@qaecy/cue-ui 0.0.58 → 0.0.60

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/3869.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkcue_ui=self.webpackChunkcue_ui||[]).push([[3869],{3183(O,M,a){a.d(M,{A:()=>d});var E=a(7705),_=a(5802),u=a(9417),f=a(1359),x=a(8957),T=a(2245),k=a(5381),o=a(5547);const s=(p,l)=>l.value;function v(p,l){if(1&p){const e=o.RV6();o.j41(0,"cue-input",6),o.bIt("valueChange",function(r){_.eBV(e);const n=o.XpG();return n.searchText=r,_.Njj(n.onSearchChange())}),o.k0s()}if(2&p){const e=o.XpG();o.Y8G("value",e.searchText)}}function i(p,l){if(1&p){const e=o.RV6();o.j41(0,"cue-checkbox",7),o.bIt("checkedChange",function(r){const n=_.eBV(e).$implicit,y=o.XpG();return n.selected=r,_.Njj(y.onSelectionChange())}),o.k0s()}if(2&p){const e=l.$implicit;o.Y8G("label",e.value||"(blank)")("checked",e.selected)}}function D(p,l){1&p&&(o.j41(0,"cue-typography",5),o.EFF(1,"No results"),o.k0s())}let d=(()=>{class p{_cdr=(0,_.WQX)(E.gRc);_params;options=[];filteredOptions=[];searchText="";agInit(e){this._params=e}afterGuiAttached(e){this._refreshOptions(),this._cdr.markForCheck()}onNewRowsLoaded(){this._refreshOptions(),this._cdr.markForCheck()}isFilterActive(){return this.options.some(e=>!e.selected)}doesFilterPass(e){const c=new Set(this.options.filter(t=>t.selected).map(t=>t.value)),r=this._params.getValue(e.node),n=null==r?"":String(r);return"..."===n||"Loading..."===n||(""===n?c.has(""):n.split(", ").map(t=>t.trim()).some(t=>c.has(t)))}getModel(){return this.isFilterActive()?{selectedValues:this.options.filter(e=>e.selected).map(e=>e.value)}:null}setModel(e){if(e){const c=new Set(e.selectedValues);this.options.forEach(r=>r.selected=c.has(r.value))}else this.options.forEach(c=>c.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(e=>e.selected)}toggleAll(e){this.options.forEach(c=>c.selected=e),this._applySearch(),this._params.filterChangedCallback(),this._cdr.markForCheck()}_refreshOptions(){const e=new Set;this._params.api.forEachNode(r=>{const n=this._params.getValue(r);if(null==n||""===n)e.add("");else{const y=String(n);if("..."===y||"Loading..."===y)return;const t=y.split(", ").map(h=>h.trim());for(const h of t)e.add(h)}});const c=new Map(this.options.map(r=>[r.value,r.selected]));this.options=Array.from(e).sort((r,n)=>r.localeCompare(n)).map(r=>({value:r,selected:c.get(r)??!0})),this._applySearch()}_applySearch(){const e=this.searchText.toLowerCase().trim();this.filteredOptions=e?this.options.filter(c=>c.value.toLowerCase().includes(e)):this.options}static \u0275fac=function(c){return new(c||p)};static \u0275cmp=o.VBU({type:p,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(c,r){1&c&&(o.j41(0,"cue-flexcontainer",0),o.nVh(1,v,1,1,"cue-input",1),o.j41(2,"cue-checkbox",2),o.bIt("checkedChange",function(y){return r.toggleAll(y)}),o.k0s(),o.j41(3,"div",3),o.Z7z(4,i,1,2,"cue-checkbox",4,s),o.nVh(6,D,2,0,"cue-typography",5),o.k0s()()),2&c&&(o.R7$(),o.vxM(r.options.length>10?1:-1),o.R7$(),o.Y8G("checked",r.allSelected),o.R7$(2),o.Dyx(r.filteredOptions),o.R7$(2),o.vxM(0===r.filteredOptions.length?6:-1))},dependencies:[u.YN,f.Checkbox,x.Input,T.Typography,k.FlexContainer],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 p})()},5902(O,M,a){a.d(M,{U:()=>D});var E=a(7705),_=a(5802),u=a(2271),f=a(9352),x=a(8957),T=a(63),k=a(2245),o=a(5381),s=a(5547);function v(d,p){if(1&d){const l=s.RV6();s.j41(0,"cue-input",4),s.bIt("valueChange",function(c){_.eBV(l);const r=s.XpG();return _.Njj(r.onValueChange(c))}),s.k0s()}if(2&d){const l=s.XpG();s.Y8G("value",l.filterText)}}function i(d,p){if(1&d){const l=s.RV6();s.j41(0,"cue-typography",5),s.bIt("click",function(){_.eBV(l);const c=s.XpG();return _.Njj(c.clear())}),s.EFF(1,"Clear"),s.k0s()}}let D=(()=>{class d{_cdr=(0,_.WQX)(E.gRc);_params;filterText="";filterType="contains";filterTypeOptions=["contains","notContains","equals","notEqual","startsWith","endsWith","blank","notBlank"];_labelContains=(0,f.Xx)("components.agGridColumnSelect.textFilterContains");_labelNotContains=(0,f.Xx)("components.agGridColumnSelect.textFilterNotContains");_labelEquals=(0,f.Xx)("components.agGridColumnSelect.textFilterEquals");_labelNotEqual=(0,f.Xx)("components.agGridColumnSelect.textFilterNotEqual");_labelStartsWith=(0,f.Xx)("components.agGridColumnSelect.textFilterStartsWith");_labelEndsWith=(0,f.Xx)("components.agGridColumnSelect.textFilterEndsWith");_labelBlank=(0,f.Xx)("components.agGridColumnSelect.textFilterBlank");_labelNotBlank=(0,f.Xx)("components.agGridColumnSelect.textFilterNotBlank");filterTypeLabelMap=(0,u.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,u.EW)(()=>!["blank","notBlank"].includes(this.filterType));agInit(l){this._params=l}afterGuiAttached(l){this._cdr.markForCheck()}isFilterActive(){return!!["blank","notBlank"].includes(this.filterType)||this.filterText.trim().length>0}doesFilterPass(l){const e=this._params.getValue(l.node),c=null==e?"":String(e),r=this.filterText.toLowerCase().trim(),n=c.toLowerCase();switch(this.filterType){case"contains":default:return n.includes(r);case"notContains":return!n.includes(r);case"equals":return n===r;case"notEqual":return n!==r;case"startsWith":return n.startsWith(r);case"endsWith":return n.endsWith(r);case"blank":return""===c;case"notBlank":return""!==c}}getModel(){return this.isFilterActive()?{filterType:"text",type:this.filterType,filter:this.filterText}:null}setModel(l){this.filterText=l?.filter??"",this.filterType=l?.type??"contains",this._cdr.markForCheck()}onValueChange(l){this.filterText=l,this._params.filterChangedCallback(),this._cdr.markForCheck()}onFilterTypeChange(l){this.filterType=String(l||"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(e){return new(e||d)};static \u0275cmp=s.VBU({type:d,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(e,c){1&e&&(s.j41(0,"cue-flexcontainer",0)(1,"cue-select",1),s.bIt("valueChange",function(n){return c.onFilterTypeChange(n)}),s.k0s(),s.nVh(2,v,1,1,"cue-input",2),s.nVh(3,i,2,0,"cue-typography",3),s.k0s()),2&e&&(s.R7$(),s.Y8G("value",c.filterType)("options",c.filterTypeOptions)("labelMap",c.filterTypeLabelMap()),s.R7$(),s.vxM(c.showTextInput()?2:-1),s.R7$(),s.vxM(c.filterText||"contains"!==c.filterType?3:-1))},dependencies:[x.Input,T.Select,k.Typography,o.FlexContainer],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 d})()},5448(O,M,a){a.d(M,{ButtonLabel:()=>x});var E=a(7705),_=a(2245),u=a(5547);const f=["*"];let x=(()=>{class T{fontSize=(0,E.hFB)("m");italic=(0,E.hFB)(!1);noWrap=(0,E.hFB)(!0);static \u0275fac=function(s){return new(s||T)};static \u0275cmp=u.VBU({type:T,selectors:[["cue-button-label"]],inputs:{fontSize:[1,"fontSize"],italic:[1,"italic"],noWrap:[1,"noWrap"]},ngContentSelectors:f,decls:3,vars:3,consts:[[3,"size","italic","noWrap"]],template:function(s,v){1&s&&(u.NAR(),u.j41(0,"div")(1,"cue-typography",0),u.SdG(2),u.k0s()()),2&s&&(u.R7$(),u.Y8G("size",v.fontSize())("italic",v.italic())("noWrap",v.noWrap()))},dependencies:[_.Typography],styles:["div[_ngcontent-%COMP%]{transform:translateY(.05em)}"]})}return T})()},6103(O,M,a){a.d(M,{N:()=>f});var E=a(2306),_=a(140),u=a(58);function f({entityData:x,availableEntityRelationships:T}){const k=d=>T.find(p=>p.iri===d)?.label??d.split("#").pop()??d,o=[],s={};for(const[d,p]of Object.entries(x)){for(const l of p.directMapGeometries??[])o.push({iri:d,wkt:l.wkt});for(const l of p.indirectMapGeometries??[]){s[l.rel]||(s[l.rel]=[]);for(const e of l.geometries)s[l.rel].push({iri:l.entityUUID,wkt:e.wkt})}}const v=(d,p,l)=>{if(!p.length)return null;const e=new E.ux(d,d);return e.category=l,e.collection=new _.o(p.flatMap(({iri:c,wkt:r})=>{const n=(0,u.S)(r);return n?[{type:"Feature",geometry:(0,u.n)(n),properties:{iri:c}}]:[]})),e},i=[],D=v("direct",o,"Direct");D&&i.push(D);for(const[d,p]of Object.entries(s)){const l=k(d),e=v(l,p,l);e&&i.push(e)}return i}},7643(O,M,a){a.d(M,{CueEntityList:()=>r});var E=a(467),_=a(7705),u=a(5802),f=a(2271),x=a(2839),T=a(5381),k=a(2245),o=a(9769),s=a(7851),v=a(7293),i=a(5547);function D(n,y){if(1&n&&(i.j41(0,"cue-flexcontainer",2)(1,"cue-typography",4),i.EFF(2),i.k0s()()),2&n){const t=i.XpG(2);i.R7$(2),i.SpI(" ",t.errorMessage()," ")}}function d(n,y){if(1&n){const t=i.RV6();i.j41(0,"cue-ent-list-inner",7),i.bIt("rowClicked",function(g){u.eBV(t);const m=i.XpG(3);return u.Njj(m.rowClicked.emit(g))})("clickedOpen",function(g){u.eBV(t);const m=i.XpG(3);return u.Njj(m.clickedOpen.emit(g))}),i.k0s()}if(2&n){const t=i.XpG(3);i.Y8G("entities",t._displayIris())("entityData",t.entityData())("handlers",t.handlers())("mapboxToken",t.mapboxToken())("paginationPageSize",t.paginationPageSize())("size",t.size())("variant",t.variant())}}function p(n,y){1&n&&(i.j41(0,"cue-flexcontainer",2)(1,"cue-typography",8),i.EFF(2," No project connected. "),i.k0s()())}function l(n,y){if(1&n&&i.nrm(0,"cue-logo-link",6),2&n){let t;const h=i.XpG(3);i.Y8G("projectId",null==(t=h.sdkState())?null:t.projectId)}}function e(n,y){if(1&n&&(i.j41(0,"div",3),i.nVh(1,d,1,7,"cue-ent-list-inner",5)(2,p,3,0,"cue-flexcontainer",2),i.nVh(3,l,1,1,"cue-logo-link",6),i.k0s()),2&n){const t=i.XpG(2);i.Y8G("cueLogoLoader","loading"===t.state()),i.R7$(),i.vxM(t.handlers()?1:"loading"!==t.state()?2:-1),i.R7$(2),i.vxM(t.showLogo()?3:-1)}}function c(n,y){if(1&n&&i.nVh(0,D,3,1,"cue-flexcontainer",2)(1,e,4,3,"div",3),2&n){const t=i.XpG();i.vxM("error"===t.state()?0:1)}}let r=(()=>{class n{iris=(0,_.hFB)([]);categoryIris=(0,_.hFB)(void 0);sdkState=(0,_.hFB)(void 0);mapboxToken=(0,_.hFB)(void 0);paginationPageSize=(0,_.hFB)(10,{transform:_.Udg});size=(0,_.hFB)("m");variant=(0,_.hFB)("none");showLogo=(0,_.hFB)(!1,{transform:_.L39});rowClicked=(0,_.CGW)();clickedOpen=(0,_.CGW)();state=(0,u.vPA)("idle");errorMessage=(0,u.vPA)(null);entityData=(0,u.vPA)({});_entities=(0,u.vPA)(void 0);_categoryResolvedIris=(0,u.vPA)([]);_displayIris=(0,f.EW)(()=>void 0!==this.categoryIris()?this._categoryResolvedIris():this.iris());_unsubscribe;_inputWarningTimer;handlers=(0,f.EW)(()=>{var t=this;const h=this._entities();if(h)return{requestData:(g,m)=>{const C=g.map(b=>b.split("/").pop()).filter(Boolean);h.requestEntityData(C,m)},requestLocations:g=>{if(!this.mapboxToken())return void console.warn("[cue-entity-list] No mapboxToken provided \u2014 skipping map location fetch.");const m=g.map(C=>C.split("/").pop()).filter(Boolean);h.requestEntityLocations(m)},checkHasLocations:(g=(0,E.A)(function*(m){const C=t.sdkState()?.cue,b=t.sdkState()?.projectId;if(!(t.mapboxToken()&&C&&b&&m.length))return!1;const L=`PREFIX qcy: <https://dev.qaecy.com/ont#>\nASK WHERE {\n ?entity qcy:hasEntityCategory ?cat .\n FILTER(?cat IN (${m.map(S=>`<${S}>`).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(L,b))?.boolean}catch{return!1}}),function(C){return g.apply(this,arguments)})};var g});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,u.QZP)(()=>{this._setupEntities(this.sdkState()?.entities)}),(0,u.QZP)(()=>{const t=this.categoryIris(),h=this._entities();void 0!==t&&this._fetchByCategories(t,h)})}ngOnDestroy(){clearTimeout(this._inputWarningTimer),this._teardown()}_setupEntities(t){if(this._teardown(),!t)return this._entities.set(void 0),this.entityData.set({}),void this.state.set("idle");this._entities.set(t),this.state.set("ready"),this._syncEntityData(t),this._unsubscribe=t.entityInfoMap.subscribe(()=>{this._syncEntityData(t)})}_syncEntityData(t){const h=t.entityInfoMap.get(),g={};for(const m of Object.keys(h)){const C=h[m],b=Array.isArray(C.documentRefs)?C.documentRefs.map(P=>"string"==typeof P?{id:P}:P):C.documentRefs;g[t.entityIri(m)]={...C,documentRefs:b}}this.entityData.set(g)}_fetchByCategories(t,h){var g=this;return(0,E.A)(function*(){if(h&&t.length){g.state.set("loading");try{const m=yield h.entitiesByCategory(t);g._categoryResolvedIris.set(m.map(C=>C.iri)),g.state.set("ready")}catch(m){console.error("[cue-entity-list] Failed to fetch entities by category",m),g.errorMessage.set("Failed to load entities for the given categories."),g.state.set("error")}}else g._categoryResolvedIris.set([])})()}_teardown(){this._unsubscribe?.(),this._unsubscribe=void 0}static \u0275fac=function(h){return new(h||n)};static \u0275cmp=i.VBU({type:n,selectors:[["cue-entity-list"]],inputs:{iris:[1,"iris"],categoryIris:[1,"categoryIris"],sdkState:[1,"sdkState"],mapboxToken:[1,"mapboxToken"],paginationPageSize:[1,"paginationPageSize"],size:[1,"size"],variant:[1,"variant"],showLogo:[1,"showLogo"]},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,"position","relative","height","100%","width","100%",3,"cueLogoLoader"],[2,"color","#c44","font-size","13px"],[2,"height","100%",3,"entities","entityData","handlers","mapboxToken","paginationPageSize","size","variant"],[2,"position","absolute","top","12px","right","12px","z-index","5",3,"projectId"],[2,"height","100%",3,"rowClicked","clickedOpen","entities","entityData","handlers","mapboxToken","paginationPageSize","size","variant"],[2,"color","#9ca3af","font-size","13px"]],template:function(h,g){if(1&h&&(i.DNE(0,c,2,1,"ng-template",null,0,i.C5r),i.eu8(2,1)),2&h){const m=i.sdS(1);i.R7$(2),i.Y8G("ngTemplateOutlet",m)}},dependencies:[x.u,T.FlexContainer,k.Typography,o.T3,s.k,v.x],styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%}"],changeDetection:0})}return n})()}}]);
package/4098.js CHANGED
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkcue_ui=self.webpackChunkcue_ui||[]).push([[2014,4098],{2014(W,I,f){f.d(I,{ButtonPadder:()=>C});var g=f(7705),s=f(2271),_=f(5547);const q=["*"];let C=(()=>{class N{justify=(0,g.hFB)("start");size=(0,g.hFB)("l");widthStyle=(0,s.EW)(()=>`var(--cue-button-label-padding-${this.size()}-x)`);static \u0275fac=function(F){return new(F||N)};static \u0275cmp=_.VBU({type:N,selectors:[["cue-button-padder"]],inputs:{justify:[1,"justify"],size:[1,"size"]},ngContentSelectors:q,decls:2,vars:4,template:function(F,w){1&F&&(_.NAR(),_.rj2(0,"div"),_.SdG(1),_.eux()),2&F&&_.xc7("justify-content",w.justify())("min-width",w.widthStyle())},styles:["div[_ngcontent-%COMP%]{display:flex;align-items:center;min-height:1px}"]})}return N})()},7293(W,I,f){f.d(I,{x:()=>F});var g=f(7705),s=f(5802),_=f(2271),q=f(4613),C=f(9352),N=f(7089),S=f(5547);function E(w,Y){1&w&&S.nrm(0,"cue-logo",4)}let F=(()=>{class w{projectId=(0,g.hFB)(void 0);resourceId=(0,g.hFB)(void 0);_active=(0,s.vPA)(!0);onHover(){this._active.set(!1),requestAnimationFrame(()=>this._active.set(!0))}_title=(0,_.EW)(()=>this.projectId()&&this.resourceId()?"components.logoLink.showResourceInCue":this.projectId()?"components.logoLink.openProjectInCue":"components.logoLink.openCuePortal");_href=(0,_.EW)(()=>{const j=this.projectId(),A=this.resourceId();return j&&A?`https://cue.qaecy.com/r/${encodeURIComponent(j)}/${encodeURIComponent(A)}`:j?`https://cue.qaecy.com/home/projects?p=${encodeURIComponent(j)}`:"https://cue.qaecy.com/home/projects"});static \u0275fac=function(A){return new(A||w)};static \u0275cmp=S.VBU({type:w,selectors:[["cue-logo-link"]],inputs:{projectId:[1,"projectId"],resourceId:[1,"resourceId"]},decls:6,vars:5,consts:[["target","_blank","rel","noopener noreferrer",1,"link",3,"mouseenter","href"],[1,"logo-stack",3,"cueTooltip"],["size","xs",1,"logo-bg"],[1,"logo-fg"],["size","xs"]],template:function(A,G){1&A&&(S.j41(0,"a",0),S.bIt("mouseenter",function(){return G.onHover()}),S.j41(1,"div",1),S.nI1(2,"transloco"),S.nrm(3,"cue-logo",2),S.j41(4,"div",3),S.nVh(5,E,1,0,"cue-logo",4),S.k0s()()()),2&A&&(S.Y8G("href",G._href(),S.B4B),S.R7$(),S.Y8G("cueTooltip",S.bMT(2,3,G._title())),S.R7$(4),S.vxM(G._active()?5:-1))},dependencies:[q.Logo,N.d,C.Kj],styles:["[_nghost-%COMP%]{display:inline-block;line-height:0}.link[_ngcontent-%COMP%]{display:block;text-decoration:none;cursor:pointer}.logo-stack[_ngcontent-%COMP%]{position:relative;display:inline-block;line-height:0}.logo-bg[_ngcontent-%COMP%]{display:block;opacity:.3;transition:opacity .2s ease}.link[_ngcontent-%COMP%]:hover .logo-bg[_ngcontent-%COMP%]{opacity:.15}.logo-fg[_ngcontent-%COMP%]{position:absolute;inset:0;opacity:0;transition:opacity .15s ease}.link[_ngcontent-%COMP%]:hover .logo-fg[_ngcontent-%COMP%]{opacity:1}"],changeDetection:0})}return w})()},4098(W,I,f){f.d(I,{CueSparqlTable:()=>Jt});var g=f(7705),s=f(5802),_=f(2271),q=f(1492),C=f(467),N=f(7374),S=f.n(N),E=f(7400);function F(i,d,t=""){const a=d.valueKey??"val",n=d.priorityKey,o=d.fallback??t,l=d.preProcess?i.map(p=>{const c=p[a];return null==c?p:{...p,[a]:(0,E.w9)(d.preProcess,c)}}):i,r=(n?[...l].sort((p,c)=>{const m=p[n],h=c[n],y=Number(m),T=Number(h);return isNaN(y)||isNaN(T)?(h??"").localeCompare(m??""):T-y}):l).map(p=>p[a]).filter(p=>null!=p);if(0===r.length)return o;switch(d.type){case"first":default:return r[0];case"last":return r[r.length-1];case"random":return r[Math.floor(Math.random()*r.length)];case"count":return String(r.length);case"join":return r.join(d.separator??", ");case"longest":return r.reduce((p,c)=>c.length>p.length?c:p);case"shortest":return r.reduce((p,c)=>c.length<p.length?c:p);case"sum":{const p=r.map(Number).filter(c=>!isNaN(c));return p.length?String(p.reduce((c,m)=>c+m,0)):t}case"avg":{const p=r.map(Number).filter(c=>!isNaN(c));return p.length?String(p.reduce((c,m)=>c+m,0)/p.length):t}case"min":{const p=r.map(Number).filter(c=>!isNaN(c));return p.length?String(Math.min(...p)):t}case"max":{const p=r.map(Number).filter(c=>!isNaN(c));return p.length?String(Math.max(...p)):t}case"mostRecent":return[...r].sort((c,m)=>S()(m).valueOf()-S()(c).valueOf())[0];case"oldest":return[...r].sort((c,m)=>S()(c).valueOf()-S()(m).valueOf())[0];case"map":{const{map:p}=d;return p[r[0]]??o}}}const Y=Object.keys({first:"First",last:"Last",random:"Random",join:"Concatenate",count:"Count",longest:"Longest text",shortest:"Shortest text",map:"Map lookup",sum:"Sum",avg:"Average",min:"Minimum",max:"Maximum",mostRecent:"Most recent date",oldest:"Oldest date"}),j=["first","last","random","join","count"],A={text:[...j,"longest","shortest","map"],number:[...j,"sum","avg","min","max"],date:[...j,"mostRecent","oldest"]},G={first:"components.sparqlTable.strategyFirst",last:"components.sparqlTable.strategyLast",random:"components.sparqlTable.strategyRandom",join:"components.sparqlTable.strategyJoin",count:"components.sparqlTable.strategyCount",longest:"components.sparqlTable.strategyLongest",shortest:"components.sparqlTable.strategyShortest",map:"components.sparqlTable.strategyMap",sum:"components.sparqlTable.strategySum",avg:"components.sparqlTable.strategyAvg",min:"components.sparqlTable.strategyMin",max:"components.sparqlTable.strategyMax",mostRecent:"components.sparqlTable.strategyMostRecent",oldest:"components.sparqlTable.strategyOldest"},se={first:"components.sparqlTable.strategyFirstDesc",last:"components.sparqlTable.strategyLastDesc",random:"components.sparqlTable.strategyRandomDesc",join:"components.sparqlTable.strategyJoinDesc",count:"components.sparqlTable.strategyCountDesc",longest:"components.sparqlTable.strategyLongestDesc",shortest:"components.sparqlTable.strategyShortestDesc",map:"components.sparqlTable.strategyMapDesc",sum:"components.sparqlTable.strategySumDesc",avg:"components.sparqlTable.strategyAvgDesc",min:"components.sparqlTable.strategyMinDesc",max:"components.sparqlTable.strategyMaxDesc",mostRecent:"components.sparqlTable.strategyMostRecentDesc",oldest:"components.sparqlTable.strategyOldestDesc"};var U=f(7573);const H=`PREFIX qcy: <${U.E.qcy}>\nPREFIX qcy-e: <${U.E["qcy-e"]}>\n\nSELECT ?subject\nWHERE {\n ?subject a qcy:CanonicalEntity ;\n qcy:hasEntityCategory qcy-e:Person .\n}`;class re{field;headerName;sortable;filter;editable;hide;minWidth;cellStyle;headerClass;query="";defType="data";calculatedFrom;evaluation;datatype;postProcess;strategy;valueKey;labelKey;formatter=void 0;constructor(d="",t=""){this.field=d,this.headerName=t}getFormatter=()=>{if(this.formatter)return this.formatter;if(this.strategy){const d=this.strategy;return t=>F(t,d,"")}return d=>Array.isArray(d)?d.map(t=>t?.val??"").filter(Boolean).join(", "):String(d??"")}}var Te=f(4284),Se=f(2716),Me=f(222),k=f(6019);class Pe{queryHandler=(0,C.A)(function*(){throw new Error("No query handler defined")})}var ue=f(7089),e=f(5547);function xe(i,d){if(1&i&&(e.j41(0,"span",1),e.EFF(1),e.k0s()),2&i){const t=e.XpG();e.Y8G("cueTooltip",t._tooltip()),e.R7$(),e.SpI("\xd7",t._allValues().length)}}let Fe=(()=>{class i{_displayValue=(0,s.vPA)("");_allValues=(0,s.vPA)([]);_tooltip=(0,s.vPA)("");agInit(t){this._apply(t)}refresh(t){return this._apply(t),!0}_apply(t){const a=t.value,n=Array.isArray(a)?a:null!=a?[a]:[],o=t.colDef?.cellRendererParams?.strategy,l=t.colDef?.cellRendererParams?.valueKey??"val",r=t.colDef?.cellRendererParams?.labelKey??l,p=n.map(m=>m[r]).filter(Boolean);this._allValues.set(p);const c=t.colDef?.cellRendererParams?.postProcess;this._displayValue.set((0,E.g4)(o?F(n,o):p[0]??"",c)),this._tooltip.set(p.map(m=>(0,E.g4)(m,c)).join("\n"))}static \u0275fac=function(a){return new(a||i)};static \u0275cmp=e.VBU({type:i,selectors:[["cue-multi-binding-cell-renderer"]],decls:3,vars:2,consts:[[1,"cell-value"],["cueTooltipPosition","bottomleft",1,"badge",3,"cueTooltip"]],template:function(a,n){1&a&&(e.j41(0,"span",0),e.EFF(1),e.k0s(),e.nVh(2,xe,2,2,"span",1)),2&a&&(e.R7$(),e.JRh(n._displayValue()),e.R7$(),e.vxM(n._allValues().length>1?2:-1))},dependencies:[ue.d],styles:["[_nghost-%COMP%]{display:flex;align-items:center;gap:4px;overflow:hidden;width:100%}.cell-value[_ngcontent-%COMP%]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1}.badge[_ngcontent-%COMP%]{flex-shrink:0;font-size:10px;font-weight:600;background:var(--cue-color-blue, #2563eb);color:#fff;border-radius:8px;padding:0 5px;line-height:16px;cursor:default}"],changeDetection:0})}return i})();const de=["template","formula","pipeline"],pe=["add","subtract","multiply","divide"],je={template:"components.sparqlTable.evalTypeTemplate",formula:"components.sparqlTable.evalTypeFormula",pipeline:"components.sparqlTable.evalTypePipeline"},Ae={template:"components.sparqlTable.evalTypeTemplateDesc",formula:"components.sparqlTable.evalTypeFormulaDesc",pipeline:"components.sparqlTable.evalTypePipelineDesc"},Ne={add:"components.sparqlTable.formulaOpAdd",subtract:"components.sparqlTable.formulaOpSubtract",multiply:"components.sparqlTable.formulaOpMultiply",divide:"components.sparqlTable.formulaOpDivide"};let B=(()=>{class i{_requestedColumns=[];_columnQueries={};emptyTableText=(0,s.vPA)("Building table");_columns=(0,s.vPA)([]);_columnsGross=(0,s.vPA)(void 0);_dataColumns=(0,s.vPA)(void 0);columnDefsGross=(0,_.EW)(()=>void 0===this._columnsGross()?this._columns():this._columnsGross());keyVals={};_handlers=(0,s.vPA)(new Pe);destroy(){this.keyVals={},this._requestedColumns=[],this._columnQueries={},this.fetchedColumns.update(()=>[])}resetData(){this.keyVals={},this._requestedColumns=[],this._columnQueries={},this.fetchedColumns.update(()=>[])}mergeColumnData(t,a,n){Object.entries(a).forEach(([o,l])=>{this.keyVals[o]||(this.keyVals[o]={}),void 0===this.keyVals[o][t]&&(this.keyVals[o][t]=l)}),this._requestedColumns.includes(t)||this._requestedColumns.push(t),this._columnQueries[t]=n,this.fetchedColumns.update(o=>[...o,t])}injectPreloadedData(t,a,n){this.keyVals=t,this._requestedColumns=[...a],this._columnQueries={...n},this.fetchedColumns.update(()=>[...a])}fetchedColumns=(0,s.vPA)([],{equal:(t,a)=>t.length===a.length});isLoading=(0,_.EW)(()=>this._columns().length>0&&this.fetchedColumns().length<this.totalQueryCount());totalQueryCount=(0,_.EW)(()=>{const t=new Set;for(const a of this._columns())"data"===a.defType&&!a.hide&&a.query&&t.add(a.field);return t.size});columnDefsAG=(0,_.EW)(()=>{const t=[];return this._columns().forEach(a=>{const n=a.getFormatter();if("calculated"===a.defType){const o=this._columns().filter(r=>"data"===r.defType).map(r=>r.field);if(Array.from(new Set(o)).every(r=>this.fetchedColumns().includes(r))){const r=a.formatter??n;t.push({colId:a.field,headerName:a.headerName,sortable:!0,filter:!0,...a.minWidth?{minWidth:a.minWidth}:{},valueGetter:p=>r(null,p.data)})}}else if("evaluation"===a.defType){const o=this._columns().filter(r=>"data"===r.defType).map(r=>r.field);if(Array.from(new Set(o)).every(r=>this.fetchedColumns().includes(r))&&a.evaluation){const r=a.evaluation,p=this._columns();t.push({colId:a.field,headerName:a.headerName,hide:a.hide,flex:1,sortable:!0,filter:!0,valueGetter:c=>{const m=c.data??{},h={};for(const y of p)if("data"===y.defType){const T=y.getFormatter();h[y.field]=(0,E.g4)(T(m[y.field]??[]),y.postProcess)}return function we(i,d,t="",a){switch(i.type){case"template":return i.template.replace(/\$\{([\w.-]+)\}/g,(n,o)=>d[o]??"").trim();case"formula":{const n=i.fields.map(o=>parseFloat(d[o])).filter(o=>!isNaN(o));if(0===n.length)return t;switch(i.op){case"add":return String(n.reduce((o,l)=>o+l,0));case"subtract":return String(n.reduce((o,l)=>o-l));case"multiply":return String(n.reduce((o,l)=>o*l,1));case"divide":return n.length<2||0===n[1]?t:String(n[0]/n[1])}return t}case"pipeline":{const{sources:n,transform:o,exclude:l,deduplicate:u,sort:r,limit:p,valueKey:c="val"}=i,m=i.separator??", ",h=i.fallback??t,y=new Set,T=[];for(const R of n){let D=(a?.[R]??[]).map(b=>b[c]??"").filter(b=>""!==b);o&&(D=D.map(b=>(0,E.w9)(o,b))),l?.length&&(D=D.filter(b=>!l.includes(b)));for(const b of D)u&&y.has(b)||(y.add(b),T.push(b))}r&&T.sort();const v=void 0!==p?T.slice(0,p):T;return 0===v.length?h:v.join(m)}}}(r,h,"",m)}})}}else{const o=!!a.strategy;t.push({field:a.field,headerName:a.headerName,hide:a.hide,flex:1,sortable:!0,filter:!0,...a.minWidth?{minWidth:a.minWidth}:{},...a.cellStyle?{cellStyle:a.cellStyle}:{},...a.headerClass?{headerClass:a.headerClass}:{},valueGetter:o?l=>l.data?.[a.field]??[]:l=>(0,E.g4)(n(l.data?.[a.field]??[]),a.postProcess),...o?{comparator:(l,u)=>{const r=Array.isArray(l)?l:[],p=Array.isArray(u)?u:[],c=(0,E.g4)(F(r,a.strategy,""),a.postProcess),m=(0,E.g4)(F(p,a.strategy,""),a.postProcess);return c.localeCompare(m)},cellRenderer:Fe,cellRendererParams:{strategy:a.strategy,valueKey:a.valueKey??"val",labelKey:a.labelKey,postProcess:a.postProcess}}:{}})}}),t});set columns(t){t.forEach(a=>{a.field&&void 0!==this._columnQueries[a.field]&&this._columnQueries[a.field]!==a.query&&(this._requestedColumns=this._requestedColumns.filter(n=>n!==a.field),Object.values(this.keyVals).forEach(n=>delete n[a.field]),this.fetchedColumns.update(n=>n.filter(o=>o!==a.field))),this._columnQueries[a.field]=a.query}),this._columns.set(t),this.buildTable()}set columnsGross(t){this._columnsGross.set(t)}set dataColumns(t){this._dataColumns.set(t)}set handlers(t){this._handlers.set(t)}get visibleColumns(){return this._columns}buildTable(){var t=this;return(0,C.A)(function*(){const a=t._columns(),n=t._dataColumns(),o=a.filter(r=>"data"===r.defType&&!r.hide),l=n?.filter(r=>"data"===r.defType&&!r.hide);if(!o.length&&!l?.length)return void((a.length>0||(n?.length??0)>0)&&t.emptyTableText.set("No data columns defined"));t.emptyTableText.set("Building table...");const u=[];o.forEach(r=>{u.push(t.fetchColumnData(r))}),l?.forEach(r=>{u.push(t.fetchColumnData(r))}),yield Promise.all(u),t.emptyTableText.set("Table data downloaded")})()}fetchColumnData(t){var a=this;return(0,C.A)(function*(){if(a._requestedColumns.includes(t.field))return;a._requestedColumns.push(t.field);const n=(0,k.t)(t.query),o=yield a._handlers().queryHandler(t.query,n),l=new Set;o.results.bindings.forEach(u=>{const r=u.subject?.value,p=Object.keys(u).filter(m=>"subject"!==m),c={};p.forEach(m=>{const h=u[m]?.value;Object.keys(a.keyVals).includes(r)||(a.keyVals[r]={}),void 0===a.keyVals[r][t.field]&&(a.keyVals[r][t.field]=[]),c[m]=h}),a.keyVals[r][t.field].push(c),l.add(r)}),a.fetchedColumns.update(u=>[...u,t.field])})()}static \u0275fac=function(a){return new(a||i)};static \u0275prov=s.jDH({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})(),J=(()=>{class i{_isUpdating=!1;_pendingUpdate=!1;_dataFetchService=(0,s.WQX)(B);tableData=(0,s.vPA)([]);destroy(){this.tableData.update(()=>[])}onProcessedColumn=(0,s.QZP)((()=>{var t=this;return(0,C.A)(function*(){t._dataFetchService.fetchedColumns(),yield t._debouncedUpdateTableData()})})());_debouncedUpdateTableData(){var t=this;return(0,C.A)(function*(){t._isUpdating?t._pendingUpdate=!0:(t._isUpdating=!0,yield t._updateTableData(),t._isUpdating=!1,t._pendingUpdate&&(t._pendingUpdate=!1,yield t._debouncedUpdateTableData()))})()}_updateTableData(){var t=this;return(0,C.A)(function*(){return new Promise(a=>{const n={},o=Object.keys(t._dataFetchService.keyVals),l=[],u=t._dataFetchService.visibleColumns().map(p=>p.field);let r=!1;for(let p=0;p<o.length;p++){const c=o[p],m={};if(m.id=c,Object.keys(t._dataFetchService.keyVals[c]).forEach(h=>{Object.keys(n).includes(h)||(n[h]=0),m[h]=t._dataFetchService.keyVals[c][h]??[],""!==m[h]&&n[h]++}),l.push(m),!r&&9===p){let h=!0;for(const y of u)if(typeof m[y]>"u"){h=!1;break}h&&(t.tableData.update(()=>[...l]),r=!0)}}t.tableData.update(()=>l),a()})})()}static \u0275fac=function(a){return new(a||i)};static \u0275prov=s.jDH({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})();var V=f(2245),O=f(5381),Ie=f(2611);function ke(i,d){if(1&i&&e.nrm(0,"cue-typography",1),2&i){const t=e.XpG();e.Y8G("innerHTML",t.instructions(),e.npT)}}let Le=(()=>{class i{tableService=(0,s.WQX)(J);dataFetchService=(0,s.WQX)(B);handlers=g.hFB.required();columns=(0,g.geq)([]);columnsGross=(0,g.hFB)();dataColumns=(0,g.hFB)();showInstructions=(0,g.hFB)(!1);showPaginator=(0,g.hFB)(!0);paginationPageSize=(0,g.hFB)(10);settings=(0,g.hFB)(new Se.QA);emptyTableText=(0,g.geq)("Building table");loading=(0,g.hFB)(!1);clickableRows=(0,g.hFB)(!1);useAGGrid=(0,g.hFB)(!1);size=(0,g.hFB)("m");clickedRow=(0,g.CGW)();hoveredRow=(0,g.CGW)();tableDataUpdated=(0,g.CGW)();gridApi=(0,g.CGW)();visibleRows=(0,g.CGW)();columnDefsAG=(0,g.CGW)();onAGColumnDefs=(0,s.QZP)(()=>{const t=this.dataFetchService.columnDefsAG();this.columnDefsAG.emit(t)});onTableDataChange=(0,s.QZP)(()=>{this.tableDataUpdated.emit(this.tableService.tableData())});onHandlersChange=(0,s.QZP)(()=>{this.dataFetchService.handlers=this.handlers()});onColumnsChange=(0,s.QZP)(()=>{this.dataFetchService.columns=this.columns()});onColumnsGrossChange=(0,s.QZP)(()=>{this.dataFetchService.columnsGross=this.columnsGross()});onDataColumnsChange=(0,s.QZP)(()=>{this.dataFetchService.dataColumns=this.dataColumns()});onEmptyTableTextChange=(0,s.QZP)(()=>{this.emptyTableText.set(this.emptyTableText())});_onGridApiReady(t){this.gridApi.emit(t),t.addEventListener("columnVisible",a=>{a.visible&&(a.columns??(a.column?[a.column]:[])).forEach(o=>{const l=o.getColId(),u=this.columns().find(r=>r.field===l);u&&this.dataFetchService.fetchColumnData(u)})})}instructions=(0,s.vPA)("");buildInstructions=(0,s.QZP)((()=>{var t=this;return(0,C.A)(function*(){if(t.showInstructions()){const a=yield(0,Me.xI)('The component takes an array of SPARQL table columns. It is an extension of the regular table that adds a query to the column definition and restricts the formatter to always start with an array of values that should be converted to a string value (per default by comma joining).\n\nThere are some requirements for the SPARQL query:\n\n- Must be a SELECT query \n- Must use variable `?subject` to bind to the row identifier\n- No grouping needed since the component automatically groups by key and returns the remaining bindings as an array\n\nExample query:\n\n```sparql\nSELECT ?subject ?val \nWHERE { \n ?subject qcy:entityCategory qcy-e:Space ;\n qcy:hasProperty [\n qcy:label "LongName" ;\n qcy:value ?val\n ]\n}\n```\n\nThis query will outputs for the formatter in the following form (in this case with two bindings to the key/val):\n\n```json\n[{"val": "Room 101"}, {"val": "Room 01"}]\n```\n\nThese can then be used in a simple formatter that simply returns the first value or a - in case there are no bindings:\n\n```typescript\n(row) => row[0]?.val ?? \'-\'\n```\n\nLet\'s imagine that we instead had a query that would return bindings on the variables *?val* and *?score* and return bindings like this:\n\n```json\n[{"val": "Room 101", "score": "1"}, {"val": "Room 01", "score": "0.9"}]\n```\n\nA formatter could then take the highest score value:\n\n```typescript\n(row) => {\n const maxScore = 0;\n let val = "";\n row.forEach(r => {\n if(parseFloat(r.score) > maxScore) {\n maxScore = parseFloat(r.score);\n val = r.val;\n }\n });\n return val;\n}\n```\n\nThe formatter can also be more advanced and for example first format the values as dates using a library like DayJS before taking the most recent.\n');t.instructions.set(a)}})})());ngOnDestroy(){this.tableService.destroy(),this.dataFetchService.destroy()}static \u0275fac=function(a){return new(a||i)};static \u0275cmp=e.VBU({type:i,selectors:[["cue-sparql-table-inner"]],inputs:{handlers:[1,"handlers"],columns:[1,"columns"],columnsGross:[1,"columnsGross"],dataColumns:[1,"dataColumns"],showInstructions:[1,"showInstructions"],showPaginator:[1,"showPaginator"],paginationPageSize:[1,"paginationPageSize"],settings:[1,"settings"],emptyTableText:[1,"emptyTableText"],loading:[1,"loading"],clickableRows:[1,"clickableRows"],useAGGrid:[1,"useAGGrid"],size:[1,"size"]},outputs:{columns:"columnsChange",emptyTableText:"emptyTableTextChange",clickedRow:"clickedRow",hoveredRow:"hoveredRow",tableDataUpdated:"tableDataUpdated",gridApi:"gridApi",visibleRows:"visibleRows",columnDefsAG:"columnDefsAG"},decls:3,vars:8,consts:[["direction","column","gap","xl"],[3,"innerHTML"],[3,"gridApiReady","visibleRows","size","rowData","columnDefs","showPaginator","paginationPageSize","noRowsText","loading"]],template:function(a,n){1&a&&(e.j41(0,"cue-flexcontainer",0),e.nVh(1,ke,1,1,"cue-typography",1),e.j41(2,"cue-ag-grid",2),e.bIt("gridApiReady",function(l){return n._onGridApiReady(l)})("visibleRows",function(l){return n.visibleRows.emit(l)}),e.k0s()()),2&a&&(e.R7$(),e.vxM(n.showInstructions()?1:-1),e.R7$(),e.Y8G("size",n.size())("rowData",n.tableService.tableData())("columnDefs",n.dataFetchService.columnDefsAG())("showPaginator",n.showPaginator())("paginationPageSize",n.paginationPageSize())("noRowsText",n.dataFetchService.emptyTableText())("loading",n.loading()||n.dataFetchService.isLoading()))},dependencies:[V.Typography,O.FlexContainer,Ie.R],encapsulation:2,changeDetection:0})}return i})();var qe=f(9079),z=f(9352),_e=f(63),me=f(8957),Z=f(5971),fe=f(3319),ge=f(2530),ee=f(1096),he=f(5448),Ge=f(2014),Q=f(6593);const te=(i,d)=>d.field;function Oe(i,d){if(1&i&&(e.j41(0,"cue-typography",6),e.EFF(1),e.k0s()),2&i){const t=e.XpG(2);e.R7$(),e.SpI(" ",t._queryError()," ")}}function Qe(i,d){if(1&i){const t=e.RV6();e.j41(0,"cue-button",17),e.bIt("click",function(){s.eBV(t);const n=e.XpG(2);return s.Njj(n.discardQuery())}),e.nrm(1,"cue-button-padder"),e.j41(2,"cue-button-label"),e.EFF(3),e.nI1(4,"transloco"),e.k0s(),e.nrm(5,"cue-button-padder"),e.k0s()}2&i&&(e.R7$(3),e.JRh(e.bMT(4,1,"components.sparqlTable.labelDiscard")))}function $e(i,d){1&i&&(e.j41(0,"cue-typography",11),e.EFF(1),e.nI1(2,"transloco"),e.k0s()),2&i&&(e.R7$(),e.SpI(" ",e.bMT(2,1,"components.sparqlTable.labelQueryPending")," "))}function Be(i,d){if(1&i&&(e.j41(0,"cue-typography",6),e.EFF(1),e.k0s()),2&i){const t=e.XpG(2);e.R7$(),e.SpI(" ",t._testError()," ")}}function ze(i,d){if(1&i&&(e.j41(0,"cue-typography",19),e.EFF(1),e.k0s()),2&i){const t=d.$implicit;e.R7$(),e.JRh(t)}}function Xe(i,d){if(1&i&&(e.j41(0,"cue-typography",18),e.EFF(1),e.nI1(2,"transloco"),e.k0s(),e.Z7z(3,ze,2,1,"cue-typography",19,e.Vm6)),2&i){const t=e.XpG(2);e.R7$(),e.JRh(e.bMT(2,1,"components.sparqlTable.labelTestResults")),e.R7$(2),e.Dyx(t._testRows())}}function Ke(i,d){if(1&i){const t=e.RV6();e.j41(0,"cue-input",20),e.nI1(1,"transloco"),e.bIt("valueChange",function(n){s.eBV(t);const o=e.XpG(2);return s.Njj(o._strategySeparator.set(n))}),e.k0s()}if(2&i){const t=e.XpG(2);e.Y8G("label",e.bMT(1,2,"components.sparqlTable.labelSeparator"))("value",t._strategySeparator())}}function We(i,d){if(1&i){const t=e.RV6();e.j41(0,"cue-input",20),e.nI1(1,"transloco"),e.bIt("valueChange",function(n){s.eBV(t);const o=e.XpG(2);return s.Njj(o._strategyValueKey.set(n))}),e.k0s()}if(2&i){const t=e.XpG(2);e.Y8G("label",e.bMT(1,2,"components.sparqlTable.labelValueKey"))("value",t._strategyValueKey())}}function Ye(i,d){if(1&i){const t=e.RV6();e.j41(0,"cue-input",16),e.nI1(1,"transloco"),e.nI1(2,"transloco"),e.bIt("valueChange",function(n){s.eBV(t);const o=e.XpG(2);return o._strategyPriorityKey.set(n),s.Njj(o._applyStrategyChange())}),e.k0s()}if(2&i){const t=e.XpG(2);e.Y8G("label",e.bMT(1,3,"components.sparqlTable.labelPriorityKey"))("info",e.bMT(2,5,"components.sparqlTable.tooltipPriorityKey"))("value",t._strategyPriorityKey())}}function Ue(i,d){if(1&i&&(e.j41(0,"cue-typography",6),e.EFF(1),e.k0s()),2&i){const t=e.XpG(3);e.R7$(),e.SpI(" ",t._strategyMapError()," ")}}function He(i,d){if(1&i){const t=e.RV6();e.j41(0,"cue-typography",3),e.nI1(1,"transloco"),e.EFF(2),e.nI1(3,"transloco"),e.k0s(),e.j41(4,"div",21)(5,"cue-code-editor",22),e.bIt("contentChanged",function(n){s.eBV(t);const o=e.XpG(2);return s.Njj(o._onMapJsonChanged(n))}),e.k0s()(),e.nVh(6,Ue,2,1,"cue-typography",6)}if(2&i){const t=e.XpG(2);e.Y8G("info",e.bMT(1,4,"components.sparqlTable.tooltipMapJson")),e.R7$(2),e.SpI(" ",e.bMT(3,6,"components.sparqlTable.labelMapJson")," "),e.R7$(3),e.Y8G("content",t._strategyMapJson()),e.R7$(),e.vxM(t._strategyMapError()?6:-1)}}function Je(i,d){if(1&i&&(e.j41(0,"cue-typography",6),e.EFF(1),e.k0s()),2&i){const t=e.XpG(2);e.R7$(),e.SpI(" ",t._strategyPreProcessError()," ")}}function Ze(i,d){if(1&i){const t=e.RV6();e.j41(0,"cue-typography",3),e.nI1(1,"transloco"),e.EFF(2),e.nI1(3,"transloco"),e.k0s(),e.j41(4,"div",4)(5,"cue-code-editor",5),e.bIt("contentChanged",function(n){s.eBV(t);const o=e.XpG();return s.Njj(o.onQueryChanged(n))}),e.k0s()(),e.nVh(6,Oe,2,1,"cue-typography",6),e.j41(7,"cue-flexcontainer",7),e.nVh(8,Qe,6,3,"cue-button",8),e.j41(9,"cue-button",9),e.bIt("click",function(){s.eBV(t);const n=e.XpG();return s.Njj(n.testQuery())}),e.nrm(10,"cue-button-padder")(11,"cue-button-icon",10),e.j41(12,"cue-button-label"),e.EFF(13),e.nI1(14,"transloco"),e.k0s(),e.nrm(15,"cue-button-padder"),e.k0s()(),e.nVh(16,$e,3,3,"cue-typography",11),e.nVh(17,Be,2,1,"cue-typography",6),e.nVh(18,Xe,5,3),e.j41(19,"cue-select",2),e.nI1(20,"transloco"),e.bIt("valueChange",function(n){s.eBV(t);const o=e.XpG();return s.Njj(o.setDatatype(n))}),e.k0s(),e.j41(21,"cue-select",12),e.nI1(22,"transloco"),e.nI1(23,"transloco"),e.bIt("valueChange",function(n){s.eBV(t);const o=e.XpG();return s.Njj(o.setStrategyType(n))}),e.k0s(),e.j41(24,"cue-typography",13),e.EFF(25),e.k0s(),e.nVh(26,Ke,2,4,"cue-input",14),e.nVh(27,We,2,4,"cue-input",14),e.nVh(28,Ye,3,7,"cue-input",15),e.nVh(29,He,7,8),e.j41(30,"cue-input",16),e.nI1(31,"transloco"),e.nI1(32,"transloco"),e.bIt("valueChange",function(n){s.eBV(t);const o=e.XpG();return o._strategyPreProcess.set(n),s.Njj(o._applyStrategyChange())}),e.k0s(),e.nVh(33,Je,2,1,"cue-typography",6),e.j41(34,"cue-input",16),e.nI1(35,"transloco"),e.nI1(36,"transloco"),e.bIt("valueChange",function(n){s.eBV(t);const o=e.XpG();return o._strategyFallback.set(n),s.Njj(o._applyStrategyChange())}),e.k0s()}if(2&i){const t=e.XpG();e.Y8G("info",e.bMT(1,31,"components.sparqlTable.tooltipQuery")),e.R7$(2),e.JRh(e.bMT(3,33,"components.sparqlTable.labelQuery")),e.R7$(3),e.Y8G("content",t.query()),e.R7$(),e.vxM(t._queryError()?6:-1),e.R7$(2),e.vxM(t._queryDirty()?8:-1),e.R7$(),e.Y8G("disabled",!!t._queryError()),e.R7$(4),e.JRh(e.bMT(14,35,"components.sparqlTable.labelTest")),e.R7$(3),e.vxM(t._queryDirty()&&!t._queryError()?16:-1),e.R7$(),e.vxM(t._testError()?17:-1),e.R7$(),e.vxM(t._testRows().length>0?18:-1),e.R7$(),e.Y8G("label",e.bMT(20,37,"components.sparqlTable.labelDatatype"))("value",t._datatype()??"")("options",t.datatypeOptions)("labelMap",t.datatypeLabelMap()),e.R7$(2),e.Y8G("label",e.bMT(22,39,"components.sparqlTable.labelStrategy"))("info",e.bMT(23,41,"components.sparqlTable.tooltipStrategy"))("value",t._strategyType())("options",t.availableStrategyTypes())("labelMap",t.strategyLabelMap()),e.R7$(4),e.JRh(t._strategyDescription()),e.R7$(),e.vxM(t._strategyNeedsSeparator()?26:-1),e.R7$(),e.vxM(t._strategyNeedsValueKey()?27:-1),e.R7$(),e.vxM(t._strategyNeedsPriorityKey()?28:-1),e.R7$(),e.vxM(t._strategyNeedsMap()?29:-1),e.R7$(),e.Y8G("label",e.bMT(31,43,"components.sparqlTable.labelPreProcess"))("info",e.bMT(32,45,"components.sparqlTable.tooltipPreProcess"))("value",t._strategyPreProcess()),e.R7$(3),e.vxM(t._strategyPreProcessError()?33:-1),e.R7$(),e.Y8G("label",e.bMT(35,47,"components.sparqlTable.labelFallback"))("info",e.bMT(36,49,"components.sparqlTable.tooltipFallback"))("value",t._strategyFallback())}}function et(i,d){if(1&i){const t=e.RV6();e.j41(0,"span",26),e.bIt("click",function(){const n=s.eBV(t).$implicit,o=e.XpG(4);return s.Njj(o._insertFieldIntoTemplate(n.field))}),e.EFF(1),e.k0s()}if(2&i){const t=d.$implicit;e.Y8G("title",t.headerName),e.R7$(),e.JRh(t.token)}}function tt(i,d){if(1&i&&(e.j41(0,"cue-typography",13),e.EFF(1),e.nI1(2,"transloco"),e.k0s(),e.j41(3,"cue-flexcontainer",24),e.Z7z(4,et,2,2,"span",25,te),e.k0s()),2&i){const t=e.XpG(3);e.R7$(),e.SpI(" ",e.bMT(2,1,"components.sparqlTable.labelAvailableFields")," "),e.R7$(3),e.Dyx(t._dataColumnFields())}}function nt(i,d){if(1&i){const t=e.RV6();e.j41(0,"cue-input",16),e.nI1(1,"transloco"),e.nI1(2,"transloco"),e.bIt("valueChange",function(n){s.eBV(t);const o=e.XpG(2);return o._evalTemplate.set(n),s.Njj(o._applyEvaluation())}),e.k0s(),e.nVh(3,tt,6,3)}if(2&i){const t=e.XpG(2);e.Y8G("label",e.bMT(1,4,"components.sparqlTable.labelEvalTemplate"))("info",e.bMT(2,6,"components.sparqlTable.tooltipEvalTemplate"))("value",t._evalTemplate()),e.R7$(3),e.vxM(t._dataColumnFields().length?3:-1)}}function at(i,d){if(1&i){const t=e.RV6();e.j41(0,"span",26),e.bIt("click",function(){const n=s.eBV(t).$implicit,o=e.XpG(3);return s.Njj(o._toggleFormulaField(n.field))}),e.EFF(1),e.k0s()}if(2&i){const t=d.$implicit,a=e.XpG(3);e.AVh("field-chip--active",a._formulaFields().includes(t.field)),e.Y8G("title",t.field),e.R7$(),e.JRh(t.headerName)}}function ot(i,d){if(1&i&&(e.j41(0,"span",30),e.EFF(1),e.k0s()),2&i){const t=e.XpG(5);e.R7$(),e.JRh(t._formulaOpSymbol())}}function it(i,d){if(1&i&&(e.j41(0,"span",29),e.EFF(1),e.k0s(),e.nVh(2,ot,2,1,"span",30)),2&i){const t=d.$implicit,a=d.$index,n=d.$count,o=e.XpG(4);e.R7$(),e.JRh(o._fieldLabel(t)),e.R7$(),e.vxM(a!==n-1?2:-1)}}function lt(i,d){if(1&i&&(e.j41(0,"cue-flexcontainer",28),e.Z7z(1,it,3,2,null,null,e.fX1),e.k0s()),2&i){const t=e.XpG(3);e.R7$(),e.Dyx(t._formulaFields())}}function st(i,d){if(1&i){const t=e.RV6();e.j41(0,"cue-select",2),e.nI1(1,"transloco"),e.bIt("valueChange",function(n){s.eBV(t);const o=e.XpG(2);return s.Njj(o.setFormulaOp(n))}),e.k0s(),e.j41(2,"cue-typography",13),e.EFF(3),e.nI1(4,"transloco"),e.k0s(),e.j41(5,"cue-flexcontainer",24),e.Z7z(6,at,2,4,"span",27,te),e.k0s(),e.nVh(8,lt,3,0,"cue-flexcontainer",28)}if(2&i){const t=e.XpG(2);e.Y8G("label",e.bMT(1,6,"components.sparqlTable.labelFormulaOp"))("value",t._formulaOp())("options",t.formulaOpOptions)("labelMap",t.formulaOpLabelMap()),e.R7$(3),e.SpI(" ",e.bMT(4,8,"components.sparqlTable.labelFormulaFields")," "),e.R7$(3),e.Dyx(t._dataColumnFields()),e.R7$(2),e.vxM(t._formulaFields().length?8:-1)}}function rt(i,d){if(1&i&&(e.j41(0,"cue-typography",23),e.EFF(1),e.nI1(2,"transloco"),e.k0s()),2&i){const t=e.XpG(2);e.R7$(),e.Lme(" ",e.bMT(2,2,"components.sparqlTable.labelEvalPreview"),": ",t._evalPreview()," ")}}function ct(i,d){if(1&i){const t=e.RV6();e.j41(0,"span",26),e.bIt("click",function(){const n=s.eBV(t).$implicit,o=e.XpG(3);return s.Njj(o._togglePipelineSource(n.field))}),e.EFF(1),e.k0s()}if(2&i){const t=d.$implicit,a=e.XpG(3);e.AVh("field-chip--active",a._pipelineSources().includes(t.field)),e.Y8G("title",t.field),e.R7$(),e.JRh(t.headerName)}}function ut(i,d){if(1&i&&(e.j41(0,"cue-typography",11),e.EFF(1),e.nI1(2,"transloco"),e.k0s()),2&i){const t=e.XpG(3);e.R7$(),e.Lme(" ",e.bMT(2,2,"components.sparqlTable.labelPipelineSourceOrder"),": ",t._pipelineSources().join(" \u2192 ")," ")}}function dt(i,d){if(1&i&&(e.j41(0,"cue-typography",6),e.EFF(1),e.k0s()),2&i){const t=e.XpG(3);e.R7$(),e.JRh(t._pipelineTransformError())}}function pt(i,d){if(1&i&&(e.j41(0,"cue-typography",6),e.EFF(1),e.k0s()),2&i){const t=e.XpG(3);e.R7$(),e.JRh(t._pipelineExcludeError())}}function _t(i,d){if(1&i){const t=e.RV6();e.j41(0,"cue-typography",3),e.nI1(1,"transloco"),e.EFF(2),e.nI1(3,"transloco"),e.k0s(),e.j41(4,"cue-flexcontainer",24),e.Z7z(5,ct,2,4,"span",27,te),e.k0s(),e.nVh(7,ut,3,4,"cue-typography",11),e.j41(8,"cue-input",16),e.nI1(9,"transloco"),e.nI1(10,"transloco"),e.bIt("valueChange",function(n){s.eBV(t);const o=e.XpG(2);return o._pipelineTransform.set(n),s.Njj(o._applyEvaluation())}),e.k0s(),e.nVh(11,dt,2,1,"cue-typography",6),e.j41(12,"cue-input",16),e.nI1(13,"transloco"),e.nI1(14,"transloco"),e.bIt("valueChange",function(n){s.eBV(t);const o=e.XpG(2);return o._pipelineLimit.set(n),s.Njj(o._applyEvaluation())}),e.k0s(),e.j41(15,"cue-input",20),e.nI1(16,"transloco"),e.bIt("valueChange",function(n){s.eBV(t);const o=e.XpG(2);return o._pipelineSeparator.set(n),s.Njj(o._applyEvaluation())}),e.k0s(),e.j41(17,"cue-input",16),e.nI1(18,"transloco"),e.nI1(19,"transloco"),e.bIt("valueChange",function(n){s.eBV(t);const o=e.XpG(2);return o._pipelineFallback.set(n),s.Njj(o._applyEvaluation())}),e.k0s(),e.j41(20,"cue-flexcontainer",31)(21,"label",32)(22,"input",33),e.bIt("change",function(){s.eBV(t);const n=e.XpG(2);return n._pipelineDeduplicate.set(!n._pipelineDeduplicate()),s.Njj(n._applyEvaluation())}),e.k0s(),e.EFF(23),e.nI1(24,"transloco"),e.k0s(),e.j41(25,"label",32)(26,"input",33),e.bIt("change",function(){s.eBV(t);const n=e.XpG(2);return n._pipelineSort.set(!n._pipelineSort()),s.Njj(n._applyEvaluation())}),e.k0s(),e.EFF(27),e.nI1(28,"transloco"),e.k0s()(),e.j41(29,"cue-typography",3),e.nI1(30,"transloco"),e.EFF(31),e.nI1(32,"transloco"),e.k0s(),e.j41(33,"div",34)(34,"cue-code-editor",22),e.bIt("contentChanged",function(n){s.eBV(t);const o=e.XpG(2);return s.Njj(o._onPipelineExcludeChanged(n))}),e.k0s()(),e.nVh(35,pt,2,1,"cue-typography",6)}if(2&i){const t=e.XpG(2);e.Y8G("info",e.bMT(1,23,"components.sparqlTable.tooltipPipelineSources")),e.R7$(2),e.SpI(" ",e.bMT(3,25,"components.sparqlTable.labelPipelineSources")," "),e.R7$(3),e.Dyx(t._dataColumnFields()),e.R7$(2),e.vxM(t._pipelineSources().length>1?7:-1),e.R7$(),e.Y8G("label",e.bMT(9,27,"components.sparqlTable.labelPipelineTransform"))("info",e.bMT(10,29,"components.sparqlTable.tooltipPipelineTransform"))("value",t._pipelineTransform()),e.R7$(3),e.vxM(t._pipelineTransformError()?11:-1),e.R7$(),e.Y8G("label",e.bMT(13,31,"components.sparqlTable.labelPipelineLimit"))("info",e.bMT(14,33,"components.sparqlTable.tooltipPipelineLimit"))("value",t._pipelineLimit()),e.R7$(3),e.Y8G("label",e.bMT(16,35,"components.sparqlTable.labelSeparator"))("value",t._pipelineSeparator()),e.R7$(2),e.Y8G("label",e.bMT(18,37,"components.sparqlTable.labelFallback"))("info",e.bMT(19,39,"components.sparqlTable.tooltipFallback"))("value",t._pipelineFallback()),e.R7$(5),e.Y8G("checked",t._pipelineDeduplicate()),e.R7$(),e.SpI(" ",e.bMT(24,41,"components.sparqlTable.labelPipelineDeduplicate")," "),e.R7$(3),e.Y8G("checked",t._pipelineSort()),e.R7$(),e.SpI(" ",e.bMT(28,43,"components.sparqlTable.labelPipelineSort")," "),e.R7$(2),e.Y8G("info",e.bMT(30,45,"components.sparqlTable.tooltipPipelineExclude")),e.R7$(2),e.SpI(" ",e.bMT(32,47,"components.sparqlTable.labelPipelineExclude")," "),e.R7$(3),e.Y8G("content",t._pipelineExcludeJson()),e.R7$(),e.vxM(t._pipelineExcludeError()?35:-1)}}function mt(i,d){if(1&i){const t=e.RV6();e.j41(0,"cue-select",2),e.nI1(1,"transloco"),e.bIt("valueChange",function(n){s.eBV(t);const o=e.XpG();return s.Njj(o.setEvalType(n))}),e.k0s(),e.j41(2,"cue-typography",13),e.EFF(3),e.k0s(),e.nVh(4,nt,4,8),e.nVh(5,st,9,10),e.nVh(6,rt,3,4,"cue-typography",23),e.nVh(7,_t,36,49)}if(2&i){const t=e.XpG();e.Y8G("label",e.bMT(1,9,"components.sparqlTable.labelEvalType"))("value",t._evalType())("options",t.evaluationTypeOptions)("labelMap",t.evaluationTypeLabelMap()),e.R7$(3),e.JRh(t._evalTypeDescription()),e.R7$(),e.vxM("template"===t._evalType()?4:-1),e.R7$(),e.vxM("formula"===t._evalType()?5:-1),e.R7$(),e.vxM(t._evalPreview()?6:-1),e.R7$(),e.vxM("pipeline"===t._evalType()?7:-1)}}const ft=["join"],ye=["sum","avg","min","max","mostRecent","oldest","longest","shortest"],ve=["first","last","sum","avg","min","max","mostRecent","oldest","longest","shortest"],gt=["map"],be=["text","number","date"],ht=Object.assign(new ee.e,{});let yt=(()=>{class i{columnDef=g.geq.required();handlers=(0,g.hFB)();columns=(0,g.hFB)([]);close=(0,g.CGW)();updateColumnDef=(0,g.CGW)();agGridSettings=ht;_transloco=(0,s.WQX)(z.JO);_lang=(0,qe.ot)(this._transloco.langChanges$,{initialValue:this._transloco.getActiveLang()});columnTypeOptions=["data","evaluation"];columnTypeLabelMap=(0,_.EW)(()=>(this._lang(),{data:this._transloco.translate("components.sparqlTable.columnTypeData"),evaluation:this._transloco.translate("components.sparqlTable.columnTypeEvaluation")}));_defType=(0,_.uu)(()=>"evaluation"===this.columnDef().defType?"evaluation":"data");setDefType(t){const a=t;if(this._defType.set(a),"evaluation"===a){const o=this.columnDef().evaluation??{type:"template",template:""};this.updateColumnDef.emit({defType:"evaluation",evaluation:o})}else this.updateColumnDef.emit({defType:"data"})}_evalType=(0,_.uu)(()=>this.columnDef().evaluation?.type??"template");_evalTemplate=(0,_.uu)(()=>{const t=this.columnDef().evaluation;return"template"===t?.type?t.template:""});_formulaOp=(0,_.uu)(()=>{const t=this.columnDef().evaluation;return"formula"===t?.type?t.op:"add"});_formulaFields=(0,_.uu)(()=>{const t=this.columnDef().evaluation;return"formula"===t?.type?[...t.fields]:[]});_pipelineSources=(0,_.uu)(()=>{const t=this.columnDef().evaluation;return"pipeline"===t?.type?[...t.sources]:[]});_pipelineTransform=(0,_.uu)(()=>{const t=this.columnDef().evaluation;return"pipeline"===t?.type?t.transform??"":""});_pipelineLimit=(0,_.uu)(()=>{const t=this.columnDef().evaluation;return"pipeline"===t?.type?String(t.limit??""):""});_pipelineSeparator=(0,_.uu)(()=>{const t=this.columnDef().evaluation;return"pipeline"===t?.type?t.separator??", ":", "});_pipelineFallback=(0,_.uu)(()=>{const t=this.columnDef().evaluation;return"pipeline"===t?.type?t.fallback??"":""});_pipelineDeduplicate=(0,_.uu)(()=>{const t=this.columnDef().evaluation;return"pipeline"===t?.type&&(t.deduplicate??!1)});_pipelineSort=(0,_.uu)(()=>{const t=this.columnDef().evaluation;return"pipeline"===t?.type&&(t.sort??!1)});_pipelineExcludeJson=(0,_.uu)(()=>{const t=this.columnDef().evaluation,a="pipeline"===t?.type?t.exclude??[]:[];try{return JSON.stringify(a,null,2)}catch{return"[]"}});_pipelineExcludeError=(0,s.vPA)("");_pipelineExcludeParsed=(0,s.vPA)([]);_pipelineTransformError=(0,_.EW)(()=>{const t=this._pipelineTransform();if(t)return(0,E.NF)(t)??void 0});evaluationTypeOptions=de;evaluationTypeLabelMap=(0,_.EW)(()=>(this._lang(),Object.fromEntries(de.map(t=>[t,this._transloco.translate(je[t])]))));_evalTypeDescription=(0,_.EW)(()=>(this._lang(),this._transloco.translate(Ae[this._evalType()])));formulaOpOptions=pe;formulaOpLabelMap=(0,_.EW)(()=>(this._lang(),Object.fromEntries(pe.map(t=>[t,this._transloco.translate(Ne[t])]))));_dataColumnFields=(0,_.EW)(()=>this.columns().filter(t=>"data"===t.defType&&t.field!==this.columnDef().field).map(t=>({field:t.field,headerName:t.headerName??t.field,token:"${"+t.field+"}"})));_evalPreview=(0,_.EW)(()=>{if("template"===this._evalType()){const t=this._evalTemplate();return t?t.replace(/\$\{([\w.-]+)\}/g,(a,n)=>`[${n}]`):""}if("formula"===this._evalType()){const t=this._formulaFields(),a=this._formulaOp();return 0===t.length?"":t.join(` ${{add:"+",subtract:"\u2212",multiply:"\xd7",divide:"\xf7"}[a]} `)}if("pipeline"===this._evalType()){const t=this._pipelineSources(),a=this._pipelineTransform(),n=this._pipelineLimit();if(0===t.length)return"";const o=[`sources: [${t.join(", ")}]`];return a&&o.push(`transform: ${a}`),this._pipelineDeduplicate()&&o.push("deduplicate"),this._pipelineSort()&&o.push("sort"),n&&o.push(`limit: ${n}`),o.join(" | ")}return""});setEvalType(t){if(t){if(this._evalType.set(t),"pipeline"===t&&0===this._pipelineSources().length){const a=this._dataColumnFields()[0];a&&this._pipelineSources.set([a.field])}this._applyEvaluation()}}setFormulaOp(t){t&&(this._formulaOp.set(t),this._applyEvaluation())}_toggleFormulaField(t){const a=this._formulaFields(),n=a.includes(t)?a.filter(o=>o!==t):[...a,t];this._formulaFields.set(n),this._applyEvaluation()}_fieldLabel(t){return this._dataColumnFields().find(a=>a.field===t)?.headerName??t}_formulaOpSymbol=(0,_.EW)(()=>({add:"+",subtract:"\u2212",multiply:"\xd7",divide:"\xf7"}[this._formulaOp()]));_insertFieldIntoTemplate(t){const a=this._evalTemplate();this._evalTemplate.set(a+`\${${t}}`),this._applyEvaluation()}_togglePipelineSource(t){const a=this._pipelineSources(),n=a.includes(t)?a.filter(o=>o!==t):[...a,t];this._pipelineSources.set(n),this._applyEvaluation()}_applyEvaluation(){let t;if("template"===this._evalType())t={type:"template",template:this._evalTemplate()};else if("pipeline"===this._evalType()){const a={type:"pipeline",sources:this._pipelineSources(),deduplicate:this._pipelineDeduplicate()||void 0,sort:this._pipelineSort()||void 0,separator:this._pipelineSeparator()||void 0,fallback:this._pipelineFallback()||void 0,transform:this._pipelineTransform()||void 0,exclude:this._pipelineExcludeParsed().length?this._pipelineExcludeParsed():void 0},n=parseInt(this._pipelineLimit(),10);!isNaN(n)&&n>0&&(a.limit=n),t=a}else t={type:"formula",fields:this._formulaFields(),op:this._formulaOp()};this.updateColumnDef.emit({evaluation:t})}_onPipelineExcludeChanged(t){this._pipelineExcludeJson.set(t);try{const a=JSON.parse(t);if(!Array.isArray(a))throw new Error("Must be a JSON array of strings");this._pipelineExcludeError.set(""),this._pipelineExcludeParsed.set(a),this._applyEvaluation()}catch(a){this._pipelineExcludeError.set(a?.message??"Invalid JSON")}}datatypeOptions=be;datatypeLabelMap=(0,_.EW)(()=>(this._lang(),Object.fromEntries(be.map(t=>[t,this._transloco.translate(`components.sparqlTable.datatype${t.charAt(0).toUpperCase()+t.slice(1)}`)]))));availableStrategyTypes=(0,_.EW)(()=>{const t=this._datatype();return t?A[t]:Y});strategyLabelMap=(0,_.EW)(()=>(this._lang(),Object.fromEntries(Y.map(t=>[t,this._transloco.translate(G[t])]))));_strategyDescription=(0,_.EW)(()=>(this._lang(),this._transloco.translate(se[this._strategyType()])));query=(0,_.EW)(()=>this.columnDef().query??"");_editedQuery=(0,_.uu)(()=>this.query());_queryError=(0,_.EW)(()=>{this._lang();const t=function Ve(i,d="val"){if(!i?.trim())return null;let t;try{t=new Q.Parser({sparqlStar:!0}).parse(i)}catch{return"validationErrorSyntax"}if("query"!==t?.type||"SELECT"!==t?.queryType)return"validationErrorNotSelect";const n=t.variables;if(1===n.length&&"*"===n[0])return null;const o=n.map(l=>l?.value??l?.variable?.value??"");return o.includes("subject")?o.includes(d)?null:"validationErrorMissingVal":"validationErrorMissingKey"}(this._editedQuery(),this._strategyValueKey()||"val");if(!t)return;const a=`components.sparqlTable.${t}`;return"validationErrorMissingVal"===t?this._transloco.translate(a,{var:this._strategyValueKey()||"val"}):this._transloco.translate(a)});_datatype=(0,_.uu)(()=>this.columnDef().datatype);_strategyType=(0,_.uu)(()=>this.columnDef().strategy?.type??"join");_strategySeparator=(0,_.uu)(()=>this.columnDef().strategy?.separator??", ");_strategyValueKey=(0,_.uu)(()=>this.columnDef().strategy?.valueKey??"val");_strategyPriorityKey=(0,_.uu)(()=>this.columnDef().strategy?.priorityKey??"");_strategyPreProcess=(0,_.uu)(()=>this.columnDef().strategy?.preProcess??"");_strategyFallback=(0,_.uu)(()=>this.columnDef().strategy?.fallback??"");_strategyMapJson=(0,_.uu)(()=>{const t=this.columnDef().strategy;if("map"!==t?.type)return"{}";try{return JSON.stringify(t.map,null,2)}catch{return"{}"}});_strategyMapError=(0,s.vPA)("");_strategyNeedsSeparator=(0,_.EW)(()=>ft.includes(this._strategyType()));_strategyNeedsValueKey=(0,_.EW)(()=>ye.includes(this._strategyType()));_strategyNeedsPriorityKey=(0,_.EW)(()=>ve.includes(this._strategyType())&&this._queryExtraBindings().length>0);_strategyNeedsMap=(0,_.EW)(()=>gt.includes(this._strategyType()));_strategyPreProcessError=(0,_.EW)(()=>{const t=this._strategyPreProcess();return t?(0,E.NF)(t)??void 0:void 0});_queryExtraBindings=(0,_.EW)(()=>{const t=this._editedQuery(),a=this._strategyValueKey()||"val";if(!t?.trim())return[];try{const n=new Q.Parser({sparqlStar:!0}).parse(t);if("SELECT"!==n?.queryType)return[];const o=n.variables;return 1===o.length&&"*"===o[0]?[]:o.map(u=>u?.value??u?.variable?.value??"").filter(Boolean).filter(u=>"subject"!==u&&u!==a)}catch{return[]}});setDatatype(t){const a=t||void 0;if(this._datatype.set(a),a&&!A[a].includes(this._strategyType()))return this._strategyType.set("first"),void this.updateColumnDef.emit({strategy:{type:"first"},datatype:a});this.updateColumnDef.emit({datatype:a})}setStrategyType(t){if(!t)return;this._strategyType.set(t);const a=this._buildStrategy(t);this.updateColumnDef.emit({strategy:a})}_applyStrategyChange(){const t=this._buildStrategy(this._strategyType());this.updateColumnDef.emit({strategy:t})}_buildStrategy(t){const a=this._strategyValueKey()||"val",n=this._strategyPriorityKey()||void 0,u={preProcess:this._strategyPreProcess()||void 0,fallback:this._strategyFallback()||void 0};if("join"===t)return{type:t,separator:this._strategySeparator(),...u};if("map"===t){let r={};try{r=JSON.parse(this._strategyMapJson())}catch{}return{type:t,map:r,...u}}return ye.includes(t)?{type:t,valueKey:a,priorityKey:n,...u}:ve.includes(t)?{type:t,priorityKey:n,...u}:{type:t,...u}}_onMapJsonChanged(t){this._strategyMapJson.set(t);try{const a=JSON.parse(t);if("object"!=typeof a||Array.isArray(a))throw new Error("Must be a JSON object");this._strategyMapError.set(""),this._applyStrategyChange()}catch(a){this._strategyMapError.set(a?.message??"Invalid JSON")}}_queryDirty=(0,_.EW)(()=>this._editedQuery()!==this.query());onQueryChanged(t){this._editedQuery.set(t)}discardQuery(){this._editedQuery.set(this.query()),this._testRows.set([]),this._testError.set("")}_testRows=(0,s.vPA)([]);_testError=(0,s.vPA)("");_testLoading=(0,s.vPA)(!1);testQuery(){var t=this;return(0,C.A)(function*(){const a=t.handlers()?.queryHandler;if(!a)return void t._testError.set("No query handler available.");t._testRows.set([]),t._testError.set(""),t._testLoading.set(!0);const o=t._editedQuery().trim().replace(/\s*LIMIT\s+\d+\s*$/i,"")+"\nLIMIT 5";try{const u=((yield a(o,{}))?.results?.bindings??[]).map(r=>JSON.stringify(Object.fromEntries(Object.entries(r).map(([p,c])=>[p,c.value])),null,2));t._testRows.set(u),t.updateColumnDef.emit({query:t._editedQuery()})}catch(l){t._testError.set(l?.message??String(l))}finally{t._testLoading.set(!1)}})()}_onColDefUpdate(t){this.updateColumnDef.emit(t)}static \u0275fac=function(a){return new(a||i)};static \u0275cmp=e.VBU({type:i,selectors:[["cue-declarative-sparql-column-settings-modal"]],inputs:{columnDef:[1,"columnDef"],handlers:[1,"handlers"],columns:[1,"columns"]},outputs:{columnDef:"columnDefChange",close:"close",updateColumnDef:"updateColumnDef"},decls:7,vars:13,consts:[["minWidth","800px",3,"updateColumn","close","columnDef","settings","extraPanelLabel"],["cueExtraContent","","direction","column"],[3,"valueChange","label","value","options","labelMap"],["size","s",3,"info"],[2,"height","200px","min-height","120px"],["type","sparql",3,"contentChanged","content"],["size","s",2,"color","var(--cue-error)"],["direction","row","justify","end","gap","s"],["variant","ghost","size","s"],["variant","secondary","size","s",3,"click","disabled"],["icon","go"],["size","xs",2,"opacity","0.6","font-style","italic"],[3,"valueChange","label","info","value","options","labelMap"],["size","xs",2,"opacity","0.7"],[3,"label","value"],[3,"label","info","value"],[3,"valueChange","label","info","value"],["variant","ghost","size","s",3,"click"],["size","s"],["size","xs",2,"font-family","monospace","white-space","pre-wrap"],[3,"valueChange","label","value"],[2,"height","200px","min-height","120px","text-align","left"],["type","json",3,"contentChanged","content"],["size","xs",2,"opacity","0.7","font-style","italic"],["direction","row","wrap","wrap","gap","xs"],[1,"field-chip",3,"title"],[1,"field-chip",3,"click","title"],[1,"field-chip",3,"field-chip--active","title"],["direction","row","wrap","wrap","gap","xs",2,"align-items","center"],[1,"formula-token"],[1,"formula-op"],["direction","row","gap","m"],[2,"display","flex","align-items","center","gap","4px","font-size","0.85rem","cursor","pointer"],["type","checkbox",3,"change","checked"],[2,"height","160px","min-height","80px","text-align","left"]],template:function(a,n){1&a&&(e.j41(0,"cue-table-column-settings-modal",0),e.nI1(1,"transloco"),e.bIt("updateColumn",function(l){return n._onColDefUpdate(l)})("close",function(){return n.close.emit()}),e.j41(2,"cue-flexcontainer",1)(3,"cue-select",2),e.nI1(4,"transloco"),e.bIt("valueChange",function(l){return n.setDefType(l)}),e.k0s(),e.nVh(5,Ze,37,51),e.nVh(6,mt,8,11),e.k0s()()),2&a&&(e.Y8G("columnDef",n.columnDef())("settings",n.agGridSettings)("extraPanelLabel",e.bMT(1,9,"components.sparqlTable.panelLabel")),e.R7$(3),e.Y8G("label",e.bMT(4,11,"components.sparqlTable.labelColumnType"))("value",n._defType())("options",n.columnTypeOptions)("labelMap",n.columnTypeLabelMap()),e.R7$(2),e.vxM("data"===n._defType()?5:-1),e.R7$(),e.vxM("evaluation"===n._defType()?6:-1))},dependencies:[ee.T,O.FlexContainer,V.Typography,_e.Select,me.Input,Z.Button,fe.ButtonIcon,ge.B,he.ButtonLabel,Ge.ButtonPadder,z.Kj],styles:[".field-chip[_ngcontent-%COMP%]{display:inline-block;padding:2px 8px;border-radius:4px;background:var(--cue-surface-2, #eee);font-family:monospace;font-size:.75rem;cursor:pointer;-webkit-user-select:none;user-select:none;transition:background .12s,outline .12s;outline:2px solid transparent}.field-chip[_ngcontent-%COMP%]:hover{background:var(--cue-primary-light, #c8e6c9)}.field-chip--active[_ngcontent-%COMP%]{background:var(--cue-primary, #4caf50);color:#fff;outline-color:var(--cue-primary, #4caf50)}.formula-token[_ngcontent-%COMP%]{display:inline-block;padding:2px 8px;border-radius:4px;background:var(--cue-primary, #4caf50);color:#fff;font-family:monospace;font-size:.75rem}.formula-op[_ngcontent-%COMP%]{font-size:1rem;font-weight:700;opacity:.6;padding:0 2px}"],changeDetection:0})}return i})();var vt=f(5187),bt=f(7717),ne=f(5661),Dt=f(6117),Ct=f(356),Tt=f(6279),St=f(29),Mt=f(5821),Rt=f(5745);const Pt=(i,d)=>d.key;function Et(i,d){if(1&i){const t=e.RV6();e.j41(0,"cue-input",12),e.bIt("valueChange",function(n){s.eBV(t);const o=e.XpG().$implicit,l=e.XpG(2);return s.Njj(l._setVar(o.key,n))}),e.k0s()}if(2&i){const t=e.XpG().$implicit,a=e.XpG(2);e.Y8G("label",t.label)("value",a._varValues()[t.key]??a._filePathPlaceholder())}}function xt(i,d){if(1&i){const t=e.RV6();e.j41(0,"cue-select",13),e.bIt("valueChange",function(n){s.eBV(t);const o=e.XpG().$implicit,l=e.XpG(2);return s.Njj(l._setVar(o.key,n))}),e.k0s()}if(2&i){const t=e.XpG().$implicit,a=e.XpG(2);e.Y8G("label",t.label)("options",a._categoryOptions())("labelMap",a._categoryLabelMap())("value",a._varValues()[t.key]??void 0)("disabled",a._categoriesLoading())("placeholder",a._categoriesLoading()?"Loading\u2026":"Select a category\u2026")}}function Ft(i,d){if(1&i&&e.nVh(0,Et,1,2,"cue-input",10)(1,xt,1,6,"cue-select",11),2&i){const t=d.$implicit;e.vxM("text"===t.type?0:"select"===t.type?1:-1)}}function wt(i,d){1&i&&e.Z7z(0,Ft,2,1,null,null,Pt),2&i&&e.Dyx(d.variables)}function jt(i,d){1&i&&(e.j41(0,"div",6),e.EFF(1),e.nI1(2,"transloco"),e.k0s()),2&i&&(e.R7$(),e.JRh(e.bMT(2,1,d)))}const At=new Q.Parser({sparqlStar:!0}),De=`PREFIX qcy: <${U.E.qcy}>`,ae=[{id:"files-in-directory",label:"Files in a specific directory",template:`${De}\n\nSELECT DISTINCT ?subject\nWHERE {\n ?subject a qcy:FileContent ;\n qcy:hasFileLocation ?fl .\n ?fl qcy:filePath ?path .\n FILTER(STRSTARTS(STR(?path), "\${THE_FILE_PATH}"))\n\n # EXCLUDE DERIVED FILES\n FILTER NOT EXISTS {?x qcy:alternativeRepresentation ?subject}\n}`,variables:[{key:"THE_FILE_PATH",label:"File path",type:"text"}]},{id:"entities-of-category",label:"Entities of a specific category",template:`${De}\n\nSELECT DISTINCT ?subject\nWHERE {\n ?subject a qcy:CanonicalEntity ;\n qcy:hasEntityCategory <\${CATEGORY_IRI}> .\n}`,variables:[{key:"CATEGORY_IRI",label:"Category",type:"select"}]}];let Nt=(()=>{class i{rowDefinitionQuery=(0,g.geq)(null);handlers=(0,g.hFB)(void 0);close=(0,g.CGW)();saved=(0,g.CGW)();_draft=(0,_.uu)(()=>this.rowDefinitionQuery()||H);_selectedPredefinedId=(0,s.vPA)(null);_varValues=(0,s.vPA)({});_categories=(0,s.vPA)([]);_categoriesLoading=(0,s.vPA)(!1);_filePathPlaceholder=(0,s.vPA)("");_selectedPredefined=(0,_.EW)(()=>{const t=this._selectedPredefinedId();return t?ae.find(a=>a.id===t)??null:null});_predefinedOptions=ae.map(t=>t.id);_predefinedLabelMap=Object.fromEntries(ae.map(t=>[t.id,t.label]));_categoryOptions=(0,_.EW)(()=>this._categories().map(t=>t.iri));_categoryLabelMap=(0,_.EW)(()=>Object.fromEntries(this._categories().map(t=>[t.iri,t.label])));_resolvedTemplate=(0,_.EW)(()=>{const t=this._selectedPredefined();if(!t)return null;const a=this._varValues();let n=t.template;for(const o of t.variables)n=n.replaceAll(`\${${o.key}}`,a[o.key]??"");return n});constructor(){(0,s.QZP)(()=>{const t=this._selectedPredefined(),a=this.handlers();this._varValues.set({}),this._categories.set([]),this._filePathPlaceholder.set(""),t?.variables.some(n=>"select"===n.type)&&this._loadCategories(a),t?.variables.some(n=>"THE_FILE_PATH"===n.key)&&this._loadFilePathPlaceholder(a)}),(0,s.QZP)(()=>{const t=this._resolvedTemplate();null!==t&&this._draft.set(t)})}_loadCategories(t){var a=this;return(0,C.A)(function*(){const n=t?.contentCategoriesInProject;if(n){a._categoriesLoading.set(!0);try{const o=yield n();a._categories.set(o)}catch(o){console.error("[RowDefModal] _loadCategories \u2014 error:",o)}finally{a._categoriesLoading.set(!1)}}})()}_loadFilePathPlaceholder(t){var a=this;return(0,C.A)(function*(){const n=t?.randomFilePath;if(!n)return;const o=yield n();if(o){const l=o.replace(/\/?[^\/]*$/,"/");a._filePathPlaceholder.set(l),a._setVar("THE_FILE_PATH",l)}})()}_onPredefinedChange(t){this._selectedPredefinedId.set(null!=t?String(t):null)}_setVar(t,a){null!=a&&this._varValues.update(n=>({...n,[t]:String(a)}))}_validationError=(0,_.EW)(()=>{const t=this._draft().trim();if(!t)return null;try{const a=At.parse(t);if("SELECT"!==a?.queryType)return"components.sparqlTable.rowDefinitionErrorNotSelect";if(!a.variables.filter(l=>"*"!==l).map(l=>l?.value??l?.variable?.value??"").includes("subject"))return"components.sparqlTable.rowDefinitionErrorMissingSubject"}catch{return"components.sparqlTable.rowDefinitionErrorSyntax"}return null});_isSaveDisabled=(0,_.EW)(()=>!!this._draft().trim()&&!!this._validationError());_save(){this._draft()&&this._validationError()||(this.rowDefinitionQuery.set(this._draft()),this.saved.emit(),this.close.emit())}static \u0275fac=function(a){return new(a||i)};static \u0275cmp=e.VBU({type:i,selectors:[["cue-sparql-row-definition-modal"]],inputs:{rowDefinitionQuery:[1,"rowDefinitionQuery"],handlers:[1,"handlers"]},outputs:{rowDefinitionQuery:"rowDefinitionQueryChange",close:"close",saved:"saved"},decls:20,vars:20,consts:[[3,"close","label","minWidth"],["direction","column","gap","m",2,"padding","4px 0"],["size","s","color","secondary"],["label","Predefined query","placeholder","Custom query\u2026",3,"valueChange","options","labelMap","value"],[2,"height","200px","display","flex","flex-direction","column"],["type","sparql",2,"flex","1",3,"contentChange","content"],[1,"row-def-error"],["direction","row","gap","s","justify","end"],["variant","tertiary","size","s",3,"click"],["variant","primary","size","s",3,"click","disabled"],[3,"label","value"],[3,"label","options","labelMap","value","disabled","placeholder"],[3,"valueChange","label","value"],[3,"valueChange","label","options","labelMap","value","disabled","placeholder"]],template:function(a,n){if(1&a&&(e.j41(0,"cue-modal",0),e.nI1(1,"transloco"),e.bIt("close",function(){return n.close.emit()}),e.j41(2,"cue-flexcontainer",1)(3,"cue-typography",2),e.EFF(4),e.nI1(5,"transloco"),e.k0s(),e.j41(6,"cue-select",3),e.bIt("valueChange",function(l){return n._onPredefinedChange(l)}),e.k0s(),e.nVh(7,wt,2,0),e.j41(8,"div",4)(9,"cue-code-editor",5),e.bIt("contentChange",function(l){return n._draft.set(l)}),e.k0s()(),e.nVh(10,jt,3,3,"div",6),e.j41(11,"cue-flexcontainer",7)(12,"cue-button",8),e.bIt("click",function(){return n.close.emit()}),e.j41(13,"cue-button-label"),e.EFF(14),e.nI1(15,"transloco"),e.k0s()(),e.j41(16,"cue-button",9),e.bIt("click",function(){return n._save()}),e.j41(17,"cue-button-label"),e.EFF(18),e.nI1(19,"transloco"),e.k0s()()()()()),2&a){let o,l;e.Y8G("label",e.bMT(1,12,"components.sparqlTable.rowDefinitionModalTitle"))("minWidth","620px"),e.R7$(4),e.SpI(" ",e.bMT(5,14,"components.sparqlTable.rowDefinitionModalDescription")," "),e.R7$(2),e.Y8G("options",n._predefinedOptions)("labelMap",n._predefinedLabelMap)("value",n._selectedPredefinedId()??void 0),e.R7$(),e.vxM((o=n._selectedPredefined())?7:-1,o),e.R7$(2),e.Y8G("content",n._draft()),e.R7$(),e.vxM((l=n._draft()&&n._validationError())?10:-1,l),e.R7$(4),e.SpI(" ",e.bMT(15,16,"components.sparqlTable.rowDefinitionDiscard")," "),e.R7$(2),e.Y8G("disabled",n._isSaveDisabled()),e.R7$(2),e.SpI(" ",e.bMT(19,18,"components.sparqlTable.rowDefinitionSave")," ")}},dependencies:[Rt.a,O.FlexContainer,V.Typography,Z.Button,he.ButtonLabel,ge.B,_e.Select,me.Input,z.Kj],styles:[".row-def-error[_ngcontent-%COMP%]{color:var(--cue-color-error, #ef4444);font-size:12px;padding:2px 0}"],changeDetection:0})}return i})();var It=f(7284);function kt(i,d){if(1&i&&(e.j41(0,"div",13),e.nrm(1,"span",26),e.EFF(2),e.k0s()),2&i){const t=d;e.R7$(2),e.Lme(" ",t.done," / ",t.total," queries ")}}function Lt(i,d){1&i&&(e.j41(0,"div",13),e.nrm(1,"span",26),e.EFF(2," Building table for download\u2026 "),e.k0s())}function qt(i,d){if(1&i){const t=e.RV6();e.j41(0,"div",27),e.bIt("click",function(){s.eBV(t);const n=e.XpG();return s.Njj(n._openRowDefModal())}),e.j41(1,"cue-typography",28),e.EFF(2),e.nI1(3,"transloco"),e.k0s()()}2&i&&(e.R7$(2),e.SpI(" ",e.bMT(3,1,"components.sparqlTable.rowDefinitionEmpty")," "))}function Gt(i,d){if(1&i){const t=e.RV6();e.j41(0,"cue-paginator",29),e.bIt("currentPage",function(n){s.eBV(t);const o=e.XpG();return s.Njj(o._onPaginateEvent(n))}),e.k0s()}if(2&i){const t=e.XpG();e.Y8G("size",t._totalKeys())("pageSize",t.pageSize())}}function Vt(i,d){if(1&i){const t=e.RV6();e.j41(0,"cue-button",30),e.bIt("click",function(){const n=s.eBV(t),o=n.$implicit,l=n.index,u=e.XpG();return s.Njj(u._openSettings(o,l))}),e.nrm(1,"cue-button-icon",11),e.k0s(),e.j41(2,"cue-button",31),e.bIt("click",function(){const n=s.eBV(t).$implicit,o=e.XpG();return s.Njj(o._deleteColumn(n.field))}),e.nrm(3,"cue-button-icon",32),e.k0s()}}function Ot(i,d){if(1&i){const t=e.RV6();e.j41(0,"div",33),e.bIt("click",function(){s.eBV(t);const n=e.XpG();return s.Njj(n._addColumn())}),e.nrm(1,"cue-button-icon",34),e.k0s()}}function Qt(i,d){if(1&i){const t=e.RV6();e.j41(0,"cue-declarative-sparql-column-settings-modal",35),e.mxI("columnDefChange",function(n){const o=s.eBV(t);return e.DH7(o.col,n)||(o.col=n),s.Njj(n)}),e.bIt("close",function(){s.eBV(t);const n=e.XpG();return s.Njj(n._activeColumn.set(void 0))})("updateColumnDef",function(n){const o=s.eBV(t),l=e.XpG();return s.Njj(l._applyColumnUpdate(o.index,n))}),e.k0s()}if(2&i){const t=e.XpG();e.R50("columnDef",d.col),e.Y8G("handlers",t.handlers())("columns",t.columns())}}function $t(i,d){if(1&i){const t=e.RV6();e.j41(0,"cue-sparql-row-definition-modal",36),e.mxI("rowDefinitionQueryChange",function(n){s.eBV(t);const o=e.XpG();return e.DH7(o.rowDefinition,n)||(o.rowDefinition=n),s.Njj(n)}),e.bIt("saved",function(){s.eBV(t);const n=e.XpG();return s.Njj(n._onRowDefSaved())})("close",function(){s.eBV(t);const n=e.XpG();return s.Njj(n._showRowDefModal.set(!1))}),e.k0s()}if(2&i){const t=e.XpG();e.R50("rowDefinitionQuery",t.rowDefinition),e.Y8G("handlers",t.rowDefinitionHandlers())}}const Bt=new Q.Parser({sparqlStar:!0}),zt=new Q.Generator;function K(i,d){return oe.apply(this,arguments)}function oe(){return oe=(0,C.A)(function*(i,d){const t=new Array(i.length);let a=0;function o(){return(o=(0,C.A)(function*(){for(;a<i.length;){const u=a++;t[u]=yield i[u]()}})).apply(this,arguments)}const l=Array.from({length:Math.min(d,i.length)},()=>function n(){return o.apply(this,arguments)}());return yield Promise.all(l),t}),oe.apply(this,arguments)}function ie(i,d){if(d.length>200)return i;try{const t=Bt.parse(i),a={type:"values",values:d.map(n=>({"?subject":{termType:"NamedNode",value:n}}))};return Array.isArray(t.where)&&(t.where=[a,...t.where]),zt.stringify(t)}catch{const t=`VALUES ?subject { ${d.map(a=>`<${a}>`).join(" ")} }`;return i.replace(/WHERE\s*\{/i,`WHERE {\n ${t}`)}}let Kt=(()=>{class i{visibleRows=(0,g.CGW)();columnDefsAG=(0,g.CGW)();columns=g.geq.required();handlers=g.hFB.required();rowDefinitionHandlers=(0,g.hFB)(void 0);rowDefinition=(0,g.geq)(H);pageSize=(0,g.hFB)(10);size=(0,g.hFB)("m");bufferFactor=(0,g.hFB)(5);_bufferSize=(0,_.EW)(()=>this.pageSize()*this.bufferFactor());_noRowDef=(0,_.EW)(()=>null!==this.rowDefinition()&&!this.rowDefinition()&&!this._showSettings());_showSettings=(0,s.vPA)(!1);_activeColumn=(0,s.vPA)(void 0);_showRowDefModal=(0,s.vPA)(!1);_dataFetchService=(0,s.WQX)(B);_tableService=(0,s.WQX)(J);_allKeys=(0,s.vPA)([]);_totalKeys=(0,_.EW)(()=>this._allKeys().length);_bufferKeys=(0,s.vPA)([]);_bufferOffset=(0,s.vPA)(0);_rowDefLoading=(0,s.vPA)(!1);_rowDefError=(0,s.vPA)("");_gridApi=null;_fullDataMode=(0,s.vPA)(!1);_fetchingFullData=(0,s.vPA)(!1);_fullDataFetchVersion=0;_exporting=(0,s.vPA)(!1);_prefetchCache=new Map;_currentlyPrefetching=new Set;_displayColumns=(0,_.EW)(()=>{const t=this._bufferKeys();return null===this.rowDefinition()||t.length?this._patchColumns(this.columns(),t):[]});_queryProgress=(0,_.EW)(()=>{const t=!!this.rowDefinition(),a=t?1:0;if(this._fetchingFullData()){const p=this._dataFetchService.totalQueryCount(),c=a+Math.max(p,1);return 0===c?null:{done:0,total:c}}const n=t&&!this._rowDefLoading()&&this._allKeys().length>0?1:0,o=this._dataFetchService.totalQueryCount(),u=n+this._dataFetchService.fetchedColumns().length,r=a+o;return 0===r||u>=r?null:{done:u,total:r}});_handlers=(0,_.EW)(()=>({queryHandler:this.handlers().queryHandler}));constructor(){(0,s.QZP)(()=>{const t=this.rowDefinition(),a=this.handlers();t&&a&&this._fetchRowDef(t,a)})}_openRowDefModal(){this._showRowDefModal.set(!0)}_onGridApi(t){this._gridApi=t,null!==this.rowDefinition()&&(t.addEventListener("sortChanged",()=>this._checkSortFilterState(t)),t.addEventListener("filterChanged",()=>this._checkSortFilterState(t)))}_checkSortFilterState(t){if(!this.rowDefinition())return;const a=t.getColumnState().some(l=>null!=l.sort),n=Object.keys(t.getFilterModel()??{}).length>0,o=a||n;!o||this._fullDataMode()||this._fetchingFullData()?o&&this._fullDataMode()?this._fillVisibleRows():!o&&(this._fullDataMode()||this._fetchingFullData())&&this._exitFullDataMode():this._enterFullDataMode()}_fillingVisibleRows=!1;_fillVisibleRows(){var t=this;return(0,C.A)(function*(){if(!t._fillingVisibleRows&&t._gridApi){t._fillingVisibleRows=!0;try{const a=t._gridApi.paginationGetPageSize?.()??t.pageSize(),o=(t._gridApi.paginationGetCurrentPage?.()??0)*a,l=[];for(let p=o;p<o+a;p++){const c=t._gridApi.getDisplayedRowAtIndex(p);if(!c?.data?.id)break;l.push(c.data.id)}if(!l.length)return;const u=t.columns().filter(p=>"data"===p.defType&&p.query&&!p.hide),r=t._dataFetchService.keyVals;yield K(u.map(p=>(0,C.A)(function*(){const c=l.filter(h=>void 0===r[h]?.[p.field]);if(!c.length)return;const m=ie(p.query,c);try{const h=yield t.handlers().queryHandler(m,(0,k.t)(m)),y={};h.results.bindings.forEach(T=>{const v=T.subject?.value;if(!v)return;y[v]||(y[v]=[]);const R={};Object.keys(T).filter(M=>"subject"!==M).forEach(M=>{R[M]=T[M]?.value}),y[v].push(R)}),t._dataFetchService.mergeColumnData(p.field,y,p.query)}catch{}})),3)}finally{t._fillingVisibleRows=!1}}})()}_onPaginateEvent(t){const a=t.startIndex,n=this._bufferSize(),o=Math.floor(a/n)*n;this._loadBuffer(o);const l=Math.floor((a-o)/this.pageSize());if(this._gridApi)try{this._gridApi.paginationGoToPage(l)}catch{}if(l>=Math.ceil(n/this.pageSize())-1){const r=o+n;r<this._allKeys().length&&this._prefetchBuffer(r)}}_fetchRowDef(t,a){var n=this;return(0,C.A)(function*(){n._rowDefLoading.set(!0),n._rowDefError.set(""),n._dataFetchService.emptyTableText.set("Loading\u2026"),n._allKeys.set([]),n._bufferKeys.set([]),n._bufferOffset.set(0),n._prefetchCache.clear(),n._currentlyPrefetching.clear();try{const o=(0,k.t)(t),l=yield a.queryHandler(t,o),u=l.results.bindings.map(r=>r.subject?.value).filter(Boolean);console.log("[ROWDEF] _fetchRowDef received",l.results.bindings.length,"bindings,",u.length,"valid keys. meta=",l.meta),n._allKeys.set(u),n._loadBuffer(0)}catch(o){n._rowDefError.set(String(o?.message??o))}finally{n._rowDefLoading.set(!1)}})()}_loadBuffer(t,a=!1){const n=this._allKeys().slice(t,t+this._bufferSize()),o=this._bufferKeys();if(!a&&n.length===o.length&&n.every((u,r)=>u===o[r]))return;const l=this._prefetchCache.get(t);if(this._prefetchCache.delete(t),this._dataFetchService.resetData(),l?this._dataFetchService.injectPreloadedData(l.keyVals,l.fetchedColumnFields,l.columnQueries):this._tableService.destroy(),this._bufferOffset.set(t),this._bufferKeys.set(n),this._gridApi)try{this._gridApi.paginationGoToPage(0)}catch{}}_enterFullDataMode(){var t=this;return(0,C.A)(function*(){if(console.log("[FDM] _enterFullDataMode called. _fetchingFullData=",t._fetchingFullData(),"_fullDataMode=",t._fullDataMode(),"_allKeys=",t._allKeys().length),t._fetchingFullData())return;t._fetchingFullData.set(!0);const a=++t._fullDataFetchVersion;let n;t._gridApi&&(n=t._gridApi.getColumnState().find(r=>null!=r.sort)?.colId,n||(n=Object.keys(t._gridApi.getFilterModel()??{})[0]));const o=n?.replace(/_\d+$/,""),l=o?t.columns().find(u=>u.field===o&&"data"===u.defType&&u.query):void 0;if(!l)return t._fullDataMode.set(!0),void t._fetchingFullData.set(!1);try{if(a!==t._fullDataFetchVersion)return;const u=yield t.handlers().queryHandler(l.query,(0,k.t)(l.query));if(a!==t._fullDataFetchVersion)return;const r={};Object.entries(t._dataFetchService.keyVals).forEach(([v,R])=>{r[v]={...R}});const p=t._allKeys();p.forEach(v=>{r[v]||(r[v]={})}),console.log("[DeclarativeSPARQLTable] keyVals pre-seed: allKeys=",p.length,"keyVals size=",Object.keys(r).length);const c=[...t._dataFetchService.fetchedColumns()],m={...t._dataFetchService._columnQueries},h=[];if(u.results.bindings.forEach(v=>{const R=v.subject?.value;if(!R)return;r[R]||(r[R]={}),r[R][l.field]=[];const M={};Object.keys(v).filter(D=>"subject"!==D).forEach(D=>{M[D]=v[D]?.value}),r[R][l.field].push(M),h.push(R)}),c.includes(l.field)||c.push(l.field),m[l.field]=l.query,console.log("[FDM] after sort-col fetch: keyVals size=",Object.keys(r).length,"allKeys from sort col=",h.length),console.log("[FDM] calling resetData()"),t._dataFetchService.resetData(),t._tableService.destroy(),console.log("[FDM] calling injectPreloadedData with",Object.keys(r).length,"rows"),t._dataFetchService.injectPreloadedData(r,c,m),console.log("[FDM] injectPreloadedData done. Service keyVals size=",Object.keys(t._dataFetchService.keyVals).length),t._fullDataMode.set(!0),a!==t._fullDataFetchVersion)return;const y=t.columns().filter(v=>"data"===v.defType&&v.query&&v.field!==l.field&&!v.hide),T=new Set(t._bufferKeys());yield K(y.map(v=>(0,C.A)(function*(){const R=h.filter(D=>T.has(D)&&void 0===r[D]?.[v.field]);if(!R.length||a!==t._fullDataFetchVersion)return;const M=ie(v.query,R);try{const D=yield t.handlers().queryHandler(M,(0,k.t)(M));if(a!==t._fullDataFetchVersion)return;const b={};D.results.bindings.forEach(P=>{const x=P.subject?.value;if(!x)return;b[x]||(b[x]=[]);const $={};Object.keys(P).filter(L=>"subject"!==L).forEach(L=>{$[L]=P[L]?.value}),b[x].push($)}),Object.entries(b).forEach(([P,x])=>{r[P]&&(r[P][v.field]=x)}),t._dataFetchService.mergeColumnData(v.field,b,v.query)}catch{}})),3)}catch(u){console.error("[DeclarativeSPARQLTable] Error in _enterFullDataMode:",u)}finally{a===t._fullDataFetchVersion&&t._fetchingFullData.set(!1)}})()}_exitFullDataMode(){if(console.log("[FDM] _exitFullDataMode called"),this._fullDataFetchVersion++,this._fetchingFullData.set(!1),this._fullDataMode.set(!1),this._dataFetchService.resetData(),this._tableService.destroy(),this._loadBuffer(this._bufferOffset(),!0),this._gridApi)try{this._gridApi.paginationGoToPage(0)}catch{}}_prefetchBuffer(t){var a=this;return(0,C.A)(function*(){if(a._prefetchCache.has(t)||a._currentlyPrefetching.has(t))return;const n=a._allKeys().slice(t,t+a._bufferSize());if(!n.length)return;a._currentlyPrefetching.add(t);const l=a._patchColumns(a.columns(),n).filter(c=>"data"===c.defType&&!c.hide&&c.query),u={},r=[],p={};try{yield K(l.map(c=>(0,C.A)(function*(){try{(yield a.handlers().queryHandler(c.query,(0,k.t)(c.query))).results.bindings.forEach(h=>{const y=h.subject?.value;if(!y)return;u[y]||(u[y]={}),u[y][c.field]||(u[y][c.field]=[]);const T={};Object.keys(h).filter(v=>"subject"!==v).forEach(v=>{T[v]=h[v]?.value}),u[y][c.field].push(T)}),r.push(c.field),p[c.field]=c.query}catch{}})),3),a._prefetchCache.set(t,{keyVals:u,fetchedColumnFields:r,columnQueries:p})}finally{a._currentlyPrefetching.delete(t)}})()}_patchColumns(t,a){return a.length?t.map(n=>n.query&&"data"===n.defType?{...n,query:ie(n.query,a)}:n):t}_columnSelectSettings=Object.assign(new ee.e,{allowEditing:!1});_shownColumns=(0,_.EW)(()=>this.columns().filter(t=>!t.hide));_openSettings(t,a){const n=this.columns().findIndex(o=>o.field===t.field);this._activeColumn.set({col:{...t},index:n})}_onShownChanged(t){const a=new Set(t.map(u=>u.field)),n=this.columns(),o=t.map(u=>({...n.find(p=>p.field===u.field)??u,hide:!1})),l=n.filter(u=>!a.has(u.field)).map(u=>({...u,hide:!0}));this.columns.set([...o,...l])}_applyColumnUpdate(t,a){const n=this.columns().map((o,l)=>l===t?Object.assign(Object.create(Object.getPrototypeOf(o)),o,a):o);this.columns.set(n)}_addColumn(){const t=this.columns();let a;if(t.length>0)a=t[t.length-1];else{const l=this.rowDefinition();a=Object.assign(new re,{query:l?this._seedQueryFromRowDef(l):"",strategy:{type:"first"}})}const n=Object.assign(Object.create(Object.getPrototypeOf(a)),a,{field:`column_${Date.now()}`,headerName:`${a.headerName??a.field??"Column"} Copy`,hide:!1}),o=t.length;this.columns.update(l=>[...l,n]),this._activeColumn.set({col:{...n},index:o})}_deleteColumn(t){this.columns.update(a=>a.filter(n=>n.field!==t))}_onRowDefSaved(){if(this.columns().length>0)return;this._showSettings.set(!0);const t=this.rowDefinition(),a=t?this._seedQueryFromRowDef(t):"",n=Object.assign(new re,{field:`column_${Date.now()}`,headerName:"Column 1",query:a,strategy:{type:"first"}});this.columns.set([n]),this._activeColumn.set({col:{...n},index:0})}_seedQueryFromRowDef(t){try{if(/qcy:FileContent\b/.test(t)){let n=t.replace(/SELECT\s+(?:DISTINCT\s+)?\?subject\b/i,"SELECT ?subject ?value");n=n.replace(/\s*ORDER\s+BY\s+[^\n{}]*/gi,""),/PREFIX\s+skos:/i.test(n)||(n=`PREFIX skos: <${Te.B.skos}>\n`+n);const o=n.lastIndexOf("}");return-1!==o&&(n=n.slice(0,o)+" ?subject qcy:hasContentCategory ?cat .\n ?cat skos:prefLabel ?value .\n}"),n.trim()}{let n=t.replace(/SELECT\s+(?:DISTINCT\s+)?\?subject\b/i,"SELECT ?subject ?val");n=n.replace(/\s*ORDER\s+BY\s+[^\n{}]*/gi,"");const o=n.lastIndexOf("}");return-1!==o&&(n=n.slice(0,o)+" ?subject qcy:value ?val .\n}"),n.trim()}}catch{return t}}_getFormattedData(t=!1,a){const n=t?this.columns().filter(c=>"data"===c.defType&&c.query).map(c=>this._dataFetchService.columnDefsAG().find(h=>h.colId===c.field||h.field===c.field)??{colId:c.field,headerName:c.headerName??c.field,cellRendererParams:{strategy:c.strategy,postProcess:c.postProcess}}):this._dataFetchService.columnDefsAG().filter(c=>!c.hide),o=this._allKeys(),l=a?(o.length>0?o:Object.keys(a)).map(c=>({id:c,...a[c]??{}})):this._tableService.tableData(),u=["Key",...n.map(c=>c.headerName??c.field??"")],r=["",...n.map(c=>{const m=c.cellStyle;return m&&"object"==typeof m?String(m.textAlign??m["text-align"]??"").toLowerCase():""})];return{headers:u,rows:l.map(c=>[String(c.id??""),...n.map(m=>{const h=m.colId??m.field??"",y=m.valueGetter;let T="function"==typeof y?y({data:c,colDef:m}):c[h];if(void 0===T&&a&&(T=(a[c.id]??{})[h]??[]),Array.isArray(T)){const v=m.cellRendererParams?.strategy,R=m.cellRendererParams?.postProcess,M=v?F(T,v,""):T.map(D=>D?.val??"").filter(Boolean).join(", ");return(0,E.g4)(M,R)}return String(T??"")})]),alignments:r}}_fetchAllColumnsForExport(t){var a=this;return(0,C.A)(function*(){const n=a._allKeys();console.log("[EXPORT] _fetchAllColumnsForExport called for",t.length,"columns. allKeys=",n.length);const o=t.filter(r=>"data"===r.defType&&r.query);if(!o.length)return{};const l=n.length?a._patchColumns(o,n):o,u={};return yield K(l.map(r=>(0,C.A)(function*(){try{(yield a.handlers().queryHandler(r.query,(0,k.t)(r.query))).results.bindings.forEach(c=>{const m=c.subject?.value;if(!m)return;u[m]||(u[m]={}),u[m][r.field]||(u[m][r.field]=[]);const h={};Object.keys(c).filter(y=>"subject"!==y).forEach(y=>{h[y]=c[y]?.value}),u[m][r.field].push(h)})}catch{}})),3),u})()}_downloadCsv(){var t=this;return(0,C.A)(function*(a=!1){if(!t._exporting()){t._exporting.set(!0);try{const n=a?t.columns():t.columns().filter(c=>!c.hide),o=yield t._fetchAllColumnsForExport(n),{headers:l,rows:u}=t._getFormattedData(a,o),r=It.unparse([l,...u]),p=new Blob([r],{type:"text/csv;charset=utf-8;"});t._triggerDownload(p,"export.csv")}finally{t._exporting.set(!1)}}}).apply(this,arguments)}_downloadXlsx(){var t=this;return(0,C.A)(function*(a=!1){if(!t._exporting()){t._exporting.set(!0);try{const n=a?t.columns():t.columns().filter(c=>!c.hide),o=yield t._fetchAllColumnsForExport(n),{headers:l,rows:u,alignments:r}=t._getFormattedData(a,o),p=yield t._buildStyledXlsxBlob(l,u,r);t._triggerDownload(p,"export.xlsx")}finally{t._exporting.set(!1)}}}).apply(this,arguments)}_buildStyledXlsxBlob(t,a,n){return(0,C.A)(function*(){const u=(D,b)=>D?"center"===b?2:"right"===b?3:1:"center"===b?4:"right"===b?5:0,r=(D,b,P,x)=>{const $=`${(D=>{let b="",P=D+1;for(;P>0;)b=String.fromCharCode(65+(P-1)%26)+b,P=Math.floor((P-1)/26);return b})(D)}${b}`,L=x>0?` s="${x}"`:"",le=Number(P);return 0===x&&""!==P&&!isNaN(le)&&isFinite(le)?`<c r="${$}"${L}><v>${le}</v></c>`:`<c r="${$}"${L} t="inlineStr"><is><t>${(D=>D.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"))(P)}</t></is></c>`},p=[];p.push(`<row r="1">${t.map((D,b)=>r(b,1,D,u(!0,n[b]??""))).join("")}</row>`),a.forEach((D,b)=>{p.push(`<row r="${b+2}">${D.map((P,x)=>r(x,b+2,P,u(!1,n[x]??""))).join("")}</row>`)});const c=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">\n <cols><col min="1" max="1" hidden="1"/></cols>\n <sheetData>${p.join("")}</sheetData>\n</worksheet>`,M=new(0,(yield f.e(7247).then(f.t.bind(f,7247,23))).default);return M.file("[Content_Types].xml",'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">\n <Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>\n <Default Extension="xml" ContentType="application/xml"/>\n <Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/>\n <Override PartName="/xl/worksheets/sheet1.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>\n <Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"/>\n</Types>'),M.file("_rels/.rels",'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">\n <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/>\n</Relationships>'),M.file("xl/workbook.xml",'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">\n <sheets><sheet name="Data" sheetId="1" r:id="rId1"/></sheets>\n</workbook>'),M.file("xl/_rels/workbook.xml.rels",'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">\n <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet1.xml"/>\n <Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/>\n</Relationships>'),M.file("xl/worksheets/sheet1.xml",c),M.file("xl/styles.xml",'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">\n <fonts count="2">\n <font><sz val="11"/><name val="Calibri"/></font>\n <font><b/><color rgb="FFFFFFFF"/><sz val="11"/><name val="Poppins"/></font>\n </fonts>\n <fills count="3">\n <fill><patternFill patternType="none"/></fill>\n <fill><patternFill patternType="gray125"/></fill>\n <fill><patternFill patternType="solid"><fgColor rgb="FF2859E1"/><bgColor indexed="64"/></patternFill></fill>\n </fills>\n <borders count="1">\n <border><left/><right/><top/><bottom/><diagonal/></border>\n </borders>\n <cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs>\n <cellXfs count="6">\n <xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/>\n <xf numFmtId="0" fontId="1" fillId="2" borderId="0" xfId="0" applyFont="1" applyFill="1"/>\n <xf numFmtId="0" fontId="1" fillId="2" borderId="0" xfId="0" applyFont="1" applyFill="1" applyAlignment="1"><alignment horizontal="center"/></xf>\n <xf numFmtId="0" fontId="1" fillId="2" borderId="0" xfId="0" applyFont="1" applyFill="1" applyAlignment="1"><alignment horizontal="right"/></xf>\n <xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0" applyAlignment="1"><alignment horizontal="center"/></xf>\n <xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0" applyAlignment="1"><alignment horizontal="right"/></xf>\n </cellXfs>\n</styleSheet>'),M.generateAsync({type:"blob",mimeType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"})})()}_triggerDownload(t,a){const n=URL.createObjectURL(t),o=document.createElement("a");o.href=n,o.download=a,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(n)}static \u0275fac=function(a){return new(a||i)};static \u0275cmp=e.VBU({type:i,selectors:[["cue-declarative-sparql-table"]],inputs:{columns:[1,"columns"],handlers:[1,"handlers"],rowDefinitionHandlers:[1,"rowDefinitionHandlers"],rowDefinition:[1,"rowDefinition"],pageSize:[1,"pageSize"],size:[1,"size"],bufferFactor:[1,"bufferFactor"]},outputs:{visibleRows:"visibleRows",columnDefsAG:"columnDefsAG",columns:"columnsChange",rowDefinition:"rowDefinitionChange"},features:[e.Jv_([B,J])],decls:39,vars:27,consts:[[1,"flip-card",3,"cueFlipChange","cueFlip"],[1,"flip-content"],[1,"card-face","front"],["direction","row","justify","end",2,"padding","2px"],["positioning","bottomleft"],["trigger","","variant","tertiary","size","s","cueTooltip","Export",3,"disabled"],["icon","more-vert"],["menu",""],[3,"click","disabled"],["before","","name","download"],["variant","accent","size","s","cueTooltip","Column settings",3,"click"],["icon","settings"],[3,"gridApi","visibleRows","columnDefsAG","handlers","columns","showPaginator","paginationPageSize","size","loading"],[1,"query-status"],[1,"row-def-empty"],[3,"size","pageSize"],[1,"card-face","back",2,"min-height","var(--cue-table-m-height)",3,"maxHeight"],["variant","tertiary","size","s",3,"click","cueTooltip"],["icon","filter"],["variant","accent","size","s","cueTooltip","Back to table",3,"click"],["icon","arrow-back"],[3,"shown","columnDefs","columnDefsGross","settings"],["cueColumnItem",""],["cueColumnListFooter",""],[3,"columnDef","handlers","columns"],[3,"rowDefinitionQuery","handlers"],[1,"query-status-spinner"],[1,"row-def-empty",3,"click"],["size","s","color","muted"],[3,"currentPage","size","pageSize"],["variant","tertiary","size","s","cueTooltip","Edit column",3,"click"],["variant","tertiary","size","s","cueTooltip","Delete column",3,"click"],["icon","delete"],["cueTooltip","Add column definition",1,"add-column-row",3,"click"],["icon","add"],[3,"columnDefChange","close","updateColumnDef","columnDef","handlers","columns"],[3,"rowDefinitionQueryChange","saved","close","rowDefinitionQuery","handlers"]],template:function(a,n){if(1&a&&(e.j41(0,"div",0),e.mxI("cueFlipChange",function(l){return e.DH7(n._showSettings,l)||(n._showSettings=l),l}),e.j41(1,"div",1)(2,"cue-card",2)(3,"cue-flexcontainer",3)(4,"cue-menu",4)(5,"cue-button",5),e.nrm(6,"cue-button-icon",6),e.k0s(),e.j41(7,"cue-menu-wrap",7)(8,"cue-menu-item",8),e.bIt("click",function(){return n._downloadCsv()}),e.nrm(9,"cue-svg-icon",9),e.EFF(10," Download CSV "),e.k0s(),e.j41(11,"cue-menu-item",8),e.bIt("click",function(){return n._downloadCsv(!0)}),e.nrm(12,"cue-svg-icon",9),e.EFF(13," Download CSV (incl. hidden columns) "),e.k0s(),e.j41(14,"cue-menu-item",8),e.bIt("click",function(){return n._downloadXlsx()}),e.nrm(15,"cue-svg-icon",9),e.EFF(16," Download XLSX "),e.k0s(),e.j41(17,"cue-menu-item",8),e.bIt("click",function(){return n._downloadXlsx(!0)}),e.nrm(18,"cue-svg-icon",9),e.EFF(19," Download XLSX (incl. hidden columns) "),e.k0s()()(),e.j41(20,"cue-button",10),e.bIt("click",function(){return n._showSettings.set(!0)}),e.nrm(21,"cue-button-icon",11),e.k0s()(),e.j41(22,"cue-sparql-table-inner",12),e.bIt("gridApi",function(l){return n._onGridApi(l)})("visibleRows",function(l){return n.visibleRows.emit(l)})("columnDefsAG",function(l){return n.columnDefsAG.emit(l)}),e.k0s(),e.nVh(23,kt,3,2,"div",13),e.nVh(24,Lt,3,0,"div",13),e.nVh(25,qt,4,3,"div",14),e.nVh(26,Gt,1,2,"cue-paginator",15),e.k0s(),e.j41(27,"cue-card",16)(28,"cue-flexcontainer",3)(29,"cue-button",17),e.nI1(30,"transloco"),e.bIt("click",function(){return n._openRowDefModal()}),e.nrm(31,"cue-button-icon",18),e.k0s(),e.j41(32,"cue-button",19),e.bIt("click",function(){return n._showSettings.set(!1)}),e.nrm(33,"cue-button-icon",20),e.k0s()(),e.j41(34,"cue-ag-grid-column-select",21),e.bIt("shown",function(l){return n._onShownChanged(l)}),e.DNE(35,Vt,4,0,"ng-template",22)(36,Ot,2,0,"ng-template",23),e.k0s()()()(),e.nVh(37,Qt,1,3,"cue-declarative-sparql-column-settings-modal",24),e.nVh(38,$t,1,2,"cue-sparql-row-definition-modal",25)),2&a){let o,l;e.R50("cueFlip",n._showSettings),e.R7$(5),e.Y8G("disabled",n._exporting()),e.R7$(3),e.Y8G("disabled",n._exporting()),e.R7$(3),e.Y8G("disabled",n._exporting()),e.R7$(3),e.Y8G("disabled",n._exporting()),e.R7$(3),e.Y8G("disabled",n._exporting()),e.R7$(5),e.AVh("hidden",n._showSettings()||n._noRowDef()),e.Y8G("handlers",n._handlers())("columns",n._displayColumns())("showPaginator",n._fullDataMode())("paginationPageSize",n.pageSize())("size",n.size())("loading",n._rowDefLoading()),e.R7$(),e.vxM((o=n._queryProgress())?23:-1,o),e.R7$(),e.vxM(n._exporting()?24:-1),e.R7$(),e.vxM(n._noRowDef()?25:-1),e.R7$(),e.vxM(n.rowDefinition()&&!n._fullDataMode()?26:-1),e.R7$(),e.Y8G("maxHeight","var(--cue-table-m-height)"),e.R7$(2),e.Y8G("cueTooltip",e.bMT(30,25,"components.sparqlTable.rowDefinitionTooltip")),e.R7$(5),e.Y8G("columnDefs",n._shownColumns())("columnDefsGross",n.columns())("settings",n._columnSelectSettings),e.R7$(3),e.vxM((l=n._activeColumn())?37:-1,l),e.R7$(),e.vxM(n._showRowDefModal()?38:-1)}},dependencies:[Le,yt,Nt,ne.pL,ne.pC,ne.rx,vt.Card,O.FlexContainer,V.Typography,Z.Button,fe.ButtonIcon,bt.R,ue.d,Dt.W,Ct.M,Tt.D,St.A,Mt.m,z.Kj],styles:[".flip-card[_ngcontent-%COMP%]{width:100%}.flip-content[_ngcontent-%COMP%]{position:relative;width:100%}.card-face[_ngcontent-%COMP%]{width:100%}.hidden[_ngcontent-%COMP%]{display:none}.row-def-empty[_ngcontent-%COMP%]{flex:1;min-height:160px;display:flex;align-items:center;justify-content:center;padding:32px 16px;border:2px dashed var(--cue-color-border, #d1d5db);border-radius:8px;cursor:pointer;margin-top:8px;transition:border-color .15s}.row-def-empty[_ngcontent-%COMP%]:hover{border-color:var(--cue-color-accent, #4f46e5)}.query-status[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;padding:6px 10px;font-size:12px;color:var(--cue-color-text-muted, #6b7280);background:var(--cue-color-surface-subtle, #f9fafb);border:1px solid var(--cue-color-border, #e5e7eb);border-radius:6px;margin-top:6px}@keyframes _ngcontent-%COMP%_spin{to{transform:rotate(360deg)}}.query-status-spinner[_ngcontent-%COMP%]{display:inline-block;width:11px;height:11px;border:2px solid currentColor;border-top-color:transparent;border-radius:50%;animation:_ngcontent-%COMP%_spin .7s linear infinite;flex-shrink:0}.add-column-row[_ngcontent-%COMP%]{padding:20px 10px;border-top:solid 1px #ccc;display:flex;align-items:center;justify-content:center;opacity:.4;cursor:pointer;transition:opacity .15s ease}.add-column-row[_ngcontent-%COMP%]:hover{opacity:.75}"],changeDetection:0})}return i})();var Wt=f(7293);function Yt(i,d){if(1&i){const t=e.RV6();e.j41(0,"cue-declarative-sparql-table",3),e.mxI("columnsChange",function(n){s.eBV(t);const o=e.XpG();return e.DH7(o.columns,n)||(o.columns=n),s.Njj(n)})("rowDefinitionChange",function(n){s.eBV(t);const o=e.XpG();return e.DH7(o.rowDefinition,n)||(o.rowDefinition=n),s.Njj(n)}),e.bIt("visibleRows",function(n){s.eBV(t);const o=e.XpG();return s.Njj(o.visibleRows.emit(n))})("columnDefsAG",function(n){s.eBV(t);const o=e.XpG();return s.Njj(o.columnDefsAG.emit(n))}),e.k0s()}if(2&i){const t=e.XpG();e.Y8G("handlers",d)("rowDefinitionHandlers",t._rowDefinitionHandlers()),e.R50("columns",t.columns)("rowDefinition",t.rowDefinition),e.Y8G("pageSize",t.pageSize())("size",t.size())("bufferFactor",t.bufferFactor())}}function Ut(i,d){1&i&&(e.j41(0,"cue-flexcontainer",1)(1,"cue-typography",4),e.EFF(2," No project connected. Pass a sdkState with cue and projectId. "),e.k0s()())}function Ht(i,d){if(1&i&&e.nrm(0,"cue-logo-link",2),2&i){let t;const a=e.XpG();e.Y8G("projectId",null==(t=a.sdkState())?null:t.projectId)}}let Jt=(()=>{class i{sdkState=(0,g.hFB)(void 0);columns=g.geq.required();rowDefinition=(0,g.geq)(H);pageSize=(0,g.hFB)(10,{transform:g.Udg});size=(0,g.hFB)("m");showLogo=(0,g.hFB)(!1,{transform:g.L39});bufferFactor=(0,g.hFB)(5,{transform:g.Udg});visibleRows=(0,g.CGW)();columnDefsAG=(0,g.CGW)();_entities=(0,s.vPA)(void 0);_documents=(0,s.vPA)(void 0);_handlers=(0,_.EW)(()=>{const t=this.sdkState();if(!t)return;const{cue:a,projectId:n,graphType:o="fuseki"}=t;return{queryHandler:l=>a.api.sparql(l,n,o)}});_rowDefinitionHandlers=(0,_.EW)(()=>{const t=this._entities(),a=this._documents();if(t&&a)return{contentCategoriesInProject:()=>t.contentCategoriesInProject(),randomFilePath:()=>a.randomFilePath()}});constructor(){(0,s.QZP)(()=>{const t=this.sdkState();t?.cue&&t?.projectId?(this._entities.set(new q.g8(t.cue.api,t.projectId)),this._documents.set(new q.f$(t.cue.api,t.projectId))):(this._entities.set(void 0),this._documents.set(void 0))})}static \u0275fac=function(a){return new(a||i)};static \u0275cmp=e.VBU({type:i,selectors:[["cue-sparql-table"]],inputs:{sdkState:[1,"sdkState"],columns:[1,"columns"],rowDefinition:[1,"rowDefinition"],pageSize:[1,"pageSize"],size:[1,"size"],showLogo:[1,"showLogo"],bufferFactor:[1,"bufferFactor"]},outputs:{columns:"columnsChange",rowDefinition:"rowDefinitionChange",visibleRows:"visibleRows",columnDefsAG:"columnDefsAG"},decls:3,vars:2,consts:[[3,"handlers","rowDefinitionHandlers","columns","rowDefinition","pageSize","size","bufferFactor"],["direction","column","align","center","justify","center",2,"height","100%","width","100%","padding","8px"],[2,"position","absolute","top","26px","left","26px","z-index","5",3,"projectId"],[3,"columnsChange","rowDefinitionChange","visibleRows","columnDefsAG","handlers","rowDefinitionHandlers","columns","rowDefinition","pageSize","size","bufferFactor"],[2,"color","#9ca3af","font-size","13px"]],template:function(a,n){if(1&a&&(e.nVh(0,Yt,1,7,"cue-declarative-sparql-table",0)(1,Ut,3,0,"cue-flexcontainer",1),e.nVh(2,Ht,1,1,"cue-logo-link",2)),2&a){let o;e.vxM((o=n._handlers())?0:1,o),e.R7$(2),e.vxM(n.showLogo()?2:-1)}},dependencies:[Kt,O.FlexContainer,V.Typography,Wt.x],styles:["[_nghost-%COMP%]{display:block;width:100%;position:relative}"],changeDetection:0})}return i})()},7573(W,I,f){f.d(I,{E:()=>g});const g={qcy:"https://dev.qaecy.com/ont#","qcy-e":"https://dev.qaecy.com/enum#","qcy-f":"https://dev.qaecy.com/functions#",obc:"https://w3id.org/obc#",dicc:"https://w3id.org/digitalconstruction/0.5/Contexts#",dicv:"https://w3id.org/digitalconstruction/0.5/Variables#",dice:"https://w3id.org/digitalconstruction/0.5/Entities#",dicp:"https://w3id.org/digitalconstruction/0.5/Processes#",dica:"https://w3id.org/digitalconstruction/0.5/Agents#",dici:"https://w3id.org/digitalconstruction/0.5/Information#",dicbm:"https://w3id.org/digitalconstruction/0.5/Materials#",dicob:"https://w3id.org/digitalconstruction/0.5/Occupancy#",dicl:"https://w3id.org/digitalconstruction/0.5/Lifecycle#",dices:"https://w3id.org/digitalconstruction/0.5/Energy#",dicu:"https://w3id.org/digitalconstruction/0.5/Units#",diclvl:"https://w3id.org/digitalconstruction/0.5/Levels#",dicstg:"https://w3id.org/digitalconstruction/0.5/Stages#"}}}]);
1
+ "use strict";(self.webpackChunkcue_ui=self.webpackChunkcue_ui||[]).push([[2014,4098],{2014(W,I,f){f.d(I,{ButtonPadder:()=>C});var g=f(7705),s=f(2271),_=f(5547);const q=["*"];let C=(()=>{class N{justify=(0,g.hFB)("start");size=(0,g.hFB)("l");widthStyle=(0,s.EW)(()=>`var(--cue-button-label-padding-${this.size()}-x)`);static \u0275fac=function(F){return new(F||N)};static \u0275cmp=_.VBU({type:N,selectors:[["cue-button-padder"]],inputs:{justify:[1,"justify"],size:[1,"size"]},ngContentSelectors:q,decls:2,vars:4,template:function(F,w){1&F&&(_.NAR(),_.rj2(0,"div"),_.SdG(1),_.eux()),2&F&&_.xc7("justify-content",w.justify())("min-width",w.widthStyle())},styles:["div[_ngcontent-%COMP%]{display:flex;align-items:center;min-height:1px}"]})}return N})()},7293(W,I,f){f.d(I,{x:()=>F});var g=f(7705),s=f(5802),_=f(2271),q=f(4613),C=f(9352),N=f(7089),S=f(5547);function E(w,Y){1&w&&S.nrm(0,"cue-logo",4)}let F=(()=>{class w{projectId=(0,g.hFB)(void 0);resourceId=(0,g.hFB)(void 0);_active=(0,s.vPA)(!0);onHover(){this._active.set(!1),requestAnimationFrame(()=>this._active.set(!0))}_title=(0,_.EW)(()=>this.projectId()&&this.resourceId()?"components.logoLink.showResourceInCue":this.projectId()?"components.logoLink.openProjectInCue":"components.logoLink.openCuePortal");_href=(0,_.EW)(()=>{const j=this.projectId(),A=this.resourceId();return j&&A?`https://cue.qaecy.com/r/${encodeURIComponent(j)}/${encodeURIComponent(A)}`:j?`https://cue.qaecy.com/home/projects?p=${encodeURIComponent(j)}`:"https://cue.qaecy.com/home/projects"});static \u0275fac=function(A){return new(A||w)};static \u0275cmp=S.VBU({type:w,selectors:[["cue-logo-link"]],inputs:{projectId:[1,"projectId"],resourceId:[1,"resourceId"]},decls:6,vars:5,consts:[["target","_blank","rel","noopener noreferrer",1,"link",3,"mouseenter","href"],[1,"logo-stack",3,"cueTooltip"],["size","xs",1,"logo-bg"],[1,"logo-fg"],["size","xs"]],template:function(A,G){1&A&&(S.j41(0,"a",0),S.bIt("mouseenter",function(){return G.onHover()}),S.j41(1,"div",1),S.nI1(2,"transloco"),S.nrm(3,"cue-logo",2),S.j41(4,"div",3),S.nVh(5,E,1,0,"cue-logo",4),S.k0s()()()),2&A&&(S.Y8G("href",G._href(),S.B4B),S.R7$(),S.Y8G("cueTooltip",S.bMT(2,3,G._title())),S.R7$(4),S.vxM(G._active()?5:-1))},dependencies:[q.Logo,N.d,C.Kj],styles:["[_nghost-%COMP%]{display:inline-block;line-height:0}.link[_ngcontent-%COMP%]{display:block;text-decoration:none;cursor:pointer}.logo-stack[_ngcontent-%COMP%]{position:relative;display:inline-block;line-height:0}.logo-bg[_ngcontent-%COMP%]{display:block;opacity:.3;transition:opacity .2s ease}.link[_ngcontent-%COMP%]:hover .logo-bg[_ngcontent-%COMP%]{opacity:.15}.logo-fg[_ngcontent-%COMP%]{position:absolute;inset:0;opacity:0;transition:opacity .15s ease}.link[_ngcontent-%COMP%]:hover .logo-fg[_ngcontent-%COMP%]{opacity:1}"],changeDetection:0})}return w})()},4098(W,I,f){f.d(I,{CueSparqlTable:()=>Jt});var g=f(7705),s=f(5802),_=f(2271),q=f(8645),C=f(467),N=f(7374),S=f.n(N),E=f(7400);function F(i,d,t=""){const a=d.valueKey??"val",n=d.priorityKey,o=d.fallback??t,l=d.preProcess?i.map(p=>{const c=p[a];return null==c?p:{...p,[a]:(0,E.w9)(d.preProcess,c)}}):i,r=(n?[...l].sort((p,c)=>{const m=p[n],h=c[n],y=Number(m),T=Number(h);return isNaN(y)||isNaN(T)?(h??"").localeCompare(m??""):T-y}):l).map(p=>p[a]).filter(p=>null!=p);if(0===r.length)return o;switch(d.type){case"first":default:return r[0];case"last":return r[r.length-1];case"random":return r[Math.floor(Math.random()*r.length)];case"count":return String(r.length);case"join":return r.join(d.separator??", ");case"longest":return r.reduce((p,c)=>c.length>p.length?c:p);case"shortest":return r.reduce((p,c)=>c.length<p.length?c:p);case"sum":{const p=r.map(Number).filter(c=>!isNaN(c));return p.length?String(p.reduce((c,m)=>c+m,0)):t}case"avg":{const p=r.map(Number).filter(c=>!isNaN(c));return p.length?String(p.reduce((c,m)=>c+m,0)/p.length):t}case"min":{const p=r.map(Number).filter(c=>!isNaN(c));return p.length?String(Math.min(...p)):t}case"max":{const p=r.map(Number).filter(c=>!isNaN(c));return p.length?String(Math.max(...p)):t}case"mostRecent":return[...r].sort((c,m)=>S()(m).valueOf()-S()(c).valueOf())[0];case"oldest":return[...r].sort((c,m)=>S()(c).valueOf()-S()(m).valueOf())[0];case"map":{const{map:p}=d;return p[r[0]]??o}}}const Y=Object.keys({first:"First",last:"Last",random:"Random",join:"Concatenate",count:"Count",longest:"Longest text",shortest:"Shortest text",map:"Map lookup",sum:"Sum",avg:"Average",min:"Minimum",max:"Maximum",mostRecent:"Most recent date",oldest:"Oldest date"}),j=["first","last","random","join","count"],A={text:[...j,"longest","shortest","map"],number:[...j,"sum","avg","min","max"],date:[...j,"mostRecent","oldest"]},G={first:"components.sparqlTable.strategyFirst",last:"components.sparqlTable.strategyLast",random:"components.sparqlTable.strategyRandom",join:"components.sparqlTable.strategyJoin",count:"components.sparqlTable.strategyCount",longest:"components.sparqlTable.strategyLongest",shortest:"components.sparqlTable.strategyShortest",map:"components.sparqlTable.strategyMap",sum:"components.sparqlTable.strategySum",avg:"components.sparqlTable.strategyAvg",min:"components.sparqlTable.strategyMin",max:"components.sparqlTable.strategyMax",mostRecent:"components.sparqlTable.strategyMostRecent",oldest:"components.sparqlTable.strategyOldest"},se={first:"components.sparqlTable.strategyFirstDesc",last:"components.sparqlTable.strategyLastDesc",random:"components.sparqlTable.strategyRandomDesc",join:"components.sparqlTable.strategyJoinDesc",count:"components.sparqlTable.strategyCountDesc",longest:"components.sparqlTable.strategyLongestDesc",shortest:"components.sparqlTable.strategyShortestDesc",map:"components.sparqlTable.strategyMapDesc",sum:"components.sparqlTable.strategySumDesc",avg:"components.sparqlTable.strategyAvgDesc",min:"components.sparqlTable.strategyMinDesc",max:"components.sparqlTable.strategyMaxDesc",mostRecent:"components.sparqlTable.strategyMostRecentDesc",oldest:"components.sparqlTable.strategyOldestDesc"};var U=f(7573);const H=`PREFIX qcy: <${U.E.qcy}>\nPREFIX qcy-e: <${U.E["qcy-e"]}>\n\nSELECT ?subject\nWHERE {\n ?subject a qcy:CanonicalEntity ;\n qcy:hasEntityCategory qcy-e:Person .\n}`;class re{field;headerName;sortable;filter;editable;hide;minWidth;cellStyle;headerClass;query="";defType="data";calculatedFrom;evaluation;datatype;postProcess;strategy;valueKey;labelKey;formatter=void 0;constructor(d="",t=""){this.field=d,this.headerName=t}getFormatter=()=>{if(this.formatter)return this.formatter;if(this.strategy){const d=this.strategy;return t=>F(t,d,"")}return d=>Array.isArray(d)?d.map(t=>t?.val??"").filter(Boolean).join(", "):String(d??"")}}var Te=f(4284),Se=f(2716),Me=f(222),k=f(6019);class Pe{queryHandler=(0,C.A)(function*(){throw new Error("No query handler defined")})}var ue=f(7089),e=f(5547);function xe(i,d){if(1&i&&(e.j41(0,"span",1),e.EFF(1),e.k0s()),2&i){const t=e.XpG();e.Y8G("cueTooltip",t._tooltip()),e.R7$(),e.SpI("\xd7",t._allValues().length)}}let Fe=(()=>{class i{_displayValue=(0,s.vPA)("");_allValues=(0,s.vPA)([]);_tooltip=(0,s.vPA)("");agInit(t){this._apply(t)}refresh(t){return this._apply(t),!0}_apply(t){const a=t.value,n=Array.isArray(a)?a:null!=a?[a]:[],o=t.colDef?.cellRendererParams?.strategy,l=t.colDef?.cellRendererParams?.valueKey??"val",r=t.colDef?.cellRendererParams?.labelKey??l,p=n.map(m=>m[r]).filter(Boolean);this._allValues.set(p);const c=t.colDef?.cellRendererParams?.postProcess;this._displayValue.set((0,E.g4)(o?F(n,o):p[0]??"",c)),this._tooltip.set(p.map(m=>(0,E.g4)(m,c)).join("\n"))}static \u0275fac=function(a){return new(a||i)};static \u0275cmp=e.VBU({type:i,selectors:[["cue-multi-binding-cell-renderer"]],decls:3,vars:2,consts:[[1,"cell-value"],["cueTooltipPosition","bottomleft",1,"badge",3,"cueTooltip"]],template:function(a,n){1&a&&(e.j41(0,"span",0),e.EFF(1),e.k0s(),e.nVh(2,xe,2,2,"span",1)),2&a&&(e.R7$(),e.JRh(n._displayValue()),e.R7$(),e.vxM(n._allValues().length>1?2:-1))},dependencies:[ue.d],styles:["[_nghost-%COMP%]{display:flex;align-items:center;gap:4px;overflow:hidden;width:100%}.cell-value[_ngcontent-%COMP%]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1}.badge[_ngcontent-%COMP%]{flex-shrink:0;font-size:10px;font-weight:600;background:var(--cue-color-blue, #2563eb);color:#fff;border-radius:8px;padding:0 5px;line-height:16px;cursor:default}"],changeDetection:0})}return i})();const de=["template","formula","pipeline"],pe=["add","subtract","multiply","divide"],je={template:"components.sparqlTable.evalTypeTemplate",formula:"components.sparqlTable.evalTypeFormula",pipeline:"components.sparqlTable.evalTypePipeline"},Ae={template:"components.sparqlTable.evalTypeTemplateDesc",formula:"components.sparqlTable.evalTypeFormulaDesc",pipeline:"components.sparqlTable.evalTypePipelineDesc"},Ne={add:"components.sparqlTable.formulaOpAdd",subtract:"components.sparqlTable.formulaOpSubtract",multiply:"components.sparqlTable.formulaOpMultiply",divide:"components.sparqlTable.formulaOpDivide"};let B=(()=>{class i{_requestedColumns=[];_columnQueries={};emptyTableText=(0,s.vPA)("Building table");_columns=(0,s.vPA)([]);_columnsGross=(0,s.vPA)(void 0);_dataColumns=(0,s.vPA)(void 0);columnDefsGross=(0,_.EW)(()=>void 0===this._columnsGross()?this._columns():this._columnsGross());keyVals={};_handlers=(0,s.vPA)(new Pe);destroy(){this.keyVals={},this._requestedColumns=[],this._columnQueries={},this.fetchedColumns.update(()=>[])}resetData(){this.keyVals={},this._requestedColumns=[],this._columnQueries={},this.fetchedColumns.update(()=>[])}mergeColumnData(t,a,n){Object.entries(a).forEach(([o,l])=>{this.keyVals[o]||(this.keyVals[o]={}),void 0===this.keyVals[o][t]&&(this.keyVals[o][t]=l)}),this._requestedColumns.includes(t)||this._requestedColumns.push(t),this._columnQueries[t]=n,this.fetchedColumns.update(o=>[...o,t])}injectPreloadedData(t,a,n){this.keyVals=t,this._requestedColumns=[...a],this._columnQueries={...n},this.fetchedColumns.update(()=>[...a])}fetchedColumns=(0,s.vPA)([],{equal:(t,a)=>t.length===a.length});isLoading=(0,_.EW)(()=>this._columns().length>0&&this.fetchedColumns().length<this.totalQueryCount());totalQueryCount=(0,_.EW)(()=>{const t=new Set;for(const a of this._columns())"data"===a.defType&&!a.hide&&a.query&&t.add(a.field);return t.size});columnDefsAG=(0,_.EW)(()=>{const t=[];return this._columns().forEach(a=>{const n=a.getFormatter();if("calculated"===a.defType){const o=this._columns().filter(r=>"data"===r.defType).map(r=>r.field);if(Array.from(new Set(o)).every(r=>this.fetchedColumns().includes(r))){const r=a.formatter??n;t.push({colId:a.field,headerName:a.headerName,sortable:!0,filter:!0,...a.minWidth?{minWidth:a.minWidth}:{},valueGetter:p=>r(null,p.data)})}}else if("evaluation"===a.defType){const o=this._columns().filter(r=>"data"===r.defType).map(r=>r.field);if(Array.from(new Set(o)).every(r=>this.fetchedColumns().includes(r))&&a.evaluation){const r=a.evaluation,p=this._columns();t.push({colId:a.field,headerName:a.headerName,hide:a.hide,flex:1,sortable:!0,filter:!0,valueGetter:c=>{const m=c.data??{},h={};for(const y of p)if("data"===y.defType){const T=y.getFormatter();h[y.field]=(0,E.g4)(T(m[y.field]??[]),y.postProcess)}return function we(i,d,t="",a){switch(i.type){case"template":return i.template.replace(/\$\{([\w.-]+)\}/g,(n,o)=>d[o]??"").trim();case"formula":{const n=i.fields.map(o=>parseFloat(d[o])).filter(o=>!isNaN(o));if(0===n.length)return t;switch(i.op){case"add":return String(n.reduce((o,l)=>o+l,0));case"subtract":return String(n.reduce((o,l)=>o-l));case"multiply":return String(n.reduce((o,l)=>o*l,1));case"divide":return n.length<2||0===n[1]?t:String(n[0]/n[1])}return t}case"pipeline":{const{sources:n,transform:o,exclude:l,deduplicate:u,sort:r,limit:p,valueKey:c="val"}=i,m=i.separator??", ",h=i.fallback??t,y=new Set,T=[];for(const R of n){let D=(a?.[R]??[]).map(b=>b[c]??"").filter(b=>""!==b);o&&(D=D.map(b=>(0,E.w9)(o,b))),l?.length&&(D=D.filter(b=>!l.includes(b)));for(const b of D)u&&y.has(b)||(y.add(b),T.push(b))}r&&T.sort();const v=void 0!==p?T.slice(0,p):T;return 0===v.length?h:v.join(m)}}}(r,h,"",m)}})}}else{const o=!!a.strategy;t.push({field:a.field,headerName:a.headerName,hide:a.hide,flex:1,sortable:!0,filter:!0,...a.minWidth?{minWidth:a.minWidth}:{},...a.cellStyle?{cellStyle:a.cellStyle}:{},...a.headerClass?{headerClass:a.headerClass}:{},valueGetter:o?l=>l.data?.[a.field]??[]:l=>(0,E.g4)(n(l.data?.[a.field]??[]),a.postProcess),...o?{comparator:(l,u)=>{const r=Array.isArray(l)?l:[],p=Array.isArray(u)?u:[],c=(0,E.g4)(F(r,a.strategy,""),a.postProcess),m=(0,E.g4)(F(p,a.strategy,""),a.postProcess);return c.localeCompare(m)},cellRenderer:Fe,cellRendererParams:{strategy:a.strategy,valueKey:a.valueKey??"val",labelKey:a.labelKey,postProcess:a.postProcess}}:{}})}}),t});set columns(t){t.forEach(a=>{a.field&&void 0!==this._columnQueries[a.field]&&this._columnQueries[a.field]!==a.query&&(this._requestedColumns=this._requestedColumns.filter(n=>n!==a.field),Object.values(this.keyVals).forEach(n=>delete n[a.field]),this.fetchedColumns.update(n=>n.filter(o=>o!==a.field))),this._columnQueries[a.field]=a.query}),this._columns.set(t),this.buildTable()}set columnsGross(t){this._columnsGross.set(t)}set dataColumns(t){this._dataColumns.set(t)}set handlers(t){this._handlers.set(t)}get visibleColumns(){return this._columns}buildTable(){var t=this;return(0,C.A)(function*(){const a=t._columns(),n=t._dataColumns(),o=a.filter(r=>"data"===r.defType&&!r.hide),l=n?.filter(r=>"data"===r.defType&&!r.hide);if(!o.length&&!l?.length)return void((a.length>0||(n?.length??0)>0)&&t.emptyTableText.set("No data columns defined"));t.emptyTableText.set("Building table...");const u=[];o.forEach(r=>{u.push(t.fetchColumnData(r))}),l?.forEach(r=>{u.push(t.fetchColumnData(r))}),yield Promise.all(u),t.emptyTableText.set("Table data downloaded")})()}fetchColumnData(t){var a=this;return(0,C.A)(function*(){if(a._requestedColumns.includes(t.field))return;a._requestedColumns.push(t.field);const n=(0,k.t)(t.query),o=yield a._handlers().queryHandler(t.query,n),l=new Set;o.results.bindings.forEach(u=>{const r=u.subject?.value,p=Object.keys(u).filter(m=>"subject"!==m),c={};p.forEach(m=>{const h=u[m]?.value;Object.keys(a.keyVals).includes(r)||(a.keyVals[r]={}),void 0===a.keyVals[r][t.field]&&(a.keyVals[r][t.field]=[]),c[m]=h}),a.keyVals[r][t.field].push(c),l.add(r)}),a.fetchedColumns.update(u=>[...u,t.field])})()}static \u0275fac=function(a){return new(a||i)};static \u0275prov=s.jDH({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})(),J=(()=>{class i{_isUpdating=!1;_pendingUpdate=!1;_dataFetchService=(0,s.WQX)(B);tableData=(0,s.vPA)([]);destroy(){this.tableData.update(()=>[])}onProcessedColumn=(0,s.QZP)((()=>{var t=this;return(0,C.A)(function*(){t._dataFetchService.fetchedColumns(),yield t._debouncedUpdateTableData()})})());_debouncedUpdateTableData(){var t=this;return(0,C.A)(function*(){t._isUpdating?t._pendingUpdate=!0:(t._isUpdating=!0,yield t._updateTableData(),t._isUpdating=!1,t._pendingUpdate&&(t._pendingUpdate=!1,yield t._debouncedUpdateTableData()))})()}_updateTableData(){var t=this;return(0,C.A)(function*(){return new Promise(a=>{const n={},o=Object.keys(t._dataFetchService.keyVals),l=[],u=t._dataFetchService.visibleColumns().map(p=>p.field);let r=!1;for(let p=0;p<o.length;p++){const c=o[p],m={};if(m.id=c,Object.keys(t._dataFetchService.keyVals[c]).forEach(h=>{Object.keys(n).includes(h)||(n[h]=0),m[h]=t._dataFetchService.keyVals[c][h]??[],""!==m[h]&&n[h]++}),l.push(m),!r&&9===p){let h=!0;for(const y of u)if(typeof m[y]>"u"){h=!1;break}h&&(t.tableData.update(()=>[...l]),r=!0)}}t.tableData.update(()=>l),a()})})()}static \u0275fac=function(a){return new(a||i)};static \u0275prov=s.jDH({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})();var V=f(2245),O=f(5381),Ie=f(2611);function ke(i,d){if(1&i&&e.nrm(0,"cue-typography",1),2&i){const t=e.XpG();e.Y8G("innerHTML",t.instructions(),e.npT)}}let Le=(()=>{class i{tableService=(0,s.WQX)(J);dataFetchService=(0,s.WQX)(B);handlers=g.hFB.required();columns=(0,g.geq)([]);columnsGross=(0,g.hFB)();dataColumns=(0,g.hFB)();showInstructions=(0,g.hFB)(!1);showPaginator=(0,g.hFB)(!0);paginationPageSize=(0,g.hFB)(10);settings=(0,g.hFB)(new Se.QA);emptyTableText=(0,g.geq)("Building table");loading=(0,g.hFB)(!1);clickableRows=(0,g.hFB)(!1);useAGGrid=(0,g.hFB)(!1);size=(0,g.hFB)("m");clickedRow=(0,g.CGW)();hoveredRow=(0,g.CGW)();tableDataUpdated=(0,g.CGW)();gridApi=(0,g.CGW)();visibleRows=(0,g.CGW)();columnDefsAG=(0,g.CGW)();onAGColumnDefs=(0,s.QZP)(()=>{const t=this.dataFetchService.columnDefsAG();this.columnDefsAG.emit(t)});onTableDataChange=(0,s.QZP)(()=>{this.tableDataUpdated.emit(this.tableService.tableData())});onHandlersChange=(0,s.QZP)(()=>{this.dataFetchService.handlers=this.handlers()});onColumnsChange=(0,s.QZP)(()=>{this.dataFetchService.columns=this.columns()});onColumnsGrossChange=(0,s.QZP)(()=>{this.dataFetchService.columnsGross=this.columnsGross()});onDataColumnsChange=(0,s.QZP)(()=>{this.dataFetchService.dataColumns=this.dataColumns()});onEmptyTableTextChange=(0,s.QZP)(()=>{this.emptyTableText.set(this.emptyTableText())});_onGridApiReady(t){this.gridApi.emit(t),t.addEventListener("columnVisible",a=>{a.visible&&(a.columns??(a.column?[a.column]:[])).forEach(o=>{const l=o.getColId(),u=this.columns().find(r=>r.field===l);u&&this.dataFetchService.fetchColumnData(u)})})}instructions=(0,s.vPA)("");buildInstructions=(0,s.QZP)((()=>{var t=this;return(0,C.A)(function*(){if(t.showInstructions()){const a=yield(0,Me.xI)('The component takes an array of SPARQL table columns. It is an extension of the regular table that adds a query to the column definition and restricts the formatter to always start with an array of values that should be converted to a string value (per default by comma joining).\n\nThere are some requirements for the SPARQL query:\n\n- Must be a SELECT query \n- Must use variable `?subject` to bind to the row identifier\n- No grouping needed since the component automatically groups by key and returns the remaining bindings as an array\n\nExample query:\n\n```sparql\nSELECT ?subject ?val \nWHERE { \n ?subject qcy:entityCategory qcy-e:Space ;\n qcy:hasProperty [\n qcy:label "LongName" ;\n qcy:value ?val\n ]\n}\n```\n\nThis query will outputs for the formatter in the following form (in this case with two bindings to the key/val):\n\n```json\n[{"val": "Room 101"}, {"val": "Room 01"}]\n```\n\nThese can then be used in a simple formatter that simply returns the first value or a - in case there are no bindings:\n\n```typescript\n(row) => row[0]?.val ?? \'-\'\n```\n\nLet\'s imagine that we instead had a query that would return bindings on the variables *?val* and *?score* and return bindings like this:\n\n```json\n[{"val": "Room 101", "score": "1"}, {"val": "Room 01", "score": "0.9"}]\n```\n\nA formatter could then take the highest score value:\n\n```typescript\n(row) => {\n const maxScore = 0;\n let val = "";\n row.forEach(r => {\n if(parseFloat(r.score) > maxScore) {\n maxScore = parseFloat(r.score);\n val = r.val;\n }\n });\n return val;\n}\n```\n\nThe formatter can also be more advanced and for example first format the values as dates using a library like DayJS before taking the most recent.\n');t.instructions.set(a)}})})());ngOnDestroy(){this.tableService.destroy(),this.dataFetchService.destroy()}static \u0275fac=function(a){return new(a||i)};static \u0275cmp=e.VBU({type:i,selectors:[["cue-sparql-table-inner"]],inputs:{handlers:[1,"handlers"],columns:[1,"columns"],columnsGross:[1,"columnsGross"],dataColumns:[1,"dataColumns"],showInstructions:[1,"showInstructions"],showPaginator:[1,"showPaginator"],paginationPageSize:[1,"paginationPageSize"],settings:[1,"settings"],emptyTableText:[1,"emptyTableText"],loading:[1,"loading"],clickableRows:[1,"clickableRows"],useAGGrid:[1,"useAGGrid"],size:[1,"size"]},outputs:{columns:"columnsChange",emptyTableText:"emptyTableTextChange",clickedRow:"clickedRow",hoveredRow:"hoveredRow",tableDataUpdated:"tableDataUpdated",gridApi:"gridApi",visibleRows:"visibleRows",columnDefsAG:"columnDefsAG"},decls:3,vars:8,consts:[["direction","column","gap","xl"],[3,"innerHTML"],[3,"gridApiReady","visibleRows","size","rowData","columnDefs","showPaginator","paginationPageSize","noRowsText","loading"]],template:function(a,n){1&a&&(e.j41(0,"cue-flexcontainer",0),e.nVh(1,ke,1,1,"cue-typography",1),e.j41(2,"cue-ag-grid",2),e.bIt("gridApiReady",function(l){return n._onGridApiReady(l)})("visibleRows",function(l){return n.visibleRows.emit(l)}),e.k0s()()),2&a&&(e.R7$(),e.vxM(n.showInstructions()?1:-1),e.R7$(),e.Y8G("size",n.size())("rowData",n.tableService.tableData())("columnDefs",n.dataFetchService.columnDefsAG())("showPaginator",n.showPaginator())("paginationPageSize",n.paginationPageSize())("noRowsText",n.dataFetchService.emptyTableText())("loading",n.loading()||n.dataFetchService.isLoading()))},dependencies:[V.Typography,O.FlexContainer,Ie.R],encapsulation:2,changeDetection:0})}return i})();var qe=f(9079),z=f(9352),_e=f(63),me=f(8957),Z=f(5971),fe=f(3319),ge=f(2530),ee=f(1096),he=f(5448),Ge=f(2014),Q=f(6593);const te=(i,d)=>d.field;function Oe(i,d){if(1&i&&(e.j41(0,"cue-typography",6),e.EFF(1),e.k0s()),2&i){const t=e.XpG(2);e.R7$(),e.SpI(" ",t._queryError()," ")}}function Qe(i,d){if(1&i){const t=e.RV6();e.j41(0,"cue-button",17),e.bIt("click",function(){s.eBV(t);const n=e.XpG(2);return s.Njj(n.discardQuery())}),e.nrm(1,"cue-button-padder"),e.j41(2,"cue-button-label"),e.EFF(3),e.nI1(4,"transloco"),e.k0s(),e.nrm(5,"cue-button-padder"),e.k0s()}2&i&&(e.R7$(3),e.JRh(e.bMT(4,1,"components.sparqlTable.labelDiscard")))}function $e(i,d){1&i&&(e.j41(0,"cue-typography",11),e.EFF(1),e.nI1(2,"transloco"),e.k0s()),2&i&&(e.R7$(),e.SpI(" ",e.bMT(2,1,"components.sparqlTable.labelQueryPending")," "))}function Be(i,d){if(1&i&&(e.j41(0,"cue-typography",6),e.EFF(1),e.k0s()),2&i){const t=e.XpG(2);e.R7$(),e.SpI(" ",t._testError()," ")}}function ze(i,d){if(1&i&&(e.j41(0,"cue-typography",19),e.EFF(1),e.k0s()),2&i){const t=d.$implicit;e.R7$(),e.JRh(t)}}function Xe(i,d){if(1&i&&(e.j41(0,"cue-typography",18),e.EFF(1),e.nI1(2,"transloco"),e.k0s(),e.Z7z(3,ze,2,1,"cue-typography",19,e.Vm6)),2&i){const t=e.XpG(2);e.R7$(),e.JRh(e.bMT(2,1,"components.sparqlTable.labelTestResults")),e.R7$(2),e.Dyx(t._testRows())}}function Ke(i,d){if(1&i){const t=e.RV6();e.j41(0,"cue-input",20),e.nI1(1,"transloco"),e.bIt("valueChange",function(n){s.eBV(t);const o=e.XpG(2);return s.Njj(o._strategySeparator.set(n))}),e.k0s()}if(2&i){const t=e.XpG(2);e.Y8G("label",e.bMT(1,2,"components.sparqlTable.labelSeparator"))("value",t._strategySeparator())}}function We(i,d){if(1&i){const t=e.RV6();e.j41(0,"cue-input",20),e.nI1(1,"transloco"),e.bIt("valueChange",function(n){s.eBV(t);const o=e.XpG(2);return s.Njj(o._strategyValueKey.set(n))}),e.k0s()}if(2&i){const t=e.XpG(2);e.Y8G("label",e.bMT(1,2,"components.sparqlTable.labelValueKey"))("value",t._strategyValueKey())}}function Ye(i,d){if(1&i){const t=e.RV6();e.j41(0,"cue-input",16),e.nI1(1,"transloco"),e.nI1(2,"transloco"),e.bIt("valueChange",function(n){s.eBV(t);const o=e.XpG(2);return o._strategyPriorityKey.set(n),s.Njj(o._applyStrategyChange())}),e.k0s()}if(2&i){const t=e.XpG(2);e.Y8G("label",e.bMT(1,3,"components.sparqlTable.labelPriorityKey"))("info",e.bMT(2,5,"components.sparqlTable.tooltipPriorityKey"))("value",t._strategyPriorityKey())}}function Ue(i,d){if(1&i&&(e.j41(0,"cue-typography",6),e.EFF(1),e.k0s()),2&i){const t=e.XpG(3);e.R7$(),e.SpI(" ",t._strategyMapError()," ")}}function He(i,d){if(1&i){const t=e.RV6();e.j41(0,"cue-typography",3),e.nI1(1,"transloco"),e.EFF(2),e.nI1(3,"transloco"),e.k0s(),e.j41(4,"div",21)(5,"cue-code-editor",22),e.bIt("contentChanged",function(n){s.eBV(t);const o=e.XpG(2);return s.Njj(o._onMapJsonChanged(n))}),e.k0s()(),e.nVh(6,Ue,2,1,"cue-typography",6)}if(2&i){const t=e.XpG(2);e.Y8G("info",e.bMT(1,4,"components.sparqlTable.tooltipMapJson")),e.R7$(2),e.SpI(" ",e.bMT(3,6,"components.sparqlTable.labelMapJson")," "),e.R7$(3),e.Y8G("content",t._strategyMapJson()),e.R7$(),e.vxM(t._strategyMapError()?6:-1)}}function Je(i,d){if(1&i&&(e.j41(0,"cue-typography",6),e.EFF(1),e.k0s()),2&i){const t=e.XpG(2);e.R7$(),e.SpI(" ",t._strategyPreProcessError()," ")}}function Ze(i,d){if(1&i){const t=e.RV6();e.j41(0,"cue-typography",3),e.nI1(1,"transloco"),e.EFF(2),e.nI1(3,"transloco"),e.k0s(),e.j41(4,"div",4)(5,"cue-code-editor",5),e.bIt("contentChanged",function(n){s.eBV(t);const o=e.XpG();return s.Njj(o.onQueryChanged(n))}),e.k0s()(),e.nVh(6,Oe,2,1,"cue-typography",6),e.j41(7,"cue-flexcontainer",7),e.nVh(8,Qe,6,3,"cue-button",8),e.j41(9,"cue-button",9),e.bIt("click",function(){s.eBV(t);const n=e.XpG();return s.Njj(n.testQuery())}),e.nrm(10,"cue-button-padder")(11,"cue-button-icon",10),e.j41(12,"cue-button-label"),e.EFF(13),e.nI1(14,"transloco"),e.k0s(),e.nrm(15,"cue-button-padder"),e.k0s()(),e.nVh(16,$e,3,3,"cue-typography",11),e.nVh(17,Be,2,1,"cue-typography",6),e.nVh(18,Xe,5,3),e.j41(19,"cue-select",2),e.nI1(20,"transloco"),e.bIt("valueChange",function(n){s.eBV(t);const o=e.XpG();return s.Njj(o.setDatatype(n))}),e.k0s(),e.j41(21,"cue-select",12),e.nI1(22,"transloco"),e.nI1(23,"transloco"),e.bIt("valueChange",function(n){s.eBV(t);const o=e.XpG();return s.Njj(o.setStrategyType(n))}),e.k0s(),e.j41(24,"cue-typography",13),e.EFF(25),e.k0s(),e.nVh(26,Ke,2,4,"cue-input",14),e.nVh(27,We,2,4,"cue-input",14),e.nVh(28,Ye,3,7,"cue-input",15),e.nVh(29,He,7,8),e.j41(30,"cue-input",16),e.nI1(31,"transloco"),e.nI1(32,"transloco"),e.bIt("valueChange",function(n){s.eBV(t);const o=e.XpG();return o._strategyPreProcess.set(n),s.Njj(o._applyStrategyChange())}),e.k0s(),e.nVh(33,Je,2,1,"cue-typography",6),e.j41(34,"cue-input",16),e.nI1(35,"transloco"),e.nI1(36,"transloco"),e.bIt("valueChange",function(n){s.eBV(t);const o=e.XpG();return o._strategyFallback.set(n),s.Njj(o._applyStrategyChange())}),e.k0s()}if(2&i){const t=e.XpG();e.Y8G("info",e.bMT(1,31,"components.sparqlTable.tooltipQuery")),e.R7$(2),e.JRh(e.bMT(3,33,"components.sparqlTable.labelQuery")),e.R7$(3),e.Y8G("content",t.query()),e.R7$(),e.vxM(t._queryError()?6:-1),e.R7$(2),e.vxM(t._queryDirty()?8:-1),e.R7$(),e.Y8G("disabled",!!t._queryError()),e.R7$(4),e.JRh(e.bMT(14,35,"components.sparqlTable.labelTest")),e.R7$(3),e.vxM(t._queryDirty()&&!t._queryError()?16:-1),e.R7$(),e.vxM(t._testError()?17:-1),e.R7$(),e.vxM(t._testRows().length>0?18:-1),e.R7$(),e.Y8G("label",e.bMT(20,37,"components.sparqlTable.labelDatatype"))("value",t._datatype()??"")("options",t.datatypeOptions)("labelMap",t.datatypeLabelMap()),e.R7$(2),e.Y8G("label",e.bMT(22,39,"components.sparqlTable.labelStrategy"))("info",e.bMT(23,41,"components.sparqlTable.tooltipStrategy"))("value",t._strategyType())("options",t.availableStrategyTypes())("labelMap",t.strategyLabelMap()),e.R7$(4),e.JRh(t._strategyDescription()),e.R7$(),e.vxM(t._strategyNeedsSeparator()?26:-1),e.R7$(),e.vxM(t._strategyNeedsValueKey()?27:-1),e.R7$(),e.vxM(t._strategyNeedsPriorityKey()?28:-1),e.R7$(),e.vxM(t._strategyNeedsMap()?29:-1),e.R7$(),e.Y8G("label",e.bMT(31,43,"components.sparqlTable.labelPreProcess"))("info",e.bMT(32,45,"components.sparqlTable.tooltipPreProcess"))("value",t._strategyPreProcess()),e.R7$(3),e.vxM(t._strategyPreProcessError()?33:-1),e.R7$(),e.Y8G("label",e.bMT(35,47,"components.sparqlTable.labelFallback"))("info",e.bMT(36,49,"components.sparqlTable.tooltipFallback"))("value",t._strategyFallback())}}function et(i,d){if(1&i){const t=e.RV6();e.j41(0,"span",26),e.bIt("click",function(){const n=s.eBV(t).$implicit,o=e.XpG(4);return s.Njj(o._insertFieldIntoTemplate(n.field))}),e.EFF(1),e.k0s()}if(2&i){const t=d.$implicit;e.Y8G("title",t.headerName),e.R7$(),e.JRh(t.token)}}function tt(i,d){if(1&i&&(e.j41(0,"cue-typography",13),e.EFF(1),e.nI1(2,"transloco"),e.k0s(),e.j41(3,"cue-flexcontainer",24),e.Z7z(4,et,2,2,"span",25,te),e.k0s()),2&i){const t=e.XpG(3);e.R7$(),e.SpI(" ",e.bMT(2,1,"components.sparqlTable.labelAvailableFields")," "),e.R7$(3),e.Dyx(t._dataColumnFields())}}function nt(i,d){if(1&i){const t=e.RV6();e.j41(0,"cue-input",16),e.nI1(1,"transloco"),e.nI1(2,"transloco"),e.bIt("valueChange",function(n){s.eBV(t);const o=e.XpG(2);return o._evalTemplate.set(n),s.Njj(o._applyEvaluation())}),e.k0s(),e.nVh(3,tt,6,3)}if(2&i){const t=e.XpG(2);e.Y8G("label",e.bMT(1,4,"components.sparqlTable.labelEvalTemplate"))("info",e.bMT(2,6,"components.sparqlTable.tooltipEvalTemplate"))("value",t._evalTemplate()),e.R7$(3),e.vxM(t._dataColumnFields().length?3:-1)}}function at(i,d){if(1&i){const t=e.RV6();e.j41(0,"span",26),e.bIt("click",function(){const n=s.eBV(t).$implicit,o=e.XpG(3);return s.Njj(o._toggleFormulaField(n.field))}),e.EFF(1),e.k0s()}if(2&i){const t=d.$implicit,a=e.XpG(3);e.AVh("field-chip--active",a._formulaFields().includes(t.field)),e.Y8G("title",t.field),e.R7$(),e.JRh(t.headerName)}}function ot(i,d){if(1&i&&(e.j41(0,"span",30),e.EFF(1),e.k0s()),2&i){const t=e.XpG(5);e.R7$(),e.JRh(t._formulaOpSymbol())}}function it(i,d){if(1&i&&(e.j41(0,"span",29),e.EFF(1),e.k0s(),e.nVh(2,ot,2,1,"span",30)),2&i){const t=d.$implicit,a=d.$index,n=d.$count,o=e.XpG(4);e.R7$(),e.JRh(o._fieldLabel(t)),e.R7$(),e.vxM(a!==n-1?2:-1)}}function lt(i,d){if(1&i&&(e.j41(0,"cue-flexcontainer",28),e.Z7z(1,it,3,2,null,null,e.fX1),e.k0s()),2&i){const t=e.XpG(3);e.R7$(),e.Dyx(t._formulaFields())}}function st(i,d){if(1&i){const t=e.RV6();e.j41(0,"cue-select",2),e.nI1(1,"transloco"),e.bIt("valueChange",function(n){s.eBV(t);const o=e.XpG(2);return s.Njj(o.setFormulaOp(n))}),e.k0s(),e.j41(2,"cue-typography",13),e.EFF(3),e.nI1(4,"transloco"),e.k0s(),e.j41(5,"cue-flexcontainer",24),e.Z7z(6,at,2,4,"span",27,te),e.k0s(),e.nVh(8,lt,3,0,"cue-flexcontainer",28)}if(2&i){const t=e.XpG(2);e.Y8G("label",e.bMT(1,6,"components.sparqlTable.labelFormulaOp"))("value",t._formulaOp())("options",t.formulaOpOptions)("labelMap",t.formulaOpLabelMap()),e.R7$(3),e.SpI(" ",e.bMT(4,8,"components.sparqlTable.labelFormulaFields")," "),e.R7$(3),e.Dyx(t._dataColumnFields()),e.R7$(2),e.vxM(t._formulaFields().length?8:-1)}}function rt(i,d){if(1&i&&(e.j41(0,"cue-typography",23),e.EFF(1),e.nI1(2,"transloco"),e.k0s()),2&i){const t=e.XpG(2);e.R7$(),e.Lme(" ",e.bMT(2,2,"components.sparqlTable.labelEvalPreview"),": ",t._evalPreview()," ")}}function ct(i,d){if(1&i){const t=e.RV6();e.j41(0,"span",26),e.bIt("click",function(){const n=s.eBV(t).$implicit,o=e.XpG(3);return s.Njj(o._togglePipelineSource(n.field))}),e.EFF(1),e.k0s()}if(2&i){const t=d.$implicit,a=e.XpG(3);e.AVh("field-chip--active",a._pipelineSources().includes(t.field)),e.Y8G("title",t.field),e.R7$(),e.JRh(t.headerName)}}function ut(i,d){if(1&i&&(e.j41(0,"cue-typography",11),e.EFF(1),e.nI1(2,"transloco"),e.k0s()),2&i){const t=e.XpG(3);e.R7$(),e.Lme(" ",e.bMT(2,2,"components.sparqlTable.labelPipelineSourceOrder"),": ",t._pipelineSources().join(" \u2192 ")," ")}}function dt(i,d){if(1&i&&(e.j41(0,"cue-typography",6),e.EFF(1),e.k0s()),2&i){const t=e.XpG(3);e.R7$(),e.JRh(t._pipelineTransformError())}}function pt(i,d){if(1&i&&(e.j41(0,"cue-typography",6),e.EFF(1),e.k0s()),2&i){const t=e.XpG(3);e.R7$(),e.JRh(t._pipelineExcludeError())}}function _t(i,d){if(1&i){const t=e.RV6();e.j41(0,"cue-typography",3),e.nI1(1,"transloco"),e.EFF(2),e.nI1(3,"transloco"),e.k0s(),e.j41(4,"cue-flexcontainer",24),e.Z7z(5,ct,2,4,"span",27,te),e.k0s(),e.nVh(7,ut,3,4,"cue-typography",11),e.j41(8,"cue-input",16),e.nI1(9,"transloco"),e.nI1(10,"transloco"),e.bIt("valueChange",function(n){s.eBV(t);const o=e.XpG(2);return o._pipelineTransform.set(n),s.Njj(o._applyEvaluation())}),e.k0s(),e.nVh(11,dt,2,1,"cue-typography",6),e.j41(12,"cue-input",16),e.nI1(13,"transloco"),e.nI1(14,"transloco"),e.bIt("valueChange",function(n){s.eBV(t);const o=e.XpG(2);return o._pipelineLimit.set(n),s.Njj(o._applyEvaluation())}),e.k0s(),e.j41(15,"cue-input",20),e.nI1(16,"transloco"),e.bIt("valueChange",function(n){s.eBV(t);const o=e.XpG(2);return o._pipelineSeparator.set(n),s.Njj(o._applyEvaluation())}),e.k0s(),e.j41(17,"cue-input",16),e.nI1(18,"transloco"),e.nI1(19,"transloco"),e.bIt("valueChange",function(n){s.eBV(t);const o=e.XpG(2);return o._pipelineFallback.set(n),s.Njj(o._applyEvaluation())}),e.k0s(),e.j41(20,"cue-flexcontainer",31)(21,"label",32)(22,"input",33),e.bIt("change",function(){s.eBV(t);const n=e.XpG(2);return n._pipelineDeduplicate.set(!n._pipelineDeduplicate()),s.Njj(n._applyEvaluation())}),e.k0s(),e.EFF(23),e.nI1(24,"transloco"),e.k0s(),e.j41(25,"label",32)(26,"input",33),e.bIt("change",function(){s.eBV(t);const n=e.XpG(2);return n._pipelineSort.set(!n._pipelineSort()),s.Njj(n._applyEvaluation())}),e.k0s(),e.EFF(27),e.nI1(28,"transloco"),e.k0s()(),e.j41(29,"cue-typography",3),e.nI1(30,"transloco"),e.EFF(31),e.nI1(32,"transloco"),e.k0s(),e.j41(33,"div",34)(34,"cue-code-editor",22),e.bIt("contentChanged",function(n){s.eBV(t);const o=e.XpG(2);return s.Njj(o._onPipelineExcludeChanged(n))}),e.k0s()(),e.nVh(35,pt,2,1,"cue-typography",6)}if(2&i){const t=e.XpG(2);e.Y8G("info",e.bMT(1,23,"components.sparqlTable.tooltipPipelineSources")),e.R7$(2),e.SpI(" ",e.bMT(3,25,"components.sparqlTable.labelPipelineSources")," "),e.R7$(3),e.Dyx(t._dataColumnFields()),e.R7$(2),e.vxM(t._pipelineSources().length>1?7:-1),e.R7$(),e.Y8G("label",e.bMT(9,27,"components.sparqlTable.labelPipelineTransform"))("info",e.bMT(10,29,"components.sparqlTable.tooltipPipelineTransform"))("value",t._pipelineTransform()),e.R7$(3),e.vxM(t._pipelineTransformError()?11:-1),e.R7$(),e.Y8G("label",e.bMT(13,31,"components.sparqlTable.labelPipelineLimit"))("info",e.bMT(14,33,"components.sparqlTable.tooltipPipelineLimit"))("value",t._pipelineLimit()),e.R7$(3),e.Y8G("label",e.bMT(16,35,"components.sparqlTable.labelSeparator"))("value",t._pipelineSeparator()),e.R7$(2),e.Y8G("label",e.bMT(18,37,"components.sparqlTable.labelFallback"))("info",e.bMT(19,39,"components.sparqlTable.tooltipFallback"))("value",t._pipelineFallback()),e.R7$(5),e.Y8G("checked",t._pipelineDeduplicate()),e.R7$(),e.SpI(" ",e.bMT(24,41,"components.sparqlTable.labelPipelineDeduplicate")," "),e.R7$(3),e.Y8G("checked",t._pipelineSort()),e.R7$(),e.SpI(" ",e.bMT(28,43,"components.sparqlTable.labelPipelineSort")," "),e.R7$(2),e.Y8G("info",e.bMT(30,45,"components.sparqlTable.tooltipPipelineExclude")),e.R7$(2),e.SpI(" ",e.bMT(32,47,"components.sparqlTable.labelPipelineExclude")," "),e.R7$(3),e.Y8G("content",t._pipelineExcludeJson()),e.R7$(),e.vxM(t._pipelineExcludeError()?35:-1)}}function mt(i,d){if(1&i){const t=e.RV6();e.j41(0,"cue-select",2),e.nI1(1,"transloco"),e.bIt("valueChange",function(n){s.eBV(t);const o=e.XpG();return s.Njj(o.setEvalType(n))}),e.k0s(),e.j41(2,"cue-typography",13),e.EFF(3),e.k0s(),e.nVh(4,nt,4,8),e.nVh(5,st,9,10),e.nVh(6,rt,3,4,"cue-typography",23),e.nVh(7,_t,36,49)}if(2&i){const t=e.XpG();e.Y8G("label",e.bMT(1,9,"components.sparqlTable.labelEvalType"))("value",t._evalType())("options",t.evaluationTypeOptions)("labelMap",t.evaluationTypeLabelMap()),e.R7$(3),e.JRh(t._evalTypeDescription()),e.R7$(),e.vxM("template"===t._evalType()?4:-1),e.R7$(),e.vxM("formula"===t._evalType()?5:-1),e.R7$(),e.vxM(t._evalPreview()?6:-1),e.R7$(),e.vxM("pipeline"===t._evalType()?7:-1)}}const ft=["join"],ye=["sum","avg","min","max","mostRecent","oldest","longest","shortest"],ve=["first","last","sum","avg","min","max","mostRecent","oldest","longest","shortest"],gt=["map"],be=["text","number","date"],ht=Object.assign(new ee.e,{});let yt=(()=>{class i{columnDef=g.geq.required();handlers=(0,g.hFB)();columns=(0,g.hFB)([]);close=(0,g.CGW)();updateColumnDef=(0,g.CGW)();agGridSettings=ht;_transloco=(0,s.WQX)(z.JO);_lang=(0,qe.ot)(this._transloco.langChanges$,{initialValue:this._transloco.getActiveLang()});columnTypeOptions=["data","evaluation"];columnTypeLabelMap=(0,_.EW)(()=>(this._lang(),{data:this._transloco.translate("components.sparqlTable.columnTypeData"),evaluation:this._transloco.translate("components.sparqlTable.columnTypeEvaluation")}));_defType=(0,_.uu)(()=>"evaluation"===this.columnDef().defType?"evaluation":"data");setDefType(t){const a=t;if(this._defType.set(a),"evaluation"===a){const o=this.columnDef().evaluation??{type:"template",template:""};this.updateColumnDef.emit({defType:"evaluation",evaluation:o})}else this.updateColumnDef.emit({defType:"data"})}_evalType=(0,_.uu)(()=>this.columnDef().evaluation?.type??"template");_evalTemplate=(0,_.uu)(()=>{const t=this.columnDef().evaluation;return"template"===t?.type?t.template:""});_formulaOp=(0,_.uu)(()=>{const t=this.columnDef().evaluation;return"formula"===t?.type?t.op:"add"});_formulaFields=(0,_.uu)(()=>{const t=this.columnDef().evaluation;return"formula"===t?.type?[...t.fields]:[]});_pipelineSources=(0,_.uu)(()=>{const t=this.columnDef().evaluation;return"pipeline"===t?.type?[...t.sources]:[]});_pipelineTransform=(0,_.uu)(()=>{const t=this.columnDef().evaluation;return"pipeline"===t?.type?t.transform??"":""});_pipelineLimit=(0,_.uu)(()=>{const t=this.columnDef().evaluation;return"pipeline"===t?.type?String(t.limit??""):""});_pipelineSeparator=(0,_.uu)(()=>{const t=this.columnDef().evaluation;return"pipeline"===t?.type?t.separator??", ":", "});_pipelineFallback=(0,_.uu)(()=>{const t=this.columnDef().evaluation;return"pipeline"===t?.type?t.fallback??"":""});_pipelineDeduplicate=(0,_.uu)(()=>{const t=this.columnDef().evaluation;return"pipeline"===t?.type&&(t.deduplicate??!1)});_pipelineSort=(0,_.uu)(()=>{const t=this.columnDef().evaluation;return"pipeline"===t?.type&&(t.sort??!1)});_pipelineExcludeJson=(0,_.uu)(()=>{const t=this.columnDef().evaluation,a="pipeline"===t?.type?t.exclude??[]:[];try{return JSON.stringify(a,null,2)}catch{return"[]"}});_pipelineExcludeError=(0,s.vPA)("");_pipelineExcludeParsed=(0,s.vPA)([]);_pipelineTransformError=(0,_.EW)(()=>{const t=this._pipelineTransform();if(t)return(0,E.NF)(t)??void 0});evaluationTypeOptions=de;evaluationTypeLabelMap=(0,_.EW)(()=>(this._lang(),Object.fromEntries(de.map(t=>[t,this._transloco.translate(je[t])]))));_evalTypeDescription=(0,_.EW)(()=>(this._lang(),this._transloco.translate(Ae[this._evalType()])));formulaOpOptions=pe;formulaOpLabelMap=(0,_.EW)(()=>(this._lang(),Object.fromEntries(pe.map(t=>[t,this._transloco.translate(Ne[t])]))));_dataColumnFields=(0,_.EW)(()=>this.columns().filter(t=>"data"===t.defType&&t.field!==this.columnDef().field).map(t=>({field:t.field,headerName:t.headerName??t.field,token:"${"+t.field+"}"})));_evalPreview=(0,_.EW)(()=>{if("template"===this._evalType()){const t=this._evalTemplate();return t?t.replace(/\$\{([\w.-]+)\}/g,(a,n)=>`[${n}]`):""}if("formula"===this._evalType()){const t=this._formulaFields(),a=this._formulaOp();return 0===t.length?"":t.join(` ${{add:"+",subtract:"\u2212",multiply:"\xd7",divide:"\xf7"}[a]} `)}if("pipeline"===this._evalType()){const t=this._pipelineSources(),a=this._pipelineTransform(),n=this._pipelineLimit();if(0===t.length)return"";const o=[`sources: [${t.join(", ")}]`];return a&&o.push(`transform: ${a}`),this._pipelineDeduplicate()&&o.push("deduplicate"),this._pipelineSort()&&o.push("sort"),n&&o.push(`limit: ${n}`),o.join(" | ")}return""});setEvalType(t){if(t){if(this._evalType.set(t),"pipeline"===t&&0===this._pipelineSources().length){const a=this._dataColumnFields()[0];a&&this._pipelineSources.set([a.field])}this._applyEvaluation()}}setFormulaOp(t){t&&(this._formulaOp.set(t),this._applyEvaluation())}_toggleFormulaField(t){const a=this._formulaFields(),n=a.includes(t)?a.filter(o=>o!==t):[...a,t];this._formulaFields.set(n),this._applyEvaluation()}_fieldLabel(t){return this._dataColumnFields().find(a=>a.field===t)?.headerName??t}_formulaOpSymbol=(0,_.EW)(()=>({add:"+",subtract:"\u2212",multiply:"\xd7",divide:"\xf7"}[this._formulaOp()]));_insertFieldIntoTemplate(t){const a=this._evalTemplate();this._evalTemplate.set(a+`\${${t}}`),this._applyEvaluation()}_togglePipelineSource(t){const a=this._pipelineSources(),n=a.includes(t)?a.filter(o=>o!==t):[...a,t];this._pipelineSources.set(n),this._applyEvaluation()}_applyEvaluation(){let t;if("template"===this._evalType())t={type:"template",template:this._evalTemplate()};else if("pipeline"===this._evalType()){const a={type:"pipeline",sources:this._pipelineSources(),deduplicate:this._pipelineDeduplicate()||void 0,sort:this._pipelineSort()||void 0,separator:this._pipelineSeparator()||void 0,fallback:this._pipelineFallback()||void 0,transform:this._pipelineTransform()||void 0,exclude:this._pipelineExcludeParsed().length?this._pipelineExcludeParsed():void 0},n=parseInt(this._pipelineLimit(),10);!isNaN(n)&&n>0&&(a.limit=n),t=a}else t={type:"formula",fields:this._formulaFields(),op:this._formulaOp()};this.updateColumnDef.emit({evaluation:t})}_onPipelineExcludeChanged(t){this._pipelineExcludeJson.set(t);try{const a=JSON.parse(t);if(!Array.isArray(a))throw new Error("Must be a JSON array of strings");this._pipelineExcludeError.set(""),this._pipelineExcludeParsed.set(a),this._applyEvaluation()}catch(a){this._pipelineExcludeError.set(a?.message??"Invalid JSON")}}datatypeOptions=be;datatypeLabelMap=(0,_.EW)(()=>(this._lang(),Object.fromEntries(be.map(t=>[t,this._transloco.translate(`components.sparqlTable.datatype${t.charAt(0).toUpperCase()+t.slice(1)}`)]))));availableStrategyTypes=(0,_.EW)(()=>{const t=this._datatype();return t?A[t]:Y});strategyLabelMap=(0,_.EW)(()=>(this._lang(),Object.fromEntries(Y.map(t=>[t,this._transloco.translate(G[t])]))));_strategyDescription=(0,_.EW)(()=>(this._lang(),this._transloco.translate(se[this._strategyType()])));query=(0,_.EW)(()=>this.columnDef().query??"");_editedQuery=(0,_.uu)(()=>this.query());_queryError=(0,_.EW)(()=>{this._lang();const t=function Ve(i,d="val"){if(!i?.trim())return null;let t;try{t=new Q.Parser({sparqlStar:!0}).parse(i)}catch{return"validationErrorSyntax"}if("query"!==t?.type||"SELECT"!==t?.queryType)return"validationErrorNotSelect";const n=t.variables;if(1===n.length&&"*"===n[0])return null;const o=n.map(l=>l?.value??l?.variable?.value??"");return o.includes("subject")?o.includes(d)?null:"validationErrorMissingVal":"validationErrorMissingKey"}(this._editedQuery(),this._strategyValueKey()||"val");if(!t)return;const a=`components.sparqlTable.${t}`;return"validationErrorMissingVal"===t?this._transloco.translate(a,{var:this._strategyValueKey()||"val"}):this._transloco.translate(a)});_datatype=(0,_.uu)(()=>this.columnDef().datatype);_strategyType=(0,_.uu)(()=>this.columnDef().strategy?.type??"join");_strategySeparator=(0,_.uu)(()=>this.columnDef().strategy?.separator??", ");_strategyValueKey=(0,_.uu)(()=>this.columnDef().strategy?.valueKey??"val");_strategyPriorityKey=(0,_.uu)(()=>this.columnDef().strategy?.priorityKey??"");_strategyPreProcess=(0,_.uu)(()=>this.columnDef().strategy?.preProcess??"");_strategyFallback=(0,_.uu)(()=>this.columnDef().strategy?.fallback??"");_strategyMapJson=(0,_.uu)(()=>{const t=this.columnDef().strategy;if("map"!==t?.type)return"{}";try{return JSON.stringify(t.map,null,2)}catch{return"{}"}});_strategyMapError=(0,s.vPA)("");_strategyNeedsSeparator=(0,_.EW)(()=>ft.includes(this._strategyType()));_strategyNeedsValueKey=(0,_.EW)(()=>ye.includes(this._strategyType()));_strategyNeedsPriorityKey=(0,_.EW)(()=>ve.includes(this._strategyType())&&this._queryExtraBindings().length>0);_strategyNeedsMap=(0,_.EW)(()=>gt.includes(this._strategyType()));_strategyPreProcessError=(0,_.EW)(()=>{const t=this._strategyPreProcess();return t?(0,E.NF)(t)??void 0:void 0});_queryExtraBindings=(0,_.EW)(()=>{const t=this._editedQuery(),a=this._strategyValueKey()||"val";if(!t?.trim())return[];try{const n=new Q.Parser({sparqlStar:!0}).parse(t);if("SELECT"!==n?.queryType)return[];const o=n.variables;return 1===o.length&&"*"===o[0]?[]:o.map(u=>u?.value??u?.variable?.value??"").filter(Boolean).filter(u=>"subject"!==u&&u!==a)}catch{return[]}});setDatatype(t){const a=t||void 0;if(this._datatype.set(a),a&&!A[a].includes(this._strategyType()))return this._strategyType.set("first"),void this.updateColumnDef.emit({strategy:{type:"first"},datatype:a});this.updateColumnDef.emit({datatype:a})}setStrategyType(t){if(!t)return;this._strategyType.set(t);const a=this._buildStrategy(t);this.updateColumnDef.emit({strategy:a})}_applyStrategyChange(){const t=this._buildStrategy(this._strategyType());this.updateColumnDef.emit({strategy:t})}_buildStrategy(t){const a=this._strategyValueKey()||"val",n=this._strategyPriorityKey()||void 0,u={preProcess:this._strategyPreProcess()||void 0,fallback:this._strategyFallback()||void 0};if("join"===t)return{type:t,separator:this._strategySeparator(),...u};if("map"===t){let r={};try{r=JSON.parse(this._strategyMapJson())}catch{}return{type:t,map:r,...u}}return ye.includes(t)?{type:t,valueKey:a,priorityKey:n,...u}:ve.includes(t)?{type:t,priorityKey:n,...u}:{type:t,...u}}_onMapJsonChanged(t){this._strategyMapJson.set(t);try{const a=JSON.parse(t);if("object"!=typeof a||Array.isArray(a))throw new Error("Must be a JSON object");this._strategyMapError.set(""),this._applyStrategyChange()}catch(a){this._strategyMapError.set(a?.message??"Invalid JSON")}}_queryDirty=(0,_.EW)(()=>this._editedQuery()!==this.query());onQueryChanged(t){this._editedQuery.set(t)}discardQuery(){this._editedQuery.set(this.query()),this._testRows.set([]),this._testError.set("")}_testRows=(0,s.vPA)([]);_testError=(0,s.vPA)("");_testLoading=(0,s.vPA)(!1);testQuery(){var t=this;return(0,C.A)(function*(){const a=t.handlers()?.queryHandler;if(!a)return void t._testError.set("No query handler available.");t._testRows.set([]),t._testError.set(""),t._testLoading.set(!0);const o=t._editedQuery().trim().replace(/\s*LIMIT\s+\d+\s*$/i,"")+"\nLIMIT 5";try{const u=((yield a(o,{}))?.results?.bindings??[]).map(r=>JSON.stringify(Object.fromEntries(Object.entries(r).map(([p,c])=>[p,c.value])),null,2));t._testRows.set(u),t.updateColumnDef.emit({query:t._editedQuery()})}catch(l){t._testError.set(l?.message??String(l))}finally{t._testLoading.set(!1)}})()}_onColDefUpdate(t){this.updateColumnDef.emit(t)}static \u0275fac=function(a){return new(a||i)};static \u0275cmp=e.VBU({type:i,selectors:[["cue-declarative-sparql-column-settings-modal"]],inputs:{columnDef:[1,"columnDef"],handlers:[1,"handlers"],columns:[1,"columns"]},outputs:{columnDef:"columnDefChange",close:"close",updateColumnDef:"updateColumnDef"},decls:7,vars:13,consts:[["minWidth","800px",3,"updateColumn","close","columnDef","settings","extraPanelLabel"],["cueExtraContent","","direction","column"],[3,"valueChange","label","value","options","labelMap"],["size","s",3,"info"],[2,"height","200px","min-height","120px"],["type","sparql",3,"contentChanged","content"],["size","s",2,"color","var(--cue-error)"],["direction","row","justify","end","gap","s"],["variant","ghost","size","s"],["variant","secondary","size","s",3,"click","disabled"],["icon","go"],["size","xs",2,"opacity","0.6","font-style","italic"],[3,"valueChange","label","info","value","options","labelMap"],["size","xs",2,"opacity","0.7"],[3,"label","value"],[3,"label","info","value"],[3,"valueChange","label","info","value"],["variant","ghost","size","s",3,"click"],["size","s"],["size","xs",2,"font-family","monospace","white-space","pre-wrap"],[3,"valueChange","label","value"],[2,"height","200px","min-height","120px","text-align","left"],["type","json",3,"contentChanged","content"],["size","xs",2,"opacity","0.7","font-style","italic"],["direction","row","wrap","wrap","gap","xs"],[1,"field-chip",3,"title"],[1,"field-chip",3,"click","title"],[1,"field-chip",3,"field-chip--active","title"],["direction","row","wrap","wrap","gap","xs",2,"align-items","center"],[1,"formula-token"],[1,"formula-op"],["direction","row","gap","m"],[2,"display","flex","align-items","center","gap","4px","font-size","0.85rem","cursor","pointer"],["type","checkbox",3,"change","checked"],[2,"height","160px","min-height","80px","text-align","left"]],template:function(a,n){1&a&&(e.j41(0,"cue-table-column-settings-modal",0),e.nI1(1,"transloco"),e.bIt("updateColumn",function(l){return n._onColDefUpdate(l)})("close",function(){return n.close.emit()}),e.j41(2,"cue-flexcontainer",1)(3,"cue-select",2),e.nI1(4,"transloco"),e.bIt("valueChange",function(l){return n.setDefType(l)}),e.k0s(),e.nVh(5,Ze,37,51),e.nVh(6,mt,8,11),e.k0s()()),2&a&&(e.Y8G("columnDef",n.columnDef())("settings",n.agGridSettings)("extraPanelLabel",e.bMT(1,9,"components.sparqlTable.panelLabel")),e.R7$(3),e.Y8G("label",e.bMT(4,11,"components.sparqlTable.labelColumnType"))("value",n._defType())("options",n.columnTypeOptions)("labelMap",n.columnTypeLabelMap()),e.R7$(2),e.vxM("data"===n._defType()?5:-1),e.R7$(),e.vxM("evaluation"===n._defType()?6:-1))},dependencies:[ee.T,O.FlexContainer,V.Typography,_e.Select,me.Input,Z.Button,fe.ButtonIcon,ge.B,he.ButtonLabel,Ge.ButtonPadder,z.Kj],styles:[".field-chip[_ngcontent-%COMP%]{display:inline-block;padding:2px 8px;border-radius:4px;background:var(--cue-surface-2, #eee);font-family:monospace;font-size:.75rem;cursor:pointer;-webkit-user-select:none;user-select:none;transition:background .12s,outline .12s;outline:2px solid transparent}.field-chip[_ngcontent-%COMP%]:hover{background:var(--cue-primary-light, #c8e6c9)}.field-chip--active[_ngcontent-%COMP%]{background:var(--cue-primary, #4caf50);color:#fff;outline-color:var(--cue-primary, #4caf50)}.formula-token[_ngcontent-%COMP%]{display:inline-block;padding:2px 8px;border-radius:4px;background:var(--cue-primary, #4caf50);color:#fff;font-family:monospace;font-size:.75rem}.formula-op[_ngcontent-%COMP%]{font-size:1rem;font-weight:700;opacity:.6;padding:0 2px}"],changeDetection:0})}return i})();var vt=f(5187),bt=f(7717),ne=f(5661),Dt=f(6117),Ct=f(356),Tt=f(6279),St=f(29),Mt=f(5821),Rt=f(5745);const Pt=(i,d)=>d.key;function Et(i,d){if(1&i){const t=e.RV6();e.j41(0,"cue-input",12),e.bIt("valueChange",function(n){s.eBV(t);const o=e.XpG().$implicit,l=e.XpG(2);return s.Njj(l._setVar(o.key,n))}),e.k0s()}if(2&i){const t=e.XpG().$implicit,a=e.XpG(2);e.Y8G("label",t.label)("value",a._varValues()[t.key]??a._filePathPlaceholder())}}function xt(i,d){if(1&i){const t=e.RV6();e.j41(0,"cue-select",13),e.bIt("valueChange",function(n){s.eBV(t);const o=e.XpG().$implicit,l=e.XpG(2);return s.Njj(l._setVar(o.key,n))}),e.k0s()}if(2&i){const t=e.XpG().$implicit,a=e.XpG(2);e.Y8G("label",t.label)("options",a._categoryOptions())("labelMap",a._categoryLabelMap())("value",a._varValues()[t.key]??void 0)("disabled",a._categoriesLoading())("placeholder",a._categoriesLoading()?"Loading\u2026":"Select a category\u2026")}}function Ft(i,d){if(1&i&&e.nVh(0,Et,1,2,"cue-input",10)(1,xt,1,6,"cue-select",11),2&i){const t=d.$implicit;e.vxM("text"===t.type?0:"select"===t.type?1:-1)}}function wt(i,d){1&i&&e.Z7z(0,Ft,2,1,null,null,Pt),2&i&&e.Dyx(d.variables)}function jt(i,d){1&i&&(e.j41(0,"div",6),e.EFF(1),e.nI1(2,"transloco"),e.k0s()),2&i&&(e.R7$(),e.JRh(e.bMT(2,1,d)))}const At=new Q.Parser({sparqlStar:!0}),De=`PREFIX qcy: <${U.E.qcy}>`,ae=[{id:"files-in-directory",label:"Files in a specific directory",template:`${De}\n\nSELECT DISTINCT ?subject\nWHERE {\n ?subject a qcy:FileContent ;\n qcy:hasFileLocation ?fl .\n ?fl qcy:filePath ?path .\n FILTER(STRSTARTS(STR(?path), "\${THE_FILE_PATH}"))\n\n # EXCLUDE DERIVED FILES\n FILTER NOT EXISTS {?x qcy:alternativeRepresentation ?subject}\n}`,variables:[{key:"THE_FILE_PATH",label:"File path",type:"text"}]},{id:"entities-of-category",label:"Entities of a specific category",template:`${De}\n\nSELECT DISTINCT ?subject\nWHERE {\n ?subject a qcy:CanonicalEntity ;\n qcy:hasEntityCategory <\${CATEGORY_IRI}> .\n}`,variables:[{key:"CATEGORY_IRI",label:"Category",type:"select"}]}];let Nt=(()=>{class i{rowDefinitionQuery=(0,g.geq)(null);handlers=(0,g.hFB)(void 0);close=(0,g.CGW)();saved=(0,g.CGW)();_draft=(0,_.uu)(()=>this.rowDefinitionQuery()||H);_selectedPredefinedId=(0,s.vPA)(null);_varValues=(0,s.vPA)({});_categories=(0,s.vPA)([]);_categoriesLoading=(0,s.vPA)(!1);_filePathPlaceholder=(0,s.vPA)("");_selectedPredefined=(0,_.EW)(()=>{const t=this._selectedPredefinedId();return t?ae.find(a=>a.id===t)??null:null});_predefinedOptions=ae.map(t=>t.id);_predefinedLabelMap=Object.fromEntries(ae.map(t=>[t.id,t.label]));_categoryOptions=(0,_.EW)(()=>this._categories().map(t=>t.iri));_categoryLabelMap=(0,_.EW)(()=>Object.fromEntries(this._categories().map(t=>[t.iri,t.label])));_resolvedTemplate=(0,_.EW)(()=>{const t=this._selectedPredefined();if(!t)return null;const a=this._varValues();let n=t.template;for(const o of t.variables)n=n.replaceAll(`\${${o.key}}`,a[o.key]??"");return n});constructor(){(0,s.QZP)(()=>{const t=this._selectedPredefined(),a=this.handlers();this._varValues.set({}),this._categories.set([]),this._filePathPlaceholder.set(""),t?.variables.some(n=>"select"===n.type)&&this._loadCategories(a),t?.variables.some(n=>"THE_FILE_PATH"===n.key)&&this._loadFilePathPlaceholder(a)}),(0,s.QZP)(()=>{const t=this._resolvedTemplate();null!==t&&this._draft.set(t)})}_loadCategories(t){var a=this;return(0,C.A)(function*(){const n=t?.contentCategoriesInProject;if(n){a._categoriesLoading.set(!0);try{const o=yield n();a._categories.set(o)}catch(o){console.error("[RowDefModal] _loadCategories \u2014 error:",o)}finally{a._categoriesLoading.set(!1)}}})()}_loadFilePathPlaceholder(t){var a=this;return(0,C.A)(function*(){const n=t?.randomFilePath;if(!n)return;const o=yield n();if(o){const l=o.replace(/\/?[^\/]*$/,"/");a._filePathPlaceholder.set(l),a._setVar("THE_FILE_PATH",l)}})()}_onPredefinedChange(t){this._selectedPredefinedId.set(null!=t?String(t):null)}_setVar(t,a){null!=a&&this._varValues.update(n=>({...n,[t]:String(a)}))}_validationError=(0,_.EW)(()=>{const t=this._draft().trim();if(!t)return null;try{const a=At.parse(t);if("SELECT"!==a?.queryType)return"components.sparqlTable.rowDefinitionErrorNotSelect";if(!a.variables.filter(l=>"*"!==l).map(l=>l?.value??l?.variable?.value??"").includes("subject"))return"components.sparqlTable.rowDefinitionErrorMissingSubject"}catch{return"components.sparqlTable.rowDefinitionErrorSyntax"}return null});_isSaveDisabled=(0,_.EW)(()=>!!this._draft().trim()&&!!this._validationError());_save(){this._draft()&&this._validationError()||(this.rowDefinitionQuery.set(this._draft()),this.saved.emit(),this.close.emit())}static \u0275fac=function(a){return new(a||i)};static \u0275cmp=e.VBU({type:i,selectors:[["cue-sparql-row-definition-modal"]],inputs:{rowDefinitionQuery:[1,"rowDefinitionQuery"],handlers:[1,"handlers"]},outputs:{rowDefinitionQuery:"rowDefinitionQueryChange",close:"close",saved:"saved"},decls:20,vars:20,consts:[[3,"close","label","minWidth"],["direction","column","gap","m",2,"padding","4px 0"],["size","s","color","secondary"],["label","Predefined query","placeholder","Custom query\u2026",3,"valueChange","options","labelMap","value"],[2,"height","200px","display","flex","flex-direction","column"],["type","sparql",2,"flex","1",3,"contentChange","content"],[1,"row-def-error"],["direction","row","gap","s","justify","end"],["variant","tertiary","size","s",3,"click"],["variant","primary","size","s",3,"click","disabled"],[3,"label","value"],[3,"label","options","labelMap","value","disabled","placeholder"],[3,"valueChange","label","value"],[3,"valueChange","label","options","labelMap","value","disabled","placeholder"]],template:function(a,n){if(1&a&&(e.j41(0,"cue-modal",0),e.nI1(1,"transloco"),e.bIt("close",function(){return n.close.emit()}),e.j41(2,"cue-flexcontainer",1)(3,"cue-typography",2),e.EFF(4),e.nI1(5,"transloco"),e.k0s(),e.j41(6,"cue-select",3),e.bIt("valueChange",function(l){return n._onPredefinedChange(l)}),e.k0s(),e.nVh(7,wt,2,0),e.j41(8,"div",4)(9,"cue-code-editor",5),e.bIt("contentChange",function(l){return n._draft.set(l)}),e.k0s()(),e.nVh(10,jt,3,3,"div",6),e.j41(11,"cue-flexcontainer",7)(12,"cue-button",8),e.bIt("click",function(){return n.close.emit()}),e.j41(13,"cue-button-label"),e.EFF(14),e.nI1(15,"transloco"),e.k0s()(),e.j41(16,"cue-button",9),e.bIt("click",function(){return n._save()}),e.j41(17,"cue-button-label"),e.EFF(18),e.nI1(19,"transloco"),e.k0s()()()()()),2&a){let o,l;e.Y8G("label",e.bMT(1,12,"components.sparqlTable.rowDefinitionModalTitle"))("minWidth","620px"),e.R7$(4),e.SpI(" ",e.bMT(5,14,"components.sparqlTable.rowDefinitionModalDescription")," "),e.R7$(2),e.Y8G("options",n._predefinedOptions)("labelMap",n._predefinedLabelMap)("value",n._selectedPredefinedId()??void 0),e.R7$(),e.vxM((o=n._selectedPredefined())?7:-1,o),e.R7$(2),e.Y8G("content",n._draft()),e.R7$(),e.vxM((l=n._draft()&&n._validationError())?10:-1,l),e.R7$(4),e.SpI(" ",e.bMT(15,16,"components.sparqlTable.rowDefinitionDiscard")," "),e.R7$(2),e.Y8G("disabled",n._isSaveDisabled()),e.R7$(2),e.SpI(" ",e.bMT(19,18,"components.sparqlTable.rowDefinitionSave")," ")}},dependencies:[Rt.a,O.FlexContainer,V.Typography,Z.Button,he.ButtonLabel,ge.B,_e.Select,me.Input,z.Kj],styles:[".row-def-error[_ngcontent-%COMP%]{color:var(--cue-color-error, #ef4444);font-size:12px;padding:2px 0}"],changeDetection:0})}return i})();var It=f(7284);function kt(i,d){if(1&i&&(e.j41(0,"div",13),e.nrm(1,"span",26),e.EFF(2),e.k0s()),2&i){const t=d;e.R7$(2),e.Lme(" ",t.done," / ",t.total," queries ")}}function Lt(i,d){1&i&&(e.j41(0,"div",13),e.nrm(1,"span",26),e.EFF(2," Building table for download\u2026 "),e.k0s())}function qt(i,d){if(1&i){const t=e.RV6();e.j41(0,"div",27),e.bIt("click",function(){s.eBV(t);const n=e.XpG();return s.Njj(n._openRowDefModal())}),e.j41(1,"cue-typography",28),e.EFF(2),e.nI1(3,"transloco"),e.k0s()()}2&i&&(e.R7$(2),e.SpI(" ",e.bMT(3,1,"components.sparqlTable.rowDefinitionEmpty")," "))}function Gt(i,d){if(1&i){const t=e.RV6();e.j41(0,"cue-paginator",29),e.bIt("currentPage",function(n){s.eBV(t);const o=e.XpG();return s.Njj(o._onPaginateEvent(n))}),e.k0s()}if(2&i){const t=e.XpG();e.Y8G("size",t._totalKeys())("pageSize",t.pageSize())}}function Vt(i,d){if(1&i){const t=e.RV6();e.j41(0,"cue-button",30),e.bIt("click",function(){const n=s.eBV(t),o=n.$implicit,l=n.index,u=e.XpG();return s.Njj(u._openSettings(o,l))}),e.nrm(1,"cue-button-icon",11),e.k0s(),e.j41(2,"cue-button",31),e.bIt("click",function(){const n=s.eBV(t).$implicit,o=e.XpG();return s.Njj(o._deleteColumn(n.field))}),e.nrm(3,"cue-button-icon",32),e.k0s()}}function Ot(i,d){if(1&i){const t=e.RV6();e.j41(0,"div",33),e.bIt("click",function(){s.eBV(t);const n=e.XpG();return s.Njj(n._addColumn())}),e.nrm(1,"cue-button-icon",34),e.k0s()}}function Qt(i,d){if(1&i){const t=e.RV6();e.j41(0,"cue-declarative-sparql-column-settings-modal",35),e.mxI("columnDefChange",function(n){const o=s.eBV(t);return e.DH7(o.col,n)||(o.col=n),s.Njj(n)}),e.bIt("close",function(){s.eBV(t);const n=e.XpG();return s.Njj(n._activeColumn.set(void 0))})("updateColumnDef",function(n){const o=s.eBV(t),l=e.XpG();return s.Njj(l._applyColumnUpdate(o.index,n))}),e.k0s()}if(2&i){const t=e.XpG();e.R50("columnDef",d.col),e.Y8G("handlers",t.handlers())("columns",t.columns())}}function $t(i,d){if(1&i){const t=e.RV6();e.j41(0,"cue-sparql-row-definition-modal",36),e.mxI("rowDefinitionQueryChange",function(n){s.eBV(t);const o=e.XpG();return e.DH7(o.rowDefinition,n)||(o.rowDefinition=n),s.Njj(n)}),e.bIt("saved",function(){s.eBV(t);const n=e.XpG();return s.Njj(n._onRowDefSaved())})("close",function(){s.eBV(t);const n=e.XpG();return s.Njj(n._showRowDefModal.set(!1))}),e.k0s()}if(2&i){const t=e.XpG();e.R50("rowDefinitionQuery",t.rowDefinition),e.Y8G("handlers",t.rowDefinitionHandlers())}}const Bt=new Q.Parser({sparqlStar:!0}),zt=new Q.Generator;function K(i,d){return oe.apply(this,arguments)}function oe(){return oe=(0,C.A)(function*(i,d){const t=new Array(i.length);let a=0;function o(){return(o=(0,C.A)(function*(){for(;a<i.length;){const u=a++;t[u]=yield i[u]()}})).apply(this,arguments)}const l=Array.from({length:Math.min(d,i.length)},()=>function n(){return o.apply(this,arguments)}());return yield Promise.all(l),t}),oe.apply(this,arguments)}function ie(i,d){if(d.length>200)return i;try{const t=Bt.parse(i),a={type:"values",values:d.map(n=>({"?subject":{termType:"NamedNode",value:n}}))};return Array.isArray(t.where)&&(t.where=[a,...t.where]),zt.stringify(t)}catch{const t=`VALUES ?subject { ${d.map(a=>`<${a}>`).join(" ")} }`;return i.replace(/WHERE\s*\{/i,`WHERE {\n ${t}`)}}let Kt=(()=>{class i{visibleRows=(0,g.CGW)();columnDefsAG=(0,g.CGW)();columns=g.geq.required();handlers=g.hFB.required();rowDefinitionHandlers=(0,g.hFB)(void 0);rowDefinition=(0,g.geq)(H);pageSize=(0,g.hFB)(10);size=(0,g.hFB)("m");bufferFactor=(0,g.hFB)(5);_bufferSize=(0,_.EW)(()=>this.pageSize()*this.bufferFactor());_noRowDef=(0,_.EW)(()=>null!==this.rowDefinition()&&!this.rowDefinition()&&!this._showSettings());_showSettings=(0,s.vPA)(!1);_activeColumn=(0,s.vPA)(void 0);_showRowDefModal=(0,s.vPA)(!1);_dataFetchService=(0,s.WQX)(B);_tableService=(0,s.WQX)(J);_allKeys=(0,s.vPA)([]);_totalKeys=(0,_.EW)(()=>this._allKeys().length);_bufferKeys=(0,s.vPA)([]);_bufferOffset=(0,s.vPA)(0);_rowDefLoading=(0,s.vPA)(!1);_rowDefError=(0,s.vPA)("");_gridApi=null;_fullDataMode=(0,s.vPA)(!1);_fetchingFullData=(0,s.vPA)(!1);_fullDataFetchVersion=0;_exporting=(0,s.vPA)(!1);_prefetchCache=new Map;_currentlyPrefetching=new Set;_displayColumns=(0,_.EW)(()=>{const t=this._bufferKeys();return null===this.rowDefinition()||t.length?this._patchColumns(this.columns(),t):[]});_queryProgress=(0,_.EW)(()=>{const t=!!this.rowDefinition(),a=t?1:0;if(this._fetchingFullData()){const p=this._dataFetchService.totalQueryCount(),c=a+Math.max(p,1);return 0===c?null:{done:0,total:c}}const n=t&&!this._rowDefLoading()&&this._allKeys().length>0?1:0,o=this._dataFetchService.totalQueryCount(),u=n+this._dataFetchService.fetchedColumns().length,r=a+o;return 0===r||u>=r?null:{done:u,total:r}});_handlers=(0,_.EW)(()=>({queryHandler:this.handlers().queryHandler}));constructor(){(0,s.QZP)(()=>{const t=this.rowDefinition(),a=this.handlers();t&&a&&this._fetchRowDef(t,a)})}_openRowDefModal(){this._showRowDefModal.set(!0)}_onGridApi(t){this._gridApi=t,null!==this.rowDefinition()&&(t.addEventListener("sortChanged",()=>this._checkSortFilterState(t)),t.addEventListener("filterChanged",()=>this._checkSortFilterState(t)))}_checkSortFilterState(t){if(!this.rowDefinition())return;const a=t.getColumnState().some(l=>null!=l.sort),n=Object.keys(t.getFilterModel()??{}).length>0,o=a||n;!o||this._fullDataMode()||this._fetchingFullData()?o&&this._fullDataMode()?this._fillVisibleRows():!o&&(this._fullDataMode()||this._fetchingFullData())&&this._exitFullDataMode():this._enterFullDataMode()}_fillingVisibleRows=!1;_fillVisibleRows(){var t=this;return(0,C.A)(function*(){if(!t._fillingVisibleRows&&t._gridApi){t._fillingVisibleRows=!0;try{const a=t._gridApi.paginationGetPageSize?.()??t.pageSize(),o=(t._gridApi.paginationGetCurrentPage?.()??0)*a,l=[];for(let p=o;p<o+a;p++){const c=t._gridApi.getDisplayedRowAtIndex(p);if(!c?.data?.id)break;l.push(c.data.id)}if(!l.length)return;const u=t.columns().filter(p=>"data"===p.defType&&p.query&&!p.hide),r=t._dataFetchService.keyVals;yield K(u.map(p=>(0,C.A)(function*(){const c=l.filter(h=>void 0===r[h]?.[p.field]);if(!c.length)return;const m=ie(p.query,c);try{const h=yield t.handlers().queryHandler(m,(0,k.t)(m)),y={};h.results.bindings.forEach(T=>{const v=T.subject?.value;if(!v)return;y[v]||(y[v]=[]);const R={};Object.keys(T).filter(M=>"subject"!==M).forEach(M=>{R[M]=T[M]?.value}),y[v].push(R)}),t._dataFetchService.mergeColumnData(p.field,y,p.query)}catch{}})),3)}finally{t._fillingVisibleRows=!1}}})()}_onPaginateEvent(t){const a=t.startIndex,n=this._bufferSize(),o=Math.floor(a/n)*n;this._loadBuffer(o);const l=Math.floor((a-o)/this.pageSize());if(this._gridApi)try{this._gridApi.paginationGoToPage(l)}catch{}if(l>=Math.ceil(n/this.pageSize())-1){const r=o+n;r<this._allKeys().length&&this._prefetchBuffer(r)}}_fetchRowDef(t,a){var n=this;return(0,C.A)(function*(){n._rowDefLoading.set(!0),n._rowDefError.set(""),n._dataFetchService.emptyTableText.set("Loading\u2026"),n._allKeys.set([]),n._bufferKeys.set([]),n._bufferOffset.set(0),n._prefetchCache.clear(),n._currentlyPrefetching.clear();try{const o=(0,k.t)(t),l=yield a.queryHandler(t,o),u=l.results.bindings.map(r=>r.subject?.value).filter(Boolean);console.log("[ROWDEF] _fetchRowDef received",l.results.bindings.length,"bindings,",u.length,"valid keys. meta=",l.meta),n._allKeys.set(u),n._loadBuffer(0)}catch(o){n._rowDefError.set(String(o?.message??o))}finally{n._rowDefLoading.set(!1)}})()}_loadBuffer(t,a=!1){const n=this._allKeys().slice(t,t+this._bufferSize()),o=this._bufferKeys();if(!a&&n.length===o.length&&n.every((u,r)=>u===o[r]))return;const l=this._prefetchCache.get(t);if(this._prefetchCache.delete(t),this._dataFetchService.resetData(),l?this._dataFetchService.injectPreloadedData(l.keyVals,l.fetchedColumnFields,l.columnQueries):this._tableService.destroy(),this._bufferOffset.set(t),this._bufferKeys.set(n),this._gridApi)try{this._gridApi.paginationGoToPage(0)}catch{}}_enterFullDataMode(){var t=this;return(0,C.A)(function*(){if(console.log("[FDM] _enterFullDataMode called. _fetchingFullData=",t._fetchingFullData(),"_fullDataMode=",t._fullDataMode(),"_allKeys=",t._allKeys().length),t._fetchingFullData())return;t._fetchingFullData.set(!0);const a=++t._fullDataFetchVersion;let n;t._gridApi&&(n=t._gridApi.getColumnState().find(r=>null!=r.sort)?.colId,n||(n=Object.keys(t._gridApi.getFilterModel()??{})[0]));const o=n?.replace(/_\d+$/,""),l=o?t.columns().find(u=>u.field===o&&"data"===u.defType&&u.query):void 0;if(!l)return t._fullDataMode.set(!0),void t._fetchingFullData.set(!1);try{if(a!==t._fullDataFetchVersion)return;const u=yield t.handlers().queryHandler(l.query,(0,k.t)(l.query));if(a!==t._fullDataFetchVersion)return;const r={};Object.entries(t._dataFetchService.keyVals).forEach(([v,R])=>{r[v]={...R}});const p=t._allKeys();p.forEach(v=>{r[v]||(r[v]={})}),console.log("[DeclarativeSPARQLTable] keyVals pre-seed: allKeys=",p.length,"keyVals size=",Object.keys(r).length);const c=[...t._dataFetchService.fetchedColumns()],m={...t._dataFetchService._columnQueries},h=[];if(u.results.bindings.forEach(v=>{const R=v.subject?.value;if(!R)return;r[R]||(r[R]={}),r[R][l.field]=[];const M={};Object.keys(v).filter(D=>"subject"!==D).forEach(D=>{M[D]=v[D]?.value}),r[R][l.field].push(M),h.push(R)}),c.includes(l.field)||c.push(l.field),m[l.field]=l.query,console.log("[FDM] after sort-col fetch: keyVals size=",Object.keys(r).length,"allKeys from sort col=",h.length),console.log("[FDM] calling resetData()"),t._dataFetchService.resetData(),t._tableService.destroy(),console.log("[FDM] calling injectPreloadedData with",Object.keys(r).length,"rows"),t._dataFetchService.injectPreloadedData(r,c,m),console.log("[FDM] injectPreloadedData done. Service keyVals size=",Object.keys(t._dataFetchService.keyVals).length),t._fullDataMode.set(!0),a!==t._fullDataFetchVersion)return;const y=t.columns().filter(v=>"data"===v.defType&&v.query&&v.field!==l.field&&!v.hide),T=new Set(t._bufferKeys());yield K(y.map(v=>(0,C.A)(function*(){const R=h.filter(D=>T.has(D)&&void 0===r[D]?.[v.field]);if(!R.length||a!==t._fullDataFetchVersion)return;const M=ie(v.query,R);try{const D=yield t.handlers().queryHandler(M,(0,k.t)(M));if(a!==t._fullDataFetchVersion)return;const b={};D.results.bindings.forEach(P=>{const x=P.subject?.value;if(!x)return;b[x]||(b[x]=[]);const $={};Object.keys(P).filter(L=>"subject"!==L).forEach(L=>{$[L]=P[L]?.value}),b[x].push($)}),Object.entries(b).forEach(([P,x])=>{r[P]&&(r[P][v.field]=x)}),t._dataFetchService.mergeColumnData(v.field,b,v.query)}catch{}})),3)}catch(u){console.error("[DeclarativeSPARQLTable] Error in _enterFullDataMode:",u)}finally{a===t._fullDataFetchVersion&&t._fetchingFullData.set(!1)}})()}_exitFullDataMode(){if(console.log("[FDM] _exitFullDataMode called"),this._fullDataFetchVersion++,this._fetchingFullData.set(!1),this._fullDataMode.set(!1),this._dataFetchService.resetData(),this._tableService.destroy(),this._loadBuffer(this._bufferOffset(),!0),this._gridApi)try{this._gridApi.paginationGoToPage(0)}catch{}}_prefetchBuffer(t){var a=this;return(0,C.A)(function*(){if(a._prefetchCache.has(t)||a._currentlyPrefetching.has(t))return;const n=a._allKeys().slice(t,t+a._bufferSize());if(!n.length)return;a._currentlyPrefetching.add(t);const l=a._patchColumns(a.columns(),n).filter(c=>"data"===c.defType&&!c.hide&&c.query),u={},r=[],p={};try{yield K(l.map(c=>(0,C.A)(function*(){try{(yield a.handlers().queryHandler(c.query,(0,k.t)(c.query))).results.bindings.forEach(h=>{const y=h.subject?.value;if(!y)return;u[y]||(u[y]={}),u[y][c.field]||(u[y][c.field]=[]);const T={};Object.keys(h).filter(v=>"subject"!==v).forEach(v=>{T[v]=h[v]?.value}),u[y][c.field].push(T)}),r.push(c.field),p[c.field]=c.query}catch{}})),3),a._prefetchCache.set(t,{keyVals:u,fetchedColumnFields:r,columnQueries:p})}finally{a._currentlyPrefetching.delete(t)}})()}_patchColumns(t,a){return a.length?t.map(n=>n.query&&"data"===n.defType?{...n,query:ie(n.query,a)}:n):t}_columnSelectSettings=Object.assign(new ee.e,{allowEditing:!1});_shownColumns=(0,_.EW)(()=>this.columns().filter(t=>!t.hide));_openSettings(t,a){const n=this.columns().findIndex(o=>o.field===t.field);this._activeColumn.set({col:{...t},index:n})}_onShownChanged(t){const a=new Set(t.map(u=>u.field)),n=this.columns(),o=t.map(u=>({...n.find(p=>p.field===u.field)??u,hide:!1})),l=n.filter(u=>!a.has(u.field)).map(u=>({...u,hide:!0}));this.columns.set([...o,...l])}_applyColumnUpdate(t,a){const n=this.columns().map((o,l)=>l===t?Object.assign(Object.create(Object.getPrototypeOf(o)),o,a):o);this.columns.set(n)}_addColumn(){const t=this.columns();let a;if(t.length>0)a=t[t.length-1];else{const l=this.rowDefinition();a=Object.assign(new re,{query:l?this._seedQueryFromRowDef(l):"",strategy:{type:"first"}})}const n=Object.assign(Object.create(Object.getPrototypeOf(a)),a,{field:`column_${Date.now()}`,headerName:`${a.headerName??a.field??"Column"} Copy`,hide:!1}),o=t.length;this.columns.update(l=>[...l,n]),this._activeColumn.set({col:{...n},index:o})}_deleteColumn(t){this.columns.update(a=>a.filter(n=>n.field!==t))}_onRowDefSaved(){if(this.columns().length>0)return;this._showSettings.set(!0);const t=this.rowDefinition(),a=t?this._seedQueryFromRowDef(t):"",n=Object.assign(new re,{field:`column_${Date.now()}`,headerName:"Column 1",query:a,strategy:{type:"first"}});this.columns.set([n]),this._activeColumn.set({col:{...n},index:0})}_seedQueryFromRowDef(t){try{if(/qcy:FileContent\b/.test(t)){let n=t.replace(/SELECT\s+(?:DISTINCT\s+)?\?subject\b/i,"SELECT ?subject ?value");n=n.replace(/\s*ORDER\s+BY\s+[^\n{}]*/gi,""),/PREFIX\s+skos:/i.test(n)||(n=`PREFIX skos: <${Te.B.skos}>\n`+n);const o=n.lastIndexOf("}");return-1!==o&&(n=n.slice(0,o)+" ?subject qcy:hasContentCategory ?cat .\n ?cat skos:prefLabel ?value .\n}"),n.trim()}{let n=t.replace(/SELECT\s+(?:DISTINCT\s+)?\?subject\b/i,"SELECT ?subject ?val");n=n.replace(/\s*ORDER\s+BY\s+[^\n{}]*/gi,"");const o=n.lastIndexOf("}");return-1!==o&&(n=n.slice(0,o)+" ?subject qcy:value ?val .\n}"),n.trim()}}catch{return t}}_getFormattedData(t=!1,a){const n=t?this.columns().filter(c=>"data"===c.defType&&c.query).map(c=>this._dataFetchService.columnDefsAG().find(h=>h.colId===c.field||h.field===c.field)??{colId:c.field,headerName:c.headerName??c.field,cellRendererParams:{strategy:c.strategy,postProcess:c.postProcess}}):this._dataFetchService.columnDefsAG().filter(c=>!c.hide),o=this._allKeys(),l=a?(o.length>0?o:Object.keys(a)).map(c=>({id:c,...a[c]??{}})):this._tableService.tableData(),u=["Key",...n.map(c=>c.headerName??c.field??"")],r=["",...n.map(c=>{const m=c.cellStyle;return m&&"object"==typeof m?String(m.textAlign??m["text-align"]??"").toLowerCase():""})];return{headers:u,rows:l.map(c=>[String(c.id??""),...n.map(m=>{const h=m.colId??m.field??"",y=m.valueGetter;let T="function"==typeof y?y({data:c,colDef:m}):c[h];if(void 0===T&&a&&(T=(a[c.id]??{})[h]??[]),Array.isArray(T)){const v=m.cellRendererParams?.strategy,R=m.cellRendererParams?.postProcess,M=v?F(T,v,""):T.map(D=>D?.val??"").filter(Boolean).join(", ");return(0,E.g4)(M,R)}return String(T??"")})]),alignments:r}}_fetchAllColumnsForExport(t){var a=this;return(0,C.A)(function*(){const n=a._allKeys();console.log("[EXPORT] _fetchAllColumnsForExport called for",t.length,"columns. allKeys=",n.length);const o=t.filter(r=>"data"===r.defType&&r.query);if(!o.length)return{};const l=n.length?a._patchColumns(o,n):o,u={};return yield K(l.map(r=>(0,C.A)(function*(){try{(yield a.handlers().queryHandler(r.query,(0,k.t)(r.query))).results.bindings.forEach(c=>{const m=c.subject?.value;if(!m)return;u[m]||(u[m]={}),u[m][r.field]||(u[m][r.field]=[]);const h={};Object.keys(c).filter(y=>"subject"!==y).forEach(y=>{h[y]=c[y]?.value}),u[m][r.field].push(h)})}catch{}})),3),u})()}_downloadCsv(){var t=this;return(0,C.A)(function*(a=!1){if(!t._exporting()){t._exporting.set(!0);try{const n=a?t.columns():t.columns().filter(c=>!c.hide),o=yield t._fetchAllColumnsForExport(n),{headers:l,rows:u}=t._getFormattedData(a,o),r=It.unparse([l,...u]),p=new Blob([r],{type:"text/csv;charset=utf-8;"});t._triggerDownload(p,"export.csv")}finally{t._exporting.set(!1)}}}).apply(this,arguments)}_downloadXlsx(){var t=this;return(0,C.A)(function*(a=!1){if(!t._exporting()){t._exporting.set(!0);try{const n=a?t.columns():t.columns().filter(c=>!c.hide),o=yield t._fetchAllColumnsForExport(n),{headers:l,rows:u,alignments:r}=t._getFormattedData(a,o),p=yield t._buildStyledXlsxBlob(l,u,r);t._triggerDownload(p,"export.xlsx")}finally{t._exporting.set(!1)}}}).apply(this,arguments)}_buildStyledXlsxBlob(t,a,n){return(0,C.A)(function*(){const u=(D,b)=>D?"center"===b?2:"right"===b?3:1:"center"===b?4:"right"===b?5:0,r=(D,b,P,x)=>{const $=`${(D=>{let b="",P=D+1;for(;P>0;)b=String.fromCharCode(65+(P-1)%26)+b,P=Math.floor((P-1)/26);return b})(D)}${b}`,L=x>0?` s="${x}"`:"",le=Number(P);return 0===x&&""!==P&&!isNaN(le)&&isFinite(le)?`<c r="${$}"${L}><v>${le}</v></c>`:`<c r="${$}"${L} t="inlineStr"><is><t>${(D=>D.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"))(P)}</t></is></c>`},p=[];p.push(`<row r="1">${t.map((D,b)=>r(b,1,D,u(!0,n[b]??""))).join("")}</row>`),a.forEach((D,b)=>{p.push(`<row r="${b+2}">${D.map((P,x)=>r(x,b+2,P,u(!1,n[x]??""))).join("")}</row>`)});const c=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">\n <cols><col min="1" max="1" hidden="1"/></cols>\n <sheetData>${p.join("")}</sheetData>\n</worksheet>`,M=new(0,(yield f.e(7247).then(f.t.bind(f,7247,23))).default);return M.file("[Content_Types].xml",'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">\n <Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>\n <Default Extension="xml" ContentType="application/xml"/>\n <Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/>\n <Override PartName="/xl/worksheets/sheet1.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>\n <Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"/>\n</Types>'),M.file("_rels/.rels",'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">\n <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/>\n</Relationships>'),M.file("xl/workbook.xml",'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">\n <sheets><sheet name="Data" sheetId="1" r:id="rId1"/></sheets>\n</workbook>'),M.file("xl/_rels/workbook.xml.rels",'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">\n <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet1.xml"/>\n <Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/>\n</Relationships>'),M.file("xl/worksheets/sheet1.xml",c),M.file("xl/styles.xml",'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">\n <fonts count="2">\n <font><sz val="11"/><name val="Calibri"/></font>\n <font><b/><color rgb="FFFFFFFF"/><sz val="11"/><name val="Poppins"/></font>\n </fonts>\n <fills count="3">\n <fill><patternFill patternType="none"/></fill>\n <fill><patternFill patternType="gray125"/></fill>\n <fill><patternFill patternType="solid"><fgColor rgb="FF2859E1"/><bgColor indexed="64"/></patternFill></fill>\n </fills>\n <borders count="1">\n <border><left/><right/><top/><bottom/><diagonal/></border>\n </borders>\n <cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs>\n <cellXfs count="6">\n <xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/>\n <xf numFmtId="0" fontId="1" fillId="2" borderId="0" xfId="0" applyFont="1" applyFill="1"/>\n <xf numFmtId="0" fontId="1" fillId="2" borderId="0" xfId="0" applyFont="1" applyFill="1" applyAlignment="1"><alignment horizontal="center"/></xf>\n <xf numFmtId="0" fontId="1" fillId="2" borderId="0" xfId="0" applyFont="1" applyFill="1" applyAlignment="1"><alignment horizontal="right"/></xf>\n <xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0" applyAlignment="1"><alignment horizontal="center"/></xf>\n <xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0" applyAlignment="1"><alignment horizontal="right"/></xf>\n </cellXfs>\n</styleSheet>'),M.generateAsync({type:"blob",mimeType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"})})()}_triggerDownload(t,a){const n=URL.createObjectURL(t),o=document.createElement("a");o.href=n,o.download=a,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(n)}static \u0275fac=function(a){return new(a||i)};static \u0275cmp=e.VBU({type:i,selectors:[["cue-declarative-sparql-table"]],inputs:{columns:[1,"columns"],handlers:[1,"handlers"],rowDefinitionHandlers:[1,"rowDefinitionHandlers"],rowDefinition:[1,"rowDefinition"],pageSize:[1,"pageSize"],size:[1,"size"],bufferFactor:[1,"bufferFactor"]},outputs:{visibleRows:"visibleRows",columnDefsAG:"columnDefsAG",columns:"columnsChange",rowDefinition:"rowDefinitionChange"},features:[e.Jv_([B,J])],decls:39,vars:27,consts:[[1,"flip-card",3,"cueFlipChange","cueFlip"],[1,"flip-content"],[1,"card-face","front"],["direction","row","justify","end",2,"padding","2px"],["positioning","bottomleft"],["trigger","","variant","tertiary","size","s","cueTooltip","Export",3,"disabled"],["icon","more-vert"],["menu",""],[3,"click","disabled"],["before","","name","download"],["variant","accent","size","s","cueTooltip","Column settings",3,"click"],["icon","settings"],[3,"gridApi","visibleRows","columnDefsAG","handlers","columns","showPaginator","paginationPageSize","size","loading"],[1,"query-status"],[1,"row-def-empty"],[3,"size","pageSize"],[1,"card-face","back",2,"min-height","var(--cue-table-m-height)",3,"maxHeight"],["variant","tertiary","size","s",3,"click","cueTooltip"],["icon","filter"],["variant","accent","size","s","cueTooltip","Back to table",3,"click"],["icon","arrow-back"],[3,"shown","columnDefs","columnDefsGross","settings"],["cueColumnItem",""],["cueColumnListFooter",""],[3,"columnDef","handlers","columns"],[3,"rowDefinitionQuery","handlers"],[1,"query-status-spinner"],[1,"row-def-empty",3,"click"],["size","s","color","muted"],[3,"currentPage","size","pageSize"],["variant","tertiary","size","s","cueTooltip","Edit column",3,"click"],["variant","tertiary","size","s","cueTooltip","Delete column",3,"click"],["icon","delete"],["cueTooltip","Add column definition",1,"add-column-row",3,"click"],["icon","add"],[3,"columnDefChange","close","updateColumnDef","columnDef","handlers","columns"],[3,"rowDefinitionQueryChange","saved","close","rowDefinitionQuery","handlers"]],template:function(a,n){if(1&a&&(e.j41(0,"div",0),e.mxI("cueFlipChange",function(l){return e.DH7(n._showSettings,l)||(n._showSettings=l),l}),e.j41(1,"div",1)(2,"cue-card",2)(3,"cue-flexcontainer",3)(4,"cue-menu",4)(5,"cue-button",5),e.nrm(6,"cue-button-icon",6),e.k0s(),e.j41(7,"cue-menu-wrap",7)(8,"cue-menu-item",8),e.bIt("click",function(){return n._downloadCsv()}),e.nrm(9,"cue-svg-icon",9),e.EFF(10," Download CSV "),e.k0s(),e.j41(11,"cue-menu-item",8),e.bIt("click",function(){return n._downloadCsv(!0)}),e.nrm(12,"cue-svg-icon",9),e.EFF(13," Download CSV (incl. hidden columns) "),e.k0s(),e.j41(14,"cue-menu-item",8),e.bIt("click",function(){return n._downloadXlsx()}),e.nrm(15,"cue-svg-icon",9),e.EFF(16," Download XLSX "),e.k0s(),e.j41(17,"cue-menu-item",8),e.bIt("click",function(){return n._downloadXlsx(!0)}),e.nrm(18,"cue-svg-icon",9),e.EFF(19," Download XLSX (incl. hidden columns) "),e.k0s()()(),e.j41(20,"cue-button",10),e.bIt("click",function(){return n._showSettings.set(!0)}),e.nrm(21,"cue-button-icon",11),e.k0s()(),e.j41(22,"cue-sparql-table-inner",12),e.bIt("gridApi",function(l){return n._onGridApi(l)})("visibleRows",function(l){return n.visibleRows.emit(l)})("columnDefsAG",function(l){return n.columnDefsAG.emit(l)}),e.k0s(),e.nVh(23,kt,3,2,"div",13),e.nVh(24,Lt,3,0,"div",13),e.nVh(25,qt,4,3,"div",14),e.nVh(26,Gt,1,2,"cue-paginator",15),e.k0s(),e.j41(27,"cue-card",16)(28,"cue-flexcontainer",3)(29,"cue-button",17),e.nI1(30,"transloco"),e.bIt("click",function(){return n._openRowDefModal()}),e.nrm(31,"cue-button-icon",18),e.k0s(),e.j41(32,"cue-button",19),e.bIt("click",function(){return n._showSettings.set(!1)}),e.nrm(33,"cue-button-icon",20),e.k0s()(),e.j41(34,"cue-ag-grid-column-select",21),e.bIt("shown",function(l){return n._onShownChanged(l)}),e.DNE(35,Vt,4,0,"ng-template",22)(36,Ot,2,0,"ng-template",23),e.k0s()()()(),e.nVh(37,Qt,1,3,"cue-declarative-sparql-column-settings-modal",24),e.nVh(38,$t,1,2,"cue-sparql-row-definition-modal",25)),2&a){let o,l;e.R50("cueFlip",n._showSettings),e.R7$(5),e.Y8G("disabled",n._exporting()),e.R7$(3),e.Y8G("disabled",n._exporting()),e.R7$(3),e.Y8G("disabled",n._exporting()),e.R7$(3),e.Y8G("disabled",n._exporting()),e.R7$(3),e.Y8G("disabled",n._exporting()),e.R7$(5),e.AVh("hidden",n._showSettings()||n._noRowDef()),e.Y8G("handlers",n._handlers())("columns",n._displayColumns())("showPaginator",n._fullDataMode())("paginationPageSize",n.pageSize())("size",n.size())("loading",n._rowDefLoading()),e.R7$(),e.vxM((o=n._queryProgress())?23:-1,o),e.R7$(),e.vxM(n._exporting()?24:-1),e.R7$(),e.vxM(n._noRowDef()?25:-1),e.R7$(),e.vxM(n.rowDefinition()&&!n._fullDataMode()?26:-1),e.R7$(),e.Y8G("maxHeight","var(--cue-table-m-height)"),e.R7$(2),e.Y8G("cueTooltip",e.bMT(30,25,"components.sparqlTable.rowDefinitionTooltip")),e.R7$(5),e.Y8G("columnDefs",n._shownColumns())("columnDefsGross",n.columns())("settings",n._columnSelectSettings),e.R7$(3),e.vxM((l=n._activeColumn())?37:-1,l),e.R7$(),e.vxM(n._showRowDefModal()?38:-1)}},dependencies:[Le,yt,Nt,ne.pL,ne.pC,ne.rx,vt.Card,O.FlexContainer,V.Typography,Z.Button,fe.ButtonIcon,bt.R,ue.d,Dt.W,Ct.M,Tt.D,St.A,Mt.m,z.Kj],styles:[".flip-card[_ngcontent-%COMP%]{width:100%}.flip-content[_ngcontent-%COMP%]{position:relative;width:100%}.card-face[_ngcontent-%COMP%]{width:100%}.hidden[_ngcontent-%COMP%]{display:none}.row-def-empty[_ngcontent-%COMP%]{flex:1;min-height:160px;display:flex;align-items:center;justify-content:center;padding:32px 16px;border:2px dashed var(--cue-color-border, #d1d5db);border-radius:8px;cursor:pointer;margin-top:8px;transition:border-color .15s}.row-def-empty[_ngcontent-%COMP%]:hover{border-color:var(--cue-color-accent, #4f46e5)}.query-status[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;padding:6px 10px;font-size:12px;color:var(--cue-color-text-muted, #6b7280);background:var(--cue-color-surface-subtle, #f9fafb);border:1px solid var(--cue-color-border, #e5e7eb);border-radius:6px;margin-top:6px}@keyframes _ngcontent-%COMP%_spin{to{transform:rotate(360deg)}}.query-status-spinner[_ngcontent-%COMP%]{display:inline-block;width:11px;height:11px;border:2px solid currentColor;border-top-color:transparent;border-radius:50%;animation:_ngcontent-%COMP%_spin .7s linear infinite;flex-shrink:0}.add-column-row[_ngcontent-%COMP%]{padding:20px 10px;border-top:solid 1px #ccc;display:flex;align-items:center;justify-content:center;opacity:.4;cursor:pointer;transition:opacity .15s ease}.add-column-row[_ngcontent-%COMP%]:hover{opacity:.75}"],changeDetection:0})}return i})();var Wt=f(7293);function Yt(i,d){if(1&i){const t=e.RV6();e.j41(0,"cue-declarative-sparql-table",3),e.mxI("columnsChange",function(n){s.eBV(t);const o=e.XpG();return e.DH7(o.columns,n)||(o.columns=n),s.Njj(n)})("rowDefinitionChange",function(n){s.eBV(t);const o=e.XpG();return e.DH7(o.rowDefinition,n)||(o.rowDefinition=n),s.Njj(n)}),e.bIt("visibleRows",function(n){s.eBV(t);const o=e.XpG();return s.Njj(o.visibleRows.emit(n))})("columnDefsAG",function(n){s.eBV(t);const o=e.XpG();return s.Njj(o.columnDefsAG.emit(n))}),e.k0s()}if(2&i){const t=e.XpG();e.Y8G("handlers",d)("rowDefinitionHandlers",t._rowDefinitionHandlers()),e.R50("columns",t.columns)("rowDefinition",t.rowDefinition),e.Y8G("pageSize",t.pageSize())("size",t.size())("bufferFactor",t.bufferFactor())}}function Ut(i,d){1&i&&(e.j41(0,"cue-flexcontainer",1)(1,"cue-typography",4),e.EFF(2," No project connected. Pass a sdkState with cue and projectId. "),e.k0s()())}function Ht(i,d){if(1&i&&e.nrm(0,"cue-logo-link",2),2&i){let t;const a=e.XpG();e.Y8G("projectId",null==(t=a.sdkState())?null:t.projectId)}}let Jt=(()=>{class i{sdkState=(0,g.hFB)(void 0);columns=g.geq.required();rowDefinition=(0,g.geq)(H);pageSize=(0,g.hFB)(10,{transform:g.Udg});size=(0,g.hFB)("m");showLogo=(0,g.hFB)(!1,{transform:g.L39});bufferFactor=(0,g.hFB)(5,{transform:g.Udg});visibleRows=(0,g.CGW)();columnDefsAG=(0,g.CGW)();_entities=(0,s.vPA)(void 0);_documents=(0,s.vPA)(void 0);_handlers=(0,_.EW)(()=>{const t=this.sdkState();if(!t)return;const{cue:a,projectId:n,graphType:o="fuseki"}=t;return{queryHandler:l=>a.api.sparql(l,n,o)}});_rowDefinitionHandlers=(0,_.EW)(()=>{const t=this._entities(),a=this._documents();if(t&&a)return{contentCategoriesInProject:()=>t.contentCategoriesInProject(),randomFilePath:()=>a.randomFilePath()}});constructor(){(0,s.QZP)(()=>{const t=this.sdkState();t?.cue&&t?.projectId?(this._entities.set(new q.g8(t.cue.api,t.projectId)),this._documents.set(new q.f$(t.cue.api,t.projectId))):(this._entities.set(void 0),this._documents.set(void 0))})}static \u0275fac=function(a){return new(a||i)};static \u0275cmp=e.VBU({type:i,selectors:[["cue-sparql-table"]],inputs:{sdkState:[1,"sdkState"],columns:[1,"columns"],rowDefinition:[1,"rowDefinition"],pageSize:[1,"pageSize"],size:[1,"size"],showLogo:[1,"showLogo"],bufferFactor:[1,"bufferFactor"]},outputs:{columns:"columnsChange",rowDefinition:"rowDefinitionChange",visibleRows:"visibleRows",columnDefsAG:"columnDefsAG"},decls:3,vars:2,consts:[[3,"handlers","rowDefinitionHandlers","columns","rowDefinition","pageSize","size","bufferFactor"],["direction","column","align","center","justify","center",2,"height","100%","width","100%","padding","8px"],[2,"position","absolute","top","26px","left","26px","z-index","5",3,"projectId"],[3,"columnsChange","rowDefinitionChange","visibleRows","columnDefsAG","handlers","rowDefinitionHandlers","columns","rowDefinition","pageSize","size","bufferFactor"],[2,"color","#9ca3af","font-size","13px"]],template:function(a,n){if(1&a&&(e.nVh(0,Yt,1,7,"cue-declarative-sparql-table",0)(1,Ut,3,0,"cue-flexcontainer",1),e.nVh(2,Ht,1,1,"cue-logo-link",2)),2&a){let o;e.vxM((o=n._handlers())?0:1,o),e.R7$(2),e.vxM(n.showLogo()?2:-1)}},dependencies:[Kt,O.FlexContainer,V.Typography,Wt.x],styles:["[_nghost-%COMP%]{display:block;width:100%;position:relative}"],changeDetection:0})}return i})()},7573(W,I,f){f.d(I,{E:()=>g});const g={qcy:"https://dev.qaecy.com/ont#","qcy-e":"https://dev.qaecy.com/enum#","qcy-f":"https://dev.qaecy.com/functions#",obc:"https://w3id.org/obc#",dicc:"https://w3id.org/digitalconstruction/0.5/Contexts#",dicv:"https://w3id.org/digitalconstruction/0.5/Variables#",dice:"https://w3id.org/digitalconstruction/0.5/Entities#",dicp:"https://w3id.org/digitalconstruction/0.5/Processes#",dica:"https://w3id.org/digitalconstruction/0.5/Agents#",dici:"https://w3id.org/digitalconstruction/0.5/Information#",dicbm:"https://w3id.org/digitalconstruction/0.5/Materials#",dicob:"https://w3id.org/digitalconstruction/0.5/Occupancy#",dicl:"https://w3id.org/digitalconstruction/0.5/Lifecycle#",dices:"https://w3id.org/digitalconstruction/0.5/Energy#",dicu:"https://w3id.org/digitalconstruction/0.5/Units#",diclvl:"https://w3id.org/digitalconstruction/0.5/Levels#",dicstg:"https://w3id.org/digitalconstruction/0.5/Stages#"}}}]);
package/5381.js CHANGED
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkcue_ui=self.webpackChunkcue_ui||[]).push([[5381],{5381(c,g,n){n.d(g,{FlexContainer:()=>u});var e=n(7705),l=n(2271),a=n(5547);const r=["*"];let u=(()=>{class i{style=(0,e.hFB)("");gap=(0,e.hFB)("m");direction=(0,e.hFB)("row");wrap=(0,e.hFB)("nowrap");align=(0,e.hFB)("stretch");justify=(0,e.hFB)("start");noGap=(0,e.hFB)(!1);getStyles=(0,l.EW)(()=>{const s=this.noGap()?"0":`var(--cue-flex-gap-${this.gap()})`;return`\n flex-direction: ${this.direction()};\n flex-wrap: ${this.wrap()};\n align-items: ${this.align()};\n justify-content: ${this.justify()};\n gap: ${s};\n ${this.style()}\n `});static \u0275fac=function(t){return new(t||i)};static \u0275cmp=a.VBU({type:i,selectors:[["cue-flexcontainer"]],hostVars:2,hostBindings:function(t,o){2&t&&a.Aen(o.getStyles())},inputs:{style:[1,"style"],gap:[1,"gap"],direction:[1,"direction"],wrap:[1,"wrap"],align:[1,"align"],justify:[1,"justify"],noGap:[1,"noGap"]},ngContentSelectors:r,decls:1,vars:0,template:function(t,o){1&t&&(a.NAR(),a.SdG(0))},styles:["[_nghost-%COMP%]{display:flex;min-width:0;min-height:0}"]})}return i})()}}]);
1
+ "use strict";(self.webpackChunkcue_ui=self.webpackChunkcue_ui||[]).push([[5381],{5381(c,g,n){n.d(g,{FlexContainer:()=>u});var e=n(7705),l=n(2271),a=n(5547);const r=["*"];let u=(()=>{class i{style=(0,e.hFB)("");gap=(0,e.hFB)("m");direction=(0,e.hFB)("row");wrap=(0,e.hFB)("nowrap");align=(0,e.hFB)("stretch");justify=(0,e.hFB)("start");noGap=(0,e.hFB)(!1);getStyles=(0,l.EW)(()=>{const s=this.noGap()?"0":`var(--cue-flex-gap-${this.gap()})`;return`\n flex-direction: ${this.direction()};\n flex-wrap: ${this.wrap()};\n align-items: ${this.align()};\n justify-content: ${this.justify()};\n gap: ${s};\n ${this.style()}\n `});static \u0275fac=function(t){return new(t||i)};static \u0275cmp=a.VBU({type:i,selectors:[["cue-flexcontainer"]],hostVars:2,hostBindings:function(t,o){2&t&&a.Aen(o.getStyles())},inputs:{style:[1,"style"],gap:[1,"gap"],direction:[1,"direction"],wrap:[1,"wrap"],align:[1,"align"],justify:[1,"justify"],noGap:[1,"noGap"]},ngContentSelectors:r,decls:1,vars:0,template:function(t,o){1&t&&(a.NAR(),a.SdG(0))},styles:["[_nghost-%COMP%]{display:flex;min-width:0;min-height:0;flex-shrink:0}"]})}return i})()}}]);