mftsccs-browser 2.1.45-beta → 2.1.47-beta
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
var e={1735:(e,t,o)=>{o.d(t,{J:()=>s});var n,i=o(2830),r=o(3278),c=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class s{static incrementConcept(e){try{e&&(this.conceptsData[e]=(this.conceptsData[e]||0)+1)}catch(e){console.error("Failed on increment concept")}}static incrementConnection(e){try{e&&(this.connectionsData[e]=(this.connectionsData[e]||0)+1)}catch(e){console.error("Failed on increment connection")}}static getTopConcepts(e){return Object.entries(this.conceptsData).map((([e,t])=>[parseInt(e),t])).sort(((e,t)=>t[1]-e[1])).slice(0,e)}static getTopConnections(e){return Object.entries(this.connectionsData).map((([e,t])=>[parseInt(e),t])).sort(((e,t)=>t[1]-e[1])).slice(0,e)}static saveDataToLocalStorage(){const e={concepts:this.conceptsData,connections:this.connectionsData};null===localStorage||void 0===localStorage||localStorage.setItem(this.accessData,JSON.stringify(e))}static loadDataFromLocalStorage(){const e=null===localStorage||void 0===localStorage?void 0:localStorage.getItem(this.accessData);if(e){const t=JSON.parse(e);this.conceptsData=t.concepts||{},this.connectionsData=t.connections||{}}}static sendToServer(){return c(this,void 0,void 0,(function*(){try{yield this.syncToServer()}catch(e){console.error("Failed to process Access Tracker Sync with Server")}}))}static syncToServer(){return c(this,void 0,void 0,(function*(){try{if(!Object.keys(this.conceptsData).length&&!Object.keys(this.connectionsData).length)return;const e=r.b.BearerAccessToken;if(!e)return;const t=this.conceptsData&&Object.keys(this.conceptsData).length>0?this.conceptsData:{},o=this.connectionsData&&Object.keys(this.connectionsData).length>0?this.connectionsData:{},n=yield fetch(i.BaseUrl.PostPrefetchConceptConnections(),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:JSON.stringify({concepts:t,connections:o})});if(!n.ok)throw new Error("Failed to sync data to the server.");yield n.json(),this.conceptsData={},this.connectionsData={},this.setNextSyncTime()}catch(e){console.error("Sync error:",e)}}))}static setNextSyncTime(){this.nextSyncTime=Date.now()+this.SYNC_INTERVAL_MS}static startAutoSync(){setInterval((()=>{const e=Date.now();this.nextSyncTime&&e>=this.nextSyncTime&&this.syncNow().catch(console.error)}),6e4)}static syncNow(){return c(this,void 0,void 0,(function*(){try{this.activateStatus?yield this.syncToServer():console.warn("Access Tracker inactive.")}catch(e){console.error("Error on sync access tracker")}}))}static GetSuggestedConcepts(e){return c(this,void 0,void 0,(function*(){try{const t=r.b.BearerAccessToken,o=new URL(i.BaseUrl.GetSuggestedConcepts());void 0!==e&&o.searchParams.append("top",e.toString());const n=yield fetch(o.toString(),{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}});if(!n.ok){const e=yield n.text();throw new Error(`Failed to load concepts: ${n.status} ${n.statusText}. Details: ${e}`)}const c=(yield n.json())||[];return yield this.addConceptToBinaryTree(c.data),c}catch(e){throw e instanceof Error?(console.error("Error fetching suggested concepts:",e.message),new Error("Unable to fetch suggested concepts. Please try again later.")):(console.error("An unexpected error occurred:",e),new Error("An unexpected error occurred while fetching suggested concepts."))}}))}static GetSuggestedConnections(e){return c(this,void 0,void 0,(function*(){try{const t=r.b.BearerAccessToken,o=new URL(i.BaseUrl.GetSuggestedConnections());void 0!==e&&o.searchParams.append("top",e.toString());const n=yield fetch(o.toString(),{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}});if(!n.ok){const e=yield n.text();throw new Error(`Failed to load connections: ${n.status} ${n.statusText}. Details: ${e}`)}const c=(yield n.json())||[];return yield this.addConnectionToBinaryTree(c.data),c}catch(e){throw e instanceof Error?(console.error("Error fetching suggested Connections:",e.message),new Error("Unable to fetch suggested connections. Please try again later.")):(console.error("An unexpected error occurred:",e),new Error("An unexpected error occurred while fetching suggested Connections."))}}))}static addConceptToBinaryTree(e){return c(this,void 0,void 0,(function*(){try{e.forEach((e=>{i.ConceptsData.AddConcept(e)}))}catch(e){console.error("Error on adding Concepts Data into tree")}}))}static addConnectionToBinaryTree(e){return c(this,void 0,void 0,(function*(){try{e.forEach((e=>{i.ConnectionData.AddConnection(e)}))}catch(e){console.error("Error on adding Connections Data into tree")}}))}}n=s,s.conceptsData={},s.connectionsData={},s.SYNC_INTERVAL_MS=12e4,s.nextSyncTime=Date.now(),s.activateStatus=!1,s.accessData="Access Data",n.startAutoSync()},1167:(e,t,o)=>{o.d(t,{Y:()=>a});var n=o(9581),i=o(3518),r=o(2830),c=o(1863),s=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function a(e){return s(this,void 0,void 0,(function*(){const t=r.Logger.logfunction("CreateTheConceptApi",e);let o=(0,r.CreateDefaultConcept)();try{var s=(0,i.Xr)();const a=yield fetch(n.B.CreateTheConceptUrl(),{method:"POST",headers:s,body:JSON.stringify(e)});if(!a.ok)throw(0,c.ry)(a),new Error(`Error! status: ${a.status}`);return o=yield a.json(),r.Logger.logUpdate(t),o}catch(e){e instanceof Error?console.log("Create the concept api error message: ",e.message):console.log("Create the concept api unexpected error: ",e),(0,c.Mb)(e,n.B.CreateTheConceptUrl()),(0,c.ey)(t,"CreateTheConceptApi",e)}}))}},2:(e,t,o)=>{o.d(t,{s:()=>d});var n=o(8286),i=o(9581),r=o(1412),c=o(3518),s=o(1863),a=o(2830),l=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function d(e){var t=arguments;return l(this,void 0,void 0,(function*(){const o=a.Logger.logfunction("GetAllConnectionsOfComposition",t);var i=[];if(0==(i=yield n.d.GetConnectionsOfConcept(e)).length)i=yield u(e);else{var c=yield u(e);(0,r.e)(c,i),i=c}return a.Logger.logUpdate(o),i}))}function u(e){var t=arguments;return l(this,void 0,void 0,(function*(){const o=a.Logger.logfunction("GetAllConnectionsOfCompositionOnline",t);var r=[];try{(0,c.Xr)("application/json");const t=new Headers,d=new FormData;d.append("composition_id",e.toString());const u=yield fetch(i.B.GetAllConnectionsOfCompositionUrl(),{method:"POST",headers:t,body:d});if(console.log("this is getting connection from online",i.B.GetAllConnectionsOfCompositionUrl(),e),!u.ok)throw(0,s.ry)(u),new Error(`Error! status: ${u.status}`);const h=yield u.json();for(var l=0;l<h.length;l++)n.d.AddConnection(h[l]),r.push(h[l]);return a.Logger.logUpdate(o),r}catch(e){e instanceof Error?console.log("Get all connection of composition error : ",e.message):console.log("Get all connection of composition error : ",e),(0,s.Mb)(e,i.B.GetAllConnectionsOfCompositionUrl()),(0,s.ey)(o,"GetAllConnectionsOfCompositionOnline",e)}}))}},8642:(e,t,o)=>{o.d(t,{Y:()=>h});var n=o(8286),i=o(9581),r=o(4364),c=o(5284),s=o(1412),a=o(3518),l=o(1863),d=o(2830),u=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function h(){var e=arguments;return u(this,arguments,void 0,(function*(t=[]){const o=d.Logger.logfunction("GetAllConnectionsOfCompositionBulk",e);if(d.serviceWorker){o.serviceWorker=!0;try{const e=yield(0,d.sendMessage)("GetAllConnectionsOfCompositionBulk",{composition_ids:t});return d.Logger.logUpdate(o),e.data}catch(e){console.error("GetAllConnectionsOfCompositionBulk sw error: ",e),(0,l.ey)(o,"GetAllConnectionsOfCompositionBulk",e),(0,d.handleServiceWorkerException)(e)}}var h=[];if(t.length<=0)return h;var p=yield(0,c.B)(t),f=yield function(){var e=arguments;return u(this,arguments,void 0,(function*(t=[]){const o=d.Logger.logfunction("GetAllConnectionsOfCompositionOnline",e);var r=[];try{var c=(0,a.Xr)();const e=yield fetch(i.B.GetAllConnectionsOfCompositionBulkUrl(),{method:"POST",headers:c,body:JSON.stringify(t)});if(e.ok){const t=yield e.json();for(var s=0;s<t.length;s++)n.d.AddConnection(t[s]),r.push(t[s])}else console.log("Get all connections of composition bulk error message: ","Cannot get response"),(0,l.ry)(e);return d.Logger.logUpdate(o),r}catch(e){e instanceof Error?console.log("Get all connections of composition bulk error message: ",e.message):console.log("Get all connections of composition bulk unexpected error: ",e),(0,l.Mb)(e,i.B.GetAllConnectionsOfCompositionBulkUrl()),(0,l.ey)(o,"GetAllConnectionsOfCompositionOnline",e)}}))}(t);return h=f,(0,s.e)(h,p),yield(0,r.s)(h),d.Logger.logUpdate(o),h}))}},2803:(e,t,o)=>{o.d(t,{x:()=>a});var n=o(8286),i=o(9581),r=o(1863),c=o(2830),s=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function a(e,t,o){var a=arguments;return s(this,void 0,void 0,(function*(){const s=c.Logger.logfunction("GetCompositionConnectionsBetweenTwoConcepts",a);var l=[];try{if(c.serviceWorker){s.serviceWorker=!0;try{const n=yield(0,c.sendMessage)("GetCompositionConnectionsBetweenTwoConcepts",{ofConceptId:e,toConcept:t,mainKey:o});return c.Logger.logUpdate(s),n.data}catch(e){console.error("GetCompositionConnectionsBetweenTwoConcepts sw error: ",e),(0,r.ey)(s,"GetCompositionConnectionsBetweenTwoConcepts",e),(0,c.handleServiceWorkerException)(e)}}var d=new FormData;d.append("ofConceptId",e.toString()),d.append("mainKey",o.toString()),d.append("toConceptId",t.toString());const a=yield fetch(i.B.GetCompositionConnectionBetweenTwoConceptsUrl(),{method:"POST",body:d,redirect:"follow"});if(a.ok){const e=yield a.json();for(var u=0;u<e.length;u++)n.d.AddConnection(e[u]),l.push(e[u]);c.Logger.logUpdate(s)}else console.log("Get composition connection between two concepts",a.status),(0,r.ry)(a)}catch(e){e instanceof Error?console.log("Get composition connection between two concepts error message: ",e.message):console.log("Get composition connection between two concepts unexpected error: ",e),(0,r.Mb)(e,i.B.GetCompositionConnectionBetweenTwoConceptsUrl()),(0,r.ey)(s,"GetCompositionConnectionsBetweenTwoConcepts",e)}return l}))}},7139:(e,t,o)=>{o.d(t,{r:()=>l});var n=o(9639),i=o(9581),r=o(3518),c=o(2830),s=o(1863),a=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function l(e){var t=arguments;return a(this,void 0,void 0,(function*(){const o=c.Logger.logfunction("GetConcept",t);try{if(c.serviceWorker){o.serviceWorker=!0;try{const t=yield(0,c.sendMessage)("GetConcept",{id:e});return c.Logger.logUpdate(o),t.data}catch(e){console.error("GetConcept sw error: ",e),(0,s.ey)(o,"GetConcept",e),(0,c.handleServiceWorkerException)(e)}}let t=(0,c.CreateDefaultConcept)();if(0==e||null==e||null==e)return t;var a=yield n.I.GetConcept(e);let l=n.I.GetNpc(e);if(0!=a.id||l)return c.Logger.logUpdate(o),a;{(0,r.Xr)(),console.log("this is the url",i.B.GetConceptUrl());const a=new FormData;a.append("id",e.toString());const l=yield fetch(i.B.GetConceptUrl(),{method:"POST",body:a});return l.ok?(t=yield l.json(),t.id>0?n.I.AddConcept(t):n.I.AddNpc(e)):(console.log("Get the concept error",l.status),(0,s.ry)(l)),c.Logger.logUpdate(o),t}}catch(e){e instanceof Error?console.log("Get the concept error message: ",e.message):console.log("Get the concept unexpected error: ",e),(0,s.Mb)(e,i.B.GetConceptUrl()),(0,s.ey)(o,"GetConcept",e)}}))}},1239:(e,t,o)=>{o.d(t,{I:()=>d,r:()=>l});var n=o(9639),i=o(9581),r=o(3518),c=o(1863),s=o(2830),a=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function l(e){return a(this,void 0,void 0,(function*(){const t=s.Logger.logfunction("GetConceptBulk",[e.length]);let o=[],a=((new Date).getTime(),performance.now()),l=Array.from(new Set(e));try{if(s.serviceWorker){t.serviceWorker=!0;try{const o=yield(0,s.sendMessage)("GetConceptBulk",{passedConcepts:e});return s.Logger.logUpdate(t),o.data}catch(e){console.error("GetConceptBulk sw error: ",e),(0,c.ey)(t,"GetConceptBulk",e),(0,s.handleServiceWorkerException)(e)}}if(l.length>0){let d=[];for(let e=0;e<l.length;e++)0==(yield n.I.GetConcept(l[e])).id&&d.push(l[e]);if(0==d.length)return s.Logger.logfunction(t),o;{let l=(0,r.Xr)();const u=yield fetch(i.B.GetConceptBulkUrl(),{method:"POST",headers:l,body:JSON.stringify(d)});if(u.ok){if(o=yield u.json(),o.length>0)for(let e=0;e<o.length;e++){let t=o[e];n.I.AddConcept(t)}console.log("added the concepts"),s.Logger.logUpdate(t)}else console.log("Get Concept Bulk error",u.status),s.Logger.logError(a,"unknown","read","unknown",void 0,u.status,u,"GetConceptBulk",[e],"unknown",void 0),(0,c.ry)(u)}}}catch(o){o instanceof Error?console.log("Get Concept Bulk error message: ",o.message):console.log("Get Concept Bulk unexpected error: ",o),s.Logger.logError(a,"unknown","read","unknown",void 0,500,o,"GetConceptBulk",[e],"unknown",void 0),(0,c.Mb)(o,i.B.GetConceptBulkUrl()),(0,c.ey)(t,"GetConceptBulk",o)}return o}))}function d(e){return a(this,void 0,void 0,(function*(){const t=[];if(e.length>0){const o={"Content-Type":"application/json"};try{const r=yield fetch(i.B.GetConceptBulkUrl(),{method:"POST",headers:o,body:JSON.stringify(e)});if(r.ok){const e=yield r.json();if(e.length>0)for(let o=0;o<e.length;o++){const i=e[o];t.push(i),n.I.AddConcept(i)}}else console.log("bulk concept getter api error: ",r.status),(0,c.ry)(r)}catch(e){e instanceof Error?console.log("bulk concept getter api error: ",e.message):console.log("bulk concept getter api error: ",e),(0,c.Mb)(e,i.B.GetConceptBulkUrl())}}return t}))}},4402:(e,t,o)=>{o.d(t,{A:()=>l});var n=o(9639),i=o(9581),r=o(3518),c=o(1863),s=o(2830),a=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function l(e,t){var o=arguments;return a(this,void 0,void 0,(function*(){const a=s.Logger.logfunction("GetConceptByCharacterAndType",o);try{if(s.serviceWorker)try{return(yield(0,s.sendMessage)("GetConceptByCharacterAndType",{characterValue:e,typeId:t})).data}catch(e){console.error("GetConceptByCharacterAndType sw error: ",e),(0,s.handleServiceWorkerException)(e)}let o=yield n.I.GetConceptByCharacterAndTypeLocal(e,t);if(null==o||0==o.id){var l={character_value:`${e}`,type_id:t},d=JSON.stringify(l),u=(0,r.Xr)();const s=yield fetch(i.B.GetConceptByCharacterAndTypeUrl(),{method:"POST",headers:u,body:d});s.ok?(o=yield s.json(),n.I.AddConcept(o)):((0,c.ry)(s),console.log("This is the concept by type and character error",s.status))}return s.Logger.logUpdate(a),o}catch(e){e instanceof Error?console.log(" This is the concept by type and character error message: ",e.message):console.log(" This is the concept by type and character unexpected error: ",e),(0,c.Mb)(e,i.B.GetConceptByCharacterAndTypeUrl()),(0,c.ey)(a,"GetConceptByCharacterAndType",e)}}))}},8146:(e,t,o)=>{o.d(t,{Y:()=>a});var n=o(9639),i=o(9581),r=o(2830),c=o(1863),s=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function a(e){var t=arguments;return s(this,void 0,void 0,(function*(){const o=r.Logger.logfunction("GetConceptByCharacterValue",t);let s=(0,r.CreateDefaultConcept)();try{const t=new FormData;t.append("character_value",e);const a=yield fetch(i.B.GetConceptByCharacterValueUrl(),{method:"POST",body:t});a.ok?(s=yield a.json(),s.id>0&&n.I.AddConcept(s),r.Logger.logUpdate(o)):((0,c.ry)(a),console.log("Error in Getting concept by character value Error",a.status))}catch(e){e instanceof Error?console.log("Error in Getting concept by character value error message: ",e):console.log("Error in Getting concept by character value unexpected error: ",e),(0,c.Mb)(e,i.B.GetConceptByCharacterValueUrl()),(0,c.ey)(o,"GetConceptByCharacterValue",e)}return s}))}},7467:(e,t,o)=>{o.d(t,{j:()=>d});var n=o(8286),i=o(9581),r=o(4364),c=o(3518),s=o(1863),a=o(2830),l=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function d(){return l(this,arguments,void 0,(function*(e=[]){const t=a.Logger.logfunction("GetConnectionBulk",e.length);let o=[];try{if(a.serviceWorker){t.serviceWorker=!0;try{const o=yield(0,a.sendMessage)("GetConnectionBulk",{connectionIds:e});return a.Logger.logUpdate(t),o.data}catch(e){console.error("GetConnectionBulk sw error: ",e),(0,s.ey)(t,"GetConnectionBulk",e),(0,a.handleServiceWorkerException)(e)}}if(e.length>0){let r=[];for(let t=0;t<e.length;t++){let i=yield n.d.GetConnection(e[t]);0==i.id?r.push(e[t]):o.push(i)}if(0==r.length)return a.Logger.logUpdate(t),o;{let e=(0,c.Xr)();const l=yield fetch(i.B.GetConnectionBulkUrl(),{method:"POST",headers:e,body:JSON.stringify(r)});if(l.ok){const e=yield l.json();if(e.length>0)for(let t=0;t<e.length;t++){let i=e[t];o.push(i),n.d.AddConnection(i)}}else(0,s.ey)(t,"GetConnectionBulk",l.status),(0,s.ry)(l),console.log("Get Connection Bulk error",l.status);a.Logger.logUpdate(t)}}}catch(e){e instanceof Error?console.log("Get Connection Bulk error message: ",e):console.log("Get Connection Bulk unexpected error: ",e),(0,s.ey)(t,"GetConnectionBulk",e),(0,s.Mb)(e,i.B.GetConnectionBulkUrl())}return yield(0,r.s)(o),o}))}},2832:(e,t,o)=>{o.d(t,{j:()=>a});var n=o(2830),i=o(9581),r=o(1863),c=o(3518),s=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function a(e){var t=arguments;return s(this,arguments,void 0,(function*(e,o=""){const s=n.Logger.logfunction("SearchLinkMultipleApi",t);let a=performance.now();var l=(0,c.ab)("application/json",o);const d=i.B.SearchLinkMultipleAllApiUrl(),u=JSON.stringify(e);try{const t=yield fetch(d,{method:"POST",headers:l,body:u});if(t.ok){let e=yield t.json();return n.Logger.logUpdate(s),e}return(0,r.ry)(t),console.log("This is the searching multiple error",t.status),n.Logger.logError(a,"unknown","search","unknown",void 0,t.status,t,"SearchLinkMultipleApi",[e,o],"unknown",void 0),[]}catch(t){console.log("This is the searching multiple error",t),n.Logger.logError(a,"unknown","search","unknown",void 0,500,t,"SearchLinkMultipleApi",[e,o],"unknown",void 0),(0,r.Mb)(t,d),(0,r.ey)(s,"SearchLinkMultipleApi",t)}}))}},3130:(e,t,o)=>{o.d(t,{BG:()=>a,SL:()=>l,XZ:()=>s,ZJ:()=>r,iw:()=>c,y0:()=>i,yv:()=>n});const n=1,i=2,r=3,c=4,s=5,a=6,l=7},9635:(e,t,o)=>{o.d(t,{x:()=>n});const n=new BroadcastChannel("Freeschema_mftsccs_browser_channel")},9581:(e,t,o)=>{o.d(t,{B:()=>n});class n{static setRandomizer(e){console.log("set randomizer",e),this.BASE_RANDOMIZER=e}static getRandomizer(){return this.BASE_RANDOMIZER}static GetConceptUrl(){return this.BASE_URL+"/api/getConcept"}static GetConnectionUrl(){return this.BASE_URL+"/api/get-connection-by-id"}static GetConceptBulkUrl(){return this.BASE_URL+"/api/get_concept_bulk"}static GetConnectionBulkUrl(){return this.BASE_URL+"/api/get_connection_bulk"}static GetAllConceptsOfUserUrl(){return this.BASE_URL+"/api/get_all_concepts_of_user"}static GetAllConnectionsOfUserUrl(){return this.BASE_URL+"/api/get_all_connections_of_user"}static GetAllConnectionsOfCompositionUrl(){return this.BASE_URL+"/api/get_all_connections_of_composition"}static GetAllConnectionsOfCompositionBulkUrl(){return this.BASE_URL+"/api/get_all_connections_of_composition_bulk"}static GetConceptByCharacterValueUrl(){return this.BASE_URL+"/api/get_concept_by_character_value"}static GetConceptByCharacterAndTypeUrl(){return this.BASE_URL+"/api/get_concept_by_character_and_type"}static GetConceptByCharacterAndCategoryUrl(){return this.BASE_URL+"/api/get_concept_by_character_and_category"}static GetConceptByCharacterAndCategoryDirectUrl(){return this.BASE_URL+"/api/get_concept_by_character_and_category_direct"}static GetCharacterByCharacterUrl(){return this.BASE_URL+"/api/get_character_by_character"}static GetAllConceptsByTypeUrl(){return this.BASE_URL+"/api/get_all_concepts_by_type"}static GetAllConnectionsOfConceptUrl(){return this.BASE_URL+"/api/get-link-connections"}static GetAllAiData(){return this.BASE_URL+"/api/get-preloaded-concepts"}static PostPrefetchConceptConnections(){return this.NODE_URL+"/api/v1/access-tracker/sync-access-tracker"}static GetSuggestedConcepts(){return this.NODE_URL+"/api/v1/access-tracker/list-concepts-file"}static GetSuggestedConnections(){return this.NODE_URL+"/api/v1/access-tracker/list-connections-file"}static PostLogger(){return this.LOG_SERVER+"/api/logger"}static GetAllPrefetchConnectionsUrl(){return this.BASE_URL+"/api/get_all_connections_of_user?inpage=500"}static GetAllLinkerConnectionOfConceptUrl(){return this.BASE_URL+"/api/get-all-linkers-from-concept"}static GetAllLinkerConnectionToConceptUrl(){return this.BASE_URL+"/api/get-all-linkers-to-concept"}static DeleteConceptUrl(){return this.BASE_URL+"/api/delete_concept"}static DeleteUserUrl(){return this.BASE_URL+"/api/deleteuser"}static RecursiveSearchUrl(){return this.BASE_URL+"/api/recursivesearch-concept-connection"}static SearchLinkMultipleAllApiUrl(){return this.BASE_URL+"/api/Connection/search-link-multiple-all-ccs"}static MakeTheNameInBackendUrl(){return this.BASE_URL+"/api/make-name-from-frontend"}static SearchAllTypeWithLinker(e=!0){return e?this.BASE_URL+"/api/search-all-with-linker-ccs":this.BASE_URL+"/api-search-compositions-internal-clean-ccs"}static LoginUrl(){return this.BASE_URL+"/api/auth/login"}static SignupUrl(){return this.BASE_URL+"/api/auth/signup"}static GetCompositionConnectionBetweenTwoConceptsUrl(){return this.BASE_URL+"/api/get-composition-connection-between-two-concepts"}static SearchCompositionsUrl(){return this.BASE_URL+"/api/search-compositions"}static SearchLinkMultipleAll(){return this.BASE_URL+"/api/Connection/search-link-multiple-all"}static CreateSessionId(){return this.BASE_URL+"/api/create-session-id-remote"}static CreateSessionVisitUrl(){return this.BASE_URL+"/api/create-remote-session-visit"}static ViewInternalDataUrl(){return this.BASE_URL+"/api/view-api-internal-data-ccs-id-bulk"}static SearchInternalWithAuthenticatedCcsUrl(){return this.BASE_URL+"/api/search-composition-internal-authenticated-ccs"}static SearchInternalWithCcsUrl(){return this.BASE_URL+"/api-search-compositions-internal-clean-ccs"}static CreateGhostConceptApiUrl(){return n.NODE_URL+"/api/v1/local-concepts"}static CreateGhostConnectionApiUrl(){return n.NODE_URL+"/api/v1/local-connections"}static GetRealConceptById(){return n.NODE_URL+"/api/v1/local-concepts-translate"}static GetReservedIdUrl(){return this.BASE_URL+"/api/get_reserved_ids"}static GetReservedConnectionIdUrl(){return this.BASE_URL+"/api/get_reserved_connection_ids"}static CreateTheTextDataUrl(){return this.BASE_URL+"/api/create_text_data"}static CreateTheCharacterDataUrl(){return this.BASE_URL+"/api/create_character_data"}static CreateTheConceptUrl(){return this.BASE_URL+"/api/create_the_concept"}static CreateTheConnectionUrl(){return this.BASE_URL+"/api/create_the_connection"}static CreateTheConnectionNewUrl(){return this.BASE_URL+"/api/create_the_connection_new"}static MakeTheTypeConceptUrl(){return this.BASE_URL+"/api/make_the_type_concept"}static DeleteTheConnectionUrl(){return this.BASE_URL+"/api/delete_connection"}static FreeschemaQueryUrl(){return this.BASE_URL+"/api/freeschema-query"}static uploadImageUrl(){return this.BASE_URL+"/api/Image/UploadImage"}static uploadFileUrl(){return this.BASE_URL+"/api/Image/UploadFile"}static sendMail(){return this.BASE_URL+"/api/sendmail"}static sendBulkMail(){return this.BASE_URL+"/api/sendmail/bulk"}static getWidgetData(){return this.BASE_URL+"/api/get-widget"}}n.BASE_URL="https://localhost:7053/",n.AI_URL="https://ai.freeschema.com",n.MQTT_URL="192.168.1.249",n.NODE_URL="http://localhost:5001",n.LOG_SERVER="https://logdev.freeschema.com",n.BASE_APPLICATION="",n.FLAGS={logApplication:!1,logPackage:!1,accessTracker:!1,isTest:!1},n.BASE_RANDOMIZER=999},6963:(e,t,o)=>{o.d(t,{f:()=>c});var n=o(205),i=o(6731),r=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class c{static waitForDataToLoad(){return r(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(n.B.isCharacterLoaded)return e("done");setTimeout(c.checkFlag,1e3,e)}static addNodeToTree(e){return r(this,void 0,void 0,(function*(){return null==this.characterRoot?(this.characterRoot=e,this.characterRoot):(this.characterRoot=this.characterRoot.addCharacterNode(e,this.characterRoot,this.characterRoot.height),this.characterRoot)}))}static removeNodeByCharacter(e,t){return r(this,void 0,void 0,(function*(){this.characterRoot&&this.characterRoot.removeNodeWithVariants(this.characterRoot,e,t)}))}static countNumberOfNodes(){return this.characterRoot?this.characterRoot.countNodeBelow(this.characterRoot):0}static addConceptToTree(e){if(""!=e.characterValue){var t=new i.b(e.characterValue,e,null,null);this.addNodeToTree(t)}}static getNodeFromTree(e){return this.characterRoot?this.characterRoot.getCharacterFromNode(e,this.characterRoot):this.characterRoot}static getNodeFromTreeUpdated(e){return this.characterRoot?this.characterRoot.getCharacterFromNode(e,this.characterRoot):this.characterRoot}static getCharacterAndTypeFromTree(e,t){return r(this,void 0,void 0,(function*(){return this.characterRoot?this.characterRoot.getFromNodeWithCharacterAndType(e,t,this.characterRoot):this.characterRoot}))}static getCharacterAndCategoryFromTree(e,t){return r(this,void 0,void 0,(function*(){return this.characterRoot?this.characterRoot.getFromNodeWithCharacterAndCategory(e,t,this.characterRoot):this.characterRoot}))}static removeConceptCharacter(e){this.characterRoot&&(this.characterRoot=this.characterRoot.removeNode(this.characterRoot,e))}}c.characterRoot=null},2202:(e,t,o)=>{o.d(t,{W:()=>a});var n=o(6963),i=o(6731),r=o(205),c=o(2830),s=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class a{static addNodeToTree(e){if(null==this.root)return this.root=e,this.root;this.root=this.root.addNode(e,this.root,this.root.height)}static waitForDataToLoad(){return s(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(r.B.isDataLoaded)return e("done");setTimeout(a.checkFlag,1e3,e)}static addConceptToTree(e){let t=new i.b(e.id,e,null,null),o=new i.b(e.characterValue,e,null,null);n.f.addNodeToTree(o),this.addNodeToTree(t)}static getNodeFromTree(e){return s(this,void 0,void 0,(function*(){return this.root?this.root.getFromNode(e,this.root):null}))}static removeNodeFromTree(e){return s(this,void 0,void 0,(function*(){if(this.root){let t=new Event(`${e}`);console.log("this is the fired event after delete",t),(0,c.dispatchIdEvent)(e),this.root=this.root.removeNode(this.root,e)}}))}static getConceptListFromIds(e,t,o){return s(this,void 0,void 0,(function*(){this.root&&this.root.checkIfIdsInNode(this.root,e,t,o)}))}static countNumberOfNodes(){return this.root?this.root.countNodeBelow(this.root):0}}a.root=null},5457:(e,t,o)=>{o.d(t,{c:()=>a});var n=o(2830),i=o(7282),r=o(205);class c{constructor(e,t){this.value=[],this.height=1,this.key=e,this.value.push(t),this.leftNode=null,this.rightNode=null,this.currentNode=null}addType(e,t,o){var n,i,r,s;if(null==e)return new c(t,o);if(t<e.key)e.leftNode=this.addType(e.leftNode,t,o);else{if(!(t>e.key))return e.value.push(o),e;e.rightNode=this.addType(e.rightNode,t,o)}e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1;const a=this.getBalanceFactor(e);return a>1&&t<(null===(n=e.leftNode)||void 0===n?void 0:n.key)?this.rightRotate(e):a<-1&&t>(null===(i=e.rightNode)||void 0===i?void 0:i.key)?this.leftRotate(e):a>1&&t>(null===(r=e.leftNode)||void 0===r?void 0:r.key)?(e.leftNode=this.leftRotate(e.leftNode),this.rightRotate(e)):a<-1&&t<(null===(s=e.rightNode)||void 0===s?void 0:s.key)?(e.rightNode=this.rightRotate(e.rightNode),this.leftRotate(e)):e}rightRotate(e){if(e){let t=e.leftNode;if(t){let o=t.rightNode;return e.leftNode=o,t.rightNode=e,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode))+1,t}}return e}leftRotate(e){if(e){let t=e.rightNode;if(t){let o=t.leftNode;return t.leftNode=e,e.rightNode=o,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(e.rightNode))+1,t}}return e}getHeight(e){return e?e.height:0}getBalanceFactor(e){return null==e?0:this.getHeight(e.leftNode)-this.getHeight(e.rightNode)}getFromNode(e,t){return t?e==t.key?t:e<t.key?this.getFromNode(e,t.leftNode):e>t.key?this.getFromNode(e,t.rightNode):t:t}removeNodeWithVariants(e,t,o){if(null==e)return e;if(e.key>t)return e.leftNode=this.removeNodeWithVariants(e.leftNode,t,o),e;if(e.key<t)return e.rightNode=this.removeNodeWithVariants(e.rightNode,t,o),e;if(e.value.length>0)for(let t=0;t<e.value.length;t++)if(o==e.value[t])return e.value.splice(t,1),e;if(null==e.leftNode){let t=e.rightNode;return e=null,t}if(null==e.rightNode){let t=e.leftNode;return e=null,t}{let t=this.inOrderSuccessor(e.rightNode);return e.value=t.value,e.key=t.key,e.currentNode=t.currentNode,e.rightNode=this.removeNodeWithVariants(e.rightNode,t.key,o),e}}countNodeBelow(e){return null==e?0:1+this.countNodeBelow(e.leftNode)+this.countNodeBelow(e.rightNode)}inOrderSuccessor(e){for(;null!=e.leftNode;)e=e.leftNode;return e}}var s=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class a{static addType(e){return s(this,void 0,void 0,(function*(){return null==this.root?(this.root=e,new CustomEvent(`${e.key}`,{detail:e.value[0]}),(0,n.dispatchIdEvent)(e.key,{detail:e.value[0]}),this.root):(new CustomEvent(`${e.key}`,{detail:e.value[0]}),(0,n.dispatchIdEvent)(e.key,{detail:e.value[0]}),this.root=this.root.addType(this.root,e.key,e.value[0]),this.root)}))}static addConceptToTree(e){if(0!=e.typeId){let t=new c(e.typeId,e.id);this.addType(t)}}static removeTypeConcept(e,t){this.root&&(this.root=this.root.removeNodeWithVariants(this.root,e,t))}static getNodeFromTreeNew(e){return this.root?this.root.getFromNode(e,this.root):this.root}static getTypeVariantsFromTreeNew(e){return s(this,void 0,void 0,(function*(){let t=this.getNodeFromTreeNew(e),o=[],i=[];if(t){o=t.value;for(let e=0;e<o.length;e++){let t=!1;for(let n=0;n<i.length;n++)i[n].id==o[e]&&(t=!0);t||i.push(yield(0,n.GetTheConcept)(o[e]))}}return i}))}static waitForDataToLoad(){return s(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(r.B.isTypeLoaded)return e("done");setTimeout(a.checkFlag,1e3,e)}static getTypeVariantsFromTreeWithUserIdNew(e,t){return s(this,void 0,void 0,(function*(){let o=[],n=yield this.getTypeVariantsFromTreeNew(e);console.log("these are all the concepts",n);for(let e=0;e<n.length;e++)n[e].userId==t&&o.push(n[e]);return o}))}static getTypeVariantsWithCharacterValueNew(e,t){return s(this,void 0,void 0,(function*(){let o=yield this.getTypeVariantsFromTreeNew(t);console.log("this is all the concepts for character",o);let n=(0,i.o)();for(let t=0;t<o.length;t++)o[t].characterValue==e&&(n=o[t]);return n}))}static countNumberOfNodes(){return this.typeRoot?this.typeRoot.countNodeBelow(this.typeRoot):0}}a.typeRoot=null,a.root=null},2615:(e,t,o)=>{o.d(t,{j:()=>i});var n=o(2830);class i{constructor(e,t,o,i,r,c,s,a=!1,l,d,u){this.count=0,this.typeCharacter="",this.isComposition=!1,this.isTemp=!1,this.isSynced=!1,this.applicationId=n.BaseUrl.getRandomizer(),this.x=0,this.y=0,this.id=e,this.userId=t,this.typeId=o,this.ghostId=e,this.categoryId=i,this.referentId=r,this.characterValue=`${c}`,this.accessId=s,this.typeCharacter=u,this.type=null,this.isNew=a,this.entryTimeStamp=l,this.updatedTimeStamp=d}getType(){console.log(this.typeId)}}},9639:(e,t,o)=>{o.d(t,{I:()=>d});var n=o(3655),i=o(2202),r=o(6963),c=o(5457),s=o(7282),a=o(2830),l=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class d{constructor(){this.name="conceptsArray"}static CheckContains(e){for(var t=!1,o=0;o<this.conceptsArray.length;o++)this.conceptsArray[o].id==e.id&&(t=!0);return t}static AddNpc(e){this.NPC.includes(e)||(this.NPC.length>10&&(this.NPC=[]),this.NPC.push(e))}static GetNpc(e){return!!this.NPC.includes(e)}static AddConceptToStorage(e){e.id>0&&(0,n.kH)("concept",e)}static GetConceptBulkData(e,t,o){return l(this,void 0,void 0,(function*(){yield i.W.getConceptListFromIds(e,t,o)}))}static AddConcept(e){if(a.serviceWorker)try{(0,a.sendMessage)("ConceptsData__AddConcept",{concept:e})}catch(e){console.error("Concept Data, Add Concpet sw error: ",e),(0,a.handleServiceWorkerException)(e)}e.id>0&&(i.W.addConceptToTree(e),c.c.addConceptToTree(e))}static AddConceptToMemory(e){e.id>0&&(i.W.addConceptToTree(e),c.c.addConceptToTree(e))}static AddConceptTemporary(e){var t=this.CheckContains(e);this.conceptDictionary[e.id]=e,t&&this.RemoveConcept(e),this.conceptsArray.push(e)}static RemoveConcept(e){for(var t=0;t<this.conceptsArray.length;t++)this.conceptsArray[t].id==e.id&&this.conceptsArray.splice(t,1);(0,n.wh)("concept",e.id)}static GetConcept(e){return l(this,void 0,void 0,(function*(){if(a.serviceWorker)try{return(yield(0,a.sendMessage)("ConceptsData__GetConcept",{id:e})).data}catch(e){console.error("Concept Data, Get Concpet sw error: ",e),(0,a.handleServiceWorkerException)(e)}if(0==e||null==e||null==e)return(0,s.o)();var t=(0,s.o)(),o=yield i.W.getNodeFromTree(e);if(null==o?void 0:o.value){var n=o.value;n&&(t=n)}return t}))}static GetConceptByCharacter(e){return l(this,void 0,void 0,(function*(){var t=(0,s.o)(),o=r.f.getNodeFromTree(e);return o&&(t=o.value),t}))}static GetConceptByCharacterUpdated(e){return l(this,void 0,void 0,(function*(){var t=(0,s.o)(),o=r.f.getNodeFromTree(e);return o&&(t=o.value),t}))}static GetConceptByCharacterAndTypeLocal(e,t){return l(this,void 0,void 0,(function*(){return(0,s.o)(),yield c.c.getTypeVariantsWithCharacterValueNew(e,t)}))}static GetConceptByCharacterAndCategoryLocal(e,t){return l(this,void 0,void 0,(function*(){var o=(0,s.o)(),n=yield r.f.getCharacterAndCategoryFromTree(e,t);return n&&(o=n.value),o}))}static GetConceptsByTypeId(e){let t=[];for(var o=0;o<this.conceptsArray.length;o++)this.conceptsArray[o].typeId==e&&t.push(this.conceptsArray[o]);return t}static GetConceptsByTypeIdAndUser(e,t){var o=arguments;return l(this,void 0,void 0,(function*(){if(a.Logger.logfunction("ConceptsData.GetConceptsByTypeIdAndUser",o),a.serviceWorker)try{return(yield(0,a.sendMessage)("ConceptsData__GetConceptsByTypeIdAndUser",{typeId:e,userId:t})).data}catch(e){console.error("Concept Data, Get Concpet sw error:",e),(0,a.handleServiceWorkerException)(e)}let n=[];return n=yield c.c.getTypeVariantsFromTreeWithUserIdNew(e,t),n}))}static GetBinaryCharacterTree(){return r.f.characterRoot}getName(){return this.name}}d.conceptsArray=[],d.NPC=[],d.conceptDictionary=[]},2155:(e,t,o)=>{o.d(t,{N:()=>r});var n=o(7282),i=o(9581);class r{constructor(e=0,t,o,r,c,s,a){this.count=0,this.isTemp=!1,this.toUpdate=!1,this.applicationId=i.B.getRandomizer(),this.type=(0,n.o)(),this.ofConcept=(0,n.o)(),this.toConcept=(0,n.o)(),this.id=e,this.ofTheConceptId=t,this.toTheConceptId=o,this.userId=r,this.typeId=c,this.ghostId=e,this.orderId=s,this.accessId=a,this.entryTimeStamp=new Date,this.terminationDateTime=new Date,this.localSyncTime=new Date,this.typeCharacter=""}}},5239:(e,t,o)=>{o.d(t,{O:()=>s});var n=o(205),i=o(2830);class r{constructor(e,t,o,n){this.leftNode=null,this.rightNode=null,this.variants=[],this.height=1,this.key=e,this.value=t,this.leftNode=o,this.rightNode=n,this.currentNode=null}addCurrentNode(e,t){return null==t?t=e:(e.value.typeId!=t.value.typeId&&(t.currentNode=this.addCurrentNode(e,t.currentNode)),t)}addCurrentNodeType(e,t){if(null==t)return e;let o=!1;e.value.id==t.value.id&&(o=!0);for(let n=0;n<t.variants.length;n++)t.variants[n].value.id==e.value.id&&(o=!0);return o||t.variants.push(e),t}getMax(e,t){return e>t?e:t}addNode(e,t,o){if(null==t)return e;let n=t.leftNode,i=t.rightNode;if(e.key<t.key)t.leftNode=this.addNode(e,n,o);else{if(!(e.key>t.key))return t;t.rightNode=this.addNode(e,i,o)}t.height=1+this.getMax(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let r=this.getBalanceFactor(t);if(r>1&&t.leftNode){if(this.getBalanceFactor(t.leftNode)>=0)return this.rightRotate(t);if(this.getBalanceFactor(t.leftNode)<0)return t.leftNode=this.leftRotate(t.leftNode),this.rightRotate(t)}if(r<-1&&t.rightNode){if(this.getBalanceFactor(t.rightNode)<=0)return this.leftRotate(t);if(this.getBalanceFactor(t.rightNode)>0)return t.rightNode=this.rightRotate(t.rightNode),this.leftRotate(t)}return t}addTypeNode(e,t,o){if(0!=e.value.typeId){if(null==t)return e;let n=t.leftNode,i=t.rightNode;if(t.key>e.key)t.leftNode=this.addTypeNode(e,n,o);else{if(!(t.key<e.key))return t.key==e.key&&0!=t.key&&t.addCurrentNodeType(e,t),t;t.rightNode=this.addTypeNode(e,i,o)}t.height=1+this.getMax(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let r=this.getBalanceFactor(t);if(r>1&&t.leftNode){if(e.key<t.leftNode.key){return this.rightRotate(t)}if(e.key>t.leftNode.key){return t.leftNode=this.leftRotate(t.leftNode),this.rightRotate(t)}}if(r<-1&&t.rightNode){if(e.key>t.rightNode.key){return this.leftRotate(t)}if(e.key<t.rightNode.key){return t.rightNode=this.rightRotate(t.rightNode),this.leftRotate(t)}}}return t}rightRotate(e){if(e){let t=e.leftNode;if(t){let o=t.rightNode;return e.leftNode=o,t.rightNode=e,e.height=this.getMax(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=this.getMax(this.getHeight(t.leftNode),this.getHeight(t.rightNode))+1,t}throw console.log("this is the error in right rotation",e,t),new Error("Cannot perform right rotation: left node is null.")}return e}leftRotate(e){if(e){let t=e.rightNode;if(t){let o=t.leftNode;return t.leftNode=e,e.rightNode=o,e.height=this.getMax(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=this.getMax(this.getHeight(t.leftNode),this.getHeight(e.rightNode))+1,t}throw console.log("this is the error in left rotation",e,t),new Error("Cannot perform left rotation: right node is null.")}return e}getHeight(e){return e?e.height:0}getBalanceFactor(e){return null==e?0:this.getHeight(e.leftNode)-this.getHeight(e.rightNode)}getFromNode(e,t){try{if(t)return e==t.key?(t.value.count?t.value.count++:t.value.count=1,t):e<t.key?this.getFromNode(e,t.leftNode):e>t.key?this.getFromNode(e,t.rightNode):t}catch(o){console.log("this is the exception",e,t,null==t?void 0:t.leftNode,null==t?void 0:t.rightNode)}return t}getCharacterFromNode(e,t){return t?e==t.key?t:e<t.key?this.getCharacterFromNode(e,t.leftNode):e>t.key?this.getCharacterFromNode(e,t.rightNode):t:t}checkIfIdsInNode(e,t,o,n){if(e){if(t.includes(e.key)){o.push(e.value);let n=t.indexOf(e.key);t.splice(n,1)}e.leftNode&&this.checkIfIdsInNode(e.leftNode,t,o,n),e.rightNode&&this.checkIfIdsInNode(e.rightNode,t,o,n)}}traverse(e){let t=0;return e&&(t+=1,(null==e?void 0:e.leftNode)&&(t+=this.traverse(e.leftNode)),e.rightNode&&(t+=this.traverse(e.rightNode))),t}removeNode(e,t){if(null==e)return e;if(e.key>t)return e.leftNode=this.removeNode(e.leftNode,t),e;if(e.key<t)return e.rightNode=this.removeNode(e.rightNode,t),e;if(new Event(`${e.value.ofTheConceptId}`),(0,i.dispatchIdEvent)(e.value.ofTheConceptId),null==e.leftNode){let t=e.rightNode;return e=null,t}if(null==e.rightNode){let t=e.leftNode;return e=null,t}{let t=this.inOrderSuccessor(e.rightNode);return e.value=t.value,e.key=t.key,e.variants=t.variants,e.currentNode=t.currentNode,e.rightNode=this.removeNode(e.rightNode,t.key),e}}removeNodeWithVariants(e,t,o){if(null==e)return e;if(e.key>t)return e.leftNode=this.removeNodeWithVariants(e.leftNode,t,o),e;if(e.key<t)return e.rightNode=this.removeNodeWithVariants(e.rightNode,t,o),e;if(e.variants.length>0)if(e.value.id==o){let t=e.variants[0];if(t)return e.value=t.value,e.key=t.key,e.currentNode=t.currentNode,e.variants.splice(0,1),e}else for(let t=0;t<e.variants.length;t++)if(o==e.variants[t].value.id)return e.variants.splice(t,1),e;if(null==e.leftNode){let t=e.rightNode;return e=null,t}if(null==e.rightNode){let t=e.leftNode;return e=null,t}{let t=this.inOrderSuccessor(e.rightNode);return e.value=t.value,e.key=t.key,e.variants=t.variants,e.currentNode=t.currentNode,e.rightNode=this.removeNodeWithVariants(e.rightNode,t.key,o),e}}inOrderSuccessor(e){for(;null!=e.leftNode;)e=e.leftNode;return e}}var c=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class s{static addNodeToTree(e){try{if(null==this.connectionroot)return this.connectionroot=e,this.connectionroot;this.connectionroot=this.connectionroot.addNode(e,this.connectionroot,this.connectionroot.height)}catch(e){throw console.log("This is the error in making the tree",e),e}}static addConnectionToTree(e){let t=new r(e.id,e,null,null);this.addNodeToTree(t)}static traverse(){var e;return null===(e=this.connectionroot)||void 0===e?void 0:e.traverse(this.connectionroot)}static waitForDataToLoad(){return c(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(n.B.isConnectionLoaded)return e("done");setTimeout(s.checkFlag,1e3,e)}static removeNodeFromTree(e){return c(this,void 0,void 0,(function*(){this.connectionroot&&(this.connectionroot=this.connectionroot.removeNode(this.connectionroot,e))}))}static getNodeFromTree(e){return c(this,void 0,void 0,(function*(){try{return this.connectionroot?this.connectionroot.getFromNode(e,this.connectionroot):this.connectionroot}catch(t){console.log("this is the getNodeFromTree",e,this.connectionroot)}}))}static getConnectionListFromIds(e,t,o){return c(this,void 0,void 0,(function*(){this.connectionroot&&this.connectionroot.checkIfIdsInNode(this.connectionroot,e,t,o)}))}}s.connectionroot=null},991:(e,t,o)=>{o.d(t,{H:()=>s});var n=o(2830),i=o(3996);class r extends i.i{constructor(e,t,o,n){super(e,t,o,n),this.key="",this.value=[],this.height=1,this.key=e,this.value=t,this.leftNode=o,this.rightNode=n}addNode(e,t,o){if(null==t)return e;let n=t.leftNode,i=t.rightNode;if(t.key>e.key)t.leftNode=this.addNode(e,n,o);else{if(!(t.key<e.key))return t;t.rightNode=this.addNode(e,i,o)}t.height=1+Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let r=this.getBalanceFactor(t);if(r>1&&t.leftNode){if(this.getBalanceFactor(t.leftNode)>=0)return this.rightRotate(t);if(this.getBalanceFactor(t.leftNode)<0)return t.leftNode=this.leftRotate(t.leftNode),this.rightRotate(t)}if(r<-1&&t.rightNode){if(this.getBalanceFactor(t.rightNode)<=0)return this.leftRotate(t);if(this.getBalanceFactor(t.rightNode)>0)return t.rightNode=this.rightRotate(t.rightNode),this.leftRotate(t)}return t}}var c=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class s{static CreateCompositionKey(e,t){return e}static GetConnectionByOfTheConceptAndTypeId(e,t){let o=this.CreateCompositionKey(e,t);if(this.node){let e=this.node.getFromNode(o,this.node);if(e)return e.value}return null}static addConnection(e){if(e.id>0){let t=this.CreateCompositionKey(e.ofTheConceptId,e.typeId);if(this.node){let o=this.node.getFromNode(t,this.node);if(o){let t=null==o?void 0:o.value;0==t.length&&(o.value=[]),t.includes(e.id)||t.push(e.id)}else{let o=[];o.push(e.id);let n=new r(t,o,null,null);this.addNodeToTree(n)}}else{let o=[];o.push(e.id);let n=new r(t,o,null,null);this.addNodeToTree(n)}new Event(`${t}`)}else console.log("cannot insert key id with n 0 to the connection tree",e)}static addNodeToTree(e){return c(this,void 0,void 0,(function*(){return null==this.node?(this.node=e,(0,n.dispatchIdEvent)(e.key),this.node):(this.node=this.node.addNode(e,this.node,this.node.height),this.node)}))}static removeNodeFromTree(e){return c(this,void 0,void 0,(function*(){this.node&&(this.node=this.node.removeNode(this.node,e))}))}}s.node=null},3996:(e,t,o)=>{o.d(t,{i:()=>n});class n{constructor(e,t,o,n){this.key="",this.value=[],this.height=1,this.key=e,this.value=t,this.leftNode=o,this.rightNode=n}getFromNode(e,t){return t?e==t.key?t:e<t.key?this.getFromNode(e,t.leftNode):e>t.key?this.getFromNode(e,t.rightNode):t:t}rightRotate(e){if(e){let t=e.leftNode;if(t){let o=t.rightNode;return e.leftNode=o,t.rightNode=e,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode))+1,t}}return e}leftRotate(e){if(e){let t=e.rightNode;if(t){let o=t.leftNode;return t.leftNode=e,e.rightNode=o,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(e.rightNode))+1,t}}return e}getHeight(e){return e?e.height:0}getBalanceFactor(e){return null==e?0:this.getHeight(e.leftNode)-this.getHeight(e.rightNode)}removeNode(e,t){if(null==e)return e;if(e.key>t)return e.leftNode=this.removeNode(e.leftNode,t),e;if(e.key<t)return e.rightNode=this.removeNode(e.rightNode,t),e;if(null==e.leftNode){let t=e.rightNode;return e=null,t}if(null==e.rightNode){let t=e.leftNode;return e=null,t}{let t=this.inOrderSuccessor(e.rightNode);return e.value=t.value,e.key=t.key,e.variants=t.variants,e.currentNode=t.currentNode,e.rightNode=this.removeNode(e.rightNode,t.key),e}}inOrderSuccessor(e){for(;null!=e.leftNode;)e=e.leftNode;return e}}},8286:(e,t,o)=>{o.d(t,{d:()=>f});var n=o(1735),i=o(2830),r=o(3655),c=o(1863),s=o(2155),a=o(5239),l=o(991),d=o(3996);class u extends d.i{constructor(e,t,o,n){super(e,t,o,n),this.key="",this.value=[],this.height=1,this.key=e,this.value=t,this.leftNode=o,this.rightNode=n}addNode(e,t,o){if(null==t)return e;let n=t.leftNode,i=t.rightNode;if(t.key>e.key)t.leftNode=this.addNode(e,n,o);else{if(!(t.key<e.key))return t;t.rightNode=this.addNode(e,i,o)}t.height=1+Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let r=this.getBalanceFactor(t);if(r>1&&t.leftNode){if(e.key<t.leftNode.key)return this.rightRotate(t);if(e.key>t.leftNode.key)return t.leftNode=this.leftRotate(t.leftNode),this.rightRotate(t)}if(r<-1&&t.rightNode){if(e.key>t.rightNode.key)return this.leftRotate(t);if(e.key<t.rightNode.key)return t.rightNode=this.rightRotate(t.rightNode),this.leftRotate(t)}return t}}class h{static CreateCompositionKey(e){return e}static addNodeToTree(e){return t=this,o=void 0,i=function*(){return null==this.connectionTypeRoot?(this.connectionTypeRoot=e,this.connectionTypeRoot):(this.connectionTypeRoot=this.connectionTypeRoot.addNode(e,this.connectionTypeRoot,this.connectionTypeRoot.height),this.connectionTypeRoot)},new((n=void 0)||(n=Promise))((function(e,r){function c(e){try{a(i.next(e))}catch(e){r(e)}}function s(e){try{a(i.throw(e))}catch(e){r(e)}}function a(t){var o;t.done?e(t.value):(o=t.value,o instanceof n?o:new n((function(e){e(o)}))).then(c,s)}a((i=i.apply(t,o||[])).next())}));var t,o,n,i}static addConnectionToTree(e){if(e.id>0){let t=this.CreateCompositionKey(e.typeId);if(this.connectionTypeRoot){let o=this.connectionTypeRoot.getFromNode(t,this.connectionTypeRoot);if(o){let t=null==o?void 0:o.value;0==t.length&&(o.value=[]),t.includes(e.id)||t.push(e.id)}else{let o=[];o.push(e.id);let n=new u(t,o,null,null);this.addNodeToTree(n)}}else{let o=[];o.push(e.id);let n=new u(t,o,null,null);this.addNodeToTree(n)}}else console.log("cannot insert key id with n 0 to the connection tree",e)}static GetConnectionByOfTheConceptAndTypeId(e,t){let o=this.CreateCompositionKey(t);if(this.connectionTypeRoot){let e=this.connectionTypeRoot.getFromNode(o,this.connectionTypeRoot);if(e)return e.value}return null}}h.connectionTypeRoot=null;var p=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class f{constructor(){this.name="Connection Array"}static CheckContains(e){let t=!1;for(let o=0;o<this.connectionArray.length;o++)this.connectionArray[o].id==e.id&&(t=!0);return t}static AddConnectionToStorage(e){(0,r.kH)("connection",e)}static AddConnection(e){try{a.O.addConnectionToTree(e),h.addConnectionToTree(e),l.H.addConnection(e)}catch(e){throw console.log("this is the error in making the connection"),e}}static AddConnectionToMemory(e){e.isTemp||(a.O.addConnectionToTree(e),h.addConnectionToTree(e),l.H.addConnection(e))}static AddToDictionary(e){this.connectionDictionary[e.id]=e}static RemoveConnection(e){0!=e.id&&((0,r.wh)("connection",e.id),a.O.removeNodeFromTree(e.id),l.H.removeNodeFromTree(e.id))}static GetConnectionTypeOfTree(){l.H.node}static GetConnectionByOfTheConceptAndType(e,t){return p(this,void 0,void 0,(function*(){try{if(i.serviceWorker)try{return(yield(0,i.sendMessage)("ConnectionData__GetConnectionByOfTheConceptAndType",{ofTheConceptId:e,typeId:t})).data}catch(e){console.error("GetConnectionByOfTheConceptAndType sw error: ",e),(0,i.handleServiceWorkerException)(e)}return l.H.GetConnectionByOfTheConceptAndTypeId(e,t)||[]}catch(e){return console.log("this is the error in GetConnectionByOfTheConceptAndType",e),[]}}))}static GetConnectionByOfType(e,t){const o=i.Logger.logfunction("ConnectionData.GetConnectionByOfType",arguments);let n=h.GetConnectionByOfTheConceptAndTypeId(e,t);return n?(i.Logger.logUpdate(o),n):(i.Logger.logUpdate(o),[])}static GetConnectionTree(){return a.O.connectionroot}static GetConnectionTypeTree(){return h.connectionTypeRoot}static GetConnectionBulkData(e,t,o){return p(this,void 0,void 0,(function*(){yield a.O.getConnectionListFromIds(e,t,o)}))}static GetConnection(e){return p(this,void 0,void 0,(function*(){n.J.incrementConnection(e);let t=new s.N(0,0,0,0,0,0,0);try{if(i.serviceWorker)try{return(yield(0,i.sendMessage)("ConnectionData__GetConnection",{id:e})).data}catch(e){console.error("GetConnection sw error: ",e),(0,i.handleServiceWorkerException)(e)}let o=yield a.O.getNodeFromTree(e);if(null==o?void 0:o.value){let e=o.value;e&&(t=e)}return t}catch(e){return console.log("this is the error in GetConnection",e),t}}))}static GetConnectionsOfCompositionLocal(e){var t=arguments;return p(this,void 0,void 0,(function*(){const o=i.Logger.logfunction("ConnectionData.GetConnectionsOfCompositionLocal",t);let n=[];try{if(i.serviceWorker){o.serviceWorker=!0;try{const t=yield(0,i.sendMessage)("ConnectionData__GetConnectionsOfCompositionLocal",{id:e});return i.Logger.logUpdate(o),t.data}catch(e){console.error("GetConnectionsOfCompositionLocal sw error: ",e),(0,c.ey)(o,"GetConnectionsOfCompositionLocal",e),(0,i.handleServiceWorkerException)(e)}}let t=[];t=f.GetConnectionByOfType(e,e);for(let e=0;e<t.length;e++){let r=yield a.O.getNodeFromTree(t[e]);r&&n.push(r.value),i.Logger.logUpdate(o)}}catch(t){console.log("this is the error GetConnectionsOfCompositionLocal",e,n),(0,c.ey)(o,"ConnectionData.GetConnectionsOfCompositionLocal",t)}return n}))}static GetConnectionsOfConcept(e){return p(this,void 0,void 0,(function*(){let t=[],o=[];try{if(i.serviceWorker)try{return(yield(0,i.sendMessage)("ConnectionData__GetConnectionsOfConcept",{id:e})).data}catch(e){console.error("GetConnectionsOfConcept sw error: ",e),(0,i.handleServiceWorkerException)(e)}t=yield f.GetConnectionByOfTheConceptAndType(e,e);for(let e=0;e<t.length;e++){let n=yield a.O.getNodeFromTree(t[e]);n&&o.push(n.value)}return o}catch(e){return console.log("this is the error in GetConnectionsOfConcept",e),o}}))}getName(){return this.name}}f.connectionArray=[],f.connectionDictionary=[]},205:(e,t,o)=>{o.d(t,{B:()=>n});class n{}n.isTypeLoaded=!1,n.isCharacterLoaded=!1,n.isDataLoaded=!1,n.isLocalDataLoaded=!1,n.isLocalCharacterLoaded=!1,n.isLocalTypeLoaded=!1,n.isConnectionLoaded=!1,n.isConnectionTypeLoaded=!1,n.isLocalConnectionLoaded=!1},2515:(e,t,o)=>{o.d(t,{x:()=>n});class n{constructor(e,t,o,n){this.variants=[],this.height=1,this.key=e,this.value=t,this.leftNode=o,this.rightNode=n,this.currentNode=null}addCurrentNode(e,t){return null==t?t=e:(e.value.typeId!=t.value.typeId&&(t.currentNode=this.addCurrentNode(e,t.currentNode)),t)}addCurrentNodeType(e,t){if(null==t)return e;var o=!1;for(let n=0;n<t.variants.length;n++)t.variants[n].value.id==e.value.id&&(o=!0);return o||t.variants.push(e),t}addNode(e,t,o){if(null==t)return e;var n=t.leftNode,i=t.rightNode;if(t.key>e.key)t.leftNode=this.addNode(e,n,o);else{if(!(t.key<e.key))return t;t.rightNode=this.addNode(e,i,o)}t.height=1+Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let r=this.getBalanceFactor(t);if(r>1&&t.leftNode){if(e.key<t.leftNode.key)return this.rightRotate(t);if(e.key>t.leftNode.key)return t.leftNode=this.leftRotate(t.leftNode),this.rightRotate(t)}if(r<-1&&t.rightNode){if(e.key>t.rightNode.key)return this.leftRotate(t);if(e.key<t.rightNode.key)return t.rightNode=this.rightRotate(t.rightNode),this.leftRotate(t)}return t}addCharacterNode(e,t,o){if(""!=e.value.characterValue){if(null==t)return e;var n=t.leftNode,i=t.rightNode;if(t.key>e.key)t.leftNode=this.addCharacterNode(e,n,o);else{if(!(t.key<e.key))return t.key==e.key&&""!=t.key&&t.value.id!=e.value.id&&t.addCurrentNodeType(e,t),t;t.rightNode=this.addCharacterNode(e,i,o)}t.height=1+Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let r=this.getBalanceFactor(t);if(r>1&&t.leftNode){if(e.key<t.leftNode.key)return this.rightRotate(t);if(e.key>t.leftNode.key)return t.leftNode=this.leftRotate(t.leftNode),this.rightRotate(t)}if(r<-1&&t.rightNode){if(e.key>t.rightNode.key)return this.leftRotate(t);if(e.key<t.rightNode.key)return t.rightNode=this.rightRotate(t.rightNode),this.leftRotate(t)}}return t}addTypeNode(e,t,o){if(0!=e.value.typeId){if(null==t)return e;var n=t.leftNode,i=t.rightNode;if(t.key>e.key)t.leftNode=this.addTypeNode(e,n,o);else{if(!(t.key<e.key))return t.key==e.key&&0!=t.key&&t.value.id!=e.value.id&&t.addCurrentNodeType(e,t),t;t.rightNode=this.addTypeNode(e,i,o)}t.height=1+Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let r=this.getBalanceFactor(t);if(r>1&&t.leftNode){if(e.key<t.leftNode.key)return this.rightRotate(t);if(e.key>t.leftNode.key)return t.leftNode=this.leftRotate(t.leftNode),this.rightRotate(t)}if(r<-1&&t.rightNode){if(e.key>t.rightNode.key)return this.leftRotate(t);if(e.key<t.rightNode.key)return t.rightNode=this.rightRotate(t.rightNode),this.leftRotate(t)}}return t}rightRotate(e){if(e){let t=e.leftNode;if(t){let o=t.rightNode;return e.leftNode=o,t.rightNode=e,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode))+1,t}}return e}leftRotate(e){if(e){let t=e.rightNode;if(t){let o=t.leftNode;return t.leftNode=e,e.rightNode=o,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(e.rightNode))+1,t}}return e}getHeight(e){return e?e.height:0}getBalanceFactor(e){return null==e?0:this.getHeight(e.leftNode)-this.getHeight(e.rightNode)}getFromNode(e,t){return t?e==t.key?t:e<t.key?this.getFromNode(e,t.leftNode):e>t.key?this.getFromNode(e,t.rightNode):t:t}updateNodeSyncStatus(e,t,o){if(o){if(e==o.key){let e=o.value;return e.isSynced=t,o.value=e,o}return e<o.key?this.updateNodeSyncStatus(e,t,o.leftNode):e>o.key?this.updateNodeSyncStatus(e,t,o.rightNode):o}return o}getCharacterFromNode(e,t){return t?e==t.key?t:e<t.key?this.getCharacterFromNode(e,t.leftNode):e>t.key?this.getCharacterFromNode(e,t.rightNode):t:t}getFromNodeWithCharacterAndType(e,t,o){if(e=`${e}`,o){if(e==o.key){if(e==o.value.characterValue&&t==o.value.typeId)return o;for(let e=0;e<o.variants.length;e++)if(o.variants[e].value.typeId==t)return o.variants[e]}else{if(e<o.key)return this.getFromNodeWithCharacterAndType(e,t,o.leftNode);if(e>o.key)return this.getFromNodeWithCharacterAndType(e,t,o.rightNode)}return null}return o}getFromNodeWithCharacterAndCategory(e,t,o){if(e=`${e}`,o){if(e==o.key){if(e==o.value.characterValue&&t==o.value.categoryId)return o;for(let e=0;e<o.variants.length;e++)if(o.variants[e].value.categoryId==t)return o.variants[e]}else{if(e<o.key)return this.getFromNodeWithCharacterAndCategory(e,t,o.leftNode);if(e>o.key)return this.getFromNodeWithCharacterAndCategory(e,t,o.rightNode)}return null}return o}removeNode(e,t){if(null==e)return e;if(e.key>t)return e.leftNode=this.removeNode(e.leftNode,t),e;if(e.key<t)return e.rightNode=this.removeNode(e.rightNode,t),e;if(null==e.leftNode){let t=e.rightNode;return e=null,t}if(null==e.rightNode){let t=e.leftNode;return e=null,t}var o=this.inOrderSuccessor(e.rightNode);return e.value=o.value,e.key=o.key,e.variants=o.variants,e.currentNode=o.currentNode,e.rightNode=this.removeNode(e.rightNode,o.key),e}removeNodeWithVariants(e,t,o){if(null==e)return e;if(e.key>t)return e.leftNode=this.removeNodeWithVariants(e.leftNode,t,o),e;if(e.key<t)return e.rightNode=this.removeNodeWithVariants(e.rightNode,t,o),e;if(e.variants.length>0)if(e.value.id==o){var n=e.variants[0];if(n)return e.value=n.value,e.key=n.key,e.currentNode=n.currentNode,e.variants.splice(0,1),e}else for(let t=0;t<e.variants.length;t++)if(o==e.variants[t].value.id)return e.variants.splice(t,1),e;if(null==e.leftNode){let t=e.rightNode;return e=null,t}if(null==e.rightNode){let t=e.leftNode;return e=null,t}var i=this.inOrderSuccessor(e.rightNode);return e.value=i.value,e.key=i.key,e.variants=i.variants,e.currentNode=i.currentNode,e.rightNode=this.removeNodeWithVariants(e.rightNode,i.key,o),e}countNodeBelow(e){return null==e?0:1+this.countNodeBelow(e.leftNode)+this.countNodeBelow(e.rightNode)}inOrderSuccessor(e){for(;null!=e.leftNode;)e=e.leftNode;return e}}},9736:(e,t,o)=>{o.d(t,{v:()=>m});var n=o(9003),i=o(205),r=o(2515),c=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class s{static addNodeToTree(e){if(null==this.root)return this.root=e,this.root;this.root=this.root.addNode(e,this.root,this.root.height)}static addConceptToTree(e){var t=new r.x(e.id,e,null,null);new r.x(e.characterValue,e,null,null),this.addNodeToTree(t)}static waitForDataToLoad(){return c(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(i.B.isLocalDataLoaded)return e("done");setTimeout(s.checkFlag,1e3,e)}static getNodeFromTree(e){return c(this,void 0,void 0,(function*(){return this.root?this.root.getFromNode(e,this.root):null}))}static getCharacterAndTypeFromTree(e,t){return this.root?this.root.getFromNodeWithCharacterAndType(e,t,this.root):this.root}static updateSyncStatus(e){return this.root?this.root.updateNodeSyncStatus(e,!0,this.root):this.root}static removeNodeFromTree(e){return c(this,void 0,void 0,(function*(){this.root&&(this.root=this.root.removeNode(this.root,e))}))}}s.root=null;var a=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class l{static waitForDataToLoad(){return a(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(i.B.isLocalCharacterLoaded)return e("done");setTimeout(l.checkFlag,1e3,e)}static addNodeToTree(e){return a(this,void 0,void 0,(function*(){return null==this.LocalCharacterRoot?(this.LocalCharacterRoot=e,this.LocalCharacterRoot):(this.LocalCharacterRoot=this.LocalCharacterRoot.addCharacterNode(e,this.LocalCharacterRoot,this.LocalCharacterRoot.height),this.LocalCharacterRoot)}))}static addConceptToTree(e){if(""!=e.characterValue){var t=new r.x(e.characterValue,e,null,null);this.addNodeToTree(t)}}static getNodeFromTree(e){return this.LocalCharacterRoot?this.LocalCharacterRoot.getCharacterFromNode(e,this.LocalCharacterRoot):this.LocalCharacterRoot}static getCharacterAndTypeFromTree(e,t){return a(this,void 0,void 0,(function*(){return this.LocalCharacterRoot?this.LocalCharacterRoot.getFromNodeWithCharacterAndType(e,t,this.LocalCharacterRoot):this.LocalCharacterRoot}))}static getCharacterAndCategoryFromTree(e,t){return a(this,void 0,void 0,(function*(){return this.LocalCharacterRoot?this.LocalCharacterRoot.getFromNodeWithCharacterAndCategory(e,t,this.LocalCharacterRoot):this.LocalCharacterRoot}))}static removeConceptType(e,t){this.LocalCharacterRoot&&(this.LocalCharacterRoot=this.LocalCharacterRoot.removeNodeWithVariants(this.LocalCharacterRoot,e,t))}}l.LocalCharacterRoot=null;var d=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class u{static addNodeToTree(e){return d(this,void 0,void 0,(function*(){return null==this.LocalTypeRoot?(this.LocalTypeRoot=e,this.LocalTypeRoot):(this.LocalTypeRoot=this.LocalTypeRoot.addTypeNode(e,this.LocalTypeRoot,this.LocalTypeRoot.height),this.LocalTypeRoot)}))}static addConceptToTree(e){if(0!=e.typeId){var t=new r.x(e.typeId,e,null,null);this.addNodeToTree(t)}}static removeConceptType(e,t){this.LocalTypeRoot&&(this.LocalTypeRoot=this.LocalTypeRoot.removeNodeWithVariants(this.LocalTypeRoot,e,t))}static getNodeFromTree(e){return this.LocalTypeRoot?this.LocalTypeRoot.getFromNode(e,this.LocalTypeRoot):this.LocalTypeRoot}static getTypeVariantsFromTree(e){var t=this.getNodeFromTree(e),o=[];if(t){o.push(null==t?void 0:t.value);for(let e=0;e<t.variants.length;e++)o.push(t.variants[e].value);return o}}static waitForDataToLoad(){return d(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(i.B.isLocalTypeLoaded)return e("done");setTimeout(u.checkFlag,1e3,e)}static getTypeVariantsFromTreeWithUserId(e,t){return d(this,void 0,void 0,(function*(){var o=[],n=this.getNodeFromTree(e);if(n){console.log("this is the node to type",n),n.value.userId!=t&&999!=n.value.userId||o.push(null==n?void 0:n.value);for(let e=0;e<n.variants.length;e++)n.variants[e].value.userId!=t&&999!=n.value.userId||o.push(n.variants[e].value)}return o}))}}u.LocalTypeRoot=null;var h=o(6416),p=o(9639),f=o(7820),y=o(4864),v=o(628),g=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class m{constructor(){this.name="conceptsArray"}static AddConcept(e){0!=e.id&&((0,n.kH)("localconcept",e),s.addConceptToTree(e),l.addConceptToTree(e),u.addConceptToTree(e),this.localconceptsArray.push(e))}static AddPermanentConcept(e){0!=e.id&&(s.removeNodeFromTree(e.ghostId),l.removeConceptType(e.characterValue,e.ghostId),u.removeConceptType(e.typeId,e.ghostId),f.G.addConceptToTree(e),(0,n.wh)("localconcept",e.ghostId),p.I.AddConcept(e))}static RemoveConcept(e){return g(this,void 0,void 0,(function*(){try{0!=e.id&&(s.removeNodeFromTree(e.ghostId),l.removeConceptType(e.characterValue,e.ghostId),u.removeConceptType(e.typeId,e.ghostId),yield(0,n.wh)("localconcept",e.ghostId))}catch(e){throw e}}))}static RemoveConceptById(e){return g(this,void 0,void 0,(function*(){try{let t=yield m.GetConcept(e);0!=t.id&&(s.removeNodeFromTree(e),l.removeConceptType(t.characterValue,t.ghostId),u.removeConceptType(t.typeId,t.ghostId),v.H.RemoveConcept(t))}catch(e){throw e}}))}static AddConceptToMemory(e){0!=e.id&&(s.addConceptToTree(e),l.addConceptToTree(e),u.addConceptToTree(e))}static GetConcept(e){return g(this,void 0,void 0,(function*(){var t=(0,h.u)(),o=yield s.getNodeFromTree(e);if(null==o?void 0:o.value){var n=o.value;n&&(t=n)}return t}))}static UpdateConceptSyncStatus(e){return g(this,void 0,void 0,(function*(){s.updateSyncStatus(e)}))}static GetConceptByGhostId(e){return g(this,void 0,void 0,(function*(){var t=(0,h.u)(),o=yield f.G.getNodeFromTree(e);if(null==o?void 0:o.value){var n=o.value;n&&(t=n)}return t}))}static GetConceptByCharacter(e){return g(this,void 0,void 0,(function*(){var t=(0,h.u)(),o=l.getNodeFromTree(e);return o&&(t=o.value),t}))}static GetConceptByCharacterAndTypeLocal(e,t){return g(this,void 0,void 0,(function*(){var o=(0,h.u)(),n=yield l.getCharacterAndTypeFromTree(e,t);return n&&(o=n.value),o}))}static GetConceptByCharacterAndCategoryLocal(e,t){return g(this,void 0,void 0,(function*(){var o=(0,h.u)(),n=yield l.getCharacterAndCategoryFromTree(e,t);return n&&(o=n.value),o}))}static GetConceptsByTypeId(e){let t=[];for(var o=0;o<this.localconceptsArray.length;o++)this.localconceptsArray[o].typeId==e&&t.push(this.localconceptsArray[o]);return t}static GetConceptsByTypeIdAndUser(e,t){return g(this,void 0,void 0,(function*(){let o=[];return o=yield u.getTypeVariantsFromTreeWithUserId(e,t),o}))}static ClearData(){return g(this,void 0,void 0,(function*(){this.localconceptsArray=[],y.G.connectionArray=[]}))}getName(){return this.name}}m.localconceptsArray=[]},4864:(e,t,o)=>{o.d(t,{G:()=>l});var n=o(9003),i=o(2155),r=o(8286),c=o(205),s=o(628),a=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class l{constructor(){this.name="Connection Array"}static CheckContains(e){for(var t=!1,o=0;o<this.connectionArray.length;o++)this.connectionArray[o].id==e.id&&(t=!0);return t}static AddConnection(e){this.CheckContains(e)&&this.RemoveConnection(e),0!=e.id&&(0,n.kH)("localconnection",e),this.connectionArray.push(e)}static AddConnectionToMemory(e){this.CheckContains(e)&&this.RemoveConnection(e),this.connectionArray.push(e)}static AddToDictionary(e){this.connectionDictionary[e.id]=e}static RemoveConnection(e){for(var t=0;t<this.connectionArray.length;t++)this.connectionArray[t].id==e.id&&this.connectionArray.splice(t,1);e.id}static RemoveConnectionById(e){for(var t=0;t<this.connectionArray.length;t++)this.connectionArray[t].id==e&&this.connectionArray.splice(t,1);s.H.RemoveConnectionById(e)}static AddPermanentConnection(e){e.id>0&&((0,n.wh)("localconnection",e.ghostId),r.d.AddConnection(function(e){let t=new i.N(0,0,0,0,0,0,0);return t.ofTheConceptId=e.ofTheConceptId,t.toTheConceptId=e.toTheConceptId,t.typeId=e.typeId,t.orderId=e.orderId,t.id=e.id,t}(e)))}static GetConnection(e){var t;t=null;for(var o=0;o<this.connectionArray.length;o++)this.connectionArray[o].id==e&&(t=this.connectionArray[o]);return t}static waitForDataToLoad(){return a(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(c.B.isLocalConnectionLoaded)return e("done");setTimeout(l.checkFlag,1e3,e)}static GetConnectionsOfCompositionLocal(e){return a(this,void 0,void 0,(function*(){var t=[];try{for(var o=0;o<this.connectionArray.length;o++)this.connectionArray[o].typeId==e&&t.push(this.connectionArray[o]);return t}catch(e){return t}}))}static GetConnectionOfCompositionAndTypeLocal(e,t){return a(this,void 0,void 0,(function*(){var o=[];try{for(var n=0;n<this.connectionArray.length;n++)this.connectionArray[n].typeId==e&&this.connectionArray[n].ofTheConceptId==t&&o.push(this.connectionArray[n]);return o}catch(e){return o}}))}getName(){return this.name}}l.connectionArray=[],l.connectionDictionary=[]},7820:(e,t,o)=>{o.d(t,{G:()=>c});var n=o(205),i=o(2515),r=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class c{static addNodeToTree(e){if(null==this.root)return this.root=e,this.root;this.root=this.root.addNode(e,this.root,this.root.height)}static addConceptToTree(e){var t=new i.x(e.ghostId,e,null,null);this.addNodeToTree(t)}static waitForDataToLoad(){return r(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(n.B.isLocalDataLoaded)return e("done");setTimeout(c.checkFlag,1e3,e)}static getNodeFromTree(e){return r(this,void 0,void 0,(function*(){return this.root?this.root.getFromNode(e,this.root):null}))}static removeNodeFromTree(e){return r(this,void 0,void 0,(function*(){this.root&&(this.root=this.root.removeNode(this.root,e))}))}}c.root=null},5257:(e,t,o)=>{o.d(t,{R:()=>c});var n=o(9003),i=o(3075),r=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class c{static AddConceptId(e){this.localId=e.value,(0,n.kH)("localid",e)}static getConceptId(){return r(this,void 0,void 0,(function*(){try{if(this.localId){if(this.ReservedLocalId.length<5){yield(0,i.EO)().then((()=>{let e=this.localId;for(let t=1;t<10;t++){let o=this.localId-t;this.ReservedLocalId.push(o),e=o}this.AddConceptId({id:0,value:e})})).catch((e=>(console.log(" getid: cannot get the id from indexdb"),-Math.floor(1e8*Math.random()))));let e=this.ReservedLocalId[0];return this.ReservedLocalId.shift(),e}{let e=this.ReservedLocalId[0];return this.ReservedLocalId.shift(),e}}return yield(0,i.EO)().then((()=>{let e=this.localId;for(let t=1;t<10;t++){let o=this.localId-t;this.ReservedLocalId.push(o),e=o}this.AddConceptId({id:0,value:e})})),this.getConceptId()}catch(e){return console.log(" getid: this is the eror in concept",e),-Math.floor(1e8*Math.random())}}))}static AddConnectionId(e){this.localConnectionId=e.value}static getConnectionId(){return r(this,void 0,void 0,(function*(){try{if(this.localConnectionId){if(this.ReservedConnectionId.length<5){yield(0,i.xd)().then((()=>{let e=this.localConnectionId;for(let t=1;t<10;t++){let o=this.localConnectionId-t;this.ReservedConnectionId.push(o),e=o}})).catch((e=>(console.log("this is the new event",e),-Math.floor(1e8*Math.random()))));let e=this.ReservedConnectionId[0];return this.ReservedConnectionId.shift(),e}{let e=this.ReservedConnectionId[0];return this.ReservedConnectionId.shift(),e}}return yield(0,i.xd)().then((()=>{let e=this.localConnectionId;for(let t=1;t<10;t++){let o=this.localConnectionId-t;this.ReservedConnectionId.push(o),e=o}this.AddConnectionId({id:1,value:e})})),this.getConnectionId()}catch(e){return-Math.floor(1e8*Math.random())}}))}}c.ReservedLocalId=[],c.ReservedConnectionId=[]},628:(e,t,o)=>{o.d(t,{H:()=>y});var n=o(9581),i=o(3278),r=o(2830),c=o(1863),s=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};const a=(e,t)=>s(void 0,void 0,void 0,(function*(){let o={concepts:[],connections:[]};try{const r=new Headers;let s={concepts:e,connections:t};r.set("Content-Type","application/json"),r.set("Authorization","Bearer "+i.b.BearerAccessToken),r.set("Accept","application/json"),r.set("Randomizer",n.B.getRandomizer().toString());const a=yield fetch(n.B.CreateGhostConceptApiUrl(),{method:"POST",headers:r,body:JSON.stringify(s)});if(!a.ok)throw(0,c.ry)(a),new Error(`Error! status: ${a.status}`);const l=yield a.json();return o.concepts=l.concepts,o.connections=l.connections,o}catch(e){throw e instanceof Error?console.log("Create the concept api error message: ",e.message):console.log("Create the concept api unexpected error: ",e),e}}));function l(e,t){const o=[];for(let n=0;n<e.length;n+=t){const i=e.slice(n,n+t);o.push(i)}return o}const d=(...e)=>s(void 0,[...e],void 0,(function*(e=[]){return yield Promise.all(e.map((e=>{let t=JSON.parse(JSON.stringify(e));return delete t.type,delete t.ofConcept,delete t.toConcept,t})))}));var u=o(9003),h=o(9736),p=o(4864),f=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class y{static CheckContains(e){for(var t=!1,o=0;o<this.conceptsSyncArray.length;o++)this.conceptsSyncArray[o].id==e.id&&(t=!0);return t}static SyncDataDelete(e){for(var t=0;t<this.conceptsSyncArray.length;t++)e==this.conceptsSyncArray[t].id&&this.conceptsSyncArray.splice(t,1);for(t=0;t<this.connectionSyncArray.length;t++)this.connectionSyncArray[t].ofTheConceptId!=e&&this.connectionSyncArray[t].toTheConceptId!=e&&this.connectionSyncArray[t].typeId!=e||this.connectionSyncArray.splice(t,1)}static CheckContainsConnection(e){for(var t=!1,o=0;o<this.connectionSyncArray.length;o++)this.connectionSyncArray[o].id==e.id&&(t=!0);return t}static AddConcept(e){try{let t=!1;0!=y.CheckIfTheConceptIdExists(e.id,this.conceptsSyncArray).id&&(t=!0),t||this.conceptsSyncArray.push(e)}catch(e){throw e}}static RemoveConcept(e){for(var t=0;t<this.conceptsSyncArray.length;t++)this.conceptsSyncArray[t].id==e.id&&this.conceptsSyncArray.splice(t,1)}static SyncDataOnline(e,t){return f(this,void 0,void 0,(function*(){let o=performance.now();try{if(r.serviceWorker)try{return(yield(0,r.sendMessage)("LocalSyncData__SyncDataOnline",{transactionId:e})).data}catch(e){console.error("LocalSyncData__SyncDataOnline sw error: ",e),(0,r.handleServiceWorkerException)(e)}let o=[],n=[];if(e&&this.transactionCollections.some((t=>t.id==e))){const t=this.transactionCollections.find((t=>t.id==e));if(this.transactionCollections=this.transactionCollections.filter((t=>t.id!=e)),this.transactionCollections=this.transactionCollections.filter((e=>new Date(e.createdDate).getTime()>(new Date).getTime()-6048e5)),!t)return;o=t.data.concepts.slice(),n=t.data.connections.slice()}else Array.isArray(null==t?void 0:t.concepts)&&Array.isArray(null==t?void 0:t.connections)?(o=t.concepts.filter((e=>this.conceptsSyncArray.some((t=>e.id==t.id||e.ghostId==t.ghostId)))).slice(),n=t.connections.filter((e=>this.connectionSyncArray.some((t=>e.id==t.id||e.ghostId==t.ghostId)))).slice(),this.conceptsSyncArray=this.conceptsSyncArray.filter((e=>!t.concepts.some((t=>e.id==t.id||e.ghostId==t.ghostId)))),this.connectionSyncArray=this.connectionSyncArray.filter((e=>!t.connections.some((t=>e.id==t.id||e.ghostId==t.ghostId))))):(console.warn("Syncing this way has been Depreceted in service worker."),console.info("Only if serive worker is not running"),o=this.conceptsSyncArray.slice()||[],n=this.connectionSyncArray.slice()||[]);this.connectionSyncArray=[],this.conceptsSyncArray=[];let i=[];for(let e=0;e<o.length;e++)i.push(o[e]),yield h.v.UpdateConceptSyncStatus(o[e].id);yield this.UpdateConceptListToIncludeRelatedConcepts(n,i);let u=yield function(e,t){return s(this,void 0,void 0,(function*(){const o=r.Logger.logfunction("CreateTheGhostConceptApi",[e.length,t.length]);try{const n=1e3;let i={concepts:[],connections:[]};const c=yield d(e),s=yield d(t);if(e.length+t.length<=2*n){const e=yield a(c,s);return Array.isArray(null==e?void 0:e.concepts)&&(i.concepts=[...i.concepts,...e.concepts]),Array.isArray(null==e?void 0:e.connections)&&(i.connections=[...i.connections,...e.connections]),r.Logger.logUpdate(o),i}const u=l(c,n),h=l(s,n),p=[],f=[];for(let e=0;e<u.length;e++){const t=u[e];p.push(a(t,[]))}const y=yield Promise.all(p);for(let e=0;e<y.length;e++){const t=y[e];Array.isArray(null==t?void 0:t.concepts)&&(i.concepts=[...i.concepts,...t.concepts]),Array.isArray(null==t?void 0:t.connections)&&(i.connections=[...i.connections,...t.connections])}for(let e=0;e<h.length;e++){const t=h[e];f.push(a([],t))}const v=yield Promise.all(f);for(let e=0;e<v.length;e++){const t=v[e];Array.isArray(null==t?void 0:t.concepts)&&(i.concepts=[...i.concepts,...t.concepts]),Array.isArray(null==t?void 0:t.connections)&&(i.connections=[...i.connections,...t.connections])}return r.Logger.logUpdate(o),i}catch(e){throw console.log(e),(0,c.ey)(o,"CreateTheGhostConceptApi",e),e}}))}(i,n),f=u.concepts,y=u.connections;for(let e=0;e<f.length;e++)h.v.AddPermanentConcept(f[e]);for(let e=0;e<y.length;e++)p.G.AddPermanentConnection(y[e]);return o}catch(e){throw r.Logger.logError(o,"unknown",void 0,"unknown",void 0,500,e,"SyncDataOnline",[],"unknown",void 0),e}}))}static ConvertGhostIdsInConnections(e){var t,o,n;for(let i=0;i<e.length;i++){let r=e[i].ofTheConceptId,c=e[i].toTheConceptId,s=e[i].typeId,a=null!==(t=y.ghostIdMap.get(r))&&void 0!==t?t:r,l=null!==(o=y.ghostIdMap.get(c))&&void 0!==o?o:c,d=null!==(n=y.ghostIdMap.get(s))&&void 0!==n?n:s;e[i].ofTheConceptId=a,e[i].toTheConceptId=l,e[i].typeId=d}}static UpdateConceptListToIncludeRelatedConcepts(e,t){return f(this,void 0,void 0,(function*(){for(let o=0;o<e.length;o++){let n=e[o].ofTheConceptId,i=e[o].toTheConceptId,r=e[o].typeId;if(n<0){let i=this.CheckIfTheConceptIdExists(n,t);0==i.id&&(i=yield h.v.GetConceptByGhostId(n),0!=i.id?i.id!=i.ghostId&&(e[o].ofTheConceptId=i.id):(i=yield h.v.GetConcept(n),this.AddConceptIfDoesNotExist(i,t)))}if(i<0){let n=this.CheckIfTheConceptIdExists(i,t);0==n.id&&(n=yield h.v.GetConceptByGhostId(i),0!=n.id?n.id!=n.ghostId&&(e[o].toTheConceptId=n.id):(n=yield h.v.GetConcept(i),this.AddConceptIfDoesNotExist(n,t)))}if(r<0){let n=this.CheckIfTheConceptIdExists(r,t);0==n.id&&(n=yield h.v.GetConceptByGhostId(r),0!=n.id?n.id!=n.ghostId&&(e[o].typeId=n.id):(n=yield h.v.GetConcept(r),this.AddConceptIfDoesNotExist(n,t)))}}}))}static AddConceptIfDoesNotExist(e,t=[]){let o=!1;for(let n=0;n<t.length;n++)e.ghostId==t[n].ghostId&&(o=!0);o||t.push(e)}static CheckIfTheConceptIdExists(e,t=[]){let o=(0,r.CreateDefaultLConcept)();for(let n=0;n<t.length;n++)e!=t[n].ghostId&&e!=t[n].id||(o=t[n]);return o}static AddConnection(e){this.connectionSyncArray.push(e)}static RemoveConnection(e){for(var t=0;t<this.connectionSyncArray.length;t++)this.connectionSyncArray[t].id==e.id&&this.connectionSyncArray.splice(t,1)}static RemoveConnectionById(e){for(var t=0;t<this.connectionSyncArray.length;t++)this.connectionSyncArray[t].id==e&&this.connectionSyncArray.splice(t,1)}static syncDataLocalDb(){return f(this,void 0,void 0,(function*(){if(this.conceptsSyncArray.length>0){for(let e=0;e<this.conceptsSyncArray.length;e++)(0,u.kH)("localconcept",this.conceptsSyncArray[e]);this.conceptsSyncArray=[]}if(this.connectionSyncArray.length>0){for(let e=0;e<this.connectionSyncArray.length;e++)(0,u.kH)("localconnection",this.connectionSyncArray[e]);this.connectionSyncArray=[]}return"done"}))}static initializeTransaction(e){return f(this,void 0,void 0,(function*(){try{if(r.serviceWorker)try{return(yield(0,r.sendMessage)("LocalSyncData__initializeTransaction",{transactionId:e})).data}catch(e){console.error("LocalSyncData__initializeTransaction sw error: ",e),(0,r.handleServiceWorkerException)(e)}if(this.transactionCollections.some((t=>t.id==e)))return;this.transactionCollections.push({id:e,data:{concepts:[],connections:[]},createdDate:(new Date).toISOString()})}catch(e){console.log("error in initializeTransaction",e)}}))}static markTransactionActions(e,t){return f(this,void 0,void 0,(function*(){try{if(r.serviceWorker)try{return(yield(0,r.sendMessage)("LocalSyncData__markTransactionActions",{transactionId:e,actions:t})).data}catch(e){console.error("LocalSyncData__markTransactionActions sw error: ",e),(0,r.handleServiceWorkerException)(e)}this.transactionCollections=this.transactionCollections.map((o=>o.id==e?Object.assign(Object.assign({},o),{data:JSON.parse(JSON.stringify(t))}):o)),this.conceptsSyncArray=this.conceptsSyncArray.filter((e=>!t.concepts.some((t=>t.id==e.id||t.ghostId==e.id)))),this.connectionSyncArray=this.connectionSyncArray.filter((e=>!t.connections.some((t=>t.id==e.id||t.ghostId==e.id))))}catch(e){console.log("error in markTransactionActions",e)}}))}static rollbackTransaction(e,t){return f(this,void 0,void 0,(function*(){try{if(r.serviceWorker)try{return(yield(0,r.sendMessage)("LocalSyncData__rollbackTransaction",{transactionId:e,actions:t})).data}catch(e){console.error("LocalSyncData__rollbackTransaction sw error: ",e),(0,r.handleServiceWorkerException)(e)}if(this.transactionCollections.some((t=>t.id==e)))return;this.transactionCollections=this.transactionCollections.filter((t=>t.id!=e))}catch(e){console.log("LocalSyncData, roll",e)}}))}}y.conceptsSyncArray=[],y.connectionSyncArray=[],y.ghostIdMap=new Map,y.transactionCollections=[]},6731:(e,t,o)=>{o.d(t,{b:()=>n});class n{constructor(e,t,o,n){this.variants=[],this.height=1,this.key=e,this.value=t,this.leftNode=o,this.rightNode=n,this.currentNode=null}addCurrentNode(e,t){return null==t?t=e:(e.value.typeId!=t.value.typeId&&(t.currentNode=this.addCurrentNode(e,t.currentNode)),t)}addCurrentNodeType(e,t){if(null==t)return e;let o=!1;for(let n=0;n<t.variants.length;n++)t.variants[n].value.id==e.value.id&&(o=!0);return o||t.variants.push(e),t}addNode(e,t,o){if(null==t)return e;let n=t.leftNode,i=t.rightNode;if(t.key>e.key)t.leftNode=this.addNode(e,n,o);else{if(!(t.key<e.key))return t;t.rightNode=this.addNode(e,i,o)}t.height=1+Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let r=this.getBalanceFactor(t);if(r>1&&t.leftNode){if(e.key<t.leftNode.key)return this.rightRotate(t);if(e.key>t.leftNode.key)return t.leftNode=this.leftRotate(t.leftNode),this.rightRotate(t)}if(r<-1&&t.rightNode){if(e.key>t.rightNode.key)return this.leftRotate(t);if(e.key<t.rightNode.key)return t.rightNode=this.rightRotate(t.rightNode),this.leftRotate(t)}return t}checkIfIdsInNode(e,t,o,n){if(e){if(t.includes(e.key)){o.push(e.value);let n=t.indexOf(e.key);t.splice(n,1)}e.leftNode&&this.checkIfIdsInNode(e.leftNode,t,o,n),e.rightNode&&this.checkIfIdsInNode(e.rightNode,t,o,n)}}addCharacterNode(e,t,o){if(""!=e.value.characterValue){if(null==t)return e;let n=t.leftNode,i=t.rightNode;if(t.key>e.key)t.leftNode=this.addCharacterNode(e,n,o);else{if(!(t.key<e.key))return t.key==e.key&&""!=t.key&&t.value.id!=e.value.id&&t.addCurrentNodeType(e,t),t;t.rightNode=this.addCharacterNode(e,i,o)}t.height=1+Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let r=this.getBalanceFactor(t);if(r>1&&t.leftNode){if(e.key<t.leftNode.key){return this.rightRotate(t)}if(e.key>t.leftNode.key){return t.leftNode=this.leftRotate(t.leftNode),this.rightRotate(t)}}if(r<-1&&t.rightNode){if(e.key>t.rightNode.key){return this.leftRotate(t)}if(e.key<t.rightNode.key){return t.rightNode=this.rightRotate(t.rightNode),this.leftRotate(t)}}}return t}addTypeNode(e,t,o){if(0!=e.value.typeId){if(null==t)return console.log("adding the type node to the tree",e),e;let n=t.leftNode,i=t.rightNode;if(t.key>e.key)t.leftNode=this.addTypeNode(e,n,o);else{if(!(t.key<e.key))return console.log("adding the type node to the tree down",e),t.key==e.key&&0!=t.key&&t.value.id!=e.value.id&&t.addCurrentNodeType(e,t),console.log("adding the type node to the tree last",t),t;t.rightNode=this.addTypeNode(e,i,o)}t.height=1+Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let r=this.getBalanceFactor(t);if(r>1&&t.leftNode){if(e.key<t.leftNode.key){return this.rightRotate(t)}if(e.key>t.leftNode.key){return t.leftNode=this.leftRotate(t.leftNode),this.rightRotate(t)}}if(r<-1&&t.rightNode){if(e.key>t.rightNode.key){return this.leftRotate(t)}if(e.key<t.rightNode.key){return t.rightNode=this.rightRotate(t.rightNode),this.leftRotate(t)}}}return t}rightRotate(e){if(e){let t=e.leftNode;if(t){let o=t.rightNode;return e.leftNode=o,t.rightNode=e,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode))+1,t}}return e}leftRotate(e){if(e){let t=e.rightNode;if(t){let o=t.leftNode;return t.leftNode=e,e.rightNode=o,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(e.rightNode))+1,t}}return e}getHeight(e){return e?e.height:0}getBalanceFactor(e){return null==e?0:this.getHeight(e.leftNode)-this.getHeight(e.rightNode)}getFromNode(e,t){return t?e==t.key?t:e<t.key?this.getFromNode(e,t.leftNode):e>t.key?this.getFromNode(e,t.rightNode):t:t}getCharacterFromNode(e,t){return t?e==t.key?t:e<t.key?this.getCharacterFromNode(e,t.leftNode):e>t.key?this.getCharacterFromNode(e,t.rightNode):t:t}getCharacterFromNodeUpdated(e,t){var o;return t?e==t.key||51==(null===(o=t.value)||void 0===o?void 0:o.typeId)?t:e<t.key?this.getCharacterFromNode(e,t.leftNode):e>t.key?this.getCharacterFromNode(e,t.rightNode):t:t}getFromNodeWithCharacterAndType(e,t,o){if(e=`${e}`,o){if(e==o.key){if(e==o.value.characterValue&&t==o.value.typeId)return o;for(let e=0;e<o.variants.length;e++)if(o.variants[e].value.typeId==t)return o.variants[e]}else{if(e<o.key)return this.getFromNodeWithCharacterAndType(e,t,o.leftNode);if(e>o.key)return this.getFromNodeWithCharacterAndType(e,t,o.rightNode)}return null}return o}getFromNodeWithCharacterAndCategory(e,t,o){if(e=`${e}`,o){if(e==o.key){if(e==o.value.characterValue&&t==o.value.categoryId)return o;for(let e=0;e<o.variants.length;e++)if(o.variants[e].value.categoryId==t)return o.variants[e]}else{if(e<o.key)return this.getFromNodeWithCharacterAndCategory(e,t,o.leftNode);if(e>o.key)return this.getFromNodeWithCharacterAndCategory(e,t,o.rightNode)}return null}return o}removeNode(e,t){if(null==e)return e;if(e.key>t)return e.leftNode=this.removeNode(e.leftNode,t),e;if(e.key<t)return e.rightNode=this.removeNode(e.rightNode,t),e;if(null==e.leftNode){let t=e.rightNode;return e=null,t}if(null==e.rightNode){let t=e.leftNode;return e=null,t}{let t=this.inOrderSuccessor(e.rightNode);return e.value=t.value,e.key=t.key,e.variants=t.variants,e.currentNode=t.currentNode,e.rightNode=this.removeNode(e.rightNode,t.key),e}}removeNodeWithVariants(e,t,o){if(null==e)return e;if(e.key>t)return e.leftNode=this.removeNodeWithVariants(e.leftNode,t,o),e;if(e.key<t)return e.rightNode=this.removeNodeWithVariants(e.rightNode,t,o),e;if(e.variants.length>0)if(e.value.id==o){let t=e.variants[0];if(t)return e.value=t.value,e.key=t.key,e.currentNode=t.currentNode,e.variants.splice(0,1),e}else for(let t=0;t<e.variants.length;t++)if(o==e.variants[t].value.id)return e.variants.splice(t,1),e;if(null==e.leftNode){let t=e.rightNode;return e=null,t}if(null==e.rightNode){let t=e.leftNode;return e=null,t}{let t=this.inOrderSuccessor(e.rightNode);return e.value=t.value,e.key=t.key,e.variants=t.variants,e.currentNode=t.currentNode,e.rightNode=this.removeNodeWithVariants(e.rightNode,t.key,o),e}}countNodeBelow(e){return null==e?0:1+this.countNodeBelow(e.leftNode)+this.countNodeBelow(e.rightNode)}inOrderSuccessor(e){for(;null!=e.leftNode;)e=e.leftNode;return e}}},5976:(e,t,o)=>{o.d(t,{p:()=>l,B:()=>a});var n=o(9581),i=o(3518),r=o(1863),c=o(2830),s=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class a{static getId(){return s(this,void 0,void 0,(function*(){this.ids.length<5&&(yield function(){var e,t,o,s,l=arguments;return e=this,t=void 0,s=function*(){const e=c.Logger.logfunction("GetReservedIds",l);try{let t=(0,i.Xr)("application/x-www-form-urlencoded");const o=yield fetch(n.B.GetReservedIdUrl(),{method:"GET",headers:t});if(!o.ok)throw(0,r.ry)(o),new Error(`Error! status: ${o.status}`);const s=yield o.json();for(let e=0;e<s.length;e++)a.AddId(s[e]);c.Logger.logUpdate(e)}catch(t){t instanceof Error?console.log("get reserved ids error message: ",t.message):console.log("get reserved ids unexpected error: ",t),(0,r.Mb)(t,n.B.GetReservedIdUrl()),(0,r.ey)(e,"GetReservedIds",t)}},new((o=void 0)||(o=Promise))((function(n,i){function r(e){try{a(s.next(e))}catch(e){i(e)}}function c(e){try{a(s.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?n(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(r,c)}a((s=s.apply(e,t||[])).next())}))}());var e=this.ids[0];return this.ids.shift(),e}))}static AddId(e){this.ids.includes(e)||this.ids.push(e)}}a.ids=[];class l{static getId(){return s(this,void 0,void 0,(function*(){this.connectionIds.length<5&&(yield function(){var e,t,o,s,a=arguments;return e=this,t=void 0,s=function*(){const e=c.Logger.logfunction("GetReservedConnectionIds",a);try{let t=(0,i.Xr)("application/x-www-form-urlencoded");const o=yield fetch(n.B.GetReservedConnectionIdUrl(),{method:"GET",headers:t});if(!o.ok)throw(0,r.ry)(o),new Error(`Error! status: ${o.status}`);const s=yield o.json();for(let e=0;e<s.length;e++)l.AddId(s[e]);c.Logger.logUpdate(e)}catch(t){t instanceof Error?console.log("get reserved connection ids error message: ",t.message):console.log("get reserved connection ids unexpected error: ",t),(0,r.Mb)(t,n.B.GetReservedConnectionIdUrl()),(0,r.ey)(e,"GetReservedConnectionIds",t)}},new((o=void 0)||(o=Promise))((function(n,i){function r(e){try{a(s.next(e))}catch(e){i(e)}}function c(e){try{a(s.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?n(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(r,c)}a((s=s.apply(e,t||[])).next())}))}());var e=this.connectionIds[0];return this.connectionIds.shift(),e}))}static AddId(e){this.connectionIds.includes(e)||this.connectionIds.push(e)}}l.connectionIds=[]},7273:(e,t,o)=>{o.d(t,{z:()=>i});var n=o(9581);class i{constructor(e,t,o,i){this.url=n.B.BASE_URL,this.message=e,this.ok=t,this.status=o,this.data=i}getMessage(){return this.message}setMessage(e){return this.message=e,this}getStatus(){return this.status}setStatus(e){return this.status=e,this}getData(){return this.data}setData(e){return this.data=e,this}getOk(){return this.ok}setOk(e){return this.ok=e,this}getUrl(){return this.url}setUrl(e){return this.url=e,this}}},3278:(e,t,o)=>{o.d(t,{b:()=>n});class n{}n.BearerAccessToken="",n.sessionId=998},2299:(e,t,o)=>{o.d(t,{B:()=>n});class n{constructor(e){this.id=1,this.isOnlineSync=!1,this.isOnlineSync=e}}},442:(e,t,o)=>{o.d(t,{Y:()=>u});var n=o(1167),i=o(2155),r=o(9581),c=o(3518),s=o(1863),a=o(9639),l=o(8286),d=o(2830);class u{static CheckContains(e){for(var t=!1,o=0;o<this.conceptsSyncArray.length;o++)this.conceptsSyncArray[o].id==e.id&&(t=!0);return t}static SyncDataDelete(e){for(var t=0;t<this.conceptsSyncArray.length;t++)e==this.conceptsSyncArray[t].id&&this.conceptsSyncArray.splice(t,1);for(t=0;t<this.connectionSyncArray.length;t++)this.connectionSyncArray[t].ofTheConceptId!=e&&this.connectionSyncArray[t].toTheConceptId!=e&&this.connectionSyncArray[t].typeId!=e||this.connectionSyncArray.splice(t,1)}static CheckContainsConnection(e){for(var t=!1,o=0;o<this.connectionSyncArray.length;o++)this.connectionSyncArray[o].id==e.id&&(t=!0);return t}static AddConcept(e){this.conceptsSyncArray.push(e)}static RemoveConcept(e){for(var t=0;t<this.conceptsSyncArray.length;t++)this.conceptsSyncArray[t].id==e.id&&this.conceptsSyncArray.splice(t,1)}static AddConnection(e){this.connectionSyncArray.push(e)}static RemoveConnection(e){for(var t=0;t<this.connectionSyncArray.length;t++)this.connectionSyncArray[t].id==e.id&&this.connectionSyncArray.splice(t,1)}static SyncDataOnline(){return e=this,t=void 0,u=function*(){if(d.serviceWorker)try{return(yield(0,d.sendMessage)("SyncData__SyncDataOnline",{})).data}catch(e){console.error("SyncData__SyncDataOnline sw error: ",e),(0,d.handleServiceWorkerException)(e)}for(let e=0;e<this.conceptsSyncArray.length;e++)a.I.AddConcept(this.conceptsSyncArray[e]);for(let e=0;e<this.connectionSyncArray.length;e++)l.d.AddConnection(this.connectionSyncArray[e]);if(this.conceptsSyncArray.length>0){let e=this.conceptsSyncArray.slice();this.conceptsSyncArray=[],(0,n.Y)(e)}if(this.connectionSyncArray.length>0){let e=this.connectionSyncArray.slice();this.connectionSyncArray=[],yield function(e){return t=this,o=void 0,a=function*(){let t=new i.N(0,0,0,0,0,0,0);try{var o=(0,c.Xr)(),n=JSON.stringify(e);const i=yield fetch(r.B.CreateTheConnectionUrl(),{method:"POST",headers:o,body:n});return i.ok?yield i.json():(console.log("Create the connection error message: ",i.status),(0,s.ry)(i)),t}catch(e){throw e instanceof Error?console.log("Create the connection error message: ",e.message):console.log(" Create the connection unexpected error: ",e),e}},new((n=void 0)||(n=Promise))((function(e,i){function r(e){try{s(a.next(e))}catch(e){i(e)}}function c(e){try{s(a.throw(e))}catch(e){i(e)}}function s(t){var o;t.done?e(t.value):(o=t.value,o instanceof n?o:new n((function(e){e(o)}))).then(r,c)}s((a=a.apply(t,o||[])).next())}));var t,o,n,a}(e)}return"done"},new((o=void 0)||(o=Promise))((function(n,i){function r(e){try{s(u.next(e))}catch(e){i(e)}}function c(e){try{s(u.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?n(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(r,c)}s((u=u.apply(e,t||[])).next())}));var e,t,o,u}}u.conceptsSyncArray=[],u.connectionSyncArray=[]},9003:(e,t,o)=>{o.d(t,{S5:()=>l,kH:()=>u,qI:()=>a,wh:()=>h});var n=o(1863),i=o(2830),r=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};let c=10;class s{}function a(e){const t=i.Logger.logfunction("openDatabase",arguments);return new Promise((function(o,r){s.db&&(i.Logger.logUpdate(t),o(s.db));let l=i.BaseUrl.BASE_URL+"_FreeSchemaLocal"+i.BaseUrl.BASE_APPLICATION;const u=indexedDB.open(l,c);u.onupgradeneeded=e=>{var t=e.target.result,n="localconcept",r="localconnection",s="localid";console.log("this is the version upgrade",c),t.objectStoreNames.contains(n)&&t.deleteObjectStore(n),t.objectStoreNames.contains(r)&&t.deleteObjectStore(r),t.objectStoreNames.contains(s)&&t.deleteObjectStore(s),t.objectStoreNames.contains(n)||(t.createObjectStore(n,{keyPath:"id"}).transaction.oncomplete=e=>{}),t.objectStoreNames.contains(r)||(t.createObjectStore(r,{keyPath:"id"}).transaction.oncomplete=e=>{}),t.objectStoreNames.contains(s)||(t.createObjectStore(s,{keyPath:"id"}).transaction.oncomplete=e=>{d(s,{id:0,value:-100}),d(s,{id:1,value:-200}),d(s,{id:3,value:i.BaseUrl.getRandomizer()})}),o(t)},u.onerror=o=>{console.error("Why didn't you allow my web app to use IndexedDB?!",o),indexedDB.deleteDatabase(l),a(e),(0,n.ey)(t,"openDatabase",o),r(o)},u.onsuccess=function(e){var n=e.target;s.db=n.result,i.Logger.logUpdate(t),o(s.db)}}))}function l(e){var t=arguments;return r(this,void 0,void 0,(function*(){const o=i.Logger.logfunction("getObjectsFromLocalIndexDb",t);return new Promise((function(t,r){a(e).then((n=>{var r=[],c=n.transaction(e,"readwrite").objectStore(e).getAll();c.onsuccess=()=>{const e=c.result;for(var n=0;n<e.length;n++)r.push(e[n]);i.Logger.logUpdate(o),t(r)}})).catch((e=>{let t={status:400,ok:!1,message:"Cannot get objects from database because you cannot open the Local database",data:e};(0,n.ey)(o,"getObjectsFromLocalIndexDb",t),r(t)}))}))}))}function d(e,t){const o=i.Logger.logfunction("storeToDatabase",[e,"localindexdb"]);return new Promise((function(r,c){a(e).then((s=>{const a=s.transaction(e,"readwrite").objectStore(e).add(t);a.onsuccess=e=>{i.Logger.logUpdate(o),r(t)},a.onerror=i=>{let r={status:400,ok:!1,message:"Cannot store to the Local database "+e,data:i,body:t};(0,n.ey)(o,"storeToDatabase",r),c(r)}})).catch((e=>{let t={status:400,ok:!1,message:"Cannot store to database because you cannot open the Local database",data:e};(0,n.ey)(o,"storeToDatabase",t),c(t)}))}))}function u(e,t){const o=i.Logger.logfunction("UpdateToDatabase",arguments);return new Promise((function(r,c){a(e).then((s=>{const a=s.transaction(e,"readwrite").objectStore(e).put(t);a.onsuccess=e=>{i.Logger.logUpdate(o),r(t)},a.onerror=i=>{let r={status:400,ok:!1,message:"Cannot Update to the Local database"+e,data:i,body:t};(0,n.ey)(o,"UpdateToDatabase",r),c(r)}})).catch((e=>{let t={status:400,ok:!1,message:"Cannot update to database because you cannot open the Local database",data:e};(0,n.ey)(o,"UpdateToDatabase",t),c(t)}))}))}function h(e,t){const o=i.Logger.logfunction("removeFromDatabase",arguments);return new Promise((function(r,c){a(e).then((s=>{let a=s.transaction(e,"readwrite").objectStore(e).delete(t);a.onsuccess=function(e){i.Logger.logUpdate(o),r(t)},a.onerror=function(i){let r={status:400,ok:!1,message:"Cannot Update to the Local database"+e,data:i,body:t};(0,n.ey)(o,"removeFromDatabase",r),c(r)}})).catch((e=>{let t={status:400,ok:!1,message:"Cannot remove object from database because you cannot open the Local database",data:e};(0,n.ey)(o,"removeFromDatabase",t),c(t)}))}))}},3655:(e,t,o)=>{o.d(t,{El:()=>h,b8:()=>u,kH:()=>d,qI:()=>l,wh:()=>p});var n=o(2299),i=o(9581),r=o(2830),c=o(1863);let s=10;class a{}function l(e){const t=r.Logger.logfunction("openDatabase",[e,"indexdb"]);return new Promise((function(o,n){a.db&&(r.Logger.logUpdate(t),o(a.db));let d=i.B.BASE_URL+"_FreeSchema"+i.B.BASE_APPLICATION;const u=indexedDB.open(d,s);u.onupgradeneeded=e=>{let n=e.target.result,i="concept",c="connection",a="settings";console.log("this is the version update for index",s),n.objectStoreNames.contains(i)&&n.deleteObjectStore(i),n.objectStoreNames.contains(c)&&n.deleteObjectStore(c),n.objectStoreNames.contains(a)&&n.deleteObjectStore(a),n.objectStoreNames.contains(i)||(n.createObjectStore(i,{keyPath:"id"}).transaction.oncomplete=e=>{}),n.objectStoreNames.contains(c)||(n.createObjectStore(c,{keyPath:"id"}).transaction.oncomplete=e=>{}),n.objectStoreNames.contains(a)||(n.createObjectStore(a,{keyPath:"id"}).transaction.oncomplete=e=>{}),r.Logger.logUpdate(t),o(n)},u.onerror=o=>{console.error("Why didn't you allow my web app to use IndexedDB?!",o),indexedDB.deleteDatabase(d),l(e),(0,c.ey)(t,"openDatabase",o),n(o)},u.onsuccess=function(e){let n=e.target;a.db=n.result,r.Logger.logUpdate(t),o(a.db)}}))}function d(e,t){const o=r.Logger.logfunction("UpdateToDatabase",[e,"indexdb"]);return new Promise((function(n,i){l(e).then((s=>{const a=s.transaction(e,"readwrite").objectStore(e).put(t);a.onsuccess=e=>{r.Logger.logUpdate(o),n(t)},a.onerror=n=>{let r={status:400,ok:!1,message:"Cannot Update to the database"+e,data:n,body:t};(0,c.ey)(o,"UpdateToDatabase",r),i(r)}})).catch((e=>{let t={status:400,ok:!1,message:"Cannot update to database because you cannot open the database",data:e};(0,c.ey)(o,"UpdateToDatabase",t),i(t)}))}))}function u(){const e=r.Logger.logfunction("GetLastSettingsFromDatabase",["indexdb"]);return new Promise((function(t,o){let i="settings";l(i).then((s=>{let a=s.transaction(i,"readwrite").objectStore(i).getAll();a.onsuccess=()=>{let o=new n.B(!1),i=a.result;for(let e=0;e<i.length;e++)o=i[e];r.Logger.logUpdate(e),t(o)},a.onerror=t=>{(0,c.ey)(e,"GetLastSettingsFromDatabase",t),o(t)}})).catch((t=>{let n={status:400,ok:!1,message:"Cannot get last object from database because you cannot open the database",data:t};(0,c.ey)(e,"GetLastSettingsFromDatabase",n),o(n)}))}))}function h(e){const t=r.Logger.logfunction("AiUpdateFlag",["indexdb"]);return new Promise((function(o,n){let i="settings";l(i).then((s=>{const a=s.transaction(i,"readwrite").objectStore(i).put(e);a.onsuccess=n=>{r.Logger.logUpdate(t),o(e)},a.onerror=o=>{let i={status:400,ok:!1,message:"Cannot update AI flag",data:o,body:e};(0,c.ey)(t,"AiUpdateFlag",i),n(i)}})).catch((e=>{let o={status:400,ok:!1,message:"Cannot update AI flag because you cannot open the database",data:e};(0,c.ey)(t,"AiUpdateFlag",o),n(o)}))}))}function p(e,t){const o=r.Logger.logfunction("removeFromDatabase",[e,"indexdb"]);return new Promise((function(n,i){l(e).then((s=>{const a=s.transaction(e,"readwrite").objectStore(e).delete(Number(t));a.onsuccess=function(e){r.Logger.logUpdate(o),n(t)},a.onerror=t=>{let n={status:400,ok:!1,message:"Cannot remove from the database"+e,data:t};(0,c.ey)(o,"removeFromDatabase",n),i(n)}})).catch((e=>{let n={status:400,ok:!1,message:"Cannot remove from the database because you cannot open the database",data:e,body:t};(0,c.ey)(o,"removeFromDatabase",n),i(n)}))}))}},4485:(e,t,o)=>{function n(e=[],t){var o,n;let i=[],r=null===(o=t.type)||void 0===o?void 0:o.characterValue;if((null==r?void 0:r.startsWith("the_"))||(r="the_"+r),Array.isArray(e))for(let o=0;o<e.length;o++){let c=null===(n=e[o].type)||void 0===n?void 0:n.characterValue;(null==c?void 0:c.startsWith("the_"))||(c="the_"+c),t.typeId!=e[o].typeId&&r!=c||i.push(e[o])}return i}function i(e=[],t){let o=[],n=t.typeCharacter;if((null==n?void 0:n.startsWith("the_"))||(n="the_"+n),Array.isArray(e))for(let i=0;i<e.length;i++){let r=e[i].typeCharacter;(null==r?void 0:r.startsWith("the_"))||(r="the_"+r),t.typeId!=e[i].typeId&&n!=r||o.push(e[i])}return o}function r(e=[],t){let o=[];if(Array.isArray(e)){const n=e.find((e=>e.toTheConceptId==t));n&&o.push(n);const i=e.find((e=>e.ofTheConceptId==t));i&&o.push(i)}return o}function c(e=[],t){let o=[];if(Array.isArray(e)){const n=e.find((e=>e.toTheConceptId==t));n&&o.push(n);const i=e.find((e=>e.ofTheConceptId==t));i&&o.push(i)}return o}o.d(t,{gt:()=>c,nm:()=>i,vo:()=>n,wS:()=>r}),o(2155),o(7282)},9934:(e,t,o)=>{function n(e,t){return-1===e.indexOf(t)&&e.push(t),e}o.d(t,{A:()=>n})},9700:(e,t,o)=>{o.d(t,{R:()=>d,V:()=>l});var n,i=o(2830),r=o(3278),c=o(1863),s=o(3518),a=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class l{static startAutoSync(){this.autoSyncInterval?console.warn("Auto-sync is already running."):(this.nextSyncTime=Date.now()+this.SYNC_INTERVAL_MS,setInterval((()=>{const e=Date.now();this.nextSyncTime&&e>=this.nextSyncTime&&(this.nextSyncTime=e+this.SYNC_INTERVAL_MS,this.sendPackageLogsToServer(),this.sendApplicationLogsToServer())}),6e4))}static stopAutoSync(){null!==this.autoSyncInterval&&(clearInterval(this.autoSyncInterval),this.autoSyncInterval=null,this.nextSyncTime=null)}static setLogLevel(e){this.logLevel=e}static shouldLog(e){return this.LOG_LEVELS.indexOf(e)>=this.LOG_LEVELS.indexOf(this.logLevel)}static formatLogData(e,t,o){if(!this.shouldLog(e))return;const n=Object.assign({timestamp:(new Date).toLocaleString(),level:e,message:t},o);return this.packageLogsData.push(n),"ERROR"==e&&(this.sendPackageLogsToServer(),this.sendApplicationLogsToServer()),n}static log(e,t,o){if(this.logPackageActivationStatus)try{this.formatLogData(e,t,o||null)}catch(e){console.error("Error on Logger Log : ",e)}}static logUpdate(e){var t;try{if(!e)return void console.error("logUpdate failed: logData is undefined");const o=Date.now();e.startTime=null!==(t=e.startTime)&&void 0!==t?t:o;const n=o-e.startTime;e.responseTime=`${n} ms`,1==!e.serviceWorker&&(e.serviceWorker=!1)}catch(t){(0,c.ey)(e,"Logger.logUpdate",t)}}static logfunction(e,...t){const o=Date.now();let n=t;const c=i.BaseUrl.getRandomizer(),s=r.b.sessionId;let a={startTime:o,functionName:e,functionParameters:n,requestFrom:i.BaseUrl.BASE_APPLICATION,sessionId:s,applicationId:c};return this.formatLogData("INFO","function called",a)}static logError(e,t,o,n,i,r,c,s,a,l,u){try{const h=d("SessionId"),p={startTime:e,userId:t,operationType:o,requestFrom:n,requestIP:i,responseStatus:r,responseTime:`${(performance.now()-e).toFixed(3)}ms`,responseSize:c?`${JSON.stringify(c).length}`:"0",sessionId:null==h?void 0:h.toString(),functionName:s,functionParameters:a,userAgent:l,conceptsUsed:u};this.formatLogData("ERROR",`Information logged for ${s}`,p)}catch(e){console.error("Error on logError")}}static logApplication(e,t,o){if(console.log("LogApplicationActivationStatus : ",this.logApplicationActivationStatus),this.logApplicationActivationStatus)try{const n={timestamp:(new Date).toLocaleString(),type:e,message:t,data:o||null};this.applicationLogsData.push(n)}catch(e){console.error("Failed to log application activity:",e)}}static sendApplicationLogsToServer(){return a(this,void 0,void 0,(function*(){const e=this.applicationLogsData;try{if(console.log("Log from sendApplicationLogsToServer : ",this.applicationLogsData),0===this.applicationLogsData.length)return;this.applicationLogsData=[],r.b.BearerAccessToken;const t=50;let o=(0,s.Xr)();for(let n=0;n<e.length;n+=t){const r=e.slice(n,n+t),c=yield fetch(i.BaseUrl.PostLogger(),{method:"POST",headers:o,body:JSON.stringify({logType:this.appLogs,logData:r})});c.ok||(yield c.text())}}catch(e){}}))}static sendPackageLogsToServer(){return a(this,void 0,void 0,(function*(){const e=this.packageLogsData;try{if(console.log("Log from sendPackageLogsToServer : ",this.packageLogsData),0===this.packageLogsData.length)return;this.packageLogsData=[];const t=300;for(let o=0;o<e.length;o+=t){const n=e.slice(o,o+t);let r=(0,s.Xr)();const c=yield fetch(i.BaseUrl.PostLogger(),{method:"POST",headers:r,body:JSON.stringify({logType:this.mftsccsBrowser,logData:n})});if(!c.ok)return void(yield c.text())}}catch(e){}}))}static saveLogToLocalStorage(e,t){try{if(void 0===typeof localStorage)return void console.warn("Local Storage type undefined");{const o=JSON.parse((null===localStorage||void 0===localStorage?void 0:localStorage.getItem(e))||"[]");o.push(t),null===localStorage||void 0===localStorage||localStorage.setItem(e,JSON.stringify(o))}}catch(e){console.error("Error on saving log in localstorage"),this.log("ERROR","Error while saving log in local storage")}}static clearLogsFromLocalStorage(e){void 0!==typeof localStorage?null===localStorage||void 0===localStorage||localStorage.removeItem(e):console.warn("localStorage is not available")}}function d(e){try{let t=e+"=",o=decodeURIComponent(document.cookie);console.log("this is the decoded cookie",o);let n=o.split(";");for(let e=0;e<n.length;e++){let o=n[e];for(;" "==o.charAt(0);)o=o.substring(1);if(0==o.indexOf(t))return o.substring(t.length,o.length)}return""}catch(e){return console.error("Error on getcookie"),""}}n=l,l.logLevel="INFO",l.packageLogsData=[],l.applicationLogsData=[],l.LOG_LEVELS=["DEBUG","INFO","WARNING","ERROR"],l.SYNC_INTERVAL_MS=12e4,l.nextSyncTime=null,l.appLogs="app",l.mftsccsBrowser="mftsccs",l.logApplicationActivationStatus=!1,l.logPackageActivationStatus=!1,l.autoSyncInterval=null,n.startAutoSync()},1412:(e,t,o)=>{function n(e=[],t=[]){}o.d(t,{e:()=>n})},5898:(e,t,o)=>{o.d(t,{w:()=>s,V:()=>a});var n=o(7139),i=o(2830);class r{constructor(){this.conceptId=0,this.connectionTypeId=0,this.connectionType="",this.count=0}}var c=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function s(e=[]){let t=[];if(e.length>0)for(let o=0;o<e.length;o++){let n=l(e[o]);t.push(n)}return t}function a(e){var t=arguments;return c(this,void 0,void 0,(function*(){const o=i.Logger.logfunction("GetConnectionTypeForCount",t);let r={};for(let t=0;t<e.length;t++){let o=yield(0,n.r)(e[t].connectionTypeId);e[t].connectionType=o.characterValue,r[e[t].conceptId]=e[t]}return i.Logger.logUpdate(o),r}))}function l(e){const t=e.split("_");if(3===t.length){let e=new r;return e.conceptId=Number(t[0]),e.connectionTypeId=Number(t[1]),e.count=Number(t[2]),e}throw new Error("Input string must contain exactly three parts separated by underscores.")}},1863:(e,t,o)=>{o.d(t,{ER:()=>c,Mb:()=>s,ey:()=>a,ry:()=>r});var n=o(2830),i=o(7273);function r(e){if(n.Logger.log("ERROR",e.statusText,{code:e.status,data:e.statusText}),401==e.status||406==e.status){let t=new i.z(e.statusText,!1,e.status,"");throw t.setUrl(e.url),t}if(500==e.status){let t=new i.z(e.statusText,!1,e.status,"");throw t.setUrl(e.url),t}}function c(e,t={}){if(n.Logger.log("ERROR",t.statusText,{code:e.status,data:e.status}),401==e.status||406==e.status){let o=new i.z(t.statusText,!1,e.status,"");throw o.setUrl(e.url),o}if(500==e.status){let o=new i.z(t.statusText,!1,e.status,"");throw o.setUrl(e.url),o}}function s(e,t=""){if(n.Logger.log("ERROR",e.message,{code:e.status,data:e.stack}),e.status){let o=new i.z(e.message,!1,e.status,e.stack);throw o.setUrl(t),o}{let o=new i.z(e.message,!1,500,e.stack);throw o.setUrl(t),o}}function a(e,t,o){var n;try{if(!e)return void console.error(`Error in ${t}: logData is undefined`);const i=Date.now();e.startTime=null!==(n=e.startTime)&&void 0!==n?n:i,e.responseTime=i-e.startTime+" ms",e.level="ERROR",e.errorMessage=(null==o?void 0:o.message)||"Unknown error occurred"}catch(e){console.error("Failed to handle package function error:",e)}}},176:(e,t,o)=>{o.d(t,{F4:()=>c,P6:()=>a,dp:()=>s});var n=o(2155),i=o(7282),r=o(6416);function c(e){var t,o;const n=(0,r.u)();return n.id=e.id,n.ghostId=e.ghostId,n.userId=e.userId,n.accessId=e.accessId,n.categoryId=e.categoryId,n.characterValue=e.characterValue,n.entryTimeStamp=e.entryTimeStamp,n.typeId=e.typeId,n.type=e.type,n.isTemp=!1,n.typeCharacter=null!==(o=null===(t=null==e?void 0:e.type)||void 0===t?void 0:t.characterValue)&&void 0!==o?o:"",n}function s(e){const t=(0,i.o)();return t.id=e.id,t.ghostId=e.ghostId,t.userId=e.userId,t.accessId=e.accessId,t.entryTimeStamp=e.entryTimeStamp,t.typeId=e.typeId,t.categoryId=e.categoryId,t}function a(e){const t=new n.N(0,0,0,0,0,0,0);return t.id=e.id,t.ghostId=e.ghostId,t.accessId=e.accessId,t.ofTheConceptId=e.ofTheConceptId,t.toTheConceptId=e.toTheConceptId,t.entryTimeStamp=e.entryTimeStamp,t.typeId=e.typeId,t.isTemp=!1,t}},5020:(e,t,o)=>{o.d(t,{A:()=>s});var n=o(2830),i=o(9639),r=o(205),c=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function s(){return c(this,void 0,void 0,(function*(){try{let e=[];if(Array.isArray(e))for(let t=0;t<e.length;t++){let o=e[t];i.I.AddConceptToMemory(o)}r.B.isDataLoaded=!0,r.B.isCharacterLoaded=!0,r.B.isTypeLoaded=!0}catch(e){throw yield(0,n.DelayFunctionExecution)(2e3,s()),{message:"Cannot create Binary Tree Concept",ok:!1,status:400,data:e}}}))}},7282:(e,t,o)=>{o.d(t,{o:()=>i});var n=o(2615);function i(){let e=new Date,t=new Date;return new n.j(0,0,0,0,0,"0",0,!1,e,t,"0")}},1218:(e,t,o)=>{o.d(t,{A:()=>a});var n=o(2830),i=o(7282),r=o(1666),c=o(8407),s=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function a(e){return s(this,arguments,void 0,(function*(e,t=null,o=null,s=null,l=null,d=null,u=null){if(n.serviceWorker)try{return(yield(0,n.sendMessage)("CreateTheComposition",{json:e,ofTheConceptId:t,ofTheConceptUserId:o,mainKey:s,userId:l,accessId:d,sessionInformationId:u})).data}catch(e){console.error("CreateTheComposition sw error: ",e),(0,n.handleServiceWorkerException)(e)}let h=null!=l?l:999,p=null!=d?d:4,f=null!=u?u:999,y=null!=s?s:0,v=(0,i.o)();for(const n in e)if("string"!=typeof e[n]&&"number"!=typeof e[n])if(null==t&&null==o){let t=y,o=yield(0,c.A)(n,"",!0,h,p,f);v=o,t=o.id,y=o.id,yield a(e[n],o.id,o.userId,t,l,d,u)}else{let i=null!=t?t:999,s=null!=o?o:999,g=y,m=yield(0,c.A)(n,"",!0,h,p,f);v=m,yield(0,r.q)(i,s,m.id,g),yield a(e[n],m.id,m.userId,g,l,d,u)}else{let i=null!=t?t:999,s=null!=o?o:10267,a=y,l=yield(0,c.A)(n,e[n].toString(),!1,h,p,f);yield(0,r.q)(i,s,l.id,a)}return v}))}},2212:(e,t,o)=>{o.d(t,{Ay:()=>l,N:()=>d});var n=o(1167),i=o(2615),r=o(5976),c=o(442),s=o(2830),a=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function l(e,t,o,n,s,l,d){return a(this,void 0,void 0,(function*(){let a=yield r.B.getId(),u=new Date,h=new Date,p=new i.j(a,t,n,o,s,e,l,!0,u,h,d);return p.isTemp=!1,c.Y.AddConcept(p),p}))}function d(e,t,o,c,l,d,u){return a(this,void 0,void 0,(function*(){let a=yield r.B.getId(),h=new Date,p=new Date,f=new i.j(a,t,c,o,l,e,d,!1,h,p,u);return s.ConceptsData.AddConcept(f),(0,n.Y)([f]),f}))}},1666:(e,t,o)=>{o.d(t,{q:()=>c});var n=o(2155),i=o(442),r=o(1863);function c(e,t,o,c){var s=t,a=new n.N(0,e,o,s,c,1,4);if(e==o)return a.ofTheConceptId=0,a.toTheConceptId=1,a;try{a.isTemp=!0,a.id=Math.floor(1e8*Math.random()),i.Y.AddConnection(a)}catch(e){(0,r.Mb)(e)}return a}},1838:(e,t,o)=>{o.d(t,{m:()=>u});var n=o(2830),i=o(9581),r=o(1863),c=o(3518),s=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))},a=o(5239),l=o(4864),d=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function u(e){var t=arguments;return d(this,void 0,void 0,(function*(){const o=n.Logger.logfunction("DeleteConnectionById",t);if(n.serviceWorker)try{return(yield(0,n.sendMessage)("DeleteConnectionById",{id:e})).data}catch(e){console.error("DeleteConnectionById sw error: ",e),(0,n.handleServiceWorkerException)(e)}e>0?(yield function(e){var t=arguments;return s(this,void 0,void 0,(function*(){const o=n.Logger.logfunction("DeleteTheConnection",t);try{const t=new FormData;t.append("id",e.toString());let s=(0,c.BZ)();const a=yield fetch(i.B.DeleteTheConnectionUrl(),{method:"POST",headers:s,body:t,redirect:"follow"});n.Logger.logUpdate(o),a.ok||(console.log("Delete connection error status: ",a.status),(0,r.ry)(a))}catch(e){e instanceof Error?console.log("Delete connection error message: ",e.message):console.log("Delete connection unexpected error: ",e),(0,r.Mb)(e,i.B.DeleteTheConnectionUrl()),(0,r.ey)(o,"DeleteTheConnection",e)}}))}(e),a.O.removeNodeFromTree(e)):l.G.RemoveConnectionById(e),n.Logger.logUpdate(o)}))}},4364:(e,t,o)=>{o.d(t,{s:()=>c});var n=o(1239),i=o(2830),r=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function c(){return r(this,arguments,void 0,(function*(e=[]){const t=i.Logger.logfunction("FindConceptsFromConnections",[e.length]);let o=[];if(e.length>0){for(let t=0;t<e.length;t++)o.includes(e[t].ofTheConceptId)||o.push(e[t].ofTheConceptId),o.includes(e[t].toTheConceptId)||o.push(e[t].toTheConceptId),o.includes(e[t].typeId)||o.push(e[t].typeId);yield(0,n.r)(o)}i.Logger.logUpdate(t)}))}},5284:(e,t,o)=>{o.d(t,{B:()=>s});var n=o(2830),i=o(8286),r=o(1863),c=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function s(){return c(this,arguments,void 0,(function*(e=[]){const t=n.Logger.logfunction("FindConnectionsOfCompositionsBulkInMemory",[e.length]);let o=[];try{if(n.serviceWorker){t.serviceWorker=!0;try{const o=yield(0,n.sendMessage)("FindConnectionsOfCompositionsBulkInMemory",{composition_ids:e});return n.Logger.logUpdate(t),o.data}catch(e){console.error("FindConnectionsOfCompositionsBulkInMemory sw error: ",e),(0,r.ey)(t,"FindConnectionsOfCompositionsBulkInMemory",e),(0,n.handleServiceWorkerException)(e)}}for(let t=0;t<e.length;t++){let n=yield i.d.GetConnectionsOfConcept(e[t]);o.push(...n)}return n.Logger.logUpdate(t),o}catch(e){return console.error("FindConnectionsOfCompositionsBulkInMemory error: ",e),(0,r.ey)(t,"FindConnectionsOfCompositionsBulkInMemory",e),o}}))}},8939:(e,t,o)=>{o.d(t,{$N:()=>w,$V:()=>h,Ez:()=>I,JA:()=>C,Mb:()=>y,Nj:()=>f,PT:()=>T,RW:()=>m,XI:()=>g,ay:()=>u,hL:()=>d,kx:()=>v,re:()=>p,yz:()=>k,zN:()=>L});var n=o(7139),i=o(2),r=o(9639),c=o(8286),s=o(2830),a=o(1863),l=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function d(e){return l(this,void 0,void 0,(function*(){let t={connectionList:[],compositionList:[]};try{if(s.serviceWorker)try{return(yield(0,s.sendMessage)("GetCompositionById",{id:e})).data}catch(e){console.error("GetCompositionById error sw: ",e),(0,s.handleServiceWorkerException)(e)}let o=yield(0,i.s)(e);t.connectionList=o;for(let e=0;e<t.connectionList.length;e++)t.compositionList.includes(t.connectionList[e].ofTheConceptId)||t.compositionList.push(t.connectionList[e].ofTheConceptId);return t}catch(e){return console.error("GetCompositionById error: ",e),t}}))}function u(e,t,o){return l(this,void 0,void 0,(function*(){var i,c;let s={},a=yield r.I.GetConcept(e);0==a.id&&null!=e&&null!=e&&(a=yield(0,n.r)(e));let l=yield L(e,t,o);return s[null!==(c=null===(i=null==a?void 0:a.type)||void 0===i?void 0:i.characterValue)&&void 0!==c?c:""]=l,s}))}function h(e,t,o){return l(this,void 0,void 0,(function*(){var i,c;let s={},a=yield r.I.GetConcept(e);0==a.id&&null!=e&&null!=e&&(a=yield(0,n.r)(e));let l=yield L(e,t,o);s[null!==(c=null===(i=null==a?void 0:a.type)||void 0===i?void 0:i.characterValue)&&void 0!==c?c:""]=l;let d={};return d.created_at=a.entryTimeStamp,d.data=s,d.id=e,d}))}function p(e,t,o){return l(this,void 0,void 0,(function*(){var i,c;let s={},a=yield r.I.GetConcept(e);0==a.id&&null!=e&&null!=e&&(a=yield(0,n.r)(e));let l=yield A(a,t,o);return s[null!==(c=null===(i=null==a?void 0:a.type)||void 0===i?void 0:i.characterValue)&&void 0!==c?c:""]=l,s}))}function f(e){return l(this,void 0,void 0,(function*(){var t,o;if(s.serviceWorker)try{return(yield(0,s.sendMessage)("GetComposition",{id:e})).data}catch(e){console.error("GetComposition error sw: ",e),(0,s.handleServiceWorkerException)(e)}let c=[],a={};c=yield(0,i.s)(e),console.log("this is the connection list online",c);let l=[];for(let e=0;e<c.length;e++)l.includes(c[e].ofTheConceptId)||l.push(c[e].ofTheConceptId);let d=yield r.I.GetConcept(e);0==d.id&&null!=e&&null!=e&&(d=yield(0,n.r)(e));let u=yield L(e,c,l);return a[null!==(o=null===(t=null==d?void 0:d.type)||void 0===t?void 0:t.characterValue)&&void 0!==o?o:""]=u,a}))}function y(e){return l(this,void 0,void 0,(function*(){var t,o;let c=[],s={};c=yield(0,i.s)(e);let a=[];for(let e=0;e<c.length;e++)a.includes(c[e].ofTheConceptId)||a.push(c[e].ofTheConceptId);let l=yield r.I.GetConcept(e);0==l.id&&null!=e&&null!=e&&(l=yield(0,n.r)(e));let d=yield S(e,c,a);return s[null!==(o=null===(t=null==l?void 0:l.type)||void 0===t?void 0:t.characterValue)&&void 0!==o?o:""]=d,s}))}function v(e){return l(this,void 0,void 0,(function*(){var t,o;if(s.serviceWorker)try{return(yield(0,s.sendMessage)("GetCompositionFromMemory",{id:e})).data}catch(e){console.error("GetCompositionFromMemory error sw: ",e),(0,s.handleServiceWorkerException)(e)}let i=[],a={};i=yield c.d.GetConnectionsOfCompositionLocal(e);let l=[];for(let e=0;e<i.length;e++)l.includes(i[e].ofTheConceptId)||l.push(i[e].ofTheConceptId);let d=yield r.I.GetConcept(e);0==d.id&&null!=e&&null!=e&&(d=yield(0,n.r)(e));let u=yield N(d,i,l);return a[null!==(o=null===(t=null==d?void 0:d.type)||void 0===t?void 0:t.characterValue)&&void 0!==o?o:""]=u,a}))}function g(e){return l(this,void 0,void 0,(function*(){var t,o;if(s.serviceWorker)try{return(yield(0,s.sendMessage)("GetCompositionFromMemoryNormal",{id:e})).data}catch(e){console.error("GetCompositionFromMemoryNormal error sw: ",e),(0,s.handleServiceWorkerException)(e)}let i=[],a={};i=yield c.d.GetConnectionsOfCompositionLocal(e);let l=[];for(let e=0;e<i.length;e++)l.includes(i[e].ofTheConceptId)||l.push(i[e].ofTheConceptId);let d=yield r.I.GetConcept(e);0==d.id&&null!=e&&null!=e&&(d=yield(0,n.r)(e));let u=yield A(d,i,l);return a[null!==(o=null===(t=null==d?void 0:d.type)||void 0===t?void 0:t.characterValue)&&void 0!==o?o:""]=u,a}))}function m(e){var t=arguments;return l(this,void 0,void 0,(function*(){var o,i;const l=s.Logger.logfunction("GetCompositionWithIdFromMemory",t);if(s.serviceWorker){l.serviceWorker=!0;try{const t=yield(0,s.sendMessage)("GetCompositionWithIdFromMemory",{id:e});return s.Logger.logUpdate(l),t.data}catch(e){console.error("GetCompositionWithIdFromMemory error sw: ",e),(0,a.ey)(l,"GetCompositionWithIdFromMemory",e),(0,s.handleServiceWorkerException)(e)}}let d={},u=[],h={};try{u=yield c.d.GetConnectionsOfCompositionLocal(e);let t=[];for(let e=0;e<u.length;e++)t.includes(u[e].ofTheConceptId)||t.push(u[e].ofTheConceptId);let s=yield r.I.GetConcept(e);0==s.id&&null!=e&&null!=e&&(s=yield(0,n.r)(e));let a=yield N(s,u,t);h[null!==(i=null===(o=null==s?void 0:s.type)||void 0===o?void 0:o.characterValue)&&void 0!==i?i:""]=a,d.created_at=s.entryTimeStamp,d.data=h,d.id=e}catch(t){console.log("this is the exception in GetCompositionWithIdFromMemory",e),(0,a.ey)(l,"GetCompositionWithIdFromMemory",t)}return s.Logger.logUpdate(l),d}))}function C(e,t){var o=arguments;return l(this,void 0,void 0,(function*(){var i,c;const l=s.Logger.logfunction("GetCompositionFromMemoryWithConnections",o);if(s.serviceWorker){l.serviceWorker=!0;try{const o=yield(0,s.sendMessage)("GetCompositionFromMemoryWithConnections",{id:e,connectionList:t});return s.Logger.logUpdate(l),o.data}catch(e){console.error("GetCompositionFromMemoryWithConnections error sw: ",e),(0,a.ey)(l,"GetCompositionFromMemoryWithConnections",e),(0,s.handleServiceWorkerException)(e)}}let d={},u=[];for(let e=0;e<t.length;e++)u.includes(t[e].ofTheConceptId)||u.push(t[e].ofTheConceptId);let h=yield r.I.GetConcept(e);0==h.id&&null!=e&&null!=e&&(h=yield(0,n.r)(e));let p=yield N(h,t,u);d[null!==(c=null===(i=null==h?void 0:h.type)||void 0===i?void 0:i.characterValue)&&void 0!==c?c:""]=p;let f={};return f.created_at=h.entryTimeStamp,f.data=d,f.id=e,s.Logger.logUpdate(l),f}))}function T(e,t){return l(this,void 0,void 0,(function*(){var o,i;const c=s.Logger.logfunction("GetCompositionWithIdFromMemoryFromConnection",[e]);if(s.serviceWorker){c.serviceWorker=!0;try{const t=yield(0,s.sendMessage)("GetCompositionWithIdFromMemory",{id:e});return s.Logger.logUpdate(c),t.data}catch(e){console.error("GetCompositionWithIdFromMemory error sw: ",e),(0,a.ey)(c,"GetCompositionWithIdFromMemoryFromConnection",e),(0,s.handleServiceWorkerException)(e)}}let l={},d=[];for(let e=0;e<t.length;e++)d.includes(t[e].ofTheConceptId)||d.push(t[e].ofTheConceptId);let u=yield r.I.GetConcept(e);0==u.id&&null!=e&&null!=e&&(u=yield(0,n.r)(e));let h=yield N(u,t,d);console.log("this is the output",h,u),l[null!==(i=null===(o=null==u?void 0:u.type)||void 0===o?void 0:o.characterValue)&&void 0!==i?i:""]=h;let p={};return p.created_at=u.entryTimeStamp,p.data=l,p.id=e,s.Logger.logUpdate(c),p}))}function w(e){return l(this,void 0,void 0,(function*(){var t;if(s.serviceWorker)try{return(yield(0,s.sendMessage)("GetCompositionWithIdFromMemoryNew",{id:e})).data}catch(e){console.error("GetCompositionWithIdFromMemoryNew error sw: ",e),(0,s.handleServiceWorkerException)(e)}let o=[],i={};o=yield c.d.GetConnectionsOfCompositionLocal(e);let a=[];for(let e=0;e<o.length;e++)a.includes(o[e].ofTheConceptId)||a.push(o[e].ofTheConceptId);let d=yield r.I.GetConcept(e);0==d.id&&null!=e&&null!=e&&(console.log("this concept you cannot find ",e),d=yield(0,n.r)(e));let u=(new Date).getTime(),h=yield function(e,t,o){return l(this,arguments,void 0,(function*(e,t,o,n=[]){var i,r,c,a,l,d,u,h;let p={},f=e.id,y=((new Date).getTime(),null!==(r=null===(i=null==e?void 0:e.type)||void 0===i?void 0:i.characterValue)&&void 0!==r?r:"");if(!o.includes(f)){let t=y;return{[t]:null==e?void 0:e.characterValue}}if(n.includes(f))return"";n.push(f);for(let e=0;e<t.length;e++){let o=yield(0,s.GetTheConcept)(t[e].ofTheConceptId),n=yield(0,s.GetTheConcept)(t[e].toTheConceptId);t[e].ofConcept=o,t[e].toConcept=n;let i=o.id,r="the_",l=(null!==(a=null===(c=null==n?void 0:n.type)||void 0===c?void 0:c.characterValue)&&void 0!==a?a:"").replace(r,"");null!=p[i]&&null!=p[i]||(p[i]={}),p[i][l]=n.characterValue}let v={};for(let e=0;e<t.length;e++){let o=t[e].ofConcept,n=t[e].toConcept,i=null!==(d=null===(l=null==o?void 0:o.type)||void 0===l?void 0:l.characterValue)&&void 0!==d?d:"",r="the_",c=(null!==(h=null===(u=null==n?void 0:n.type)||void 0===u?void 0:u.characterValue)&&void 0!==h?h:"").replace(r,"");null!=v[o.id]&&null!=v[o.id]||(v[o.id]={});let s=v[o.id];null!=s[i]&&null!=s[i]||(s[i]={}),null!=p[t[e].ofTheConceptId]&&null!=p[t[e].toTheConceptId]?s[i][c]=p[n.id]:s[i][c]=n.characterValue}return v[e.id]}))}(d,o,a);console.log("this is the time for the data to be made",(new Date).getTime()-u),null===(t=null==d?void 0:d.type)||void 0===t||t.characterValue,i=h;let p={};return p.created_at=d.entryTimeStamp,p.data=i,p.id=e,p}))}function I(e){return l(this,void 0,void 0,(function*(){var t,o;if(s.serviceWorker)try{return(yield(0,s.sendMessage)("GetCompositionWithIdAndDateFromMemory",{id:e})).data}catch(e){console.error("GetCompositionWithIdAndDateFromMemory error sw: ",e),(0,s.handleServiceWorkerException)(e)}let i=[],a={};i=yield c.d.GetConnectionsOfCompositionLocal(e);let l=[];for(let e=0;e<i.length;e++)l.includes(i[e].ofTheConceptId)||l.push(i[e].ofTheConceptId);let d=yield r.I.GetConcept(e);0==d.id&&null!=e&&null!=e&&(d=yield(0,n.r)(e));let u=yield L(e,i,l);a[null!==(o=null===(t=null==d?void 0:d.type)||void 0===t?void 0:t.characterValue)&&void 0!==o?o:""]=u;let h={};return h.data=a,h.id=e,h.created_at=d.entryTimeStamp,h}))}function k(e){var t=arguments;return l(this,void 0,void 0,(function*(){var o,c;const l=s.Logger.logfunction("GetCompositionWithId",t);if(s.serviceWorker){l.serviceWorker=!0;try{const t=yield(0,s.sendMessage)("GetCompositionWithId",{id:e});return s.Logger.logUpdate(l),t.data}catch(e){console.error("GetCompositionWithId error sw: ",e),(0,a.ey)(l,"GetCompositionWithId",e),(0,s.handleServiceWorkerException)(e)}}let d=[],u={};d=yield(0,i.s)(e);let h=[];for(let e=0;e<d.length;e++)h.includes(d[e].ofTheConceptId)||h.push(d[e].ofTheConceptId);let p=yield r.I.GetConcept(e);0==p.id&&null!=e&&null!=e&&(p=yield(0,n.r)(e));let f=yield L(e,d,h);u[null!==(c=null===(o=null==p?void 0:p.type)||void 0===o?void 0:o.characterValue)&&void 0!==c?c:""]=f;let y={};return y.data=u,y.id=e,s.Logger.logUpdate(l),y}))}function N(e,t,o){return l(this,arguments,void 0,(function*(e,t,o,i=[]){var c,s,a;let l={},d=[],u=e.id;if(null===(c=null==e?void 0:e.type)||void 0===c?void 0:c.characterValue,!o.includes(u))return null==e?void 0:e.characterValue;if(i.includes(u))return"";i.push(u);for(let e=0;e<t.length;e++)if(t[e].ofTheConceptId==u)if(u!=t[e].toTheConceptId){let c=t[e].toTheConceptId,u=yield r.I.GetConcept(c);if(null!=u&&0!=u.id||null==c||null==c||(u=yield(0,n.r)(c)),0!=u.id&&null==(null==u?void 0:u.type)){let e=u.typeId,t=yield r.I.GetConcept(e);u.type=t,null==t&&null!=e&&null!=e&&(t=yield(0,n.r)(e),u.type=t)}let h="the_",p=(null!==(a=null===(s=null==u?void 0:u.type)||void 0===s?void 0:s.characterValue)&&void 0!==a?a:"").replace(h,"");if(isNaN(Number(p))){if(p){const e=yield N(u,t,o,i);l[p]=e}}else{const e=yield N(u,t,o,i);d[p]=e,l=d}}else console.log("this is the faulty connection ",t[e]);return l}))}function A(e,t,o){return l(this,arguments,void 0,(function*(e,t,o,i=[]){var c,a,l;const d=s.Logger.logfunction("recursiveFetchConceptNormal",[e]);(new Date).getTime();let u={},h=[],p=e.id;if(u.id=p,null===(c=null==e?void 0:e.type)||void 0===c?void 0:c.characterValue,!o.includes(p))return null==e?void 0:e.characterValue;if(i.includes(p))return"";i.push(p);for(let e=0;e<t.length;e++)if(t[e].ofTheConceptId==p)if(p!=t[e].toTheConceptId){let c=t[e].toTheConceptId,s=yield r.I.GetConcept(c);if(null!=s&&0!=s.id||null==c||null==c||(s=yield(0,n.r)(c)),0!=s.id&&null==(null==s?void 0:s.type)){let e=s.typeId,t=yield r.I.GetConcept(e);s.type=t,null==t&&null!=e&&null!=e&&(t=yield(0,n.r)(e),s.type=t)}let d="the_",p=(null!==(l=null===(a=null==s?void 0:s.type)||void 0===a?void 0:a.characterValue)&&void 0!==l?l:"").replace(d,"");if(isNaN(Number(p))){if(p){const e=yield N(s,t,o,i);u[p]=e}}else{const e=yield N(s,t,o,i);h[p]=e,u=h}}else console.log("this is the faulty connection ",t[e]);return s.Logger.logUpdate(d),u}))}function L(e,t,o){return l(this,arguments,void 0,(function*(e,t,o,i=[]){var c,s,a;let l={},d=[];if(0==e)return null;let u=yield r.I.GetConcept(e);if(null!=u&&0!=u.id||null==e||null==e||(u=yield(0,n.r)(e)),0!=u.id&&null==u.type){let e=u.typeId,t=yield r.I.GetConcept(e);u.type=t,null==t&&null!=e&&null!=e&&(t=yield(0,n.r)(e),u.type=t)}if(null===(c=null==u?void 0:u.type)||void 0===c?void 0:c.characterValue,!o.includes(e))return null==u?void 0:u.characterValue;if(i.includes(e))return"";i.push(e);for(let c=0;c<t.length;c++)if((new Date).getTime(),t[c].ofTheConceptId==e)if(e!=t[c].toTheConceptId){let e=t[c].toTheConceptId,u=yield r.I.GetConcept(e);if(null!=u&&0!=u.id||null==e||null==e||(u=yield(0,n.r)(e)),0!=u.id&&null==(null==u?void 0:u.type)){let e=u.typeId,t=yield r.I.GetConcept(e);u.type=t,null==t&&null!=e&&null!=e&&(t=yield(0,n.r)(e),u.type=t)}let h="the_",p=(null!==(a=null===(s=null==u?void 0:u.type)||void 0===s?void 0:s.characterValue)&&void 0!==a?a:"").replace(h,"");if(isNaN(Number(p))){if(p){const n=yield L(e,t,o,i);l[p]=n}}else{const n=yield L(e,t,o,i);d[p]=n,l=d}}else console.log("this is the faulty connection ",t[c]);return l}))}function S(e,t,o){return l(this,arguments,void 0,(function*(e,t,o,i=[]){var c,s,a;let l={},d=[];if(0==e)return null;let u=yield r.I.GetConcept(e);if(null!=u&&0!=u.id||null==e||null==e||(u=yield(0,n.r)(e)),0!=u.id&&null==u.type){let e=u.typeId,t=yield r.I.GetConcept(e);u.type=t,null==t&&null!=e&&null!=e&&(t=yield(0,n.r)(e),u.type=t)}if(null===(c=null==u?void 0:u.type)||void 0===c?void 0:c.characterValue,!o.includes(e))return null==u?void 0:u.characterValue;if(i.includes(e))return"";i.push(e),l.id=e;for(let i=0;i<t.length;i++)if(t[i].ofTheConceptId==e){let e=t[i].toTheConceptId,c=yield r.I.GetConcept(e);if(null!=c&&0!=c.id||null==e||null==e||(c=yield(0,n.r)(e)),c&&null==(null==c?void 0:c.type)){let e=c.typeId,t=yield r.I.GetConcept(e);c.type=t,null==t&&null!=e&&null!=e&&(t=yield(0,n.r)(e),c.type=t)}let u="the_",h=(null!==(a=null===(s=null==c?void 0:c.type)||void 0===s?void 0:s.characterValue)&&void 0!==a?a:"").replace(u,"");if(isNaN(Number(h))){if(h){const n=yield S(e,t,o);l[h]=n}}else{const n=yield S(e,t,o);d[h]=n,l=d}}return l}))}},6687:(e,t,o)=>{o.d(t,{D:()=>w,MT:()=>T,Nt:()=>f,QL:()=>g,as:()=>y,cw:()=>u,dF:()=>d,hG:()=>v,km:()=>p,nr:()=>C,p8:()=>h,rv:()=>m});var n=o(8642),i=o(7467),r=o(2830),c=o(1863),s=o(5284),a=o(8939),l=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function d(){return l(this,arguments,void 0,(function*(e=[]){yield(0,n.Y)(e);let t=[];for(let o=0;o<e.length;o++){let n=yield(0,a.kx)(e[o]);t.push(n)}return t}))}function u(){return l(this,arguments,void 0,(function*(e=[]){yield(0,n.Y)(e);let t=[];for(let o=0;o<e.length;o++){let n=yield(0,a.RW)(e[o]);t.push(n)}return t}))}function h(){return l(this,arguments,void 0,(function*(e=[],t=[]){const o=r.Logger.logfunction("GetCompositionFromConnectionsWithDataId",[e]);if(r.serviceWorker){o.serviceWorker=!0;try{const n=yield(0,r.sendMessage)("GetCompositionFromConnectionsWithDataId",{conceptIds:e,connectionIds:t});return r.Logger.logUpdate(o),n.data}catch(e){console.error("GetCompositionFromConnectionsWithDataId error sw: ",e),(0,c.ey)(o,"GetCompositionFromConnectionsWithDataId",e),(0,r.handleServiceWorkerException)(e)}}let n=[];for(let t=0;t<e.length;t++){let o=yield(0,a.RW)(e[t]);n.push(o)}return r.Logger.logUpdate(o),n}))}function p(){var e=arguments;return l(this,arguments,void 0,(function*(t=[],o=[]){const n=r.Logger.logfunction("GetCompositionFromConnectionsWithDataIdFromConnections",e);if(r.serviceWorker){n.serviceWorker=!0;try{const e=yield(0,r.sendMessage)("GetCompositionFromConnectionsWithDataIdFromConnections",{conceptIds:t,connectionIds:o});return r.Logger.logUpdate(n),e.data}catch(e){console.error("GetCompositionFromConnectionsWithDataIdFromConnections error sw: ",e),(0,c.ey)(n,"GetCompositionFromConnectionsWithDataIdFromConnections",e),(0,r.handleServiceWorkerException)(e)}}let s=yield(0,i.j)(o),l=[];for(let e=0;e<t.length;e++){let o=yield(0,a.PT)(t[e],s);l.push(o)}return r.Logger.logUpdate(n),l}))}function f(){var e=arguments;return l(this,arguments,void 0,(function*(t=[],o=[]){const n=r.Logger.logfunction("GetCompositionFromConnectionsWithDataIdIndex",e);if(r.serviceWorker){n.serviceWorker=!0;try{const e=yield(0,r.sendMessage)("GetCompositionFromConnectionsWithDataIdIndex",{conceptIds:t,connectionIds:o});return r.Logger.logUpdate(n),e.data}catch(e){console.error("GetCompositionFromConnectionsWithDataIdIndex error sw: ",e),(0,c.ey)(n,"GetCompositionFromConnectionsWithDataIdIndex",e),(0,r.handleServiceWorkerException)(e)}}yield(0,i.j)(o),yield(0,s.B)(t);let l={};for(let e=0;e<t.length;e++){let o=yield(0,a.RW)(t[e]);l[t[e]]=o}return r.Logger.logUpdate(n),l}))}function y(){return l(this,arguments,void 0,(function*(e=[],t=[]){yield(0,i.j)(t),yield(0,s.B)(e);let o={};for(let t=0;t<e.length;t++){let n=yield(0,a.kx)(e[t]);o[e[t]]=n}return o}))}function v(){return l(this,arguments,void 0,(function*(e=[],t=[]){if(r.serviceWorker)try{return(yield(0,r.sendMessage)("GetCompositionFromConnectionsWithIndexFromConnections",{conceptIds:e,connectionIds:t})).data}catch(e){console.error("GetCompositionFromConnectionsWithIndexFromConnections error sw: ",e),(0,r.handleServiceWorkerException)(e)}let o=yield(0,i.j)(t),n=[];for(let t=0;t<e.length;t++){let i=yield(0,a.JA)(e[t],o);n[e[t]]=i}return n}))}function g(e){var t=arguments;return l(this,void 0,void 0,(function*(){const o=r.Logger.logfunction("GetConnectionDataPrefetch",t);if(r.serviceWorker){o.serviceWorker=!0;try{const t=yield(0,r.sendMessage)("GetConnectionDataPrefetch",{connectionIds:e});return r.Logger.logUpdate(o),t.data}catch(e){console.error("GetConnectionDataPrefetch error sw: ",e),(0,c.ey)(o,"GetConnectionDataPrefetch",e),(0,r.handleServiceWorkerException)(e)}}let n=[],s=[],a={};for(let t=0;t<e.length;t++){let o=yield r.ConnectionData.GetConnection(e[t]);0==o.id?n.push(e[t]):s.push(o)}for(let t=0;t<n.length;t++)a[e[t]]=!1;let l=[],d=yield(0,i.j)(n);s=[...s,...d];for(let e=0;e<s.length;e++)l.push(s[e].ofTheConceptId),l.push(s[e].toTheConceptId),l.push(s[e].typeId);return yield(0,r.GetConceptBulk)(l),r.Logger.logUpdate(o),s}))}function m(){var e=arguments;return l(this,arguments,void 0,(function*(t=[],o=[]){const n=r.Logger.logfunction("GetCompositionFromConnectionsWithDataIdInObject",e);yield(0,i.j)(o);let c={};for(let e=0;e<t.length;e++){let o=yield(0,a.RW)(t[e]);c[t[e]]=o}return r.Logger.logUpdate(n),c}))}function C(){return l(this,arguments,void 0,(function*(e=[],t=[]){yield(0,i.j)(t);let o={};for(let t=0;t<e.length;t++){let n=yield(0,a.$N)(e[t]);o[e[t]]=n}return o}))}function T(){return l(this,arguments,void 0,(function*(e=[],t=[]){yield(0,i.j)(t);let o={};for(let t=0;t<e.length;t++){let n=yield(0,a.kx)(e[t]);o[e[t]]=n}return o}))}function w(){return l(this,arguments,void 0,(function*(e=[],t=[]){yield(0,i.j)(t);let o={};for(let t=0;t<e.length;t++){let n=yield(0,a.XI)(e[t]);o[e[t]]=n,console.log("this is the normal data",e[t],n)}return o}))}},2013:(e,t,o)=>{o.d(t,{A:()=>a,w:()=>l});var n=o(8146),i=o(2830),r=o(9639),c=o(1863),s=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function a(e){var t=arguments;return s(this,void 0,void 0,(function*(){const o=i.Logger.logfunction("GetConceptByCharacter",t);if(i.serviceWorker){o.serviceWorker=!0;try{const t=yield(0,i.sendMessage)("GetConceptByCharacter",{characterValue:e});return i.Logger.logUpdate(o),t.data}catch(e){console.error("GetConceptByCharacter sw error: ",e),(0,c.ey)(o,"GetConceptByCharacter",e),(0,i.handleServiceWorkerException)(e)}}let s=yield r.I.GetConceptByCharacter(e),a=`${e}`;return null!=s&&0!=(null==s?void 0:s.id)||!a||(yield(0,n.Y)(e),s=yield r.I.GetConceptByCharacterAndTypeLocal(e,51),0==s.id&&(s=yield r.I.GetConceptByCharacter(e))),i.Logger.logUpdate(o),s}))}function l(e){var t=arguments;return s(this,void 0,void 0,(function*(){const o=i.Logger.logfunction("GetConceptByCharacterUpdated",t);if(i.serviceWorker){o.serviceWorker=!0;try{const t=yield(0,i.sendMessage)("GetConceptByCharacterUpdated",{characterValue:e});return i.Logger.logUpdate(o),t.data}catch(e){console.error("GetConceptByCharacterUpdated error sw: ",e),(0,c.ey)(o,"GetConceptByCharacterUpdated",e),(0,i.handleServiceWorkerException)(e)}}let s=yield r.I.GetConceptByCharacter(e),a=`${e}`;return null!=s&&0!=(null==s?void 0:s.id)||!a||(yield(0,n.Y)(e),s=yield r.I.GetConceptByCharacter(e)),i.Logger.logUpdate(o),s}))}},7887:(e,t,o)=>{o.d(t,{a:()=>c,p:()=>s});var n=o(8286),i=o(4864),r=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function c(){return r(this,void 0,void 0,(function*(){try{let e=[];if(Array.isArray(e))for(let t=0;t<e.length;t++)n.d.AddConnectionToMemory(e[t])}catch(e){throw{message:"Cannot create Connection Binary Tree Concept",ok:!1,status:400,data:e}}}))}function s(){return r(this,void 0,void 0,(function*(){try{let e=[];if(Array.isArray(e))for(let t=0;t<e.length;t++)i.G.AddConnectionToMemory(e[t])}catch(e){throw{message:"Cannot create Local Connection Binary Tree Concept",ok:!1,status:400,data:e}}}))}},7876:(e,t,o)=>{o.d(t,{A:()=>l});var n=o(1735),i=o(7139),r=o(2830),c=o(9639),s=o(7282),a=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function l(e){return a(this,arguments,void 0,(function*(e,t=999){let o=performance.now();if(n.J.activateStatus)try{n.J.incrementConcept(e)}catch(e){console.error("Error adding connection in access tracker"),r.Logger.log("ERROR","Error Adding Connection")}try{if(r.serviceWorker)try{console.time("serviceworker");const o=yield(0,r.sendMessage)("GetTheConcept",{id:e,userId:t});return console.timeEnd("serviceworker"),o.data}catch(e){console.error("GetTheConcept sw error: ",e),(0,r.handleServiceWorkerException)(e)}let o=(0,s.o)();if(e<0){let n=yield(0,r.GetUserGhostId)(t,e);return o=(0,r.convertFromLConceptToConcept)(n),o}if(o=yield c.I.GetConcept(e),null!=o&&0!=o.id||null==e||null==e||(o=yield(0,i.r)(e)),0!=o.id&&null==o.type&&null==(yield c.I.GetConcept(o.typeId))&&null!=o.typeId&&null!=o.typeId){let e=yield(0,i.r)(o.typeId);o.type=e}return o}catch(n){throw console.error("this is the error in the getting concept",n),r.Logger.logError(o,t,"read","unknown",void 0,500,n,"GetTheConcept",[e,t],"unknown",void 0),n}}))}},7869:(e,t,o)=>{o.d(t,{_:()=>y,A:()=>f});var n=o(9581),i=o(9639),r=o(1863),c=o(3518),s=o(2830),a=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))},l=o(2299);class d{}d.isUpdated=!1,d.isOnlineSync=!1;var u=o(3655),h=o(9003),p=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function f(){return p(this,arguments,void 0,(function*(e=!0){try{if(yield(0,u.qI)("concepts"),yield(0,h.qI)("concepts"),e){if((yield(0,u.b8)()).isOnlineSync)return!0;yield function(){return a(this,void 0,void 0,(function*(){const e=s.Logger.logfunction("GetAiData");try{const a=(new Date).getTime();var t=(0,c.ab)("application/x-www-form-urlencoded");const l=yield fetch(n.B.GetAllAiData(),{method:"GET",headers:t});l.ok||(console.log("Ai Error Message: ","Cannot get response"),(0,r.ry)(l));const d=yield l.json();for(var o=0;o<d.length;o++)i.I.AddConcept(d[o]);y();let u=(new Date).getTime()-a;console.log("The time taken is ",u),s.Logger.logUpdate(e)}catch(e){e instanceof Error?console.log("Ai Error Message: ",e.message):console.log("Ai Error Message: ",e),(0,r.Mb)(e,n.B.GetAllAiData())}}))}()}return!0}catch(e){let t={message:"cannot initlize the AI system",ok:!1,status:400,data:e};return console.log(t),!0}}))}function y(){return p(this,void 0,void 0,(function*(){d.isOnlineSync=!0;var e=new l.B(d.isOnlineSync);(0,u.El)(e)}))}},8095:(e,t,o)=>{o.d(t,{h:()=>s});var n=o(2830),i=o(9700),r=o(1863),c=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function s(e,t,o){var s=arguments;return c(this,arguments,void 0,(function*(e,t,o,c=!1,a={concepts:[],connections:[]}){var l,d,u,h,p,f;const y=i.V.logfunction("CreateConnectionBetweenTwoConceptsLocal",s);let v=performance.now();try{if(n.serviceWorker){y.serviceWorker=!0;try{const r=yield(0,n.sendMessage)("CreateConnectionBetweenTwoConceptsLocal",{ofTheConcept:e,toTheConcept:t,linker:o,both:c,actions:a});return(null===(d=null===(l=null==r?void 0:r.actions)||void 0===l?void 0:l.concepts)||void 0===d?void 0:d.length)&&(a.concepts=JSON.parse(JSON.stringify(r.actions.concepts))),(null===(h=null===(u=null==r?void 0:r.actions)||void 0===u?void 0:u.connections)||void 0===h?void 0:h.length)&&(a.connections=JSON.parse(JSON.stringify(r.actions.connections))),i.V.logUpdate(y),r.data}catch(e){console.error("CreateConnectionBetweenTwoConceptsLocal sw error: ",e),(0,r.ey)(y,"CreateConnectionBetweenTwoConceptsLocal",e),(0,n.handleServiceWorkerException)(e)}}if(e.userId,c){let i=(null===(p=t.type)||void 0===p?void 0:p.characterValue)+"_s_"+o+"_by";var g=yield(0,n.MakeTheInstanceConceptLocal)("connection",i,!1,999,999,999,0,a);yield(0,n.CreateTheConnectionLocal)(t.id,e.id,g.id,1e3,void 0,void 0,a)}let s=(null===(f=e.type)||void 0===f?void 0:f.characterValue)+"_s_"+o+"_s";var m=yield(0,n.MakeTheInstanceConceptLocal)("connection",s,!1,999,999,999,void 0,a);let v=yield(0,n.CreateTheConnectionLocal)(e.id,t.id,m.id,1e3,void 0,void 0,a);return i.V.logUpdate(y),v}catch(n){throw i.V.logError(v,e.userId,"create",void 0,void 0,500,n,"CreateConnectionBetweenTwoConceptsLocal",[e,t,o,c],void 0,void 0),(0,r.ey)(y,"CreateConnectionBetweenTwoConceptsLocal",n),n}}))}},6416:(e,t,o)=>{o.d(t,{u:()=>i});var n=o(2615);function i(){let e=new Date,t=new Date;return new n.j(0,0,0,0,0,"0",0,!1,e,t,"0")}},3075:(e,t,o)=>{o.d(t,{Ay:()=>d,EO:()=>u,xd:()=>h});var n=o(205),i=o(9736),r=o(5257),c=o(9003),s=o(2830),a=o(1863),l=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function d(){return l(this,void 0,void 0,(function*(){const e=s.Logger.logfunction("CreateLocalBinaryTreeFromIndexDb");try{let t=[];if(Array.isArray(t))for(let e=0;e<t.length;e++){let o=t[e];i.v.AddConceptToMemory(o)}n.B.isLocalDataLoaded=!0,n.B.isLocalTypeLoaded=!0,n.B.isLocalCharacterLoaded=!0,s.Logger.logUpdate(e)}catch(t){yield(0,s.DelayFunctionExecution)(2e3,d());let o={message:"Cannot create local binary tree from index db",data:t,ok:!1,status:400};throw(0,a.ey)(e,"CreateLocalBinaryTreeFromIndexDb",t),o}}))}function u(){return l(this,void 0,void 0,(function*(){var e;const t=s.Logger.logfunction("PopulateTheLocalConceptsToMemory");try{yield null===(e=navigator.locks)||void 0===e?void 0:e.request("dblock",(e=>l(this,void 0,void 0,(function*(){let e=yield(0,c.S5)("localid");if(Array.isArray(e)){if(e[0]){let t=e[0].value;if(t)r.R.AddConceptId(e[0]),yield(0,c.kH)("localid",{id:0,value:t-10});else{t=-Math.floor(1e8*Math.random());let e={id:0,value:t},o={id:0,value:t-10};r.R.AddConceptId(e),yield(0,c.kH)("localid",o)}}e[2]&&s.BaseUrl.setRandomizer(e[2].value)}})))),s.Logger.logUpdate(t)}catch(e){let o={message:"Cannot populate Local Ids from the Index Db",data:e,ok:!1,status:400};throw(0,a.ey)(t,"PopulateTheLocalConceptsToMemory",e),o}}))}function h(){return l(this,void 0,void 0,(function*(){var e;const t=s.Logger.logfunction("PopulateTheLocalConnectionToMemory");try{yield null===(e=navigator.locks)||void 0===e?void 0:e.request("dblock",(e=>l(this,void 0,void 0,(function*(){let e=yield(0,c.S5)("localid");if(Array.isArray(e)){if(e[1]){let t=e[1].value;if(t)r.R.AddConnectionId(e[1]),yield(0,c.kH)("localid",{id:1,value:t-10});else{t=-Math.floor(1e8*Math.random());let e={id:0,value:t},o={id:0,value:t-10};r.R.AddConnectionId(e),yield(0,c.kH)("localid",o)}}e[2]&&s.BaseUrl.setRandomizer(e[2].value)}})))),s.Logger.logUpdate(t)}catch(e){let o={message:"Cannot populate Local Ids from the Index Db",data:e,ok:!1,status:400};throw(0,a.ey)(t,"PopulateTheLocalConnectionToMemory",e),o}}))}},999:(e,t,o)=>{o.d(t,{R:()=>l});var n=o(2830),i=o(1863),r=o(6416),c=o(4711),s=o(5868),a=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function l(e){return a(this,arguments,void 0,(function*(e,t=null,o=null,a=null,d=null,u=null,h=null,p=!1,f={concepts:[],connections:[]}){var y,v,g,m;const C=n.Logger.logfunction("CreateTheCompositionLocal");if(n.serviceWorker){C.serviceWorker=!0;try{const i=yield(0,n.sendMessage)("CreateTheCompositionLocal",{json:e,ofTheConceptId:t,ofTheConceptUserId:o,mainKey:a,userId:d,accessId:u,sessionInformationId:h,actions:f});return(null===(v=null===(y=null==i?void 0:i.actions)||void 0===y?void 0:y.concepts)||void 0===v?void 0:v.length)&&(f.concepts=JSON.parse(JSON.stringify(i.actions.concepts))),(null===(m=null===(g=null==i?void 0:i.actions)||void 0===g?void 0:g.connections)||void 0===m?void 0:m.length)&&(f.connections=JSON.parse(JSON.stringify(i.actions.connections))),n.Logger.logUpdate(C),i.data}catch(e){console.error("CreateTheCompositionLocal error sw: ",e),(0,i.ey)(C,"CreateTheCompositionLocal",e),(0,n.handleServiceWorkerException)(e)}}let T=null!=d?d:999,w=null!=u?u:999,I=null!=h?h:999,k=null!=a?a:0,N=(0,r.u)();for(const n in e)if("string"!=typeof e[n]&&"number"!=typeof e[n])if(null==t&&null==o){let t=k,o=yield(0,s.k)(n,"",!0,T,w,I,void 0,f);N=o,t=o.id,k=o.id,yield l(e[n],o.id,o.userId,t,d,u,h,void 0,f)}else{let o=null!=t?t:999,i=k,r=yield(0,s.k)(n,"",!0,T,w,I,void 0,f);yield(0,c.F)(o,r.id,i,void 0,void 0,void 0,f),yield l(e[n],r.id,r.userId,i,d,u,h,void 0,f)}else{let o=null!=t?t:999,i=k,r=yield(0,s.k)(n,e[n].toString(),!1,T,w,I,void 0,f);yield(0,c.F)(o,r.id,i,void 0,void 0,void 0,f)}return n.Logger.logUpdate(C),N}))}},3077:(e,t,o)=>{o.d(t,{A:()=>l});var n=o(2830),i=o(2615),r=o(9736),c=o(5257),s=o(9700),a=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function l(e,t,o,l,d,u){return a(this,arguments,void 0,(function*(e,t,o,a,l,d,u=!1,h=0,p={concepts:[],connections:[]}){var f,y,v,g;let m=performance.now();try{if(n.serviceWorker)try{const i=yield(0,n.sendMessage)("CreateTheConceptLocal",{referent:e,typecharacter:t,userId:o,categoryId:a,typeId:l,accessId:d,isComposition:u,referentId:h});return(null===(y=null===(f=null==i?void 0:i.actions)||void 0===f?void 0:f.concepts)||void 0===y?void 0:y.length)&&(p.concepts=JSON.parse(JSON.stringify(i.actions.concepts))),(null===(g=null===(v=null==i?void 0:i.actions)||void 0===v?void 0:v.connections)||void 0===g?void 0:g.length)&&(p.connections=JSON.parse(JSON.stringify(i.actions.connections))),i.data}catch(e){console.error("CreateTheConceptLocal error sw: ",e),(0,n.handleServiceWorkerException)(e)}let s=yield c.R.getConceptId(),m=!0,C=new Date,T=new Date;if("the"==e)return new i.j(1,999,5,5,h,e,d,m,C,T,t);let w=new i.j(s,o,l,a,h,e,d,m,C,T,t);return w.isTemp=!0,w.isComposition=u,r.v.AddConcept(w),p.concepts.push(w),w}catch(n){throw s.V.logError(m,o,"create","unknown","unknown",500,void 0,"createTheConceptLocal",[e,t,o,a,l,d,u],void 0),n}}))}},4711:(e,t,o)=>{o.d(t,{F:()=>l});var n=o(2155),i=o(4864),r=o(5257),c=o(9700),s=o(2830),a=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function l(e,t,o){return a(this,arguments,void 0,(function*(e,t,o,a=1,l="",d=999,u={concepts:[],connections:[]}){var h,p,f,y;let v=performance.now();if(s.serviceWorker)try{const n=yield(0,s.sendMessage)("CreateTheConnectionLocal",{ofTheConceptId:e,toTheConceptId:t,typeId:o,orderId:a,typeString:l,userId:d,actions:u});return(null===(p=null===(h=null==n?void 0:n.actions)||void 0===h?void 0:h.concepts)||void 0===p?void 0:p.length)&&(u.concepts=JSON.parse(JSON.stringify(n.actions.concepts))),(null===(y=null===(f=null==n?void 0:n.actions)||void 0===f?void 0:f.connections)||void 0===y?void 0:y.length)&&(u.connections=JSON.parse(JSON.stringify(n.actions.connections))),n.data}catch(e){console.log("CreateTheConnectionLocal error sw: ",e),(0,s.handleServiceWorkerException)(e)}try{let c=4,h=yield r.R.getConnectionId(),p=0,f=0,y=0;p=e,f=t,y=o;let v=new n.N(0,0,0,0,0,0,0);return e!=t&&(v=new n.N(h,p,f,d,o,a,c),v.isTemp=!0,v.typeCharacter=l,s.LocalSyncData.AddConnection(v),i.G.AddConnection(v),u.connections.push(v)),v}catch(n){throw c.V.logError(v,d,"create","Unknown","Unknown",500,void 0,"CreateTheConnectionLocal",[e,t,o,a,l,d],"UnknownUserAgent",[]),n}}))}},8064:(e,t,o)=>{o.d(t,{$I:()=>s,Ay:()=>c});var n=o(9736),i=(o(9581),o(3518),o(2830));o(1863);var r=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function c(e){return r(this,void 0,void 0,(function*(){return yield n.v.GetConceptByCharacterAndTypeLocal(e,51)}))}function s(e){return r(this,void 0,void 0,(function*(){if(i.serviceWorker)try{return(yield(0,i.sendMessage)("GetConceptByCharacterAndCategoryLocal",{character:e})).data}catch(e){console.error("GetConceptByCharacterAndCategoryLocal error sw: ",e),(0,i.handleServiceWorkerException)(e)}let t=(0,i.CreateDefaultLConcept)();if("the"==e)return t.id=1,t.typeId=5,t.characterValue="the",t;let o=(0,i.SplitStrings)(e);if(o.length>1){let i=1,c=yield s(o[0]);0!=c.id&&(i=c.id),t=yield function(e,t){return r(this,void 0,void 0,(function*(){return n.v.GetConceptByCharacterAndCategoryLocal(e,t)}))}(e,i)}else o[0]==e&&(t=yield c(e));return t}))}},1213:(e,t,o)=>{o.d(t,{f:()=>a});var n=o(9736),i=o(7820),r=o(2830),c=o(176),s=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function a(e){return s(this,void 0,void 0,(function*(){let t=performance.now();try{if(r.serviceWorker)try{return(yield(0,r.sendMessage)("GetTheConceptLocal",{id:e})).data}catch(e){console.error("GetTheConceptLocal error sw: ",e),(0,r.handleServiceWorkerException)(e)}let t=(0,r.CreateDefaultLConcept)();if(e<0){if(t=yield n.v.GetConcept(e),0==t.id){let o=yield i.G.getNodeFromTree(e);if(null==o?void 0:o.value){let e=o.value;e&&(t=e)}}}else{let o=yield(0,r.GetTheConcept)(e);t=(0,c.F4)(o)}return t}catch(o){throw r.Logger.logError(t,"unknown","read","unknown",void 0,200,void 0,"GetTheConceptLocal",[e],"unknown",void 0),o}}))}},9975:(e,t,o)=>{o.d(t,{A:()=>s});var n=o(2830),i=o(9736),r=o(3077),c=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function s(e,t,o,s,a){return c(this,arguments,void 0,(function*(e,t,o,c,s,a={concepts:[],connections:[]}){var l,d,u,h;if(n.serviceWorker)try{const i=yield(0,n.sendMessage)("MakeTheConceptLocal",{referent:e,typeCharacter:t,userId:o,categoryId:c,typeId:s,actions:a});return(null===(d=null===(l=null==i?void 0:i.actions)||void 0===l?void 0:l.concepts)||void 0===d?void 0:d.length)&&(a.concepts=JSON.parse(JSON.stringify(i.actions.concepts))),(null===(h=null===(u=null==i?void 0:i.actions)||void 0===u?void 0:u.connections)||void 0===h?void 0:h.length)&&(a.connections=JSON.parse(JSON.stringify(i.actions.connections))),i.data}catch(e){console.error("MakeTheConceptLocal error sw: ",e),(0,n.handleServiceWorkerException)(e)}let p=yield i.v.GetConceptByCharacterAndTypeLocal(e,s),f=p;return"the"==t&&(c=1),0==f.id&&(p=yield(0,r.A)(e,t,o,c,s,4,void 0,void 0,a),f=p),f}))}},5868:(e,t,o)=>{o.d(t,{k:()=>l});var n=o(3077),i=o(8357),r=o(9736),c=o(2830),s=o(1863),a=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function l(e,t){var o=arguments;return a(this,arguments,void 0,(function*(e,t,a=!1,l,d,u=999,h=0,p={concepts:[],connections:[]}){var f,y,v,g;const m=c.Logger.logfunction("MakeTheInstanceConceptLocal",o);if(performance.now(),c.serviceWorker){m.serviceWorker=!0;try{const o=yield(0,c.sendMessage)("MakeTheInstanceConceptLocal",{type:e,referent:t,composition:a,userId:l,accessId:d,sessionInformationId:u,referentId:h,actions:p});return(null===(y=null===(f=null==o?void 0:o.actions)||void 0===f?void 0:f.concepts)||void 0===y?void 0:y.length)&&(p.concepts=JSON.parse(JSON.stringify(o.actions.concepts))),(null===(g=null===(v=null==o?void 0:o.actions)||void 0===v?void 0:v.connections)||void 0===g?void 0:g.length)&&(p.connections=JSON.parse(JSON.stringify(o.actions.connections))),c.Logger.logUpdate(m),o.data}catch(e){console.error("MakeTheInstanceConceptLocal error sw: ",e),(0,s.ey)(m,"MakeTheInstanceConceptLocal",e),(0,c.handleServiceWorkerException)(e)}}try{let o,s,d=999,u=4,f=l,y=4,v="",g=t.length;if(v=e.startsWith("the_")?e:"the_"+e,a)o=yield(0,i.$)(e,d,l,l,p),s=yield(0,n.A)(t,e,l,u,o.id,y,!0,h,p);else if(g>255)o=yield(0,i.$)(v,d,f,l,p),s=yield(0,n.A)(t,v,l,u,o.id,y,void 0,void 0,p);else{o=yield(0,i.$)(v,d,f,l,p);let e=yield r.v.GetConceptByCharacterAndTypeLocal(t,o.id);s=e,0==e.id&&0==e.userId&&(s=yield(0,n.A)(t,v,l,u,o.id,y,void 0,void 0,p))}return s.type=o,c.LocalSyncData.AddConcept(s),p.concepts.push(s),c.Logger.logUpdate(m),s}catch(e){throw(0,s.ey)(m,"MakeTheInstanceConceptLocal",e),e}}))}},8357:(e,t,o)=>{o.d(t,{$:()=>d});var n=o(3077),i=o(8064),r=o(6467),c=o(9975),s=o(2830),a=o(1863),l=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function d(e,t,o,u){var h=arguments;return l(this,arguments,void 0,(function*(e,t,o,l,u={concepts:[],connections:[]}){var p,f,y,v;const g=s.Logger.logfunction("MakeTheTypeConceptLocal",h);if(s.serviceWorker){g.serviceWorker=!0;try{const n=yield(0,s.sendMessage)("MakeTheTypeConceptLocal",{typeString:e,sessionId:t,sessionUserId:o,userId:l,actions:u});return(null===(f=null===(p=null==n?void 0:n.actions)||void 0===p?void 0:p.concepts)||void 0===f?void 0:f.length)&&(u.concepts=JSON.parse(JSON.stringify(n.actions.concepts))),(null===(v=null===(y=null==n?void 0:n.actions)||void 0===y?void 0:y.connections)||void 0===v?void 0:v.length)&&(u.connections=JSON.parse(JSON.stringify(n.actions.connections))),s.Logger.logUpdate(g),n.data}catch(e){console.error("MakeTheTypeConceptLocal error sw: ",e),(0,a.ey)(g,"MakeTheTypeConceptLocal",e),(0,s.handleServiceWorkerException)(e)}}let m=yield(0,i.$I)(e);if(m&&(0==m.id||0==m.userId)){let i=(0,r.f)(e);if(i[0]==e)m=yield(0,c.A)(e,"the",l,1,51,u);else{let r=yield d(i[0],t,o,l,u),c=yield d(i[1],t,o,l,u);m=yield(0,n.A)(e,i[1],l,r.id,c.id,4,void 0,void 0,u)}}return s.Logger.logUpdate(g),m}))}},3729:(e,t,o)=>{o.d(t,{D:()=>p});var n=o(9934),i=o(4485),r=o(2),c=o(7876),s=o(1838),a=o(999),l=o(5868),d=o(2830),u=o(176),h=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function p(e){return h(this,arguments,void 0,(function*(e,t={concepts:[],connections:[]}){var o,h,p,f;if(performance.now(),d.serviceWorker)try{const n=yield(0,d.sendMessage)("UpdateCompositionLocal",{patcherStructure:e,actions:t});return(null===(h=null===(o=null==n?void 0:n.actions)||void 0===o?void 0:o.concepts)||void 0===h?void 0:h.length)&&(t.concepts=JSON.parse(JSON.stringify(n.actions.concepts))),(null===(f=null===(p=null==n?void 0:n.actions)||void 0===p?void 0:p.connections)||void 0===f?void 0:f.length)&&(t.connections=JSON.parse(JSON.stringify(n.actions.connections))),n.data}catch(e){console.error("UpdateCompositionLocal error sw: ",e),(0,d.handleServiceWorkerException)(e)}const y=e.userId,v=e.sessionId,g=e.accessId;let m=[];const C=[];let T=(0,d.CreateDefaultLConcept)(),w=(0,d.CreateDefaultLConcept)();const I=[],k=e.compositionId,N=e.ofTheCompositionId;let A=[],L=yield(0,r.s)(k);for(let e=0;e<L.length;e++)m.push((0,u.P6)(L[e]));const S=[],G=[];let x=[];for(let e=0;e<m.length;e++)(0,n.A)(G,m[e].ofTheConceptId),(0,n.A)(S,m[e].ofTheConceptId),(0,n.A)(S,m[e].toTheConceptId),x.push(m[e].ofTheConceptId);for(let e=0;e<S.length;e++){const t=yield(0,c.A)(S[e]);k==S[e]&&(T=(0,u.F4)(t)),N==S[e]&&(w=(0,u.F4)(t)),C.push((0,u.F4)(t))}const B=e.patchObject;for(const e in B){let o=(0,d.CreateDefaultLConcept)();const n=B[e];let r=T;w.id>0&&(r=w),Array.isArray(n)||"object"==typeof n?(o=yield(0,l.k)(e,"",!0,T.userId,4,999,void 0,t),yield(0,a.R)(B[e],o.id,o.userId,T.id,T.userId,4,999,void 0,t)):o=yield(0,l.k)(e,n,!1,y,g,v,void 0,t);const c=(0,i.nm)(C,o);for(let e=0;e<c.length;e++)if(c[e].id>0){const t=(0,i.gt)(m,c[e].id);A=A.concat(t),I.push(c[e])}yield(0,d.CreateTheConnectionLocal)(r.id,o.id,T.id,2,void 0,void 0,t),C.push(o)}for(let e=0;e<A.length;e++)yield(0,s.m)(A[e].id);yield d.LocalSyncData.SyncDataOnline(void 0,t)}))}},8407:(e,t,o)=>{o.d(t,{A:()=>f});var n=o(9581),i=o(3518),r=o(1863),c=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))},s=o(4402),a=o(2830),l=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class d{constructor(e,t,o,n,i,r,c,s,a,l){this.id=0,this.userId=e,this.data=t,this.securityId=o,this.securityUserId=n,this.accessId=i,this.accessUserId=r,this.sessionId=c,this.sessionUserId=s,this.entryTimestamp=a,this.isNew=l}}var u=o(7282),h=o(2212),p=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function f(e,t){var o=arguments;return p(this,arguments,void 0,(function*(e,t,p=!1,f,y=4,v=999,g=0){const m=a.Logger.logfunction("MakeTheInstanceConcept",o);if(a.serviceWorker){m.serviceWorker=!0;try{const o=yield(0,a.sendMessage)("MakeTheInstanceConcept",{type:e,referent:t,composition:p,userId:f,passedAccessId:y,passedSessionId:v,referentId:g});return a.Logger.logUpdate(m),o.data}catch(e){console.error("MakeTheInstanceConcept sw error: ",e),(0,r.ey)(m,"MakeTheInstanceConcept",e),(0,a.handleServiceWorkerException)(e)}}let C,T=v,w=f,I=f,k=y,N=f,A="",L=t.length,S=(0,u.o)();if(A=e.startsWith("the_")?e:"the_"+e,p)S=yield(0,a.MakeTheTypeConceptApi)(e,f),C=yield(0,h.Ay)(t,f,4,S.id,g,k,e);else if(L>255)S=yield(0,a.MakeTheTypeConceptApi)(A,f),C=yield(0,h.Ay)(t,f,4,S.id,g,k,A),function(e){c(this,void 0,void 0,(function*(){try{var t=(0,i.Xr)();const o=yield fetch(n.B.CreateTheTextDataUrl(),{method:"POST",headers:t,body:JSON.stringify(e)});if(!o.ok)throw(0,r.ry)(o),new Error(`Error! status: ${o.status}`);return yield o.json()}catch(e){throw e instanceof Error?console.log("Create the text error message: ",e.message):console.log("Create the text unexpected error: ",e),e}}))}(new d(f,t,999,w,k,N,T,I,Date.now().toString(),!0));else{S=yield(0,a.MakeTheTypeConceptApi)(A,f);let e=yield(0,s.A)(t,S.id);C=e,0==e.id&&0==e.userId&&(C=yield(0,h.N)(t,f,4,S.id,12,k,A),function(e,t,o,c){var s=arguments;l(this,void 0,void 0,(function*(){const l=a.Logger.logfunction("MakeTheNameInBackend",s);try{let s={newConceptId:e,referent:t,typeId:o,typeUserId:c},d=(0,i.Xr)(),u=JSON.stringify(s);const h=yield fetch(n.B.MakeTheNameInBackendUrl(),{method:"POST",headers:d,body:u});a.Logger.logUpdate(l),h.ok||(0,r.ry)(h)}catch(e){e instanceof Error?console.log("make the name in backend error message: ",e.message):console.log("make the name in backend unexpected error: ",e),(0,r.Mb)(e,n.B.MakeTheNameInBackendUrl()),(0,r.ey)(l,"MakeTheNameInBackend",e)}}))}(C.id,`${t}`,S.id,f))}return C.type=S,a.Logger.logUpdate(m),C}))}},5312:(e,t,o)=>{o.d(t,{NK:()=>h,Ve:()=>p,cf:()=>d,vw:()=>f,y8:()=>u});var n=o(2832),i=o(3130),r=o(2830),c=o(1863),s=o(6687),a=o(7106),l=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function d(e){var t=arguments;return l(this,arguments,void 0,(function*(e,o="",d=null,h=i.y0){var p,y,v,g,m,C,T,w;const I=r.Logger.logfunction("SearchLinkMultipleAll",t);try{try{if(r.serviceWorker){I.serviceWorker=!0;const t=yield(0,r.sendMessage)("SearchLinkMultipleAll",{searchQuery:e,token:o,caller:d,format:h});return r.Logger.logUpdate(I),t.data}}catch(e){console.error("SearchLinkMultipleAll error sw: ",e),(0,c.ey)(I,"SearchLinkMultipleAll",e),(0,r.handleServiceWorkerException)(e)}let t=[],k=[],N=[],A=[],L=e[0].composition,S={},G={};(null==d?void 0:d.isDataLoaded)?(S.compositionIds=null===(p=d.conceptIds)||void 0===p?void 0:p.slice(),S.internalConnections=null===(y=d.internalConnections)||void 0===y?void 0:y.slice(),S.linkers=null===(v=d.linkers)||void 0===v?void 0:v.slice(),S.reverse=null===(g=d.reverse)||void 0===g?void 0:g.slice(),G=S,t=G.compositionIds,N=G.internalConnections,k=G.linkers,A=G.reverse):(console.log("calling api"),S=yield(0,n.j)(e,o),console.log("calling api end"),d&&(d.conceptIds=null===(m=S.compositionIds)||void 0===m?void 0:m.slice(),d.internalConnections=null===(C=S.internalConnections)||void 0===C?void 0:C.slice(),d.linkers=null===(T=S.linkers)||void 0===T?void 0:T.slice(),d.reverse=null===(w=S.reverse)||void 0===w?void 0:w.slice(),d.isDataLoaded=!0),G=S,t=G.compositionIds,N=G.internalConnections,k=G.linkers,A=G.reverse);let x=yield function(e,t,o,n,r,c){return l(this,arguments,void 0,(function*(e,t,o,n,r,c,l=i.y0){try{let d,h,p=yield(0,s.QL)(e);return l==i.ZJ?(d=yield(0,s.MT)(t,o),h=yield f(e,d,r,n)):l==i.yv?(d=yield(0,s.D)(t,o),h=yield f(e,d,r,n)):100==l?(d=yield(0,s.nr)(t,o),h=yield u(p,d,r,n)):l==i.SL?h=yield(0,a._W)(e,t,o,c.ofCompositions,n):(d=yield(0,s.rv)(t,o),h=yield u(p,d,r,n)),h}catch(e){return void console.log("Error Occured in build layer",e)}}))}(k,t,N,A,L,e[0],h);return r.Logger.logUpdate(I),x}catch(e){throw console.log("this is the error in the search link multiple",e),(0,c.ey)(I,"SearchLinkMultipleAll",e),e}}))}function u(e,t,o){return l(this,arguments,void 0,(function*(e,t,o,n=[]){(new Date).getTime();let i={},c=[];for(let t=0;t<e.length;t++)c.push(e[t].toTheConceptId),c.push(e[t].ofTheConceptId),c.push(e[t].typeId);e.sort((function(e,t){return t.id-e.id}));for(let o=0;o<e.length;o++){let i=!1;if(n.includes(e[o].id)&&(i=!0),1==i){if(t[e[o].ofTheConceptId]&&t[e[o].toTheConceptId]){let n=t[e[o].toTheConceptId],i=yield(0,r.GetTheConcept)(e[o].typeId),c=null==n?void 0:n.data,s=Object.keys(c)[0];try{let n=i.characterValue+"_reverse";"string"==typeof c&&(c={}),Array.isArray(c[s][n])||("string"==typeof c[s]&&(c[s]={}),c[s][n]=[]),c[s][n].push(t[e[o].ofTheConceptId])}catch(e){console.log("this is error",e)}}}else if(t[e[o].ofTheConceptId]&&t[e[o].toTheConceptId]){let n=t[e[o].ofTheConceptId],i=yield(0,r.GetTheConcept)(e[o].typeId),c=null==n?void 0:n.data,s=Object.keys(c)[0];try{"string"==typeof c&&(c={}),Array.isArray(c[s][i.characterValue])||("string"==typeof c[s]&&(c[s]={}),c[s][i.characterValue]=[]),c[s][i.characterValue].push(t[e[o].toTheConceptId])}catch(e){console.log("this is error",e)}}}return i=t[o],i}))}function h(e,t,o){return l(this,arguments,void 0,(function*(e,t,o,n=[]){let i=[],c=[];for(let t=0;t<e.length;t++)c.push(e[t].toTheConceptId),c.push(e[t].ofTheConceptId),c.push(e[t].typeId);e.sort((function(e,t){return t.id-e.id}));for(let o=0;o<e.length;o++){let i=!1;if(n.includes(e[o].id)&&(i=!0),1==i){if(t[e[o].ofTheConceptId]&&t[e[o].toTheConceptId]){let n=t[e[o].toTheConceptId],i=yield(0,r.GetTheConcept)(e[o].typeId),c=Object.keys(n)[0];try{let r=i.characterValue+"_reverse";"string"==typeof n&&(n={}),Array.isArray(n[c][r])||("string"==typeof n[c]&&(n[c]={}),n[c][r]=[]),n[c][r].push(t[e[o].ofTheConceptId])}catch(e){console.log("this is error",e)}}}else if(t[e[o].ofTheConceptId]&&t[e[o].toTheConceptId]){let n=t[e[o].ofTheConceptId],i=yield(0,r.GetTheConcept)(e[o].typeId),c=Object.keys(n)[0];try{"string"==typeof n&&(n={}),Array.isArray(n[c][i.characterValue])||("string"==typeof n[c]&&(n[c]={}),n[c][i.characterValue]=[]),n[c][i.characterValue].push(t[e[o].toTheConceptId])}catch(e){console.log("this is error",e)}}}for(let e=0;e<o.length;e++){let n=t[o[e]];n&&i.push(n)}return i}))}function p(e,t,o,n){return l(this,arguments,void 0,(function*(e,t,o,n,i=[]){(new Date).getTime();let c=[],s=[];for(let t=0;t<e.length;t++)s.push(e[t].toTheConceptId),s.push(e[t].ofTheConceptId),s.push(e[t].typeId);e.sort((function(e,t){return t.id-e.id}));for(let o=0;o<e.length;o++){let n=!1;if(i.includes(e[o].id)&&(n=!0),1==n){if(t[e[o].ofTheConceptId]&&t[e[o].toTheConceptId]){let n=t[e[o].toTheConceptId],i=yield(0,r.GetTheConcept)(e[o].typeId),c=null==n?void 0:n.data,s=Object.keys(c)[0];try{let n=i.characterValue+"_reverse";"string"==typeof c&&(c={}),Array.isArray(c[s][n])||("string"==typeof c[s]&&(c[s]={}),c[s][n]=[]),c[s][n].push(t[e[o].ofTheConceptId])}catch(e){console.log("this is error",e)}}}else if(t[e[o].ofTheConceptId]&&t[e[o].toTheConceptId]){let n=t[e[o].ofTheConceptId],i=yield(0,r.GetTheConcept)(e[o].typeId),c=null==n?void 0:n.data,s=Object.keys(c)[0];try{"string"==typeof c&&(c={}),Array.isArray(c[s][i.characterValue])||("string"==typeof c[s]&&(c[s]={}),c[s][i.characterValue]=[]),c[s][i.characterValue].push(t[e[o].toTheConceptId])}catch(e){console.log("this is error",e)}}}for(let e=0;e<n.length;e++){let o=t[n[e]];o&&c.push(o)}return c}))}function f(e,t,o){return l(this,arguments,void 0,(function*(e,t,o,n=[]){let i={},c=yield(0,r.GetConnectionBulk)(e),s=[];for(let e=0;e<c.length;e++)s.push(c[e].toTheConceptId),s.push(c[e].ofTheConceptId),s.push(c[e].typeId);yield(0,r.GetConceptBulk)(s),c.sort((function(e,t){return t.id-e.id}));for(let e=0;e<c.length;e++){let o=!1;if(n.includes(c[e].id)&&(o=!0),1==o){if(t[c[e].ofTheConceptId]&&t[c[e].toTheConceptId]){let o=t[c[e].toTheConceptId],n=yield(0,r.GetTheConcept)(c[e].typeId),i=o,s=Object.keys(i)[0];try{let o=n.characterValue+"_reverse";"string"==typeof i&&(i={}),Array.isArray(i[s][o])||("string"==typeof i[s]&&(i[s]={}),i[s][o]=[]),i[s][o].push(t[c[e].ofTheConceptId])}catch(e){console.log("this is error",e)}}}else if(t[c[e].ofTheConceptId]&&t[c[e].toTheConceptId]){let o=t[c[e].ofTheConceptId],n=yield(0,r.GetTheConcept)(c[e].typeId),i=o,s=Object.keys(i)[0];try{"string"==typeof i&&(i={}),Array.isArray(i[s][n.characterValue])||("string"==typeof i[s]&&(i[s]={}),i[s][n.characterValue]=[]),i[s][n.characterValue].push(t[c[e].toTheConceptId])}catch(e){console.log("this is error",e)}}}return i=t[o],i}))}},7106:(e,t,o)=>{o.d(t,{zl:()=>v,b6:()=>C,e$:()=>w,y6:()=>T,yV:()=>g,_W:()=>m});var n=o(2830),i=o(6687);function r(e){return e.startsWith("the_")?e.slice(4):e}var c=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function s(e,t,o){return c(this,void 0,void 0,(function*(){var i,r,c,s,a,l,d,u;let h=[];for(let t=0;t<e.length;t++)h.push(e[t].toTheConceptId),h.push(e[t].ofTheConceptId),h.push(e[t].typeId);for(let h=0;h<e.length;h++){let p=!1;o.includes(e[h].id)&&(p=!0);let f=yield(0,n.GetTheConcept)(e[h].ofTheConceptId),y=yield(0,n.GetTheConcept)(e[h].toTheConceptId);if(1==p){if(0!=f.id&&0!=y.id){let o,a=null!==(r=null===(i=y.type)||void 0===i?void 0:i.characterValue)&&void 0!==r?r:"self";e[h].toTheConceptId in t?o=t[e[h].toTheConceptId]:(o={},o[a]={},t[e[h].toTheConceptId]=o);let l=yield(0,n.GetTheConcept)(e[h].typeId);try{let e=null!==(s=null===(c=null==f?void 0:f.type)||void 0===c?void 0:c.characterValue)&&void 0!==s?s:"none",o=f.characterValue;l.characterValue,l.characterValue.includes("_s_")&&(f.id in t||(t[f.id]={}),t[f.id][e]=o),t[y.id]={}}catch(e){console.log("this is error",e)}}}else if(0!=f.id&&0!=y.id){let o,i=null!==(l=null===(a=f.type)||void 0===a?void 0:a.characterValue)&&void 0!==l?l:"self";e[h].ofTheConceptId in t?o=t[e[h].ofTheConceptId]:(o={},o[i]={},t[e[h].ofTheConceptId]=o);let r=yield(0,n.GetTheConcept)(e[h].typeId);try{let e=null!==(u=null===(d=null==y?void 0:y.type)||void 0===d?void 0:d.characterValue)&&void 0!==u?u:"none",o=y.characterValue;r.characterValue.includes("_s_")&&(y.id in t||(t[y.id]={}),t[y.id][e]=o),t[f.id]={}}catch(e){console.log("this is error",e)}}}return t}))}var a=o(5312),l=o(7876),d=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function u(e,t,o){if(e in t){let n=t[e];console.log("this is the count info",n),n&&(o[n.connectionType+"_count"]=n.count,console.log("this is the data updated",o))}}var h=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))},p=o(5898);function f(e,t="DESC"){return console.log("this is the order",t),"ASC"==t?e.sort((function(e,t){return e.id-t.id})):e.sort((function(e,t){return t.id-e.id})),e}var y=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function v(e,t){return y(this,arguments,void 0,(function*(e,t,o=""){let r=yield(0,n.SearchWithTypeAndLinkerApi)(e,t,o),c=r.compositionIds,s=r.internalConnections,l=r.linkers,d=r.reverse,u=r.mainCompositionIds,h=yield(0,i.QL)(l),p=yield(0,i.MT)(c,s);return yield(0,a.NK)(h,p,u,d)}))}function g(e,t,o,n,r){return y(this,void 0,void 0,(function*(){let c=yield(0,i.QL)(e),s=yield(0,i.rv)(t,o);return yield(0,a.Ve)(c,s,t,n,r)}))}function m(e,t,o,n,r){return y(this,void 0,void 0,(function*(){let c=yield(0,i.QL)(e),s=yield(0,i.D)(t,o);return yield(0,a.NK)(c,s,n,r)}))}function C(e,t,o,a,l){return y(this,void 0,void 0,(function*(){if(n.serviceWorker)try{return(yield(0,n.sendMessage)("formatConnections",{linkers:e,conceptIds:t,mainCompositionIds:o,reverse:a,countInfos:l})).data}catch(e){console.error("formatConnections error sw: ",e),(0,n.handleServiceWorkerException)(e)}let d=yield(0,i.QL)(e);d=f(d);let u=[],h=(new Date).getTime();u=yield s(d,u,a),console.log("format1",(new Date).getTime()-h);let p=(new Date).getTime();u=yield function(e,t,o){return c(this,void 0,void 0,(function*(){var i,c,s,a,l,d,u,h;let p=[];for(let t=0;t<e.length;t++)p.push(e[t].toTheConceptId),p.push(e[t].ofTheConceptId),p.push(e[t].typeId);e.sort((function(e,t){return t.id-e.id}));for(let p=0;p<e.length;p++){let f=!1;o.includes(e[p].id)&&(f=!0);let y=yield(0,n.GetTheConcept)(e[p].ofTheConceptId),v=yield(0,n.GetTheConcept)(e[p].toTheConceptId);if(1==f){if(0!=y.id&&0!=v.id){let o,l=null!==(c=null===(i=v.type)||void 0===i?void 0:i.characterValue)&&void 0!==c?c:"self";e[p].toTheConceptId in t?(o=t[e[p].toTheConceptId],l in o||(o[l]={})):(o={},o[l]={},t[e[p].toTheConceptId]=o);let d=yield(0,n.GetTheConcept)(e[p].typeId);try{let e=null!==(a=null===(s=null==y?void 0:y.type)||void 0===s?void 0:s.characterValue)&&void 0!==a?a:"none",t=y.characterValue,n=d.characterValue;""==n&&(n=e,n=r(n));let i={[e]:t},c=n+"_reverse";d.characterValue.includes("_s_")||("string"==typeof o[l]&&(o[l]={}),o[l][c]=i)}catch(e){console.log("this is error",e)}}}else if(0!=y.id&&0!=v.id){let o,i=null!==(d=null===(l=y.type)||void 0===l?void 0:l.characterValue)&&void 0!==d?d:"self";e[p].ofTheConceptId in t?(o=t[e[p].ofTheConceptId],i in o||(o[i]={})):(o={},o[i]={},t[e[p].ofTheConceptId]=o);let c=yield(0,n.GetTheConcept)(e[p].typeId);try{let e=null!==(h=null===(u=null==v?void 0:v.type)||void 0===u?void 0:u.characterValue)&&void 0!==h?h:"none",t=v.characterValue,n=c.characterValue,s=(c.characterValue,!1);""==n&&(n=e,n=r(n),s=!0);let a={[e]:t};isNaN(Number(n))?c.characterValue.includes("_s_")||("string"==typeof o[i]&&(o[i]={}),o[i][n]=s?t:a):o[i]=[]}catch(e){console.log("this is error",e)}}}return t}))}(d,u,a),console.log("format2",(new Date).getTime()-p);let y=(new Date).getTime(),v=yield function(e,t,o,i){return c(this,arguments,void 0,(function*(e,t,o,i,r=[]){var c,s,a,l,d,u;let h=[],p=[];for(let t=0;t<e.length;t++)p.push(e[t].toTheConceptId),p.push(e[t].ofTheConceptId),p.push(e[t].typeId);e.sort((function(e,t){return t.id-e.id}));for(let o=0;o<e.length;o++){let i=!1;r.includes(e[o].id)&&(i=!0);let h=yield(0,n.GetTheConcept)(e[o].ofTheConceptId),p=yield(0,n.GetTheConcept)(e[o].toTheConceptId);if(1==i){if(0!=h.id&&0!=p.id&&p.id in t){let i,r=null!==(s=null===(c=p.type)||void 0===c?void 0:c.characterValue)&&void 0!==s?s:"self";e[o].toTheConceptId in t?i=t[e[o].toTheConceptId]:(i={},i[r]={},t[e[o].toTheConceptId]=i);let a=yield(0,n.GetTheConcept)(e[o].typeId);try{let n=a.characterValue+"_reverse",c=t[e[o].ofTheConceptId];c&&(Array.isArray(i[r][n])?i[r][n].push(c):a.characterValue.includes("_s_")?(i[r][n]=[],i[r][n].push(c)):i[r][n]=c)}catch(e){console.log("this is error",e)}}}else if(0!=h.id&&0!=p.id&&h.id in t){let i,r=null!==(l=null===(a=h.type)||void 0===a?void 0:a.characterValue)&&void 0!==l?l:"self";e[o].ofTheConceptId in t?(i=t[e[o].ofTheConceptId],"string"==typeof i[r]&&(i[r]={})):(i={},i[r]={},t[e[o].ofTheConceptId]=i);let c=!1,s=(yield(0,n.GetTheConcept)(e[o].typeId)).characterValue;""==s&&(s=p.characterValue,c=!0),""==s&&(s=null!==(u=null===(d=null==p?void 0:p.type)||void 0===d?void 0:d.characterValue)&&void 0!==u?u:"");try{let n=t[e[o].toTheConceptId];n&&(Array.isArray(i[r])?c?i[r].push(n[s]):i[r].push(n):Array.isArray(i[r][s])?i[r][s].push(n):s.includes("_s_")?(i[r][s]=[],c?i[r][s].push(n[s]):i[r][s].push(n)):i[r][s]=c?n[s]:n)}catch(e){console.log("this is error",e)}}}for(let e=0;e<o.length;e++){let n=t[o[e]];n&&(n.id=o[e],h.push(n))}return h}))}(d,u,o,[],a);return console.log("format3",(new Date).getTime()-y),v}))}function T(e,t,o,c,a){return y(this,arguments,void 0,(function*(e,t,o,c,a,h="DESC"){if(n.serviceWorker)try{return(yield(0,n.sendMessage)("formatConnectionsJustId",{linkers:e,conceptIds:t,mainCompositionIds:o,reverse:c,countInfos:a,order:h})).data}catch(e){console.error("formatConnectionsJustId error sw: ",e),(0,n.handleServiceWorkerException)(e)}let y=yield(0,i.QL)(e),v=yield(0,p.V)(a);y=f(y,h);let g=[];g=yield s(y,g,c),g=yield function(e,t){return d(this,arguments,void 0,(function*(e,t,o=[]){var n,i,c,s,a,d,u,h;let p=[];for(let t=0;t<e.length;t++)p.push(e[t].toTheConceptId),p.push(e[t].ofTheConceptId),p.push(e[t].typeId);for(let p=0;p<e.length;p++){let f=!1,y=yield(0,l.A)(e[p].ofTheConceptId),v=yield(0,l.A)(e[p].toTheConceptId);if(o.includes(e[p].id)&&(f=!0),1==f){if(0!=y.id&&0!=v.id){let o,a=yield(0,l.A)(e[p].typeId),d=null!==(i=null===(n=v.type)||void 0===n?void 0:n.characterValue)&&void 0!==i?i:"self";e[p].toTheConceptId in t?(o=t[e[p].toTheConceptId],d in o||(o[d]={})):(o={},o[d]={},t[e[p].toTheConceptId]=o);try{let e=null!==(s=null===(c=null==y?void 0:y.type)||void 0===c?void 0:c.characterValue)&&void 0!==s?s:"none",t=y.characterValue,n=a.characterValue;""==n&&(n=e,n=r(n));let i={id:y.id,[e]:t},l=n+"_reverse";l.includes("_s_")||("string"==typeof o[d]&&(o[d]={}),o[d][l]=i)}catch(e){console.log("this is error",e)}}}else if(0!=y.id&&0!=v.id){let o,n=yield(0,l.A)(e[p].typeId),i=null!==(d=null===(a=y.type)||void 0===a?void 0:a.characterValue)&&void 0!==d?d:"self";e[p].ofTheConceptId in t?(o=t[e[p].ofTheConceptId],i in o||(o[i]={})):(o={},o[i]={},t[e[p].ofTheConceptId]=o);try{let t=null!==(h=null===(u=null==v?void 0:v.type)||void 0===u?void 0:u.characterValue)&&void 0!==h?h:"none",c=v.characterValue,s=n.characterValue,a=!1;""==s&&(s=t,s=r(s),a=!0);let l={};l[t]={id:v.id,data:c,created_on:e[p].entryTimeStamp},isNaN(Number(s))?s.includes("_s_")||("string"==typeof o[i]&&(o[i]={}),o[i][s]=a?l[t]:l):o[i]=[]}catch(e){console.log("this is error",e)}}}return t}))}(y,g,c);let m=yield function(e,t,o){return d(this,arguments,void 0,(function*(e,t,o,n=[],i){var r,c,s,a,d,h,p;(new Date).getTime();let f=[],y=[];for(let t=0;t<e.length;t++)y.push(e[t].toTheConceptId),y.push(e[t].ofTheConceptId),y.push(e[t].typeId);for(let o=0;o<e.length;o++){let f=!1,y=yield(0,l.A)(e[o].ofTheConceptId),v=yield(0,l.A)(e[o].toTheConceptId);if(n.includes(e[o].id)&&(f=!0),1==f){if(0!=y.id&&0!=v.id&&v.id in t){let n,i=yield(0,l.A)(e[o].typeId),s=null!==(c=null===(r=v.type)||void 0===r?void 0:r.characterValue)&&void 0!==c?c:"self",a=!1;e[o].toTheConceptId in t&&(a=!0),e[o].toTheConceptId in t?(n=t[e[o].toTheConceptId],"string"==typeof n[s]&&(n[s]={})):(n={},n[s]={},t[e[o].toTheConceptId]=n);try{if(t[e[o].ofTheConceptId]){let r=t[e[o].ofTheConceptId];r&&(r.id=y.id,r.created_on=y.entryTimeStamp);let c=i.characterValue+"_reverse";Array.isArray(n[s][c])?n[s][c].push(r):c.includes("_s_")?(n[s][c]=[],n[s][c].push(r)):n[s][c]=r}}catch(e){console.log("this is error",e)}}}else if(0!=y.id&&0!=v.id&&y.id in t){let n,r=yield(0,l.A)(e[o].typeId),c=null!==(a=null===(s=y.type)||void 0===s?void 0:s.characterValue)&&void 0!==a?a:"self",f=!1;e[o].toTheConceptId in t&&(f=!0),e[o].ofTheConceptId in t?(n=t[e[o].ofTheConceptId],"string"==typeof n[c]&&(n[c]={})):(n={},n[c]={},t[e[o].ofTheConceptId]=n),u(y.id,i,n);let g=!1,m=r.characterValue;""==m&&(m=v.characterValue,g=!0),""==m&&(m=null===(d=null==v?void 0:v.type)||void 0===d?void 0:d.characterValue);try{let r=null!==(p=null===(h=null==v?void 0:v.type)||void 0===h?void 0:h.characterValue)&&void 0!==p?p:"none",s=t[e[o].toTheConceptId];if(s){let t={};t[r]={data:s[r],id:v.id,created_on:e[o].entryTimeStamp},Array.isArray(n[c])?g?n[c].push(s[m]):n[c].push(s):Array.isArray(n[c][m])?n[c][m].push(t):m.includes("_s_")?(n[c][m]=[],g?n[c][m].push(t[r]):n[c][m].push(t)):n[c][m]=g?t[r]:t,u(v.id,i,t)}}catch(e){console.log("this is error",e)}}}console.log("this is the main compositions",o);for(let e=0;e<o.length;e++){let n={};console.log("this is the main compositions DATA",t[o[e]]),n=t[o[e]],n&&(n.id=o[e]),f.push(n)}return f}))}(y,g,o,c,v);return m}))}function w(e,t,o,c,s){return y(this,arguments,void 0,(function*(e,t,o,c,s,a="DESC"){if(n.serviceWorker)try{return(yield(0,n.sendMessage)("formatConnectionsDataId",{linkers:e,conceptIds:t,mainCompositionIds:o,reverse:c,countInfos:s,order:a})).data}catch(e){console.error("GetConnectionDataPrefetch error sw: ",e),(0,n.handleServiceWorkerException)(e)}let l=yield(0,i.QL)(e),d=yield(0,p.V)(s);l=f(l,a),console.log("this is the prfetch connections",l);let u=[],y=(new Date).getTime();u=yield function(e,t){var o=arguments;return h(this,arguments,void 0,(function*(e,t,i=[]){var r,c,s,a,l,d,u,h;const p=n.Logger.logfunction("FormatFunctionData",o);let f=[];for(let t=0;t<e.length;t++)f.push(e[t].toTheConceptId),f.push(e[t].ofTheConceptId),f.push(e[t].typeId);for(let o=0;o<e.length;o++){let p=!1,f=yield(0,n.GetTheConcept)(e[o].ofTheConceptId),y=yield(0,n.GetTheConcept)(e[o].toTheConceptId);if(i.includes(e[o].id)&&(p=!0),1==p){if(0!=f.id&&0!=y.id){let i,l=yield(0,n.GetTheConcept)(e[o].typeId),d=null!==(c=null===(r=y.type)||void 0===r?void 0:r.characterValue)&&void 0!==c?c:"self";e[o].toTheConceptId in t?i=t[e[o].toTheConceptId]:(i={},i[d]={},t[e[o].toTheConceptId]=i);try{let e=null!==(a=null===(s=null==f?void 0:f.type)||void 0===s?void 0:s.characterValue)&&void 0!==a?a:"none",o=f.characterValue;(l.characterValue+"_reverse").includes("_s_")&&(f.id in t||(t[f.id]={}),t[f.id][e]=o),t[y.id]={}}catch(e){console.log("this is error",e)}}}else if(0!=f.id&&0!=y.id){let i,r=yield(0,n.GetTheConcept)(e[o].typeId),c=null!==(d=null===(l=f.type)||void 0===l?void 0:l.characterValue)&&void 0!==d?d:"self";e[o].ofTheConceptId in t?i=t[e[o].ofTheConceptId]:(i={},i[c]={},t[e[o].ofTheConceptId]=i);try{let e=null!==(h=null===(u=null==y?void 0:y.type)||void 0===u?void 0:u.characterValue)&&void 0!==h?h:"none",o=y.characterValue;r.characterValue.includes("_s_")&&(y.id in t||(t[y.id]={}),t[y.id][e]=o),t[f.id]={}}catch(e){console.log("this is error",e)}}}return n.Logger.logUpdate(p),t}))}(l,u,c),console.log("format1",(new Date).getTime()-y);let v=(new Date).getTime();u=yield function(e,t){var o=arguments;return h(this,arguments,void 0,(function*(e,t,i=[]){var c,s,a,l,d,u,h,p;const f=n.Logger.logfunction("FormatFunctionDataForData",o);let y=[];for(let t=0;t<e.length;t++)y.push(e[t].toTheConceptId),y.push(e[t].ofTheConceptId),y.push(e[t].typeId);for(let o=0;o<e.length;o++){let f=!1,y=yield(0,n.GetTheConcept)(e[o].ofTheConceptId),v=yield(0,n.GetTheConcept)(e[o].toTheConceptId);if(i.includes(e[o].id)&&(f=!0),1==f){if(0!=y.id&&0!=v.id){let i,d=yield(0,n.GetTheConcept)(e[o].typeId),u=null!==(s=null===(c=v.type)||void 0===c?void 0:c.characterValue)&&void 0!==s?s:"self";e[o].toTheConceptId in t?(i=t[e[o].toTheConceptId],u in i||(i[u]={})):(i={},i[u]={},t[e[o].toTheConceptId]=i);try{let e=null!==(l=null===(a=null==y?void 0:y.type)||void 0===a?void 0:a.characterValue)&&void 0!==l?l:"none",t=y.characterValue,o=d.characterValue;""==o&&(o=e,o=r(o));let n={id:y.id,data:{[e]:t}},c=o+"_reverse";c.includes("_s_")||("string"==typeof i[u]&&(i[u]={}),i[u][c]=n)}catch(e){console.log("this is error",e)}}}else if(0!=y.id&&0!=v.id){let i,c=yield(0,n.GetTheConcept)(e[o].typeId),s=null!==(u=null===(d=y.type)||void 0===d?void 0:d.characterValue)&&void 0!==u?u:"self";e[o].ofTheConceptId in t?(i=t[e[o].ofTheConceptId],s in i||(i[s]={})):(i={},i[s]={},t[e[o].ofTheConceptId]=i);try{let e=null!==(p=null===(h=null==v?void 0:v.type)||void 0===h?void 0:h.characterValue)&&void 0!==p?p:"none",t=v.characterValue,o=c.characterValue,n=!1;""==o&&(o=e,o=r(o),n=!0);let a={id:v.id,data:{[e]:t}};isNaN(Number(o))?o.includes("_s_")||("string"==typeof i[s]&&(i[s]={}),i[s][o]=a):i[s]=[]}catch(e){console.log("this is error",e)}}}return n.Logger.logUpdate(f),t}))}(l,u,c),console.log("format2",(new Date).getTime()-v);let g=(new Date).getTime(),m=yield function(e,t,o,i){var r=arguments;return h(this,arguments,void 0,(function*(e,t,o,i,c=[],s){var a,l,d,u,h,p;const f=n.Logger.logfunction("FormatFromConnectionsAlteredArrayExternal",r);let y=[],v=[];for(let t=0;t<e.length;t++)v.push(e[t].toTheConceptId),v.push(e[t].ofTheConceptId),v.push(e[t].typeId);for(let o=0;o<e.length;o++){let i=!1,r=yield(0,n.GetTheConcept)(e[o].ofTheConceptId),s=yield(0,n.GetTheConcept)(e[o].toTheConceptId);if(c.includes(e[o].id)&&(i=!0),1==i){if(0!=r.id&&0!=s.id&&s.id in t){let i,c=yield(0,n.GetTheConcept)(e[o].typeId),d=null!==(l=null===(a=s.type)||void 0===a?void 0:a.characterValue)&&void 0!==l?l:"self",u=!1;e[o].toTheConceptId in t&&(u=!0),e[o].toTheConceptId in t?(i=t[e[o].toTheConceptId],"string"==typeof i[d]&&(i[d]={})):(i={},i[d]={},t[e[o].toTheConceptId]=i);try{if(t[e[o].ofTheConceptId]){let n={id:r.id,data:t[e[o].ofTheConceptId],created_on:e[o].entryTimeStamp},s=c.characterValue+"_reverse";Array.isArray(i[d][s])?i[d][s].push(n):s.includes("_s_")?(i[d][s]=[],i[d][s].push(n)):i[d][s]=n}}catch(e){console.log("this is error",e)}}}else if(0!=r.id&&0!=s.id&&r.id in t){let i,c=yield(0,n.GetTheConcept)(e[o].typeId),a=null!==(u=null===(d=r.type)||void 0===d?void 0:d.characterValue)&&void 0!==u?u:"self",l=!1;e[o].toTheConceptId in t&&(l=!0),e[o].ofTheConceptId in t?(i=t[e[o].ofTheConceptId],"string"==typeof i[a]&&(i[a]={})):(i={},i[a]={},t[e[o].ofTheConceptId]=i);let f=!0,y=c.characterValue;""==y&&(y=s.characterValue,f=!0),""==y&&(y=null===(h=null==s?void 0:s.type)||void 0===h?void 0:h.characterValue);try{null===(p=null==s?void 0:s.type)||void 0===p||p.characterValue;let n=t[e[o].toTheConceptId];if(n){let r={id:s.id,data:t[e[o].toTheConceptId],created_on:e[o].entryTimeStamp};Array.isArray(i[a])?i[a].push(n):Array.isArray(i[a][y])?i[a][c.characterValue].push(r):y.includes("_s_")?(i[a][y]=[],i[a][y].push(r)):i[a][y]=r}}catch(e){console.log("this is error",e)}}}for(let e=0;e<i.length;e++){let o={};o.id=i[e],o.data=t[i[e]],y.push(o)}return n.Logger.logUpdate(f),y}))}(l,u,[],o,c,d);return console.log("format2",(new Date).getTime()-g),m}))}},3518:(e,t,o)=>{o.d(t,{BZ:()=>c,Xr:()=>i,ab:()=>r});var n=o(3278);function i(e="application/json",t="application/json"){let o={};return o=""!=n.b.BearerAccessToken?{"Content-Type":e,Authorization:"Bearer "+n.b.BearerAccessToken,Accept:t}:{"Content-Type":e,Accept:t},o}function r(e="application/json",t="",o="application/json"){""==t&&(t=n.b.BearerAccessToken);let i={};return i=""!=t?{"Content-Type":e,Authorization:"Bearer "+t,Accept:o}:{"Content-Type":e,Accept:o},i}function c(){let e=n.b.BearerAccessToken;const t=new Headers;return t.append("Authorization","Bearer "+e),t}},6467:(e,t,o)=>{function n(e){const t=e.lastIndexOf("_");let o=[];return o=t>0?[e.substring(0,t),e.substring(t+1,e.length)]:[e],o}o.d(t,{f:()=>n})},4310:(e,t,o)=>{o.d(t,{C:()=>l,i:()=>d});var n=o(2830),i=o(5898),r=o(1863),c=o(7106),s=o(3518),a=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function l(e){var t=arguments;return a(this,void 0,void 0,(function*(){n.Logger.logfunction("BuildWidgetFromId",t);try{try{if(n.serviceWorker)return(yield(0,n.sendMessage)("BuildWidgetFromId",{id:e})).data}catch(e){console.error("BuildWidgetFromId error sw: ",e),(0,n.handleServiceWorkerException)(e)}let t=[],o=[],a=[],l=[],d="DESC",u=[],h={},p={},f=(0,s.Xr)("application/json"),y=n.BaseUrl.getWidgetData()+"?id="+e;const v=yield fetch(y,{method:"GET",headers:f});if(!v.ok)return(0,r.ry)(v),console.log("This is the BuildWidgetFromId error",v.status),[];h=yield v.json(),t=h.conceptIds,o=h.linkers,a=h.reverse,l=h.mainCompositionIds,u=h.countinfo,console.log("this is the concept",h);let g=(0,i.w)(u);return p=yield(0,c.e$)(o,t,l,a,g,d),console.log("this is the widget build data",p),p}catch(e){throw console.log("this is the error in the build widget",e),e}}))}function d(e,t){for(let o=0;o<e.length;o++)if(t==e[o].id)return e[o]}},4287:(e,t,o)=>{o.d(t,{w:()=>c});var n=o(2830),i=o(3130),r=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class c{constructor(){this.subscribers=[],this.mainConcept=0,this.compositionIds=[],this.conceptIds=[],this.internalConnections=[],this.reverse=[],this.linkers=[],this.dependency=[],this.isDataLoaded=!1,this.isUpdating=!1,this.fetched=!1,this.format=i.yv}listenToEventType(e){console.log("this is the type listen before",e),window.addEventListener(`${e}`,(t=>{if(console.log("this is the window event",e,t),this.isUpdating)console.log("rejected this");else{this.isUpdating=!0;let e=this;setTimeout((function(){return r(this,void 0,void 0,(function*(){let o=t;console.log("this is the event",o),e.compositionIds.includes(null==o?void 0:o.detail)||(e.compositionIds.unshift(null==o?void 0:o.detail),e.listenToEvent(null==o?void 0:o.detail)),e.isUpdating=!1,yield e.bind(),e.notify()}))}),200)}}))}listenToEvent(e){console.log("this is listening to the id adding event",e),window.addEventListener(`${e}`,(t=>{if(this.isUpdating)console.log("rejected this");else{this.isUpdating=!0;let t=this;setTimeout((function(){return r(this,void 0,void 0,(function*(){let o=yield n.ConnectionData.GetConnectionByOfTheConceptAndType(e,e);console.log("this is the new connections",o);for(let e=0;e<o.length;e++)yield n.ConnectionData.GetConnection(o[e]).then((e=>{e.typeId==t.mainConcept?t.internalConnections.includes(e.id)||t.internalConnections.push(e.id):t.linkers.includes(e.id)||t.linkers.push(e.id),t.conceptIds.includes(e.toTheConceptId)||t.conceptIds.push(e.toTheConceptId),t.compositionIds.includes(e.ofTheConceptId)||t.compositionIds.push(e.ofTheConceptId)}));t.isUpdating=!1,yield t.bind(),t.notify()}))}),200)}}))}listenToEventConnectionType(e,t){window.addEventListener(`${e}`,(o=>{if(this.isUpdating)console.log("rejected this");else{this.isUpdating=!0;let o=this;setTimeout((function(){return r(this,void 0,void 0,(function*(){let i=yield n.ConnectionData.GetConnectionByOfTheConceptAndType(e,e);for(let e=0;e<i.length;e++)i.typeId==t&&(yield n.ConnectionData.GetConnection(i[e]).then((e=>{e.typeId==o.mainConcept?o.internalConnections.includes(e.id)||o.internalConnections.push(e.id):o.linkers.includes(e.id)||o.linkers.push(e.id),o.conceptIds.includes(e.toTheConceptId)||o.conceptIds.push(e.toTheConceptId),o.compositionIds.includes(e.ofTheConceptId)||o.compositionIds.push(e.ofTheConceptId)})));o.isUpdating=!1,yield o.bind(),o.notify()}))}),200)}}))}bind(){return r(this,void 0,void 0,(function*(){console.log("this is the old execute data")}))}subscribe(e){return r(this,void 0,void 0,(function*(){return this.subscribers.push(e),console.log("again executing data"),yield this.bind(),e(this.data)}))}unsubscribe(e){return this.subscribers.filter((t=>t!=e)),this.subscribers.length}notify(){console.log("notifiers",this.subscribers),this.subscribers.map((e=>{console.log("notify"),e(this.data)}))}}},5328:(e,t,o)=>{o.d(t,{d:()=>l});var n=o(2830),i=o(3130),r=o(8939),c=o(4287),s=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class a extends c.w{constructor(e,t,o,n,i){super(),this.connections=[],this.data=[],this.mainConcept=e,this.linker=t,this.inpage=o,this.page=n,this.format=i}bind(){return s(this,void 0,void 0,(function*(){var e;if(!this.isDataLoaded){let i=yield(0,n.GetTheConcept)(this.mainConcept),r=(null===(e=i.type)||void 0===e?void 0:e.characterValue)+"_s_"+this.linker,c=yield(0,n.GetConceptByCharacterAndType)(r,16);if(c.id>0){let e=yield(0,n.GetConnectionOfTheConcept)(c.id,i.id,i.userId,this.inpage,this.page);this.connections=e;for(var t=[],o=0;o<this.connections.length;o++)t.push(this.connections[o].toTheConceptId),this.linkers.push(this.connections[o].id),this.listenToEvent(this.connections[o].toTheConceptId);yield(0,n.GetAllConnectionsOfCompositionBulk)(t)}this.isDataLoaded=!0,this.listenToEvent(this.mainConcept)}return yield this.build()}))}build(){return s(this,void 0,void 0,(function*(){this.data=[],this.connections=yield(0,n.GetConnectionBulk)(this.linkers);for(var e=0;e<this.connections.length;e++){let t=this.connections[e].toTheConceptId,o=yield(0,n.GetTheConcept)(t);if(console.log("this is the format",this.format),this.format==i.yv){let e=yield(0,r.RW)(o.id);this.data.push(e)}else if(this.format==i.ZJ){let e=yield(0,r.kx)(o.id);this.data.push(e)}else if(this.format==i.iw){let e=yield(0,n.GetCompositionWithIdAndDateFromMemory)(o.id);this.data.push(e)}else{let e=yield(0,n.GetCompositionWithIdAndDateFromMemory)(o.id);this.data.push(e)}}return this.data}))}}function l(e,t,o,n,r=i.yv){return new a(e,t,o,n,r)}},2830:(e,t,o)=>{o.r(t),o.d(t,{ADMIN:()=>Uo,ALLID:()=>Do.BG,AccessTracker:()=>Je.J,AddGhostConcept:()=>lo,Anomaly:()=>Gn,BaseUrl:()=>l.B,BinaryTree:()=>We.W,BuildWidgetFromId:()=>$n.C,BuilderStatefulWidget:()=>kn,Composition:()=>Dt,CompositionBinaryTree:()=>xt,CompositionNode:()=>St,Concept:()=>on.j,ConceptsData:()=>a.I,Connection:()=>O.N,ConnectionData:()=>ze.d,CreateComposition:()=>E.A,CreateConnectionBetweenEntityLocal:()=>Hn,CreateConnectionBetweenTwoConcepts:()=>X,CreateConnectionBetweenTwoConceptsGeneral:()=>Z,CreateConnectionBetweenTwoConceptsLocal:()=>Lo.h,CreateDefaultConcept:()=>M.o,CreateDefaultLConcept:()=>oo.u,CreateSession:()=>Xt,CreateSessionVisit:()=>Zt,CreateTheCompositionLocal:()=>F.R,CreateTheCompositionWithCache:()=>Et,CreateTheConnection:()=>ie.q,CreateTheConnectionGeneral:()=>$,CreateTheConnectionLocal:()=>no.F,DATAID:()=>Do.y0,DATAIDDATE:()=>Do.iw,DelayFunctionExecution:()=>Ro,DeleteConceptById:()=>Pe,DeleteConceptLocal:()=>Go,DeleteConnectionById:()=>J.m,DeleteConnectionByType:()=>Dn,DeleteUser:()=>je,DependencyObserver:()=>Oo.w,FilterSearch:()=>ln,FormatFromConnections:()=>uo.vw,FormatFromConnectionsAltered:()=>uo.y8,FreeschemaQuery:()=>En,FreeschemaQueryApi:()=>_n,GetAllConnectionsOfComposition:()=>U.s,GetAllConnectionsOfCompositionBulk:()=>f.Y,GetAllTheConnectionsByTypeAndOfTheConcept:()=>Un,GetComposition:()=>v.Nj,GetCompositionBulk:()=>et.dF,GetCompositionBulkWithDataId:()=>et.cw,GetCompositionFromConnectionsWithDataId:()=>et.p8,GetCompositionFromConnectionsWithDataIdFromConnections:()=>et.km,GetCompositionFromConnectionsWithDataIdInObject:()=>et.rv,GetCompositionFromConnectionsWithDataIdIndex:()=>et.Nt,GetCompositionFromConnectionsWithIndex:()=>et.as,GetCompositionFromConnectionsWithIndexFromConnections:()=>et.hG,GetCompositionFromMemoryWithConnections:()=>v.JA,GetCompositionList:()=>T,GetCompositionListAll:()=>w,GetCompositionListAllWithId:()=>I,GetCompositionListListener:()=>zo,GetCompositionListLocal:()=>R,GetCompositionListLocalWithId:()=>D,GetCompositionListWithId:()=>k,GetCompositionListWithIdUpdated:()=>N,GetCompositionListener:()=>Ho,GetCompositionLocal:()=>G,GetCompositionLocalWithId:()=>x,GetCompositionWithAllIds:()=>v.Mb,GetCompositionWithCache:()=>Ht,GetCompositionWithDataIdBulk:()=>zt,GetCompositionWithDataIdWithCache:()=>Jt,GetCompositionWithId:()=>v.yz,GetCompositionWithIdAndDateFromMemory:()=>v.Ez,GetConceptBulk:()=>pt.r,GetConceptByCharacter:()=>g.A,GetConceptByCharacterAndCategoryLocal:()=>m.$I,GetConceptByCharacterAndType:()=>re.A,GetConnectionBetweenTwoConceptsLinker:()=>bo,GetConnectionBulk:()=>ft.j,GetConnectionById:()=>Xe,GetConnectionDataPrefetch:()=>et.QL,GetConnectionOfTheConcept:()=>W,GetLink:()=>se,GetLinkListListener:()=>tn,GetLinkListener:()=>Qo.d,GetLinkRaw:()=>ae,GetLinkerConnectionFromConcepts:()=>De,GetLinkerConnectionToConcepts:()=>Ue,GetRelation:()=>eo,GetRelationLocal:()=>vo,GetRelationRaw:()=>to,GetTheConcept:()=>z.A,GetTheConceptLocal:()=>ho.f,GetUserGhostId:()=>ao,JUSTDATA:()=>Do.ZJ,LConcept:()=>nn,LConnection:()=>rn,LISTNORMAL:()=>Do.SL,LocalConceptsData:()=>y.v,LocalSyncData:()=>an.H,LocalTransaction:()=>An,Logger:()=>yn.V,LoginToBackend:()=>gt,MakeTheInstanceConcept:()=>q.A,MakeTheInstanceConceptLocal:()=>K.k,MakeTheTimestamp:()=>Ze,MakeTheTypeConcept:()=>we,MakeTheTypeConceptApi:()=>Se,MakeTheTypeConceptLocal:()=>le.$,NORMAL:()=>Do.yv,PRIVATE:()=>Eo,PUBLIC:()=>Fo,PatcherStructure:()=>cn,RAW:()=>Do.XZ,RecursiveSearchApi:()=>ot,RecursiveSearchApiNewRawFullLinker:()=>ct,RecursiveSearchApiRaw:()=>it,RecursiveSearchApiRawFullLinker:()=>rt,RecursiveSearchApiWithInternalConnections:()=>nt,RecursiveSearchListener:()=>Zo,SchemaQueryListener:()=>Mn,SearchAllConcepts:()=>Ot,SearchLinkInternal:()=>No,SearchLinkInternalAll:()=>Ao,SearchLinkMultipleAll:()=>uo.cf,SearchLinkMultipleAllObservable:()=>Vo,SearchLinkMultipleApi:()=>c.j,SearchQuery:()=>Ke,SearchStructure:()=>dn,SearchWithLinker:()=>Mt,SearchWithTypeAndLinker:()=>qo.zl,SearchWithTypeAndLinkerApi:()=>Wo,SessionData:()=>sn,Signin:()=>It,Signup:()=>Ct,SignupEntity:()=>Tt,SplitStrings:()=>s.f,StatefulWidget:()=>wn,SyncData:()=>V.Y,TrashTheConcept:()=>$e,UpdateComposition:()=>_t,UpdateCompositionLocal:()=>po.D,UserBinaryTree:()=>co,Validator:()=>Bn,ViewInternalData:()=>To,ViewInternalDataApi:()=>mo,WidgetTree:()=>Pn,convertFromConceptToLConcept:()=>wo.F4,convertFromLConceptToConcept:()=>wo.dp,convertWidgetTreeToWidget:()=>Zn,convertWidgetTreeToWidgetWithWrapper:()=>Kn,createFormFieldData:()=>bn,dispatchIdEvent:()=>yi,getFromDatabaseWithType:()=>oe,getObjectsFromIndexDb:()=>ne,getWidgetBulkFromId:()=>Yn,getWidgetFromId:()=>Xn,handleServiceWorkerException:()=>gi,hasActivatedSW:()=>ai,init:()=>ui,recursiveFetch:()=>v.zN,recursiveFetchNew:()=>bt,renderLatestWidget:()=>qn,renderPage:()=>zn,renderWidget:()=>Qn,searchLinkMultipleListener:()=>Mo,sendEmail:()=>mn,sendMessage:()=>hi,serviceWorker:()=>ni,setHasActivatedSW:()=>li,storeToDatabase:()=>te,subscribedListeners:()=>ci,unwrapContainers:()=>oi,updateAccessToken:()=>di,uploadAttachment:()=>dt,uploadFile:()=>ht,uploadImage:()=>ut,validDocumentFormats:()=>lt,validImageFormats:()=>at});var n={};o.r(n),o.d(n,{ADMIN:()=>Uo,ALLID:()=>Do.BG,AccessTracker:()=>Je.J,AddGhostConcept:()=>lo,Anomaly:()=>Gn,BaseUrl:()=>l.B,BinaryTree:()=>We.W,BuildWidgetFromId:()=>$n.C,BuilderStatefulWidget:()=>kn,Composition:()=>Dt,CompositionBinaryTree:()=>xt,CompositionNode:()=>St,Concept:()=>on.j,ConceptsData:()=>a.I,Connection:()=>O.N,ConnectionData:()=>ze.d,CreateComposition:()=>E.A,CreateConnectionBetweenEntityLocal:()=>Hn,CreateConnectionBetweenTwoConcepts:()=>X,CreateConnectionBetweenTwoConceptsGeneral:()=>Z,CreateConnectionBetweenTwoConceptsLocal:()=>Lo.h,CreateDefaultConcept:()=>M.o,CreateDefaultLConcept:()=>oo.u,CreateSession:()=>Xt,CreateSessionVisit:()=>Zt,CreateTheCompositionLocal:()=>F.R,CreateTheCompositionWithCache:()=>Et,CreateTheConnection:()=>ie.q,CreateTheConnectionGeneral:()=>$,CreateTheConnectionLocal:()=>no.F,DATAID:()=>Do.y0,DATAIDDATE:()=>Do.iw,DelayFunctionExecution:()=>Ro,DeleteConceptById:()=>Pe,DeleteConceptLocal:()=>Go,DeleteConnectionById:()=>J.m,DeleteConnectionByType:()=>Dn,DeleteUser:()=>je,DependencyObserver:()=>Oo.w,FilterSearch:()=>ln,FormatFromConnections:()=>uo.vw,FormatFromConnectionsAltered:()=>uo.y8,FreeschemaQuery:()=>En,FreeschemaQueryApi:()=>_n,GetAllConnectionsOfComposition:()=>U.s,GetAllConnectionsOfCompositionBulk:()=>f.Y,GetAllTheConnectionsByTypeAndOfTheConcept:()=>Un,GetComposition:()=>v.Nj,GetCompositionBulk:()=>et.dF,GetCompositionBulkWithDataId:()=>et.cw,GetCompositionFromConnectionsWithDataId:()=>et.p8,GetCompositionFromConnectionsWithDataIdFromConnections:()=>et.km,GetCompositionFromConnectionsWithDataIdInObject:()=>et.rv,GetCompositionFromConnectionsWithDataIdIndex:()=>et.Nt,GetCompositionFromConnectionsWithIndex:()=>et.as,GetCompositionFromConnectionsWithIndexFromConnections:()=>et.hG,GetCompositionFromMemoryWithConnections:()=>v.JA,GetCompositionList:()=>T,GetCompositionListAll:()=>w,GetCompositionListAllWithId:()=>I,GetCompositionListListener:()=>zo,GetCompositionListLocal:()=>R,GetCompositionListLocalWithId:()=>D,GetCompositionListWithId:()=>k,GetCompositionListWithIdUpdated:()=>N,GetCompositionListener:()=>Ho,GetCompositionLocal:()=>G,GetCompositionLocalWithId:()=>x,GetCompositionWithAllIds:()=>v.Mb,GetCompositionWithCache:()=>Ht,GetCompositionWithDataIdBulk:()=>zt,GetCompositionWithDataIdWithCache:()=>Jt,GetCompositionWithId:()=>v.yz,GetCompositionWithIdAndDateFromMemory:()=>v.Ez,GetConceptBulk:()=>pt.r,GetConceptByCharacter:()=>g.A,GetConceptByCharacterAndCategoryLocal:()=>m.$I,GetConceptByCharacterAndType:()=>re.A,GetConnectionBetweenTwoConceptsLinker:()=>bo,GetConnectionBulk:()=>ft.j,GetConnectionById:()=>Xe,GetConnectionDataPrefetch:()=>et.QL,GetConnectionOfTheConcept:()=>W,GetLink:()=>se,GetLinkListListener:()=>tn,GetLinkListener:()=>Qo.d,GetLinkRaw:()=>ae,GetLinkerConnectionFromConcepts:()=>De,GetLinkerConnectionToConcepts:()=>Ue,GetRelation:()=>eo,GetRelationLocal:()=>vo,GetRelationRaw:()=>to,GetTheConcept:()=>z.A,GetTheConceptLocal:()=>ho.f,GetUserGhostId:()=>ao,JUSTDATA:()=>Do.ZJ,LConcept:()=>nn,LConnection:()=>rn,LISTNORMAL:()=>Do.SL,LocalConceptsData:()=>y.v,LocalSyncData:()=>an.H,LocalTransaction:()=>An,Logger:()=>yn.V,LoginToBackend:()=>gt,MakeTheInstanceConcept:()=>q.A,MakeTheInstanceConceptLocal:()=>K.k,MakeTheTimestamp:()=>Ze,MakeTheTypeConcept:()=>we,MakeTheTypeConceptApi:()=>Se,MakeTheTypeConceptLocal:()=>le.$,NORMAL:()=>Do.yv,PRIVATE:()=>Eo,PUBLIC:()=>Fo,PatcherStructure:()=>cn,RAW:()=>Do.XZ,RecursiveSearchApi:()=>ot,RecursiveSearchApiNewRawFullLinker:()=>ct,RecursiveSearchApiRaw:()=>it,RecursiveSearchApiRawFullLinker:()=>rt,RecursiveSearchApiWithInternalConnections:()=>nt,RecursiveSearchListener:()=>Zo,SchemaQueryListener:()=>Mn,SearchAllConcepts:()=>Ot,SearchLinkInternal:()=>No,SearchLinkInternalAll:()=>Ao,SearchLinkMultipleAll:()=>uo.cf,SearchLinkMultipleAllObservable:()=>Vo,SearchLinkMultipleApi:()=>c.j,SearchQuery:()=>Ke,SearchStructure:()=>dn,SearchWithLinker:()=>Mt,SearchWithTypeAndLinker:()=>qo.zl,SearchWithTypeAndLinkerApi:()=>Wo,SessionData:()=>sn,Signin:()=>It,Signup:()=>Ct,SignupEntity:()=>Tt,SplitStrings:()=>s.f,StatefulWidget:()=>wn,SyncData:()=>V.Y,TrashTheConcept:()=>$e,UpdateComposition:()=>_t,UpdateCompositionLocal:()=>po.D,UserBinaryTree:()=>co,Validator:()=>Bn,ViewInternalData:()=>To,ViewInternalDataApi:()=>mo,WidgetTree:()=>Pn,convertFromConceptToLConcept:()=>wo.F4,convertFromLConceptToConcept:()=>wo.dp,convertWidgetTreeToWidget:()=>Zn,convertWidgetTreeToWidgetWithWrapper:()=>Kn,createFormFieldData:()=>bn,dispatchIdEvent:()=>yi,getFromDatabaseWithType:()=>oe,getObjectsFromIndexDb:()=>ne,getWidgetBulkFromId:()=>Yn,getWidgetFromId:()=>Xn,handleServiceWorkerException:()=>gi,hasActivatedSW:()=>ai,init:()=>ui,recursiveFetch:()=>v.zN,recursiveFetchNew:()=>bt,renderLatestWidget:()=>qn,renderPage:()=>zn,renderWidget:()=>Qn,searchLinkMultipleListener:()=>Mo,sendEmail:()=>mn,sendMessage:()=>hi,serviceWorker:()=>ni,setHasActivatedSW:()=>li,storeToDatabase:()=>te,subscribedListeners:()=>ci,unwrapContainers:()=>oi,updateAccessToken:()=>di,uploadAttachment:()=>dt,uploadFile:()=>ht,uploadImage:()=>ut,validDocumentFormats:()=>lt,validImageFormats:()=>at});var i=o(5020),r=o(205),c=o(2832),s=o(6467),a=o(9639),l=o(9581),d=o(3518),u=o(1863),h=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function p(e,t){var o=arguments;return h(this,void 0,void 0,(function*(){const n=yn.V.logfunction("GetAllConceptsByType",o);try{var i=new URLSearchParams;i.append("type",e),i.append("user_id",t.toString());var r=(0,d.Xr)("application/x-www-form-urlencoded");const o=yield fetch(l.B.GetAllConceptsByTypeUrl(),{method:"POST",headers:r,body:i});if(o.ok){const e=yield o.json();for(var c=0;c<e.length;c++)a.I.AddConcept(e[c])}else console.log("GetAllConceptsByType error",o.status),(0,u.ry)(o)}catch(e){e instanceof Error?console.log("GetAllConceptsByType error message: ",e.message):console.log("GetAllConceptsByType unexpected error: ",e),(0,u.Mb)(e,l.B.GetAllConceptsByTypeUrl()),(0,u.ey)(n,"GetAllConceptsByType",e)}}))}var f=o(8642),y=o(9736),v=o(8939),g=o(2013),m=o(8064),C=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function T(e,t){var o=arguments;return C(this,arguments,void 0,(function*(e,t,n=10,i=1){const r=yn.V.logfunction("GetCompositionList",o);if(ni){r.serviceWorker=!0;try{const o=yield hi("GetCompositionList",{compositionName:e,userId:t,inpage:n,page:i});return yn.V.logUpdate(r),o.data}catch(e){console.error("GetCompositionList sw error: ",e),(0,u.ey)(r,"GetCompositionList",e),gi(e)}}let c=yield(0,g.A)(e),s=[];if(c){yield p(e,t);let o=yield a.I.GetConceptsByTypeIdAndUser(c.id,t),r=n*(i-1),l=[];for(let e=r;e<r+n;e++)o[e]&&l.push(o[e].id);yield(0,f.Y)(l);for(let e=r;e<r+n;e++)if(o[e]){let t=yield(0,v.kx)(o[e].id);s.push(t)}}return yn.V.logUpdate(r),s}))}function w(e,t){return C(this,arguments,void 0,(function*(e,t,o=10,n=1){let i=R(e,t),r=T(e,t),c=[];return Promise.race([i,r]).then((e=>{console.log("Promise result",e),c.push(...e)})).catch((e=>{console.log("error in handling",e)})),r.then((e=>{console.log("This is the second promise result",e),c.push(...e)})),c}))}function I(e,t){return C(this,arguments,void 0,(function*(e,t,o=10,n=1){if(ni)try{return(yield hi("GetCompositionListAllWithId",{compositionName:e,userId:t,inpage:o,page:n})).data}catch(e){console.error("GetCompositionListAllWithId sw error: ",e),gi(e)}let i=yield(0,m.Ay)(e),r=yield(0,g.A)(e),c=[],s=[],l=[],d=[];0!=i.id&&(s=yield y.v.GetConceptsByTypeIdAndUser(i.id,t)),0!=r.id&&(yield p(e,t),d=yield a.I.GetConceptsByTypeIdAndUser(r.id,t),c=d);for(let e=0;e<s.length;e++){let t=!1;for(let o=0;o<d.length;o++)s[e].ghostId==d[o].ghostId&&(t=!0);t||l.push(s[e])}console.log("This is the all list",l);let u=[];return u=yield function(e,t){return C(this,arguments,void 0,(function*(e,t,o=10,n=1){let i=[],r=o*(n-1),c=[],s=t.length;for(let t=r;t<r+o-s;t++)e[t]&&c.push(e[t].id);for(let e=0;e<t.length;e++){let o=yield x(t[e].id);i.push(o)}yield(0,f.Y)(c);for(let t=r;t<r+o-s;t++)if(e[t]){let o=yield(0,v.RW)(e[t].id);i.push(o)}return i}))}(c,l,o,n),u}))}function k(e,t){return C(this,arguments,void 0,(function*(e,t,o=10,n=1){if(ni)try{return(yield hi("GetCompositionListWithId",{compositionName:e,userId:t,inpage:o,page:n})).data}catch(e){console.error("GetCompositionListWithId sw error: ",e),gi(e)}let i=yield(0,g.A)(e),r=[];if(i){yield p(e,t);let c=yield a.I.GetConceptsByTypeIdAndUser(i.id,t),s=o*(n-1),l=[];for(let e=s;e<s+o;e++)c[e]&&l.push(c[e].id);yield(0,f.Y)(l);for(let e=s;e<s+o;e++)if(c[e]){let t=yield(0,v.RW)(c[e].id);r.push(t)}}return r}))}function N(e,t){return C(this,arguments,void 0,(function*(e,t,o=10,n=1){let i=yield(0,g.w)(e),r=[];if(i){yield p(e,t);let c=yield a.I.GetConceptsByTypeIdAndUser(i.id,t),s=o*(n-1),l=[];for(let e=s;e<s+o;e++)c[e]&&l.push(c[e].id);yield(0,f.Y)(l);for(let e=s;e<s+o;e++)if(c[e]){let t=yield(0,v.RW)(c[e].id);r.push(t)}}return r}))}var A=o(4864),L=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))},S=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function G(e){return S(this,void 0,void 0,(function*(){var t,o;try{if(ni)try{return(yield hi("GetCompositionLocal",{id:e})).data}catch(e){console.error("GetCompositionLocal error sw: ",e),gi(e)}let n=[],i={};n=yield A.G.GetConnectionsOfCompositionLocal(e);let r=[];for(let e=0;e<n.length;e++)r.includes(n[e].ofTheConceptId)||r.push(n[e].ofTheConceptId);let c=yield y.v.GetConcept(e);if(0==c.id){let t=yield function(e){var t=arguments;return L(this,void 0,void 0,(function*(){const o=yn.V.logfunction("TranslateLocalToReal",t);let n=(0,M.o)();try{var i=(0,d.ab)("application/x-www-form-urlencoded");const t=yield fetch(l.B.GetRealConceptById(),{method:"POST",headers:i,body:`id=${e}`});if(t.ok)return n=yield t.json(),n.id>0&&a.I.AddConcept(n),n;console.log("Error in Getting Translating concept Error",t.status),(0,u.ry)(t),yn.V.logUpdate(o)}catch(e){e instanceof Error?console.log("Error in Getting Translating concept error message: ",e):console.log("Error in Getting Translating concept unexpected error: ",e),(0,u.Mb)(e,l.B.GetRealConceptById()),(0,u.ey)(o,"TranslateLocalToReal",e)}return n}))}(e);if(t.id>0)return yield(0,v.Nj)(t.id)}let s=yield B(e,n,r);return i[null!==(o=null===(t=null==c?void 0:c.type)||void 0===t?void 0:t.characterValue)&&void 0!==o?o:"top"]=s,i}catch(e){throw e}}))}function x(e){return S(this,void 0,void 0,(function*(){var t,o;try{if(ni)try{return(yield hi("GetCompositionLocalWithId",{id:e})).data}catch(e){console.error("GetCompositionLocalWithId error sw: ",e),gi(e)}let n=[],i={},r={};n=yield A.G.GetConnectionsOfCompositionLocal(e);let c=[];for(let e=0;e<n.length;e++)c.includes(n[e].ofTheConceptId)||c.push(n[e].ofTheConceptId);let s=yield y.v.GetConcept(e);if(0!=s.id){let r=yield B(e,n,c);i[null!==(o=null===(t=null==s?void 0:s.type)||void 0===t?void 0:t.characterValue)&&void 0!==o?o:"top"]=r}return r.data=i,r.id=e,r}catch(e){throw e}}))}function B(e,t,o){return S(this,arguments,void 0,(function*(e,t,o,n=[]){var i,r,c;let s={},a=[],l=yield y.v.GetConcept(e);if(0!=l.id&&null==l.type){let e=l.typeId,t=yield y.v.GetConcept(e);l.type=t}if(null===(i=null==l?void 0:l.type)||void 0===i?void 0:i.characterValue,!o.includes(e))return null==l?void 0:l.characterValue;if(n.includes(e))return"";n.push(e);for(let n=0;n<t.length;n++)if(t[n].ofTheConceptId==e){let e=t[n].toTheConceptId,i=yield y.v.GetConcept(e);if(0!=i.id&&null==(null==i?void 0:i.type)){let e=i.typeId,t=yield y.v.GetConcept(e);i.type=t}let l="the_",d=(null!==(c=null===(r=null==i?void 0:i.type)||void 0===r?void 0:r.characterValue)&&void 0!==c?c:"top").replace(l,"");if(isNaN(Number(d))){if(d){const n=yield B(e,t,o);s[d]=n}}else{const n=yield B(e,t,o);a[d]=n,s=a}}return s}))}var b=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function R(e,t){return b(this,void 0,void 0,(function*(){if(ni)try{return(yield hi("GetCompositionListLocal",{compositionName:e,userId:t})).data}catch(e){console.error("GetCompositionListLocal error sw: ",e),gi(e)}try{let o=yield(0,m.Ay)(e),n=[];if(0!=o.id){let e=yield y.v.GetConceptsByTypeIdAndUser(o.id,t);for(let t=0;t<e.length;t++){let o=yield G(e[t].id);n.push(o)}}return n}catch(e){throw e}}))}function D(e,t){return b(this,void 0,void 0,(function*(){if(ni)try{return(yield hi("GetCompositionListLocalWithId",{compositionName:e,userId:t})).data}catch(e){console.error("GetCompositionListLocalWithId error sw: ",e),gi(e)}try{let o=yield(0,m.Ay)(e),n=[];if(0!=o.id){let e=yield y.v.GetConceptsByTypeIdAndUser(o.id,t);for(let t=0;t<e.length;t++){let o=yield x(e[t].id);n.push(o)}}return n}catch(e){throw e}}))}var U=o(2),E=o(1218),F=o(999),_=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function W(e,t,o){var n=arguments;return _(this,arguments,void 0,(function*(e,t,o,i=10,r=1){const c=yn.V.logfunction("GetConnectionOfTheConcept",n);let s=[];try{if(ni){c.serviceWorker=!0;try{const n=yield hi("GetConnectionOfTheConcept",{typeId:e,ofTheConceptId:t,userId:o,inpage:i,page:r});return yn.V.logUpdate(c),n.data}catch(e){console.error("GetConnectionOfTheConcept sw error: ",e),(0,u.ey)(c,"GetConnectionOfTheConcept",e),gi(e)}}let n=new URLSearchParams;n.append("typeId",`${e}`),n.append("ofTheConceptId",`${t}`),n.append("userId",`${o}`),n.append("inpage",`${i}`),n.append("page",`${r}`);let a=(0,d.Xr)("application/x-www-form-urlencoded");const h=yield fetch(l.B.GetAllConnectionsOfConceptUrl(),{method:"POST",headers:a,body:n});return h.ok?s=yield h.json():((0,u.ey)(c,"GetConnectionOfTheConcept",h.status),(0,u.ry)(h),console.log("Get connection of concept error",h.status)),yn.V.logUpdate(c),s}catch(e){e instanceof Error?console.log("Get connection of concept error message: ",e.message):console.log("Get connection of concept unexpected error: ",e),(0,u.Mb)(e,l.B.GetAllConnectionsOfConceptUrl()),(0,u.ey)(c,"GetConnectionOfTheConcept",e)}}))}var O=o(2155),V=o(442),M=o(7282),P=o(5976),j=o(7273),H=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function $(e,t,o,n){return H(this,arguments,void 0,(function*(e,t,o,n,i=1,r=4){if(e>0&&o>0){var c=t,s=yield P.p.getId(),a=new O.N(s,e,o,c,n,i,r);return e==o?(a.ofTheConceptId=0,a.toTheConceptId=1,a):(a.toUpdate=!0,a.isTemp=!1,V.Y.AddConnection(a),a)}throw new j.z("cannot create connection because id are negative ",!1,400,"")}))}var J=o(1838),z=o(7876),q=o(8407),Q=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function X(e,t,o){return Q(this,arguments,void 0,(function*(e,t,o,n=!1,i=!1){var r,c;if(ni)try{return(yield hi("CreateConnectionBetweenTwoConcepts",{ofTheConcept:e,toTheConcept:t,linker:o,both:n,count:i})).data}catch(e){console.error("CreateConnectionBetweenTwoConcepts sw error: ",e),gi(e)}let s=e.userId;if(n){let n=o+"_by",c=(null===(r=t.type)||void 0===r?void 0:r.characterValue)+"_s_"+n;i&&(yield Y(n,t,s));let a=yield(0,q.A)("connection",c,!1,999,999,999),l=new O.N(0,t.id,e.id,s,a.id,1e3,4);V.Y.AddConnection(l)}let a=o+"_s",l=(null===(c=e.type)||void 0===c?void 0:c.characterValue)+"_s_"+a;i&&(yield Y(a,e,s));let d=yield(0,q.A)("connection",l,!1,999,999,999),u=new O.N(0,e.id,t.id,s,d.id,1e3,4);return V.Y.AddConnection(u),u}))}function Y(e,t){return Q(this,arguments,void 0,(function*(e,t,o=null){var n;let i=t,r=null!=o?o:t.userId,c=e+"_count",s=(null===(n=t.type)||void 0===n?void 0:n.characterValue)+"_s_"+c,a=yield(0,q.A)("connection",s,!1,r,4,999),l=yield W(a.id,t.id,r,10,1),d=[],u=(0,M.o)();for(let e=0;e<l.length;e++){let t=yield(0,z.A)(l[e].toTheConceptId);d.push(t)}if(d.length<1)u=yield(0,q.A)("count","1",!1,r,4,999);else{let e=d[0],t=0;try{t=Number(e.characterValue)}catch(e){t=0}t+=1,u=yield(0,q.A)("count",t.toString(),!1,r,4,999);for(let e=0;e<l.length;e++)(0,J.m)(l[e].id)}let h=new O.N(0,i.id,u.id,i.userId,a.id,1e3,4);yield V.Y.AddConnection(h)}))}function Z(e,t,o){return Q(this,arguments,void 0,(function*(e,t,o,n=!1,i=!1){var r,c;let s=e.userId;if(n){let n=o+"_by",c=(null===(r=t.type)||void 0===r?void 0:r.characterValue)+"_s_"+n;i&&(yield Y(n,t,s));let a=yield(0,q.A)("connection",c,!1,999,999,999),l=new O.N(0,t.id,e.id,s,a.id,1e3,4);V.Y.AddConnection(l)}let a=o+"_s",l=(null===(c=e.type)||void 0===c?void 0:c.characterValue)+"_s_"+a;i&&(yield Y(a,e,s));let d=yield(0,q.A)("connection",l,!1,999,999,999);return yield $(e.id,e.userId,t.id,d.id,1e3,4)}))}var K=o(5868),ee=(o(3655),function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))});function te(e,t){const o=yn.V.logfunction("storeToDatabase",[e,"noindexdb"]);yn.V.logUpdate(o)}function oe(e,t,o){return ee(this,void 0,void 0,(function*(){const t=yn.V.logfunction("getFromDatabaseWithType",[e,"noindexdb"]);yn.V.logUpdate(t)}))}function ne(e){return ee(this,void 0,void 0,(function*(){const t=yn.V.logfunction("getObjectsFromIndexDb",[e,"noindexdb"]);yn.V.logUpdate(t)}))}var ie=o(1666),re=o(4402),ce=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function se(e,t){var o=arguments;return ce(this,arguments,void 0,(function*(e,t,n=10,i=1){var r;const c=yn.V.logfunction("GetLink",o);if(ni){c.serviceWorker=!0;try{const o=yield hi("GetLink",{id:e,linker:t,inpage:n,page:i});return yn.V.logUpdate(c),o.data}catch(e){console.error("GetLink sw error: ",e),(0,u.ey)(c,"GetLink",e),gi(e)}}let s=[],a=yield(0,z.A)(e),l=(null===(r=a.type)||void 0===r?void 0:r.characterValue)+"_s_"+t,d=yield(0,re.A)(l,16);if(d.id>0){let e=yield W(d.id,a.id,a.userId,n,i),t=[];for(let o=0;o<e.length;o++)t.push(e[o].toTheConceptId);yield(0,f.Y)(t);for(let t=0;t<e.length;t++){let o=e[t].toTheConceptId,n=yield(0,z.A)(o),i=yield(0,v.Ez)(n.id);s.push(i)}}return yn.V.logUpdate(c),s}))}function ae(e,t){var o=arguments;return ce(this,arguments,void 0,(function*(e,t,n=10,i=1){var r;const c=yn.V.logfunction("GetLinkRaw",o);let s=[],a=yield(0,z.A)(e),l=(null===(r=a.type)||void 0===r?void 0:r.characterValue)+"_s_"+t,d=yield(0,re.A)(l,16);if(d.id>0){let e=yield W(d.id,a.id,a.userId,n,i),t=[];for(let o=0;o<e.length;o++)t.push(e[o].toTheConceptId);for(let t=0;t<e.length;t++){let o=e[t].toTheConceptId,n=yield(0,z.A)(o);s.push(n)}}return yn.V.logUpdate(c),s}))}var le=o(8357),de=o(2212);class ue{constructor(e,t,o,n,i,r,c,s,a,l){this.id=0,this.isNew=!1,this.userId=e,this.data=`${t}`,this.securityId=o,this.securityUserId=n,this.accessId=i,this.accessUserId=r,this.sessionId=c,this.sessionUserId=s,this.isNew=l}}class he{constructor(){this.name="character Repository"}static AddCharacter(e){this.characterData[e.id]=e}static GetCharacter(e){for(var t=new ue(0,"0",0,0,0,0,0,0,"0",!1),o=0;o<this.characterData.length;o++)this.characterData[o].data==e&&(t=this.characterData[o]);return t}}he.characterData=[];class pe{constructor(e,t,o,n){this.id=e,this.userId=t,this.referentId=o,this.isNew=n}}var fe=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))},ye=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function ve(e,t,o,n,i){return ye(this,void 0,void 0,(function*(){return new ue(t,e,o,t,n,t,i,t,"",!1),yield function(){return fe(this,void 0,void 0,(function*(){var e;const t=yn.V.logfunction("CreateTheCharacter",e);try{if(0==(e=he.GetCharacter(e.data)).id){var o=(0,d.Xr)();const i=yield fetch(l.B.CreateTheCharacterDataUrl(),{method:"POST",headers:o,body:JSON.stringify(e)});if(!i.ok)throw(0,u.ry)(i),new Error(`Error! status: ${i.status}`);const r=yield i.json();var n=new ue(r.userId,e.data,0,0,4,4,999,999,"",!1);return n.id=r.id,he.AddCharacter(n),yn.V.logUpdate(t),r}return new pe(e.id,e.userId,0,!1)}catch(e){throw e instanceof Error?console.log("create the character error message: ",e.message):console.log("create the character unexpected error: ",e),(0,u.ey)(t,"CreateTheCharacter",e),e}}))}()}))}var ge=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function me(e,t,o,n,i,r,c){return ge(this,void 0,void 0,(function*(){let s=yield(0,re.A)(e,n),a=s;return 0==a.id&&(s=yield(0,de.Ay)(e,t,o,n,i,r,c),a=s),a}))}var Ce=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))},Te=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function we(e,t,o,n){var i=arguments;return Te(this,void 0,void 0,(function*(){const r=yn.V.logfunction("MakeTheTypeConcept",i);if(ni){r.serviceWorker=!0;try{const i=yield hi("MakeTheTypeConcept",{typeString:e,sessionId:t,sessionUserId:o,userId:n});return yn.V.logUpdate(r),i.data}catch(e){console.error("MakeTheTypeConcept sw error: ",e),(0,u.ey)(r,"MakeTheTypeConcept",e),gi(e)}}let c=yield(0,g.A)(e);if(c&&(0==c.id||0==c.userId)){let i=(0,s.f)(e);if(i.length>0)if(i[0]==e){let o=yield function(e,t,o,n,i,r){return Ce(this,void 0,void 0,(function*(){let o;if(1==e.length){let i=e.charCodeAt(0),c=49;yield ve(e,t,999,n,r),o=me(e,t,4,c,i,n,"the_character")}else{let i=yield ve(e,t,999,n,r);i.isNew,o=yield me(e,t,4,51,i.id,n,"the_characters")}return o}))}(e,n,0,999,0,t);c=o}else{let r=yield we(i[0],t,o,n),s=yield we(i[1],t,o,n);s&&(c=yield(0,de.N)(e,n,r.id,s.id,999,999,i[1]))}}return yn.V.logUpdate(r),c}))}var Ie=o(8146),ke=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))},Ne=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function Ae(e){return Ne(this,void 0,void 0,(function*(){const t=yn.V.logfunction("GetConceptByCharacterAndCategory",e);let o=(0,M.o)();if("the"==e)return o.id=1,o.typeId=5,o.characterValue="the",o;let n=(0,s.f)(e);if(n.length>1){let t=1,i=yield Ae(n[0]);0!=i.id&&(t=i.id),o=yield function(e,t){var o=arguments;return Ne(this,void 0,void 0,(function*(){const n=yn.V.logfunction("GetConceptByCharacterAndCategoryFromMemory",o);let i=yield a.I.GetConceptByCharacterAndCategoryLocal(e,t);return 0==i.id&&(i=yield function(e,t){var o=arguments;return ke(this,void 0,void 0,(function*(){const n=yn.V.logfunction("GetConceptByCharacterAndCategoryDirectApi",o);let i=(0,M.o)();try{var r=(0,d.Xr)("application/x-www-form-urlencoded");const o=yield fetch(l.B.GetConceptByCharacterAndCategoryDirectUrl(),{method:"POST",headers:r,body:`character_value=${e}&category_id=${t}`});o.ok?(i=yield o.json(),a.I.AddConcept(i)):(console.log("This is the concept by category and character error",o.status),(0,u.ry)(o)),yn.V.logUpdate(n)}catch(e){e instanceof Error?console.log(" This is the concept by category and character error message: ",e.message):console.log(" This is the concept by category and character unexpected error: ",e),(0,u.Mb)(e,l.B.GetConceptByCharacterAndCategoryDirectUrl()),(0,u.ey)(n,"GetConceptByCharacterAndCategoryDirectApi",e)}return i}))}(e,t)),yn.V.logUpdate(n),i}))}(e,t)}else n[0]==e&&(o=yield function(e){var t=arguments;return Ne(this,void 0,void 0,(function*(){const o=yn.V.logfunction("GetConceptByCharacter",t);let n=yield a.I.GetConceptByCharacterAndTypeLocal(e,51);return 0==n.id&&(n=yield(0,Ie.Y)(e)),yn.V.logUpdate(o),n}))}(e));return yn.V.logUpdate(t),o}))}var Le=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function Se(e,t){var o=arguments;return Le(this,void 0,void 0,(function*(){const t=yn.V.logfunction("MakeTheTypeConceptApi",o);let n=(0,M.o)();try{if(n=yield Ae(e),0==n.id||4==n.typeId){let o=(0,d.Xr)("application/x-www-form-urlencoded");const i=yield fetch(l.B.MakeTheTypeConceptUrl(),{method:"POST",headers:o,body:`type=${e}`});if(!i.ok)throw(0,u.ry)(i),new Error(`Error! status: ${i.status}`);n=yield i.json(),yn.V.logUpdate(t)}}catch(e){e instanceof Error?console.log("Make The Type Concept Api error : ",e.message):console.log("Make The Type Concept Api error : ",e),(0,u.Mb)(e,l.B.MakeTheTypeConceptUrl()),(0,u.ey)(t,"MakeTheTypeConceptApi",e)}return n}))}var Ge=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function xe(e){var t=arguments;return Ge(this,void 0,void 0,(function*(){yn.V.logfunction("GetAllLinkerConnectionsFromTheConcept",t);var o=[];try{(new Date).getTime();var n=(0,d.Xr)("application/x-www-form-urlencoded");const t=yield fetch(l.B.GetAllLinkerConnectionOfConceptUrl()+`?conceptId=${e}`,{method:"GET",headers:n});if(t.ok){const e=yield t.json();for(var i=0;i<e.length;i++){var r=e[i];o.push(r)}}else console.log("Get all linker connection from the concepts error","cannot get respone"),(0,u.ry)(t)}catch(e){e instanceof Error?console.log("Get all linker connection from the concepts error: ",e.message):console.log("Get all linker connection from the concepts error(Unexpected): ",e),(0,u.Mb)(e,l.B.GetAllLinkerConnectionOfConceptUrl())}return o}))}var Be=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function be(e){var t=arguments;return Be(this,void 0,void 0,(function*(){const o=yn.V.logfunction("GetAllLinkerConnectionsToTheConcept",t);var n=[];try{(new Date).getTime();var i=(0,d.Xr)("application/x-www-form-urlencoded");const t=yield fetch(l.B.GetAllLinkerConnectionToConceptUrl()+`?conceptId=${e}`,{method:"GET",headers:i});if(t.ok){const e=yield t.json();for(var r=0;r<e.length;r++){var c=e[r];n.push(c)}yn.V.logUpdate(o)}else console.log("Get all linker connection To the concepts error","cannot get respone"),(0,u.ry)(t)}catch(e){e instanceof Error?console.log("Get all linker connection To the concepts error: ",e.message):console.log("Get all linker connection To the concepts error(Unexpected): ",e),(0,u.Mb)(e,l.B.GetAllLinkerConnectionToConceptUrl()),(0,u.ey)(o,"GetAllLinkerConnectionsToTheConcept",e)}return n}))}var Re=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function De(e){var t=arguments;return Re(this,void 0,void 0,(function*(){const o=yn.V.logfunction("GetLinkerConnectionFromConcepts",t);let n=yield xe(e);for(let e=0;e<n.length;e++){let t=n[e],o=t.typeId,i=yield(0,z.A)(o);t.type=i}return yn.V.logUpdate(o),n}))}function Ue(e){var t=arguments;return Re(this,void 0,void 0,(function*(){const o=yn.V.logfunction("GetLinkerConnectionToConcepts",t);let n=yield be(e);for(let e=0;e<n.length;e++){let t=n[e],o=t.typeId,i=yield(0,z.A)(o);t.type=i}return yn.V.logUpdate(o),n}))}var Ee=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))},Fe=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))},_e=o(6963),We=o(2202),Oe=o(5457),Ve=o(991),Me=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function Pe(e){var t=arguments;return Me(this,void 0,void 0,(function*(){const o=yn.V.logfunction("DeleteConceptById",t);if(ni)try{return(yield hi("DeleteConceptById",{id:e})).data}catch(e){console.error("DeleteConceptById sw error: ",e),gi(e)}if(e>0){var n=yield a.I.GetConcept(e);if(n.id>0){var i=n.typeId,r=n.characterValue;yield Oe.c.removeTypeConcept(i,e),yield _e.f.removeNodeByCharacter(r,e),yield function(e){var t=arguments;return Fe(this,void 0,void 0,(function*(){const o=yn.V.logfunction("DeleteTheConcept",t);try{const t=new FormData;t.append("id",e.toString());let n=(0,d.BZ)();const i=yield fetch(l.B.DeleteConceptUrl(),{method:"POST",headers:n,body:t});i.ok||(console.log("Delete concept error",i.status),(0,u.ry)(i)),yn.V.logUpdate(o)}catch(e){e instanceof Error?console.log("Delete concept error message: ",e.message):console.log("Delete concept unexpected error: ",e),(0,u.Mb)(e,l.B.DeleteConceptUrl()),(0,u.ey)(o,"DeleteTheConcept",e)}}))}(e),yield We.W.removeNodeFromTree(e),yield Ve.H.removeNodeFromTree(e)}}else y.v.RemoveConceptById(e);yn.V.logUpdate(o)}))}function je(e){return Me(this,void 0,void 0,(function*(){if(ni)try{return(yield hi("DeleteUser",{id:e})).data}catch(e){console.error("DeleteUser sw error: ",e),gi(e)}e>0?function(e){var t=arguments;Ee(this,void 0,void 0,(function*(){const o=yn.V.logfunction("DeleteUserInBackend",t);try{var n=(0,d.ab)("application/json","");let t=l.B.DeleteUserUrl();t=t+"?conceptId="+e+"&apiKey=freeschema";const i=yield fetch(t,{method:"POST",headers:n});if(i.ok){let e=yield i.json(),t=Number(e.data);return console.log("this is the delete email concept",t),Pe(t),yn.V.logUpdate(o),t}throw(0,u.ry)(i),new Error(`Delete composition Error! status: ${i.status}`)}catch(e){e instanceof Error?console.log("Delete composition error message: ",e.message):console.log("Delete composition unexpected error: ",e),(0,u.Mb)(e,l.B.DeleteConceptUrl()),(0,u.ey)(o,"DeleteUserInBackend",e)}}))}(e):y.v.RemoveConceptById(e)}))}var He=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function $e(e,t){return He(this,void 0,void 0,(function*(){try{const o=new Headers;o.append("Authorization","Bearer "+t);const n=new FormData;n.append("id",e.toString());const i=yield fetch(l.B.DeleteConceptUrl(),{method:"POST",body:n,headers:o});if(!i.ok)throw(0,u.ry)(i),new Error(`Delete composition Error! status: ${i.status}`)}catch(e){e instanceof Error?console.log("Delete composition error message: ",e.message):console.log("Delete composition unexpected error: ",e),(0,u.Mb)(e,l.B.DeleteConceptUrl())}}))}var Je=o(1735),ze=o(8286),qe=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))},Qe=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function Xe(e){var t=arguments;return Qe(this,void 0,void 0,(function*(){const o=yn.V.logfunction("GetConnectionById",t);if(console.log("AccessTracker activation status from GetConnectionById"),!0===Je.J.activateStatus)try{Je.J.incrementConnection(e)}catch(e){console.error("Error adding connection in access tracker"),yn.V.log("ERROR","Error Adding Connection")}if(ni)try{return(yield hi("GetConnectionById",{id:e})).data}catch(e){console.error("GetConnectionById sw error: ",e),gi(e)}let n=yield ze.d.GetConnection(e);if((null==n||0==n.id)&&null!=e&&null!=e){let t=yield function(e){var t=arguments;return qe(this,void 0,void 0,(function*(){const o=yn.V.logfunction("GetConnection",t);let n=yield ze.d.GetConnection(e);try{if(0!=n.id)return n;{let t=(0,d.Xr)("application/x-www-form-urlencoded");const i=new FormData;i.append("id",e.toString());const r=yield fetch(l.B.GetConnectionUrl(),{method:"POST",headers:t,body:i});return r.ok?(n=yield r.json(),ze.d.AddConnection(n)):((0,u.ry)(r),console.log("Get Connection Error",r.status)),yn.V.logUpdate(o),n}}catch(e){e instanceof Error?console.log("Get Connection error message: ",e.message):console.log("Get Connection unexpected error: ",e),(0,u.Mb)(e,l.B.GetConnectionUrl()),(0,u.ey)(o,"GetConnection",e)}}))}(e);n=t}return yn.V.logUpdate(o),n}))}var Ye=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function Ze(e,t,o){return Ye(this,arguments,void 0,(function*(e,t,o,n=4,i=999){const r=yn.V.logfunction("MakeTheTimestamp");if(ni){r.serviceWorker=!0;try{const c=yield hi("MakeTheTimestamp",{type:e,referent:t,userId:o,accessId:n,sessionInformationId:i});return yn.V.logUpdate(r),c.data}catch(e){console.error("MakeTheTimestamp sw error: ",e),(0,u.ey)(r,"MakeTheTimestamp",e),gi(e)}}let c,s="",a=e.startsWith("the_"),l=(0,M.o)();return s=a?e:"the_"+e,l=yield Se(s,o),c=yield me(t,o,4,l.id,0,n,s),yn.V.logUpdate(r),c}))}class Ke{constructor(){this.composition=0,this.type="",this.linker="",this.inpage=10,this.page=1,this.listLinkers=[],this.fullLinkers=[],this.textSearch="",this.logic="or",this.reverse=!1,this.doFilter=!1,this.filterSearches=[],this.selectors=[],this.ofCompositions=[]}}var et=o(6687),tt=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function ot(){var e=arguments;return tt(this,arguments,void 0,(function*(t=0,o=[],n=""){const i=yn.V.logfunction("RecursiveSearchApi",e);let r=[];try{if(ni){i.serviceWorker=!0;try{const e=yield hi("RecursiveSearchApi",{composition:t,listLinkers:o,textSearch:n});return yn.V.logUpdate(i),e.data}catch(e){console.error("RecursiveSearchApi sw error: ",e),(0,u.ey)(i,"RecursiveSearchApi",e),gi(e)}}let e=new Ke;e.composition=t,e.listLinkers=o,e.textSearch=n;let c=JSON.stringify(e),s=(0,d.Xr)();const a=yield fetch(l.B.RecursiveSearchUrl(),{method:"POST",headers:s,body:c});if(a.ok){const e=yield a.json();let t=e.compositionIds,o=e.internalConnections;e.externalConnections,r=yield(0,et.p8)(t,o)}else console.log("recursive search error ",a.status),(0,u.ey)(i,"RecursiveSearchApi",a.status),(0,u.ry)(a);yn.V.logUpdate(i)}catch(e){e instanceof Error?console.log("recursive search error message: ",e.message):console.log("recursive search unexpected error: ",e),(0,u.ey)(i,"RecursiveSearchApi",e),(0,u.Mb)(e,l.B.RecursiveSearchUrl())}return r}))}function nt(){var e=arguments;return tt(this,arguments,void 0,(function*(t=0,o=[],n=""){const i=yn.V.logfunction("RecursiveSearchApiWithInternalConnections",e);let r=[];try{if(ni){i.serviceWorker=!0;try{const e=yield hi("RecursiveSearchApiWithInternalConnections",{composition:t,listLinkers:o,textSearch:n});return yn.V.logUpdate(i),e.data}catch(e){console.error("RecursiveSearchApiWithInternalConnections sw error: ",e),(0,u.ey)(i,"RecursiveSearchApiWithInternalConnections",e),gi(e)}}let e=new Ke;e.composition=t,e.listLinkers=o,e.textSearch=n;let c=JSON.stringify(e),s=(0,d.Xr)();const a=yield fetch(l.B.RecursiveSearchUrl(),{method:"POST",headers:s,body:c});if(a.ok){const e=yield a.json();let t=e.compositionIds,o=e.internalConnections;e.externalConnections,r=yield(0,et.km)(t,o),yn.V.logUpdate(i)}else console.log("recursive search error ",a.status),(0,u.ey)(i,"GetCompositionConnectionsBetweenTwoConcepts",a.status),(0,u.ry)(a)}catch(e){e instanceof Error?console.log("recursive search error message: ",e.message):console.log("recursive search unexpected error: ",e),(0,u.ey)(i,"GetCompositionConnectionsBetweenTwoConcepts",e),(0,u.Mb)(e,l.B.RecursiveSearchUrl())}return r}))}function it(){var e=arguments;return tt(this,arguments,void 0,(function*(t=0,o=[],n=""){const i=yn.V.logfunction("RecursiveSearchApiRaw",e);try{if(ni){i.serviceWorker=!0;try{const e=yield hi("RecursiveSearchApiRaw",{composition:t,listLinkers:o,textSearch:n});return yn.V.logUpdate(i),e.data}catch(e){console.error("RecursiveSearchApiRaw sw error: ",e),(0,u.ey)(i,"RecursiveSearchApiRaw",e),gi(e)}}let e=new Ke;e.composition=t,e.listLinkers=o,e.textSearch=n;let r=JSON.stringify(e),c=(0,d.Xr)();const s=yield fetch(l.B.RecursiveSearchUrl(),{method:"POST",headers:c,body:r});if(s.ok){const e=yield s.json();return e.compositionIds,e.internalConnections,e.externalConnections,yn.V.logUpdate(i),e}return console.log("recursive search error ",s.status),(0,u.ey)(i,"RecursiveSearchApiRaw",s.status),(0,u.ry)(s),yn.V.logUpdate(i),[]}catch(e){e instanceof Error?console.log("recursive search error message: ",e.message):console.log("recursive search unexpected error: ",e),(0,u.ey)(i,"RecursiveSearchApiRaw",e),(0,u.Mb)(e,l.B.RecursiveSearchUrl())}}))}function rt(){var e=arguments;return tt(this,arguments,void 0,(function*(t=0,o=[],n=""){const i=yn.V.logfunction("RecursiveSearchApiRawFullLinker",e);try{if(ni){i.serviceWorker=!0;try{const e=yield hi("RecursiveSearchApiRawFullLinker",{composition:t,fullLinkers:o,textSearch:n});return yn.V.logUpdate(i),e.data}catch(e){console.error("RecursiveSearchApiRawFullLinker sw error: ",e),(0,u.ey)(i,"RecursiveSearchApiRawFullLinker",e),gi(e)}}let e=new Ke;e.composition=t,e.fullLinkers=o,e.textSearch=n;let r=JSON.stringify(e),c=(0,d.Xr)();const s=yield fetch(l.B.RecursiveSearchUrl(),{method:"POST",headers:c,body:r});if(s.ok){const e=yield s.json();return e.compositionIds,e.internalConnections,e.externalConnections,yn.V.logUpdate(i),e}return console.log("recursive search error ",s.status),(0,u.ey)(i,"RecursiveSearchApiRawFullLinker",s.status),(0,u.ry)(s),yn.V.logUpdate(i),[]}catch(e){e instanceof Error?console.log("recursive search error message: ",e.message):console.log("recursive search unexpected error: ",e),(0,u.Mb)(e,l.B.RecursiveSearchUrl()),(0,u.ey)(i,"RecursiveSearchApiRawFullLinker",e)}}))}function ct(){var e=arguments;return tt(this,arguments,void 0,(function*(t=0,o=[],n=""){const i=yn.V.logfunction("RecursiveSearchApiRawFullLinker",e);try{if(ni)try{i.serviceWorker=!0;const e=yield hi("RecursiveSearchApiNewRawFullLinker",{composition:t,fullLinkers:o,textSearch:n});return yn.V.logUpdate(i),e.data}catch(e){console.error("RecursiveSearchApiNewRawFullLinker sw error: ",e),(0,u.ey)(i,"RecursiveSearchApiNewRawFullLinker",e),gi(e)}let e=new Ke;e.composition=t,e.fullLinkers=o,e.textSearch=n;let r=JSON.stringify(e),c=(0,d.Xr)();const s=yield fetch(l.B.RecursiveSearchUrl(),{method:"POST",headers:c,body:r});if(s.ok){const e=yield s.json();return e.compositionIds,e.internalConnections,e.externalConnections,yn.V.logUpdate(i),e}return console.log("recursive search error ",s.status),(0,u.ey)(i,"RecursiveSearchApiNewRawFullLinker",s.status),(0,u.ry)(s),yn.V.logUpdate(i),[]}catch(e){e instanceof Error?console.log("recursive search error message: ",e.message):console.log("recursive search unexpected error: ",e),(0,u.Mb)(e,l.B.RecursiveSearchUrl()),(0,u.ey)(i,"RecursiveSearchApiNewRawFullLinker",e)}}))}var st=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};const at=["image/jpeg","image/jpg","image/png","image/webp"],lt=["application/msword","application/vnd.ms-excel","application/vnd.ms-powerpoint","text/plain","application/pdf"];function dt(e,t){return st(this,void 0,void 0,(function*(){const o=yn.V.logfunction("uploadAttachment");try{console.log("File Type",e.type);const n=new FormData;let i;if(lt.includes(e.type))n.append("file",e,e.name),i=yield ht(n,t);else{if(!at.includes(e.type))return{message:"Invalid File Format",success:!1};n.append("image",e,e.name),i=yield ut(n,t)}return(null==i?void 0:i.data)?(yn.V.logUpdate(o),{message:"Upload Success",success:!0,url:i.data}):{message:"File Upload Failed",success:!1}}catch(e){throw console.error(e),(0,u.ey)(o,"uploadAttachment",e),e}}))}function ut(e){return st(this,arguments,void 0,(function*(e,t=""){const o=yn.V.logfunction("uploadImage");try{const n=yield fetch(l.B.uploadImageUrl(),{method:"POST",body:e,headers:{Authorization:`Bearer ${t}`}});if(!n.ok){const e=n.headers.get("content-type");e&&e.includes("text/plain")&&console.info(null==n?void 0:n.text());const t=yield null==n?void 0:n.text();return console.error(`${n.status} ${t}`),yn.V.logUpdate(o),null}return yield n.json()}catch(e){return console.error(e),(0,u.ey)(o,"uploadImage",e),null}}))}function ht(e){return st(this,arguments,void 0,(function*(e,t=""){const o=yn.V.logfunction("uploadFile");try{const n=yield fetch(l.B.uploadFileUrl(),{method:"POST",body:e,headers:{Authorization:`Bearer ${t}`}});if(!n.ok){const e=n.headers.get("content-type");e&&e.includes("text/plain")&&console.info(n.text());const t=yield n.text();return console.error(`${n.status} ${t}`),null}return yn.V.logUpdate(o),yield n.json()}catch(e){return console.error(e),(0,u.ey)(o,"uploadFile",e),null}}))}var pt=o(1239),ft=o(7467),yt=o(3278),vt=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function gt(e,t){var o=arguments;return vt(this,void 0,void 0,(function*(){const n=yn.V.logfunction("LoginToBackend",o);try{let o={email:e,password:t},i=new Headers;i.append("Content-Type","application/json");let r=JSON.stringify(o);const c=yield fetch(l.B.LoginUrl(),{method:"POST",headers:i,body:r}),s=yield c.json();if(c.ok)return yt.b.BearerAccessToken=s.data.token,yn.V.logUpdate(n),s;console.log("Login tsccs error message: ",c.status),(0,u.ER)(c,s)}catch(e){e instanceof Error?console.log("Login tsccs error message: ",e.message):console.log(" Login tsccs unexpected error: ",e),(0,u.Mb)(e,l.B.LoginUrl()),(0,u.ey)(n,"LoginToBackend",e)}}))}var mt=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function Ct(e){return mt(this,void 0,void 0,(function*(){const t=yield function(){return mt(this,arguments,void 0,(function*(e="",t={}){let o={message:"success",status:!1,statusCode:200,data:"cannot signup"};try{const n=yield fetch(e,{method:"POST",mode:"cors",cache:"no-cache",credentials:"same-origin",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify(t)}),i=yield n.json();return n.ok?o={message:"success",status:!0,statusCode:200,data:i}:(0,u.ER)(n,i),o}catch(t){console.log("Signup Error: ",t),(0,u.Mb)(t,e)}}))}(l.B.SignupUrl(),e);return t}))}function Tt(e){return mt(this,void 0,void 0,(function*(){const t=l.B.NODE_URL,o=yield fetch(`${t}/api/v1/entity/signup`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(o.ok)return o.json();if(404===o.status)throw new Error("404, Not found");if(500===o.status)throw new Error("500, internal server error");throw new Error(o.status)}))}var wt=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function It(e){return wt(this,void 0,void 0,(function*(){const t=JSON.stringify({email:e.email,password:e.password});let o={message:"success",status:!1,statusCode:200,data:""};const n=new Headers;n.append("Content-Type","application/json");const i=l.B.LoginUrl();try{const e=yield fetch(i,{method:"POST",headers:n,body:t,redirect:"follow"}),r=yield e.json();return e.ok?o={message:"success",status:!0,statusCode:200,data:null==r?void 0:r.data}:(0,u.ER)(e,r),o}catch(e){console.log("Sign in api error",e),(0,u.Mb)(e,i)}}))}var kt=o(9934),Nt=o(4485);function At(e=[],t){Array.isArray(e)&&e.splice(e.findIndex((function(e){return e.id===t.id})),1)}function Lt(e=[],t){Array.isArray(e)&&e.splice(e.findIndex((function(e){return e.id===t.id})),1)}class St{constructor(e,t,o,n){this.expiryTime=new Date(Date.now()+6e5),this.height=1,this.key=e,this.value=t,this.leftNode=o,this.rightNode=n}isValid(){const e=new Date(Date.now());return!(this.expiryTime<e&&(xt.removeNodeFromTree(this.key),1))}saveToCache(e){this.value.cached=e}addNode(e,t,o){if(null==t)return e;const n=t.leftNode,i=t.rightNode;if(t.key>e.key)t.leftNode=this.addNode(e,n,o);else{if(!(t.key<e.key))return this.isValid(),e;t.rightNode=this.addNode(e,i,o)}t.height=1+Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode));const r=this.getBalanceFactor(t);if(r>1&&t.leftNode){if(e.key<t.leftNode.key)return this.rightRotate(t);if(e.key>t.leftNode.key)return t.leftNode=this.leftRotate(t.leftNode),this.rightRotate(t)}if(r<-1&&t.rightNode){if(e.key>t.rightNode.key)return this.leftRotate(t);if(e.key<t.rightNode.key)return t.rightNode=this.rightRotate(t.rightNode),this.leftRotate(t)}return this.isValid(),t}rightRotate(e){if(e){const t=e.leftNode;if(t){const o=t.rightNode;return e.leftNode=o,t.rightNode=e,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode))+1,t}}return e}leftRotate(e){if(e){const t=e.rightNode;if(t){const o=t.leftNode;return t.leftNode=e,e.rightNode=o,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(e.rightNode))+1,t}}return e}getHeight(e){return e?e.height:0}getBalanceFactor(e){return null==e?0:this.getHeight(e.leftNode)-this.getHeight(e.rightNode)}getFromNode(e,t){return t?e==t.key&&t.isValid()?t:e<t.key?this.getFromNode(e,t.leftNode):e>t.key?this.getFromNode(e,t.rightNode):t:t}removeNode(e,t){if(null==e)return e;if(e.key>t)return e.leftNode=this.removeNode(e.leftNode,t),e;if(e.key<t)return e.rightNode=this.removeNode(e.rightNode,t),e;if(null==e.leftNode){const t=e.rightNode;return e=null,t}if(null==e.rightNode){const t=e.leftNode;return e=null,t}{const t=this.inOrderSuccessor(e.rightNode);return e.value=t.value,e.key=t.key,e.rightNode=this.removeNode(e.rightNode,t.key),e}}countNodeBelow(e){return null==e?0:1+this.countNodeBelow(e.leftNode)+this.countNodeBelow(e.rightNode)}inOrderSuccessor(e){for(;null!=e.leftNode;)e=e.leftNode;return e}}var Gt=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class xt{static addNodeToTree(e){if(null==this.root)return this.root=e,this.root;this.root=this.root.addNode(e,this.root,this.root.height)}static addCompositionToTree(e){const t=new St(e.id,e,null,null);this.addNodeToTree(t)}static getNodeFromTree(e){return Gt(this,void 0,void 0,(function*(){return this.root?this.root.getFromNode(e,this.root):null}))}static removeNodeFromTree(e){return Gt(this,void 0,void 0,(function*(){this.root&&(this.root=this.root.removeNode(this.root,e))}))}static countNumberOfNodes(){return this.root?this.root.countNodeBelow(this.root):0}}xt.root=null;var Bt=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function bt(e,t,o,n){return Bt(this,arguments,void 0,(function*(e,t,o,n,i=[]){var r,c;let s={};const l=[];if(0==e)return"";let d=Rt(o,e);if(null!=d&&0!=d.id||null==e||null==e||(d=yield(0,z.A)(e)),0!=d.id&&null==d.type){const e=d.typeId;let t=Rt(o,e);d.type=t,null==t&&null!=e&&null!=e&&(t=yield(0,z.A)(e),d.type=t)}if(!n.includes(e))return null==d?void 0:d.characterValue;if(i.includes(e))return"";i.push(e);for(let d=0;d<t.length;d++)if(t[d].ofTheConceptId==e){const u=t[d].toTheConceptId;if(n.includes(e)){let e=Rt(o,u);if(null!=e&&0!=e.id||null==u||null==u||(e=yield(0,z.A)(u)),0!=e.id&&null==(null==e?void 0:e.type)){const t=e.typeId;let o=yield a.I.GetConcept(t);e.type=o,null==o&&null!=t&&null!=t&&(o=yield(0,z.A)(t),e.type=o)}const d="the_",h=(null!==(c=null===(r=null==e?void 0:e.type)||void 0===r?void 0:r.characterValue)&&void 0!==c?c:"").replace(d,"");if(isNaN(Number(h))){if(h){const e=yield bt(u,t,o,n,i);s[h]=e}}else{const e=yield bt(u,t,o,n,i);l[h]=e,s=l}}}return s}))}function Rt(e,t){let o=(0,M.o)();for(let n=0;n<e.length;n++)if(t==e[n].id)return o=e[n],o;return o}class Dt{constructor(){this.id=0,this.mainConcept=(0,M.o)(),this.connections=[],this.concepts=[],this.subcompositions=[],this.cached={}}updateCache(){return e=this,t=void 0,n=function*(){if(0==this.mainConcept.id)for(let e=0;e<this.concepts.length;e++)this.concepts[e].id==this.id&&(this.mainConcept=this.concepts[e]);this.cached=yield bt(this.id,this.connections,this.concepts,this.subcompositions,[])},new((o=void 0)||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}));var e,t,o,n}UpdateAcrossDistributedSystem(){var e,t;try{0!=this.id&&(t=null===(e=this.id)||void 0===e?void 0:e.toString(),l.B.MQTT_CONNECTION&&l.B.MQTT_CONNECTION.publish("compositionUpdate",t))}catch(e){console.log("Error while publishing message",e)}}isUpdating(){this.UpdateAcrossDistributedSystem()}GetDataCache(){var e,t,o;const n={};n[null!==(o=null===(t=null===(e=this.mainConcept)||void 0===e?void 0:e.type)||void 0===t?void 0:t.characterValue)&&void 0!==o?o:""]=this.cached;const i={};return i.data=n,i.id=this.id,i}}var Ut=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function Et(e){return Ut(this,arguments,void 0,(function*(e,t=null,o=null,n=null,i=null,r=null,c=null,s=null){const a=null!=i?i:999,l=null!=r?r:4,d=null!=c?c:999;let u=null!=n?n:0,h=(0,M.o)();null==s&&(s=new Dt);for(const n in e)if("object"==typeof e[n]||Array.isArray(e[n])){const p=yield(0,q.A)(n,"",!0,a,l,d);if(null==t&&null==o){let t=u;h=p,t=p.id,u=p.id,s.concepts.push(p),s.id=p.id,yield Et(e[n],p.id,p.userId,t,i,r,c,s)}else{const a=null!=t?t:999,l=null!=o?o:999,d=u;h=p,s.concepts.push(p);const f=yield(0,ie.q)(a,l,p.id,d);s.connections.push(f),yield Et(e[n],p.id,p.userId,d,i,r,c,s)}null!=e[n]&&null!=e[n]&&s.subcompositions.push(p.id)}else{const i=null!=t?t:999,r=null!=o?o:999,c=u,h=yield(0,q.A)(n,e[n],!1,a,l,d);s.concepts.push(h);const p=yield(0,ie.q)(i,r,h.id,c);s.connections.push(p)}return h}))}var Ft=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function _t(e){return Ft(this,void 0,void 0,(function*(){const t=yn.V.logfunction("UpdateComposition");if(ni){t.serviceWorker=!0;try{const o=yield hi("UpdateComposition",{patcherStructure:e});return yn.V.logUpdate(t),o.data}catch(e){console.error("UpdateComposition sw error: ",e),(0,u.ey)(t,"UpdateComposition",e),gi(e)}}const o=e.userId,n=e.sessionId,i=e.accessId;let r=[];const c=[];let s=(0,M.o)(),a=(0,M.o)();const l=[];let d=e.compositionId;const h=e.ofTheCompositionId;let p=[];if(d<0){let e=yield(0,z.A)(d,o);if(!(e.id>0))return null;d=e.id}r=yield(0,U.s)(d);const f=[],y=new Dt,v=[];y.id=d,y.isUpdating();let g=[];for(let e=0;e<r.length;e++)(0,kt.A)(v,r[e].ofTheConceptId),(0,kt.A)(f,r[e].ofTheConceptId),(0,kt.A)(f,r[e].toTheConceptId),g.push(r[e].ofTheConceptId);y.subcompositions=v,y.connections=r;for(let e=0;e<f.length;e++){const t=yield(0,z.A)(f[e]);d==f[e]&&(s=t),h==f[e]&&(a=t),c.push(t)}const m=e.patchObject;for(const e in m){let t=(0,M.o)();const r=m[e];let d=s;if(a.id>0&&(d=a),Array.isArray(r)||"object"==typeof r){t=yield(0,q.A)(e,"",!0,s.userId,4,999),y.subcompositions.push(t.id);const o=(0,Nt.vo)(c,t);for(let e=0;e<o.length;e++)if(o[e].id>0){const t=(0,Nt.wS)(y.connections,o[e].id);p=p.concat(t),l.push(o[e])}yield Et(m[e],t.id,t.userId,s.id,s.userId,4,999,y)}else{t=yield(0,q.A)(e,r,!1,o,i,n);const s=(0,Nt.vo)(c,t);for(let e=0;e<s.length;e++)if(s[e].id>0){const t=(0,Nt.wS)(y.connections,s[e].id);p=p.concat(t),l.push(s[e])}}const u=(0,ie.q)(d.id,d.userId,t.id,s.id);c.push(t),y.connections.push(u)}for(let e=0;e<p.length;e++)Lt(y.connections,p[e]),(0,J.m)(p[e].id);for(let e=0;e<l.length;e++)At(c,l[e]);y.concepts=y.concepts.concat(c),y.mainConcept=s,y.id=s.id,yield y.updateCache(),xt.addCompositionToTree(y),V.Y.SyncDataOnline();let C=y.GetDataCache();return yn.V.logUpdate(t),C}))}var Wt=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function Ot(e,t,o,n){return Wt(this,arguments,void 0,(function*(e,t,o,n,i=10,r=1){var c=(0,d.ab)("application/x-www-form-urlencoded",n),s=new URLSearchParams;s.append("type",e),s.append("search",t),s.append("composition",o),s.append("inpage",i.toString()),s.append("page",r.toString());const a=l.B.SearchCompositionsUrl()+"?"+s.toString();try{const e=yield fetch(a,{method:"GET",headers:c});return e.ok?yield e.json():((0,u.ry)(e),[])}catch(e){console.log("This is the searching error",e),(0,u.Mb)(e,a)}}))}var Vt=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function Mt(e){return Vt(this,arguments,void 0,(function*(e,t=""){var o=(0,d.ab)("application/json",t);const n=l.B.SearchLinkMultipleAll(),i=JSON.stringify(e);try{const e=yield fetch(n,{method:"POST",headers:o,body:i});return e.ok?yield e.json():(console.log("This is the searching error",e.status),(0,u.ry)(e),[])}catch(e){console.log("This is the searching error",e),(0,u.Mb)(e,n)}}))}var Pt=o(7139),jt=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function Ht(e){return jt(this,arguments,void 0,(function*(e,t=[]){var o,n;let i=[];const r=[];let c={},s={};const l=yield xt.getNodeFromTree(e),d=[];let u=yield a.I.GetConcept(e);if(0==u.id&&null!=e&&null!=e&&(u=yield(0,Pt.r)(e)),null==l){let a=[];a=t.length>0?$t(e,t):yield(0,U.s)(e),i=a;for(let e=0;e<i.length;e++)d.includes(i[e].ofTheConceptId)||(d.push(i[e].ofTheConceptId),r.push(i[e].ofTheConceptId)),r.includes(i[e].toTheConceptId)||r.push(i[e].toTheConceptId);qt(u,i,r,d);let l=[];s=yield(0,v.zN)(e,i,d,l),c[null!==(n=null===(o=null==u?void 0:u.type)||void 0===o?void 0:o.characterValue)&&void 0!==n?n:""]=s}else s=l.value.GetDataCache(),c=s;return 0==u.id?"":c}))}function $t(e,t){const o=[];for(let n=0;n<t.length;n++)t[n].typeId==e&&o.push(t[n]);return o}function Jt(e){return jt(this,arguments,void 0,(function*(e,t=[]){var o,n;let i={},r=[];const c=[];let s;const l={},d=yield xt.getNodeFromTree(e),u=[];let h=yield a.I.GetConcept(e);if(0==h.id&&null!=e&&null!=e&&(h=yield(0,Pt.r)(e)),null==d){let a=[];a=t.length>0?$t(e,t):yield(0,U.s)(e),r=a;for(let e=0;e<r.length;e++)u.includes(r[e].ofTheConceptId)||(u.push(r[e].ofTheConceptId),c.push(r[e].ofTheConceptId)),c.includes(r[e].toTheConceptId)||c.push(r[e].toTheConceptId);qt(h,r,c,u),s=yield(0,v.zN)(e,r,u),l[null!==(n=null===(o=null==h?void 0:h.type)||void 0===o?void 0:o.characterValue)&&void 0!==n?n:""]=s,i.created_at=h.entryTimeStamp,i.data=l,i.id=e}else s=d.value.GetDataCache(),i=s;return 0==h.id?"":i}))}function zt(e,t){return jt(this,void 0,void 0,(function*(){let o=[];const n=[];o=yield(0,ft.j)(t);for(let t=0;t<e.length;t++){const i=yield Jt(e[t],o);i&&n.push(i)}return n}))}function qt(e,t,o,n){return jt(this,void 0,void 0,(function*(){const i=new Dt,r=yield function(e){return jt(this,void 0,void 0,(function*(){let t=[];const o=[];for(let n=0;n<(null==e?void 0:e.length);n++){const i=yield a.I.GetConcept(e[n]);0==i.id?o.push(e[n]):t.push(i)}return 0==(null==o?void 0:o.length)||(t=yield(0,pt.I)(o)),t}))}(o);i.connections=t,i.concepts=r,i.id=e.id,i.subcompositions=n,i.mainConcept=e;const c=yield bt(e.id,t,r,n,[]);i.cached=c,xt.addCompositionToTree(i)}))}var Qt=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function Xt(e){return Qt(this,void 0,void 0,(function*(){try{var t=(0,d.Xr)();const o=JSON.stringify(e),n=yield fetch(l.B.CreateSessionId(),{method:"POST",headers:t,body:o});return n.ok?n.json():(console.log("Creating session failed",yield n.json()),(0,u.ry)(n),null)}catch(e){console.log("Creating session failed",e),(0,u.Mb)(e,l.B.CreateSessionId())}}))}var Yt=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function Zt(e,t){return Yt(this,void 0,void 0,(function*(){try{var o=(0,d.Xr)("application/x-www-form-urlencoded");const n=new URLSearchParams;n.append("sessionId",e.toString()),n.append("url",t);const i=yield fetch(l.B.CreateSessionVisitUrl(),{method:"POST",headers:o,body:n});return i.ok?i.json():(console.log("Creating session url failed",yield i.json()),(0,u.ry)(i),null)}catch(e){console.log("Creating session url failed",e),(0,u.Mb)(e,l.B.CreateSessionVisitUrl())}}))}var Kt=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function eo(e,t){var o=arguments;return Kt(this,arguments,void 0,(function*(e,t,n=10,i=1){const r=yn.V.logfunction("GetRelation",o);if(ni){r.serviceWorker=!0;try{const o=yield hi("GetRelation",{id:e,relation:t,inpage:n,page:i});return yn.V.logUpdate(r),o.data}catch(e){console.error("GetRelation error sw: ",e),(0,u.ey)(r,"GetRelation",e),gi(e)}}let c=[],s=yield(0,z.A)(e),a=yield Ae(t);if(a.id>0){let e=yield W(a.id,s.id,s.userId,n,i),t=[];for(let o=0;o<e.length;o++)t.push(e[o].toTheConceptId);yield(0,f.Y)(t);for(let t=0;t<e.length;t++){let o=e[t].toTheConceptId,n=yield(0,z.A)(o),i=yield(0,v.Ez)(n.id);c.push(i)}}return yn.V.logUpdate(r),c}))}function to(e,t){var o=arguments;return Kt(this,arguments,void 0,(function*(e,t,n=10,i=1){const r=yn.V.logfunction("GetRelationRaw",o);if(ni){r.serviceWorker=!0;try{const o=yield hi("GetRelationRaw",{id:e,relation:t,inpage:n,page:i});return yn.V.logUpdate(r),o.data}catch(e){console.error("GetRelationRaw error sw: ",e),(0,u.ey)(r,"GetRelationRaw",e),gi(e)}}let c=[],s=yield(0,z.A)(e),a=yield Ae(t);if(a.id>0){let e=yield W(a.id,s.id,s.userId,n,i),t=[];for(let o=0;o<e.length;o++)t.push(e[o].toTheConceptId);for(let t=0;t<e.length;t++){let o=e[t].toTheConceptId,n=yield(0,z.A)(o);c.push(n)}}return yn.V.logUpdate(r),c}))}var oo=o(6416),no=o(4711);class io{constructor(e,t,o,n){this.value=[],this.height=1,this.key=e,this.value.push(t),this.leftNode=o,this.rightNode=n}addNode(e,t,o){if(null==t)return e;var n=t.leftNode,i=t.rightNode;if(t.key>e.key)t.leftNode=this.addNode(e,n,o);else{if(!(t.key<e.key))return t.value.push(...e.value),t;t.rightNode=this.addNode(e,i,o)}t.height=1+Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let r=this.getBalanceFactor(t);if(r>1&&t.leftNode){if(e.key<t.leftNode.key)return this.rightRotate(t);if(e.key>t.leftNode.key)return t.leftNode=this.leftRotate(t.leftNode),this.rightRotate(t)}if(r<-1&&t.rightNode){if(e.key>t.rightNode.key)return this.leftRotate(t);if(e.key<t.rightNode.key)return t.rightNode=this.rightRotate(t.rightNode),this.leftRotate(t)}return t}rightRotate(e){if(e){let t=e.leftNode;if(t){let o=t.rightNode;return e.leftNode=o,t.rightNode=e,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode))+1,t}}return e}leftRotate(e){if(e){let t=e.rightNode;if(t){let o=t.leftNode;return t.leftNode=e,e.rightNode=o,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(e.rightNode))+1,t}}return e}getHeight(e){return e?e.height:0}getBalanceFactor(e){return null==e?0:this.getHeight(e.leftNode)-this.getHeight(e.rightNode)}getFromNode(e,t){return t?e==t.key?t:e<t.key?this.getFromNode(e,t.leftNode):e>t.key?this.getFromNode(e,t.rightNode):t:t}removeNode(e,t){if(null==e)return e;if(e.key>t)return e.leftNode=this.removeNode(e.leftNode,t),e;if(e.key<t)return e.rightNode=this.removeNode(e.rightNode,t),e;if(null==e.leftNode){let t=e.rightNode;return e=null,t}if(null==e.rightNode){let t=e.leftNode;return e=null,t}var o=this.inOrderSuccessor(e.rightNode);return e.value=o.value,e.key=o.key,e.rightNode=this.removeNode(e.rightNode,o.key),e}countNodeBelow(e){return null==e?0:1+this.countNodeBelow(e.leftNode)+this.countNodeBelow(e.rightNode)}inOrderSuccessor(e){for(;null!=e.leftNode;)e=e.leftNode;return e}}var ro=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class co{static compositeKey(e,t){return("0000"+e.toString(16).toUpperCase()).slice(-4)+("0000"+t.toString(16).toUpperCase()).slice(-4)}static addNodeToTree(e){if(null==this.root)return this.root=e,this.root;this.root=this.root.addNode(e,this.root,this.root.height)}static waitForDataToLoad(){return ro(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(r.B.isDataLoaded)return e("done");setTimeout(co.checkFlag,1e3,e)}static addConceptToTree(e,t,o=999){let n=this.compositeKey(t,o);var i=new io(n,e,null,null);this.addNodeToTree(i)}static getNodeFromTree(e,t){return ro(this,void 0,void 0,(function*(){let o=this.compositeKey(e,t);return this.root?this.root.getFromNode(o,this.root):null}))}static removeNodeFromTree(e){return ro(this,arguments,void 0,(function*(e,t=999){if(this.root){let o=this.compositeKey(e,t);this.root=this.root.removeNode(this.root,o)}}))}static countNumberOfNodes(){return this.root?this.root.countNodeBelow(this.root):0}}co.root=null;var so=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function ao(e,t){return so(this,arguments,void 0,(function*(e,t,o=999){let n=yield co.getNodeFromTree(e,o);console.log("this is the ghost id",e,o);let i=(0,oo.u)();if(n)for(let e=0;e<n.value.length;e++){let o=n.value[e];o.ghostId==t&&(i=o)}return i}))}function lo(e,t){return so(this,arguments,void 0,(function*(e,t,o=999){co.addConceptToTree(e,t,o)}))}var uo=o(5312),ho=o(1213),po=o(3729),fo=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))},yo=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function vo(e,t,o){return yo(this,void 0,void 0,(function*(){try{if(ni)try{return(yield hi("GetRelationLocal",{id:e,relation:t,userId:o})).data}catch(e){console.error("GetRelationLocal error sw: ",e),gi(e)}let n=yield(0,m.$I)(t),i=[];0!=n.id&&(i=yield function(e,t){return fo(this,void 0,void 0,(function*(){try{return yield A.G.GetConnectionOfCompositionAndTypeLocal(t,e)}catch(e){throw e}}))}(e,n.id));let r=[];for(let e=0;e<i.length;e++){let t=yield G(i[e].toTheConceptId);r.push(t)}return r}catch(e){throw e}}))}var go=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function mo(e){return go(this,void 0,void 0,(function*(){let t=[];try{var o=(0,d.Xr)();const n=yield fetch(l.B.ViewInternalDataUrl(),{method:"POST",headers:o,body:JSON.stringify(e)});if(n.ok){let e=yield n.json(),o={};for(let n=0;n<e.length;n++){let i=e[n].concepts;t=e[n].connections;let r=e[n].id;(0,pt.r)(i),o[r]=t}return o}return console.log("View Internal Data error",n.status),(0,u.ry)(n),t}catch(e){throw e instanceof Error?console.log(" This is the view internal data error message: ",e.message):console.log(" This is the view internal data unexpected error: ",e),e}}))}var Co=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function To(e){return Co(this,void 0,void 0,(function*(){var t;try{let o=yield mo(e),n=[];for(let i=0;i<e.length;i++){let r=e[i],c=o[r];if(r&&c){let e=[],t={};for(let t=0;t<c.length;t++)e.includes(c[t].ofTheConceptId)||e.push(c[t].ofTheConceptId);let o=yield(0,v.zN)(r,c,e);t.data=o,t.id=r,n.push(t)}else{let e={};e.id=r;let o=yield(0,z.A)(r),i={};o.type&&(i[null===(t=null==o?void 0:o.type)||void 0===t?void 0:t.characterValue]=o.characterValue,e.data=i,n.push(e))}}return n}catch(e){throw e}}))}var wo=o(176),Io=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))},ko=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function No(e){return ko(this,arguments,void 0,(function*(e,t=""){try{let o=yield function(e){return Io(this,arguments,void 0,(function*(e,t=""){var o=(0,d.ab)("application/json",t);let n=l.B.SearchInternalWithAuthenticatedCcsUrl();n=n+"?composition="+e.composition+"&search="+e.search+"&internalComposition="+e.internalComposition+"&type="+e.type+"&inpage="+e.inpage+"&page="+e.page;try{const e=yield fetch(n,{method:"GET",headers:o});return e.ok?yield e.json():(console.log("This is the searching internal error",e.status),(0,u.ry)(e),[])}catch(e){console.log("This is the searching internal error",e),(0,u.Mb)(e,n)}}))}(e,t);return yield To(o)}catch(e){throw e}}))}function Ao(e){return ko(this,arguments,void 0,(function*(e,t=""){try{return yield function(e){return Io(this,void 0,void 0,(function*(){var t=(0,d.ab)("application/json","");let o=l.B.SearchInternalWithCcsUrl();o=o+"?composition="+e.composition+"&search="+e.search+"&internalComposition="+e.internalComposition+"&type="+e.type+"&inpage="+e.inpage+"&page="+e.page;try{const e=yield fetch(o,{method:"GET",headers:t});return e.ok?yield e.json():(console.log("This is the searching internal error",e.status),(0,u.ry)(e),[])}catch(e){console.log("This is the searching internal error",e),(0,u.Mb)(e,o)}}))}(e)}catch(e){throw e}}))}var Lo=o(8095),So=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function Go(e){return So(this,void 0,void 0,(function*(){if(ni)try{return(yield hi("DeleteConceptLocal",{id:e})).data}catch(e){console.error("DeleteConceptLocal error sw: ",e),gi(e)}let t=yield(0,ho.f)(e);y.v.RemoveConcept(t)}))}var xo=o(2803),Bo=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function bo(e,t,o,n){return Bo(this,arguments,void 0,(function*(e,t,o,n,i=!0){var r,c;const s=yn.V.logfunction("GetConnectionBetweenTwoConceptsLinker");if(ni){s.serviceWorker=!0;try{const r=yield hi("GetConnectionBetweenTwoConceptsLinker",{ofTheConcept:e,toTheConcept:t,linker:o,fullLinker:n,forward:i});return yn.V.logUpdate(s),r.data}catch(e){console.error("GetConnectionBetweenTwoConceptsLinker sw error: ",e),(0,u.ey)(s,"GetConnectionBetweenTwoConceptsLinker",e),gi(e)}}let a=(0,M.o)();if(""!=o){let n="";n=i?(null===(r=e.type)||void 0===r?void 0:r.characterValue)+"_s_"+o+"_s":(null===(c=t.type)||void 0===c?void 0:c.characterValue)+"_s_"+o+"_by",a=yield(0,q.A)("connection",n,!1,999)}""!=n&&(a=yield Se(n,999));let l=[];return l=i?yield(0,xo.x)(e.id,t.id,a.id):yield(0,xo.x)(t.id,e.id,a.id),yn.V.logUpdate(s),l}))}function Ro(e,t){return new Promise(((o,n)=>{setTimeout((()=>{o(t)}),e)}))}var Do=o(3130);const Uo=3,Eo=4,Fo=5;var _o=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function Wo(e,t){return _o(this,arguments,void 0,(function*(e,t,o=""){let n=l.B.SearchAllTypeWithLinker(e.auth);var i=(0,d.ab)("application/json",o);n=n+"?search="+e.search+"&type="+e.type+"&inpage="+e.inpage+"&page="+e.page;const r=JSON.stringify(t);try{const e=yield fetch(n,{method:"POST",headers:i,body:r});return e.ok?yield e.json():((0,u.ry)(e),console.log("This is the searching multiple error",e.status),[])}catch(e){console.log("This is the searching SearchWithTypeAndLinker error",e),(0,u.Mb)(e,n)}}))}var Oo=o(4287);class Vo extends Oo.w{constructor(e,t,o=Do.y0){super(),this.searchQuery=[],this.format=Do.y0,this.searchQuery=e,this.format=o}bind(){return e=this,t=void 0,n=function*(){return this.data=yield(0,uo.cf)(this.searchQuery,"",this,this.format),this.mainConcept=this.searchQuery[0].composition,this.listenToEvent(this.mainConcept),console.log("this is the data",this.data),this.data},new((o=void 0)||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}));var e,t,o,n}}function Mo(e,t,o=Do.y0){return new Vo(e,null!=t?t:"",o)}var Po=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class jo extends Oo.w{constructor(e,t=Do.ZJ){super(),this.id=e,this.format=t}bind(){return Po(this,void 0,void 0,(function*(){if(!this.isDataLoaded){let e=yield(0,v.hL)(this.id);this.mainConcept=this.id,this.compositionIds=e.compositionList;let t=e.connectionList;for(let e=0;e<t.length;e++)this.internalConnections.push(t[e].id);this.isDataLoaded=!0,this.listenToEvent(this.mainConcept)}return yield this.build()}))}build(){return Po(this,void 0,void 0,(function*(){let e=[],t=this.internalConnections;for(let o=0;o<t.length;o++)e.push(yield ze.d.GetConnection(t[o]));return this.format==Do.ZJ?(console.log("this is the data for the build layer",e,this.mainConcept,this.internalConnections,this.compositionIds),this.data=yield(0,v.ay)(this.mainConcept,e,this.compositionIds)):this.format==Do.y0?this.data=yield(0,v.$V)(this.mainConcept,e,this.compositionIds):this.format==Do.yv?this.data=yield(0,v.re)(this.mainConcept,e,this.compositionIds):this.data=yield(0,v.ay)(this.mainConcept,e,this.compositionIds),this.data}))}}function Ho(e,t=Do.ZJ){return new jo(e,t)}var $o=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class Jo extends Oo.w{constructor(e,t,o,n,i){super(),this.data=[],this.startPage=0,this.compositionName=e,this.userId=t,this.inpage=o,this.page=n,this.format=i}bind(){return $o(this,void 0,void 0,(function*(){if(!this.isDataLoaded){var e=yield(0,g.A)(this.compositionName);if(e){yield p(this.compositionName,this.userId);let n=yield a.I.GetConceptsByTypeIdAndUser(e.id,this.userId);for(var t=this.inpage*(this.page-1),o=t;o<t+this.inpage;o++)n[o]&&this.compositionIds.push(n[o].id)}yield(0,f.Y)(this.compositionIds),this.isDataLoaded=!0,this.listenToEventType(e.id);for(let e=0;e<this.compositionIds.length;e++)this.listenToEvent(this.compositionIds[e])}return yield this.build()}))}build(){return $o(this,void 0,void 0,(function*(){if(this.data=[],this.format==Do.ZJ){for(let e=this.startPage;e<this.startPage+this.inpage;e++)if(this.compositionIds[e]){let t=yield(0,v.kx)(this.compositionIds[e]);this.data.push(t)}}else if(this.format==Do.y0){for(let e=this.startPage;e<this.startPage+this.inpage;e++)if(this.compositionIds[e]){let t=yield(0,v.RW)(this.compositionIds[e]);this.data.push(t)}}else if(this.format==Do.yv){for(let e=this.startPage;e<this.startPage+this.inpage;e++)if(this.compositionIds[e]){let t=yield(0,v.XI)(this.compositionIds[e]);this.data.push(t)}}else for(let e=this.startPage;e<this.startPage+this.inpage;e++)if(this.compositionIds[e]){let t=yield(0,v.kx)(this.compositionIds[e]);this.data.push(t)}return this.data}))}}function zo(e,t,o,n,i=Do.ZJ){return new Jo(e,t,o,n,i)}var qo=o(7106),Qo=o(5328),Xo=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class Yo extends Oo.w{constructor(e,t,o="",n){super(),this.searchText="",this.connections=[],this.externalConnectionIds=[],this.data=[],this.mainConcept=e,this.searchLinkers=t,this.textSearch=o,n&&(this.format=n)}listenToEvent(e){window.addEventListener(`${e}`,(t=>{if(this.isUpdating)console.log("rejected this");else{this.isUpdating=!0;let t=this;setTimeout((function(){return Xo(this,void 0,void 0,(function*(){let o=yield ze.d.GetConnectionByOfTheConceptAndType(e,e);for(let e=0;e<o.length;e++)yield ze.d.GetConnection(o[e]).then((e=>{e.typeId==t.mainConcept?t.internalConnections.includes(e.id)||t.internalConnections.push(e.id):t.linkers.includes(e.id)||t.linkers.push(e.id),t.conceptIds.includes(e.toTheConceptId)||t.conceptIds.push(e.toTheConceptId),t.compositionIds.includes(e.ofTheConceptId)||t.compositionIds.push(e.ofTheConceptId),t.compositionIds.includes(e.toTheConceptId)||t.compositionIds.push(e.toTheConceptId)}));t.isUpdating=!1,yield t.bind(),t.notify()}))}),200)}}))}bind(){return Xo(this,void 0,void 0,(function*(){if(!this.isDataLoaded){this.isDataLoaded=!0;const e=yield it(this.mainConcept,this.searchLinkers,this.textSearch);this.compositionIds=e.compositionIds||[],this.internalConnections=e.internalConnections||[],this.externalConnectionIds=e.externalConnections||[],this.linkers=this.externalConnectionIds,this.connections=yield(0,ft.j)(this.externalConnectionIds);for(let e=0;e<this.compositionIds.length;e++)this.listenToEvent(this.compositionIds[e]);this.listenToEvent(this.mainConcept)}return yield this.build()}))}build(){return Xo(this,void 0,void 0,(function*(){return this.externalConnectionIds=this.linkers,this.format&&this.format==Do.XZ?this.data={compositionIds:this.compositionIds,internalConnections:this.internalConnections,externalConnections:this.externalConnectionIds}:this.data=yield(0,et.p8)(this.compositionIds,this.internalConnections),this.data}))}}function Zo(e,t,o="",n){return new Yo(e,t,o,n)}var Ko=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class en extends Oo.w{constructor(e,t,o,n=Do.y0){super(),this.searchQuery=[],this.format=Do.y0,this.mainCompositionIds=[],this.searchCharacter="",this.token="",this.searchStructure=e,this.searchQuery=t,this.searchQuery[0].type=e.composition,this.searchCharacter=e.composition,this.format=n,this.token=yt.b.BearerAccessToken}listenToEventType(e){window.addEventListener(`${e}`,(e=>{if(this.isUpdating)console.log("rejected this");else{this.isUpdating=!0;let t=this;setTimeout((function(){return Ko(this,void 0,void 0,(function*(){let o=e;t.mainCompositionIds.includes(null==o?void 0:o.detail)||(t.mainCompositionIds.unshift(null==o?void 0:o.detail),t.conceptIds.push(null==o?void 0:o.detail),t.listenToEvent(null==o?void 0:o.detail),ze.d.GetConnectionsOfConcept(null==o?void 0:o.detail).then((e=>{for(let o=0;o<e.length;o++)t.linkers.push(e[o].id)}))),t.isUpdating=!1,yield t.bind(),t.notify()}))}),200)}}))}bind(){return Ko(this,void 0,void 0,(function*(){if(!this.isDataLoaded){this.isDataLoaded=!0;var e=yield(0,g.A)(this.searchCharacter);let t=yield Wo(this.searchStructure,this.searchQuery,this.token);this.conceptIds=t.compositionIds,this.internalConnections=t.internalConnections,this.linkers=t.linkers,this.reverse=t.reverse,this.mainCompositionIds=t.mainCompositionIds,this.listenToEventType(e.id);for(let e=0;e<this.mainCompositionIds.length;e++)this.listenToEvent(this.mainCompositionIds[e])}return yield this.build()}))}build(){return Ko(this,void 0,void 0,(function*(){return yield(0,pt.r)(this.conceptIds),this.format==Do.y0?this.data=yield(0,qo.yV)(this.linkers,this.conceptIds,this.internalConnections,this.mainCompositionIds,this.reverse):this.data=yield(0,qo._W)(this.linkers,this.conceptIds,this.internalConnections,this.mainCompositionIds,this.reverse),this.data}))}}function tn(e,t,o,n=Do.y0){return new en(e,t,o,n)}var on=o(2615);class nn{constructor(e,t,o,n,i,r,c,s=!1,a,d,u){this.structureType="lconcept",this.isComposition=!1,this.isTemp=!1,this.isSynced=!1,this.applicationId=l.B.getRandomizer(),this.id=e,this.userId=t,this.typeId=o,this.ghostId=e,this.categoryId=n,this.characterValue=r,this.accessId=i,this.type=null,this.isNew=s,this.typeCharacter=c,this.entryTimeStamp=a,this.updatedTimeStamp=d,this.isSynced=!1,this.referentId=u}getType(){console.log(this.typeId)}}class rn{constructor(e,t,o,n,i,r){this.isTemp=!1,this.applicationId=l.B.getRandomizer(),this.type=(0,M.o)(),this.id=e,this.ofTheConceptId=t,this.toTheConceptId=o,this.typeId=n,this.ghostId=e,this.orderId=i,this.typeCharacter="",this.accessId=r,this.typeCharacter="",this.entryTimeStamp=new Date,this.terminationDateTime=new Date,this.localSyncTime=new Date}}class cn{constructor(){this.compositionId=0,this.userId=999,this.sessionId=999,this.accessId=4,this.ofTheCompositionId=0,this.patchObject={}}}class sn{constructor(){this.id="0",this.remote_address="",this.server_port="",this.server_address="",this.server_name="",this.server_software="",this.http_user_agent="",this.self="",this.port="",this.userId="",this.email=""}}var an=o(628);class ln{constructor(){this.type="",this.search="",this.logicoperator="=",this.index=0,this.composition=!0,this.name="",this.operateon=""}}class dn{constructor(){this.type="",this.search="",this.composition="",this.internalComposition="",this.userId=999,this.inpage=10,this.page=1,this.auth=!0}}var un=o(7887),hn=o(3075),pn=o(7869),fn=o(9635),yn=o(9700);class vn{static initialize(){try{console.warn("Initialized Application Monitoring for tracking errors..."),this.initGlobalErrorHandlers(),this.logCatchError(),this.logErrorEvent(),this.logUnhandledError(),this.logUserInteractions(),this.logNetworkRequests(),this.logRouteChanges(),this.logPerformanceMetrics(),this.logWebSocketEvents()}catch(e){console.error("Error during Application Monitoring initialization:",e)}}static initGlobalErrorHandlers(){try{if(console.log("this is the window",window),void 0===typeof window)return;window.onerror=(e,t,o,n,i)=>{const r={message:e,source:t,lineno:o,colno:n,stack:(null==i?void 0:i.stack)||"undefined"};console.log("This is the window error",r),yn.V.logApplication("ERROR","Runtime Error",r),yn.V.log("ERROR","Runtime Error",r)},window.onunhandledrejection=e=>{yn.V.logApplication("ERROR","Unhandled Promise Rejection",{message:e.reason?e.reason.message:e.reason,stack:e.reason?e.reason.stack:null}),yn.V.log("ERROR","Unhandled Promise Rejection",{message:e.reason?e.reason.message:e.reason,stack:e.reason?e.reason.stack:null})}}catch(e){console.warn("Failed to initialize global error handlers:",e)}}static logCatchError(){try{const e=console.error;console.log("Inside originalConsoleError..."),console.error=function(...t){const o="Console Error",n={arguments:t.map((e=>gn(e)))};yn.V.logApplication("ERROR",o,n),yn.V.log("ERROR",o,n),e.apply(console,t)}}catch(e){console.warn("Failed to override console.error:",e)}}static logErrorEvent(){try{window.addEventListener("error",(e=>{var t;console.log("Inside error event...");const o={error:(null===(t=e.error)||void 0===t?void 0:t.message)||e.message,source:e.filename,line:e.lineno,column:e.colno,stack:e.error?gn(e.error.stack):void 0},n="Unhandled Error";yn.V.logApplication("ERROR",n,o),yn.V.log("ERROR",n,o)}))}catch(e){console.warn("Failed to add error event listener:",e)}}static logUnhandledError(){try{window.addEventListener("unhandledrejection",(e=>{var t,o;console.log("Inside unhandledrejection...");const n={reason:(null===(t=e.reason)||void 0===t?void 0:t.message)||String(e.reason),stack:(null===(o=e.reason)||void 0===o?void 0:o.stack)||"No stack trace available"};yn.V.logApplication("ERROR","Unhandled Promise Rejection",n),yn.V.log("ERROR","Unhandled Promise Rejection",n)}))}catch(e){console.warn("Failed to add unhandled rejection event listener:",e)}}static logUserInteractions(){document.addEventListener("click",(e=>{var t;const o=e.target,n={element:o.tagName,id:o.id,classes:o.className,text:null===(t=o.innerText)||void 0===t?void 0:t.slice(0,50)};yn.V.logApplication("INFO","User Click",n)})),document.addEventListener("input",(e=>{const t=e.target;t.tagName,t.id,t.value})),document.addEventListener("scroll",(()=>{window.scrollY}))}static logNetworkRequests(){try{if(void 0===typeof window)return;const e=null===window||void 0===window?void 0:window.fetch;if(!e)throw new Error("Original fetch is not available.");const t=[l.B.PostLogger(),l.B.PostPrefetchConceptConnections()];window.fetch=(...o)=>{return n=this,i=void 0,c=function*(){const[n,i]=o,r=n instanceof Request?n.url:n instanceof URL?n.toString():n;if(t.includes(r)){console.log("Ignored URLs detected : ",r);let t={url:r,detail:"skip"};return yn.V.logApplication("INFO","Network Request",t),e(...o)}let c={request:{type:"REQUEST",message:"Network Request",method:(null==i?void 0:i.method)||"GET",url:r,body:null==i?void 0:i.body}};try{const t=yield e(...o);return c.response={type:"RESPONSE",message:"Network Response",url:r,status:t.status},t}catch(e){throw c.response={type:"ERROR",message:"Network Request Failed",url:r,error:e instanceof Error?e.message:String(e)},yn.V.logApplication("ERROR","Failed Network Request",c),new Error(`Network request failed for ${r}: ${e.message}`)}},new((r=void 0)||(r=Promise))((function(e,t){function o(e){try{a(c.next(e))}catch(e){t(e)}}function s(e){try{a(c.throw(e))}catch(e){t(e)}}function a(t){var n;t.done?e(t.value):(n=t.value,n instanceof r?n:new r((function(e){e(n)}))).then(o,s)}a((c=c.apply(n,i||[])).next())}));var n,i,r,c}}catch(e){console.warn("Failed to override network requests:",e)}}static logPerformanceMetrics(){void 0!==typeof window&&(null===window||void 0===window||window.addEventListener("load",(()=>{const e=performance.timing;e.loadEventEnd,e.navigationStart,e.domContentLoadedEventEnd,e.navigationStart})))}static logRouteChanges(){const e=history.pushState;history.pushState=function(...t){var o;const n={url:null===(o=t[2])||void 0===o?void 0:o.toString()};return yn.V.logApplication("INFO","Route Change",n),e.apply(this,t)},null===window||void 0===window||window.addEventListener("popstate",(()=>{const e={url:location.href};yn.V.logApplication("INFO","Route Changed (Back/Forward)",e)}))}static logWebSocketEvents(){if(void 0===typeof window)return;const e=WebSocket;window.WebSocket=class extends e{constructor(e,t){super(e,t);const o={url:e.toString()};yn.V.logApplication("INFO","WebSocket Open",o),this.addEventListener("message",(t=>{const o={url:e,data:t.data};yn.V.logApplication("INFO","WebSocket Message",o)})),this.addEventListener("error",(t=>{const o={url:e,error:t instanceof Error?t.message:String(t)};yn.V.logApplication("ERROR","WebSocket Error",o)})),this.addEventListener("close",(()=>{const t={url:e};yn.V.logApplication("INFO","WebSocket Closed",t)}))}}}}function gn(e){try{return JSON.stringify(e,((e,t)=>t&&"object"==typeof t&&t instanceof Error?{message:t.message,stack:t.stack}:t))}catch(e){return"Error while serializing value"}}const mn=(e,t,...o)=>{return n=void 0,i=[e,t,...o],c=function*(e,t,o=!1){try{let n=l.B.sendMail();o&&(n=l.B.sendBulkMail());const i=yield fetch(n,{method:"POST",body:e instanceof FormData?e:JSON.stringify(e),headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}}),r=i.headers.get("content-type");if(!i.ok){const e=yield i.json();return console.info(`${i.status} ${e}`),null}const c=yield i.json();return r&&r.includes("text/plain")?yield i.text():c}catch(e){return console.error(e),null}},new((r=void 0)||(r=Promise))((function(e,t){function o(e){try{a(c.next(e))}catch(e){t(e)}}function s(e){try{a(c.throw(e))}catch(e){t(e)}}function a(t){var n;t.done?e(t.value):(n=t.value,n instanceof r?n:new r((function(e){e(n)}))).then(o,s)}a((c=c.apply(n,i||[])).next())}));var n,i,r,c};class Cn{constructor(){this.subscribers=[]}notify(){console.log("this is the subscribers",this.subscribers),this.subscribers.map((e=>{e(this.data)}))}dataChange(e){return this.subscribers.push(e),e(this.data)}}class Tn extends Cn{constructor(){super(...arguments),this.elementIdentifier=0,this.widgetMounted=!1}getComponent(){return document.getElementById(this.elementIdentifier.toString())}getElementById(e){let t=this.getComponent(),o=document.body;if(t){let n=t.querySelector("#"+e);if(n)return o=n,o}return null}createWidgetWrapperIdentifier(){return this.elementIdentifier=1e4*Math.random(),this.elementIdentifier.toString()}}class wn extends Tn{constructor(){super(...arguments),this.html="",this.css="",this.js="",this.childWidgets=[],this.childWidgetElement=[],this.widgetState={},this.parentElement="",this.element=null}getElement(){return this.element}setTitle(e){document.title=e}getHtml(){return this.html}UpdateChildData(e,t){let o=t;o.data=e,o.render(),o.update()}update(){}setState(e){this.data=e,this.notify(),this.render()}loadChildWidgets(){this.childWidgets.map((e=>{let t=this.getElementById(e.parentElement);t&&(t.innerHTML=""),e.mount(t)}))}render(){this.element&&(this.element.innerHTML=this.getHtml()),console.log("this is the rendering",this),this.after_render(),this.widgetMounted&&this.loadChildWidgets()}getElementByClassName(e){let t=this.getComponent();if(t){let o=null==t?void 0:t.querySelectorAll("."+e);return console.log("this is the element",t,o,e),o}return[]}mount_child(){}mount(e){return t=this,o=void 0,i=function*(){e&&(this.element=document.createElement("div"),this.element.id=this.createWidgetWrapperIdentifier(),this.element.innerHTML=this.getHtml(),e.appendChild(this.element),this.parentElement=e.id,this.before_render(),this.mount_child(),this.widgetMounted=!0)},new((n=void 0)||(n=Promise))((function(e,r){function c(e){try{a(i.next(e))}catch(e){r(e)}}function s(e){try{a(i.throw(e))}catch(e){r(e)}}function a(t){var o;t.done?e(t.value):(o=t.value,o instanceof n?o:new n((function(e){e(o)}))).then(c,s)}a((i=i.apply(t,o||[])).next())}));var t,o,n,i}before_render(){this.render()}after_render(){console.log("this is calling the after render",this)}renderChildWidgets(){function e(t){var o;t&&(null===(o=t.childWidgets)||void 0===o||o.forEach((t=>{e(t)})),t.render())}this.childWidgets.forEach((t=>{e(t)}))}setWidgetState(e,t){this.widgetState[e]=t,function e(t){t&&Array.isArray(t.childWidgets)&&t.childWidgets.forEach((o=>{o.widgetState=Object.assign(Object.assign({},o.widgetState),t.widgetState),e(o)}))}(this),this.renderChildWidgets()}getWidgetState(e,t){return Object.keys.length&&this.widgetState[e]?this.widgetState[e]:t}}var In=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class kn extends wn{constructor(){super(...arguments),this.childComponents=[],this.componentMounted=!1,this.oldHtml=null,this.phonebooks=[],this.childrenData={},this.childWidgets=[],this.typeValueList=[],this.widgetType="the_element_name",this.parentConceptList=[]}getUserId(){return In(this,void 0,void 0,(function*(){const e=yield new Promise((e=>{let t=(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("profile"))||"";t?e(JSON.parse(t)):e()}));return null==e?void 0:e.userId}))}getTypeValueList(){return In(this,arguments,void 0,(function*(e=""){return new Promise((t=>In(this,void 0,void 0,(function*(){const o=null==(e=this.widgetType)?void 0:e.match(/^[a-z0-9]+_[a-z0-9]+/i),n=o?o[0]:"",i=null==e?void 0:e.match(/^([a-z0-9]+).*_([a-z0-9]+)$/i),r=i?`${i[1]}_${i[2]}`:"";let c=[],s=new ln;s.type=r,s.search="1",s.logicoperator=">",s.name="emailfilter",s.operateon="entityEmail",s.composition=!1,c.push(s);let a=new En;a.typeConnection=e,a.name="entityEmail";let l=new En;l.type=n,l.filterLogic="( emailfilter )",l.filters=c,l.name="top",l.inpage=100,l.freeschemaQueries=[a],l.outputFormat=Do.y0,Mn(l,"").subscribe((o=>{if(null==o?void 0:o.length){const i=null==o?void 0:o.map((t=>{var o,i,c,s,a,l,d;const u=null===(s=null===(c=null===(i=null===(o=t.data)||void 0===o?void 0:o[n])||void 0===i?void 0:i[e])||void 0===c?void 0:c.data)||void 0===s?void 0:s[r];return{id:null===(d=null===(l=null===(a=t.data)||void 0===a?void 0:a[n])||void 0===l?void 0:l[e])||void 0===d?void 0:d.id,name:u,text:u}}));return this.typeValueList=i,t(i),i}}))}))))}))}setTitle(e){document.title=e}getHtml(){return this.html}createRandomNumber(){return this.elementIdentifier=1e4*Math.random(),this.elementIdentifier}mount_child(){return In(this,void 0,void 0,(function*(){try{new Function("tsccs",`\n return (async function() {\n ${this.mountChildWidgetsFunction}\n }).call(this);\n `).bind(this)(n)}catch(e){throw console.log("This is the error in the mount child",e),e}}))}setProperty(e){return In(this,void 0,void 0,(function*(){return this.widgetType=e,this.getTypeValueList(this.widgetType).then((()=>{var e,t,o;null===(e=this.element)||void 0===e||e.setAttribute("data-type-value",this.widgetType),null===(o=null===(t=this.element)||void 0===t?void 0:t.parentElement)||void 0===o||o.setAttribute("data-type-value",this.widgetType),this.render()})),this}))}createTypeEditor(e){!function(e,t){if(e){const o=document.querySelector("#widget-properties #widget-type");console.log("This is the input val container",o,t,e);const n=null==o?void 0:o.querySelectorAll("input");null==n||n.forEach((e=>{null==e||e.remove()})),console.log("event.target",e.target);const i=e.target.closest(".added-widget-container"),r=e.target.closest("div");let c="";i?c=null==i?void 0:i.getAttribute("data-type-value"):r&&(c=null==r?void 0:r.getAttribute("data-type-value"));const s=document.createElement("input");s.setAttribute("type","text"),s.setAttribute("name","input-widgetTypeValue"),s.setAttribute("of",t.elementIdentifier.toString()),s.setAttribute("class","form-control"),s.setAttribute("id","widgetType"),t.widgetType?s.value=t.widgetType:s.setAttribute("placeholder","e.g. the_entity");let a=t;s.onchange=function(e){var t,o,n;e.preventDefault(),e.stopPropagation();const i=null===(t=null==e?void 0:e.target)||void 0===t?void 0:t.value;a.widgetType=i,a.before_render(),a.loadChildWidgets(),null===(n=null===(o=a.element)||void 0===o?void 0:o.parentElement)||void 0===n||n.setAttribute("data-type-value",a.widgetType)},null==o||o.appendChild(s)}}(e,this)}mount(e){return In(this,void 0,void 0,(function*(){if(e){this.element=document.createElement("div");let t=this;this.element.onclick=function(e){e.preventDefault(),e.stopPropagation(),t.createTypeEditor(e)},this.element.id=this.createWidgetWrapperIdentifier(),this.element.className="p-2 mftsccs-marking-element",this.element.innerHTML=this.getHtml(),null==e||e.setAttribute("data-type-value",t.widgetType),e.appendChild(this.element),this.parentElement=e.id,0==this.componentMounted||0==this.widgetMounted?(this.before_render(),this.mount_child(),this.widgetMounted=!0,this.componentMounted=!0):this.render(),this.childWidgetElement=this.getElementByClassName("added-widget-container")}}))}before_render(){try{new Function("tsccs",`\n return (async function() {\n ${this.componentDidMountFunction}\n }).call(this);\n `).bind(this)(n)}catch(e){throw console.log("This is the error in the before render",e),e}}after_render(){try{new Function("tsccs",`\n return (async function() {\n ${this.addEventFunction}\n }).call(this);\n `).bind(this)(n)}catch(e){throw console.log("This is the error in the after render",e),e}}CreateConnectionBetweenEntityLocal(e,t,o){return In(this,void 0,void 0,(function*(){var n;const i=e.userId,r=(null===(n=e.type)||void 0===n?void 0:n.characterValue)+"_"+o,c=yield(0,le.$)(r,999,999,i);return yield(0,no.F)(e.id,t.id,c.id,1e3),"connection created"}))}}var Nn=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class An{constructor(){this.actions={concepts:[],connections:[]},this.success=!0,this.transactionId=Math.random().toString().substring(5)}initialize(){return Nn(this,void 0,void 0,(function*(){yield an.H.initializeTransaction(this.transactionId)}))}commitTransaction(){return Nn(this,void 0,void 0,(function*(){if(!this.success)throw Error("Query Transaction Expired");yield an.H.SyncDataOnline(this.transactionId),this.actions={concepts:[],connections:[]},this.success=!1}))}rollbackTransaction(){return Nn(this,void 0,void 0,(function*(){this.success=!1,this.actions={concepts:[],connections:[]},yield an.H.rollbackTransaction(this.transactionId,this.actions)}))}markAction(){return Nn(this,void 0,void 0,(function*(){yield an.H.markTransactionActions(this.transactionId,this.actions)}))}MakeTheInstanceConceptLocal(e,t){return Nn(this,arguments,void 0,(function*(e,t,o=!1,n,i,r=999,c=0){try{if(!this.success)throw Error("Query Transaction Expired");const s=yield(0,K.k)(e,t,o,n,i,r,c,this.actions);return yield this.markAction(),s}catch(e){throw console.log(e),this.success=!1,e}}))}MakeTheTypeConceptLocal(e,t,o,n){return Nn(this,void 0,void 0,(function*(){try{if(!this.success)throw Error("Query Transaction Expired");const i=yield(0,le.$)(e,t,o,n,this.actions);return yield this.markAction(),i}catch(e){throw console.log(e),this.success=!1,e}}))}CreateConnectionBetweenTwoConceptsLocal(e,t,o){return Nn(this,arguments,void 0,(function*(e,t,o,n=!1){try{if(!this.success)throw Error("Query Transaction Expired");const i=yield(0,Lo.h)(e,t,o,n,this.actions);return yield this.markAction(),i}catch(e){throw console.log(e),this.success=!1,e}}))}CreateTheConnectionLocal(e,t,o){return Nn(this,arguments,void 0,(function*(e,t,o,n=1,i="",r=999){try{if(!this.success)throw Error("Query Transaction Expired");const c=yield(0,no.F)(e,t,o,n,i,r,this.actions);return yield this.markAction(),c}catch(e){throw console.log(e),this.success=!1,e}}))}CreateTheCompositionLocal(e){return Nn(this,arguments,void 0,(function*(e,t=null,o=null,n=null,i=null,r=null,c=null,s=!1){try{if(!this.success)throw Error("Query Transaction Expired");const a=yield(0,F.R)(e,t,o,n,i,r,c,s,this.actions);return yield this.markAction(),a}catch(e){throw console.log(e),this.success=!1,e}}))}}const Ln={number:/^\d+(\.\d+)?$/,text:/^[\s\S]*$/,textOnly:/^[A-Za-z\s]+$/,email:/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,document:/\.(pdf|docx?|pptx?|xlsx?)$/i,sound:/\.(mp3|wav|ogg|flac)$/i,image:/\.(jpg|jpeg|png|gif|bmp|svg|webp)$/i,video:/\.(mp4|avi|mov|mkv|flv|webm)$/i,url:/^(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})([/\w .-]*)*\/?$/,date:/^\d{4}-\d{2}-\d{2}$/,time:/^(?:[01]\d|2[0-3]):[0-5]\d$/,password:/^.{6,}$/,ipaddress:/^(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^([0-9a-fA-F]{1,4}:){7}([0-9a-fA-F]{1,4})$/,uuid:/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/};var Sn=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class Gn{constructor(){Gn.cacheInitialized||Gn.initializeAnomalyParameters()}static initializeAnomalyParameters(){return Sn(this,void 0,void 0,(function*(){try{yield Gn.getAnomalyParameters(),Gn.refreshCache(),Gn.cacheInitialized=!0}catch(e){console.error("Error during anomaly parameter initialization:",e)}}))}static getAnomalyParameters(){return Sn(this,void 0,void 0,(function*(){const e=Date.now();if(Gn.anomalyParamsCache&&e-Gn.lastFetchedTime<Gn.cacheExpiryThreshold)return console.log("Returning cached anomaly parameters"),Gn.anomalyParamsCache;try{return yield Gn.fetchAnomalyParameters()}catch(e){throw console.error("Error fetching anomaly parameters:",e),e}}))}static fetchAnomalyParameters(){return Sn(this,void 0,void 0,(function*(){try{const e=yield fetch("https://devai.freeschema.com/v1/get-frontend-anomaly-parameters",{method:"GET",headers:{"Content-Type":"application/json"}});if(!e.ok)throw new Error("Failed to fetch anomaly parameters");const t=yield e.json();return Gn.anomalyParamsCache=t.data,Gn.lastFetchedTime=Date.now(),t.data}catch(e){throw console.error("API Fetch Error:",e),e}}))}static refreshCache(){return Sn(this,void 0,void 0,(function*(){try{Date.now()-Gn.lastFetchedTime>Gn.cacheExpiryThreshold&&(yield Gn.getAnomalyParameters())}catch(e){console.error("Error refreshing anomaly parameters cache:",e)}}))}detectDataType(e){for(const[t,o]of Object.entries(Ln))if(o.test(e))return t;return null}checkConceptAnomaly(e,t){return Sn(this,void 0,void 0,(function*(){const o=[];try{if(!t)return o.push("Null value"),{valid:!1,warnings:o};const n=Gn.anomalyParamsCache;e.startsWith("the_")||(e=`the_${e}`);const i=n[e];if(console.log("Concept Details : ",i),!i)return console.warn(`No concept details found for type: ${e}`),o.push(`No concept details found for type: ${e}`),{valid:!1,warnings:o};const r=t.length,{min_length:c,max_length:s,data_types:a}=i,l=r>=c&&r<=s,d=this.detectDataType(t),u=a.includes(d);return l||o.push(`Length of '${t}' is outside the allowed range (min: ${c}, max: ${s}). Current length: ${r}.`),u||o.push(`Type mismatch for '${t}'. Expected types: ${a.join(", ")}, detected type: ${d}.`),l&&u&&o.push(`Concept ${e} is valid. Length: ${r}, Type: ${d}`),{valid:l&&u,warnings:o}}catch(n){return console.error(`Error checking anomaly for ${e} with value ${t}:`,n),{valid:!1,warnings:o}}}))}static checkAnomalyInBulk(e){return Sn(this,void 0,void 0,(function*(){Gn.cacheInitialized||(yield Gn.initializeAnomalyParameters());try{const t={};for(const[o,n]of Object.entries(e)){const e=n.value,{valid:i,warnings:r}=yield(new Gn).checkConceptAnomaly(o,e);t[o]={valid:i,warnings:r}}return t}catch(e){throw console.error("Bulk Anomaly Check Error:",e),e}}))}static getExportedFunction(){console.log("Main : ",n);const e=Object.keys(n);return console.log("The exported List : ",e),e}static getFunctionaAnomalyParameters(){}}Gn.anomalyParamsCache=null,Gn.cacheInitialized=!1,Gn.lastFetchedTime=0,Gn.cacheExpiryThreshold=6e5;var xn=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class Bn{checkUniqueness(e,t){return xn(this,void 0,void 0,(function*(){const o=yn.V.logfunction("checkUniqueness");e.startsWith("the_")||(e="the_"+e);let n=(yield Se(e,999)).id,i=yield(0,re.A)(t,n);return console.log("This is the concept for validator",i),!(i.id>0||(yn.V.logUpdate(o),0))}))}validateField(e,t,o,n,i,r,c,s,a,l,d,h,p){return xn(this,arguments,void 0,(function*(e,t,o,n,i,r,c,s,a,l,d,h,p,f=!1){var y;const v=yn.V.logfunction("validateField");try{performance.now();const e={};if(!p||null!==n&&""!==n||(e.required="This is required field"),o&&n){let t=Ln[o];t&&""!==n&&!t.test(n)&&(e.dataType=`Invalid value for ${o}`)}if(i&&n){const t="string"==typeof i?new RegExp(i):i;""===n||t.test(n)||(e.pattern="Pattern doesn't match with value")}if(n&&null!==c&&n.length>c&&(e.maxLength=`Length exceeds the maximum length of ${c}`),n&&null!==s&&n.length<s&&(e.minLength=`Length must be at least ${s} characters long`),null!==a&&n&&!isNaN(Number(n))&&Number(n)<a&&(e.minValue=`Value must be greater than or equal to ${a}`),null!==l&&n&&!isNaN(Number(n))&&Number(n)>l&&(e.maxValue=`Value must be less than or equal to ${l}`),h&&t&&d){const t=d.split(",").map((e=>e.trim().toLowerCase())),o=null===(y=h.name.split(".").pop())||void 0===y?void 0:y.toLowerCase();o&&!t.includes(o)&&(e.accept=`File must be a valid file type: ${t.join(", ")}`)}return r&&f&&n&&((yield this.checkUniqueness(r,n))||(e.unique="Value is not unique")),yn.V.logUpdate(v),e}catch(e){throw(0,u.ey)(v,"Validator.validateField",e),e}}))}validateForm(e){return xn(this,void 0,void 0,(function*(){const t=yn.V.logfunction("validateForm");try{performance.now();const o={};for(const t in e){const{value:n,fieldType:i,dataType:r,pattern:c,conceptType:s,maxLength:a=null,minLength:l=null,minValue:d=null,maxValue:u=null,accept:h=null,file:p=null,required:f,isUnique:y}=e[t],v=yield this.validateField(t,i,r,n,c,s,a,l,d,u,h,p,f,y);Object.keys(v).length>0&&(o[t]=v)}return yn.V.logUpdate(t),o}catch(e){throw(0,u.ey)(t,"Validator.validateForm",e),e}}))}validate(e,t,o,n,i,r,c,s,a,l,d,h,p,f=!1){const y=yn.V.logfunction("validate");try{let u={};return this.validateField(e,t,o,n,i,r,c,s,a,l,d,h,p,f).then((e=>{Object.keys(e).length>0?(u.status=!1,u.details=e):u.status=!0})),console.error("Error on validate object"),yn.V.logUpdate(y),u}catch(e){(0,u.ey)(y,"Validator.validate",e)}}}const bn=e=>{var t;const o=document.getElementsByName(e)[0];if(!o)return console.warn(`Element with NAME "${e}" not found.`),{value:null,fieldType:null,dataType:null,pattern:null,conceptType:null,maxLength:null,minLength:null,minValue:null,maxValue:null,accept:null,file:null,required:!1,isUnique:!0};const n=o.hasAttribute("required")||"true"===o.getAttribute("data-required"),i=o.hasAttribute("isUnique")&&"true"===o.getAttribute("isUnique");return{value:o.value,fieldType:o.type,dataType:o.getAttribute("data-type"),pattern:o.getAttribute("data-pattern"),conceptType:o.getAttribute("concept-type"),maxLength:o.getAttribute("data-maxlength")?parseInt(o.getAttribute("data-maxlength")):null,minLength:o.getAttribute("data-minlength")?parseInt(o.getAttribute("data-minlength")):null,minValue:o.getAttribute("data-min")?parseInt(o.getAttribute("data-min")):null,maxValue:o.getAttribute("data-max")?parseInt(o.getAttribute("data-max")):null,accept:o.getAttribute("accept")||null,file:"file"===o.type&&(null===(t=o.files)||void 0===t?void 0:t[0])||null,required:n,isUnique:i}};var Rn=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function Dn(e,t){var o=arguments;return Rn(this,void 0,void 0,(function*(){const n=yn.V.logfunction("DeleteConnectionByType",o);if(ni){n.serviceWorker=!0;try{const o=yield hi("DeleteConnectionByType",{id:e,linker:t});return yn.V.logUpdate(n),o.data}catch(e){console.error("DeleteConnectionByType sw error: ",e),(0,u.ey)(n,"DeleteConnectionByType",e),gi(e)}}let i=yield xe(e);for(let e=0;e<i.length;e++)ze.d.AddConnection(i[e]);let r=yield ze.d.GetConnectionsOfConcept(e),c=yield(0,g.A)(t),s=[];for(let e=0;e<r.length;e++)r[e].typeId==c.id&&s.push(r[e]);for(let e=0;e<s.length;e++)(0,J.m)(s[e].id);yn.V.logUpdate(n)}))}function Un(e,t){return Rn(this,arguments,void 0,(function*(e,t,o=!1){if(ni)try{return(yield hi("GetAllTheConnectionsByTypeAndOfTheConcept",{id:e,linker:t,reverse:o})).data}catch(e){console.error("GetAllTheConnectionsByTypeAndOfTheConcept sw error: ",e),gi(e)}let n=[];if(o){let o=yield be(e),i=yield Se(t,999);for(let e=0;e<o.length;e++)o[e].typeId==i.id&&n.push(o[e])}else{let o=yield xe(e);for(let e=0;e<o.length;e++)ze.d.AddConnection(o[e]);let i=yield ze.d.GetConnectionsOfConcept(e),r=yield(0,g.A)(t);for(let e=0;e<i.length;e++)i[e].typeId==r.id&&n.push(i[e])}return n}))}class En{constructor(){this.type="",this.inpage=10,this.page=1,this.concepts=[],this.conceptIds=[],this.selectors=[],this.freeschemaQueries=[],this.filters=[],this.filterLogic="",this.typeConnection="",this.order="DESC",this.outputFormat=Do.yv,this.name="",this.reverse=!1,this.limit=!1,this.includeInFilter=!1,this.isOldConnectionType=!1}}var Fn=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function _n(e){var t=arguments;return Fn(this,arguments,void 0,(function*(e,o=""){const n=yn.V.logfunction("FreeschemaQueryApi",t);var i=(0,d.ab)("application/json",o);const r=l.B.FreeschemaQueryUrl(),c=JSON.stringify(e);try{const e=yield fetch(r,{method:"POST",headers:i,body:c});return e.ok?yield e.json():((0,u.ry)(e),console.log("This is the freeschema query error",e.status),[])}catch(e){console.log("This is the freeschema query error others",e),(0,u.Mb)(e,r),(0,u.ey)(n,"FreeschemaQueryApi",e)}}))}var Wn=o(5898),On=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class Vn extends Oo.w{constructor(e,t){super(),this.mainCompositionIds=[],this.query=new En,this.countInfoStrings=[],this.order="DESC",this.query=e,this.format=e.outputFormat,this.order=e.order}bind(){return On(this,void 0,void 0,(function*(){if(!this.isDataLoaded){this.isDataLoaded=!0,this.query.outputFormat=Do.BG;let e=yield _n(this.query,"");this.conceptIds=e.conceptIds,this.internalConnections=e.internalConnections,this.linkers=e.linkers,this.reverse=e.reverse,this.mainCompositionIds=e.mainCompositionIds,this.countInfoStrings=e.countinfo}return yield this.build()}))}build(){return On(this,void 0,void 0,(function*(){yn.V.logfunction("build",["schemaquery",this.mainCompositionIds]);let e=(0,Wn.w)(this.countInfoStrings);return this.format==Do.y0?(console.time("format"),this.data=yield(0,qo.e$)(this.linkers,this.conceptIds,this.mainCompositionIds,this.reverse,e,this.order),console.timeEnd("format")):this.format==Do.ZJ?this.data=yield(0,qo.y6)(this.linkers,this.conceptIds,this.mainCompositionIds,this.reverse,e,this.order):(console.time("format"),this.data=yield(0,qo.b6)(this.linkers,this.conceptIds,this.mainCompositionIds,this.reverse,e),console.timeEnd("format")),this.data}))}}function Mn(e,t){return new Vn(e,t)}class Pn{constructor(){this.id=0,this.name="",this.html="",this.css="",this.js="",this.library={css:[],js:[]},this.timestamp="",this.widgetId=0,this.type="",this.clean="",this.after_render="",this.before_render="",this.update="",this.origin=0,this.version=0,this.mount_child="",this.children=[],this.wrapper="0",this.widget=new kn}}var jn=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function Hn(e,t,o){return jn(this,void 0,void 0,(function*(){var n;const i=yn.V.logfunction("CreateConnectionBetweenEntityLocal",[e.id,t.id,o]),r=e.userId,c=(null===(n=e.type)||void 0===n?void 0:n.characterValue)+"_"+o,s=yield(0,le.$)(c,999,999,r);console.log(yield(0,no.F)(e.id,t.id,s.id,1e3)),yn.V.logUpdate(i)}))}var $n=o(4310),Jn=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function zn(e,t,o){return Jn(this,void 0,void 0,(function*(){var n;const i=yield eo(e,"the_page_body");(null===(n=null==i?void 0:i[0])||void 0===n?void 0:n.id)?yield Qn(i[0].id,t,o):t.innerHTML="<h4>Invalid or Page doesn't exist</h4>"}))}function qn(e,t,o){return Jn(this,void 0,void 0,(function*(){var n;const i=yield eo(e,"the_widget_latest");if(0==(null==i?void 0:i.length))yield Qn(e,t,o);else{const e=null===(n=null==i?void 0:i[0])||void 0===n?void 0:n.id;e&&(yield Qn(e,t,o))}}))}function Qn(e,t,o){return Jn(this,void 0,void 0,(function*(){try{const n=yield(0,$n.C)(e);console.log("this is the bulk widget",n);const i=yield Yn(e,[],n);if(!i.name)return void(t.innerHTML="<h4>Invalid or Widget doesn't exist</h4>");const r=t,c=yield Zn(i,r,void 0,o);console.log("this is the tree newWidget",i);const s=document.createElement("style");s.innerHTML=i.css+c.css,r.appendChild(s);const a=document.createElement("script");a.innerHTML=i.js,r.appendChild(a),r.querySelectorAll(".wb-initial-empty").forEach((e=>{e.classList.remove("wb-initial-empty")})),document.querySelectorAll('[onclick="widgetSelected(event)"]').forEach((e=>{e.removeAttribute("onclick")}))}catch(e){console.error("Error Caught Rendering Widget")}}))}function Xn(e){return Jn(this,arguments,void 0,(function*(e,t=[],o=""){const n=yield(0,$n.C)(e);return console.log("this is the bulk widget",n),yield Yn(e,[],n)}))}function Yn(e){return Jn(this,arguments,void 0,(function*(e,t=[],o,n=""){var i,r,c,s,a,l,d,u,h,p,f,y,v,g,m,C,T,w,I,k,N,A,L,S,G,x,B,b,R,D,U,E,F,_,W,O,V,M,P,j,H,$,J,z;try{const q=new Pn,Q=(0,$n.i)(o,e);console.log("this is the output",Q),t.push(e);const X=null===(i=null==Q?void 0:Q.data)||void 0===i?void 0:i.the_widget;q.name=null===(c=null===(r=null==X?void 0:X.the_widget_name)||void 0===r?void 0:r.data)||void 0===c?void 0:c.the_name,q.html=null===(a=null===(s=null==X?void 0:X.the_widget_html)||void 0===s?void 0:s.data)||void 0===a?void 0:a.the_html,q.css=null===(d=null===(l=null==X?void 0:X.the_widget_css)||void 0===l?void 0:l.data)||void 0===d?void 0:d.the_css,q.js=null===(h=null===(u=null==X?void 0:X.the_widget_js)||void 0===u?void 0:u.data)||void 0===h?void 0:h.the_js,q.origin=Number(null===(f=null===(p=null==X?void 0:X.the_widget_origin)||void 0===p?void 0:p.data)||void 0===f?void 0:f.the_origin),q.version=null===(v=null===(y=null==X?void 0:X.the_widget_version)||void 0===y?void 0:y.data)||void 0===v?void 0:v.the_version,q.clean=null===(m=null===(g=null==X?void 0:X.the_widget_clean)||void 0===g?void 0:g.data)||void 0===m?void 0:m.the_clean,q.timestamp=null===(T=null===(C=null==X?void 0:X.the_widget_timestamp)||void 0===C?void 0:C.data)||void 0===T?void 0:T.the_timestamp,q.id=Q.id;const Y=null===(I=null===(w=null==X?void 0:X.the_widget_type)||void 0===w?void 0:w.data)||void 0===I?void 0:I.the_type;q.type="null"==Y||null==Y?"the_element_name":Y,q.after_render=null===(N=null===(k=null==X?void 0:X.the_widget_after_render)||void 0===k?void 0:k.data)||void 0===N?void 0:N.the_after_render,q.before_render=null===(L=null===(A=null==X?void 0:X.the_widget_before_render)||void 0===A?void 0:A.data)||void 0===L?void 0:L.the_before_render,q.update=null===(G=null===(S=null==X?void 0:X.the_widget_update)||void 0===S?void 0:S.data)||void 0===G?void 0:G.the_update,q.widgetId=e,q.mount_child=null===(B=null===(x=null==X?void 0:X.the_widget_mount_child)||void 0===x?void 0:x.data)||void 0===B?void 0:B.the_mount_child;const Z=null==X?void 0:X.the_widget_s_child;if(console.log("widget info",q),null==Z?void 0:Z.length)for(let e=0;e<Z.length;e++){const i=(null===(D=null===(R=null===(b=Z[e])||void 0===b?void 0:b.data.the_child_widget)||void 0===R?void 0:R.the_child_widget_info)||void 0===D?void 0:D.id)||(null===(_=null===(F=null===(E=null===(U=Z[e])||void 0===U?void 0:U.data.the_child_widget)||void 0===E?void 0:E.the_child_widget_parent)||void 0===F?void 0:F.data)||void 0===_?void 0:_.the_parent);console.log("this is the child Widget",i);const r=yield Yn(i,t,o,n);console.log("this is the child Widget",r);const c=null===(P=null===(M=null===(V=null===(O=null===(W=Z[e])||void 0===W?void 0:W.data)||void 0===O?void 0:O.the_child_widget)||void 0===V?void 0:V.the_child_widget_type)||void 0===M?void 0:M.data)||void 0===P?void 0:P.the_type,s=null===(z=null===(J=null===($=null===(H=null===(j=Z[e])||void 0===j?void 0:j.data)||void 0===H?void 0:H.the_child_widget)||void 0===$?void 0:$.the_child_widget_wrapper)||void 0===J?void 0:J.data)||void 0===z?void 0:z.the_wrapper;r.type="null"==c||null==c?"the_element_name":c,r.wrapper=s,q.children.push(r)}return q}catch(e){throw console.error("error",e),e}}))}function Zn(e,t){return Jn(this,arguments,void 0,(function*(e,t,o=!0,n,i){var r,c;const s=new kn;s.html=e.html,s.widgetType=e.type,s.componentDidMountFunction=e.before_render,s.addEventFunction=e.after_render,s.mountChildWidgetsFunction=e.mount_child,s.widgetState=Object.assign({},i),n&&(s.data=n),t.innerHTML="";const a=t;if(a&&(yield s.mount(a),e.widget=s,e.children.length>0&&(null===(r=s.childWidgetElement)||void 0===r?void 0:r.length)>0))for(let t=0;t<(null===(c=e.children)||void 0===c?void 0:c.length);t++){const o=e.children[t];for(let e=0;e<s.childWidgetElement.length;e++){const t=s.childWidgetElement[e];if(o.wrapper===t.id){const e=ei(o);o.html=`<div id="${o.wrapper}">${o.html}</div>`;const n=yield Zn(e,t,!1,s.data,s.widgetState);s.childWidgets.push(n),s.css=s.css+n.css+`#${t.id} { ${o.css} }`,n.dataChange((e=>{var t;console.log("This is the data change in child",e);const o=null===(t=null==e?void 0:e.type)||void 0===t?void 0:t.characterValue;o&&(s.childrenData[o]=e),console.log("new child data",s.childrenData)}))}}}return console.log("newWidget ->",s),yield oi(t,".mftsccs-marking-element"),yield oi(t,".widget_container"),s}))}function Kn(e,t){return Jn(this,arguments,void 0,(function*(e,t,o=!0,n){var i,r;let c=new kn;c.html=e.html,c.widgetState=Object.assign({},n),c.widgetType=e.type,c.componentDidMountFunction=e.before_render,c.addEventFunction=e.after_render,c.mountChildWidgetsFunction=e.mount_child,t.innerHTML="";let s=t;if(s&&(yield c.mount(s),e.widget=c,e.children.length>0&&(null===(i=c.childWidgetElement)||void 0===i?void 0:i.length)>0))for(let t=0;t<(null===(r=e.children)||void 0===r?void 0:r.length);t++){let o=e.children[t];for(let e=0;e<c.childWidgetElement.length;e++){let t=c.childWidgetElement[e];if(o.wrapper===t.id){const e=ei(o),n=yield Kn(e,t,!1,c.widgetState);c.childWidgets.push(n),c.css=c.css+n.css+`#${t.id} { ${o.css} }`,n.dataChange((e=>{var t;console.log("This is the data change in child",e);let o=null===(t=null==e?void 0:e.type)||void 0===t?void 0:t.characterValue;o&&(c.childrenData[o]=e),console.log("new child data",c.childrenData)}))}}}return console.log("newWidget ->",c),c}))}function ei(e){return e.html=e.html.replace(/<[^>]*\bclass=["'][^"']*\bwidget_container\b[^"']*["'][^>]*>/g,(e=>e.replace(/\bwidget_container\b/g,"").trim())),e.html=e.html.replace(/<[^>]*\bdraggable=["'][^"']*\btrue\b[^"']*["'][^>]*>/g,(e=>e.replace(/\btrue\b/g,"false").trim())),e.html=e.html.replace(/<[^>]*\bclass=["'][^"']*\bhover-element\b[^"']*["'][^>]*>/g,(e=>e.replace(/\bhover-element\b/g,"").trim())),e.html=e.html.replace(/<[^>]*\bclass=["'][^"']*\bwb-block\b[^"']*["'][^>]*>/g,(e=>e.replace(/\bwb-block\b/g,"").trim())),e.html=e.html.replace(/<[^>]*onclick="widgetSelected\(event\)"\s*,?\s*ondragover="_dragService\.dragOverWidgetElement\(event\)"\s*,?\s*ondrop="_dragService\.dropWidgetElement\(event\)"\s*,?\s*ondragstart="_dragService\.dragStartWidgetElement\(event\)"\s*,?\s*ondragend="_dragService\.dragEndWidgetElement\(event\)"[^>]*>/g,(e=>e.replace(/onclick="widgetSelected\(event\)"/g,'onclick=""').replace(/ondragover="_dragService\.dragOverWidgetElement\(event\)"/g,'ondragover=""').replace(/ondrop="_dragService\.dropWidgetElement\(event\)"/g,'ondrop=""').replace(/ondragstart="_dragService\.dragStartWidgetElement\(event\)"/g,'ondragstart=""').replace(/ondragend="_dragService\.dragEndWidgetElement\(event\)"/g,'ondragend=""').trim())),e.html=e.html.replace(/<[^>]*\bondragstart=["'][^"']*\b_dragService\.onWidgetDragStart\(event\)\b[^"']*["'][^>]*>/g,(e=>e.replace(/\b_dragService\.onWidgetDragStart\(event\)\b/g,"").trim())),e}function ti(e,t){return Jn(this,void 0,void 0,(function*(){return e.querySelectorAll(t).forEach((e=>{for(;e.firstChild;)e.parentNode.insertBefore(e.firstChild,e);e.remove()})),e}))}function oi(e,t){return Jn(this,void 0,void 0,(function*(){const o=e.querySelectorAll(t);for(const e of o){const o=e.parentElement;if(o){for(;e.firstChild;){const n=yield ti(e.firstChild,t);o.insertBefore(n,e)}o.removeChild(e)}}}))}var ni,ii=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};const ri=Date.now().toString(36)+Math.random().toString(36).substring(2);let ci=[],si=[],ai=!1;function li(e){ai=e}function di(e="",t){yt.b.BearerAccessToken=e,null==typeof document?yt.b.sessionId=t:yt.b.sessionId=parseInt((0,yn.R)("SessionId")),ni&&hi("updateAccessToken",{accessToken:e,session:parseInt((0,yn.R)("SessionId"))})}function ui(){return ii(this,arguments,void 0,(function*(e="",t="",o="",n="",i=!0,c="",s=void 0,a={},d={}){var h;try{l.B.BASE_URL=e,l.B.AI_URL=t,l.B.NODE_URL=n,l.B.BASE_APPLICATION=c,l.B.LOG_SERVER=null!==(h=d.logserver)&&void 0!==h?h:"https://logdev.freeschema.com",console.log("setting the logserver",l.B.LOG_SERVER,d.logserver),di(o);let i=Math.floor(1e8*Math.random());l.B.setRandomizer(i);const p={logApplication:!1,logPackage:!1,accessTracker:!1,isTest:!1};if(l.B.FLAGS=p,l.B.FLAGS=Object.assign(Object.assign({},p),a),function(e){const t=yn.V.logfunction("initializeFlags",arguments);try{return e.logApplication&&(vn.initialize(),yn.V.logApplicationActivationStatus=!0,console.warn("Application log started.")),e.logPackage&&(yn.V.logPackageActivationStatus=!0,console.warn("Package log started.")),e.accessTracker&&(Je.J.activateStatus=!0,console.warn("Access Tracker Activated.")),e.isTest&&(r.B.isDataLoaded=!0,r.B.isCharacterLoaded=!0,r.B.isTypeLoaded=!0,r.B.isLocalDataLoaded=!0,r.B.isLocalTypeLoaded=!0,r.B.isLocalCharacterLoaded=!0,r.B.isConnectionLoaded=!0,r.B.isConnectionTypeLoaded=!0,r.B.isLocalConnectionLoaded=!0),yn.V.logUpdate(t),e}catch(e){throw(0,u.ey)(t,"initializeFlags",e),e}}(l.B.FLAGS),!("serviceWorker"in navigator))return yield fi(),void console.warn("Service Worker not supported in this browser.");if(function(){navigator.serviceWorker.addEventListener("message",(e=>ii(this,void 0,void 0,(function*(){var t,o,n,i;try{if(e.data&&"API_401"===e.data.type){const{requestDetails:n}=e.data,i={method:n.method,headers:new Headers(n.headers),body:n.body},r=yield fetch(n.url,i),c=yield null==r?void 0:r.json();null===(o=null===(t=null===navigator||void 0===navigator?void 0:navigator.serviceWorker)||void 0===t?void 0:t.controller)||void 0===o||o.postMessage({type:"API_RESPONSE",messageId:e.data.messageId,response:new Response(c,{status:r.status,statusText:r.statusText,headers:r.headers})})}}catch(t){console.error("Error during listenPostMessage",t),null===(i=null===(n=null===navigator||void 0===navigator?void 0:navigator.serviceWorker)||void 0===n?void 0:n.controller)||void 0===i||i.postMessage({type:"API_RESPONSE",messageId:e.data.messageId})}}))))}(),function(){fn.x.addEventListener("message",(e=>ii(this,void 0,void 0,(function*(){const{type:t,payload:o}=e.data;if(!t)return;let n={success:!1,data:void 0};pi[t]?yield pi[t](o):console.warn(`Unable to handle "${t}" case in BC service worker`)}))))}(),s&&s.activate&&s.manual)yield new Promise(((e,t)=>{navigator.serviceWorker.ready.then((t=>ii(this,void 0,void 0,(function*(){console.log("registraions ready",t),ni=t.active,yield mi(),e("done")})))).catch((e=>{console.error("Error: Ready service worker",e),t(e)})).finally((()=>console.log("Finally service worker ready done"))),setTimeout((()=>t("Timeout ready")),3e4)}));else if(s&&(null==s?void 0:s.activate))try{console.log("service worker initialiing"),yield function(e){var t=arguments;return ii(this,void 0,void 0,(function*(){const o=yn.V.logfunction("handleRegisterServiceWorker",t);yield new Promise(((t,n)=>{var i,r;let c=!1;navigator.serviceWorker.register(null!==(i=e.pathToSW)&&void 0!==i?i:"./serviceWorker.bundle.js",{scope:null!==(r=e.scope)&&void 0!==r?r:"/"}).then((e=>ii(this,void 0,void 0,(function*(){console.log("Service Worker registered:",e),setInterval((()=>{console.log("message process interrval calling",si),si.length&&vi()}),2e3),console.log("update listen start"),e.onupdatefound=()=>{const o=e.installing;console.log("new worker",o),o&&(o.onstatechange=()=>ii(this,void 0,void 0,(function*(){console.warn("on state change triggered",o.state,navigator.serviceWorker.controller),"installing"===o.state&&(console.log("Service Worker installing"),ni=void 0),"activated"!==o.state&&"redundant"!==o.state||!navigator.serviceWorker.controller||(ni=o,console.log("New Service Worker is active",e),setTimeout((()=>{console.log("Message Processed after some time"),vi()}),5e3),yield mi(),c=!0,vi(),t())})))},e.addEventListener("controllerchange",(()=>ii(this,void 0,void 0,(function*(){console.warn("controller change triggered",navigator.serviceWorker.controller),navigator.serviceWorker.controller&&(ni=navigator.serviceWorker.controller,console.warn("Service worker has been activated; controller change"),yield mi())})))),(e.installing||e.waiting||e.active)&&e.addEventListener("statechange",(e=>ii(this,void 0,void 0,(function*(){var t;"activating"===(null===(t=null==e?void 0:e.target)||void 0===t?void 0:t.state)&&(ni=navigator.serviceWorker.controller,console.warn("Service Worker is activating statechange"),yield mi())})))),e.active?(console.log("active sw"),ni=e.active,yield mi(),vi(),t()):setTimeout((()=>{c||n("Not Completed Initialization")}),1e4)})))).catch((e=>ii(this,void 0,void 0,(function*(){yield fi(),n(e),console.error("Service Worker registration failed:",e),(0,u.ey)(o,"handleRegisterServiceWorker",e)}))))}))}))}(s)}catch(e){yield fi(),console.error("Unable to start service worker",e)}else yield fi(),console.warn("Service Worker not activated");return!0}catch(e){yield fi(),console.warn("Cannot initialize the system",e)}}))}function hi(e,t){return ii(this,arguments,void 0,(function*(e,t,o=0){let n=!1;const i=Math.random().toString(36).substring(2);t.messageId=i,t.TABID=ri;const r=JSON.parse(JSON.stringify(t));let c;return"checkProcess"!=e&&0==o&&(c=setInterval((()=>ii(this,void 0,void 0,(function*(){if(console.log("process took more than one second",i,e,n),!n&&!(yield function(e,t){return ii(this,void 0,void 0,(function*(){var o;try{const n=yield hi("checkProcess",{checkMessageId:e});if(console.log("check interval data res for type ",t,e,n.data),null===(o=null==n?void 0:n.data)||void 0===o?void 0:o.processing)return!0}catch(o){return console.error("error on checing executing process",t,e,o),!1}}))}(i,e))&&(clearInterval(c),!n)){if(console.log("Failed to handle type "+e+" message not found "+i,"retrying: ",0==o,e),0==o&&"checkProcess"!=e)return console.log("retrying ",e,i),yield hi(e,t,o+1);console.log("Failed to handle type "+e+" "+i)}}))),2e3)),new Promise(((o,s)=>{if(navigator.serviceWorker.controller||ni||console.log("will go to queue",navigator.serviceWorker.controller,ni,e),navigator.serviceWorker.controller||ni){const a=r=>{var l,d,h,p,f,y;(null===(l=null==r?void 0:r.data)||void 0===l?void 0:l.messageId)==i&&(n=!0,"checkProcess"!=e&&console.log("received from sw",e,i),clearInterval(c),r.data.success||(401==(null===(d=null==r?void 0:r.data)||void 0===d?void 0:d.status)?s((0,u.ry)(new Response("Unauthorized",{status:401,statusText:null===(h=null==r?void 0:r.data)||void 0===h?void 0:h.statusText}))):500==(null===(p=null==r?void 0:r.data)||void 0===p?void 0:p.status)?s((0,u.Mb)(new Response("Internal Server Error",{status:500,statusText:null===(f=null==r?void 0:r.data)||void 0===f?void 0:f.statusText}))):(console.error("Error in the response from worker:",r),s(`Failed to handle action ${e} ${JSON.stringify(t)}, Response: ${JSON.stringify(r.data)}`))),(null===(y=r.data)||void 0===y?void 0:y.actions)&&(t.actions=JSON.parse(JSON.stringify(r.data.actions))),o(r.data),navigator.serviceWorker.removeEventListener("message",a))};if(navigator.serviceWorker.addEventListener("message",a),navigator.serviceWorker.controller)"checkProcess"!=e&&console.log("sent to sw",e,i),navigator.serviceWorker.controller.postMessage({type:e,payload:r});else if(ni){console.log("sent to sw",e,i),console.warn(`controller not found but serviceWorker is available. messageId: ${i}, type: ${e}`);try{ni.postMessage({type:e,payload:r})}catch(t){console.log("Retrying again on catch service worker",t),ni.postMessage({type:e,payload:r})}}else console.warn(`Service Worker hasn't loaded yet. messageId: ${i}, type: ${e}`),console.info("ready",navigator.serviceWorker.ready),setTimeout((()=>{console.warn(`Re-Trying after certain time. messageId: ${i}, type: ${e}`),ni?(console.info("This is triggered "),null==ni||ni.postMessage({type:e,payload:t})):(console.log("not ready",e),clearInterval(c),s("Service worker not ready"))}),3e4);setTimeout((()=>{clearInterval(c),s(`No response from service worker after timeout: ${e}`),navigator.serviceWorker.removeEventListener("message",a)}),21e4)}else si.push({message:{type:e,payload:r}}),console.log("Message Queued",e,t),console.log(navigator.serviceWorker.controller,ni,e),"init"==e&&(clearInterval(c),o(null))}))}))}const pi={GetLinkListener:e=>ii(void 0,void 0,void 0,(function*(){const t=ci.find((t=>t.listenerId==e.listenerId));return null==t||t.callback(e.data),{success:!0}})),dispatchEvent:e=>ii(void 0,void 0,void 0,(function*(){if(ni){let t=new Event(e.id||"");dispatchEvent(t)}return{success:!0}})),checkInit:e=>ii(void 0,void 0,void 0,(function*(){return console.log("service worker init 0"),navigator.serviceWorker.controller&&(console.log("service worker init 1"),ni=navigator.serviceWorker.controller),yield mi(),{success:!0}}))};function fi(){return ii(this,void 0,void 0,(function*(){yield(0,pn.A)();const e=(new Date).getTime();yield(0,i.A)().then((()=>{let t=(new Date).getTime()-e;console.log("The time taken to prepare concept data is ",t)})).catch((e=>{throw e})),yield(0,hn.Ay)().then((()=>{let t=(new Date).getTime()-e;console.log("The time taken to prepare local concept ",t)})).catch((e=>{throw e})),yield(0,un.p)().then((()=>{r.B.isLocalConnectionLoaded=!0})).catch((e=>{throw e})),yield(0,hn.xd)().catch((e=>{throw console.log("This is the error in populating binary tree"),e})),yield(0,un.a)().then((()=>{r.B.isConnectionLoaded=!0,r.B.isConnectionTypeLoaded=!0;let t=(new Date).getTime()-e;console.log("The time taken to prepare connections ",t)})).catch((e=>{throw e}))}))}function yi(e,t={}){if(ni||null!=typeof window){let o=new CustomEvent(`${e}`,t);dispatchEvent(o)}else fn.x.postMessage({type:"dispatchEvent",payload:{id:e}})}function vi(){return ii(this,void 0,void 0,(function*(){console.log("message queue",si);const e=si.find((e=>{var t;return"init"==(null===(t=null==e?void 0:e.message)||void 0===t?void 0:t.type)}));if(e){console.log("Processing Init Queue poped",null==e?void 0:e.type,e);const t=si.indexOf(e);t>-1&&si.splice(t,1),yield hi(null==e?void 0:e.type,null==e?void 0:e.payload)}for(console.log("message queue while",si);si.length>0;){const{message:e,resolve:t,reject:o}=si.shift();console.log("Queue poped",e.type,e),yield hi(e.type,e.payload)}}))}const gi=e=>{if(e instanceof j.z)throw console.error("FreeSchemaResponse Error",e),e;console.error("Service Worker Error",e)};function mi(){return ii(this,void 0,void 0,(function*(){yield hi("init",{url:l.B.BASE_URL,aiurl:l.B.AI_URL,accessToken:yt.b.BearerAccessToken,nodeUrl:l.B.NODE_URL,enableAi:!1,applicationName:l.B.BASE_APPLICATION,flags:l.B.FLAGS})}))}}},t={};function o(n){var i=t[n];if(void 0!==i)return i.exports;var r=t[n]={exports:{}};return e[n](r,r.exports,o),r.exports}o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n=o(2830),i=o(9635),r=o(205),c=o(3278),s=o(5020),a=o(7887),l=o(7869),d=o(3075),u=o(2803),h=o(7139),p=o(5284),f=o(8939),y=o(6687),v=o(2013),g=o(1213),m=o(5328),C=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};const T={GetConcept:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,h.r)(e.id)}})),GetTheConcept:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.GetTheConcept)(e.id,e.userId)}})),GetConceptBulk:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.GetConceptBulk)(e.passedConcepts)}})),GetLink:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.GetLink)(e.id,e.linker,e.inpage,e.page)}})),GetRelation:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.GetRelation)(e.id,e.relation,e.inpage,e.page)}})),GetRelationRaw:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.GetRelationRaw)(e.id,e.relation,e.inpage,e.page)}})),GetComposition:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,f.Nj)(e.id)}})),GetCompositionList:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.GetCompositionList)(e.compositionName,e.userId,e.inpage,e.page)}})),GetCompositionListWithId:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.GetCompositionListWithId)(e.compositionName,e.userId,e.inpage,e.page)}})),GetCompositionById:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,f.hL)(e.id)}})),GetCompositionWithId:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,f.yz)(e.id)}})),GetCompositionListAllWithId:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.GetCompositionListAllWithId)(e.compositionName,e.userId,e.inpage,e.page)}})),GetConceptByCharacter:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.GetConceptByCharacter)(e.characterValue)}})),GetConceptByCharacterUpdated:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,v.w)(e.characterValue)}})),GetConceptByCharacterAndType:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.GetConceptByCharacterAndType)(e.characterValue,e.typeId)}})),GetCompositionFromConnectionsWithDataId:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,y.p8)(e.conceptIds,e.connectionIds)}})),GetCompositionFromConnectionsWithDataIdIndex:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,y.Nt)(e.conceptIds,e.connectionIds)}})),GetCompositionConnectionsBetweenTwoConcepts:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,u.x)(e.ofConceptId,e.toConcept,e.mainKey)}})),GetConnectionDataPrefetch:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,y.QL)(e.connectionIds)}})),GetCompositionWithIdFromMemory:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,f.RW)(e.id)}})),GetCompositionWithIdAndDateFromMemory:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,f.Ez)(e.id)}})),GetCompositionFromMemory:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,f.kx)(e.id)}})),GetCompositionFromMemoryNormal:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,f.XI)(e.id)}})),GetCompositionWithIdFromMemoryNew:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,f.$N)(e.id)}})),FindConnectionsOfCompositionsBulkInMemory:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,p.B)(e.composition_ids)}})),GetAllTheConnectionsByTypeAndOfTheConcept:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.GetAllTheConnectionsByTypeAndOfTheConcept)(e.id,e.linker,e.reverse)}})),GetCompositionFromMemoryWithConnections:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,f.JA)(e.id,e.connectionList)}})),GetCompositionFromConnectionsWithIndexFromConnections:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,y.hG)(e.conceptIds,e.connectionIds)}})),GetCompositionFromConnectionsWithDataIdFromConnections:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,y.km)(e.conceptIds,e.connectionIds)}})),GetTheConceptLocal:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,g.f)(e.id)}})),GetCompositionLocal:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.GetCompositionLocal)(e.id)}})),GetCompositionLocalWithId:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.GetCompositionLocalWithId)(e.id)}})),GetCompositionListLocal:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.GetCompositionListLocal)(e.compositionName,e.userId)}})),GetCompositionListLocalWithId:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.GetCompositionListLocalWithId)(e.compositionName,e.userId)}})),GetConceptByCharacterAndCategoryLocal:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.GetConceptByCharacterAndCategoryLocal)(e.character)}})),ConceptsData__AddConcept:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield n.ConceptsData.AddConcept(e.concept)}})),ConceptsData__GetConcept:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield n.ConceptsData.GetConcept(e.id)}})),ConceptsData__GetConceptsByTypeIdAndUser:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield n.ConceptsData.GetConceptsByTypeIdAndUser(e.typeId,e.userId)}})),ConnectionData__GetConnectionByOfTheConceptAndType:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield n.ConnectionData.GetConnectionByOfTheConceptAndType(e.ofTheConceptId,e.typeId)}})),ConnectionData__GetConnection:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield n.ConnectionData.GetConnection(e.id)}})),ConnectionData__GetConnectionsOfCompositionLocal:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield n.ConnectionData.GetConnectionsOfCompositionLocal(e.id)}})),ConnectionData__GetConnectionsOfConcept:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield n.ConnectionData.GetConnectionsOfConcept(e.id)}})),GetLinkListener:e=>C(void 0,void 0,void 0,(function*(){let t=!1;return new Promise(((o,n)=>{(0,m.d)(e.id,e.linker,e.inpage,e.page,e.format).subscribe((n=>{var r,c;t?(console.log("isSubscribed",t),o({success:!0,data:n}),t=!0):(console.log("is not isSubscribed",t),i.x.postMessage({type:"GetLinkListener",payload:{id:null===(r=null==e?void 0:e.listener)||void 0===r?void 0:r.listenerId,listenerId:null===(c=null==e?void 0:e.listener)||void 0===c?void 0:c.listenerId,data:n}}))})).catch((e=>{console.log("Error : ",e),n("Error Occured")}))}))}))};var w=o(7106),I=o(4310),k=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};const N={SearchLinkMultipleAll:e=>k(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.SearchLinkMultipleAll)(e.searchQuery,e.token,e.caller,e.format)}})),RecursiveSearchApi:e=>k(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.RecursiveSearchApi)(e.composition,e.listLinkers,e.textSearch)}})),RecursiveSearchApiWithInternalConnections:e=>k(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.RecursiveSearchApiWithInternalConnections)(e.composition,e.listLinkers,e.textSearch)}})),RecursiveSearchApiRaw:e=>k(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.RecursiveSearchApiRaw)(e.composition,e.listLinkers,e.textSearch)}})),RecursiveSearchApiRawFullLinker:e=>k(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.RecursiveSearchApiRawFullLinker)(e.composition,e.fullLinkers,e.textSearch)}})),RecursiveSearchApiNewRawFullLinker:e=>k(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.RecursiveSearchApiNewRawFullLinker)(e.composition,e.fullLinkers,e.textSearch)}})),formatConnectionsDataId:e=>k(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,w.e$)(e.linkers,e.conceptIds,e.mainCompositionIds,e.reverse,e.countInfos,e.order)}})),formatConnectionsJustId:e=>k(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,w.y6)(e.linkers,e.conceptIds,e.mainCompositionIds,e.reverse,e.countInfos,e.order)}})),formatConnections:e=>k(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,w.b6)(e.linkers,e.conceptIds,e.mainCompositionIds,e.reverse,e.countInfos)}})),BuildWidgetFromId:e=>k(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,I.C)(e.id)}}))};var A=o(1218),L=o(3077),S=o(9975),G=o(5868),x=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};const B={MakeTheInstanceConcept:e=>x(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.MakeTheInstanceConcept)(e.type,e.referent,e.composition,e.userId,e.passedAccessId,e.passedSessionId,e.referentId)}})),MakeTheConceptLocal:e=>x(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,S.A)(e.referent,e.typeCharacter,e.userId,e.categoryId,e.typeId,e.actions)}})),MakeTheTypeConcept:e=>x(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.MakeTheTypeConcept)(e.typeString,e.sessionId,e.sessionUserId,e.userId)}})),MakeTheTimestamp:e=>x(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.MakeTheTimestamp)(e.type,e.referent,e.userId,e.accessId,e.sessionInformationId)}})),CreateTheComposition:e=>x(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,A.A)(e.json,e.ofTheConceptId,e.ofTheConceptUserId,e.mainKey,e.userId,e.accessId,e.sessionInformationId)}})),MakeTheInstanceConceptLocal:e=>x(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,G.k)(e.type,e.referent,e.composition,e.userId,e.accessId,e.sessionInformationId,e.referentId,e.actions),actions:e.actions}})),MakeTheTypeConceptLocal:e=>x(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.MakeTheTypeConceptLocal)(e.typeString,e.sessionId,e.sessionUserId,e.userId,e.actions),actions:e.actions}})),CreateTheConceptLocal:e=>x(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,L.A)(e.referent,e.typecharacter,e.userId,e.categoryId,e.typeId,e.accessId,e.isComposition,e.referentId,e.actions),actions:e.actions}})),CreateTheCompositionLocal:e=>x(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.CreateTheCompositionLocal)(e.json,e.ofTheConceptId,e.ofTheConceptUserId,e.mainKey,e.userId,e.accessId,e.sessionInformationId,e.automaticSync,e.actions),actions:e.actions}}))};var b=o(3729),R=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};const D={UpdateComposition:e=>R(void 0,void 0,void 0,(function*(){return yield(0,n.UpdateComposition)(e.patcherStructure),{success:!0}})),UpdateCompositionLocal:e=>R(void 0,void 0,void 0,(function*(){return yield(0,b.D)(e.patcherStructure,e.actions),{success:!0}}))};var U=o(8095),E=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};const F={GetConnectionById:e=>E(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.GetConnectionById)(e.id)}})),GetConnectionBulk:e=>E(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.GetConnectionBulk)(e.connectionIds)}})),GetConnectionOfTheConcept:e=>E(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.GetConnectionOfTheConcept)(e.typeId,e.ofTheConceptId,e.userId,e.inpage,e.page)}})),GetAllConnectionsOfCompositionBulk:e=>E(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.GetAllConnectionsOfCompositionBulk)(e.composition_ids)}})),GetConnectionBetweenTwoConceptsLinker:e=>E(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.GetConnectionBetweenTwoConceptsLinker)(e.ofTheConcept,e.toTheConcept,e.linker,e.fullLinker,e.forward)}})),CreateConnectionBetweenTwoConcepts:e=>E(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.CreateConnectionBetweenTwoConcepts)(e.ofTheConcept,e.toTheConcept,e.linker,e.both)}})),CreateConnectionBetweenTwoConceptsLocal:e=>E(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,U.h)(e.ofTheConcept,e.toTheConcept,e.linker,e.both,e.actions),actions:e.actions}})),CreateTheConnectionLocal:e=>E(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.CreateTheConnectionLocal)(e.ofTheConceptId,e.toTheConceptId,e.typeId,e.orderId,e.typeString,e.userId,e.actions),actions:e.actions}}))};var _=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};const W={DeleteConceptById:e=>_(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.DeleteConceptById)(e.id)}})),DeleteConnectionById:e=>_(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.DeleteConnectionById)(e.id)}})),DeleteUser:e=>_(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.DeleteUser)(e.id)}})),DeleteConnectionByType:e=>_(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.DeleteConnectionByType)(e.id,e.linker)}})),DeleteConceptLocal:e=>_(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.DeleteConceptLocal)(e.id)}}))};var O=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};const V={SyncData__SyncDataOnline:e=>O(void 0,void 0,void 0,(function*(){return{success:!0,data:yield n.SyncData.SyncDataOnline()}})),LocalSyncData__SyncDataOnline:e=>O(void 0,void 0,void 0,(function*(){return{success:!0,data:yield n.LocalSyncData.SyncDataOnline(e.transactionId)}})),LocalSyncData__initializeTransaction:e=>O(void 0,void 0,void 0,(function*(){return{success:!0,data:yield n.LocalSyncData.initializeTransaction(e.transactionId)}})),LocalSyncData__markTransactionActions:e=>O(void 0,void 0,void 0,(function*(){return{success:!0,data:yield n.LocalSyncData.markTransactionActions(e.transactionId,e.actions),actions:e.actions}})),LocalSyncData__rollbackTransaction:e=>O(void 0,void 0,void 0,(function*(){return{success:!0,data:yield n.LocalSyncData.rollbackTransaction(e.transactionId,e.actions),actions:e.actions}}))};var M=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};let P=!1,j=new Map,H=!1,$=[];const J=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({checkProcess:e=>M(void 0,void 0,void 0,(function*(){return(null==e?void 0:e.checkMessageId)&&$.includes(null==e?void 0:e.checkMessageId)?{success:!0,data:{processing:!0},name:"init"}:{success:!0,data:{processing:!1},name:"init"}})),init:e=>M(void 0,void 0,void 0,(function*(){return P?(console.warn("Already Initialized"),{success:!0,name:"init"}):(console.log("init has started"),P=!0,console.log("init has set value"),console.log("Payload log in service worker : ",e),yield function(){return M(this,arguments,void 0,(function*(e="",t="",o="",i="",u=!0,h="",p){var f,y;n.BaseUrl.BASE_URL=e,n.BaseUrl.AI_URL=t,n.BaseUrl.NODE_URL=i,n.BaseUrl.BASE_APPLICATION=h,c.b.BearerAccessToken=o;let v=Math.floor(1e8*Math.random());if(console.log("Flags came in init of service worker is ",p),n.BaseUrl.setRandomizer(v),n.BaseUrl.FLAGS=p,null===(f=n.BaseUrl.FLAGS)||void 0===f?void 0:f.isTest)return r.B.isDataLoaded=!0,r.B.isCharacterLoaded=!0,r.B.isTypeLoaded=!0,r.B.isLocalDataLoaded=!0,r.B.isLocalTypeLoaded=!0,r.B.isLocalCharacterLoaded=!0,r.B.isConnectionLoaded=!0,r.B.isConnectionTypeLoaded=!0,r.B.isLocalConnectionLoaded=!0,!0;console.log("This is the base url",n.BaseUrl.BASE_URL,v),console.log("service worker BaseUrl.FLAGS is ",n.BaseUrl.FLAGS),(null===(y=n.BaseUrl.FLAGS)||void 0===y?void 0:y.accessTracker)&&(console.log("From service worker, flag of Access Tracker."),n.AccessTracker.activateStatus=!0,console.log("Access Tracker Activation status from service worker",n.AccessTracker.activateStatus)),yield(0,l.A)();const g=(new Date).getTime();yield(0,s.A)().then((()=>{let e=(new Date).getTime()-g;console.log("The time taken to prepare concept data is ",e)})).catch((e=>{throw e})),yield(0,d.Ay)().then((()=>{let e=(new Date).getTime()-g;console.log("The time taken to prepare local concept ",e)})).catch((e=>{throw e})),yield(0,a.p)().then((()=>{r.B.isLocalConnectionLoaded=!0})).catch((e=>{throw e})),yield(0,d.xd)(),yield(0,a.a)().then((()=>{r.B.isConnectionLoaded=!0,r.B.isConnectionTypeLoaded=!0;let e=(new Date).getTime()-g;console.log("The time taken to prepare connections ",e)})).catch((e=>{throw e}))}))}(null==e?void 0:e.url,null==e?void 0:e.aiurl,null==e?void 0:e.accessToken,null==e?void 0:e.nodeUrl,null==e?void 0:e.enableAi,null==e?void 0:e.applicationName,null==e?void 0:e.flags),console.log("init has completed"),{success:!0,data:void 0,name:"init"})})),updateAccessToken:e=>M(void 0,void 0,void 0,(function*(){return yield(0,n.updateAccessToken)(e.accessToken,e.session),{success:!0,name:"updateAccessToken"}}))},T),N),B),D),F),W),V),z=()=>!!P||(i.x.postMessage({type:"checkInit",payload:{}}),console.log("Message posted to broadcastChannel"),!1);var q=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};self.addEventListener("install",(e=>{console.log("Service Worker installing... sw"),e.waitUntil(self.skipWaiting())})),self.addEventListener("activate",(e=>q(void 0,void 0,void 0,(function*(){yield(0,n.setHasActivatedSW)(!0),console.log("Service Worker activating... sw"),e.waitUntil(new Promise(((e,t)=>{try{self.clients.claim(),console.log("claimed"),z(),e(void 0)}catch(e){console.error("Error during service worker activation:",e),t(e)}})))})))),self.addEventListener("fetch",(e=>{e.clientId||e.respondWith(Q(e))})),self.addEventListener("message",(e=>{!function(e){M(this,void 0,void 0,(function*(){var t,o;let i={success:!1,data:void 0};const{type:r,payload:c}=e.data,s=c.TABID;let a=!1;try{if("checkProcess"!=r&&console.log("received",r,null==c?void 0:c.messageId),!r||!c.TABID)return;$.push(c.messageId),"init"==r||z()||(console.warn("Message received before sw initialization",r,c.messageId),yield new Promise((e=>{console.log("is it stuck here???? type",r,c.messageId);const t=setInterval((()=>{console.log("Interval check 0",P,r,c.messageId),P?(console.log("Interval check 2",P,r,c.messageId),console.log(o,t),clearInterval(t),clearTimeout(o),e(void 0)):console.warn("Watring for init 1:",r)}),200),o=setTimeout((()=>{console.warn("Tried waiting for init but couldn't complete in time: ",r,c.messageId),clearInterval(t),e(void 0)}),9e4)})),console.log("After timeout promise",r,c.messageId,P),P||(console.log("wait failed",P,c.messageId,r),$=yield Promise.all($.filter((e=>e!=c.messageId))),e.source.postMessage(i)),console.log("After timeout promise nice",r,P)),j.has(s)||j.set(s,{concepts:[],connections:[]});let l=j.get(s);if(Array.isArray(null===(t=null==c?void 0:c.actions)||void 0===t?void 0:t.concepts)&&Array.isArray(null===(o=null==c?void 0:c.actions)||void 0===o?void 0:o.connections)||(c.actions={concepts:[],connections:[]},a=!0),"LocalSyncData__SyncDataOnline"==r&&!c.transactionId&&l){const e=n.LocalSyncData.SyncDataOnline(void 0,JSON.parse(JSON.stringify(l)));j.delete(s),l=void 0,console.log("Syncing the tab here",r),i={success:!0,data:yield e,actions:{concepts:[],connections:[]}}}else J[r]?i=yield J[r](c):console.warn(`Unable to handle "${r}" case in service worker`);if(i.messageId=c.messageId,H&&console.warn("Race condition has been met",r),H=!0,l=j.get(s),i.actions&&l){let e={concepts:[...l.concepts,...i.actions.concepts],connections:[...l.connections,...i.actions.connections]};const[t,o]=yield Promise.all([Promise.all(Array.from(new Map(e.concepts.map((e=>[`${e.id}-${e.ghostId}`,e]))).values())),Promise.all(Array.from(new Map(e.connections.map((e=>[`${e.id}-${e.ghostId}`,e]))).values()))]);j.set(s,JSON.parse(JSON.stringify({concepts:t,connections:o})))}H=!1,a&&delete i.actions,"checkProcess"!=r&&console.log("sent",r,null==c?void 0:c.messageId),$=yield Promise.all($.filter((e=>e!=c.messageId))),e.source.postMessage(i)}catch(t){console.error("Service worker Message Handle Error: ",r,t),401!=(null==t?void 0:t.status)&&500!=(null==t?void 0:t.status)||(i={success:!1,data:{status:t.status,statusText:null==t?void 0:t.url},messageId:c.messageId}),$=yield Promise.all($.filter((e=>e!=c.messageId))),e.source.postMessage(i)}}))}(e)}));const Q=e=>q(void 0,void 0,void 0,(function*(){try{const t=yield fetch(e.request);if(401===t.status){const o=Math.random().toString(36).substring(2);return e.waitUntil(e.source.postMessage({type:"API_401",messageId:o,message:"Unauthorized",payload:{method:e.request.method,url:e.request.url,headers:Array.from(e.request.headers.entries()),body:yield e.request.clone().json()}})),yield new Promise((e=>{console.log("Re resolving 401",t.url),setTimeout((()=>e(t)),6e4),navigator.serviceWorker.addEventListener("message",(n=>{var i,r,c;n.data&&(null===(i=n.data)||void 0===i?void 0:i.messageId)==o&&"API_RESPONSE"===(null===(r=n.data)||void 0===r?void 0:r.type)&&((null===(c=null==n?void 0:n.data)||void 0===c?void 0:c.response)?e(n.data.response):(console.log("Unable to resolve re 401",t.url),e(t)))}))}))}return t}catch(e){throw console.error("Error occured during 401 intercepting",e),e}}));
|
|
1
|
+
var e={1735:(e,t,o)=>{o.d(t,{J:()=>s});var n,i=o(2830),r=o(3278),c=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class s{static incrementConcept(e){try{e&&(this.conceptsData[e]=(this.conceptsData[e]||0)+1)}catch(e){console.error("Failed on increment concept")}}static incrementConnection(e){try{e&&(this.connectionsData[e]=(this.connectionsData[e]||0)+1)}catch(e){console.error("Failed on increment connection")}}static getTopConcepts(e){return Object.entries(this.conceptsData).map((([e,t])=>[parseInt(e),t])).sort(((e,t)=>t[1]-e[1])).slice(0,e)}static getTopConnections(e){return Object.entries(this.connectionsData).map((([e,t])=>[parseInt(e),t])).sort(((e,t)=>t[1]-e[1])).slice(0,e)}static saveDataToLocalStorage(){const e={concepts:this.conceptsData,connections:this.connectionsData};null===localStorage||void 0===localStorage||localStorage.setItem(this.accessData,JSON.stringify(e))}static loadDataFromLocalStorage(){const e=null===localStorage||void 0===localStorage?void 0:localStorage.getItem(this.accessData);if(e){const t=JSON.parse(e);this.conceptsData=t.concepts||{},this.connectionsData=t.connections||{}}}static sendToServer(){return c(this,void 0,void 0,(function*(){try{yield this.syncToServer()}catch(e){console.error("Failed to process Access Tracker Sync with Server")}}))}static syncToServer(){return c(this,void 0,void 0,(function*(){try{if(!Object.keys(this.conceptsData).length&&!Object.keys(this.connectionsData).length)return;const e=r.b.BearerAccessToken;if(!e)return;const t=this.conceptsData&&Object.keys(this.conceptsData).length>0?this.conceptsData:{},o=this.connectionsData&&Object.keys(this.connectionsData).length>0?this.connectionsData:{},n=yield fetch(i.BaseUrl.PostPrefetchConceptConnections(),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:JSON.stringify({concepts:t,connections:o})});if(!n.ok)throw new Error("Failed to sync data to the server.");yield n.json(),this.conceptsData={},this.connectionsData={},this.setNextSyncTime()}catch(e){console.error("Sync error:",e)}}))}static setNextSyncTime(){this.nextSyncTime=Date.now()+this.SYNC_INTERVAL_MS}static startAutoSync(){setInterval((()=>{const e=Date.now();this.nextSyncTime&&e>=this.nextSyncTime&&this.syncNow().catch(console.error)}),6e4)}static syncNow(){return c(this,void 0,void 0,(function*(){try{this.activateStatus?yield this.syncToServer():console.warn("Access Tracker inactive.")}catch(e){console.error("Error on sync access tracker")}}))}static GetSuggestedConcepts(e){return c(this,void 0,void 0,(function*(){try{const t=r.b.BearerAccessToken,o=new URL(i.BaseUrl.GetSuggestedConcepts());void 0!==e&&o.searchParams.append("top",e.toString());const n=yield fetch(o.toString(),{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}});if(!n.ok){const e=yield n.text();throw new Error(`Failed to load concepts: ${n.status} ${n.statusText}. Details: ${e}`)}const c=(yield n.json())||[];return yield this.addConceptToBinaryTree(c.data),c}catch(e){throw e instanceof Error?(console.error("Error fetching suggested concepts:",e.message),new Error("Unable to fetch suggested concepts. Please try again later.")):(console.error("An unexpected error occurred:",e),new Error("An unexpected error occurred while fetching suggested concepts."))}}))}static GetSuggestedConnections(e){return c(this,void 0,void 0,(function*(){try{const t=r.b.BearerAccessToken,o=new URL(i.BaseUrl.GetSuggestedConnections());void 0!==e&&o.searchParams.append("top",e.toString());const n=yield fetch(o.toString(),{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}});if(!n.ok){const e=yield n.text();throw new Error(`Failed to load connections: ${n.status} ${n.statusText}. Details: ${e}`)}const c=(yield n.json())||[];return yield this.addConnectionToBinaryTree(c.data),c}catch(e){throw e instanceof Error?(console.error("Error fetching suggested Connections:",e.message),new Error("Unable to fetch suggested connections. Please try again later.")):(console.error("An unexpected error occurred:",e),new Error("An unexpected error occurred while fetching suggested Connections."))}}))}static addConceptToBinaryTree(e){return c(this,void 0,void 0,(function*(){try{e.forEach((e=>{i.ConceptsData.AddConcept(e)}))}catch(e){console.error("Error on adding Concepts Data into tree")}}))}static addConnectionToBinaryTree(e){return c(this,void 0,void 0,(function*(){try{e.forEach((e=>{i.ConnectionData.AddConnection(e)}))}catch(e){console.error("Error on adding Connections Data into tree")}}))}}n=s,s.conceptsData={},s.connectionsData={},s.SYNC_INTERVAL_MS=12e4,s.nextSyncTime=Date.now(),s.activateStatus=!1,s.accessData="Access Data",n.startAutoSync()},1167:(e,t,o)=>{o.d(t,{Y:()=>a});var n=o(9581),i=o(3518),r=o(2830),c=o(1863),s=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function a(e){return s(this,void 0,void 0,(function*(){const t=r.Logger.logfunction("CreateTheConceptApi",e);let o=(0,r.CreateDefaultConcept)();try{var s=(0,i.Xr)();const a=yield fetch(n.B.CreateTheConceptUrl(),{method:"POST",headers:s,body:JSON.stringify(e)});if(!a.ok)throw(0,c.ry)(a),new Error(`Error! status: ${a.status}`);return o=yield a.json(),r.Logger.logUpdate(t),o}catch(e){e instanceof Error?console.log("Create the concept api error message: ",e.message):console.log("Create the concept api unexpected error: ",e),(0,c.Mb)(e,n.B.CreateTheConceptUrl()),(0,c.ey)(t,"CreateTheConceptApi",e)}}))}},2:(e,t,o)=>{o.d(t,{s:()=>d});var n=o(8286),i=o(9581),r=o(1412),c=o(3518),s=o(1863),a=o(2830),l=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function d(e){var t=arguments;return l(this,void 0,void 0,(function*(){const o=a.Logger.logfunction("GetAllConnectionsOfComposition",t);var i=[];if(0==(i=yield n.d.GetConnectionsOfConcept(e)).length)i=yield u(e);else{var c=yield u(e);(0,r.e)(c,i),i=c}return a.Logger.logUpdate(o),i}))}function u(e){var t=arguments;return l(this,void 0,void 0,(function*(){const o=a.Logger.logfunction("GetAllConnectionsOfCompositionOnline",t);var r=[];try{(0,c.Xr)("application/json");const t=new Headers,d=new FormData;d.append("composition_id",e.toString());const u=yield fetch(i.B.GetAllConnectionsOfCompositionUrl(),{method:"POST",headers:t,body:d});if(console.log("this is getting connection from online",i.B.GetAllConnectionsOfCompositionUrl(),e),!u.ok)throw(0,s.ry)(u),new Error(`Error! status: ${u.status}`);const h=yield u.json();for(var l=0;l<h.length;l++)n.d.AddConnection(h[l]),r.push(h[l]);return a.Logger.logUpdate(o),r}catch(e){e instanceof Error?console.log("Get all connection of composition error : ",e.message):console.log("Get all connection of composition error : ",e),(0,s.Mb)(e,i.B.GetAllConnectionsOfCompositionUrl()),(0,s.ey)(o,"GetAllConnectionsOfCompositionOnline",e)}}))}},8642:(e,t,o)=>{o.d(t,{Y:()=>h});var n=o(8286),i=o(9581),r=o(4364),c=o(5284),s=o(1412),a=o(3518),l=o(1863),d=o(2830),u=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function h(){var e=arguments;return u(this,arguments,void 0,(function*(t=[]){const o=d.Logger.logfunction("GetAllConnectionsOfCompositionBulk",e);if(d.serviceWorker){o.serviceWorker=!0;try{const e=yield(0,d.sendMessage)("GetAllConnectionsOfCompositionBulk",{composition_ids:t});return d.Logger.logUpdate(o),e.data}catch(e){console.error("GetAllConnectionsOfCompositionBulk sw error: ",e),(0,l.ey)(o,"GetAllConnectionsOfCompositionBulk",e),(0,d.handleServiceWorkerException)(e)}}var h=[];if(t.length<=0)return h;var p=yield(0,c.B)(t),f=yield function(){var e=arguments;return u(this,arguments,void 0,(function*(t=[]){const o=d.Logger.logfunction("GetAllConnectionsOfCompositionOnline",e);var r=[];try{var c=(0,a.Xr)();const e=yield fetch(i.B.GetAllConnectionsOfCompositionBulkUrl(),{method:"POST",headers:c,body:JSON.stringify(t)});if(e.ok){const t=yield e.json();for(var s=0;s<t.length;s++)n.d.AddConnection(t[s]),r.push(t[s])}else console.log("Get all connections of composition bulk error message: ","Cannot get response"),(0,l.ry)(e);return d.Logger.logUpdate(o),r}catch(e){e instanceof Error?console.log("Get all connections of composition bulk error message: ",e.message):console.log("Get all connections of composition bulk unexpected error: ",e),(0,l.Mb)(e,i.B.GetAllConnectionsOfCompositionBulkUrl()),(0,l.ey)(o,"GetAllConnectionsOfCompositionOnline",e)}}))}(t);return h=f,(0,s.e)(h,p),yield(0,r.s)(h),d.Logger.logUpdate(o),h}))}},2803:(e,t,o)=>{o.d(t,{x:()=>a});var n=o(8286),i=o(9581),r=o(1863),c=o(2830),s=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function a(e,t,o){var a=arguments;return s(this,void 0,void 0,(function*(){const s=c.Logger.logfunction("GetCompositionConnectionsBetweenTwoConcepts",a);var l=[];try{if(c.serviceWorker){s.serviceWorker=!0;try{const n=yield(0,c.sendMessage)("GetCompositionConnectionsBetweenTwoConcepts",{ofConceptId:e,toConcept:t,mainKey:o});return c.Logger.logUpdate(s),n.data}catch(e){console.error("GetCompositionConnectionsBetweenTwoConcepts sw error: ",e),(0,r.ey)(s,"GetCompositionConnectionsBetweenTwoConcepts",e),(0,c.handleServiceWorkerException)(e)}}var d=new FormData;d.append("ofConceptId",e.toString()),d.append("mainKey",o.toString()),d.append("toConceptId",t.toString());const a=yield fetch(i.B.GetCompositionConnectionBetweenTwoConceptsUrl(),{method:"POST",body:d,redirect:"follow"});if(a.ok){const e=yield a.json();for(var u=0;u<e.length;u++)n.d.AddConnection(e[u]),l.push(e[u]);c.Logger.logUpdate(s)}else console.log("Get composition connection between two concepts",a.status),(0,r.ry)(a)}catch(e){e instanceof Error?console.log("Get composition connection between two concepts error message: ",e.message):console.log("Get composition connection between two concepts unexpected error: ",e),(0,r.Mb)(e,i.B.GetCompositionConnectionBetweenTwoConceptsUrl()),(0,r.ey)(s,"GetCompositionConnectionsBetweenTwoConcepts",e)}return l}))}},7139:(e,t,o)=>{o.d(t,{r:()=>l});var n=o(9639),i=o(9581),r=o(3518),c=o(2830),s=o(1863),a=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function l(e){var t=arguments;return a(this,void 0,void 0,(function*(){const o=c.Logger.logfunction("GetConcept",t);try{if(c.serviceWorker){o.serviceWorker=!0;try{const t=yield(0,c.sendMessage)("GetConcept",{id:e});return c.Logger.logUpdate(o),t.data}catch(e){console.error("GetConcept sw error: ",e),(0,s.ey)(o,"GetConcept",e),(0,c.handleServiceWorkerException)(e)}}let t=(0,c.CreateDefaultConcept)();if(0==e||null==e||null==e)return t;var a=yield n.I.GetConcept(e);let l=n.I.GetNpc(e);if(0!=a.id||l)return c.Logger.logUpdate(o),a;{(0,r.Xr)(),console.log("this is the url",i.B.GetConceptUrl());const a=new FormData;a.append("id",e.toString());const l=yield fetch(i.B.GetConceptUrl(),{method:"POST",body:a});return l.ok?(t=yield l.json(),t.id>0?n.I.AddConcept(t):n.I.AddNpc(e)):(console.log("Get the concept error",l.status),(0,s.ry)(l)),c.Logger.logUpdate(o),t}}catch(e){e instanceof Error?console.log("Get the concept error message: ",e.message):console.log("Get the concept unexpected error: ",e),(0,s.Mb)(e,i.B.GetConceptUrl()),(0,s.ey)(o,"GetConcept",e)}}))}},1239:(e,t,o)=>{o.d(t,{I:()=>d,r:()=>l});var n=o(9639),i=o(9581),r=o(3518),c=o(1863),s=o(2830),a=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function l(e){return a(this,void 0,void 0,(function*(){const t=s.Logger.logfunction("GetConceptBulk",[e.length]);let o=[],a=((new Date).getTime(),performance.now()),l=Array.from(new Set(e));try{if(s.serviceWorker){t.serviceWorker=!0;try{const o=yield(0,s.sendMessage)("GetConceptBulk",{passedConcepts:e});return s.Logger.logUpdate(t),o.data}catch(e){console.error("GetConceptBulk sw error: ",e),(0,c.ey)(t,"GetConceptBulk",e),(0,s.handleServiceWorkerException)(e)}}if(l.length>0){let d=[];for(let e=0;e<l.length;e++)0==(yield n.I.GetConcept(l[e])).id&&d.push(l[e]);if(0==d.length)return s.Logger.logfunction(t),o;{let l=(0,r.Xr)();const u=yield fetch(i.B.GetConceptBulkUrl(),{method:"POST",headers:l,body:JSON.stringify(d)});if(u.ok){if(o=yield u.json(),o.length>0)for(let e=0;e<o.length;e++){let t=o[e];n.I.AddConcept(t)}console.log("added the concepts"),s.Logger.logUpdate(t)}else console.log("Get Concept Bulk error",u.status),s.Logger.logError(a,"unknown","read","unknown",void 0,u.status,u,"GetConceptBulk",[e],"unknown",void 0),(0,c.ry)(u)}}}catch(o){o instanceof Error?console.log("Get Concept Bulk error message: ",o.message):console.log("Get Concept Bulk unexpected error: ",o),s.Logger.logError(a,"unknown","read","unknown",void 0,500,o,"GetConceptBulk",[e],"unknown",void 0),(0,c.Mb)(o,i.B.GetConceptBulkUrl()),(0,c.ey)(t,"GetConceptBulk",o)}return o}))}function d(e){return a(this,void 0,void 0,(function*(){const t=[];if(e.length>0){const o={"Content-Type":"application/json"};try{const r=yield fetch(i.B.GetConceptBulkUrl(),{method:"POST",headers:o,body:JSON.stringify(e)});if(r.ok){const e=yield r.json();if(e.length>0)for(let o=0;o<e.length;o++){const i=e[o];t.push(i),n.I.AddConcept(i)}}else console.log("bulk concept getter api error: ",r.status),(0,c.ry)(r)}catch(e){e instanceof Error?console.log("bulk concept getter api error: ",e.message):console.log("bulk concept getter api error: ",e),(0,c.Mb)(e,i.B.GetConceptBulkUrl())}}return t}))}},4402:(e,t,o)=>{o.d(t,{A:()=>l});var n=o(9639),i=o(9581),r=o(3518),c=o(1863),s=o(2830),a=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function l(e,t){var o=arguments;return a(this,void 0,void 0,(function*(){const a=s.Logger.logfunction("GetConceptByCharacterAndType",o);try{if(s.serviceWorker)try{return(yield(0,s.sendMessage)("GetConceptByCharacterAndType",{characterValue:e,typeId:t})).data}catch(e){console.error("GetConceptByCharacterAndType sw error: ",e),(0,s.handleServiceWorkerException)(e)}let o=yield n.I.GetConceptByCharacterAndTypeLocal(e,t);if(null==o||0==o.id){var l={character_value:`${e}`,type_id:t},d=JSON.stringify(l),u=(0,r.Xr)();const s=yield fetch(i.B.GetConceptByCharacterAndTypeUrl(),{method:"POST",headers:u,body:d});s.ok?(o=yield s.json(),n.I.AddConcept(o)):((0,c.ry)(s),console.log("This is the concept by type and character error",s.status))}return s.Logger.logUpdate(a),o}catch(e){e instanceof Error?console.log(" This is the concept by type and character error message: ",e.message):console.log(" This is the concept by type and character unexpected error: ",e),(0,c.Mb)(e,i.B.GetConceptByCharacterAndTypeUrl()),(0,c.ey)(a,"GetConceptByCharacterAndType",e)}}))}},8146:(e,t,o)=>{o.d(t,{Y:()=>a});var n=o(9639),i=o(9581),r=o(2830),c=o(1863),s=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function a(e){var t=arguments;return s(this,void 0,void 0,(function*(){const o=r.Logger.logfunction("GetConceptByCharacterValue",t);let s=(0,r.CreateDefaultConcept)();try{const t=new FormData;t.append("character_value",e);const a=yield fetch(i.B.GetConceptByCharacterValueUrl(),{method:"POST",body:t});a.ok?(s=yield a.json(),s.id>0&&n.I.AddConcept(s),r.Logger.logUpdate(o)):((0,c.ry)(a),console.log("Error in Getting concept by character value Error",a.status))}catch(e){e instanceof Error?console.log("Error in Getting concept by character value error message: ",e):console.log("Error in Getting concept by character value unexpected error: ",e),(0,c.Mb)(e,i.B.GetConceptByCharacterValueUrl()),(0,c.ey)(o,"GetConceptByCharacterValue",e)}return s}))}},7467:(e,t,o)=>{o.d(t,{j:()=>d});var n=o(8286),i=o(9581),r=o(4364),c=o(3518),s=o(1863),a=o(2830),l=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function d(){return l(this,arguments,void 0,(function*(e=[]){const t=a.Logger.logfunction("GetConnectionBulk",e.length);let o=[];try{if(a.serviceWorker){t.serviceWorker=!0;try{const o=yield(0,a.sendMessage)("GetConnectionBulk",{connectionIds:e});return a.Logger.logUpdate(t),o.data}catch(e){console.error("GetConnectionBulk sw error: ",e),(0,s.ey)(t,"GetConnectionBulk",e),(0,a.handleServiceWorkerException)(e)}}if(e.length>0){let r=[];for(let t=0;t<e.length;t++){let i=yield n.d.GetConnection(e[t]);0==i.id?r.push(e[t]):o.push(i)}if(0==r.length)return a.Logger.logUpdate(t),o;{let e=(0,c.Xr)();const l=yield fetch(i.B.GetConnectionBulkUrl(),{method:"POST",headers:e,body:JSON.stringify(r)});if(l.ok){const e=yield l.json();if(e.length>0)for(let t=0;t<e.length;t++){let i=e[t];o.push(i),n.d.AddConnection(i)}}else(0,s.ey)(t,"GetConnectionBulk",l.status),(0,s.ry)(l),console.log("Get Connection Bulk error",l.status);a.Logger.logUpdate(t)}}}catch(e){e instanceof Error?console.log("Get Connection Bulk error message: ",e):console.log("Get Connection Bulk unexpected error: ",e),(0,s.ey)(t,"GetConnectionBulk",e),(0,s.Mb)(e,i.B.GetConnectionBulkUrl())}return yield(0,r.s)(o),o}))}},2832:(e,t,o)=>{o.d(t,{j:()=>a});var n=o(2830),i=o(9581),r=o(1863),c=o(3518),s=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function a(e){var t=arguments;return s(this,arguments,void 0,(function*(e,o=""){const s=n.Logger.logfunction("SearchLinkMultipleApi",t);let a=performance.now();var l=(0,c.ab)("application/json",o);const d=i.B.SearchLinkMultipleAllApiUrl(),u=JSON.stringify(e);try{const t=yield fetch(d,{method:"POST",headers:l,body:u});if(t.ok){let e=yield t.json();return n.Logger.logUpdate(s),e}return(0,r.ry)(t),console.log("This is the searching multiple error",t.status),n.Logger.logError(a,"unknown","search","unknown",void 0,t.status,t,"SearchLinkMultipleApi",[e,o],"unknown",void 0),[]}catch(t){console.log("This is the searching multiple error",t),n.Logger.logError(a,"unknown","search","unknown",void 0,500,t,"SearchLinkMultipleApi",[e,o],"unknown",void 0),(0,r.Mb)(t,d),(0,r.ey)(s,"SearchLinkMultipleApi",t)}}))}},3130:(e,t,o)=>{o.d(t,{BG:()=>a,SL:()=>l,XZ:()=>s,ZJ:()=>r,iw:()=>c,y0:()=>i,yv:()=>n});const n=1,i=2,r=3,c=4,s=5,a=6,l=7},9635:(e,t,o)=>{o.d(t,{x:()=>n});const n=new BroadcastChannel("Freeschema_mftsccs_browser_channel")},9581:(e,t,o)=>{o.d(t,{B:()=>n});class n{static setRandomizer(e){console.log("set randomizer",e),this.BASE_RANDOMIZER=e}static getRandomizer(){return this.BASE_RANDOMIZER}static GetConceptUrl(){return this.BASE_URL+"/api/getConcept"}static GetConnectionUrl(){return this.BASE_URL+"/api/get-connection-by-id"}static GetConceptBulkUrl(){return this.BASE_URL+"/api/get_concept_bulk"}static GetConnectionBulkUrl(){return this.BASE_URL+"/api/get_connection_bulk"}static GetAllConceptsOfUserUrl(){return this.BASE_URL+"/api/get_all_concepts_of_user"}static GetAllConnectionsOfUserUrl(){return this.BASE_URL+"/api/get_all_connections_of_user"}static GetAllConnectionsOfCompositionUrl(){return this.BASE_URL+"/api/get_all_connections_of_composition"}static GetAllConnectionsOfCompositionBulkUrl(){return this.BASE_URL+"/api/get_all_connections_of_composition_bulk"}static GetConceptByCharacterValueUrl(){return this.BASE_URL+"/api/get_concept_by_character_value"}static GetConceptByCharacterAndTypeUrl(){return this.BASE_URL+"/api/get_concept_by_character_and_type"}static GetConceptByCharacterAndCategoryUrl(){return this.BASE_URL+"/api/get_concept_by_character_and_category"}static GetConceptByCharacterAndCategoryDirectUrl(){return this.BASE_URL+"/api/get_concept_by_character_and_category_direct"}static GetCharacterByCharacterUrl(){return this.BASE_URL+"/api/get_character_by_character"}static GetAllConceptsByTypeUrl(){return this.BASE_URL+"/api/get_all_concepts_by_type"}static GetAllConnectionsOfConceptUrl(){return this.BASE_URL+"/api/get-link-connections"}static GetAllAiData(){return this.BASE_URL+"/api/get-preloaded-concepts"}static PostPrefetchConceptConnections(){return this.NODE_URL+"/api/v1/access-tracker/sync-access-tracker"}static GetSuggestedConcepts(){return this.NODE_URL+"/api/v1/access-tracker/list-concepts-file"}static GetSuggestedConnections(){return this.NODE_URL+"/api/v1/access-tracker/list-connections-file"}static PostLogger(){return this.LOG_SERVER+"/api/logger"}static GetAllPrefetchConnectionsUrl(){return this.BASE_URL+"/api/get_all_connections_of_user?inpage=500"}static GetAllLinkerConnectionOfConceptUrl(){return this.BASE_URL+"/api/get-all-linkers-from-concept"}static GetAllLinkerConnectionToConceptUrl(){return this.BASE_URL+"/api/get-all-linkers-to-concept"}static DeleteConceptUrl(){return this.BASE_URL+"/api/delete_concept"}static DeleteUserUrl(){return this.BASE_URL+"/api/deleteuser"}static RecursiveSearchUrl(){return this.BASE_URL+"/api/recursivesearch-concept-connection"}static SearchLinkMultipleAllApiUrl(){return this.BASE_URL+"/api/Connection/search-link-multiple-all-ccs"}static MakeTheNameInBackendUrl(){return this.BASE_URL+"/api/make-name-from-frontend"}static SearchAllTypeWithLinker(e=!0){return e?this.BASE_URL+"/api/search-all-with-linker-ccs":this.BASE_URL+"/api-search-compositions-internal-clean-ccs"}static LoginUrl(){return this.BASE_URL+"/api/auth/login"}static SignupUrl(){return this.BASE_URL+"/api/auth/signup"}static GetCompositionConnectionBetweenTwoConceptsUrl(){return this.BASE_URL+"/api/get-composition-connection-between-two-concepts"}static SearchCompositionsUrl(){return this.BASE_URL+"/api/search-compositions"}static SearchLinkMultipleAll(){return this.BASE_URL+"/api/Connection/search-link-multiple-all"}static CreateSessionId(){return this.BASE_URL+"/api/create-session-id-remote"}static CreateSessionVisitUrl(){return this.BASE_URL+"/api/create-remote-session-visit"}static ViewInternalDataUrl(){return this.BASE_URL+"/api/view-api-internal-data-ccs-id-bulk"}static SearchInternalWithAuthenticatedCcsUrl(){return this.BASE_URL+"/api/search-composition-internal-authenticated-ccs"}static SearchInternalWithCcsUrl(){return this.BASE_URL+"/api-search-compositions-internal-clean-ccs"}static CreateGhostConceptApiUrl(){return n.NODE_URL+"/api/v1/local-concepts"}static CreateGhostConnectionApiUrl(){return n.NODE_URL+"/api/v1/local-connections"}static GetRealConceptById(){return n.NODE_URL+"/api/v1/local-concepts-translate"}static GetReservedIdUrl(){return this.BASE_URL+"/api/get_reserved_ids"}static GetReservedConnectionIdUrl(){return this.BASE_URL+"/api/get_reserved_connection_ids"}static CreateTheTextDataUrl(){return this.BASE_URL+"/api/create_text_data"}static CreateTheCharacterDataUrl(){return this.BASE_URL+"/api/create_character_data"}static CreateTheConceptUrl(){return this.BASE_URL+"/api/create_the_concept"}static CreateTheConnectionUrl(){return this.BASE_URL+"/api/create_the_connection"}static CreateTheConnectionNewUrl(){return this.BASE_URL+"/api/create_the_connection_new"}static MakeTheTypeConceptUrl(){return this.BASE_URL+"/api/make_the_type_concept"}static DeleteTheConnectionUrl(){return this.BASE_URL+"/api/delete_connection"}static FreeschemaQueryUrl(){return this.BASE_URL+"/api/freeschema-query"}static uploadImageUrl(){return this.BASE_URL+"/api/Image/UploadImage"}static uploadFileUrl(){return this.BASE_URL+"/api/Image/UploadFile"}static sendMail(){return this.BASE_URL+"/api/sendmail"}static sendBulkMail(){return this.BASE_URL+"/api/sendmail/bulk"}static getWidgetData(){return this.BASE_URL+"/api/get-widget"}}n.BASE_URL="https://localhost:7053/",n.AI_URL="https://ai.freeschema.com",n.MQTT_URL="192.168.1.249",n.NODE_URL="http://localhost:5001",n.LOG_SERVER="https://logdev.freeschema.com",n.BASE_APPLICATION="",n.FLAGS={logApplication:!1,logPackage:!1,accessTracker:!1,isTest:!1},n.BASE_RANDOMIZER=999},6963:(e,t,o)=>{o.d(t,{f:()=>c});var n=o(205),i=o(6731),r=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class c{static waitForDataToLoad(){return r(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(n.B.isCharacterLoaded)return e("done");setTimeout(c.checkFlag,1e3,e)}static addNodeToTree(e){return r(this,void 0,void 0,(function*(){return null==this.characterRoot?(this.characterRoot=e,this.characterRoot):(this.characterRoot=this.characterRoot.addCharacterNode(e,this.characterRoot,this.characterRoot.height),this.characterRoot)}))}static removeNodeByCharacter(e,t){return r(this,void 0,void 0,(function*(){this.characterRoot&&this.characterRoot.removeNodeWithVariants(this.characterRoot,e,t)}))}static countNumberOfNodes(){return this.characterRoot?this.characterRoot.countNodeBelow(this.characterRoot):0}static addConceptToTree(e){if(""!=e.characterValue){var t=new i.b(e.characterValue,e,null,null);this.addNodeToTree(t)}}static getNodeFromTree(e){return this.characterRoot?this.characterRoot.getCharacterFromNode(e,this.characterRoot):this.characterRoot}static getNodeFromTreeUpdated(e){return this.characterRoot?this.characterRoot.getCharacterFromNode(e,this.characterRoot):this.characterRoot}static getCharacterAndTypeFromTree(e,t){return r(this,void 0,void 0,(function*(){return this.characterRoot?this.characterRoot.getFromNodeWithCharacterAndType(e,t,this.characterRoot):this.characterRoot}))}static getCharacterAndCategoryFromTree(e,t){return r(this,void 0,void 0,(function*(){return this.characterRoot?this.characterRoot.getFromNodeWithCharacterAndCategory(e,t,this.characterRoot):this.characterRoot}))}static removeConceptCharacter(e){this.characterRoot&&(this.characterRoot=this.characterRoot.removeNode(this.characterRoot,e))}}c.characterRoot=null},2202:(e,t,o)=>{o.d(t,{W:()=>a});var n=o(6963),i=o(6731),r=o(205),c=o(2830),s=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class a{static addNodeToTree(e){if(null==this.root)return this.root=e,this.root;this.root=this.root.addNode(e,this.root,this.root.height)}static waitForDataToLoad(){return s(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(r.B.isDataLoaded)return e("done");setTimeout(a.checkFlag,1e3,e)}static addConceptToTree(e){let t=new i.b(e.id,e,null,null),o=new i.b(e.characterValue,e,null,null);n.f.addNodeToTree(o),this.addNodeToTree(t)}static getNodeFromTree(e){return s(this,void 0,void 0,(function*(){return this.root?this.root.getFromNode(e,this.root):null}))}static removeNodeFromTree(e){return s(this,void 0,void 0,(function*(){if(this.root){let t=new Event(`${e}`);console.log("this is the fired event after delete",t),(0,c.dispatchIdEvent)(e),this.root=this.root.removeNode(this.root,e)}}))}static getConceptListFromIds(e,t,o){return s(this,void 0,void 0,(function*(){this.root&&this.root.checkIfIdsInNode(this.root,e,t,o)}))}static countNumberOfNodes(){return this.root?this.root.countNodeBelow(this.root):0}}a.root=null},5457:(e,t,o)=>{o.d(t,{c:()=>a});var n=o(2830),i=o(7282),r=o(205);class c{constructor(e,t){this.value=[],this.height=1,this.key=e,this.value.push(t),this.leftNode=null,this.rightNode=null,this.currentNode=null}addType(e,t,o){var n,i,r,s;if(null==e)return new c(t,o);if(t<e.key)e.leftNode=this.addType(e.leftNode,t,o);else{if(!(t>e.key))return e.value.push(o),e;e.rightNode=this.addType(e.rightNode,t,o)}e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1;const a=this.getBalanceFactor(e);return a>1&&t<(null===(n=e.leftNode)||void 0===n?void 0:n.key)?this.rightRotate(e):a<-1&&t>(null===(i=e.rightNode)||void 0===i?void 0:i.key)?this.leftRotate(e):a>1&&t>(null===(r=e.leftNode)||void 0===r?void 0:r.key)?(e.leftNode=this.leftRotate(e.leftNode),this.rightRotate(e)):a<-1&&t<(null===(s=e.rightNode)||void 0===s?void 0:s.key)?(e.rightNode=this.rightRotate(e.rightNode),this.leftRotate(e)):e}rightRotate(e){if(e){let t=e.leftNode;if(t){let o=t.rightNode;return e.leftNode=o,t.rightNode=e,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode))+1,t}}return e}leftRotate(e){if(e){let t=e.rightNode;if(t){let o=t.leftNode;return t.leftNode=e,e.rightNode=o,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(e.rightNode))+1,t}}return e}getHeight(e){return e?e.height:0}getBalanceFactor(e){return null==e?0:this.getHeight(e.leftNode)-this.getHeight(e.rightNode)}getFromNode(e,t){return t?e==t.key?t:e<t.key?this.getFromNode(e,t.leftNode):e>t.key?this.getFromNode(e,t.rightNode):t:t}removeNodeWithVariants(e,t,o){if(null==e)return e;if(e.key>t)return e.leftNode=this.removeNodeWithVariants(e.leftNode,t,o),e;if(e.key<t)return e.rightNode=this.removeNodeWithVariants(e.rightNode,t,o),e;if(e.value.length>0)for(let t=0;t<e.value.length;t++)if(o==e.value[t])return e.value.splice(t,1),e;if(null==e.leftNode){let t=e.rightNode;return e=null,t}if(null==e.rightNode){let t=e.leftNode;return e=null,t}{let t=this.inOrderSuccessor(e.rightNode);return e.value=t.value,e.key=t.key,e.currentNode=t.currentNode,e.rightNode=this.removeNodeWithVariants(e.rightNode,t.key,o),e}}countNodeBelow(e){return null==e?0:1+this.countNodeBelow(e.leftNode)+this.countNodeBelow(e.rightNode)}inOrderSuccessor(e){for(;null!=e.leftNode;)e=e.leftNode;return e}}var s=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class a{static addType(e){return s(this,void 0,void 0,(function*(){return null==this.root?(this.root=e,new CustomEvent(`${e.key}`,{detail:e.value[0]}),(0,n.dispatchIdEvent)(e.key,{detail:e.value[0]}),this.root):(new CustomEvent(`${e.key}`,{detail:e.value[0]}),(0,n.dispatchIdEvent)(e.key,{detail:e.value[0]}),this.root=this.root.addType(this.root,e.key,e.value[0]),this.root)}))}static addConceptToTree(e){if(0!=e.typeId){let t=new c(e.typeId,e.id);this.addType(t)}}static removeTypeConcept(e,t){this.root&&(this.root=this.root.removeNodeWithVariants(this.root,e,t))}static getNodeFromTreeNew(e){return this.root?this.root.getFromNode(e,this.root):this.root}static getTypeVariantsFromTreeNew(e){return s(this,void 0,void 0,(function*(){let t=this.getNodeFromTreeNew(e),o=[],i=[];if(t){o=t.value;for(let e=0;e<o.length;e++){let t=!1;for(let n=0;n<i.length;n++)i[n].id==o[e]&&(t=!0);t||i.push(yield(0,n.GetTheConcept)(o[e]))}}return i}))}static waitForDataToLoad(){return s(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(r.B.isTypeLoaded)return e("done");setTimeout(a.checkFlag,1e3,e)}static getTypeVariantsFromTreeWithUserIdNew(e,t){return s(this,void 0,void 0,(function*(){let o=[],n=yield this.getTypeVariantsFromTreeNew(e);console.log("these are all the concepts",n);for(let e=0;e<n.length;e++)n[e].userId==t&&o.push(n[e]);return o}))}static getTypeVariantsWithCharacterValueNew(e,t){return s(this,void 0,void 0,(function*(){let o=yield this.getTypeVariantsFromTreeNew(t);console.log("this is all the concepts for character",o);let n=(0,i.o)();for(let t=0;t<o.length;t++)o[t].characterValue==e&&(n=o[t]);return n}))}static countNumberOfNodes(){return this.typeRoot?this.typeRoot.countNodeBelow(this.typeRoot):0}}a.typeRoot=null,a.root=null},2615:(e,t,o)=>{o.d(t,{j:()=>i});var n=o(2830);class i{constructor(e,t,o,i,r,c,s,a=!1,l,d,u){this.count=0,this.typeCharacter="",this.isComposition=!1,this.isTemp=!1,this.isSynced=!1,this.applicationId=n.BaseUrl.getRandomizer(),this.x=0,this.y=0,this.id=e,this.userId=t,this.typeId=o,this.ghostId=e,this.categoryId=i,this.referentId=r,this.characterValue=`${c}`,this.accessId=s,this.typeCharacter=u,this.type=null,this.isNew=a,this.entryTimeStamp=l,this.updatedTimeStamp=d}getType(){console.log(this.typeId)}}},9639:(e,t,o)=>{o.d(t,{I:()=>d});var n=o(3655),i=o(2202),r=o(6963),c=o(5457),s=o(7282),a=o(2830),l=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class d{constructor(){this.name="conceptsArray"}static CheckContains(e){for(var t=!1,o=0;o<this.conceptsArray.length;o++)this.conceptsArray[o].id==e.id&&(t=!0);return t}static AddNpc(e){this.NPC.includes(e)||(this.NPC.length>10&&(this.NPC=[]),this.NPC.push(e))}static GetNpc(e){return!!this.NPC.includes(e)}static AddConceptToStorage(e){e.id>0&&(0,n.kH)("concept",e)}static GetConceptBulkData(e,t,o){return l(this,void 0,void 0,(function*(){yield i.W.getConceptListFromIds(e,t,o)}))}static AddConcept(e){if(a.serviceWorker)try{(0,a.sendMessage)("ConceptsData__AddConcept",{concept:e})}catch(e){console.error("Concept Data, Add Concpet sw error: ",e),(0,a.handleServiceWorkerException)(e)}e.id>0&&(i.W.addConceptToTree(e),c.c.addConceptToTree(e))}static AddConceptToMemory(e){e.id>0&&(i.W.addConceptToTree(e),c.c.addConceptToTree(e))}static AddConceptTemporary(e){var t=this.CheckContains(e);this.conceptDictionary[e.id]=e,t&&this.RemoveConcept(e),this.conceptsArray.push(e)}static RemoveConcept(e){for(var t=0;t<this.conceptsArray.length;t++)this.conceptsArray[t].id==e.id&&this.conceptsArray.splice(t,1);(0,n.wh)("concept",e.id)}static GetConcept(e){return l(this,void 0,void 0,(function*(){if(a.serviceWorker)try{return(yield(0,a.sendMessage)("ConceptsData__GetConcept",{id:e})).data}catch(e){console.error("Concept Data, Get Concpet sw error: ",e),(0,a.handleServiceWorkerException)(e)}if(0==e||null==e||null==e)return(0,s.o)();var t=(0,s.o)(),o=yield i.W.getNodeFromTree(e);if(null==o?void 0:o.value){var n=o.value;n&&(t=n)}return t}))}static GetConceptByCharacter(e){return l(this,void 0,void 0,(function*(){var t=(0,s.o)(),o=r.f.getNodeFromTree(e);return o&&(t=o.value),t}))}static GetConceptByCharacterUpdated(e){return l(this,void 0,void 0,(function*(){var t=(0,s.o)(),o=r.f.getNodeFromTree(e);return o&&(t=o.value),t}))}static GetConceptByCharacterAndTypeLocal(e,t){return l(this,void 0,void 0,(function*(){return(0,s.o)(),yield c.c.getTypeVariantsWithCharacterValueNew(e,t)}))}static GetConceptByCharacterAndCategoryLocal(e,t){return l(this,void 0,void 0,(function*(){var o=(0,s.o)(),n=yield r.f.getCharacterAndCategoryFromTree(e,t);return n&&(o=n.value),o}))}static GetConceptsByTypeId(e){let t=[];for(var o=0;o<this.conceptsArray.length;o++)this.conceptsArray[o].typeId==e&&t.push(this.conceptsArray[o]);return t}static GetConceptsByTypeIdAndUser(e,t){var o=arguments;return l(this,void 0,void 0,(function*(){if(a.Logger.logfunction("ConceptsData.GetConceptsByTypeIdAndUser",o),a.serviceWorker)try{return(yield(0,a.sendMessage)("ConceptsData__GetConceptsByTypeIdAndUser",{typeId:e,userId:t})).data}catch(e){console.error("Concept Data, Get Concpet sw error:",e),(0,a.handleServiceWorkerException)(e)}let n=[];return n=yield c.c.getTypeVariantsFromTreeWithUserIdNew(e,t),n}))}static GetBinaryCharacterTree(){return r.f.characterRoot}getName(){return this.name}}d.conceptsArray=[],d.NPC=[],d.conceptDictionary=[]},2155:(e,t,o)=>{o.d(t,{N:()=>r});var n=o(7282),i=o(9581);class r{constructor(e=0,t,o,r,c,s,a){this.count=0,this.isTemp=!1,this.toUpdate=!1,this.applicationId=i.B.getRandomizer(),this.type=(0,n.o)(),this.ofConcept=(0,n.o)(),this.toConcept=(0,n.o)(),this.id=e,this.ofTheConceptId=t,this.toTheConceptId=o,this.userId=r,this.typeId=c,this.ghostId=e,this.orderId=s,this.accessId=a,this.entryTimeStamp=new Date,this.terminationDateTime=new Date,this.localSyncTime=new Date,this.typeCharacter=""}}},5239:(e,t,o)=>{o.d(t,{O:()=>s});var n=o(205),i=o(2830);class r{constructor(e,t,o,n){this.leftNode=null,this.rightNode=null,this.variants=[],this.height=1,this.key=e,this.value=t,this.leftNode=o,this.rightNode=n,this.currentNode=null}addCurrentNode(e,t){return null==t?t=e:(e.value.typeId!=t.value.typeId&&(t.currentNode=this.addCurrentNode(e,t.currentNode)),t)}addCurrentNodeType(e,t){if(null==t)return e;let o=!1;e.value.id==t.value.id&&(o=!0);for(let n=0;n<t.variants.length;n++)t.variants[n].value.id==e.value.id&&(o=!0);return o||t.variants.push(e),t}getMax(e,t){return e>t?e:t}addNode(e,t,o){if(null==t)return e;let n=t.leftNode,i=t.rightNode;if(e.key<t.key)t.leftNode=this.addNode(e,n,o);else{if(!(e.key>t.key))return t;t.rightNode=this.addNode(e,i,o)}t.height=1+this.getMax(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let r=this.getBalanceFactor(t);if(r>1&&t.leftNode){if(this.getBalanceFactor(t.leftNode)>=0)return this.rightRotate(t);if(this.getBalanceFactor(t.leftNode)<0)return t.leftNode=this.leftRotate(t.leftNode),this.rightRotate(t)}if(r<-1&&t.rightNode){if(this.getBalanceFactor(t.rightNode)<=0)return this.leftRotate(t);if(this.getBalanceFactor(t.rightNode)>0)return t.rightNode=this.rightRotate(t.rightNode),this.leftRotate(t)}return t}addTypeNode(e,t,o){if(0!=e.value.typeId){if(null==t)return e;let n=t.leftNode,i=t.rightNode;if(t.key>e.key)t.leftNode=this.addTypeNode(e,n,o);else{if(!(t.key<e.key))return t.key==e.key&&0!=t.key&&t.addCurrentNodeType(e,t),t;t.rightNode=this.addTypeNode(e,i,o)}t.height=1+this.getMax(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let r=this.getBalanceFactor(t);if(r>1&&t.leftNode){if(e.key<t.leftNode.key){return this.rightRotate(t)}if(e.key>t.leftNode.key){return t.leftNode=this.leftRotate(t.leftNode),this.rightRotate(t)}}if(r<-1&&t.rightNode){if(e.key>t.rightNode.key){return this.leftRotate(t)}if(e.key<t.rightNode.key){return t.rightNode=this.rightRotate(t.rightNode),this.leftRotate(t)}}}return t}rightRotate(e){if(e){let t=e.leftNode;if(t){let o=t.rightNode;return e.leftNode=o,t.rightNode=e,e.height=this.getMax(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=this.getMax(this.getHeight(t.leftNode),this.getHeight(t.rightNode))+1,t}throw console.log("this is the error in right rotation",e,t),new Error("Cannot perform right rotation: left node is null.")}return e}leftRotate(e){if(e){let t=e.rightNode;if(t){let o=t.leftNode;return t.leftNode=e,e.rightNode=o,e.height=this.getMax(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=this.getMax(this.getHeight(t.leftNode),this.getHeight(e.rightNode))+1,t}throw console.log("this is the error in left rotation",e,t),new Error("Cannot perform left rotation: right node is null.")}return e}getHeight(e){return e?e.height:0}getBalanceFactor(e){return null==e?0:this.getHeight(e.leftNode)-this.getHeight(e.rightNode)}getFromNode(e,t){try{if(t)return e==t.key?(t.value.count?t.value.count++:t.value.count=1,t):e<t.key?this.getFromNode(e,t.leftNode):e>t.key?this.getFromNode(e,t.rightNode):t}catch(o){console.log("this is the exception",e,t,null==t?void 0:t.leftNode,null==t?void 0:t.rightNode)}return t}getCharacterFromNode(e,t){return t?e==t.key?t:e<t.key?this.getCharacterFromNode(e,t.leftNode):e>t.key?this.getCharacterFromNode(e,t.rightNode):t:t}checkIfIdsInNode(e,t,o,n){if(e){if(t.includes(e.key)){o.push(e.value);let n=t.indexOf(e.key);t.splice(n,1)}e.leftNode&&this.checkIfIdsInNode(e.leftNode,t,o,n),e.rightNode&&this.checkIfIdsInNode(e.rightNode,t,o,n)}}traverse(e){let t=0;return e&&(t+=1,(null==e?void 0:e.leftNode)&&(t+=this.traverse(e.leftNode)),e.rightNode&&(t+=this.traverse(e.rightNode))),t}removeNode(e,t){if(null==e)return e;if(e.key>t)return e.leftNode=this.removeNode(e.leftNode,t),e;if(e.key<t)return e.rightNode=this.removeNode(e.rightNode,t),e;if(new Event(`${e.value.ofTheConceptId}`),(0,i.dispatchIdEvent)(e.value.ofTheConceptId),null==e.leftNode){let t=e.rightNode;return e=null,t}if(null==e.rightNode){let t=e.leftNode;return e=null,t}{let t=this.inOrderSuccessor(e.rightNode);return e.value=t.value,e.key=t.key,e.variants=t.variants,e.currentNode=t.currentNode,e.rightNode=this.removeNode(e.rightNode,t.key),e}}removeNodeWithVariants(e,t,o){if(null==e)return e;if(e.key>t)return e.leftNode=this.removeNodeWithVariants(e.leftNode,t,o),e;if(e.key<t)return e.rightNode=this.removeNodeWithVariants(e.rightNode,t,o),e;if(e.variants.length>0)if(e.value.id==o){let t=e.variants[0];if(t)return e.value=t.value,e.key=t.key,e.currentNode=t.currentNode,e.variants.splice(0,1),e}else for(let t=0;t<e.variants.length;t++)if(o==e.variants[t].value.id)return e.variants.splice(t,1),e;if(null==e.leftNode){let t=e.rightNode;return e=null,t}if(null==e.rightNode){let t=e.leftNode;return e=null,t}{let t=this.inOrderSuccessor(e.rightNode);return e.value=t.value,e.key=t.key,e.variants=t.variants,e.currentNode=t.currentNode,e.rightNode=this.removeNodeWithVariants(e.rightNode,t.key,o),e}}inOrderSuccessor(e){for(;null!=e.leftNode;)e=e.leftNode;return e}}var c=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class s{static addNodeToTree(e){try{if(null==this.connectionroot)return this.connectionroot=e,this.connectionroot;this.connectionroot=this.connectionroot.addNode(e,this.connectionroot,this.connectionroot.height)}catch(e){throw console.log("This is the error in making the tree",e),e}}static addConnectionToTree(e){let t=new r(e.id,e,null,null);this.addNodeToTree(t)}static traverse(){var e;return null===(e=this.connectionroot)||void 0===e?void 0:e.traverse(this.connectionroot)}static waitForDataToLoad(){return c(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(n.B.isConnectionLoaded)return e("done");setTimeout(s.checkFlag,1e3,e)}static removeNodeFromTree(e){return c(this,void 0,void 0,(function*(){this.connectionroot&&(this.connectionroot=this.connectionroot.removeNode(this.connectionroot,e))}))}static getNodeFromTree(e){return c(this,void 0,void 0,(function*(){try{return this.connectionroot?this.connectionroot.getFromNode(e,this.connectionroot):this.connectionroot}catch(t){console.log("this is the getNodeFromTree",e,this.connectionroot)}}))}static getConnectionListFromIds(e,t,o){return c(this,void 0,void 0,(function*(){this.connectionroot&&this.connectionroot.checkIfIdsInNode(this.connectionroot,e,t,o)}))}}s.connectionroot=null},991:(e,t,o)=>{o.d(t,{H:()=>s});var n=o(2830),i=o(3996);class r extends i.i{constructor(e,t,o,n){super(e,t,o,n),this.key="",this.value=[],this.height=1,this.key=e,this.value=t,this.leftNode=o,this.rightNode=n}addNode(e,t,o){if(null==t)return e;let n=t.leftNode,i=t.rightNode;if(t.key>e.key)t.leftNode=this.addNode(e,n,o);else{if(!(t.key<e.key))return t;t.rightNode=this.addNode(e,i,o)}t.height=1+Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let r=this.getBalanceFactor(t);if(r>1&&t.leftNode){if(this.getBalanceFactor(t.leftNode)>=0)return this.rightRotate(t);if(this.getBalanceFactor(t.leftNode)<0)return t.leftNode=this.leftRotate(t.leftNode),this.rightRotate(t)}if(r<-1&&t.rightNode){if(this.getBalanceFactor(t.rightNode)<=0)return this.leftRotate(t);if(this.getBalanceFactor(t.rightNode)>0)return t.rightNode=this.rightRotate(t.rightNode),this.leftRotate(t)}return t}}var c=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class s{static CreateCompositionKey(e,t){return e}static GetConnectionByOfTheConceptAndTypeId(e,t){let o=this.CreateCompositionKey(e,t);if(this.node){let e=this.node.getFromNode(o,this.node);if(e)return e.value}return null}static addConnection(e){if(e.id>0){let t=this.CreateCompositionKey(e.ofTheConceptId,e.typeId);if(this.node){let o=this.node.getFromNode(t,this.node);if(o){let t=null==o?void 0:o.value;0==t.length&&(o.value=[]),t.includes(e.id)||t.push(e.id)}else{let o=[];o.push(e.id);let n=new r(t,o,null,null);this.addNodeToTree(n)}}else{let o=[];o.push(e.id);let n=new r(t,o,null,null);this.addNodeToTree(n)}new Event(`${t}`)}else console.log("cannot insert key id with n 0 to the connection tree",e)}static addNodeToTree(e){return c(this,void 0,void 0,(function*(){return null==this.node?(this.node=e,(0,n.dispatchIdEvent)(e.key),this.node):(this.node=this.node.addNode(e,this.node,this.node.height),this.node)}))}static removeNodeFromTree(e){return c(this,void 0,void 0,(function*(){this.node&&(this.node=this.node.removeNode(this.node,e))}))}}s.node=null},3996:(e,t,o)=>{o.d(t,{i:()=>n});class n{constructor(e,t,o,n){this.key="",this.value=[],this.height=1,this.key=e,this.value=t,this.leftNode=o,this.rightNode=n}getFromNode(e,t){return t?e==t.key?t:e<t.key?this.getFromNode(e,t.leftNode):e>t.key?this.getFromNode(e,t.rightNode):t:t}rightRotate(e){if(e){let t=e.leftNode;if(t){let o=t.rightNode;return e.leftNode=o,t.rightNode=e,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode))+1,t}}return e}leftRotate(e){if(e){let t=e.rightNode;if(t){let o=t.leftNode;return t.leftNode=e,e.rightNode=o,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(e.rightNode))+1,t}}return e}getHeight(e){return e?e.height:0}getBalanceFactor(e){return null==e?0:this.getHeight(e.leftNode)-this.getHeight(e.rightNode)}removeNode(e,t){if(null==e)return e;if(e.key>t)return e.leftNode=this.removeNode(e.leftNode,t),e;if(e.key<t)return e.rightNode=this.removeNode(e.rightNode,t),e;if(null==e.leftNode){let t=e.rightNode;return e=null,t}if(null==e.rightNode){let t=e.leftNode;return e=null,t}{let t=this.inOrderSuccessor(e.rightNode);return e.value=t.value,e.key=t.key,e.variants=t.variants,e.currentNode=t.currentNode,e.rightNode=this.removeNode(e.rightNode,t.key),e}}inOrderSuccessor(e){for(;null!=e.leftNode;)e=e.leftNode;return e}}},8286:(e,t,o)=>{o.d(t,{d:()=>f});var n=o(1735),i=o(2830),r=o(3655),c=o(1863),s=o(2155),a=o(5239),l=o(991),d=o(3996);class u extends d.i{constructor(e,t,o,n){super(e,t,o,n),this.key="",this.value=[],this.height=1,this.key=e,this.value=t,this.leftNode=o,this.rightNode=n}addNode(e,t,o){if(null==t)return e;let n=t.leftNode,i=t.rightNode;if(t.key>e.key)t.leftNode=this.addNode(e,n,o);else{if(!(t.key<e.key))return t;t.rightNode=this.addNode(e,i,o)}t.height=1+Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let r=this.getBalanceFactor(t);if(r>1&&t.leftNode){if(e.key<t.leftNode.key)return this.rightRotate(t);if(e.key>t.leftNode.key)return t.leftNode=this.leftRotate(t.leftNode),this.rightRotate(t)}if(r<-1&&t.rightNode){if(e.key>t.rightNode.key)return this.leftRotate(t);if(e.key<t.rightNode.key)return t.rightNode=this.rightRotate(t.rightNode),this.leftRotate(t)}return t}}class h{static CreateCompositionKey(e){return e}static addNodeToTree(e){return t=this,o=void 0,i=function*(){return null==this.connectionTypeRoot?(this.connectionTypeRoot=e,this.connectionTypeRoot):(this.connectionTypeRoot=this.connectionTypeRoot.addNode(e,this.connectionTypeRoot,this.connectionTypeRoot.height),this.connectionTypeRoot)},new((n=void 0)||(n=Promise))((function(e,r){function c(e){try{a(i.next(e))}catch(e){r(e)}}function s(e){try{a(i.throw(e))}catch(e){r(e)}}function a(t){var o;t.done?e(t.value):(o=t.value,o instanceof n?o:new n((function(e){e(o)}))).then(c,s)}a((i=i.apply(t,o||[])).next())}));var t,o,n,i}static addConnectionToTree(e){if(e.id>0){let t=this.CreateCompositionKey(e.typeId);if(this.connectionTypeRoot){let o=this.connectionTypeRoot.getFromNode(t,this.connectionTypeRoot);if(o){let t=null==o?void 0:o.value;0==t.length&&(o.value=[]),t.includes(e.id)||t.push(e.id)}else{let o=[];o.push(e.id);let n=new u(t,o,null,null);this.addNodeToTree(n)}}else{let o=[];o.push(e.id);let n=new u(t,o,null,null);this.addNodeToTree(n)}}else console.log("cannot insert key id with n 0 to the connection tree",e)}static GetConnectionByOfTheConceptAndTypeId(e,t){let o=this.CreateCompositionKey(t);if(this.connectionTypeRoot){let e=this.connectionTypeRoot.getFromNode(o,this.connectionTypeRoot);if(e)return e.value}return null}}h.connectionTypeRoot=null;var p=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class f{constructor(){this.name="Connection Array"}static CheckContains(e){let t=!1;for(let o=0;o<this.connectionArray.length;o++)this.connectionArray[o].id==e.id&&(t=!0);return t}static AddConnectionToStorage(e){(0,r.kH)("connection",e)}static AddConnection(e){try{a.O.addConnectionToTree(e),h.addConnectionToTree(e),l.H.addConnection(e)}catch(e){throw console.log("this is the error in making the connection"),e}}static AddConnectionToMemory(e){e.isTemp||(a.O.addConnectionToTree(e),h.addConnectionToTree(e),l.H.addConnection(e))}static AddToDictionary(e){this.connectionDictionary[e.id]=e}static RemoveConnection(e){0!=e.id&&((0,r.wh)("connection",e.id),a.O.removeNodeFromTree(e.id),l.H.removeNodeFromTree(e.id))}static GetConnectionTypeOfTree(){l.H.node}static GetConnectionByOfTheConceptAndType(e,t){return p(this,void 0,void 0,(function*(){try{if(i.serviceWorker)try{return(yield(0,i.sendMessage)("ConnectionData__GetConnectionByOfTheConceptAndType",{ofTheConceptId:e,typeId:t})).data}catch(e){console.error("GetConnectionByOfTheConceptAndType sw error: ",e),(0,i.handleServiceWorkerException)(e)}return l.H.GetConnectionByOfTheConceptAndTypeId(e,t)||[]}catch(e){return console.log("this is the error in GetConnectionByOfTheConceptAndType",e),[]}}))}static GetConnectionByOfType(e,t){const o=i.Logger.logfunction("ConnectionData.GetConnectionByOfType",arguments);let n=h.GetConnectionByOfTheConceptAndTypeId(e,t);return n?(i.Logger.logUpdate(o),n):(i.Logger.logUpdate(o),[])}static GetConnectionTree(){return a.O.connectionroot}static GetConnectionTypeTree(){return h.connectionTypeRoot}static GetConnectionBulkData(e,t,o){return p(this,void 0,void 0,(function*(){yield a.O.getConnectionListFromIds(e,t,o)}))}static GetConnection(e){return p(this,void 0,void 0,(function*(){n.J.incrementConnection(e);let t=new s.N(0,0,0,0,0,0,0);try{if(i.serviceWorker)try{return(yield(0,i.sendMessage)("ConnectionData__GetConnection",{id:e})).data}catch(e){console.error("GetConnection sw error: ",e),(0,i.handleServiceWorkerException)(e)}let o=yield a.O.getNodeFromTree(e);if(null==o?void 0:o.value){let e=o.value;e&&(t=e)}return t}catch(e){return console.log("this is the error in GetConnection",e),t}}))}static GetConnectionsOfCompositionLocal(e){var t=arguments;return p(this,void 0,void 0,(function*(){const o=i.Logger.logfunction("ConnectionData.GetConnectionsOfCompositionLocal",t);let n=[];try{if(i.serviceWorker){o.serviceWorker=!0;try{const t=yield(0,i.sendMessage)("ConnectionData__GetConnectionsOfCompositionLocal",{id:e});return i.Logger.logUpdate(o),t.data}catch(e){console.error("GetConnectionsOfCompositionLocal sw error: ",e),(0,c.ey)(o,"GetConnectionsOfCompositionLocal",e),(0,i.handleServiceWorkerException)(e)}}let t=[];t=f.GetConnectionByOfType(e,e);for(let e=0;e<t.length;e++){let r=yield a.O.getNodeFromTree(t[e]);r&&n.push(r.value),i.Logger.logUpdate(o)}}catch(t){console.log("this is the error GetConnectionsOfCompositionLocal",e,n),(0,c.ey)(o,"ConnectionData.GetConnectionsOfCompositionLocal",t)}return n}))}static GetConnectionsOfConcept(e){return p(this,void 0,void 0,(function*(){let t=[],o=[];try{if(i.serviceWorker)try{return(yield(0,i.sendMessage)("ConnectionData__GetConnectionsOfConcept",{id:e})).data}catch(e){console.error("GetConnectionsOfConcept sw error: ",e),(0,i.handleServiceWorkerException)(e)}t=yield f.GetConnectionByOfTheConceptAndType(e,e);for(let e=0;e<t.length;e++){let n=yield a.O.getNodeFromTree(t[e]);n&&o.push(n.value)}return o}catch(e){return console.log("this is the error in GetConnectionsOfConcept",e),o}}))}getName(){return this.name}}f.connectionArray=[],f.connectionDictionary=[]},205:(e,t,o)=>{o.d(t,{B:()=>n});class n{}n.isTypeLoaded=!1,n.isCharacterLoaded=!1,n.isDataLoaded=!1,n.isLocalDataLoaded=!1,n.isLocalCharacterLoaded=!1,n.isLocalTypeLoaded=!1,n.isConnectionLoaded=!1,n.isConnectionTypeLoaded=!1,n.isLocalConnectionLoaded=!1},2515:(e,t,o)=>{o.d(t,{x:()=>n});class n{constructor(e,t,o,n){this.variants=[],this.height=1,this.key=e,this.value=t,this.leftNode=o,this.rightNode=n,this.currentNode=null}addCurrentNode(e,t){return null==t?t=e:(e.value.typeId!=t.value.typeId&&(t.currentNode=this.addCurrentNode(e,t.currentNode)),t)}addCurrentNodeType(e,t){if(null==t)return e;var o=!1;for(let n=0;n<t.variants.length;n++)t.variants[n].value.id==e.value.id&&(o=!0);return o||t.variants.push(e),t}addNode(e,t,o){if(null==t)return e;var n=t.leftNode,i=t.rightNode;if(t.key>e.key)t.leftNode=this.addNode(e,n,o);else{if(!(t.key<e.key))return t;t.rightNode=this.addNode(e,i,o)}t.height=1+Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let r=this.getBalanceFactor(t);if(r>1&&t.leftNode){if(e.key<t.leftNode.key)return this.rightRotate(t);if(e.key>t.leftNode.key)return t.leftNode=this.leftRotate(t.leftNode),this.rightRotate(t)}if(r<-1&&t.rightNode){if(e.key>t.rightNode.key)return this.leftRotate(t);if(e.key<t.rightNode.key)return t.rightNode=this.rightRotate(t.rightNode),this.leftRotate(t)}return t}addCharacterNode(e,t,o){if(""!=e.value.characterValue){if(null==t)return e;var n=t.leftNode,i=t.rightNode;if(t.key>e.key)t.leftNode=this.addCharacterNode(e,n,o);else{if(!(t.key<e.key))return t.key==e.key&&""!=t.key&&t.value.id!=e.value.id&&t.addCurrentNodeType(e,t),t;t.rightNode=this.addCharacterNode(e,i,o)}t.height=1+Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let r=this.getBalanceFactor(t);if(r>1&&t.leftNode){if(e.key<t.leftNode.key)return this.rightRotate(t);if(e.key>t.leftNode.key)return t.leftNode=this.leftRotate(t.leftNode),this.rightRotate(t)}if(r<-1&&t.rightNode){if(e.key>t.rightNode.key)return this.leftRotate(t);if(e.key<t.rightNode.key)return t.rightNode=this.rightRotate(t.rightNode),this.leftRotate(t)}}return t}addTypeNode(e,t,o){if(0!=e.value.typeId){if(null==t)return e;var n=t.leftNode,i=t.rightNode;if(t.key>e.key)t.leftNode=this.addTypeNode(e,n,o);else{if(!(t.key<e.key))return t.key==e.key&&0!=t.key&&t.value.id!=e.value.id&&t.addCurrentNodeType(e,t),t;t.rightNode=this.addTypeNode(e,i,o)}t.height=1+Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let r=this.getBalanceFactor(t);if(r>1&&t.leftNode){if(e.key<t.leftNode.key)return this.rightRotate(t);if(e.key>t.leftNode.key)return t.leftNode=this.leftRotate(t.leftNode),this.rightRotate(t)}if(r<-1&&t.rightNode){if(e.key>t.rightNode.key)return this.leftRotate(t);if(e.key<t.rightNode.key)return t.rightNode=this.rightRotate(t.rightNode),this.leftRotate(t)}}return t}rightRotate(e){if(e){let t=e.leftNode;if(t){let o=t.rightNode;return e.leftNode=o,t.rightNode=e,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode))+1,t}}return e}leftRotate(e){if(e){let t=e.rightNode;if(t){let o=t.leftNode;return t.leftNode=e,e.rightNode=o,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(e.rightNode))+1,t}}return e}getHeight(e){return e?e.height:0}getBalanceFactor(e){return null==e?0:this.getHeight(e.leftNode)-this.getHeight(e.rightNode)}getFromNode(e,t){return t?e==t.key?t:e<t.key?this.getFromNode(e,t.leftNode):e>t.key?this.getFromNode(e,t.rightNode):t:t}updateNodeSyncStatus(e,t,o){if(o){if(e==o.key){let e=o.value;return e.isSynced=t,o.value=e,o}return e<o.key?this.updateNodeSyncStatus(e,t,o.leftNode):e>o.key?this.updateNodeSyncStatus(e,t,o.rightNode):o}return o}getCharacterFromNode(e,t){return t?e==t.key?t:e<t.key?this.getCharacterFromNode(e,t.leftNode):e>t.key?this.getCharacterFromNode(e,t.rightNode):t:t}getFromNodeWithCharacterAndType(e,t,o){if(e=`${e}`,o){if(e==o.key){if(e==o.value.characterValue&&t==o.value.typeId)return o;for(let e=0;e<o.variants.length;e++)if(o.variants[e].value.typeId==t)return o.variants[e]}else{if(e<o.key)return this.getFromNodeWithCharacterAndType(e,t,o.leftNode);if(e>o.key)return this.getFromNodeWithCharacterAndType(e,t,o.rightNode)}return null}return o}getFromNodeWithCharacterAndCategory(e,t,o){if(e=`${e}`,o){if(e==o.key){if(e==o.value.characterValue&&t==o.value.categoryId)return o;for(let e=0;e<o.variants.length;e++)if(o.variants[e].value.categoryId==t)return o.variants[e]}else{if(e<o.key)return this.getFromNodeWithCharacterAndCategory(e,t,o.leftNode);if(e>o.key)return this.getFromNodeWithCharacterAndCategory(e,t,o.rightNode)}return null}return o}removeNode(e,t){if(null==e)return e;if(e.key>t)return e.leftNode=this.removeNode(e.leftNode,t),e;if(e.key<t)return e.rightNode=this.removeNode(e.rightNode,t),e;if(null==e.leftNode){let t=e.rightNode;return e=null,t}if(null==e.rightNode){let t=e.leftNode;return e=null,t}var o=this.inOrderSuccessor(e.rightNode);return e.value=o.value,e.key=o.key,e.variants=o.variants,e.currentNode=o.currentNode,e.rightNode=this.removeNode(e.rightNode,o.key),e}removeNodeWithVariants(e,t,o){if(null==e)return e;if(e.key>t)return e.leftNode=this.removeNodeWithVariants(e.leftNode,t,o),e;if(e.key<t)return e.rightNode=this.removeNodeWithVariants(e.rightNode,t,o),e;if(e.variants.length>0)if(e.value.id==o){var n=e.variants[0];if(n)return e.value=n.value,e.key=n.key,e.currentNode=n.currentNode,e.variants.splice(0,1),e}else for(let t=0;t<e.variants.length;t++)if(o==e.variants[t].value.id)return e.variants.splice(t,1),e;if(null==e.leftNode){let t=e.rightNode;return e=null,t}if(null==e.rightNode){let t=e.leftNode;return e=null,t}var i=this.inOrderSuccessor(e.rightNode);return e.value=i.value,e.key=i.key,e.variants=i.variants,e.currentNode=i.currentNode,e.rightNode=this.removeNodeWithVariants(e.rightNode,i.key,o),e}countNodeBelow(e){return null==e?0:1+this.countNodeBelow(e.leftNode)+this.countNodeBelow(e.rightNode)}inOrderSuccessor(e){for(;null!=e.leftNode;)e=e.leftNode;return e}}},9736:(e,t,o)=>{o.d(t,{v:()=>g});var n=o(205),i=o(2515),r=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class c{static addNodeToTree(e){if(null==this.root)return this.root=e,this.root;this.root=this.root.addNode(e,this.root,this.root.height)}static addConceptToTree(e){var t=new i.x(e.id,e,null,null);new i.x(e.characterValue,e,null,null),this.addNodeToTree(t)}static waitForDataToLoad(){return r(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(n.B.isLocalDataLoaded)return e("done");setTimeout(c.checkFlag,1e3,e)}static getNodeFromTree(e){return r(this,void 0,void 0,(function*(){return this.root?this.root.getFromNode(e,this.root):null}))}static getCharacterAndTypeFromTree(e,t){return this.root?this.root.getFromNodeWithCharacterAndType(e,t,this.root):this.root}static updateSyncStatus(e){return this.root?this.root.updateNodeSyncStatus(e,!0,this.root):this.root}static removeNodeFromTree(e){return r(this,void 0,void 0,(function*(){this.root&&(this.root=this.root.removeNode(this.root,e))}))}}c.root=null;var s=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class a{static waitForDataToLoad(){return s(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(n.B.isLocalCharacterLoaded)return e("done");setTimeout(a.checkFlag,1e3,e)}static addNodeToTree(e){return s(this,void 0,void 0,(function*(){return null==this.LocalCharacterRoot?(this.LocalCharacterRoot=e,this.LocalCharacterRoot):(this.LocalCharacterRoot=this.LocalCharacterRoot.addCharacterNode(e,this.LocalCharacterRoot,this.LocalCharacterRoot.height),this.LocalCharacterRoot)}))}static addConceptToTree(e){if(""!=e.characterValue){var t=new i.x(e.characterValue,e,null,null);this.addNodeToTree(t)}}static getNodeFromTree(e){return this.LocalCharacterRoot?this.LocalCharacterRoot.getCharacterFromNode(e,this.LocalCharacterRoot):this.LocalCharacterRoot}static getCharacterAndTypeFromTree(e,t){return s(this,void 0,void 0,(function*(){return this.LocalCharacterRoot?this.LocalCharacterRoot.getFromNodeWithCharacterAndType(e,t,this.LocalCharacterRoot):this.LocalCharacterRoot}))}static getCharacterAndCategoryFromTree(e,t){return s(this,void 0,void 0,(function*(){return this.LocalCharacterRoot?this.LocalCharacterRoot.getFromNodeWithCharacterAndCategory(e,t,this.LocalCharacterRoot):this.LocalCharacterRoot}))}static removeConceptType(e,t){this.LocalCharacterRoot&&(this.LocalCharacterRoot=this.LocalCharacterRoot.removeNodeWithVariants(this.LocalCharacterRoot,e,t))}}a.LocalCharacterRoot=null;var l=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class d{static addNodeToTree(e){return l(this,void 0,void 0,(function*(){return null==this.LocalTypeRoot?(this.LocalTypeRoot=e,this.LocalTypeRoot):(this.LocalTypeRoot=this.LocalTypeRoot.addTypeNode(e,this.LocalTypeRoot,this.LocalTypeRoot.height),this.LocalTypeRoot)}))}static addConceptToTree(e){if(0!=e.typeId){var t=new i.x(e.typeId,e,null,null);this.addNodeToTree(t)}}static removeConceptType(e,t){this.LocalTypeRoot&&(this.LocalTypeRoot=this.LocalTypeRoot.removeNodeWithVariants(this.LocalTypeRoot,e,t))}static getNodeFromTree(e){return this.LocalTypeRoot?this.LocalTypeRoot.getFromNode(e,this.LocalTypeRoot):this.LocalTypeRoot}static getTypeVariantsFromTree(e){var t=this.getNodeFromTree(e),o=[];if(t){o.push(null==t?void 0:t.value);for(let e=0;e<t.variants.length;e++)o.push(t.variants[e].value);return o}}static waitForDataToLoad(){return l(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(n.B.isLocalTypeLoaded)return e("done");setTimeout(d.checkFlag,1e3,e)}static getTypeVariantsFromTreeWithUserId(e,t){return l(this,void 0,void 0,(function*(){var o=[],n=this.getNodeFromTree(e);if(n){console.log("this is the node to type",n),n.value.userId!=t&&999!=n.value.userId||o.push(null==n?void 0:n.value);for(let e=0;e<n.variants.length;e++)n.variants[e].value.userId!=t&&999!=n.value.userId||o.push(n.variants[e].value)}return o}))}}d.LocalTypeRoot=null;var u=o(6416),h=o(9639),p=o(7820),f=o(4864),y=o(628),v=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class g{constructor(){this.name="conceptsArray"}static AddConcept(e){0!=e.id&&(c.addConceptToTree(e),a.addConceptToTree(e),d.addConceptToTree(e),this.localconceptsArray.push(e))}static AddPermanentConcept(e){0!=e.id&&(c.removeNodeFromTree(e.ghostId),a.removeConceptType(e.characterValue,e.ghostId),d.removeConceptType(e.typeId,e.ghostId),p.G.addConceptToTree(e),h.I.AddConcept(e))}static RemoveConcept(e){return v(this,void 0,void 0,(function*(){try{0!=e.id&&(c.removeNodeFromTree(e.ghostId),a.removeConceptType(e.characterValue,e.ghostId),d.removeConceptType(e.typeId,e.ghostId))}catch(e){throw e}}))}static RemoveConceptById(e){return v(this,void 0,void 0,(function*(){try{let t=yield g.GetConcept(e);0!=t.id&&(c.removeNodeFromTree(e),a.removeConceptType(t.characterValue,t.ghostId),d.removeConceptType(t.typeId,t.ghostId),y.H.RemoveConcept(t))}catch(e){throw e}}))}static AddConceptToMemory(e){0!=e.id&&(c.addConceptToTree(e),a.addConceptToTree(e),d.addConceptToTree(e))}static GetConcept(e){return v(this,void 0,void 0,(function*(){var t=(0,u.u)(),o=yield c.getNodeFromTree(e);if(null==o?void 0:o.value){var n=o.value;n&&(t=n)}return t}))}static UpdateConceptSyncStatus(e){return v(this,void 0,void 0,(function*(){c.updateSyncStatus(e)}))}static GetConceptByGhostId(e){return v(this,void 0,void 0,(function*(){var t=(0,u.u)(),o=yield p.G.getNodeFromTree(e);if(null==o?void 0:o.value){var n=o.value;n&&(t=n)}return t}))}static GetConceptByCharacter(e){return v(this,void 0,void 0,(function*(){var t=(0,u.u)(),o=a.getNodeFromTree(e);return o&&(t=o.value),t}))}static GetConceptByCharacterAndTypeLocal(e,t){return v(this,void 0,void 0,(function*(){var o=(0,u.u)(),n=yield a.getCharacterAndTypeFromTree(e,t);return n&&(o=n.value),o}))}static GetConceptByCharacterAndCategoryLocal(e,t){return v(this,void 0,void 0,(function*(){var o=(0,u.u)(),n=yield a.getCharacterAndCategoryFromTree(e,t);return n&&(o=n.value),o}))}static GetConceptsByTypeId(e){let t=[];for(var o=0;o<this.localconceptsArray.length;o++)this.localconceptsArray[o].typeId==e&&t.push(this.localconceptsArray[o]);return t}static GetConceptsByTypeIdAndUser(e,t){return v(this,void 0,void 0,(function*(){let o=[];return o=yield d.getTypeVariantsFromTreeWithUserId(e,t),o}))}static ClearData(){return v(this,void 0,void 0,(function*(){this.localconceptsArray=[],f.G.connectionArray=[]}))}getName(){return this.name}}g.localconceptsArray=[]},4864:(e,t,o)=>{o.d(t,{G:()=>a});var n=o(2155),i=o(8286),r=o(205),c=o(628),s=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class a{constructor(){this.name="Connection Array"}static CheckContains(e){for(var t=!1,o=0;o<this.connectionArray.length;o++)this.connectionArray[o].id==e.id&&(t=!0);return t}static AddConnection(e){this.CheckContains(e)&&this.RemoveConnection(e),e.id,this.connectionArray.push(e)}static AddConnectionToMemory(e){this.CheckContains(e)&&this.RemoveConnection(e),this.connectionArray.push(e)}static AddToDictionary(e){this.connectionDictionary[e.id]=e}static RemoveConnection(e){for(var t=0;t<this.connectionArray.length;t++)this.connectionArray[t].id==e.id&&this.connectionArray.splice(t,1);e.id}static RemoveConnectionById(e){for(var t=0;t<this.connectionArray.length;t++)this.connectionArray[t].id==e&&this.connectionArray.splice(t,1);c.H.RemoveConnectionById(e)}static AddPermanentConnection(e){e.id>0&&i.d.AddConnection(function(e){let t=new n.N(0,0,0,0,0,0,0);return t.ofTheConceptId=e.ofTheConceptId,t.toTheConceptId=e.toTheConceptId,t.typeId=e.typeId,t.orderId=e.orderId,t.id=e.id,t}(e))}static GetConnection(e){var t;t=null;for(var o=0;o<this.connectionArray.length;o++)this.connectionArray[o].id==e&&(t=this.connectionArray[o]);return t}static waitForDataToLoad(){return s(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(r.B.isLocalConnectionLoaded)return e("done");setTimeout(a.checkFlag,1e3,e)}static GetConnectionsOfCompositionLocal(e){return s(this,void 0,void 0,(function*(){var t=[];try{for(var o=0;o<this.connectionArray.length;o++)this.connectionArray[o].typeId==e&&t.push(this.connectionArray[o]);return t}catch(e){return t}}))}static GetConnectionOfCompositionAndTypeLocal(e,t){return s(this,void 0,void 0,(function*(){var o=[];try{for(var n=0;n<this.connectionArray.length;n++)this.connectionArray[n].typeId==e&&this.connectionArray[n].ofTheConceptId==t&&o.push(this.connectionArray[n]);return o}catch(e){return o}}))}getName(){return this.name}}a.connectionArray=[],a.connectionDictionary=[]},7820:(e,t,o)=>{o.d(t,{G:()=>c});var n=o(205),i=o(2515),r=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class c{static addNodeToTree(e){if(null==this.root)return this.root=e,this.root;this.root=this.root.addNode(e,this.root,this.root.height)}static addConceptToTree(e){var t=new i.x(e.ghostId,e,null,null);this.addNodeToTree(t)}static waitForDataToLoad(){return r(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(n.B.isLocalDataLoaded)return e("done");setTimeout(c.checkFlag,1e3,e)}static getNodeFromTree(e){return r(this,void 0,void 0,(function*(){return this.root?this.root.getFromNode(e,this.root):null}))}static removeNodeFromTree(e){return r(this,void 0,void 0,(function*(){this.root&&(this.root=this.root.removeNode(this.root,e))}))}}c.root=null},5257:(e,t,o)=>{o.d(t,{R:()=>c});var n=o(9003),i=o(3075),r=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class c{static AddConceptId(e){this.localId=e.value,(0,n.kH)("localid",e)}static getConceptId(){return r(this,void 0,void 0,(function*(){try{if(this.localId){if(this.ReservedLocalId.length<5){yield(0,i.EO)().then((()=>{let e=this.localId;for(let t=1;t<10;t++){let o=this.localId-t;this.ReservedLocalId.push(o),e=o}this.AddConceptId({id:0,value:e})})).catch((e=>(console.log(" getid: cannot get the id from indexdb"),-Math.floor(1e8*Math.random()))));let e=this.ReservedLocalId[0];return this.ReservedLocalId.shift(),e}{let e=this.ReservedLocalId[0];return this.ReservedLocalId.shift(),e}}return yield(0,i.EO)().then((()=>{let e=this.localId;for(let t=1;t<10;t++){let o=this.localId-t;this.ReservedLocalId.push(o),e=o}this.AddConceptId({id:0,value:e})})),this.getConceptId()}catch(e){return console.log(" getid: this is the eror in concept",e),-Math.floor(1e8*Math.random())}}))}static AddConnectionId(e){this.localConnectionId=e.value}static getConnectionId(){return r(this,void 0,void 0,(function*(){try{if(this.localConnectionId){if(this.ReservedConnectionId.length<5){yield(0,i.xd)().then((()=>{let e=this.localConnectionId;for(let t=1;t<10;t++){let o=this.localConnectionId-t;this.ReservedConnectionId.push(o),e=o}})).catch((e=>(console.log("this is the new event",e),-Math.floor(1e8*Math.random()))));let e=this.ReservedConnectionId[0];return this.ReservedConnectionId.shift(),e}{let e=this.ReservedConnectionId[0];return this.ReservedConnectionId.shift(),e}}return yield(0,i.xd)().then((()=>{let e=this.localConnectionId;for(let t=1;t<10;t++){let o=this.localConnectionId-t;this.ReservedConnectionId.push(o),e=o}this.AddConnectionId({id:1,value:e})})),this.getConnectionId()}catch(e){return-Math.floor(1e8*Math.random())}}))}}c.ReservedLocalId=[],c.ReservedConnectionId=[]},628:(e,t,o)=>{o.d(t,{H:()=>y});var n=o(9581),i=o(3278),r=o(2830),c=o(1863),s=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};const a=(e,t)=>s(void 0,void 0,void 0,(function*(){let o={concepts:[],connections:[]};try{const r=new Headers;let s={concepts:e,connections:t};r.set("Content-Type","application/json"),r.set("Authorization","Bearer "+i.b.BearerAccessToken),r.set("Accept","application/json"),r.set("Randomizer",n.B.getRandomizer().toString());const a=yield fetch(n.B.CreateGhostConceptApiUrl(),{method:"POST",headers:r,body:JSON.stringify(s)});if(!a.ok)throw(0,c.ry)(a),new Error(`Error! status: ${a.status}`);const l=yield a.json();return o.concepts=l.concepts,o.connections=l.connections,o}catch(e){throw e instanceof Error?console.log("Create the concept api error message: ",e.message):console.log("Create the concept api unexpected error: ",e),e}}));function l(e,t){const o=[];for(let n=0;n<e.length;n+=t){const i=e.slice(n,n+t);o.push(i)}return o}const d=(...e)=>s(void 0,[...e],void 0,(function*(e=[]){return yield Promise.all(e.map((e=>{let t=JSON.parse(JSON.stringify(e));return delete t.type,delete t.ofConcept,delete t.toConcept,t})))}));var u=o(9003),h=o(9736),p=o(4864),f=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class y{static CheckContains(e){for(var t=!1,o=0;o<this.conceptsSyncArray.length;o++)this.conceptsSyncArray[o].id==e.id&&(t=!0);return t}static SyncDataDelete(e){for(var t=0;t<this.conceptsSyncArray.length;t++)e==this.conceptsSyncArray[t].id&&this.conceptsSyncArray.splice(t,1);for(t=0;t<this.connectionSyncArray.length;t++)this.connectionSyncArray[t].ofTheConceptId!=e&&this.connectionSyncArray[t].toTheConceptId!=e&&this.connectionSyncArray[t].typeId!=e||this.connectionSyncArray.splice(t,1)}static CheckContainsConnection(e){for(var t=!1,o=0;o<this.connectionSyncArray.length;o++)this.connectionSyncArray[o].id==e.id&&(t=!0);return t}static AddConcept(e){try{let t=!1;0!=y.CheckIfTheConceptIdExists(e.id,this.conceptsSyncArray).id&&(t=!0),t||this.conceptsSyncArray.push(e)}catch(e){throw e}}static RemoveConcept(e){for(var t=0;t<this.conceptsSyncArray.length;t++)this.conceptsSyncArray[t].id==e.id&&this.conceptsSyncArray.splice(t,1)}static SyncDataOnline(e,t){return f(this,void 0,void 0,(function*(){let o=performance.now();try{if(r.serviceWorker)try{return(yield(0,r.sendMessage)("LocalSyncData__SyncDataOnline",{transactionId:e})).data}catch(e){console.error("LocalSyncData__SyncDataOnline sw error: ",e),(0,r.handleServiceWorkerException)(e)}let o=[],n=[];if(e&&this.transactionCollections.some((t=>t.id==e))){const t=this.transactionCollections.find((t=>t.id==e));if(this.transactionCollections=this.transactionCollections.filter((t=>t.id!=e)),this.transactionCollections=this.transactionCollections.filter((e=>new Date(e.createdDate).getTime()>(new Date).getTime()-6048e5)),!t)return;o=t.data.concepts.slice(),n=t.data.connections.slice()}else Array.isArray(null==t?void 0:t.concepts)&&Array.isArray(null==t?void 0:t.connections)?(o=t.concepts.filter((e=>this.conceptsSyncArray.some((t=>e.id==t.id||e.ghostId==t.ghostId)))).slice(),n=t.connections.filter((e=>this.connectionSyncArray.some((t=>e.id==t.id||e.ghostId==t.ghostId)))).slice(),this.conceptsSyncArray=this.conceptsSyncArray.filter((e=>!t.concepts.some((t=>e.id==t.id||e.ghostId==t.ghostId)))),this.connectionSyncArray=this.connectionSyncArray.filter((e=>!t.connections.some((t=>e.id==t.id||e.ghostId==t.ghostId))))):(console.warn("Syncing this way has been Depreceted in service worker."),console.info("Only if serive worker is not running"),o=this.conceptsSyncArray.slice()||[],n=this.connectionSyncArray.slice()||[]);this.connectionSyncArray=[],this.conceptsSyncArray=[];let i=[];for(let e=0;e<o.length;e++)i.push(o[e]),yield h.v.UpdateConceptSyncStatus(o[e].id);yield this.UpdateConceptListToIncludeRelatedConcepts(n,i);let u=yield function(e,t){return s(this,void 0,void 0,(function*(){const o=r.Logger.logfunction("CreateTheGhostConceptApi",[e.length,t.length]);try{const n=1e3;let i={concepts:[],connections:[]};const c=yield d(e),s=yield d(t);if(e.length+t.length<=2*n){const e=yield a(c,s);return Array.isArray(null==e?void 0:e.concepts)&&(i.concepts=[...i.concepts,...e.concepts]),Array.isArray(null==e?void 0:e.connections)&&(i.connections=[...i.connections,...e.connections]),r.Logger.logUpdate(o),i}const u=l(c,n),h=l(s,n),p=[],f=[];for(let e=0;e<u.length;e++){const t=u[e];p.push(a(t,[]))}const y=yield Promise.all(p);for(let e=0;e<y.length;e++){const t=y[e];Array.isArray(null==t?void 0:t.concepts)&&(i.concepts=[...i.concepts,...t.concepts]),Array.isArray(null==t?void 0:t.connections)&&(i.connections=[...i.connections,...t.connections])}for(let e=0;e<h.length;e++){const t=h[e];f.push(a([],t))}const v=yield Promise.all(f);for(let e=0;e<v.length;e++){const t=v[e];Array.isArray(null==t?void 0:t.concepts)&&(i.concepts=[...i.concepts,...t.concepts]),Array.isArray(null==t?void 0:t.connections)&&(i.connections=[...i.connections,...t.connections])}return r.Logger.logUpdate(o),i}catch(e){throw console.log(e),(0,c.ey)(o,"CreateTheGhostConceptApi",e),e}}))}(i,n),f=u.concepts,y=u.connections;for(let e=0;e<f.length;e++)h.v.AddPermanentConcept(f[e]);for(let e=0;e<y.length;e++)p.G.AddPermanentConnection(y[e]);return o}catch(e){throw r.Logger.logError(o,"unknown",void 0,"unknown",void 0,500,e,"SyncDataOnline",[],"unknown",void 0),e}}))}static ConvertGhostIdsInConnections(e){var t,o,n;for(let i=0;i<e.length;i++){let r=e[i].ofTheConceptId,c=e[i].toTheConceptId,s=e[i].typeId,a=null!==(t=y.ghostIdMap.get(r))&&void 0!==t?t:r,l=null!==(o=y.ghostIdMap.get(c))&&void 0!==o?o:c,d=null!==(n=y.ghostIdMap.get(s))&&void 0!==n?n:s;e[i].ofTheConceptId=a,e[i].toTheConceptId=l,e[i].typeId=d}}static UpdateConceptListToIncludeRelatedConcepts(e,t){return f(this,void 0,void 0,(function*(){for(let o=0;o<e.length;o++){let n=e[o].ofTheConceptId,i=e[o].toTheConceptId,r=e[o].typeId;if(n<0){let i=this.CheckIfTheConceptIdExists(n,t);0==i.id&&(i=yield h.v.GetConceptByGhostId(n),0!=i.id?i.id!=i.ghostId&&(e[o].ofTheConceptId=i.id):(i=yield h.v.GetConcept(n),this.AddConceptIfDoesNotExist(i,t)))}if(i<0){let n=this.CheckIfTheConceptIdExists(i,t);0==n.id&&(n=yield h.v.GetConceptByGhostId(i),0!=n.id?n.id!=n.ghostId&&(e[o].toTheConceptId=n.id):(n=yield h.v.GetConcept(i),this.AddConceptIfDoesNotExist(n,t)))}if(r<0){let n=this.CheckIfTheConceptIdExists(r,t);0==n.id&&(n=yield h.v.GetConceptByGhostId(r),0!=n.id?n.id!=n.ghostId&&(e[o].typeId=n.id):(n=yield h.v.GetConcept(r),this.AddConceptIfDoesNotExist(n,t)))}}}))}static AddConceptIfDoesNotExist(e,t=[]){let o=!1;for(let n=0;n<t.length;n++)e.ghostId==t[n].ghostId&&(o=!0);o||t.push(e)}static CheckIfTheConceptIdExists(e,t=[]){let o=(0,r.CreateDefaultLConcept)();for(let n=0;n<t.length;n++)e!=t[n].ghostId&&e!=t[n].id||(o=t[n]);return o}static AddConnection(e){this.connectionSyncArray.push(e)}static RemoveConnection(e){for(var t=0;t<this.connectionSyncArray.length;t++)this.connectionSyncArray[t].id==e.id&&this.connectionSyncArray.splice(t,1)}static RemoveConnectionById(e){for(var t=0;t<this.connectionSyncArray.length;t++)this.connectionSyncArray[t].id==e&&this.connectionSyncArray.splice(t,1)}static syncDataLocalDb(){return f(this,void 0,void 0,(function*(){if(this.conceptsSyncArray.length>0){for(let e=0;e<this.conceptsSyncArray.length;e++)(0,u.kH)("localconcept",this.conceptsSyncArray[e]);this.conceptsSyncArray=[]}if(this.connectionSyncArray.length>0){for(let e=0;e<this.connectionSyncArray.length;e++)(0,u.kH)("localconnection",this.connectionSyncArray[e]);this.connectionSyncArray=[]}return"done"}))}static initializeTransaction(e){return f(this,void 0,void 0,(function*(){try{if(r.serviceWorker)try{return(yield(0,r.sendMessage)("LocalSyncData__initializeTransaction",{transactionId:e})).data}catch(e){console.error("LocalSyncData__initializeTransaction sw error: ",e),(0,r.handleServiceWorkerException)(e)}if(this.transactionCollections.some((t=>t.id==e)))return;this.transactionCollections.push({id:e,data:{concepts:[],connections:[]},createdDate:(new Date).toISOString()})}catch(e){console.log("error in initializeTransaction",e)}}))}static markTransactionActions(e,t){return f(this,void 0,void 0,(function*(){try{if(r.serviceWorker)try{return(yield(0,r.sendMessage)("LocalSyncData__markTransactionActions",{transactionId:e,actions:t})).data}catch(e){console.error("LocalSyncData__markTransactionActions sw error: ",e),(0,r.handleServiceWorkerException)(e)}this.transactionCollections=this.transactionCollections.map((o=>o.id==e?Object.assign(Object.assign({},o),{data:JSON.parse(JSON.stringify(t))}):o)),this.conceptsSyncArray=this.conceptsSyncArray.filter((e=>!t.concepts.some((t=>t.id==e.id||t.ghostId==e.id)))),this.connectionSyncArray=this.connectionSyncArray.filter((e=>!t.connections.some((t=>t.id==e.id||t.ghostId==e.id))))}catch(e){console.log("error in markTransactionActions",e)}}))}static rollbackTransaction(e,t){return f(this,void 0,void 0,(function*(){try{if(r.serviceWorker)try{return(yield(0,r.sendMessage)("LocalSyncData__rollbackTransaction",{transactionId:e,actions:t})).data}catch(e){console.error("LocalSyncData__rollbackTransaction sw error: ",e),(0,r.handleServiceWorkerException)(e)}if(this.transactionCollections.some((t=>t.id==e)))return;this.transactionCollections=this.transactionCollections.filter((t=>t.id!=e))}catch(e){console.log("LocalSyncData, roll",e)}}))}}y.conceptsSyncArray=[],y.connectionSyncArray=[],y.ghostIdMap=new Map,y.transactionCollections=[]},6731:(e,t,o)=>{o.d(t,{b:()=>n});class n{constructor(e,t,o,n){this.variants=[],this.height=1,this.key=e,this.value=t,this.leftNode=o,this.rightNode=n,this.currentNode=null}addCurrentNode(e,t){return null==t?t=e:(e.value.typeId!=t.value.typeId&&(t.currentNode=this.addCurrentNode(e,t.currentNode)),t)}addCurrentNodeType(e,t){if(null==t)return e;let o=!1;for(let n=0;n<t.variants.length;n++)t.variants[n].value.id==e.value.id&&(o=!0);return o||t.variants.push(e),t}addNode(e,t,o){if(null==t)return e;let n=t.leftNode,i=t.rightNode;if(t.key>e.key)t.leftNode=this.addNode(e,n,o);else{if(!(t.key<e.key))return t;t.rightNode=this.addNode(e,i,o)}t.height=1+Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let r=this.getBalanceFactor(t);if(r>1&&t.leftNode){if(e.key<t.leftNode.key)return this.rightRotate(t);if(e.key>t.leftNode.key)return t.leftNode=this.leftRotate(t.leftNode),this.rightRotate(t)}if(r<-1&&t.rightNode){if(e.key>t.rightNode.key)return this.leftRotate(t);if(e.key<t.rightNode.key)return t.rightNode=this.rightRotate(t.rightNode),this.leftRotate(t)}return t}checkIfIdsInNode(e,t,o,n){if(e){if(t.includes(e.key)){o.push(e.value);let n=t.indexOf(e.key);t.splice(n,1)}e.leftNode&&this.checkIfIdsInNode(e.leftNode,t,o,n),e.rightNode&&this.checkIfIdsInNode(e.rightNode,t,o,n)}}addCharacterNode(e,t,o){if(""!=e.value.characterValue){if(null==t)return e;let n=t.leftNode,i=t.rightNode;if(t.key>e.key)t.leftNode=this.addCharacterNode(e,n,o);else{if(!(t.key<e.key))return t.key==e.key&&""!=t.key&&t.value.id!=e.value.id&&t.addCurrentNodeType(e,t),t;t.rightNode=this.addCharacterNode(e,i,o)}t.height=1+Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let r=this.getBalanceFactor(t);if(r>1&&t.leftNode){if(e.key<t.leftNode.key){return this.rightRotate(t)}if(e.key>t.leftNode.key){return t.leftNode=this.leftRotate(t.leftNode),this.rightRotate(t)}}if(r<-1&&t.rightNode){if(e.key>t.rightNode.key){return this.leftRotate(t)}if(e.key<t.rightNode.key){return t.rightNode=this.rightRotate(t.rightNode),this.leftRotate(t)}}}return t}addTypeNode(e,t,o){if(0!=e.value.typeId){if(null==t)return console.log("adding the type node to the tree",e),e;let n=t.leftNode,i=t.rightNode;if(t.key>e.key)t.leftNode=this.addTypeNode(e,n,o);else{if(!(t.key<e.key))return console.log("adding the type node to the tree down",e),t.key==e.key&&0!=t.key&&t.value.id!=e.value.id&&t.addCurrentNodeType(e,t),console.log("adding the type node to the tree last",t),t;t.rightNode=this.addTypeNode(e,i,o)}t.height=1+Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let r=this.getBalanceFactor(t);if(r>1&&t.leftNode){if(e.key<t.leftNode.key){return this.rightRotate(t)}if(e.key>t.leftNode.key){return t.leftNode=this.leftRotate(t.leftNode),this.rightRotate(t)}}if(r<-1&&t.rightNode){if(e.key>t.rightNode.key){return this.leftRotate(t)}if(e.key<t.rightNode.key){return t.rightNode=this.rightRotate(t.rightNode),this.leftRotate(t)}}}return t}rightRotate(e){if(e){let t=e.leftNode;if(t){let o=t.rightNode;return e.leftNode=o,t.rightNode=e,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode))+1,t}}return e}leftRotate(e){if(e){let t=e.rightNode;if(t){let o=t.leftNode;return t.leftNode=e,e.rightNode=o,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(e.rightNode))+1,t}}return e}getHeight(e){return e?e.height:0}getBalanceFactor(e){return null==e?0:this.getHeight(e.leftNode)-this.getHeight(e.rightNode)}getFromNode(e,t){return t?e==t.key?t:e<t.key?this.getFromNode(e,t.leftNode):e>t.key?this.getFromNode(e,t.rightNode):t:t}getCharacterFromNode(e,t){return t?e==t.key?t:e<t.key?this.getCharacterFromNode(e,t.leftNode):e>t.key?this.getCharacterFromNode(e,t.rightNode):t:t}getCharacterFromNodeUpdated(e,t){var o;return t?e==t.key||51==(null===(o=t.value)||void 0===o?void 0:o.typeId)?t:e<t.key?this.getCharacterFromNode(e,t.leftNode):e>t.key?this.getCharacterFromNode(e,t.rightNode):t:t}getFromNodeWithCharacterAndType(e,t,o){if(e=`${e}`,o){if(e==o.key){if(e==o.value.characterValue&&t==o.value.typeId)return o;for(let e=0;e<o.variants.length;e++)if(o.variants[e].value.typeId==t)return o.variants[e]}else{if(e<o.key)return this.getFromNodeWithCharacterAndType(e,t,o.leftNode);if(e>o.key)return this.getFromNodeWithCharacterAndType(e,t,o.rightNode)}return null}return o}getFromNodeWithCharacterAndCategory(e,t,o){if(e=`${e}`,o){if(e==o.key){if(e==o.value.characterValue&&t==o.value.categoryId)return o;for(let e=0;e<o.variants.length;e++)if(o.variants[e].value.categoryId==t)return o.variants[e]}else{if(e<o.key)return this.getFromNodeWithCharacterAndCategory(e,t,o.leftNode);if(e>o.key)return this.getFromNodeWithCharacterAndCategory(e,t,o.rightNode)}return null}return o}removeNode(e,t){if(null==e)return e;if(e.key>t)return e.leftNode=this.removeNode(e.leftNode,t),e;if(e.key<t)return e.rightNode=this.removeNode(e.rightNode,t),e;if(null==e.leftNode){let t=e.rightNode;return e=null,t}if(null==e.rightNode){let t=e.leftNode;return e=null,t}{let t=this.inOrderSuccessor(e.rightNode);return e.value=t.value,e.key=t.key,e.variants=t.variants,e.currentNode=t.currentNode,e.rightNode=this.removeNode(e.rightNode,t.key),e}}removeNodeWithVariants(e,t,o){if(null==e)return e;if(e.key>t)return e.leftNode=this.removeNodeWithVariants(e.leftNode,t,o),e;if(e.key<t)return e.rightNode=this.removeNodeWithVariants(e.rightNode,t,o),e;if(e.variants.length>0)if(e.value.id==o){let t=e.variants[0];if(t)return e.value=t.value,e.key=t.key,e.currentNode=t.currentNode,e.variants.splice(0,1),e}else for(let t=0;t<e.variants.length;t++)if(o==e.variants[t].value.id)return e.variants.splice(t,1),e;if(null==e.leftNode){let t=e.rightNode;return e=null,t}if(null==e.rightNode){let t=e.leftNode;return e=null,t}{let t=this.inOrderSuccessor(e.rightNode);return e.value=t.value,e.key=t.key,e.variants=t.variants,e.currentNode=t.currentNode,e.rightNode=this.removeNodeWithVariants(e.rightNode,t.key,o),e}}countNodeBelow(e){return null==e?0:1+this.countNodeBelow(e.leftNode)+this.countNodeBelow(e.rightNode)}inOrderSuccessor(e){for(;null!=e.leftNode;)e=e.leftNode;return e}}},5976:(e,t,o)=>{o.d(t,{p:()=>l,B:()=>a});var n=o(9581),i=o(3518),r=o(1863),c=o(2830),s=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class a{static getId(){return s(this,void 0,void 0,(function*(){this.ids.length<5&&(yield function(){var e,t,o,s,l=arguments;return e=this,t=void 0,s=function*(){const e=c.Logger.logfunction("GetReservedIds",l);try{let t=(0,i.Xr)("application/x-www-form-urlencoded");const o=yield fetch(n.B.GetReservedIdUrl(),{method:"GET",headers:t});if(!o.ok)throw(0,r.ry)(o),new Error(`Error! status: ${o.status}`);const s=yield o.json();for(let e=0;e<s.length;e++)a.AddId(s[e]);c.Logger.logUpdate(e)}catch(t){t instanceof Error?console.log("get reserved ids error message: ",t.message):console.log("get reserved ids unexpected error: ",t),(0,r.Mb)(t,n.B.GetReservedIdUrl()),(0,r.ey)(e,"GetReservedIds",t)}},new((o=void 0)||(o=Promise))((function(n,i){function r(e){try{a(s.next(e))}catch(e){i(e)}}function c(e){try{a(s.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?n(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(r,c)}a((s=s.apply(e,t||[])).next())}))}());var e=this.ids[0];return this.ids.shift(),e}))}static AddId(e){this.ids.includes(e)||this.ids.push(e)}}a.ids=[];class l{static getId(){return s(this,void 0,void 0,(function*(){this.connectionIds.length<5&&(yield function(){var e,t,o,s,a=arguments;return e=this,t=void 0,s=function*(){const e=c.Logger.logfunction("GetReservedConnectionIds",a);try{let t=(0,i.Xr)("application/x-www-form-urlencoded");const o=yield fetch(n.B.GetReservedConnectionIdUrl(),{method:"GET",headers:t});if(!o.ok)throw(0,r.ry)(o),new Error(`Error! status: ${o.status}`);const s=yield o.json();for(let e=0;e<s.length;e++)l.AddId(s[e]);c.Logger.logUpdate(e)}catch(t){t instanceof Error?console.log("get reserved connection ids error message: ",t.message):console.log("get reserved connection ids unexpected error: ",t),(0,r.Mb)(t,n.B.GetReservedConnectionIdUrl()),(0,r.ey)(e,"GetReservedConnectionIds",t)}},new((o=void 0)||(o=Promise))((function(n,i){function r(e){try{a(s.next(e))}catch(e){i(e)}}function c(e){try{a(s.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?n(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(r,c)}a((s=s.apply(e,t||[])).next())}))}());var e=this.connectionIds[0];return this.connectionIds.shift(),e}))}static AddId(e){this.connectionIds.includes(e)||this.connectionIds.push(e)}}l.connectionIds=[]},7273:(e,t,o)=>{o.d(t,{z:()=>i});var n=o(9581);class i{constructor(e,t,o,i){this.url=n.B.BASE_URL,this.message=e,this.ok=t,this.status=o,this.data=i}getMessage(){return this.message}setMessage(e){return this.message=e,this}getStatus(){return this.status}setStatus(e){return this.status=e,this}getData(){return this.data}setData(e){return this.data=e,this}getOk(){return this.ok}setOk(e){return this.ok=e,this}getUrl(){return this.url}setUrl(e){return this.url=e,this}}},3278:(e,t,o)=>{o.d(t,{b:()=>n});class n{}n.BearerAccessToken="",n.sessionId=998},2299:(e,t,o)=>{o.d(t,{B:()=>n});class n{constructor(e){this.id=1,this.isOnlineSync=!1,this.isOnlineSync=e}}},442:(e,t,o)=>{o.d(t,{Y:()=>u});var n=o(1167),i=o(2155),r=o(9581),c=o(3518),s=o(1863),a=o(9639),l=o(8286),d=o(2830);class u{static CheckContains(e){for(var t=!1,o=0;o<this.conceptsSyncArray.length;o++)this.conceptsSyncArray[o].id==e.id&&(t=!0);return t}static SyncDataDelete(e){for(var t=0;t<this.conceptsSyncArray.length;t++)e==this.conceptsSyncArray[t].id&&this.conceptsSyncArray.splice(t,1);for(t=0;t<this.connectionSyncArray.length;t++)this.connectionSyncArray[t].ofTheConceptId!=e&&this.connectionSyncArray[t].toTheConceptId!=e&&this.connectionSyncArray[t].typeId!=e||this.connectionSyncArray.splice(t,1)}static CheckContainsConnection(e){for(var t=!1,o=0;o<this.connectionSyncArray.length;o++)this.connectionSyncArray[o].id==e.id&&(t=!0);return t}static AddConcept(e){this.conceptsSyncArray.push(e)}static RemoveConcept(e){for(var t=0;t<this.conceptsSyncArray.length;t++)this.conceptsSyncArray[t].id==e.id&&this.conceptsSyncArray.splice(t,1)}static AddConnection(e){this.connectionSyncArray.push(e)}static RemoveConnection(e){for(var t=0;t<this.connectionSyncArray.length;t++)this.connectionSyncArray[t].id==e.id&&this.connectionSyncArray.splice(t,1)}static SyncDataOnline(){return e=this,t=void 0,u=function*(){if(d.serviceWorker)try{return(yield(0,d.sendMessage)("SyncData__SyncDataOnline",{})).data}catch(e){console.error("SyncData__SyncDataOnline sw error: ",e),(0,d.handleServiceWorkerException)(e)}for(let e=0;e<this.conceptsSyncArray.length;e++)a.I.AddConcept(this.conceptsSyncArray[e]);for(let e=0;e<this.connectionSyncArray.length;e++)l.d.AddConnection(this.connectionSyncArray[e]);if(this.conceptsSyncArray.length>0){let e=this.conceptsSyncArray.slice();this.conceptsSyncArray=[],(0,n.Y)(e)}if(this.connectionSyncArray.length>0){let e=this.connectionSyncArray.slice();this.connectionSyncArray=[],yield function(e){return t=this,o=void 0,a=function*(){let t=new i.N(0,0,0,0,0,0,0);try{var o=(0,c.Xr)(),n=JSON.stringify(e);const i=yield fetch(r.B.CreateTheConnectionUrl(),{method:"POST",headers:o,body:n});return i.ok?yield i.json():(console.log("Create the connection error message: ",i.status),(0,s.ry)(i)),t}catch(e){throw e instanceof Error?console.log("Create the connection error message: ",e.message):console.log(" Create the connection unexpected error: ",e),e}},new((n=void 0)||(n=Promise))((function(e,i){function r(e){try{s(a.next(e))}catch(e){i(e)}}function c(e){try{s(a.throw(e))}catch(e){i(e)}}function s(t){var o;t.done?e(t.value):(o=t.value,o instanceof n?o:new n((function(e){e(o)}))).then(r,c)}s((a=a.apply(t,o||[])).next())}));var t,o,n,a}(e)}return"done"},new((o=void 0)||(o=Promise))((function(n,i){function r(e){try{s(u.next(e))}catch(e){i(e)}}function c(e){try{s(u.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?n(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(r,c)}s((u=u.apply(e,t||[])).next())}));var e,t,o,u}}u.conceptsSyncArray=[],u.connectionSyncArray=[]},9003:(e,t,o)=>{o.d(t,{S5:()=>l,kH:()=>u,qI:()=>a});var n=o(1863),i=o(2830),r=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};let c=10;class s{}function a(e){const t=i.Logger.logfunction("openDatabase",arguments);return new Promise((function(o,r){s.db&&(i.Logger.logUpdate(t),o(s.db));let l=i.BaseUrl.BASE_URL+"_FreeSchemaLocal"+i.BaseUrl.BASE_APPLICATION;const u=indexedDB.open(l,c);u.onupgradeneeded=e=>{var t=e.target.result,n="localconcept",r="localconnection",s="localid";console.log("this is the version upgrade",c),t.objectStoreNames.contains(n)&&t.deleteObjectStore(n),t.objectStoreNames.contains(r)&&t.deleteObjectStore(r),t.objectStoreNames.contains(s)&&t.deleteObjectStore(s),t.objectStoreNames.contains(n)||(t.createObjectStore(n,{keyPath:"id"}).transaction.oncomplete=e=>{}),t.objectStoreNames.contains(r)||(t.createObjectStore(r,{keyPath:"id"}).transaction.oncomplete=e=>{}),t.objectStoreNames.contains(s)||(t.createObjectStore(s,{keyPath:"id"}).transaction.oncomplete=e=>{d(s,{id:0,value:-100}),d(s,{id:1,value:-200}),d(s,{id:3,value:i.BaseUrl.getRandomizer()})}),o(t)},u.onerror=o=>{console.error("Why didn't you allow my web app to use IndexedDB?!",o),indexedDB.deleteDatabase(l),a(e),(0,n.ey)(t,"openDatabase",o),r(o)},u.onsuccess=function(e){var n=e.target;s.db=n.result,i.Logger.logUpdate(t),o(s.db)}}))}function l(e){var t=arguments;return r(this,void 0,void 0,(function*(){const o=i.Logger.logfunction("getObjectsFromLocalIndexDb",t);return new Promise((function(t,r){a(e).then((n=>{var r=[],c=n.transaction(e,"readwrite").objectStore(e).getAll();c.onsuccess=()=>{const e=c.result;for(var n=0;n<e.length;n++)r.push(e[n]);i.Logger.logUpdate(o),t(r)}})).catch((e=>{let t={status:400,ok:!1,message:"Cannot get objects from database because you cannot open the Local database",data:e};(0,n.ey)(o,"getObjectsFromLocalIndexDb",t),r(t)}))}))}))}function d(e,t){const o=i.Logger.logfunction("storeToDatabase",[e,"localindexdb"]);return new Promise((function(r,c){a(e).then((s=>{const a=s.transaction(e,"readwrite").objectStore(e).add(t);a.onsuccess=e=>{i.Logger.logUpdate(o),r(t)},a.onerror=i=>{let r={status:400,ok:!1,message:"Cannot store to the Local database "+e,data:i,body:t};(0,n.ey)(o,"storeToDatabase",r),c(r)}})).catch((e=>{let t={status:400,ok:!1,message:"Cannot store to database because you cannot open the Local database",data:e};(0,n.ey)(o,"storeToDatabase",t),c(t)}))}))}function u(e,t){const o=i.Logger.logfunction("UpdateToDatabase",arguments);return new Promise((function(r,c){a(e).then((s=>{const a=s.transaction(e,"readwrite").objectStore(e).put(t);a.onsuccess=e=>{i.Logger.logUpdate(o),r(t)},a.onerror=i=>{let r={status:400,ok:!1,message:"Cannot Update to the Local database"+e,data:i,body:t};(0,n.ey)(o,"UpdateToDatabase",r),c(r)}})).catch((e=>{let t={status:400,ok:!1,message:"Cannot update to database because you cannot open the Local database",data:e};(0,n.ey)(o,"UpdateToDatabase",t),c(t)}))}))}},3655:(e,t,o)=>{o.d(t,{El:()=>h,b8:()=>u,kH:()=>d,qI:()=>l,wh:()=>p});var n=o(2299),i=o(9581),r=o(2830),c=o(1863);let s=10;class a{}function l(e){const t=r.Logger.logfunction("openDatabase",[e,"indexdb"]);return new Promise((function(o,n){a.db&&(r.Logger.logUpdate(t),o(a.db));let d=i.B.BASE_URL+"_FreeSchema"+i.B.BASE_APPLICATION;const u=indexedDB.open(d,s);console.log("this is the update version",s,u),u.onupgradeneeded=e=>{let n=e.target.result,i="concept",c="connection",a="settings";console.log("this is the version update for index",s),n.objectStoreNames.contains(i)&&n.deleteObjectStore(i),n.objectStoreNames.contains(c)&&n.deleteObjectStore(c),n.objectStoreNames.contains(a)&&n.deleteObjectStore(a),n.objectStoreNames.contains(i)||(n.createObjectStore(i,{keyPath:"id"}).transaction.oncomplete=e=>{}),n.objectStoreNames.contains(c)||(n.createObjectStore(c,{keyPath:"id"}).transaction.oncomplete=e=>{}),n.objectStoreNames.contains(a)||(n.createObjectStore(a,{keyPath:"id"}).transaction.oncomplete=e=>{}),r.Logger.logUpdate(t),o(n)},u.onerror=o=>{console.error("Why didn't you allow my web app to use IndexedDB?!",o),indexedDB.deleteDatabase(d),l(e),(0,c.ey)(t,"openDatabase",o),n(o)},u.onsuccess=function(e){let n=e.target;a.db=n.result,r.Logger.logUpdate(t),o(a.db)}}))}function d(e,t){const o=r.Logger.logfunction("UpdateToDatabase",[e,"indexdb"]);return new Promise((function(n,i){l(e).then((s=>{const a=s.transaction(e,"readwrite").objectStore(e).put(t);a.onsuccess=e=>{r.Logger.logUpdate(o),n(t)},a.onerror=n=>{let r={status:400,ok:!1,message:"Cannot Update to the database"+e,data:n,body:t};(0,c.ey)(o,"UpdateToDatabase",r),i(r)}})).catch((e=>{let t={status:400,ok:!1,message:"Cannot update to database because you cannot open the database",data:e};(0,c.ey)(o,"UpdateToDatabase",t),i(t)}))}))}function u(){const e=r.Logger.logfunction("GetLastSettingsFromDatabase",["indexdb"]);return new Promise((function(t,o){let i="settings";l(i).then((s=>{let a=s.transaction(i,"readwrite").objectStore(i).getAll();a.onsuccess=()=>{let o=new n.B(!1),i=a.result;for(let e=0;e<i.length;e++)o=i[e];r.Logger.logUpdate(e),t(o)},a.onerror=t=>{(0,c.ey)(e,"GetLastSettingsFromDatabase",t),o(t)}})).catch((t=>{let n={status:400,ok:!1,message:"Cannot get last object from database because you cannot open the database",data:t};(0,c.ey)(e,"GetLastSettingsFromDatabase",n),o(n)}))}))}function h(e){const t=r.Logger.logfunction("AiUpdateFlag",["indexdb"]);return new Promise((function(o,n){let i="settings";l(i).then((s=>{const a=s.transaction(i,"readwrite").objectStore(i).put(e);a.onsuccess=n=>{r.Logger.logUpdate(t),o(e)},a.onerror=o=>{let i={status:400,ok:!1,message:"Cannot update AI flag",data:o,body:e};(0,c.ey)(t,"AiUpdateFlag",i),n(i)}})).catch((e=>{let o={status:400,ok:!1,message:"Cannot update AI flag because you cannot open the database",data:e};(0,c.ey)(t,"AiUpdateFlag",o),n(o)}))}))}function p(e,t){const o=r.Logger.logfunction("removeFromDatabase",[e,"indexdb"]);return new Promise((function(n,i){l(e).then((s=>{const a=s.transaction(e,"readwrite").objectStore(e).delete(Number(t));a.onsuccess=function(e){r.Logger.logUpdate(o),n(t)},a.onerror=t=>{let n={status:400,ok:!1,message:"Cannot remove from the database"+e,data:t};(0,c.ey)(o,"removeFromDatabase",n),i(n)}})).catch((e=>{let n={status:400,ok:!1,message:"Cannot remove from the database because you cannot open the database",data:e,body:t};(0,c.ey)(o,"removeFromDatabase",n),i(n)}))}))}},4485:(e,t,o)=>{function n(e=[],t){var o,n;let i=[],r=null===(o=t.type)||void 0===o?void 0:o.characterValue;if((null==r?void 0:r.startsWith("the_"))||(r="the_"+r),Array.isArray(e))for(let o=0;o<e.length;o++){let c=null===(n=e[o].type)||void 0===n?void 0:n.characterValue;(null==c?void 0:c.startsWith("the_"))||(c="the_"+c),t.typeId!=e[o].typeId&&r!=c||i.push(e[o])}return i}function i(e=[],t){let o=[],n=t.typeCharacter;if((null==n?void 0:n.startsWith("the_"))||(n="the_"+n),Array.isArray(e))for(let i=0;i<e.length;i++){let r=e[i].typeCharacter;(null==r?void 0:r.startsWith("the_"))||(r="the_"+r),t.typeId!=e[i].typeId&&n!=r||o.push(e[i])}return o}function r(e=[],t){let o=[];if(Array.isArray(e)){const n=e.find((e=>e.toTheConceptId==t));n&&o.push(n);const i=e.find((e=>e.ofTheConceptId==t));i&&o.push(i)}return o}function c(e=[],t){let o=[];if(Array.isArray(e)){const n=e.find((e=>e.toTheConceptId==t));n&&o.push(n);const i=e.find((e=>e.ofTheConceptId==t));i&&o.push(i)}return o}o.d(t,{gt:()=>c,nm:()=>i,vo:()=>n,wS:()=>r}),o(2155),o(7282)},9934:(e,t,o)=>{function n(e,t){return-1===e.indexOf(t)&&e.push(t),e}o.d(t,{A:()=>n})},9700:(e,t,o)=>{o.d(t,{R:()=>d,V:()=>l});var n,i=o(2830),r=o(3278),c=o(1863),s=o(3518),a=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class l{static startAutoSync(){this.autoSyncInterval?console.warn("Auto-sync is already running."):(this.nextSyncTime=Date.now()+this.SYNC_INTERVAL_MS,setInterval((()=>{const e=Date.now();this.nextSyncTime&&e>=this.nextSyncTime&&(this.nextSyncTime=e+this.SYNC_INTERVAL_MS,this.sendPackageLogsToServer(),this.sendApplicationLogsToServer())}),6e4))}static stopAutoSync(){null!==this.autoSyncInterval&&(clearInterval(this.autoSyncInterval),this.autoSyncInterval=null,this.nextSyncTime=null)}static setLogLevel(e){this.logLevel=e}static shouldLog(e){return this.LOG_LEVELS.indexOf(e)>=this.LOG_LEVELS.indexOf(this.logLevel)}static formatLogData(e,t,o){if(!this.shouldLog(e))return;const n=Object.assign({timestamp:(new Date).toLocaleString(),level:e,message:t},o);return this.packageLogsData.push(n),"ERROR"==e&&(this.sendPackageLogsToServer(),this.sendApplicationLogsToServer()),n}static log(e,t,o){if(this.logPackageActivationStatus)try{this.formatLogData(e,t,o||null)}catch(e){console.error("Error on Logger Log : ",e)}}static logUpdate(e){var t;try{if(!e)return void console.error("logUpdate failed: logData is undefined");const o=Date.now();e.startTime=null!==(t=e.startTime)&&void 0!==t?t:o;const n=o-e.startTime;e.responseTime=`${n} ms`,1==!e.serviceWorker&&(e.serviceWorker=!1)}catch(t){(0,c.ey)(e,"Logger.logUpdate",t)}}static logfunction(e,...t){const o=Date.now();let n=t;const c=i.BaseUrl.getRandomizer(),s=r.b.sessionId;let a={startTime:o,functionName:e,functionParameters:n,requestFrom:i.BaseUrl.BASE_APPLICATION,sessionId:s,applicationId:c};return this.formatLogData("INFO","function called",a)}static logError(e,t,o,n,i,r,c,s,a,l,u){try{const h=d("SessionId"),p={startTime:e,userId:t,operationType:o,requestFrom:n,requestIP:i,responseStatus:r,responseTime:`${(performance.now()-e).toFixed(3)}ms`,responseSize:c?`${JSON.stringify(c).length}`:"0",sessionId:null==h?void 0:h.toString(),functionName:s,functionParameters:a,userAgent:l,conceptsUsed:u};this.formatLogData("ERROR",`Information logged for ${s}`,p)}catch(e){console.error("Error on logError")}}static logApplication(e,t,o){if(console.log("LogApplicationActivationStatus : ",this.logApplicationActivationStatus),this.logApplicationActivationStatus)try{const n={timestamp:(new Date).toLocaleString(),type:e,message:t,data:o||null};this.applicationLogsData.push(n)}catch(e){console.error("Failed to log application activity:",e)}}static sendApplicationLogsToServer(){return a(this,void 0,void 0,(function*(){const e=this.applicationLogsData;try{if(console.log("Log from sendApplicationLogsToServer : ",this.applicationLogsData),0===this.applicationLogsData.length)return;this.applicationLogsData=[],r.b.BearerAccessToken;const t=50;let o=(0,s.Xr)();for(let n=0;n<e.length;n+=t){const r=e.slice(n,n+t),c=yield fetch(i.BaseUrl.PostLogger(),{method:"POST",headers:o,body:JSON.stringify({logType:this.appLogs,logData:r})});c.ok||(yield c.text())}}catch(e){}}))}static sendPackageLogsToServer(){return a(this,void 0,void 0,(function*(){const e=this.packageLogsData;try{if(console.log("Log from sendPackageLogsToServer : ",this.packageLogsData),0===this.packageLogsData.length)return;this.packageLogsData=[];const t=300;for(let o=0;o<e.length;o+=t){const n=e.slice(o,o+t);let r=(0,s.Xr)();const c=yield fetch(i.BaseUrl.PostLogger(),{method:"POST",headers:r,body:JSON.stringify({logType:this.mftsccsBrowser,logData:n})});if(!c.ok)return void(yield c.text())}}catch(e){}}))}static saveLogToLocalStorage(e,t){try{if(void 0===typeof localStorage)return void console.warn("Local Storage type undefined");{const o=JSON.parse((null===localStorage||void 0===localStorage?void 0:localStorage.getItem(e))||"[]");o.push(t),null===localStorage||void 0===localStorage||localStorage.setItem(e,JSON.stringify(o))}}catch(e){console.error("Error on saving log in localstorage"),this.log("ERROR","Error while saving log in local storage")}}static clearLogsFromLocalStorage(e){void 0!==typeof localStorage?null===localStorage||void 0===localStorage||localStorage.removeItem(e):console.warn("localStorage is not available")}}function d(e){try{let t=e+"=",o=decodeURIComponent(document.cookie);console.log("this is the decoded cookie",o);let n=o.split(";");for(let e=0;e<n.length;e++){let o=n[e];for(;" "==o.charAt(0);)o=o.substring(1);if(0==o.indexOf(t))return o.substring(t.length,o.length)}return""}catch(e){return console.error("Error on getcookie"),""}}n=l,l.logLevel="INFO",l.packageLogsData=[],l.applicationLogsData=[],l.LOG_LEVELS=["DEBUG","INFO","WARNING","ERROR"],l.SYNC_INTERVAL_MS=12e4,l.nextSyncTime=null,l.appLogs="app",l.mftsccsBrowser="mftsccs",l.logApplicationActivationStatus=!1,l.logPackageActivationStatus=!1,l.autoSyncInterval=null,n.startAutoSync()},1412:(e,t,o)=>{function n(e=[],t=[]){}o.d(t,{e:()=>n})},5898:(e,t,o)=>{o.d(t,{w:()=>s,V:()=>a});var n=o(7139),i=o(2830);class r{constructor(){this.conceptId=0,this.connectionTypeId=0,this.connectionType="",this.count=0}}var c=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function s(e=[]){let t=[];if(e.length>0)for(let o=0;o<e.length;o++){let n=l(e[o]);t.push(n)}return t}function a(e){var t=arguments;return c(this,void 0,void 0,(function*(){const o=i.Logger.logfunction("GetConnectionTypeForCount",t);let r={};for(let t=0;t<e.length;t++){let o=yield(0,n.r)(e[t].connectionTypeId);e[t].connectionType=o.characterValue,r[e[t].conceptId]=e[t]}return i.Logger.logUpdate(o),r}))}function l(e){const t=e.split("_");if(3===t.length){let e=new r;return e.conceptId=Number(t[0]),e.connectionTypeId=Number(t[1]),e.count=Number(t[2]),e}throw new Error("Input string must contain exactly three parts separated by underscores.")}},1863:(e,t,o)=>{o.d(t,{ER:()=>c,Mb:()=>s,ey:()=>a,ry:()=>r});var n=o(2830),i=o(7273);function r(e){if(n.Logger.log("ERROR",e.statusText,{code:e.status,data:e.statusText}),401==e.status||406==e.status){let t=new i.z(e.statusText,!1,e.status,"");throw t.setUrl(e.url),t}if(500==e.status){let t=new i.z(e.statusText,!1,e.status,"");throw t.setUrl(e.url),t}}function c(e,t={}){if(n.Logger.log("ERROR",t.statusText,{code:e.status,data:e.status}),401==e.status||406==e.status){let o=new i.z(t.statusText,!1,e.status,"");throw o.setUrl(e.url),o}if(500==e.status){let o=new i.z(t.statusText,!1,e.status,"");throw o.setUrl(e.url),o}}function s(e,t=""){if(n.Logger.log("ERROR",e.message,{code:e.status,data:e.stack}),e.status){let o=new i.z(e.message,!1,e.status,e.stack);throw o.setUrl(t),o}{let o=new i.z(e.message,!1,500,e.stack);throw o.setUrl(t),o}}function a(e,t,o){var n;try{if(!e)return void console.error(`Error in ${t}: logData is undefined`);const i=Date.now();e.startTime=null!==(n=e.startTime)&&void 0!==n?n:i,e.responseTime=i-e.startTime+" ms",e.level="ERROR",e.errorMessage=(null==o?void 0:o.message)||"Unknown error occurred"}catch(e){console.error("Failed to handle package function error:",e)}}},176:(e,t,o)=>{o.d(t,{F4:()=>c,P6:()=>a,dp:()=>s});var n=o(2155),i=o(7282),r=o(6416);function c(e){var t,o;const n=(0,r.u)();return n.id=e.id,n.ghostId=e.ghostId,n.userId=e.userId,n.accessId=e.accessId,n.categoryId=e.categoryId,n.characterValue=e.characterValue,n.entryTimeStamp=e.entryTimeStamp,n.typeId=e.typeId,n.type=e.type,n.isTemp=!1,n.typeCharacter=null!==(o=null===(t=null==e?void 0:e.type)||void 0===t?void 0:t.characterValue)&&void 0!==o?o:"",n}function s(e){const t=(0,i.o)();return t.id=e.id,t.ghostId=e.ghostId,t.userId=e.userId,t.accessId=e.accessId,t.entryTimeStamp=e.entryTimeStamp,t.typeId=e.typeId,t.categoryId=e.categoryId,t}function a(e){const t=new n.N(0,0,0,0,0,0,0);return t.id=e.id,t.ghostId=e.ghostId,t.accessId=e.accessId,t.ofTheConceptId=e.ofTheConceptId,t.toTheConceptId=e.toTheConceptId,t.entryTimeStamp=e.entryTimeStamp,t.typeId=e.typeId,t.isTemp=!1,t}},5020:(e,t,o)=>{o.d(t,{A:()=>s});var n=o(2830),i=o(9639),r=o(205),c=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function s(){return c(this,void 0,void 0,(function*(){try{let e=[];if(Array.isArray(e))for(let t=0;t<e.length;t++){let o=e[t];i.I.AddConceptToMemory(o)}r.B.isDataLoaded=!0,r.B.isCharacterLoaded=!0,r.B.isTypeLoaded=!0}catch(e){throw yield(0,n.DelayFunctionExecution)(2e3,s()),{message:"Cannot create Binary Tree Concept",ok:!1,status:400,data:e}}}))}},7282:(e,t,o)=>{o.d(t,{o:()=>i});var n=o(2615);function i(){let e=new Date,t=new Date;return new n.j(0,0,0,0,0,"0",0,!1,e,t,"0")}},1218:(e,t,o)=>{o.d(t,{A:()=>a});var n=o(2830),i=o(7282),r=o(1666),c=o(8407),s=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function a(e){return s(this,arguments,void 0,(function*(e,t=null,o=null,s=null,l=null,d=null,u=null){if(n.serviceWorker)try{return(yield(0,n.sendMessage)("CreateTheComposition",{json:e,ofTheConceptId:t,ofTheConceptUserId:o,mainKey:s,userId:l,accessId:d,sessionInformationId:u})).data}catch(e){console.error("CreateTheComposition sw error: ",e),(0,n.handleServiceWorkerException)(e)}let h=null!=l?l:999,p=null!=d?d:4,f=null!=u?u:999,y=null!=s?s:0,v=(0,i.o)();for(const n in e)if("string"!=typeof e[n]&&"number"!=typeof e[n])if(null==t&&null==o){let t=y,o=yield(0,c.A)(n,"",!0,h,p,f);v=o,t=o.id,y=o.id,yield a(e[n],o.id,o.userId,t,l,d,u)}else{let i=null!=t?t:999,s=null!=o?o:999,g=y,m=yield(0,c.A)(n,"",!0,h,p,f);v=m,yield(0,r.q)(i,s,m.id,g),yield a(e[n],m.id,m.userId,g,l,d,u)}else{let i=null!=t?t:999,s=null!=o?o:10267,a=y,l=yield(0,c.A)(n,e[n].toString(),!1,h,p,f);yield(0,r.q)(i,s,l.id,a)}return v}))}},2212:(e,t,o)=>{o.d(t,{Ay:()=>l,N:()=>d});var n=o(1167),i=o(2615),r=o(5976),c=o(442),s=o(2830),a=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function l(e,t,o,n,s,l,d){return a(this,void 0,void 0,(function*(){let a=yield r.B.getId(),u=new Date,h=new Date,p=new i.j(a,t,n,o,s,e,l,!0,u,h,d);return p.isTemp=!1,c.Y.AddConcept(p),p}))}function d(e,t,o,c,l,d,u){return a(this,void 0,void 0,(function*(){let a=yield r.B.getId(),h=new Date,p=new Date,f=new i.j(a,t,c,o,l,e,d,!1,h,p,u);return s.ConceptsData.AddConcept(f),(0,n.Y)([f]),f}))}},1666:(e,t,o)=>{o.d(t,{q:()=>c});var n=o(2155),i=o(442),r=o(1863);function c(e,t,o,c){var s=t,a=new n.N(0,e,o,s,c,1,4);if(e==o)return a.ofTheConceptId=0,a.toTheConceptId=1,a;try{a.isTemp=!0,a.id=Math.floor(1e8*Math.random()),i.Y.AddConnection(a)}catch(e){(0,r.Mb)(e)}return a}},1838:(e,t,o)=>{o.d(t,{m:()=>u});var n=o(2830),i=o(9581),r=o(1863),c=o(3518),s=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))},a=o(5239),l=o(4864),d=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function u(e){var t=arguments;return d(this,void 0,void 0,(function*(){const o=n.Logger.logfunction("DeleteConnectionById",t);if(n.serviceWorker)try{return(yield(0,n.sendMessage)("DeleteConnectionById",{id:e})).data}catch(e){console.error("DeleteConnectionById sw error: ",e),(0,n.handleServiceWorkerException)(e)}e>0?(yield function(e){var t=arguments;return s(this,void 0,void 0,(function*(){const o=n.Logger.logfunction("DeleteTheConnection",t);try{const t=new FormData;t.append("id",e.toString());let s=(0,c.BZ)();const a=yield fetch(i.B.DeleteTheConnectionUrl(),{method:"POST",headers:s,body:t,redirect:"follow"});n.Logger.logUpdate(o),a.ok||(console.log("Delete connection error status: ",a.status),(0,r.ry)(a))}catch(e){e instanceof Error?console.log("Delete connection error message: ",e.message):console.log("Delete connection unexpected error: ",e),(0,r.Mb)(e,i.B.DeleteTheConnectionUrl()),(0,r.ey)(o,"DeleteTheConnection",e)}}))}(e),a.O.removeNodeFromTree(e)):l.G.RemoveConnectionById(e),n.Logger.logUpdate(o)}))}},4364:(e,t,o)=>{o.d(t,{s:()=>c});var n=o(1239),i=o(2830),r=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function c(){return r(this,arguments,void 0,(function*(e=[]){const t=i.Logger.logfunction("FindConceptsFromConnections",[e.length]);let o=[];if(e.length>0){for(let t=0;t<e.length;t++)o.includes(e[t].ofTheConceptId)||o.push(e[t].ofTheConceptId),o.includes(e[t].toTheConceptId)||o.push(e[t].toTheConceptId),o.includes(e[t].typeId)||o.push(e[t].typeId);yield(0,n.r)(o)}i.Logger.logUpdate(t)}))}},5284:(e,t,o)=>{o.d(t,{B:()=>s});var n=o(2830),i=o(8286),r=o(1863),c=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function s(){return c(this,arguments,void 0,(function*(e=[]){const t=n.Logger.logfunction("FindConnectionsOfCompositionsBulkInMemory",[e.length]);let o=[];try{if(n.serviceWorker){t.serviceWorker=!0;try{const o=yield(0,n.sendMessage)("FindConnectionsOfCompositionsBulkInMemory",{composition_ids:e});return n.Logger.logUpdate(t),o.data}catch(e){console.error("FindConnectionsOfCompositionsBulkInMemory sw error: ",e),(0,r.ey)(t,"FindConnectionsOfCompositionsBulkInMemory",e),(0,n.handleServiceWorkerException)(e)}}for(let t=0;t<e.length;t++){let n=yield i.d.GetConnectionsOfConcept(e[t]);o.push(...n)}return n.Logger.logUpdate(t),o}catch(e){return console.error("FindConnectionsOfCompositionsBulkInMemory error: ",e),(0,r.ey)(t,"FindConnectionsOfCompositionsBulkInMemory",e),o}}))}},8939:(e,t,o)=>{o.d(t,{$N:()=>w,$V:()=>h,Ez:()=>I,JA:()=>C,Mb:()=>y,Nj:()=>f,PT:()=>T,RW:()=>m,XI:()=>g,ay:()=>u,hL:()=>d,kx:()=>v,re:()=>p,yz:()=>k,zN:()=>L});var n=o(7139),i=o(2),r=o(9639),c=o(8286),s=o(2830),a=o(1863),l=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function d(e){return l(this,void 0,void 0,(function*(){let t={connectionList:[],compositionList:[]};try{if(s.serviceWorker)try{return(yield(0,s.sendMessage)("GetCompositionById",{id:e})).data}catch(e){console.error("GetCompositionById error sw: ",e),(0,s.handleServiceWorkerException)(e)}let o=yield(0,i.s)(e);t.connectionList=o;for(let e=0;e<t.connectionList.length;e++)t.compositionList.includes(t.connectionList[e].ofTheConceptId)||t.compositionList.push(t.connectionList[e].ofTheConceptId);return t}catch(e){return console.error("GetCompositionById error: ",e),t}}))}function u(e,t,o){return l(this,void 0,void 0,(function*(){var i,c;let s={},a=yield r.I.GetConcept(e);0==a.id&&null!=e&&null!=e&&(a=yield(0,n.r)(e));let l=yield L(e,t,o);return s[null!==(c=null===(i=null==a?void 0:a.type)||void 0===i?void 0:i.characterValue)&&void 0!==c?c:""]=l,s}))}function h(e,t,o){return l(this,void 0,void 0,(function*(){var i,c;let s={},a=yield r.I.GetConcept(e);0==a.id&&null!=e&&null!=e&&(a=yield(0,n.r)(e));let l=yield L(e,t,o);s[null!==(c=null===(i=null==a?void 0:a.type)||void 0===i?void 0:i.characterValue)&&void 0!==c?c:""]=l;let d={};return d.created_at=a.entryTimeStamp,d.data=s,d.id=e,d}))}function p(e,t,o){return l(this,void 0,void 0,(function*(){var i,c;let s={},a=yield r.I.GetConcept(e);0==a.id&&null!=e&&null!=e&&(a=yield(0,n.r)(e));let l=yield A(a,t,o);return s[null!==(c=null===(i=null==a?void 0:a.type)||void 0===i?void 0:i.characterValue)&&void 0!==c?c:""]=l,s}))}function f(e){return l(this,void 0,void 0,(function*(){var t,o;if(s.serviceWorker)try{return(yield(0,s.sendMessage)("GetComposition",{id:e})).data}catch(e){console.error("GetComposition error sw: ",e),(0,s.handleServiceWorkerException)(e)}let c=[],a={};c=yield(0,i.s)(e),console.log("this is the connection list online",c);let l=[];for(let e=0;e<c.length;e++)l.includes(c[e].ofTheConceptId)||l.push(c[e].ofTheConceptId);let d=yield r.I.GetConcept(e);0==d.id&&null!=e&&null!=e&&(d=yield(0,n.r)(e));let u=yield L(e,c,l);return a[null!==(o=null===(t=null==d?void 0:d.type)||void 0===t?void 0:t.characterValue)&&void 0!==o?o:""]=u,a}))}function y(e){return l(this,void 0,void 0,(function*(){var t,o;let c=[],s={};c=yield(0,i.s)(e);let a=[];for(let e=0;e<c.length;e++)a.includes(c[e].ofTheConceptId)||a.push(c[e].ofTheConceptId);let l=yield r.I.GetConcept(e);0==l.id&&null!=e&&null!=e&&(l=yield(0,n.r)(e));let d=yield S(e,c,a);return s[null!==(o=null===(t=null==l?void 0:l.type)||void 0===t?void 0:t.characterValue)&&void 0!==o?o:""]=d,s}))}function v(e){return l(this,void 0,void 0,(function*(){var t,o;if(s.serviceWorker)try{return(yield(0,s.sendMessage)("GetCompositionFromMemory",{id:e})).data}catch(e){console.error("GetCompositionFromMemory error sw: ",e),(0,s.handleServiceWorkerException)(e)}let i=[],a={};i=yield c.d.GetConnectionsOfCompositionLocal(e);let l=[];for(let e=0;e<i.length;e++)l.includes(i[e].ofTheConceptId)||l.push(i[e].ofTheConceptId);let d=yield r.I.GetConcept(e);0==d.id&&null!=e&&null!=e&&(d=yield(0,n.r)(e));let u=yield N(d,i,l);return a[null!==(o=null===(t=null==d?void 0:d.type)||void 0===t?void 0:t.characterValue)&&void 0!==o?o:""]=u,a}))}function g(e){return l(this,void 0,void 0,(function*(){var t,o;if(s.serviceWorker)try{return(yield(0,s.sendMessage)("GetCompositionFromMemoryNormal",{id:e})).data}catch(e){console.error("GetCompositionFromMemoryNormal error sw: ",e),(0,s.handleServiceWorkerException)(e)}let i=[],a={};i=yield c.d.GetConnectionsOfCompositionLocal(e);let l=[];for(let e=0;e<i.length;e++)l.includes(i[e].ofTheConceptId)||l.push(i[e].ofTheConceptId);let d=yield r.I.GetConcept(e);0==d.id&&null!=e&&null!=e&&(d=yield(0,n.r)(e));let u=yield A(d,i,l);return a[null!==(o=null===(t=null==d?void 0:d.type)||void 0===t?void 0:t.characterValue)&&void 0!==o?o:""]=u,a}))}function m(e){var t=arguments;return l(this,void 0,void 0,(function*(){var o,i;const l=s.Logger.logfunction("GetCompositionWithIdFromMemory",t);if(s.serviceWorker){l.serviceWorker=!0;try{const t=yield(0,s.sendMessage)("GetCompositionWithIdFromMemory",{id:e});return s.Logger.logUpdate(l),t.data}catch(e){console.error("GetCompositionWithIdFromMemory error sw: ",e),(0,a.ey)(l,"GetCompositionWithIdFromMemory",e),(0,s.handleServiceWorkerException)(e)}}let d={},u=[],h={};try{u=yield c.d.GetConnectionsOfCompositionLocal(e);let t=[];for(let e=0;e<u.length;e++)t.includes(u[e].ofTheConceptId)||t.push(u[e].ofTheConceptId);let s=yield r.I.GetConcept(e);0==s.id&&null!=e&&null!=e&&(s=yield(0,n.r)(e));let a=yield N(s,u,t);h[null!==(i=null===(o=null==s?void 0:s.type)||void 0===o?void 0:o.characterValue)&&void 0!==i?i:""]=a,d.created_at=s.entryTimeStamp,d.data=h,d.id=e}catch(t){console.log("this is the exception in GetCompositionWithIdFromMemory",e),(0,a.ey)(l,"GetCompositionWithIdFromMemory",t)}return s.Logger.logUpdate(l),d}))}function C(e,t){var o=arguments;return l(this,void 0,void 0,(function*(){var i,c;const l=s.Logger.logfunction("GetCompositionFromMemoryWithConnections",o);if(s.serviceWorker){l.serviceWorker=!0;try{const o=yield(0,s.sendMessage)("GetCompositionFromMemoryWithConnections",{id:e,connectionList:t});return s.Logger.logUpdate(l),o.data}catch(e){console.error("GetCompositionFromMemoryWithConnections error sw: ",e),(0,a.ey)(l,"GetCompositionFromMemoryWithConnections",e),(0,s.handleServiceWorkerException)(e)}}let d={},u=[];for(let e=0;e<t.length;e++)u.includes(t[e].ofTheConceptId)||u.push(t[e].ofTheConceptId);let h=yield r.I.GetConcept(e);0==h.id&&null!=e&&null!=e&&(h=yield(0,n.r)(e));let p=yield N(h,t,u);d[null!==(c=null===(i=null==h?void 0:h.type)||void 0===i?void 0:i.characterValue)&&void 0!==c?c:""]=p;let f={};return f.created_at=h.entryTimeStamp,f.data=d,f.id=e,s.Logger.logUpdate(l),f}))}function T(e,t){return l(this,void 0,void 0,(function*(){var o,i;const c=s.Logger.logfunction("GetCompositionWithIdFromMemoryFromConnection",[e]);if(s.serviceWorker){c.serviceWorker=!0;try{const t=yield(0,s.sendMessage)("GetCompositionWithIdFromMemory",{id:e});return s.Logger.logUpdate(c),t.data}catch(e){console.error("GetCompositionWithIdFromMemory error sw: ",e),(0,a.ey)(c,"GetCompositionWithIdFromMemoryFromConnection",e),(0,s.handleServiceWorkerException)(e)}}let l={},d=[];for(let e=0;e<t.length;e++)d.includes(t[e].ofTheConceptId)||d.push(t[e].ofTheConceptId);let u=yield r.I.GetConcept(e);0==u.id&&null!=e&&null!=e&&(u=yield(0,n.r)(e));let h=yield N(u,t,d);console.log("this is the output",h,u),l[null!==(i=null===(o=null==u?void 0:u.type)||void 0===o?void 0:o.characterValue)&&void 0!==i?i:""]=h;let p={};return p.created_at=u.entryTimeStamp,p.data=l,p.id=e,s.Logger.logUpdate(c),p}))}function w(e){return l(this,void 0,void 0,(function*(){var t;if(s.serviceWorker)try{return(yield(0,s.sendMessage)("GetCompositionWithIdFromMemoryNew",{id:e})).data}catch(e){console.error("GetCompositionWithIdFromMemoryNew error sw: ",e),(0,s.handleServiceWorkerException)(e)}let o=[],i={};o=yield c.d.GetConnectionsOfCompositionLocal(e);let a=[];for(let e=0;e<o.length;e++)a.includes(o[e].ofTheConceptId)||a.push(o[e].ofTheConceptId);let d=yield r.I.GetConcept(e);0==d.id&&null!=e&&null!=e&&(console.log("this concept you cannot find ",e),d=yield(0,n.r)(e));let u=(new Date).getTime(),h=yield function(e,t,o){return l(this,arguments,void 0,(function*(e,t,o,n=[]){var i,r,c,a,l,d,u,h;let p={},f=e.id,y=((new Date).getTime(),null!==(r=null===(i=null==e?void 0:e.type)||void 0===i?void 0:i.characterValue)&&void 0!==r?r:"");if(!o.includes(f)){let t=y;return{[t]:null==e?void 0:e.characterValue}}if(n.includes(f))return"";n.push(f);for(let e=0;e<t.length;e++){let o=yield(0,s.GetTheConcept)(t[e].ofTheConceptId),n=yield(0,s.GetTheConcept)(t[e].toTheConceptId);t[e].ofConcept=o,t[e].toConcept=n;let i=o.id,r="the_",l=(null!==(a=null===(c=null==n?void 0:n.type)||void 0===c?void 0:c.characterValue)&&void 0!==a?a:"").replace(r,"");null!=p[i]&&null!=p[i]||(p[i]={}),p[i][l]=n.characterValue}let v={};for(let e=0;e<t.length;e++){let o=t[e].ofConcept,n=t[e].toConcept,i=null!==(d=null===(l=null==o?void 0:o.type)||void 0===l?void 0:l.characterValue)&&void 0!==d?d:"",r="the_",c=(null!==(h=null===(u=null==n?void 0:n.type)||void 0===u?void 0:u.characterValue)&&void 0!==h?h:"").replace(r,"");null!=v[o.id]&&null!=v[o.id]||(v[o.id]={});let s=v[o.id];null!=s[i]&&null!=s[i]||(s[i]={}),null!=p[t[e].ofTheConceptId]&&null!=p[t[e].toTheConceptId]?s[i][c]=p[n.id]:s[i][c]=n.characterValue}return v[e.id]}))}(d,o,a);console.log("this is the time for the data to be made",(new Date).getTime()-u),null===(t=null==d?void 0:d.type)||void 0===t||t.characterValue,i=h;let p={};return p.created_at=d.entryTimeStamp,p.data=i,p.id=e,p}))}function I(e){return l(this,void 0,void 0,(function*(){var t,o;if(s.serviceWorker)try{return(yield(0,s.sendMessage)("GetCompositionWithIdAndDateFromMemory",{id:e})).data}catch(e){console.error("GetCompositionWithIdAndDateFromMemory error sw: ",e),(0,s.handleServiceWorkerException)(e)}let i=[],a={};i=yield c.d.GetConnectionsOfCompositionLocal(e);let l=[];for(let e=0;e<i.length;e++)l.includes(i[e].ofTheConceptId)||l.push(i[e].ofTheConceptId);let d=yield r.I.GetConcept(e);0==d.id&&null!=e&&null!=e&&(d=yield(0,n.r)(e));let u=yield L(e,i,l);a[null!==(o=null===(t=null==d?void 0:d.type)||void 0===t?void 0:t.characterValue)&&void 0!==o?o:""]=u;let h={};return h.data=a,h.id=e,h.created_at=d.entryTimeStamp,h}))}function k(e){var t=arguments;return l(this,void 0,void 0,(function*(){var o,c;const l=s.Logger.logfunction("GetCompositionWithId",t);if(s.serviceWorker){l.serviceWorker=!0;try{const t=yield(0,s.sendMessage)("GetCompositionWithId",{id:e});return s.Logger.logUpdate(l),t.data}catch(e){console.error("GetCompositionWithId error sw: ",e),(0,a.ey)(l,"GetCompositionWithId",e),(0,s.handleServiceWorkerException)(e)}}let d=[],u={};d=yield(0,i.s)(e);let h=[];for(let e=0;e<d.length;e++)h.includes(d[e].ofTheConceptId)||h.push(d[e].ofTheConceptId);let p=yield r.I.GetConcept(e);0==p.id&&null!=e&&null!=e&&(p=yield(0,n.r)(e));let f=yield L(e,d,h);u[null!==(c=null===(o=null==p?void 0:p.type)||void 0===o?void 0:o.characterValue)&&void 0!==c?c:""]=f;let y={};return y.data=u,y.id=e,s.Logger.logUpdate(l),y}))}function N(e,t,o){return l(this,arguments,void 0,(function*(e,t,o,i=[]){var c,s,a;let l={},d=[],u=e.id;if(null===(c=null==e?void 0:e.type)||void 0===c?void 0:c.characterValue,!o.includes(u))return null==e?void 0:e.characterValue;if(i.includes(u))return"";i.push(u);for(let e=0;e<t.length;e++)if(t[e].ofTheConceptId==u)if(u!=t[e].toTheConceptId){let c=t[e].toTheConceptId,u=yield r.I.GetConcept(c);if(null!=u&&0!=u.id||null==c||null==c||(u=yield(0,n.r)(c)),0!=u.id&&null==(null==u?void 0:u.type)){let e=u.typeId,t=yield r.I.GetConcept(e);u.type=t,null==t&&null!=e&&null!=e&&(t=yield(0,n.r)(e),u.type=t)}let h="the_",p=(null!==(a=null===(s=null==u?void 0:u.type)||void 0===s?void 0:s.characterValue)&&void 0!==a?a:"").replace(h,"");if(isNaN(Number(p))){if(p){const e=yield N(u,t,o,i);l[p]=e}}else{const e=yield N(u,t,o,i);d[p]=e,l=d}}else console.log("this is the faulty connection ",t[e]);return l}))}function A(e,t,o){return l(this,arguments,void 0,(function*(e,t,o,i=[]){var c,a,l;const d=s.Logger.logfunction("recursiveFetchConceptNormal",[e]);(new Date).getTime();let u={},h=[],p=e.id;if(u.id=p,null===(c=null==e?void 0:e.type)||void 0===c?void 0:c.characterValue,!o.includes(p))return null==e?void 0:e.characterValue;if(i.includes(p))return"";i.push(p);for(let e=0;e<t.length;e++)if(t[e].ofTheConceptId==p)if(p!=t[e].toTheConceptId){let c=t[e].toTheConceptId,s=yield r.I.GetConcept(c);if(null!=s&&0!=s.id||null==c||null==c||(s=yield(0,n.r)(c)),0!=s.id&&null==(null==s?void 0:s.type)){let e=s.typeId,t=yield r.I.GetConcept(e);s.type=t,null==t&&null!=e&&null!=e&&(t=yield(0,n.r)(e),s.type=t)}let d="the_",p=(null!==(l=null===(a=null==s?void 0:s.type)||void 0===a?void 0:a.characterValue)&&void 0!==l?l:"").replace(d,"");if(isNaN(Number(p))){if(p){const e=yield N(s,t,o,i);u[p]=e}}else{const e=yield N(s,t,o,i);h[p]=e,u=h}}else console.log("this is the faulty connection ",t[e]);return s.Logger.logUpdate(d),u}))}function L(e,t,o){return l(this,arguments,void 0,(function*(e,t,o,i=[]){var c,s,a;let l={},d=[];if(0==e)return null;let u=yield r.I.GetConcept(e);if(null!=u&&0!=u.id||null==e||null==e||(u=yield(0,n.r)(e)),0!=u.id&&null==u.type){let e=u.typeId,t=yield r.I.GetConcept(e);u.type=t,null==t&&null!=e&&null!=e&&(t=yield(0,n.r)(e),u.type=t)}if(null===(c=null==u?void 0:u.type)||void 0===c?void 0:c.characterValue,!o.includes(e))return null==u?void 0:u.characterValue;if(i.includes(e))return"";i.push(e);for(let c=0;c<t.length;c++)if((new Date).getTime(),t[c].ofTheConceptId==e)if(e!=t[c].toTheConceptId){let e=t[c].toTheConceptId,u=yield r.I.GetConcept(e);if(null!=u&&0!=u.id||null==e||null==e||(u=yield(0,n.r)(e)),0!=u.id&&null==(null==u?void 0:u.type)){let e=u.typeId,t=yield r.I.GetConcept(e);u.type=t,null==t&&null!=e&&null!=e&&(t=yield(0,n.r)(e),u.type=t)}let h="the_",p=(null!==(a=null===(s=null==u?void 0:u.type)||void 0===s?void 0:s.characterValue)&&void 0!==a?a:"").replace(h,"");if(isNaN(Number(p))){if(p){const n=yield L(e,t,o,i);l[p]=n}}else{const n=yield L(e,t,o,i);d[p]=n,l=d}}else console.log("this is the faulty connection ",t[c]);return l}))}function S(e,t,o){return l(this,arguments,void 0,(function*(e,t,o,i=[]){var c,s,a;let l={},d=[];if(0==e)return null;let u=yield r.I.GetConcept(e);if(null!=u&&0!=u.id||null==e||null==e||(u=yield(0,n.r)(e)),0!=u.id&&null==u.type){let e=u.typeId,t=yield r.I.GetConcept(e);u.type=t,null==t&&null!=e&&null!=e&&(t=yield(0,n.r)(e),u.type=t)}if(null===(c=null==u?void 0:u.type)||void 0===c?void 0:c.characterValue,!o.includes(e))return null==u?void 0:u.characterValue;if(i.includes(e))return"";i.push(e),l.id=e;for(let i=0;i<t.length;i++)if(t[i].ofTheConceptId==e){let e=t[i].toTheConceptId,c=yield r.I.GetConcept(e);if(null!=c&&0!=c.id||null==e||null==e||(c=yield(0,n.r)(e)),c&&null==(null==c?void 0:c.type)){let e=c.typeId,t=yield r.I.GetConcept(e);c.type=t,null==t&&null!=e&&null!=e&&(t=yield(0,n.r)(e),c.type=t)}let u="the_",h=(null!==(a=null===(s=null==c?void 0:c.type)||void 0===s?void 0:s.characterValue)&&void 0!==a?a:"").replace(u,"");if(isNaN(Number(h))){if(h){const n=yield S(e,t,o);l[h]=n}}else{const n=yield S(e,t,o);d[h]=n,l=d}}return l}))}},6687:(e,t,o)=>{o.d(t,{D:()=>w,MT:()=>T,Nt:()=>f,QL:()=>g,as:()=>y,cw:()=>u,dF:()=>d,hG:()=>v,km:()=>p,nr:()=>C,p8:()=>h,rv:()=>m});var n=o(8642),i=o(7467),r=o(2830),c=o(1863),s=o(5284),a=o(8939),l=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function d(){return l(this,arguments,void 0,(function*(e=[]){yield(0,n.Y)(e);let t=[];for(let o=0;o<e.length;o++){let n=yield(0,a.kx)(e[o]);t.push(n)}return t}))}function u(){return l(this,arguments,void 0,(function*(e=[]){yield(0,n.Y)(e);let t=[];for(let o=0;o<e.length;o++){let n=yield(0,a.RW)(e[o]);t.push(n)}return t}))}function h(){return l(this,arguments,void 0,(function*(e=[],t=[]){const o=r.Logger.logfunction("GetCompositionFromConnectionsWithDataId",[e]);if(r.serviceWorker){o.serviceWorker=!0;try{const n=yield(0,r.sendMessage)("GetCompositionFromConnectionsWithDataId",{conceptIds:e,connectionIds:t});return r.Logger.logUpdate(o),n.data}catch(e){console.error("GetCompositionFromConnectionsWithDataId error sw: ",e),(0,c.ey)(o,"GetCompositionFromConnectionsWithDataId",e),(0,r.handleServiceWorkerException)(e)}}let n=[];for(let t=0;t<e.length;t++){let o=yield(0,a.RW)(e[t]);n.push(o)}return r.Logger.logUpdate(o),n}))}function p(){var e=arguments;return l(this,arguments,void 0,(function*(t=[],o=[]){const n=r.Logger.logfunction("GetCompositionFromConnectionsWithDataIdFromConnections",e);if(r.serviceWorker){n.serviceWorker=!0;try{const e=yield(0,r.sendMessage)("GetCompositionFromConnectionsWithDataIdFromConnections",{conceptIds:t,connectionIds:o});return r.Logger.logUpdate(n),e.data}catch(e){console.error("GetCompositionFromConnectionsWithDataIdFromConnections error sw: ",e),(0,c.ey)(n,"GetCompositionFromConnectionsWithDataIdFromConnections",e),(0,r.handleServiceWorkerException)(e)}}let s=yield(0,i.j)(o),l=[];for(let e=0;e<t.length;e++){let o=yield(0,a.PT)(t[e],s);l.push(o)}return r.Logger.logUpdate(n),l}))}function f(){var e=arguments;return l(this,arguments,void 0,(function*(t=[],o=[]){const n=r.Logger.logfunction("GetCompositionFromConnectionsWithDataIdIndex",e);if(r.serviceWorker){n.serviceWorker=!0;try{const e=yield(0,r.sendMessage)("GetCompositionFromConnectionsWithDataIdIndex",{conceptIds:t,connectionIds:o});return r.Logger.logUpdate(n),e.data}catch(e){console.error("GetCompositionFromConnectionsWithDataIdIndex error sw: ",e),(0,c.ey)(n,"GetCompositionFromConnectionsWithDataIdIndex",e),(0,r.handleServiceWorkerException)(e)}}yield(0,i.j)(o),yield(0,s.B)(t);let l={};for(let e=0;e<t.length;e++){let o=yield(0,a.RW)(t[e]);l[t[e]]=o}return r.Logger.logUpdate(n),l}))}function y(){return l(this,arguments,void 0,(function*(e=[],t=[]){yield(0,i.j)(t),yield(0,s.B)(e);let o={};for(let t=0;t<e.length;t++){let n=yield(0,a.kx)(e[t]);o[e[t]]=n}return o}))}function v(){return l(this,arguments,void 0,(function*(e=[],t=[]){if(r.serviceWorker)try{return(yield(0,r.sendMessage)("GetCompositionFromConnectionsWithIndexFromConnections",{conceptIds:e,connectionIds:t})).data}catch(e){console.error("GetCompositionFromConnectionsWithIndexFromConnections error sw: ",e),(0,r.handleServiceWorkerException)(e)}let o=yield(0,i.j)(t),n=[];for(let t=0;t<e.length;t++){let i=yield(0,a.JA)(e[t],o);n[e[t]]=i}return n}))}function g(e){var t=arguments;return l(this,void 0,void 0,(function*(){const o=r.Logger.logfunction("GetConnectionDataPrefetch",t);if(r.serviceWorker){o.serviceWorker=!0;try{const t=yield(0,r.sendMessage)("GetConnectionDataPrefetch",{connectionIds:e});return r.Logger.logUpdate(o),t.data}catch(e){console.error("GetConnectionDataPrefetch error sw: ",e),(0,c.ey)(o,"GetConnectionDataPrefetch",e),(0,r.handleServiceWorkerException)(e)}}let n=[],s=[],a={};for(let t=0;t<e.length;t++){let o=yield r.ConnectionData.GetConnection(e[t]);0==o.id?n.push(e[t]):s.push(o)}for(let t=0;t<n.length;t++)a[e[t]]=!1;let l=[],d=yield(0,i.j)(n);s=[...s,...d];for(let e=0;e<s.length;e++)l.push(s[e].ofTheConceptId),l.push(s[e].toTheConceptId),l.push(s[e].typeId);return yield(0,r.GetConceptBulk)(l),r.Logger.logUpdate(o),s}))}function m(){var e=arguments;return l(this,arguments,void 0,(function*(t=[],o=[]){const n=r.Logger.logfunction("GetCompositionFromConnectionsWithDataIdInObject",e);yield(0,i.j)(o);let c={};for(let e=0;e<t.length;e++){let o=yield(0,a.RW)(t[e]);c[t[e]]=o}return r.Logger.logUpdate(n),c}))}function C(){return l(this,arguments,void 0,(function*(e=[],t=[]){yield(0,i.j)(t);let o={};for(let t=0;t<e.length;t++){let n=yield(0,a.$N)(e[t]);o[e[t]]=n}return o}))}function T(){return l(this,arguments,void 0,(function*(e=[],t=[]){yield(0,i.j)(t);let o={};for(let t=0;t<e.length;t++){let n=yield(0,a.kx)(e[t]);o[e[t]]=n}return o}))}function w(){return l(this,arguments,void 0,(function*(e=[],t=[]){yield(0,i.j)(t);let o={};for(let t=0;t<e.length;t++){let n=yield(0,a.XI)(e[t]);o[e[t]]=n,console.log("this is the normal data",e[t],n)}return o}))}},2013:(e,t,o)=>{o.d(t,{A:()=>a,w:()=>l});var n=o(8146),i=o(2830),r=o(9639),c=o(1863),s=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function a(e){var t=arguments;return s(this,void 0,void 0,(function*(){const o=i.Logger.logfunction("GetConceptByCharacter",t);if(i.serviceWorker){o.serviceWorker=!0;try{const t=yield(0,i.sendMessage)("GetConceptByCharacter",{characterValue:e});return i.Logger.logUpdate(o),t.data}catch(e){console.error("GetConceptByCharacter sw error: ",e),(0,c.ey)(o,"GetConceptByCharacter",e),(0,i.handleServiceWorkerException)(e)}}let s=yield r.I.GetConceptByCharacter(e),a=`${e}`;return null!=s&&0!=(null==s?void 0:s.id)||!a||(yield(0,n.Y)(e),s=yield r.I.GetConceptByCharacterAndTypeLocal(e,51),0==s.id&&(s=yield r.I.GetConceptByCharacter(e))),i.Logger.logUpdate(o),s}))}function l(e){var t=arguments;return s(this,void 0,void 0,(function*(){const o=i.Logger.logfunction("GetConceptByCharacterUpdated",t);if(i.serviceWorker){o.serviceWorker=!0;try{const t=yield(0,i.sendMessage)("GetConceptByCharacterUpdated",{characterValue:e});return i.Logger.logUpdate(o),t.data}catch(e){console.error("GetConceptByCharacterUpdated error sw: ",e),(0,c.ey)(o,"GetConceptByCharacterUpdated",e),(0,i.handleServiceWorkerException)(e)}}let s=yield r.I.GetConceptByCharacter(e),a=`${e}`;return null!=s&&0!=(null==s?void 0:s.id)||!a||(yield(0,n.Y)(e),s=yield r.I.GetConceptByCharacter(e)),i.Logger.logUpdate(o),s}))}},7887:(e,t,o)=>{o.d(t,{a:()=>c,p:()=>s});var n=o(8286),i=o(4864),r=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function c(){return r(this,void 0,void 0,(function*(){try{let e=[];if(Array.isArray(e))for(let t=0;t<e.length;t++)n.d.AddConnectionToMemory(e[t])}catch(e){throw{message:"Cannot create Connection Binary Tree Concept",ok:!1,status:400,data:e}}}))}function s(){return r(this,void 0,void 0,(function*(){try{let e=[];if(Array.isArray(e))for(let t=0;t<e.length;t++)i.G.AddConnectionToMemory(e[t])}catch(e){throw{message:"Cannot create Local Connection Binary Tree Concept",ok:!1,status:400,data:e}}}))}},7876:(e,t,o)=>{o.d(t,{A:()=>l});var n=o(1735),i=o(7139),r=o(2830),c=o(9639),s=o(7282),a=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function l(e){return a(this,arguments,void 0,(function*(e,t=999){let o=performance.now();if(n.J.activateStatus)try{n.J.incrementConcept(e)}catch(e){console.error("Error adding connection in access tracker"),r.Logger.log("ERROR","Error Adding Connection")}try{if(r.serviceWorker)try{console.time("serviceworker");const o=yield(0,r.sendMessage)("GetTheConcept",{id:e,userId:t});return console.timeEnd("serviceworker"),o.data}catch(e){console.error("GetTheConcept sw error: ",e),(0,r.handleServiceWorkerException)(e)}let o=(0,s.o)();if(e<0){let n=yield(0,r.GetUserGhostId)(t,e);return o=(0,r.convertFromLConceptToConcept)(n),o}if(o=yield c.I.GetConcept(e),null!=o&&0!=o.id||null==e||null==e||(o=yield(0,i.r)(e)),0!=o.id&&null==o.type&&null==(yield c.I.GetConcept(o.typeId))&&null!=o.typeId&&null!=o.typeId){let e=yield(0,i.r)(o.typeId);o.type=e}return o}catch(n){throw console.error("this is the error in the getting concept",n),r.Logger.logError(o,t,"read","unknown",void 0,500,n,"GetTheConcept",[e,t],"unknown",void 0),n}}))}},7869:(e,t,o)=>{o.d(t,{_:()=>y,A:()=>f});var n=o(9581),i=o(9639),r=o(1863),c=o(3518),s=o(2830),a=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))},l=o(2299);class d{}d.isUpdated=!1,d.isOnlineSync=!1;var u=o(3655),h=o(9003),p=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function f(){return p(this,arguments,void 0,(function*(e=!0){try{if(yield(0,u.qI)("concepts"),yield(0,h.qI)("concepts"),e){if((yield(0,u.b8)()).isOnlineSync)return!0;yield function(){return a(this,void 0,void 0,(function*(){const e=s.Logger.logfunction("GetAiData");try{const a=(new Date).getTime();var t=(0,c.ab)("application/x-www-form-urlencoded");const l=yield fetch(n.B.GetAllAiData(),{method:"GET",headers:t});l.ok||(console.log("Ai Error Message: ","Cannot get response"),(0,r.ry)(l));const d=yield l.json();for(var o=0;o<d.length;o++)i.I.AddConcept(d[o]);y();let u=(new Date).getTime()-a;console.log("The time taken is ",u),s.Logger.logUpdate(e)}catch(e){e instanceof Error?console.log("Ai Error Message: ",e.message):console.log("Ai Error Message: ",e),(0,r.Mb)(e,n.B.GetAllAiData())}}))}()}return!0}catch(e){let t={message:"cannot initlize the AI system",ok:!1,status:400,data:e};return console.log(t),!0}}))}function y(){return p(this,void 0,void 0,(function*(){d.isOnlineSync=!0;var e=new l.B(d.isOnlineSync);(0,u.El)(e)}))}},8095:(e,t,o)=>{o.d(t,{h:()=>s});var n=o(2830),i=o(9700),r=o(1863),c=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function s(e,t,o){var s=arguments;return c(this,arguments,void 0,(function*(e,t,o,c=!1,a={concepts:[],connections:[]}){var l,d,u,h,p,f;const y=i.V.logfunction("CreateConnectionBetweenTwoConceptsLocal",s);let v=performance.now();try{if(n.serviceWorker){y.serviceWorker=!0;try{const r=yield(0,n.sendMessage)("CreateConnectionBetweenTwoConceptsLocal",{ofTheConcept:e,toTheConcept:t,linker:o,both:c,actions:a});return(null===(d=null===(l=null==r?void 0:r.actions)||void 0===l?void 0:l.concepts)||void 0===d?void 0:d.length)&&(a.concepts=JSON.parse(JSON.stringify(r.actions.concepts))),(null===(h=null===(u=null==r?void 0:r.actions)||void 0===u?void 0:u.connections)||void 0===h?void 0:h.length)&&(a.connections=JSON.parse(JSON.stringify(r.actions.connections))),i.V.logUpdate(y),r.data}catch(e){console.error("CreateConnectionBetweenTwoConceptsLocal sw error: ",e),(0,r.ey)(y,"CreateConnectionBetweenTwoConceptsLocal",e),(0,n.handleServiceWorkerException)(e)}}if(e.userId,c){let i=(null===(p=t.type)||void 0===p?void 0:p.characterValue)+"_s_"+o+"_by";var g=yield(0,n.MakeTheInstanceConceptLocal)("connection",i,!1,999,999,999,0,a);yield(0,n.CreateTheConnectionLocal)(t.id,e.id,g.id,1e3,void 0,void 0,a)}let s=(null===(f=e.type)||void 0===f?void 0:f.characterValue)+"_s_"+o+"_s";var m=yield(0,n.MakeTheInstanceConceptLocal)("connection",s,!1,999,999,999,void 0,a);let v=yield(0,n.CreateTheConnectionLocal)(e.id,t.id,m.id,1e3,void 0,void 0,a);return i.V.logUpdate(y),v}catch(n){throw i.V.logError(v,e.userId,"create",void 0,void 0,500,n,"CreateConnectionBetweenTwoConceptsLocal",[e,t,o,c],void 0,void 0),(0,r.ey)(y,"CreateConnectionBetweenTwoConceptsLocal",n),n}}))}},6416:(e,t,o)=>{o.d(t,{u:()=>i});var n=o(2615);function i(){let e=new Date,t=new Date;return new n.j(0,0,0,0,0,"0",0,!1,e,t,"0")}},3075:(e,t,o)=>{o.d(t,{Ay:()=>d,EO:()=>u,xd:()=>h});var n=o(205),i=o(9736),r=o(5257),c=o(9003),s=o(2830),a=o(1863),l=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function d(){return l(this,void 0,void 0,(function*(){const e=s.Logger.logfunction("CreateLocalBinaryTreeFromIndexDb");try{let t=[];if(Array.isArray(t))for(let e=0;e<t.length;e++){let o=t[e];i.v.AddConceptToMemory(o)}n.B.isLocalDataLoaded=!0,n.B.isLocalTypeLoaded=!0,n.B.isLocalCharacterLoaded=!0,s.Logger.logUpdate(e)}catch(t){yield(0,s.DelayFunctionExecution)(2e3,d());let o={message:"Cannot create local binary tree from index db",data:t,ok:!1,status:400};throw(0,a.ey)(e,"CreateLocalBinaryTreeFromIndexDb",t),o}}))}function u(){return l(this,void 0,void 0,(function*(){var e;const t=s.Logger.logfunction("PopulateTheLocalConceptsToMemory");try{yield null===(e=navigator.locks)||void 0===e?void 0:e.request("dblock",(e=>l(this,void 0,void 0,(function*(){let e=yield(0,c.S5)("localid");if(Array.isArray(e)){if(e[0]){let t=e[0].value;if(t)r.R.AddConceptId(e[0]),yield(0,c.kH)("localid",{id:0,value:t-10});else{t=-Math.floor(1e8*Math.random());let e={id:0,value:t},o={id:0,value:t-10};r.R.AddConceptId(e),yield(0,c.kH)("localid",o)}}e[2]}})))),s.Logger.logUpdate(t)}catch(e){let o={message:"Cannot populate Local Ids from the Index Db",data:e,ok:!1,status:400};throw(0,a.ey)(t,"PopulateTheLocalConceptsToMemory",e),o}}))}function h(){return l(this,void 0,void 0,(function*(){var e;const t=s.Logger.logfunction("PopulateTheLocalConnectionToMemory");try{yield null===(e=navigator.locks)||void 0===e?void 0:e.request("dblock",(e=>l(this,void 0,void 0,(function*(){let e=yield(0,c.S5)("localid");if(Array.isArray(e)){if(e[1]){let t=e[1].value;if(t)r.R.AddConnectionId(e[1]),yield(0,c.kH)("localid",{id:1,value:t-10});else{t=-Math.floor(1e8*Math.random());let e={id:0,value:t},o={id:0,value:t-10};r.R.AddConnectionId(e),yield(0,c.kH)("localid",o)}}e[2]}})))),s.Logger.logUpdate(t)}catch(e){let o={message:"Cannot populate Local Ids from the Index Db",data:e,ok:!1,status:400};throw(0,a.ey)(t,"PopulateTheLocalConnectionToMemory",e),o}}))}},999:(e,t,o)=>{o.d(t,{R:()=>l});var n=o(2830),i=o(1863),r=o(6416),c=o(4711),s=o(5868),a=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function l(e){return a(this,arguments,void 0,(function*(e,t=null,o=null,a=null,d=null,u=null,h=null,p=!1,f={concepts:[],connections:[]}){var y,v,g,m;const C=n.Logger.logfunction("CreateTheCompositionLocal");if(n.serviceWorker){C.serviceWorker=!0;try{const i=yield(0,n.sendMessage)("CreateTheCompositionLocal",{json:e,ofTheConceptId:t,ofTheConceptUserId:o,mainKey:a,userId:d,accessId:u,sessionInformationId:h,actions:f});return(null===(v=null===(y=null==i?void 0:i.actions)||void 0===y?void 0:y.concepts)||void 0===v?void 0:v.length)&&(f.concepts=JSON.parse(JSON.stringify(i.actions.concepts))),(null===(m=null===(g=null==i?void 0:i.actions)||void 0===g?void 0:g.connections)||void 0===m?void 0:m.length)&&(f.connections=JSON.parse(JSON.stringify(i.actions.connections))),n.Logger.logUpdate(C),i.data}catch(e){console.error("CreateTheCompositionLocal error sw: ",e),(0,i.ey)(C,"CreateTheCompositionLocal",e),(0,n.handleServiceWorkerException)(e)}}let T=null!=d?d:999,w=null!=u?u:999,I=null!=h?h:999,k=null!=a?a:0,N=(0,r.u)();for(const n in e)if("string"!=typeof e[n]&&"number"!=typeof e[n])if(null==t&&null==o){let t=k,o=yield(0,s.k)(n,"",!0,T,w,I,void 0,f);N=o,t=o.id,k=o.id,yield l(e[n],o.id,o.userId,t,d,u,h,void 0,f)}else{let o=null!=t?t:999,i=k,r=yield(0,s.k)(n,"",!0,T,w,I,void 0,f);yield(0,c.F)(o,r.id,i,void 0,void 0,void 0,f),yield l(e[n],r.id,r.userId,i,d,u,h,void 0,f)}else{let o=null!=t?t:999,i=k,r=yield(0,s.k)(n,e[n].toString(),!1,T,w,I,void 0,f);yield(0,c.F)(o,r.id,i,void 0,void 0,void 0,f)}return n.Logger.logUpdate(C),N}))}},3077:(e,t,o)=>{o.d(t,{A:()=>l});var n=o(2830),i=o(2615),r=o(9736),c=o(5257),s=o(9700),a=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function l(e,t,o,l,d,u){return a(this,arguments,void 0,(function*(e,t,o,a,l,d,u=!1,h=0,p={concepts:[],connections:[]}){var f,y,v,g;let m=performance.now();try{if(n.serviceWorker)try{const i=yield(0,n.sendMessage)("CreateTheConceptLocal",{referent:e,typecharacter:t,userId:o,categoryId:a,typeId:l,accessId:d,isComposition:u,referentId:h});return(null===(y=null===(f=null==i?void 0:i.actions)||void 0===f?void 0:f.concepts)||void 0===y?void 0:y.length)&&(p.concepts=JSON.parse(JSON.stringify(i.actions.concepts))),(null===(g=null===(v=null==i?void 0:i.actions)||void 0===v?void 0:v.connections)||void 0===g?void 0:g.length)&&(p.connections=JSON.parse(JSON.stringify(i.actions.connections))),i.data}catch(e){console.error("CreateTheConceptLocal error sw: ",e),(0,n.handleServiceWorkerException)(e)}let s=yield c.R.getConceptId(),m=!0,C=new Date,T=new Date;if("the"==e)return new i.j(1,999,5,5,h,e,d,m,C,T,t);let w=new i.j(s,o,l,a,h,e,d,m,C,T,t);return w.isTemp=!0,w.isComposition=u,r.v.AddConcept(w),p.concepts.push(w),w}catch(n){throw s.V.logError(m,o,"create","unknown","unknown",500,void 0,"createTheConceptLocal",[e,t,o,a,l,d,u],void 0),n}}))}},4711:(e,t,o)=>{o.d(t,{F:()=>l});var n=o(2155),i=o(4864),r=o(5257),c=o(9700),s=o(2830),a=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function l(e,t,o){return a(this,arguments,void 0,(function*(e,t,o,a=1,l="",d=999,u={concepts:[],connections:[]}){var h,p,f,y;let v=performance.now();if(s.serviceWorker)try{const n=yield(0,s.sendMessage)("CreateTheConnectionLocal",{ofTheConceptId:e,toTheConceptId:t,typeId:o,orderId:a,typeString:l,userId:d,actions:u});return(null===(p=null===(h=null==n?void 0:n.actions)||void 0===h?void 0:h.concepts)||void 0===p?void 0:p.length)&&(u.concepts=JSON.parse(JSON.stringify(n.actions.concepts))),(null===(y=null===(f=null==n?void 0:n.actions)||void 0===f?void 0:f.connections)||void 0===y?void 0:y.length)&&(u.connections=JSON.parse(JSON.stringify(n.actions.connections))),n.data}catch(e){console.log("CreateTheConnectionLocal error sw: ",e),(0,s.handleServiceWorkerException)(e)}try{let c=4,h=yield r.R.getConnectionId(),p=0,f=0,y=0;p=e,f=t,y=o;let v=new n.N(0,0,0,0,0,0,0);return e!=t&&(v=new n.N(h,p,f,d,o,a,c),v.isTemp=!0,v.typeCharacter=l,s.LocalSyncData.AddConnection(v),i.G.AddConnection(v),u.connections.push(v)),v}catch(n){throw c.V.logError(v,d,"create","Unknown","Unknown",500,void 0,"CreateTheConnectionLocal",[e,t,o,a,l,d],"UnknownUserAgent",[]),n}}))}},8064:(e,t,o)=>{o.d(t,{$I:()=>s,Ay:()=>c});var n=o(9736),i=(o(9581),o(3518),o(2830));o(1863);var r=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function c(e){return r(this,void 0,void 0,(function*(){return yield n.v.GetConceptByCharacterAndTypeLocal(e,51)}))}function s(e){return r(this,void 0,void 0,(function*(){if(i.serviceWorker)try{return(yield(0,i.sendMessage)("GetConceptByCharacterAndCategoryLocal",{character:e})).data}catch(e){console.error("GetConceptByCharacterAndCategoryLocal error sw: ",e),(0,i.handleServiceWorkerException)(e)}let t=(0,i.CreateDefaultLConcept)();if("the"==e)return t.id=1,t.typeId=5,t.characterValue="the",t;let o=(0,i.SplitStrings)(e);if(o.length>1){let i=1,c=yield s(o[0]);0!=c.id&&(i=c.id),t=yield function(e,t){return r(this,void 0,void 0,(function*(){return n.v.GetConceptByCharacterAndCategoryLocal(e,t)}))}(e,i)}else o[0]==e&&(t=yield c(e));return t}))}},1213:(e,t,o)=>{o.d(t,{f:()=>a});var n=o(9736),i=o(7820),r=o(2830),c=o(176),s=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function a(e){return s(this,void 0,void 0,(function*(){let t=performance.now();try{if(r.serviceWorker)try{return(yield(0,r.sendMessage)("GetTheConceptLocal",{id:e})).data}catch(e){console.error("GetTheConceptLocal error sw: ",e),(0,r.handleServiceWorkerException)(e)}let t=(0,r.CreateDefaultLConcept)();if(e<0){if(t=yield n.v.GetConcept(e),0==t.id){let o=yield i.G.getNodeFromTree(e);if(null==o?void 0:o.value){let e=o.value;e&&(t=e)}}}else{let o=yield(0,r.GetTheConcept)(e);t=(0,c.F4)(o)}return t}catch(o){throw r.Logger.logError(t,"unknown","read","unknown",void 0,200,void 0,"GetTheConceptLocal",[e],"unknown",void 0),o}}))}},9975:(e,t,o)=>{o.d(t,{A:()=>s});var n=o(2830),i=o(9736),r=o(3077),c=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function s(e,t,o,s,a){return c(this,arguments,void 0,(function*(e,t,o,c,s,a={concepts:[],connections:[]}){var l,d,u,h;if(n.serviceWorker)try{const i=yield(0,n.sendMessage)("MakeTheConceptLocal",{referent:e,typeCharacter:t,userId:o,categoryId:c,typeId:s,actions:a});return(null===(d=null===(l=null==i?void 0:i.actions)||void 0===l?void 0:l.concepts)||void 0===d?void 0:d.length)&&(a.concepts=JSON.parse(JSON.stringify(i.actions.concepts))),(null===(h=null===(u=null==i?void 0:i.actions)||void 0===u?void 0:u.connections)||void 0===h?void 0:h.length)&&(a.connections=JSON.parse(JSON.stringify(i.actions.connections))),i.data}catch(e){console.error("MakeTheConceptLocal error sw: ",e),(0,n.handleServiceWorkerException)(e)}let p=yield i.v.GetConceptByCharacterAndTypeLocal(e,s),f=p;return"the"==t&&(c=1),0==f.id&&(p=yield(0,r.A)(e,t,o,c,s,4,void 0,void 0,a),f=p),f}))}},5868:(e,t,o)=>{o.d(t,{k:()=>l});var n=o(3077),i=o(8357),r=o(9736),c=o(2830),s=o(1863),a=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function l(e,t){var o=arguments;return a(this,arguments,void 0,(function*(e,t,a=!1,l,d,u=999,h=0,p={concepts:[],connections:[]}){var f,y,v,g;const m=c.Logger.logfunction("MakeTheInstanceConceptLocal",o);if(performance.now(),c.serviceWorker){m.serviceWorker=!0;try{const o=yield(0,c.sendMessage)("MakeTheInstanceConceptLocal",{type:e,referent:t,composition:a,userId:l,accessId:d,sessionInformationId:u,referentId:h,actions:p});return(null===(y=null===(f=null==o?void 0:o.actions)||void 0===f?void 0:f.concepts)||void 0===y?void 0:y.length)&&(p.concepts=JSON.parse(JSON.stringify(o.actions.concepts))),(null===(g=null===(v=null==o?void 0:o.actions)||void 0===v?void 0:v.connections)||void 0===g?void 0:g.length)&&(p.connections=JSON.parse(JSON.stringify(o.actions.connections))),c.Logger.logUpdate(m),o.data}catch(e){console.error("MakeTheInstanceConceptLocal error sw: ",e),(0,s.ey)(m,"MakeTheInstanceConceptLocal",e),(0,c.handleServiceWorkerException)(e)}}try{let o,s,d=999,u=4,f=l,y=4,v="",g=t.length;if(v=e.startsWith("the_")?e:"the_"+e,a)o=yield(0,i.$)(e,d,l,l,p),s=yield(0,n.A)(t,e,l,u,o.id,y,!0,h,p);else if(g>255)o=yield(0,i.$)(v,d,f,l,p),s=yield(0,n.A)(t,v,l,u,o.id,y,void 0,void 0,p);else{o=yield(0,i.$)(v,d,f,l,p);let e=yield r.v.GetConceptByCharacterAndTypeLocal(t,o.id);s=e,0==e.id&&0==e.userId&&(s=yield(0,n.A)(t,v,l,u,o.id,y,void 0,void 0,p))}return s.type=o,c.LocalSyncData.AddConcept(s),p.concepts.push(s),c.Logger.logUpdate(m),s}catch(e){throw(0,s.ey)(m,"MakeTheInstanceConceptLocal",e),e}}))}},8357:(e,t,o)=>{o.d(t,{$:()=>d});var n=o(3077),i=o(8064),r=o(6467),c=o(9975),s=o(2830),a=o(1863),l=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function d(e,t,o,u){var h=arguments;return l(this,arguments,void 0,(function*(e,t,o,l,u={concepts:[],connections:[]}){var p,f,y,v;const g=s.Logger.logfunction("MakeTheTypeConceptLocal",h);if(s.serviceWorker){g.serviceWorker=!0;try{const n=yield(0,s.sendMessage)("MakeTheTypeConceptLocal",{typeString:e,sessionId:t,sessionUserId:o,userId:l,actions:u});return(null===(f=null===(p=null==n?void 0:n.actions)||void 0===p?void 0:p.concepts)||void 0===f?void 0:f.length)&&(u.concepts=JSON.parse(JSON.stringify(n.actions.concepts))),(null===(v=null===(y=null==n?void 0:n.actions)||void 0===y?void 0:y.connections)||void 0===v?void 0:v.length)&&(u.connections=JSON.parse(JSON.stringify(n.actions.connections))),s.Logger.logUpdate(g),n.data}catch(e){console.error("MakeTheTypeConceptLocal error sw: ",e),(0,a.ey)(g,"MakeTheTypeConceptLocal",e),(0,s.handleServiceWorkerException)(e)}}let m=yield(0,i.$I)(e);if(m&&(0==m.id||0==m.userId)){let i=(0,r.f)(e);if(i[0]==e)m=yield(0,c.A)(e,"the",l,1,51,u);else{let r=yield d(i[0],t,o,l,u),c=yield d(i[1],t,o,l,u);m=yield(0,n.A)(e,i[1],l,r.id,c.id,4,void 0,void 0,u)}}return s.Logger.logUpdate(g),m}))}},3729:(e,t,o)=>{o.d(t,{D:()=>p});var n=o(9934),i=o(4485),r=o(2),c=o(7876),s=o(1838),a=o(999),l=o(5868),d=o(2830),u=o(176),h=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function p(e){return h(this,arguments,void 0,(function*(e,t={concepts:[],connections:[]}){var o,h,p,f;if(performance.now(),d.serviceWorker)try{const n=yield(0,d.sendMessage)("UpdateCompositionLocal",{patcherStructure:e,actions:t});return(null===(h=null===(o=null==n?void 0:n.actions)||void 0===o?void 0:o.concepts)||void 0===h?void 0:h.length)&&(t.concepts=JSON.parse(JSON.stringify(n.actions.concepts))),(null===(f=null===(p=null==n?void 0:n.actions)||void 0===p?void 0:p.connections)||void 0===f?void 0:f.length)&&(t.connections=JSON.parse(JSON.stringify(n.actions.connections))),n.data}catch(e){console.error("UpdateCompositionLocal error sw: ",e),(0,d.handleServiceWorkerException)(e)}const y=e.userId,v=e.sessionId,g=e.accessId;let m=[];const C=[];let T=(0,d.CreateDefaultLConcept)(),w=(0,d.CreateDefaultLConcept)();const I=[],k=e.compositionId,N=e.ofTheCompositionId;let A=[],L=yield(0,r.s)(k);for(let e=0;e<L.length;e++)m.push((0,u.P6)(L[e]));const S=[],G=[];let x=[];for(let e=0;e<m.length;e++)(0,n.A)(G,m[e].ofTheConceptId),(0,n.A)(S,m[e].ofTheConceptId),(0,n.A)(S,m[e].toTheConceptId),x.push(m[e].ofTheConceptId);for(let e=0;e<S.length;e++){const t=yield(0,c.A)(S[e]);k==S[e]&&(T=(0,u.F4)(t)),N==S[e]&&(w=(0,u.F4)(t)),C.push((0,u.F4)(t))}const B=e.patchObject;for(const e in B){let o=(0,d.CreateDefaultLConcept)();const n=B[e];let r=T;w.id>0&&(r=w),Array.isArray(n)||"object"==typeof n?(o=yield(0,l.k)(e,"",!0,T.userId,4,999,void 0,t),yield(0,a.R)(B[e],o.id,o.userId,T.id,T.userId,4,999,void 0,t)):o=yield(0,l.k)(e,n,!1,y,g,v,void 0,t);const c=(0,i.nm)(C,o);for(let e=0;e<c.length;e++)if(c[e].id>0){const t=(0,i.gt)(m,c[e].id);A=A.concat(t),I.push(c[e])}yield(0,d.CreateTheConnectionLocal)(r.id,o.id,T.id,2,void 0,void 0,t),C.push(o)}for(let e=0;e<A.length;e++)yield(0,s.m)(A[e].id);yield d.LocalSyncData.SyncDataOnline(void 0,t)}))}},8407:(e,t,o)=>{o.d(t,{A:()=>f});var n=o(9581),i=o(3518),r=o(1863),c=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))},s=o(4402),a=o(2830),l=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class d{constructor(e,t,o,n,i,r,c,s,a,l){this.id=0,this.userId=e,this.data=t,this.securityId=o,this.securityUserId=n,this.accessId=i,this.accessUserId=r,this.sessionId=c,this.sessionUserId=s,this.entryTimestamp=a,this.isNew=l}}var u=o(7282),h=o(2212),p=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function f(e,t){var o=arguments;return p(this,arguments,void 0,(function*(e,t,p=!1,f,y=4,v=999,g=0){const m=a.Logger.logfunction("MakeTheInstanceConcept",o);if(a.serviceWorker){m.serviceWorker=!0;try{const o=yield(0,a.sendMessage)("MakeTheInstanceConcept",{type:e,referent:t,composition:p,userId:f,passedAccessId:y,passedSessionId:v,referentId:g});return a.Logger.logUpdate(m),o.data}catch(e){console.error("MakeTheInstanceConcept sw error: ",e),(0,r.ey)(m,"MakeTheInstanceConcept",e),(0,a.handleServiceWorkerException)(e)}}let C,T=v,w=f,I=f,k=y,N=f,A="",L=t.length,S=(0,u.o)();if(A=e.startsWith("the_")?e:"the_"+e,p)S=yield(0,a.MakeTheTypeConceptApi)(e,f),C=yield(0,h.Ay)(t,f,4,S.id,g,k,e);else if(L>255)S=yield(0,a.MakeTheTypeConceptApi)(A,f),C=yield(0,h.Ay)(t,f,4,S.id,g,k,A),function(e){c(this,void 0,void 0,(function*(){try{var t=(0,i.Xr)();const o=yield fetch(n.B.CreateTheTextDataUrl(),{method:"POST",headers:t,body:JSON.stringify(e)});if(!o.ok)throw(0,r.ry)(o),new Error(`Error! status: ${o.status}`);return yield o.json()}catch(e){throw e instanceof Error?console.log("Create the text error message: ",e.message):console.log("Create the text unexpected error: ",e),e}}))}(new d(f,t,999,w,k,N,T,I,Date.now().toString(),!0));else{S=yield(0,a.MakeTheTypeConceptApi)(A,f);let e=yield(0,s.A)(t,S.id);C=e,0==e.id&&0==e.userId&&(C=yield(0,h.N)(t,f,4,S.id,12,k,A),function(e,t,o,c){var s=arguments;l(this,void 0,void 0,(function*(){const l=a.Logger.logfunction("MakeTheNameInBackend",s);try{let s={newConceptId:e,referent:t,typeId:o,typeUserId:c},d=(0,i.Xr)(),u=JSON.stringify(s);const h=yield fetch(n.B.MakeTheNameInBackendUrl(),{method:"POST",headers:d,body:u});a.Logger.logUpdate(l),h.ok||(0,r.ry)(h)}catch(e){e instanceof Error?console.log("make the name in backend error message: ",e.message):console.log("make the name in backend unexpected error: ",e),(0,r.Mb)(e,n.B.MakeTheNameInBackendUrl()),(0,r.ey)(l,"MakeTheNameInBackend",e)}}))}(C.id,`${t}`,S.id,f))}return C.type=S,a.Logger.logUpdate(m),C}))}},5312:(e,t,o)=>{o.d(t,{NK:()=>h,Ve:()=>p,cf:()=>d,vw:()=>f,y8:()=>u});var n=o(2832),i=o(3130),r=o(2830),c=o(1863),s=o(6687),a=o(7106),l=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function d(e){var t=arguments;return l(this,arguments,void 0,(function*(e,o="",d=null,h=i.y0){var p,y,v,g,m,C,T,w;const I=r.Logger.logfunction("SearchLinkMultipleAll",t);try{try{if(r.serviceWorker){I.serviceWorker=!0;const t=yield(0,r.sendMessage)("SearchLinkMultipleAll",{searchQuery:e,token:o,caller:d,format:h});return r.Logger.logUpdate(I),t.data}}catch(e){console.error("SearchLinkMultipleAll error sw: ",e),(0,c.ey)(I,"SearchLinkMultipleAll",e),(0,r.handleServiceWorkerException)(e)}let t=[],k=[],N=[],A=[],L=e[0].composition,S={},G={};(null==d?void 0:d.isDataLoaded)?(S.compositionIds=null===(p=d.conceptIds)||void 0===p?void 0:p.slice(),S.internalConnections=null===(y=d.internalConnections)||void 0===y?void 0:y.slice(),S.linkers=null===(v=d.linkers)||void 0===v?void 0:v.slice(),S.reverse=null===(g=d.reverse)||void 0===g?void 0:g.slice(),G=S,t=G.compositionIds,N=G.internalConnections,k=G.linkers,A=G.reverse):(console.log("calling api"),S=yield(0,n.j)(e,o),console.log("calling api end"),d&&(d.conceptIds=null===(m=S.compositionIds)||void 0===m?void 0:m.slice(),d.internalConnections=null===(C=S.internalConnections)||void 0===C?void 0:C.slice(),d.linkers=null===(T=S.linkers)||void 0===T?void 0:T.slice(),d.reverse=null===(w=S.reverse)||void 0===w?void 0:w.slice(),d.isDataLoaded=!0),G=S,t=G.compositionIds,N=G.internalConnections,k=G.linkers,A=G.reverse);let x=yield function(e,t,o,n,r,c){return l(this,arguments,void 0,(function*(e,t,o,n,r,c,l=i.y0){try{let d,h,p=yield(0,s.QL)(e);return l==i.ZJ?(d=yield(0,s.MT)(t,o),h=yield f(e,d,r,n)):l==i.yv?(d=yield(0,s.D)(t,o),h=yield f(e,d,r,n)):100==l?(d=yield(0,s.nr)(t,o),h=yield u(p,d,r,n)):l==i.SL?h=yield(0,a._W)(e,t,o,c.ofCompositions,n):(d=yield(0,s.rv)(t,o),h=yield u(p,d,r,n)),h}catch(e){return void console.log("Error Occured in build layer",e)}}))}(k,t,N,A,L,e[0],h);return r.Logger.logUpdate(I),x}catch(e){throw console.log("this is the error in the search link multiple",e),(0,c.ey)(I,"SearchLinkMultipleAll",e),e}}))}function u(e,t,o){return l(this,arguments,void 0,(function*(e,t,o,n=[]){(new Date).getTime();let i={},c=[];for(let t=0;t<e.length;t++)c.push(e[t].toTheConceptId),c.push(e[t].ofTheConceptId),c.push(e[t].typeId);e.sort((function(e,t){return t.id-e.id}));for(let o=0;o<e.length;o++){let i=!1;if(n.includes(e[o].id)&&(i=!0),1==i){if(t[e[o].ofTheConceptId]&&t[e[o].toTheConceptId]){let n=t[e[o].toTheConceptId],i=yield(0,r.GetTheConcept)(e[o].typeId),c=null==n?void 0:n.data,s=Object.keys(c)[0];try{let n=i.characterValue+"_reverse";"string"==typeof c&&(c={}),Array.isArray(c[s][n])||("string"==typeof c[s]&&(c[s]={}),c[s][n]=[]),c[s][n].push(t[e[o].ofTheConceptId])}catch(e){console.log("this is error",e)}}}else if(t[e[o].ofTheConceptId]&&t[e[o].toTheConceptId]){let n=t[e[o].ofTheConceptId],i=yield(0,r.GetTheConcept)(e[o].typeId),c=null==n?void 0:n.data,s=Object.keys(c)[0];try{"string"==typeof c&&(c={}),Array.isArray(c[s][i.characterValue])||("string"==typeof c[s]&&(c[s]={}),c[s][i.characterValue]=[]),c[s][i.characterValue].push(t[e[o].toTheConceptId])}catch(e){console.log("this is error",e)}}}return i=t[o],i}))}function h(e,t,o){return l(this,arguments,void 0,(function*(e,t,o,n=[]){let i=[],c=[];for(let t=0;t<e.length;t++)c.push(e[t].toTheConceptId),c.push(e[t].ofTheConceptId),c.push(e[t].typeId);e.sort((function(e,t){return t.id-e.id}));for(let o=0;o<e.length;o++){let i=!1;if(n.includes(e[o].id)&&(i=!0),1==i){if(t[e[o].ofTheConceptId]&&t[e[o].toTheConceptId]){let n=t[e[o].toTheConceptId],i=yield(0,r.GetTheConcept)(e[o].typeId),c=Object.keys(n)[0];try{let r=i.characterValue+"_reverse";"string"==typeof n&&(n={}),Array.isArray(n[c][r])||("string"==typeof n[c]&&(n[c]={}),n[c][r]=[]),n[c][r].push(t[e[o].ofTheConceptId])}catch(e){console.log("this is error",e)}}}else if(t[e[o].ofTheConceptId]&&t[e[o].toTheConceptId]){let n=t[e[o].ofTheConceptId],i=yield(0,r.GetTheConcept)(e[o].typeId),c=Object.keys(n)[0];try{"string"==typeof n&&(n={}),Array.isArray(n[c][i.characterValue])||("string"==typeof n[c]&&(n[c]={}),n[c][i.characterValue]=[]),n[c][i.characterValue].push(t[e[o].toTheConceptId])}catch(e){console.log("this is error",e)}}}for(let e=0;e<o.length;e++){let n=t[o[e]];n&&i.push(n)}return i}))}function p(e,t,o,n){return l(this,arguments,void 0,(function*(e,t,o,n,i=[]){(new Date).getTime();let c=[],s=[];for(let t=0;t<e.length;t++)s.push(e[t].toTheConceptId),s.push(e[t].ofTheConceptId),s.push(e[t].typeId);e.sort((function(e,t){return t.id-e.id}));for(let o=0;o<e.length;o++){let n=!1;if(i.includes(e[o].id)&&(n=!0),1==n){if(t[e[o].ofTheConceptId]&&t[e[o].toTheConceptId]){let n=t[e[o].toTheConceptId],i=yield(0,r.GetTheConcept)(e[o].typeId),c=null==n?void 0:n.data,s=Object.keys(c)[0];try{let n=i.characterValue+"_reverse";"string"==typeof c&&(c={}),Array.isArray(c[s][n])||("string"==typeof c[s]&&(c[s]={}),c[s][n]=[]),c[s][n].push(t[e[o].ofTheConceptId])}catch(e){console.log("this is error",e)}}}else if(t[e[o].ofTheConceptId]&&t[e[o].toTheConceptId]){let n=t[e[o].ofTheConceptId],i=yield(0,r.GetTheConcept)(e[o].typeId),c=null==n?void 0:n.data,s=Object.keys(c)[0];try{"string"==typeof c&&(c={}),Array.isArray(c[s][i.characterValue])||("string"==typeof c[s]&&(c[s]={}),c[s][i.characterValue]=[]),c[s][i.characterValue].push(t[e[o].toTheConceptId])}catch(e){console.log("this is error",e)}}}for(let e=0;e<n.length;e++){let o=t[n[e]];o&&c.push(o)}return c}))}function f(e,t,o){return l(this,arguments,void 0,(function*(e,t,o,n=[]){let i={},c=yield(0,r.GetConnectionBulk)(e),s=[];for(let e=0;e<c.length;e++)s.push(c[e].toTheConceptId),s.push(c[e].ofTheConceptId),s.push(c[e].typeId);yield(0,r.GetConceptBulk)(s),c.sort((function(e,t){return t.id-e.id}));for(let e=0;e<c.length;e++){let o=!1;if(n.includes(c[e].id)&&(o=!0),1==o){if(t[c[e].ofTheConceptId]&&t[c[e].toTheConceptId]){let o=t[c[e].toTheConceptId],n=yield(0,r.GetTheConcept)(c[e].typeId),i=o,s=Object.keys(i)[0];try{let o=n.characterValue+"_reverse";"string"==typeof i&&(i={}),Array.isArray(i[s][o])||("string"==typeof i[s]&&(i[s]={}),i[s][o]=[]),i[s][o].push(t[c[e].ofTheConceptId])}catch(e){console.log("this is error",e)}}}else if(t[c[e].ofTheConceptId]&&t[c[e].toTheConceptId]){let o=t[c[e].ofTheConceptId],n=yield(0,r.GetTheConcept)(c[e].typeId),i=o,s=Object.keys(i)[0];try{"string"==typeof i&&(i={}),Array.isArray(i[s][n.characterValue])||("string"==typeof i[s]&&(i[s]={}),i[s][n.characterValue]=[]),i[s][n.characterValue].push(t[c[e].toTheConceptId])}catch(e){console.log("this is error",e)}}}return i=t[o],i}))}},7106:(e,t,o)=>{o.d(t,{zl:()=>v,b6:()=>C,e$:()=>w,y6:()=>T,yV:()=>g,_W:()=>m});var n=o(2830),i=o(6687);function r(e){return e.startsWith("the_")?e.slice(4):e}var c=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function s(e,t,o){return c(this,void 0,void 0,(function*(){var i,r,c,s,a,l,d,u;let h=[];for(let t=0;t<e.length;t++)h.push(e[t].toTheConceptId),h.push(e[t].ofTheConceptId),h.push(e[t].typeId);for(let h=0;h<e.length;h++){let p=!1;o.includes(e[h].id)&&(p=!0);let f=yield(0,n.GetTheConcept)(e[h].ofTheConceptId),y=yield(0,n.GetTheConcept)(e[h].toTheConceptId);if(1==p){if(0!=f.id&&0!=y.id){let o,a=null!==(r=null===(i=y.type)||void 0===i?void 0:i.characterValue)&&void 0!==r?r:"self";e[h].toTheConceptId in t?o=t[e[h].toTheConceptId]:(o={},o[a]={},t[e[h].toTheConceptId]=o);let l=yield(0,n.GetTheConcept)(e[h].typeId);try{let e=null!==(s=null===(c=null==f?void 0:f.type)||void 0===c?void 0:c.characterValue)&&void 0!==s?s:"none",o=f.characterValue;l.characterValue,l.characterValue.includes("_s_")&&(f.id in t||(t[f.id]={}),t[f.id][e]=o),t[y.id]={}}catch(e){console.log("this is error",e)}}}else if(0!=f.id&&0!=y.id){let o,i=null!==(l=null===(a=f.type)||void 0===a?void 0:a.characterValue)&&void 0!==l?l:"self";e[h].ofTheConceptId in t?o=t[e[h].ofTheConceptId]:(o={},o[i]={},t[e[h].ofTheConceptId]=o);let r=yield(0,n.GetTheConcept)(e[h].typeId);try{let e=null!==(u=null===(d=null==y?void 0:y.type)||void 0===d?void 0:d.characterValue)&&void 0!==u?u:"none",o=y.characterValue;r.characterValue.includes("_s_")&&(y.id in t||(t[y.id]={}),t[y.id][e]=o),t[f.id]={}}catch(e){console.log("this is error",e)}}}return t}))}var a=o(5312),l=o(7876),d=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function u(e,t,o){if(e in t){let n=t[e];console.log("this is the count info",n),n&&(o[n.connectionType+"_count"]=n.count,console.log("this is the data updated",o))}}var h=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))},p=o(5898);function f(e,t="DESC"){return console.log("this is the order",t),"ASC"==t?e.sort((function(e,t){return e.id-t.id})):e.sort((function(e,t){return t.id-e.id})),e}var y=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function v(e,t){return y(this,arguments,void 0,(function*(e,t,o=""){let r=yield(0,n.SearchWithTypeAndLinkerApi)(e,t,o),c=r.compositionIds,s=r.internalConnections,l=r.linkers,d=r.reverse,u=r.mainCompositionIds,h=yield(0,i.QL)(l),p=yield(0,i.MT)(c,s);return yield(0,a.NK)(h,p,u,d)}))}function g(e,t,o,n,r){return y(this,void 0,void 0,(function*(){let c=yield(0,i.QL)(e),s=yield(0,i.rv)(t,o);return yield(0,a.Ve)(c,s,t,n,r)}))}function m(e,t,o,n,r){return y(this,void 0,void 0,(function*(){let c=yield(0,i.QL)(e),s=yield(0,i.D)(t,o);return yield(0,a.NK)(c,s,n,r)}))}function C(e,t,o,a,l){return y(this,void 0,void 0,(function*(){if(n.serviceWorker)try{return(yield(0,n.sendMessage)("formatConnections",{linkers:e,conceptIds:t,mainCompositionIds:o,reverse:a,countInfos:l})).data}catch(e){console.error("formatConnections error sw: ",e),(0,n.handleServiceWorkerException)(e)}let d=yield(0,i.QL)(e);d=f(d);let u=[],h=(new Date).getTime();u=yield s(d,u,a),console.log("format1",(new Date).getTime()-h);let p=(new Date).getTime();u=yield function(e,t,o){return c(this,void 0,void 0,(function*(){var i,c,s,a,l,d,u,h;let p=[];for(let t=0;t<e.length;t++)p.push(e[t].toTheConceptId),p.push(e[t].ofTheConceptId),p.push(e[t].typeId);e.sort((function(e,t){return t.id-e.id}));for(let p=0;p<e.length;p++){let f=!1;o.includes(e[p].id)&&(f=!0);let y=yield(0,n.GetTheConcept)(e[p].ofTheConceptId),v=yield(0,n.GetTheConcept)(e[p].toTheConceptId);if(1==f){if(0!=y.id&&0!=v.id){let o,l=null!==(c=null===(i=v.type)||void 0===i?void 0:i.characterValue)&&void 0!==c?c:"self";e[p].toTheConceptId in t?(o=t[e[p].toTheConceptId],l in o||(o[l]={})):(o={},o[l]={},t[e[p].toTheConceptId]=o);let d=yield(0,n.GetTheConcept)(e[p].typeId);try{let e=null!==(a=null===(s=null==y?void 0:y.type)||void 0===s?void 0:s.characterValue)&&void 0!==a?a:"none",t=y.characterValue,n=d.characterValue;""==n&&(n=e,n=r(n));let i={[e]:t},c=n+"_reverse";d.characterValue.includes("_s_")||("string"==typeof o[l]&&(o[l]={}),o[l][c]=i)}catch(e){console.log("this is error",e)}}}else if(0!=y.id&&0!=v.id){let o,i=null!==(d=null===(l=y.type)||void 0===l?void 0:l.characterValue)&&void 0!==d?d:"self";e[p].ofTheConceptId in t?(o=t[e[p].ofTheConceptId],i in o||(o[i]={})):(o={},o[i]={},t[e[p].ofTheConceptId]=o);let c=yield(0,n.GetTheConcept)(e[p].typeId);try{let e=null!==(h=null===(u=null==v?void 0:v.type)||void 0===u?void 0:u.characterValue)&&void 0!==h?h:"none",t=v.characterValue,n=c.characterValue,s=(c.characterValue,!1);""==n&&(n=e,n=r(n),s=!0);let a={[e]:t};isNaN(Number(n))?c.characterValue.includes("_s_")||("string"==typeof o[i]&&(o[i]={}),o[i][n]=s?t:a):o[i]=[]}catch(e){console.log("this is error",e)}}}return t}))}(d,u,a),console.log("format2",(new Date).getTime()-p);let y=(new Date).getTime(),v=yield function(e,t,o,i){return c(this,arguments,void 0,(function*(e,t,o,i,r=[]){var c,s,a,l,d,u;let h=[],p=[];for(let t=0;t<e.length;t++)p.push(e[t].toTheConceptId),p.push(e[t].ofTheConceptId),p.push(e[t].typeId);e.sort((function(e,t){return t.id-e.id}));for(let o=0;o<e.length;o++){let i=!1;r.includes(e[o].id)&&(i=!0);let h=yield(0,n.GetTheConcept)(e[o].ofTheConceptId),p=yield(0,n.GetTheConcept)(e[o].toTheConceptId);if(1==i){if(0!=h.id&&0!=p.id&&p.id in t){let i,r=null!==(s=null===(c=p.type)||void 0===c?void 0:c.characterValue)&&void 0!==s?s:"self";e[o].toTheConceptId in t?i=t[e[o].toTheConceptId]:(i={},i[r]={},t[e[o].toTheConceptId]=i);let a=yield(0,n.GetTheConcept)(e[o].typeId);try{let n=a.characterValue+"_reverse",c=t[e[o].ofTheConceptId];c&&(Array.isArray(i[r][n])?i[r][n].push(c):a.characterValue.includes("_s_")?(i[r][n]=[],i[r][n].push(c)):i[r][n]=c)}catch(e){console.log("this is error",e)}}}else if(0!=h.id&&0!=p.id&&h.id in t){let i,r=null!==(l=null===(a=h.type)||void 0===a?void 0:a.characterValue)&&void 0!==l?l:"self";e[o].ofTheConceptId in t?(i=t[e[o].ofTheConceptId],"string"==typeof i[r]&&(i[r]={})):(i={},i[r]={},t[e[o].ofTheConceptId]=i);let c=!1,s=(yield(0,n.GetTheConcept)(e[o].typeId)).characterValue;""==s&&(s=p.characterValue,c=!0),""==s&&(s=null!==(u=null===(d=null==p?void 0:p.type)||void 0===d?void 0:d.characterValue)&&void 0!==u?u:"");try{let n=t[e[o].toTheConceptId];n&&(Array.isArray(i[r])?c?i[r].push(n[s]):i[r].push(n):Array.isArray(i[r][s])?i[r][s].push(n):s.includes("_s_")?(i[r][s]=[],c?i[r][s].push(n[s]):i[r][s].push(n)):i[r][s]=c?n[s]:n)}catch(e){console.log("this is error",e)}}}for(let e=0;e<o.length;e++){let n=t[o[e]];n&&(n.id=o[e],h.push(n))}return h}))}(d,u,o,[],a);return console.log("format3",(new Date).getTime()-y),v}))}function T(e,t,o,c,a){return y(this,arguments,void 0,(function*(e,t,o,c,a,h="DESC"){if(n.serviceWorker)try{return(yield(0,n.sendMessage)("formatConnectionsJustId",{linkers:e,conceptIds:t,mainCompositionIds:o,reverse:c,countInfos:a,order:h})).data}catch(e){console.error("formatConnectionsJustId error sw: ",e),(0,n.handleServiceWorkerException)(e)}let y=yield(0,i.QL)(e),v=yield(0,p.V)(a);y=f(y,h);let g=[];g=yield s(y,g,c),g=yield function(e,t){return d(this,arguments,void 0,(function*(e,t,o=[]){var n,i,c,s,a,d,u,h;let p=[];for(let t=0;t<e.length;t++)p.push(e[t].toTheConceptId),p.push(e[t].ofTheConceptId),p.push(e[t].typeId);for(let p=0;p<e.length;p++){let f=!1,y=yield(0,l.A)(e[p].ofTheConceptId),v=yield(0,l.A)(e[p].toTheConceptId);if(o.includes(e[p].id)&&(f=!0),1==f){if(0!=y.id&&0!=v.id){let o,a=yield(0,l.A)(e[p].typeId),d=null!==(i=null===(n=v.type)||void 0===n?void 0:n.characterValue)&&void 0!==i?i:"self";e[p].toTheConceptId in t?(o=t[e[p].toTheConceptId],d in o||(o[d]={})):(o={},o[d]={},t[e[p].toTheConceptId]=o);try{let e=null!==(s=null===(c=null==y?void 0:y.type)||void 0===c?void 0:c.characterValue)&&void 0!==s?s:"none",t=y.characterValue,n=a.characterValue;""==n&&(n=e,n=r(n));let i={id:y.id,[e]:t},l=n+"_reverse";l.includes("_s_")||("string"==typeof o[d]&&(o[d]={}),o[d][l]=i)}catch(e){console.log("this is error",e)}}}else if(0!=y.id&&0!=v.id){let o,n=yield(0,l.A)(e[p].typeId),i=null!==(d=null===(a=y.type)||void 0===a?void 0:a.characterValue)&&void 0!==d?d:"self";e[p].ofTheConceptId in t?(o=t[e[p].ofTheConceptId],i in o||(o[i]={})):(o={},o[i]={},t[e[p].ofTheConceptId]=o);try{let t=null!==(h=null===(u=null==v?void 0:v.type)||void 0===u?void 0:u.characterValue)&&void 0!==h?h:"none",c=v.characterValue,s=n.characterValue,a=!1;""==s&&(s=t,s=r(s),a=!0);let l={};l[t]={id:v.id,data:c,created_on:e[p].entryTimeStamp},isNaN(Number(s))?s.includes("_s_")||("string"==typeof o[i]&&(o[i]={}),o[i][s]=a?l[t]:l):o[i]=[]}catch(e){console.log("this is error",e)}}}return t}))}(y,g,c);let m=yield function(e,t,o){return d(this,arguments,void 0,(function*(e,t,o,n=[],i){var r,c,s,a,d,h,p;(new Date).getTime();let f=[],y=[];for(let t=0;t<e.length;t++)y.push(e[t].toTheConceptId),y.push(e[t].ofTheConceptId),y.push(e[t].typeId);for(let o=0;o<e.length;o++){let f=!1,y=yield(0,l.A)(e[o].ofTheConceptId),v=yield(0,l.A)(e[o].toTheConceptId);if(n.includes(e[o].id)&&(f=!0),1==f){if(0!=y.id&&0!=v.id&&v.id in t){let n,i=yield(0,l.A)(e[o].typeId),s=null!==(c=null===(r=v.type)||void 0===r?void 0:r.characterValue)&&void 0!==c?c:"self",a=!1;e[o].toTheConceptId in t&&(a=!0),e[o].toTheConceptId in t?(n=t[e[o].toTheConceptId],"string"==typeof n[s]&&(n[s]={})):(n={},n[s]={},t[e[o].toTheConceptId]=n);try{if(t[e[o].ofTheConceptId]){let r=t[e[o].ofTheConceptId];r&&(r.id=y.id,r.created_on=y.entryTimeStamp);let c=i.characterValue+"_reverse";Array.isArray(n[s][c])?n[s][c].push(r):c.includes("_s_")?(n[s][c]=[],n[s][c].push(r)):n[s][c]=r}}catch(e){console.log("this is error",e)}}}else if(0!=y.id&&0!=v.id&&y.id in t){let n,r=yield(0,l.A)(e[o].typeId),c=null!==(a=null===(s=y.type)||void 0===s?void 0:s.characterValue)&&void 0!==a?a:"self",f=!1;e[o].toTheConceptId in t&&(f=!0),e[o].ofTheConceptId in t?(n=t[e[o].ofTheConceptId],"string"==typeof n[c]&&(n[c]={})):(n={},n[c]={},t[e[o].ofTheConceptId]=n),u(y.id,i,n);let g=!1,m=r.characterValue;""==m&&(m=v.characterValue,g=!0),""==m&&(m=null===(d=null==v?void 0:v.type)||void 0===d?void 0:d.characterValue);try{let r=null!==(p=null===(h=null==v?void 0:v.type)||void 0===h?void 0:h.characterValue)&&void 0!==p?p:"none",s=t[e[o].toTheConceptId];if(s){let t={};t[r]={data:s[r],id:v.id,created_on:e[o].entryTimeStamp},Array.isArray(n[c])?g?n[c].push(s[m]):n[c].push(s):Array.isArray(n[c][m])?n[c][m].push(t):m.includes("_s_")?(n[c][m]=[],g?n[c][m].push(t[r]):n[c][m].push(t)):n[c][m]=g?t[r]:t,u(v.id,i,t)}}catch(e){console.log("this is error",e)}}}console.log("this is the main compositions",o);for(let e=0;e<o.length;e++){let n={};console.log("this is the main compositions DATA",t[o[e]]),n=t[o[e]],n&&(n.id=o[e]),f.push(n)}return f}))}(y,g,o,c,v);return m}))}function w(e,t,o,c,s){return y(this,arguments,void 0,(function*(e,t,o,c,s,a="DESC"){if(n.serviceWorker)try{return(yield(0,n.sendMessage)("formatConnectionsDataId",{linkers:e,conceptIds:t,mainCompositionIds:o,reverse:c,countInfos:s,order:a})).data}catch(e){console.error("GetConnectionDataPrefetch error sw: ",e),(0,n.handleServiceWorkerException)(e)}let l=yield(0,i.QL)(e),d=yield(0,p.V)(s);l=f(l,a),console.log("this is the prfetch connections",l);let u=[],y=(new Date).getTime();u=yield function(e,t){var o=arguments;return h(this,arguments,void 0,(function*(e,t,i=[]){var r,c,s,a,l,d,u,h;const p=n.Logger.logfunction("FormatFunctionData",o);let f=[];for(let t=0;t<e.length;t++)f.push(e[t].toTheConceptId),f.push(e[t].ofTheConceptId),f.push(e[t].typeId);for(let o=0;o<e.length;o++){let p=!1,f=yield(0,n.GetTheConcept)(e[o].ofTheConceptId),y=yield(0,n.GetTheConcept)(e[o].toTheConceptId);if(i.includes(e[o].id)&&(p=!0),1==p){if(0!=f.id&&0!=y.id){let i,l=yield(0,n.GetTheConcept)(e[o].typeId),d=null!==(c=null===(r=y.type)||void 0===r?void 0:r.characterValue)&&void 0!==c?c:"self";e[o].toTheConceptId in t?i=t[e[o].toTheConceptId]:(i={},i[d]={},t[e[o].toTheConceptId]=i);try{let e=null!==(a=null===(s=null==f?void 0:f.type)||void 0===s?void 0:s.characterValue)&&void 0!==a?a:"none",o=f.characterValue;(l.characterValue+"_reverse").includes("_s_")&&(f.id in t||(t[f.id]={}),t[f.id][e]=o),t[y.id]={}}catch(e){console.log("this is error",e)}}}else if(0!=f.id&&0!=y.id){let i,r=yield(0,n.GetTheConcept)(e[o].typeId),c=null!==(d=null===(l=f.type)||void 0===l?void 0:l.characterValue)&&void 0!==d?d:"self";e[o].ofTheConceptId in t?i=t[e[o].ofTheConceptId]:(i={},i[c]={},t[e[o].ofTheConceptId]=i);try{let e=null!==(h=null===(u=null==y?void 0:y.type)||void 0===u?void 0:u.characterValue)&&void 0!==h?h:"none",o=y.characterValue;r.characterValue.includes("_s_")&&(y.id in t||(t[y.id]={}),t[y.id][e]=o),t[f.id]={}}catch(e){console.log("this is error",e)}}}return n.Logger.logUpdate(p),t}))}(l,u,c),console.log("format1",(new Date).getTime()-y);let v=(new Date).getTime();u=yield function(e,t){var o=arguments;return h(this,arguments,void 0,(function*(e,t,i=[]){var c,s,a,l,d,u,h,p;const f=n.Logger.logfunction("FormatFunctionDataForData",o);let y=[];for(let t=0;t<e.length;t++)y.push(e[t].toTheConceptId),y.push(e[t].ofTheConceptId),y.push(e[t].typeId);for(let o=0;o<e.length;o++){let f=!1,y=yield(0,n.GetTheConcept)(e[o].ofTheConceptId),v=yield(0,n.GetTheConcept)(e[o].toTheConceptId);if(i.includes(e[o].id)&&(f=!0),1==f){if(0!=y.id&&0!=v.id){let i,d=yield(0,n.GetTheConcept)(e[o].typeId),u=null!==(s=null===(c=v.type)||void 0===c?void 0:c.characterValue)&&void 0!==s?s:"self";e[o].toTheConceptId in t?(i=t[e[o].toTheConceptId],u in i||(i[u]={})):(i={},i[u]={},t[e[o].toTheConceptId]=i);try{let e=null!==(l=null===(a=null==y?void 0:y.type)||void 0===a?void 0:a.characterValue)&&void 0!==l?l:"none",t=y.characterValue,o=d.characterValue;""==o&&(o=e,o=r(o));let n={id:y.id,data:{[e]:t}},c=o+"_reverse";c.includes("_s_")||("string"==typeof i[u]&&(i[u]={}),i[u][c]=n)}catch(e){console.log("this is error",e)}}}else if(0!=y.id&&0!=v.id){let i,c=yield(0,n.GetTheConcept)(e[o].typeId),s=null!==(u=null===(d=y.type)||void 0===d?void 0:d.characterValue)&&void 0!==u?u:"self";e[o].ofTheConceptId in t?(i=t[e[o].ofTheConceptId],s in i||(i[s]={})):(i={},i[s]={},t[e[o].ofTheConceptId]=i);try{let e=null!==(p=null===(h=null==v?void 0:v.type)||void 0===h?void 0:h.characterValue)&&void 0!==p?p:"none",t=v.characterValue,o=c.characterValue,n=!1;""==o&&(o=e,o=r(o),n=!0);let a={id:v.id,data:{[e]:t}};isNaN(Number(o))?o.includes("_s_")||("string"==typeof i[s]&&(i[s]={}),i[s][o]=a):i[s]=[]}catch(e){console.log("this is error",e)}}}return n.Logger.logUpdate(f),t}))}(l,u,c),console.log("format2",(new Date).getTime()-v);let g=(new Date).getTime(),m=yield function(e,t,o,i){var r=arguments;return h(this,arguments,void 0,(function*(e,t,o,i,c=[],s){var a,l,d,u,h,p;const f=n.Logger.logfunction("FormatFromConnectionsAlteredArrayExternal",r);let y=[],v=[];for(let t=0;t<e.length;t++)v.push(e[t].toTheConceptId),v.push(e[t].ofTheConceptId),v.push(e[t].typeId);for(let o=0;o<e.length;o++){let i=!1,r=yield(0,n.GetTheConcept)(e[o].ofTheConceptId),s=yield(0,n.GetTheConcept)(e[o].toTheConceptId);if(c.includes(e[o].id)&&(i=!0),1==i){if(0!=r.id&&0!=s.id&&s.id in t){let i,c=yield(0,n.GetTheConcept)(e[o].typeId),d=null!==(l=null===(a=s.type)||void 0===a?void 0:a.characterValue)&&void 0!==l?l:"self",u=!1;e[o].toTheConceptId in t&&(u=!0),e[o].toTheConceptId in t?(i=t[e[o].toTheConceptId],"string"==typeof i[d]&&(i[d]={})):(i={},i[d]={},t[e[o].toTheConceptId]=i);try{if(t[e[o].ofTheConceptId]){let n={id:r.id,data:t[e[o].ofTheConceptId],created_on:e[o].entryTimeStamp},s=c.characterValue+"_reverse";Array.isArray(i[d][s])?i[d][s].push(n):s.includes("_s_")?(i[d][s]=[],i[d][s].push(n)):i[d][s]=n}}catch(e){console.log("this is error",e)}}}else if(0!=r.id&&0!=s.id&&r.id in t){let i,c=yield(0,n.GetTheConcept)(e[o].typeId),a=null!==(u=null===(d=r.type)||void 0===d?void 0:d.characterValue)&&void 0!==u?u:"self",l=!1;e[o].toTheConceptId in t&&(l=!0),e[o].ofTheConceptId in t?(i=t[e[o].ofTheConceptId],"string"==typeof i[a]&&(i[a]={})):(i={},i[a]={},t[e[o].ofTheConceptId]=i);let f=!0,y=c.characterValue;""==y&&(y=s.characterValue,f=!0),""==y&&(y=null===(h=null==s?void 0:s.type)||void 0===h?void 0:h.characterValue);try{null===(p=null==s?void 0:s.type)||void 0===p||p.characterValue;let n=t[e[o].toTheConceptId];if(n){let r={id:s.id,data:t[e[o].toTheConceptId],created_on:e[o].entryTimeStamp};Array.isArray(i[a])?i[a].push(n):Array.isArray(i[a][y])?i[a][c.characterValue].push(r):y.includes("_s_")?(i[a][y]=[],i[a][y].push(r)):i[a][y]=r}}catch(e){console.log("this is error",e)}}}for(let e=0;e<i.length;e++){let o={};o.id=i[e],o.data=t[i[e]],y.push(o)}return n.Logger.logUpdate(f),y}))}(l,u,[],o,c,d);return console.log("format2",(new Date).getTime()-g),m}))}},3518:(e,t,o)=>{o.d(t,{BZ:()=>c,Xr:()=>i,ab:()=>r});var n=o(3278);function i(e="application/json",t="application/json"){let o={};return o=""!=n.b.BearerAccessToken?{"Content-Type":e,Authorization:"Bearer "+n.b.BearerAccessToken,Accept:t}:{"Content-Type":e,Accept:t},o}function r(e="application/json",t="",o="application/json"){""==t&&(t=n.b.BearerAccessToken);let i={};return i=""!=t?{"Content-Type":e,Authorization:"Bearer "+t,Accept:o}:{"Content-Type":e,Accept:o},i}function c(){let e=n.b.BearerAccessToken;const t=new Headers;return t.append("Authorization","Bearer "+e),t}},6467:(e,t,o)=>{function n(e){const t=e.lastIndexOf("_");let o=[];return o=t>0?[e.substring(0,t),e.substring(t+1,e.length)]:[e],o}o.d(t,{f:()=>n})},4310:(e,t,o)=>{o.d(t,{C:()=>l,i:()=>d});var n=o(2830),i=o(5898),r=o(1863),c=o(7106),s=o(3518),a=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function l(e){var t=arguments;return a(this,void 0,void 0,(function*(){n.Logger.logfunction("BuildWidgetFromId",t);try{try{if(n.serviceWorker)return(yield(0,n.sendMessage)("BuildWidgetFromId",{id:e})).data}catch(e){console.error("BuildWidgetFromId error sw: ",e),(0,n.handleServiceWorkerException)(e)}let t=[],o=[],a=[],l=[],d="DESC",u=[],h={},p={},f=(0,s.Xr)("application/json"),y=n.BaseUrl.getWidgetData()+"?id="+e;const v=yield fetch(y,{method:"GET",headers:f});if(!v.ok)return(0,r.ry)(v),console.log("This is the BuildWidgetFromId error",v.status),[];h=yield v.json(),t=h.conceptIds,o=h.linkers,a=h.reverse,l=h.mainCompositionIds,u=h.countinfo,console.log("this is the concept",h);let g=(0,i.w)(u);return p=yield(0,c.e$)(o,t,l,a,g,d),console.log("this is the widget build data",p),p}catch(e){throw console.log("this is the error in the build widget",e),e}}))}function d(e,t){for(let o=0;o<e.length;o++)if(t==e[o].id)return e[o]}},4287:(e,t,o)=>{o.d(t,{w:()=>c});var n=o(2830),i=o(3130),r=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class c{constructor(){this.subscribers=[],this.mainConcept=0,this.compositionIds=[],this.conceptIds=[],this.internalConnections=[],this.reverse=[],this.linkers=[],this.dependency=[],this.isDataLoaded=!1,this.isUpdating=!1,this.fetched=!1,this.format=i.yv}listenToEventType(e){console.log("this is the type listen before",e),window.addEventListener(`${e}`,(t=>{if(console.log("this is the window event",e,t),this.isUpdating)console.log("rejected this");else{this.isUpdating=!0;let e=this;setTimeout((function(){return r(this,void 0,void 0,(function*(){let o=t;console.log("this is the event",o),e.compositionIds.includes(null==o?void 0:o.detail)||(e.compositionIds.unshift(null==o?void 0:o.detail),e.listenToEvent(null==o?void 0:o.detail)),e.isUpdating=!1,yield e.bind(),e.notify()}))}),200)}}))}listenToEvent(e){console.log("this is listening to the id adding event",e),window.addEventListener(`${e}`,(t=>{if(this.isUpdating)console.log("rejected this");else{this.isUpdating=!0;let t=this;setTimeout((function(){return r(this,void 0,void 0,(function*(){let o=yield n.ConnectionData.GetConnectionByOfTheConceptAndType(e,e);console.log("this is the new connections",o);for(let e=0;e<o.length;e++)yield n.ConnectionData.GetConnection(o[e]).then((e=>{e.typeId==t.mainConcept?t.internalConnections.includes(e.id)||t.internalConnections.push(e.id):t.linkers.includes(e.id)||t.linkers.push(e.id),t.conceptIds.includes(e.toTheConceptId)||t.conceptIds.push(e.toTheConceptId),t.compositionIds.includes(e.ofTheConceptId)||t.compositionIds.push(e.ofTheConceptId)}));t.isUpdating=!1,yield t.bind(),t.notify()}))}),200)}}))}listenToEventConnectionType(e,t){window.addEventListener(`${e}`,(o=>{if(this.isUpdating)console.log("rejected this");else{this.isUpdating=!0;let o=this;setTimeout((function(){return r(this,void 0,void 0,(function*(){let i=yield n.ConnectionData.GetConnectionByOfTheConceptAndType(e,e);for(let e=0;e<i.length;e++)i.typeId==t&&(yield n.ConnectionData.GetConnection(i[e]).then((e=>{e.typeId==o.mainConcept?o.internalConnections.includes(e.id)||o.internalConnections.push(e.id):o.linkers.includes(e.id)||o.linkers.push(e.id),o.conceptIds.includes(e.toTheConceptId)||o.conceptIds.push(e.toTheConceptId),o.compositionIds.includes(e.ofTheConceptId)||o.compositionIds.push(e.ofTheConceptId)})));o.isUpdating=!1,yield o.bind(),o.notify()}))}),200)}}))}bind(){return r(this,void 0,void 0,(function*(){console.log("this is the old execute data")}))}subscribe(e){return r(this,void 0,void 0,(function*(){return this.subscribers.push(e),console.log("again executing data"),yield this.bind(),e(this.data)}))}unsubscribe(e){return this.subscribers.filter((t=>t!=e)),this.subscribers.length}notify(){console.log("notifiers",this.subscribers),this.subscribers.map((e=>{console.log("notify"),e(this.data)}))}}},5328:(e,t,o)=>{o.d(t,{d:()=>l});var n=o(2830),i=o(3130),r=o(8939),c=o(4287),s=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class a extends c.w{constructor(e,t,o,n,i){super(),this.connections=[],this.data=[],this.mainConcept=e,this.linker=t,this.inpage=o,this.page=n,this.format=i}bind(){return s(this,void 0,void 0,(function*(){var e;if(!this.isDataLoaded){let i=yield(0,n.GetTheConcept)(this.mainConcept),r=(null===(e=i.type)||void 0===e?void 0:e.characterValue)+"_s_"+this.linker,c=yield(0,n.GetConceptByCharacterAndType)(r,16);if(c.id>0){let e=yield(0,n.GetConnectionOfTheConcept)(c.id,i.id,i.userId,this.inpage,this.page);this.connections=e;for(var t=[],o=0;o<this.connections.length;o++)t.push(this.connections[o].toTheConceptId),this.linkers.push(this.connections[o].id),this.listenToEvent(this.connections[o].toTheConceptId);yield(0,n.GetAllConnectionsOfCompositionBulk)(t)}this.isDataLoaded=!0,this.listenToEvent(this.mainConcept)}return yield this.build()}))}build(){return s(this,void 0,void 0,(function*(){this.data=[],this.connections=yield(0,n.GetConnectionBulk)(this.linkers);for(var e=0;e<this.connections.length;e++){let t=this.connections[e].toTheConceptId,o=yield(0,n.GetTheConcept)(t);if(console.log("this is the format",this.format),this.format==i.yv){let e=yield(0,r.RW)(o.id);this.data.push(e)}else if(this.format==i.ZJ){let e=yield(0,r.kx)(o.id);this.data.push(e)}else if(this.format==i.iw){let e=yield(0,n.GetCompositionWithIdAndDateFromMemory)(o.id);this.data.push(e)}else{let e=yield(0,n.GetCompositionWithIdAndDateFromMemory)(o.id);this.data.push(e)}}return this.data}))}}function l(e,t,o,n,r=i.yv){return new a(e,t,o,n,r)}},2830:(e,t,o)=>{o.r(t),o.d(t,{ADMIN:()=>Uo,ALLID:()=>Do.BG,AccessTracker:()=>Je.J,AddGhostConcept:()=>lo,Anomaly:()=>Gn,BaseUrl:()=>l.B,BinaryTree:()=>We.W,BuildWidgetFromId:()=>$n.C,BuilderStatefulWidget:()=>kn,Composition:()=>Dt,CompositionBinaryTree:()=>xt,CompositionNode:()=>St,Concept:()=>on.j,ConceptsData:()=>a.I,Connection:()=>O.N,ConnectionData:()=>ze.d,CreateComposition:()=>E.A,CreateConnectionBetweenEntityLocal:()=>Hn,CreateConnectionBetweenTwoConcepts:()=>X,CreateConnectionBetweenTwoConceptsGeneral:()=>Z,CreateConnectionBetweenTwoConceptsLocal:()=>Lo.h,CreateDefaultConcept:()=>M.o,CreateDefaultLConcept:()=>oo.u,CreateSession:()=>Xt,CreateSessionVisit:()=>Zt,CreateTheCompositionLocal:()=>F.R,CreateTheCompositionWithCache:()=>Et,CreateTheConnection:()=>ie.q,CreateTheConnectionGeneral:()=>$,CreateTheConnectionLocal:()=>no.F,DATAID:()=>Do.y0,DATAIDDATE:()=>Do.iw,DelayFunctionExecution:()=>bo,DeleteConceptById:()=>Pe,DeleteConceptLocal:()=>Go,DeleteConnectionById:()=>J.m,DeleteConnectionByType:()=>Dn,DeleteUser:()=>je,DependencyObserver:()=>Oo.w,FilterSearch:()=>ln,FormatFromConnections:()=>uo.vw,FormatFromConnectionsAltered:()=>uo.y8,FreeschemaQuery:()=>En,FreeschemaQueryApi:()=>_n,GetAllConnectionsOfComposition:()=>U.s,GetAllConnectionsOfCompositionBulk:()=>f.Y,GetAllTheConnectionsByTypeAndOfTheConcept:()=>Un,GetComposition:()=>v.Nj,GetCompositionBulk:()=>et.dF,GetCompositionBulkWithDataId:()=>et.cw,GetCompositionFromConnectionsWithDataId:()=>et.p8,GetCompositionFromConnectionsWithDataIdFromConnections:()=>et.km,GetCompositionFromConnectionsWithDataIdInObject:()=>et.rv,GetCompositionFromConnectionsWithDataIdIndex:()=>et.Nt,GetCompositionFromConnectionsWithIndex:()=>et.as,GetCompositionFromConnectionsWithIndexFromConnections:()=>et.hG,GetCompositionFromMemoryWithConnections:()=>v.JA,GetCompositionList:()=>T,GetCompositionListAll:()=>w,GetCompositionListAllWithId:()=>I,GetCompositionListListener:()=>zo,GetCompositionListLocal:()=>b,GetCompositionListLocalWithId:()=>D,GetCompositionListWithId:()=>k,GetCompositionListWithIdUpdated:()=>N,GetCompositionListener:()=>Ho,GetCompositionLocal:()=>G,GetCompositionLocalWithId:()=>x,GetCompositionWithAllIds:()=>v.Mb,GetCompositionWithCache:()=>Ht,GetCompositionWithDataIdBulk:()=>zt,GetCompositionWithDataIdWithCache:()=>Jt,GetCompositionWithId:()=>v.yz,GetCompositionWithIdAndDateFromMemory:()=>v.Ez,GetConceptBulk:()=>pt.r,GetConceptByCharacter:()=>g.A,GetConceptByCharacterAndCategoryLocal:()=>m.$I,GetConceptByCharacterAndType:()=>re.A,GetConnectionBetweenTwoConceptsLinker:()=>Ro,GetConnectionBulk:()=>ft.j,GetConnectionById:()=>Xe,GetConnectionDataPrefetch:()=>et.QL,GetConnectionOfTheConcept:()=>W,GetLink:()=>se,GetLinkListListener:()=>tn,GetLinkListener:()=>Qo.d,GetLinkRaw:()=>ae,GetLinkerConnectionFromConcepts:()=>De,GetLinkerConnectionToConcepts:()=>Ue,GetRelation:()=>eo,GetRelationLocal:()=>vo,GetRelationRaw:()=>to,GetTheConcept:()=>z.A,GetTheConceptLocal:()=>ho.f,GetUserGhostId:()=>ao,JUSTDATA:()=>Do.ZJ,LConcept:()=>nn,LConnection:()=>rn,LISTNORMAL:()=>Do.SL,LocalConceptsData:()=>y.v,LocalSyncData:()=>an.H,LocalTransaction:()=>An,Logger:()=>yn.V,LoginToBackend:()=>gt,MakeTheInstanceConcept:()=>q.A,MakeTheInstanceConceptLocal:()=>K.k,MakeTheTimestamp:()=>Ze,MakeTheTypeConcept:()=>we,MakeTheTypeConceptApi:()=>Se,MakeTheTypeConceptLocal:()=>le.$,NORMAL:()=>Do.yv,PRIVATE:()=>Eo,PUBLIC:()=>Fo,PatcherStructure:()=>cn,RAW:()=>Do.XZ,RecursiveSearchApi:()=>ot,RecursiveSearchApiNewRawFullLinker:()=>ct,RecursiveSearchApiRaw:()=>it,RecursiveSearchApiRawFullLinker:()=>rt,RecursiveSearchApiWithInternalConnections:()=>nt,RecursiveSearchListener:()=>Zo,SchemaQueryListener:()=>Mn,SearchAllConcepts:()=>Ot,SearchLinkInternal:()=>No,SearchLinkInternalAll:()=>Ao,SearchLinkMultipleAll:()=>uo.cf,SearchLinkMultipleAllObservable:()=>Vo,SearchLinkMultipleApi:()=>c.j,SearchQuery:()=>Ke,SearchStructure:()=>dn,SearchWithLinker:()=>Mt,SearchWithTypeAndLinker:()=>qo.zl,SearchWithTypeAndLinkerApi:()=>Wo,SessionData:()=>sn,Signin:()=>It,Signup:()=>Ct,SignupEntity:()=>Tt,SplitStrings:()=>s.f,StatefulWidget:()=>wn,SyncData:()=>V.Y,TrashTheConcept:()=>$e,UpdateComposition:()=>_t,UpdateCompositionLocal:()=>po.D,UserBinaryTree:()=>co,Validator:()=>Bn,ViewInternalData:()=>To,ViewInternalDataApi:()=>mo,WidgetTree:()=>Pn,convertFromConceptToLConcept:()=>wo.F4,convertFromLConceptToConcept:()=>wo.dp,convertWidgetTreeToWidget:()=>Zn,convertWidgetTreeToWidgetWithWrapper:()=>Kn,createFormFieldData:()=>Rn,dispatchIdEvent:()=>yi,getFromDatabaseWithType:()=>oe,getObjectsFromIndexDb:()=>ne,getWidgetBulkFromId:()=>Yn,getWidgetFromId:()=>Xn,handleServiceWorkerException:()=>gi,hasActivatedSW:()=>ai,init:()=>ui,recursiveFetch:()=>v.zN,recursiveFetchNew:()=>Rt,renderLatestWidget:()=>qn,renderPage:()=>zn,renderWidget:()=>Qn,searchLinkMultipleListener:()=>Mo,sendEmail:()=>mn,sendMessage:()=>hi,serviceWorker:()=>ni,setHasActivatedSW:()=>li,storeToDatabase:()=>te,subscribedListeners:()=>ci,unwrapContainers:()=>oi,updateAccessToken:()=>di,uploadAttachment:()=>dt,uploadFile:()=>ht,uploadImage:()=>ut,validDocumentFormats:()=>lt,validImageFormats:()=>at});var n={};o.r(n),o.d(n,{ADMIN:()=>Uo,ALLID:()=>Do.BG,AccessTracker:()=>Je.J,AddGhostConcept:()=>lo,Anomaly:()=>Gn,BaseUrl:()=>l.B,BinaryTree:()=>We.W,BuildWidgetFromId:()=>$n.C,BuilderStatefulWidget:()=>kn,Composition:()=>Dt,CompositionBinaryTree:()=>xt,CompositionNode:()=>St,Concept:()=>on.j,ConceptsData:()=>a.I,Connection:()=>O.N,ConnectionData:()=>ze.d,CreateComposition:()=>E.A,CreateConnectionBetweenEntityLocal:()=>Hn,CreateConnectionBetweenTwoConcepts:()=>X,CreateConnectionBetweenTwoConceptsGeneral:()=>Z,CreateConnectionBetweenTwoConceptsLocal:()=>Lo.h,CreateDefaultConcept:()=>M.o,CreateDefaultLConcept:()=>oo.u,CreateSession:()=>Xt,CreateSessionVisit:()=>Zt,CreateTheCompositionLocal:()=>F.R,CreateTheCompositionWithCache:()=>Et,CreateTheConnection:()=>ie.q,CreateTheConnectionGeneral:()=>$,CreateTheConnectionLocal:()=>no.F,DATAID:()=>Do.y0,DATAIDDATE:()=>Do.iw,DelayFunctionExecution:()=>bo,DeleteConceptById:()=>Pe,DeleteConceptLocal:()=>Go,DeleteConnectionById:()=>J.m,DeleteConnectionByType:()=>Dn,DeleteUser:()=>je,DependencyObserver:()=>Oo.w,FilterSearch:()=>ln,FormatFromConnections:()=>uo.vw,FormatFromConnectionsAltered:()=>uo.y8,FreeschemaQuery:()=>En,FreeschemaQueryApi:()=>_n,GetAllConnectionsOfComposition:()=>U.s,GetAllConnectionsOfCompositionBulk:()=>f.Y,GetAllTheConnectionsByTypeAndOfTheConcept:()=>Un,GetComposition:()=>v.Nj,GetCompositionBulk:()=>et.dF,GetCompositionBulkWithDataId:()=>et.cw,GetCompositionFromConnectionsWithDataId:()=>et.p8,GetCompositionFromConnectionsWithDataIdFromConnections:()=>et.km,GetCompositionFromConnectionsWithDataIdInObject:()=>et.rv,GetCompositionFromConnectionsWithDataIdIndex:()=>et.Nt,GetCompositionFromConnectionsWithIndex:()=>et.as,GetCompositionFromConnectionsWithIndexFromConnections:()=>et.hG,GetCompositionFromMemoryWithConnections:()=>v.JA,GetCompositionList:()=>T,GetCompositionListAll:()=>w,GetCompositionListAllWithId:()=>I,GetCompositionListListener:()=>zo,GetCompositionListLocal:()=>b,GetCompositionListLocalWithId:()=>D,GetCompositionListWithId:()=>k,GetCompositionListWithIdUpdated:()=>N,GetCompositionListener:()=>Ho,GetCompositionLocal:()=>G,GetCompositionLocalWithId:()=>x,GetCompositionWithAllIds:()=>v.Mb,GetCompositionWithCache:()=>Ht,GetCompositionWithDataIdBulk:()=>zt,GetCompositionWithDataIdWithCache:()=>Jt,GetCompositionWithId:()=>v.yz,GetCompositionWithIdAndDateFromMemory:()=>v.Ez,GetConceptBulk:()=>pt.r,GetConceptByCharacter:()=>g.A,GetConceptByCharacterAndCategoryLocal:()=>m.$I,GetConceptByCharacterAndType:()=>re.A,GetConnectionBetweenTwoConceptsLinker:()=>Ro,GetConnectionBulk:()=>ft.j,GetConnectionById:()=>Xe,GetConnectionDataPrefetch:()=>et.QL,GetConnectionOfTheConcept:()=>W,GetLink:()=>se,GetLinkListListener:()=>tn,GetLinkListener:()=>Qo.d,GetLinkRaw:()=>ae,GetLinkerConnectionFromConcepts:()=>De,GetLinkerConnectionToConcepts:()=>Ue,GetRelation:()=>eo,GetRelationLocal:()=>vo,GetRelationRaw:()=>to,GetTheConcept:()=>z.A,GetTheConceptLocal:()=>ho.f,GetUserGhostId:()=>ao,JUSTDATA:()=>Do.ZJ,LConcept:()=>nn,LConnection:()=>rn,LISTNORMAL:()=>Do.SL,LocalConceptsData:()=>y.v,LocalSyncData:()=>an.H,LocalTransaction:()=>An,Logger:()=>yn.V,LoginToBackend:()=>gt,MakeTheInstanceConcept:()=>q.A,MakeTheInstanceConceptLocal:()=>K.k,MakeTheTimestamp:()=>Ze,MakeTheTypeConcept:()=>we,MakeTheTypeConceptApi:()=>Se,MakeTheTypeConceptLocal:()=>le.$,NORMAL:()=>Do.yv,PRIVATE:()=>Eo,PUBLIC:()=>Fo,PatcherStructure:()=>cn,RAW:()=>Do.XZ,RecursiveSearchApi:()=>ot,RecursiveSearchApiNewRawFullLinker:()=>ct,RecursiveSearchApiRaw:()=>it,RecursiveSearchApiRawFullLinker:()=>rt,RecursiveSearchApiWithInternalConnections:()=>nt,RecursiveSearchListener:()=>Zo,SchemaQueryListener:()=>Mn,SearchAllConcepts:()=>Ot,SearchLinkInternal:()=>No,SearchLinkInternalAll:()=>Ao,SearchLinkMultipleAll:()=>uo.cf,SearchLinkMultipleAllObservable:()=>Vo,SearchLinkMultipleApi:()=>c.j,SearchQuery:()=>Ke,SearchStructure:()=>dn,SearchWithLinker:()=>Mt,SearchWithTypeAndLinker:()=>qo.zl,SearchWithTypeAndLinkerApi:()=>Wo,SessionData:()=>sn,Signin:()=>It,Signup:()=>Ct,SignupEntity:()=>Tt,SplitStrings:()=>s.f,StatefulWidget:()=>wn,SyncData:()=>V.Y,TrashTheConcept:()=>$e,UpdateComposition:()=>_t,UpdateCompositionLocal:()=>po.D,UserBinaryTree:()=>co,Validator:()=>Bn,ViewInternalData:()=>To,ViewInternalDataApi:()=>mo,WidgetTree:()=>Pn,convertFromConceptToLConcept:()=>wo.F4,convertFromLConceptToConcept:()=>wo.dp,convertWidgetTreeToWidget:()=>Zn,convertWidgetTreeToWidgetWithWrapper:()=>Kn,createFormFieldData:()=>Rn,dispatchIdEvent:()=>yi,getFromDatabaseWithType:()=>oe,getObjectsFromIndexDb:()=>ne,getWidgetBulkFromId:()=>Yn,getWidgetFromId:()=>Xn,handleServiceWorkerException:()=>gi,hasActivatedSW:()=>ai,init:()=>ui,recursiveFetch:()=>v.zN,recursiveFetchNew:()=>Rt,renderLatestWidget:()=>qn,renderPage:()=>zn,renderWidget:()=>Qn,searchLinkMultipleListener:()=>Mo,sendEmail:()=>mn,sendMessage:()=>hi,serviceWorker:()=>ni,setHasActivatedSW:()=>li,storeToDatabase:()=>te,subscribedListeners:()=>ci,unwrapContainers:()=>oi,updateAccessToken:()=>di,uploadAttachment:()=>dt,uploadFile:()=>ht,uploadImage:()=>ut,validDocumentFormats:()=>lt,validImageFormats:()=>at});var i=o(5020),r=o(205),c=o(2832),s=o(6467),a=o(9639),l=o(9581),d=o(3518),u=o(1863),h=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function p(e,t){var o=arguments;return h(this,void 0,void 0,(function*(){const n=yn.V.logfunction("GetAllConceptsByType",o);try{var i=new URLSearchParams;i.append("type",e),i.append("user_id",t.toString());var r=(0,d.Xr)("application/x-www-form-urlencoded");const o=yield fetch(l.B.GetAllConceptsByTypeUrl(),{method:"POST",headers:r,body:i});if(o.ok){const e=yield o.json();for(var c=0;c<e.length;c++)a.I.AddConcept(e[c])}else console.log("GetAllConceptsByType error",o.status),(0,u.ry)(o)}catch(e){e instanceof Error?console.log("GetAllConceptsByType error message: ",e.message):console.log("GetAllConceptsByType unexpected error: ",e),(0,u.Mb)(e,l.B.GetAllConceptsByTypeUrl()),(0,u.ey)(n,"GetAllConceptsByType",e)}}))}var f=o(8642),y=o(9736),v=o(8939),g=o(2013),m=o(8064),C=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function T(e,t){var o=arguments;return C(this,arguments,void 0,(function*(e,t,n=10,i=1){const r=yn.V.logfunction("GetCompositionList",o);if(ni){r.serviceWorker=!0;try{const o=yield hi("GetCompositionList",{compositionName:e,userId:t,inpage:n,page:i});return yn.V.logUpdate(r),o.data}catch(e){console.error("GetCompositionList sw error: ",e),(0,u.ey)(r,"GetCompositionList",e),gi(e)}}let c=yield(0,g.A)(e),s=[];if(c){yield p(e,t);let o=yield a.I.GetConceptsByTypeIdAndUser(c.id,t),r=n*(i-1),l=[];for(let e=r;e<r+n;e++)o[e]&&l.push(o[e].id);yield(0,f.Y)(l);for(let e=r;e<r+n;e++)if(o[e]){let t=yield(0,v.kx)(o[e].id);s.push(t)}}return yn.V.logUpdate(r),s}))}function w(e,t){return C(this,arguments,void 0,(function*(e,t,o=10,n=1){let i=b(e,t),r=T(e,t),c=[];return Promise.race([i,r]).then((e=>{console.log("Promise result",e),c.push(...e)})).catch((e=>{console.log("error in handling",e)})),r.then((e=>{console.log("This is the second promise result",e),c.push(...e)})),c}))}function I(e,t){return C(this,arguments,void 0,(function*(e,t,o=10,n=1){if(ni)try{return(yield hi("GetCompositionListAllWithId",{compositionName:e,userId:t,inpage:o,page:n})).data}catch(e){console.error("GetCompositionListAllWithId sw error: ",e),gi(e)}let i=yield(0,m.Ay)(e),r=yield(0,g.A)(e),c=[],s=[],l=[],d=[];0!=i.id&&(s=yield y.v.GetConceptsByTypeIdAndUser(i.id,t)),0!=r.id&&(yield p(e,t),d=yield a.I.GetConceptsByTypeIdAndUser(r.id,t),c=d);for(let e=0;e<s.length;e++){let t=!1;for(let o=0;o<d.length;o++)s[e].ghostId==d[o].ghostId&&(t=!0);t||l.push(s[e])}console.log("This is the all list",l);let u=[];return u=yield function(e,t){return C(this,arguments,void 0,(function*(e,t,o=10,n=1){let i=[],r=o*(n-1),c=[],s=t.length;for(let t=r;t<r+o-s;t++)e[t]&&c.push(e[t].id);for(let e=0;e<t.length;e++){let o=yield x(t[e].id);i.push(o)}yield(0,f.Y)(c);for(let t=r;t<r+o-s;t++)if(e[t]){let o=yield(0,v.RW)(e[t].id);i.push(o)}return i}))}(c,l,o,n),u}))}function k(e,t){return C(this,arguments,void 0,(function*(e,t,o=10,n=1){if(ni)try{return(yield hi("GetCompositionListWithId",{compositionName:e,userId:t,inpage:o,page:n})).data}catch(e){console.error("GetCompositionListWithId sw error: ",e),gi(e)}let i=yield(0,g.A)(e),r=[];if(i){yield p(e,t);let c=yield a.I.GetConceptsByTypeIdAndUser(i.id,t),s=o*(n-1),l=[];for(let e=s;e<s+o;e++)c[e]&&l.push(c[e].id);yield(0,f.Y)(l);for(let e=s;e<s+o;e++)if(c[e]){let t=yield(0,v.RW)(c[e].id);r.push(t)}}return r}))}function N(e,t){return C(this,arguments,void 0,(function*(e,t,o=10,n=1){let i=yield(0,g.w)(e),r=[];if(i){yield p(e,t);let c=yield a.I.GetConceptsByTypeIdAndUser(i.id,t),s=o*(n-1),l=[];for(let e=s;e<s+o;e++)c[e]&&l.push(c[e].id);yield(0,f.Y)(l);for(let e=s;e<s+o;e++)if(c[e]){let t=yield(0,v.RW)(c[e].id);r.push(t)}}return r}))}var A=o(4864),L=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))},S=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function G(e){return S(this,void 0,void 0,(function*(){var t,o;try{if(ni)try{return(yield hi("GetCompositionLocal",{id:e})).data}catch(e){console.error("GetCompositionLocal error sw: ",e),gi(e)}let n=[],i={};n=yield A.G.GetConnectionsOfCompositionLocal(e);let r=[];for(let e=0;e<n.length;e++)r.includes(n[e].ofTheConceptId)||r.push(n[e].ofTheConceptId);let c=yield y.v.GetConcept(e);if(0==c.id){let t=yield function(e){var t=arguments;return L(this,void 0,void 0,(function*(){const o=yn.V.logfunction("TranslateLocalToReal",t);let n=(0,M.o)();try{var i=(0,d.ab)("application/x-www-form-urlencoded");const t=yield fetch(l.B.GetRealConceptById(),{method:"POST",headers:i,body:`id=${e}`});if(t.ok)return n=yield t.json(),n.id>0&&a.I.AddConcept(n),n;console.log("Error in Getting Translating concept Error",t.status),(0,u.ry)(t),yn.V.logUpdate(o)}catch(e){e instanceof Error?console.log("Error in Getting Translating concept error message: ",e):console.log("Error in Getting Translating concept unexpected error: ",e),(0,u.Mb)(e,l.B.GetRealConceptById()),(0,u.ey)(o,"TranslateLocalToReal",e)}return n}))}(e);if(t.id>0)return yield(0,v.Nj)(t.id)}let s=yield B(e,n,r);return i[null!==(o=null===(t=null==c?void 0:c.type)||void 0===t?void 0:t.characterValue)&&void 0!==o?o:"top"]=s,i}catch(e){throw e}}))}function x(e){return S(this,void 0,void 0,(function*(){var t,o;try{if(ni)try{return(yield hi("GetCompositionLocalWithId",{id:e})).data}catch(e){console.error("GetCompositionLocalWithId error sw: ",e),gi(e)}let n=[],i={},r={};n=yield A.G.GetConnectionsOfCompositionLocal(e);let c=[];for(let e=0;e<n.length;e++)c.includes(n[e].ofTheConceptId)||c.push(n[e].ofTheConceptId);let s=yield y.v.GetConcept(e);if(0!=s.id){let r=yield B(e,n,c);i[null!==(o=null===(t=null==s?void 0:s.type)||void 0===t?void 0:t.characterValue)&&void 0!==o?o:"top"]=r}return r.data=i,r.id=e,r}catch(e){throw e}}))}function B(e,t,o){return S(this,arguments,void 0,(function*(e,t,o,n=[]){var i,r,c;let s={},a=[],l=yield y.v.GetConcept(e);if(0!=l.id&&null==l.type){let e=l.typeId,t=yield y.v.GetConcept(e);l.type=t}if(null===(i=null==l?void 0:l.type)||void 0===i?void 0:i.characterValue,!o.includes(e))return null==l?void 0:l.characterValue;if(n.includes(e))return"";n.push(e);for(let n=0;n<t.length;n++)if(t[n].ofTheConceptId==e){let e=t[n].toTheConceptId,i=yield y.v.GetConcept(e);if(0!=i.id&&null==(null==i?void 0:i.type)){let e=i.typeId,t=yield y.v.GetConcept(e);i.type=t}let l="the_",d=(null!==(c=null===(r=null==i?void 0:i.type)||void 0===r?void 0:r.characterValue)&&void 0!==c?c:"top").replace(l,"");if(isNaN(Number(d))){if(d){const n=yield B(e,t,o);s[d]=n}}else{const n=yield B(e,t,o);a[d]=n,s=a}}return s}))}var R=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function b(e,t){return R(this,void 0,void 0,(function*(){if(ni)try{return(yield hi("GetCompositionListLocal",{compositionName:e,userId:t})).data}catch(e){console.error("GetCompositionListLocal error sw: ",e),gi(e)}try{let o=yield(0,m.Ay)(e),n=[];if(0!=o.id){let e=yield y.v.GetConceptsByTypeIdAndUser(o.id,t);for(let t=0;t<e.length;t++){let o=yield G(e[t].id);n.push(o)}}return n}catch(e){throw e}}))}function D(e,t){return R(this,void 0,void 0,(function*(){if(ni)try{return(yield hi("GetCompositionListLocalWithId",{compositionName:e,userId:t})).data}catch(e){console.error("GetCompositionListLocalWithId error sw: ",e),gi(e)}try{let o=yield(0,m.Ay)(e),n=[];if(0!=o.id){let e=yield y.v.GetConceptsByTypeIdAndUser(o.id,t);for(let t=0;t<e.length;t++){let o=yield x(e[t].id);n.push(o)}}return n}catch(e){throw e}}))}var U=o(2),E=o(1218),F=o(999),_=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function W(e,t,o){var n=arguments;return _(this,arguments,void 0,(function*(e,t,o,i=10,r=1){const c=yn.V.logfunction("GetConnectionOfTheConcept",n);let s=[];try{if(ni){c.serviceWorker=!0;try{const n=yield hi("GetConnectionOfTheConcept",{typeId:e,ofTheConceptId:t,userId:o,inpage:i,page:r});return yn.V.logUpdate(c),n.data}catch(e){console.error("GetConnectionOfTheConcept sw error: ",e),(0,u.ey)(c,"GetConnectionOfTheConcept",e),gi(e)}}let n=new URLSearchParams;n.append("typeId",`${e}`),n.append("ofTheConceptId",`${t}`),n.append("userId",`${o}`),n.append("inpage",`${i}`),n.append("page",`${r}`);let a=(0,d.Xr)("application/x-www-form-urlencoded");const h=yield fetch(l.B.GetAllConnectionsOfConceptUrl(),{method:"POST",headers:a,body:n});return h.ok?s=yield h.json():((0,u.ey)(c,"GetConnectionOfTheConcept",h.status),(0,u.ry)(h),console.log("Get connection of concept error",h.status)),yn.V.logUpdate(c),s}catch(e){e instanceof Error?console.log("Get connection of concept error message: ",e.message):console.log("Get connection of concept unexpected error: ",e),(0,u.Mb)(e,l.B.GetAllConnectionsOfConceptUrl()),(0,u.ey)(c,"GetConnectionOfTheConcept",e)}}))}var O=o(2155),V=o(442),M=o(7282),P=o(5976),j=o(7273),H=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function $(e,t,o,n){return H(this,arguments,void 0,(function*(e,t,o,n,i=1,r=4){if(e>0&&o>0){var c=t,s=yield P.p.getId(),a=new O.N(s,e,o,c,n,i,r);return e==o?(a.ofTheConceptId=0,a.toTheConceptId=1,a):(a.toUpdate=!0,a.isTemp=!1,V.Y.AddConnection(a),a)}throw new j.z("cannot create connection because id are negative ",!1,400,"")}))}var J=o(1838),z=o(7876),q=o(8407),Q=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function X(e,t,o){return Q(this,arguments,void 0,(function*(e,t,o,n=!1,i=!1){var r,c;if(ni)try{return(yield hi("CreateConnectionBetweenTwoConcepts",{ofTheConcept:e,toTheConcept:t,linker:o,both:n,count:i})).data}catch(e){console.error("CreateConnectionBetweenTwoConcepts sw error: ",e),gi(e)}let s=e.userId;if(n){let n=o+"_by",c=(null===(r=t.type)||void 0===r?void 0:r.characterValue)+"_s_"+n;i&&(yield Y(n,t,s));let a=yield(0,q.A)("connection",c,!1,999,999,999),l=new O.N(0,t.id,e.id,s,a.id,1e3,4);V.Y.AddConnection(l)}let a=o+"_s",l=(null===(c=e.type)||void 0===c?void 0:c.characterValue)+"_s_"+a;i&&(yield Y(a,e,s));let d=yield(0,q.A)("connection",l,!1,999,999,999),u=new O.N(0,e.id,t.id,s,d.id,1e3,4);return V.Y.AddConnection(u),u}))}function Y(e,t){return Q(this,arguments,void 0,(function*(e,t,o=null){var n;let i=t,r=null!=o?o:t.userId,c=e+"_count",s=(null===(n=t.type)||void 0===n?void 0:n.characterValue)+"_s_"+c,a=yield(0,q.A)("connection",s,!1,r,4,999),l=yield W(a.id,t.id,r,10,1),d=[],u=(0,M.o)();for(let e=0;e<l.length;e++){let t=yield(0,z.A)(l[e].toTheConceptId);d.push(t)}if(d.length<1)u=yield(0,q.A)("count","1",!1,r,4,999);else{let e=d[0],t=0;try{t=Number(e.characterValue)}catch(e){t=0}t+=1,u=yield(0,q.A)("count",t.toString(),!1,r,4,999);for(let e=0;e<l.length;e++)(0,J.m)(l[e].id)}let h=new O.N(0,i.id,u.id,i.userId,a.id,1e3,4);yield V.Y.AddConnection(h)}))}function Z(e,t,o){return Q(this,arguments,void 0,(function*(e,t,o,n=!1,i=!1){var r,c;let s=e.userId;if(n){let n=o+"_by",c=(null===(r=t.type)||void 0===r?void 0:r.characterValue)+"_s_"+n;i&&(yield Y(n,t,s));let a=yield(0,q.A)("connection",c,!1,999,999,999),l=new O.N(0,t.id,e.id,s,a.id,1e3,4);V.Y.AddConnection(l)}let a=o+"_s",l=(null===(c=e.type)||void 0===c?void 0:c.characterValue)+"_s_"+a;i&&(yield Y(a,e,s));let d=yield(0,q.A)("connection",l,!1,999,999,999);return yield $(e.id,e.userId,t.id,d.id,1e3,4)}))}var K=o(5868),ee=(o(3655),function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))});function te(e,t){const o=yn.V.logfunction("storeToDatabase",[e,"noindexdb"]);yn.V.logUpdate(o)}function oe(e,t,o){return ee(this,void 0,void 0,(function*(){const t=yn.V.logfunction("getFromDatabaseWithType",[e,"noindexdb"]);yn.V.logUpdate(t)}))}function ne(e){return ee(this,void 0,void 0,(function*(){const t=yn.V.logfunction("getObjectsFromIndexDb",[e,"noindexdb"]);yn.V.logUpdate(t)}))}var ie=o(1666),re=o(4402),ce=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function se(e,t){var o=arguments;return ce(this,arguments,void 0,(function*(e,t,n=10,i=1){var r;const c=yn.V.logfunction("GetLink",o);if(ni){c.serviceWorker=!0;try{const o=yield hi("GetLink",{id:e,linker:t,inpage:n,page:i});return yn.V.logUpdate(c),o.data}catch(e){console.error("GetLink sw error: ",e),(0,u.ey)(c,"GetLink",e),gi(e)}}let s=[],a=yield(0,z.A)(e),l=(null===(r=a.type)||void 0===r?void 0:r.characterValue)+"_s_"+t,d=yield(0,re.A)(l,16);if(d.id>0){let e=yield W(d.id,a.id,a.userId,n,i),t=[];for(let o=0;o<e.length;o++)t.push(e[o].toTheConceptId);yield(0,f.Y)(t);for(let t=0;t<e.length;t++){let o=e[t].toTheConceptId,n=yield(0,z.A)(o),i=yield(0,v.Ez)(n.id);s.push(i)}}return yn.V.logUpdate(c),s}))}function ae(e,t){var o=arguments;return ce(this,arguments,void 0,(function*(e,t,n=10,i=1){var r;const c=yn.V.logfunction("GetLinkRaw",o);let s=[],a=yield(0,z.A)(e),l=(null===(r=a.type)||void 0===r?void 0:r.characterValue)+"_s_"+t,d=yield(0,re.A)(l,16);if(d.id>0){let e=yield W(d.id,a.id,a.userId,n,i),t=[];for(let o=0;o<e.length;o++)t.push(e[o].toTheConceptId);for(let t=0;t<e.length;t++){let o=e[t].toTheConceptId,n=yield(0,z.A)(o);s.push(n)}}return yn.V.logUpdate(c),s}))}var le=o(8357),de=o(2212);class ue{constructor(e,t,o,n,i,r,c,s,a,l){this.id=0,this.isNew=!1,this.userId=e,this.data=`${t}`,this.securityId=o,this.securityUserId=n,this.accessId=i,this.accessUserId=r,this.sessionId=c,this.sessionUserId=s,this.isNew=l}}class he{constructor(){this.name="character Repository"}static AddCharacter(e){this.characterData[e.id]=e}static GetCharacter(e){for(var t=new ue(0,"0",0,0,0,0,0,0,"0",!1),o=0;o<this.characterData.length;o++)this.characterData[o].data==e&&(t=this.characterData[o]);return t}}he.characterData=[];class pe{constructor(e,t,o,n){this.id=e,this.userId=t,this.referentId=o,this.isNew=n}}var fe=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))},ye=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function ve(e,t,o,n,i){return ye(this,void 0,void 0,(function*(){return new ue(t,e,o,t,n,t,i,t,"",!1),yield function(){return fe(this,void 0,void 0,(function*(){var e;const t=yn.V.logfunction("CreateTheCharacter",e);try{if(0==(e=he.GetCharacter(e.data)).id){var o=(0,d.Xr)();const i=yield fetch(l.B.CreateTheCharacterDataUrl(),{method:"POST",headers:o,body:JSON.stringify(e)});if(!i.ok)throw(0,u.ry)(i),new Error(`Error! status: ${i.status}`);const r=yield i.json();var n=new ue(r.userId,e.data,0,0,4,4,999,999,"",!1);return n.id=r.id,he.AddCharacter(n),yn.V.logUpdate(t),r}return new pe(e.id,e.userId,0,!1)}catch(e){throw e instanceof Error?console.log("create the character error message: ",e.message):console.log("create the character unexpected error: ",e),(0,u.ey)(t,"CreateTheCharacter",e),e}}))}()}))}var ge=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function me(e,t,o,n,i,r,c){return ge(this,void 0,void 0,(function*(){let s=yield(0,re.A)(e,n),a=s;return 0==a.id&&(s=yield(0,de.Ay)(e,t,o,n,i,r,c),a=s),a}))}var Ce=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))},Te=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function we(e,t,o,n){var i=arguments;return Te(this,void 0,void 0,(function*(){const r=yn.V.logfunction("MakeTheTypeConcept",i);if(ni){r.serviceWorker=!0;try{const i=yield hi("MakeTheTypeConcept",{typeString:e,sessionId:t,sessionUserId:o,userId:n});return yn.V.logUpdate(r),i.data}catch(e){console.error("MakeTheTypeConcept sw error: ",e),(0,u.ey)(r,"MakeTheTypeConcept",e),gi(e)}}let c=yield(0,g.A)(e);if(c&&(0==c.id||0==c.userId)){let i=(0,s.f)(e);if(i.length>0)if(i[0]==e){let o=yield function(e,t,o,n,i,r){return Ce(this,void 0,void 0,(function*(){let o;if(1==e.length){let i=e.charCodeAt(0),c=49;yield ve(e,t,999,n,r),o=me(e,t,4,c,i,n,"the_character")}else{let i=yield ve(e,t,999,n,r);i.isNew,o=yield me(e,t,4,51,i.id,n,"the_characters")}return o}))}(e,n,0,999,0,t);c=o}else{let r=yield we(i[0],t,o,n),s=yield we(i[1],t,o,n);s&&(c=yield(0,de.N)(e,n,r.id,s.id,999,999,i[1]))}}return yn.V.logUpdate(r),c}))}var Ie=o(8146),ke=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))},Ne=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function Ae(e){return Ne(this,void 0,void 0,(function*(){const t=yn.V.logfunction("GetConceptByCharacterAndCategory",e);let o=(0,M.o)();if("the"==e)return o.id=1,o.typeId=5,o.characterValue="the",o;let n=(0,s.f)(e);if(n.length>1){let t=1,i=yield Ae(n[0]);0!=i.id&&(t=i.id),o=yield function(e,t){var o=arguments;return Ne(this,void 0,void 0,(function*(){const n=yn.V.logfunction("GetConceptByCharacterAndCategoryFromMemory",o);let i=yield a.I.GetConceptByCharacterAndCategoryLocal(e,t);return 0==i.id&&(i=yield function(e,t){var o=arguments;return ke(this,void 0,void 0,(function*(){const n=yn.V.logfunction("GetConceptByCharacterAndCategoryDirectApi",o);let i=(0,M.o)();try{var r=(0,d.Xr)("application/x-www-form-urlencoded");const o=yield fetch(l.B.GetConceptByCharacterAndCategoryDirectUrl(),{method:"POST",headers:r,body:`character_value=${e}&category_id=${t}`});o.ok?(i=yield o.json(),a.I.AddConcept(i)):(console.log("This is the concept by category and character error",o.status),(0,u.ry)(o)),yn.V.logUpdate(n)}catch(e){e instanceof Error?console.log(" This is the concept by category and character error message: ",e.message):console.log(" This is the concept by category and character unexpected error: ",e),(0,u.Mb)(e,l.B.GetConceptByCharacterAndCategoryDirectUrl()),(0,u.ey)(n,"GetConceptByCharacterAndCategoryDirectApi",e)}return i}))}(e,t)),yn.V.logUpdate(n),i}))}(e,t)}else n[0]==e&&(o=yield function(e){var t=arguments;return Ne(this,void 0,void 0,(function*(){const o=yn.V.logfunction("GetConceptByCharacter",t);let n=yield a.I.GetConceptByCharacterAndTypeLocal(e,51);return 0==n.id&&(n=yield(0,Ie.Y)(e)),yn.V.logUpdate(o),n}))}(e));return yn.V.logUpdate(t),o}))}var Le=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function Se(e,t){var o=arguments;return Le(this,void 0,void 0,(function*(){const t=yn.V.logfunction("MakeTheTypeConceptApi",o);let n=(0,M.o)();try{if(n=yield Ae(e),0==n.id||4==n.typeId){let o=(0,d.Xr)("application/x-www-form-urlencoded");const i=yield fetch(l.B.MakeTheTypeConceptUrl(),{method:"POST",headers:o,body:`type=${e}`});if(!i.ok)throw(0,u.ry)(i),new Error(`Error! status: ${i.status}`);n=yield i.json(),yn.V.logUpdate(t)}}catch(e){e instanceof Error?console.log("Make The Type Concept Api error : ",e.message):console.log("Make The Type Concept Api error : ",e),(0,u.Mb)(e,l.B.MakeTheTypeConceptUrl()),(0,u.ey)(t,"MakeTheTypeConceptApi",e)}return n}))}var Ge=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function xe(e){var t=arguments;return Ge(this,void 0,void 0,(function*(){yn.V.logfunction("GetAllLinkerConnectionsFromTheConcept",t);var o=[];try{(new Date).getTime();var n=(0,d.Xr)("application/x-www-form-urlencoded");const t=yield fetch(l.B.GetAllLinkerConnectionOfConceptUrl()+`?conceptId=${e}`,{method:"GET",headers:n});if(t.ok){const e=yield t.json();for(var i=0;i<e.length;i++){var r=e[i];o.push(r)}}else console.log("Get all linker connection from the concepts error","cannot get respone"),(0,u.ry)(t)}catch(e){e instanceof Error?console.log("Get all linker connection from the concepts error: ",e.message):console.log("Get all linker connection from the concepts error(Unexpected): ",e),(0,u.Mb)(e,l.B.GetAllLinkerConnectionOfConceptUrl())}return o}))}var Be=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function Re(e){var t=arguments;return Be(this,void 0,void 0,(function*(){const o=yn.V.logfunction("GetAllLinkerConnectionsToTheConcept",t);var n=[];try{(new Date).getTime();var i=(0,d.Xr)("application/x-www-form-urlencoded");const t=yield fetch(l.B.GetAllLinkerConnectionToConceptUrl()+`?conceptId=${e}`,{method:"GET",headers:i});if(t.ok){const e=yield t.json();for(var r=0;r<e.length;r++){var c=e[r];n.push(c)}yn.V.logUpdate(o)}else console.log("Get all linker connection To the concepts error","cannot get respone"),(0,u.ry)(t)}catch(e){e instanceof Error?console.log("Get all linker connection To the concepts error: ",e.message):console.log("Get all linker connection To the concepts error(Unexpected): ",e),(0,u.Mb)(e,l.B.GetAllLinkerConnectionToConceptUrl()),(0,u.ey)(o,"GetAllLinkerConnectionsToTheConcept",e)}return n}))}var be=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function De(e){var t=arguments;return be(this,void 0,void 0,(function*(){const o=yn.V.logfunction("GetLinkerConnectionFromConcepts",t);let n=yield xe(e);for(let e=0;e<n.length;e++){let t=n[e],o=t.typeId,i=yield(0,z.A)(o);t.type=i}return yn.V.logUpdate(o),n}))}function Ue(e){var t=arguments;return be(this,void 0,void 0,(function*(){const o=yn.V.logfunction("GetLinkerConnectionToConcepts",t);let n=yield Re(e);for(let e=0;e<n.length;e++){let t=n[e],o=t.typeId,i=yield(0,z.A)(o);t.type=i}return yn.V.logUpdate(o),n}))}var Ee=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))},Fe=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))},_e=o(6963),We=o(2202),Oe=o(5457),Ve=o(991),Me=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function Pe(e){var t=arguments;return Me(this,void 0,void 0,(function*(){const o=yn.V.logfunction("DeleteConceptById",t);if(ni)try{return(yield hi("DeleteConceptById",{id:e})).data}catch(e){console.error("DeleteConceptById sw error: ",e),gi(e)}if(e>0){var n=yield a.I.GetConcept(e);if(n.id>0){var i=n.typeId,r=n.characterValue;yield Oe.c.removeTypeConcept(i,e),yield _e.f.removeNodeByCharacter(r,e),yield function(e){var t=arguments;return Fe(this,void 0,void 0,(function*(){const o=yn.V.logfunction("DeleteTheConcept",t);try{const t=new FormData;t.append("id",e.toString());let n=(0,d.BZ)();const i=yield fetch(l.B.DeleteConceptUrl(),{method:"POST",headers:n,body:t});i.ok||(console.log("Delete concept error",i.status),(0,u.ry)(i)),yn.V.logUpdate(o)}catch(e){e instanceof Error?console.log("Delete concept error message: ",e.message):console.log("Delete concept unexpected error: ",e),(0,u.Mb)(e,l.B.DeleteConceptUrl()),(0,u.ey)(o,"DeleteTheConcept",e)}}))}(e),yield We.W.removeNodeFromTree(e),yield Ve.H.removeNodeFromTree(e)}}else y.v.RemoveConceptById(e);yn.V.logUpdate(o)}))}function je(e){return Me(this,void 0,void 0,(function*(){if(ni)try{return(yield hi("DeleteUser",{id:e})).data}catch(e){console.error("DeleteUser sw error: ",e),gi(e)}e>0?function(e){var t=arguments;Ee(this,void 0,void 0,(function*(){const o=yn.V.logfunction("DeleteUserInBackend",t);try{var n=(0,d.ab)("application/json","");let t=l.B.DeleteUserUrl();t=t+"?conceptId="+e+"&apiKey=freeschema";const i=yield fetch(t,{method:"POST",headers:n});if(i.ok){let e=yield i.json(),t=Number(e.data);return console.log("this is the delete email concept",t),Pe(t),yn.V.logUpdate(o),t}throw(0,u.ry)(i),new Error(`Delete composition Error! status: ${i.status}`)}catch(e){e instanceof Error?console.log("Delete composition error message: ",e.message):console.log("Delete composition unexpected error: ",e),(0,u.Mb)(e,l.B.DeleteConceptUrl()),(0,u.ey)(o,"DeleteUserInBackend",e)}}))}(e):y.v.RemoveConceptById(e)}))}var He=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function $e(e,t){return He(this,void 0,void 0,(function*(){try{const o=new Headers;o.append("Authorization","Bearer "+t);const n=new FormData;n.append("id",e.toString());const i=yield fetch(l.B.DeleteConceptUrl(),{method:"POST",body:n,headers:o});if(!i.ok)throw(0,u.ry)(i),new Error(`Delete composition Error! status: ${i.status}`)}catch(e){e instanceof Error?console.log("Delete composition error message: ",e.message):console.log("Delete composition unexpected error: ",e),(0,u.Mb)(e,l.B.DeleteConceptUrl())}}))}var Je=o(1735),ze=o(8286),qe=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))},Qe=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function Xe(e){var t=arguments;return Qe(this,void 0,void 0,(function*(){const o=yn.V.logfunction("GetConnectionById",t);if(console.log("AccessTracker activation status from GetConnectionById"),!0===Je.J.activateStatus)try{Je.J.incrementConnection(e)}catch(e){console.error("Error adding connection in access tracker"),yn.V.log("ERROR","Error Adding Connection")}if(ni)try{return(yield hi("GetConnectionById",{id:e})).data}catch(e){console.error("GetConnectionById sw error: ",e),gi(e)}let n=yield ze.d.GetConnection(e);if((null==n||0==n.id)&&null!=e&&null!=e){let t=yield function(e){var t=arguments;return qe(this,void 0,void 0,(function*(){const o=yn.V.logfunction("GetConnection",t);let n=yield ze.d.GetConnection(e);try{if(0!=n.id)return n;{let t=(0,d.Xr)("application/x-www-form-urlencoded");const i=new FormData;i.append("id",e.toString());const r=yield fetch(l.B.GetConnectionUrl(),{method:"POST",headers:t,body:i});return r.ok?(n=yield r.json(),ze.d.AddConnection(n)):((0,u.ry)(r),console.log("Get Connection Error",r.status)),yn.V.logUpdate(o),n}}catch(e){e instanceof Error?console.log("Get Connection error message: ",e.message):console.log("Get Connection unexpected error: ",e),(0,u.Mb)(e,l.B.GetConnectionUrl()),(0,u.ey)(o,"GetConnection",e)}}))}(e);n=t}return yn.V.logUpdate(o),n}))}var Ye=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function Ze(e,t,o){return Ye(this,arguments,void 0,(function*(e,t,o,n=4,i=999){const r=yn.V.logfunction("MakeTheTimestamp");if(ni){r.serviceWorker=!0;try{const c=yield hi("MakeTheTimestamp",{type:e,referent:t,userId:o,accessId:n,sessionInformationId:i});return yn.V.logUpdate(r),c.data}catch(e){console.error("MakeTheTimestamp sw error: ",e),(0,u.ey)(r,"MakeTheTimestamp",e),gi(e)}}let c,s="",a=e.startsWith("the_"),l=(0,M.o)();return s=a?e:"the_"+e,l=yield Se(s,o),c=yield me(t,o,4,l.id,0,n,s),yn.V.logUpdate(r),c}))}class Ke{constructor(){this.composition=0,this.type="",this.linker="",this.inpage=10,this.page=1,this.listLinkers=[],this.fullLinkers=[],this.textSearch="",this.logic="or",this.reverse=!1,this.doFilter=!1,this.filterSearches=[],this.selectors=[],this.ofCompositions=[]}}var et=o(6687),tt=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function ot(){var e=arguments;return tt(this,arguments,void 0,(function*(t=0,o=[],n=""){const i=yn.V.logfunction("RecursiveSearchApi",e);let r=[];try{if(ni){i.serviceWorker=!0;try{const e=yield hi("RecursiveSearchApi",{composition:t,listLinkers:o,textSearch:n});return yn.V.logUpdate(i),e.data}catch(e){console.error("RecursiveSearchApi sw error: ",e),(0,u.ey)(i,"RecursiveSearchApi",e),gi(e)}}let e=new Ke;e.composition=t,e.listLinkers=o,e.textSearch=n;let c=JSON.stringify(e),s=(0,d.Xr)();const a=yield fetch(l.B.RecursiveSearchUrl(),{method:"POST",headers:s,body:c});if(a.ok){const e=yield a.json();let t=e.compositionIds,o=e.internalConnections;e.externalConnections,r=yield(0,et.p8)(t,o)}else console.log("recursive search error ",a.status),(0,u.ey)(i,"RecursiveSearchApi",a.status),(0,u.ry)(a);yn.V.logUpdate(i)}catch(e){e instanceof Error?console.log("recursive search error message: ",e.message):console.log("recursive search unexpected error: ",e),(0,u.ey)(i,"RecursiveSearchApi",e),(0,u.Mb)(e,l.B.RecursiveSearchUrl())}return r}))}function nt(){var e=arguments;return tt(this,arguments,void 0,(function*(t=0,o=[],n=""){const i=yn.V.logfunction("RecursiveSearchApiWithInternalConnections",e);let r=[];try{if(ni){i.serviceWorker=!0;try{const e=yield hi("RecursiveSearchApiWithInternalConnections",{composition:t,listLinkers:o,textSearch:n});return yn.V.logUpdate(i),e.data}catch(e){console.error("RecursiveSearchApiWithInternalConnections sw error: ",e),(0,u.ey)(i,"RecursiveSearchApiWithInternalConnections",e),gi(e)}}let e=new Ke;e.composition=t,e.listLinkers=o,e.textSearch=n;let c=JSON.stringify(e),s=(0,d.Xr)();const a=yield fetch(l.B.RecursiveSearchUrl(),{method:"POST",headers:s,body:c});if(a.ok){const e=yield a.json();let t=e.compositionIds,o=e.internalConnections;e.externalConnections,r=yield(0,et.km)(t,o),yn.V.logUpdate(i)}else console.log("recursive search error ",a.status),(0,u.ey)(i,"GetCompositionConnectionsBetweenTwoConcepts",a.status),(0,u.ry)(a)}catch(e){e instanceof Error?console.log("recursive search error message: ",e.message):console.log("recursive search unexpected error: ",e),(0,u.ey)(i,"GetCompositionConnectionsBetweenTwoConcepts",e),(0,u.Mb)(e,l.B.RecursiveSearchUrl())}return r}))}function it(){var e=arguments;return tt(this,arguments,void 0,(function*(t=0,o=[],n=""){const i=yn.V.logfunction("RecursiveSearchApiRaw",e);try{if(ni){i.serviceWorker=!0;try{const e=yield hi("RecursiveSearchApiRaw",{composition:t,listLinkers:o,textSearch:n});return yn.V.logUpdate(i),e.data}catch(e){console.error("RecursiveSearchApiRaw sw error: ",e),(0,u.ey)(i,"RecursiveSearchApiRaw",e),gi(e)}}let e=new Ke;e.composition=t,e.listLinkers=o,e.textSearch=n;let r=JSON.stringify(e),c=(0,d.Xr)();const s=yield fetch(l.B.RecursiveSearchUrl(),{method:"POST",headers:c,body:r});if(s.ok){const e=yield s.json();return e.compositionIds,e.internalConnections,e.externalConnections,yn.V.logUpdate(i),e}return console.log("recursive search error ",s.status),(0,u.ey)(i,"RecursiveSearchApiRaw",s.status),(0,u.ry)(s),yn.V.logUpdate(i),[]}catch(e){e instanceof Error?console.log("recursive search error message: ",e.message):console.log("recursive search unexpected error: ",e),(0,u.ey)(i,"RecursiveSearchApiRaw",e),(0,u.Mb)(e,l.B.RecursiveSearchUrl())}}))}function rt(){var e=arguments;return tt(this,arguments,void 0,(function*(t=0,o=[],n=""){const i=yn.V.logfunction("RecursiveSearchApiRawFullLinker",e);try{if(ni){i.serviceWorker=!0;try{const e=yield hi("RecursiveSearchApiRawFullLinker",{composition:t,fullLinkers:o,textSearch:n});return yn.V.logUpdate(i),e.data}catch(e){console.error("RecursiveSearchApiRawFullLinker sw error: ",e),(0,u.ey)(i,"RecursiveSearchApiRawFullLinker",e),gi(e)}}let e=new Ke;e.composition=t,e.fullLinkers=o,e.textSearch=n;let r=JSON.stringify(e),c=(0,d.Xr)();const s=yield fetch(l.B.RecursiveSearchUrl(),{method:"POST",headers:c,body:r});if(s.ok){const e=yield s.json();return e.compositionIds,e.internalConnections,e.externalConnections,yn.V.logUpdate(i),e}return console.log("recursive search error ",s.status),(0,u.ey)(i,"RecursiveSearchApiRawFullLinker",s.status),(0,u.ry)(s),yn.V.logUpdate(i),[]}catch(e){e instanceof Error?console.log("recursive search error message: ",e.message):console.log("recursive search unexpected error: ",e),(0,u.Mb)(e,l.B.RecursiveSearchUrl()),(0,u.ey)(i,"RecursiveSearchApiRawFullLinker",e)}}))}function ct(){var e=arguments;return tt(this,arguments,void 0,(function*(t=0,o=[],n=""){const i=yn.V.logfunction("RecursiveSearchApiRawFullLinker",e);try{if(ni)try{i.serviceWorker=!0;const e=yield hi("RecursiveSearchApiNewRawFullLinker",{composition:t,fullLinkers:o,textSearch:n});return yn.V.logUpdate(i),e.data}catch(e){console.error("RecursiveSearchApiNewRawFullLinker sw error: ",e),(0,u.ey)(i,"RecursiveSearchApiNewRawFullLinker",e),gi(e)}let e=new Ke;e.composition=t,e.fullLinkers=o,e.textSearch=n;let r=JSON.stringify(e),c=(0,d.Xr)();const s=yield fetch(l.B.RecursiveSearchUrl(),{method:"POST",headers:c,body:r});if(s.ok){const e=yield s.json();return e.compositionIds,e.internalConnections,e.externalConnections,yn.V.logUpdate(i),e}return console.log("recursive search error ",s.status),(0,u.ey)(i,"RecursiveSearchApiNewRawFullLinker",s.status),(0,u.ry)(s),yn.V.logUpdate(i),[]}catch(e){e instanceof Error?console.log("recursive search error message: ",e.message):console.log("recursive search unexpected error: ",e),(0,u.Mb)(e,l.B.RecursiveSearchUrl()),(0,u.ey)(i,"RecursiveSearchApiNewRawFullLinker",e)}}))}var st=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};const at=["image/jpeg","image/jpg","image/png","image/webp"],lt=["application/msword","application/vnd.ms-excel","application/vnd.ms-powerpoint","text/plain","application/pdf"];function dt(e,t){return st(this,void 0,void 0,(function*(){const o=yn.V.logfunction("uploadAttachment");try{console.log("File Type",e.type);const n=new FormData;let i;if(lt.includes(e.type))n.append("file",e,e.name),i=yield ht(n,t);else{if(!at.includes(e.type))return{message:"Invalid File Format",success:!1};n.append("image",e,e.name),i=yield ut(n,t)}return(null==i?void 0:i.data)?(yn.V.logUpdate(o),{message:"Upload Success",success:!0,url:i.data}):{message:"File Upload Failed",success:!1}}catch(e){throw console.error(e),(0,u.ey)(o,"uploadAttachment",e),e}}))}function ut(e){return st(this,arguments,void 0,(function*(e,t=""){const o=yn.V.logfunction("uploadImage");try{const n=yield fetch(l.B.uploadImageUrl(),{method:"POST",body:e,headers:{Authorization:`Bearer ${t}`}});if(!n.ok){const e=n.headers.get("content-type");e&&e.includes("text/plain")&&console.info(null==n?void 0:n.text());const t=yield null==n?void 0:n.text();return console.error(`${n.status} ${t}`),yn.V.logUpdate(o),null}return yield n.json()}catch(e){return console.error(e),(0,u.ey)(o,"uploadImage",e),null}}))}function ht(e){return st(this,arguments,void 0,(function*(e,t=""){const o=yn.V.logfunction("uploadFile");try{const n=yield fetch(l.B.uploadFileUrl(),{method:"POST",body:e,headers:{Authorization:`Bearer ${t}`}});if(!n.ok){const e=n.headers.get("content-type");e&&e.includes("text/plain")&&console.info(n.text());const t=yield n.text();return console.error(`${n.status} ${t}`),null}return yn.V.logUpdate(o),yield n.json()}catch(e){return console.error(e),(0,u.ey)(o,"uploadFile",e),null}}))}var pt=o(1239),ft=o(7467),yt=o(3278),vt=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function gt(e,t){var o=arguments;return vt(this,void 0,void 0,(function*(){const n=yn.V.logfunction("LoginToBackend",o);try{let o={email:e,password:t},i=new Headers;i.append("Content-Type","application/json");let r=JSON.stringify(o);const c=yield fetch(l.B.LoginUrl(),{method:"POST",headers:i,body:r}),s=yield c.json();if(c.ok)return yt.b.BearerAccessToken=s.data.token,yn.V.logUpdate(n),s;console.log("Login tsccs error message: ",c.status),(0,u.ER)(c,s)}catch(e){e instanceof Error?console.log("Login tsccs error message: ",e.message):console.log(" Login tsccs unexpected error: ",e),(0,u.Mb)(e,l.B.LoginUrl()),(0,u.ey)(n,"LoginToBackend",e)}}))}var mt=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function Ct(e){return mt(this,void 0,void 0,(function*(){const t=yield function(){return mt(this,arguments,void 0,(function*(e="",t={}){let o={message:"success",status:!1,statusCode:200,data:"cannot signup"};try{const n=yield fetch(e,{method:"POST",mode:"cors",cache:"no-cache",credentials:"same-origin",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify(t)}),i=yield n.json();return n.ok?o={message:"success",status:!0,statusCode:200,data:i}:(0,u.ER)(n,i),o}catch(t){console.log("Signup Error: ",t),(0,u.Mb)(t,e)}}))}(l.B.SignupUrl(),e);return t}))}function Tt(e){return mt(this,void 0,void 0,(function*(){const t=l.B.NODE_URL,o=yield fetch(`${t}/api/v1/entity/signup`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(o.ok)return o.json();if(404===o.status)throw new Error("404, Not found");if(500===o.status)throw new Error("500, internal server error");throw new Error(o.status)}))}var wt=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function It(e){return wt(this,void 0,void 0,(function*(){const t=JSON.stringify({email:e.email,password:e.password});let o={message:"success",status:!1,statusCode:200,data:""};const n=new Headers;n.append("Content-Type","application/json");const i=l.B.LoginUrl();try{const e=yield fetch(i,{method:"POST",headers:n,body:t,redirect:"follow"}),r=yield e.json();return e.ok?o={message:"success",status:!0,statusCode:200,data:null==r?void 0:r.data}:(0,u.ER)(e,r),o}catch(e){console.log("Sign in api error",e),(0,u.Mb)(e,i)}}))}var kt=o(9934),Nt=o(4485);function At(e=[],t){Array.isArray(e)&&e.splice(e.findIndex((function(e){return e.id===t.id})),1)}function Lt(e=[],t){Array.isArray(e)&&e.splice(e.findIndex((function(e){return e.id===t.id})),1)}class St{constructor(e,t,o,n){this.expiryTime=new Date(Date.now()+6e5),this.height=1,this.key=e,this.value=t,this.leftNode=o,this.rightNode=n}isValid(){const e=new Date(Date.now());return!(this.expiryTime<e&&(xt.removeNodeFromTree(this.key),1))}saveToCache(e){this.value.cached=e}addNode(e,t,o){if(null==t)return e;const n=t.leftNode,i=t.rightNode;if(t.key>e.key)t.leftNode=this.addNode(e,n,o);else{if(!(t.key<e.key))return this.isValid(),e;t.rightNode=this.addNode(e,i,o)}t.height=1+Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode));const r=this.getBalanceFactor(t);if(r>1&&t.leftNode){if(e.key<t.leftNode.key)return this.rightRotate(t);if(e.key>t.leftNode.key)return t.leftNode=this.leftRotate(t.leftNode),this.rightRotate(t)}if(r<-1&&t.rightNode){if(e.key>t.rightNode.key)return this.leftRotate(t);if(e.key<t.rightNode.key)return t.rightNode=this.rightRotate(t.rightNode),this.leftRotate(t)}return this.isValid(),t}rightRotate(e){if(e){const t=e.leftNode;if(t){const o=t.rightNode;return e.leftNode=o,t.rightNode=e,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode))+1,t}}return e}leftRotate(e){if(e){const t=e.rightNode;if(t){const o=t.leftNode;return t.leftNode=e,e.rightNode=o,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(e.rightNode))+1,t}}return e}getHeight(e){return e?e.height:0}getBalanceFactor(e){return null==e?0:this.getHeight(e.leftNode)-this.getHeight(e.rightNode)}getFromNode(e,t){return t?e==t.key&&t.isValid()?t:e<t.key?this.getFromNode(e,t.leftNode):e>t.key?this.getFromNode(e,t.rightNode):t:t}removeNode(e,t){if(null==e)return e;if(e.key>t)return e.leftNode=this.removeNode(e.leftNode,t),e;if(e.key<t)return e.rightNode=this.removeNode(e.rightNode,t),e;if(null==e.leftNode){const t=e.rightNode;return e=null,t}if(null==e.rightNode){const t=e.leftNode;return e=null,t}{const t=this.inOrderSuccessor(e.rightNode);return e.value=t.value,e.key=t.key,e.rightNode=this.removeNode(e.rightNode,t.key),e}}countNodeBelow(e){return null==e?0:1+this.countNodeBelow(e.leftNode)+this.countNodeBelow(e.rightNode)}inOrderSuccessor(e){for(;null!=e.leftNode;)e=e.leftNode;return e}}var Gt=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class xt{static addNodeToTree(e){if(null==this.root)return this.root=e,this.root;this.root=this.root.addNode(e,this.root,this.root.height)}static addCompositionToTree(e){const t=new St(e.id,e,null,null);this.addNodeToTree(t)}static getNodeFromTree(e){return Gt(this,void 0,void 0,(function*(){return this.root?this.root.getFromNode(e,this.root):null}))}static removeNodeFromTree(e){return Gt(this,void 0,void 0,(function*(){this.root&&(this.root=this.root.removeNode(this.root,e))}))}static countNumberOfNodes(){return this.root?this.root.countNodeBelow(this.root):0}}xt.root=null;var Bt=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function Rt(e,t,o,n){return Bt(this,arguments,void 0,(function*(e,t,o,n,i=[]){var r,c;let s={};const l=[];if(0==e)return"";let d=bt(o,e);if(null!=d&&0!=d.id||null==e||null==e||(d=yield(0,z.A)(e)),0!=d.id&&null==d.type){const e=d.typeId;let t=bt(o,e);d.type=t,null==t&&null!=e&&null!=e&&(t=yield(0,z.A)(e),d.type=t)}if(!n.includes(e))return null==d?void 0:d.characterValue;if(i.includes(e))return"";i.push(e);for(let d=0;d<t.length;d++)if(t[d].ofTheConceptId==e){const u=t[d].toTheConceptId;if(n.includes(e)){let e=bt(o,u);if(null!=e&&0!=e.id||null==u||null==u||(e=yield(0,z.A)(u)),0!=e.id&&null==(null==e?void 0:e.type)){const t=e.typeId;let o=yield a.I.GetConcept(t);e.type=o,null==o&&null!=t&&null!=t&&(o=yield(0,z.A)(t),e.type=o)}const d="the_",h=(null!==(c=null===(r=null==e?void 0:e.type)||void 0===r?void 0:r.characterValue)&&void 0!==c?c:"").replace(d,"");if(isNaN(Number(h))){if(h){const e=yield Rt(u,t,o,n,i);s[h]=e}}else{const e=yield Rt(u,t,o,n,i);l[h]=e,s=l}}}return s}))}function bt(e,t){let o=(0,M.o)();for(let n=0;n<e.length;n++)if(t==e[n].id)return o=e[n],o;return o}class Dt{constructor(){this.id=0,this.mainConcept=(0,M.o)(),this.connections=[],this.concepts=[],this.subcompositions=[],this.cached={}}updateCache(){return e=this,t=void 0,n=function*(){if(0==this.mainConcept.id)for(let e=0;e<this.concepts.length;e++)this.concepts[e].id==this.id&&(this.mainConcept=this.concepts[e]);this.cached=yield Rt(this.id,this.connections,this.concepts,this.subcompositions,[])},new((o=void 0)||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}));var e,t,o,n}UpdateAcrossDistributedSystem(){var e,t;try{0!=this.id&&(t=null===(e=this.id)||void 0===e?void 0:e.toString(),l.B.MQTT_CONNECTION&&l.B.MQTT_CONNECTION.publish("compositionUpdate",t))}catch(e){console.log("Error while publishing message",e)}}isUpdating(){this.UpdateAcrossDistributedSystem()}GetDataCache(){var e,t,o;const n={};n[null!==(o=null===(t=null===(e=this.mainConcept)||void 0===e?void 0:e.type)||void 0===t?void 0:t.characterValue)&&void 0!==o?o:""]=this.cached;const i={};return i.data=n,i.id=this.id,i}}var Ut=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function Et(e){return Ut(this,arguments,void 0,(function*(e,t=null,o=null,n=null,i=null,r=null,c=null,s=null){const a=null!=i?i:999,l=null!=r?r:4,d=null!=c?c:999;let u=null!=n?n:0,h=(0,M.o)();null==s&&(s=new Dt);for(const n in e)if("object"==typeof e[n]||Array.isArray(e[n])){const p=yield(0,q.A)(n,"",!0,a,l,d);if(null==t&&null==o){let t=u;h=p,t=p.id,u=p.id,s.concepts.push(p),s.id=p.id,yield Et(e[n],p.id,p.userId,t,i,r,c,s)}else{const a=null!=t?t:999,l=null!=o?o:999,d=u;h=p,s.concepts.push(p);const f=yield(0,ie.q)(a,l,p.id,d);s.connections.push(f),yield Et(e[n],p.id,p.userId,d,i,r,c,s)}null!=e[n]&&null!=e[n]&&s.subcompositions.push(p.id)}else{const i=null!=t?t:999,r=null!=o?o:999,c=u,h=yield(0,q.A)(n,e[n],!1,a,l,d);s.concepts.push(h);const p=yield(0,ie.q)(i,r,h.id,c);s.connections.push(p)}return h}))}var Ft=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function _t(e){return Ft(this,void 0,void 0,(function*(){const t=yn.V.logfunction("UpdateComposition");if(ni){t.serviceWorker=!0;try{const o=yield hi("UpdateComposition",{patcherStructure:e});return yn.V.logUpdate(t),o.data}catch(e){console.error("UpdateComposition sw error: ",e),(0,u.ey)(t,"UpdateComposition",e),gi(e)}}const o=e.userId,n=e.sessionId,i=e.accessId;let r=[];const c=[];let s=(0,M.o)(),a=(0,M.o)();const l=[];let d=e.compositionId;const h=e.ofTheCompositionId;let p=[];if(d<0){let e=yield(0,z.A)(d,o);if(!(e.id>0))return null;d=e.id}r=yield(0,U.s)(d);const f=[],y=new Dt,v=[];y.id=d,y.isUpdating();let g=[];for(let e=0;e<r.length;e++)(0,kt.A)(v,r[e].ofTheConceptId),(0,kt.A)(f,r[e].ofTheConceptId),(0,kt.A)(f,r[e].toTheConceptId),g.push(r[e].ofTheConceptId);y.subcompositions=v,y.connections=r;for(let e=0;e<f.length;e++){const t=yield(0,z.A)(f[e]);d==f[e]&&(s=t),h==f[e]&&(a=t),c.push(t)}const m=e.patchObject;for(const e in m){let t=(0,M.o)();const r=m[e];let d=s;if(a.id>0&&(d=a),Array.isArray(r)||"object"==typeof r){t=yield(0,q.A)(e,"",!0,s.userId,4,999),y.subcompositions.push(t.id);const o=(0,Nt.vo)(c,t);for(let e=0;e<o.length;e++)if(o[e].id>0){const t=(0,Nt.wS)(y.connections,o[e].id);p=p.concat(t),l.push(o[e])}yield Et(m[e],t.id,t.userId,s.id,s.userId,4,999,y)}else{t=yield(0,q.A)(e,r,!1,o,i,n);const s=(0,Nt.vo)(c,t);for(let e=0;e<s.length;e++)if(s[e].id>0){const t=(0,Nt.wS)(y.connections,s[e].id);p=p.concat(t),l.push(s[e])}}const u=(0,ie.q)(d.id,d.userId,t.id,s.id);c.push(t),y.connections.push(u)}for(let e=0;e<p.length;e++)Lt(y.connections,p[e]),(0,J.m)(p[e].id);for(let e=0;e<l.length;e++)At(c,l[e]);y.concepts=y.concepts.concat(c),y.mainConcept=s,y.id=s.id,yield y.updateCache(),xt.addCompositionToTree(y),V.Y.SyncDataOnline();let C=y.GetDataCache();return yn.V.logUpdate(t),C}))}var Wt=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function Ot(e,t,o,n){return Wt(this,arguments,void 0,(function*(e,t,o,n,i=10,r=1){var c=(0,d.ab)("application/x-www-form-urlencoded",n),s=new URLSearchParams;s.append("type",e),s.append("search",t),s.append("composition",o),s.append("inpage",i.toString()),s.append("page",r.toString());const a=l.B.SearchCompositionsUrl()+"?"+s.toString();try{const e=yield fetch(a,{method:"GET",headers:c});return e.ok?yield e.json():((0,u.ry)(e),[])}catch(e){console.log("This is the searching error",e),(0,u.Mb)(e,a)}}))}var Vt=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function Mt(e){return Vt(this,arguments,void 0,(function*(e,t=""){var o=(0,d.ab)("application/json",t);const n=l.B.SearchLinkMultipleAll(),i=JSON.stringify(e);try{const e=yield fetch(n,{method:"POST",headers:o,body:i});return e.ok?yield e.json():(console.log("This is the searching error",e.status),(0,u.ry)(e),[])}catch(e){console.log("This is the searching error",e),(0,u.Mb)(e,n)}}))}var Pt=o(7139),jt=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function Ht(e){return jt(this,arguments,void 0,(function*(e,t=[]){var o,n;let i=[];const r=[];let c={},s={};const l=yield xt.getNodeFromTree(e),d=[];let u=yield a.I.GetConcept(e);if(0==u.id&&null!=e&&null!=e&&(u=yield(0,Pt.r)(e)),null==l){let a=[];a=t.length>0?$t(e,t):yield(0,U.s)(e),i=a;for(let e=0;e<i.length;e++)d.includes(i[e].ofTheConceptId)||(d.push(i[e].ofTheConceptId),r.push(i[e].ofTheConceptId)),r.includes(i[e].toTheConceptId)||r.push(i[e].toTheConceptId);qt(u,i,r,d);let l=[];s=yield(0,v.zN)(e,i,d,l),c[null!==(n=null===(o=null==u?void 0:u.type)||void 0===o?void 0:o.characterValue)&&void 0!==n?n:""]=s}else s=l.value.GetDataCache(),c=s;return 0==u.id?"":c}))}function $t(e,t){const o=[];for(let n=0;n<t.length;n++)t[n].typeId==e&&o.push(t[n]);return o}function Jt(e){return jt(this,arguments,void 0,(function*(e,t=[]){var o,n;let i={},r=[];const c=[];let s;const l={},d=yield xt.getNodeFromTree(e),u=[];let h=yield a.I.GetConcept(e);if(0==h.id&&null!=e&&null!=e&&(h=yield(0,Pt.r)(e)),null==d){let a=[];a=t.length>0?$t(e,t):yield(0,U.s)(e),r=a;for(let e=0;e<r.length;e++)u.includes(r[e].ofTheConceptId)||(u.push(r[e].ofTheConceptId),c.push(r[e].ofTheConceptId)),c.includes(r[e].toTheConceptId)||c.push(r[e].toTheConceptId);qt(h,r,c,u),s=yield(0,v.zN)(e,r,u),l[null!==(n=null===(o=null==h?void 0:h.type)||void 0===o?void 0:o.characterValue)&&void 0!==n?n:""]=s,i.created_at=h.entryTimeStamp,i.data=l,i.id=e}else s=d.value.GetDataCache(),i=s;return 0==h.id?"":i}))}function zt(e,t){return jt(this,void 0,void 0,(function*(){let o=[];const n=[];o=yield(0,ft.j)(t);for(let t=0;t<e.length;t++){const i=yield Jt(e[t],o);i&&n.push(i)}return n}))}function qt(e,t,o,n){return jt(this,void 0,void 0,(function*(){const i=new Dt,r=yield function(e){return jt(this,void 0,void 0,(function*(){let t=[];const o=[];for(let n=0;n<(null==e?void 0:e.length);n++){const i=yield a.I.GetConcept(e[n]);0==i.id?o.push(e[n]):t.push(i)}return 0==(null==o?void 0:o.length)||(t=yield(0,pt.I)(o)),t}))}(o);i.connections=t,i.concepts=r,i.id=e.id,i.subcompositions=n,i.mainConcept=e;const c=yield Rt(e.id,t,r,n,[]);i.cached=c,xt.addCompositionToTree(i)}))}var Qt=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function Xt(e){return Qt(this,void 0,void 0,(function*(){try{var t=(0,d.Xr)();const o=JSON.stringify(e),n=yield fetch(l.B.CreateSessionId(),{method:"POST",headers:t,body:o});return n.ok?n.json():(console.log("Creating session failed",yield n.json()),(0,u.ry)(n),null)}catch(e){console.log("Creating session failed",e),(0,u.Mb)(e,l.B.CreateSessionId())}}))}var Yt=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function Zt(e,t){return Yt(this,void 0,void 0,(function*(){try{var o=(0,d.Xr)("application/x-www-form-urlencoded");const n=new URLSearchParams;n.append("sessionId",e.toString()),n.append("url",t);const i=yield fetch(l.B.CreateSessionVisitUrl(),{method:"POST",headers:o,body:n});return i.ok?i.json():(console.log("Creating session url failed",yield i.json()),(0,u.ry)(i),null)}catch(e){console.log("Creating session url failed",e),(0,u.Mb)(e,l.B.CreateSessionVisitUrl())}}))}var Kt=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function eo(e,t){var o=arguments;return Kt(this,arguments,void 0,(function*(e,t,n=10,i=1){const r=yn.V.logfunction("GetRelation",o);if(ni){r.serviceWorker=!0;try{const o=yield hi("GetRelation",{id:e,relation:t,inpage:n,page:i});return yn.V.logUpdate(r),o.data}catch(e){console.error("GetRelation error sw: ",e),(0,u.ey)(r,"GetRelation",e),gi(e)}}let c=[],s=yield(0,z.A)(e),a=yield Ae(t);if(a.id>0){let e=yield W(a.id,s.id,s.userId,n,i),t=[];for(let o=0;o<e.length;o++)t.push(e[o].toTheConceptId);yield(0,f.Y)(t);for(let t=0;t<e.length;t++){let o=e[t].toTheConceptId,n=yield(0,z.A)(o),i=yield(0,v.Ez)(n.id);c.push(i)}}return yn.V.logUpdate(r),c}))}function to(e,t){var o=arguments;return Kt(this,arguments,void 0,(function*(e,t,n=10,i=1){const r=yn.V.logfunction("GetRelationRaw",o);if(ni){r.serviceWorker=!0;try{const o=yield hi("GetRelationRaw",{id:e,relation:t,inpage:n,page:i});return yn.V.logUpdate(r),o.data}catch(e){console.error("GetRelationRaw error sw: ",e),(0,u.ey)(r,"GetRelationRaw",e),gi(e)}}let c=[],s=yield(0,z.A)(e),a=yield Ae(t);if(a.id>0){let e=yield W(a.id,s.id,s.userId,n,i),t=[];for(let o=0;o<e.length;o++)t.push(e[o].toTheConceptId);for(let t=0;t<e.length;t++){let o=e[t].toTheConceptId,n=yield(0,z.A)(o);c.push(n)}}return yn.V.logUpdate(r),c}))}var oo=o(6416),no=o(4711);class io{constructor(e,t,o,n){this.value=[],this.height=1,this.key=e,this.value.push(t),this.leftNode=o,this.rightNode=n}addNode(e,t,o){if(null==t)return e;var n=t.leftNode,i=t.rightNode;if(t.key>e.key)t.leftNode=this.addNode(e,n,o);else{if(!(t.key<e.key))return t.value.push(...e.value),t;t.rightNode=this.addNode(e,i,o)}t.height=1+Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let r=this.getBalanceFactor(t);if(r>1&&t.leftNode){if(e.key<t.leftNode.key)return this.rightRotate(t);if(e.key>t.leftNode.key)return t.leftNode=this.leftRotate(t.leftNode),this.rightRotate(t)}if(r<-1&&t.rightNode){if(e.key>t.rightNode.key)return this.leftRotate(t);if(e.key<t.rightNode.key)return t.rightNode=this.rightRotate(t.rightNode),this.leftRotate(t)}return t}rightRotate(e){if(e){let t=e.leftNode;if(t){let o=t.rightNode;return e.leftNode=o,t.rightNode=e,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode))+1,t}}return e}leftRotate(e){if(e){let t=e.rightNode;if(t){let o=t.leftNode;return t.leftNode=e,e.rightNode=o,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(e.rightNode))+1,t}}return e}getHeight(e){return e?e.height:0}getBalanceFactor(e){return null==e?0:this.getHeight(e.leftNode)-this.getHeight(e.rightNode)}getFromNode(e,t){return t?e==t.key?t:e<t.key?this.getFromNode(e,t.leftNode):e>t.key?this.getFromNode(e,t.rightNode):t:t}removeNode(e,t){if(null==e)return e;if(e.key>t)return e.leftNode=this.removeNode(e.leftNode,t),e;if(e.key<t)return e.rightNode=this.removeNode(e.rightNode,t),e;if(null==e.leftNode){let t=e.rightNode;return e=null,t}if(null==e.rightNode){let t=e.leftNode;return e=null,t}var o=this.inOrderSuccessor(e.rightNode);return e.value=o.value,e.key=o.key,e.rightNode=this.removeNode(e.rightNode,o.key),e}countNodeBelow(e){return null==e?0:1+this.countNodeBelow(e.leftNode)+this.countNodeBelow(e.rightNode)}inOrderSuccessor(e){for(;null!=e.leftNode;)e=e.leftNode;return e}}var ro=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class co{static compositeKey(e,t){return("0000"+e.toString(16).toUpperCase()).slice(-4)+("0000"+t.toString(16).toUpperCase()).slice(-4)}static addNodeToTree(e){if(null==this.root)return this.root=e,this.root;this.root=this.root.addNode(e,this.root,this.root.height)}static waitForDataToLoad(){return ro(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(r.B.isDataLoaded)return e("done");setTimeout(co.checkFlag,1e3,e)}static addConceptToTree(e,t,o=999){let n=this.compositeKey(t,o);var i=new io(n,e,null,null);this.addNodeToTree(i)}static getNodeFromTree(e,t){return ro(this,void 0,void 0,(function*(){let o=this.compositeKey(e,t);return this.root?this.root.getFromNode(o,this.root):null}))}static removeNodeFromTree(e){return ro(this,arguments,void 0,(function*(e,t=999){if(this.root){let o=this.compositeKey(e,t);this.root=this.root.removeNode(this.root,o)}}))}static countNumberOfNodes(){return this.root?this.root.countNodeBelow(this.root):0}}co.root=null;var so=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function ao(e,t){return so(this,arguments,void 0,(function*(e,t,o=999){let n=yield co.getNodeFromTree(e,o);console.log("this is the ghost id",e,o);let i=(0,oo.u)();if(n)for(let e=0;e<n.value.length;e++){let o=n.value[e];o.ghostId==t&&(i=o)}return i}))}function lo(e,t){return so(this,arguments,void 0,(function*(e,t,o=999){co.addConceptToTree(e,t,o)}))}var uo=o(5312),ho=o(1213),po=o(3729),fo=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))},yo=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function vo(e,t,o){return yo(this,void 0,void 0,(function*(){try{if(ni)try{return(yield hi("GetRelationLocal",{id:e,relation:t,userId:o})).data}catch(e){console.error("GetRelationLocal error sw: ",e),gi(e)}let n=yield(0,m.$I)(t),i=[];0!=n.id&&(i=yield function(e,t){return fo(this,void 0,void 0,(function*(){try{return yield A.G.GetConnectionOfCompositionAndTypeLocal(t,e)}catch(e){throw e}}))}(e,n.id));let r=[];for(let e=0;e<i.length;e++){let t=yield G(i[e].toTheConceptId);r.push(t)}return r}catch(e){throw e}}))}var go=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function mo(e){return go(this,void 0,void 0,(function*(){let t=[];try{var o=(0,d.Xr)();const n=yield fetch(l.B.ViewInternalDataUrl(),{method:"POST",headers:o,body:JSON.stringify(e)});if(n.ok){let e=yield n.json(),o={};for(let n=0;n<e.length;n++){let i=e[n].concepts;t=e[n].connections;let r=e[n].id;(0,pt.r)(i),o[r]=t}return o}return console.log("View Internal Data error",n.status),(0,u.ry)(n),t}catch(e){throw e instanceof Error?console.log(" This is the view internal data error message: ",e.message):console.log(" This is the view internal data unexpected error: ",e),e}}))}var Co=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function To(e){return Co(this,void 0,void 0,(function*(){var t;try{let o=yield mo(e),n=[];for(let i=0;i<e.length;i++){let r=e[i],c=o[r];if(r&&c){let e=[],t={};for(let t=0;t<c.length;t++)e.includes(c[t].ofTheConceptId)||e.push(c[t].ofTheConceptId);let o=yield(0,v.zN)(r,c,e);t.data=o,t.id=r,n.push(t)}else{let e={};e.id=r;let o=yield(0,z.A)(r),i={};o.type&&(i[null===(t=null==o?void 0:o.type)||void 0===t?void 0:t.characterValue]=o.characterValue,e.data=i,n.push(e))}}return n}catch(e){throw e}}))}var wo=o(176),Io=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))},ko=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function No(e){return ko(this,arguments,void 0,(function*(e,t=""){try{let o=yield function(e){return Io(this,arguments,void 0,(function*(e,t=""){var o=(0,d.ab)("application/json",t);let n=l.B.SearchInternalWithAuthenticatedCcsUrl();n=n+"?composition="+e.composition+"&search="+e.search+"&internalComposition="+e.internalComposition+"&type="+e.type+"&inpage="+e.inpage+"&page="+e.page;try{const e=yield fetch(n,{method:"GET",headers:o});return e.ok?yield e.json():(console.log("This is the searching internal error",e.status),(0,u.ry)(e),[])}catch(e){console.log("This is the searching internal error",e),(0,u.Mb)(e,n)}}))}(e,t);return yield To(o)}catch(e){throw e}}))}function Ao(e){return ko(this,arguments,void 0,(function*(e,t=""){try{return yield function(e){return Io(this,void 0,void 0,(function*(){var t=(0,d.ab)("application/json","");let o=l.B.SearchInternalWithCcsUrl();o=o+"?composition="+e.composition+"&search="+e.search+"&internalComposition="+e.internalComposition+"&type="+e.type+"&inpage="+e.inpage+"&page="+e.page;try{const e=yield fetch(o,{method:"GET",headers:t});return e.ok?yield e.json():(console.log("This is the searching internal error",e.status),(0,u.ry)(e),[])}catch(e){console.log("This is the searching internal error",e),(0,u.Mb)(e,o)}}))}(e)}catch(e){throw e}}))}var Lo=o(8095),So=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function Go(e){return So(this,void 0,void 0,(function*(){if(ni)try{return(yield hi("DeleteConceptLocal",{id:e})).data}catch(e){console.error("DeleteConceptLocal error sw: ",e),gi(e)}let t=yield(0,ho.f)(e);y.v.RemoveConcept(t)}))}var xo=o(2803),Bo=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function Ro(e,t,o,n){return Bo(this,arguments,void 0,(function*(e,t,o,n,i=!0){var r,c;const s=yn.V.logfunction("GetConnectionBetweenTwoConceptsLinker");if(ni){s.serviceWorker=!0;try{const r=yield hi("GetConnectionBetweenTwoConceptsLinker",{ofTheConcept:e,toTheConcept:t,linker:o,fullLinker:n,forward:i});return yn.V.logUpdate(s),r.data}catch(e){console.error("GetConnectionBetweenTwoConceptsLinker sw error: ",e),(0,u.ey)(s,"GetConnectionBetweenTwoConceptsLinker",e),gi(e)}}let a=(0,M.o)();if(""!=o){let n="";n=i?(null===(r=e.type)||void 0===r?void 0:r.characterValue)+"_s_"+o+"_s":(null===(c=t.type)||void 0===c?void 0:c.characterValue)+"_s_"+o+"_by",a=yield(0,q.A)("connection",n,!1,999)}""!=n&&(a=yield Se(n,999));let l=[];return l=i?yield(0,xo.x)(e.id,t.id,a.id):yield(0,xo.x)(t.id,e.id,a.id),yn.V.logUpdate(s),l}))}function bo(e,t){return new Promise(((o,n)=>{setTimeout((()=>{o(t)}),e)}))}var Do=o(3130);const Uo=3,Eo=4,Fo=5;var _o=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function Wo(e,t){return _o(this,arguments,void 0,(function*(e,t,o=""){let n=l.B.SearchAllTypeWithLinker(e.auth);var i=(0,d.ab)("application/json",o);n=n+"?search="+e.search+"&type="+e.type+"&inpage="+e.inpage+"&page="+e.page;const r=JSON.stringify(t);try{const e=yield fetch(n,{method:"POST",headers:i,body:r});return e.ok?yield e.json():((0,u.ry)(e),console.log("This is the searching multiple error",e.status),[])}catch(e){console.log("This is the searching SearchWithTypeAndLinker error",e),(0,u.Mb)(e,n)}}))}var Oo=o(4287);class Vo extends Oo.w{constructor(e,t,o=Do.y0){super(),this.searchQuery=[],this.format=Do.y0,this.searchQuery=e,this.format=o}bind(){return e=this,t=void 0,n=function*(){return this.data=yield(0,uo.cf)(this.searchQuery,"",this,this.format),this.mainConcept=this.searchQuery[0].composition,this.listenToEvent(this.mainConcept),console.log("this is the data",this.data),this.data},new((o=void 0)||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}));var e,t,o,n}}function Mo(e,t,o=Do.y0){return new Vo(e,null!=t?t:"",o)}var Po=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class jo extends Oo.w{constructor(e,t=Do.ZJ){super(),this.id=e,this.format=t}bind(){return Po(this,void 0,void 0,(function*(){if(!this.isDataLoaded){let e=yield(0,v.hL)(this.id);this.mainConcept=this.id,this.compositionIds=e.compositionList;let t=e.connectionList;for(let e=0;e<t.length;e++)this.internalConnections.push(t[e].id);this.isDataLoaded=!0,this.listenToEvent(this.mainConcept)}return yield this.build()}))}build(){return Po(this,void 0,void 0,(function*(){let e=[],t=this.internalConnections;for(let o=0;o<t.length;o++)e.push(yield ze.d.GetConnection(t[o]));return this.format==Do.ZJ?(console.log("this is the data for the build layer",e,this.mainConcept,this.internalConnections,this.compositionIds),this.data=yield(0,v.ay)(this.mainConcept,e,this.compositionIds)):this.format==Do.y0?this.data=yield(0,v.$V)(this.mainConcept,e,this.compositionIds):this.format==Do.yv?this.data=yield(0,v.re)(this.mainConcept,e,this.compositionIds):this.data=yield(0,v.ay)(this.mainConcept,e,this.compositionIds),this.data}))}}function Ho(e,t=Do.ZJ){return new jo(e,t)}var $o=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class Jo extends Oo.w{constructor(e,t,o,n,i){super(),this.data=[],this.startPage=0,this.compositionName=e,this.userId=t,this.inpage=o,this.page=n,this.format=i}bind(){return $o(this,void 0,void 0,(function*(){if(!this.isDataLoaded){var e=yield(0,g.A)(this.compositionName);if(e){yield p(this.compositionName,this.userId);let n=yield a.I.GetConceptsByTypeIdAndUser(e.id,this.userId);for(var t=this.inpage*(this.page-1),o=t;o<t+this.inpage;o++)n[o]&&this.compositionIds.push(n[o].id)}yield(0,f.Y)(this.compositionIds),this.isDataLoaded=!0,this.listenToEventType(e.id);for(let e=0;e<this.compositionIds.length;e++)this.listenToEvent(this.compositionIds[e])}return yield this.build()}))}build(){return $o(this,void 0,void 0,(function*(){if(this.data=[],this.format==Do.ZJ){for(let e=this.startPage;e<this.startPage+this.inpage;e++)if(this.compositionIds[e]){let t=yield(0,v.kx)(this.compositionIds[e]);this.data.push(t)}}else if(this.format==Do.y0){for(let e=this.startPage;e<this.startPage+this.inpage;e++)if(this.compositionIds[e]){let t=yield(0,v.RW)(this.compositionIds[e]);this.data.push(t)}}else if(this.format==Do.yv){for(let e=this.startPage;e<this.startPage+this.inpage;e++)if(this.compositionIds[e]){let t=yield(0,v.XI)(this.compositionIds[e]);this.data.push(t)}}else for(let e=this.startPage;e<this.startPage+this.inpage;e++)if(this.compositionIds[e]){let t=yield(0,v.kx)(this.compositionIds[e]);this.data.push(t)}return this.data}))}}function zo(e,t,o,n,i=Do.ZJ){return new Jo(e,t,o,n,i)}var qo=o(7106),Qo=o(5328),Xo=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class Yo extends Oo.w{constructor(e,t,o="",n){super(),this.searchText="",this.connections=[],this.externalConnectionIds=[],this.data=[],this.mainConcept=e,this.searchLinkers=t,this.textSearch=o,n&&(this.format=n)}listenToEvent(e){window.addEventListener(`${e}`,(t=>{if(this.isUpdating)console.log("rejected this");else{this.isUpdating=!0;let t=this;setTimeout((function(){return Xo(this,void 0,void 0,(function*(){let o=yield ze.d.GetConnectionByOfTheConceptAndType(e,e);for(let e=0;e<o.length;e++)yield ze.d.GetConnection(o[e]).then((e=>{e.typeId==t.mainConcept?t.internalConnections.includes(e.id)||t.internalConnections.push(e.id):t.linkers.includes(e.id)||t.linkers.push(e.id),t.conceptIds.includes(e.toTheConceptId)||t.conceptIds.push(e.toTheConceptId),t.compositionIds.includes(e.ofTheConceptId)||t.compositionIds.push(e.ofTheConceptId),t.compositionIds.includes(e.toTheConceptId)||t.compositionIds.push(e.toTheConceptId)}));t.isUpdating=!1,yield t.bind(),t.notify()}))}),200)}}))}bind(){return Xo(this,void 0,void 0,(function*(){if(!this.isDataLoaded){this.isDataLoaded=!0;const e=yield it(this.mainConcept,this.searchLinkers,this.textSearch);this.compositionIds=e.compositionIds||[],this.internalConnections=e.internalConnections||[],this.externalConnectionIds=e.externalConnections||[],this.linkers=this.externalConnectionIds,this.connections=yield(0,ft.j)(this.externalConnectionIds);for(let e=0;e<this.compositionIds.length;e++)this.listenToEvent(this.compositionIds[e]);this.listenToEvent(this.mainConcept)}return yield this.build()}))}build(){return Xo(this,void 0,void 0,(function*(){return this.externalConnectionIds=this.linkers,this.format&&this.format==Do.XZ?this.data={compositionIds:this.compositionIds,internalConnections:this.internalConnections,externalConnections:this.externalConnectionIds}:this.data=yield(0,et.p8)(this.compositionIds,this.internalConnections),this.data}))}}function Zo(e,t,o="",n){return new Yo(e,t,o,n)}var Ko=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class en extends Oo.w{constructor(e,t,o,n=Do.y0){super(),this.searchQuery=[],this.format=Do.y0,this.mainCompositionIds=[],this.searchCharacter="",this.token="",this.searchStructure=e,this.searchQuery=t,this.searchQuery[0].type=e.composition,this.searchCharacter=e.composition,this.format=n,this.token=yt.b.BearerAccessToken}listenToEventType(e){window.addEventListener(`${e}`,(e=>{if(this.isUpdating)console.log("rejected this");else{this.isUpdating=!0;let t=this;setTimeout((function(){return Ko(this,void 0,void 0,(function*(){let o=e;t.mainCompositionIds.includes(null==o?void 0:o.detail)||(t.mainCompositionIds.unshift(null==o?void 0:o.detail),t.conceptIds.push(null==o?void 0:o.detail),t.listenToEvent(null==o?void 0:o.detail),ze.d.GetConnectionsOfConcept(null==o?void 0:o.detail).then((e=>{for(let o=0;o<e.length;o++)t.linkers.push(e[o].id)}))),t.isUpdating=!1,yield t.bind(),t.notify()}))}),200)}}))}bind(){return Ko(this,void 0,void 0,(function*(){if(!this.isDataLoaded){this.isDataLoaded=!0;var e=yield(0,g.A)(this.searchCharacter);let t=yield Wo(this.searchStructure,this.searchQuery,this.token);this.conceptIds=t.compositionIds,this.internalConnections=t.internalConnections,this.linkers=t.linkers,this.reverse=t.reverse,this.mainCompositionIds=t.mainCompositionIds,this.listenToEventType(e.id);for(let e=0;e<this.mainCompositionIds.length;e++)this.listenToEvent(this.mainCompositionIds[e])}return yield this.build()}))}build(){return Ko(this,void 0,void 0,(function*(){return yield(0,pt.r)(this.conceptIds),this.format==Do.y0?this.data=yield(0,qo.yV)(this.linkers,this.conceptIds,this.internalConnections,this.mainCompositionIds,this.reverse):this.data=yield(0,qo._W)(this.linkers,this.conceptIds,this.internalConnections,this.mainCompositionIds,this.reverse),this.data}))}}function tn(e,t,o,n=Do.y0){return new en(e,t,o,n)}var on=o(2615);class nn{constructor(e,t,o,n,i,r,c,s=!1,a,d,u){this.structureType="lconcept",this.isComposition=!1,this.isTemp=!1,this.isSynced=!1,this.applicationId=l.B.getRandomizer(),this.id=e,this.userId=t,this.typeId=o,this.ghostId=e,this.categoryId=n,this.characterValue=r,this.accessId=i,this.type=null,this.isNew=s,this.typeCharacter=c,this.entryTimeStamp=a,this.updatedTimeStamp=d,this.isSynced=!1,this.referentId=u}getType(){console.log(this.typeId)}}class rn{constructor(e,t,o,n,i,r){this.isTemp=!1,this.applicationId=l.B.getRandomizer(),this.type=(0,M.o)(),this.id=e,this.ofTheConceptId=t,this.toTheConceptId=o,this.typeId=n,this.ghostId=e,this.orderId=i,this.typeCharacter="",this.accessId=r,this.typeCharacter="",this.entryTimeStamp=new Date,this.terminationDateTime=new Date,this.localSyncTime=new Date}}class cn{constructor(){this.compositionId=0,this.userId=999,this.sessionId=999,this.accessId=4,this.ofTheCompositionId=0,this.patchObject={}}}class sn{constructor(){this.id="0",this.remote_address="",this.server_port="",this.server_address="",this.server_name="",this.server_software="",this.http_user_agent="",this.self="",this.port="",this.userId="",this.email=""}}var an=o(628);class ln{constructor(){this.type="",this.search="",this.logicoperator="=",this.index=0,this.composition=!0,this.name="",this.operateon=""}}class dn{constructor(){this.type="",this.search="",this.composition="",this.internalComposition="",this.userId=999,this.inpage=10,this.page=1,this.auth=!0}}var un=o(7887),hn=o(3075),pn=o(7869),fn=o(9635),yn=o(9700);class vn{static initialize(){try{console.warn("Initialized Application Monitoring for tracking errors..."),this.initGlobalErrorHandlers(),this.logCatchError(),this.logErrorEvent(),this.logUnhandledError(),this.logUserInteractions(),this.logNetworkRequests(),this.logRouteChanges(),this.logPerformanceMetrics(),this.logWebSocketEvents()}catch(e){console.error("Error during Application Monitoring initialization:",e)}}static initGlobalErrorHandlers(){try{if(console.log("this is the window",window),void 0===typeof window)return;window.onerror=(e,t,o,n,i)=>{const r={message:e,source:t,lineno:o,colno:n,stack:(null==i?void 0:i.stack)||"undefined"};console.log("This is the window error",r),yn.V.logApplication("ERROR","Runtime Error",r),yn.V.log("ERROR","Runtime Error",r)},window.onunhandledrejection=e=>{yn.V.logApplication("ERROR","Unhandled Promise Rejection",{message:e.reason?e.reason.message:e.reason,stack:e.reason?e.reason.stack:null}),yn.V.log("ERROR","Unhandled Promise Rejection",{message:e.reason?e.reason.message:e.reason,stack:e.reason?e.reason.stack:null})}}catch(e){console.warn("Failed to initialize global error handlers:",e)}}static logCatchError(){try{const e=console.error;console.log("Inside originalConsoleError..."),console.error=function(...t){const o="Console Error",n={arguments:t.map((e=>gn(e)))};yn.V.logApplication("ERROR",o,n),yn.V.log("ERROR",o,n),e.apply(console,t)}}catch(e){console.warn("Failed to override console.error:",e)}}static logErrorEvent(){try{window.addEventListener("error",(e=>{var t;console.log("Inside error event...");const o={error:(null===(t=e.error)||void 0===t?void 0:t.message)||e.message,source:e.filename,line:e.lineno,column:e.colno,stack:e.error?gn(e.error.stack):void 0},n="Unhandled Error";yn.V.logApplication("ERROR",n,o),yn.V.log("ERROR",n,o)}))}catch(e){console.warn("Failed to add error event listener:",e)}}static logUnhandledError(){try{window.addEventListener("unhandledrejection",(e=>{var t,o;console.log("Inside unhandledrejection...");const n={reason:(null===(t=e.reason)||void 0===t?void 0:t.message)||String(e.reason),stack:(null===(o=e.reason)||void 0===o?void 0:o.stack)||"No stack trace available"};yn.V.logApplication("ERROR","Unhandled Promise Rejection",n),yn.V.log("ERROR","Unhandled Promise Rejection",n)}))}catch(e){console.warn("Failed to add unhandled rejection event listener:",e)}}static logUserInteractions(){document.addEventListener("click",(e=>{var t;const o=e.target,n={element:o.tagName,id:o.id,classes:o.className,text:null===(t=o.innerText)||void 0===t?void 0:t.slice(0,50)};yn.V.logApplication("INFO","User Click",n)})),document.addEventListener("input",(e=>{const t=e.target;t.tagName,t.id,t.value})),document.addEventListener("scroll",(()=>{window.scrollY}))}static logNetworkRequests(){try{if(void 0===typeof window)return;const e=null===window||void 0===window?void 0:window.fetch;if(!e)throw new Error("Original fetch is not available.");const t=[l.B.PostLogger(),l.B.PostPrefetchConceptConnections()];window.fetch=(...o)=>{return n=this,i=void 0,c=function*(){const[n,i]=o,r=n instanceof Request?n.url:n instanceof URL?n.toString():n;if(t.includes(r)){console.log("Ignored URLs detected : ",r);let t={url:r,detail:"skip"};return yn.V.logApplication("INFO","Network Request",t),e(...o)}let c={request:{type:"REQUEST",message:"Network Request",method:(null==i?void 0:i.method)||"GET",url:r,body:null==i?void 0:i.body}};try{const t=yield e(...o);return c.response={type:"RESPONSE",message:"Network Response",url:r,status:t.status},t}catch(e){throw c.response={type:"ERROR",message:"Network Request Failed",url:r,error:e instanceof Error?e.message:String(e)},yn.V.logApplication("ERROR","Failed Network Request",c),new Error(`Network request failed for ${r}: ${e.message}`)}},new((r=void 0)||(r=Promise))((function(e,t){function o(e){try{a(c.next(e))}catch(e){t(e)}}function s(e){try{a(c.throw(e))}catch(e){t(e)}}function a(t){var n;t.done?e(t.value):(n=t.value,n instanceof r?n:new r((function(e){e(n)}))).then(o,s)}a((c=c.apply(n,i||[])).next())}));var n,i,r,c}}catch(e){console.warn("Failed to override network requests:",e)}}static logPerformanceMetrics(){void 0!==typeof window&&(null===window||void 0===window||window.addEventListener("load",(()=>{const e=performance.timing;e.loadEventEnd,e.navigationStart,e.domContentLoadedEventEnd,e.navigationStart})))}static logRouteChanges(){const e=history.pushState;history.pushState=function(...t){var o;const n={url:null===(o=t[2])||void 0===o?void 0:o.toString()};return yn.V.logApplication("INFO","Route Change",n),e.apply(this,t)},null===window||void 0===window||window.addEventListener("popstate",(()=>{const e={url:location.href};yn.V.logApplication("INFO","Route Changed (Back/Forward)",e)}))}static logWebSocketEvents(){if(void 0===typeof window)return;const e=WebSocket;window.WebSocket=class extends e{constructor(e,t){super(e,t);const o={url:e.toString()};yn.V.logApplication("INFO","WebSocket Open",o),this.addEventListener("message",(t=>{const o={url:e,data:t.data};yn.V.logApplication("INFO","WebSocket Message",o)})),this.addEventListener("error",(t=>{const o={url:e,error:t instanceof Error?t.message:String(t)};yn.V.logApplication("ERROR","WebSocket Error",o)})),this.addEventListener("close",(()=>{const t={url:e};yn.V.logApplication("INFO","WebSocket Closed",t)}))}}}}function gn(e){try{return JSON.stringify(e,((e,t)=>t&&"object"==typeof t&&t instanceof Error?{message:t.message,stack:t.stack}:t))}catch(e){return"Error while serializing value"}}const mn=(e,t,...o)=>{return n=void 0,i=[e,t,...o],c=function*(e,t,o=!1){try{let n=l.B.sendMail();o&&(n=l.B.sendBulkMail());const i=yield fetch(n,{method:"POST",body:e instanceof FormData?e:JSON.stringify(e),headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}}),r=i.headers.get("content-type");if(!i.ok){const e=yield i.json();return console.info(`${i.status} ${e}`),null}const c=yield i.json();return r&&r.includes("text/plain")?yield i.text():c}catch(e){return console.error(e),null}},new((r=void 0)||(r=Promise))((function(e,t){function o(e){try{a(c.next(e))}catch(e){t(e)}}function s(e){try{a(c.throw(e))}catch(e){t(e)}}function a(t){var n;t.done?e(t.value):(n=t.value,n instanceof r?n:new r((function(e){e(n)}))).then(o,s)}a((c=c.apply(n,i||[])).next())}));var n,i,r,c};class Cn{constructor(){this.subscribers=[]}notify(){console.log("this is the subscribers",this.subscribers),this.subscribers.map((e=>{e(this.data)}))}dataChange(e){return this.subscribers.push(e),e(this.data)}}class Tn extends Cn{constructor(){super(...arguments),this.elementIdentifier=0,this.widgetMounted=!1}getComponent(){return document.getElementById(this.elementIdentifier.toString())}getElementById(e){let t=this.getComponent(),o=document.body;if(t){let n=t.querySelector("#"+e);if(n)return o=n,o}return null}createWidgetWrapperIdentifier(){return this.elementIdentifier=1e4*Math.random(),this.elementIdentifier.toString()}}class wn extends Tn{constructor(){super(...arguments),this.html="",this.css="",this.js="",this.childWidgets=[],this.childWidgetElement=[],this.widgetState={},this.parentElement="",this.element=null}getElement(){return this.element}setTitle(e){document.title=e}getHtml(){return this.html}UpdateChildData(e,t){let o=t;o.data=e,o.render(),o.update()}update(){}setState(e){this.data=e,this.notify(),this.render()}loadChildWidgets(){this.childWidgets.map((e=>{let t=this.getElementById(e.parentElement);t&&(t.innerHTML=""),e.mount(t)}))}render(){this.element&&(this.element.innerHTML=this.getHtml()),console.log("this is the rendering",this),this.after_render(),this.widgetMounted&&this.loadChildWidgets()}getElementByClassName(e){let t=this.getComponent();if(t){let o=null==t?void 0:t.querySelectorAll("."+e);return console.log("this is the element",t,o,e),o}return[]}mount_child(){}mount(e){return t=this,o=void 0,i=function*(){e&&(this.element=document.createElement("div"),this.element.id=this.createWidgetWrapperIdentifier(),this.element.innerHTML=this.getHtml(),e.appendChild(this.element),this.parentElement=e.id,this.before_render(),this.mount_child(),this.widgetMounted=!0)},new((n=void 0)||(n=Promise))((function(e,r){function c(e){try{a(i.next(e))}catch(e){r(e)}}function s(e){try{a(i.throw(e))}catch(e){r(e)}}function a(t){var o;t.done?e(t.value):(o=t.value,o instanceof n?o:new n((function(e){e(o)}))).then(c,s)}a((i=i.apply(t,o||[])).next())}));var t,o,n,i}before_render(){this.render()}after_render(){console.log("this is calling the after render",this)}renderChildWidgets(){function e(t){var o;t&&(null===(o=t.childWidgets)||void 0===o||o.forEach((t=>{e(t)})),t.render())}this.childWidgets.forEach((t=>{e(t)}))}setWidgetState(e,t){this.widgetState[e]=t,function e(t){t&&Array.isArray(t.childWidgets)&&t.childWidgets.forEach((o=>{o.widgetState=Object.assign(Object.assign({},o.widgetState),t.widgetState),e(o)}))}(this),this.renderChildWidgets()}getWidgetState(e,t){return Object.keys.length&&this.widgetState[e]?this.widgetState[e]:t}}var In=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class kn extends wn{constructor(){super(...arguments),this.childComponents=[],this.componentMounted=!1,this.oldHtml=null,this.phonebooks=[],this.childrenData={},this.childWidgets=[],this.typeValueList=[],this.widgetType="the_element_name",this.parentConceptList=[]}getUserId(){return In(this,void 0,void 0,(function*(){const e=yield new Promise((e=>{let t=(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("profile"))||"";t?e(JSON.parse(t)):e()}));return null==e?void 0:e.userId}))}getTypeValueList(){return In(this,arguments,void 0,(function*(e=""){return new Promise((t=>In(this,void 0,void 0,(function*(){const o=null==(e=this.widgetType)?void 0:e.match(/^[a-z0-9]+_[a-z0-9]+/i),n=o?o[0]:"",i=null==e?void 0:e.match(/^([a-z0-9]+).*_([a-z0-9]+)$/i),r=i?`${i[1]}_${i[2]}`:"";let c=[],s=new ln;s.type=r,s.search="1",s.logicoperator=">",s.name="emailfilter",s.operateon="entityEmail",s.composition=!1,c.push(s);let a=new En;a.typeConnection=e,a.name="entityEmail";let l=new En;l.type=n,l.filterLogic="( emailfilter )",l.filters=c,l.name="top",l.inpage=100,l.freeschemaQueries=[a],l.outputFormat=Do.y0,Mn(l,"").subscribe((o=>{if(null==o?void 0:o.length){const i=null==o?void 0:o.map((t=>{var o,i,c,s,a,l,d;const u=null===(s=null===(c=null===(i=null===(o=t.data)||void 0===o?void 0:o[n])||void 0===i?void 0:i[e])||void 0===c?void 0:c.data)||void 0===s?void 0:s[r];return{id:null===(d=null===(l=null===(a=t.data)||void 0===a?void 0:a[n])||void 0===l?void 0:l[e])||void 0===d?void 0:d.id,name:u,text:u}}));return this.typeValueList=i,t(i),i}}))}))))}))}setTitle(e){document.title=e}getHtml(){return this.html}createRandomNumber(){return this.elementIdentifier=1e4*Math.random(),this.elementIdentifier}mount_child(){return In(this,void 0,void 0,(function*(){try{new Function("tsccs",`\n return (async function() {\n ${this.mountChildWidgetsFunction}\n }).call(this);\n `).bind(this)(n)}catch(e){throw console.log("This is the error in the mount child",e),e}}))}setProperty(e){return In(this,void 0,void 0,(function*(){return this.widgetType=e,this.getTypeValueList(this.widgetType).then((()=>{var e,t,o;null===(e=this.element)||void 0===e||e.setAttribute("data-type-value",this.widgetType),null===(o=null===(t=this.element)||void 0===t?void 0:t.parentElement)||void 0===o||o.setAttribute("data-type-value",this.widgetType),this.render()})),this}))}createTypeEditor(e){!function(e,t){if(e){const o=document.querySelector("#widget-properties #widget-type");console.log("This is the input val container",o,t,e);const n=null==o?void 0:o.querySelectorAll("input");null==n||n.forEach((e=>{null==e||e.remove()})),console.log("event.target",e.target);const i=e.target.closest(".added-widget-container"),r=e.target.closest("div");let c="";i?c=null==i?void 0:i.getAttribute("data-type-value"):r&&(c=null==r?void 0:r.getAttribute("data-type-value"));const s=document.createElement("input");s.setAttribute("type","text"),s.setAttribute("name","input-widgetTypeValue"),s.setAttribute("of",t.elementIdentifier.toString()),s.setAttribute("class","form-control"),s.setAttribute("id","widgetType"),t.widgetType?s.value=t.widgetType:s.setAttribute("placeholder","e.g. the_entity");let a=t;s.onchange=function(e){var t,o,n;e.preventDefault(),e.stopPropagation();const i=null===(t=null==e?void 0:e.target)||void 0===t?void 0:t.value;a.widgetType=i,a.before_render(),a.loadChildWidgets(),null===(n=null===(o=a.element)||void 0===o?void 0:o.parentElement)||void 0===n||n.setAttribute("data-type-value",a.widgetType)},null==o||o.appendChild(s)}}(e,this)}mount(e){return In(this,void 0,void 0,(function*(){if(e){this.element=document.createElement("div");let t=this;this.element.onclick=function(e){e.preventDefault(),e.stopPropagation(),t.createTypeEditor(e)},this.element.id=this.createWidgetWrapperIdentifier(),this.element.className="p-2 mftsccs-marking-element",this.element.innerHTML=this.getHtml(),null==e||e.setAttribute("data-type-value",t.widgetType),e.appendChild(this.element),this.parentElement=e.id,0==this.componentMounted||0==this.widgetMounted?(this.before_render(),this.mount_child(),this.widgetMounted=!0,this.componentMounted=!0):this.render(),this.childWidgetElement=this.getElementByClassName("added-widget-container")}}))}before_render(){try{new Function("tsccs",`\n return (async function() {\n ${this.componentDidMountFunction}\n }).call(this);\n `).bind(this)(n)}catch(e){throw console.log("This is the error in the before render",e),e}}after_render(){try{new Function("tsccs",`\n return (async function() {\n ${this.addEventFunction}\n }).call(this);\n `).bind(this)(n)}catch(e){throw console.log("This is the error in the after render",e),e}}CreateConnectionBetweenEntityLocal(e,t,o){return In(this,void 0,void 0,(function*(){var n;const i=e.userId,r=(null===(n=e.type)||void 0===n?void 0:n.characterValue)+"_"+o,c=yield(0,le.$)(r,999,999,i);return yield(0,no.F)(e.id,t.id,c.id,1e3),"connection created"}))}}var Nn=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class An{constructor(){this.actions={concepts:[],connections:[]},this.success=!0,this.transactionId=Math.random().toString().substring(5)}initialize(){return Nn(this,void 0,void 0,(function*(){yield an.H.initializeTransaction(this.transactionId)}))}commitTransaction(){return Nn(this,void 0,void 0,(function*(){if(!this.success)throw Error("Query Transaction Expired");yield an.H.SyncDataOnline(this.transactionId),this.actions={concepts:[],connections:[]},this.success=!1}))}rollbackTransaction(){return Nn(this,void 0,void 0,(function*(){this.success=!1,this.actions={concepts:[],connections:[]},yield an.H.rollbackTransaction(this.transactionId,this.actions)}))}markAction(){return Nn(this,void 0,void 0,(function*(){yield an.H.markTransactionActions(this.transactionId,this.actions)}))}MakeTheInstanceConceptLocal(e,t){return Nn(this,arguments,void 0,(function*(e,t,o=!1,n,i,r=999,c=0){try{if(!this.success)throw Error("Query Transaction Expired");const s=yield(0,K.k)(e,t,o,n,i,r,c,this.actions);return yield this.markAction(),s}catch(e){throw console.log(e),this.success=!1,e}}))}MakeTheTypeConceptLocal(e,t,o,n){return Nn(this,void 0,void 0,(function*(){try{if(!this.success)throw Error("Query Transaction Expired");const i=yield(0,le.$)(e,t,o,n,this.actions);return yield this.markAction(),i}catch(e){throw console.log(e),this.success=!1,e}}))}CreateConnectionBetweenTwoConceptsLocal(e,t,o){return Nn(this,arguments,void 0,(function*(e,t,o,n=!1){try{if(!this.success)throw Error("Query Transaction Expired");const i=yield(0,Lo.h)(e,t,o,n,this.actions);return yield this.markAction(),i}catch(e){throw console.log(e),this.success=!1,e}}))}CreateTheConnectionLocal(e,t,o){return Nn(this,arguments,void 0,(function*(e,t,o,n=1,i="",r=999){try{if(!this.success)throw Error("Query Transaction Expired");const c=yield(0,no.F)(e,t,o,n,i,r,this.actions);return yield this.markAction(),c}catch(e){throw console.log(e),this.success=!1,e}}))}CreateTheCompositionLocal(e){return Nn(this,arguments,void 0,(function*(e,t=null,o=null,n=null,i=null,r=null,c=null,s=!1){try{if(!this.success)throw Error("Query Transaction Expired");const a=yield(0,F.R)(e,t,o,n,i,r,c,s,this.actions);return yield this.markAction(),a}catch(e){throw console.log(e),this.success=!1,e}}))}}const Ln={number:/^\d+(\.\d+)?$/,text:/^[\s\S]*$/,textOnly:/^[A-Za-z\s]+$/,email:/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,document:/\.(pdf|docx?|pptx?|xlsx?)$/i,sound:/\.(mp3|wav|ogg|flac)$/i,image:/\.(jpg|jpeg|png|gif|bmp|svg|webp)$/i,video:/\.(mp4|avi|mov|mkv|flv|webm)$/i,url:/^(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})([/\w .-]*)*\/?$/,date:/^\d{4}-\d{2}-\d{2}$/,time:/^(?:[01]\d|2[0-3]):[0-5]\d$/,password:/^.{6,}$/,ipaddress:/^(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^([0-9a-fA-F]{1,4}:){7}([0-9a-fA-F]{1,4})$/,uuid:/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/};var Sn=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class Gn{constructor(){Gn.cacheInitialized||Gn.initializeAnomalyParameters()}static initializeAnomalyParameters(){return Sn(this,void 0,void 0,(function*(){try{yield Gn.getAnomalyParameters(),Gn.refreshCache(),Gn.cacheInitialized=!0}catch(e){console.error("Error during anomaly parameter initialization:",e)}}))}static getAnomalyParameters(){return Sn(this,void 0,void 0,(function*(){const e=Date.now();if(Gn.anomalyParamsCache&&e-Gn.lastFetchedTime<Gn.cacheExpiryThreshold)return console.log("Returning cached anomaly parameters"),Gn.anomalyParamsCache;try{return yield Gn.fetchAnomalyParameters()}catch(e){throw console.error("Error fetching anomaly parameters:",e),e}}))}static fetchAnomalyParameters(){return Sn(this,void 0,void 0,(function*(){try{const e=yield fetch("https://devai.freeschema.com/v1/get-frontend-anomaly-parameters",{method:"GET",headers:{"Content-Type":"application/json"}});if(!e.ok)throw new Error("Failed to fetch anomaly parameters");const t=yield e.json();return Gn.anomalyParamsCache=t.data,Gn.lastFetchedTime=Date.now(),t.data}catch(e){throw console.error("API Fetch Error:",e),e}}))}static refreshCache(){return Sn(this,void 0,void 0,(function*(){try{Date.now()-Gn.lastFetchedTime>Gn.cacheExpiryThreshold&&(yield Gn.getAnomalyParameters())}catch(e){console.error("Error refreshing anomaly parameters cache:",e)}}))}detectDataType(e){for(const[t,o]of Object.entries(Ln))if(o.test(e))return t;return null}checkConceptAnomaly(e,t){return Sn(this,void 0,void 0,(function*(){const o=[];try{if(!t)return o.push("Null value"),{valid:!1,warnings:o};const n=Gn.anomalyParamsCache;e.startsWith("the_")||(e=`the_${e}`);const i=n[e];if(console.log("Concept Details : ",i),!i)return console.warn(`No concept details found for type: ${e}`),o.push(`No concept details found for type: ${e}`),{valid:!1,warnings:o};const r=t.length,{min_length:c,max_length:s,data_types:a}=i,l=r>=c&&r<=s,d=this.detectDataType(t),u=a.includes(d);return l||o.push(`Length of '${t}' is outside the allowed range (min: ${c}, max: ${s}). Current length: ${r}.`),u||o.push(`Type mismatch for '${t}'. Expected types: ${a.join(", ")}, detected type: ${d}.`),l&&u&&o.push(`Concept ${e} is valid. Length: ${r}, Type: ${d}`),{valid:l&&u,warnings:o}}catch(n){return console.error(`Error checking anomaly for ${e} with value ${t}:`,n),{valid:!1,warnings:o}}}))}static checkAnomalyInBulk(e){return Sn(this,void 0,void 0,(function*(){Gn.cacheInitialized||(yield Gn.initializeAnomalyParameters());try{const t={};for(const[o,n]of Object.entries(e)){const e=n.value,{valid:i,warnings:r}=yield(new Gn).checkConceptAnomaly(o,e);t[o]={valid:i,warnings:r}}return t}catch(e){throw console.error("Bulk Anomaly Check Error:",e),e}}))}static getExportedFunction(){console.log("Main : ",n);const e=Object.keys(n);return console.log("The exported List : ",e),e}static getFunctionaAnomalyParameters(){}}Gn.anomalyParamsCache=null,Gn.cacheInitialized=!1,Gn.lastFetchedTime=0,Gn.cacheExpiryThreshold=6e5;var xn=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class Bn{checkUniqueness(e,t){return xn(this,void 0,void 0,(function*(){const o=yn.V.logfunction("checkUniqueness");e.startsWith("the_")||(e="the_"+e);let n=(yield Se(e,999)).id,i=yield(0,re.A)(t,n);return console.log("This is the concept for validator",i),!(i.id>0||(yn.V.logUpdate(o),0))}))}validateField(e,t,o,n,i,r,c,s,a,l,d,h,p){return xn(this,arguments,void 0,(function*(e,t,o,n,i,r,c,s,a,l,d,h,p,f=!1){var y;const v=yn.V.logfunction("validateField");try{performance.now();const e={};if(!p||null!==n&&""!==n||(e.required="This is required field"),o&&n){let t=Ln[o];t&&""!==n&&!t.test(n)&&(e.dataType=`Invalid value for ${o}`)}if(i&&n){const t="string"==typeof i?new RegExp(i):i;""===n||t.test(n)||(e.pattern="Pattern doesn't match with value")}if(n&&null!==c&&n.length>c&&(e.maxLength=`Length exceeds the maximum length of ${c}`),n&&null!==s&&n.length<s&&(e.minLength=`Length must be at least ${s} characters long`),null!==a&&n&&!isNaN(Number(n))&&Number(n)<a&&(e.minValue=`Value must be greater than or equal to ${a}`),null!==l&&n&&!isNaN(Number(n))&&Number(n)>l&&(e.maxValue=`Value must be less than or equal to ${l}`),h&&t&&d){const t=d.split(",").map((e=>e.trim().toLowerCase())),o=null===(y=h.name.split(".").pop())||void 0===y?void 0:y.toLowerCase();o&&!t.includes(o)&&(e.accept=`File must be a valid file type: ${t.join(", ")}`)}return r&&f&&n&&((yield this.checkUniqueness(r,n))||(e.unique="Value is not unique")),yn.V.logUpdate(v),e}catch(e){throw(0,u.ey)(v,"Validator.validateField",e),e}}))}validateForm(e){return xn(this,void 0,void 0,(function*(){const t=yn.V.logfunction("validateForm");try{performance.now();const o={};for(const t in e){const{value:n,fieldType:i,dataType:r,pattern:c,conceptType:s,maxLength:a=null,minLength:l=null,minValue:d=null,maxValue:u=null,accept:h=null,file:p=null,required:f,isUnique:y}=e[t],v=yield this.validateField(t,i,r,n,c,s,a,l,d,u,h,p,f,y);Object.keys(v).length>0&&(o[t]=v)}return yn.V.logUpdate(t),o}catch(e){throw(0,u.ey)(t,"Validator.validateForm",e),e}}))}validate(e,t,o,n,i,r,c,s,a,l,d,h,p,f=!1){const y=yn.V.logfunction("validate");try{let u={};return this.validateField(e,t,o,n,i,r,c,s,a,l,d,h,p,f).then((e=>{Object.keys(e).length>0?(u.status=!1,u.details=e):u.status=!0})),console.error("Error on validate object"),yn.V.logUpdate(y),u}catch(e){(0,u.ey)(y,"Validator.validate",e)}}}const Rn=e=>{var t;const o=document.getElementsByName(e)[0];if(!o)return console.warn(`Element with NAME "${e}" not found.`),{value:null,fieldType:null,dataType:null,pattern:null,conceptType:null,maxLength:null,minLength:null,minValue:null,maxValue:null,accept:null,file:null,required:!1,isUnique:!0};const n=o.hasAttribute("required")||"true"===o.getAttribute("data-required"),i=o.hasAttribute("isUnique")&&"true"===o.getAttribute("isUnique");return{value:o.value,fieldType:o.type,dataType:o.getAttribute("data-type"),pattern:o.getAttribute("data-pattern"),conceptType:o.getAttribute("concept-type"),maxLength:o.getAttribute("data-maxlength")?parseInt(o.getAttribute("data-maxlength")):null,minLength:o.getAttribute("data-minlength")?parseInt(o.getAttribute("data-minlength")):null,minValue:o.getAttribute("data-min")?parseInt(o.getAttribute("data-min")):null,maxValue:o.getAttribute("data-max")?parseInt(o.getAttribute("data-max")):null,accept:o.getAttribute("accept")||null,file:"file"===o.type&&(null===(t=o.files)||void 0===t?void 0:t[0])||null,required:n,isUnique:i}};var bn=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function Dn(e,t){var o=arguments;return bn(this,void 0,void 0,(function*(){const n=yn.V.logfunction("DeleteConnectionByType",o);if(ni){n.serviceWorker=!0;try{const o=yield hi("DeleteConnectionByType",{id:e,linker:t});return yn.V.logUpdate(n),o.data}catch(e){console.error("DeleteConnectionByType sw error: ",e),(0,u.ey)(n,"DeleteConnectionByType",e),gi(e)}}let i=yield xe(e);for(let e=0;e<i.length;e++)ze.d.AddConnection(i[e]);let r=yield ze.d.GetConnectionsOfConcept(e),c=yield(0,g.A)(t),s=[];for(let e=0;e<r.length;e++)r[e].typeId==c.id&&s.push(r[e]);for(let e=0;e<s.length;e++)(0,J.m)(s[e].id);yn.V.logUpdate(n)}))}function Un(e,t){return bn(this,arguments,void 0,(function*(e,t,o=!1){if(ni)try{return(yield hi("GetAllTheConnectionsByTypeAndOfTheConcept",{id:e,linker:t,reverse:o})).data}catch(e){console.error("GetAllTheConnectionsByTypeAndOfTheConcept sw error: ",e),gi(e)}let n=[];if(o){let o=yield Re(e),i=yield Se(t,999);for(let e=0;e<o.length;e++)o[e].typeId==i.id&&n.push(o[e])}else{let o=yield xe(e);for(let e=0;e<o.length;e++)ze.d.AddConnection(o[e]);let i=yield ze.d.GetConnectionsOfConcept(e),r=yield(0,g.A)(t);for(let e=0;e<i.length;e++)i[e].typeId==r.id&&n.push(i[e])}return n}))}class En{constructor(){this.type="",this.inpage=10,this.page=1,this.concepts=[],this.conceptIds=[],this.selectors=[],this.freeschemaQueries=[],this.filters=[],this.filterLogic="",this.typeConnection="",this.order="DESC",this.outputFormat=Do.yv,this.name="",this.reverse=!1,this.limit=!1,this.includeInFilter=!1,this.isOldConnectionType=!1}}var Fn=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function _n(e){var t=arguments;return Fn(this,arguments,void 0,(function*(e,o=""){const n=yn.V.logfunction("FreeschemaQueryApi",t);var i=(0,d.ab)("application/json",o);const r=l.B.FreeschemaQueryUrl(),c=JSON.stringify(e);try{const e=yield fetch(r,{method:"POST",headers:i,body:c});return e.ok?yield e.json():((0,u.ry)(e),console.log("This is the freeschema query error",e.status),[])}catch(e){console.log("This is the freeschema query error others",e),(0,u.Mb)(e,r),(0,u.ey)(n,"FreeschemaQueryApi",e)}}))}var Wn=o(5898),On=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};class Vn extends Oo.w{constructor(e,t){super(),this.mainCompositionIds=[],this.query=new En,this.countInfoStrings=[],this.order="DESC",this.query=e,this.format=e.outputFormat,this.order=e.order}bind(){return On(this,void 0,void 0,(function*(){if(!this.isDataLoaded){this.isDataLoaded=!0,this.query.outputFormat=Do.BG;let e=yield _n(this.query,"");this.conceptIds=e.conceptIds,this.internalConnections=e.internalConnections,this.linkers=e.linkers,this.reverse=e.reverse,this.mainCompositionIds=e.mainCompositionIds,this.countInfoStrings=e.countinfo}return yield this.build()}))}build(){return On(this,void 0,void 0,(function*(){yn.V.logfunction("build",["schemaquery",this.mainCompositionIds]);let e=(0,Wn.w)(this.countInfoStrings);return this.format==Do.y0?(console.time("format"),this.data=yield(0,qo.e$)(this.linkers,this.conceptIds,this.mainCompositionIds,this.reverse,e,this.order),console.timeEnd("format")):this.format==Do.ZJ?this.data=yield(0,qo.y6)(this.linkers,this.conceptIds,this.mainCompositionIds,this.reverse,e,this.order):(console.time("format"),this.data=yield(0,qo.b6)(this.linkers,this.conceptIds,this.mainCompositionIds,this.reverse,e),console.timeEnd("format")),this.data}))}}function Mn(e,t){return new Vn(e,t)}class Pn{constructor(){this.id=0,this.name="",this.html="",this.css="",this.js="",this.library={css:[],js:[]},this.timestamp="",this.widgetId=0,this.type="",this.clean="",this.after_render="",this.before_render="",this.update="",this.origin=0,this.version=0,this.mount_child="",this.children=[],this.wrapper="0",this.widget=new kn}}var jn=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function Hn(e,t,o){return jn(this,void 0,void 0,(function*(){var n;const i=yn.V.logfunction("CreateConnectionBetweenEntityLocal",[e.id,t.id,o]),r=e.userId,c=(null===(n=e.type)||void 0===n?void 0:n.characterValue)+"_"+o,s=yield(0,le.$)(c,999,999,r);console.log(yield(0,no.F)(e.id,t.id,s.id,1e3)),yn.V.logUpdate(i)}))}var $n=o(4310),Jn=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};function zn(e,t,o){return Jn(this,void 0,void 0,(function*(){var n;const i=yield eo(e,"the_page_body");(null===(n=null==i?void 0:i[0])||void 0===n?void 0:n.id)?yield Qn(i[0].id,t,o):t.innerHTML="<h4>Invalid or Page doesn't exist</h4>"}))}function qn(e,t,o){return Jn(this,void 0,void 0,(function*(){var n;const i=yield eo(e,"the_widget_latest");if(0==(null==i?void 0:i.length))yield Qn(e,t,o);else{const e=null===(n=null==i?void 0:i[0])||void 0===n?void 0:n.id;e&&(yield Qn(e,t,o))}}))}function Qn(e,t,o){return Jn(this,void 0,void 0,(function*(){try{const n=yield(0,$n.C)(e);console.log("this is the bulk widget",n);const i=yield Yn(e,[],n);if(!i.name)return void(t.innerHTML="<h4>Invalid or Widget doesn't exist</h4>");const r=t,c=yield Zn(i,r,void 0,o);console.log("this is the tree newWidget",i);const s=document.createElement("style");s.innerHTML=i.css+c.css,r.appendChild(s);const a=document.createElement("script");a.innerHTML=i.js,r.appendChild(a),r.querySelectorAll(".wb-initial-empty").forEach((e=>{e.classList.remove("wb-initial-empty")})),document.querySelectorAll('[onclick="widgetSelected(event)"]').forEach((e=>{e.removeAttribute("onclick")}))}catch(e){console.error("Error Caught Rendering Widget")}}))}function Xn(e){return Jn(this,arguments,void 0,(function*(e,t=[],o=""){const n=yield(0,$n.C)(e);return console.log("this is the bulk widget",n),yield Yn(e,[],n)}))}function Yn(e){return Jn(this,arguments,void 0,(function*(e,t=[],o,n=""){var i,r,c,s,a,l,d,u,h,p,f,y,v,g,m,C,T,w,I,k,N,A,L,S,G,x,B,R,b,D,U,E,F,_,W,O,V,M,P,j,H,$,J,z;try{const q=new Pn,Q=(0,$n.i)(o,e);console.log("this is the output",Q),t.push(e);const X=null===(i=null==Q?void 0:Q.data)||void 0===i?void 0:i.the_widget;q.name=null===(c=null===(r=null==X?void 0:X.the_widget_name)||void 0===r?void 0:r.data)||void 0===c?void 0:c.the_name,q.html=null===(a=null===(s=null==X?void 0:X.the_widget_html)||void 0===s?void 0:s.data)||void 0===a?void 0:a.the_html,q.css=null===(d=null===(l=null==X?void 0:X.the_widget_css)||void 0===l?void 0:l.data)||void 0===d?void 0:d.the_css,q.js=null===(h=null===(u=null==X?void 0:X.the_widget_js)||void 0===u?void 0:u.data)||void 0===h?void 0:h.the_js,q.origin=Number(null===(f=null===(p=null==X?void 0:X.the_widget_origin)||void 0===p?void 0:p.data)||void 0===f?void 0:f.the_origin),q.version=null===(v=null===(y=null==X?void 0:X.the_widget_version)||void 0===y?void 0:y.data)||void 0===v?void 0:v.the_version,q.clean=null===(m=null===(g=null==X?void 0:X.the_widget_clean)||void 0===g?void 0:g.data)||void 0===m?void 0:m.the_clean,q.timestamp=null===(T=null===(C=null==X?void 0:X.the_widget_timestamp)||void 0===C?void 0:C.data)||void 0===T?void 0:T.the_timestamp,q.id=Q.id;const Y=null===(I=null===(w=null==X?void 0:X.the_widget_type)||void 0===w?void 0:w.data)||void 0===I?void 0:I.the_type;q.type="null"==Y||null==Y?"the_element_name":Y,q.after_render=null===(N=null===(k=null==X?void 0:X.the_widget_after_render)||void 0===k?void 0:k.data)||void 0===N?void 0:N.the_after_render,q.before_render=null===(L=null===(A=null==X?void 0:X.the_widget_before_render)||void 0===A?void 0:A.data)||void 0===L?void 0:L.the_before_render,q.update=null===(G=null===(S=null==X?void 0:X.the_widget_update)||void 0===S?void 0:S.data)||void 0===G?void 0:G.the_update,q.widgetId=e,q.mount_child=null===(B=null===(x=null==X?void 0:X.the_widget_mount_child)||void 0===x?void 0:x.data)||void 0===B?void 0:B.the_mount_child;const Z=null==X?void 0:X.the_widget_s_child;if(console.log("widget info",q),null==Z?void 0:Z.length)for(let e=0;e<Z.length;e++){const i=(null===(D=null===(b=null===(R=Z[e])||void 0===R?void 0:R.data.the_child_widget)||void 0===b?void 0:b.the_child_widget_info)||void 0===D?void 0:D.id)||(null===(_=null===(F=null===(E=null===(U=Z[e])||void 0===U?void 0:U.data.the_child_widget)||void 0===E?void 0:E.the_child_widget_parent)||void 0===F?void 0:F.data)||void 0===_?void 0:_.the_parent);console.log("this is the child Widget",i);const r=yield Yn(i,t,o,n);console.log("this is the child Widget",r);const c=null===(P=null===(M=null===(V=null===(O=null===(W=Z[e])||void 0===W?void 0:W.data)||void 0===O?void 0:O.the_child_widget)||void 0===V?void 0:V.the_child_widget_type)||void 0===M?void 0:M.data)||void 0===P?void 0:P.the_type,s=null===(z=null===(J=null===($=null===(H=null===(j=Z[e])||void 0===j?void 0:j.data)||void 0===H?void 0:H.the_child_widget)||void 0===$?void 0:$.the_child_widget_wrapper)||void 0===J?void 0:J.data)||void 0===z?void 0:z.the_wrapper;r.type="null"==c||null==c?"the_element_name":c,r.wrapper=s,q.children.push(r)}return q}catch(e){throw console.error("error",e),e}}))}function Zn(e,t){return Jn(this,arguments,void 0,(function*(e,t,o=!0,n,i){var r,c;const s=new kn;s.html=e.html,s.widgetType=e.type,s.componentDidMountFunction=e.before_render,s.addEventFunction=e.after_render,s.mountChildWidgetsFunction=e.mount_child,s.widgetState=Object.assign({},i),n&&(s.data=n),t.innerHTML="";const a=t;if(a&&(yield s.mount(a),e.widget=s,e.children.length>0&&(null===(r=s.childWidgetElement)||void 0===r?void 0:r.length)>0))for(let t=0;t<(null===(c=e.children)||void 0===c?void 0:c.length);t++){const o=e.children[t];for(let e=0;e<s.childWidgetElement.length;e++){const t=s.childWidgetElement[e];if(o.wrapper===t.id){const e=ei(o);o.html=`<div id="${o.wrapper}">${o.html}</div>`;const n=yield Zn(e,t,!1,s.data,s.widgetState);s.childWidgets.push(n),s.css=s.css+n.css+`#${t.id} { ${o.css} }`,n.dataChange((e=>{var t;console.log("This is the data change in child",e);const o=null===(t=null==e?void 0:e.type)||void 0===t?void 0:t.characterValue;o&&(s.childrenData[o]=e),console.log("new child data",s.childrenData)}))}}}return console.log("newWidget ->",s),yield oi(t,".mftsccs-marking-element"),yield oi(t,".widget_container"),s}))}function Kn(e,t){return Jn(this,arguments,void 0,(function*(e,t,o=!0,n){var i,r;let c=new kn;c.html=e.html,c.widgetState=Object.assign({},n),c.widgetType=e.type,c.componentDidMountFunction=e.before_render,c.addEventFunction=e.after_render,c.mountChildWidgetsFunction=e.mount_child,t.innerHTML="";let s=t;if(s&&(yield c.mount(s),e.widget=c,e.children.length>0&&(null===(i=c.childWidgetElement)||void 0===i?void 0:i.length)>0))for(let t=0;t<(null===(r=e.children)||void 0===r?void 0:r.length);t++){let o=e.children[t];for(let e=0;e<c.childWidgetElement.length;e++){let t=c.childWidgetElement[e];if(o.wrapper===t.id){const e=ei(o),n=yield Kn(e,t,!1,c.widgetState);c.childWidgets.push(n),c.css=c.css+n.css+`#${t.id} { ${o.css} }`,n.dataChange((e=>{var t;console.log("This is the data change in child",e);let o=null===(t=null==e?void 0:e.type)||void 0===t?void 0:t.characterValue;o&&(c.childrenData[o]=e),console.log("new child data",c.childrenData)}))}}}return console.log("newWidget ->",c),c}))}function ei(e){return e.html=e.html.replace(/<[^>]*\bclass=["'][^"']*\bwidget_container\b[^"']*["'][^>]*>/g,(e=>e.replace(/\bwidget_container\b/g,"").trim())),e.html=e.html.replace(/<[^>]*\bdraggable=["'][^"']*\btrue\b[^"']*["'][^>]*>/g,(e=>e.replace(/\btrue\b/g,"false").trim())),e.html=e.html.replace(/<[^>]*\bclass=["'][^"']*\bhover-element\b[^"']*["'][^>]*>/g,(e=>e.replace(/\bhover-element\b/g,"").trim())),e.html=e.html.replace(/<[^>]*\bclass=["'][^"']*\bwb-block\b[^"']*["'][^>]*>/g,(e=>e.replace(/\bwb-block\b/g,"").trim())),e.html=e.html.replace(/<[^>]*onclick="widgetSelected\(event\)"\s*,?\s*ondragover="_dragService\.dragOverWidgetElement\(event\)"\s*,?\s*ondrop="_dragService\.dropWidgetElement\(event\)"\s*,?\s*ondragstart="_dragService\.dragStartWidgetElement\(event\)"\s*,?\s*ondragend="_dragService\.dragEndWidgetElement\(event\)"[^>]*>/g,(e=>e.replace(/onclick="widgetSelected\(event\)"/g,'onclick=""').replace(/ondragover="_dragService\.dragOverWidgetElement\(event\)"/g,'ondragover=""').replace(/ondrop="_dragService\.dropWidgetElement\(event\)"/g,'ondrop=""').replace(/ondragstart="_dragService\.dragStartWidgetElement\(event\)"/g,'ondragstart=""').replace(/ondragend="_dragService\.dragEndWidgetElement\(event\)"/g,'ondragend=""').trim())),e.html=e.html.replace(/<[^>]*\bondragstart=["'][^"']*\b_dragService\.onWidgetDragStart\(event\)\b[^"']*["'][^>]*>/g,(e=>e.replace(/\b_dragService\.onWidgetDragStart\(event\)\b/g,"").trim())),e}function ti(e,t){return Jn(this,void 0,void 0,(function*(){return e.querySelectorAll(t).forEach((e=>{for(;e.firstChild;)e.parentNode.insertBefore(e.firstChild,e);e.remove()})),e}))}function oi(e,t){return Jn(this,void 0,void 0,(function*(){const o=e.querySelectorAll(t);for(const e of o){const o=e.parentElement;if(o){for(;e.firstChild;){const n=yield ti(e.firstChild,t);o.insertBefore(n,e)}o.removeChild(e)}}}))}var ni,ii=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};const ri=Date.now().toString(36)+Math.random().toString(36).substring(2);let ci=[],si=[],ai=!1;function li(e){ai=e}function di(e="",t){yt.b.BearerAccessToken=e,null==typeof document?yt.b.sessionId=t:yt.b.sessionId=parseInt((0,yn.R)("SessionId")),ni&&hi("updateAccessToken",{accessToken:e,session:parseInt((0,yn.R)("SessionId"))})}function ui(){return ii(this,arguments,void 0,(function*(e="",t="",o="",n="",i=!0,c="",s=void 0,a={},d={}){var h;try{l.B.BASE_URL=e,l.B.AI_URL=t,l.B.NODE_URL=n,l.B.BASE_APPLICATION=c,l.B.LOG_SERVER=null!==(h=d.logserver)&&void 0!==h?h:"https://logdev.freeschema.com",console.log("setting the logserver",l.B.LOG_SERVER,d.logserver),di(o);let i=Math.floor(1e8*Math.random());l.B.setRandomizer(i);const p={logApplication:!1,logPackage:!1,accessTracker:!1,isTest:!1};if(l.B.FLAGS=p,l.B.FLAGS=Object.assign(Object.assign({},p),a),function(e){const t=yn.V.logfunction("initializeFlags",arguments);try{return e.logApplication&&(vn.initialize(),yn.V.logApplicationActivationStatus=!0,console.warn("Application log started.")),e.logPackage&&(yn.V.logPackageActivationStatus=!0,console.warn("Package log started.")),e.accessTracker&&(Je.J.activateStatus=!0,console.warn("Access Tracker Activated.")),e.isTest&&(r.B.isDataLoaded=!0,r.B.isCharacterLoaded=!0,r.B.isTypeLoaded=!0,r.B.isLocalDataLoaded=!0,r.B.isLocalTypeLoaded=!0,r.B.isLocalCharacterLoaded=!0,r.B.isConnectionLoaded=!0,r.B.isConnectionTypeLoaded=!0,r.B.isLocalConnectionLoaded=!0),yn.V.logUpdate(t),e}catch(e){throw(0,u.ey)(t,"initializeFlags",e),e}}(l.B.FLAGS),!("serviceWorker"in navigator))return yield fi(),void console.warn("Service Worker not supported in this browser.");if(function(){navigator.serviceWorker.addEventListener("message",(e=>ii(this,void 0,void 0,(function*(){var t,o,n,i;try{if(e.data&&"API_401"===e.data.type){const{requestDetails:n}=e.data,i={method:n.method,headers:new Headers(n.headers),body:n.body},r=yield fetch(n.url,i),c=yield null==r?void 0:r.json();null===(o=null===(t=null===navigator||void 0===navigator?void 0:navigator.serviceWorker)||void 0===t?void 0:t.controller)||void 0===o||o.postMessage({type:"API_RESPONSE",messageId:e.data.messageId,response:new Response(c,{status:r.status,statusText:r.statusText,headers:r.headers})})}}catch(t){console.error("Error during listenPostMessage",t),null===(i=null===(n=null===navigator||void 0===navigator?void 0:navigator.serviceWorker)||void 0===n?void 0:n.controller)||void 0===i||i.postMessage({type:"API_RESPONSE",messageId:e.data.messageId})}}))))}(),function(){fn.x.addEventListener("message",(e=>ii(this,void 0,void 0,(function*(){const{type:t,payload:o}=e.data;if(!t)return;let n={success:!1,data:void 0};pi[t]?yield pi[t](o):console.warn(`Unable to handle "${t}" case in BC service worker`)}))))}(),s&&s.activate&&s.manual)yield new Promise(((e,t)=>{navigator.serviceWorker.ready.then((t=>ii(this,void 0,void 0,(function*(){console.log("registraions ready",t),ni=t.active,yield mi(),e("done")})))).catch((e=>{console.error("Error: Ready service worker",e),t(e)})).finally((()=>console.log("Finally service worker ready done"))),setTimeout((()=>t("Timeout ready")),3e4)}));else if(s&&(null==s?void 0:s.activate))try{console.log("service worker initialiing"),yield function(e){var t=arguments;return ii(this,void 0,void 0,(function*(){const o=yn.V.logfunction("handleRegisterServiceWorker",t);yield new Promise(((t,n)=>{var i,r;let c=!1;navigator.serviceWorker.register(null!==(i=e.pathToSW)&&void 0!==i?i:"./serviceWorker.bundle.js",{scope:null!==(r=e.scope)&&void 0!==r?r:"/"}).then((e=>ii(this,void 0,void 0,(function*(){console.log("Service Worker registered:",e),setInterval((()=>{console.log("message process interrval calling",si),si.length&&vi()}),2e3),console.log("update listen start"),e.onupdatefound=()=>{const o=e.installing;console.log("new worker",o),o&&(o.onstatechange=()=>ii(this,void 0,void 0,(function*(){console.warn("on state change triggered",o.state,navigator.serviceWorker.controller),"installing"===o.state&&(console.log("Service Worker installing"),ni=void 0),"activated"!==o.state&&"redundant"!==o.state||!navigator.serviceWorker.controller||(ni=o,console.log("New Service Worker is active",e),setTimeout((()=>{console.log("Message Processed after some time"),vi()}),5e3),yield mi(),c=!0,vi(),t())})))},e.addEventListener("controllerchange",(()=>ii(this,void 0,void 0,(function*(){console.warn("controller change triggered",navigator.serviceWorker.controller),navigator.serviceWorker.controller&&(ni=navigator.serviceWorker.controller,console.warn("Service worker has been activated; controller change"),yield mi())})))),(e.installing||e.waiting||e.active)&&e.addEventListener("statechange",(e=>ii(this,void 0,void 0,(function*(){var t;"activating"===(null===(t=null==e?void 0:e.target)||void 0===t?void 0:t.state)&&(ni=navigator.serviceWorker.controller,console.warn("Service Worker is activating statechange"),yield mi())})))),e.active?(console.log("active sw"),ni=e.active,yield mi(),vi(),t()):setTimeout((()=>{c||n("Not Completed Initialization")}),1e4)})))).catch((e=>ii(this,void 0,void 0,(function*(){yield fi(),n(e),console.error("Service Worker registration failed:",e),(0,u.ey)(o,"handleRegisterServiceWorker",e)}))))}))}))}(s)}catch(e){yield fi(),console.error("Unable to start service worker",e)}else yield fi(),console.warn("Service Worker not activated");return!0}catch(e){yield fi(),console.warn("Cannot initialize the system",e)}}))}function hi(e,t){return ii(this,arguments,void 0,(function*(e,t,o=0){let n=!1;const i=Math.random().toString(36).substring(2);t.messageId=i,t.TABID=ri;const r=JSON.parse(JSON.stringify(t));let c;return"checkProcess"!=e&&0==o&&(c=setInterval((()=>ii(this,void 0,void 0,(function*(){if(console.log("process took more than one second",i,e,n),!n&&!(yield function(e,t){return ii(this,void 0,void 0,(function*(){var o;try{const n=yield hi("checkProcess",{checkMessageId:e});if(console.log("check interval data res for type ",t,e,n.data),null===(o=null==n?void 0:n.data)||void 0===o?void 0:o.processing)return!0}catch(o){return console.error("error on checing executing process",t,e,o),!1}}))}(i,e))&&(clearInterval(c),!n)){if(console.log("Failed to handle type "+e+" message not found "+i,"retrying: ",0==o,e),0==o&&"checkProcess"!=e)return console.log("retrying ",e,i),yield hi(e,t,o+1);console.log("Failed to handle type "+e+" "+i)}}))),2e3)),new Promise(((o,s)=>{if(navigator.serviceWorker.controller||ni||console.log("will go to queue",navigator.serviceWorker.controller,ni,e),navigator.serviceWorker.controller||ni){const a=r=>{var l,d,h,p,f,y;(null===(l=null==r?void 0:r.data)||void 0===l?void 0:l.messageId)==i&&(n=!0,"checkProcess"!=e&&console.log("received from sw",e,i),clearInterval(c),r.data.success||(401==(null===(d=null==r?void 0:r.data)||void 0===d?void 0:d.status)?s((0,u.ry)(new Response("Unauthorized",{status:401,statusText:null===(h=null==r?void 0:r.data)||void 0===h?void 0:h.statusText}))):500==(null===(p=null==r?void 0:r.data)||void 0===p?void 0:p.status)?s((0,u.Mb)(new Response("Internal Server Error",{status:500,statusText:null===(f=null==r?void 0:r.data)||void 0===f?void 0:f.statusText}))):(console.error("Error in the response from worker:",r),s(`Failed to handle action ${e} ${JSON.stringify(t)}, Response: ${JSON.stringify(r.data)}`))),(null===(y=r.data)||void 0===y?void 0:y.actions)&&(t.actions=JSON.parse(JSON.stringify(r.data.actions))),o(r.data),navigator.serviceWorker.removeEventListener("message",a))};if(navigator.serviceWorker.addEventListener("message",a),navigator.serviceWorker.controller)"checkProcess"!=e&&console.log("sent to sw",e,i),navigator.serviceWorker.controller.postMessage({type:e,payload:r});else if(ni){console.log("sent to sw",e,i),console.warn(`controller not found but serviceWorker is available. messageId: ${i}, type: ${e}`);try{ni.postMessage({type:e,payload:r})}catch(t){console.log("Retrying again on catch service worker",t),ni.postMessage({type:e,payload:r})}}else console.warn(`Service Worker hasn't loaded yet. messageId: ${i}, type: ${e}`),console.info("ready",navigator.serviceWorker.ready),setTimeout((()=>{console.warn(`Re-Trying after certain time. messageId: ${i}, type: ${e}`),ni?(console.info("This is triggered "),null==ni||ni.postMessage({type:e,payload:t})):(console.log("not ready",e),clearInterval(c),s("Service worker not ready"))}),3e4);setTimeout((()=>{clearInterval(c),s(`No response from service worker after timeout: ${e}`),navigator.serviceWorker.removeEventListener("message",a)}),21e4)}else si.push({message:{type:e,payload:r}}),console.log("Message Queued",e,t),console.log(navigator.serviceWorker.controller,ni,e),"init"==e&&(clearInterval(c),o(null))}))}))}const pi={GetLinkListener:e=>ii(void 0,void 0,void 0,(function*(){const t=ci.find((t=>t.listenerId==e.listenerId));return null==t||t.callback(e.data),{success:!0}})),dispatchEvent:e=>ii(void 0,void 0,void 0,(function*(){if(ni){let t=new Event(e.id||"");dispatchEvent(t)}return{success:!0}})),checkInit:e=>ii(void 0,void 0,void 0,(function*(){return console.log("service worker init 0"),navigator.serviceWorker.controller&&(console.log("service worker init 1"),ni=navigator.serviceWorker.controller),yield mi(),{success:!0}}))};function fi(){return ii(this,void 0,void 0,(function*(){yield(0,pn.A)();const e=(new Date).getTime();yield(0,i.A)().then((()=>{let t=(new Date).getTime()-e;console.log("The time taken to prepare concept data is ",t)})).catch((e=>{throw e})),yield(0,hn.Ay)().then((()=>{let t=(new Date).getTime()-e;console.log("The time taken to prepare local concept ",t)})).catch((e=>{throw e})),yield(0,un.p)().then((()=>{r.B.isLocalConnectionLoaded=!0})).catch((e=>{throw e})),yield(0,hn.xd)().catch((e=>{throw console.log("This is the error in populating binary tree"),e})),yield(0,un.a)().then((()=>{r.B.isConnectionLoaded=!0,r.B.isConnectionTypeLoaded=!0;let t=(new Date).getTime()-e;console.log("The time taken to prepare connections ",t)})).catch((e=>{throw e}))}))}function yi(e,t={}){if(ni||null!=typeof window){let o=new CustomEvent(`${e}`,t);dispatchEvent(o)}else fn.x.postMessage({type:"dispatchEvent",payload:{id:e}})}function vi(){return ii(this,void 0,void 0,(function*(){console.log("message queue",si);const e=si.find((e=>{var t;return"init"==(null===(t=null==e?void 0:e.message)||void 0===t?void 0:t.type)}));if(e){console.log("Processing Init Queue poped",null==e?void 0:e.type,e);const t=si.indexOf(e);t>-1&&si.splice(t,1),yield hi(null==e?void 0:e.type,null==e?void 0:e.payload)}for(console.log("message queue while",si);si.length>0;){const{message:e,resolve:t,reject:o}=si.shift();console.log("Queue poped",e.type,e),yield hi(e.type,e.payload)}}))}const gi=e=>{if(e instanceof j.z)throw console.error("FreeSchemaResponse Error",e),e;console.error("Service Worker Error",e)};function mi(){return ii(this,void 0,void 0,(function*(){yield hi("init",{url:l.B.BASE_URL,aiurl:l.B.AI_URL,accessToken:yt.b.BearerAccessToken,nodeUrl:l.B.NODE_URL,enableAi:!1,applicationName:l.B.BASE_APPLICATION,flags:l.B.FLAGS})}))}}},t={};function o(n){var i=t[n];if(void 0!==i)return i.exports;var r=t[n]={exports:{}};return e[n](r,r.exports,o),r.exports}o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n=o(2830),i=o(9635),r=o(205),c=o(3278),s=o(5020),a=o(7887),l=o(7869),d=o(3075),u=o(2803),h=o(7139),p=o(5284),f=o(8939),y=o(6687),v=o(2013),g=o(1213),m=o(5328),C=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};const T={GetConcept:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,h.r)(e.id)}})),GetTheConcept:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.GetTheConcept)(e.id,e.userId)}})),GetConceptBulk:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.GetConceptBulk)(e.passedConcepts)}})),GetLink:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.GetLink)(e.id,e.linker,e.inpage,e.page)}})),GetRelation:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.GetRelation)(e.id,e.relation,e.inpage,e.page)}})),GetRelationRaw:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.GetRelationRaw)(e.id,e.relation,e.inpage,e.page)}})),GetComposition:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,f.Nj)(e.id)}})),GetCompositionList:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.GetCompositionList)(e.compositionName,e.userId,e.inpage,e.page)}})),GetCompositionListWithId:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.GetCompositionListWithId)(e.compositionName,e.userId,e.inpage,e.page)}})),GetCompositionById:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,f.hL)(e.id)}})),GetCompositionWithId:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,f.yz)(e.id)}})),GetCompositionListAllWithId:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.GetCompositionListAllWithId)(e.compositionName,e.userId,e.inpage,e.page)}})),GetConceptByCharacter:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.GetConceptByCharacter)(e.characterValue)}})),GetConceptByCharacterUpdated:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,v.w)(e.characterValue)}})),GetConceptByCharacterAndType:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.GetConceptByCharacterAndType)(e.characterValue,e.typeId)}})),GetCompositionFromConnectionsWithDataId:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,y.p8)(e.conceptIds,e.connectionIds)}})),GetCompositionFromConnectionsWithDataIdIndex:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,y.Nt)(e.conceptIds,e.connectionIds)}})),GetCompositionConnectionsBetweenTwoConcepts:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,u.x)(e.ofConceptId,e.toConcept,e.mainKey)}})),GetConnectionDataPrefetch:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,y.QL)(e.connectionIds)}})),GetCompositionWithIdFromMemory:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,f.RW)(e.id)}})),GetCompositionWithIdAndDateFromMemory:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,f.Ez)(e.id)}})),GetCompositionFromMemory:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,f.kx)(e.id)}})),GetCompositionFromMemoryNormal:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,f.XI)(e.id)}})),GetCompositionWithIdFromMemoryNew:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,f.$N)(e.id)}})),FindConnectionsOfCompositionsBulkInMemory:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,p.B)(e.composition_ids)}})),GetAllTheConnectionsByTypeAndOfTheConcept:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.GetAllTheConnectionsByTypeAndOfTheConcept)(e.id,e.linker,e.reverse)}})),GetCompositionFromMemoryWithConnections:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,f.JA)(e.id,e.connectionList)}})),GetCompositionFromConnectionsWithIndexFromConnections:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,y.hG)(e.conceptIds,e.connectionIds)}})),GetCompositionFromConnectionsWithDataIdFromConnections:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,y.km)(e.conceptIds,e.connectionIds)}})),GetTheConceptLocal:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,g.f)(e.id)}})),GetCompositionLocal:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.GetCompositionLocal)(e.id)}})),GetCompositionLocalWithId:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.GetCompositionLocalWithId)(e.id)}})),GetCompositionListLocal:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.GetCompositionListLocal)(e.compositionName,e.userId)}})),GetCompositionListLocalWithId:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.GetCompositionListLocalWithId)(e.compositionName,e.userId)}})),GetConceptByCharacterAndCategoryLocal:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.GetConceptByCharacterAndCategoryLocal)(e.character)}})),ConceptsData__AddConcept:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield n.ConceptsData.AddConcept(e.concept)}})),ConceptsData__GetConcept:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield n.ConceptsData.GetConcept(e.id)}})),ConceptsData__GetConceptsByTypeIdAndUser:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield n.ConceptsData.GetConceptsByTypeIdAndUser(e.typeId,e.userId)}})),ConnectionData__GetConnectionByOfTheConceptAndType:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield n.ConnectionData.GetConnectionByOfTheConceptAndType(e.ofTheConceptId,e.typeId)}})),ConnectionData__GetConnection:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield n.ConnectionData.GetConnection(e.id)}})),ConnectionData__GetConnectionsOfCompositionLocal:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield n.ConnectionData.GetConnectionsOfCompositionLocal(e.id)}})),ConnectionData__GetConnectionsOfConcept:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield n.ConnectionData.GetConnectionsOfConcept(e.id)}})),GetLinkListener:e=>C(void 0,void 0,void 0,(function*(){let t=!1;return new Promise(((o,n)=>{(0,m.d)(e.id,e.linker,e.inpage,e.page,e.format).subscribe((n=>{var r,c;t?(console.log("isSubscribed",t),o({success:!0,data:n}),t=!0):(console.log("is not isSubscribed",t),i.x.postMessage({type:"GetLinkListener",payload:{id:null===(r=null==e?void 0:e.listener)||void 0===r?void 0:r.listenerId,listenerId:null===(c=null==e?void 0:e.listener)||void 0===c?void 0:c.listenerId,data:n}}))})).catch((e=>{console.log("Error : ",e),n("Error Occured")}))}))}))};var w=o(7106),I=o(4310),k=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};const N={SearchLinkMultipleAll:e=>k(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.SearchLinkMultipleAll)(e.searchQuery,e.token,e.caller,e.format)}})),RecursiveSearchApi:e=>k(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.RecursiveSearchApi)(e.composition,e.listLinkers,e.textSearch)}})),RecursiveSearchApiWithInternalConnections:e=>k(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.RecursiveSearchApiWithInternalConnections)(e.composition,e.listLinkers,e.textSearch)}})),RecursiveSearchApiRaw:e=>k(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.RecursiveSearchApiRaw)(e.composition,e.listLinkers,e.textSearch)}})),RecursiveSearchApiRawFullLinker:e=>k(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.RecursiveSearchApiRawFullLinker)(e.composition,e.fullLinkers,e.textSearch)}})),RecursiveSearchApiNewRawFullLinker:e=>k(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.RecursiveSearchApiNewRawFullLinker)(e.composition,e.fullLinkers,e.textSearch)}})),formatConnectionsDataId:e=>k(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,w.e$)(e.linkers,e.conceptIds,e.mainCompositionIds,e.reverse,e.countInfos,e.order)}})),formatConnectionsJustId:e=>k(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,w.y6)(e.linkers,e.conceptIds,e.mainCompositionIds,e.reverse,e.countInfos,e.order)}})),formatConnections:e=>k(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,w.b6)(e.linkers,e.conceptIds,e.mainCompositionIds,e.reverse,e.countInfos)}})),BuildWidgetFromId:e=>k(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,I.C)(e.id)}}))};var A=o(1218),L=o(3077),S=o(9975),G=o(5868),x=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};const B={MakeTheInstanceConcept:e=>x(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.MakeTheInstanceConcept)(e.type,e.referent,e.composition,e.userId,e.passedAccessId,e.passedSessionId,e.referentId)}})),MakeTheConceptLocal:e=>x(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,S.A)(e.referent,e.typeCharacter,e.userId,e.categoryId,e.typeId,e.actions)}})),MakeTheTypeConcept:e=>x(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.MakeTheTypeConcept)(e.typeString,e.sessionId,e.sessionUserId,e.userId)}})),MakeTheTimestamp:e=>x(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.MakeTheTimestamp)(e.type,e.referent,e.userId,e.accessId,e.sessionInformationId)}})),CreateTheComposition:e=>x(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,A.A)(e.json,e.ofTheConceptId,e.ofTheConceptUserId,e.mainKey,e.userId,e.accessId,e.sessionInformationId)}})),MakeTheInstanceConceptLocal:e=>x(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,G.k)(e.type,e.referent,e.composition,e.userId,e.accessId,e.sessionInformationId,e.referentId,e.actions),actions:e.actions}})),MakeTheTypeConceptLocal:e=>x(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.MakeTheTypeConceptLocal)(e.typeString,e.sessionId,e.sessionUserId,e.userId,e.actions),actions:e.actions}})),CreateTheConceptLocal:e=>x(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,L.A)(e.referent,e.typecharacter,e.userId,e.categoryId,e.typeId,e.accessId,e.isComposition,e.referentId,e.actions),actions:e.actions}})),CreateTheCompositionLocal:e=>x(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.CreateTheCompositionLocal)(e.json,e.ofTheConceptId,e.ofTheConceptUserId,e.mainKey,e.userId,e.accessId,e.sessionInformationId,e.automaticSync,e.actions),actions:e.actions}}))};var R=o(3729),b=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};const D={UpdateComposition:e=>b(void 0,void 0,void 0,(function*(){return yield(0,n.UpdateComposition)(e.patcherStructure),{success:!0}})),UpdateCompositionLocal:e=>b(void 0,void 0,void 0,(function*(){return yield(0,R.D)(e.patcherStructure,e.actions),{success:!0}}))};var U=o(8095),E=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};const F={GetConnectionById:e=>E(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.GetConnectionById)(e.id)}})),GetConnectionBulk:e=>E(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.GetConnectionBulk)(e.connectionIds)}})),GetConnectionOfTheConcept:e=>E(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.GetConnectionOfTheConcept)(e.typeId,e.ofTheConceptId,e.userId,e.inpage,e.page)}})),GetAllConnectionsOfCompositionBulk:e=>E(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.GetAllConnectionsOfCompositionBulk)(e.composition_ids)}})),GetConnectionBetweenTwoConceptsLinker:e=>E(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.GetConnectionBetweenTwoConceptsLinker)(e.ofTheConcept,e.toTheConcept,e.linker,e.fullLinker,e.forward)}})),CreateConnectionBetweenTwoConcepts:e=>E(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.CreateConnectionBetweenTwoConcepts)(e.ofTheConcept,e.toTheConcept,e.linker,e.both)}})),CreateConnectionBetweenTwoConceptsLocal:e=>E(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,U.h)(e.ofTheConcept,e.toTheConcept,e.linker,e.both,e.actions),actions:e.actions}})),CreateTheConnectionLocal:e=>E(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.CreateTheConnectionLocal)(e.ofTheConceptId,e.toTheConceptId,e.typeId,e.orderId,e.typeString,e.userId,e.actions),actions:e.actions}}))};var _=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};const W={DeleteConceptById:e=>_(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.DeleteConceptById)(e.id)}})),DeleteConnectionById:e=>_(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.DeleteConnectionById)(e.id)}})),DeleteUser:e=>_(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.DeleteUser)(e.id)}})),DeleteConnectionByType:e=>_(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.DeleteConnectionByType)(e.id,e.linker)}})),DeleteConceptLocal:e=>_(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,n.DeleteConceptLocal)(e.id)}}))};var O=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};const V={SyncData__SyncDataOnline:e=>O(void 0,void 0,void 0,(function*(){return{success:!0,data:yield n.SyncData.SyncDataOnline()}})),LocalSyncData__SyncDataOnline:e=>O(void 0,void 0,void 0,(function*(){return{success:!0,data:yield n.LocalSyncData.SyncDataOnline(e.transactionId)}})),LocalSyncData__initializeTransaction:e=>O(void 0,void 0,void 0,(function*(){return{success:!0,data:yield n.LocalSyncData.initializeTransaction(e.transactionId)}})),LocalSyncData__markTransactionActions:e=>O(void 0,void 0,void 0,(function*(){return{success:!0,data:yield n.LocalSyncData.markTransactionActions(e.transactionId,e.actions),actions:e.actions}})),LocalSyncData__rollbackTransaction:e=>O(void 0,void 0,void 0,(function*(){return{success:!0,data:yield n.LocalSyncData.rollbackTransaction(e.transactionId,e.actions),actions:e.actions}}))};var M=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};let P=!1,j=new Map,H=!1,$=[];const J=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({checkProcess:e=>M(void 0,void 0,void 0,(function*(){return(null==e?void 0:e.checkMessageId)&&$.includes(null==e?void 0:e.checkMessageId)?{success:!0,data:{processing:!0},name:"init"}:{success:!0,data:{processing:!1},name:"init"}})),init:e=>M(void 0,void 0,void 0,(function*(){return P?(console.warn("Already Initialized"),{success:!0,name:"init"}):(console.log("init has started"),P=!0,console.log("init has set value"),console.log("Payload log in service worker : ",e),yield function(){return M(this,arguments,void 0,(function*(e="",t="",o="",i="",u=!0,h="",p){var f,y;n.BaseUrl.BASE_URL=e,n.BaseUrl.AI_URL=t,n.BaseUrl.NODE_URL=i,n.BaseUrl.BASE_APPLICATION=h,c.b.BearerAccessToken=o;let v=Math.floor(1e8*Math.random());if(console.log("Flags came in init of service worker is ",p),n.BaseUrl.setRandomizer(v),n.BaseUrl.FLAGS=p,null===(f=n.BaseUrl.FLAGS)||void 0===f?void 0:f.isTest)return r.B.isDataLoaded=!0,r.B.isCharacterLoaded=!0,r.B.isTypeLoaded=!0,r.B.isLocalDataLoaded=!0,r.B.isLocalTypeLoaded=!0,r.B.isLocalCharacterLoaded=!0,r.B.isConnectionLoaded=!0,r.B.isConnectionTypeLoaded=!0,r.B.isLocalConnectionLoaded=!0,!0;console.log("This is the base url",n.BaseUrl.BASE_URL,v),console.log("service worker BaseUrl.FLAGS is ",n.BaseUrl.FLAGS),(null===(y=n.BaseUrl.FLAGS)||void 0===y?void 0:y.accessTracker)&&(console.log("From service worker, flag of Access Tracker."),n.AccessTracker.activateStatus=!0,console.log("Access Tracker Activation status from service worker",n.AccessTracker.activateStatus)),yield(0,l.A)();const g=(new Date).getTime();yield(0,s.A)().then((()=>{let e=(new Date).getTime()-g;console.log("The time taken to prepare concept data is ",e)})).catch((e=>{throw e})),yield(0,d.Ay)().then((()=>{let e=(new Date).getTime()-g;console.log("The time taken to prepare local concept ",e)})).catch((e=>{throw e})),yield(0,a.p)().then((()=>{r.B.isLocalConnectionLoaded=!0})).catch((e=>{throw e})),yield(0,d.xd)(),yield(0,a.a)().then((()=>{r.B.isConnectionLoaded=!0,r.B.isConnectionTypeLoaded=!0;let e=(new Date).getTime()-g;console.log("The time taken to prepare connections ",e)})).catch((e=>{throw e}))}))}(null==e?void 0:e.url,null==e?void 0:e.aiurl,null==e?void 0:e.accessToken,null==e?void 0:e.nodeUrl,null==e?void 0:e.enableAi,null==e?void 0:e.applicationName,null==e?void 0:e.flags),console.log("init has completed"),{success:!0,data:void 0,name:"init"})})),updateAccessToken:e=>M(void 0,void 0,void 0,(function*(){return yield(0,n.updateAccessToken)(e.accessToken,e.session),{success:!0,name:"updateAccessToken"}}))},T),N),B),D),F),W),V),z=()=>!!P||(i.x.postMessage({type:"checkInit",payload:{}}),console.log("Message posted to broadcastChannel"),!1);var q=function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function c(e){try{a(n.next(e))}catch(e){r(e)}}function s(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(c,s)}a((n=n.apply(e,t||[])).next())}))};self.addEventListener("install",(e=>{console.log("Service Worker installing... sw"),e.waitUntil(self.skipWaiting())})),self.addEventListener("activate",(e=>q(void 0,void 0,void 0,(function*(){yield(0,n.setHasActivatedSW)(!0),console.log("Service Worker activating... sw"),e.waitUntil(new Promise(((e,t)=>{try{self.clients.claim(),console.log("claimed"),z(),e(void 0)}catch(e){console.error("Error during service worker activation:",e),t(e)}})))})))),self.addEventListener("fetch",(e=>{e.clientId||e.respondWith(Q(e))})),self.addEventListener("message",(e=>{!function(e){M(this,void 0,void 0,(function*(){var t,o;let i={success:!1,data:void 0};const{type:r,payload:c}=e.data,s=c.TABID;let a=!1;try{if("checkProcess"!=r&&console.log("received",r,null==c?void 0:c.messageId),!r||!c.TABID)return;$.push(c.messageId),"init"==r||z()||(console.warn("Message received before sw initialization",r,c.messageId),yield new Promise((e=>{console.log("is it stuck here???? type",r,c.messageId);const t=setInterval((()=>{console.log("Interval check 0",P,r,c.messageId),P?(console.log("Interval check 2",P,r,c.messageId),console.log(o,t),clearInterval(t),clearTimeout(o),e(void 0)):console.warn("Watring for init 1:",r)}),200),o=setTimeout((()=>{console.warn("Tried waiting for init but couldn't complete in time: ",r,c.messageId),clearInterval(t),e(void 0)}),9e4)})),console.log("After timeout promise",r,c.messageId,P),P||(console.log("wait failed",P,c.messageId,r),$=yield Promise.all($.filter((e=>e!=c.messageId))),e.source.postMessage(i)),console.log("After timeout promise nice",r,P)),j.has(s)||j.set(s,{concepts:[],connections:[]});let l=j.get(s);if(Array.isArray(null===(t=null==c?void 0:c.actions)||void 0===t?void 0:t.concepts)&&Array.isArray(null===(o=null==c?void 0:c.actions)||void 0===o?void 0:o.connections)||(c.actions={concepts:[],connections:[]},a=!0),"LocalSyncData__SyncDataOnline"==r&&!c.transactionId&&l){const e=n.LocalSyncData.SyncDataOnline(void 0,JSON.parse(JSON.stringify(l)));j.delete(s),l=void 0,console.log("Syncing the tab here",r),i={success:!0,data:yield e,actions:{concepts:[],connections:[]}}}else J[r]?i=yield J[r](c):console.warn(`Unable to handle "${r}" case in service worker`);if(i.messageId=c.messageId,H&&console.warn("Race condition has been met",r),H=!0,l=j.get(s),i.actions&&l){let e={concepts:[...l.concepts,...i.actions.concepts],connections:[...l.connections,...i.actions.connections]};const[t,o]=yield Promise.all([Promise.all(Array.from(new Map(e.concepts.map((e=>[`${e.id}-${e.ghostId}`,e]))).values())),Promise.all(Array.from(new Map(e.connections.map((e=>[`${e.id}-${e.ghostId}`,e]))).values()))]);j.set(s,JSON.parse(JSON.stringify({concepts:t,connections:o})))}H=!1,a&&delete i.actions,"checkProcess"!=r&&console.log("sent",r,null==c?void 0:c.messageId),$=yield Promise.all($.filter((e=>e!=c.messageId))),e.source.postMessage(i)}catch(t){console.error("Service worker Message Handle Error: ",r,t),401!=(null==t?void 0:t.status)&&500!=(null==t?void 0:t.status)||(i={success:!1,data:{status:t.status,statusText:null==t?void 0:t.url},messageId:c.messageId}),$=yield Promise.all($.filter((e=>e!=c.messageId))),e.source.postMessage(i)}}))}(e)}));const Q=e=>q(void 0,void 0,void 0,(function*(){try{const t=yield fetch(e.request);if(401===t.status){const o=Math.random().toString(36).substring(2);return e.waitUntil(e.source.postMessage({type:"API_401",messageId:o,message:"Unauthorized",payload:{method:e.request.method,url:e.request.url,headers:Array.from(e.request.headers.entries()),body:yield e.request.clone().json()}})),yield new Promise((e=>{console.log("Re resolving 401",t.url),setTimeout((()=>e(t)),6e4),navigator.serviceWorker.addEventListener("message",(n=>{var i,r,c;n.data&&(null===(i=n.data)||void 0===i?void 0:i.messageId)==o&&"API_RESPONSE"===(null===(r=n.data)||void 0===r?void 0:r.type)&&((null===(c=null==n?void 0:n.data)||void 0===c?void 0:c.response)?e(n.data.response):(console.log("Unable to resolve re 401",t.url),e(t)))}))}))}return t}catch(e){throw console.error("Error occured during 401 intercepting",e),e}}));
|