UNPKG

graphdb-workbench

Version:
1 lines 40.2 kB
"use strict";var index=require("./index-jdsA9lN2.js"),resourceSearchConstants=require("./resource-search-constants-nHPm7A9W.js"),workbenchApi=require("@ontotext/workbench-api"),dropdownItemAlignment=require("./dropdown-item-alignment-DD8H-alk.js"),ontoTooltipPlacement=require("./onto-tooltip-placement-CTomd-7A.js"),translation_service=require("./translation.service-CC6jY4U-.js"),htmlUtil=require("./html-util-e108SpX7.js");const ontoLanguageSelectorCss=":host{display:block}onto-language-selector{display:block}onto-language-selector .onto-dropdown{height:100%}onto-language-selector .onto-dropdown.open .onto-dropdown-button{height:fit-content}onto-language-selector .onto-dropdown.closed .onto-dropdown-button{background-color:transparent}onto-language-selector .onto-dropdown.closed .onto-dropdown-button .ri-translate-2{font-size:1.5em}onto-language-selector .onto-dropdown.closed .onto-dropdown-button:hover{background-color:var(--gw-button-secondary-hover-background)}",OntoLanguageSelector=class{constructor(e){index.registerInstance(this,e),this.languageService=workbenchApi.ServiceProvider.get(workbenchApi.LanguageService),this.languageContextService=workbenchApi.ServiceProvider.get(workbenchApi.LanguageContextService),this.items=[],this.dropdownAlignment=dropdownItemAlignment.DropdownItemAlignment.LEFT}connectedCallback(){this.onLanguageChangeSubscription=this.languageContextService.onSelectedLanguageChanged(e=>this.changeLanguage(e)),this.items=this.getLanguageDropdownOptions()}disconnectedCallback(){this.onLanguageChangeSubscription&&this.onLanguageChangeSubscription()}render(){var e,t;return index.h(index.Host,{key:"faabdc9c474b053c32f4ae2c45cd79bd6166a255"},index.h("onto-dropdown",{key:"43e4e0ce38718186c585639fa6ff31873b8fa093",class:"onto-language-selector",onValueChanged:this.valueChangeHandler(),dropdownButtonNameLabelKey:this.currentLanguage?void 0:"language_selector.toggle_menu.label",dropdownButtonName:null!==(e=this.currentLanguage)&&void 0!==e?e:void 0,dropdownButtonTooltipLabelKey:this.currentLanguage?"language_selector.toggle_menu.tooltip":"language_selector.toggle_menu.label",dropdownAlignment:null!==(t=this.dropdownAlignment)&&void 0!==t?t:dropdownItemAlignment.DropdownItemAlignment.RIGHT,iconClass:"ri-translate-2",items:this.items,"auto-close":!0}))}valueChangeHandler(){return e=>this.onSelectedLanguageChanged(e)}changeLanguage(e){let t=e;t||(t=this.languageService.getDefaultLanguage()),this.currentLanguage=t,this.items=this.getLanguageDropdownOptions()}onSelectedLanguageChanged(e){this.languageContextService.updateSelectedLanguage(e.detail)}getLanguageDropdownOptions(){return this.languageService.getSupportedLanguages().map(e=>{const t=this.currentLanguage===e?"ri-check-line":"";return(new resourceSearchConstants.DropdownItem).setNameLabelKey(`language_selector.language.${e}.label`).setTooltipLabelKey(`language_selector.language.${e}.tooltip.`+(this.currentLanguage===e?"selected":"not_selected")).setIconClass(t).setCssClass(e).setValue(e)})}};OntoLanguageSelector.style=ontoLanguageSelectorCss;const ontoLicenseAlertCss=":host{display:block}.onto-license-alert{animation:fade-button 2s infinite;--fade-color:var(--gw-error-light);border:1px solid transparent !important}.onto-license-alert:hover{text-decoration:none;background-color:var(--gw-error-light) !important;border-color:var(--gw-error-light) !important}.onto-license-alert:hover span{transform:scale(1.2)}.onto-license-alert span{transition:transform 0.15s ease-out}.onto-license-alert .ri-alert-line{margin-right:0.2em;line-height:0.75;font-size:1.4em;display:inline-block;vertical-align:middle}",OntoLicenseAlert=class{constructor(e){index.registerInstance(this,e)}render(){var e;return index.h(index.Host,{key:"0067db786bd82713daab8282753d3f93aec0ec38","tooltip-content":null===(e=this.license)||void 0===e?void 0:e.message,"tooltip-placement":ontoTooltipPlacement.OntoTooltipPlacement.BOTTOM,"data-test":"onto-license-alert"},index.h("button",{key:"b85276c21bc7686e7d9b00ba5123aa73b5013a19",class:"onto-license-alert onto-btn",onClick:workbenchApi.navigateTo("license")},index.h("span",{key:"50564f8edbd0606f755b90c90d55ca6e4ae8fed8",class:"ri-alert-line"}),index.h("translate-label",{key:"98d4e7caee05ad80c1e83d08b096048dac67abff",labelKey:"license_alert.label"})))}};OntoLicenseAlert.style=ontoLicenseAlertCss;const ontoOperationsNotificationCss=".operations-statuses{position:relative}.operations-statuses .operations-statuses-dropdown-toggle{display:flex;font-weight:400;line-height:1.25;text-align:center;white-space:nowrap;vertical-align:middle;cursor:pointer;user-select:none;border:1px solid transparent;padding:0.4rem 1rem;font-size:1rem;gap:0.75em;transition:all 0.15s ease-out}.operations-statuses .operations-statuses-dropdown-toggle:hover{background-color:#d4d4d4;border-color:#d4d4d4}.operations-statuses .operations-statuses-dropdown-toggle:hover i:not(.ri-arrow-down-s-line){transform:scale(1.2)}.operations-statuses .operations-statuses-dropdown-toggle:focus{outline:none}.operations-statuses .operations-statuses-dropdown-toggle.open{background-color:#bbb !important;border-color:#bbb !important}.operations-statuses .operations-statuses-dropdown-toggle .operation-status-header{display:flex}.operations-statuses .operations-statuses-dropdown-toggle .operation-status-header .running-operation-count{color:white;padding:1px 2px;line-height:1;align-self:center;top:-1em;font-size:60%}.operations-statuses .operations-dropdown{position:absolute;right:0;z-index:1000;border:none;background-color:var(--gw-primary-base, #9e2b0a);border-radius:0;list-style:none;padding:0;-moz-transition:all 150ms ease-out;-o-transition:all 150ms ease-out;-webkit-transition:all 150ms ease-out;transition:all 150ms ease-out}.operations-statuses .operations-dropdown .operations-statuses-content{display:flex;flex-direction:column;background-color:#bbb;margin:0}.operations-statuses .operations-dropdown .operations-statuses-content li:first-child{margin-top:5px}.operations-statuses .operations-dropdown .operations-statuses-content li:last-child{margin-bottom:5px}.operations-statuses .operations-dropdown .operations-statuses-content .operation-status-content{display:flex;flex-direction:row;margin:5px 10px;align-items:center;justify-content:start;cursor:pointer;text-decoration:none;width:auto;gap:0.5em;background-color:var(--gw-button-secondary-background);border-color:var(--gw-button-secondary-border-color)}.operations-statuses .operations-dropdown .operations-statuses-content .operation-status-content i{width:8.33%}.operations-statuses .operations-dropdown .operations-statuses-content .operation-status-content .operation-number{min-width:50px;display:block}.operations-statuses .operations-dropdown .operations-statuses-content .operation-status-content .operation-number .operation-status-running-operation-count{display:block;width:100%;color:white;border-radius:2px;padding:3px 2px 2px;text-align:center;font-size:75%;background-color:var(--gw-info-dark, #004177) !important}.operations-statuses .operations-dropdown .operations-statuses-content .operation-status-content .operation-status-content>*{padding:0}.operations-statuses .operations-dropdown .operations-statuses-content .operation-status-content .operation-status-label{width:66.66%;padding-left:5px;line-height:0;text-align:start}.operations-statuses .operations-dropdown .operations-statuses-content .operation-status-content:hover{text-decoration:none;background-color:var(--gw-button-secondary-hover-background);border-color:var(--gw-button-secondary-hover-border-color)}.operations-statuses .operations-dropdown .operations-statuses-content .operation-status-content:hover i{transform:scale(1.2)}.operations-statuses .status-information{color:var(--gw-message-info-color, #004177) !important}.operations-statuses .status-warning{color:var(--gw-message-warning-color, #7e2308) !important}.operations-statuses .status-critical{color:var(--gw-message-error-color, #a31425) !important}.operations-statuses i{padding-left:3px;padding-right:3px;font-size:1.1em;line-height:1.6rem !important;align-content:center;transition:transform 0.15s ease-out}.operations-statuses i.ri-arrow-down-s-line{color:rgba(0, 0, 0, 0.35);transition:all 0.2s ease-in}.operations-statuses .ri-download-2-line{font-size:21px}",operationGroupToIcon={[workbenchApi.OperationGroup.BACKUP]:"ri-archive-line",[workbenchApi.OperationGroup.QUERY]:"ri-arrow-left-right-line",[workbenchApi.OperationGroup.CLUSTER]:"ri-organization-chart",[workbenchApi.OperationGroup.IMPORT]:"ri-download-2-line"},operationStatusToWarningClass={[workbenchApi.OperationStatus.WARNING]:"status-warning",[workbenchApi.OperationStatus.INFORMATION]:"status-information",[workbenchApi.OperationStatus.CRITICAL]:"status-critical"},operationStatusToFadeClass={[workbenchApi.OperationStatus.WARNING]:"onto-btn-fade-warning",[workbenchApi.OperationStatus.CRITICAL]:"onto-btn-fade-danger"},OntoOperationsNotification=class{constructor(e){index.registerInstance(this,e),this.isOpen=!1,this.toggleDropdown=e=>{e.stopPropagation(),this.isOpen=!this.isOpen}}handleOutsideClick(){this.isOpen&&(this.isOpen=!1)}render(){var e;return this.operationGroups=this.activeOperations.toOperationGroupSummaryList(),index.h("section",{key:"7a92d84014a1600e615b78c2dd89dbd68b2f214f",class:"operations-statuses"},index.h("button",{key:"2e157a404f2fe64ce08097992598bdfca36cf7db",class:`operations-statuses-dropdown-toggle ${this.isOpen?"open":"closed"} ${null!==(e=operationStatusToFadeClass[this.activeOperations.status])&&void 0!==e?e:""}`,onClick:this.toggleDropdown},this.operationGroups.getItems().map(e=>index.h("section",{key:e.id,class:"operation-status-header"},index.h("i",{class:`${operationGroupToIcon[e.group]} ${operationStatusToWarningClass[e.status]}`}),e.totalOperations?index.h("sup",{class:"running-operation-count tag-info"},e.totalOperations):"")),index.h("i",{key:"980f0e06cb1182f9e832f45423f6872af27bb0ec",class:"ri-arrow-down-s-line "+(this.isOpen?"rotate-180":"")})),this.isOpen&&index.h("ul",{key:"4dae219ef215abce0367335ab10c8ab85cfad684",class:"operations-dropdown"},index.h("section",{key:"e0de9986991b78cd339da605148a22b088a55566",class:"operations-statuses-content"},this.activeOperations.allRunningOperations.getItems().map(e=>index.h("li",{key:e.id},index.h("a",{class:`operation-status-content onto-btn no-underline ${operationStatusToWarningClass[e.status]}`,target:"_blank",onClick:workbenchApi.navigateTo(e.href)},index.h("i",{class:operationGroupToIcon[e.group]}),index.h("span",{class:"operation-status-label"},index.h("translate-label",{labelKey:`operations_notification.links.${e.labelKey}`})),index.h("span",{class:"operation-number"},e.count?index.h("span",{class:"operation-status-running-operation-count"},e.count):"")))))))}get el(){return index.getElement(this)}};OntoOperationsNotification.style=ontoOperationsNotificationCss;const ontoRdfSearchCss=".onto-rdf-search{display:flex;align-items:center;font-size:1.4em;height:auto}.onto-rdf-search .search-area{white-space:nowrap;text-align:start;font-weight:300;max-width:100vw;position:fixed;right:3em;z-index:1;display:block;width:60vw;-webkit-transition:top 0.3s ease-in, opacity 0.5s ease;transition:top 0.3s ease-in, opacity 0.5s ease;border-radius:0;margin-bottom:1em;padding:1.6rem;color:var(--gw-dialog-color);background-color:var(--gw-dialog-background);border:1px solid var(--gw-dialog-border-color);box-shadow:var(--gw-dialog-shadow-1-offset-x) var(--gw-dialog-shadow-1-offset-y) var(--gw-dialog-shadow-1-blur) var(--gw-dialog-shadow-1-spread) var(--gw-dialog-shadow-1-color)}.onto-rdf-search .search-area.visible{top:40px;opacity:1}.onto-rdf-search .search-area.invisible{top:-550px;opacity:0}.onto-rdf-search .search-area .close-btn{display:block;position:absolute;top:0;right:0;font-size:1.5rem}.onto-rdf-search i{cursor:pointer;color:var(--gw-primary-base);transition:all 0.15s ease-out}.onto-rdf-search i.ri-search-line,.onto-rdf-search i.close-btn{padding:0.5rem 0.8rem}.onto-rdf-search i:hover{transform:scale(1.2)}",OntoRdfSearch=class{constructor(e){index.registerInstance(this,e),this.subscriptions=new workbenchApi.SubscriptionList,this.eventService=workbenchApi.ServiceProvider.get(workbenchApi.EventService),this.resourceSearchStorageService=workbenchApi.ServiceProvider.get(workbenchApi.ResourceSearchStorageService),this.RDF_CONTEXT="rdfSearchContext",this.isOpen=!1,this.redirectUrl=workbenchApi.UriUtil.RESOURCE_URL}handleClick(e){var t;this.isOpen&&((null===(t=this.rdfSearchRef)||void 0===t?void 0:t.contains(e.target))||(this.isOpen=!1))}connectedCallback(){this.onSuggestionSelected()}disconnectedCallback(){this.subscriptions.unsubscribeAll()}componentDidRender(){this.focusSearchInput()}componentDidLoad(){this.buttonConfig=this.createButtonConfig()}render(){return index.h("section",{key:"fb63b11874e6049ea060d7f8bf2b9ce00a2bc78c",ref:e=>this.rdfSearchRef=e,class:"onto-rdf-search",onKeyDown:this.onKeyDown(),"data-test":"onto-rdf-search-component"},index.h("section",{key:"1c7f6a7e9951011e1c62e2f24c912c8c2813c404",class:"search-area "+(this.isOpen?"visible":"invisible")},index.h("i",{key:"e6f8e37067378b674c1ff4ad8ac105cd472972a5",onClick:this.setIsOpen(!1),"tooltip-content":translation_service.TranslationService.translate("rdf_search.tooltips.close_search_area"),"tooltip-placement":ontoTooltipPlacement.OntoTooltipPlacement.BOTTOM,"data-test":"onto-rdf-resource-search-close-btn",class:"ri-close-line close-btn"}),index.h("onto-search-resource-input",{key:"a2b41801185618be5658c27bce1e4a05a3820dc7",buttonConfig:this.buttonConfig,preserveSearch:!0,isHidden:!this.isOpen,"data-test":"onto-rdf-resource-search-input",context:this.RDF_CONTEXT})),this.isOpen?"":index.h("onto-search-icon",{onClick:this.setIsOpen(!0)}))}setIsOpen(e){return()=>{this.isOpen=e,this.isOpen&&this.loadSelectedViewFromStorage()}}createButtonConfig(){return new workbenchApi.SearchButtonConfig({isRadio:!0,buttons:[this.createSearchButton(resourceSearchConstants.ResourceSearchConstants.TABLE_VIEW,"rdf_search.buttons.table",()=>{this.redirectUrl=workbenchApi.UriUtil.RESOURCE_URL,this.resourceSearchStorageService.setSelectedView(resourceSearchConstants.ResourceSearchConstants.TABLE_VIEW)},!0),this.createSearchButton(resourceSearchConstants.ResourceSearchConstants.VISUAL_VIEW,"rdf_search.buttons.visual",()=>{this.redirectUrl=workbenchApi.UriUtil.GRAPHS_VISUALIZATIONS_URL,this.resourceSearchStorageService.setSelectedView(resourceSearchConstants.ResourceSearchConstants.VISUAL_VIEW)},!1)]})}createSearchButton(e,t,o,r){return new workbenchApi.SearchButton({label:translation_service.TranslationService.translate(t),id:e,callback:o,selected:r})}onSuggestionSelected(){this.subscriptions.add(this.eventService.subscribe(resourceSearchConstants.ResourceSearchConstants.SUGGESTION_SELECTED_EVENT,e=>{if(e.getContext()===this.RDF_CONTEXT){const t=e.getSuggestion().getOverrideToVisual()?workbenchApi.UriUtil.GRAPHS_VISUALIZATIONS_URL:this.redirectUrl;workbenchApi.openInNewTab(workbenchApi.UriUtil.createAutocompleteRedirect(t,e.getSuggestion().getValue()))}}))}onKeyDown(){return e=>{"Escape"===e.key&&(this.isOpen=!1)}}focusSearchInput(){this.isOpen&&htmlUtil.HtmlUtil.focusElement(`#${this.RDF_CONTEXT}`)}loadSelectedViewFromStorage(){const e=this.resourceSearchStorageService.getSelectedView();if(e){const t=this.buttonConfig.getButtons().find(t=>t.id===e);t&&(this.buttonConfig=this.buttonConfig.selectButton(t))}}};OntoRdfSearch.style=ontoRdfSearchCss;const RepositorySelection=({repository:e,defaultToggleButtonName:t,location:o})=>{var r;const n=e?"repository-selection active-repository":"repository-selection no-selected-repository";return index.h("div",{class:n,"data-test":"repository-selection"},e&&index.h("i",{class:"button-icon icon-repo-"+e.type})," ",null!==(r=null==e?void 0:e.id)&&void 0!==r?r:t,o)},ontoRepositorySelectorCss=":host{display:block}.onto-repository-selector .onto-dropdown.closed .onto-dropdown-button{background-color:var(--gw-button-secondary-background);color:var(--gw-button-secondary-background)}.onto-repository-selector .onto-dropdown.closed .onto-dropdown-button:hover{background-color:var(--gw-button-secondary-hover-background);color:var(--gw-button-secondary-hover-color)}.onto-repository-selector .repository-selector-dropdown-item{display:flex;align-items:center;gap:0.4em}.onto-repository-selector .repository-selector-dropdown-item .item-icon{font-size:1.4em}.onto-repository-selector .repository-selector-dropdown-item .item-label{line-height:0.75em;display:inline-block;vertical-align:middle;text-align:left}.onto-repository-selector .repository-selector-dropdown-item .item-label .repository-id{line-height:0.75em}.onto-repository-selector .repository-selector-dropdown-item .item-label .repository-location{font-weight:300;font-size:0.75em;margin-top:0.4em;display:inline-block;max-width:120px;text-overflow:ellipsis;overflow:hidden}.tooltip-box[data-theme=light-border]{color:var(--gw-dialog-color);background-color:var(--gw-dialog-background);border:1px solid var(--gw-dialog-border-color);box-shadow:var(--gw-dialog-shadow-1-offset-x) var(--gw-dialog-shadow-1-offset-y) var(--gw-dialog-shadow-1-blur) var(--gw-dialog-shadow-1-spread) var(--gw-dialog-shadow-1-color);max-width:350px}.tooltip-box[data-theme=light-border] .tooltip-arrow::before{border:1px solid var(--gw-dialog-border-color);background-color:var(--gw-dialog-background)}.tooltip-box[data-theme=light-border] .tooltip-content{padding:0}.tooltip-box[data-theme=light-border] .tooltip-content .repository-tooltip-title{font-size:1rem;font-weight:400;padding:8px 14px;background-color:var(--gw-dialog-background);border-bottom:var(--gw-dialog-border-color) 1px solid}.tooltip-box[data-theme=light-border] .tooltip-content .repository-tooltip-title .value{overflow-wrap:break-word}.tooltip-box[data-theme=light-border] .tooltip-content .repository-tooltip-content{background-color:var(--gw-dialog-background);padding:1.5rem 0.5rem;display:flex;flex-direction:column;gap:0.8em;font-weight:400;font-size:0.875rem}.tooltip-box[data-theme=light-border] .tooltip-content .repository-tooltip-row{display:flex;flex-direction:row;justify-content:space-between}.tooltip-box[data-theme=light-border] .tooltip-content .repository-tooltip-row.total{margin-top:1.2em}.tooltip-box[data-theme=light-border] .tooltip-content .repository-tooltip-row .value{margin-left:0.6em}",OntoRepositorySelector=class{constructor(e){index.registerInstance(this,e),this.repositoryContextService=workbenchApi.service(workbenchApi.RepositoryContextService),this.subscriptions=[]}onItemsChanged(e){(null==e?void 0:e.length)?this.dropdownItems=this.attachTooltipsToItems(this.items):this.dropdownItems=[]}connectedCallback(){var e;this.subscriptions.push(...this.subscribeToTranslationChanged()),(null===(e=this.items)||void 0===e?void 0:e.length)?this.dropdownItems=this.attachTooltipsToItems(this.items):this.dropdownItems=[]}disconnectedCallback(){this.subscriptions.forEach(e=>e())}render(){const e=index.h(RepositorySelection,{key:"4eb3d289171f3fe23b5149c131e897bee4dbcd2c",repository:this.currentRepository,defaultToggleButtonName:this.getButtonLabel(),location:this.getLocation()});return index.h(index.Host,{key:"7d34620a51bef35614140e61aa3109e77bb007df"},index.h("onto-dropdown",Object.assign({key:"ce6a3a8f206e32639af4fc1c904c92925aa42cbc",class:"onto-repository-selector","data-test":"onto-repository-selector",onValueChanged:this.onValueChanged(),dropdownButtonName:e,dropdownButtonTooltip:this.createTooltipFunctionForRepository(this.currentRepository)},this.currentRepository?{dropdownButtonGuideSelector:`repository-id-${this.currentRepository.id}`}:{},{dropdownAlignment:dropdownItemAlignment.DropdownItemAlignment.RIGHT,tooltipPlacement:this.tooltipAlignment,tooltipTheme:"light-border",items:this.dropdownItems,"auto-close":!0})))}attachTooltipsToItems(e){return e?e.map(e=>e.setTooltip(this.createTooltipFunctionForRepository(e.value))):[]}tooltipAlignment(e){return e?ontoTooltipPlacement.OntoTooltipPlacement.LEFT:ontoTooltipPlacement.OntoTooltipPlacement.BOTTOM}onValueChanged(){return e=>this.onRepositoryChanged(e.detail)}createTooltipFunctionForRepository(e){return async()=>{if(!e)return"";const t=await this.repositorySizeInfoFetcher(e);return this.buildRepositoryTooltipHtml(e,t)}}buildRepositoryTooltipHtml(e,t){let o=`\n <div class="repository-tooltip-title">\n <span class="label">${translation_service.TranslationService.translate("repository-selector.tooltip.repository")}</span>\n <span class="value">${e.id}</span>\n </div>\n <div class="repository-tooltip-content">\n <div class="repository-tooltip-row">\n <div class="label">${translation_service.TranslationService.translate("repository-selector.tooltip.location")}:</div>\n <div class="value">${e.location?e.location:translation_service.TranslationService.translate("repository-selector.tooltip.local")}</div>\n </div>\n <div class="repository-tooltip-row">\n <div class="label">${translation_service.TranslationService.translate("repository-selector.tooltip.type")}:</div>\n <div class="value">${translation_service.TranslationService.translate("repository-selector.tooltip.types."+(e.type||"unknown"))}</div>\n </div>\n <div class="repository-tooltip-row">\n <div class="label">${translation_service.TranslationService.translate("repository-selector.tooltip.access")}:</div>\n <div class="value">${translation_service.TranslationService.translate(this.canWriteRepo(e)?"repository-selector.tooltip.accesses.read_write":"repository-selector.tooltip.accesses.read")}</div>\n </div>`;return o+=this.buildRepositorySizeInfoHtml(t),o+="</div>",o}buildRepositorySizeInfoHtml(e){if(!e||e.total<0)return"";let t=`\n <div class="repository-tooltip-row total">\n <div class="label">${translation_service.TranslationService.translate("repository-selector.tooltip.repository-size.total")}:</div>\n <div class="value">${this.totalTripletsFormatter.format(e.total)}</div>\n </div>`;if(e.explicit>=0&&(t+=`\n <div class="repository-tooltip-row">\n <div class="label">${translation_service.TranslationService.translate("repository-selector.tooltip.repository-size.explicit")}:</div>\n <div class="value">${this.totalTripletsFormatter.format(e.explicit)}</div>\n </div>`),e.inferred>=0&&(t+=`\n <div class="repository-tooltip-row">\n <div class="label">${translation_service.TranslationService.translate("repository-selector.tooltip.repository-size.inferred")}:</div>\n <div class="value">${this.totalTripletsFormatter.format(e.inferred)}</div>\n </div>`),e.total>=0){let o="-";e.explicit>0&&(o=this.expansionRatioFormatter.format(e.total/e.explicit)),t+=`\n <div class="repository-tooltip-row">\n <div class="label">${translation_service.TranslationService.translate("repository-selector.tooltip.repository-size.expansion_ratio")}:</div>\n <div class="value">${o}</div>\n </div>`}return t}subscribeToTranslationChanged(){return[translation_service.TranslationService.onTranslate("repository-selector.btn.toggle",[],e=>{this.defaultToggleButtonName=e}),translation_service.TranslationService.onTranslate("repository-selector.btn.no_repositories",[],e=>{this.noRepositoriesButtonMessage=e})]}onRepositoryChanged(e){this.repositoryContextService.updateSelectedRepository(e)}getLocation(){var e;return(null===(e=this.currentRepository)||void 0===e?void 0:e.location)?`@${workbenchApi.UriUtil.shortenIri(this.currentRepository.location)}`:""}getButtonLabel(){var e;return(null===(e=this.items)||void 0===e?void 0:e.length)?this.defaultToggleButtonName:this.noRepositoriesButtonMessage}static get watchers(){return{items:["onItemsChanged"]}}};OntoRepositorySelector.style=ontoRepositorySelectorCss;const ontoSearchIconCss=".onto-search-icon{cursor:pointer;color:var(--gw-primary-base, #9e2b0a);transition:all 0.15s ease-out;font-size:1.6rem}.onto-search-icon.ri-search-line{padding:0.5rem 0.8rem}.onto-search-icon:hover{transform:scale(1.2)}",OntoSearchIcon=class{constructor(e){index.registerInstance(this,e),this.tooltipKey="rdf_search.labels.search",this.subscriptions=new workbenchApi.SubscriptionList}connectedCallback(){this.onTooltipChange()}disconnectedCallback(){this.subscriptions.unsubscribeAll()}render(){return index.h("i",{key:"33ac85ef454f5a8de8e24217d92950219df84f7a","tooltip-content":this.tooltipLabel,"tooltip-placement":ontoTooltipPlacement.OntoTooltipPlacement.BOTTOM,class:"onto-search-icon ri-search-line"})}onTooltipChange(){this.subscriptions.add(translation_service.TranslationService.onTranslate(this.tooltipKey,[],e=>this.tooltipLabel=e))}};OntoSearchIcon.style=ontoSearchIconCss;const ontoSearchResourceInputCss=".search-resources-input{padding-right:20px}.search-resources-input .input-row{gap:3px;display:flex;flex-wrap:wrap}.search-resources-input .input-row .input-wrapper{position:relative;display:flex;flex:1;min-width:20vw}.search-resources-input .input-row .input-wrapper input{min-width:inherit;flex:1;padding:0.5rem 0.75rem;font-size:1rem;line-height:1.25;color:var(--gw-form-field-color);background-color:var(--gw-form-field-background);background-image:none;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid var(--gw-form-field-border-color)}.search-resources-input .input-row .input-wrapper input:focus{outline:0;color:var(--gw-form-field-color);border-color:var(--gw-form-field-focus-border-color)}.search-resources-input .input-row i.ri-close-line{position:absolute;right:10px;top:7px;z-index:10;font-size:1.6rem}.search-resources-input .input-row button{display:inline-block;font-weight:400;line-height:1.25;text-align:center;white-space:nowrap;vertical-align:middle;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;transition:all 0.15s ease-out;user-select:none;border:1px solid transparent;padding:0.5rem 1rem;font-size:1rem;color:var(--gw-button-secondary-color);background-color:var(--gw-button-secondary-background)}.search-resources-input .input-row button.selected{background-color:var(--gw-button-primary-background);color:var(--gw-button-primary-color)}.search-resources-input .input-row button:focus{outline:none}.search-resources-input .input-row button:hover:not(.selected){background-color:var(--gw-button-secondary-hover-background);border-color:var(--gw-button-secondary-hover-color)}.search-resources-input .hint{font-size:0.8rem;color:#818a91}.search-resources-input .autocomplete-results-wrapper{margin-top:6px;max-height:204px;overflow:auto}.search-resources-input .autocomplete-results-wrapper p{font-size:1.1rem;line-height:1.5;color:var(--gw-autocomplete-color);background-color:var(--gw-autocomplete-background);margin-bottom:0;padding:5px 25px;cursor:pointer}.search-resources-input .autocomplete-results-wrapper p b{color:var(--gw-autocomplete-dropdown-match-color)}.search-resources-input .autocomplete-results-wrapper p.selected{color:var(--gw-autocomplete-option-selected-color);background-color:var(--gw-autocomplete-option-selected-background)}.search-resources-input .autocomplete-results-wrapper p.hovered:not(.selected),.search-resources-input .autocomplete-results-wrapper p:hover:not(.selected){color:var(--gw-autocomplete-option-focus-color);background-color:var(--gw-autocomplete-option-focus-background)}",OntoSearchResourceInput=class{constructor(e){index.registerInstance(this,e),this.autocompleteService=workbenchApi.ServiceProvider.get(workbenchApi.AutocompleteService),this.autocompleteContextService=workbenchApi.ServiceProvider.get(workbenchApi.AutocompleteContextService),this.autocompleteStorageService=workbenchApi.ServiceProvider.get(workbenchApi.AutocompleteStorageService),this.resourceSearchStorageService=workbenchApi.ServiceProvider.get(workbenchApi.ResourceSearchStorageService),this.toastrService=workbenchApi.ServiceProvider.get(workbenchApi.OntoToastrService),this.eventService=workbenchApi.ServiceProvider.get(workbenchApi.EventService),this.namespaceContextService=workbenchApi.ServiceProvider.get(workbenchApi.NamespacesContextService),this.subscriptions=new workbenchApi.SubscriptionList,this.autocompleteWarningShown=!1,this.skipValidation=!1,this.isHidden=!1,this.isAutocompleteEnabled=!1,this.handleInput=e=>{const t=e.target;t.value?(this.setInputValue(t.value),this.checkForAutocomplete()):this.clearInput()},this.clearInput=()=>{this.setInputValue(""),this.preserveSearch&&this.resourceSearchStorageService.clearStoredSearch()},this.onKeyDown=e=>{switch(e.key){case"Enter":this.onEnter(e);break;case"Escape":this.onEscape();break;case"ArrowUp":this.onArrowUp(e);break;case"ArrowDown":this.onArrowDown(e)}}}onVisibilityChange(e){var t;e?null===(t=this.searchResult)||void 0===t||t.clearSuggestions():this.setInputValue(this.resourceSearchStorageService.getInputValue())}connectedCallback(){this.onAutocompleteEnabledChange(),this.onNamespaceChange(),this.loadInputFromStorage()}disconnectedCallback(){this.subscriptions.unsubscribeAll()}render(){var e,t,o;return index.h("section",{key:"c038af36fa4270f35dab06147536206eab600ce5",class:"search-resources-input"},index.h("div",{key:"d9b3044c17de9765bd3cbc724ab76bb13e823136",class:"input-row"},index.h("span",{key:"297d9e5f94d414f227349b79f26f277e3c246c39",class:"input-wrapper"},index.h("input",{key:"65db17686344b92e8fb59cba15e48538da26c07e",value:this.inputValue,id:this.context,type:"text",autocomplete:"off",placeholder:`${translation_service.TranslationService.translate("rdf_search.labels.search")}...`,ref:e=>this.inputRef=e,onKeyDown:this.onKeyDown,"data-test":this.context,onInput:this.handleInput}),(null===(e=this.inputValue)||void 0===e?void 0:e.length)?index.h("i",{onClick:this.clearInput,"tooltip-content":translation_service.TranslationService.translate("rdf_search.tooltips.clear"),"tooltip-placement":ontoTooltipPlacement.OntoTooltipPlacement.BOTTOM,class:"ri-close-line clear-input"}):""),null===(t=this.buttonConfig)||void 0===t?void 0:t.getButtons().getItems().map(e=>index.h("button",{key:e.label,onClick:this.handleButtonClick(e),class:e.selected?"selected":""},e.label))),index.h("span",{key:"cfb1aa194945352f33b786eb7bf2bae98c6e9ea2",class:"hint"},translation_service.TranslationService.translate("rdf_search.labels.hint")),index.h("section",{key:"e17c4e528f8c05ed983df81e2c364356170dac12",class:"autocomplete-results-wrapper","data-test":"onto-autocomplete-results"},null===(o=this.searchResult)||void 0===o?void 0:o.suggestions.getItems().map(e=>index.h("p",{key:e.getId(),onClick:this.onSuggestionClick(e),"data-test":"onto-autocomplete-suggestion",onMouseMove:this.hoverSuggestion(e),class:`${e.isHovered()?"hovered":""} ${e.isSelected()?"selected":""}`,innerHTML:e.getDescription()}))))}handleButtonClick(e){return()=>this.buttonConfig=this.buttonConfig.selectButton(e)}loadAutocompleteResults(){var e;this.inputValue?this.isAutocompleteEnabled&&this.autocompleteService.search(this.inputValue).then(e=>{this.onResultsReceived(e)}):null===(e=this.searchResult)||void 0===e||e.clearSuggestions()}hoverSuggestion(e){return()=>this.searchResult=this.searchResult.hoverSuggestion(e)}onAutocompleteEnabledChange(){this.isAutocompleteEnabled=this.autocompleteStorageService.isEnabled(),this.subscriptions.add(this.autocompleteContextService.onAutocompleteEnabledChanged(e=>{this.isAutocompleteEnabled=null!=e?e:this.isAutocompleteEnabled}))}checkForAutocomplete(){if(this.inputValue.length>0&&!this.isAutocompleteEnabled&&!this.autocompleteWarningShown){this.autocompleteWarningShown=!0;const e=translation_service.TranslationService.translate("rdf_search.toasts.autocomplete_is_off");this.toastrService.warning(`<a class="no-underline" style="font-weight: 500">${e}</a>`,{onClick:workbenchApi.navigateTo("autocomplete"),removeOnClick:!0})}}onSuggestionClick(e){return t=>{e.setOverrideToVisual(t.ctrlKey||t.metaKey),this.searchRdfResource(e)}}searchRdfResource(e){e.getType()===workbenchApi.SuggestionType.PREFIX?this.expandPrefix(e):(this.notifyRdfResourceSelected(e),this.preserveSearch&&this.resourceSearchStorageService.setLastSelected(e))}notifyRdfResourceSelected(e){var t;this.searchResult=null===(t=this.searchResult)||void 0===t?void 0:t.selectSuggestion(e),this.eventService.emit({NAME:resourceSearchConstants.ResourceSearchConstants.SUGGESTION_SELECTED_EVENT,payload:new workbenchApi.SuggestionSelectedPayload(e,this.context)})}expandPrefix(e){this.setInputValue(this.namespaces.getByPrefix(e.getValue())),this.inputRef.focus()}setInputValue(e){this.inputValue=e,this.preserveSearch&&this.resourceSearchStorageService.setInputValue(this.inputValue),this.loadAutocompleteResults()}onNamespaceChange(){this.subscriptions.add(this.namespaceContextService.onNamespacesChanged(e=>{this.namespaces=e}))}onEnter(e){var t;let o=null===(t=this.searchResult)||void 0===t?void 0:t.getHoveredSuggestion();o||(o=new workbenchApi.Suggestion({value:workbenchApi.UriUtil.removeAngleBrackets(this.inputValue),type:workbenchApi.SuggestionType.URI})),o.setOverrideToVisual(e.ctrlKey||e.metaKey),this.validateAndSearch(o)}onArrowUp(e){this.searchResult&&(this.searchResult=this.searchResult.hoverPreviousSuggestion(),this.displaySuggestion(e))}onArrowDown(e){this.searchResult&&(this.searchResult=this.searchResult.hoverNextSuggestion(),this.displaySuggestion(e))}displaySuggestion(e){e.preventDefault(),this.inputRef.value=this.searchResult.getHoveredSuggestion().getValue(),this.scrollToSuggestionBySelector("p.hovered")}getSuggestionValue(e){return e.getType()===workbenchApi.SuggestionType.PREFIX?this.namespaces.getByPrefix(e.getValue()):e.getValue()}scrollToSuggestionBySelector(e,t){htmlUtil.HtmlUtil.waitForElement(e).then(()=>{htmlUtil.HtmlUtil.scrollElementIntoView(e,t)})}validateAndSearch(e){if(!this.skipValidation){if(!e.getValue())return void this.toastrService.error(translation_service.TranslationService.translate("rdf_search.toasts.empty_input"));if(!workbenchApi.UriUtil.isValidUri(this.getSuggestionValue(e)))return void this.toastrService.error(translation_service.TranslationService.translate("rdf_search.toasts.invalid_uri"))}this.searchRdfResource(e)}onEscape(){this.preserveSearch||this.clearInput()}loadInputFromStorage(){this.preserveSearch&&(this.inputValue=this.resourceSearchStorageService.getInputValue()||"")}onResultsReceived(e){const t=null==e?void 0:e.getByValue(this.resourceSearchStorageService.getLastSelectedValue());t&&this.preserveSearch?(e.hoverSuggestion(t),this.searchResult=e.selectSuggestion(t),this.scrollToSuggestionBySelector("p.hovered.selected",{block:"start"})):(this.searchResult=e.hoverFirstSuggestion(),this.scrollToSuggestionBySelector("p.hovered",{block:"start"}))}static get watchers(){return{isHidden:["onVisibilityChange"]}}};OntoSearchResourceInput.style=ontoSearchResourceInputCss;const ontoUserLoginCss=":root{--onto-user-login-color:var(--gw-secondary-base, var(--base-text-color))}.onto-user-login{position:relative;width:fit-content}.onto-user-login button{display:flex;color:var(--onto-user-login-color);flex-direction:row;line-height:1.5;font-weight:400;font-size:1rem;text-align:center;user-select:none;border:1px solid transparent;padding:0.4em 1rem;cursor:pointer;white-space:nowrap;place-items:center;transition:all 0.15s ease-out}.onto-user-login button .user-login-label{padding:0 0.4rem}.onto-user-login button:hover{background-color:#d4d4d4;border-color:#d4d4d4}.onto-user-login button:hover .ri-user-fill{transform:scale(1.2)}.onto-user-login button:focus{outline:none}.onto-user-login button i{color:var(--user-menu-primary-color);line-height:0.75;font-size:1.2em;transition:0.15s ease-out}.onto-user-login button i.ri-arrow-down-s-line{color:rgba(0, 0, 0, 0.35);font-size:1.1em;transition:all 0.2s ease-in}",OntoUserLogin=class{constructor(e){index.registerInstance(this,e)}navigateToLogin(){return e=>{e.preventDefault();const t=encodeURIComponent(workbenchApi.getCurrentRoute());workbenchApi.navigate(`login?r=${encodeURIComponent(t)}`)}}render(){return index.h("section",{key:"5bdfd4bfee82e13a1cfe4781b3a791a96d1b9360",class:"onto-user-login"},index.h("button",{key:"a2f6efd3559df06a33489b25186b6d7e7a3141e1",onClick:this.navigateToLogin()},index.h("i",{key:"cf07c4a52c46d2f65b36cf478e7f730bffcbe7e2",class:"ri-arrow-right-circle-line"}),index.h("translate-label",{key:"d78bae8d524ee645c4c51031c0b0628be229af9b",class:"user-login-label",labelKey:"user_menu.login"})))}};OntoUserLogin.style=ontoUserLoginCss;const ontoUserMenuCss=".onto-user-menu{position:relative;width:fit-content}.onto-user-menu button{display:flex;flex-direction:row;line-height:1.5;font-weight:400;font-size:1rem;text-align:center;user-select:none;border:1px solid transparent;padding:0.4em 1rem;cursor:pointer;white-space:nowrap;place-items:center;transition:all 0.15s ease-out;background-color:var(--gw-button-secondary-background);color:var(--gw-button-secondary-color)}.onto-user-menu button:hover{background-color:var(--gw-button-secondary-hover-background);color:var(--gw-button-secondary-hover-color)}.onto-user-menu button:hover .ri-user-line{transform:scale(1.2)}.onto-user-menu button:focus{outline:none}.onto-user-menu button.open{color:white;background-color:var(--gw-primary-base);border-color:var(--gw-primary-base)}.onto-user-menu button.open .ri-user-line{color:var(--icon-on-primary-color, rgba(255, 255, 255, 0.8))}.onto-user-menu button.open:hover .ri-user-line{transform:scale(1.2)}.onto-user-menu button .username{padding:0 5px}.onto-user-menu button i{color:var(--gw-primary-base);transition:0.15s ease-out}.onto-user-menu button i.ri-arrow-down-s-line{color:rgba(0, 0, 0, 0.35);font-size:1.1em;transition:all 0.2s ease-in}.onto-user-menu .onto-user-menu-dropdown{position:absolute;z-index:1000;display:flex;flex-direction:column;cursor:pointer;text-decoration:none;right:0;min-width:7rem;font-size:1rem;width:100%;color:var(--gw-primary-contrast-color);background-color:var(--gw-primary-base)}.onto-user-menu .onto-user-menu-dropdown translate-label{padding:0.4rem 1rem;user-select:none;white-space:nowrap;font-weight:400}.onto-user-menu .onto-user-menu-dropdown translate-label:hover,.onto-user-menu .onto-user-menu-dropdown translate-label:focus{background-color:rgba(0, 0, 0, 0.1)}",OntoUserMenu=class{constructor(e){index.registerInstance(this,e),this.authenticationService=workbenchApi.service(workbenchApi.AuthenticationService),this.logout=()=>{this.authenticationService.logout()},this.toggleDropdown=()=>{this.isOpen=!this.isOpen},this.handleOutsideClick=e=>{this.isOpen&&!this.hostElement.contains(e.target)&&(this.isOpen=!1)}}connectedCallback(){document.addEventListener("click",this.handleOutsideClick)}disconnectedCallback(){document.removeEventListener("click",this.handleOutsideClick)}render(){return index.h("section",{key:"df7688b500d9e0a6d4704619ba9936404f88dc06",class:"onto-user-menu"},index.h("div",{key:"329d3c091bfc71d93873d6f0c937d279d250b7d9",class:"dropdown-toggle-wrapper",onClick:this.toggleDropdown},index.h("button",{key:"457dada79a3cdfbc3f6026a8582beb8ad9a5b0ff",class:this.isOpen?"open":""},index.h("i",{key:"2e7d010c271e8e87f55a90ec786669011e307de2",class:"ri-user-line ri-lg"}),index.h("span",{key:"e56a8ec1c50e5614e5b8fbeb7217eb236a40f4e2",class:"username"},this.user.username),index.h("i",{key:"4c94c83e84e9b3d1f3077a840bbc6c8f6bd14490",class:"ri-arrow-down-s-line "+(this.isOpen?"rotate-180":"")})),this.isOpen?index.h("section",{class:"onto-user-menu-dropdown"},index.h("translate-label",{onClick:workbenchApi.navigateTo("settings"),labelKey:"user_menu.my_settings"}),this.authenticationService.isExternalUser()?"":index.h("translate-label",{onClick:this.logout,labelKey:"user_menu.logout"})):""))}get hostElement(){return index.getElement(this)}};OntoUserMenu.style=ontoUserMenuCss,exports.onto_language_selector=OntoLanguageSelector,exports.onto_license_alert=OntoLicenseAlert,exports.onto_operations_notification=OntoOperationsNotification,exports.onto_rdf_search=OntoRdfSearch,exports.onto_repository_selector=OntoRepositorySelector,exports.onto_search_icon=OntoSearchIcon,exports.onto_search_resource_input=OntoSearchResourceInput,exports.onto_user_login=OntoUserLogin,exports.onto_user_menu=OntoUserMenu;