@qaecy/cue-ui 0.0.58 → 0.0.60

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/1520.js CHANGED
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkcue_ui=self.webpackChunkcue_ui||[]).push([[1520],{5448(w,O,a){a.d(O,{ButtonLabel:()=>I});var g=a(7705),s=a(2245),c=a(5547);const v=["*"];let I=(()=>{class h{fontSize=(0,g.hFB)("m");italic=(0,g.hFB)(!1);noWrap=(0,g.hFB)(!0);static \u0275fac=function(f){return new(f||h)};static \u0275cmp=c.VBU({type:h,selectors:[["cue-button-label"]],inputs:{fontSize:[1,"fontSize"],italic:[1,"italic"],noWrap:[1,"noWrap"]},ngContentSelectors:v,decls:3,vars:3,consts:[[3,"size","italic","noWrap"]],template:function(f,m){1&f&&(c.NAR(),c.j41(0,"div")(1,"cue-typography",0),c.SdG(2),c.k0s()()),2&f&&(c.R7$(),c.Y8G("size",m.fontSize())("italic",m.italic())("noWrap",m.noWrap()))},dependencies:[s.Typography],styles:["div[_ngcontent-%COMP%]{transform:translateY(.05em)}"]})}return h})()},7293(w,O,a){a.d(O,{x:()=>f});var g=a(7705),s=a(5802),c=a(2271),v=a(4613),I=a(9352),h=a(7089),d=a(5547);function b(m,P){1&m&&d.nrm(0,"cue-logo",4)}let f=(()=>{class m{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,c.EW)(()=>this.projectId()&&this.resourceId()?"components.logoLink.showResourceInCue":this.projectId()?"components.logoLink.openProjectInCue":"components.logoLink.openCuePortal");_href=(0,c.EW)(()=>{const i=this.projectId(),p=this.resourceId();return i&&p?`https://cue.qaecy.com/r/${encodeURIComponent(i)}/${encodeURIComponent(p)}`:i?`https://cue.qaecy.com/home/projects?p=${encodeURIComponent(i)}`:"https://cue.qaecy.com/home/projects"});static \u0275fac=function(p){return new(p||m)};static \u0275cmp=d.VBU({type:m,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(p,C){1&p&&(d.j41(0,"a",0),d.bIt("mouseenter",function(){return C.onHover()}),d.j41(1,"div",1),d.nI1(2,"transloco"),d.nrm(3,"cue-logo",2),d.j41(4,"div",3),d.nVh(5,b,1,0,"cue-logo",4),d.k0s()()()),2&p&&(d.Y8G("href",C._href(),d.B4B),d.R7$(),d.Y8G("cueTooltip",d.bMT(2,3,C._title())),d.R7$(4),d.vxM(C._active()?5:-1))},dependencies:[v.Logo,h.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 m})()},8791(w,O,a){a.d(O,{CueDocumentList:()=>j});var g=a(467),s=a(7705),c=a(5802),v=a(2271),I=a(2283),h=a(2065),d=a(4372),b=a(5381),f=a(2245),m=a(7851),P=a(7293),i=a(5547);function p(r,B){if(1&r&&(i.j41(0,"cue-flexcontainer",0)(1,"cue-typography",2),i.EFF(2),i.k0s()()),2&r){const e=i.XpG();i.R7$(2),i.SpI(" ",e.errorMessage()," ")}}function C(r,B){if(1&r&&i.nrm(0,"cue-logo-link",4),2&r){const e=i.XpG(2);i.Y8G("projectId",e.projectId())}}function E(r,B){if(1&r){const e=i.RV6();i.j41(0,"div",1)(1,"cue-doc-list",3),i.bIt("clickedDocument",function(o){c.eBV(e);const n=i.XpG();return c.Njj(n.clickedDocument.emit(o))})("clickedDownloadDocument",function(o){c.eBV(e);const n=i.XpG();return c.Njj(n.clickedDownloadDocument.emit(o))})("clickedOpenInDir",function(o){c.eBV(e);const n=i.XpG();return c.Njj(n.clickedOpenInDir.emit(o))})("clickedOpen",function(o){c.eBV(e);const n=i.XpG();return c.Njj(n.clickedOpen.emit(o))}),i.k0s(),i.nVh(2,C,1,1,"cue-logo-link",4),i.k0s()}if(2&r){const e=i.XpG();i.Y8G("cueLogoLoader","loading"===e.state()),i.R7$(),i.Y8G("documentRefs",e.documentRefs())("documentData",e.documentData())("handlers",e.handlers())("availableContentCategories",e.availableContentCategories())("detailedView",e.detailedView())("simple",e.simple())("pageSize",e.pageSize())("size",e.size())("prefetchPages",e.prefetchPages())("showOpenInDocumentViewerAction",e.showOpenInDocumentViewerAction())("showOpenInFileManagerAction",e.showOpenInFileManagerAction())("customOverlayActions",e.customOverlayActions())("variant",e.variant()),i.R7$(),i.vxM(e.showLogo()?2:-1)}}function L(r){return r.split("?")[0].trim()}let j=(()=>{class r{projectId=(0,s.hFB)(void 0);uuids=(0,s.hFB)([]);suffixes=(0,s.hFB)(void 0);mimeTypes=(0,s.hFB)(void 0);contentCategories=(0,s.hFB)(void 0);sdkState=(0,s.hFB)(void 0);detailedView=(0,s.hFB)(!1,{transform:s.L39});simple=(0,s.hFB)(!1,{transform:s.L39});pageSize=(0,s.hFB)(10,{transform:s.Udg});size=(0,s.hFB)("m");prefetchPages=(0,s.hFB)(3,{transform:s.Udg});showOpenInDocumentViewerAction=(0,s.hFB)(!1,{transform:s.L39});showOpenInFileManagerAction=(0,s.hFB)(!1,{transform:s.L39});customMenuItems=(0,s.hFB)([]);showLogo=(0,s.hFB)(!1,{transform:s.L39});variant=(0,s.hFB)("none");clickedDocument=(0,s.CGW)();clickedDownloadDocument=(0,s.CGW)();clickedOpenInDir=(0,s.CGW)();clickedOpen=(0,s.CGW)();state=(0,c.vPA)("idle");errorMessage=(0,c.vPA)(null);documentData=(0,c.vPA)({});availableContentCategories=(0,c.vPA)(void 0);_filterResolvedUuids=(0,c.vPA)(void 0);documentRefs=(0,v.EW)(()=>{const e=new Set;return(void 0!==this._filterResolvedUuids()?this._filterResolvedUuids()??[]:this.uuids()??[]).map(L).filter(o=>!!o).filter(o=>!e.has(o)&&(e.add(o),!0)).map(o=>({id:o}))});customOverlayActions=(0,v.EW)(()=>{const e=this.projectId();return[...e?[{label:"Open in Cue",icon:"external-link",action:n=>{const u=n.rowData;window.open(`https://cue.qaecy.com/r/${encodeURIComponent(e)}/${encodeURIComponent(u.id)}`,"_blank","noopener,noreferrer")}}]:[],...(this.customMenuItems()||[]).map(n=>({label:n.label,icon:n.icon,action:u=>{n.action(u.rowData,u)}}))]});handlers=(0,v.EW)(()=>{var e=this;const t=this._docs();if(t)return{requestData:(o=(0,g.A)(function*(n){const u=n.map(L).filter(_=>!!_),l=u.filter(_=>!e.documentData()[_]);if(console.debug("[CueDocumentListWC] requestData",{requestedCount:u.length,missingCount:l.length,missing:l}),l.length)try{const _=t,D=e.simple()&&_.fetchDocumentDataSimple?yield _.fetchDocumentDataSimple(l):yield t.fetchDocumentData(l);console.debug("[CueDocumentListWC] fetchDocumentData resolved",{fetchedCount:Object.keys(D).length,ids:Object.keys(D)});const y={};Object.values(D).forEach(M=>{y[M.id]=function R(r){return{id:r.id,path:r.path,suffix:r.suffix,size:r.size,contentIRI:r.contentIRI,providerId:r.providerId,tags:r.tags??[],summary:r.summary??"",categories:r.categories??[],subject:r.subject,relevance:0}}(M)}),Object.keys(y).length>0&&e.documentData.update(M=>({...M,...y}))}catch(_){console.error("[CueDocumentListWC] Failed to fetch document data:",_),e.errorMessage.set(_ instanceof Error?_.message:String(_)),e.state.set("error")}}),function(u){return o.apply(this,arguments)}),requestDownload:function(){var o=(0,g.A)(function*(n){const u=e._cue(),l=e.projectId();if(u&&l)try{const _=yield u.storage.getDownloadUrl(l,n.id,n.suffix,"raw"),D=yield fetch(_);if(!D.ok)throw new Error(`Download failed: ${D.status} ${D.statusText}`);const y=yield D.blob(),M=(0,d.M)(n.path)||`${n.id}${n.suffix||""}`;(0,h.KE)(y,M)}catch(_){console.error("[CueDocumentListWC] Failed to download document:",_)}});return function(u){return o.apply(this,arguments)}}(),requestOpen:(o,n)=>{console.log("[CueDocumentListWC] requestOpen",{documentUUID:o,document:n})},requestOpenInDir:(o,n)=>{console.log("[CueDocumentListWC] requestOpenInDir",{documentUUID:o,document:n})}};var o});_cue=(0,c.vPA)(void 0);_docs=(0,c.vPA)(void 0);_ownedView;_inputWarningTimer;_unsubscribeCategories;_lastSetupSignature;constructor(){this._inputWarningTimer=setTimeout(()=>{this.projectId()||console.warn('[cue-document-list] Required input "projectId" is not set. Pass the Cue project ID to load documents.'),this.sdkState()||console.warn('[cue-document-list] Required input "sdkState" is not set. Pass a { cue, view, or documents } object to enable document loading.')},3e3),(0,c.QZP)(()=>{const e=this.projectId(),t=this.sdkState(),o=t?.language??"en";if(console.debug("[CueDocumentListWC] input state changed",{projectId:e,uuids:this.uuids().length,hasSdkState:!!t,hasCue:!!t?.cue,hasView:!!t?.view,hasDocuments:!!t?.documents}),!e||!t)return this._clearRuntimeState(),void this.state.set("idle");const n={projectId:e,cue:t.cue,view:t.view,documents:t.documents,language:o,simple:this.simple()};if(this._isSameSetupSignature(n))return this.state.set("ready"),void this.errorMessage.set(null);this._setupFromSdkState(e,t),this._lastSetupSignature=n,this.state.set("ready"),this.errorMessage.set(null)}),(0,c.QZP)(()=>{const e=this.suffixes(),t=this.mimeTypes(),o=this.contentCategories(),n=this._docs();void 0!==e||void 0!==t||void 0!==o?this._fetchByFilter(e,t,o,n):this._filterResolvedUuids.set(void 0)}),(0,c.QZP)(()=>{const e=new Set(this.documentRefs().map(t=>t.id));this.documentData.update(t=>Object.fromEntries(Object.entries(t).filter(([n])=>e.has(n))))})}ngOnDestroy(){clearTimeout(this._inputWarningTimer),this._cleanupOwnedView(),this._unsubscribeCategories?.(),this._unsubscribeCategories=void 0}_setupFromSdkState(e,t){const o=t.language??"en";if(this.documentData.set({}),this._cleanupOwnedView(),this._unsubscribeCategories?.(),this._unsubscribeCategories=void 0,this.availableContentCategories.set(t.availableContentCategories?t.availableContentCategories:void 0),t.documents)return t.documents.setLanguage(o),this._docs.set(t.documents),void this._cue.set(t.cue);if(t.view)return t.view.setLanguage(o),this._docs.set(t.view.documents),this._cue.set(t.cue),void(this.simple()||this._bindCategoriesFromView(t.view));if(t.cue){if(this.simple())return this._docs.set(t.cue.createProjectDocuments(e)),this._cue.set(t.cue),void this.availableContentCategories.set(void 0);const n=t.cue.createProjectView(e,{language:o});return this._ownedView=n,this._docs.set(n.documents),this._cue.set(t.cue),void this._bindCategoriesFromView(n)}this._docs.set(void 0),this._cue.set(void 0),this.errorMessage.set("sdkState must include cue, view, or documents to load data."),this.state.set("error")}_bindCategoriesFromView(e){const t=()=>{this.availableContentCategories.set(e.availableContentCategories.get())};t(),this._unsubscribeCategories=e.availableContentCategories.subscribe(t)}_clearRuntimeState(){this._cleanupOwnedView(),this._unsubscribeCategories?.(),this._unsubscribeCategories=void 0,this._docs.set(void 0),this._cue.set(void 0),this.documentData.set({}),this.availableContentCategories.set(void 0),this.errorMessage.set(null),this._lastSetupSignature=void 0}_cleanupOwnedView(){this._ownedView&&(this._ownedView.destroy(),this._ownedView=void 0)}_fetchByFilter(e,t,o,n){var u=this;return(0,g.A)(function*(){if(n){u.state.set("loading");try{let l;if(void 0!==e&&e.length>0)l=yield n.documentsBySuffix(e);else if(void 0!==t&&t.length>0)l=yield n.documentsByMime(t);else{if(!(void 0!==o&&o.length>0))return u._filterResolvedUuids.set([]),void u.state.set("ready");l=yield n.documentsByContentCategory(o)}u._filterResolvedUuids.set(l.map(_=>_.uuid)),u.state.set("ready")}catch(l){console.error("[CueDocumentListWC] Failed to fetch documents by filter",l),u.errorMessage.set(l instanceof Error?l.message:"Failed to load documents."),u.state.set("error")}}else u._filterResolvedUuids.set([])})()}_isSameSetupSignature(e){const t=this._lastSetupSignature;return!!t&&t.projectId===e.projectId&&t.cue===e.cue&&t.view===e.view&&t.documents===e.documents&&t.language===e.language&&t.simple===e.simple}static \u0275fac=function(t){return new(t||r)};static \u0275cmp=i.VBU({type:r,selectors:[["cue-document-list"]],inputs:{projectId:[1,"projectId"],uuids:[1,"uuids"],suffixes:[1,"suffixes"],mimeTypes:[1,"mimeTypes"],contentCategories:[1,"contentCategories"],sdkState:[1,"sdkState"],detailedView:[1,"detailedView"],simple:[1,"simple"],pageSize:[1,"pageSize"],size:[1,"size"],prefetchPages:[1,"prefetchPages"],showOpenInDocumentViewerAction:[1,"showOpenInDocumentViewerAction"],showOpenInFileManagerAction:[1,"showOpenInFileManagerAction"],customMenuItems:[1,"customMenuItems"],showLogo:[1,"showLogo"],variant:[1,"variant"]},outputs:{clickedDocument:"clickedDocument",clickedDownloadDocument:"clickedDownloadDocument",clickedOpenInDir:"clickedOpenInDir",clickedOpen:"clickedOpen"},decls:2,vars:1,consts:[["direction","column","align","center","justify","center",2,"height","100%","width","100%","padding","8px"],[2,"position","relative","width","100%",3,"cueLogoLoader"],[2,"color","#c44","font-size","13px"],[3,"clickedDocument","clickedDownloadDocument","clickedOpenInDir","clickedOpen","documentRefs","documentData","handlers","availableContentCategories","detailedView","simple","pageSize","size","prefetchPages","showOpenInDocumentViewerAction","showOpenInFileManagerAction","customOverlayActions","variant"],[2,"position","absolute","top","8px","left","8px","z-index","5",3,"projectId"]],template:function(t,o){1&t&&i.nVh(0,p,3,1,"cue-flexcontainer",0)(1,E,3,15,"div",1),2&t&&i.vxM("error"===o.state()?0:1)},dependencies:[I.g,b.FlexContainer,f.Typography,m.k,P.x],styles:["[_nghost-%COMP%]{display:block;width:100%}"],changeDetection:0})}return r})()}}]);
1
+ "use strict";(self.webpackChunkcue_ui=self.webpackChunkcue_ui||[]).push([[1520],{5448(y,M,r){r.d(M,{ButtonLabel:()=>b});var f=r(7705),s=r(2245),c=r(5547);const D=["*"];let b=(()=>{class _{fontSize=(0,f.hFB)("m");italic=(0,f.hFB)(!1);noWrap=(0,f.hFB)(!0);static \u0275fac=function(p){return new(p||_)};static \u0275cmp=c.VBU({type:_,selectors:[["cue-button-label"]],inputs:{fontSize:[1,"fontSize"],italic:[1,"italic"],noWrap:[1,"noWrap"]},ngContentSelectors:D,decls:3,vars:3,consts:[[3,"size","italic","noWrap"]],template:function(p,h){1&p&&(c.NAR(),c.j41(0,"div")(1,"cue-typography",0),c.SdG(2),c.k0s()()),2&p&&(c.R7$(),c.Y8G("size",h.fontSize())("italic",h.italic())("noWrap",h.noWrap()))},dependencies:[s.Typography],styles:["div[_ngcontent-%COMP%]{transform:translateY(.05em)}"]})}return _})()},7293(y,M,r){r.d(M,{x:()=>p});var f=r(7705),s=r(5802),c=r(2271),D=r(4613),b=r(9352),_=r(7089),a=r(5547);function u(h,E){1&h&&a.nrm(0,"cue-logo",4)}let p=(()=>{class h{projectId=(0,f.hFB)(void 0);resourceId=(0,f.hFB)(void 0);_active=(0,s.vPA)(!0);onHover(){this._active.set(!1),requestAnimationFrame(()=>this._active.set(!0))}_title=(0,c.EW)(()=>this.projectId()&&this.resourceId()?"components.logoLink.showResourceInCue":this.projectId()?"components.logoLink.openProjectInCue":"components.logoLink.openCuePortal");_href=(0,c.EW)(()=>{const i=this.projectId(),v=this.resourceId();return i&&v?`https://cue.qaecy.com/r/${encodeURIComponent(i)}/${encodeURIComponent(v)}`:i?`https://cue.qaecy.com/home/projects?p=${encodeURIComponent(i)}`:"https://cue.qaecy.com/home/projects"});static \u0275fac=function(v){return new(v||h)};static \u0275cmp=a.VBU({type:h,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(v,O){1&v&&(a.j41(0,"a",0),a.bIt("mouseenter",function(){return O.onHover()}),a.j41(1,"div",1),a.nI1(2,"transloco"),a.nrm(3,"cue-logo",2),a.j41(4,"div",3),a.nVh(5,u,1,0,"cue-logo",4),a.k0s()()()),2&v&&(a.Y8G("href",O._href(),a.B4B),a.R7$(),a.Y8G("cueTooltip",a.bMT(2,3,O._title())),a.R7$(4),a.vxM(O._active()?5:-1))},dependencies:[D.Logo,_.d,b.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 h})()},8791(y,M,r){r.d(M,{CueDocumentList:()=>A});var f=r(467),s=r(7705),c=r(5802),D=r(2271),b=r(3656),_=r(2065),a=r(4372),u=r(5381),p=r(2245),h=r(7851),E=r(7293),i=r(5547);function v(d,R){if(1&d&&(i.j41(0,"cue-flexcontainer",0)(1,"cue-typography",2),i.EFF(2),i.k0s()()),2&d){const e=i.XpG();i.R7$(2),i.SpI(" ",e.errorMessage()," ")}}function O(d,R){if(1&d&&i.nrm(0,"cue-logo-link",4),2&d){const e=i.XpG(2);i.Y8G("projectId",e.projectId())}}function L(d,R){if(1&d){const e=i.RV6();i.j41(0,"div",1)(1,"cue-doc-list",3),i.bIt("clickedDocument",function(o){c.eBV(e);const n=i.XpG();return c.Njj(n.clickedDocument.emit(o))})("clickedDownloadDocument",function(o){c.eBV(e);const n=i.XpG();return c.Njj(n.clickedDownloadDocument.emit(o))})("clickedOpenInDir",function(o){c.eBV(e);const n=i.XpG();return c.Njj(n.clickedOpenInDir.emit(o))})("clickedOpen",function(o){c.eBV(e);const n=i.XpG();return c.Njj(n.clickedOpen.emit(o))}),i.k0s(),i.nVh(2,O,1,1,"cue-logo-link",4),i.k0s()}if(2&d){const e=i.XpG();i.Y8G("cueLogoLoader","loading"===e.state()),i.R7$(),i.Y8G("documentRefs",e.documentRefs())("documentData",e.documentData())("handlers",e.handlers())("availableContentCategories",e.availableContentCategories())("detailedView",e.detailedView())("simple",e.simple())("pageSize",e.pageSize())("size",e.size())("prefetchPages",e.prefetchPages())("showOpenInDocumentViewerAction",e.showOpenInDocumentViewerAction())("showOpenInFileManagerAction",e.showOpenInFileManagerAction())("customOverlayActions",e.customOverlayActions())("variant",e.variant()),i.R7$(),i.vxM(e.showLogo()?2:-1)}}function P(d){return d.split("?")[0].trim()}let A=(()=>{class d{projectId=(0,s.hFB)(void 0);uuids=(0,s.hFB)([]);suffixes=(0,s.hFB)(void 0);mimeTypes=(0,s.hFB)(void 0);contentCategories=(0,s.hFB)(void 0);sdkState=(0,s.hFB)(void 0);detailedView=(0,s.hFB)(!1,{transform:s.L39});simple=(0,s.hFB)(!1,{transform:s.L39});pageSize=(0,s.hFB)(10,{transform:s.Udg});size=(0,s.hFB)("m");prefetchPages=(0,s.hFB)(3,{transform:s.Udg});showOpenInDocumentViewerAction=(0,s.hFB)(!1,{transform:s.L39});showOpenInFileManagerAction=(0,s.hFB)(!1,{transform:s.L39});customMenuItems=(0,s.hFB)([]);showLogo=(0,s.hFB)(!1,{transform:s.L39});variant=(0,s.hFB)("none");clickedDocument=(0,s.CGW)();clickedDownloadDocument=(0,s.CGW)();clickedOpenInDir=(0,s.CGW)();clickedOpen=(0,s.CGW)();state=(0,c.vPA)("idle");errorMessage=(0,c.vPA)(null);documentData=(0,c.vPA)({});availableContentCategories=(0,c.vPA)(void 0);_filterResolvedUuids=(0,c.vPA)(void 0);documentRefs=(0,D.EW)(()=>{const e=new Set;return(void 0!==this._filterResolvedUuids()?this._filterResolvedUuids()??[]:this.uuids()??[]).map(P).filter(o=>!!o).filter(o=>!e.has(o)&&(e.add(o),!0)).map(o=>({id:o}))});customOverlayActions=(0,D.EW)(()=>{const e=this.projectId();return[...e?[{label:"Open in Cue",icon:"external-link",action:n=>{const l=n.rowData;window.open(`https://cue.qaecy.com/r/${encodeURIComponent(e)}/${encodeURIComponent(l.id)}`,"_blank","noopener,noreferrer")}}]:[],...(this.customMenuItems()||[]).map(n=>({label:n.label,icon:n.icon,action:l=>{n.action(l.rowData,l)}}))]});handlers=(0,D.EW)(()=>{var e=this;const t=this._docs();if(t)return{requestData:(o=(0,f.A)(function*(n){const l=n.map(P).filter(g=>!!g),m=l.filter(g=>!e.documentData()[g]);if(console.debug("[CueDocumentListWC] requestData",{requestedCount:l.length,missingCount:m.length,missing:m}),m.length)try{const g=t,C=e.simple()&&g.fetchDocumentDataSimple?yield g.fetchDocumentDataSimple(m):yield t.fetchDocumentData(m);console.debug("[CueDocumentListWC] fetchDocumentData resolved",{fetchedCount:Object.keys(C).length,ids:Object.keys(C)});const w={};Object.values(C).forEach(I=>{w[I.id]=function j(d){return{id:d.id,path:d.path,suffix:d.suffix,size:d.size,contentIRI:d.contentIRI,providerId:d.providerId,tags:d.tags??[],summary:d.summary??"",categories:d.categories??[],subject:d.subject,relevance:0}}(I)}),Object.keys(w).length>0&&e.documentData.update(I=>({...I,...w}))}catch(g){console.error("[CueDocumentListWC] Failed to fetch document data:",g),e.errorMessage.set(g instanceof Error?g.message:String(g)),e.state.set("error")}}),function(l){return o.apply(this,arguments)}),requestDownload:function(){var o=(0,f.A)(function*(n){const l=e._cue(),m=e.projectId();if(l&&m)try{const g=yield l.storage.getDownloadUrl(m,n.id,n.suffix,"raw"),C=yield fetch(g);if(!C.ok)throw new Error(`Download failed: ${C.status} ${C.statusText}`);const w=yield C.blob(),I=(0,a.M)(n.path)||`${n.id}${n.suffix||""}`;(0,_.KE)(w,I)}catch(g){console.error("[CueDocumentListWC] Failed to download document:",g)}});return function(l){return o.apply(this,arguments)}}(),requestOpen:(o,n)=>{console.log("[CueDocumentListWC] requestOpen",{documentUUID:o,document:n})},requestOpenInDir:(o,n)=>{console.log("[CueDocumentListWC] requestOpenInDir",{documentUUID:o,document:n})}};var o});_cue=(0,c.vPA)(void 0);_docs=(0,c.vPA)(void 0);_ownedView;_inputWarningTimer;_unsubscribeCategories;_lastSetupSignature;constructor(){this._inputWarningTimer=setTimeout(()=>{this.projectId()||console.warn('[cue-document-list] Required input "projectId" is not set. Pass the Cue project ID to load documents.'),this.sdkState()||console.warn('[cue-document-list] Required input "sdkState" is not set. Pass a { cue, view, or documents } object to enable document loading.')},3e3),(0,c.QZP)(()=>{const e=this.projectId(),t=this.sdkState(),o=t?.language??"en";if(console.debug("[CueDocumentListWC] input state changed",{projectId:e,uuids:this.uuids().length,hasSdkState:!!t,hasCue:!!t?.cue,hasView:!!t?.view,hasDocuments:!!t?.documents}),!e||!t)return this._clearRuntimeState(),void this.state.set("idle");const n={projectId:e,cue:t.cue,view:t.view,documents:t.documents,language:o,simple:this.simple()};if(this._isSameSetupSignature(n))return this.state.set("ready"),void this.errorMessage.set(null);this._setupFromSdkState(e,t),this._lastSetupSignature=n,this.state.set("ready"),this.errorMessage.set(null)}),(0,c.QZP)(()=>{const e=this.suffixes(),t=this.mimeTypes(),o=this.contentCategories(),n=this._docs();void 0!==e||void 0!==t||void 0!==o?this._fetchByFilter(e,t,o,n):this._filterResolvedUuids.set(void 0)}),(0,c.QZP)(()=>{const e=new Set(this.documentRefs().map(t=>t.id));this.documentData.update(t=>Object.fromEntries(Object.entries(t).filter(([n])=>e.has(n))))})}ngOnDestroy(){clearTimeout(this._inputWarningTimer),this._cleanupOwnedView(),this._unsubscribeCategories?.(),this._unsubscribeCategories=void 0}_setupFromSdkState(e,t){const o=t.language??"en";if(this.documentData.set({}),this._cleanupOwnedView(),this._unsubscribeCategories?.(),this._unsubscribeCategories=void 0,this.availableContentCategories.set(t.availableContentCategories?t.availableContentCategories:void 0),t.documents)return t.documents.setLanguage(o),this._docs.set(t.documents),void this._cue.set(t.cue);if(t.view)return t.view.setLanguage(o),this._docs.set(t.view.documents),this._cue.set(t.cue),void(this.simple()||this._bindCategoriesFromView(t.view));if(t.cue){if(this.simple())return this._docs.set(t.cue.createProjectDocuments(e)),this._cue.set(t.cue),void this.availableContentCategories.set(void 0);const n=t.cue.createProjectView(e,{language:o});return this._ownedView=n,this._docs.set(n.documents),this._cue.set(t.cue),void this._bindCategoriesFromView(n)}this._docs.set(void 0),this._cue.set(void 0),this.errorMessage.set("sdkState must include cue, view, or documents to load data."),this.state.set("error")}_bindCategoriesFromView(e){const t=()=>{this.availableContentCategories.set(e.availableContentCategories.get())};t(),this._unsubscribeCategories=e.availableContentCategories.subscribe(t)}_clearRuntimeState(){this._cleanupOwnedView(),this._unsubscribeCategories?.(),this._unsubscribeCategories=void 0,this._docs.set(void 0),this._cue.set(void 0),this.documentData.set({}),this.availableContentCategories.set(void 0),this.errorMessage.set(null),this._lastSetupSignature=void 0}_cleanupOwnedView(){this._ownedView&&(this._ownedView.destroy(),this._ownedView=void 0)}_fetchByFilter(e,t,o,n){var l=this;return(0,f.A)(function*(){if(n){l.state.set("loading");try{let m;if(void 0!==e&&e.length>0)m=yield n.documentsBySuffix(e);else if(void 0!==t&&t.length>0)m=yield n.documentsByMime(t);else{if(!(void 0!==o&&o.length>0))return l._filterResolvedUuids.set([]),void l.state.set("ready");m=yield n.documentsByContentCategory(o)}l._filterResolvedUuids.set(m.map(g=>g.uuid)),l.state.set("ready")}catch(m){console.error("[CueDocumentListWC] Failed to fetch documents by filter",m),l.errorMessage.set(m instanceof Error?m.message:"Failed to load documents."),l.state.set("error")}}else l._filterResolvedUuids.set([])})()}_isSameSetupSignature(e){const t=this._lastSetupSignature;return!!t&&t.projectId===e.projectId&&t.cue===e.cue&&t.view===e.view&&t.documents===e.documents&&t.language===e.language&&t.simple===e.simple}static \u0275fac=function(t){return new(t||d)};static \u0275cmp=i.VBU({type:d,selectors:[["cue-document-list"]],inputs:{projectId:[1,"projectId"],uuids:[1,"uuids"],suffixes:[1,"suffixes"],mimeTypes:[1,"mimeTypes"],contentCategories:[1,"contentCategories"],sdkState:[1,"sdkState"],detailedView:[1,"detailedView"],simple:[1,"simple"],pageSize:[1,"pageSize"],size:[1,"size"],prefetchPages:[1,"prefetchPages"],showOpenInDocumentViewerAction:[1,"showOpenInDocumentViewerAction"],showOpenInFileManagerAction:[1,"showOpenInFileManagerAction"],customMenuItems:[1,"customMenuItems"],showLogo:[1,"showLogo"],variant:[1,"variant"]},outputs:{clickedDocument:"clickedDocument",clickedDownloadDocument:"clickedDownloadDocument",clickedOpenInDir:"clickedOpenInDir",clickedOpen:"clickedOpen"},decls:2,vars:1,consts:[["direction","column","align","center","justify","center",2,"height","100%","width","100%","padding","8px"],[2,"position","relative","width","100%",3,"cueLogoLoader"],[2,"color","#c44","font-size","13px"],[3,"clickedDocument","clickedDownloadDocument","clickedOpenInDir","clickedOpen","documentRefs","documentData","handlers","availableContentCategories","detailedView","simple","pageSize","size","prefetchPages","showOpenInDocumentViewerAction","showOpenInFileManagerAction","customOverlayActions","variant"],[2,"position","absolute","top","8px","left","8px","z-index","5",3,"projectId"]],template:function(t,o){1&t&&i.nVh(0,v,3,1,"cue-flexcontainer",0)(1,L,3,15,"div",1),2&t&&i.vxM("error"===o.state()?0:1)},dependencies:[b.g,u.FlexContainer,p.Typography,h.k,E.x],styles:["[_nghost-%COMP%]{display:block;width:100%}"],changeDetection:0})}return d})()},2065(y,M,r){function c(_,a,u="text/plain"){return function f(_,a="data.zip"){const u=document.createElement("a"),p=URL.createObjectURL(_);u.href=p,u.download=a,document.body.appendChild(u),u.click(),document.body.removeChild(u),URL.revokeObjectURL(p)}(new Blob([_],{type:u}),a)}function D(_,a){const u=document.createElement("a");u.style.display="hidden",u.setAttribute("href",window.URL.createObjectURL(_)),u.setAttribute("download",a),document.body.appendChild(u),u.click(),u.remove()}r.d(M,{KE:()=>D,YN:()=>c})}}]);