UNPKG

graphdb-workbench

Version:
3 lines 24.8 kB
/*! For license information please see 12358.682decea79778402c55d.bundle.js.LICENSE.txt */ export const __webpack_esm_id__=12358;export const __webpack_esm_ids__=[3909,12358,42618,43319,62062,78508,81801,87054];export const __webpack_esm_modules__={3909:()=>{function e(){return{restrict:"E",require:"ngModel",scope:{ngModel:"=",ngDisabled:"=",placeholder:"@"},templateUrl:"js/angular/core/templates/editable-content/editable-content.html",link:function(e,t,n,a){const o=t.find("div"),i=()=>{e.ngDisabled||e.$apply(()=>{o.html().length&&!o.text().trim().length&&o.empty(),a.$setViewValue(o[0].innerText)})};a.$render=()=>{o.html(a.$viewValue||"")};const r=e=>{e.preventDefault();const t=(e.originalEvent||e).clipboardData.getData("text/plain"),n=window.getSelection();if(!n.rangeCount)return;n.deleteFromDocument();const a=n.getRangeAt(0),o=document.createDocumentFragment(),i=t.split("\n");i.forEach((e,t)=>{o.appendChild(document.createTextNode(e)),t<i.length-1&&o.appendChild(document.createElement("br"))}),a.insertNode(o),n.collapseToEnd()};e.$on("$destroy",()=>{o.off("blur keyup change input",i),o.off("paste",r)}),o.on("blur keyup change input",i),o.on("paste",r)}}}angular.module("graphdb.framework.core.directives.editable-content",[]).directive("editableContent",e),e.$inject=[]},7928:(e,t,n)=>{var a=n(71920),o=n(76076);function i(e,t){return{restrict:"E",templateUrl:"js/angular/ttyg/templates/no-agents-view.html",scope:{},link:n=>{n.canModifyAgent=!1,n.talkToGraphDocumentationLink=o.m.getDocumentationUrl(t.productShortVersion,"talk-to-graph.html"),n.onCreateAgent=()=>{e.emit(a.I.OPEN_AGENT_SETTINGS)};const i=[];i.push(e.onCanUpdateAgentUpdated(e=>{n.canModifyAgent=e})),n.$on("$destroy",()=>{i.forEach(e=>e())})}}}angular.module("graphdb.framework.ttyg.directives.no-agents-view",[]).directive("noAgentsView",i),i.$inject=["TTYGContextService","productInfo"]},12358:(e,t,n)=>{n(60039),n(13815),n(29350),n(44874),n(7928),n(62062),n(78508),n(95953),n(36665);var a=n(71920),o=(n(87054),n(70826)),i=n(28319),r=n(19402),s=n(51490),c=n(38940),l=n(11695),d=n(76752),g=n(43319),h=n(60529),u=n(81801),p=n(45458),m=n(36633),E=n(57154);function C(e,t,n,C,A,f,I,v,_,y,T,b,S,w,N){const L=(0,E.service)(E.AuthorizationService),R=(0,E.service)(E.SecurityContextService),O=[],k={filter_all:I.instant("ttyg.agent.btn.filter.all")};let D;C.helpTemplateUrl="js/angular/ttyg/templates/chatInfo.html",C.isHelpVisible=!1,C.showChats=!0,C.showAgents=!1,C.chats=void 0,C.loadingChats=!1,C.loadingChat=!1,C.initialized=!1,C.agents=void 0,C.selectedAgent=void 0,C.loadingAgents=!1,C.reloadingAgents=!1,C.connectorID=void 0,C.canModifyAgent=!1,C.agentListFilterModel=[],C.activeRepositoryList=[],C.onopen=C.onclose=()=>angular.noop(),C.startNewChat=()=>{w.getChats().containsNewChats()||w.deselectChat()},C.toggleChatsListSidebar=()=>{C.showChats=!C.showChats},C.toggleAgentsListSidebar=()=>{C.showAgents=!C.showAgents},C.onToggleHelp=()=>{C.isHelpVisible=!C.isHelpVisible},C.onExportSelectedChat=()=>{H(w.getSelectedChat())};const U=()=>{const e=w.getDefaultAgent();return e?Promise.resolve(e):S.getDefaultAgent().then(e=>(w.setDefaultAgent(e),e))};C.onOpenNewAgentSettings=()=>{U().then(e=>{const t=(0,l.Y)(_.getActiveRepositoryObject());e.repositoryId=t.id;const n=(0,s.qC)(new i.TI({}),e,o.A1.CREATE);return{templateUrl:"js/angular/ttyg/templates/modal/agent-settings-modal.html",controller:"AgentSettingsModalController",windowClass:"agent-settings-modal",backdrop:"static",resolve:{dialogModel:function(){return new g.k(t,C.activeRepositoryList,n,o.A1.CREATE)}},size:"lg"}}).then(e=>{v.open(e).result.then($)}).catch(e=>{y.error(getError(e,0,o.LE))})},C.onOpenAgentSettings=e=>{let t=e;t||(t=w.getSelectedAgent()),U().then(e=>{const n=(0,s.qC)(t,e,o.A1.EDIT),a=(0,l.Y)(_.getActiveRepositoryObject());return{templateUrl:"js/angular/ttyg/templates/modal/agent-settings-modal.html",controller:"AgentSettingsModalController",windowClass:"agent-settings-modal",backdrop:"static",resolve:{dialogModel:function(){return new g.k(a,C.activeRepositoryList,n,o.A1.EDIT)}},size:"lg"}}).then(e=>{v.open(e).result.then(e=>{const t=w.getSelectedAgent();t&&e.id===t.id&&w.selectAgent(e),$()})}).catch(e=>{y.error(getError(e,0,o.LE))})},C.onOpenCloneAgentSettings=e=>{U().then(t=>{const n=(0,s.qC)(e,t,o.A1.CLONE);n.name=`clone-${n.name}`;const a=(0,l.Y)(_.getActiveRepositoryObject());return{templateUrl:"js/angular/ttyg/templates/modal/agent-settings-modal.html",controller:"AgentSettingsModalController",windowClass:"agent-settings-modal",backdrop:"static",resolve:{dialogModel:function(){return new g.k(a,C.activeRepositoryList,n,o.A1.CLONE)}},size:"lg"}}).then(e=>{v.open(e).result.then(e=>{const t=w.getSelectedAgent();t&&e.id===t.id&&w.selectAgent(e),$()})}).catch(e=>{y.error(getError(e,0,o.LE))})};const G=()=>(C.loadingChats=!0,S.getConversations().then(e=>w.updateChats(e)).catch(e=>{y.error(getError(e,0,o.LE)),F(new r.Fe)}).finally(()=>{C.loadingChats=!1})),$=()=>(C.reloadingAgents=!0,S.getAgents().then(e=>w.updateAgents(e)).catch(e=>{y.error(getError(e,0,o.LE))}).finally(()=>{C.reloadingAgents=!1})),M=()=>{w.setCanModifyAgent(L.isRepoManager())},x=(e,t,n)=>{if(e.timestamp=n.timestamp,t.answers=t.answers||[],t.answers.push(...n.messages),w.updateSelectedChat(e),n.continueRunId)w.emit(a.I.CONTINUE_CHAT_RUN,new p.p(t,n.continueRunId));else{const t=w.getChats();t.updateChatTimestamp(e.id,n.timestamp),t.updateChatName(e.id,n.chatName),e.name=n.name,w.updateChats(t),w.emit(a.I.LAST_MESSAGE_RECEIVED,e)}},F=e=>{e.isEmpty()?C.showChats=!1:(C.showChats=!0,w.getSelectedChat()||N.getChatId()||w.selectChat(C.chats.getFirstChat()))},H=e=>{S.exportConversation(e.id).then(function({data:t,filename:n}){(0,d.saveAs)(t,n),w.emit(a.I.CHAT_EXPORT_SUCCESSFUL,e)}).catch(()=>{w.emit(a.I.CHAT_EXPORT_FAILURE),y.error(I.instant("ttyg.chat.messages.export_failure"))})},j=()=>{const e=_.getActiveRepository(),t=_.getLocalReadableGraphdbRepositories().map(t=>new i.x_(t.id,t.id,t.id===e));C.agentListFilterModel=[new i.x_(o.OJ,k.filter_all),...t]},P=(e,t,n)=>{if(e!==_.getActiveRepository()){const a=_.getRepository(e);a&&T.openConfirmationModal({title:I.instant("common.confirm"),message:(0,h.Gz)(I.instant(t,{repositoryId:a.id})),confirmButtonKey:"ttyg.chat_panel.btn.proceed.label"},()=>{_.setRepository(a),Q(n)})}else Q(n)},Q=e=>{t.open(e,"_blank")},q=e=>{t.open(`/sparql?query=${encodeURIComponent(e)}&execute=true`,"_blank")},Y=()=>{const e=N.getChatId(),t=w.getChats();e&&t?.getChat(e)&&w.selectChat(w.getChats().getChat(e))};O.push(C.$watch(C.getActiveRepositoryObject,e=>{const t=(0,E.service)(E.AuthorizationService);e&&!t.hasGqlRights(e)&&(C.activeRepositoryList=_.getLocalReadableGraphdbRepositories().map(e=>new c.rx({value:e.id,label:e.id,data:{repository:e}})),((e=!0)=>(C.loadingAgents=e,S.getAgents().then(e=>w.updateAgents(e)).catch(e=>{y.error(getError(e,0,o.LE))}).finally(()=>{C.loadingAgents=!1})))().then(()=>(C.initialized=!0,j(),G())).then(Y),M())}),w.onSelectedChatChanged(e=>{D=void 0,e&&!e.isNew()?S.getConversation(e.id).then(t=>{w.updateSelectedChat(t),N.saveChat(e)}).catch(t=>{t.status===u.h.NOT_FOUND&&((e=>{T.openModalAlert({title:I.instant("ttyg.chat.dialog.chat_is_missing.title"),message:I.instant("ttyg.chat.dialog.chat_is_missing.body")}).result.then(function(){w.deleteChat(e)})})(e),w.emit(a.I.LOAD_CHAT_FAILURE,e))}):e&&w.updateSelectedChat(e)}),w.onChatsListChanged(e=>{C.chats=e,F(e)}),w.onCanUpdateAgentUpdated(e=>{C.canModifyAgent=e}),w.subscribe(w.onAgentsListChanged(e=>{C.agents=e})),w.subscribe(a.I.CREATE_CHAT,e=>{S.createChat(e).then(t=>{const n=r.i.getNewChat();n.name="New chat",n.id=t,w.createChat(n),N.saveChat(n),e.chatId=t,w.emit(a.I.ASK_QUESTION,e)}).catch(e=>{w.emit(a.I.CREATE_CHAT_FAILURE),y.error(getError(e,0,o.LE))})}),w.subscribe(a.I.RENAME_CHAT,e=>{S.renameConversation(e).then(()=>{w.emit(a.I.RENAME_CHAT_SUCCESSFUL),w.emit(a.I.LOAD_CHATS)}).catch(()=>{w.emit(a.I.RENAME_CHAT_FAILURE),y.error(I.instant("ttyg.chat.messages.rename_failure"))})}),w.subscribe(a.I.DELETE_CHAT,e=>{w.emit(a.I.DELETING_CHAT,{chatId:e.id,inProgress:!0}),S.deleteConversation(e.id).then(()=>{w.emit(a.I.DELETE_CHAT_SUCCESSFUL,e);const t=w.getChats();t.deleteChat(e),w.updateChats(t)}).catch(()=>{w.emit(a.I.DELETE_CHAT_FAILURE),y.error(I.instant("ttyg.chat.messages.delete_failure"))}).finally(()=>w.emit(a.I.DELETING_CHAT,{chatId:e.id,inProgress:!1}))}),w.subscribe(a.I.CANCEL_PENDING_QUESTION,e=>{const t=e.chatId||w.getSelectedChat().id;D=S.cancelPendingQuestion(t).then(e=>(w.emit(a.I.PENDING_QUESTION_CANCELED_SUCCESSFUL),e)).catch(e=>(w.emit(a.I.CANCEL_PENDING_QUESTION_FAILURE),e))}),w.subscribe(a.I.CHAT_EXPORT,H),w.subscribe(a.I.ASK_QUESTION,e=>{w.emit(a.I.ASK_QUESTION_STARTING),D=void 0,S.askQuestion(e).then(t=>{const n=w.getSelectedChat();if(n&&n.id===e.chatId){if(n.isNew()){n.new=!1;const e=w.getChats();e.setChatAsOld(n.id),w.updateChats(e)}((e,t,n)=>{D?D.then(a=>{const o=w.getSelectedChat();o&&o.id!==t.chatId||(new m.Z({message:a.data.message,status:a.data.runStatus,isTerminalState:!0,tokenUsageInfo:n.tokenUsageInfo}).addToChatAnswer(n),e.chatHistory.appendItem(t),x(e,t,n))}):(e.chatHistory.appendItem(t),x(e,t,n))})(n,e,t)}}).catch(e=>{w.emit(a.I.ASK_QUESTION_FAILURE),y.error(getError(e,0,o.LE))})}),w.subscribe(a.I.CONTINUE_CHAT_RUN,e=>{S.continueChatRun(e).then(t=>{const n=e.chatId,a=w.getSelectedChat();if(a&&a.id===n){const e=a.chatHistory.items,n=e[e.length-1];x(a,n,t)}}).catch(e=>{w.emit(a.I.ASK_QUESTION_FAILURE),y.error(getError(e,0,o.LE))})}),w.subscribe(a.I.LOAD_CHATS,G),w.subscribe(a.I.OPEN_AGENT_SETTINGS,C.onOpenNewAgentSettings),w.subscribe(a.I.EDIT_AGENT,C.onOpenAgentSettings),w.subscribe(a.I.CLONE_AGENT,C.onOpenCloneAgentSettings),w.subscribe(a.I.DELETE_AGENT,e=>{w.emit(a.I.DELETING_AGENT,{agentId:e.id,inProgress:!0}),S.deleteAgent(e.id).then(()=>$()).then(()=>{w.emit(a.I.AGENT_DELETED,e),C.selectedAgent&&C.selectedAgent.id===e.id&&(C.selectedAgent=void 0)}).catch(e=>{y.error(getError(e,0,o.LE))}).finally(()=>{w.emit(a.I.DELETING_AGENT,{agentId:e.id,inProgress:!1})})}),w.subscribe(a.I.AGENT_SELECTED,e=>{C.selectedAgent=e}),w.subscribe(a.I.GO_TO_CREATE_SIMILARITY_VIEW,e=>{P(e.repositoryId,"ttyg.agent.create_agent_modal.dialog.confirm_repository_change_before_open_similarity.body","similarity/index/create")}),w.subscribe(a.I.GO_TO_AUTOCOMPLETE_INDEX_VIEW,e=>{P(e.repositoryId,"ttyg.agent.create_agent_modal.dialog.confirm_repository_change_before_open_autocomplete_index.body","autocomplete")}),w.subscribe(a.I.GO_TO_CONNECTORS_VIEW,e=>{P(e.repositoryId,"ttyg.agent.create_agent_modal.dialog.confirm_repository_change_before_open_connectors.body","connectors")}),w.subscribe(a.I.GO_TO_SPARQL_EDITOR,e=>{if(e.repositoryId!==_.getActiveRepository()){const t=_.getRepository(e.repositoryId);t&&T.openConfirmation(I.instant("common.confirm"),(0,h.Gz)(I.instant("ttyg.chat_panel.dialog.confirm_repository_change.body",{repositoryId:e.repositoryId})),()=>{_.setRepository(t),q(e.query)})}else q(e.query)}),n.$on("$translateChangeSuccess",()=>{k.filter_all=I.instant("ttyg.agent.btn.filter.all"),j()}),R.onAuthenticatedUserChanged(M)),C.$on("$destroy",function(){O.forEach(e=>e()),w.resetContext()})}angular.module("graphdb.framework.ttyg.controllers.ttyg-view",["toastr","graphdb.framework.utils.localstorageadapter","graphdb.framework.core.services.ttyg-service","graphdb.framework.ttyg.services.ttygcontext","graphdb.framework.ttyg.services.ttygstorage","graphdb.framework.ttyg.directives.chat-list","graphdb.framework.ttyg.directives.chat-panel","graphdb.framework.ttyg.directives.agent-list","graphdb.framework.ttyg.directives.agent-select-menu","graphdb.framework.ttyg.directives.no-agents-view","graphdb.framework.ttyg.directives.show-tooltip-on-overflow","graphdb.framework.ttyg.controllers.agent-settings-modal","graphdb.framework.core.directives.help-info-popover"]).controller("TTYGViewCtrl",C),C.$inject=["$jwtAuth","$window","$rootScope","$scope","$http","$timeout","$translate","$uibModal","$repositories","toastr","ModalService","LocalStorageAdapter","TTYGService","TTYGContextService","TTYGStorageService"]},13815:(e,t,n)=>{n(64118),n(3909);var a=n(71920),o=n(36633),i=n(63415),r=n(98980),s=n(60529);function c(e,t,n){return{restrict:"E",templateUrl:"js/angular/ttyg/templates/chat-panel.html",link:(e,c,l)=>{e.chat=void 0,e.selectedAgent=void 0,e.chatItem=void 0,e.askingChatItem=void 0,e.waitingForLastMessage=!1,e.loadingChat=!0,e.showCancelButton=!1,e.ask=()=>{e.chatItem.question.timestamp=Date.now(),e.askingChatItem=(0,r.cloneDeep)(e.chatItem),e.chatItem.chatId?g(e.chatItem):d(),e.chatItem=p(),E(),m()},e.cancelPendingQuestion=()=>{e.showCancelButton=!1,n.emit(a.I.CANCEL_PENDING_QUESTION,e.chatItem)},e.regenerateQuestion=t=>{const n=p();n.setQuestionMessage(t.getQuestionMessage()),n.question.timestamp=Date.now(),e.askingChatItem=n,g(n),E()},e.onKeypressOnInput=t=>{e.askingChatItem||"Enter"!==t.key||t.shiftKey||t.ctrlKey||e.ask()},e.onAskHowDeliveredAnswer=()=>{const n=p();n.setQuestionMessage(t.instant("ttyg.chat_panel.btn.derive_answer.label")),n.question.timestamp=Date.now(),e.askingChatItem=(0,r.cloneDeep)(n),g(n),E()},e.getAgentName=e=>{const a=n.getAgent(e);return a?a.name:(0,s.Gz)(t.instant("ttyg.chat_panel.deleted_agent"))};const d=()=>{n.emit(a.I.CREATE_CHAT,e.chatItem)},g=e=>{n.emit(a.I.ASK_QUESTION,e)},h=t=>{e.waitingForLastMessage=t,e.showCancelButton=t},u=()=>{e.chatItem=(0,r.cloneDeep)(e.askingChatItem),e.askingChatItem=void 0,h(!1)},p=()=>{const t=new i.T;return t.question=new o.Z({role:o.W.USER}),e.chat&&(t.chatId=e.chat.id),e.selectedAgent&&(t.agentId=e.selectedAgent.id),t},m=()=>{setTimeout(()=>{const e=document.querySelector(".question-input");e&&e.focus()})},E=()=>{setTimeout(()=>{const e=c.find(".chat-details")[0];e&&(e.scrollTop=e.scrollHeight)})},C=()=>{e.chat=void 0,e.loadingChat=!1,e.chatItem=p(),e.askingChatItem=void 0,h(!1),m()},A=[e.$watchCollection("chat.chatHistory.items",E),n.onSelectedChatUpdated(t=>{if(e.chat=t,!e.chat||e.chat.isNew())return;e.loadingChat=!1;const a=e.chatItem.question.message;if(e.chatItem=p(),e.chatItem.question.message=a,e.askingChatItem=void 0,e.chat){const t=e.chat.chatHistory.getLast();t&&t.agentId&&n.selectAgent(n.getAgent(t.agentId))}m()}),n.onLastMessageReceived(()=>{h(!1)}),n.onSelectedAgentChanged(t=>{e.selectedAgent=t,e.selectedAgent&&e.chatItem&&(e.chatItem.agentId=e.selectedAgent.id),m()}),n.onSelectedChatChanged(t=>{t?(e.loadingChat=!t.isNew(),e.chatItem=p(),h(!1),m()):C()}),n.subscribe(a.I.LOAD_CHAT_FAILURE,()=>{e.loadingChat=!1,e.chatItem=p(),m()}),n.subscribe(a.I.ASK_QUESTION_FAILURE,u),n.subscribe(a.I.CREATE_CHAT_FAILURE,u),n.subscribe(a.I.DELETE_CHAT_SUCCESSFUL,t=>{e.chat&&t.id===e.chat.id&&C()}),n.subscribe(a.I.ASK_QUESTION_STARTING,()=>{h(!0)})];e.$on("$destroy",()=>{A.forEach(e=>e())}),e.chatItem=p(),m()}}}angular.module("graphdb.framework.ttyg.directives.chat-panel",["graphdb.framework.ttyg.directives.chat-item-detail","graphdb.framework.core.directives.editable-content"]).directive("chatPanel",c),c.$inject=["toastr","$translate","TTYGContextService"]},29350:(e,t,n)=>{var a=n(60529),o=n(71920);function i(e,t,n,i,r){return{restrict:"E",templateUrl:"js/angular/ttyg/templates/agent-list.html",scope:{agentList:"=",agentListFilterModel:"="},link:(i,s,c)=>{i.selectedAgent=void 0,i.selectedAgentsFilter=void 0,i.deletingAgent=void 0,i.onEditAgent=t=>{e.emit(o.I.EDIT_AGENT,t)},i.onExternalIntegration=e=>{r.open(e)},i.onCloneAgent=t=>{e.emit(o.I.CLONE_AGENT,t)},i.onDeleteAgent=i=>{const r=n.instant("ttyg.agent.delete_agent_modal.title"),s=(0,a.Gz)(n.instant("ttyg.agent.delete_agent_modal.body",{agentName:i.name}));t.openConfirmation(r,s,()=>e.emit(o.I.DELETE_AGENT,i))},i.onAgentsFilterChange=e=>{i.selectedAgentsFilter=e,i.selectedAgentsFilter&&i.agentList.filterByRepository(i.selectedAgentsFilter.key)};const l=()=>{const e=i.agentListFilterModel.find(e=>e.selected);i.selectedAgentsFilter=e||i.agentListFilterModel[0],i.onAgentsFilterChange(i.selectedAgentsFilter)},d=[];d.push(i.$watch("agentListFilterModel",l)),d.push(e.subscribe(o.I.DELETING_AGENT,e=>{i.deletingAgent=e})),d.push(e.onSelectedAgentChanged(e=>{i.selectedAgent=e})),i.$on("$destroy",()=>{d.forEach(e=>e())}),l()}}}n(84430),angular.module("graphdb.framework.ttyg.directives.agent-list",["graphdb.framework.ttyg.services.externalIntegrationModal"]).directive("agentList",i),i.$inject=["TTYGContextService","ModalService","$translate","$uibModal","ExternalIntegrationModalService"]},42618:()=>{function e(e){return{restrict:"E",scope:{fieldName:"@",source:"=",onSave:"&",onCancel:"&",onClick:"&",onDblclick:"&",isEditing:"="},templateUrl:"js/angular/core/directives/inline-editable-text/templates/inline-editable-text.template.html",link:function(t,n){t.editableModel={};const a=[];let o;t.onKeydown=e=>{"Enter"===e.key?(r(),t.editableModel.text!==t.text&&t.onSave({newText:t.editableModel.text,source:t.source})):"Escape"===e.key&&i()},t.onCancelEditing=()=>{i()},t.onSelect=()=>{o?(r(),t.onDblclick({source:t.source})):o=e(function(){t.onClick({source:t.source}),r()},250)};const i=()=>{r(),t.onCancel()},r=()=>{e.cancel(o),o=void 0};a.push(t.$watch("isEditing",a=>{a&&(t.editableModel.text=t.source[t.fieldName],e(()=>{const e=n.find("input")[0];e.focus(),e.select()},0))})),t.$on("$destroy",()=>{a.forEach(e=>e()),r()})}}}angular.module("graphdb.framework.core.directives.inline-editable-text",[]).directive("inlineEditableText",e),e.$inject=["$timeout"]},43319:(e,t,n)=>{n.d(t,{k:()=>a});class a{constructor(e,t,n,a){this.activeRepositoryInfo=e,this.activeRepositoryList=t,this.agentFormModel=n,this.operation=a}}},44874:(e,t,n)=>{var a=n(38940),o=n(71920);function i(e,t,n,i,r){return{restrict:"E",templateUrl:"js/angular/ttyg/templates/agent-select-menu.html",scope:{},link:n=>{n.agentOptionsList=[],n.selectedAgent=void 0,n.onAgentSelected=(a,c)=>{if(!c.isCompatible)return a.stopPropagation(),void a.preventDefault();if(s(c),r.saveAgent(c),n.selectedAgent=c,e.selectAgent(c),c.isRepositoryDeleted){const n=t.instant("ttyg.agent.agent_select_menu.configure_agent_modal.title"),a=t.instant("ttyg.agent.agent_select_menu.configure_agent_modal.body");i.openConfirmation(n,a,()=>e.emit(o.I.EDIT_AGENT,c))}};const s=e=>{n.agentOptionsList.forEach(t=>{t.selected=t.data.agent===e})},c=e=>{s(e),n.selectedAgent=e},l=[];l.push(e.onAgentsListChanged(t=>{var o;o=t,n.agentOptionsList=o.agents.map(e=>new a.rx({value:e.id,label:e.name,data:{agent:e}})),(()=>{let t;const a=r.getAgentId();a&&n.agentOptionsList.forEach(e=>{e.data.agent.id===a&&(t=e.data.agent)}),!t&&n.agentOptionsList[0]&&(t=n.agentOptionsList[0].data.agent),c(t),e.selectAgent(t)})()})),l.push(e.subscribe(o.I.AGENT_DELETED,t=>{n.selectedAgent&&n.selectedAgent.id===t.id&&(n.selectedAgent.isDeleted=!0,e.selectAgent(n.selectedAgent))})),l.push(e.onSelectedAgentChanged(c)),n.$on("$destroy",()=>{l.forEach(e=>e())})}}}angular.module("graphdb.framework.ttyg.directives.agent-select-menu",[]).directive("agentSelectMenu",i),i.$inject=["TTYGContextService","$translate","$sce","ModalService","TTYGStorageService"]},60039:(e,t,n)=>{n(42618);var a=n(71920),o=n(65820),i=n(60529);function r(e,t,n,r){return{restrict:"E",templateUrl:"js/angular/ttyg/templates/chat-list.html",link:s=>{s.selectedChat=void 0,s.renamedChat=void 0,s.deletingChat=void 0,s.onSelectChatForRenaming=e=>{s.renamedChat=e},s.onSelectChat=t=>{if(!s.selectedChat||s.selectedChat.id!==t.id){const n=e.getChats().getNonPersistedChat();n&&e.deleteChat(n),e.selectChat(t),s.renamedChat=void 0}},s.onDeleteChat=o=>{const r=n.instant("ttyg.dialog.delete.title"),s=(0,i.Gz)(n.instant("ttyg.dialog.delete.body",{chatName:o.name}));t.openConfirmation(r,s,()=>e.emit(a.I.DELETE_CHAT,o))},s.onRenameChat=(t,n)=>{n.name=t,s.renamedChat=void 0,e.emit(a.I.RENAME_CHAT,n)},s.onExportChat=t=>{e.emit(a.I.CHAT_EXPORT,t)},s.onCancelChatRenaming=()=>{s.renamedChat=void 0},s.getHumanReadableChatGroupTimestamp=e=>(0,o.Q)(n,r,e);const c=e=>{s.selectedChat=e},l=[];l.push(e.onSelectedChatChanged(c)),l.push(e.onSelectedChatUpdated(c)),l.push(e.onChatsListChanged(e=>{s.chatList=e})),l.push(e.subscribe(a.I.DELETING_CHAT,e=>{s.deletingChat=e})),s.$on("$destroy",()=>{l.forEach(e=>e())})}}}angular.module("graphdb.framework.ttyg.directives.chat-list",["graphdb.framework.core.directives.inline-editable-text"]).directive("chatList",r),r.$inject=["TTYGContextService","ModalService","$translate","$filter"]},62062:()=>{angular.module("graphdb.framework.ttyg.directives.show-tooltip-on-overflow",[]).directive("showTooltipOnOverflow",function(){return{link:function(e,t){setTimeout(function(){const n=t[0].querySelector(".editable-text-element");n&&(n.scrollWidth>n.clientWidth?t.attr("title",e.chat.name):t.removeAttr("title"))},0)}}})},76752:function(e,t,n){var a,o=o||function(e){if("undefined"==typeof navigator||!/MSIE [1-9]\./.test(navigator.userAgent)){var t=e.document,n=function(){return e.URL||e.webkitURL||e},a=t.createElementNS("http://www.w3.org/1999/xhtml","a"),o=e.webkitRequestFileSystem,i=e.requestFileSystem||o||e.mozRequestFileSystem,r=function(t){(e.setImmediate||e.setTimeout)(function(){throw t},0)},s="application/octet-stream",c=0,l=function(t){var a=function(){"string"==typeof t?n().revokeObjectURL(t):t.remove()};e.chrome?a():setTimeout(a,500)},d=function(e,t,n){for(var a=(t=[].concat(t)).length;a--;){var o=e["on"+t[a]];if("function"==typeof o)try{o.call(e,n||e)}catch(e){r(e)}}},g=function(e){return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\ufeff",e],{type:e.type}):e},h=function(t,r){t=g(t);var h,u,p,m=this,E=t.type,C=!1,A=function(){d(m,"writestart progress write writeend".split(" "))},f=function(){!C&&h||(h=n().createObjectURL(t)),u?u.location.href=h:null==e.open(h,"_blank")&&"undefined"!=typeof safari&&(e.location.href=h),m.readyState=m.DONE,A(),l(h)},I=function(e){return function(){if(m.readyState!==m.DONE)return e.apply(this,arguments)}},v={create:!0,exclusive:!1};if(m.readyState=m.INIT,r||(r="download"),a)return h=n().createObjectURL(t),a.href=h,a.download=r,void setTimeout(function(){var e,t;e=a,t=new MouseEvent("click"),e.dispatchEvent(t),A(),l(h),m.readyState=m.DONE});e.chrome&&E&&E!==s&&(p=t.slice||t.webkitSlice,t=p.call(t,0,t.size,s),C=!0),o&&"download"!==r&&(r+=".download"),(E===s||o)&&(u=e),i?(c+=t.size,i(e.TEMPORARY,c,I(function(e){e.root.getDirectory("saved",v,I(function(e){var n=function(){e.getFile(r,v,I(function(e){e.createWriter(I(function(n){n.onwriteend=function(t){u.location.href=e.toURL(),m.readyState=m.DONE,d(m,"writeend",t),l(e)},n.onerror=function(){var e=n.error;e.code!==e.ABORT_ERR&&f()},"writestart progress write abort".split(" ").forEach(function(e){n["on"+e]=m["on"+e]}),n.write(t),m.abort=function(){n.abort(),m.readyState=m.DONE},m.readyState=m.WRITING}),f)}),f)};e.getFile(r,{create:!1},I(function(e){e.remove(),n()}),I(function(e){e.code===e.NOT_FOUND_ERR?n():f()}))}),f)}),f)):f()},u=h.prototype;return"undefined"!=typeof navigator&&navigator.msSaveOrOpenBlob?function(e,t){return navigator.msSaveOrOpenBlob(g(e),t)}:(u.abort=function(){var e=this;e.readyState=e.DONE,d(e,"abort")},u.readyState=u.INIT=0,u.WRITING=1,u.DONE=2,u.error=u.onwritestart=u.onprogress=u.onwrite=u.onabort=u.onerror=u.onwriteend=null,function(e,t){return new h(e,t)})}}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||this.content);e.exports?e.exports.saveAs=o:null!==n.amdD&&null!=n.amdO&&(void 0===(a=function(){return o}.apply(t,[]))||(e.exports=a))},78508:()=>{angular.module("graphdb.framework.core.directives.help-info-popover",[]).directive("helpInfoPopover",function(){return{restrict:"E",scope:{helpInfo:"="},templateUrl:"js/angular/ttyg/templates/modal/helpInfoPopoverTemplate.html",link:function(e,t){e.isPopoverOpen=!1;const n=()=>{e.$apply(()=>{e.isPopoverOpen=!0})},a=()=>{e.$apply(()=>{e.isPopoverOpen=!1})};t.on("mouseenter",n),t.on("mouseleave",a),e.$on("$destroy",function(){t.off("mouseenter",n),t.off("mouseleave",a)})}}})},81801:(e,t,n)=>{n.d(t,{h:()=>a});const a={BAD_REQUEST:400,UNAUTHORIZED:401,FORBIDDEN:403,NOT_FOUND:404,CONFLICT:409,INTERNAL_SERVER_ERROR:500,SERVICE_UNAVAILABLE:503}},87054:()=>{function e(e,t){const n={agent:{id:void 0},chat:{id:void 0}},a=()=>{let a=e.get(t.TTYG);return a||(a=n),a.agent||(a.agent={}),a.chat||(a.chat={}),a};return{saveAgent:function(n){const o=a();o.agent.id=n?n.id:void 0,e.set(t.TTYG,o)},getAgentId:function(){const e=a();if(e.agent)return e.agent.id},saveChat:function(n){const o=a();o.chat.id=n?n.id:void 0,e.set(t.TTYG,o)},getChatId:function(){const e=a();if(e.chat)return e.chat.id}}}angular.module("graphdb.framework.ttyg.services.ttygstorage",[]).factory("TTYGStorageService",e),e.$inject=["LocalStorageAdapter","LSKeys"]}}; //# sourceMappingURL=12358.682decea79778402c55d.bundle.js.map