import{Host,h}from"@stencil/core";import{service,SubscriptionList,ProductInfoContextService,SecurityContextService,TrackingService,LicenseContextService,WindowService}from"../../../../../api/dist/ontotext-workbench-api";export class OntoFooter{constructor(){this.subscriptions=new SubscriptionList,this.currentYear=(new Date).getFullYear(),this.productInfoContextService=service(ProductInfoContextService),this.securityContextService=service(SecurityContextService),this.licenseContextService=service(LicenseContextService),this.trackingService=service(TrackingService)}handleConsentGiven(){this.trackingService.acceptCookiePolicy().then(()=>{this.shouldShowCookieConsent=!1,WindowService.getWindow().dispatchEvent(new Event("resize"))})}render(){var e,t,o,i,n;return h(Host,{key:"47be218619f0a76fd507978d590a83aa5bad97eb"},h("div",{key:"71f48b2c8500bb623f71ede4957dae90721b57aa",class:"footer-component"},h("a",{key:"fbe9efacce3147044382f1750106f9a6ac31bab4",href:"http://graphdb.ontotext.com",target:"_blank",rel:"noopener noreferrer"},"GraphDB")," ",null===(e=this.productInfo)||void 0===e?void 0:e.productVersion," • ",h("a",{key:"1af39dd6cb16aaeea8714f1f2c43865322524d90",href:"http://rdf4j.org",target:"_blank",rel:"noopener noreferrer"},"RDF4J")," ",null===(t=this.productInfo)||void 0===t?void 0:t.sesame," • Connectors ",null===(o=this.productInfo)||void 0===o?void 0:o.connectors," • Ontop ",null===(i=this.productInfo)||void 0===i?void 0:i.ontop," • Workbench ",null===(n=this.productInfo)||void 0===n?void 0:n.workbench," • © 2002–",this.currentYear," ",h("a",{key:"b2f7bb5d7928b01000e7a32013a619f9c231fdff",href:"http://ontotext.com",target:"_blank",rel:"noopener noreferrer"},"Ontotext AD"),". ",h("translate-label",{key:"35d325c2cd86cd6811cc06d62d47ee8983a50422",labelKey:"footer.label.all_rights_reserved"})),this.shouldShowCookieConsent&&h("onto-cookie-consent",{key:"5e95b5341f0573399710c45bbd33044d9c8b1744"}))}connectedCallback(){this.subscribeToProductInfoChange(),this.subscribeToUserChange(),this.subscribeToLicenseChange(),this.subscribeToUserLoginStatusChange()}disconnectedCallback(){this.subscriptions.unsubscribeAll()}subscribeToProductInfoChange(){this.subscriptions.add(this.productInfoContextService.onProductInfoChanged(e=>{this.productInfo=e}))}subscribeToUserChange(){this.subscriptions.add(this.securityContextService.onAuthenticatedUserChanged(()=>{this.setCookieConsentVisibility()}))}subscribeToUserLoginStatusChange(){this.subscriptions.add(this.securityContextService.onUserLoginStatusChanged(()=>{this.setCookieConsentVisibility()}))}setCookieConsentVisibility(){var e,t;if(!this.trackingService.isTrackingAllowed())return void(this.shouldShowCookieConsent=!1);const o=this.securityContextService.getIsLoggedIn(),i=null!==(t=null===(e=this.securityContextService.getSecurityConfig())||void 0===e?void 0:e.isFreeAccessEnabled())&&void 0!==t&&t,n=this.trackingService.getCookieConsent();n&&(this.shouldShowCookieConsent=!n.policyAccepted&&(i||o))}subscribeToLicenseChange(){this.subscriptions.add(this.licenseContextService.onLicenseChanged(()=>{this.setCookieConsentVisibility()}))}static get is(){return"onto-footer"}static get originalStyleUrls(){return{$:["onto-footer.scss"]}}static get styleUrls(){return{$:["onto-footer.css"]}}static get states(){return{productInfo:{},shouldShowCookieConsent:{}}}static get listeners(){return[{name:"consentGiven",method:"handleConsentGiven",target:void 0,capture:!1,passive:!1}]}}