@qaecy/cue-ui 0.0.25 → 0.0.27

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/613.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkcue_ui=self.webpackChunkcue_ui||[]).push([[613],{4613(D,p,a){a.d(p,{Logo:()=>u});var r=a(7705),n=a(5802),o=a(5547),M=a(2271),_=a(6170);let u=(()=>{class m{size=(0,r.hFB)("m");sizeMap={xs:"40px",s:"80px",m:"160px",l:"222px"};active=(0,r.hFB)(!0,{transform:r.L39});continuous=(0,r.hFB)(!1,{transform:r.L39});mode=(0,r.hFB)("default");isDarkMode=(0,r.geq)(!1);handleDarkModeChange(e){this.isDarkMode.set(e),-1===this.raf&&this.animate()}colorA=(0,M.EW)(()=>this.isDarkMode()?[221,246,18]:[18,28,43]);colorB=[0,202,204];paths=[];raf=-1;appearTime=0;disappearTime=0;tip=0;toe=0;mix=[0,0,0];norm=0;animate=e=>{if(void 0!==e){const s=5e-4*(e-this.appearTime);"glow"===this.mode()?this.tip=s%1:(this.tip=Math.min(1,s),this.active()||(this.toe=Math.min(1,6e-4*(e-this.disappearTime))))}if("glow"===this.mode()){const s=.06666666666666667,t=this.rgbToSvg(this.colorA());return this.paths.forEach((d,g)=>{this.norm=1/this.paths.length*g;let i=this.tip-this.norm;if(i<-(1-s)&&(i+=1),i>=0&&i<s){const c=1-i/s;d.setAttribute("stroke",this.rgbToSvg(this.colorB)),d.setAttribute("stroke-opacity",c.toFixed(3))}else d.setAttribute("stroke",t),d.setAttribute("stroke-opacity","0.005")}),void(this.raf=requestAnimationFrame(this.animate))}if(this.paths.forEach((s,t)=>{this.norm=1/this.paths.length*t,this.mix=this.mixRgb(this.colorA(),this.colorB,Math.max(0,Math.min(1,15*(this.tip-this.norm)))),s.setAttribute("stroke",this.tip*this.paths.length>t&&(this.active()||this.toe*this.paths.length<t)?this.rgbToSvg(this.mix):"transparent")}),this.tip>=1&&(this.active()||this.toe>=1))return this.continuous()?void setTimeout(()=>{this.appearTime=performance.now(),this.tip=0,this.toe=0,this.raf=requestAnimationFrame(this.animate)},500):void(this.raf=-1);this.raf=requestAnimationFrame(this.animate)};activate(){this.appearTime=performance.now(),this.animate(this.appearTime)}deactivate(){this.disappearTime=performance.now(),-1===this.raf&&this.animate(this.disappearTime)}mixChannel(e,s,t){return parseInt((e*t+s*(1-t)).toFixed())}mixRgb(e,s,t){return[this.mixChannel(e[0],s[0],t),this.mixChannel(e[1],s[1],t),this.mixChannel(e[2],s[2],t)]}rgbToSvg(e){return`rgb(${e[0]},${e[1]},${e[2]})`}constructor(){(0,n.QZP)(()=>{"glow"===this.mode()||this.active()?this.activate():this.deactivate()}),(0,n.QZP)(()=>{this.isDarkMode(),this.animate()});const e=(0,n.WQX)(o.aKT);(0,o.mal)({read:()=>{if(this.paths.length)return;const s=e.nativeElement.querySelector("svg"),t=e.nativeElement.querySelector("#original-path");if(!t)return;const d=t.getTotalLength(),i=[];for(let c=0;c<400;c++){const h=t.getPointAtLength(d/400*c);i.push({x:parseFloat(h.x.toFixed(2)),y:parseFloat(h.y.toFixed(2))})}i.push(t.getPointAtLength(d)),i.reverse(),i.forEach((c,h)=>{if(0===h||1===h)return;const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",`M${i[h-2].x},${i[h-2].y}L${i[h-1].x},${i[h-1].y}L${c.x},${c.y}`),l.setAttribute("fill","none"),l.setAttribute("stroke","transparent"),l.setAttribute("stroke-width",t?.getAttribute("stroke-width")||"1"),l.setAttribute("stroke-miterlimit",t?.getAttribute("stroke-miterlimit")||"1"),s.appendChild(l),this.paths.push(l)})}})}ngOnDestroy(){this.paths=[],cancelAnimationFrame(this.raf),this.raf=-1}static \u0275fac=function(s){return new(s||m)};static \u0275cmp=o.VBU({type:m,selectors:[["cue-logo"]],hostVars:2,hostBindings:function(s,t){2&s&&o.xc7("width",t.sizeMap[t.size()])},inputs:{size:[1,"size"],active:[1,"active"],continuous:[1,"continuous"],mode:[1,"mode"],isDarkMode:[1,"isDarkMode"]},outputs:{isDarkMode:"isDarkModeChange"},decls:2,vars:0,consts:[["cueDarkMode","","xmlns","http://www.w3.org/2000/svg","viewBox","0 0 221.545 86.191","width","222","height","86","overflow","visible",3,"darkModeChange"],["id","original-path","fill","none","stroke","transparent","stroke-miterlimit","10","stroke-width","12","d","M216.046 56.638s-10.561 24.201-36.192 22.991c-25.631-1.21-22.771-24.751-20.351-37.622 2.42-12.871 10.451-20.351 16.831-18.041 6.283 2.275 8.03 9.68 2.09 21.891-5.94 12.211-21.341 37.567-35.862 33.992-12.413-3.056-13.281-23.162-13.281-23.162V29.762v26.925c0 14.471-12.47 23.212-24.672 23.212s-24.672-8.301-24.672-23.212V29.829l-.006.105v13.031c0 20.416-16.55 36.966-36.966 36.966S6 63.381 6 42.966 22.55 6 42.966 6c6.91 0 13.377 1.896 18.91 5.196"]],template:function(s,t){1&s&&(n.qSk(),o.j41(0,"svg",0),o.bIt("darkModeChange",function(g){return t.handleDarkModeChange(g)}),o.nrm(1,"path",1),o.k0s())},dependencies:[_.R],styles:["[_nghost-%COMP%]{display:block}svg[_ngcontent-%COMP%]{flex:1;display:block;width:100%;height:auto}"]})}return m})()},6170(D,p,a){a.d(p,{R:()=>_});var r=a(7705),n=a(5802),o=a(2271),M=a(5547);let _=(()=>{class u{destroyRef=(0,n.WQX)(n.abz);_isDarkMode=(0,n.vPA)(this.hasDarkClass());isDarkMode=(0,o.EW)(()=>this._isDarkMode());darkModeChange=(0,r.CGW)();constructor(){const f=new MutationObserver(e=>{e.forEach(s=>{if("attributes"===s.type&&"class"===s.attributeName){const t=this.hasDarkClass();t!==this._isDarkMode()&&this._isDarkMode.set(t)}})});f.observe(document.body,{attributes:!0,attributeFilter:["class"]}),this.destroyRef.onDestroy(()=>f.disconnect()),(0,n.QZP)(()=>{this.darkModeChange.emit(this._isDarkMode()),document.documentElement.style.colorScheme=this._isDarkMode()?"dark":"light"})}hasDarkClass(){return document.body.classList.contains("dark")}toggleDarkMode(){document.body.classList.toggle("dark")}static \u0275fac=function(e){return new(e||u)};static \u0275dir=M.FsC({type:u,selectors:[["","cueDarkMode",""]],outputs:{darkModeChange:"darkModeChange"},exportAs:["darkModeDetector"]})}return u})()}}]);
package/645.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkcue_ui=self.webpackChunkcue_ui||[]).push([[613,645],{4613(R,M,a){a.d(M,{Logo:()=>d});var c=a(7705),n=a(5802),s=a(5547),u=a(2271),y=a(6170);let d=(()=>{class h{size=(0,c.hFB)("m");sizeMap={xs:"40px",s:"80px",m:"160px",l:"222px"};active=(0,c.hFB)(!0,{transform:c.L39});continuous=(0,c.hFB)(!1,{transform:c.L39});mode=(0,c.hFB)("default");isDarkMode=(0,c.geq)(!1);handleDarkModeChange(e){this.isDarkMode.set(e),-1===this.raf&&this.animate()}colorA=(0,u.EW)(()=>this.isDarkMode()?[221,246,18]:[18,28,43]);colorB=[0,202,204];paths=[];raf=-1;appearTime=0;disappearTime=0;tip=0;toe=0;mix=[0,0,0];norm=0;animate=e=>{if(void 0!==e){const o=5e-4*(e-this.appearTime);"glow"===this.mode()?this.tip=o%1:(this.tip=Math.min(1,o),this.active()||(this.toe=Math.min(1,6e-4*(e-this.disappearTime))))}if("glow"===this.mode()){const o=.06666666666666667,t=this.rgbToSvg(this.colorA());return this.paths.forEach((i,l)=>{this.norm=1/this.paths.length*l;let r=this.tip-this.norm;if(r<-(1-o)&&(r+=1),r>=0&&r<o){const p=1-r/o;i.setAttribute("stroke",this.rgbToSvg(this.colorB)),i.setAttribute("stroke-opacity",p.toFixed(3))}else i.setAttribute("stroke",t),i.setAttribute("stroke-opacity","0.005")}),void(this.raf=requestAnimationFrame(this.animate))}if(this.paths.forEach((o,t)=>{this.norm=1/this.paths.length*t,this.mix=this.mixRgb(this.colorA(),this.colorB,Math.max(0,Math.min(1,15*(this.tip-this.norm)))),o.setAttribute("stroke",this.tip*this.paths.length>t&&(this.active()||this.toe*this.paths.length<t)?this.rgbToSvg(this.mix):"transparent")}),this.tip>=1&&(this.active()||this.toe>=1))return this.continuous()?void setTimeout(()=>{this.appearTime=performance.now(),this.tip=0,this.toe=0,this.raf=requestAnimationFrame(this.animate)},500):void(this.raf=-1);this.raf=requestAnimationFrame(this.animate)};activate(){this.appearTime=performance.now(),this.animate(this.appearTime)}deactivate(){this.disappearTime=performance.now(),-1===this.raf&&this.animate(this.disappearTime)}mixChannel(e,o,t){return parseInt((e*t+o*(1-t)).toFixed())}mixRgb(e,o,t){return[this.mixChannel(e[0],o[0],t),this.mixChannel(e[1],o[1],t),this.mixChannel(e[2],o[2],t)]}rgbToSvg(e){return`rgb(${e[0]},${e[1]},${e[2]})`}constructor(){(0,n.QZP)(()=>{"glow"===this.mode()||this.active()?this.activate():this.deactivate()}),(0,n.QZP)(()=>{this.isDarkMode(),this.animate()});const e=(0,n.WQX)(s.aKT);(0,s.mal)({read:()=>{if(this.paths.length)return;const o=e.nativeElement.querySelector("svg"),t=e.nativeElement.querySelector("#original-path");if(!t)return;const i=t.getTotalLength(),r=[];for(let p=0;p<400;p++){const g=t.getPointAtLength(i/400*p);r.push({x:parseFloat(g.x.toFixed(2)),y:parseFloat(g.y.toFixed(2))})}r.push(t.getPointAtLength(i)),r.reverse(),r.forEach((p,g)=>{if(0===g||1===g)return;const f=document.createElementNS("http://www.w3.org/2000/svg","path");f.setAttribute("d",`M${r[g-2].x},${r[g-2].y}L${r[g-1].x},${r[g-1].y}L${p.x},${p.y}`),f.setAttribute("fill","none"),f.setAttribute("stroke","transparent"),f.setAttribute("stroke-width",t?.getAttribute("stroke-width")||"1"),f.setAttribute("stroke-miterlimit",t?.getAttribute("stroke-miterlimit")||"1"),o.appendChild(f),this.paths.push(f)})}})}ngOnDestroy(){this.paths=[],cancelAnimationFrame(this.raf),this.raf=-1}static \u0275fac=function(o){return new(o||h)};static \u0275cmp=s.VBU({type:h,selectors:[["cue-logo"]],hostVars:2,hostBindings:function(o,t){2&o&&s.xc7("width",t.sizeMap[t.size()])},inputs:{size:[1,"size"],active:[1,"active"],continuous:[1,"continuous"],mode:[1,"mode"],isDarkMode:[1,"isDarkMode"]},outputs:{isDarkMode:"isDarkModeChange"},decls:2,vars:0,consts:[["cueDarkMode","","xmlns","http://www.w3.org/2000/svg","viewBox","0 0 221.545 86.191","width","222","height","86","overflow","visible",3,"darkModeChange"],["id","original-path","fill","none","stroke","transparent","stroke-miterlimit","10","stroke-width","12","d","M216.046 56.638s-10.561 24.201-36.192 22.991c-25.631-1.21-22.771-24.751-20.351-37.622 2.42-12.871 10.451-20.351 16.831-18.041 6.283 2.275 8.03 9.68 2.09 21.891-5.94 12.211-21.341 37.567-35.862 33.992-12.413-3.056-13.281-23.162-13.281-23.162V29.762v26.925c0 14.471-12.47 23.212-24.672 23.212s-24.672-8.301-24.672-23.212V29.829l-.006.105v13.031c0 20.416-16.55 36.966-36.966 36.966S6 63.381 6 42.966 22.55 6 42.966 6c6.91 0 13.377 1.896 18.91 5.196"]],template:function(o,t){1&o&&(n.qSk(),s.j41(0,"svg",0),s.bIt("darkModeChange",function(l){return t.handleDarkModeChange(l)}),s.nrm(1,"path",1),s.k0s())},dependencies:[y.R],styles:["[_nghost-%COMP%]{display:block}svg[_ngcontent-%COMP%]{flex:1;display:block;width:100%;height:auto}"]})}return h})()},3191(R,M,a){a.d(M,{g:()=>s});var c=a(467),n=a(5802);let s=(()=>{class u{searchPage(d,h,m){return(0,c.A)(function*(){if(!m||!m.trim())return[];const e=m.toLowerCase(),o=yield d.getPage(h),t=o.getViewport({scale:1}),l=(yield o.getTextContent()).items,r=[];let p="";const g=[],f=[];for(let _=0;_<l.length;_++){const D=l[_].str??"";for(let v=0;v<D.length;v++)p+=D[v],g.push(_),f.push(v)}const U=p.toLowerCase();let A=0;for(;A<U.length;){const _=U.indexOf(e,A);if(-1===_)break;const K=_+e.length-1;A=_+1;const D=new Set;for(let L=_;L<=K;L++)D.add(g[L]);let v=1/0,E=1/0,b=-1/0,w=-1/0;for(const L of D){const B=l[L],[x,W,q,z,k,C]=B.transform,P=B.width??0,O=B.height??Math.abs(x||z||12),T=Math.sqrt(x*x+W*W)||1,Q=x/T,X=W/T,j=q/T,H=z/T,ot=[[k,C],[k+Q*P,C+X*P],[k+Q*P+j*O,C+X*P+H*O],[k+j*O,C+H*O]];for(const[st,at]of ot){const[G,Z]=t.convertToViewportPoint(st,at);v=Math.min(v,G),E=Math.min(E,Z),b=Math.max(b,G),w=Math.max(w,Z)}}const F=t.width,I=t.height,V=.005*F,$=.005*I,J=(E-$)/I*100,S=(b-v+2*V)/F*100,N=(w-E+2*$)/I*100;S>0&&N>0&&r.push({page:h,xywhStr:`percent:${((v-V)/F*100).toFixed(2)},${J.toFixed(2)},${S.toFixed(2)},${N.toFixed(2)}`})}return r})()}searchAll(d,h){var m=this;return(0,c.A)(function*(){if(!h||!h.trim())return[];const e=d.numPages,o=[];for(let t=1;t<=e;t++){const i=yield m.searchPage(d,t,h);o.push(...i)}return o})()}static \u0275fac=function(h){return new(h||u)};static \u0275prov=n.jDH({token:u,factory:u.\u0275fac,providedIn:"root"})}return u})()},6170(R,M,a){a.d(M,{R:()=>y});var c=a(7705),n=a(5802),s=a(2271),u=a(5547);let y=(()=>{class d{destroyRef=(0,n.WQX)(n.abz);_isDarkMode=(0,n.vPA)(this.hasDarkClass());isDarkMode=(0,s.EW)(()=>this._isDarkMode());darkModeChange=(0,c.CGW)();constructor(){const m=new MutationObserver(e=>{e.forEach(o=>{if("attributes"===o.type&&"class"===o.attributeName){const t=this.hasDarkClass();t!==this._isDarkMode()&&this._isDarkMode.set(t)}})});m.observe(document.body,{attributes:!0,attributeFilter:["class"]}),this.destroyRef.onDestroy(()=>m.disconnect()),(0,n.QZP)(()=>{this.darkModeChange.emit(this._isDarkMode()),document.documentElement.style.colorScheme=this._isDarkMode()?"dark":"light"})}hasDarkClass(){return document.body.classList.contains("dark")}toggleDarkMode(){document.body.classList.toggle("dark")}static \u0275fac=function(e){return new(e||d)};static \u0275dir=u.FsC({type:d,selectors:[["","cueDarkMode",""]],outputs:{darkModeChange:"darkModeChange"},exportAs:["darkModeDetector"]})}return d})()},7851(R,M,a){a.d(M,{k:()=>m});var c=a(7705),n=a(5802),s=a(5547),u=a(4613),y=a(2245);function d(e,o){if(1&e&&(s.j41(0,"cue-typography",1),s.EFF(1),s.k0s()),2&e){const t=s.XpG();s.R7$(),s.JRh(t.message)}}let h=(()=>{class e{message="";static \u0275fac=function(i){return new(i||e)};static \u0275cmp=s.VBU({type:e,selectors:[["cue-logo-loader-overlay"]],decls:2,vars:1,consts:[["size","m","mode","glow"],["size","s",1,"message"]],template:function(i,l){1&i&&(s.nrm(0,"cue-logo",0),s.nVh(1,d,2,1,"cue-typography",1)),2&i&&(s.R7$(),s.vxM(l.message?1:-1))},dependencies:[u.Logo,y.Typography],styles:["[_nghost-%COMP%]{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.75rem;z-index:1000}.message[_ngcontent-%COMP%]{color:var(--color-text-secondary)}"],changeDetection:0})}return e})(),m=(()=>{class e{cueLogoLoader=(0,c.hFB)(!1);cueLogoLoaderMessage=(0,c.hFB)("");el=(0,n.WQX)(s.aKT);appRef=(0,n.WQX)(s.o8S);envInjector=(0,n.WQX)(n.uvJ);renderer=(0,n.WQX)(s.sFG);overlayRef;constructor(){(0,n.QZP)(()=>{const t=this.cueLogoLoader(),i=this.cueLogoLoaderMessage();t?(this.overlayRef||this.createOverlay(),this.overlayRef&&(this.overlayRef.instance.message=i,this.overlayRef.changeDetectorRef.markForCheck())):this.destroyOverlay()})}createOverlay(){this.overlayRef=(0,c.a0P)(h,{environmentInjector:this.envInjector}),this.appRef.attachView(this.overlayRef.hostView),this.renderer.appendChild(this.el.nativeElement,this.overlayRef.hostView.rootNodes[0])}destroyOverlay(){this.overlayRef&&(this.appRef.detachView(this.overlayRef.hostView),this.overlayRef.destroy(),this.overlayRef=void 0)}ngOnDestroy(){this.destroyOverlay()}static \u0275fac=function(i){return new(i||e)};static \u0275dir=s.FsC({type:e,selectors:[["","cueLogoLoader",""]],hostVars:2,hostBindings:function(i,l){2&i&&s.xc7("position","relative")},inputs:{cueLogoLoader:[1,"cueLogoLoader"],cueLogoLoaderMessage:[1,"cueLogoLoaderMessage"]}})}return e})()}}]);
package/741.js CHANGED
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkcue_ui=self.webpackChunkcue_ui||[]).push([[741],{1741($,p,c){c.r(p),c.d(p,{DocumentViewer:()=>E});var v=c(467),b=c(9769),r=c(5802),l=c(7705),f=c(2271),s=c(5547),m=c(3418),P=c(8807),R=c(2065);const w=["*"];let D=(()=>{class o{width=(0,l.hFB)("auto");height=(0,l.hFB)("auto");style=(0,l.hFB)("");getStyles=(0,f.EW)(()=>this.style());static \u0275fac=function(n){return new(n||o)};static \u0275cmp=s.VBU({type:o,selectors:[["cue-container"]],hostVars:6,hostBindings:function(n,i){2&n&&(s.Aen(i.getStyles()),s.xc7("max-width",i.width())("max-height",i.height()))},inputs:{width:[1,"width"],height:[1,"height"],style:[1,"style"]},ngContentSelectors:w,decls:1,vars:0,template:function(n,i){1&n&&(s.NAR(),s.SdG(0))},styles:["[_nghost-%COMP%]{display:flex;align-items:stretch;container-name:cue-container;container-type:inline-size}[_nghost-%COMP%] > *[_ngcontent-%COMP%]{flex:1;max-width:100%}"]})}return o})();var M=c(2245),T=c(5381),C=c(5971),I=c(3319),N=c(5448),B=c(2014),S=c(3191);let V=(()=>{class o{searchService=(0,r.WQX)(S.g);entityBeingPlaced=(0,r.vPA)(void 0);confirmedPlacement=(0,r.vPA)(void 0);rdfBaseURL=(0,r.vPA)("");contentUUID=(0,r.vPA)("");activePdfDoc=(0,r.vPA)(null);currentPage=(0,r.vPA)(1);requestedPage=(0,r.vPA)(null);navigateToPage(e){this.currentPage.set(e),this.requestedPage.set(e)}entityTextSearchResults=(0,r.vPA)([]);entityTextSearchResultsOnCurrentPage=(0,f.EW)(()=>this.entityTextSearchResults().filter(e=>e.page===this.currentPage()));currentPlacementBbox=(0,r.vPA)(null);categoryPreviewBoxes=(0,r.vPA)([]);_lastMatchIndex=(0,r.vPA)(null);matchCycleDisplay=(0,f.EW)(()=>{const e=this._lastMatchIndex(),n=this.entityTextSearchResultsOnCurrentPage().length;return null===e||0===n?"":`${e+1}/${n}`});cycleTextMatch(){const e=this.entityTextSearchResultsOnCurrentPage();if(!e.length)return;const n=this._lastMatchIndex(),i=null===n?0:(n+1)%e.length;this._lastMatchIndex.set(i);const t=e[i].xywhStr.replace("percent:",""),[h,g,a,u]=t.split(",").map(Number),y=Math.max(0,h-.5),x=Math.max(0,g-.5),O=Math.min(100-y,a+1),U=Math.min(100-x,u+1);this.currentPlacementBbox.set({xywhStr:`percent:${y.toFixed(2)},${x.toFixed(2)},${O.toFixed(2)},${U.toFixed(2)}`,color:"rgba(255, 160, 0, 0.9)",allowRemove:!1})}setManualBbox(e){this._lastMatchIndex.set(null),this.currentPlacementBbox.set({...e,allowRemove:!1})}clearPlacement(){this.currentPlacementBbox.set(null),this._lastMatchIndex.set(null)}constructor(){(0,r.QZP)(()=>{const e=this.entityBeingPlaced(),n=this.activePdfDoc();e?.value&&n?this.searchService.searchAll(n,e.value).then(i=>{this.entityTextSearchResults.set(i)}):this.entityTextSearchResults.set([])}),(0,r.QZP)(()=>{this.currentPage(),this._lastMatchIndex.set(null),this.currentPlacementBbox.set(null)}),(0,r.QZP)(()=>{const e=this.entityBeingPlaced();this._lastMatchIndex.set(null),void 0===e&&this.currentPlacementBbox.set(null)})}static \u0275fac=function(n){return new(n||o)};static \u0275prov=r.jDH({token:o,factory:o.\u0275fac,providedIn:"root"})}return o})();var F=c(9352);const A=["viewerTarget"];function j(o,L){if(1&o){const e=s.RV6();s.j41(0,"cue-flexcontainer",2)(1,"cue-typography"),s.EFF(2),s.nI1(3,"transloco"),s.k0s(),s.j41(4,"cue-button",3),s.bIt("click",function(){r.eBV(e);const i=s.XpG();return r.Njj(i.downloadFile())}),s.j41(5,"cue-button-padder"),s.nrm(6,"cue-button-icon",4),s.k0s(),s.j41(7,"cue-button-label"),s.EFF(8),s.nI1(9,"transloco"),s.k0s()()()}2&o&&(s.R7$(2),s.JRh(s.bMT(3,2,"components.documentViewer.infoNoViewer")),s.R7$(6),s.JRh(s.bMT(9,4,"common.buttons.download")))}let E=(()=>{class o{_eps=(0,r.WQX)(V);_destroyed=!1;url=l.hFB.required();suffix=(0,l.hFB)();settings=(0,l.hFB)(new m.DocumentViewerSettings);viewerTypeOverride=(0,l.hFB)(void 0);interactions=(0,l.CGW)();viewerType=(0,f.EW)(()=>{const e=this.viewerTypeOverride();if(e)return e;const n=this.url(),i=void 0!==this.suffix()?this.suffix()?.trim():`.${n.split(".").pop()?.trim()}`,t=i?m.extViewerMap.get(i):void 0;return console.log("[DocumentViewer] viewerType resolved",{url:n?.substring(0,80),suffix:i,viewerType:t}),void 0!==i?t:void 0});currentComponent=(0,r.vPA)(null);noViewer=(0,f.EW)(()=>null===this.currentComponent());viewerTarget;currentRef;_interactionsState=(0,r.vPA)(new m.DocumentViewerInteractions);constructor(){(0,r.QZP)(()=>{const e=this.viewerType(),n=this.url();console.log("[DocumentViewer] url/viewerType effect \u2014",{viewerType:e,url:n?.substring(0,80),destroyed:this._destroyed}),e?("pdf"!==e&&this._eps.activePdfDoc.set(null),this.loadViewerComponent(e,n,this.settings())):(this.viewerTarget.clear(),this.currentRef?.destroy(),this.currentRef=void 0,console.info("No viewer available for this file type"),this.currentComponent.set(null),this._eps.activePdfDoc.set(null))}),(0,r.QZP)(()=>{this.interactions.emit(this._interactionsState())}),(0,r.QZP)(()=>{const e=this.settings().pdf,n=this.currentRef;n&&n.setInput("settings",e)})}ngOnDestroy(){this._destroyed=!0,this.viewerTarget.clear(),this.currentRef?.destroy(),this.currentRef=void 0}loadViewerComponent(e,n,i){var t=this;return(0,v.A)(function*(){console.log("[DocumentViewer] loadViewerComponent",{viewerType:e,url:n?.substring(0,100)});try{const h=m.viewerComponents[e],g=yield h();if(t._destroyed)return;if(t.currentComponent.set(g),t.viewerTarget.clear(),t.currentRef?.destroy(),t.currentRef=t.viewerTarget.createComponent(g),"pdf"===e)t.currentRef.setInput("src",n),void 0!==i?.pdf&&t.currentRef.setInput("settings",i.pdf),t.currentRef.instance.pdfLoaded&&t.currentRef.instance.pdfLoaded.subscribe(a=>{t._eps.currentPage.set(1),t._eps.activePdfDoc.set(a)}),t.currentRef.instance.settingsChange&&t.currentRef.instance.settingsChange.subscribe(a=>{const u=parseInt(a?.page,10);!isNaN(u)&&u>0&&t._eps.currentPage.set(u)}),t.currentRef.instance.artefactDrawn&&t.currentRef.instance.artefactDrawn.subscribe(a=>{"xywh"===a.type&&t._eps.setManualBbox(a.def)}),t.currentRef.instance.artefactEdited&&t.currentRef.instance.artefactEdited.subscribe(a=>{"bbox"===a.type&&t._eps.setManualBbox(a.after)});else if("bim"===e){const a=new P.di("model","Model",n);a.visible=!0,t.currentRef.setInput("data",{models:[a]}),void 0!==i?.bim&&t.currentRef.setInput("settings",i.bim),t.currentRef.instance.selectedElements&&t.currentRef.instance.selectedElements.subscribe(u=>{t._interactionsState.update(d=>(d.bim.selectedElements=u,Object.assign({},d)))}),t.currentRef.instance.clickedElement&&t.currentRef.instance.clickedElement.subscribe(u=>{t._interactionsState.update(d=>(d.bim.clickedElement=u,Object.assign({},d)))})}else if("cad"===e)t.currentRef.setInput("fileURL",n),void 0!==i?.cad&&t.currentRef.setInput("settings",i.cad);else if("image"===e)t.currentRef.setInput("src",n);else if("markdown"===e)t.currentRef.setInput("fileURL",n);else if("text"===e)t.currentRef.setInput("fileURL",n);else if("spreadsheet"===e){const a=t.suffix()?.split(".").pop()||n.split(".").pop()||"csv";t.currentRef.setInput("data",{url:n,format:a})}else if("code"===e){const d={".json":"json",".jsonld":"jsonld",".xml":"xml",".html":"xml",".htm":"xml",".css":"text",".js":"text",".sh":"text"}[t.suffix()??`.${n.split(".").pop()??""}`]??"text";t.currentRef.setInput("fileURL",n),t.currentRef.setInput("codeType",d)}else"email"===e&&t.currentRef.setInput("fileURL",n)}catch(h){console.error("Failed to load viewer component:",h),t.currentComponent.set(null)}})()}downloadFile(){var e=this;return(0,v.A)(function*(){const i=yield(yield fetch(e.url())).blob();(0,R.KE)(i,`document${e.suffix()??""}`)})()}static \u0275fac=function(n){return new(n||o)};static \u0275cmp=s.VBU({type:o,selectors:[["cue-doc-viewer"]],viewQuery:function(n,i){if(1&n&&s.GBs(A,7,s.c1b),2&n){let t;s.mGM(t=s.lsd())&&(i.viewerTarget=t.first)}},inputs:{url:[1,"url"],suffix:[1,"suffix"],settings:[1,"settings"],viewerTypeOverride:[1,"viewerTypeOverride"]},outputs:{interactions:"interactions"},decls:4,vars:1,consts:[["viewerTarget",""],[2,"height","100%","width","100%"],["direction","column","align","center","justify","center",2,"height","100%","width","100%"],[3,"click"],["icon","download"]],template:function(n,i){1&n&&(s.j41(0,"cue-container",1),s.eu8(1,null,0),s.nVh(3,j,10,6,"cue-flexcontainer",2),s.k0s()),2&n&&(s.R7$(3),s.vxM(i.noViewer()?3:-1))},dependencies:[b.MD,D,M.Typography,T.n,C.$,I.a,N.L,B.z,F.Kj],styles:["[_nghost-%COMP%]{display:contents}"],changeDetection:0})}return o})()}}]);
1
+ "use strict";(self.webpackChunkcue_ui=self.webpackChunkcue_ui||[]).push([[741],{1741($,v,o){o.r(v),o.d(v,{DocumentViewer:()=>E});var p=o(467),b=o(9769),r=o(5802),l=o(7705),f=o(2271),s=o(5547),g=o(3418),P=o(8807),R=o(2065);const D=["*"];let M=(()=>{class c{width=(0,l.hFB)("auto");height=(0,l.hFB)("auto");style=(0,l.hFB)("");getStyles=(0,f.EW)(()=>this.style());static \u0275fac=function(n){return new(n||c)};static \u0275cmp=s.VBU({type:c,selectors:[["cue-container"]],hostVars:6,hostBindings:function(n,i){2&n&&(s.Aen(i.getStyles()),s.xc7("max-width",i.width())("max-height",i.height()))},inputs:{width:[1,"width"],height:[1,"height"],style:[1,"style"]},ngContentSelectors:D,decls:1,vars:0,template:function(n,i){1&n&&(s.NAR(),s.SdG(0))},styles:["[_nghost-%COMP%]{display:flex;align-items:stretch;container-name:cue-container;container-type:inline-size}[_nghost-%COMP%] > *[_ngcontent-%COMP%]{flex:1;max-width:100%}"]})}return c})();var w=o(2245),T=o(5381),N=o(5971),C=o(3319),I=o(5448),B=o(2014),S=o(7851),V=o(3191);let L=(()=>{class c{searchService=(0,r.WQX)(V.g);entityBeingPlaced=(0,r.vPA)(void 0);confirmedPlacement=(0,r.vPA)(void 0);rdfBaseURL=(0,r.vPA)("");contentUUID=(0,r.vPA)("");activePdfDoc=(0,r.vPA)(null);currentPage=(0,r.vPA)(1);requestedPage=(0,r.vPA)(null);navigateToPage(e){this.currentPage.set(e),this.requestedPage.set(e)}entityTextSearchResults=(0,r.vPA)([]);entityTextSearchResultsOnCurrentPage=(0,f.EW)(()=>this.entityTextSearchResults().filter(e=>e.page===this.currentPage()));currentPlacementBbox=(0,r.vPA)(null);categoryPreviewBoxes=(0,r.vPA)([]);_lastMatchIndex=(0,r.vPA)(null);matchCycleDisplay=(0,f.EW)(()=>{const e=this._lastMatchIndex(),n=this.entityTextSearchResultsOnCurrentPage().length;return null===e||0===n?"":`${e+1}/${n}`});cycleTextMatch(){const e=this.entityTextSearchResultsOnCurrentPage();if(!e.length)return;const n=this._lastMatchIndex(),i=null===n?0:(n+1)%e.length;this._lastMatchIndex.set(i);const t=e[i].xywhStr.replace("percent:",""),[h,m,a,u]=t.split(",").map(Number),y=Math.max(0,h-.5),x=Math.max(0,m-.5),O=Math.min(100-y,a+1),U=Math.min(100-x,u+1);this.currentPlacementBbox.set({xywhStr:`percent:${y.toFixed(2)},${x.toFixed(2)},${O.toFixed(2)},${U.toFixed(2)}`,color:"rgba(255, 160, 0, 0.9)",allowRemove:!1})}setManualBbox(e){this._lastMatchIndex.set(null),this.currentPlacementBbox.set({...e,allowRemove:!1})}clearPlacement(){this.currentPlacementBbox.set(null),this._lastMatchIndex.set(null)}constructor(){(0,r.QZP)(()=>{const e=this.entityBeingPlaced(),n=this.activePdfDoc();e?.value&&n?this.searchService.searchAll(n,e.value).then(i=>{this.entityTextSearchResults.set(i)}):this.entityTextSearchResults.set([])}),(0,r.QZP)(()=>{this.currentPage(),this._lastMatchIndex.set(null),this.currentPlacementBbox.set(null)}),(0,r.QZP)(()=>{const e=this.entityBeingPlaced();this._lastMatchIndex.set(null),void 0===e&&this.currentPlacementBbox.set(null)})}static \u0275fac=function(n){return new(n||c)};static \u0275prov=r.jDH({token:c,factory:c.\u0275fac,providedIn:"root"})}return c})();var F=o(9352);const A=["viewerTarget"];function j(c,Q){if(1&c){const e=s.RV6();s.j41(0,"cue-flexcontainer",2)(1,"cue-typography"),s.EFF(2),s.nI1(3,"transloco"),s.k0s(),s.j41(4,"cue-button",3),s.bIt("click",function(){r.eBV(e);const i=s.XpG();return r.Njj(i.downloadFile())}),s.j41(5,"cue-button-padder"),s.nrm(6,"cue-button-icon",4),s.k0s(),s.j41(7,"cue-button-label"),s.EFF(8),s.nI1(9,"transloco"),s.k0s()()()}2&c&&(s.R7$(2),s.JRh(s.bMT(3,2,"components.documentViewer.infoNoViewer")),s.R7$(6),s.JRh(s.bMT(9,4,"common.buttons.download")))}let E=(()=>{class c{_eps=(0,r.WQX)(L);_destroyed=!1;url=l.hFB.required();suffix=(0,l.hFB)();settings=(0,l.hFB)(new g.DocumentViewerSettings);viewerTypeOverride=(0,l.hFB)(void 0);interactions=(0,l.CGW)();viewerType=(0,f.EW)(()=>{const e=this.viewerTypeOverride();if(e)return e;const n=this.url(),i=void 0!==this.suffix()?this.suffix()?.trim():`.${n.split(".").pop()?.trim()}`,t=i?g.extViewerMap.get(i):void 0;return console.log("[DocumentViewer] viewerType resolved",{url:n?.substring(0,80),suffix:i,viewerType:t}),void 0!==i?t:void 0});currentComponent=(0,r.vPA)(null);noViewer=(0,f.EW)(()=>null===this.currentComponent());isLoading=(0,r.vPA)(!1);viewerTarget;currentRef;_interactionsState=(0,r.vPA)(new g.DocumentViewerInteractions);constructor(){(0,r.QZP)(()=>{const e=this.viewerType(),n=this.url();console.log("[DocumentViewer] url/viewerType effect \u2014",{viewerType:e,url:n?.substring(0,80),destroyed:this._destroyed}),e?("pdf"!==e&&this._eps.activePdfDoc.set(null),this.isLoading.set(!0),this.loadViewerComponent(e,n,this.settings())):(this.viewerTarget.clear(),this.currentRef?.destroy(),this.currentRef=void 0,console.info("No viewer available for this file type"),this.currentComponent.set(null),this.isLoading.set(!1),this._eps.activePdfDoc.set(null))}),(0,r.QZP)(()=>{this.interactions.emit(this._interactionsState())}),(0,r.QZP)(()=>{const e=this.settings().pdf,n=this.currentRef;n&&n.setInput("settings",e)})}ngOnDestroy(){this._destroyed=!0,this.viewerTarget.clear(),this.currentRef?.destroy(),this.currentRef=void 0}loadViewerComponent(e,n,i){var t=this;return(0,p.A)(function*(){console.log("[DocumentViewer] loadViewerComponent",{viewerType:e,url:n?.substring(0,100)});try{const h=g.viewerComponents[e],m=yield h();if(t._destroyed)return;if(t.currentComponent.set(m),t.isLoading.set(!1),t.viewerTarget.clear(),t.currentRef?.destroy(),t.currentRef=t.viewerTarget.createComponent(m),"pdf"===e)t.currentRef.setInput("src",n),void 0!==i?.pdf&&t.currentRef.setInput("settings",i.pdf),t.currentRef.instance.pdfLoaded&&t.currentRef.instance.pdfLoaded.subscribe(a=>{t._eps.currentPage.set(1),t._eps.activePdfDoc.set(a)}),t.currentRef.instance.settingsChange&&t.currentRef.instance.settingsChange.subscribe(a=>{const u=parseInt(a?.page,10);!isNaN(u)&&u>0&&t._eps.currentPage.set(u)}),t.currentRef.instance.artefactDrawn&&t.currentRef.instance.artefactDrawn.subscribe(a=>{"xywh"===a.type&&t._eps.setManualBbox(a.def)}),t.currentRef.instance.artefactEdited&&t.currentRef.instance.artefactEdited.subscribe(a=>{"bbox"===a.type&&t._eps.setManualBbox(a.after)});else if("bim"===e){const a=new P.di("model","Model",n);a.visible=!0,t.currentRef.setInput("data",{models:[a]}),void 0!==i?.bim&&t.currentRef.setInput("settings",i.bim),t.currentRef.instance.selectedElements&&t.currentRef.instance.selectedElements.subscribe(u=>{t._interactionsState.update(d=>(d.bim.selectedElements=u,Object.assign({},d)))}),t.currentRef.instance.clickedElement&&t.currentRef.instance.clickedElement.subscribe(u=>{t._interactionsState.update(d=>(d.bim.clickedElement=u,Object.assign({},d)))})}else if("cad"===e)t.currentRef.setInput("fileURL",n),void 0!==i?.cad&&t.currentRef.setInput("settings",i.cad);else if("image"===e)t.currentRef.setInput("src",n);else if("markdown"===e)t.currentRef.setInput("fileURL",n);else if("text"===e)t.currentRef.setInput("fileURL",n);else if("spreadsheet"===e){const a=t.suffix()?.split(".").pop()||n.split(".").pop()||"csv";t.currentRef.setInput("data",{url:n,format:a})}else if("code"===e){const d={".json":"json",".jsonld":"jsonld",".xml":"xml",".html":"xml",".htm":"xml",".css":"text",".js":"text",".sh":"text"}[t.suffix()??`.${n.split(".").pop()??""}`]??"text";t.currentRef.setInput("fileURL",n),t.currentRef.setInput("codeType",d)}else"email"===e&&t.currentRef.setInput("fileURL",n)}catch(h){console.error("Failed to load viewer component:",h),t.currentComponent.set(null)}})()}downloadFile(){var e=this;return(0,p.A)(function*(){const i=yield(yield fetch(e.url())).blob();(0,R.KE)(i,`document${e.suffix()??""}`)})()}static \u0275fac=function(n){return new(n||c)};static \u0275cmp=s.VBU({type:c,selectors:[["cue-doc-viewer"]],viewQuery:function(n,i){if(1&n&&s.GBs(A,7,s.c1b),2&n){let t;s.mGM(t=s.lsd())&&(i.viewerTarget=t.first)}},inputs:{url:[1,"url"],suffix:[1,"suffix"],settings:[1,"settings"],viewerTypeOverride:[1,"viewerTypeOverride"]},outputs:{interactions:"interactions"},decls:4,vars:2,consts:[["viewerTarget",""],[2,"height","100%","width","100%",3,"cueLogoLoader"],["direction","column","align","center","justify","center",2,"height","100%","width","100%"],[3,"click"],["icon","download"]],template:function(n,i){1&n&&(s.j41(0,"cue-container",1),s.eu8(1,null,0),s.nVh(3,j,10,6,"cue-flexcontainer",2),s.k0s()),2&n&&(s.Y8G("cueLogoLoader",i.isLoading()),s.R7$(3),s.vxM(!i.isLoading()&&i.noViewer()?3:-1))},dependencies:[b.MD,M,w.Typography,T.n,N.$,C.a,I.L,B.z,S.k,F.Kj],styles:["[_nghost-%COMP%]{display:contents}"],changeDetection:0})}return c})()}}]);