@sava-info-systems/api-maker-with-extensions 1.8.2 → 1.9.0

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.
Files changed (40) hide show
  1. package/.env +2 -0
  2. package/dist/1097.js +1 -1
  3. package/dist/1558.js +1 -1
  4. package/dist/1678.js +1 -1
  5. package/dist/2473.js +1 -1
  6. package/dist/4186.js +1 -1
  7. package/dist/4211.js +1 -1
  8. package/dist/5249.js +1 -1
  9. package/dist/5334.js +1 -1
  10. package/dist/5765.js +1 -1
  11. package/dist/8125.js +1 -1
  12. package/dist/9575.js +1 -0
  13. package/dist/9939.js +1 -1
  14. package/dist/assets/images/icons/swagger-logo.svg +9 -0
  15. package/dist/assets/schema-types/InterfaceProps.ts +2 -0
  16. package/dist/assets/schema-types/store-types.ts +2 -1
  17. package/dist/assets/schema-types/types.ts +269 -9
  18. package/dist/assets/swagger/favicon-16x16.png +0 -0
  19. package/dist/assets/swagger/favicon-32x32.png +0 -0
  20. package/dist/assets/swagger/index.css +16 -0
  21. package/dist/assets/swagger/index.html +19 -0
  22. package/dist/assets/swagger/oauth2-redirect.html +79 -0
  23. package/dist/assets/swagger/swagger-initializer.js +20 -0
  24. package/dist/assets/swagger/swagger-ui-bundle.js +2 -0
  25. package/dist/assets/swagger/swagger-ui-es-bundle-core.js +3 -0
  26. package/dist/assets/swagger/swagger-ui-es-bundle.js +2 -0
  27. package/dist/assets/swagger/swagger-ui-standalone-preset.js +2 -0
  28. package/dist/assets/swagger/swagger-ui.css +3 -0
  29. package/dist/assets/swagger/swagger-ui.js +2 -0
  30. package/dist/common.js +1 -1
  31. package/dist/main.js +1 -1
  32. package/local.env +3 -2
  33. package/main.js +1 -1
  34. package/package.json +6 -4
  35. package/sandbox/assets/schema-types/types.js +90 -0
  36. package/sandbox/sandbox.js +1 -1
  37. package/src/assets/schema-types/store-types.ts +2 -1
  38. package/src/assets/schema-types/types.ts +269 -9
  39. package/src/public/dist-db-masters/browser/main.js +47 -47
  40. package/src/tools/install_utils/SetEnvInFrontend.js +3 -1
package/dist/4211.js CHANGED
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkapi_maker_fe=self.webpackChunkapi_maker_fe||[]).push([[4211],{241:(de,L,r)=>{r.d(L,{$:()=>O});var D=r(5861),e=r(328),x=r(95),Z=r(3157),o=r(4946),A=r(9961),Q=r(3429),R=r(7240),K=r(2915),F=r(6814),W=r(2660),n=r(7680);function B(y,M){1&y&&(o.TgZ(0,"span"),o._UZ(1,"i",19),o._uU(2," Add Collection"),o.qZA())}function t(y,M){1&y&&(o.TgZ(0,"span"),o._UZ(1,"i",20),o._uU(2," View Collection"),o.qZA())}function Y(y,M){1&y&&(o.TgZ(0,"span"),o._UZ(1,"i",21),o._uU(2," Edit Collection"),o.qZA())}function V(y,M){1&y&&(o.TgZ(0,"span"),o._uU(1,"Save Collection"),o.qZA())}function G(y,M){1&y&&(o.TgZ(0,"span"),o._uU(1,"Update Collection"),o.qZA())}function k(y,M){if(1&y){const u=o.EpF();o.TgZ(0,"button",22),o.NdJ("click",function(){o.CHM(u);const m=o.oxw();return o.KtG(m.save())}),o._UZ(1,"i",23),o.YNc(2,V,2,0,"span",4),o.YNc(3,G,2,0,"span",4),o.qZA()}if(2&y){const u=o.oxw();o.Q6J("disabled",u.form.invalid),o.xp6(2),o.Q6J("ngIf",u.data.mode===u.EFormMode.ADD),o.xp6(1),o.Q6J("ngIf",u.data.mode===u.EFormMode.EDIT)}}function H(y,M){1&y&&o._UZ(0,"p-progressSpinner",24)}let O=(()=>{class y{fb;ns;instanceS;generalS;eventCenterS;data;loading={form:!1};EFormMode=e.D;form;subscriptions=[];constructor(u,S,m,b,T){this.fb=u,this.ns=S,this.instanceS=m,this.generalS=b,this.eventCenterS=T}ngOnInit(){var u=this;this.createForm(),this.subscriptions.push(this.data.eventChannel.subscribe(function(){var S=(0,D.Z)(function*(m){m&&(u.form.enable(),m.action===Z.F.OPEN_FORM_IN_EDIT_MODE?(u.form.reset(),u.form.patchValue(u.data.formData)):m.action===Z.F.OPEN_FORM_IN_VIEW_MODE?(u.form.reset(),u.form.patchValue(u.data.formData),u.form.disable()):m.action===Z.F.OPEN_FORM_IN_ADD_MODE&&u.form.reset())});return function(m){return S.apply(this,arguments)}}()))}createForm(){this.form=this.fb.group({name:[null,[x.kI.required]]})}showModal(){$("#idCollectionsForm").modal("show")}hideModal(){$("#idCollectionsForm").modal("hide")}save(){var u=this;return(0,D.Z)(function*(){const S=u.form.getRawValue();try{u.loading.form=!0;const m=u.eventCenterS.instance.selectedInstances.value[0],b=u.eventCenterS.database.selectedDatabases.value[0].db;let T;if(u.data.mode===e.D.ADD)T=yield u.instanceS.createCollection(m,b,S).toPromise();else if(u.data.mode===e.D.EDIT){const J={oldName:u.data.formData.name,newName:S.name};T=yield u.instanceS.renameCollection(m,b,J).toPromise()}u.ns.showSuccess(`Collection ${u.data.mode===e.D.ADD?"added":"renamed"} successfully.`),u.data.eventChannel.emit({action:u.data.mode===e.D.ADD?Z.F.SAVED:Z.F.UPDATED}),u.loading.form=!1}catch(m){console.log(m),u.loading.form=!1,u.ns.showErrorFromResponse(m.error||m,"Unable to save.")}})()}ngOnDestroy(){this.generalS.unsubscribe(this.subscriptions)}static \u0275fac=function(S){return new(S||y)(o.Y36(x.qu),o.Y36(A.W),o.Y36(Q.E),o.Y36(R.b),o.Y36(K.u))};static \u0275cmp=o.Xpm({type:y,selectors:[["app-w-collections-form"]],inputs:{data:"data"},decls:23,vars:6,consts:[["aria-hidden","true","aria-labelledby","exampleModalLabel","id","idCollectionsForm","role","dialog","data-backdrop","static","data-keyboard","false",1,"modal"],["role","document",1,"modal-dialog"],[1,"modal-content"],[1,"modal-header"],[4,"ngIf"],["aria-label","Close","data-dismiss","modal","type","button",1,"close"],["aria-hidden","true"],[1,"fas","fa-window-close"],[1,"modal-body","overflow-auto"],[1,"container","pt-3",3,"formGroup"],[1,"form-group","row"],[1,"col-4","col-form-label","col-form-label-sm","text-right"],[1,"col-6"],["formControlName","name","name","name","spellcheck","false","type","text","placeholder","Please provide name",1,"form-control","form-control-sm"],[1,"modal-footer"],["data-dismiss","modal","type","button",1,"btn","btn-sm","btn-secondary"],[1,"fas","fa-times","text-danger","fa-fw"],["class","btn btn-primary btn-sm","sava-no-dbl-click","","type","button",3,"disabled","click",4,"ngIf"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s",4,"ngIf"],[1,"fas","fa-plus","text-success","fa-fw","mr-1"],[1,"far","fa-eye","text-info","fa-fw","mr-1"],[1,"fas","fa-pencil-alt","text-light","fa-fw","mr-1"],["sava-no-dbl-click","","type","button",1,"btn","btn-primary","btn-sm",3,"disabled","click"],[1,"fas","fa-save","text-success","fa-fw","mr-1"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s"]],template:function(S,m){1&S&&(o.TgZ(0,"div",0)(1,"div",1)(2,"div",2)(3,"div",3),o.YNc(4,B,3,0,"span",4),o.YNc(5,t,3,0,"span",4),o.YNc(6,Y,3,0,"span",4),o.TgZ(7,"button",5)(8,"span",6),o._UZ(9,"i",7),o.qZA()()(),o.TgZ(10,"div",8)(11,"form",9)(12,"div",10)(13,"label",11),o._uU(14,"Name"),o.qZA(),o.TgZ(15,"div",12),o._UZ(16,"input",13),o.qZA()()()(),o.TgZ(17,"div",14)(18,"button",15),o._UZ(19,"i",16),o._uU(20," Close"),o.qZA(),o.YNc(21,k,4,3,"button",17),o.qZA(),o.YNc(22,H,1,0,"p-progressSpinner",18),o.qZA()()()),2&S&&(o.xp6(4),o.Q6J("ngIf",m.data.mode===m.EFormMode.ADD),o.xp6(1),o.Q6J("ngIf",m.data.mode===m.EFormMode.VIEW),o.xp6(1),o.Q6J("ngIf",m.data.mode===m.EFormMode.EDIT),o.xp6(5),o.Q6J("formGroup",m.form),o.xp6(10),o.Q6J("ngIf",m.data.mode!==m.EFormMode.VIEW),o.xp6(1),o.Q6J("ngIf",m.loading.form))},dependencies:[x._Y,x.Fj,x.JJ,x.JL,x.sg,x.u,F.O5,W.y,n.G],encapsulation:2})}return y})()},6937:(de,L,r)=>{r.d(L,{n:()=>f});var D=r(5861),e=r(4946),x=r(3157),Z=r(328),o=r(6212),A=r(6990),R=r(1426),K=r(7848),F=r(1162),W=r(3429),n=r(7240),B=r(9961),t=r(2189),Y=r(7414),V=r(2915),G=r(5219),k=r(95),H=r(6814),O=r(5431),y=r(7680),M=r(3259),u=r(8057),S=r(241);const m=["collectionsFormC"];function b(d,v){1&d&&(e.TgZ(0,"th",13),e._UZ(1,"p-tableHeaderCheckbox"),e.qZA())}function T(d,v){1&d&&e._UZ(0,"th",14)}function N(d,v){1&d&&e._UZ(0,"th",14)}function J(d,v){1&d&&e._UZ(0,"th",14)}function q(d,v){1&d&&e._UZ(0,"th",15)}function z(d,v){1&d&&e._UZ(0,"th",15)}function X(d,v){if(1&d&&(e.TgZ(0,"tr"),e.YNc(1,b,2,0,"th",9),e.TgZ(2,"th"),e._uU(3,"Name"),e.qZA(),e.TgZ(4,"th",10),e._uU(5,"Pre"),e.qZA(),e.TgZ(6,"th",10),e._uU(7,"Post"),e.qZA(),e.YNc(8,T,1,0,"th",11),e.YNc(9,N,1,0,"th",11),e.YNc(10,J,1,0,"th",11),e.YNc(11,q,1,0,"th",12),e.YNc(12,z,1,0,"th",12),e.qZA()),2&d){const l=e.oxw(3);e.xp6(1),e.Q6J("ngIf",l.showCheckbox),e.xp6(7),e.Q6J("ngIf",!l.isDependentOnGroup&&!l.isFilterLogTable),e.xp6(1),e.Q6J("ngIf",!l.isDependentOnGroup&&!l.isFilterLogTable),e.xp6(1),e.Q6J("ngIf",!l.isDependentOnGroup&&!l.isFilterLogTable&&l.isVisibleTableChange),e.xp6(1),e.Q6J("ngIf",l.isDependentOnGroup||l.isFilterLogTable),e.xp6(1),e.Q6J("ngIf",l.isDependentOnGroup||l.isFilterLogTable)}}function ae(d,v){if(1&d&&(e.TgZ(0,"td"),e._UZ(1,"p-tableCheckbox",20),e.qZA()),2&d){const l=e.oxw().$implicit;e.xp6(1),e.Q6J("value",l)("pSelectableRow",l)}}function se(d,v){if(1&d&&(e.TgZ(0,"td",21),e._uU(1),e.qZA()),2&d){const l=e.oxw().$implicit;e.xp6(1),e.Oqu(l.preHookCount||"")}}function oe(d,v){if(1&d&&(e.TgZ(0,"td",21),e._uU(1),e.qZA()),2&d){const l=e.oxw().$implicit;e.xp6(1),e.Oqu(l.postHookCount||"")}}function _e(d,v){if(1&d){const l=e.EpF();e.TgZ(0,"i",23),e.NdJ("click",function(){e.CHM(l);const I=e.oxw(5);return e.KtG(I.menuSchemaClicked())}),e.qZA()}}function ie(d,v){if(1&d&&(e.TgZ(0,"td"),e.YNc(1,_e,1,0,"i",22),e.qZA()),2&d){const l=e.oxw().$implicit;e.xp6(1),e.Q6J("ngIf",l.schemaIsGenerated)}}function pe(d,v){1&d&&e._UZ(0,"i",25)}function le(d,v){if(1&d&&(e.TgZ(0,"td"),e.YNc(1,pe,1,0,"i",24),e.qZA()),2&d){const l=e.oxw().$implicit;e.xp6(1),e.Q6J("ngIf",l.collectionSettingIsCreated)}}function me(d,v){if(1&d){const l=e.EpF();e.TgZ(0,"i",27),e.NdJ("click",function(){e.CHM(l);const I=e.oxw(5);return e.KtG(I.showComparison())}),e.qZA()}}function re(d,v){if(1&d&&(e.TgZ(0,"td"),e.YNc(1,me,1,0,"i",26),e.qZA()),2&d){const l=e.oxw().$implicit;e.xp6(1),e.Q6J("ngIf",l.isChangeHappenedInTable)}}function ce(d,v){if(1&d&&(e.TgZ(0,"td")(1,"span",28),e._uU(2),e.qZA()()),2&d){const l=e.oxw().$implicit;e.xp6(2),e.Oqu(l.instanceName.toString().substring(0,3).toUpperCase())}}function fe(d,v){if(1&d&&(e.TgZ(0,"td")(1,"span",28),e._uU(2),e.qZA()()),2&d){const l=e.oxw().$implicit;e.xp6(2),e.Oqu(l.databaseName.toString().substring(0,3).toUpperCase())}}function ge(d,v){if(1&d&&(e.TgZ(0,"tr",16),e.YNc(1,ae,2,2,"td",17),e.TgZ(2,"td",18),e._uU(3),e.qZA(),e.YNc(4,se,2,1,"td",19),e.YNc(5,oe,2,1,"td",19),e.YNc(6,ie,2,1,"td",17),e.YNc(7,le,2,1,"td",17),e.YNc(8,re,2,1,"td",17),e.YNc(9,ce,3,1,"td",17),e.YNc(10,fe,3,1,"td",17),e.qZA()),2&d){const l=v.$implicit,C=e.oxw(3);e.Q6J("pSelectableRow",l),e.xp6(1),e.Q6J("ngIf",C.showCheckbox),e.xp6(2),e.Oqu(l.name),e.xp6(1),e.Q6J("ngIf",C.showHooksCount),e.xp6(1),e.Q6J("ngIf",C.showHooksCount),e.xp6(1),e.Q6J("ngIf",!C.isDependentOnGroup&&!C.isFilterLogTable),e.xp6(1),e.Q6J("ngIf",!C.isDependentOnGroup&&!C.isFilterLogTable),e.xp6(1),e.Q6J("ngIf",!C.isDependentOnGroup&&!C.isFilterLogTable&&C.isVisibleTableChange),e.xp6(1),e.Q6J("ngIf",C.isDependentOnGroup||C.isFilterLogTable),e.xp6(1),e.Q6J("ngIf",C.isDependentOnGroup||C.isFilterLogTable)}}function ue(d,v){1&d&&e._UZ(0,"p-progressSpinner",29)}function he(d,v){if(1&d){const l=e.EpF();e.TgZ(0,"div",4)(1,"p-table",5),e.NdJ("selectionChange",function(I){e.CHM(l);const U=e.oxw(2);return e.KtG(U.selectedRows=I)})("selectionChange",function(){e.CHM(l);const I=e.oxw(2);return e.KtG(I.collectionSelected())})("dblclick",function(){e.CHM(l);const I=e.oxw(2);return e.KtG(I.dblClickCollections())}),e.YNc(2,X,13,6,"ng-template",6),e.YNc(3,ge,11,10,"ng-template",7),e.qZA(),e.YNc(4,ue,1,0,"p-progressSpinner",8),e.qZA()}if(2&d){const l=e.oxw(2);e.xp6(1),e.Q6J("selectionMode","multiple")("metaKeySelection",l.metaKeySelection)("selection",l.selectedRows)("dataKey",l.gridKey)("scrollable",!0)("value",l.rows),e.xp6(3),e.Q6J("ngIf",l.loading.grid)}}function Ce(d,v){if(1&d&&e.YNc(0,he,5,7,"div",3),2&d){const l=e.oxw();e.Q6J("ngIf",!(l.eventCenterS.group.apisRegex.allInstances||l.eventCenterS.filterInLog.apisRegex.allInstances||l.eventCenterS.group.apisRegex.allDatabases||l.eventCenterS.group.apisRegex.allCollections))}}function ve(d,v){if(1&d){const l=e.EpF();e.TgZ(0,"span",42),e.NdJ("click",function(){e.CHM(l);const I=e.oxw(3);return e.KtG(I.menuSchemaClicked())}),e._UZ(1,"img",43),e.qZA()}}function Se(d,v){if(1&d){const l=e.EpF();e.TgZ(0,"span",44),e.NdJ("click",function(){e.CHM(l);const I=e.oxw(3);return e.KtG(I.add())}),e._UZ(1,"i",45),e.qZA()}}function De(d,v){if(1&d){const l=e.EpF();e.TgZ(0,"span",46),e.NdJ("click",function(){e.CHM(l);const I=e.oxw(3);return e.KtG(I.edit())}),e._UZ(1,"i",47),e.qZA()}}function be(d,v){if(1&d){const l=e.EpF();e.TgZ(0,"span",48),e.NdJ("click",function(){e.CHM(l);const I=e.oxw(3);return e.KtG(I.removePermanentDialog())}),e._UZ(1,"i",49),e.qZA()}}function Ie(d,v){if(1&d&&(e.TgZ(0,"span")(1,"a",36),e._UZ(2,"img",37),e.qZA(),e.YNc(3,ve,2,0,"span",38),e.YNc(4,Se,2,0,"span",39),e.YNc(5,De,2,0,"span",40),e.YNc(6,be,2,0,"span",41),e.qZA()),2&d){const l=e.oxw(2);e.xp6(3),e.Q6J("ngIf",l.selectedRows.length),e.xp6(1),e.Q6J("ngIf",l.eventCenterS.instance.selectedInstances.value.length&&l.eventCenterS.database.selectedDatabases.value.length&&l.addCollectionFromApiMaker),e.xp6(1),e.Q6J("ngIf",l.selectedRows.length&&l.instanceType===l.EInstanceType.MONGO_DB),e.xp6(1),e.Q6J("ngIf",l.selectedRows.length&&l.instanceType===l.EInstanceType.MONGO_DB)}}function h(d,v){if(1&d){const l=e.EpF();e.TgZ(0,"span",50)(1,"label",51)(2,"p-checkbox",52),e.NdJ("ngModelChange",function(I){e.CHM(l);const U=e.oxw(2);return e.KtG(U.eventCenterS.group.apisRegex.allCollections=I)}),e.qZA()()()}if(2&d){const l=e.oxw(2);e.xp6(2),e.Q6J("ngModel",l.eventCenterS.group.apisRegex.allCollections)("binary",!0)}}function w(d,v){if(1&d&&(e.TgZ(0,"div")(1,"div",53),e._uU(2),e.qZA()()),2&d){const l=e.oxw(2);e.xp6(2),e.Oqu(l.constantsS.group.allCollectionsPermitted)}}function s(d,v){1&d&&e.GkF(0)}function g(d,v){if(1&d&&(e.TgZ(0,"div",30)(1,"div",31)(2,"span"),e._UZ(3,"i",32),e._uU(4," Collections"),e.qZA(),e.YNc(5,Ie,7,4,"span",17),e.YNc(6,h,3,2,"span",33),e.qZA(),e.TgZ(7,"div",34),e.YNc(8,w,3,1,"div",17),e.YNc(9,s,1,0,"ng-container",35),e.qZA()()),2&d){const l=e.oxw(),C=e.MAs(1);e.xp6(5),e.Q6J("ngIf",!l.isReadOnly),e.xp6(1),e.Q6J("ngIf",l.isDependentOnGroup),e.xp6(2),e.Q6J("ngIf",l.eventCenterS.group.apisRegex.allInstances||l.eventCenterS.filterInLog.apisRegex.allInstances||l.eventCenterS.group.apisRegex.allDatabases||l.eventCenterS.group.apisRegex.allCollections),e.xp6(1),e.Q6J("ngTemplateOutlet",C)}}function a(d,v){if(1&d&&e._UZ(0,"app-w-collections-form",54,55),2&d){const l=e.oxw();e.Q6J("data",l.data)}}let f=(()=>{class d{instanceS;generalS;notificationS;navigationCS;constantsS;cd;eventCenterS;confirmationService;isReadOnly=!1;showCheckbox=!0;showHooksCount=!1;isDependentOnGroup=!1;IsBulkSchemaGenerator=!1;isFilterLogTable=!1;metaKeySelection=!0;loading={grid:!1};subscriptions=[];data={mode:Z.D.ADD,eventChannel:new e.vpe,formData:void 0};rows=[];rowsMap={};instanceType;EInstanceType=K.d;selectedRows=[];gridKey=F.iH._id;addCollectionFromApiMaker=!1;isVisibleTableChange=!1;collectionsFormC;constructor(l,C,I,U,j,ee,te,ne){this.instanceS=l,this.generalS=C,this.notificationS=I,this.navigationCS=U,this.constantsS=j,this.cd=ee,this.eventCenterS=te,this.confirmationService=ne}ngOnInit(){var l=this;this.subscriptions.push(this.data.eventChannel.subscribe(function(){var C=(0,D.Z)(function*(I){(I.action===x.F.SAVED||I.action===x.F.UPDATED)&&(l.collectionsFormC.hideModal(),yield l.loadGridData())});return function(I){return C.apply(this,arguments)}}())),this.eventCenterS.collection.selectedCollections.next([]),this.subscriptions.push(this.eventCenterS.database.selectedDatabases.pipe((0,R.b)(300)).subscribe(function(){var C=(0,D.Z)(function*(I){yield l.loadGridData()});return function(I){return C.apply(this,arguments)}}())),this.subscriptions.push(this.eventCenterS.instance.selectedInstances.pipe((0,R.b)(300)).subscribe(function(){var C=(0,D.Z)(function*(I){const U=I[0];l.instanceType=U?U.type:void 0,l.addCollectionFromApiMaker=!1,"MONGO_DB"===l.instanceType&&(l.addCollectionFromApiMaker=!0)});return function(I){return C.apply(this,arguments)}}()))}resetGridAndUrl(){var l=this;return(0,D.Z)(function*(){l.rows=[],l.selectedRows=[],l.rowsMap={},l.eventCenterS.collection.selectedCollections.next([])})()}loadGridData(){var l=this;return(0,D.Z)(function*(){const C=l.eventCenterS.database.selectedDatabases.value;C&&0!==C.length&&C[0]?(l.loading.grid=!0,l.isVisibleTableChange=!1,l.resetGridAndUrl(),l.subscriptions.push(l.instanceS.getCollections(C).subscribe(function(){var I=(0,D.Z)(function*(U){if(U.success){l.selectedRows=[],l.rows=A.flatten(U.data||[]),l.rowsMap=A.keyBy(l.rows,F.iH._id),l.showHooksCount&&(yield l.instanceS.setHooksCountInCollectionArr(C[0].instanceName,C[0].db,l.rows));for(const ee of l.rows)if(ee.isChangeHappenedInTable){l.isVisibleTableChange=!0;break}}else l.resetGridAndUrl();const j=l.navigationCS.getQueryParam(o.p.collection)||(l.isFilterLogTable?l.eventCenterS.filterInLog.collectionIds.value.join(","):l.eventCenterS.group.collectionNames.value.join(","));if(j){const ee=j.split(","),te=A.intersection(A.keys(l.rowsMap),ee),ne=[];for(const xe of te)l.rowsMap[xe]&&ne.push(l.rowsMap[xe]);l.selectedRows=ne,l.eventCenterS.collection.selectedCollections.next(ne),l.isDependentOnGroup&&l.eventCenterS.group.collectionNames.next(te),l.isFilterLogTable&&(l.eventCenterS.filterInLog.collectionIds.next(te),l.eventCenterS.filterInLog.collectionNames.next(A.map(l.selectedRows,"name")))}l.loading.grid=!1,l.cd.detectChanges()});return function(U){return I.apply(this,arguments)}}()))):l.resetGridAndUrl()})()}add(){this.data.formData=void 0,this.data.mode=Z.D.ADD,this.data.eventChannel.emit({action:x.F.OPEN_FORM_IN_ADD_MODE}),this.collectionsFormC.showModal()}view(){this.data.formData=this.selectedRows[0],this.data.mode=Z.D.VIEW,this.data.eventChannel.emit({action:x.F.OPEN_FORM_IN_VIEW_MODE}),this.collectionsFormC.showModal()}edit(){this.data.formData=this.selectedRows[0],this.data.mode=Z.D.EDIT,this.data.eventChannel.emit({action:x.F.OPEN_FORM_IN_EDIT_MODE}),this.collectionsFormC.showModal()}removePermanentDialog(){var l=this;return(0,D.Z)(function*(){var C;l.confirmationService.confirm({message:l.constantsS.collection.removePermanentConfirm,header:"Confirmation",icon:"pi pi-exclamation-triangle",accept:(C=(0,D.Z)(function*(){yield l.removePermanent()}),function(){return C.apply(this,arguments)})})})()}removePermanent(){var l=this;return(0,D.Z)(function*(){const C=l.eventCenterS.instance.selectedInstances.value[0],I=l.eventCenterS.database.selectedDatabases.value[0].db,U=l.selectedRows[0].name;l.loading.grid=!0;try{const j=yield l.instanceS.dropCollection(C,I,U).toPromise();l.loading.grid=!1,j.success?(l.notificationS.showSuccess(l.constantsS.collection.removePermanent),l.selectedRows.length=0,l.loadGridData()):l.notificationS.showErrorFromResponse(j,l.constantsS.collection.removePermanentError)}catch(j){l.notificationS.showErrorMessageFromErrorObject(j),l.loading.grid=!1}})()}collectionSelected(){var l=this;return(0,D.Z)(function*(){l.eventCenterS.collection.selectedCollections.next(l.selectedRows),l.IsBulkSchemaGenerator||(l.isDependentOnGroup||l.isFilterLogTable?(l.isDependentOnGroup&&l.eventCenterS.group.collectionNames.next(A.map(l.selectedRows,"_id")),l.isFilterLogTable&&(l.eventCenterS.filterInLog.collectionIds.next(A.map(l.selectedRows,"_id")),l.eventCenterS.filterInLog.collectionNames.next(A.map(l.selectedRows,"name")))):(yield l.navigationCS.setQueryParam(o.p.collection,A.map(l.selectedRows,"_id").join(",")||null),yield l.navigationCS.setQueryParam(o.p.collection_api,null)))})()}menuSchemaClicked(){setTimeout(()=>{this.eventCenterS.apiCell.eventChannelSchema.emit({action:x.F.OPEN_FORM_IN_DECIDE_MODE})},100)}showComparison(){setTimeout(()=>{this.eventCenterS.apiCell.eventChannelSchema.emit({action:x.F.OPEN_FORM_IN_DECIDE_MODE,isOpen:"compareMode"})},100)}ngOnDestroy(){this.generalS.unsubscribe(this.subscriptions)}dblClickCollections(){this.selectedRows.length&&this.eventCenterS.apiCell.eventChannelSchema.emit({action:x.F.OPEN_FORM_IN_DECIDE_MODE})}static \u0275fac=function(C){return new(C||d)(e.Y36(W.E),e.Y36(n.b),e.Y36(B.W),e.Y36(t.S),e.Y36(Y.L),e.Y36(e.sBO),e.Y36(V.u),e.Y36(G.YP))};static \u0275cmp=e.Xpm({type:d,selectors:[["app-w-collections"]],viewQuery:function(C,I){if(1&C&&e.Gf(m,5),2&C){let U;e.iGM(U=e.CRH())&&(I.collectionsFormC=U.first)}},inputs:{isReadOnly:["IsReadOnly","isReadOnly"],showCheckbox:"showCheckbox",showHooksCount:"showHooksCount",isDependentOnGroup:["IsDependentOnGroup","isDependentOnGroup"],IsBulkSchemaGenerator:"IsBulkSchemaGenerator",isFilterLogTable:["IsFilterLogTable","isFilterLogTable"],metaKeySelection:"metaKeySelection"},decls:4,vars:2,consts:[["modalGrid",""],["class","card shadow-sm h-100",4,"ngIf"],[3,"data",4,"ngIf"],["class","h-100",4,"ngIf"],[1,"h-100"],["styleClass","p-datatable-striped collection-grid-height","scrollHeight","flex",3,"selectionMode","metaKeySelection","selection","dataKey","scrollable","value","selectionChange","dblclick"],["pTemplate","header"],["pTemplate","body"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s",4,"ngIf"],["style","width: 45px;",4,"ngIf"],[2,"width","40px"],["style","width: 42px;",4,"ngIf"],["style","width: 50px;",4,"ngIf"],[2,"width","45px"],[2,"width","42px"],[2,"width","50px"],[3,"pSelectableRow"],[4,"ngIf"],[1,"word-break-all"],["class","text-center",4,"ngIf"],[3,"value","pSelectableRow"],[1,"text-center"],["pTooltip","Schema is generated.","class","fas fa-receipt text-warning fa-fw cursor-pointer",3,"click",4,"ngIf"],["pTooltip","Schema is generated.",1,"fas","fa-receipt","text-warning","fa-fw","cursor-pointer",3,"click"],["pTooltip","Collection settings are there.","class","fas fa-cog text-danger fa-fw cursor-pointer",4,"ngIf"],["pTooltip","Collection settings are there.",1,"fas","fa-cog","text-danger","fa-fw","cursor-pointer"],["class","fas fa-retweet fa-fw align-middle text-warning cursor-pointer",3,"click",4,"ngIf"],[1,"fas","fa-retweet","fa-fw","align-middle","text-warning","cursor-pointer",3,"click"],[1,"text-monospace","small"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s"],[1,"card","shadow-sm","h-100"],[1,"card-header"],[1,"fas","fa-border-all","text-success","fa-fw","mr-1"],["class","float-right cursor-pointer","tooltipPosition","left","pTooltip","All Collections",4,"ngIf"],[1,"card-body","p-0","h-100","overflow-hidden"],[4,"ngTemplateOutlet"],["href","https://docs.apimaker.dev/v1/docs/pages/instance-database-collection-apis-page.html#collections","target","_blank"],["src","/assets/images/logo/logo_docs.svg",1,"float-right","fa-fw","ml-3",2,"font-size","25px"],["class","float-right cursor-pointer ml-3","pTooltip","Add/Edit Schema",3,"click",4,"ngIf"],["class","float-right cursor-pointer ml-3","pTooltip","Add New",3,"click",4,"ngIf"],["class","float-right cursor-pointer ml-3","pTooltip","Edit",3,"click",4,"ngIf"],["class","float-right cursor-pointer ml-3","pTooltip","Permanently Delete",3,"click",4,"ngIf"],["pTooltip","Add/Edit Schema",1,"float-right","cursor-pointer","ml-3",3,"click"],["src","/assets/images/icons/bulkschema.svg",2,"width","18px","margin-left","1px","margin-bottom","3px"],["pTooltip","Add New",1,"float-right","cursor-pointer","ml-3",3,"click"],[1,"fas","fa-plus","text-success","fa-fw"],["pTooltip","Edit",1,"float-right","cursor-pointer","ml-3",3,"click"],[1,"fas","fa-pencil-alt","text-light","fa-fw"],["pTooltip","Permanently Delete",1,"float-right","cursor-pointer","ml-3",3,"click"],[1,"far","fa-trash-alt","fa-fw","text-danger"],["tooltipPosition","left","pTooltip","All Collections",1,"float-right","cursor-pointer"],[1,"mb-0","mt--2px"],[3,"ngModel","binary","ngModelChange"],[1,"p-2","text-center","text-success"],[3,"data"],["collectionsFormC",""]],template:function(C,I){1&C&&(e.YNc(0,Ce,1,1,"ng-template",null,0,e.W1O),e.YNc(2,g,10,4,"div",1),e.YNc(3,a,2,1,"app-w-collections-form",2)),2&C&&(e.xp6(2),e.Q6J("ngIf",!I.IsBulkSchemaGenerator),e.xp6(1),e.Q6J("ngIf",!I.IsBulkSchemaGenerator))},dependencies:[k.JJ,k.On,H.O5,H.tP,O.iA,G.jx,O.Ei,O.UA,O.Mo,y.G,M.u,u.XZ,S.$]})}return d})()},740:(de,L,r)=>{r.d(L,{c:()=>w});var D=r(5861),e=r(3157),x=r(328),Z=r(6990),o=function(s){return s.double="double",s.string="string",s.object="object",s.array="array",s.binData="binData",s.undefined="undefined",s.objectId="objectId",s.bool="bool",s.date="date",s.null="null",s.regex="regex",s.dbPointer="dbPointer",s.javascript="javascript",s.symbol="symbol",s.javascriptWithScope="javascriptWithScope",s.int="int",s.timestamp="timestamp",s.long="long",s.decimal="decimal",s.minKey="minKey",s.maxKey="maxKey",s}(o||{}),A=r(9361),Q=r(1162),R=r(553),K=r(1601),F=r(3531),W=r(9989),n=r(4946),B=r(95),t=r(9961),Y=r(9530),V=r(3429),G=r(7240),k=r(5852),H=r(2915),O=r(6162),y=r(2304),M=r(7414),u=r(5219),S=r(6814),m=r(2660),b=r(5860),T=r(756),N=r(7680),J=r(4844),q=r(3259),z=r(5025);const X=["editorSchemaNative"],ae=["monacoEditorModalC"],se=["insertCodeModalC"];function oe(s,g){if(1&s&&(n.TgZ(0,"span",36),n._uU(1),n.qZA()),2&s){const a=n.oxw(2);n.xp6(1),n.Oqu(null==a.eventCenterS.instance||null==a.eventCenterS.instance.selectedInstances||null==a.eventCenterS.instance.selectedInstances.value[0]?null:a.eventCenterS.instance.selectedInstances.value[0].name)}}function _e(s,g){if(1&s&&(n.TgZ(0,"span",37),n._uU(1),n.qZA()),2&s){const a=n.oxw(2);n.xp6(1),n.Oqu(null==a.eventCenterS.database||null==a.eventCenterS.database.selectedDatabases||null==a.eventCenterS.database.selectedDatabases.value[0]?null:a.eventCenterS.database.selectedDatabases.value[0].db)}}function ie(s,g){if(1&s&&(n.TgZ(0,"span",38),n._uU(1),n.qZA()),2&s){const a=n.oxw(2);n.xp6(1),n.Oqu(null==a.eventCenterS.collection||null==a.eventCenterS.collection.selectedCollections||null==a.eventCenterS.collection.selectedCollections.value[0]?null:a.eventCenterS.collection.selectedCollections.value[0].name)}}function pe(s,g){if(1&s&&(n.TgZ(0,"span"),n._UZ(1,"i",31),n.TgZ(2,"span"),n._uU(3," Add Schema "),n.qZA(),n.YNc(4,oe,2,1,"span",32),n.TgZ(5,"span",33),n._uU(6," \u25b8 "),n.qZA(),n.YNc(7,_e,2,1,"span",34),n.TgZ(8,"span",33),n._uU(9," \u25b8 "),n.qZA(),n.YNc(10,ie,2,1,"span",35),n.qZA()),2&s){const a=n.oxw();n.xp6(4),n.Q6J("ngIf",null==a.eventCenterS||null==a.eventCenterS.instance||null==a.eventCenterS.instance.selectedInstances?null:a.eventCenterS.instance.selectedInstances.value),n.xp6(3),n.Q6J("ngIf",null==a.eventCenterS||null==a.eventCenterS.database||null==a.eventCenterS.database.selectedDatabases?null:a.eventCenterS.database.selectedDatabases.value),n.xp6(3),n.Q6J("ngIf",null==a.eventCenterS||null==a.eventCenterS.collection||null==a.eventCenterS.collection.selectedCollections?null:a.eventCenterS.collection.selectedCollections.value)}}function le(s,g){1&s&&(n.TgZ(0,"span"),n._UZ(1,"i",39),n._uU(2," View Schema"),n.qZA())}function me(s,g){if(1&s&&(n.TgZ(0,"span",36),n._uU(1),n.qZA()),2&s){const a=n.oxw(2);n.xp6(1),n.Oqu(null==a.eventCenterS.instance||null==a.eventCenterS.instance.selectedInstances||null==a.eventCenterS.instance.selectedInstances.value[0]?null:a.eventCenterS.instance.selectedInstances.value[0].name)}}function re(s,g){if(1&s&&(n.TgZ(0,"span",37),n._uU(1),n.qZA()),2&s){const a=n.oxw(2);n.xp6(1),n.Oqu(null==a.eventCenterS.database||null==a.eventCenterS.database.selectedDatabases||null==a.eventCenterS.database.selectedDatabases.value[0]?null:a.eventCenterS.database.selectedDatabases.value[0].db)}}function ce(s,g){if(1&s&&(n.TgZ(0,"span",38),n._uU(1),n.qZA()),2&s){const a=n.oxw(2);n.xp6(1),n.Oqu(null==a.eventCenterS.collection||null==a.eventCenterS.collection.selectedCollections||null==a.eventCenterS.collection.selectedCollections.value[0]?null:a.eventCenterS.collection.selectedCollections.value[0].name)}}function fe(s,g){if(1&s&&(n.TgZ(0,"span"),n._UZ(1,"i",40),n.TgZ(2,"span"),n._uU(3," Edit Schema "),n.qZA(),n.YNc(4,me,2,1,"span",32),n.TgZ(5,"span",33),n._uU(6," \u25b8 "),n.qZA(),n.YNc(7,re,2,1,"span",34),n.TgZ(8,"span",33),n._uU(9," \u25b8 "),n.qZA(),n.YNc(10,ce,2,1,"span",35),n.qZA()),2&s){const a=n.oxw();n.xp6(4),n.Q6J("ngIf",null==a.eventCenterS||null==a.eventCenterS.instance||null==a.eventCenterS.instance.selectedInstances?null:a.eventCenterS.instance.selectedInstances.value),n.xp6(3),n.Q6J("ngIf",null==a.eventCenterS||null==a.eventCenterS.database||null==a.eventCenterS.database.selectedDatabases?null:a.eventCenterS.database.selectedDatabases.value),n.xp6(3),n.Q6J("ngIf",null==a.eventCenterS||null==a.eventCenterS.collection||null==a.eventCenterS.collection.selectedCollections?null:a.eventCenterS.collection.selectedCollections.value)}}function ge(s,g){1&s&&n._UZ(0,"p-progressSpinner",43)}function ue(s,g){if(1&s){const a=n.EpF();n.TgZ(0,"div",15)(1,"app-monaco-editor",41,42),n.NdJ("editorGenerated",function(d){n.CHM(a);const v=n.oxw();return n.KtG(v.editorGenerated(d))}),n.qZA(),n.YNc(3,ge,1,0,"p-progressSpinner",17),n.qZA()}if(2&s){const a=n.oxw();n.xp6(1),n.Q6J("isSchemaEditor",!0)("editorOptions",a.editorOptionsSchema),n.xp6(2),n.Q6J("ngIf",a.loading.form)}}function he(s,g){1&s&&n._UZ(0,"p-progressSpinner",43)}function Ce(s,g){if(1&s){const a=n.EpF();n.TgZ(0,"i",44),n.NdJ("click",function(){n.CHM(a);const d=n.oxw();return n.KtG(d.removePermanentDialog())}),n.qZA()}}function ve(s,g){if(1&s){const a=n.EpF();n.TgZ(0,"i",45),n.NdJ("click",function(){n.CHM(a);const d=n.oxw();return n.KtG(d.syncSchema())}),n.qZA()}}function Se(s,g){if(1&s){const a=n.EpF();n.TgZ(0,"i",46),n.NdJ("click",function(){n.CHM(a);const d=n.oxw();return n.KtG(d.resetSchemaSyncEditor())}),n.qZA()}}function De(s,g){1&s&&(n.TgZ(0,"span"),n._uU(1,"Save Schema"),n.qZA())}function be(s,g){1&s&&(n.TgZ(0,"span"),n._uU(1,"Update Schema"),n.qZA())}function Ie(s,g){if(1&s){const a=n.EpF();n.TgZ(0,"button",47),n.NdJ("click",function(){n.CHM(a);const d=n.oxw();return n.KtG(d.save())}),n._UZ(1,"i",48),n.YNc(2,De,2,0,"span",4),n.YNc(3,be,2,0,"span",4),n.qZA()}if(2&s){const a=n.oxw();n.Q6J("disabled",a.isDiffEditorEnable),n.xp6(2),n.Q6J("ngIf",a.mode===a.EFormMode.ADD),n.xp6(1),n.Q6J("ngIf",a.mode===a.EFormMode.EDIT)}}function h(s,g){if(1&s){const a=n.EpF();n.TgZ(0,"a",49),n.NdJ("click",function(){n.CHM(a);const d=n.oxw();return n.KtG(d.viewError())}),n._uU(1),n.qZA()}if(2&s){const a=n.oxw();n.xp6(1),n.hij("View ",a.modalTitle," ")}}let w=(()=>{class s{fb;ns;schemaS;instanceS;generalS;authCS;eventCenterS;validationS;monacoS;constantsS;cd;notificationS;confirmationService;generalCS;mode=x.D.ADD;loading={form:!1};EFormMode=x.D;subscriptions=[];analysisData={fields:[]};analysisDataDiff={fields:[]};schemaData={properties:{}};bsonTypes=[];editorOptionsAnalysis={readOnly:!0,language:"json",contextmenu:!1};editorOptionsSchema={readOnly:!1,language:"typescript",contextmenu:!0};lastError;editorOptionsMonacoEditorModal={readOnly:!0,language:"json",contextmenu:!0};editorSchemaNative;viewDockerfileModelC;shouldLoadMonacoEditor=!1;monacoDecorations=[];tab;isFirstTimeEditorSchemaGenerated=!0;editorSchema;editorAnalysis;isDiffEditorEnable=!1;BE_HOST_PORT=R.N.BE_HOST_PORT;codeVersions;modalTitle;constructor(a,f,d,v,l,C,I,U,j,ee,te,ne,xe,Ze){this.fb=a,this.ns=f,this.schemaS=d,this.instanceS=v,this.generalS=l,this.authCS=C,this.eventCenterS=I,this.validationS=U,this.monacoS=j,this.constantsS=ee,this.cd=te,this.notificationS=ne,this.confirmationService=xe,this.generalCS=Ze}ngOnInit(){var a=this;this.subscriptions.push(this.eventCenterS.apiCell.eventChannelSchema.subscribe(function(){var f=(0,D.Z)(function*(d){if(d)if(d.action===e.F.OPEN_FORM_IN_DECIDE_MODE){a.loading.form=!0;const v=yield a.schemaS.getCurrentSchema();a.eventCenterS.apiCell.eventChannelSchema.emit(v?{action:e.F.OPEN_FORM_IN_EDIT_MODE,data:v}:{action:e.F.OPEN_FORM_IN_ADD_MODE}),setTimeout((0,D.Z)(function*(){"compareMode"===d.isOpen&&(yield a.syncSchema())}),500),a.loading.form=!1}else d.action===e.F.OPEN_FORM_IN_EDIT_MODE?(a.mode=x.D.EDIT,a.schemaData=d.data,a.showModal(),a.patchForm(a.schemaData)):d.action===e.F.OPEN_FORM_IN_VIEW_MODE?(a.mode=x.D.VIEW,a.showModal()):d.action===e.F.OPEN_FORM_IN_ADD_MODE&&(a.mode=x.D.ADD,a.loading.form=!0,a.resetForm(),a.showModal(),a.analysisData=yield a.loadAnalysisData(),setTimeout(()=>{a.generalCS.setValueInEditor(a,"editorSchema",a.analysisData.fieldsString),a.generalCS.setValueInEditor(a,"editorAnalysis",a.generalS.stringify(a.analysisData.fields))},500),a.loading.form=!1)});return function(d){return f.apply(this,arguments)}}()));for(const f of Z.keys(o))this.bsonTypes.push(f)}DOCS_HOST_PORT=R.N.DOCS_HOST_PORT;insertCodeModalC;showInsertCodeModel(){this.generalCS.messageReceivedFor=A.H.Schema,this.insertCodeModalC.showModal(F.b.CreateSchemaFormC)}editorGenerated(a){var f=this;return(0,D.Z)(function*(){f.editorSchema=a,f.isFirstTimeEditorSchemaGenerated&&(yield f.monacoS.loadSchemaEditorSettings(f.BE_HOST_PORT,f.authCS.getUserId(),null)),f.isFirstTimeEditorSchemaGenerated=!1,f.monacoS.addSaveCodeKeyBinding(a,d=>{f.isDiffEditorEnable||f.save()}),f.monacoS.addInsertCodeKeyBinding(a,d=>{f.generalCS.messageReceivedFor=A.H.Schema,f.insertCodeModalC.showModal(F.b.CreateSchemaFormC)}),f.subscriptions.push(f.generalS.messageReceived.subscribe(d=>{d.type&&d.type===W.g.TEXT_COPIED&&d.componentName===F.b.CreateSchemaFormC&&(f.monacoS.insertAtCursor(a,d.selectedText),f.insertCodeModalC.hideModal())}))})()}resetForm(){this.schemaData={properties:{}},this.editorSchema&&this.editorSchema.setValue(""),this.editorAnalysis&&this.editorAnalysis.setValue("")}patchForm(a){setTimeout(()=>{this.editorSchema&&this.editorSchema.setValue(a.propertiesCode),this.editorAnalysis&&this.editorAnalysis.setValue("")},500)}loadAnalysisData(){var a=this;return(0,D.Z)(function*(){const f=a.eventCenterS.instance.selectedInstances.value,d=a.eventCenterS.database.selectedDatabases.value,v=a.eventCenterS.collection.selectedCollections.value;try{const l=yield a.instanceS.getSchema(f[0],d[0].db,v[0].name).toPromise();for(const C of l.warnings||[])a.notificationS.showWarning(C.message);return l.data}catch{return{fields:[]}}})()}validateAndSetBeforeSave(){var a=this;return(0,D.Z)(function*(){a.schemaData.instanceName=a.eventCenterS.instance.selectedInstances.value[0].name,a.schemaData.collectionName=a.schemaData.collectionName=a.eventCenterS.collection.selectedCollections.value[0].name,a.schemaData.databaseName=a.eventCenterS.database.selectedDatabases.value[0].db,a.schemaData.propertiesCode=a.editorSchema.getValue(),a.schemaData.user=a.authCS.getUserId()})()}save(){var a=this;return(0,D.Z)(function*(){try{if(!a.validateAndSetBeforeSave())return;let d;a.loading.form=!0,a.lastError=void 0,a.monacoS.clearEditorDecorations(a.editorSchema,a.monacoDecorations),a.mode===x.D.ADD?d=yield a.schemaS.post(a.schemaData).toPromise():a.mode===x.D.EDIT&&(d=yield a.schemaS.put(a.schemaData._id,a.schemaData,{select:Q.iH._id}).toPromise()),a.ns.showSuccess(`Schema ${a.mode===x.D.ADD?"added":"updated"} successfully.`),d.warnings?.length?(a.lastError=d.warnings,a.modalTitle="Warnings"):a.hideModal(),a.eventCenterS.apiCell.eventChannelSchema.emit({action:a.mode===x.D.ADD?e.F.SAVED:e.F.UPDATED}),a.eventCenterS.schemaSaved.next(!0),a.eventCenterS.database.selectedDatabases.next([...a.eventCenterS.database.selectedDatabases.value]),a.loading.form=!1}catch(f){const d=f?.error?.errors||[];d.length&&a.notificationS.showError(d[0].message),a.loading.form=!1,a.lastError=f.error,a.modalTitle="Error info",a.tab=a.tab||{},a.tab.axiosResponse={data:f.error},a.monacoS.highlightErrorInMonacoEditor(a.editorSchema,a.tab,"MainSandbox.ts",a.monacoDecorations)}})()}removePermanentDialog(){var a=this;return(0,D.Z)(function*(){var f;a.confirmationService.confirm({message:a.constantsS.schema.removePermanentConfirm,header:"Confirmation",icon:"pi pi-exclamation-triangle",accept:(f=(0,D.Z)(function*(){yield a.removePermanent()}),function(){return f.apply(this,arguments)})})})()}removePermanent(){var a=this;return(0,D.Z)(function*(){a.loading.form=!0;const f=yield a.schemaS.permanentDelete(a.schemaData._id).toPromise();a.loading.form=!1,f.success?(a.notificationS.showSuccess(a.constantsS.schema.removePermanent),a.hideModal(),a.eventCenterS.schemaSaved.next(!0)):a.notificationS.showErrorFromResponse(f,a.constantsS.schema.removePermanentError)})()}showModal(){this.lastError=void 0,this.shouldLoadMonacoEditor=!0,setTimeout(()=>{this.editorSchemaNative.createEditor(),this.isDiffEditorEnable=!1,$("#idCreateSchemaForm").modal("show")},100)}hideModal(){$("#idCreateSchemaForm").modal("hide")}syncSchema(){var a=this;return(0,D.Z)(function*(){a.loading.form=!0,a.isDiffEditorEnable=!0,a.analysisDataDiff=yield a.loadAnalysisData(),yield a.editorSchemaNative.initDiffEditor(a.editorSchema.getValue(),a.analysisDataDiff.fieldsString,"typescript",!0),a.loading.form=!1})()}resetSchemaSyncEditor(){var a=this;return(0,D.Z)(function*(){a.isDiffEditorEnable=!1;const f=a.editorSchemaNative.editorDiff.getModel().original.getValue();a.editorSchemaNative.createEditor(f)})()}viewError(){this.viewDockerfileModelC.showModal(this.generalS.stringify(this.lastError),K.d.json)}ngOnDestroy(){this.generalS.unsubscribe(this.subscriptions)}static \u0275fac=function(f){return new(f||s)(n.Y36(B.qu),n.Y36(t.W),n.Y36(Y.$),n.Y36(V.E),n.Y36(G.b),n.Y36(k.D),n.Y36(H.u),n.Y36(O.m),n.Y36(y.b),n.Y36(M.L),n.Y36(n.sBO),n.Y36(t.W),n.Y36(u.YP),n.Y36(G.b))};static \u0275cmp=n.Xpm({type:s,selectors:[["app-create-schema-form"]],viewQuery:function(f,d){if(1&f&&(n.Gf(X,5),n.Gf(ae,5),n.Gf(se,5)),2&f){let v;n.iGM(v=n.CRH())&&(d.editorSchemaNative=v.first),n.iGM(v=n.CRH())&&(d.viewDockerfileModelC=v.first),n.iGM(v=n.CRH())&&(d.insertCodeModalC=v.first)}},decls:35,vars:18,consts:[["aria-hidden","true","aria-labelledby","exampleModalLabel","id","idCreateSchemaForm","role","dialog","data-backdrop","static","data-keyboard","false",1,"modal"],["role","document",1,"modal-dialog","modal-xl"],[1,"modal-content"],[1,"modal-header"],[4,"ngIf"],[1,"float-right"],["aria-label","Close","data-dismiss","modal","type","button",1,"close",3,"click"],["aria-hidden","true"],[1,"fas","fa-window-close"],["pTooltip","Insert Code","sava-no-dbl-click","",1,"cursor-pointer","mr-1","text-info",2,"font-size","1.4em",3,"click"],[1,"fas","fa-info-circle","text-info","fa-fw"],[1,"modal-body"],[3,"header"],["class","overflow-hidden","style","height: calc(100vh - 183px);",4,"ngIf"],["header","Data Analysis"],[1,"overflow-hidden",2,"height","calc(100vh - 183px)"],[3,"editorOptions","editorGenerated"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s",4,"ngIf"],[1,"modal-footer"],[1,"w-100"],["class","far fa-trash-alt fa-fw text-danger cursor-pointer align-bottom",3,"click",4,"ngIf"],["class","fas fa-sync fa-fw text-info cursor-pointer align-bottom ml-2",3,"click",4,"ngIf"],["class","fas fa-redo fa-fw text-info cursor-pointer fa-flip-horizontal align-bottom ml-2",3,"click",4,"ngIf"],["class","btn btn-primary btn-sm float-right","sava-no-dbl-click","","type","button",3,"disabled","click",4,"ngIf"],["type","button",1,"btn","btn-sm","btn-secondary","float-right","mr-1",3,"click"],[1,"fas","fa-times","text-danger","fa-fw"],["href","javascript:;","class","text-danger float-right mr-1",3,"click",4,"ngIf"],[3,"modalId","editorOptionsMonacoEditorModal","modalTitle"],["monacoEditorModalC",""],[3,"frameId","modalId","docsHostPort"],["insertCodeModalC",""],[1,"fas","fa-plus","text-success","fa-fw","mr-1"],["class","text-warning pl-5","pTooltip","Instance",4,"ngIf"],[1,"ml-2"],["class","text-light ml-2","pTooltip","Database",4,"ngIf"],["class","text-success ml-2","pTooltip","Collection",4,"ngIf"],["pTooltip","Instance",1,"text-warning","pl-5"],["pTooltip","Database",1,"text-light","ml-2"],["pTooltip","Collection",1,"text-success","ml-2"],[1,"far","fa-eye","text-info","fa-fw","mr-1"],[1,"fas","fa-pencil-alt","text-light","fa-fw","mr-1"],[3,"isSchemaEditor","editorOptions","editorGenerated"],["editorSchemaNative",""],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s"],[1,"far","fa-trash-alt","fa-fw","text-danger","cursor-pointer","align-bottom",3,"click"],[1,"fas","fa-sync","fa-fw","text-info","cursor-pointer","align-bottom","ml-2",3,"click"],[1,"fas","fa-redo","fa-fw","text-info","cursor-pointer","fa-flip-horizontal","align-bottom","ml-2",3,"click"],["sava-no-dbl-click","","type","button",1,"btn","btn-primary","btn-sm","float-right",3,"disabled","click"],[1,"fas","fa-save","text-success","fa-fw","mr-1"],["href","javascript:;",1,"text-danger","float-right","mr-1",3,"click"]],template:function(f,d){1&f&&(n.TgZ(0,"div",0)(1,"div",1)(2,"div",2)(3,"div",3),n.YNc(4,pe,11,3,"span",4),n.YNc(5,le,3,0,"span",4),n.YNc(6,fe,11,3,"span",4),n.TgZ(7,"div",5)(8,"button",6),n.NdJ("click",function(){return d.hideModal()}),n.TgZ(9,"span",7),n._UZ(10,"i",8),n.qZA()(),n.TgZ(11,"span",9),n.NdJ("click",function(){return d.showInsertCodeModel()}),n._UZ(12,"i",10),n.qZA()()(),n.TgZ(13,"div",11)(14,"p-tabView")(15,"p-tabPanel",12),n.YNc(16,ue,4,3,"div",13),n.qZA(),n.TgZ(17,"p-tabPanel",14)(18,"div",15)(19,"app-monaco-editor",16),n.NdJ("editorGenerated",function(l){return d.editorAnalysis=l}),n.qZA(),n.YNc(20,he,1,0,"p-progressSpinner",17),n.qZA()()()(),n.TgZ(21,"div",18)(22,"div",19),n.YNc(23,Ce,1,0,"i",20),n.YNc(24,ve,1,0,"i",21),n.YNc(25,Se,1,0,"i",22),n.YNc(26,Ie,4,3,"button",23),n.TgZ(27,"button",24),n.NdJ("click",function(){return d.hideModal()}),n._UZ(28,"i",25),n._uU(29," Close"),n.qZA(),n.YNc(30,h,2,1,"a",26),n.qZA()()()()(),n._UZ(31,"app-monaco-editor-modal",27,28)(33,"app-insert-code-modal",29,30)),2&f&&(n.xp6(4),n.Q6J("ngIf",d.mode===d.EFormMode.ADD),n.xp6(1),n.Q6J("ngIf",d.mode===d.EFormMode.VIEW),n.xp6(1),n.Q6J("ngIf",d.mode===d.EFormMode.EDIT),n.xp6(9),n.MGl("header","",d.mode===d.EFormMode.ADD?"Create":"Update"," Schema"),n.xp6(1),n.Q6J("ngIf",d.shouldLoadMonacoEditor),n.xp6(3),n.Q6J("editorOptions",d.editorOptionsAnalysis),n.xp6(1),n.Q6J("ngIf",d.loading.form),n.xp6(3),n.Q6J("ngIf",d.mode===d.EFormMode.EDIT),n.xp6(1),n.Q6J("ngIf",d.mode===d.EFormMode.EDIT&&!d.isDiffEditorEnable),n.xp6(1),n.Q6J("ngIf",d.mode===d.EFormMode.EDIT&&d.isDiffEditorEnable),n.xp6(1),n.Q6J("ngIf",d.mode!==d.EFormMode.VIEW),n.xp6(4),n.Q6J("ngIf",d.lastError),n.xp6(1),n.Q6J("modalId","idMonacoEditorModalInSchema")("editorOptionsMonacoEditorModal",d.editorOptionsMonacoEditorModal)("modalTitle",d.modalTitle),n.xp6(2),n.Q6J("frameId","IdInsertCodeSchema")("modalId","IdInsertCodeSchemaModal")("docsHostPort",d.DOCS_HOST_PORT))},dependencies:[S.O5,m.y,b.P,T.O,N.G,J.xf,J.x4,q.u,z.A],encapsulation:2})}return s})()},2571:(de,L,r)=>{r.d(L,{d:()=>M});var D=r(5861),e=r(6990),Z=r(1162),o=r(4946),A=r(95),Q=r(9961),R=r(3429),K=r(5852),F=r(7240),W=r(9530),n=r(2915),B=r(6814),t=r(2660),Y=r(5431),V=r(5219),G=r(7680);function k(u,S){1&u&&(o.TgZ(0,"tr")(1,"th",18),o._UZ(2,"p-tableHeaderCheckbox"),o.qZA(),o.TgZ(3,"th"),o._uU(4,"Collection/Table name"),o.qZA()())}function H(u,S){if(1&u&&(o.TgZ(0,"tr",19)(1,"td"),o._UZ(2,"p-tableCheckbox",20),o.qZA(),o.TgZ(3,"td"),o._uU(4),o.qZA()()),2&u){const m=S.$implicit;o.Q6J("pSelectableRow",m),o.xp6(2),o.Q6J("value",m)("pSelectableRow",m),o.xp6(2),o.Oqu(m.name)}}function O(u,S){1&u&&o._UZ(0,"p-progressSpinner",21)}function y(u,S){1&u&&o._UZ(0,"p-progressSpinner",21)}let M=(()=>{class u{fb;ns;instanceS;authCS;generalS;schemaS;cd;eventCenterS;subscriptions=[];loading={grid:!1};rows=[];rowsMap={};selectedRows=[];gridKey=Z.iH._id;constructor(m,b,T,N,J,q,z,X){this.fb=m,this.ns=b,this.instanceS=T,this.authCS=N,this.generalS=J,this.schemaS=q,this.cd=z,this.eventCenterS=X}ngOnInit(){}loadGridData(){var m=this;return(0,D.Z)(function*(){const b=m.eventCenterS.database.selectedDatabases.value;m.loading.grid=!0,m.subscriptions.push(m.instanceS.getCollections(b).subscribe(T=>{if(T.success){m.selectedRows=[];const N=e.filter(e.flatten(T.data||[]),{schemaIsGenerated:!1});m.rows=e.flatten(N||[]),m.rowsMap=e.keyBy(m.rows,Z.iH._id)}m.loading.grid=!1,m.cd.detectChanges()}))})()}showSchemaModal(){var m=this;return(0,D.Z)(function*(){$("#idBulkSchemaCreationModal").modal("show"),yield m.loadGridData()})()}hideSchemaModal(){$("#idBulkSchemaCreationModal").modal("hide")}generateSchemas(){var m=this;return(0,D.Z)(function*(){try{const b=m.selectedRows;m.loading.grid=!0;for(const T of b)try{const N=yield m.instanceS.getSchemaByInstanceName(T.instanceName,T.databaseName,T.name).toPromise(),J={instanceName:T.instanceName,collectionName:T.name,databaseName:T.databaseName,propertiesCode:N.data.fieldsString,user:m.authCS.getUserId()};(yield m.schemaS.post(J).toPromise()).success&&m.ns.showSuccess(`'${T.name}' schema created successfully.`)}catch{m.ns.showError(`'${T.name}' schema creation failed.`)}m.eventCenterS.database.selectedDatabases.next([...m.eventCenterS.database.selectedDatabases.value]),m.hideSchemaModal(),m.loading.grid=!1}catch(b){const T=b?.error?.errors||[];T.length&&m.ns.showError(T[0].message),m.loading.grid=!1}})()}ngOnDestroy(){this.generalS.unsubscribe(this.subscriptions)}static \u0275fac=function(b){return new(b||u)(o.Y36(A.qu),o.Y36(Q.W),o.Y36(R.E),o.Y36(K.D),o.Y36(F.b),o.Y36(W.$),o.Y36(o.sBO),o.Y36(n.u))};static \u0275cmp=o.Xpm({type:u,selectors:[["app-w-bulk-schema-generator"]],decls:24,vars:8,consts:[["aria-hidden","true","aria-labelledby","exampleModalLabel","id","idBulkSchemaCreationModal","role","dialog","data-backdrop","static","data-keyboard","false",1,"modal"],["role","document",1,"modal-dialog"],[1,"modal-content"],[1,"modal-header"],[1,"fas","fa-plus","text-success","fa-fw","mr-1"],["aria-label","Close","data-dismiss","modal","type","button",1,"close"],["aria-hidden","true"],[1,"fas","fa-window-close"],[1,"modal-body","overflow-auto"],["styleClass","p-datatable-striped","scrollHeight","calc(100vh - 152px)",3,"selectionMode","selection","dataKey","scrollable","value","selectionChange"],["pTemplate","header"],["pTemplate","body"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s",4,"ngIf"],[1,"modal-footer"],["data-dismiss","modal","type","button",1,"btn","btn-sm","btn-secondary"],[1,"fas","fa-times","text-danger","fa-fw"],["sava-no-dbl-click","","type","button",1,"btn","btn-primary","btn-sm",3,"disabled","click"],[1,"fas","fa-save","text-success","fa-fw","mr-1"],[2,"width","45px"],[3,"pSelectableRow"],[3,"value","pSelectableRow"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s"]],template:function(b,T){1&b&&(o.TgZ(0,"div",0)(1,"div",1)(2,"div",2)(3,"div",3)(4,"span"),o._UZ(5,"i",4),o._uU(6," Bulk Schemas Create"),o.qZA(),o.TgZ(7,"button",5)(8,"span",6),o._UZ(9,"i",7),o.qZA()()(),o.TgZ(10,"div",8)(11,"p-table",9),o.NdJ("selectionChange",function(J){return T.selectedRows=J}),o.YNc(12,k,5,0,"ng-template",10),o.YNc(13,H,5,4,"ng-template",11),o.qZA(),o.YNc(14,O,1,0,"p-progressSpinner",12),o.qZA(),o.TgZ(15,"div",13)(16,"button",14),o._UZ(17,"i",15),o._uU(18," Close"),o.qZA(),o.TgZ(19,"button",16),o.NdJ("click",function(){return T.generateSchemas()}),o._UZ(20,"i",17),o.TgZ(21,"span"),o._uU(22,"Generate Schemas"),o.qZA()()(),o.YNc(23,y,1,0,"p-progressSpinner",12),o.qZA()()()),2&b&&(o.xp6(11),o.Q6J("selectionMode","multiple")("selection",T.selectedRows)("dataKey",T.gridKey)("scrollable",!0)("value",T.rows),o.xp6(3),o.Q6J("ngIf",T.loading.grid),o.xp6(5),o.Q6J("disabled",!T.selectedRows.length),o.xp6(4),o.Q6J("ngIf",T.loading.grid))},dependencies:[B.O5,t.y,Y.iA,V.jx,Y.Ei,Y.UA,Y.Mo,G.G]})}return u})()},5597:(de,L,r)=>{r.d(L,{H:()=>y});var D=r(5861),e=r(328),x=r(95),Z=r(3157),o=r(4946),A=r(9961),Q=r(3429),R=r(7240),K=r(5852),F=r(2915),W=r(6814),n=r(2660),B=r(7680);function t(M,u){1&M&&(o.TgZ(0,"span"),o._UZ(1,"i",19),o._uU(2," Add Database"),o.qZA())}function Y(M,u){1&M&&(o.TgZ(0,"span"),o._UZ(1,"i",20),o._uU(2," View Database"),o.qZA())}function V(M,u){1&M&&(o.TgZ(0,"span"),o._UZ(1,"i",21),o._uU(2," Edit Database"),o.qZA())}function G(M,u){1&M&&(o.TgZ(0,"span"),o._uU(1,"Save Database"),o.qZA())}function k(M,u){1&M&&(o.TgZ(0,"span"),o._uU(1,"Update Database"),o.qZA())}function H(M,u){if(1&M){const S=o.EpF();o.TgZ(0,"button",22),o.NdJ("click",function(){o.CHM(S);const b=o.oxw();return o.KtG(b.save())}),o._UZ(1,"i",23),o.YNc(2,G,2,0,"span",4),o.YNc(3,k,2,0,"span",4),o.qZA()}if(2&M){const S=o.oxw();o.Q6J("disabled",S.form.invalid),o.xp6(2),o.Q6J("ngIf",S.data.mode===S.EFormMode.ADD),o.xp6(1),o.Q6J("ngIf",S.data.mode===S.EFormMode.EDIT)}}function O(M,u){1&M&&o._UZ(0,"p-progressSpinner",24)}let y=(()=>{class M{fb;ns;instanceS;generalS;authCS;eventCenter;data;loading={form:!1};EFormMode=e.D;form;subscriptions=[];constructor(S,m,b,T,N,J){this.fb=S,this.ns=m,this.instanceS=b,this.generalS=T,this.authCS=N,this.eventCenter=J}ngOnInit(){var S=this;this.createForm(),this.subscriptions.push(this.data.eventChannel.subscribe(function(){var m=(0,D.Z)(function*(b){b&&(S.form.enable(),b.action===Z.F.OPEN_FORM_IN_EDIT_MODE?(S.form.reset(),S.form.patchValue({name:S.data.formData.db})):b.action===Z.F.OPEN_FORM_IN_VIEW_MODE?(S.form.reset(),S.form.patchValue({name:S.data.formData.db}),S.form.disable()):b.action===Z.F.OPEN_FORM_IN_ADD_MODE&&S.form.reset())});return function(b){return m.apply(this,arguments)}}()))}createForm(){this.form=this.fb.group({name:[null,[x.kI.required]]})}showModal(){$("#idDatabasesForm").modal("show")}hideModal(){$("#idDatabasesForm").modal("hide")}save(){var S=this;return(0,D.Z)(function*(){const m=S.form.getRawValue();try{S.loading.form=!0;const b=S.eventCenter.instance.selectedInstances.value[0];let T;S.data.mode===e.D.ADD&&(T=yield S.instanceS.createDatabase(b,m).toPromise()),S.ns.showSuccess(`Database ${S.data.mode===e.D.ADD?"created":"renamed"} successfully.`),S.data.eventChannel.emit({action:S.data.mode===e.D.ADD?Z.F.SAVED:Z.F.UPDATED}),S.loading.form=!1}catch(b){S.loading.form=!1,S.ns.showErrorFromResponse(b.error||b,"Unable to save database.")}})()}ngOnDestroy(){this.generalS.unsubscribe(this.subscriptions)}static \u0275fac=function(m){return new(m||M)(o.Y36(x.qu),o.Y36(A.W),o.Y36(Q.E),o.Y36(R.b),o.Y36(K.D),o.Y36(F.u))};static \u0275cmp=o.Xpm({type:M,selectors:[["app-w-databases-form"]],inputs:{data:"data"},decls:23,vars:6,consts:[["aria-hidden","true","aria-labelledby","exampleModalLabel","id","idDatabasesForm","role","dialog","data-backdrop","static","data-keyboard","false",1,"modal"],["role","document",1,"modal-dialog"],[1,"modal-content"],[1,"modal-header"],[4,"ngIf"],["aria-label","Close","data-dismiss","modal","type","button",1,"close"],["aria-hidden","true"],[1,"fas","fa-window-close"],[1,"modal-body","overflow-auto"],[1,"container","pt-3",3,"formGroup"],[1,"form-group","row"],[1,"col-4","col-form-label","col-form-label-sm","text-right"],[1,"col-6"],["maxlength","50","formControlName","name","name","name","spellcheck","false","type","text","placeholder","Please provide database name",1,"form-control","form-control-sm"],[1,"modal-footer"],["data-dismiss","modal","type","button",1,"btn","btn-sm","btn-secondary"],[1,"fas","fa-times","text-danger","fa-fw"],["class","btn btn-primary btn-sm","sava-no-dbl-click","","type","button",3,"disabled","click",4,"ngIf"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s",4,"ngIf"],[1,"fas","fa-plus","text-success","fa-fw","mr-1"],[1,"far","fa-eye","text-info","fa-fw","mr-1"],[1,"fas","fa-pencil-alt","text-light","fa-fw","mr-1"],["sava-no-dbl-click","","type","button",1,"btn","btn-primary","btn-sm",3,"disabled","click"],[1,"fas","fa-save","text-success","fa-fw","mr-1"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s"]],template:function(m,b){1&m&&(o.TgZ(0,"div",0)(1,"div",1)(2,"div",2)(3,"div",3),o.YNc(4,t,3,0,"span",4),o.YNc(5,Y,3,0,"span",4),o.YNc(6,V,3,0,"span",4),o.TgZ(7,"button",5)(8,"span",6),o._UZ(9,"i",7),o.qZA()()(),o.TgZ(10,"div",8)(11,"form",9)(12,"div",10)(13,"label",11),o._uU(14,"Name"),o.qZA(),o.TgZ(15,"div",12),o._UZ(16,"input",13),o.qZA()()()(),o.TgZ(17,"div",14)(18,"button",15),o._UZ(19,"i",16),o._uU(20," Close"),o.qZA(),o.YNc(21,H,4,3,"button",17),o.qZA(),o.YNc(22,O,1,0,"p-progressSpinner",18),o.qZA()()()),2&m&&(o.xp6(4),o.Q6J("ngIf",b.data.mode===b.EFormMode.ADD),o.xp6(1),o.Q6J("ngIf",b.data.mode===b.EFormMode.VIEW),o.xp6(1),o.Q6J("ngIf",b.data.mode===b.EFormMode.EDIT),o.xp6(5),o.Q6J("formGroup",b.form),o.xp6(10),o.Q6J("ngIf",b.data.mode!==b.EFormMode.VIEW),o.xp6(1),o.Q6J("ngIf",b.loading.form))},dependencies:[x._Y,x.Fj,x.JJ,x.JL,x.nD,x.sg,x.u,W.O5,n.y,B.G],encapsulation:2})}return M})()},559:(de,L,r)=>{r.d(L,{O:()=>Ie});var D=r(5861),e=r(4946),x=r(3157),Z=r(328),o=r(6212),A=r(6990),R=r(1426),K=r(7848),F=r(1162),W=r(3429),n=r(7240),B=r(9961),t=r(5219),Y=r(2189),V=r(7414),G=r(2915),k=r(95),H=r(6814),O=r(5431),y=r(7680),M=r(3259),u=r(8057),S=r(5597),m=r(2571);const b=["databasesFormC"],T=["bulkSchemaGeneratorC"];function N(h,w){if(1&h){const s=e.EpF();e.TgZ(0,"span",15),e.NdJ("click",function(){e.CHM(s);const a=e.oxw(2);return e.KtG(a.add())}),e._UZ(1,"i",16),e.qZA()}}function J(h,w){if(1&h){const s=e.EpF();e.TgZ(0,"span",17),e.NdJ("click",function(){e.CHM(s);const a=e.oxw(2);return e.KtG(a.bulkSchemaCreation())}),e._UZ(1,"img",18),e.qZA()}}function q(h,w){if(1&h){const s=e.EpF();e.TgZ(0,"span",19),e.NdJ("click",function(){e.CHM(s);const a=e.oxw(2);return e.KtG(a.removePermanentDialog())}),e._UZ(1,"i",20),e.qZA()}}function z(h,w){if(1&h&&(e.TgZ(0,"span")(1,"a",10),e._UZ(2,"img",11),e.qZA(),e.YNc(3,N,2,0,"span",12),e.YNc(4,J,2,0,"span",13),e.YNc(5,q,2,0,"span",14),e.qZA()),2&h){const s=e.oxw();e.xp6(3),e.Q6J("ngIf",s.eventCenterS.instance.selectedInstances.value.length>0&&s.instanceType===s.EInstanceType.MONGO_DB),e.xp6(1),e.Q6J("ngIf",s.selectedRows.length),e.xp6(1),e.Q6J("ngIf",s.selectedRows.length)}}function X(h,w){if(1&h){const s=e.EpF();e.TgZ(0,"span",21)(1,"label",22)(2,"p-checkbox",23),e.NdJ("ngModelChange",function(a){e.CHM(s);const f=e.oxw();return e.KtG(f.eventCenterS.group.apisRegex.allDatabases=a)}),e.qZA()()()}if(2&h){const s=e.oxw();e.xp6(2),e.Q6J("ngModel",s.eventCenterS.group.apisRegex.allDatabases)("binary",!0)}}function ae(h,w){if(1&h&&(e.TgZ(0,"div")(1,"div",24),e._uU(2),e.qZA()()),2&h){const s=e.oxw();e.xp6(2),e.Oqu(s.constantsS.group.allDatabasesPermitted)}}function se(h,w){1&h&&(e.TgZ(0,"th",34),e._UZ(1,"p-tableHeaderCheckbox"),e.qZA())}function oe(h,w){1&h&&(e.TgZ(0,"th",35),e._uU(1,"Pre"),e.qZA())}function _e(h,w){1&h&&(e.TgZ(0,"th",35),e._uU(1,"Post"),e.qZA())}function ie(h,w){1&h&&(e.TgZ(0,"th"),e._uU(1,"Size"),e.qZA())}function pe(h,w){1&h&&e._UZ(0,"th",36)}function le(h,w){1&h&&e._UZ(0,"th",37)}function me(h,w){if(1&h&&(e.TgZ(0,"tr"),e.YNc(1,se,2,0,"th",30),e.TgZ(2,"th"),e._uU(3,"Name"),e.qZA(),e.YNc(4,oe,2,0,"th",31),e.YNc(5,_e,2,0,"th",31),e.YNc(6,ie,2,0,"th",3),e.YNc(7,pe,1,0,"th",32),e.YNc(8,le,1,0,"th",33),e.qZA()),2&h){const s=e.oxw(2);e.xp6(1),e.Q6J("ngIf",s.showCheckbox),e.xp6(3),e.Q6J("ngIf",s.showHooksCount),e.xp6(1),e.Q6J("ngIf",s.showHooksCount),e.xp6(1),e.Q6J("ngIf",!s.isDependentOnGroup&&!s.isFilterLogTable),e.xp6(1),e.Q6J("ngIf",!s.isDependentOnGroup&&!s.isFilterLogTable),e.xp6(1),e.Q6J("ngIf",s.isDependentOnGroup||s.isFilterLogTable)}}function re(h,w){if(1&h&&(e.TgZ(0,"td"),e._UZ(1,"p-tableCheckbox",43),e.qZA()),2&h){const s=e.oxw().$implicit;e.xp6(1),e.Q6J("value",s)("pSelectableRow",s)}}function ce(h,w){if(1&h&&(e.TgZ(0,"span",44),e._UZ(1,"i",45),e.qZA()),2&h){const s=e.oxw().$implicit;e.Q6J("pTooltip","Original name is : "+s.originalDBNameBeforeMask)}}function fe(h,w){if(1&h&&(e.TgZ(0,"td",46),e._uU(1),e.qZA()),2&h){const s=e.oxw().$implicit;e.xp6(1),e.Oqu(s.preHookCount||"")}}function ge(h,w){if(1&h&&(e.TgZ(0,"td",46),e._uU(1),e.qZA()),2&h){const s=e.oxw().$implicit;e.xp6(1),e.Oqu(s.postHookCount||"")}}function ue(h,w){if(1&h&&(e.TgZ(0,"td",47),e._uU(1),e.qZA()),2&h){const s=e.oxw().$implicit;e.xp6(1),e.Oqu(s.sizeUser)}}function he(h,w){1&h&&e._UZ(0,"i",49)}function Ce(h,w){if(1&h&&(e.TgZ(0,"td"),e.YNc(1,he,1,0,"i",48),e.qZA()),2&h){const s=e.oxw().$implicit;e.xp6(1),e.Q6J("ngIf",s.databaseSettingIsCreated)}}function ve(h,w){if(1&h&&(e.TgZ(0,"td")(1,"span",50),e._uU(2),e.qZA()()),2&h){const s=e.oxw().$implicit;e.xp6(2),e.Oqu(s.instanceName.toString().substring(0,3).toUpperCase())}}function Se(h,w){if(1&h&&(e.TgZ(0,"tr",38),e.YNc(1,re,2,2,"td",3),e.TgZ(2,"td",39)(3,"span"),e._uU(4),e.qZA(),e.YNc(5,ce,2,1,"span",40),e.qZA(),e.YNc(6,fe,2,1,"td",41),e.YNc(7,ge,2,1,"td",41),e.YNc(8,ue,2,1,"td",42),e.YNc(9,Ce,2,1,"td",3),e.YNc(10,ve,3,1,"td",3),e.qZA()),2&h){const s=w.$implicit,g=e.oxw(2);e.Q6J("pSelectableRow",s),e.xp6(1),e.Q6J("ngIf",g.showCheckbox),e.xp6(3),e.Oqu(s.db),e.xp6(1),e.Q6J("ngIf",s.isMaskedName),e.xp6(1),e.Q6J("ngIf",g.showHooksCount),e.xp6(1),e.Q6J("ngIf",g.showHooksCount),e.xp6(1),e.Q6J("ngIf",!g.isDependentOnGroup&&!g.isFilterLogTable),e.xp6(1),e.Q6J("ngIf",!g.isDependentOnGroup&&!g.isFilterLogTable),e.xp6(1),e.Q6J("ngIf",g.isDependentOnGroup||g.isFilterLogTable)}}function De(h,w){1&h&&e._UZ(0,"p-progressSpinner",51)}function be(h,w){if(1&h){const s=e.EpF();e.TgZ(0,"div",25)(1,"p-table",26),e.NdJ("selectionChange",function(a){e.CHM(s);const f=e.oxw();return e.KtG(f.selectedRows=a)})("selectionChange",function(){e.CHM(s);const a=e.oxw();return e.KtG(a.databaseSelected())}),e.YNc(2,me,9,6,"ng-template",27),e.YNc(3,Se,11,9,"ng-template",28),e.qZA(),e.YNc(4,De,1,0,"p-progressSpinner",29),e.qZA()}if(2&h){const s=e.oxw();e.xp6(1),e.Q6J("selectionMode","multiple")("metaKeySelection",s.metaKeySelection)("selection",s.selectedRows)("dataKey",s.gridKey)("scrollable",!0)("value",s.rows),e.xp6(3),e.Q6J("ngIf",s.loading.grid)}}let Ie=(()=>{class h{instanceS;generalS;notificationS;confirmationService;navigationCS;constantsS;cd;eventCenterS;isReadOnly=!1;showCheckbox=!0;showHooksCount=!1;isDependentOnGroup=!1;isFilterLogTable=!1;metaKeySelection=!0;loading={grid:!1};subscriptions=[];data={mode:Z.D.ADD,eventChannel:new e.vpe,formData:void 0};rows=[];rowsMap={};instanceType;EInstanceType=K.d;selectedRows=[];gridKey=F.iH._id;databasesFormC;bulkSchemaGeneratorC;constructor(s,g,a,f,d,v,l,C){this.instanceS=s,this.generalS=g,this.notificationS=a,this.confirmationService=f,this.navigationCS=d,this.constantsS=v,this.cd=l,this.eventCenterS=C}ngOnInit(){var s=this;this.subscriptions.push(this.data.eventChannel.subscribe(function(){var g=(0,D.Z)(function*(a){(a.action===x.F.SAVED||a.action===x.F.UPDATED)&&(s.databasesFormC.hideModal(),yield s.loadGridData())});return function(a){return g.apply(this,arguments)}}())),this.eventCenterS.database.selectedDatabases.next([]),this.subscriptions.push(this.isFilterLogTable?this.eventCenterS.filterInLog.instanceIds.pipe((0,R.b)(300)).subscribe(function(){var g=(0,D.Z)(function*(a){yield s.loadGridData()});return function(a){return g.apply(this,arguments)}}()):this.isDependentOnGroup?this.eventCenterS.group.instanceIds.pipe((0,R.b)(300)).subscribe(function(){var g=(0,D.Z)(function*(a){yield s.loadGridData()});return function(a){return g.apply(this,arguments)}}()):this.eventCenterS.instance.selectedInstances.pipe((0,R.b)(300)).subscribe(function(){var g=(0,D.Z)(function*(a){const f=a[0];s.instanceType=f?f.type:void 0,yield s.resetGridAndUrl(),yield s.loadGridData()});return function(a){return g.apply(this,arguments)}}())),this.subscriptions.push(this.eventCenterS.schemaSaved.subscribe(function(){var g=(0,D.Z)(function*(a){a&&(yield s.loadGridData())});return function(a){return g.apply(this,arguments)}}()))}loadGridData(){var s=this;return(0,D.Z)(function*(){let g=[];if(s.isDependentOnGroup){if(g=s.eventCenterS.group.instanceIds.value,!g.length)return void s.resetGridAndUrl()}else if(s.isFilterLogTable){if(g=s.eventCenterS.filterInLog.instanceIds.value,!g.length)return void s.resetGridAndUrl()}else if(g=s.eventCenterS.instance.selectedInstances.value,!g||0===g.length||!g[0].active)return void s.resetGridAndUrl();s.loading.grid=!0,s.subscriptions.push(s.instanceS.getDatabases(g).subscribe(function(){var a=(0,D.Z)(function*(f){if(f.success){s.selectedRows=[],s.rows=A.flatten(f.data||[]);for(const d of s.rows)d.sizeUser="number"==typeof d.storageSize?s.generalS.bytesToSize(d.storageSize):d.storageSize;s.rowsMap=A.keyBy(s.rows,F.iH._id)}else s.resetGridAndUrl();if(s.showHooksCount&&(yield s.instanceS.setHooksCountInDatabaseArr(g[0].name,s.rows)),s.isDependentOnGroup||s.isFilterLogTable){let l;s.isDependentOnGroup?l=s.eventCenterS.group.databaseNames.value:s.isFilterLogTable&&(l=s.eventCenterS.filterInLog.databaseIds.value);const C=A.intersection(A.keys(s.rowsMap),l),I=[];for(const U of C)s.rowsMap[U]&&I.push(s.rowsMap[U]);s.selectedRows=I,s.eventCenterS.database.selectedDatabases.next(I),s.setDatabaseIds(I)}else{const d=s.navigationCS.getQueryParam(o.p.database);if(d){const v=d.split(","),l=A.intersection(A.keys(s.rowsMap),v),C=[];for(const I of l)s.rowsMap[I]&&C.push(s.rowsMap[I]);s.selectedRows=C,s.eventCenterS.database.selectedDatabases.next(C),s.setDatabaseIds(C)}}s.loading.grid=!1,s.cd.detectChanges()});return function(f){return a.apply(this,arguments)}}(),a=>{s.loading.grid=!1,s.notificationS.showErrorMessageFromErrorObject(a),s.resetGridAndUrl()}))})()}resetGridAndUrl(){var s=this;return(0,D.Z)(function*(){s.rows=[],s.selectedRows=[],s.rowsMap={},s.eventCenterS.database.selectedDatabases.next([]),s.eventCenterS.group.databaseNames.next([])})()}add(){this.data.formData=void 0,this.data.mode=Z.D.ADD,this.data.eventChannel.emit({action:x.F.OPEN_FORM_IN_ADD_MODE}),this.databasesFormC.showModal()}bulkSchemaCreation(){var s=this;return(0,D.Z)(function*(){s.data.formData=void 0,s.data.mode=Z.D.ADD,s.data.eventChannel.emit({action:x.F.OPEN_FORM_IN_ADD_MODE}),yield s.bulkSchemaGeneratorC.showSchemaModal()})()}view(){this.data.formData=this.selectedRows[0],this.data.mode=Z.D.VIEW,this.data.eventChannel.emit({action:x.F.OPEN_FORM_IN_VIEW_MODE}),this.databasesFormC.showModal()}removePermanentDialog(){var s=this;return(0,D.Z)(function*(){let g=s.constantsS.database.removePermanentConfirm;var a;g=g.replace("'$$'",s.selectedRows[0].db),s.confirmationService.confirm({message:g,header:"Confirmation",icon:"pi pi-exclamation-triangle",accept:(a=(0,D.Z)(function*(){yield s.removePermanent()}),function(){return a.apply(this,arguments)})})})()}removePermanent(){var s=this;return(0,D.Z)(function*(){const g=s.eventCenterS.instance.selectedInstances.value[0],a=s.selectedRows[0].db;s.loading.grid=!0;try{const f=yield s.instanceS.dropDatabase(g,a).toPromise();s.loading.grid=!1,f.success?(s.notificationS.showSuccess(s.constantsS.database.removePermanent),s.selectedRows.length=0,s.loadGridData()):s.notificationS.showErrorFromResponse(f,s.constantsS.database.removePermanentError)}catch(f){s.notificationS.showErrorMessageFromErrorObject(f),s.loading.grid=!1}})()}databaseSelected(){var s=this;return(0,D.Z)(function*(){s.eventCenterS.database.selectedDatabases.next(s.selectedRows),s.isDependentOnGroup||s.isFilterLogTable?s.setDatabaseIds(s.selectedRows):(yield s.navigationCS.setQueryParam(o.p.database,A.map(s.selectedRows,"_id").join(",")||null),yield s.generalS.resetUrlParams([o.p.collection,o.p.collection_api]))})()}setDatabaseIds(s){const g=A.map(s=s||[],"_id");this.eventCenterS.group.databaseNames.next(g),this.eventCenterS.filterInLog.databaseIds.next(g),this.eventCenterS.filterInLog.databaseNames.next(A.map(s,"db"))}ngOnDestroy(){this.generalS.unsubscribe(this.subscriptions)}static \u0275fac=function(g){return new(g||h)(e.Y36(W.E),e.Y36(n.b),e.Y36(B.W),e.Y36(t.YP),e.Y36(Y.S),e.Y36(V.L),e.Y36(e.sBO),e.Y36(G.u))};static \u0275cmp=e.Xpm({type:h,selectors:[["app-w-databases"]],viewQuery:function(g,a){if(1&g&&(e.Gf(b,5),e.Gf(T,5)),2&g){let f;e.iGM(f=e.CRH())&&(a.databasesFormC=f.first),e.iGM(f=e.CRH())&&(a.bulkSchemaGeneratorC=f.first)}},inputs:{isReadOnly:["IsReadOnly","isReadOnly"],showCheckbox:"showCheckbox",showHooksCount:"showHooksCount",isDependentOnGroup:["IsDependentOnGroup","isDependentOnGroup"],isFilterLogTable:["IsFilterLogTable","isFilterLogTable"],metaKeySelection:"metaKeySelection"},decls:14,vars:5,consts:[[1,"card","shadow-sm","h-100"],[1,"card-header"],[1,"fas","fa-database","text-warning","fa-fw","mr-1"],[4,"ngIf"],["class","float-right cursor-pointer","pTooltip","All Databases",4,"ngIf"],[1,"card-body","p-0","h-100","overflow-hidden"],["class","h-100",4,"ngIf"],[3,"data"],["databasesFormC",""],["bulkSchemaGeneratorC",""],["href","https://docs.apimaker.dev/v1/docs/pages/instance-database-collection-apis-page.html#databases","target","_blank"],["src","/assets/images/logo/logo_docs.svg",1,"float-right","fa-fw","ml-3",2,"font-size","25px"],["class","float-right cursor-pointer ml-3","pTooltip","Add New Database",3,"click",4,"ngIf"],["class","float-right cursor-pointer ml-3","pTooltip","Bulk Schema Creation",3,"click",4,"ngIf"],["class","float-right cursor-pointer ml-3","pTooltip","Permanently Delete",3,"click",4,"ngIf"],["pTooltip","Add New Database",1,"float-right","cursor-pointer","ml-3",3,"click"],[1,"fas","fa-plus","text-success","fa-fw"],["pTooltip","Bulk Schema Creation",1,"float-right","cursor-pointer","ml-3",3,"click"],["src","/assets/images/icons/bulkschema.svg",2,"width","18px","margin-left","1px","margin-bottom","3px"],["pTooltip","Permanently Delete",1,"float-right","cursor-pointer","ml-3",3,"click"],[1,"far","fa-trash-alt","fa-fw","text-danger"],["pTooltip","All Databases",1,"float-right","cursor-pointer"],[1,"mb-0","mt--2px"],[3,"ngModel","binary","ngModelChange"],[1,"p-2","text-center","text-success"],[1,"h-100"],["styleClass","p-datatable-striped database-grid-height","scrollHeight","flex",3,"selectionMode","metaKeySelection","selection","dataKey","scrollable","value","selectionChange"],["pTemplate","header"],["pTemplate","body"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s",4,"ngIf"],["style","width: 45px;",4,"ngIf"],["class","text-center","style","width: 40px;",4,"ngIf"],["style","width: 42px;",4,"ngIf"],["style","width: 50px;",4,"ngIf"],[2,"width","45px"],[1,"text-center",2,"width","40px"],[2,"width","42px"],[2,"width","50px"],[3,"pSelectableRow"],[1,"word-break-all"],["class","pl-2",3,"pTooltip",4,"ngIf"],["class","text-center",4,"ngIf"],["class","nowrap",4,"ngIf"],[3,"value","pSelectableRow"],[1,"pl-2",3,"pTooltip"],[1,"fas","fa-theater-masks","fa-fw","text-info"],[1,"text-center"],[1,"nowrap"],["pTooltip","Database settings are there.","class","fas fa-cog text-danger fa-fw cursor-pointer",4,"ngIf"],["pTooltip","Database settings are there.",1,"fas","fa-cog","text-danger","fa-fw","cursor-pointer"],[1,"text-monospace","small"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s"]],template:function(g,a){1&g&&(e.TgZ(0,"div",0)(1,"div",1)(2,"span"),e._UZ(3,"i",2),e._uU(4," Databases"),e.qZA(),e.YNc(5,z,6,3,"span",3),e.YNc(6,X,3,2,"span",4),e.qZA(),e.TgZ(7,"div",5),e.YNc(8,ae,3,1,"div",3),e.YNc(9,be,5,7,"div",6),e.qZA()(),e._UZ(10,"app-w-databases-form",7,8)(12,"app-w-bulk-schema-generator",null,9)),2&g&&(e.xp6(5),e.Q6J("ngIf",!a.isReadOnly),e.xp6(1),e.Q6J("ngIf",a.isDependentOnGroup),e.xp6(2),e.Q6J("ngIf",a.eventCenterS.group.apisRegex.allInstances||a.eventCenterS.filterInLog.apisRegex.allInstances||a.eventCenterS.group.apisRegex.allDatabases),e.xp6(1),e.Q6J("ngIf",!(a.eventCenterS.group.apisRegex.allInstances||a.eventCenterS.filterInLog.apisRegex.allInstances||a.eventCenterS.group.apisRegex.allDatabases)),e.xp6(1),e.Q6J("data",a.data))},dependencies:[k.JJ,k.On,H.O5,O.iA,t.jx,O.Ei,O.UA,O.Mo,y.G,M.u,u.XZ,S.H,m.d]})}return h})()},4211:(de,L,r)=>{r.r(L),r.d(L,{DbCellM:()=>lt});var D=r(7664),e=r(8176),x=r(3726),Z=r(1678),o=r(9184),A=r(559),R=(r(5597),r(6937)),F=(r(241),r(740)),W=r(6162),n=r(2452),B=r(553),t=r(4946),Y=r(2915),V=r(5860),G=r(5219),k=r(5043),H=r(3885),O=r(5861),y=r(1426),M=r(7672),u=r(9361),S=r(1162),m=r(5085),b=r(9394),T=r(1601),N=r(3531),J=r(9989),q=r(8883),z=r(5561),X=r(9961),ae=r(3429),se=r(5852),oe=r(7414),_e=r(2304),ie=r(7240),pe=r(5394),le=r(6814),me=r(756),re=r(7680),ce=r(3259),fe=r(5025);const ge=["monacoEditorModalC"];function ue(_,E){1&_&&(t.TgZ(0,"a",14),t._UZ(1,"img",15),t.qZA())}function he(_,E){1&_&&(t.TgZ(0,"a",16),t._UZ(1,"img",15),t.qZA())}function Ce(_,E){1&_&&(t.TgZ(0,"a",17),t._UZ(1,"img",15),t.qZA())}function ve(_,E){if(1&_){const i=t.EpF();t.TgZ(0,"span",18),t.NdJ("click",function(){t.CHM(i);const p=t.oxw();return t.KtG(p.save())}),t._UZ(1,"i",19),t.qZA()}}function Se(_,E){if(1&_){const i=t.EpF();t.TgZ(0,"span",20),t.NdJ("click",function(){t.CHM(i);const p=t.oxw();return t.KtG(p.removePermanentDialog(p.mode))}),t._UZ(1,"i",21),t.qZA()}}function De(_,E){if(1&_){const i=t.EpF();t.TgZ(0,"span",22),t.NdJ("click",function(){t.CHM(i);const p=t.oxw();return t.KtG(p.showInsertCodeModel())}),t._UZ(1,"i",23),t.qZA()}}function be(_,E){if(1&_){const i=t.EpF();t.TgZ(0,"a",24),t.NdJ("click",function(){t.CHM(i);const p=t.oxw();return t.KtG(p.viewError())}),t._uU(1,"View error"),t.qZA()}}function Ie(_,E){1&_&&(t.TgZ(0,"span"),t._uU(1,"Add API Settings"),t.qZA())}function h(_,E){1&_&&(t.TgZ(0,"span"),t._uU(1,"Add Collection Settings"),t.qZA())}function w(_,E){1&_&&(t.TgZ(0,"span"),t._uU(1,"Add Database Settings"),t.qZA())}function s(_,E){if(1&_){const i=t.EpF();t.TgZ(0,"div",30)(1,"button",31),t.NdJ("click",function(){t.CHM(i);const p=t.oxw(2);return t.KtG(p.save())}),t._UZ(2,"i",32),t.YNc(3,Ie,2,0,"span",33),t.YNc(4,h,2,0,"span",33),t.YNc(5,w,2,0,"span",33),t.qZA()()}if(2&_){const i=t.oxw(2);t.xp6(3),t.Q6J("ngIf",i.mode===i.EInstanceApiWidgetMode.API),t.xp6(1),t.Q6J("ngIf",i.mode===i.EInstanceApiWidgetMode.Collection),t.xp6(1),t.Q6J("ngIf",i.mode===i.EInstanceApiWidgetMode.Database)}}function g(_,E){1&_&&t._UZ(0,"p-progressSpinner",34)}function a(_,E){if(1&_){const i=t.EpF();t.TgZ(0,"div",25),t.YNc(1,s,6,3,"div",26),t.TgZ(2,"div",27)(3,"app-monaco-editor",28),t.NdJ("editorGenerated",function(p){t.CHM(i);const P=t.oxw();return t.KtG(P.editorGenerated(p))}),t.qZA()(),t.YNc(4,g,1,0,"p-progressSpinner",29),t.qZA()}if(2&_){const i=t.oxw();t.xp6(1),t.Q6J("ngIf",!i.insApiSetting._id),t.xp6(1),t.Q6J("hidden",!i.insApiSetting._id),t.xp6(1),t.Q6J("hidden",!i.insApiSetting._id)("isSchemaEditor",!0)("editorOptions",i.editorOptionsInsApiSettingApi),t.xp6(1),t.Q6J("ngIf",i.loading.form)}}let f=(()=>{class _{groupS;navigationS;ns;instanceS;authCS;eventCenterS;constantsS;monacoS;generalCS;instanceApiSettingsS;confirmationService;cd;mode=n.a.API;insertCodeModalC;loading={form:!1};subscriptions=[];data={};EInstanceApiWidgetMode=n.a;EAPIAccessType=M.di;editorInsApiSettingApiCode;editorOptionsInsApiSettingApi={readOnly:!1,language:"typescript",contextmenu:!0};lastError;editorOptionsMonacoEditorModal={readOnly:!0,language:"json",contextmenu:!0};insApiSetting={};BE_HOST_PORT=B.N.BE_HOST_PORT;monacoDecorations=[];tab;modalId;viewDockerfileModelC;constructor(i,c,p,P,Ee,Ae,Me,rt,ct,dt,_t,pt){this.groupS=i,this.navigationS=c,this.ns=p,this.instanceS=P,this.authCS=Ee,this.eventCenterS=Ae,this.constantsS=Me,this.monacoS=rt,this.generalCS=ct,this.instanceApiSettingsS=dt,this.confirmationService=_t,this.cd=pt}ngOnInit(){var i=this;this.mode===n.a.API?(this.subscriptions.push(this.eventCenterS.colApi.selectedApi.pipe((0,y.b)(300)).subscribe(function(){var c=(0,O.Z)(function*(p){if(!p)return i.data.selectedItem=void 0;i.data.selectedItem=p,yield i.setDataInForm(i.data.selectedItem),i.cd.detectChanges()});return function(p){return c.apply(this,arguments)}}())),this.modalId="idMonacoEditorModalInInsApiSettings"):this.mode===n.a.Collection?(this.subscriptions.push(this.eventCenterS.collection.selectedCollections.pipe((0,y.b)(300)).subscribe(function(){var c=(0,O.Z)(function*(p){if(!p||0===p.length)return i.data.selectedItem=void 0;i.data.selectedItem=p[0],i.lastError=void 0,yield i.setDataInForm(i.data.selectedItem),i.cd.detectChanges()});return function(p){return c.apply(this,arguments)}}())),this.modalId="idMonacoEditorModalInColSettings"):this.mode===n.a.Database&&(this.subscriptions.push(this.eventCenterS.database.selectedDatabases.pipe((0,y.b)(300)).subscribe(function(){var c=(0,O.Z)(function*(p){if(!p||0===p.length)return i.data.selectedItem=void 0;i.data.selectedItem=p[0],i.lastError=void 0,yield i.setDataInForm(i.data.selectedItem),i.cd.detectChanges()});return function(p){return c.apply(this,arguments)}}())),this.modalId="idMonacoEditorModalInDatabaseSettings")}setDataInForm(i){var c=this;return(0,O.Z)(function*(){c.loading.form=!0,c.lastError=void 0,c.insApiSetting=(yield c.instanceApiSettingsS.getSettings(i,c.mode))||{},(c.mode===n.a.API||c.mode===n.a.Collection||c.mode===n.a.Database)&&c.setDataInFormCommon(),c.loading.form=!1})()}setDataInFormCommon(){var i=this;return(0,O.Z)(function*(){if(i.insApiSetting._id)i.generalCS.setValueInEditor(i,"editorInsApiSettingApiCode",i.insApiSetting.instanceApiSettingCode);else if(!i.insApiSetting._id)if(i.mode===n.a.API){const c=yield i.instanceS.getDefaultContent(i.BE_HOST_PORT,m.R.INSTANCE_API_SETTINGS_JSON).toPromise();i.generalCS.setValueInEditor(i,"editorInsApiSettingApiCode",c.data)}else if(i.mode===n.a.Collection||i.mode===n.a.Database){let c;i.mode===n.a.Database?c=yield i.instanceS.getDefaultContent(i.BE_HOST_PORT,m.R.DATABASE_SETTINGS_JSON).toPromise():i.mode===n.a.Collection&&(c=yield i.instanceS.getDefaultContent(i.BE_HOST_PORT,m.R.COLLECTION_SETTINGS_JSON).toPromise()),i.generalCS.setValueInEditor(i,"editorInsApiSettingApiCode",c.data)}i.cd.detectChanges()})()}editorGenerated(i){var c=this;return(0,O.Z)(function*(){c.editorInsApiSettingApiCode=i,yield c.monacoS.loadSchemaEditorSettings(c.BE_HOST_PORT,c.authCS.getUserId(),null),c.monacoS.addSaveCodeKeyBinding(i,p=>{c.insApiSetting._id&&c.save()}),c.monacoS.addInsertCodeKeyBinding(i,p=>{c.defineEditor(),c.insertCodeModalC.showModal(N.b.InstanceApiSettingsC)}),c.subscriptions.push(c.generalCS.messageReceived.subscribe(p=>{p.type&&p.type===J.g.TEXT_COPIED&&p.componentName===N.b.InstanceApiSettingsC&&(c.generalCS.messageReceivedFor===u.H.DatabaseSettings&&c.mode===n.a.Database||c.generalCS.messageReceivedFor===u.H.CollectionSettings&&c.mode===n.a.Collection||c.generalCS.messageReceivedFor===u.H.APISettings&&c.mode===n.a.API)&&(c.monacoS.insertAtCursor(i,p.selectedText),c.insertCodeModalC.hideModal())}))})()}defineEditor(){this.mode===n.a.Database?this.generalCS.messageReceivedFor=u.H.DatabaseSettings:this.mode===n.a.Collection?this.generalCS.messageReceivedFor=u.H.CollectionSettings:this.mode===n.a.API&&(this.generalCS.messageReceivedFor=u.H.APISettings)}showInsertCodeModel(){this.defineEditor(),this.insertCodeModalC.showModal(N.b.InstanceApiSettingsC)}save(){var i=this;return(0,O.Z)(function*(){let p,c={};if(i.data.selectedItem){if(i.mode===n.a.API||i.mode===n.a.Collection?p=i.data.selectedItem.databaseName:i.mode===n.a.Database&&(p=i.data.selectedItem.db),c.instanceName=i.data.selectedItem.instanceName,c.databaseName=p,i.mode===n.a.API){const P=i.data.selectedItem;c.collectionName=P.collectionName,c.apiId=P.id,c.instanceApiSettingCode=i.editorInsApiSettingApiCode.getValue()}else i.mode===n.a.Collection?(c.collectionName=i.data.selectedItem.name,c.apiId=b.pj.__COLLECTION_SETTINGS__,c.instanceApiSettingCode=i.editorInsApiSettingApiCode.getValue()):i.mode===n.a.Database&&(c.collectionName=b.pj.__DATABASE_SETTINGS__,c.apiId=b.pj.__DATABASE_SETTINGS__,c.instanceApiSettingCode=i.editorInsApiSettingApiCode.getValue());c.user=i.authCS.getUserId(),c=Object.assign({},i.insApiSetting||{},c);try{let P;i.loading.form=!0,i.lastError=void 0,i.monacoS.clearEditorDecorations(i.editorInsApiSettingApiCode,i.monacoDecorations),i.insApiSetting._id?i.insApiSetting._id&&(P=yield i.instanceApiSettingsS.replace(i.insApiSetting._id,c,{select:S.iH._id}).toPromise()):(P=yield i.instanceApiSettingsS.post(c).toPromise(),i.insApiSetting=P.data),i.ns.showSuccess(i.constantsS.tpApiSettings.addOrUpdateSuccess);const Ae=i.eventCenterS.database.selectedDatabases.value[0],Me=i.eventCenterS.instance.selectedInstances.value[0];i.mode===n.a.API?i.eventCenterS.collection.selectedCollections.next([i.eventCenterS.collection.selectedCollections.value[0]]):i.mode===n.a.Collection?i.eventCenterS.database.selectedDatabases.next([Ae]):i.mode===n.a.Database&&i.eventCenterS.instance.selectedInstances.next([Me]),i.loading.form=!1}catch(P){i.loading.form=!1,i.ns.showErrorFromResponse(P.error||P,"Unable to save instance."),i.lastError=P.error,i.tab=i.tab||{},i.tab.axiosResponse={data:P.error},i.monacoS.highlightErrorInMonacoEditor(i.editorInsApiSettingApiCode,i.tab,"MainSandbox.ts",i.monacoDecorations)}}})()}confirmMessage="";removePermanentDialog(i){var c=this;return(0,O.Z)(function*(){i===n.a.API?(c.confirmMessage=c.constantsS.instanceApiSettings.removePermanentConfirm,c.removePermanentDialogCommonCode(i)):i===n.a.Collection?(c.confirmMessage=c.constantsS.instanceCollectionSettings.removePermanentConfirm,c.removePermanentDialogCommonCode(i)):i===n.a.Database&&(c.confirmMessage=c.constantsS.instanceDatabaseSettings.removePermanentConfirm,c.removePermanentDialogCommonCode(i))})()}removePermanentDialogCommonCode(i){var p,c=this;this.confirmationService.confirm({message:this.confirmMessage,header:"Confirmation",icon:"pi pi-exclamation-triangle",accept:(p=(0,O.Z)(function*(){yield c.removePermanent(i)}),function(){return p.apply(this,arguments)})})}removePermanent(i){var c=this;return(0,O.Z)(function*(){c.loading.form=!0;const p=yield c.instanceApiSettingsS.permanentDelete(c.insApiSetting._id).toPromise();c.loading.form=!1,i===n.a.API?p?(c.ns.showSuccess(c.constantsS.instanceApiSettings.removePermanent),c.eventCenterS.collection.selectedCollections.next([c.eventCenterS.collection.selectedCollections.value[0]]),c.resetObj()):c.ns.showErrorFromResponse(p,c.constantsS.instanceApiSettings.removePermanentError):i===n.a.Collection?p?(c.ns.showSuccess(c.constantsS.instanceCollectionSettings.removePermanent),c.eventCenterS.database.selectedDatabases.next([c.eventCenterS.database.selectedDatabases.value[0]]),c.resetObj()):c.ns.showErrorFromResponse(p,c.constantsS.instanceCollectionSettings.removePermanentError):i===n.a.Database&&(p?(c.ns.showSuccess(c.constantsS.instanceDatabaseSettings.removePermanent),c.eventCenterS.instance.selectedInstances.next([c.eventCenterS.instance.selectedInstances.value[0]]),c.resetObj()):c.ns.showErrorFromResponse(p,c.constantsS.instanceDatabaseSettings.removePermanentError))})()}resetObj(){this.insApiSetting={},this.cd.detectChanges()}viewError(){this.viewDockerfileModelC.showModal(this.generalCS.stringify(this.lastError),T.d.json)}ngOnDestroy(){this.generalCS.unsubscribe(this.subscriptions)}static \u0275fac=function(c){return new(c||_)(t.Y36(q.e),t.Y36(z.X),t.Y36(X.W),t.Y36(ae.E),t.Y36(se.D),t.Y36(Y.u),t.Y36(oe.L),t.Y36(_e.b),t.Y36(ie.b),t.Y36(pe.f),t.Y36(G.YP),t.Y36(t.sBO))};static \u0275cmp=t.Xpm({type:_,selectors:[["app-w-instance-api-settings"]],viewQuery:function(c,p){if(1&c&&t.Gf(ge,5),2&c){let P;t.iGM(P=t.CRH())&&(p.viewDockerfileModelC=P.first)}},inputs:{mode:"mode",insertCodeModalC:"insertCodeModalC"},decls:16,vars:12,consts:[[1,"card","shadow-sm","h-100"],[1,"card-header"],[1,"fas","fa-cog","text-danger","fa-fw","mr-1"],["href","https://docs.apimaker.dev/v1/docs/settings/apiSettings.html","target","_blank",4,"ngIf"],["href","https://docs.apimaker.dev/v1/docs/settings/collectionSettings.html","target","_blank",4,"ngIf"],["href","https://docs.apimaker.dev/v1/docs/settings/databaseSettings.html","target","_blank",4,"ngIf"],["class","float-right cursor-pointer ml-3","pTooltip","Save",3,"click",4,"ngIf"],["class","float-right cursor-pointer ml-3","pTooltip","Delete",3,"click",4,"ngIf"],["class","float-right cursor-pointer ml-3","pTooltip","Insert Code",3,"click",4,"ngIf"],["href","javascript:;","class","text-danger float-right",3,"click",4,"ngIf"],[1,"card-body","p-0","h-100","overflow-hidden"],["class","position-relative border-top h-100",4,"ngIf"],[3,"modalId","editorOptionsMonacoEditorModal","modalTitle"],["monacoEditorModalC",""],["href","https://docs.apimaker.dev/v1/docs/settings/apiSettings.html","target","_blank"],["src","/assets/images/logo/logo_docs.svg",1,"float-right","fa-fw","ml-3",2,"font-size","25px"],["href","https://docs.apimaker.dev/v1/docs/settings/collectionSettings.html","target","_blank"],["href","https://docs.apimaker.dev/v1/docs/settings/databaseSettings.html","target","_blank"],["pTooltip","Save",1,"float-right","cursor-pointer","ml-3",3,"click"],[1,"fas","fa-save","fa-fw","text-success"],["pTooltip","Delete",1,"float-right","cursor-pointer","ml-3",3,"click"],[1,"far","fa-trash-alt","fa-fw","text-danger"],["pTooltip","Insert Code",1,"float-right","cursor-pointer","ml-3",3,"click"],[1,"fas","fa-info-circle","text-info","fa-fw"],["href","javascript:;",1,"text-danger","float-right",3,"click"],[1,"position-relative","border-top","h-100"],["class","p-1 text-center",4,"ngIf"],[1,"overflow-hidden",2,"height","calc(50vh - 68px)",3,"hidden"],[3,"hidden","isSchemaEditor","editorOptions","editorGenerated"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s",4,"ngIf"],[1,"p-1","text-center"],["type","button",1,"btn","btn-primary","btn-sm",3,"click"],[1,"fas","fa-plus","text-success","fa-fw","align-middle","mr-1"],[4,"ngIf"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s"]],template:function(c,p){1&c&&(t.TgZ(0,"div",0)(1,"div",1)(2,"span"),t._UZ(3,"i",2),t._uU(4),t.qZA(),t.YNc(5,ue,2,0,"a",3),t.YNc(6,he,2,0,"a",4),t.YNc(7,Ce,2,0,"a",5),t.YNc(8,ve,2,0,"span",6),t.YNc(9,Se,2,0,"span",7),t.YNc(10,De,2,0,"span",8),t.YNc(11,be,2,0,"a",9),t.qZA(),t.TgZ(12,"div",10),t.YNc(13,a,5,6,"div",11),t.qZA()(),t._UZ(14,"app-monaco-editor-modal",12,13)),2&c&&(t.xp6(4),t.hij(" ",p.mode," Settings"),t.xp6(1),t.Q6J("ngIf",p.mode===p.EInstanceApiWidgetMode.API),t.xp6(1),t.Q6J("ngIf",p.mode===p.EInstanceApiWidgetMode.Collection),t.xp6(1),t.Q6J("ngIf",p.mode===p.EInstanceApiWidgetMode.Database),t.xp6(1),t.Q6J("ngIf",p.data.selectedItem),t.xp6(1),t.Q6J("ngIf",p.data.selectedItem&&p.insApiSetting._id),t.xp6(1),t.Q6J("ngIf",p.data.selectedItem&&p.insApiSetting._id),t.xp6(1),t.Q6J("ngIf",p.lastError&&p.data.selectedItem),t.xp6(2),t.Q6J("ngIf",p.data.selectedItem),t.xp6(1),t.Q6J("modalId",p.modalId)("editorOptionsMonacoEditorModal",p.editorOptionsMonacoEditorModal)("modalTitle","Error info"))},dependencies:[le.O5,me.O,re.G,ce.u,fe.A]})}return _})();var d=r(328),v=r(6212),l=r(6990),C=r(921),I=r(2189),U=r(5431);function j(_,E){if(1&_&&(t.TgZ(0,"div")(1,"div",8),t._uU(2),t.qZA()()),2&_){const i=t.oxw();t.xp6(2),t.Oqu(i.constantsS.group.allCollectionsPermitted)}}function ee(_,E){1&_&&(t.TgZ(0,"th",19),t._UZ(1,"p-tableHeaderCheckbox"),t.qZA())}function te(_,E){if(1&_&&(t.TgZ(0,"tr"),t.YNc(1,ee,2,0,"th",14),t.TgZ(2,"th",15),t._uU(3,"Category"),t.qZA(),t.TgZ(4,"th"),t._uU(5,"Name"),t.qZA(),t.TgZ(6,"th",16),t._uU(7,"Pre"),t.qZA(),t.TgZ(8,"th",16),t._uU(9,"Post"),t.qZA(),t.TgZ(10,"th"),t._uU(11,"Authorization"),t.qZA(),t._UZ(12,"th",17)(13,"th",18),t.qZA()),2&_){const i=t.oxw(2);t.xp6(1),t.Q6J("ngIf",i.showCheckbox)}}function ne(_,E){if(1&_&&(t.TgZ(0,"td"),t._UZ(1,"p-tableCheckbox",30),t.qZA()),2&_){const i=t.oxw().$implicit;t.xp6(1),t.Q6J("value",i)("pSelectableRow",i)}}function xe(_,E){if(1&_&&(t.TgZ(0,"td",27),t._uU(1),t.qZA()),2&_){const i=t.oxw().$implicit;t.xp6(1),t.Oqu(i.preHookCount||"")}}function Ze(_,E){if(1&_&&(t.TgZ(0,"td",27),t._uU(1),t.qZA()),2&_){const i=t.oxw().$implicit;t.xp6(1),t.Oqu(i.postHookCount||"")}}function we(_,E){1&_&&(t.TgZ(0,"span",31),t._uU(1,"AM-User"),t.qZA())}function Ue(_,E){1&_&&(t.TgZ(0,"span",32),t._uU(1,"No-Access"),t.qZA())}function Fe(_,E){1&_&&(t.TgZ(0,"span",33),t._uU(1,"Public"),t.qZA())}function Ne(_,E){1&_&&(t.TgZ(0,"span",32),t._uU(1,"DB-User"),t.qZA())}function Re(_,E){1&_&&(t.TgZ(0,"span",32),t._uU(1,"AWS"),t.qZA())}function Ye(_,E){1&_&&(t.TgZ(0,"span",32),t._uU(1,"Azure"),t.qZA())}function Je(_,E){1&_&&(t.TgZ(0,"span",32),t._uU(1,"Google"),t.qZA())}function Ge(_,E){1&_&&t._UZ(0,"i",34)}const Le=function(){return["/api-info/api-testing/testing"]},Qe=function(_,E,i,c,p){return{at_category:"INSTANCES",at_instance:_,at_user:E,at_database:i,at_collection:c,at_api:p}};function Ke(_,E){if(1&_&&(t.TgZ(0,"tr",20),t.YNc(1,ne,2,2,"td",6),t.TgZ(2,"td"),t._uU(3),t.qZA(),t.TgZ(4,"td"),t._uU(5),t.qZA(),t.YNc(6,xe,2,1,"td",21),t.YNc(7,Ze,2,1,"td",21),t.TgZ(8,"td",22),t.YNc(9,we,2,0,"span",23),t.YNc(10,Ue,2,0,"span",24),t.YNc(11,Fe,2,0,"span",25),t.YNc(12,Ne,2,0,"span",24),t.YNc(13,Re,2,0,"span",24),t.YNc(14,Ye,2,0,"span",24),t.YNc(15,Je,2,0,"span",24),t.qZA(),t.TgZ(16,"td"),t.YNc(17,Ge,1,0,"i",26),t.qZA(),t.TgZ(18,"td")(19,"div",27)(20,"a",28),t.NdJ("click",function(c){return c.stopPropagation()}),t._UZ(21,"i",29),t.qZA()()()()),2&_){const i=E.$implicit,c=t.oxw(2);t.Q6J("pSelectableRow",i),t.xp6(1),t.Q6J("ngIf",c.showCheckbox),t.xp6(1),t.Gre("text-monospaced small pl-0 text-right ","GEN"===i.category?"text-muted":"",""),t.xp6(1),t.Oqu(i.category),t.xp6(2),t.Oqu(i.nameForApiListUI),t.xp6(1),t.Q6J("ngIf",c.showHooksCount),t.xp6(1),t.Q6J("ngIf",c.showHooksCount),t.xp6(2),t.Q6J("ngIf",i.hasAmAuth),t.xp6(1),t.Q6J("ngIf",i.noAccess),t.xp6(1),t.Q6J("ngIf",i.isPublic),t.xp6(1),t.Q6J("ngIf",i.hasAmDBAuth),t.xp6(1),t.Q6J("ngIf",i.hasAwsAuth),t.xp6(1),t.Q6J("ngIf",i.hasAzureAuth),t.xp6(1),t.Q6J("ngIf",i.hasGoogleAuth),t.xp6(2),t.Q6J("ngIf",i.instanceApiSettings),t.xp6(3),t.Q6J("routerLink",t.DdM(19,Le))("queryParams",t.qbA(20,Qe,c.eventCenterS.instance.selectedInstances.value[0]._id,c.authCS.getUserId(),c.eventCenterS.database.selectedDatabases.value[0]._id,c.eventCenterS.collection.selectedCollections.value[0]._id,i._id))}}function We(_,E){1&_&&t._UZ(0,"p-progressSpinner",35)}function ke(_,E){if(1&_){const i=t.EpF();t.TgZ(0,"div",9)(1,"p-table",10),t.NdJ("selectionChange",function(p){t.CHM(i);const P=t.oxw();return t.KtG(P.selectedRows=p)})("selectionChange",function(){t.CHM(i);const p=t.oxw();return t.KtG(p.apiSelected())}),t.YNc(2,te,14,1,"ng-template",11),t.YNc(3,Ke,22,26,"ng-template",12),t.qZA(),t.YNc(4,We,1,0,"p-progressSpinner",13),t.qZA()}if(2&_){const i=t.oxw();t.xp6(1),t.Q6J("selectionMode","multiple")("metaKeySelection",!0)("selection",i.selectedRows)("dataKey",i.gridKey)("scrollable",!0)("value",i.rows),t.xp6(3),t.Q6J("ngIf",i.loading.grid)}}let Oe=(()=>{class _{instanceS;generalS;navigationCS;authCS;constantsS;eventCenterS;router;showCheckbox=!0;showHooksCount=!1;loading={grid:!1};subscriptions=[];data={mode:d.D.ADD,eventChannel:new t.vpe,formData:void 0};rows=[];rowsMap={};showAll=!1;selectedRows=[];gridKey=S.iH._id;EUserType=C.dN;constructor(i,c,p,P,Ee,Ae,Me){this.instanceS=i,this.generalS=c,this.navigationCS=p,this.authCS=P,this.constantsS=Ee,this.eventCenterS=Ae,this.router=Me}ngOnInit(){var i=this;this.subscriptions.push(this.eventCenterS.collection.selectedCollections.subscribe(function(){var c=(0,O.Z)(function*(p){if(!p[0])return i.resetGridAndUrl();yield i.loadGridData(p[0])});return function(p){return c.apply(this,arguments)}}()))}loadGridData(i){var c=this;return(0,O.Z)(function*(){c.loading.grid=!0;try{yield c.resetGridAndUrl(),c.selectedRows=[],c.rows=(yield c.instanceS.instanceAPIList([i])).data||[],c.rowsMap=l.keyBy(c.rows,S.iH._id),c.showHooksCount&&(yield c.instanceS.setHooksCountInCollectionApisArr(i.instanceName,i.databaseName,i.name,c.rows));const p=c.navigationCS.getQueryParam(v.p.collection_api),P=c.rowsMap[p];P&&(c.selectedRows=[P],c.eventCenterS.colApi.selectedApi.next(P)),c.loading.grid=!1}catch(p){console.log(p),c.loading.grid=!1}})()}resetDependents(){var i=this;return(0,O.Z)(function*(){i.eventCenterS.colApi.selectedApi.next(void 0),yield i.navigationCS.setQueryParam(v.p.collection_api,null)})()}apiSelected(){var i=this;return(0,O.Z)(function*(){yield i.resetDependents(),yield i.fillData()})()}resetGridAndUrl(){var i=this;return(0,O.Z)(function*(){i.rows=[],i.selectedRows=[],i.rowsMap={},i.eventCenterS.colApi.selectedApi.next(void 0)})()}fillData(){var i=this;return(0,O.Z)(function*(){if(!i.selectedRows.length)return yield i.navigationCS.setQueryParam(v.p.collection_api,null),void i.eventCenterS.colApi.selectedApi.next(null);const c=i.selectedRows[0];c&&(i.eventCenterS.colApi.selectedApi.next(c),yield i.navigationCS.setQueryParam(v.p.collection_api,c._id))})()}ngOnDestroy(){this.generalS.unsubscribe(this.subscriptions)}static \u0275fac=function(c){return new(c||_)(t.Y36(ae.E),t.Y36(ie.b),t.Y36(I.S),t.Y36(se.D),t.Y36(oe.L),t.Y36(Y.u),t.Y36(D.F0))};static \u0275cmp=t.Xpm({type:_,selectors:[["app-col-api-w"]],inputs:{showCheckbox:"showCheckbox",showHooksCount:"showHooksCount"},decls:10,vars:2,consts:[[1,"card","shadow-sm","h-100"],[1,"card-header"],[1,"fas","fa-code","text-info","fa-fw","mr-1"],["href","https://docs.apimaker.dev/v1/docs/pages/instance-database-collection-apis-page.html#apis","target","_blank"],["src","/assets/images/logo/logo_docs.svg",1,"float-right","fa-fw","ml-3",2,"font-size","25px"],[1,"card-body","p-0","h-100","overflow-hidden"],[4,"ngIf"],["class","h-100",4,"ngIf"],[1,"p-2","text-center","text-success"],[1,"h-100"],["styleClass","p-datatable-striped","scrollHeight","calc(50vh - 66px)",3,"selectionMode","metaKeySelection","selection","dataKey","scrollable","value","selectionChange"],["pTemplate","header"],["pTemplate","body"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s",4,"ngIf"],["style","width: 45px;",4,"ngIf"],[1,"pl-0","text-right",2,"width","85px"],[2,"width","40px"],[2,"width","42px"],[2,"width","58px"],[2,"width","45px"],[3,"pSelectableRow"],["class","text-center",4,"ngIf"],[1,"px-1"],["class","d-inline-block small font-weight-bold font-monospaced ml-2",4,"ngIf"],["class","d-inline-block small font-weight-bold font-monospaced text-success ml-2",4,"ngIf"],["class","d-inline-block small font-weight-bold font-monospaced text-warning ml-2",4,"ngIf"],["tooltipPosition","left","pTooltip","API Settings","class","fas fa-cog text-danger fa-fw cursor-pointer",4,"ngIf"],[1,"text-center"],["href","javascript:","tooltipPosition","left","pTooltip","Test API",1,"btn","btn-xsm-custom","mr-3",3,"routerLink","queryParams","click"],[1,"fas","fa-vial","text-info","fa-fw","test-tube","pt-1"],[3,"value","pSelectableRow"],[1,"d-inline-block","small","font-weight-bold","font-monospaced","ml-2"],[1,"d-inline-block","small","font-weight-bold","font-monospaced","text-success","ml-2"],[1,"d-inline-block","small","font-weight-bold","font-monospaced","text-warning","ml-2"],["tooltipPosition","left","pTooltip","API Settings",1,"fas","fa-cog","text-danger","fa-fw","cursor-pointer"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s"]],template:function(c,p){1&c&&(t.TgZ(0,"div",0)(1,"div",1)(2,"span"),t._UZ(3,"i",2),t._uU(4," Collection APIs"),t.qZA(),t.TgZ(5,"a",3),t._UZ(6,"img",4),t.qZA()(),t.TgZ(7,"div",5),t.YNc(8,j,3,1,"div",6),t.YNc(9,ke,5,7,"div",7),t.qZA()()),2&c&&(t.xp6(8),t.Q6J("ngIf",p.eventCenterS.group.apisRegex.allCollections),t.xp6(1),t.Q6J("ngIf",!p.eventCenterS.group.apisRegex.allCollections))},dependencies:[D.rH,le.O5,U.iA,G.jx,U.Ei,U.UA,U.Mo,re.G,ce.u]})}return _})();const Be=["insertCodeModalC"];function He(_,E){1&_&&t._UZ(0,"app-w-instances",5),2&_&&t.Q6J("showHooksCount",!0)("showCheckbox",!1)}function Ve(_,E){1&_&&t._UZ(0,"app-w-databases",5),2&_&&t.Q6J("showHooksCount",!0)("showCheckbox",!1)}function je(_,E){if(1&_&&t._UZ(0,"app-w-instance-api-settings",7),2&_){const i=t.oxw(2),c=t.MAs(8);t.Q6J("insertCodeModalC",c)("mode",i.EInstanceApiWidgetMode.Database)}}const Te=function(){return[50,50]};function $e(_,E){1&_&&(t.TgZ(0,"p-splitter",6),t.YNc(1,Ve,1,2,"ng-template",2),t.YNc(2,je,1,2,"ng-template",2),t.qZA()),2&_&&t.Q6J("panelSizes",t.DdM(2,Te))("minSizes",t.DdM(3,Te))}function qe(_,E){1&_&&t._UZ(0,"app-w-collections",5),2&_&&t.Q6J("showHooksCount",!0)("showCheckbox",!1)}function ze(_,E){if(1&_&&t._UZ(0,"app-w-instance-api-settings",7),2&_){const i=t.oxw(2),c=t.MAs(8);t.Q6J("insertCodeModalC",c)("mode",i.EInstanceApiWidgetMode.Collection)}}function Xe(_,E){1&_&&(t.TgZ(0,"p-splitter",6),t.YNc(1,qe,1,2,"ng-template",2),t.YNc(2,ze,1,2,"ng-template",2),t.qZA()),2&_&&t.Q6J("panelSizes",t.DdM(2,Te))("minSizes",t.DdM(3,Te))}function et(_,E){1&_&&t._UZ(0,"app-col-api-w",5),2&_&&t.Q6J("showHooksCount",!0)("showCheckbox",!1)}function tt(_,E){if(1&_&&t._UZ(0,"app-w-instance-api-settings",8),2&_){const i=t.oxw(2),c=t.MAs(8);t.Q6J("insertCodeModalC",c)("mode",i.EInstanceApiWidgetMode.API)}}function nt(_,E){1&_&&(t.TgZ(0,"p-splitter",6),t.YNc(1,et,1,2,"ng-template",2),t.YNc(2,tt,1,2,"ng-template",2),t.qZA()),2&_&&t.Q6J("panelSizes",t.DdM(2,Te))("minSizes",t.DdM(3,Te))}const at=function(){return{height:"calc(100vh - 62px)",width:"140rem"}},ye=function(){return[35,50,50,65]};let Pe=(()=>{class _{eventCenterS;EInstanceApiWidgetMode=n.a;DOCS_HOST_PORT=B.N.DOCS_HOST_PORT;insertCodeModalC;constructor(i){this.eventCenterS=i}ngOnInit(){this.eventCenterS.group.apisRegex={},this.eventCenterS.instance.selectedInstances.next([]),this.eventCenterS.database.selectedDatabases.next([]),this.eventCenterS.collection.selectedCollections.next([])}static \u0275fac=function(c){return new(c||_)(t.Y36(Y.u))};static \u0275cmp=t.Xpm({type:_,selectors:[["app-db-cell-layout"]],viewQuery:function(c,p){if(1&c&&t.Gf(Be,5),2&c){let P;t.iGM(P=t.CRH())&&(p.insertCodeModalC=P.first)}},decls:9,vars:10,consts:[[1,"pt-1","pl-1","pr-1","overflow-auto"],[3,"panelSizes","minSizes"],["pTemplate",""],[3,"frameId","modalId","docsHostPort"],["insertCodeModalC",""],[1,"w-100",3,"showHooksCount","showCheckbox"],["layout","vertical",3,"panelSizes","minSizes"],[1,"w-100",3,"insertCodeModalC","mode"],[1,"w-100",2,"width","45.8%",3,"insertCodeModalC","mode"]],template:function(c,p){1&c&&(t.TgZ(0,"div",0)(1,"p-splitter",1),t.YNc(2,He,1,2,"ng-template",2),t.YNc(3,$e,3,4,"ng-template",2),t.YNc(4,Xe,3,4,"ng-template",2),t.YNc(5,nt,3,4,"ng-template",2),t.qZA()(),t._UZ(6,"app-create-schema-form")(7,"app-insert-code-modal",3,4)),2&c&&(t.xp6(1),t.Akn(t.DdM(7,at)),t.Q6J("panelSizes",t.DdM(8,ye))("minSizes",t.DdM(9,ye)),t.xp6(6),t.Q6J("frameId","IdInsertCode")("modalId","IdInsertCodeApiList")("docsHostPort",p.DOCS_HOST_PORT))},dependencies:[V.P,G.jx,k.q,H.f,f,Oe,A.O,R.n,F.c],encapsulation:2})}return _})();r(2571);var ot=r(4950);const it=[{path:"layout",component:Pe,canActivate:[x.P]}];let lt=(()=>{class _{static \u0275fac=function(c){return new(c||_)};static \u0275mod=t.oAB({type:_});static \u0275inj=t.cJS({providers:[W.m],imports:[D.Bz.forChild(it),e.u,Z.DashboardM,o.ApiInfoM,ot.A]})}return _})()},6162:(de,L,r)=>{r.d(L,{m:()=>x});var D=r(4946),e=r(2915);let x=(()=>{class Z{es;constructor(A){this.es=A}extractNameAndSetForLogTable(A,Q,R,K){const F=[];for(const W of A)F.push(Q[W][K]);this.es.filterInLog[R].next(F)}static \u0275fac=function(Q){return new(Q||Z)(D.LFG(e.u))};static \u0275prov=D.Yz7({token:Z,factory:Z.\u0275fac,providedIn:"root"})}return Z})()}}]);
1
+ "use strict";(self.webpackChunkapi_maker_fe=self.webpackChunkapi_maker_fe||[]).push([[4211],{241:(pe,K,r)=>{r.d(K,{$:()=>y});var D=r(5861),e=r(328),I=r(95),O=r(3157),o=r(4946),M=r(9961),W=r(3429),J=r(7240),k=r(2915),N=r(6814),B=r(2660),n=r(7680);function V(P,Z){1&P&&(o.TgZ(0,"span"),o._UZ(1,"i",19),o._uU(2," Add Collection"),o.qZA())}function t(P,Z){1&P&&(o.TgZ(0,"span"),o._UZ(1,"i",20),o._uU(2," View Collection"),o.qZA())}function G(P,Z){1&P&&(o.TgZ(0,"span"),o._UZ(1,"i",21),o._uU(2," Edit Collection"),o.qZA())}function q(P,Z){1&P&&(o.TgZ(0,"span"),o._uU(1,"Save Collection"),o.qZA())}function Q(P,Z){1&P&&(o.TgZ(0,"span"),o._uU(1,"Update Collection"),o.qZA())}function H(P,Z){if(1&P){const h=o.EpF();o.TgZ(0,"button",22),o.NdJ("click",function(){o.CHM(h);const f=o.oxw();return o.KtG(f.save())}),o._UZ(1,"i",23),o.YNc(2,q,2,0,"span",4),o.YNc(3,Q,2,0,"span",4),o.qZA()}if(2&P){const h=o.oxw();o.Q6J("disabled",h.form.invalid),o.xp6(2),o.Q6J("ngIf",h.data.mode===h.EFormMode.ADD),o.xp6(1),o.Q6J("ngIf",h.data.mode===h.EFormMode.EDIT)}}function j(P,Z){1&P&&o._UZ(0,"p-progressSpinner",24)}let y=(()=>{class P{fb;ns;instanceS;generalS;eventCenterS;data;loading={form:!1};EFormMode=e.D;form;subscriptions=[];constructor(h,S,f,b,E){this.fb=h,this.ns=S,this.instanceS=f,this.generalS=b,this.eventCenterS=E}ngOnInit(){var h=this;this.createForm(),this.subscriptions.push(this.data.eventChannel.subscribe(function(){var S=(0,D.Z)(function*(f){f&&(h.form.enable(),f.action===O.F.OPEN_FORM_IN_EDIT_MODE?(h.form.reset(),h.form.patchValue(h.data.formData)):f.action===O.F.OPEN_FORM_IN_VIEW_MODE?(h.form.reset(),h.form.patchValue(h.data.formData),h.form.disable()):f.action===O.F.OPEN_FORM_IN_ADD_MODE&&h.form.reset())});return function(f){return S.apply(this,arguments)}}()))}createForm(){this.form=this.fb.group({name:[null,[I.kI.required]]})}showModal(){$("#idCollectionsForm").modal("show")}hideModal(){$("#idCollectionsForm").modal("hide")}save(){var h=this;return(0,D.Z)(function*(){const S=h.form.getRawValue();try{h.loading.form=!0;const f=h.eventCenterS.instance.selectedInstances.value[0],b=h.eventCenterS.database.selectedDatabases.value[0].db;let E;if(h.data.mode===e.D.ADD)E=yield h.instanceS.createCollection(f,b,S).toPromise();else if(h.data.mode===e.D.EDIT){const L={oldName:h.data.formData.name,newName:S.name};E=yield h.instanceS.renameCollection(f,b,L).toPromise()}h.ns.showSuccess(`Collection ${h.data.mode===e.D.ADD?"added":"renamed"} successfully.`),h.data.eventChannel.emit({action:h.data.mode===e.D.ADD?O.F.SAVED:O.F.UPDATED}),h.loading.form=!1}catch(f){console.log(f),h.loading.form=!1,h.ns.showErrorFromResponse(f.error||f,"Unable to save.")}})()}ngOnDestroy(){this.generalS.unsubscribe(this.subscriptions)}static \u0275fac=function(S){return new(S||P)(o.Y36(I.qu),o.Y36(M.W),o.Y36(W.E),o.Y36(J.b),o.Y36(k.u))};static \u0275cmp=o.Xpm({type:P,selectors:[["app-w-collections-form"]],inputs:{data:"data"},decls:23,vars:6,consts:[["aria-hidden","true","aria-labelledby","exampleModalLabel","id","idCollectionsForm","role","dialog","data-backdrop","static","data-keyboard","false",1,"modal"],["role","document",1,"modal-dialog"],[1,"modal-content"],[1,"modal-header"],[4,"ngIf"],["aria-label","Close","data-dismiss","modal","type","button",1,"close"],["aria-hidden","true"],[1,"fas","fa-window-close"],[1,"modal-body","overflow-auto"],[1,"container","pt-3",3,"formGroup"],[1,"form-group","row"],[1,"col-4","col-form-label","col-form-label-sm","text-right"],[1,"col-6"],["formControlName","name","name","name","spellcheck","false","type","text","placeholder","Please provide name",1,"form-control","form-control-sm"],[1,"modal-footer"],["data-dismiss","modal","type","button",1,"btn","btn-sm","btn-secondary"],[1,"fas","fa-times","text-danger","fa-fw"],["class","btn btn-primary btn-sm","sava-no-dbl-click","","type","button",3,"disabled","click",4,"ngIf"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s",4,"ngIf"],[1,"fas","fa-plus","text-success","fa-fw","mr-1"],[1,"far","fa-eye","text-info","fa-fw","mr-1"],[1,"fas","fa-pencil-alt","text-light","fa-fw","mr-1"],["sava-no-dbl-click","","type","button",1,"btn","btn-primary","btn-sm",3,"disabled","click"],[1,"fas","fa-save","text-success","fa-fw","mr-1"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s"]],template:function(S,f){1&S&&(o.TgZ(0,"div",0)(1,"div",1)(2,"div",2)(3,"div",3),o.YNc(4,V,3,0,"span",4),o.YNc(5,t,3,0,"span",4),o.YNc(6,G,3,0,"span",4),o.TgZ(7,"button",5)(8,"span",6),o._UZ(9,"i",7),o.qZA()()(),o.TgZ(10,"div",8)(11,"form",9)(12,"div",10)(13,"label",11),o._uU(14,"Name"),o.qZA(),o.TgZ(15,"div",12),o._UZ(16,"input",13),o.qZA()()()(),o.TgZ(17,"div",14)(18,"button",15),o._UZ(19,"i",16),o._uU(20," Close"),o.qZA(),o.YNc(21,H,4,3,"button",17),o.qZA(),o.YNc(22,j,1,0,"p-progressSpinner",18),o.qZA()()()),2&S&&(o.xp6(4),o.Q6J("ngIf",f.data.mode===f.EFormMode.ADD),o.xp6(1),o.Q6J("ngIf",f.data.mode===f.EFormMode.VIEW),o.xp6(1),o.Q6J("ngIf",f.data.mode===f.EFormMode.EDIT),o.xp6(5),o.Q6J("formGroup",f.form),o.xp6(10),o.Q6J("ngIf",f.data.mode!==f.EFormMode.VIEW),o.xp6(1),o.Q6J("ngIf",f.loading.form))},dependencies:[I._Y,I.Fj,I.JJ,I.JL,I.sg,I.u,N.O5,B.y,n.G],encapsulation:2})}return P})()},6937:(pe,K,r)=>{r.d(K,{n:()=>U});var D=r(5861),e=r(4946),I=r(3157),O=r(328),o=r(6212),M=r(6990),J=r(1426),k=r(7848),N=r(1162),B=r(3429),n=r(7240),V=r(9961),t=r(2189),G=r(7414),q=r(2915),Q=r(5219),H=r(95),j=r(6814),y=r(5431),P=r(7680),Z=r(3259),h=r(8057),S=r(241);const f=["collectionsFormC"];function b(_,x){1&_&&(e.TgZ(0,"th",13),e._UZ(1,"p-tableHeaderCheckbox"),e.qZA())}function E(_,x){1&_&&(e.TgZ(0,"th",14),e._uU(1,"Pre"),e.qZA())}function R(_,x){1&_&&(e.TgZ(0,"th",14),e._uU(1,"Post"),e.qZA())}function L(_,x){1&_&&e._UZ(0,"th",15)}function X(_,x){1&_&&e._UZ(0,"th",15)}function ee(_,x){1&_&&e._UZ(0,"th",15)}function te(_,x){1&_&&e._UZ(0,"th",16)}function oe(_,x){1&_&&e._UZ(0,"th",16)}function ie(_,x){if(1&_&&(e.TgZ(0,"tr"),e.YNc(1,b,2,0,"th",9),e.TgZ(2,"th"),e._uU(3,"Name"),e.qZA(),e.YNc(4,E,2,0,"th",10),e.YNc(5,R,2,0,"th",10),e.YNc(6,L,1,0,"th",11),e.YNc(7,X,1,0,"th",11),e.YNc(8,ee,1,0,"th",11),e.YNc(9,te,1,0,"th",12),e.YNc(10,oe,1,0,"th",12),e.qZA()),2&_){const l=e.oxw(3);e.xp6(1),e.Q6J("ngIf",l.showCheckbox),e.xp6(3),e.Q6J("ngIf",l.showHooksCount),e.xp6(1),e.Q6J("ngIf",l.showHooksCount),e.xp6(1),e.Q6J("ngIf",!l.isDependentOnGroup&&!l.isFilterLogTable),e.xp6(1),e.Q6J("ngIf",!l.isDependentOnGroup&&!l.isFilterLogTable),e.xp6(1),e.Q6J("ngIf",!l.isDependentOnGroup&&!l.isFilterLogTable&&l.isVisibleTableChange),e.xp6(1),e.Q6J("ngIf",l.isDependentOnGroup||l.isFilterLogTable),e.xp6(1),e.Q6J("ngIf",l.isDependentOnGroup||l.isFilterLogTable)}}function le(_,x){if(1&_&&(e.TgZ(0,"td"),e._UZ(1,"p-tableCheckbox",21),e.qZA()),2&_){const l=e.oxw().$implicit;e.xp6(1),e.Q6J("value",l)("pSelectableRow",l)}}function me(_,x){if(1&_&&(e.TgZ(0,"td",22),e._uU(1),e.qZA()),2&_){const l=e.oxw().$implicit;e.xp6(1),e.Oqu(l.preHookCount||"")}}function re(_,x){if(1&_&&(e.TgZ(0,"td",22),e._uU(1),e.qZA()),2&_){const l=e.oxw().$implicit;e.xp6(1),e.Oqu(l.postHookCount||"")}}function fe(_,x){if(1&_){const l=e.EpF();e.TgZ(0,"i",24),e.NdJ("click",function(){e.CHM(l);const T=e.oxw(5);return e.KtG(T.menuSchemaClicked())}),e.qZA()}}function ce(_,x){if(1&_&&(e.TgZ(0,"td"),e.YNc(1,fe,1,0,"i",23),e.qZA()),2&_){const l=e.oxw().$implicit;e.xp6(1),e.Q6J("ngIf",l.schemaIsGenerated)}}function ge(_,x){1&_&&e._UZ(0,"i",26)}function de(_,x){if(1&_&&(e.TgZ(0,"td"),e.YNc(1,ge,1,0,"i",25),e.qZA()),2&_){const l=e.oxw().$implicit;e.xp6(1),e.Q6J("ngIf",l.collectionSettingIsCreated)}}function _e(_,x){if(1&_){const l=e.EpF();e.TgZ(0,"i",28),e.NdJ("click",function(){e.CHM(l);const T=e.oxw(5);return e.KtG(T.showComparison())}),e.qZA()}}function ue(_,x){if(1&_&&(e.TgZ(0,"td"),e.YNc(1,_e,1,0,"i",27),e.qZA()),2&_){const l=e.oxw().$implicit;e.xp6(1),e.Q6J("ngIf",l.isChangeHappenedInTable)}}function he(_,x){if(1&_&&(e.TgZ(0,"td")(1,"span",29),e._uU(2),e.qZA()()),2&_){const l=e.oxw().$implicit;e.xp6(2),e.Oqu(l.instanceName.toString().substring(0,3).toUpperCase())}}function Ce(_,x){if(1&_&&(e.TgZ(0,"td")(1,"span",29),e._uU(2),e.qZA()()),2&_){const l=e.oxw().$implicit;e.xp6(2),e.Oqu(l.databaseName.toString().substring(0,3).toUpperCase())}}function ve(_,x){if(1&_&&(e.TgZ(0,"tr",17),e.YNc(1,le,2,2,"td",18),e.TgZ(2,"td",19),e._uU(3),e.qZA(),e.YNc(4,me,2,1,"td",20),e.YNc(5,re,2,1,"td",20),e.YNc(6,ce,2,1,"td",18),e.YNc(7,de,2,1,"td",18),e.YNc(8,ue,2,1,"td",18),e.YNc(9,he,3,1,"td",18),e.YNc(10,Ce,3,1,"td",18),e.qZA()),2&_){const l=x.$implicit,v=e.oxw(3);e.Q6J("pSelectableRow",l),e.xp6(1),e.Q6J("ngIf",v.showCheckbox),e.xp6(2),e.Oqu(l.name),e.xp6(1),e.Q6J("ngIf",v.showHooksCount),e.xp6(1),e.Q6J("ngIf",v.showHooksCount),e.xp6(1),e.Q6J("ngIf",!v.isDependentOnGroup&&!v.isFilterLogTable),e.xp6(1),e.Q6J("ngIf",!v.isDependentOnGroup&&!v.isFilterLogTable),e.xp6(1),e.Q6J("ngIf",!v.isDependentOnGroup&&!v.isFilterLogTable&&v.isVisibleTableChange),e.xp6(1),e.Q6J("ngIf",v.isDependentOnGroup||v.isFilterLogTable),e.xp6(1),e.Q6J("ngIf",v.isDependentOnGroup||v.isFilterLogTable)}}function Se(_,x){1&_&&e._UZ(0,"p-progressSpinner",30)}function De(_,x){if(1&_){const l=e.EpF();e.TgZ(0,"div",4)(1,"p-table",5),e.NdJ("selectionChange",function(T){e.CHM(l);const Y=e.oxw(2);return e.KtG(Y.selectedRows=T)})("selectionChange",function(){e.CHM(l);const T=e.oxw(2);return e.KtG(T.collectionSelected())})("dblclick",function(){e.CHM(l);const T=e.oxw(2);return e.KtG(T.dblClickCollections())}),e.YNc(2,ie,11,8,"ng-template",6),e.YNc(3,ve,11,10,"ng-template",7),e.qZA(),e.YNc(4,Se,1,0,"p-progressSpinner",8),e.qZA()}if(2&_){const l=e.oxw(2);e.xp6(1),e.Q6J("selectionMode","multiple")("metaKeySelection",l.metaKeySelection)("selection",l.selectedRows)("dataKey",l.gridKey)("scrollable",!0)("value",l.rows),e.xp6(3),e.Q6J("ngIf",l.loading.grid)}}function be(_,x){if(1&_&&e.YNc(0,De,5,7,"div",3),2&_){const l=e.oxw();e.Q6J("ngIf",!(l.eventCenterS.group.apisRegex.allInstances||l.eventCenterS.filterInLog.apisRegex.allInstances||l.eventCenterS.group.apisRegex.allDatabases||l.eventCenterS.group.apisRegex.allCollections))}}function xe(_,x){if(1&_){const l=e.EpF();e.TgZ(0,"span",43),e.NdJ("click",function(){e.CHM(l);const T=e.oxw(3);return e.KtG(T.menuSchemaClicked())}),e._UZ(1,"img",44),e.qZA()}}function Ie(_,x){if(1&_){const l=e.EpF();e.TgZ(0,"span",45),e.NdJ("click",function(){e.CHM(l);const T=e.oxw(3);return e.KtG(T.add())}),e._UZ(1,"i",46),e.qZA()}}function Te(_,x){if(1&_){const l=e.EpF();e.TgZ(0,"span",47),e.NdJ("click",function(){e.CHM(l);const T=e.oxw(3);return e.KtG(T.edit())}),e._UZ(1,"i",48),e.qZA()}}function C(_,x){if(1&_){const l=e.EpF();e.TgZ(0,"span",49),e.NdJ("click",function(){e.CHM(l);const T=e.oxw(3);return e.KtG(T.removePermanentDialog())}),e._UZ(1,"i",50),e.qZA()}}function F(_,x){if(1&_&&(e.TgZ(0,"span")(1,"a",37),e._UZ(2,"img",38),e.qZA(),e.YNc(3,xe,2,0,"span",39),e.YNc(4,Ie,2,0,"span",40),e.YNc(5,Te,2,0,"span",41),e.YNc(6,C,2,0,"span",42),e.qZA()),2&_){const l=e.oxw(2);e.xp6(3),e.Q6J("ngIf",l.selectedRows.length),e.xp6(1),e.Q6J("ngIf",l.eventCenterS.instance.selectedInstances.value.length&&l.eventCenterS.database.selectedDatabases.value.length&&l.addCollectionFromApiMaker),e.xp6(1),e.Q6J("ngIf",l.selectedRows.length&&l.instanceType===l.EInstanceType.MONGO_DB),e.xp6(1),e.Q6J("ngIf",l.selectedRows.length&&l.instanceType===l.EInstanceType.MONGO_DB)}}function s(_,x){if(1&_){const l=e.EpF();e.TgZ(0,"span",51)(1,"label",52)(2,"p-checkbox",53),e.NdJ("ngModelChange",function(T){e.CHM(l);const Y=e.oxw(2);return e.KtG(Y.eventCenterS.group.apisRegex.allCollections=T)}),e.qZA()()()}if(2&_){const l=e.oxw(2);e.xp6(2),e.Q6J("ngModel",l.eventCenterS.group.apisRegex.allCollections)("binary",!0)}}function u(_,x){if(1&_&&(e.TgZ(0,"div")(1,"div",54),e._uU(2),e.qZA()()),2&_){const l=e.oxw(2);e.xp6(2),e.Oqu(l.constantsS.group.allCollectionsPermitted)}}function a(_,x){1&_&&e.GkF(0)}function g(_,x){if(1&_&&(e.TgZ(0,"div",31)(1,"div",32)(2,"span"),e._UZ(3,"i",33),e._uU(4," Collections"),e.qZA(),e.YNc(5,F,7,4,"span",18),e.YNc(6,s,3,2,"span",34),e.qZA(),e.TgZ(7,"div",35),e.YNc(8,u,3,1,"div",18),e.YNc(9,a,1,0,"ng-container",36),e.qZA()()),2&_){const l=e.oxw(),v=e.MAs(1);e.xp6(5),e.Q6J("ngIf",!l.isReadOnly),e.xp6(1),e.Q6J("ngIf",l.isDependentOnGroup),e.xp6(2),e.Q6J("ngIf",l.eventCenterS.group.apisRegex.allInstances||l.eventCenterS.filterInLog.apisRegex.allInstances||l.eventCenterS.group.apisRegex.allDatabases||l.eventCenterS.group.apisRegex.allCollections),e.xp6(1),e.Q6J("ngTemplateOutlet",v)}}function m(_,x){if(1&_&&e._UZ(0,"app-w-collections-form",55,56),2&_){const l=e.oxw();e.Q6J("data",l.data)}}let U=(()=>{class _{instanceS;generalS;notificationS;navigationCS;constantsS;cd;eventCenterS;confirmationService;isReadOnly=!1;showCheckbox=!0;showHooksCount=!1;isDependentOnGroup=!1;IsBulkSchemaGenerator=!1;isFilterLogTable=!1;metaKeySelection=!0;loading={grid:!1};subscriptions=[];data={mode:O.D.ADD,eventChannel:new e.vpe,formData:void 0};rows=[];rowsMap={};instanceType;EInstanceType=k.d;selectedRows=[];gridKey=N.iH._id;addCollectionFromApiMaker=!1;isVisibleTableChange=!1;collectionsFormC;constructor(l,v,T,Y,z,ne,ae,se){this.instanceS=l,this.generalS=v,this.notificationS=T,this.navigationCS=Y,this.constantsS=z,this.cd=ne,this.eventCenterS=ae,this.confirmationService=se}ngOnInit(){var l=this;this.subscriptions.push(this.data.eventChannel.subscribe(function(){var v=(0,D.Z)(function*(T){(T.action===I.F.SAVED||T.action===I.F.UPDATED)&&(l.collectionsFormC.hideModal(),yield l.loadGridData())});return function(T){return v.apply(this,arguments)}}())),this.eventCenterS.collection.selectedCollections.next([]),this.subscriptions.push(this.eventCenterS.database.selectedDatabases.pipe((0,J.b)(300)).subscribe(function(){var v=(0,D.Z)(function*(T){yield l.loadGridData()});return function(T){return v.apply(this,arguments)}}())),this.subscriptions.push(this.eventCenterS.instance.selectedInstances.pipe((0,J.b)(300)).subscribe(function(){var v=(0,D.Z)(function*(T){const Y=T[0];l.instanceType=Y?Y.type:void 0,l.addCollectionFromApiMaker=!1,"MONGO_DB"===l.instanceType&&(l.addCollectionFromApiMaker=!0)});return function(T){return v.apply(this,arguments)}}()))}resetGridAndUrl(){var l=this;return(0,D.Z)(function*(){l.rows=[],l.selectedRows=[],l.rowsMap={},l.eventCenterS.collection.selectedCollections.next([])})()}loadGridData(){var l=this;return(0,D.Z)(function*(){const v=l.eventCenterS.database.selectedDatabases.value;v&&0!==v.length&&v[0]?(l.loading.grid=!0,l.isVisibleTableChange=!1,l.resetGridAndUrl(),l.subscriptions.push(l.instanceS.getCollections(v).subscribe(function(){var T=(0,D.Z)(function*(Y){if(Y.success){l.selectedRows=[],l.rows=M.flatten(Y.data||[]),l.rowsMap=M.keyBy(l.rows,N.iH._id),l.showHooksCount&&(yield l.instanceS.setHooksCountInCollectionArr(v[0].instanceName,v[0].db,l.rows));for(const ne of l.rows)if(ne.isChangeHappenedInTable){l.isVisibleTableChange=!0;break}}else l.resetGridAndUrl();const z=l.navigationCS.getQueryParam(o.p.collection)||(l.isFilterLogTable?l.eventCenterS.filterInLog.collectionIds.value.join(","):l.eventCenterS.group.collectionNames.value.join(","));if(z){const ne=z.split(","),ae=M.intersection(M.keys(l.rowsMap),ne),se=[];for(const Oe of ae)l.rowsMap[Oe]&&se.push(l.rowsMap[Oe]);l.selectedRows=se,l.eventCenterS.collection.selectedCollections.next(se),l.isDependentOnGroup&&l.eventCenterS.group.collectionNames.next(ae),l.isFilterLogTable&&(l.eventCenterS.filterInLog.collectionIds.next(ae),l.eventCenterS.filterInLog.collectionNames.next(M.map(l.selectedRows,"name")))}l.loading.grid=!1,l.cd.detectChanges()});return function(Y){return T.apply(this,arguments)}}()))):l.resetGridAndUrl()})()}add(){this.data.formData=void 0,this.data.mode=O.D.ADD,this.data.eventChannel.emit({action:I.F.OPEN_FORM_IN_ADD_MODE}),this.collectionsFormC.showModal()}view(){this.data.formData=this.selectedRows[0],this.data.mode=O.D.VIEW,this.data.eventChannel.emit({action:I.F.OPEN_FORM_IN_VIEW_MODE}),this.collectionsFormC.showModal()}edit(){this.data.formData=this.selectedRows[0],this.data.mode=O.D.EDIT,this.data.eventChannel.emit({action:I.F.OPEN_FORM_IN_EDIT_MODE}),this.collectionsFormC.showModal()}removePermanentDialog(){var l=this;return(0,D.Z)(function*(){var v;l.confirmationService.confirm({message:l.constantsS.collection.removePermanentConfirm,header:"Confirmation",icon:"pi pi-exclamation-triangle",accept:(v=(0,D.Z)(function*(){yield l.removePermanent()}),function(){return v.apply(this,arguments)})})})()}removePermanent(){var l=this;return(0,D.Z)(function*(){const v=l.eventCenterS.instance.selectedInstances.value[0],T=l.eventCenterS.database.selectedDatabases.value[0].db,Y=l.selectedRows[0].name;l.loading.grid=!0;try{const z=yield l.instanceS.dropCollection(v,T,Y).toPromise();l.loading.grid=!1,z.success?(l.notificationS.showSuccess(l.constantsS.collection.removePermanent),l.selectedRows.length=0,l.loadGridData()):l.notificationS.showErrorFromResponse(z,l.constantsS.collection.removePermanentError)}catch(z){l.notificationS.showErrorMessageFromErrorObject(z),l.loading.grid=!1}})()}collectionSelected(){var l=this;return(0,D.Z)(function*(){l.eventCenterS.collection.selectedCollections.next(l.selectedRows),l.IsBulkSchemaGenerator||(l.isDependentOnGroup||l.isFilterLogTable?(l.isDependentOnGroup&&l.eventCenterS.group.collectionNames.next(M.map(l.selectedRows,"_id")),l.isFilterLogTable&&(l.eventCenterS.filterInLog.collectionIds.next(M.map(l.selectedRows,"_id")),l.eventCenterS.filterInLog.collectionNames.next(M.map(l.selectedRows,"name")))):(yield l.navigationCS.setQueryParam(o.p.collection,M.map(l.selectedRows,"_id").join(",")||null),yield l.navigationCS.setQueryParam(o.p.collection_api,null)))})()}menuSchemaClicked(){setTimeout(()=>{this.eventCenterS.apiCell.eventChannelSchema.emit({action:I.F.OPEN_FORM_IN_DECIDE_MODE})},100)}showComparison(){setTimeout(()=>{this.eventCenterS.apiCell.eventChannelSchema.emit({action:I.F.OPEN_FORM_IN_DECIDE_MODE,isOpen:"compareMode"})},100)}ngOnDestroy(){this.generalS.unsubscribe(this.subscriptions)}dblClickCollections(){this.selectedRows.length&&this.eventCenterS.apiCell.eventChannelSchema.emit({action:I.F.OPEN_FORM_IN_DECIDE_MODE})}static \u0275fac=function(v){return new(v||_)(e.Y36(B.E),e.Y36(n.b),e.Y36(V.W),e.Y36(t.S),e.Y36(G.L),e.Y36(e.sBO),e.Y36(q.u),e.Y36(Q.YP))};static \u0275cmp=e.Xpm({type:_,selectors:[["app-w-collections"]],viewQuery:function(v,T){if(1&v&&e.Gf(f,5),2&v){let Y;e.iGM(Y=e.CRH())&&(T.collectionsFormC=Y.first)}},inputs:{isReadOnly:["IsReadOnly","isReadOnly"],showCheckbox:"showCheckbox",showHooksCount:"showHooksCount",isDependentOnGroup:["IsDependentOnGroup","isDependentOnGroup"],IsBulkSchemaGenerator:"IsBulkSchemaGenerator",isFilterLogTable:["IsFilterLogTable","isFilterLogTable"],metaKeySelection:"metaKeySelection"},decls:4,vars:2,consts:[["modalGrid",""],["class","card shadow-sm h-100",4,"ngIf"],[3,"data",4,"ngIf"],["class","h-100",4,"ngIf"],[1,"h-100"],["styleClass","p-datatable-striped collection-grid-height","scrollHeight","flex",3,"selectionMode","metaKeySelection","selection","dataKey","scrollable","value","selectionChange","dblclick"],["pTemplate","header"],["pTemplate","body"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s",4,"ngIf"],["style","width: 45px;",4,"ngIf"],["style","width: 40px;",4,"ngIf"],["style","width: 42px;",4,"ngIf"],["style","width: 50px;",4,"ngIf"],[2,"width","45px"],[2,"width","40px"],[2,"width","42px"],[2,"width","50px"],[3,"pSelectableRow"],[4,"ngIf"],[1,"word-break-all"],["class","text-center",4,"ngIf"],[3,"value","pSelectableRow"],[1,"text-center"],["pTooltip","Schema is generated.","class","fas fa-receipt text-warning fa-fw cursor-pointer",3,"click",4,"ngIf"],["pTooltip","Schema is generated.",1,"fas","fa-receipt","text-warning","fa-fw","cursor-pointer",3,"click"],["pTooltip","Collection settings are there.","class","fas fa-cog text-danger fa-fw cursor-pointer",4,"ngIf"],["pTooltip","Collection settings are there.",1,"fas","fa-cog","text-danger","fa-fw","cursor-pointer"],["class","fas fa-retweet fa-fw align-middle text-warning cursor-pointer",3,"click",4,"ngIf"],[1,"fas","fa-retweet","fa-fw","align-middle","text-warning","cursor-pointer",3,"click"],[1,"text-monospace","small"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s"],[1,"card","shadow-sm","h-100"],[1,"card-header"],[1,"fas","fa-border-all","text-success","fa-fw","mr-1"],["class","float-right cursor-pointer","tooltipPosition","left","pTooltip","All Collections",4,"ngIf"],[1,"card-body","p-0","h-100","overflow-hidden"],[4,"ngTemplateOutlet"],["href","https://docs.apimaker.dev/v1/docs/pages/instance-database-collection-apis-page.html#collections","target","_blank"],["src","/assets/images/logo/logo_docs.svg",1,"float-right","fa-fw","ml-3",2,"font-size","25px"],["class","float-right cursor-pointer ml-3","pTooltip","Add/Edit Schema",3,"click",4,"ngIf"],["class","float-right cursor-pointer ml-3","pTooltip","Add New",3,"click",4,"ngIf"],["class","float-right cursor-pointer ml-3","pTooltip","Edit",3,"click",4,"ngIf"],["class","float-right cursor-pointer ml-3","pTooltip","Permanently Delete",3,"click",4,"ngIf"],["pTooltip","Add/Edit Schema",1,"float-right","cursor-pointer","ml-3",3,"click"],["src","/assets/images/icons/bulkschema.svg",2,"width","18px","margin-left","1px","margin-bottom","3px"],["pTooltip","Add New",1,"float-right","cursor-pointer","ml-3",3,"click"],[1,"fas","fa-plus","text-success","fa-fw"],["pTooltip","Edit",1,"float-right","cursor-pointer","ml-3",3,"click"],[1,"fas","fa-pencil-alt","text-light","fa-fw"],["pTooltip","Permanently Delete",1,"float-right","cursor-pointer","ml-3",3,"click"],[1,"far","fa-trash-alt","fa-fw","text-danger"],["tooltipPosition","left","pTooltip","All Collections",1,"float-right","cursor-pointer"],[1,"mb-0","mt--2px"],[3,"ngModel","binary","ngModelChange"],[1,"p-2","text-center","text-success"],[3,"data"],["collectionsFormC",""]],template:function(v,T){1&v&&(e.YNc(0,be,1,1,"ng-template",null,0,e.W1O),e.YNc(2,g,10,4,"div",1),e.YNc(3,m,2,1,"app-w-collections-form",2)),2&v&&(e.xp6(2),e.Q6J("ngIf",!T.IsBulkSchemaGenerator),e.xp6(1),e.Q6J("ngIf",!T.IsBulkSchemaGenerator))},dependencies:[H.JJ,H.On,j.O5,j.tP,y.iA,Q.jx,y.Ei,y.UA,y.Mo,P.G,Z.u,h.XZ,S.$]})}return _})()},740:(pe,K,r)=>{r.d(K,{c:()=>F});var D=r(5861),e=r(3157),I=r(328),O=r(6990),o=function(s){return s.double="double",s.string="string",s.object="object",s.array="array",s.binData="binData",s.undefined="undefined",s.objectId="objectId",s.bool="bool",s.date="date",s.null="null",s.regex="regex",s.dbPointer="dbPointer",s.javascript="javascript",s.symbol="symbol",s.javascriptWithScope="javascriptWithScope",s.int="int",s.timestamp="timestamp",s.long="long",s.decimal="decimal",s.minKey="minKey",s.maxKey="maxKey",s}(o||{}),M=r(9361),W=r(1162),J=r(553),k=r(1601),N=r(3531),B=r(9989),n=r(4946),V=r(95),t=r(9961),G=r(9530),q=r(3429),Q=r(7240),H=r(5852),j=r(2915),y=r(6162),P=r(2304),Z=r(7414),h=r(5219),S=r(6814),f=r(2660),b=r(5860),E=r(756),R=r(7680),L=r(4844),X=r(3259),ee=r(5025);const te=["editorSchemaNative"],oe=["monacoEditorModalC"],ie=["insertCodeModalC"];function le(s,u){if(1&s&&(n.TgZ(0,"span",36),n._uU(1),n.qZA()),2&s){const a=n.oxw(2);n.xp6(1),n.Oqu(null==a.eventCenterS.instance||null==a.eventCenterS.instance.selectedInstances||null==a.eventCenterS.instance.selectedInstances.value[0]?null:a.eventCenterS.instance.selectedInstances.value[0].name)}}function me(s,u){if(1&s&&(n.TgZ(0,"span",37),n._uU(1),n.qZA()),2&s){const a=n.oxw(2);n.xp6(1),n.Oqu(null==a.eventCenterS.database||null==a.eventCenterS.database.selectedDatabases||null==a.eventCenterS.database.selectedDatabases.value[0]?null:a.eventCenterS.database.selectedDatabases.value[0].db)}}function re(s,u){if(1&s&&(n.TgZ(0,"span",38),n._uU(1),n.qZA()),2&s){const a=n.oxw(2);n.xp6(1),n.Oqu(null==a.eventCenterS.collection||null==a.eventCenterS.collection.selectedCollections||null==a.eventCenterS.collection.selectedCollections.value[0]?null:a.eventCenterS.collection.selectedCollections.value[0].name)}}function fe(s,u){if(1&s&&(n.TgZ(0,"span"),n._UZ(1,"i",31),n.TgZ(2,"span"),n._uU(3," Add Schema "),n.qZA(),n.YNc(4,le,2,1,"span",32),n.TgZ(5,"span",33),n._uU(6," \u25b8 "),n.qZA(),n.YNc(7,me,2,1,"span",34),n.TgZ(8,"span",33),n._uU(9," \u25b8 "),n.qZA(),n.YNc(10,re,2,1,"span",35),n.qZA()),2&s){const a=n.oxw();n.xp6(4),n.Q6J("ngIf",null==a.eventCenterS||null==a.eventCenterS.instance||null==a.eventCenterS.instance.selectedInstances?null:a.eventCenterS.instance.selectedInstances.value),n.xp6(3),n.Q6J("ngIf",null==a.eventCenterS||null==a.eventCenterS.database||null==a.eventCenterS.database.selectedDatabases?null:a.eventCenterS.database.selectedDatabases.value),n.xp6(3),n.Q6J("ngIf",null==a.eventCenterS||null==a.eventCenterS.collection||null==a.eventCenterS.collection.selectedCollections?null:a.eventCenterS.collection.selectedCollections.value)}}function ce(s,u){1&s&&(n.TgZ(0,"span"),n._UZ(1,"i",39),n._uU(2," View Schema"),n.qZA())}function ge(s,u){if(1&s&&(n.TgZ(0,"span",36),n._uU(1),n.qZA()),2&s){const a=n.oxw(2);n.xp6(1),n.Oqu(null==a.eventCenterS.instance||null==a.eventCenterS.instance.selectedInstances||null==a.eventCenterS.instance.selectedInstances.value[0]?null:a.eventCenterS.instance.selectedInstances.value[0].name)}}function de(s,u){if(1&s&&(n.TgZ(0,"span",37),n._uU(1),n.qZA()),2&s){const a=n.oxw(2);n.xp6(1),n.Oqu(null==a.eventCenterS.database||null==a.eventCenterS.database.selectedDatabases||null==a.eventCenterS.database.selectedDatabases.value[0]?null:a.eventCenterS.database.selectedDatabases.value[0].db)}}function _e(s,u){if(1&s&&(n.TgZ(0,"span",38),n._uU(1),n.qZA()),2&s){const a=n.oxw(2);n.xp6(1),n.Oqu(null==a.eventCenterS.collection||null==a.eventCenterS.collection.selectedCollections||null==a.eventCenterS.collection.selectedCollections.value[0]?null:a.eventCenterS.collection.selectedCollections.value[0].name)}}function ue(s,u){if(1&s&&(n.TgZ(0,"span"),n._UZ(1,"i",40),n.TgZ(2,"span"),n._uU(3," Edit Schema "),n.qZA(),n.YNc(4,ge,2,1,"span",32),n.TgZ(5,"span",33),n._uU(6," \u25b8 "),n.qZA(),n.YNc(7,de,2,1,"span",34),n.TgZ(8,"span",33),n._uU(9," \u25b8 "),n.qZA(),n.YNc(10,_e,2,1,"span",35),n.qZA()),2&s){const a=n.oxw();n.xp6(4),n.Q6J("ngIf",null==a.eventCenterS||null==a.eventCenterS.instance||null==a.eventCenterS.instance.selectedInstances?null:a.eventCenterS.instance.selectedInstances.value),n.xp6(3),n.Q6J("ngIf",null==a.eventCenterS||null==a.eventCenterS.database||null==a.eventCenterS.database.selectedDatabases?null:a.eventCenterS.database.selectedDatabases.value),n.xp6(3),n.Q6J("ngIf",null==a.eventCenterS||null==a.eventCenterS.collection||null==a.eventCenterS.collection.selectedCollections?null:a.eventCenterS.collection.selectedCollections.value)}}function he(s,u){1&s&&n._UZ(0,"p-progressSpinner",43)}function Ce(s,u){if(1&s){const a=n.EpF();n.TgZ(0,"div",15)(1,"app-monaco-editor",41,42),n.NdJ("editorGenerated",function(m){n.CHM(a);const U=n.oxw();return n.KtG(U.editorGenerated(m))}),n.qZA(),n.YNc(3,he,1,0,"p-progressSpinner",17),n.qZA()}if(2&s){const a=n.oxw();n.xp6(1),n.Q6J("isSchemaEditor",!0)("editorOptions",a.editorOptionsSchema),n.xp6(2),n.Q6J("ngIf",a.loading.form)}}function ve(s,u){1&s&&n._UZ(0,"p-progressSpinner",43)}function Se(s,u){if(1&s){const a=n.EpF();n.TgZ(0,"i",44),n.NdJ("click",function(){n.CHM(a);const m=n.oxw();return n.KtG(m.removePermanentDialog())}),n.qZA()}}function De(s,u){if(1&s){const a=n.EpF();n.TgZ(0,"i",45),n.NdJ("click",function(){n.CHM(a);const m=n.oxw();return n.KtG(m.syncSchema())}),n.qZA()}}function be(s,u){if(1&s){const a=n.EpF();n.TgZ(0,"i",46),n.NdJ("click",function(){n.CHM(a);const m=n.oxw();return n.KtG(m.resetSchemaSyncEditor())}),n.qZA()}}function xe(s,u){1&s&&(n.TgZ(0,"span"),n._uU(1,"Save Schema"),n.qZA())}function Ie(s,u){1&s&&(n.TgZ(0,"span"),n._uU(1,"Update Schema"),n.qZA())}function Te(s,u){if(1&s){const a=n.EpF();n.TgZ(0,"button",47),n.NdJ("click",function(){n.CHM(a);const m=n.oxw();return n.KtG(m.save())}),n._UZ(1,"i",48),n.YNc(2,xe,2,0,"span",4),n.YNc(3,Ie,2,0,"span",4),n.qZA()}if(2&s){const a=n.oxw();n.Q6J("disabled",a.isDiffEditorEnable),n.xp6(2),n.Q6J("ngIf",a.mode===a.EFormMode.ADD),n.xp6(1),n.Q6J("ngIf",a.mode===a.EFormMode.EDIT)}}function C(s,u){if(1&s){const a=n.EpF();n.TgZ(0,"a",49),n.NdJ("click",function(){n.CHM(a);const m=n.oxw();return n.KtG(m.viewError())}),n._uU(1),n.qZA()}if(2&s){const a=n.oxw();n.xp6(1),n.hij("View ",a.modalTitle," ")}}let F=(()=>{class s{fb;ns;schemaS;instanceS;generalS;authCS;eventCenterS;validationS;monacoS;constantsS;cd;notificationS;confirmationService;generalCS;mode=I.D.ADD;loading={form:!1};EFormMode=I.D;subscriptions=[];analysisData={fields:[]};analysisDataDiff={fields:[]};schemaData={properties:{}};bsonTypes=[];editorOptionsAnalysis={readOnly:!0,language:"json",contextmenu:!1};editorOptionsSchema={readOnly:!1,language:"typescript",contextmenu:!0};lastError;editorOptionsMonacoEditorModal={readOnly:!0,language:"json",contextmenu:!0};editorSchemaNative;viewDockerfileModelC;shouldLoadMonacoEditor=!1;monacoDecorations=[];tab;isFirstTimeEditorSchemaGenerated=!0;editorSchema;editorAnalysis;isDiffEditorEnable=!1;BE_HOST_PORT=J.N.BE_HOST_PORT;codeVersions;modalTitle;constructor(a,g,m,U,_,x,l,v,T,Y,z,ne,ae,se){this.fb=a,this.ns=g,this.schemaS=m,this.instanceS=U,this.generalS=_,this.authCS=x,this.eventCenterS=l,this.validationS=v,this.monacoS=T,this.constantsS=Y,this.cd=z,this.notificationS=ne,this.confirmationService=ae,this.generalCS=se}ngOnInit(){var a=this;this.subscriptions.push(this.eventCenterS.apiCell.eventChannelSchema.subscribe(function(){var g=(0,D.Z)(function*(m){if(m)if(m.action===e.F.OPEN_FORM_IN_DECIDE_MODE){a.loading.form=!0;const U=yield a.schemaS.getCurrentSchema();a.eventCenterS.apiCell.eventChannelSchema.emit(U?{action:e.F.OPEN_FORM_IN_EDIT_MODE,data:U}:{action:e.F.OPEN_FORM_IN_ADD_MODE}),setTimeout((0,D.Z)(function*(){"compareMode"===m.isOpen&&(yield a.syncSchema())}),500),a.loading.form=!1}else m.action===e.F.OPEN_FORM_IN_EDIT_MODE?(a.mode=I.D.EDIT,a.schemaData=m.data,a.showModal(),a.patchForm(a.schemaData)):m.action===e.F.OPEN_FORM_IN_VIEW_MODE?(a.mode=I.D.VIEW,a.showModal()):m.action===e.F.OPEN_FORM_IN_ADD_MODE&&(a.mode=I.D.ADD,a.loading.form=!0,a.resetForm(),a.showModal(),a.analysisData=yield a.loadAnalysisData(),setTimeout(()=>{a.generalCS.setValueInEditor(a,"editorSchema",a.analysisData.fieldsString),a.generalCS.setValueInEditor(a,"editorAnalysis",a.generalS.stringify(a.analysisData.fields))},500),a.loading.form=!1)});return function(m){return g.apply(this,arguments)}}()));for(const g of O.keys(o))this.bsonTypes.push(g)}DOCS_HOST_PORT=J.N.DOCS_HOST_PORT;insertCodeModalC;showInsertCodeModel(){this.generalCS.messageReceivedFor=M.H.Schema,this.insertCodeModalC.showModal(N.b.CreateSchemaFormC)}editorGenerated(a){var g=this;return(0,D.Z)(function*(){g.editorSchema=a,g.isFirstTimeEditorSchemaGenerated&&(yield g.monacoS.loadSchemaEditorSettings(g.BE_HOST_PORT,g.authCS.getUserId(),null)),g.isFirstTimeEditorSchemaGenerated=!1,g.monacoS.addSaveCodeKeyBinding(a,m=>{g.isDiffEditorEnable||g.save()}),g.monacoS.addInsertCodeKeyBinding(a,m=>{g.generalCS.messageReceivedFor=M.H.Schema,g.insertCodeModalC.showModal(N.b.CreateSchemaFormC)}),g.subscriptions.push(g.generalS.messageReceived.subscribe(m=>{m.type&&m.type===B.g.TEXT_COPIED&&m.componentName===N.b.CreateSchemaFormC&&(g.monacoS.insertAtCursor(a,m.selectedText),g.insertCodeModalC.hideModal())}))})()}resetForm(){this.schemaData={properties:{}},this.editorSchema&&this.editorSchema.setValue(""),this.editorAnalysis&&this.editorAnalysis.setValue("")}patchForm(a){setTimeout(()=>{this.editorSchema&&this.editorSchema.setValue(a.propertiesCode),this.editorAnalysis&&this.editorAnalysis.setValue("")},500)}loadAnalysisData(){var a=this;return(0,D.Z)(function*(){const g=a.eventCenterS.instance.selectedInstances.value,m=a.eventCenterS.database.selectedDatabases.value,U=a.eventCenterS.collection.selectedCollections.value;try{const _=yield a.instanceS.getSchema(g[0],m[0].db,U[0].name).toPromise();for(const x of _.warnings||[])a.notificationS.showWarning(x.message);return _.data}catch{return{fields:[]}}})()}validateAndSetBeforeSave(){var a=this;return(0,D.Z)(function*(){a.schemaData.instanceName=a.eventCenterS.instance.selectedInstances.value[0].name,a.schemaData.collectionName=a.schemaData.collectionName=a.eventCenterS.collection.selectedCollections.value[0].name,a.schemaData.databaseName=a.eventCenterS.database.selectedDatabases.value[0].db,a.schemaData.propertiesCode=a.editorSchema.getValue(),a.schemaData.user=a.authCS.getUserId()})()}save(){var a=this;return(0,D.Z)(function*(){try{if(!a.validateAndSetBeforeSave())return;let m;a.loading.form=!0,a.lastError=void 0,a.monacoS.clearEditorDecorations(a.editorSchema,a.monacoDecorations),a.mode===I.D.ADD?m=yield a.schemaS.post(a.schemaData).toPromise():a.mode===I.D.EDIT&&(m=yield a.schemaS.put(a.schemaData._id,a.schemaData,{select:W.iH._id}).toPromise()),a.ns.showSuccess(`Schema ${a.mode===I.D.ADD?"added":"updated"} successfully.`),m.warnings?.length?(a.lastError=m.warnings,a.modalTitle="Warnings"):a.hideModal(),a.eventCenterS.apiCell.eventChannelSchema.emit({action:a.mode===I.D.ADD?e.F.SAVED:e.F.UPDATED}),a.eventCenterS.schemaSaved.next(!0),a.eventCenterS.database.selectedDatabases.next([...a.eventCenterS.database.selectedDatabases.value]),a.loading.form=!1}catch(g){const m=g?.error?.errors||[];m.length&&a.notificationS.showError(m[0].message),a.loading.form=!1,a.lastError=g.error,a.modalTitle="Error info",a.tab=a.tab||{},a.tab.axiosResponse={data:g.error},a.monacoS.highlightErrorInMonacoEditor(a.editorSchema,a.tab,"MainSandbox.ts",a.monacoDecorations)}})()}removePermanentDialog(){var a=this;return(0,D.Z)(function*(){var g;a.confirmationService.confirm({message:a.constantsS.schema.removePermanentConfirm,header:"Confirmation",icon:"pi pi-exclamation-triangle",accept:(g=(0,D.Z)(function*(){yield a.removePermanent()}),function(){return g.apply(this,arguments)})})})()}removePermanent(){var a=this;return(0,D.Z)(function*(){a.loading.form=!0;const g=yield a.schemaS.permanentDelete(a.schemaData._id).toPromise();a.loading.form=!1,g.success?(a.notificationS.showSuccess(a.constantsS.schema.removePermanent),a.hideModal(),a.eventCenterS.schemaSaved.next(!0)):a.notificationS.showErrorFromResponse(g,a.constantsS.schema.removePermanentError)})()}showModal(){this.lastError=void 0,this.shouldLoadMonacoEditor=!0,setTimeout(()=>{this.editorSchemaNative.createEditor(),this.isDiffEditorEnable=!1,$("#idCreateSchemaForm").modal("show")},100)}hideModal(){$("#idCreateSchemaForm").modal("hide")}syncSchema(){var a=this;return(0,D.Z)(function*(){a.loading.form=!0,a.isDiffEditorEnable=!0,a.analysisDataDiff=yield a.loadAnalysisData(),yield a.editorSchemaNative.initDiffEditor(a.editorSchema.getValue(),a.analysisDataDiff.fieldsString,"typescript",!0),a.loading.form=!1})()}resetSchemaSyncEditor(){var a=this;return(0,D.Z)(function*(){a.isDiffEditorEnable=!1;const g=a.editorSchemaNative.editorDiff.getModel().original.getValue();a.editorSchemaNative.createEditor(g)})()}viewError(){this.viewDockerfileModelC.showModal(this.generalS.stringify(this.lastError),k.d.json)}ngOnDestroy(){this.generalS.unsubscribe(this.subscriptions)}static \u0275fac=function(g){return new(g||s)(n.Y36(V.qu),n.Y36(t.W),n.Y36(G.$),n.Y36(q.E),n.Y36(Q.b),n.Y36(H.D),n.Y36(j.u),n.Y36(y.m),n.Y36(P.b),n.Y36(Z.L),n.Y36(n.sBO),n.Y36(t.W),n.Y36(h.YP),n.Y36(Q.b))};static \u0275cmp=n.Xpm({type:s,selectors:[["app-create-schema-form"]],viewQuery:function(g,m){if(1&g&&(n.Gf(te,5),n.Gf(oe,5),n.Gf(ie,5)),2&g){let U;n.iGM(U=n.CRH())&&(m.editorSchemaNative=U.first),n.iGM(U=n.CRH())&&(m.viewDockerfileModelC=U.first),n.iGM(U=n.CRH())&&(m.insertCodeModalC=U.first)}},decls:35,vars:18,consts:[["aria-hidden","true","aria-labelledby","exampleModalLabel","id","idCreateSchemaForm","role","dialog","data-backdrop","static","data-keyboard","false",1,"modal"],["role","document",1,"modal-dialog","modal-xl"],[1,"modal-content"],[1,"modal-header"],[4,"ngIf"],[1,"float-right"],["aria-label","Close","data-dismiss","modal","type","button",1,"close",3,"click"],["aria-hidden","true"],[1,"fas","fa-window-close"],["pTooltip","Insert Code","sava-no-dbl-click","",1,"cursor-pointer","mr-1","text-info",2,"font-size","1.4em",3,"click"],[1,"fas","fa-info-circle","text-info","fa-fw"],[1,"modal-body"],[3,"header"],["class","overflow-hidden","style","height: calc(100vh - 183px);",4,"ngIf"],["header","Data Analysis"],[1,"overflow-hidden",2,"height","calc(100vh - 183px)"],[3,"editorOptions","editorGenerated"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s",4,"ngIf"],[1,"modal-footer"],[1,"w-100"],["class","far fa-trash-alt fa-fw text-danger cursor-pointer align-bottom",3,"click",4,"ngIf"],["class","fas fa-sync fa-fw text-info cursor-pointer align-bottom ml-2",3,"click",4,"ngIf"],["class","fas fa-redo fa-fw text-info cursor-pointer fa-flip-horizontal align-bottom ml-2",3,"click",4,"ngIf"],["class","btn btn-primary btn-sm float-right","sava-no-dbl-click","","type","button",3,"disabled","click",4,"ngIf"],["type","button",1,"btn","btn-sm","btn-secondary","float-right","mr-1",3,"click"],[1,"fas","fa-times","text-danger","fa-fw"],["href","javascript:;","class","text-danger float-right mr-1",3,"click",4,"ngIf"],[3,"modalId","editorOptionsMonacoEditorModal","modalTitle"],["monacoEditorModalC",""],[3,"frameId","modalId","docsHostPort"],["insertCodeModalC",""],[1,"fas","fa-plus","text-success","fa-fw","mr-1"],["class","text-warning pl-5","pTooltip","Instance",4,"ngIf"],[1,"ml-2"],["class","text-light ml-2","pTooltip","Database",4,"ngIf"],["class","text-success ml-2","pTooltip","Collection",4,"ngIf"],["pTooltip","Instance",1,"text-warning","pl-5"],["pTooltip","Database",1,"text-light","ml-2"],["pTooltip","Collection",1,"text-success","ml-2"],[1,"far","fa-eye","text-info","fa-fw","mr-1"],[1,"fas","fa-pencil-alt","text-light","fa-fw","mr-1"],[3,"isSchemaEditor","editorOptions","editorGenerated"],["editorSchemaNative",""],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s"],[1,"far","fa-trash-alt","fa-fw","text-danger","cursor-pointer","align-bottom",3,"click"],[1,"fas","fa-sync","fa-fw","text-info","cursor-pointer","align-bottom","ml-2",3,"click"],[1,"fas","fa-redo","fa-fw","text-info","cursor-pointer","fa-flip-horizontal","align-bottom","ml-2",3,"click"],["sava-no-dbl-click","","type","button",1,"btn","btn-primary","btn-sm","float-right",3,"disabled","click"],[1,"fas","fa-save","text-success","fa-fw","mr-1"],["href","javascript:;",1,"text-danger","float-right","mr-1",3,"click"]],template:function(g,m){1&g&&(n.TgZ(0,"div",0)(1,"div",1)(2,"div",2)(3,"div",3),n.YNc(4,fe,11,3,"span",4),n.YNc(5,ce,3,0,"span",4),n.YNc(6,ue,11,3,"span",4),n.TgZ(7,"div",5)(8,"button",6),n.NdJ("click",function(){return m.hideModal()}),n.TgZ(9,"span",7),n._UZ(10,"i",8),n.qZA()(),n.TgZ(11,"span",9),n.NdJ("click",function(){return m.showInsertCodeModel()}),n._UZ(12,"i",10),n.qZA()()(),n.TgZ(13,"div",11)(14,"p-tabView")(15,"p-tabPanel",12),n.YNc(16,Ce,4,3,"div",13),n.qZA(),n.TgZ(17,"p-tabPanel",14)(18,"div",15)(19,"app-monaco-editor",16),n.NdJ("editorGenerated",function(_){return m.editorAnalysis=_}),n.qZA(),n.YNc(20,ve,1,0,"p-progressSpinner",17),n.qZA()()()(),n.TgZ(21,"div",18)(22,"div",19),n.YNc(23,Se,1,0,"i",20),n.YNc(24,De,1,0,"i",21),n.YNc(25,be,1,0,"i",22),n.YNc(26,Te,4,3,"button",23),n.TgZ(27,"button",24),n.NdJ("click",function(){return m.hideModal()}),n._UZ(28,"i",25),n._uU(29," Close"),n.qZA(),n.YNc(30,C,2,1,"a",26),n.qZA()()()()(),n._UZ(31,"app-monaco-editor-modal",27,28)(33,"app-insert-code-modal",29,30)),2&g&&(n.xp6(4),n.Q6J("ngIf",m.mode===m.EFormMode.ADD),n.xp6(1),n.Q6J("ngIf",m.mode===m.EFormMode.VIEW),n.xp6(1),n.Q6J("ngIf",m.mode===m.EFormMode.EDIT),n.xp6(9),n.MGl("header","",m.mode===m.EFormMode.ADD?"Create":"Update"," Schema"),n.xp6(1),n.Q6J("ngIf",m.shouldLoadMonacoEditor),n.xp6(3),n.Q6J("editorOptions",m.editorOptionsAnalysis),n.xp6(1),n.Q6J("ngIf",m.loading.form),n.xp6(3),n.Q6J("ngIf",m.mode===m.EFormMode.EDIT),n.xp6(1),n.Q6J("ngIf",m.mode===m.EFormMode.EDIT&&!m.isDiffEditorEnable),n.xp6(1),n.Q6J("ngIf",m.mode===m.EFormMode.EDIT&&m.isDiffEditorEnable),n.xp6(1),n.Q6J("ngIf",m.mode!==m.EFormMode.VIEW),n.xp6(4),n.Q6J("ngIf",m.lastError),n.xp6(1),n.Q6J("modalId","idMonacoEditorModalInSchema")("editorOptionsMonacoEditorModal",m.editorOptionsMonacoEditorModal)("modalTitle",m.modalTitle),n.xp6(2),n.Q6J("frameId","IdInsertCodeSchema")("modalId","IdInsertCodeSchemaModal")("docsHostPort",m.DOCS_HOST_PORT))},dependencies:[S.O5,f.y,b.P,E.O,R.G,L.xf,L.x4,X.u,ee.A],encapsulation:2})}return s})()},2571:(pe,K,r)=>{r.d(K,{d:()=>Z});var D=r(5861),e=r(6990),O=r(1162),o=r(4946),M=r(95),W=r(9961),J=r(3429),k=r(5852),N=r(7240),B=r(9530),n=r(2915),V=r(6814),t=r(2660),G=r(5431),q=r(5219),Q=r(7680);function H(h,S){1&h&&(o.TgZ(0,"tr")(1,"th",18),o._UZ(2,"p-tableHeaderCheckbox"),o.qZA(),o.TgZ(3,"th"),o._uU(4,"Collection/Table name"),o.qZA()())}function j(h,S){if(1&h&&(o.TgZ(0,"tr",19)(1,"td"),o._UZ(2,"p-tableCheckbox",20),o.qZA(),o.TgZ(3,"td"),o._uU(4),o.qZA()()),2&h){const f=S.$implicit;o.Q6J("pSelectableRow",f),o.xp6(2),o.Q6J("value",f)("pSelectableRow",f),o.xp6(2),o.Oqu(f.name)}}function y(h,S){1&h&&o._UZ(0,"p-progressSpinner",21)}function P(h,S){1&h&&o._UZ(0,"p-progressSpinner",21)}let Z=(()=>{class h{fb;ns;instanceS;authCS;generalS;schemaS;cd;eventCenterS;subscriptions=[];loading={grid:!1};rows=[];rowsMap={};selectedRows=[];gridKey=O.iH._id;constructor(f,b,E,R,L,X,ee,te){this.fb=f,this.ns=b,this.instanceS=E,this.authCS=R,this.generalS=L,this.schemaS=X,this.cd=ee,this.eventCenterS=te}ngOnInit(){}loadGridData(){var f=this;return(0,D.Z)(function*(){const b=f.eventCenterS.database.selectedDatabases.value;f.loading.grid=!0,f.subscriptions.push(f.instanceS.getCollections(b).subscribe(E=>{if(E.success){f.selectedRows=[];const R=e.filter(e.flatten(E.data||[]),{schemaIsGenerated:!1});f.rows=e.flatten(R||[]),f.rowsMap=e.keyBy(f.rows,O.iH._id)}f.loading.grid=!1,f.cd.detectChanges()}))})()}showSchemaModal(){var f=this;return(0,D.Z)(function*(){$("#idBulkSchemaCreationModal").modal("show"),yield f.loadGridData()})()}hideSchemaModal(){$("#idBulkSchemaCreationModal").modal("hide")}generateSchemas(){var f=this;return(0,D.Z)(function*(){try{const b=f.selectedRows;f.loading.grid=!0;for(const E of b)try{const R=yield f.instanceS.getSchemaByInstanceName(E.instanceName,E.databaseName,E.name).toPromise(),L={instanceName:E.instanceName,collectionName:E.name,databaseName:E.databaseName,propertiesCode:R.data.fieldsString,user:f.authCS.getUserId()};(yield f.schemaS.post(L).toPromise()).success&&f.ns.showSuccess(`'${E.name}' schema created successfully.`)}catch{f.ns.showError(`'${E.name}' schema creation failed.`)}f.eventCenterS.database.selectedDatabases.next([...f.eventCenterS.database.selectedDatabases.value]),f.hideSchemaModal(),f.loading.grid=!1}catch(b){const E=b?.error?.errors||[];E.length&&f.ns.showError(E[0].message),f.loading.grid=!1}})()}ngOnDestroy(){this.generalS.unsubscribe(this.subscriptions)}static \u0275fac=function(b){return new(b||h)(o.Y36(M.qu),o.Y36(W.W),o.Y36(J.E),o.Y36(k.D),o.Y36(N.b),o.Y36(B.$),o.Y36(o.sBO),o.Y36(n.u))};static \u0275cmp=o.Xpm({type:h,selectors:[["app-w-bulk-schema-generator"]],decls:24,vars:8,consts:[["aria-hidden","true","aria-labelledby","exampleModalLabel","id","idBulkSchemaCreationModal","role","dialog","data-backdrop","static","data-keyboard","false",1,"modal"],["role","document",1,"modal-dialog"],[1,"modal-content"],[1,"modal-header"],[1,"fas","fa-plus","text-success","fa-fw","mr-1"],["aria-label","Close","data-dismiss","modal","type","button",1,"close"],["aria-hidden","true"],[1,"fas","fa-window-close"],[1,"modal-body","overflow-auto"],["styleClass","p-datatable-striped","scrollHeight","calc(100vh - 152px)",3,"selectionMode","selection","dataKey","scrollable","value","selectionChange"],["pTemplate","header"],["pTemplate","body"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s",4,"ngIf"],[1,"modal-footer"],["data-dismiss","modal","type","button",1,"btn","btn-sm","btn-secondary"],[1,"fas","fa-times","text-danger","fa-fw"],["sava-no-dbl-click","","type","button",1,"btn","btn-primary","btn-sm",3,"disabled","click"],[1,"fas","fa-save","text-success","fa-fw","mr-1"],[2,"width","45px"],[3,"pSelectableRow"],[3,"value","pSelectableRow"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s"]],template:function(b,E){1&b&&(o.TgZ(0,"div",0)(1,"div",1)(2,"div",2)(3,"div",3)(4,"span"),o._UZ(5,"i",4),o._uU(6," Bulk Schemas Create"),o.qZA(),o.TgZ(7,"button",5)(8,"span",6),o._UZ(9,"i",7),o.qZA()()(),o.TgZ(10,"div",8)(11,"p-table",9),o.NdJ("selectionChange",function(L){return E.selectedRows=L}),o.YNc(12,H,5,0,"ng-template",10),o.YNc(13,j,5,4,"ng-template",11),o.qZA(),o.YNc(14,y,1,0,"p-progressSpinner",12),o.qZA(),o.TgZ(15,"div",13)(16,"button",14),o._UZ(17,"i",15),o._uU(18," Close"),o.qZA(),o.TgZ(19,"button",16),o.NdJ("click",function(){return E.generateSchemas()}),o._UZ(20,"i",17),o.TgZ(21,"span"),o._uU(22,"Generate Schemas"),o.qZA()()(),o.YNc(23,P,1,0,"p-progressSpinner",12),o.qZA()()()),2&b&&(o.xp6(11),o.Q6J("selectionMode","multiple")("selection",E.selectedRows)("dataKey",E.gridKey)("scrollable",!0)("value",E.rows),o.xp6(3),o.Q6J("ngIf",E.loading.grid),o.xp6(5),o.Q6J("disabled",!E.selectedRows.length),o.xp6(4),o.Q6J("ngIf",E.loading.grid))},dependencies:[V.O5,t.y,G.iA,q.jx,G.Ei,G.UA,G.Mo,Q.G]})}return h})()},5597:(pe,K,r)=>{r.d(K,{H:()=>P});var D=r(5861),e=r(328),I=r(95),O=r(3157),o=r(4946),M=r(9961),W=r(3429),J=r(7240),k=r(5852),N=r(2915),B=r(6814),n=r(2660),V=r(7680);function t(Z,h){1&Z&&(o.TgZ(0,"span"),o._UZ(1,"i",19),o._uU(2," Add Database"),o.qZA())}function G(Z,h){1&Z&&(o.TgZ(0,"span"),o._UZ(1,"i",20),o._uU(2," View Database"),o.qZA())}function q(Z,h){1&Z&&(o.TgZ(0,"span"),o._UZ(1,"i",21),o._uU(2," Edit Database"),o.qZA())}function Q(Z,h){1&Z&&(o.TgZ(0,"span"),o._uU(1,"Save Database"),o.qZA())}function H(Z,h){1&Z&&(o.TgZ(0,"span"),o._uU(1,"Update Database"),o.qZA())}function j(Z,h){if(1&Z){const S=o.EpF();o.TgZ(0,"button",22),o.NdJ("click",function(){o.CHM(S);const b=o.oxw();return o.KtG(b.save())}),o._UZ(1,"i",23),o.YNc(2,Q,2,0,"span",4),o.YNc(3,H,2,0,"span",4),o.qZA()}if(2&Z){const S=o.oxw();o.Q6J("disabled",S.form.invalid),o.xp6(2),o.Q6J("ngIf",S.data.mode===S.EFormMode.ADD),o.xp6(1),o.Q6J("ngIf",S.data.mode===S.EFormMode.EDIT)}}function y(Z,h){1&Z&&o._UZ(0,"p-progressSpinner",24)}let P=(()=>{class Z{fb;ns;instanceS;generalS;authCS;eventCenter;data;loading={form:!1};EFormMode=e.D;form;subscriptions=[];constructor(S,f,b,E,R,L){this.fb=S,this.ns=f,this.instanceS=b,this.generalS=E,this.authCS=R,this.eventCenter=L}ngOnInit(){var S=this;this.createForm(),this.subscriptions.push(this.data.eventChannel.subscribe(function(){var f=(0,D.Z)(function*(b){b&&(S.form.enable(),b.action===O.F.OPEN_FORM_IN_EDIT_MODE?(S.form.reset(),S.form.patchValue({name:S.data.formData.db})):b.action===O.F.OPEN_FORM_IN_VIEW_MODE?(S.form.reset(),S.form.patchValue({name:S.data.formData.db}),S.form.disable()):b.action===O.F.OPEN_FORM_IN_ADD_MODE&&S.form.reset())});return function(b){return f.apply(this,arguments)}}()))}createForm(){this.form=this.fb.group({name:[null,[I.kI.required]]})}showModal(){$("#idDatabasesForm").modal("show")}hideModal(){$("#idDatabasesForm").modal("hide")}save(){var S=this;return(0,D.Z)(function*(){const f=S.form.getRawValue();try{S.loading.form=!0;const b=S.eventCenter.instance.selectedInstances.value[0];let E;S.data.mode===e.D.ADD&&(E=yield S.instanceS.createDatabase(b,f).toPromise()),S.ns.showSuccess(`Database ${S.data.mode===e.D.ADD?"created":"renamed"} successfully.`),S.data.eventChannel.emit({action:S.data.mode===e.D.ADD?O.F.SAVED:O.F.UPDATED}),S.loading.form=!1}catch(b){S.loading.form=!1,S.ns.showErrorFromResponse(b.error||b,"Unable to save database.")}})()}ngOnDestroy(){this.generalS.unsubscribe(this.subscriptions)}static \u0275fac=function(f){return new(f||Z)(o.Y36(I.qu),o.Y36(M.W),o.Y36(W.E),o.Y36(J.b),o.Y36(k.D),o.Y36(N.u))};static \u0275cmp=o.Xpm({type:Z,selectors:[["app-w-databases-form"]],inputs:{data:"data"},decls:23,vars:6,consts:[["aria-hidden","true","aria-labelledby","exampleModalLabel","id","idDatabasesForm","role","dialog","data-backdrop","static","data-keyboard","false",1,"modal"],["role","document",1,"modal-dialog"],[1,"modal-content"],[1,"modal-header"],[4,"ngIf"],["aria-label","Close","data-dismiss","modal","type","button",1,"close"],["aria-hidden","true"],[1,"fas","fa-window-close"],[1,"modal-body","overflow-auto"],[1,"container","pt-3",3,"formGroup"],[1,"form-group","row"],[1,"col-4","col-form-label","col-form-label-sm","text-right"],[1,"col-6"],["maxlength","50","formControlName","name","name","name","spellcheck","false","type","text","placeholder","Please provide database name",1,"form-control","form-control-sm"],[1,"modal-footer"],["data-dismiss","modal","type","button",1,"btn","btn-sm","btn-secondary"],[1,"fas","fa-times","text-danger","fa-fw"],["class","btn btn-primary btn-sm","sava-no-dbl-click","","type","button",3,"disabled","click",4,"ngIf"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s",4,"ngIf"],[1,"fas","fa-plus","text-success","fa-fw","mr-1"],[1,"far","fa-eye","text-info","fa-fw","mr-1"],[1,"fas","fa-pencil-alt","text-light","fa-fw","mr-1"],["sava-no-dbl-click","","type","button",1,"btn","btn-primary","btn-sm",3,"disabled","click"],[1,"fas","fa-save","text-success","fa-fw","mr-1"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s"]],template:function(f,b){1&f&&(o.TgZ(0,"div",0)(1,"div",1)(2,"div",2)(3,"div",3),o.YNc(4,t,3,0,"span",4),o.YNc(5,G,3,0,"span",4),o.YNc(6,q,3,0,"span",4),o.TgZ(7,"button",5)(8,"span",6),o._UZ(9,"i",7),o.qZA()()(),o.TgZ(10,"div",8)(11,"form",9)(12,"div",10)(13,"label",11),o._uU(14,"Name"),o.qZA(),o.TgZ(15,"div",12),o._UZ(16,"input",13),o.qZA()()()(),o.TgZ(17,"div",14)(18,"button",15),o._UZ(19,"i",16),o._uU(20," Close"),o.qZA(),o.YNc(21,j,4,3,"button",17),o.qZA(),o.YNc(22,y,1,0,"p-progressSpinner",18),o.qZA()()()),2&f&&(o.xp6(4),o.Q6J("ngIf",b.data.mode===b.EFormMode.ADD),o.xp6(1),o.Q6J("ngIf",b.data.mode===b.EFormMode.VIEW),o.xp6(1),o.Q6J("ngIf",b.data.mode===b.EFormMode.EDIT),o.xp6(5),o.Q6J("formGroup",b.form),o.xp6(10),o.Q6J("ngIf",b.data.mode!==b.EFormMode.VIEW),o.xp6(1),o.Q6J("ngIf",b.loading.form))},dependencies:[I._Y,I.Fj,I.JJ,I.JL,I.nD,I.sg,I.u,B.O5,n.y,V.G],encapsulation:2})}return Z})()},559:(pe,K,r)=>{r.d(K,{O:()=>Te});var D=r(5861),e=r(4946),I=r(3157),O=r(328),o=r(6212),M=r(6990),J=r(1426),k=r(7848),N=r(1162),B=r(3429),n=r(7240),V=r(9961),t=r(5219),G=r(2189),q=r(7414),Q=r(2915),H=r(95),j=r(6814),y=r(5431),P=r(7680),Z=r(3259),h=r(8057),S=r(5597),f=r(2571);const b=["databasesFormC"],E=["bulkSchemaGeneratorC"];function R(C,F){if(1&C){const s=e.EpF();e.TgZ(0,"span",15),e.NdJ("click",function(){e.CHM(s);const a=e.oxw(2);return e.KtG(a.add())}),e._UZ(1,"i",16),e.qZA()}}function L(C,F){if(1&C){const s=e.EpF();e.TgZ(0,"span",17),e.NdJ("click",function(){e.CHM(s);const a=e.oxw(2);return e.KtG(a.bulkSchemaCreation())}),e._UZ(1,"img",18),e.qZA()}}function X(C,F){if(1&C){const s=e.EpF();e.TgZ(0,"span",19),e.NdJ("click",function(){e.CHM(s);const a=e.oxw(2);return e.KtG(a.removePermanentDialog())}),e._UZ(1,"i",20),e.qZA()}}function ee(C,F){if(1&C&&(e.TgZ(0,"span")(1,"a",10),e._UZ(2,"img",11),e.qZA(),e.YNc(3,R,2,0,"span",12),e.YNc(4,L,2,0,"span",13),e.YNc(5,X,2,0,"span",14),e.qZA()),2&C){const s=e.oxw();e.xp6(3),e.Q6J("ngIf",s.eventCenterS.instance.selectedInstances.value.length>0&&s.instanceType===s.EInstanceType.MONGO_DB),e.xp6(1),e.Q6J("ngIf",s.selectedRows.length),e.xp6(1),e.Q6J("ngIf",s.selectedRows.length)}}function te(C,F){if(1&C){const s=e.EpF();e.TgZ(0,"span",21)(1,"label",22)(2,"p-checkbox",23),e.NdJ("ngModelChange",function(a){e.CHM(s);const g=e.oxw();return e.KtG(g.eventCenterS.group.apisRegex.allDatabases=a)}),e.qZA()()()}if(2&C){const s=e.oxw();e.xp6(2),e.Q6J("ngModel",s.eventCenterS.group.apisRegex.allDatabases)("binary",!0)}}function oe(C,F){if(1&C&&(e.TgZ(0,"div")(1,"div",24),e._uU(2),e.qZA()()),2&C){const s=e.oxw();e.xp6(2),e.Oqu(s.constantsS.group.allDatabasesPermitted)}}function ie(C,F){1&C&&(e.TgZ(0,"th",34),e._UZ(1,"p-tableHeaderCheckbox"),e.qZA())}function le(C,F){1&C&&(e.TgZ(0,"th",35),e._uU(1,"Pre"),e.qZA())}function me(C,F){1&C&&(e.TgZ(0,"th",35),e._uU(1,"Post"),e.qZA())}function re(C,F){1&C&&(e.TgZ(0,"th"),e._uU(1,"Size"),e.qZA())}function fe(C,F){1&C&&e._UZ(0,"th",36)}function ce(C,F){1&C&&e._UZ(0,"th",37)}function ge(C,F){if(1&C&&(e.TgZ(0,"tr"),e.YNc(1,ie,2,0,"th",30),e.TgZ(2,"th"),e._uU(3,"Name"),e.qZA(),e.YNc(4,le,2,0,"th",31),e.YNc(5,me,2,0,"th",31),e.YNc(6,re,2,0,"th",3),e.YNc(7,fe,1,0,"th",32),e.YNc(8,ce,1,0,"th",33),e.qZA()),2&C){const s=e.oxw(2);e.xp6(1),e.Q6J("ngIf",s.showCheckbox),e.xp6(3),e.Q6J("ngIf",s.showHooksCount),e.xp6(1),e.Q6J("ngIf",s.showHooksCount),e.xp6(1),e.Q6J("ngIf",!s.isDependentOnGroup&&!s.isFilterLogTable),e.xp6(1),e.Q6J("ngIf",!s.isDependentOnGroup&&!s.isFilterLogTable),e.xp6(1),e.Q6J("ngIf",s.isDependentOnGroup||s.isFilterLogTable)}}function de(C,F){if(1&C&&(e.TgZ(0,"td"),e._UZ(1,"p-tableCheckbox",43),e.qZA()),2&C){const s=e.oxw().$implicit;e.xp6(1),e.Q6J("value",s)("pSelectableRow",s)}}function _e(C,F){if(1&C&&(e.TgZ(0,"span",44),e._UZ(1,"i",45),e.qZA()),2&C){const s=e.oxw().$implicit;e.Q6J("pTooltip","Original name is : "+s.originalDBNameBeforeMask)}}function ue(C,F){if(1&C&&(e.TgZ(0,"td",46),e._uU(1),e.qZA()),2&C){const s=e.oxw().$implicit;e.xp6(1),e.Oqu(s.preHookCount||"")}}function he(C,F){if(1&C&&(e.TgZ(0,"td",46),e._uU(1),e.qZA()),2&C){const s=e.oxw().$implicit;e.xp6(1),e.Oqu(s.postHookCount||"")}}function Ce(C,F){if(1&C&&(e.TgZ(0,"td",47),e._uU(1),e.qZA()),2&C){const s=e.oxw().$implicit;e.xp6(1),e.Oqu(s.sizeUser)}}function ve(C,F){1&C&&e._UZ(0,"i",49)}function Se(C,F){if(1&C&&(e.TgZ(0,"td"),e.YNc(1,ve,1,0,"i",48),e.qZA()),2&C){const s=e.oxw().$implicit;e.xp6(1),e.Q6J("ngIf",s.databaseSettingIsCreated)}}function De(C,F){if(1&C&&(e.TgZ(0,"td")(1,"span",50),e._uU(2),e.qZA()()),2&C){const s=e.oxw().$implicit;e.xp6(2),e.Oqu(s.instanceName.toString().substring(0,3).toUpperCase())}}function be(C,F){if(1&C&&(e.TgZ(0,"tr",38),e.YNc(1,de,2,2,"td",3),e.TgZ(2,"td",39)(3,"span"),e._uU(4),e.qZA(),e.YNc(5,_e,2,1,"span",40),e.qZA(),e.YNc(6,ue,2,1,"td",41),e.YNc(7,he,2,1,"td",41),e.YNc(8,Ce,2,1,"td",42),e.YNc(9,Se,2,1,"td",3),e.YNc(10,De,3,1,"td",3),e.qZA()),2&C){const s=F.$implicit,u=e.oxw(2);e.Q6J("pSelectableRow",s),e.xp6(1),e.Q6J("ngIf",u.showCheckbox),e.xp6(3),e.Oqu(s.db),e.xp6(1),e.Q6J("ngIf",s.isMaskedName),e.xp6(1),e.Q6J("ngIf",u.showHooksCount),e.xp6(1),e.Q6J("ngIf",u.showHooksCount),e.xp6(1),e.Q6J("ngIf",!u.isDependentOnGroup&&!u.isFilterLogTable),e.xp6(1),e.Q6J("ngIf",!u.isDependentOnGroup&&!u.isFilterLogTable),e.xp6(1),e.Q6J("ngIf",u.isDependentOnGroup||u.isFilterLogTable)}}function xe(C,F){1&C&&e._UZ(0,"p-progressSpinner",51)}function Ie(C,F){if(1&C){const s=e.EpF();e.TgZ(0,"div",25)(1,"p-table",26),e.NdJ("selectionChange",function(a){e.CHM(s);const g=e.oxw();return e.KtG(g.selectedRows=a)})("selectionChange",function(){e.CHM(s);const a=e.oxw();return e.KtG(a.databaseSelected())}),e.YNc(2,ge,9,6,"ng-template",27),e.YNc(3,be,11,9,"ng-template",28),e.qZA(),e.YNc(4,xe,1,0,"p-progressSpinner",29),e.qZA()}if(2&C){const s=e.oxw();e.xp6(1),e.Q6J("selectionMode","multiple")("metaKeySelection",s.metaKeySelection)("selection",s.selectedRows)("dataKey",s.gridKey)("scrollable",!0)("value",s.rows),e.xp6(3),e.Q6J("ngIf",s.loading.grid)}}let Te=(()=>{class C{instanceS;generalS;notificationS;confirmationService;navigationCS;constantsS;cd;eventCenterS;isReadOnly=!1;showCheckbox=!0;showHooksCount=!1;isDependentOnGroup=!1;isFilterLogTable=!1;metaKeySelection=!0;loading={grid:!1};subscriptions=[];data={mode:O.D.ADD,eventChannel:new e.vpe,formData:void 0};rows=[];rowsMap={};instanceType;EInstanceType=k.d;selectedRows=[];gridKey=N.iH._id;databasesFormC;bulkSchemaGeneratorC;constructor(s,u,a,g,m,U,_,x){this.instanceS=s,this.generalS=u,this.notificationS=a,this.confirmationService=g,this.navigationCS=m,this.constantsS=U,this.cd=_,this.eventCenterS=x}ngOnInit(){var s=this;this.subscriptions.push(this.data.eventChannel.subscribe(function(){var u=(0,D.Z)(function*(a){(a.action===I.F.SAVED||a.action===I.F.UPDATED)&&(s.databasesFormC.hideModal(),yield s.loadGridData())});return function(a){return u.apply(this,arguments)}}())),this.eventCenterS.database.selectedDatabases.next([]),this.subscriptions.push(this.isFilterLogTable?this.eventCenterS.filterInLog.instanceIds.pipe((0,J.b)(300)).subscribe(function(){var u=(0,D.Z)(function*(a){yield s.loadGridData()});return function(a){return u.apply(this,arguments)}}()):this.isDependentOnGroup?this.eventCenterS.group.instanceIds.pipe((0,J.b)(300)).subscribe(function(){var u=(0,D.Z)(function*(a){yield s.loadGridData()});return function(a){return u.apply(this,arguments)}}()):this.eventCenterS.instance.selectedInstances.pipe((0,J.b)(300)).subscribe(function(){var u=(0,D.Z)(function*(a){const g=a[0];s.instanceType=g?g.type:void 0,yield s.resetGridAndUrl(),yield s.loadGridData()});return function(a){return u.apply(this,arguments)}}())),this.subscriptions.push(this.eventCenterS.schemaSaved.subscribe(function(){var u=(0,D.Z)(function*(a){a&&(yield s.loadGridData())});return function(a){return u.apply(this,arguments)}}()))}loadGridData(){var s=this;return(0,D.Z)(function*(){let u=[];if(s.isDependentOnGroup){if(u=s.eventCenterS.group.instanceIds.value,!u.length)return void s.resetGridAndUrl()}else if(s.isFilterLogTable){if(u=s.eventCenterS.filterInLog.instanceIds.value,!u.length)return void s.resetGridAndUrl()}else if(u=s.eventCenterS.instance.selectedInstances.value,!u||0===u.length||!u[0].active)return void s.resetGridAndUrl();s.loading.grid=!0,s.subscriptions.push(s.instanceS.getDatabases(u).subscribe(function(){var a=(0,D.Z)(function*(g){if(g.success){s.selectedRows=[],s.rows=M.flatten(g.data||[]);for(const m of s.rows)m.sizeUser="number"==typeof m.storageSize?s.generalS.bytesToSize(m.storageSize):m.storageSize;s.rowsMap=M.keyBy(s.rows,N.iH._id)}else s.resetGridAndUrl();if(s.showHooksCount&&(yield s.instanceS.setHooksCountInDatabaseArr(u[0].name,s.rows)),s.isDependentOnGroup||s.isFilterLogTable){let _;s.isDependentOnGroup?_=s.eventCenterS.group.databaseNames.value:s.isFilterLogTable&&(_=s.eventCenterS.filterInLog.databaseIds.value);const x=M.intersection(M.keys(s.rowsMap),_),l=[];for(const v of x)s.rowsMap[v]&&l.push(s.rowsMap[v]);s.selectedRows=l,s.eventCenterS.database.selectedDatabases.next(l),s.setDatabaseIds(l)}else{const m=s.navigationCS.getQueryParam(o.p.database);if(m){const U=m.split(","),_=M.intersection(M.keys(s.rowsMap),U),x=[];for(const l of _)s.rowsMap[l]&&x.push(s.rowsMap[l]);s.selectedRows=x,s.eventCenterS.database.selectedDatabases.next(x),s.setDatabaseIds(x)}}s.loading.grid=!1,s.cd.detectChanges()});return function(g){return a.apply(this,arguments)}}(),a=>{s.loading.grid=!1,s.notificationS.showErrorMessageFromErrorObject(a),s.resetGridAndUrl()}))})()}resetGridAndUrl(){var s=this;return(0,D.Z)(function*(){s.rows=[],s.selectedRows=[],s.rowsMap={},s.eventCenterS.database.selectedDatabases.next([]),s.eventCenterS.group.databaseNames.next([])})()}add(){this.data.formData=void 0,this.data.mode=O.D.ADD,this.data.eventChannel.emit({action:I.F.OPEN_FORM_IN_ADD_MODE}),this.databasesFormC.showModal()}bulkSchemaCreation(){var s=this;return(0,D.Z)(function*(){s.data.formData=void 0,s.data.mode=O.D.ADD,s.data.eventChannel.emit({action:I.F.OPEN_FORM_IN_ADD_MODE}),yield s.bulkSchemaGeneratorC.showSchemaModal()})()}view(){this.data.formData=this.selectedRows[0],this.data.mode=O.D.VIEW,this.data.eventChannel.emit({action:I.F.OPEN_FORM_IN_VIEW_MODE}),this.databasesFormC.showModal()}removePermanentDialog(){var s=this;return(0,D.Z)(function*(){let u=s.constantsS.database.removePermanentConfirm;var a;u=u.replace("'$$'",s.selectedRows[0].db),s.confirmationService.confirm({message:u,header:"Confirmation",icon:"pi pi-exclamation-triangle",accept:(a=(0,D.Z)(function*(){yield s.removePermanent()}),function(){return a.apply(this,arguments)})})})()}removePermanent(){var s=this;return(0,D.Z)(function*(){const u=s.eventCenterS.instance.selectedInstances.value[0],a=s.selectedRows[0].db;s.loading.grid=!0;try{const g=yield s.instanceS.dropDatabase(u,a).toPromise();s.loading.grid=!1,g.success?(s.notificationS.showSuccess(s.constantsS.database.removePermanent),s.selectedRows.length=0,s.loadGridData()):s.notificationS.showErrorFromResponse(g,s.constantsS.database.removePermanentError)}catch(g){s.notificationS.showErrorMessageFromErrorObject(g),s.loading.grid=!1}})()}databaseSelected(){var s=this;return(0,D.Z)(function*(){s.eventCenterS.database.selectedDatabases.next(s.selectedRows),s.isDependentOnGroup||s.isFilterLogTable?s.setDatabaseIds(s.selectedRows):(yield s.navigationCS.setQueryParam(o.p.database,M.map(s.selectedRows,"_id").join(",")||null),yield s.generalS.resetUrlParams([o.p.collection,o.p.collection_api]))})()}setDatabaseIds(s){const u=M.map(s=s||[],"_id");this.eventCenterS.group.databaseNames.next(u),this.eventCenterS.filterInLog.databaseIds.next(u),this.eventCenterS.filterInLog.databaseNames.next(M.map(s,"db"))}ngOnDestroy(){this.generalS.unsubscribe(this.subscriptions)}static \u0275fac=function(u){return new(u||C)(e.Y36(B.E),e.Y36(n.b),e.Y36(V.W),e.Y36(t.YP),e.Y36(G.S),e.Y36(q.L),e.Y36(e.sBO),e.Y36(Q.u))};static \u0275cmp=e.Xpm({type:C,selectors:[["app-w-databases"]],viewQuery:function(u,a){if(1&u&&(e.Gf(b,5),e.Gf(E,5)),2&u){let g;e.iGM(g=e.CRH())&&(a.databasesFormC=g.first),e.iGM(g=e.CRH())&&(a.bulkSchemaGeneratorC=g.first)}},inputs:{isReadOnly:["IsReadOnly","isReadOnly"],showCheckbox:"showCheckbox",showHooksCount:"showHooksCount",isDependentOnGroup:["IsDependentOnGroup","isDependentOnGroup"],isFilterLogTable:["IsFilterLogTable","isFilterLogTable"],metaKeySelection:"metaKeySelection"},decls:14,vars:5,consts:[[1,"card","shadow-sm","h-100"],[1,"card-header"],[1,"fas","fa-database","text-warning","fa-fw","mr-1"],[4,"ngIf"],["class","float-right cursor-pointer","pTooltip","All Databases",4,"ngIf"],[1,"card-body","p-0","h-100","overflow-hidden"],["class","h-100",4,"ngIf"],[3,"data"],["databasesFormC",""],["bulkSchemaGeneratorC",""],["href","https://docs.apimaker.dev/v1/docs/pages/instance-database-collection-apis-page.html#databases","target","_blank"],["src","/assets/images/logo/logo_docs.svg",1,"float-right","fa-fw","ml-3",2,"font-size","25px"],["class","float-right cursor-pointer ml-3","pTooltip","Add New Database",3,"click",4,"ngIf"],["class","float-right cursor-pointer ml-3","pTooltip","Bulk Schema Creation",3,"click",4,"ngIf"],["class","float-right cursor-pointer ml-3","pTooltip","Permanently Delete",3,"click",4,"ngIf"],["pTooltip","Add New Database",1,"float-right","cursor-pointer","ml-3",3,"click"],[1,"fas","fa-plus","text-success","fa-fw"],["pTooltip","Bulk Schema Creation",1,"float-right","cursor-pointer","ml-3",3,"click"],["src","/assets/images/icons/bulkschema.svg",2,"width","18px","margin-left","1px","margin-bottom","3px"],["pTooltip","Permanently Delete",1,"float-right","cursor-pointer","ml-3",3,"click"],[1,"far","fa-trash-alt","fa-fw","text-danger"],["pTooltip","All Databases",1,"float-right","cursor-pointer"],[1,"mb-0","mt--2px"],[3,"ngModel","binary","ngModelChange"],[1,"p-2","text-center","text-success"],[1,"h-100"],["styleClass","p-datatable-striped database-grid-height","scrollHeight","flex",3,"selectionMode","metaKeySelection","selection","dataKey","scrollable","value","selectionChange"],["pTemplate","header"],["pTemplate","body"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s",4,"ngIf"],["style","width: 45px;",4,"ngIf"],["class","text-center","style","width: 40px;",4,"ngIf"],["style","width: 42px;",4,"ngIf"],["style","width: 50px;",4,"ngIf"],[2,"width","45px"],[1,"text-center",2,"width","40px"],[2,"width","42px"],[2,"width","50px"],[3,"pSelectableRow"],[1,"word-break-all"],["class","pl-2",3,"pTooltip",4,"ngIf"],["class","text-center",4,"ngIf"],["class","nowrap",4,"ngIf"],[3,"value","pSelectableRow"],[1,"pl-2",3,"pTooltip"],[1,"fas","fa-theater-masks","fa-fw","text-info"],[1,"text-center"],[1,"nowrap"],["pTooltip","Database settings are there.","class","fas fa-cog text-danger fa-fw cursor-pointer",4,"ngIf"],["pTooltip","Database settings are there.",1,"fas","fa-cog","text-danger","fa-fw","cursor-pointer"],[1,"text-monospace","small"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s"]],template:function(u,a){1&u&&(e.TgZ(0,"div",0)(1,"div",1)(2,"span"),e._UZ(3,"i",2),e._uU(4," Databases"),e.qZA(),e.YNc(5,ee,6,3,"span",3),e.YNc(6,te,3,2,"span",4),e.qZA(),e.TgZ(7,"div",5),e.YNc(8,oe,3,1,"div",3),e.YNc(9,Ie,5,7,"div",6),e.qZA()(),e._UZ(10,"app-w-databases-form",7,8)(12,"app-w-bulk-schema-generator",null,9)),2&u&&(e.xp6(5),e.Q6J("ngIf",!a.isReadOnly),e.xp6(1),e.Q6J("ngIf",a.isDependentOnGroup),e.xp6(2),e.Q6J("ngIf",a.eventCenterS.group.apisRegex.allInstances||a.eventCenterS.filterInLog.apisRegex.allInstances||a.eventCenterS.group.apisRegex.allDatabases),e.xp6(1),e.Q6J("ngIf",!(a.eventCenterS.group.apisRegex.allInstances||a.eventCenterS.filterInLog.apisRegex.allInstances||a.eventCenterS.group.apisRegex.allDatabases)),e.xp6(1),e.Q6J("data",a.data))},dependencies:[H.JJ,H.On,j.O5,y.iA,t.jx,y.Ei,y.UA,y.Mo,P.G,Z.u,h.XZ,S.H,f.d]})}return C})()},4211:(pe,K,r)=>{r.r(K),r.d(K,{DbCellM:()=>lt});var D=r(7664),e=r(8176),I=r(3726),O=r(1678),o=r(9184),M=r(559),J=(r(5597),r(6937)),N=(r(241),r(740)),B=r(6162),n=r(2452),V=r(553),t=r(4946),G=r(2915),q=r(5860),Q=r(5219),H=r(5043),j=r(3885),y=r(5861),P=r(1426),Z=r(7672),h=r(9361),S=r(1162),f=r(5085),b=r(9394),E=r(1601),R=r(3531),L=r(9989),X=r(8883),ee=r(5561),te=r(9961),oe=r(3429),ie=r(5852),le=r(7414),me=r(2304),re=r(7240),fe=r(5394),ce=r(6814),ge=r(756),de=r(7680),_e=r(3259),ue=r(5025);const he=["monacoEditorModalC"];function Ce(d,A){1&d&&(t.TgZ(0,"a",14),t._UZ(1,"img",15),t.qZA())}function ve(d,A){1&d&&(t.TgZ(0,"a",16),t._UZ(1,"img",15),t.qZA())}function Se(d,A){1&d&&(t.TgZ(0,"a",17),t._UZ(1,"img",15),t.qZA())}function De(d,A){if(1&d){const i=t.EpF();t.TgZ(0,"span",18),t.NdJ("click",function(){t.CHM(i);const p=t.oxw();return t.KtG(p.save())}),t._UZ(1,"i",19),t.qZA()}}function be(d,A){if(1&d){const i=t.EpF();t.TgZ(0,"span",20),t.NdJ("click",function(){t.CHM(i);const p=t.oxw();return t.KtG(p.removePermanentDialog(p.mode))}),t._UZ(1,"i",21),t.qZA()}}function xe(d,A){if(1&d){const i=t.EpF();t.TgZ(0,"span",22),t.NdJ("click",function(){t.CHM(i);const p=t.oxw();return t.KtG(p.showInsertCodeModel())}),t._UZ(1,"i",23),t.qZA()}}function Ie(d,A){if(1&d){const i=t.EpF();t.TgZ(0,"a",24),t.NdJ("click",function(){t.CHM(i);const p=t.oxw();return t.KtG(p.viewError())}),t._uU(1,"View error"),t.qZA()}}function Te(d,A){1&d&&(t.TgZ(0,"span"),t._uU(1,"Add API Settings"),t.qZA())}function C(d,A){1&d&&(t.TgZ(0,"span"),t._uU(1,"Add Collection Settings"),t.qZA())}function F(d,A){1&d&&(t.TgZ(0,"span"),t._uU(1,"Add Database Settings"),t.qZA())}function s(d,A){if(1&d){const i=t.EpF();t.TgZ(0,"div",30)(1,"button",31),t.NdJ("click",function(){t.CHM(i);const p=t.oxw(2);return t.KtG(p.save())}),t._UZ(2,"i",32),t.YNc(3,Te,2,0,"span",33),t.YNc(4,C,2,0,"span",33),t.YNc(5,F,2,0,"span",33),t.qZA()()}if(2&d){const i=t.oxw(2);t.xp6(3),t.Q6J("ngIf",i.mode===i.EInstanceApiWidgetMode.API),t.xp6(1),t.Q6J("ngIf",i.mode===i.EInstanceApiWidgetMode.Collection),t.xp6(1),t.Q6J("ngIf",i.mode===i.EInstanceApiWidgetMode.Database)}}function u(d,A){1&d&&t._UZ(0,"p-progressSpinner",34)}function a(d,A){if(1&d){const i=t.EpF();t.TgZ(0,"div",25),t.YNc(1,s,6,3,"div",26),t.TgZ(2,"div",27)(3,"app-monaco-editor",28),t.NdJ("editorGenerated",function(p){t.CHM(i);const w=t.oxw();return t.KtG(w.editorGenerated(p))}),t.qZA()(),t.YNc(4,u,1,0,"p-progressSpinner",29),t.qZA()}if(2&d){const i=t.oxw();t.xp6(1),t.Q6J("ngIf",!i.insApiSetting._id),t.xp6(1),t.Q6J("hidden",!i.insApiSetting._id),t.xp6(1),t.Q6J("hidden",!i.insApiSetting._id)("isSchemaEditor",!0)("editorOptions",i.editorOptionsInsApiSettingApi),t.xp6(1),t.Q6J("ngIf",i.loading.form)}}let g=(()=>{class d{groupS;navigationS;ns;instanceS;authCS;eventCenterS;constantsS;monacoS;generalCS;instanceApiSettingsS;confirmationService;cd;mode=n.a.API;insertCodeModalC;loading={form:!1};subscriptions=[];data={};EInstanceApiWidgetMode=n.a;EAPIAccessType=Z.di;editorInsApiSettingApiCode;editorOptionsInsApiSettingApi={readOnly:!1,language:"typescript",contextmenu:!0};lastError;editorOptionsMonacoEditorModal={readOnly:!0,language:"json",contextmenu:!0};insApiSetting={};BE_HOST_PORT=V.N.BE_HOST_PORT;monacoDecorations=[];tab;modalId;viewDockerfileModelC;constructor(i,c,p,w,Ae,Me,Ze,rt,ct,dt,_t,pt){this.groupS=i,this.navigationS=c,this.ns=p,this.instanceS=w,this.authCS=Ae,this.eventCenterS=Me,this.constantsS=Ze,this.monacoS=rt,this.generalCS=ct,this.instanceApiSettingsS=dt,this.confirmationService=_t,this.cd=pt}ngOnInit(){var i=this;this.mode===n.a.API?(this.subscriptions.push(this.eventCenterS.colApi.selectedApi.pipe((0,P.b)(300)).subscribe(function(){var c=(0,y.Z)(function*(p){if(!p)return i.data.selectedItem=void 0;i.data.selectedItem=p,yield i.setDataInForm(i.data.selectedItem),i.cd.detectChanges()});return function(p){return c.apply(this,arguments)}}())),this.modalId="idMonacoEditorModalInInsApiSettings"):this.mode===n.a.Collection?(this.subscriptions.push(this.eventCenterS.collection.selectedCollections.pipe((0,P.b)(300)).subscribe(function(){var c=(0,y.Z)(function*(p){if(!p||0===p.length)return i.data.selectedItem=void 0;i.data.selectedItem=p[0],i.lastError=void 0,yield i.setDataInForm(i.data.selectedItem),i.cd.detectChanges()});return function(p){return c.apply(this,arguments)}}())),this.modalId="idMonacoEditorModalInColSettings"):this.mode===n.a.Database&&(this.subscriptions.push(this.eventCenterS.database.selectedDatabases.pipe((0,P.b)(300)).subscribe(function(){var c=(0,y.Z)(function*(p){if(!p||0===p.length)return i.data.selectedItem=void 0;i.data.selectedItem=p[0],i.lastError=void 0,yield i.setDataInForm(i.data.selectedItem),i.cd.detectChanges()});return function(p){return c.apply(this,arguments)}}())),this.modalId="idMonacoEditorModalInDatabaseSettings")}setDataInForm(i){var c=this;return(0,y.Z)(function*(){c.loading.form=!0,c.lastError=void 0,c.insApiSetting=(yield c.instanceApiSettingsS.getSettings(i,c.mode))||{},(c.mode===n.a.API||c.mode===n.a.Collection||c.mode===n.a.Database)&&c.setDataInFormCommon(),c.loading.form=!1})()}setDataInFormCommon(){var i=this;return(0,y.Z)(function*(){if(i.insApiSetting._id)i.generalCS.setValueInEditor(i,"editorInsApiSettingApiCode",i.insApiSetting.instanceApiSettingCode);else if(!i.insApiSetting._id)if(i.mode===n.a.API){const c=yield i.instanceS.getDefaultContent(i.BE_HOST_PORT,f.R.INSTANCE_API_SETTINGS_JSON).toPromise();i.generalCS.setValueInEditor(i,"editorInsApiSettingApiCode",c.data)}else if(i.mode===n.a.Collection||i.mode===n.a.Database){let c;i.mode===n.a.Database?c=yield i.instanceS.getDefaultContent(i.BE_HOST_PORT,f.R.DATABASE_SETTINGS_JSON).toPromise():i.mode===n.a.Collection&&(c=yield i.instanceS.getDefaultContent(i.BE_HOST_PORT,f.R.COLLECTION_SETTINGS_JSON).toPromise()),i.generalCS.setValueInEditor(i,"editorInsApiSettingApiCode",c.data)}i.cd.detectChanges()})()}editorGenerated(i){var c=this;return(0,y.Z)(function*(){c.editorInsApiSettingApiCode=i,yield c.monacoS.loadSchemaEditorSettings(c.BE_HOST_PORT,c.authCS.getUserId(),null),c.monacoS.addSaveCodeKeyBinding(i,p=>{c.insApiSetting._id&&c.save()}),c.monacoS.addInsertCodeKeyBinding(i,p=>{c.defineEditor(),c.insertCodeModalC.showModal(R.b.InstanceApiSettingsC)}),c.subscriptions.push(c.generalCS.messageReceived.subscribe(p=>{p.type&&p.type===L.g.TEXT_COPIED&&p.componentName===R.b.InstanceApiSettingsC&&(c.generalCS.messageReceivedFor===h.H.DatabaseSettings&&c.mode===n.a.Database||c.generalCS.messageReceivedFor===h.H.CollectionSettings&&c.mode===n.a.Collection||c.generalCS.messageReceivedFor===h.H.APISettings&&c.mode===n.a.API)&&(c.monacoS.insertAtCursor(i,p.selectedText),c.insertCodeModalC.hideModal())}))})()}defineEditor(){this.mode===n.a.Database?this.generalCS.messageReceivedFor=h.H.DatabaseSettings:this.mode===n.a.Collection?this.generalCS.messageReceivedFor=h.H.CollectionSettings:this.mode===n.a.API&&(this.generalCS.messageReceivedFor=h.H.APISettings)}showInsertCodeModel(){this.defineEditor(),this.insertCodeModalC.showModal(R.b.InstanceApiSettingsC)}save(){var i=this;return(0,y.Z)(function*(){let p,c={};if(i.data.selectedItem){if(i.mode===n.a.API||i.mode===n.a.Collection?p=i.data.selectedItem.databaseName:i.mode===n.a.Database&&(p=i.data.selectedItem.db),c.instanceName=i.data.selectedItem.instanceName,c.databaseName=p,i.mode===n.a.API){const w=i.data.selectedItem;c.collectionName=w.collectionName,c.apiId=w.id,c.instanceApiSettingCode=i.editorInsApiSettingApiCode.getValue()}else i.mode===n.a.Collection?(c.collectionName=i.data.selectedItem.name,c.apiId=b.pj.__COLLECTION_SETTINGS__,c.instanceApiSettingCode=i.editorInsApiSettingApiCode.getValue()):i.mode===n.a.Database&&(c.collectionName=b.pj.__DATABASE_SETTINGS__,c.apiId=b.pj.__DATABASE_SETTINGS__,c.instanceApiSettingCode=i.editorInsApiSettingApiCode.getValue());c.user=i.authCS.getUserId(),c=Object.assign({},i.insApiSetting||{},c);try{let w;i.loading.form=!0,i.lastError=void 0,i.monacoS.clearEditorDecorations(i.editorInsApiSettingApiCode,i.monacoDecorations),i.insApiSetting._id?i.insApiSetting._id&&(w=yield i.instanceApiSettingsS.replace(i.insApiSetting._id,c,{select:S.iH._id}).toPromise()):(w=yield i.instanceApiSettingsS.post(c).toPromise(),i.insApiSetting=w.data),i.ns.showSuccess(i.constantsS.tpApiSettings.addOrUpdateSuccess);const Me=i.eventCenterS.database.selectedDatabases.value[0],Ze=i.eventCenterS.instance.selectedInstances.value[0];i.mode===n.a.API?i.eventCenterS.collection.selectedCollections.next([i.eventCenterS.collection.selectedCollections.value[0]]):i.mode===n.a.Collection?i.eventCenterS.database.selectedDatabases.next([Me]):i.mode===n.a.Database&&i.eventCenterS.instance.selectedInstances.next([Ze]),i.loading.form=!1}catch(w){i.loading.form=!1,i.ns.showErrorFromResponse(w.error||w,"Unable to save instance."),i.lastError=w.error,i.tab=i.tab||{},i.tab.axiosResponse={data:w.error},i.monacoS.highlightErrorInMonacoEditor(i.editorInsApiSettingApiCode,i.tab,"MainSandbox.ts",i.monacoDecorations)}}})()}confirmMessage="";removePermanentDialog(i){var c=this;return(0,y.Z)(function*(){i===n.a.API?(c.confirmMessage=c.constantsS.instanceApiSettings.removePermanentConfirm,c.removePermanentDialogCommonCode(i)):i===n.a.Collection?(c.confirmMessage=c.constantsS.instanceCollectionSettings.removePermanentConfirm,c.removePermanentDialogCommonCode(i)):i===n.a.Database&&(c.confirmMessage=c.constantsS.instanceDatabaseSettings.removePermanentConfirm,c.removePermanentDialogCommonCode(i))})()}removePermanentDialogCommonCode(i){var p,c=this;this.confirmationService.confirm({message:this.confirmMessage,header:"Confirmation",icon:"pi pi-exclamation-triangle",accept:(p=(0,y.Z)(function*(){yield c.removePermanent(i)}),function(){return p.apply(this,arguments)})})}removePermanent(i){var c=this;return(0,y.Z)(function*(){c.loading.form=!0;const p=yield c.instanceApiSettingsS.permanentDelete(c.insApiSetting._id).toPromise();c.loading.form=!1,i===n.a.API?p?(c.ns.showSuccess(c.constantsS.instanceApiSettings.removePermanent),c.eventCenterS.collection.selectedCollections.next([c.eventCenterS.collection.selectedCollections.value[0]]),c.resetObj()):c.ns.showErrorFromResponse(p,c.constantsS.instanceApiSettings.removePermanentError):i===n.a.Collection?p?(c.ns.showSuccess(c.constantsS.instanceCollectionSettings.removePermanent),c.eventCenterS.database.selectedDatabases.next([c.eventCenterS.database.selectedDatabases.value[0]]),c.resetObj()):c.ns.showErrorFromResponse(p,c.constantsS.instanceCollectionSettings.removePermanentError):i===n.a.Database&&(p?(c.ns.showSuccess(c.constantsS.instanceDatabaseSettings.removePermanent),c.eventCenterS.instance.selectedInstances.next([c.eventCenterS.instance.selectedInstances.value[0]]),c.resetObj()):c.ns.showErrorFromResponse(p,c.constantsS.instanceDatabaseSettings.removePermanentError))})()}resetObj(){this.insApiSetting={},this.cd.detectChanges()}viewError(){this.viewDockerfileModelC.showModal(this.generalCS.stringify(this.lastError),E.d.json)}ngOnDestroy(){this.generalCS.unsubscribe(this.subscriptions)}static \u0275fac=function(c){return new(c||d)(t.Y36(X.e),t.Y36(ee.X),t.Y36(te.W),t.Y36(oe.E),t.Y36(ie.D),t.Y36(G.u),t.Y36(le.L),t.Y36(me.b),t.Y36(re.b),t.Y36(fe.f),t.Y36(Q.YP),t.Y36(t.sBO))};static \u0275cmp=t.Xpm({type:d,selectors:[["app-w-instance-api-settings"]],viewQuery:function(c,p){if(1&c&&t.Gf(he,5),2&c){let w;t.iGM(w=t.CRH())&&(p.viewDockerfileModelC=w.first)}},inputs:{mode:"mode",insertCodeModalC:"insertCodeModalC"},decls:16,vars:12,consts:[[1,"card","shadow-sm","h-100"],[1,"card-header"],[1,"fas","fa-cog","text-danger","fa-fw","mr-1"],["href","https://docs.apimaker.dev/v1/docs/settings/apiSettings.html","target","_blank",4,"ngIf"],["href","https://docs.apimaker.dev/v1/docs/settings/collectionSettings.html","target","_blank",4,"ngIf"],["href","https://docs.apimaker.dev/v1/docs/settings/databaseSettings.html","target","_blank",4,"ngIf"],["class","float-right cursor-pointer ml-3","pTooltip","Save",3,"click",4,"ngIf"],["class","float-right cursor-pointer ml-3","pTooltip","Delete",3,"click",4,"ngIf"],["class","float-right cursor-pointer ml-3","pTooltip","Insert Code",3,"click",4,"ngIf"],["href","javascript:;","class","text-danger float-right",3,"click",4,"ngIf"],[1,"card-body","p-0","h-100","overflow-hidden"],["class","position-relative border-top h-100",4,"ngIf"],[3,"modalId","editorOptionsMonacoEditorModal","modalTitle"],["monacoEditorModalC",""],["href","https://docs.apimaker.dev/v1/docs/settings/apiSettings.html","target","_blank"],["src","/assets/images/logo/logo_docs.svg",1,"float-right","fa-fw","ml-3",2,"font-size","25px"],["href","https://docs.apimaker.dev/v1/docs/settings/collectionSettings.html","target","_blank"],["href","https://docs.apimaker.dev/v1/docs/settings/databaseSettings.html","target","_blank"],["pTooltip","Save",1,"float-right","cursor-pointer","ml-3",3,"click"],[1,"fas","fa-save","fa-fw","text-success"],["pTooltip","Delete",1,"float-right","cursor-pointer","ml-3",3,"click"],[1,"far","fa-trash-alt","fa-fw","text-danger"],["pTooltip","Insert Code",1,"float-right","cursor-pointer","ml-3",3,"click"],[1,"fas","fa-info-circle","text-info","fa-fw"],["href","javascript:;",1,"text-danger","float-right",3,"click"],[1,"position-relative","border-top","h-100"],["class","p-1 text-center",4,"ngIf"],[1,"overflow-hidden",2,"height","calc(50vh - 68px)",3,"hidden"],[3,"hidden","isSchemaEditor","editorOptions","editorGenerated"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s",4,"ngIf"],[1,"p-1","text-center"],["type","button",1,"btn","btn-primary","btn-sm",3,"click"],[1,"fas","fa-plus","text-success","fa-fw","align-middle","mr-1"],[4,"ngIf"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s"]],template:function(c,p){1&c&&(t.TgZ(0,"div",0)(1,"div",1)(2,"span"),t._UZ(3,"i",2),t._uU(4),t.qZA(),t.YNc(5,Ce,2,0,"a",3),t.YNc(6,ve,2,0,"a",4),t.YNc(7,Se,2,0,"a",5),t.YNc(8,De,2,0,"span",6),t.YNc(9,be,2,0,"span",7),t.YNc(10,xe,2,0,"span",8),t.YNc(11,Ie,2,0,"a",9),t.qZA(),t.TgZ(12,"div",10),t.YNc(13,a,5,6,"div",11),t.qZA()(),t._UZ(14,"app-monaco-editor-modal",12,13)),2&c&&(t.xp6(4),t.hij(" ",p.mode," Settings"),t.xp6(1),t.Q6J("ngIf",p.mode===p.EInstanceApiWidgetMode.API),t.xp6(1),t.Q6J("ngIf",p.mode===p.EInstanceApiWidgetMode.Collection),t.xp6(1),t.Q6J("ngIf",p.mode===p.EInstanceApiWidgetMode.Database),t.xp6(1),t.Q6J("ngIf",p.data.selectedItem),t.xp6(1),t.Q6J("ngIf",p.data.selectedItem&&p.insApiSetting._id),t.xp6(1),t.Q6J("ngIf",p.data.selectedItem&&p.insApiSetting._id),t.xp6(1),t.Q6J("ngIf",p.lastError&&p.data.selectedItem),t.xp6(2),t.Q6J("ngIf",p.data.selectedItem),t.xp6(1),t.Q6J("modalId",p.modalId)("editorOptionsMonacoEditorModal",p.editorOptionsMonacoEditorModal)("modalTitle","Error info"))},dependencies:[ce.O5,ge.O,de.G,_e.u,ue.A]})}return d})();var m=r(328),U=r(6212),_=r(6990),x=r(921),l=r(2189),v=r(5431);function T(d,A){if(1&d&&(t.TgZ(0,"div")(1,"div",8),t._uU(2),t.qZA()()),2&d){const i=t.oxw();t.xp6(2),t.Oqu(i.constantsS.group.allCollectionsPermitted)}}function Y(d,A){1&d&&(t.TgZ(0,"th",19),t._UZ(1,"p-tableHeaderCheckbox"),t.qZA())}function z(d,A){if(1&d&&(t.TgZ(0,"tr"),t.YNc(1,Y,2,0,"th",14),t.TgZ(2,"th",15),t._uU(3,"Category"),t.qZA(),t.TgZ(4,"th"),t._uU(5,"Name"),t.qZA(),t.TgZ(6,"th",16),t._uU(7,"Pre"),t.qZA(),t.TgZ(8,"th",16),t._uU(9,"Post"),t.qZA(),t.TgZ(10,"th"),t._uU(11,"Authorization"),t.qZA(),t._UZ(12,"th",17)(13,"th",18),t.qZA()),2&d){const i=t.oxw(2);t.xp6(1),t.Q6J("ngIf",i.showCheckbox)}}function ne(d,A){if(1&d&&(t.TgZ(0,"td"),t._UZ(1,"p-tableCheckbox",30),t.qZA()),2&d){const i=t.oxw().$implicit;t.xp6(1),t.Q6J("value",i)("pSelectableRow",i)}}function ae(d,A){if(1&d&&(t.TgZ(0,"td",27),t._uU(1),t.qZA()),2&d){const i=t.oxw().$implicit;t.xp6(1),t.Oqu(i.preHookCount||"")}}function se(d,A){if(1&d&&(t.TgZ(0,"td",27),t._uU(1),t.qZA()),2&d){const i=t.oxw().$implicit;t.xp6(1),t.Oqu(i.postHookCount||"")}}function Oe(d,A){1&d&&(t.TgZ(0,"span",31),t._uU(1,"AM-User"),t.qZA())}function Ue(d,A){1&d&&(t.TgZ(0,"span",32),t._uU(1,"No-Access"),t.qZA())}function Fe(d,A){1&d&&(t.TgZ(0,"span",33),t._uU(1,"Public"),t.qZA())}function Ne(d,A){1&d&&(t.TgZ(0,"span",32),t._uU(1,"DB-User"),t.qZA())}function Re(d,A){1&d&&(t.TgZ(0,"span",32),t._uU(1,"AWS"),t.qZA())}function Ye(d,A){1&d&&(t.TgZ(0,"span",32),t._uU(1,"Azure"),t.qZA())}function Je(d,A){1&d&&(t.TgZ(0,"span",32),t._uU(1,"Google"),t.qZA())}function Ge(d,A){1&d&&t._UZ(0,"i",34)}const Le=function(){return["/api-info/api-testing/testing"]},Qe=function(d,A,i,c,p){return{at_category:"INSTANCES",at_instance:d,at_user:A,at_database:i,at_collection:c,at_api:p}};function Ke(d,A){if(1&d&&(t.TgZ(0,"tr",20),t.YNc(1,ne,2,2,"td",6),t.TgZ(2,"td"),t._uU(3),t.qZA(),t.TgZ(4,"td"),t._uU(5),t.qZA(),t.YNc(6,ae,2,1,"td",21),t.YNc(7,se,2,1,"td",21),t.TgZ(8,"td",22),t.YNc(9,Oe,2,0,"span",23),t.YNc(10,Ue,2,0,"span",24),t.YNc(11,Fe,2,0,"span",25),t.YNc(12,Ne,2,0,"span",24),t.YNc(13,Re,2,0,"span",24),t.YNc(14,Ye,2,0,"span",24),t.YNc(15,Je,2,0,"span",24),t.qZA(),t.TgZ(16,"td"),t.YNc(17,Ge,1,0,"i",26),t.qZA(),t.TgZ(18,"td")(19,"div",27)(20,"a",28),t.NdJ("click",function(c){return c.stopPropagation()}),t._UZ(21,"i",29),t.qZA()()()()),2&d){const i=A.$implicit,c=t.oxw(2);t.Q6J("pSelectableRow",i),t.xp6(1),t.Q6J("ngIf",c.showCheckbox),t.xp6(1),t.Gre("text-monospaced small pl-0 text-right ","GEN"===i.category?"text-muted":"",""),t.xp6(1),t.Oqu(i.category),t.xp6(2),t.Oqu(i.nameForApiListUI),t.xp6(1),t.Q6J("ngIf",c.showHooksCount),t.xp6(1),t.Q6J("ngIf",c.showHooksCount),t.xp6(2),t.Q6J("ngIf",i.hasAmAuth),t.xp6(1),t.Q6J("ngIf",i.noAccess),t.xp6(1),t.Q6J("ngIf",i.isPublic),t.xp6(1),t.Q6J("ngIf",i.hasAmDBAuth),t.xp6(1),t.Q6J("ngIf",i.hasAwsAuth),t.xp6(1),t.Q6J("ngIf",i.hasAzureAuth),t.xp6(1),t.Q6J("ngIf",i.hasGoogleAuth),t.xp6(2),t.Q6J("ngIf",i.instanceApiSettings),t.xp6(3),t.Q6J("routerLink",t.DdM(19,Le))("queryParams",t.qbA(20,Qe,c.eventCenterS.instance.selectedInstances.value[0]._id,c.authCS.getUserId(),c.eventCenterS.database.selectedDatabases.value[0]._id,c.eventCenterS.collection.selectedCollections.value[0]._id,i._id))}}function We(d,A){1&d&&t._UZ(0,"p-progressSpinner",35)}function ke(d,A){if(1&d){const i=t.EpF();t.TgZ(0,"div",9)(1,"p-table",10),t.NdJ("selectionChange",function(p){t.CHM(i);const w=t.oxw();return t.KtG(w.selectedRows=p)})("selectionChange",function(){t.CHM(i);const p=t.oxw();return t.KtG(p.apiSelected())}),t.YNc(2,z,14,1,"ng-template",11),t.YNc(3,Ke,22,26,"ng-template",12),t.qZA(),t.YNc(4,We,1,0,"p-progressSpinner",13),t.qZA()}if(2&d){const i=t.oxw();t.xp6(1),t.Q6J("selectionMode","multiple")("metaKeySelection",!0)("selection",i.selectedRows)("dataKey",i.gridKey)("scrollable",!0)("value",i.rows),t.xp6(3),t.Q6J("ngIf",i.loading.grid)}}let ye=(()=>{class d{instanceS;generalS;navigationCS;authCS;constantsS;eventCenterS;router;showCheckbox=!0;showHooksCount=!1;loading={grid:!1};subscriptions=[];data={mode:m.D.ADD,eventChannel:new t.vpe,formData:void 0};rows=[];rowsMap={};showAll=!1;selectedRows=[];gridKey=S.iH._id;EUserType=x.dN;constructor(i,c,p,w,Ae,Me,Ze){this.instanceS=i,this.generalS=c,this.navigationCS=p,this.authCS=w,this.constantsS=Ae,this.eventCenterS=Me,this.router=Ze}ngOnInit(){var i=this;this.subscriptions.push(this.eventCenterS.collection.selectedCollections.subscribe(function(){var c=(0,y.Z)(function*(p){if(!p[0])return i.resetGridAndUrl();yield i.loadGridData(p[0])});return function(p){return c.apply(this,arguments)}}()))}loadGridData(i){var c=this;return(0,y.Z)(function*(){c.loading.grid=!0;try{yield c.resetGridAndUrl(),c.selectedRows=[],c.rows=(yield c.instanceS.instanceAPIList([i])).data||[],c.rowsMap=_.keyBy(c.rows,S.iH._id),c.showHooksCount&&(yield c.instanceS.setHooksCountInCollectionApisArr(i.instanceName,i.databaseName,i.name,c.rows));const p=c.navigationCS.getQueryParam(U.p.collection_api),w=c.rowsMap[p];w&&(c.selectedRows=[w],c.eventCenterS.colApi.selectedApi.next(w)),c.loading.grid=!1}catch(p){console.log(p),c.loading.grid=!1}})()}resetDependents(){var i=this;return(0,y.Z)(function*(){i.eventCenterS.colApi.selectedApi.next(void 0),yield i.navigationCS.setQueryParam(U.p.collection_api,null)})()}apiSelected(){var i=this;return(0,y.Z)(function*(){yield i.resetDependents(),yield i.fillData()})()}resetGridAndUrl(){var i=this;return(0,y.Z)(function*(){i.rows=[],i.selectedRows=[],i.rowsMap={},i.eventCenterS.colApi.selectedApi.next(void 0)})()}fillData(){var i=this;return(0,y.Z)(function*(){if(!i.selectedRows.length)return yield i.navigationCS.setQueryParam(U.p.collection_api,null),void i.eventCenterS.colApi.selectedApi.next(null);const c=i.selectedRows[0];c&&(i.eventCenterS.colApi.selectedApi.next(c),yield i.navigationCS.setQueryParam(U.p.collection_api,c._id))})()}ngOnDestroy(){this.generalS.unsubscribe(this.subscriptions)}static \u0275fac=function(c){return new(c||d)(t.Y36(oe.E),t.Y36(re.b),t.Y36(l.S),t.Y36(ie.D),t.Y36(le.L),t.Y36(G.u),t.Y36(D.F0))};static \u0275cmp=t.Xpm({type:d,selectors:[["app-col-api-w"]],inputs:{showCheckbox:"showCheckbox",showHooksCount:"showHooksCount"},decls:10,vars:2,consts:[[1,"card","shadow-sm","h-100"],[1,"card-header"],[1,"fas","fa-code","text-info","fa-fw","mr-1"],["href","https://docs.apimaker.dev/v1/docs/pages/instance-database-collection-apis-page.html#apis","target","_blank"],["src","/assets/images/logo/logo_docs.svg",1,"float-right","fa-fw","ml-3",2,"font-size","25px"],[1,"card-body","p-0","h-100","overflow-hidden"],[4,"ngIf"],["class","h-100",4,"ngIf"],[1,"p-2","text-center","text-success"],[1,"h-100"],["styleClass","p-datatable-striped","scrollHeight","calc(50vh - 66px)",3,"selectionMode","metaKeySelection","selection","dataKey","scrollable","value","selectionChange"],["pTemplate","header"],["pTemplate","body"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s",4,"ngIf"],["style","width: 45px;",4,"ngIf"],[1,"pl-0","text-right",2,"width","85px"],[2,"width","40px"],[2,"width","42px"],[2,"width","58px"],[2,"width","45px"],[3,"pSelectableRow"],["class","text-center",4,"ngIf"],[1,"px-1"],["class","d-inline-block small font-weight-bold font-monospaced ml-2",4,"ngIf"],["class","d-inline-block small font-weight-bold font-monospaced text-success ml-2",4,"ngIf"],["class","d-inline-block small font-weight-bold font-monospaced text-warning ml-2",4,"ngIf"],["tooltipPosition","left","pTooltip","API Settings","class","fas fa-cog text-danger fa-fw cursor-pointer",4,"ngIf"],[1,"text-center"],["href","javascript:","tooltipPosition","left","pTooltip","Test API",1,"btn","btn-xsm-custom","mr-3",3,"routerLink","queryParams","click"],[1,"fas","fa-vial","text-info","fa-fw","test-tube","pt-1"],[3,"value","pSelectableRow"],[1,"d-inline-block","small","font-weight-bold","font-monospaced","ml-2"],[1,"d-inline-block","small","font-weight-bold","font-monospaced","text-success","ml-2"],[1,"d-inline-block","small","font-weight-bold","font-monospaced","text-warning","ml-2"],["tooltipPosition","left","pTooltip","API Settings",1,"fas","fa-cog","text-danger","fa-fw","cursor-pointer"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s"]],template:function(c,p){1&c&&(t.TgZ(0,"div",0)(1,"div",1)(2,"span"),t._UZ(3,"i",2),t._uU(4," Collection APIs"),t.qZA(),t.TgZ(5,"a",3),t._UZ(6,"img",4),t.qZA()(),t.TgZ(7,"div",5),t.YNc(8,T,3,1,"div",6),t.YNc(9,ke,5,7,"div",7),t.qZA()()),2&c&&(t.xp6(8),t.Q6J("ngIf",p.eventCenterS.group.apisRegex.allCollections),t.xp6(1),t.Q6J("ngIf",!p.eventCenterS.group.apisRegex.allCollections))},dependencies:[D.rH,ce.O5,v.iA,Q.jx,v.Ei,v.UA,v.Mo,de.G,_e.u]})}return d})();const Be=["insertCodeModalC"];function He(d,A){1&d&&t._UZ(0,"app-w-instances",5),2&d&&t.Q6J("showHooksCount",!0)("showCheckbox",!1)}function Ve(d,A){1&d&&t._UZ(0,"app-w-databases",5),2&d&&t.Q6J("showHooksCount",!0)("showCheckbox",!1)}function je(d,A){if(1&d&&t._UZ(0,"app-w-instance-api-settings",7),2&d){const i=t.oxw(2),c=t.MAs(8);t.Q6J("insertCodeModalC",c)("mode",i.EInstanceApiWidgetMode.Database)}}const Ee=function(){return[50,50]};function $e(d,A){1&d&&(t.TgZ(0,"p-splitter",6),t.YNc(1,Ve,1,2,"ng-template",2),t.YNc(2,je,1,2,"ng-template",2),t.qZA()),2&d&&t.Q6J("panelSizes",t.DdM(2,Ee))("minSizes",t.DdM(3,Ee))}function qe(d,A){1&d&&t._UZ(0,"app-w-collections",5),2&d&&t.Q6J("showHooksCount",!0)("showCheckbox",!1)}function ze(d,A){if(1&d&&t._UZ(0,"app-w-instance-api-settings",7),2&d){const i=t.oxw(2),c=t.MAs(8);t.Q6J("insertCodeModalC",c)("mode",i.EInstanceApiWidgetMode.Collection)}}function Xe(d,A){1&d&&(t.TgZ(0,"p-splitter",6),t.YNc(1,qe,1,2,"ng-template",2),t.YNc(2,ze,1,2,"ng-template",2),t.qZA()),2&d&&t.Q6J("panelSizes",t.DdM(2,Ee))("minSizes",t.DdM(3,Ee))}function et(d,A){1&d&&t._UZ(0,"app-col-api-w",5),2&d&&t.Q6J("showHooksCount",!0)("showCheckbox",!1)}function tt(d,A){if(1&d&&t._UZ(0,"app-w-instance-api-settings",8),2&d){const i=t.oxw(2),c=t.MAs(8);t.Q6J("insertCodeModalC",c)("mode",i.EInstanceApiWidgetMode.API)}}function nt(d,A){1&d&&(t.TgZ(0,"p-splitter",6),t.YNc(1,et,1,2,"ng-template",2),t.YNc(2,tt,1,2,"ng-template",2),t.qZA()),2&d&&t.Q6J("panelSizes",t.DdM(2,Ee))("minSizes",t.DdM(3,Ee))}const at=function(){return{height:"calc(100vh - 62px)",width:"140rem"}},Pe=function(){return[35,50,50,65]};let we=(()=>{class d{eventCenterS;EInstanceApiWidgetMode=n.a;DOCS_HOST_PORT=V.N.DOCS_HOST_PORT;insertCodeModalC;constructor(i){this.eventCenterS=i}ngOnInit(){this.eventCenterS.group.apisRegex={},this.eventCenterS.instance.selectedInstances.next([]),this.eventCenterS.database.selectedDatabases.next([]),this.eventCenterS.collection.selectedCollections.next([])}static \u0275fac=function(c){return new(c||d)(t.Y36(G.u))};static \u0275cmp=t.Xpm({type:d,selectors:[["app-db-cell-layout"]],viewQuery:function(c,p){if(1&c&&t.Gf(Be,5),2&c){let w;t.iGM(w=t.CRH())&&(p.insertCodeModalC=w.first)}},decls:9,vars:10,consts:[[1,"pt-1","pl-1","pr-1","overflow-auto"],[3,"panelSizes","minSizes"],["pTemplate",""],[3,"frameId","modalId","docsHostPort"],["insertCodeModalC",""],[1,"w-100",3,"showHooksCount","showCheckbox"],["layout","vertical",3,"panelSizes","minSizes"],[1,"w-100",3,"insertCodeModalC","mode"],[1,"w-100",2,"width","45.8%",3,"insertCodeModalC","mode"]],template:function(c,p){1&c&&(t.TgZ(0,"div",0)(1,"p-splitter",1),t.YNc(2,He,1,2,"ng-template",2),t.YNc(3,$e,3,4,"ng-template",2),t.YNc(4,Xe,3,4,"ng-template",2),t.YNc(5,nt,3,4,"ng-template",2),t.qZA()(),t._UZ(6,"app-create-schema-form")(7,"app-insert-code-modal",3,4)),2&c&&(t.xp6(1),t.Akn(t.DdM(7,at)),t.Q6J("panelSizes",t.DdM(8,Pe))("minSizes",t.DdM(9,Pe)),t.xp6(6),t.Q6J("frameId","IdInsertCode")("modalId","IdInsertCodeApiList")("docsHostPort",p.DOCS_HOST_PORT))},dependencies:[q.P,Q.jx,H.q,j.f,g,ye,M.O,J.n,N.c],encapsulation:2})}return d})();r(2571);var ot=r(4950);const it=[{path:"layout",component:we,canActivate:[I.P]}];let lt=(()=>{class d{static \u0275fac=function(c){return new(c||d)};static \u0275mod=t.oAB({type:d});static \u0275inj=t.cJS({providers:[B.m],imports:[D.Bz.forChild(it),e.u,O.DashboardM,o.ApiInfoM,ot.A]})}return d})()},6162:(pe,K,r)=>{r.d(K,{m:()=>I});var D=r(4946),e=r(2915);let I=(()=>{class O{es;constructor(M){this.es=M}extractNameAndSetForLogTable(M,W,J,k){const N=[];for(const B of M)N.push(W[B][k]);this.es.filterInLog[J].next(N)}static \u0275fac=function(W){return new(W||O)(D.LFG(e.u))};static \u0275prov=D.Yz7({token:O,factory:O.\u0275fac,providedIn:"root"})}return O})()}}]);