"use strict";(self.webpackChunkpergamon_server_extension=self.webpackChunkpergamon_server_extension||[]).push([[509],{509:(e,t,o)=>{o.r(t),o.d(t,{default:()=>i});var n=o(598);const i={id:"pergamon_server_extension:plugin",description:"Calliope server extension",requires:[n.INotebookTracker],autoStart:!0,activate:(e,t)=>{t.widgetAdded.connect(((e,t)=>{t.sessionContext.ready.then((()=>{var e;const o=t.sessionContext.session;(null==o?void 0:o.kernel)&&(o.kernel.registerCommTarget("toggle_fixing",(e=>{e.onMsg=e=>{const o=t.content.activeCell;if(o){const e=o;e.model.sharedModel&&e.node.classList.toggle("calliope-thinking")}}})),null===(e=null==o?void 0:o.kernel)||void 0===e||e.registerCommTarget("replace_cell",(e=>{e.onMsg=e=>{const o=e.content.data.replace_with,i=t.content.activeCell;if(i&&"code"===i.model.type){const e=i;e.editor&&(e.model.sharedModel.setSource(o),n.NotebookActions.run(t.content,t.sessionContext))}}})),o.kernel.registerCommTarget("insert_new_cell",(e=>{e.onMsg=e=>{const o=e.content.data.cell_content,i=e.content.data.execute_cell;n.NotebookActions.insertBelow(t.content),n.NotebookActions.changeCellType(t.content,"code"),t.content.activeCell.model.sharedModel.setSource(o),i&&n.NotebookActions.run(t.content,t.sessionContext)}})),o.kernel.requestExecute({code:"\n%load_ext jupyter_ai\n%ai register anthropic-chat anthropic-chat:claude-2.0\n%ai register native-cohere cohere:command\n%ai register bedrock-cohere bedrock:cohere.command-text-v14\n%ai register anthropic anthropic:claude-v1\n%ai register bedrock bedrock:amazon.titan-text-lite-v1\n%ai register gemini gemini:gemini-1.0-pro-001\n%ai register gpto openai-chat:gpt-4o\n%ai delete ernie-bot\n%ai delete ernie-bot-4\n%ai delete titan\n%load_ext pergamon_server_extension\n"}).done.then((()=>{}))),n.NotebookActions.executionScheduled.connect(((e,t)=>{const{cell:o}=t;if("code"===o.model.type){const e=o;e.node.classList.add("executing");const t=e.model.sharedModel.source||"";(t.trim().startsWith("%%calliope")||t.trim().startsWith("%calliope"))&&e.node.classList.add("calliope-thinking")}})),n.NotebookActions.executed.connect(((e,t)=>{const{cell:o}=t;if("code"===o.model.type){const e=o;e.node.classList.remove("executing"),e.node.classList.remove("calliope-thinking")}}))}))})),new MutationObserver(((e,t)=>{const o=document.querySelector(".jp-Splash");o&&(o.remove(),t.disconnect())})).observe(document.body,{childList:!0,subtree:!0})}}}}]);