UNPKG

n8n-editor-ui

Version:

Workflow Editor UI for n8n

2 lines 2.68 kB
(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{};e.SENTRY_RELEASE={id:`n8n@2.13.4`}}catch{}})();try{(function(){var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`66f9ae6a-d3ba-40b4-9a60-602a9b926de0`,e._sentryDebugIdIdentifier=`sentry-dbid-66f9ae6a-d3ba-40b4-9a60-602a9b926de0`)})()}catch{}import{$ as e,E as t,Ft as n,N as r,S as i,_n as a,gt as o,it as s}from"./vue.runtime.esm-bundler-D9KLAxvJ.js";import{M as c,O as l}from"./_MapCache-CUJwh2qp.js";import{Ht as u,_t as d}from"./src-wni2AGA3.js";import{t as f}from"./_plugin-vue_export-helper-Dm3nT7Ps.js";import{As as p,Ft as m,at as h,r as g}from"./users.store-BHWXXawf.js";import{cs as _,di as v,ds as y,fi as b,hi as x,ic as S,li as C,ls as w,us as T}from"./constants-CIP7tKq1.js";import{l as E}from"./constants-B7scOakb.js";import{g as D,h as O}from"./chat.store-Bg89IR0u.js";const k=T(x,y().or(_())),A=b.and(w({cachedDisplayName:y().optional(),cachedIcon:v.optional()})).transform(e=>({...e,cachedDisplayName:e.cachedDisplayName||(D(e)?e.model:``)}));function j(e){let t=n(!1),r=h(),a=p(),s=m(),l=c(S(e),{},{writeDefaults:!1,shallow:!0,serializer:{read:e=>{try{return k.parse(JSON.parse(e))}catch{return{}}},write:e=>JSON.stringify(e)}}),u=i(()=>t.value||r.allCredentials.length>0),d=i(()=>Object.fromEntries(x.options.map(e=>{if(!O(e))return[e,null];let t=C[e];if(!t)return[e,null];let n=r.getCredentialsByType(t),i=a.moduleSettings?.[`chat-hub`]?.providers[e];return i?.credentialId&&n.some(e=>e.id===i.credentialId)?[e,i.credentialId]:[e,n.toSorted((e,t)=>new Date(t.createdAt)-+new Date(e.createdAt))[0]?.id??null]}))),f=i(()=>u.value?x.options.reduce((e,t)=>{let n=l.value[t]??null;return e[t]=n&&r.allCredentials.some(e=>e.id===n)?n:d.value[t],e},{}):null);function g(e,t){l.value={...l.value,[e]:t}}return o(()=>s.personalProject,async e=>{e&&(await Promise.all([r.fetchCredentialTypes(!1),r.fetchAllCredentialsForWorkflow({projectId:e.id})]),t.value=!0)},{immediate:!0}),{credentialsByProvider:f,selectCredential:g}}var M=f(r({__name:`ChatLayout`,setup(n){let r=d(),i=g(),{isCtrlKeyPressed:o}=u();return l(document,`keydown`,e=>{e.key.toLowerCase()===`o`&&o(e)&&e.shiftKey&&!i.isAnyModalOpen&&(e.preventDefault(),e.stopPropagation(),r.push({name:E,force:!0}))}),(n,r)=>(e(),t(`div`,{class:a(n.$style.component)},[s(n.$slots,`default`)],2))}}),[[`__cssModules`,{$style:{component:`_component_1txea_125`}}]]);export{j as n,A as r,M as t}; //# sourceMappingURL=ChatLayout-C5PLneyp.js.map