@qaecy/cue-ui 0.0.36 → 0.0.38

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.
package/493.js CHANGED
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkcue_ui=self.webpackChunkcue_ui||[]).push([[493],{3183(N,S,a){a.d(S,{A:()=>E});var x=a(7705),g=a(5802),y=a(9417),o=a(1359),B=a(8957),v=a(2245),L=a(5381),d=a(5547);const p=(C,f)=>f.value;function k(C,f){if(1&C){const r=d.RV6();d.j41(0,"cue-input",6),d.bIt("valueChange",function(u){g.eBV(r);const _=d.XpG();return _.searchText=u,g.Njj(_.onSearchChange())}),d.k0s()}if(2&C){const r=d.XpG();d.Y8G("value",r.searchText)}}function R(C,f){if(1&C){const r=d.RV6();d.j41(0,"cue-checkbox",7),d.bIt("checkedChange",function(u){const _=g.eBV(r).$implicit,T=d.XpG();return _.selected=u,g.Njj(T.onSelectionChange())}),d.k0s()}if(2&C){const r=f.$implicit;d.Y8G("label",r.value||"(blank)")("checked",r.selected)}}function F(C,f){1&C&&(d.j41(0,"cue-typography",5),d.EFF(1,"No results"),d.k0s())}let E=(()=>{class C{_cdr=(0,g.WQX)(x.gRc);_params;options=[];filteredOptions=[];searchText="";agInit(r){this._params=r}afterGuiAttached(r){this._refreshOptions(),this._cdr.markForCheck()}onNewRowsLoaded(){this._refreshOptions(),this._cdr.markForCheck()}isFilterActive(){return this.options.some(r=>!r.selected)}doesFilterPass(r){const h=new Set(this.options.filter(M=>M.selected).map(M=>M.value)),u=this._params.getValue(r.node),_=null==u?"":String(u);return"..."===_||"Loading..."===_||(""===_?h.has(""):_.split(", ").map(M=>M.trim()).some(M=>h.has(M)))}getModel(){return this.isFilterActive()?{selectedValues:this.options.filter(r=>r.selected).map(r=>r.value)}:null}setModel(r){if(r){const h=new Set(r.selectedValues);this.options.forEach(u=>u.selected=h.has(u.value))}else this.options.forEach(h=>h.selected=!0);this._applySearch(),this._cdr.markForCheck()}onSelectionChange(){this._params.filterChangedCallback(),this._cdr.markForCheck()}onSearchChange(){this._applySearch(),this._cdr.markForCheck()}get allSelected(){return this.options.length>0&&this.options.every(r=>r.selected)}toggleAll(r){this.options.forEach(h=>h.selected=r),this._applySearch(),this._params.filterChangedCallback(),this._cdr.markForCheck()}_refreshOptions(){const r=new Set;this._params.api.forEachNode(u=>{const _=this._params.getValue(u);if(null==_||""===_)r.add("");else{const T=String(_);if("..."===T||"Loading..."===T)return;const M=T.split(", ").map(I=>I.trim());for(const I of M)r.add(I)}});const h=new Map(this.options.map(u=>[u.value,u.selected]));this.options=Array.from(r).sort((u,_)=>u.localeCompare(_)).map(u=>({value:u,selected:h.get(u)??!0})),this._applySearch()}_applySearch(){const r=this.searchText.toLowerCase().trim();this.filteredOptions=r?this.options.filter(h=>h.value.toLowerCase().includes(r)):this.options}static \u0275fac=function(h){return new(h||C)};static \u0275cmp=d.VBU({type:C,selectors:[["cue-multi-select-filter"]],decls:7,vars:3,consts:[["direction","column","gap","s"],["placeholder","Search...","size","s",3,"value"],["size","s","label","Select all",3,"checkedChange","checked"],[1,"msf-list"],["size","s",3,"label","checked"],["size","s"],["placeholder","Search...","size","s",3,"valueChange","value"],["size","s",3,"checkedChange","label","checked"]],template:function(h,u){1&h&&(d.j41(0,"cue-flexcontainer",0),d.nVh(1,k,1,1,"cue-input",1),d.j41(2,"cue-checkbox",2),d.bIt("checkedChange",function(T){return u.toggleAll(T)}),d.k0s(),d.j41(3,"div",3),d.Z7z(4,R,1,2,"cue-checkbox",4,p),d.nVh(6,F,2,0,"cue-typography",5),d.k0s()()),2&h&&(d.R7$(),d.vxM(u.options.length>10?1:-1),d.R7$(),d.Y8G("checked",u.allSelected),d.R7$(2),d.Dyx(u.filteredOptions),d.R7$(2),d.vxM(0===u.filteredOptions.length?6:-1))},dependencies:[y.YN,o.S,B.p,v.Typography,L.n],styles:["[_nghost-%COMP%]{display:block;padding:var(--cue-card-padding-y) var(--cue-card-padding-x);min-width:200px;max-width:300px;box-sizing:border-box}.msf-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2px;max-height:200px;overflow-y:auto}"],changeDetection:0})}return C})()},5902(N,S,a){a.d(S,{U:()=>F});var x=a(7705),g=a(5802),y=a(2271),o=a(9352),B=a(8957),v=a(2444),L=a(2245),d=a(5381),p=a(5547);function k(E,C){if(1&E){const f=p.RV6();p.j41(0,"cue-input",4),p.bIt("valueChange",function(h){g.eBV(f);const u=p.XpG();return g.Njj(u.onValueChange(h))}),p.k0s()}if(2&E){const f=p.XpG();p.Y8G("value",f.filterText)}}function R(E,C){if(1&E){const f=p.RV6();p.j41(0,"cue-typography",5),p.bIt("click",function(){g.eBV(f);const h=p.XpG();return g.Njj(h.clear())}),p.EFF(1,"Clear"),p.k0s()}}let F=(()=>{class E{_cdr=(0,g.WQX)(x.gRc);_params;filterText="";filterType="contains";filterTypeOptions=["contains","notContains","equals","notEqual","startsWith","endsWith","blank","notBlank"];_labelContains=(0,o.Xx)("components.agGridColumnSelect.textFilterContains");_labelNotContains=(0,o.Xx)("components.agGridColumnSelect.textFilterNotContains");_labelEquals=(0,o.Xx)("components.agGridColumnSelect.textFilterEquals");_labelNotEqual=(0,o.Xx)("components.agGridColumnSelect.textFilterNotEqual");_labelStartsWith=(0,o.Xx)("components.agGridColumnSelect.textFilterStartsWith");_labelEndsWith=(0,o.Xx)("components.agGridColumnSelect.textFilterEndsWith");_labelBlank=(0,o.Xx)("components.agGridColumnSelect.textFilterBlank");_labelNotBlank=(0,o.Xx)("components.agGridColumnSelect.textFilterNotBlank");filterTypeLabelMap=(0,y.EW)(()=>({contains:this._labelContains(),notContains:this._labelNotContains(),equals:this._labelEquals(),notEqual:this._labelNotEqual(),startsWith:this._labelStartsWith(),endsWith:this._labelEndsWith(),blank:this._labelBlank(),notBlank:this._labelNotBlank()}));showTextInput=(0,y.EW)(()=>!["blank","notBlank"].includes(this.filterType));agInit(f){this._params=f}afterGuiAttached(f){this._cdr.markForCheck()}isFilterActive(){return!!["blank","notBlank"].includes(this.filterType)||this.filterText.trim().length>0}doesFilterPass(f){const r=this._params.getValue(f.node),h=null==r?"":String(r),u=this.filterText.toLowerCase().trim(),_=h.toLowerCase();switch(this.filterType){case"contains":default:return _.includes(u);case"notContains":return!_.includes(u);case"equals":return _===u;case"notEqual":return _!==u;case"startsWith":return _.startsWith(u);case"endsWith":return _.endsWith(u);case"blank":return""===h;case"notBlank":return""!==h}}getModel(){return this.isFilterActive()?{filterType:"text",type:this.filterType,filter:this.filterText}:null}setModel(f){this.filterText=f?.filter??"",this.filterType=f?.type??"contains",this._cdr.markForCheck()}onValueChange(f){this.filterText=f,this._params.filterChangedCallback(),this._cdr.markForCheck()}onFilterTypeChange(f){this.filterType=String(f||"contains"),["blank","notBlank"].includes(this.filterType)&&(this.filterText=""),this._params.filterChangedCallback(),this._cdr.markForCheck()}clear(){this.filterText="",this.filterType="contains",this._params.filterChangedCallback(),this._cdr.markForCheck()}static \u0275fac=function(r){return new(r||E)};static \u0275cmp=p.VBU({type:E,selectors:[["cue-text-filter"]],decls:4,vars:5,consts:[["direction","column","gap","s"],["size","s",3,"valueChange","value","options","labelMap"],["placeholder","Filter...","size","s",3,"value"],["size","s",2,"cursor","pointer","text-align","right"],["placeholder","Filter...","size","s",3,"valueChange","value"],["size","s",2,"cursor","pointer","text-align","right",3,"click"]],template:function(r,h){1&r&&(p.j41(0,"cue-flexcontainer",0)(1,"cue-select",1),p.bIt("valueChange",function(_){return h.onFilterTypeChange(_)}),p.k0s(),p.nVh(2,k,1,1,"cue-input",2),p.nVh(3,R,2,0,"cue-typography",3),p.k0s()),2&r&&(p.R7$(),p.Y8G("value",h.filterType)("options",h.filterTypeOptions)("labelMap",h.filterTypeLabelMap()),p.R7$(),p.vxM(h.showTextInput()?2:-1),p.R7$(),p.vxM(h.filterText||"contains"!==h.filterType?3:-1))},dependencies:[B.p,v.l,L.Typography,d.n],styles:["[_nghost-%COMP%]{display:block;padding:var(--cue-card-padding-y) var(--cue-card-padding-x);min-width:180px;max-width:280px;box-sizing:border-box}"],changeDetection:0})}return E})()},5448(N,S,a){a.d(S,{L:()=>B});var x=a(7705),g=a(2245),y=a(5547);const o=["*"];let B=(()=>{class v{fontSize=(0,x.hFB)("m");italic=(0,x.hFB)(!1);noWrap=(0,x.hFB)(!0);static \u0275fac=function(p){return new(p||v)};static \u0275cmp=y.VBU({type:v,selectors:[["cue-button-label"]],inputs:{fontSize:[1,"fontSize"],italic:[1,"italic"],noWrap:[1,"noWrap"]},ngContentSelectors:o,decls:3,vars:3,consts:[[3,"size","italic","noWrap"]],template:function(p,k){1&p&&(y.NAR(),y.j41(0,"div")(1,"cue-typography",0),y.SdG(2),y.k0s()()),2&p&&(y.R7$(),y.Y8G("size",k.fontSize())("italic",k.italic())("noWrap",k.noWrap()))},dependencies:[g.Typography],styles:["div[_ngcontent-%COMP%]{transform:translateY(.05em)}"]})}return v})()},8493(N,S,a){a.d(S,{CueEntityList:()=>J});var x=a(467),g=a(7705),y=a(2271),o=a(5802),B=a(6950),v=a(9352),L=a(1951),d=a(6455),p=a(8334),k=a(5949),R=a(2843),F=a(3646),E=a(8017),C=a(2306),f=a(6103);let r=(()=>{class l{mapboxToken=(0,o.vPA)(void 0);entityData=(0,o.vPA)({});availableEntityRelationships=(0,o.vPA)([]);settings=(0,y.EW)(()=>{const e=this.mapboxToken();if(!e)return;const n=new C.yY;return n.mapboxToken=e,n.contextMenu.showFlyTo=!1,n.contextMenu.showProperties=!1,n});layers=(0,y.EW)(()=>{const e=this.entityData(),n=this.availableEntityRelationships();return(0,f.N)({entityData:e,availableEntityRelationships:n})});static \u0275fac=function(n){return new(n||l)};static \u0275prov=o.jDH({token:l,factory:l.\u0275fac,providedIn:"root"})}return l})();var h=a(3183),u=a(5902);let _=(()=>{class l{entities=(0,o.vPA)([]);entityData=(0,o.vPA)({});orderByMentionCount=(0,o.vPA)(!1);availableEntityCategories=(0,o.vPA)(void 0);labelValue=(0,v.Xx)("components.entityList.labelValue");labelCategories=(0,v.Xx)("components.entityList.labelCategories");labelMentions=(0,v.Xx)("components.entityList.labelMentionCount");_filterChangeCounter=(0,o.vPA)(0);filterChangeCounter=this._filterChangeCounter.asReadonly();onFilterChanged(){this._filterChangeCounter.update(e=>e+1)}columnDefs=(0,y.EW)(()=>{const e=[{field:"value",headerName:this.labelValue(),flex:2,filter:u.U,valueGetter:n=>!n.data?.value&&n.data?.loading?"Loading...":n.data?.value||n.data?.entity},{field:"categories",headerName:this.labelCategories(),flex:1.5,filter:h.A,valueGetter:n=>{const i=n.data?.categories;if(!i)return n.data?.loading?"...":"";const s=Array.isArray(i)?i:[i],c=this._leafEntityCategoryIris();return(c?s.filter(b=>c.has(b)):s).map(b=>this._getEntityCategoryLabel(b)).join(", ")}}];return this.orderByMentionCount()&&e.push({field:"mentionCount",headerName:this.labelMentions(),flex:1,filter:"agNumberColumnFilter",valueGetter:n=>{const i=n.data;if(i?.loading)return"...";const s=i?.mentionCount??0;return s>0?s:""},cellStyle:{textAlign:"center"}}),e});rows=(0,y.EW)(()=>{const e=this.entities()||[],n=this.entityData()||{},i=e.map(s=>{const c=n[s];return{entity:s,value:c?.value,categories:c?.categories,mentionCount:c?.mentionCount,loading:!c}});return this.orderByMentionCount()?i.sort((s,c)=>(c.mentionCount||0)-(s.mentionCount||0)):i});_leafEntityCategoryIris=(0,y.EW)(()=>{const e=this.availableEntityCategories();if(!e)return null;const n=new Set(e.map(i=>i.parent).filter(i=>!!i));return new Set(e.filter(i=>!n.has(i.iri)).map(i=>i.iri))});_getEntityCategoryLabel(e){const n=this.availableEntityCategories();if(void 0!==n){const i=n.find(s=>s.iri===e);if(i)return i.label}return this._prettifyCategory(e)}_prettifyCategory(e){if(!e)return"";const n=e.split("#");return(n[n.length-1]||e).replace(/([A-Z])/g," $1").trim()}static \u0275fac=function(n){return new(n||l)};static \u0275prov=o.jDH({token:l,factory:l.\u0275fac,providedIn:"root"})}return l})();var T=a(5971),M=a(5448),I=a(2014),W=a(5381),t=a(5547);function w(l,P){if(1&l){const e=t.RV6();t.j41(0,"cue-flexcontainer",2)(1,"cue-button",5),t.bIt("click",function(){o.eBV(e);const i=t.XpG();return o.Njj(i.onOrderByMentionCountClick())}),t.nrm(2,"cue-button-padder"),t.j41(3,"cue-button-label"),t.EFF(4),t.nI1(5,"transloco"),t.k0s(),t.nrm(6,"cue-button-padder"),t.k0s()()}if(2&l){const e=t.XpG();t.R7$(),t.Y8G("tooltip",e.infoOrderByMentionCount()),t.R7$(3),t.JRh(t.bMT(5,2,"components.entityList.labelOrderByMentionCount"))}}function j(l,P){if(1&l){const e=t.RV6();t.j41(0,"cue-tab",1),t.nI1(1,"transloco"),t.j41(2,"cue-map",6),t.bIt("clickedFeature",function(i){o.eBV(e);const s=t.XpG();return o.Njj(s.onMapFeatureClick(i))}),t.k0s()()}if(2&l){t.XpG();const e=t.r8f(6),n=t.r8f(7);t.Y8G("label",t.bMT(1,3,"components.entityList.tabMap")),t.R7$(2),t.Y8G("layers",n)("settings",e)}}let z=(()=>{class l{map=(0,o.WQX)(r);table=(0,o.WQX)(_);entities=g.hFB.required();mapboxToken=(0,g.hFB)(void 0);handlers=g.hFB.required();availableEntityCategories=(0,g.hFB)(void 0);availableEntityRelationships=(0,g.hFB)();entityData=(0,g.hFB)({});paginationPageSize=(0,g.hFB)(10);prefetchPages=(0,g.hFB)(3);rowClicked=(0,g.CGW)();clickedOpen=(0,g.CGW)();_gridApi=null;_requestedIris=new Set;_requestedLocationIris=new Set;_isSorted=!1;_pendingMapClickIri=(0,o.vPA)(null);_bufferedUntilIndex=(0,o.vPA)(0);_locationBufferedUntilIndex=0;_lastEntitiesKey="";_destroyed=!1;labelOpenInEntityViewer=(0,v.Xx)("components.entityList.labelOpenInEntityViewer");infoOrderByMentionCount=(0,v.Xx)("components.entityList.infoOrderByMentionCount");overlaySettings={...new L.K,mode:"row"};overlayActions=(0,y.EW)(()=>[{label:this.labelOpenInEntityViewer(),icon:"info",action:e=>{this.handlers().requestOpen?.(e.rowData),this.clickedOpen.emit(e.rowData)}}]);constructor(){(0,o.QZP)(()=>this.map.mapboxToken.set(this.mapboxToken())),(0,o.QZP)(()=>{const e=this.entityData();this.map.entityData.update(n=>{let i=!1;const s={...n};for(const[c,m]of Object.entries(e))(m.directMapGeometries?.length||m.indirectMapGeometries?.length)&&(s[c]={value:"",categories:[],directMapGeometries:m.directMapGeometries,indirectMapGeometries:m.indirectMapGeometries},i=!0);return i?s:n})}),(0,o.QZP)(()=>this.map.availableEntityRelationships.set(this.availableEntityRelationships()??[])),(0,o.QZP)(()=>this.table.availableEntityCategories.set(this.availableEntityCategories())),(0,o.QZP)(()=>this.table.entities.set(this.entities())),(0,o.QZP)(()=>this.table.entityData.set(this.entityData())),(0,o.QZP)(()=>{const e=this._pendingMapClickIri();if(!e)return;const n=this.entityData()[e];n&&(this._pendingMapClickIri.set(null),this.rowClicked.emit({entity:e,value:n.value,categories:n.categories,mentionCount:n.mentionCount,loading:!1}))}),(0,o.QZP)(()=>{const n=this.entities().join("|");if(n!==this._lastEntitiesKey)if(this._lastEntitiesKey=n,this._requestedIris.clear(),this._requestedLocationIris.clear(),this._bufferedUntilIndex.set(0),this._locationBufferedUntilIndex=0,this.handlers().checkHasLocations&&this.handlers().requestLocations){const i=(this.availableEntityCategories()??[]).map(s=>s.iri);this.handlers().checkHasLocations(i).then(s=>{s&&!this._destroyed&&this._requestLocationBatch()})}else this.handlers().requestLocations&&setTimeout(()=>this._requestLocationBatch())}),(0,o.QZP)(()=>{const e=this.table.orderByMentionCount(),n=this.table.filterChangeCounter();if(e||n>0){const c=this.entities().filter(m=>!this._requestedIris.has(m));c.length>0&&(c.forEach(m=>this._requestedIris.add(m)),this.handlers().requestData(c,e))}})}rowSelection={mode:"singleRow",checkboxes:!1,enableClickSelection:!0};onGridReady(e){this._gridApi=e,e.addEventListener("viewportChanged",()=>this._checkViewport()),e.addEventListener("modelUpdated",()=>this._checkViewport()),e.addEventListener("paginationChanged",()=>this._checkViewport()),e.addEventListener("sortChanged",()=>{const n=e.getColumnState();this._isSorted=n.some(i=>null!=i.sort),this._isSorted&&this._requestAllUnloaded()}),e.addEventListener("filterChanged",()=>{this.table.onFilterChanged()}),setTimeout(()=>this._checkViewport(),100)}onMapFeatureClick(e){var n=this;return(0,x.A)(function*(){const s=e.feature.properties?.iri;s&&(n._pendingMapClickIri.set(s),yield n.handlers().requestData?.([s],n.table.orderByMentionCount()))})()}_checkViewport(){if(!this._gridApi||this._gridApi.isDestroyed?.())return;if(this._isSorted)return void this._requestAllUnloaded();const e=this.entities(),n=e.length;if(!n)return;const i=Math.max(1,this._gridApi.paginationGetPageSize?.()??this.paginationPageSize()),c=Math.max(0,this._gridApi.paginationGetCurrentPage?.()??0)*i,m=Math.min(n,c+i),b=this._bufferedUntilIndex();let D=null;if(0===b?D=0:(c>=Math.max(0,b-i)||m>b)&&(D=b),null===D||D>=n)return;const A=i*Math.max(1,this.prefetchPages()),V=Math.min(n,D+A),G=e.slice(D,V).filter(O=>!this._requestedIris.has(O));this._bufferedUntilIndex.set(Math.max(b,V)),G.length&&(G.forEach(O=>this._requestedIris.add(O)),setTimeout(()=>this.handlers().requestData(G,this.table.orderByMentionCount())))}_requestLocationBatch(){if(!this.handlers().requestLocations)return;const e=this.entities(),n=e.length;if(this._locationBufferedUntilIndex>=n)return;const s=Math.min(n,this._locationBufferedUntilIndex+500),c=e.slice(this._locationBufferedUntilIndex,s).filter(m=>!this._requestedLocationIris.has(m));this._locationBufferedUntilIndex=s,c.length>0&&(c.forEach(m=>this._requestedLocationIris.add(m)),setTimeout(()=>this.handlers().requestLocations(c))),s<n&&!this._destroyed&&setTimeout(()=>this._requestLocationBatch(),200)}ngOnDestroy(){this._destroyed=!0,this._gridApi=null}_requestAllUnloaded(){if(!this._gridApi)return;const e=[];if(this._gridApi.forEachNode(n=>{const i=n.data;i?.loading&&!this._requestedIris.has(i.entity)&&e.push(i.entity)}),e.length>0){const n=Array.from(new Set(e));n.forEach(i=>this._requestedIris.add(i)),this.handlers().requestData(n,this.table.orderByMentionCount())}}onOrderByMentionCountClick(){this.table.orderByMentionCount.set(!this.table.orderByMentionCount())}static \u0275fac=function(n){return new(n||l)};static \u0275cmp=t.VBU({type:l,selectors:[["cue-ent-list-inner"]],inputs:{entities:[1,"entities"],mapboxToken:[1,"mapboxToken"],handlers:[1,"handlers"],availableEntityCategories:[1,"availableEntityCategories"],availableEntityRelationships:[1,"availableEntityRelationships"],entityData:[1,"entityData"],paginationPageSize:[1,"paginationPageSize"],prefetchPages:[1,"prefetchPages"]},outputs:{rowClicked:"rowClicked",clickedOpen:"clickedOpen"},features:[t.Jv_([k.u,R.M,F.B,r,_])],decls:9,vars:13,consts:[[2,"position","relative","width","100%","height","100%","display","flex","flex-direction","column","gap","12px"],[3,"label"],["direction","row","justify","end",2,"width","100%","padding-bottom","6px"],[2,"flex","1","min-height","0","position","relative","display","flex","flex-direction","column"],["height","100%",2,"flex","1","min-height","0",3,"gridApiReady","selectedRows","columnDefs","rowData","rowSelection","paginationPageSize","overlaySettings","overlayActions"],["size","xs","variant","secondary",3,"click","tooltip"],[3,"clickedFeature","layers","settings"]],template:function(n,i){if(1&n&&(t.j41(0,"cue-tabs",0)(1,"cue-tab",1),t.nI1(2,"transloco"),t.nVh(3,w,7,4,"cue-flexcontainer",2),t.j41(4,"div",3)(5,"cue-ag-grid",4),t.bIt("gridApiReady",function(c){return i.onGridReady(c)})("selectedRows",function(c){return c[0]&&i.rowClicked.emit(c[0])}),t.k0s()()(),t.SS7(6)(7),t.nVh(8,j,3,5,"cue-tab",1),t.k0s()),2&n){t.R7$(),t.Y8G("label",t.bMT(2,9,"components.entityList.tabList")),t.R7$(2),t.vxM(i.table.orderByMentionCount()?-1:3),t.R7$(2),t.Y8G("columnDefs",i.table.columnDefs())("rowData",i.table.rows())("rowSelection",i.rowSelection)("paginationPageSize",i.paginationPageSize())("overlaySettings",i.overlaySettings)("overlayActions",i.overlayActions()),t.R7$();const s=t.bH3(i.map.settings());t.R7$();const c=t.bH3(i.map.layers());t.R7$(),t.vxM(c.length>0&&s?8:-1)}},dependencies:[B.R,d.t,p.o,E.T,T.$,M.L,I.z,W.n,v.Kj],styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%}"],changeDetection:0})}return l})();var U=a(2245),X=a(5187),K=a(9769);function $(l,P){if(1&l&&(t.j41(0,"cue-flexcontainer",3)(1,"cue-typography",5),t.EFF(2),t.k0s()()),2&l){const e=t.XpG(2);t.R7$(2),t.SpI(" ",e.errorMessage()," ")}}function Y(l,P){if(1&l){const e=t.RV6();t.j41(0,"cue-ent-list-inner",6),t.bIt("rowClicked",function(i){o.eBV(e);const s=t.XpG(2);return o.Njj(s.rowClicked.emit(i))})("clickedOpen",function(i){o.eBV(e);const s=t.XpG(2);return o.Njj(s.clickedOpen.emit(i))}),t.k0s()}if(2&l){const e=t.XpG(2);t.Y8G("entities",e.iris())("entityData",e.entityData())("handlers",e.handlers())("mapboxToken",e.mapboxToken())("paginationPageSize",e.paginationPageSize())}}function q(l,P){1&l&&(t.j41(0,"cue-flexcontainer",3)(1,"cue-typography",7),t.EFF(2," No project connected. "),t.k0s()())}function Q(l,P){if(1&l&&t.nVh(0,$,3,1,"cue-flexcontainer",3)(1,Y,1,5,"cue-ent-list-inner",4)(2,q,3,0,"cue-flexcontainer",3),2&l){const e=t.XpG();t.vxM("error"===e.state()?0:e.handlers()?1:2)}}function Z(l,P){if(1&l&&(t.j41(0,"cue-card",1),t.eu8(1,2),t.k0s()),2&l){const e=t.XpG(),n=t.sdS(1);t.Y8G("variant",e._cardVariant())("padded",!1),t.R7$(),t.Y8G("ngTemplateOutlet",n)}}function H(l,P){if(1&l&&t.eu8(0,2),2&l){t.XpG();const e=t.sdS(1);t.Y8G("ngTemplateOutlet",e)}}let J=(()=>{class l{iris=(0,g.hFB)([]);sdkState=(0,g.hFB)(void 0);mapboxToken=(0,g.hFB)(void 0);paginationPageSize=(0,g.hFB)(10);variant=(0,g.hFB)("none");_cardVariant=(0,y.EW)(()=>this.variant());rowClicked=(0,g.CGW)();clickedOpen=(0,g.CGW)();state=(0,o.vPA)("idle");errorMessage=(0,o.vPA)(null);entityData=(0,o.vPA)({});_entities=(0,o.vPA)(void 0);_unsubscribe;handlers=(0,y.EW)(()=>{var e=this;const n=this._entities();if(n)return{requestData:(i,s)=>{const c=i.map(m=>m.split("/").pop()).filter(Boolean);n.requestEntityData(c,s)},requestLocations:i=>{if(!this.mapboxToken())return void console.warn("[cue-entity-list] No mapboxToken provided \u2014 skipping map location fetch.");const s=i.map(c=>c.split("/").pop()).filter(Boolean);n.requestEntityLocations(s)},checkHasLocations:(i=(0,x.A)(function*(s){const c=e.sdkState()?.cue,m=e.sdkState()?.projectId;if(!(e.mapboxToken()&&c&&m&&s.length))return!1;const D=`PREFIX qcy: <https://dev.qaecy.com/ont#>\nASK WHERE {\n ?entity qcy:hasEntityCategory ?cat .\n FILTER(?cat IN (${s.map(A=>`<${A}>`).join(" ")}))\n { ?entity qcy:similarTo ?osm . FILTER(STRSTARTS(STR(?osm), "https://www.openstreetmap.org/")) }\n UNION\n { ?entity qcy:relatedEntity ?loc . ?loc qcy:similarTo ?osm . FILTER(STRSTARTS(STR(?osm), "https://www.openstreetmap.org/")) }\n}`;try{return!0===(yield c.api.sparql(D,m))?.boolean}catch{return!1}}),function(c){return i.apply(this,arguments)})};var i});constructor(){(0,o.QZP)(()=>{this._setupEntities(this.sdkState()?.entities)})}ngOnDestroy(){this._teardown()}_setupEntities(e){if(this._teardown(),!e)return this._entities.set(void 0),this.entityData.set({}),void this.state.set("idle");this._entities.set(e),this.state.set("ready"),this._syncEntityData(e),this._unsubscribe=e.entityInfoMap.subscribe(()=>{this._syncEntityData(e)})}_syncEntityData(e){const n=e.entityInfoMap.get(),i={};for(const s of Object.keys(n)){const c=n[s],m=Array.isArray(c.documentRefs)?c.documentRefs.map(b=>"string"==typeof b?{id:b}:b):c.documentRefs;i[e.entityIri(s)]={...c,documentRefs:m}}this.entityData.set(i)}_teardown(){this._unsubscribe?.(),this._unsubscribe=void 0}static \u0275fac=function(n){return new(n||l)};static \u0275cmp=t.VBU({type:l,selectors:[["cue-entity-list"]],inputs:{iris:[1,"iris"],sdkState:[1,"sdkState"],mapboxToken:[1,"mapboxToken"],paginationPageSize:[1,"paginationPageSize"],variant:[1,"variant"]},outputs:{rowClicked:"rowClicked",clickedOpen:"clickedOpen"},decls:4,vars:1,consts:[["body",""],[2,"height","100%","width","100%",3,"variant","padded"],[3,"ngTemplateOutlet"],["direction","column","align","center","justify","center",2,"height","100%","width","100%","padding","8px"],[2,"height","100%",3,"entities","entityData","handlers","mapboxToken","paginationPageSize"],[2,"color","#c44","font-size","13px"],[2,"height","100%",3,"rowClicked","clickedOpen","entities","entityData","handlers","mapboxToken","paginationPageSize"],[2,"color","#9ca3af","font-size","13px"]],template:function(n,i){1&n&&(t.DNE(0,Q,3,1,"ng-template",null,0,t.C5r),t.nVh(2,Z,2,3,"cue-card",1)(3,H,1,1,"ng-container",2)),2&n&&(t.R7$(2),t.vxM("none"!==i.variant()?2:3))},dependencies:[z,W.n,U.Typography,X.Z,K.T3],styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%}"],changeDetection:0})}return l})()}}]);
1
+ "use strict";(self.webpackChunkcue_ui=self.webpackChunkcue_ui||[]).push([[493],{3183(N,S,s){s.d(S,{A:()=>E});var x=s(7705),g=s(5802),o=s(9417),y=s(1359),P=s(8957),C=s(2245),B=s(5381),c=s(5547);const p=(v,f)=>f.value;function k(v,f){if(1&v){const r=c.RV6();c.j41(0,"cue-input",6),c.bIt("valueChange",function(d){g.eBV(r);const _=c.XpG();return _.searchText=d,g.Njj(_.onSearchChange())}),c.k0s()}if(2&v){const r=c.XpG();c.Y8G("value",r.searchText)}}function F(v,f){if(1&v){const r=c.RV6();c.j41(0,"cue-checkbox",7),c.bIt("checkedChange",function(d){const _=g.eBV(r).$implicit,T=c.XpG();return _.selected=d,g.Njj(T.onSelectionChange())}),c.k0s()}if(2&v){const r=f.$implicit;c.Y8G("label",r.value||"(blank)")("checked",r.selected)}}function L(v,f){1&v&&(c.j41(0,"cue-typography",5),c.EFF(1,"No results"),c.k0s())}let E=(()=>{class v{_cdr=(0,g.WQX)(x.gRc);_params;options=[];filteredOptions=[];searchText="";agInit(r){this._params=r}afterGuiAttached(r){this._refreshOptions(),this._cdr.markForCheck()}onNewRowsLoaded(){this._refreshOptions(),this._cdr.markForCheck()}isFilterActive(){return this.options.some(r=>!r.selected)}doesFilterPass(r){const h=new Set(this.options.filter(M=>M.selected).map(M=>M.value)),d=this._params.getValue(r.node),_=null==d?"":String(d);return"..."===_||"Loading..."===_||(""===_?h.has(""):_.split(", ").map(M=>M.trim()).some(M=>h.has(M)))}getModel(){return this.isFilterActive()?{selectedValues:this.options.filter(r=>r.selected).map(r=>r.value)}:null}setModel(r){if(r){const h=new Set(r.selectedValues);this.options.forEach(d=>d.selected=h.has(d.value))}else this.options.forEach(h=>h.selected=!0);this._applySearch(),this._cdr.markForCheck()}onSelectionChange(){this._params.filterChangedCallback(),this._cdr.markForCheck()}onSearchChange(){this._applySearch(),this._cdr.markForCheck()}get allSelected(){return this.options.length>0&&this.options.every(r=>r.selected)}toggleAll(r){this.options.forEach(h=>h.selected=r),this._applySearch(),this._params.filterChangedCallback(),this._cdr.markForCheck()}_refreshOptions(){const r=new Set;this._params.api.forEachNode(d=>{const _=this._params.getValue(d);if(null==_||""===_)r.add("");else{const T=String(_);if("..."===T||"Loading..."===T)return;const M=T.split(", ").map(R=>R.trim());for(const R of M)r.add(R)}});const h=new Map(this.options.map(d=>[d.value,d.selected]));this.options=Array.from(r).sort((d,_)=>d.localeCompare(_)).map(d=>({value:d,selected:h.get(d)??!0})),this._applySearch()}_applySearch(){const r=this.searchText.toLowerCase().trim();this.filteredOptions=r?this.options.filter(h=>h.value.toLowerCase().includes(r)):this.options}static \u0275fac=function(h){return new(h||v)};static \u0275cmp=c.VBU({type:v,selectors:[["cue-multi-select-filter"]],decls:7,vars:3,consts:[["direction","column","gap","s"],["placeholder","Search...","size","s",3,"value"],["size","s","label","Select all",3,"checkedChange","checked"],[1,"msf-list"],["size","s",3,"label","checked"],["size","s"],["placeholder","Search...","size","s",3,"valueChange","value"],["size","s",3,"checkedChange","label","checked"]],template:function(h,d){1&h&&(c.j41(0,"cue-flexcontainer",0),c.nVh(1,k,1,1,"cue-input",1),c.j41(2,"cue-checkbox",2),c.bIt("checkedChange",function(T){return d.toggleAll(T)}),c.k0s(),c.j41(3,"div",3),c.Z7z(4,F,1,2,"cue-checkbox",4,p),c.nVh(6,L,2,0,"cue-typography",5),c.k0s()()),2&h&&(c.R7$(),c.vxM(d.options.length>10?1:-1),c.R7$(),c.Y8G("checked",d.allSelected),c.R7$(2),c.Dyx(d.filteredOptions),c.R7$(2),c.vxM(0===d.filteredOptions.length?6:-1))},dependencies:[o.YN,y.S,P.p,C.Typography,B.n],styles:["[_nghost-%COMP%]{display:block;padding:var(--cue-card-padding-y) var(--cue-card-padding-x);min-width:200px;max-width:300px;box-sizing:border-box}.msf-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2px;max-height:200px;overflow-y:auto}"],changeDetection:0})}return v})()},5902(N,S,s){s.d(S,{U:()=>L});var x=s(7705),g=s(5802),o=s(2271),y=s(9352),P=s(8957),C=s(2444),B=s(2245),c=s(5381),p=s(5547);function k(E,v){if(1&E){const f=p.RV6();p.j41(0,"cue-input",4),p.bIt("valueChange",function(h){g.eBV(f);const d=p.XpG();return g.Njj(d.onValueChange(h))}),p.k0s()}if(2&E){const f=p.XpG();p.Y8G("value",f.filterText)}}function F(E,v){if(1&E){const f=p.RV6();p.j41(0,"cue-typography",5),p.bIt("click",function(){g.eBV(f);const h=p.XpG();return g.Njj(h.clear())}),p.EFF(1,"Clear"),p.k0s()}}let L=(()=>{class E{_cdr=(0,g.WQX)(x.gRc);_params;filterText="";filterType="contains";filterTypeOptions=["contains","notContains","equals","notEqual","startsWith","endsWith","blank","notBlank"];_labelContains=(0,y.Xx)("components.agGridColumnSelect.textFilterContains");_labelNotContains=(0,y.Xx)("components.agGridColumnSelect.textFilterNotContains");_labelEquals=(0,y.Xx)("components.agGridColumnSelect.textFilterEquals");_labelNotEqual=(0,y.Xx)("components.agGridColumnSelect.textFilterNotEqual");_labelStartsWith=(0,y.Xx)("components.agGridColumnSelect.textFilterStartsWith");_labelEndsWith=(0,y.Xx)("components.agGridColumnSelect.textFilterEndsWith");_labelBlank=(0,y.Xx)("components.agGridColumnSelect.textFilterBlank");_labelNotBlank=(0,y.Xx)("components.agGridColumnSelect.textFilterNotBlank");filterTypeLabelMap=(0,o.EW)(()=>({contains:this._labelContains(),notContains:this._labelNotContains(),equals:this._labelEquals(),notEqual:this._labelNotEqual(),startsWith:this._labelStartsWith(),endsWith:this._labelEndsWith(),blank:this._labelBlank(),notBlank:this._labelNotBlank()}));showTextInput=(0,o.EW)(()=>!["blank","notBlank"].includes(this.filterType));agInit(f){this._params=f}afterGuiAttached(f){this._cdr.markForCheck()}isFilterActive(){return!!["blank","notBlank"].includes(this.filterType)||this.filterText.trim().length>0}doesFilterPass(f){const r=this._params.getValue(f.node),h=null==r?"":String(r),d=this.filterText.toLowerCase().trim(),_=h.toLowerCase();switch(this.filterType){case"contains":default:return _.includes(d);case"notContains":return!_.includes(d);case"equals":return _===d;case"notEqual":return _!==d;case"startsWith":return _.startsWith(d);case"endsWith":return _.endsWith(d);case"blank":return""===h;case"notBlank":return""!==h}}getModel(){return this.isFilterActive()?{filterType:"text",type:this.filterType,filter:this.filterText}:null}setModel(f){this.filterText=f?.filter??"",this.filterType=f?.type??"contains",this._cdr.markForCheck()}onValueChange(f){this.filterText=f,this._params.filterChangedCallback(),this._cdr.markForCheck()}onFilterTypeChange(f){this.filterType=String(f||"contains"),["blank","notBlank"].includes(this.filterType)&&(this.filterText=""),this._params.filterChangedCallback(),this._cdr.markForCheck()}clear(){this.filterText="",this.filterType="contains",this._params.filterChangedCallback(),this._cdr.markForCheck()}static \u0275fac=function(r){return new(r||E)};static \u0275cmp=p.VBU({type:E,selectors:[["cue-text-filter"]],decls:4,vars:5,consts:[["direction","column","gap","s"],["size","s",3,"valueChange","value","options","labelMap"],["placeholder","Filter...","size","s",3,"value"],["size","s",2,"cursor","pointer","text-align","right"],["placeholder","Filter...","size","s",3,"valueChange","value"],["size","s",2,"cursor","pointer","text-align","right",3,"click"]],template:function(r,h){1&r&&(p.j41(0,"cue-flexcontainer",0)(1,"cue-select",1),p.bIt("valueChange",function(_){return h.onFilterTypeChange(_)}),p.k0s(),p.nVh(2,k,1,1,"cue-input",2),p.nVh(3,F,2,0,"cue-typography",3),p.k0s()),2&r&&(p.R7$(),p.Y8G("value",h.filterType)("options",h.filterTypeOptions)("labelMap",h.filterTypeLabelMap()),p.R7$(),p.vxM(h.showTextInput()?2:-1),p.R7$(),p.vxM(h.filterText||"contains"!==h.filterType?3:-1))},dependencies:[P.p,C.l,B.Typography,c.n],styles:["[_nghost-%COMP%]{display:block;padding:var(--cue-card-padding-y) var(--cue-card-padding-x);min-width:180px;max-width:280px;box-sizing:border-box}"],changeDetection:0})}return E})()},5448(N,S,s){s.d(S,{L:()=>P});var x=s(7705),g=s(2245),o=s(5547);const y=["*"];let P=(()=>{class C{fontSize=(0,x.hFB)("m");italic=(0,x.hFB)(!1);noWrap=(0,x.hFB)(!0);static \u0275fac=function(p){return new(p||C)};static \u0275cmp=o.VBU({type:C,selectors:[["cue-button-label"]],inputs:{fontSize:[1,"fontSize"],italic:[1,"italic"],noWrap:[1,"noWrap"]},ngContentSelectors:y,decls:3,vars:3,consts:[[3,"size","italic","noWrap"]],template:function(p,k){1&p&&(o.NAR(),o.j41(0,"div")(1,"cue-typography",0),o.SdG(2),o.k0s()()),2&p&&(o.R7$(),o.Y8G("size",k.fontSize())("italic",k.italic())("noWrap",k.noWrap()))},dependencies:[g.Typography],styles:["div[_ngcontent-%COMP%]{transform:translateY(.05em)}"]})}return C})()},8493(N,S,s){s.d(S,{CueEntityList:()=>Q});var x=s(467),g=s(7705),o=s(5802),y=s(2271),P=s(6950),C=s(9352),B=s(1951),c=s(6455),p=s(8334),k=s(5949),F=s(2843),L=s(3646),E=s(8017),v=s(2306),f=s(6103);let r=(()=>{class u{mapboxToken=(0,o.vPA)(void 0);entityData=(0,o.vPA)({});availableEntityRelationships=(0,o.vPA)([]);settings=(0,y.EW)(()=>{const e=this.mapboxToken();if(!e)return;const t=new v.yY;return t.mapboxToken=e,t.contextMenu.showFlyTo=!1,t.contextMenu.showProperties=!1,t});layers=(0,y.EW)(()=>{const e=this.entityData(),t=this.availableEntityRelationships();return(0,f.N)({entityData:e,availableEntityRelationships:t})});static \u0275fac=function(t){return new(t||u)};static \u0275prov=o.jDH({token:u,factory:u.\u0275fac,providedIn:"root"})}return u})();var h=s(3183),d=s(5902);let _=(()=>{class u{entities=(0,o.vPA)([]);entityData=(0,o.vPA)({});orderByMentionCount=(0,o.vPA)(!1);availableEntityCategories=(0,o.vPA)(void 0);labelValue=(0,C.Xx)("components.entityList.labelValue");labelCategories=(0,C.Xx)("components.entityList.labelCategories");labelMentions=(0,C.Xx)("components.entityList.labelMentionCount");_filterChangeCounter=(0,o.vPA)(0);filterChangeCounter=this._filterChangeCounter.asReadonly();onFilterChanged(){this._filterChangeCounter.update(e=>e+1)}columnDefs=(0,y.EW)(()=>{const e=[{field:"value",headerName:this.labelValue(),flex:2,filter:d.U,valueGetter:t=>!t.data?.value&&t.data?.loading?"Loading...":t.data?.value||t.data?.entity},{field:"categories",headerName:this.labelCategories(),flex:1.5,filter:h.A,valueGetter:t=>{const i=t.data?.categories;if(!i)return t.data?.loading?"...":"";const a=Array.isArray(i)?i:[i],l=this._leafEntityCategoryIris();return(l?a.filter(b=>l.has(b)):a).map(b=>this._getEntityCategoryLabel(b)).join(", ")}}];return this.orderByMentionCount()&&e.push({field:"mentionCount",headerName:this.labelMentions(),flex:1,filter:"agNumberColumnFilter",valueGetter:t=>{const i=t.data;if(i?.loading)return"...";const a=i?.mentionCount??0;return a>0?a:""},cellStyle:{textAlign:"center"}}),e});rows=(0,y.EW)(()=>{const e=this.entities()||[],t=this.entityData()||{},i=e.map(a=>{const l=t[a];return{entity:a,value:l?.value,categories:l?.categories,mentionCount:l?.mentionCount,loading:!l}});return this.orderByMentionCount()?i.sort((a,l)=>(l.mentionCount||0)-(a.mentionCount||0)):i});_leafEntityCategoryIris=(0,y.EW)(()=>{const e=this.availableEntityCategories();if(!e)return null;const t=new Set(e.map(i=>i.parent).filter(i=>!!i));return new Set(e.filter(i=>!t.has(i.iri)).map(i=>i.iri))});_getEntityCategoryLabel(e){const t=this.availableEntityCategories();if(void 0!==t){const i=t.find(a=>a.iri===e);if(i)return i.label}return this._prettifyCategory(e)}_prettifyCategory(e){if(!e)return"";const t=e.split("#");return(t[t.length-1]||e).replace(/([A-Z])/g," $1").trim()}static \u0275fac=function(t){return new(t||u)};static \u0275prov=o.jDH({token:u,factory:u.\u0275fac,providedIn:"root"})}return u})();var T=s(5971),M=s(5448),R=s(2014),G=s(5381),n=s(5547);function j(u,I){if(1&u){const e=n.RV6();n.j41(0,"cue-flexcontainer",2)(1,"cue-button",5),n.bIt("click",function(){o.eBV(e);const i=n.XpG();return o.Njj(i.onOrderByMentionCountClick())}),n.nrm(2,"cue-button-padder"),n.j41(3,"cue-button-label"),n.EFF(4),n.nI1(5,"transloco"),n.k0s(),n.nrm(6,"cue-button-padder"),n.k0s()()}if(2&u){const e=n.XpG();n.R7$(),n.Y8G("tooltip",e.infoOrderByMentionCount()),n.R7$(3),n.JRh(n.bMT(5,2,"components.entityList.labelOrderByMentionCount"))}}function V(u,I){if(1&u){const e=n.RV6();n.j41(0,"cue-tab",1),n.nI1(1,"transloco"),n.j41(2,"cue-map",6),n.bIt("clickedFeature",function(i){o.eBV(e);const a=n.XpG();return o.Njj(a.onMapFeatureClick(i))}),n.k0s()()}if(2&u){n.XpG();const e=n.r8f(6),t=n.r8f(7);n.Y8G("label",n.bMT(1,3,"components.entityList.tabMap")),n.R7$(2),n.Y8G("layers",t)("settings",e)}}let z=(()=>{class u{map=(0,o.WQX)(r);table=(0,o.WQX)(_);entities=g.hFB.required();mapboxToken=(0,g.hFB)(void 0);handlers=g.hFB.required();availableEntityCategories=(0,g.hFB)(void 0);availableEntityRelationships=(0,g.hFB)();entityData=(0,g.hFB)({});paginationPageSize=(0,g.hFB)(10);prefetchPages=(0,g.hFB)(3);variant=(0,g.hFB)("none");rowClicked=(0,g.CGW)();clickedOpen=(0,g.CGW)();_gridApi=null;_requestedIris=new Set;_requestedLocationIris=new Set;_isSorted=!1;_pendingMapClickIri=(0,o.vPA)(null);_bufferedUntilIndex=(0,o.vPA)(0);_locationBufferedUntilIndex=0;_lastEntitiesKey="";_destroyed=!1;labelOpenInEntityViewer=(0,C.Xx)("components.entityList.labelOpenInEntityViewer");infoOrderByMentionCount=(0,C.Xx)("components.entityList.infoOrderByMentionCount");overlaySettings={...new B.K,mode:"row"};overlayActions=(0,y.EW)(()=>[{label:this.labelOpenInEntityViewer(),icon:"info",action:e=>{this.handlers().requestOpen?.(e.rowData),this.clickedOpen.emit(e.rowData)}}]);constructor(){(0,o.QZP)(()=>this.map.mapboxToken.set(this.mapboxToken())),(0,o.QZP)(()=>{const e=this.entityData();this.map.entityData.update(t=>{let i=!1;const a={...t};for(const[l,m]of Object.entries(e))(m.directMapGeometries?.length||m.indirectMapGeometries?.length)&&(a[l]={value:"",categories:[],directMapGeometries:m.directMapGeometries,indirectMapGeometries:m.indirectMapGeometries},i=!0);return i?a:t})}),(0,o.QZP)(()=>this.map.availableEntityRelationships.set(this.availableEntityRelationships()??[])),(0,o.QZP)(()=>this.table.availableEntityCategories.set(this.availableEntityCategories())),(0,o.QZP)(()=>this.table.entities.set(this.entities())),(0,o.QZP)(()=>this.table.entityData.set(this.entityData())),(0,o.QZP)(()=>{const e=this._pendingMapClickIri();if(!e)return;const t=this.entityData()[e];t&&(this._pendingMapClickIri.set(null),this.rowClicked.emit({entity:e,value:t.value,categories:t.categories,mentionCount:t.mentionCount,loading:!1}))}),(0,o.QZP)(()=>{const t=this.entities().join("|");if(t!==this._lastEntitiesKey)if(this._lastEntitiesKey=t,this._requestedIris.clear(),this._requestedLocationIris.clear(),this._bufferedUntilIndex.set(0),this._locationBufferedUntilIndex=0,this.handlers().checkHasLocations&&this.handlers().requestLocations){const i=(this.availableEntityCategories()??[]).map(a=>a.iri);this.handlers().checkHasLocations(i).then(a=>{a&&!this._destroyed&&this._requestLocationBatch()})}else this.handlers().requestLocations&&setTimeout(()=>this._requestLocationBatch())}),(0,o.QZP)(()=>{const e=this.table.orderByMentionCount(),t=this.table.filterChangeCounter();if(e||t>0){const l=this.entities().filter(m=>!this._requestedIris.has(m));l.length>0&&(l.forEach(m=>this._requestedIris.add(m)),this.handlers().requestData(l,e))}})}rowSelection={mode:"singleRow",checkboxes:!1,enableClickSelection:!0};onGridReady(e){this._gridApi=e,e.addEventListener("viewportChanged",()=>this._checkViewport()),e.addEventListener("modelUpdated",()=>this._checkViewport()),e.addEventListener("paginationChanged",()=>this._checkViewport()),e.addEventListener("sortChanged",()=>{const t=e.getColumnState();this._isSorted=t.some(i=>null!=i.sort),this._isSorted&&this._requestAllUnloaded()}),e.addEventListener("filterChanged",()=>{this.table.onFilterChanged()}),setTimeout(()=>this._checkViewport(),100)}onMapFeatureClick(e){var t=this;return(0,x.A)(function*(){const a=e.feature.properties?.iri;a&&(t._pendingMapClickIri.set(a),yield t.handlers().requestData?.([a],t.table.orderByMentionCount()))})()}_checkViewport(){if(!this._gridApi||this._gridApi.isDestroyed?.())return;if(this._isSorted)return void this._requestAllUnloaded();const e=this.entities(),t=e.length;if(!t)return;const i=Math.max(1,this._gridApi.paginationGetPageSize?.()??this.paginationPageSize()),l=Math.max(0,this._gridApi.paginationGetCurrentPage?.()??0)*i,m=Math.min(t,l+i),b=this._bufferedUntilIndex();let D=null;if(0===b?D=0:(l>=Math.max(0,b-i)||m>b)&&(D=b),null===D||D>=t)return;const A=i*Math.max(1,this.prefetchPages()),w=Math.min(t,D+A),W=e.slice(D,w).filter(O=>!this._requestedIris.has(O));this._bufferedUntilIndex.set(Math.max(b,w)),W.length&&(W.forEach(O=>this._requestedIris.add(O)),setTimeout(()=>this.handlers().requestData(W,this.table.orderByMentionCount())))}_requestLocationBatch(){if(!this.handlers().requestLocations)return;const e=this.entities(),t=e.length;if(this._locationBufferedUntilIndex>=t)return;const a=Math.min(t,this._locationBufferedUntilIndex+500),l=e.slice(this._locationBufferedUntilIndex,a).filter(m=>!this._requestedLocationIris.has(m));this._locationBufferedUntilIndex=a,l.length>0&&(l.forEach(m=>this._requestedLocationIris.add(m)),setTimeout(()=>this.handlers().requestLocations(l))),a<t&&!this._destroyed&&setTimeout(()=>this._requestLocationBatch(),200)}ngOnDestroy(){this._destroyed=!0,this._gridApi=null}_requestAllUnloaded(){if(!this._gridApi)return;const e=[];if(this._gridApi.forEachNode(t=>{const i=t.data;i?.loading&&!this._requestedIris.has(i.entity)&&e.push(i.entity)}),e.length>0){const t=Array.from(new Set(e));t.forEach(i=>this._requestedIris.add(i)),this.handlers().requestData(t,this.table.orderByMentionCount())}}onOrderByMentionCountClick(){this.table.orderByMentionCount.set(!this.table.orderByMentionCount())}static \u0275fac=function(t){return new(t||u)};static \u0275cmp=n.VBU({type:u,selectors:[["cue-ent-list-inner"]],inputs:{entities:[1,"entities"],mapboxToken:[1,"mapboxToken"],handlers:[1,"handlers"],availableEntityCategories:[1,"availableEntityCategories"],availableEntityRelationships:[1,"availableEntityRelationships"],entityData:[1,"entityData"],paginationPageSize:[1,"paginationPageSize"],prefetchPages:[1,"prefetchPages"],variant:[1,"variant"]},outputs:{rowClicked:"rowClicked",clickedOpen:"clickedOpen"},features:[n.Jv_([k.u,F.M,L.B,r,_])],decls:9,vars:14,consts:[[2,"position","relative","width","100%","height","100%","display","flex","flex-direction","column","gap","12px",3,"variant"],[3,"label"],["direction","row","justify","end",2,"width","100%","padding-bottom","6px"],[2,"flex","1","min-height","0","position","relative","display","flex","flex-direction","column"],["height","100%",2,"flex","1","min-height","0",3,"gridApiReady","selectedRows","columnDefs","rowData","rowSelection","paginationPageSize","overlaySettings","overlayActions"],["size","xs","variant","secondary",3,"click","tooltip"],[3,"clickedFeature","layers","settings"]],template:function(t,i){if(1&t&&(n.j41(0,"cue-tabs",0)(1,"cue-tab",1),n.nI1(2,"transloco"),n.nVh(3,j,7,4,"cue-flexcontainer",2),n.j41(4,"div",3)(5,"cue-ag-grid",4),n.bIt("gridApiReady",function(l){return i.onGridReady(l)})("selectedRows",function(l){return l[0]&&i.rowClicked.emit(l[0])}),n.k0s()()(),n.SS7(6)(7),n.nVh(8,V,3,5,"cue-tab",1),n.k0s()),2&t){n.Y8G("variant",i.variant()),n.R7$(),n.Y8G("label",n.bMT(2,10,"components.entityList.tabList")),n.R7$(2),n.vxM(i.table.orderByMentionCount()?-1:3),n.R7$(2),n.Y8G("columnDefs",i.table.columnDefs())("rowData",i.table.rows())("rowSelection",i.rowSelection)("paginationPageSize",i.paginationPageSize())("overlaySettings",i.overlaySettings)("overlayActions",i.overlayActions()),n.R7$();const a=n.bH3(i.map.settings());n.R7$();const l=n.bH3(i.map.layers());n.R7$(),n.vxM(l.length>0&&a?8:-1)}},dependencies:[P.R,c.t,p.o,E.T,T.$,M.L,R.z,G.n,C.Kj],styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%}"],changeDetection:0})}return u})();var U=s(2245),X=s(9769);function K(u,I){if(1&u&&(n.j41(0,"cue-flexcontainer",2)(1,"cue-typography",4),n.EFF(2),n.k0s()()),2&u){const e=n.XpG(2);n.R7$(2),n.SpI(" ",e.errorMessage()," ")}}function $(u,I){if(1&u){const e=n.RV6();n.j41(0,"cue-ent-list-inner",5),n.bIt("rowClicked",function(i){o.eBV(e);const a=n.XpG(2);return o.Njj(a.rowClicked.emit(i))})("clickedOpen",function(i){o.eBV(e);const a=n.XpG(2);return o.Njj(a.clickedOpen.emit(i))}),n.k0s()}if(2&u){const e=n.XpG(2);n.Y8G("entities",e.iris())("entityData",e.entityData())("handlers",e.handlers())("mapboxToken",e.mapboxToken())("paginationPageSize",e.paginationPageSize())("variant",e.variant())}}function q(u,I){1&u&&(n.j41(0,"cue-flexcontainer",2)(1,"cue-typography",6),n.EFF(2," No project connected. "),n.k0s()())}function Y(u,I){if(1&u&&n.nVh(0,K,3,1,"cue-flexcontainer",2)(1,$,1,6,"cue-ent-list-inner",3)(2,q,3,0,"cue-flexcontainer",2),2&u){const e=n.XpG();n.vxM("error"===e.state()?0:e.handlers()?1:2)}}let Q=(()=>{class u{iris=(0,g.hFB)([]);sdkState=(0,g.hFB)(void 0);mapboxToken=(0,g.hFB)(void 0);paginationPageSize=(0,g.hFB)(10);variant=(0,g.hFB)("none");rowClicked=(0,g.CGW)();clickedOpen=(0,g.CGW)();state=(0,o.vPA)("idle");errorMessage=(0,o.vPA)(null);entityData=(0,o.vPA)({});_entities=(0,o.vPA)(void 0);_unsubscribe;_inputWarningTimer;handlers=(0,y.EW)(()=>{var e=this;const t=this._entities();if(t)return{requestData:(i,a)=>{const l=i.map(m=>m.split("/").pop()).filter(Boolean);t.requestEntityData(l,a)},requestLocations:i=>{if(!this.mapboxToken())return void console.warn("[cue-entity-list] No mapboxToken provided \u2014 skipping map location fetch.");const a=i.map(l=>l.split("/").pop()).filter(Boolean);t.requestEntityLocations(a)},checkHasLocations:(i=(0,x.A)(function*(a){const l=e.sdkState()?.cue,m=e.sdkState()?.projectId;if(!(e.mapboxToken()&&l&&m&&a.length))return!1;const D=`PREFIX qcy: <https://dev.qaecy.com/ont#>\nASK WHERE {\n ?entity qcy:hasEntityCategory ?cat .\n FILTER(?cat IN (${a.map(A=>`<${A}>`).join(" ")}))\n { ?entity qcy:similarTo ?osm . FILTER(STRSTARTS(STR(?osm), "https://www.openstreetmap.org/")) }\n UNION\n { ?entity qcy:relatedEntity ?loc . ?loc qcy:similarTo ?osm . FILTER(STRSTARTS(STR(?osm), "https://www.openstreetmap.org/")) }\n}`;try{return!0===(yield l.api.sparql(D,m))?.boolean}catch{return!1}}),function(l){return i.apply(this,arguments)})};var i});constructor(){this._inputWarningTimer=setTimeout(()=>{this.sdkState()||console.warn('[cue-entity-list] Required input "sdkState" is not set. Pass a { entities: CueProjectEntities } (or include a `cue` instance) object to load entity data.')},3e3),(0,o.QZP)(()=>{this._setupEntities(this.sdkState()?.entities)})}ngOnDestroy(){clearTimeout(this._inputWarningTimer),this._teardown()}_setupEntities(e){if(this._teardown(),!e)return this._entities.set(void 0),this.entityData.set({}),void this.state.set("idle");this._entities.set(e),this.state.set("ready"),this._syncEntityData(e),this._unsubscribe=e.entityInfoMap.subscribe(()=>{this._syncEntityData(e)})}_syncEntityData(e){const t=e.entityInfoMap.get(),i={};for(const a of Object.keys(t)){const l=t[a],m=Array.isArray(l.documentRefs)?l.documentRefs.map(b=>"string"==typeof b?{id:b}:b):l.documentRefs;i[e.entityIri(a)]={...l,documentRefs:m}}this.entityData.set(i)}_teardown(){this._unsubscribe?.(),this._unsubscribe=void 0}static \u0275fac=function(t){return new(t||u)};static \u0275cmp=n.VBU({type:u,selectors:[["cue-entity-list"]],inputs:{iris:[1,"iris"],sdkState:[1,"sdkState"],mapboxToken:[1,"mapboxToken"],paginationPageSize:[1,"paginationPageSize"],variant:[1,"variant"]},outputs:{rowClicked:"rowClicked",clickedOpen:"clickedOpen"},decls:3,vars:1,consts:[["body",""],[3,"ngTemplateOutlet"],["direction","column","align","center","justify","center",2,"height","100%","width","100%","padding","8px"],[2,"height","100%",3,"entities","entityData","handlers","mapboxToken","paginationPageSize","variant"],[2,"color","#c44","font-size","13px"],[2,"height","100%",3,"rowClicked","clickedOpen","entities","entityData","handlers","mapboxToken","paginationPageSize","variant"],[2,"color","#9ca3af","font-size","13px"]],template:function(t,i){if(1&t&&(n.DNE(0,Y,3,1,"ng-template",null,0,n.C5r),n.eu8(2,1)),2&t){const a=n.sdS(1);n.R7$(2),n.Y8G("ngTemplateOutlet",a)}},dependencies:[z,G.n,U.Typography,X.T3],styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%}"],changeDetection:0})}return u})()}}]);