@qaecy/cue-ui 0.0.66 → 0.0.68
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/1153.js +1 -1
- package/1231.js +1 -0
- package/1320.js +1 -0
- package/179.js +1 -0
- package/1837.js +1 -1
- package/198.js +1 -0
- package/2130.js +1 -1
- package/2317.js +1 -1
- package/2559.js +1 -1
- package/2775.js +1 -1
- package/29.js +1 -1
- package/3.js +1 -0
- package/3036.js +1 -1
- package/3202.js +1 -1
- package/3213.js +1 -1
- package/3614.js +1 -1
- package/3630.js +1 -0
- package/3632.js +7 -0
- package/3786.js +1 -1
- package/4098.js +1 -1
- package/4415.js +1 -1
- package/4660.js +1 -0
- package/469.js +1 -0
- package/5649.js +1 -1
- package/6233.js +1 -1
- package/6423.js +1 -1
- package/6439.js +1 -1
- package/6442.js +1 -0
- package/650.js +1 -1
- package/675.js +1 -0
- package/6751.js +1 -1
- package/6947.js +1 -1
- package/7003.js +1 -0
- package/7108.js +1 -0
- package/7154.js +1 -1
- package/7573.js +1 -0
- package/7719.js +1 -1
- package/7727.js +1 -1
- package/8629.js +1 -0
- package/8647.js +1 -0
- package/9231.js +1 -0
- package/9396.js +1 -1
- package/README.md +20 -0
- package/common.js +1 -1
- package/ifclite-pointcloud-decode.js +1 -0
- package/index.js +1 -1
- package/main.js +1 -1
- package/package.json +3 -1
- package/pdf.worker.min.mjs +21 -0
- package/runtime.js +1 -1
- package/styles.css +1 -1
- package/wasm/ifc-lite_bg.wasm +0 -0
- package/1778.js +0 -1
- package/487.js +0 -1
- package/6780.js +0 -7
- package/7598.js +0 -1
- package/9707.js +0 -1
package/4098.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkcue_ui=self.webpackChunkcue_ui||[]).push([[2014,4098],{2014(B,N,m){m.d(N,{ButtonPadder:()=>C});var g=m(17705),s=m(32271),_=m(35547);const q=["*"];let C=(()=>{class I{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(w){return new(w||I)};static \u0275cmp=_.VBU({type:I,selectors:[["cue-button-padder"]],inputs:{justify:[1,"justify"],size:[1,"size"]},ngContentSelectors:q,decls:2,vars:4,template:function(w,F){1&w&&(_.NAR(),_.rj2(0,"div"),_.SdG(1),_.eux()),2&w&&_.xc7("justify-content",F.justify())("min-width",F.widthStyle())},styles:["div[_ngcontent-%COMP%]{display:flex;align-items:center;min-height:1px}"]})}return I})()},57293(B,N,m){m.d(N,{x:()=>w});var g=m(17705),s=m(85802),_=m(32271),q=m(44613),C=m(77089),I=m(59352),S=m(35547);function E(F,Y){1&F&&S.nrm(0,"cue-logo",4)}let w=(()=>{class F{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||F)};static \u0275cmp=S.VBU({type:F,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,C.d,I.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 F})()},4098(B,N,m){m.d(N,{CueSparqlTable:()=>Jt});var g=m(17705),s=m(85802),_=m(32271),q=m(17579),C=m(10467),I=m(67374),S=m.n(I),E=m(67400);function w(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 f=p[n],h=c[n],y=Number(f),T=Number(h);return isNaN(y)||isNaN(T)?(h??"").localeCompare(f??""):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,f)=>c+f,0)):t}case"avg":{const p=r.map(Number).filter(c=>!isNaN(c));return p.length?String(p.reduce((c,f)=>c+f,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,f)=>S()(f).valueOf()-S()(c).valueOf())[0];case"oldest":return[...r].sort((c,f)=>S()(c).valueOf()-S()(f).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=m(77573);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=>w(t,d,"")}return d=>Array.isArray(d)?d.map(t=>t?.val??"").filter(Boolean).join(", "):String(d??"")}}var Te=m(35401),Se=m(72716),Me=m(30222),k=m(46019);class Pe{queryHandler=(0,C.A)(function*(){throw new Error("No query handler defined")})}var ue=m(77089),e=m(35547);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 we=(()=>{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(f=>f[r]).filter(Boolean);this._allValues.set(p);const c=t.colDef?.cellRendererParams?.postProcess;this._displayValue.set((0,E.g4)(o?w(n,o):p[0]??"",c)),this._tooltip.set(p.map(f=>(0,E.g4)(f,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 z=(()=>{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 f=c.data??{},h={};for(const y of p)if("data"===y.defType){const T=y.getFormatter();h[y.field]=(0,E.g4)(T(f[y.field]??[]),y.postProcess)}return function Fe(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,f=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(f)}}}(r,h,"",f)}})}}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)(w(r,a.strategy,""),a.postProcess),f=(0,E.g4)(w(p,a.strategy,""),a.postProcess);return c.localeCompare(f)},cellRenderer:we,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(f=>"subject"!==f),c={};p.forEach(f=>{const h=u[f]?.value;Object.keys(a.keyVals).includes(r)||(a.keyVals[r]={}),void 0===a.keyVals[r][t.field]&&(a.keyVals[r][t.field]=[]),c[f]=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)(z);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],f={};if(f.id=c,Object.keys(t._dataFetchService.keyVals[c]).forEach(h=>{Object.keys(n).includes(h)||(n[h]=0),f[h]=t._dataFetchService.keyVals[c][h]??[],""!==f[h]&&n[h]++}),l.push(f),!r&&9===p){let h=!0;for(const y of u)if(typeof f[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=m(42245),O=m(35381),Ie=m(19682);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)(z);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=m(89079),X=m(59352),_e=m(70063),me=m(58957),Z=m(85971),fe=m(13319),ge=m(75448),Ge=m(2014),he=m(61485),ee=m(1096),Q=m(56593);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)(X.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,he.B,ge.ButtonLabel,Ge.ButtonPadder,X.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=m(65187),bt=m(97717),Dt=m(86117),Ct=m(90356),Tt=m(66279),St=m(20029),ne=m(65661),Mt=m(55821),Rt=m(55745);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 wt(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 Ft(i,d){1&i&&e.Z7z(0,wt,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,Ft,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,ge.ButtonLabel,he.B,_e.Select,me.Input,X.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=m(90262);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 W(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)(z);_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 W(u.map(p=>(0,C.A)(function*(){const c=l.filter(h=>void 0===r[h]?.[p.field]);if(!c.length)return;const f=ie(p.query,c);try{const h=yield t.handlers().queryHandler(f,(0,k.t)(f)),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()],f={...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),f[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,f),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 W(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 W(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.Q.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 f=c.cellStyle;return f&&"object"==typeof f?String(f.textAlign??f["text-align"]??"").toLowerCase():""})];return{headers:u,rows:l.map(c=>[String(c.id??""),...n.map(f=>{const h=f.colId??f.field??"",y=f.valueGetter;let T="function"==typeof y?y({data:c,colDef:f}):c[h];if(void 0===T&&a&&(T=(a[c.id]??{})[h]??[]),Array.isArray(T)){const v=f.cellRendererParams?.strategy,R=f.cellRendererParams?.postProcess,M=v?w(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 W(l.map(r=>(0,C.A)(function*(){try{(yield a.handlers().queryHandler(r.query,(0,k.t)(r.query))).results.bindings.forEach(c=>{const f=c.subject?.value;if(!f)return;u[f]||(u[f]={}),u[f][r.field]||(u[f][r.field]=[]);const h={};Object.keys(c).filter(y=>"subject"!==y).forEach(y=>{h[y]=c[y]?.value}),u[f][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,"&").replace(/</g,"<").replace(/>/g,">"))(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 m.e(7247).then(m.t.bind(m,77247,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_([z,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,X.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=m(57293);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})()},35401(B,N,m){m.d(N,{Q:()=>g});const g={foaf:"http://xmlns.com/foaf/0.1/",rdf:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",rdfs:"http://www.w3.org/2000/01/rdf-schema#",skos:"http://www.w3.org/2004/02/skos/core#",geo:"http://www.opengis.net/ont/geosparql#",schema:"http://schema.org/"}},77573(B,N,m){m.d(N,{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(B,N,m){m.d(N,{ButtonPadder:()=>C});var g=m(17705),s=m(32271),_=m(35547);const q=["*"];let C=(()=>{class I{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(w){return new(w||I)};static \u0275cmp=_.VBU({type:I,selectors:[["cue-button-padder"]],inputs:{justify:[1,"justify"],size:[1,"size"]},ngContentSelectors:q,decls:2,vars:4,template:function(w,F){1&w&&(_.NAR(),_.rj2(0,"div"),_.SdG(1),_.eux()),2&w&&_.xc7("justify-content",F.justify())("min-width",F.widthStyle())},styles:["div[_ngcontent-%COMP%]{display:flex;align-items:center;min-height:1px}"]})}return I})()},57293(B,N,m){m.d(N,{x:()=>w});var g=m(17705),s=m(85802),_=m(32271),q=m(44613),C=m(77089),I=m(59352),S=m(35547);function E(F,Y){1&F&&S.nrm(0,"cue-logo",4)}let w=(()=>{class F{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||F)};static \u0275cmp=S.VBU({type:F,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,C.d,I.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 F})()},4098(B,N,m){m.d(N,{CueSparqlTable:()=>Jt});var g=m(17705),s=m(85802),_=m(32271),q=m(42996),C=m(10467),I=m(67374),S=m.n(I),E=m(67400);function w(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 f=p[n],h=c[n],y=Number(f),T=Number(h);return isNaN(y)||isNaN(T)?(h??"").localeCompare(f??""):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,f)=>c+f,0)):t}case"avg":{const p=r.map(Number).filter(c=>!isNaN(c));return p.length?String(p.reduce((c,f)=>c+f,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,f)=>S()(f).valueOf()-S()(c).valueOf())[0];case"oldest":return[...r].sort((c,f)=>S()(c).valueOf()-S()(f).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=m(77573);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=>w(t,d,"")}return d=>Array.isArray(d)?d.map(t=>t?.val??"").filter(Boolean).join(", "):String(d??"")}}var Te=m(35401),Se=m(72716),Me=m(30222),k=m(46019);class Pe{queryHandler=(0,C.A)(function*(){throw new Error("No query handler defined")})}var ue=m(77089),e=m(35547);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 we=(()=>{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(f=>f[r]).filter(Boolean);this._allValues.set(p);const c=t.colDef?.cellRendererParams?.postProcess;this._displayValue.set((0,E.g4)(o?w(n,o):p[0]??"",c)),this._tooltip.set(p.map(f=>(0,E.g4)(f,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 z=(()=>{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 f=c.data??{},h={};for(const y of p)if("data"===y.defType){const T=y.getFormatter();h[y.field]=(0,E.g4)(T(f[y.field]??[]),y.postProcess)}return function Fe(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,f=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(f)}}}(r,h,"",f)}})}}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)(w(r,a.strategy,""),a.postProcess),f=(0,E.g4)(w(p,a.strategy,""),a.postProcess);return c.localeCompare(f)},cellRenderer:we,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(f=>"subject"!==f),c={};p.forEach(f=>{const h=u[f]?.value;Object.keys(a.keyVals).includes(r)||(a.keyVals[r]={}),void 0===a.keyVals[r][t.field]&&(a.keyVals[r][t.field]=[]),c[f]=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)(z);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],f={};if(f.id=c,Object.keys(t._dataFetchService.keyVals[c]).forEach(h=>{Object.keys(n).includes(h)||(n[h]=0),f[h]=t._dataFetchService.keyVals[c][h]??[],""!==f[h]&&n[h]++}),l.push(f),!r&&9===p){let h=!0;for(const y of u)if(typeof f[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=m(42245),O=m(35381),Ie=m(19682);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)(z);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=m(89079),X=m(59352),_e=m(70063),me=m(58957),Z=m(85971),fe=m(13319),ge=m(75448),Ge=m(2014),he=m(61485),ee=m(1096),Q=m(56593);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)(X.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,he.B,ge.ButtonLabel,Ge.ButtonPadder,X.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=m(65187),bt=m(97717),Dt=m(86117),Ct=m(90356),Tt=m(66279),St=m(20029),ne=m(65661),Mt=m(55821),Rt=m(21331);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 wt(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 Ft(i,d){1&i&&e.Z7z(0,wt,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,Ft,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,ge.ButtonLabel,he.B,_e.Select,me.Input,X.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=m(90262);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 W(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)(z);_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 W(u.map(p=>(0,C.A)(function*(){const c=l.filter(h=>void 0===r[h]?.[p.field]);if(!c.length)return;const f=ie(p.query,c);try{const h=yield t.handlers().queryHandler(f,(0,k.t)(f)),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()],f={...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),f[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,f),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 W(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 W(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.Q.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 f=c.cellStyle;return f&&"object"==typeof f?String(f.textAlign??f["text-align"]??"").toLowerCase():""})];return{headers:u,rows:l.map(c=>[String(c.id??""),...n.map(f=>{const h=f.colId??f.field??"",y=f.valueGetter;let T="function"==typeof y?y({data:c,colDef:f}):c[h];if(void 0===T&&a&&(T=(a[c.id]??{})[h]??[]),Array.isArray(T)){const v=f.cellRendererParams?.strategy,R=f.cellRendererParams?.postProcess,M=v?w(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 W(l.map(r=>(0,C.A)(function*(){try{(yield a.handlers().queryHandler(r.query,(0,k.t)(r.query))).results.bindings.forEach(c=>{const f=c.subject?.value;if(!f)return;u[f]||(u[f]={}),u[f][r.field]||(u[f][r.field]=[]);const h={};Object.keys(c).filter(y=>"subject"!==y).forEach(y=>{h[y]=c[y]?.value}),u[f][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,"&").replace(/</g,"<").replace(/>/g,">"))(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 m.e(7247).then(m.t.bind(m,77247,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_([z,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,X.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=m(57293);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})()},35401(B,N,m){m.d(N,{Q:()=>g});const g={foaf:"http://xmlns.com/foaf/0.1/",rdf:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",rdfs:"http://www.w3.org/2000/01/rdf-schema#",skos:"http://www.w3.org/2004/02/skos/core#",geo:"http://www.opengis.net/ont/geosparql#",schema:"http://schema.org/"}},77573(B,N,m){m.d(N,{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/4415.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkcue_ui=self.webpackChunkcue_ui||[]).push([[4415],{74415(Q,E,i){i.d(E,{Spreadsheet:()=>Y});var d=i(10467),m=i(17705),c=i(85802),M=i(32271),P=i(19682),j=i(
|
|
1
|
+
"use strict";(self.webpackChunkcue_ui=self.webpackChunkcue_ui||[]).push([[4415],{74415(Q,E,i){i.d(E,{Spreadsheet:()=>Y});var d=i(10467),m=i(17705),c=i(85802),M=i(32271),P=i(19682),j=i(79462),B=i(70063),V=i(35381),O=i(42245),_=i(85971),I=i(2014),G=i(75448);function v(r){return F.apply(this,arguments)}function F(){return(F=(0,d.A)(function*(r){return new Promise((a,e)=>{const t=document.createElement("input");t.style.display="none",t.setAttribute("type","file"),void 0!==r&&t.setAttribute("accept",r),document.body.appendChild(t),t.click(),t.addEventListener("change",n=>{const o=n.target?.files[0];t.remove(),o&&a(o),e()})})})).apply(this,arguments)}function D(r,a,e,t){const o=r.utils.sheet_to_json(a.Sheets[e],{header:1,defval:null}),p={colDefs:[],rows:[],sheetNames:t,sheetSelector:l=>D(r,a,l,t)};if(0===o.length)return p;const h=l=>l.filter(u=>null!=u&&""!==u).length,f=Math.max(...o.map(h));if(0===f)return p;const g=o.findIndex(l=>h(l)===f),x=o[g].map(l=>null!=l?String(l):""),T=o.slice(g+1).filter(l=>h(l)>0).map(l=>{const u={};return x.forEach((A,K)=>{A&&(u[A]=l[K]??"")}),u});return{colDefs:x.filter(l=>l).map(l=>({field:l})),rows:T,sheetNames:t,sheetSelector:l=>D(r,a,l,t)}}function R(){return(R=(0,d.A)(function*(r){const a=yield i.e(2288).then(i.bind(i,62288)),t=a.read(r,{type:"string"==typeof r?"binary":"array"}),n=t.SheetNames.filter(o=>D(a,t,o,[]).rows.length>0).filter(o=>"Export Summary"!==o);return 0===n.length?{colDefs:[],rows:[],sheetNames:[],sheetSelector:()=>({colDefs:[],rows:[],sheetNames:[],sheetSelector:()=>({})})}:D(a,t,n[0],n)})).apply(this,arguments)}var z=i(90262),J=i.n(z),k=i(59352),s=i(35547);function $(r,a){if(1&r){const e=s.RV6();s.j41(0,"div",1)(1,"cue-flexcontainer",4)(2,"cue-typography"),s.EFF(3),s.nI1(4,"transloco"),s.k0s(),s.j41(5,"cue-button",5),s.bIt("click",function(){c.eBV(e);const n=s.XpG();return c.Njj(n.promptFileUpload())}),s.nrm(6,"cue-button-padder"),s.j41(7,"cue-button-label"),s.EFF(8),s.nI1(9,"transloco"),s.k0s(),s.nrm(10,"cue-button-padder"),s.k0s()()()}2&r&&(s.R7$(3),s.JRh(s.bMT(4,2,"components.spreadsheet.infoDropFiles")),s.R7$(5),s.JRh(s.bMT(9,4,"components.spreadsheet.infoClickToLoad")))}function X(r,a){if(1&r){const e=s.RV6();s.j41(0,"cue-select",6),s.bIt("valueChange",function(n){c.eBV(e);const o=s.XpG();return c.Njj(o.onSheetChange(n))}),s.k0s()}if(2&r){const e=s.XpG();s.Y8G("options",e.sheetNames())("value",e.selectedSheet())("underline",!1)}}let Y=(()=>{class r{data=(0,m.hFB)();acceptedFileTypes=(0,m.hFB)([".csv",".xlsx",".xls"]);allowUpload=(0,m.hFB)(!1);loading=(0,c.vPA)(!1);noRowsText=(0,M.EW)(()=>this.data()?this.loading()?"components.spreadsheet.infoLoading":"components.spreadsheet.infoNoRows":"");parseResult=(0,m.CGW)();filesDropped=(0,m.CGW)();rowData=(0,c.vPA)([]);columnDefs=(0,c.vPA)([]);fileName=(0,c.vPA)("");sheetNames=(0,c.vPA)([]);selectedSheet=(0,c.vPA)("");_sheetSelector=null;constructor(){var e=this;(0,c.QZP)((0,d.A)(function*(){const t=e.data();t&&(e.loading.set(!0),yield e._processInputData(t),e.loading.set(!1))}))}handleFileDrop(e){var t=this;return(0,d.A)(function*(){if(0===e.length)return;const n=e[0];t.fileName.set(n.name),yield t._processDroppedFile(n),t.filesDropped.emit(e)})()}promptFileUpload(){var e=this;return(0,d.A)(function*(){try{const t=e.acceptedFileTypes().join(","),n=yield v(t);e.fileName.set(n.name),yield e._processDroppedFile(n)}catch(t){console.error("File upload cancelled or failed:",t)}})()}_processInputData(e){var t=this;return(0,d.A)(function*(){if("csv"===e.format)console.log("Parsing CSV data"),e.raw?t.parseCsv(e.raw):e.url&&fetch(e.url).then(n=>n.text()).then(n=>t.parseCsv(n)).catch(n=>console.error("Error fetching CSV:",n));else if(("xlsx"===e.format||"xls"===e.format)&&(console.log("Parsing Excel data"),e.url))try{const o=yield(yield fetch(e.url)).arrayBuffer();yield t._parseExcel(o)}catch(n){console.error("Error fetching or parsing Excel file:",n)}})()}_processDroppedFile(e){var t=this;return(0,d.A)(function*(){const n=e.name.toLowerCase();n.endsWith(".csv")?yield t._parseFile(e,"csv"):n.endsWith(".xlsx")||n.endsWith(".xls")?yield t._parseFile(e,"xlsx"):console.error("Unsupported file type:",e.name)})()}_parseFile(e,t){var n=this;return(0,d.A)(function*(){if("csv"===t){const o=yield e.text();n.parseCsv(o)}else if("xlsx"===t){const o=yield e.arrayBuffer();yield n._parseExcel(o)}})()}_parseExcel(e){var t=this;return(0,d.A)(function*(){try{const n=yield function U(r){return R.apply(this,arguments)}(e);t._sheetSelector=n.sheetSelector,t.sheetNames.set(n.sheetNames),t.selectedSheet.set(n.sheetNames[0]??""),t._applySheetResult(n)}catch(n){console.error("Error parsing Excel file:",n)}})()}onSheetChange(e){if(!this._sheetSelector)return;this.selectedSheet.set(e);const t=this._sheetSelector(e);this._applySheetResult(t)}_applySheetResult(e){this.columnDefs.set(e.colDefs),this.rowData.set(e.rows),this.parseResult.emit({rows:e.rows,columns:e.colDefs,fileName:this.fileName()})}parseCsv(e){const{colDefs:t,rows:n}=function W(r,a){const e=J().parse(r,{header:a});let t=[],n=[];return e.meta.fields&&(n=e.meta.fields.map(o=>({field:o}))),t=e.data.filter(o=>"object"==typeof o&&null!==o&&function L(r){for(const a in r){const e=r[a];if(""!==e&&null!=e)return!0}return!1}(o)),{colDefs:n,rows:t}}(e,!0);this.columnDefs.set(t),this.rowData.set(n),this.parseResult.emit({rows:this.rowData(),columns:this.columnDefs(),fileName:this.fileName()})}static \u0275fac=function(t){return new(t||r)};static \u0275cmp=s.VBU({type:r,selectors:[["cue-spreadsheet"]],inputs:{data:[1,"data"],acceptedFileTypes:[1,"acceptedFileTypes"],allowUpload:[1,"allowUpload"]},outputs:{parseResult:"parseResult",filesDropped:"filesDropped"},decls:4,vars:5,consts:[["cueFileDrop","",1,"spreadsheet-grid-wrapper",3,"filesDropped"],[1,"drop-zone"],["size","s",1,"sheet-selector",3,"options","value","underline"],[2,"width","100%","height","100%","background-color","var(--cue-color-bg-primary)",3,"rowData","columnDefs","noRowsText"],["direction","column","gap","l","align","center",1,"drop-zone-content"],[3,"click"],["size","s",1,"sheet-selector",3,"valueChange","options","value","underline"]],template:function(t,n){1&t&&(s.j41(0,"div",0),s.bIt("filesDropped",function(p){return n.handleFileDrop(p)}),s.nVh(1,$,11,6,"div",1),s.nVh(2,X,1,3,"cue-select",2),s.nrm(3,"cue-ag-grid",3),s.k0s()),2&t&&(s.R7$(),s.vxM(0===n.rowData().length&&n.allowUpload()?1:-1),s.R7$(),s.vxM(n.sheetNames().length>1?2:-1),s.R7$(),s.Y8G("rowData",n.rowData())("columnDefs",n.columnDefs())("noRowsText",n.noRowsText()))},dependencies:[P.R,j.F,B.Select,V.FlexContainer,O.Typography,_.Button,I.ButtonPadder,G.ButtonLabel,k.Kj],styles:["[_nghost-%COMP%]{--ag-font-family: var(--cue-font-family);--ag-header-font-family: var(--cue-font-family);--ag-cell-font-family: var(--cue-font-family);display:contents}.spreadsheet-grid-wrapper[_ngcontent-%COMP%]{width:100%;height:100%;min-height:200px;display:flex;flex-direction:column;position:relative}.sheet-selector[_ngcontent-%COMP%]{align-self:flex-start;margin-bottom:4px;min-width:160px}.drop-zone[_ngcontent-%COMP%]{width:100%;height:100%;display:flex;align-items:center;justify-content:center;border:2px dashed var(--cue-color-border-secondary, #ccc);border-radius:8px;background-color:var(--cue-color-bg-secondary, #f9f9f9);transition:all .2s ease}.drop-zone[_ngcontent-%COMP%]:hover{border-color:var(--cue-color-border-primary, #007acc);background-color:var(--cue-color-bg-hover, #f0f8ff)}.drop-zone-content[_ngcontent-%COMP%]{color:var(--cue-color-text-secondary, #666);padding:50px}.ag-theme-alpine[_ngcontent-%COMP%]{width:100%;height:100%}"],changeDetection:0})}return r})()}}]);
|