????

Your IP : 3.22.242.214


Current Path : C:/inetpub/vhost/dbadm.gdtsolutions.vn/web/js/
Upload File :
Current File : C:/inetpub/vhost/dbadm.gdtsolutions.vn/web/js/plugin-sql-editor-new-a35743504a407e959c9d.js

/*! For license information please see ../license.txt */
"use strict";(self.webpackChunk_cloudbeaver_product_default=self.webpackChunk_cloudbeaver_product_default||[]).push([[46696],{39998:(e,t,r)=>{r.r(t),r.d(t,{LocaleService:()=>a});var n=r(1118),i=r(82103),o=r(5576),s=r(34227);let a=class LocaleService extends i.j{constructor(e){super(),this.localizationService=e}register(){this.localizationService.addProvider(this.provider.bind(this))}load(){}async provider(e){switch(e){case"ru":return(await Promise.all([r.e(92436),r.e(93371)]).then(r.bind(r,40626))).default;case"it":return(await Promise.all([r.e(32756),r.e(70990)]).then(r.bind(r,86574))).default;case"zh":return(await Promise.all([r.e(52041),r.e(48609)]).then(r.bind(r,24349))).default;case"fr":return(await Promise.all([r.e(29671),r.e(5276)]).then(r.bind(r,57599))).default;default:return(await Promise.all([r.e(41114),r.e(82895)]).then(r.bind(r,72640))).default}}};a=(0,n.Cg)([(0,o._)(),(0,n.Sn)("design:paramtypes",[s.LocalizationService])],a)},35936:(e,t,r)=>{r.r(t),r.d(t,{PluginBootstrap:()=>a});var n=r(1118),i=r(82103),o=r(5576),s=r(23521);let a=class PluginBootstrap extends i.j{constructor(e){super(),this.sqlCodeEditorPanelService=e}register(){this.sqlCodeEditorPanelService.registerPanel()}load(){}};a=(0,n.Cg)([(0,o._)(),(0,n.Sn)("design:paramtypes",[s.SQLCodeEditorPanelService])],a)},84790:(e,t,r)=>{r.d(t,{SQLCodeEditor:()=>a});var n=r(41773),i=r(7838),o=r(15993),s=r(94302);const a=(0,i.PA)((0,o.forwardRef)((function SQLCodeEditor(e,t){return(0,n.jsx)(s.Z,{...e,ref:t})})))},2293:(e,t,r)=>{r.d(t,{m:()=>c});var n=r(41773),i=r(7838),o=r(15993),s=r(38857);const a=(0,s.mC)((async function loader(){const{SQLCodeEditor:e}=await Promise.all([r.e(46696),r.e(81191)]).then(r.bind(r,84790));return{SQLCodeEditor:e}})),c=(0,i.PA)((0,o.forwardRef)((function SQLCodeEditorLoader(e,t){return(0,n.jsx)(s.CW,{loader:a,children:({SQLCodeEditor:r})=>(0,n.jsx)(r,{...e,ref:t})})})))},13752:(e,t,r)=>{r.r(t),r.d(t,{SQLCodeEditorPanel:()=>$});var n=r(41773),i=r(7838),o=r(15993),s=r(17675),a=r(64928),c=r(91184),l=r(22347),d=r(18699),u=r(14452),h=r(64809),p=r(14841),g=r(35350),m=r(94819),f=r(42453),v=r(87988),S=r(18007),L=r(28573),C=r(80624);const _=v.Pe.define({map:(e,t)=>({from:t.mapPos(e.from),to:void 0===e.to?void 0:t.mapPos(e.to)})}),y=v.Pe.define(),w=C.NZ.mark({class:"active-query"}),x=v.sU.define({create:()=>C.NZ.none,update(e,t){e=e.map(t.changes);for(const r of t.effects){if(r.is(_)){if(r.value.from===r.value.to)return e;e=e.update({add:[w.range(r.value.from,r.value.to)]})}r.is(y)&&(e=e.update({filter:()=>!1}))}return e},provide:e=>C.Lz.decorations.from(e)});const P=new class extends C.wJ{},Q=new class extends C.wJ{toDOM(){const e=document.createElement("div");return e.className="running-query-line",e}},b=new class extends C.wJ{toDOM(){const e=document.createElement("div");return e.className="running-query-error-line",e}},E=v.Pe.define({map:(e,t)=>({pos:t.mapPos(e.pos),on:e.on,type:e.type})}),q=v.sU.define({create:()=>v.om.empty,update(e,t){e=e.map(t.changes);for(const r of t.effects)if(r.is(E))if(r.value.on){const t=[];"run"===r.value.type&&t.push(Q.range(r.value.pos)),"error"===r.value.type&&t.push(b.range(r.value.pos)),e=e.update({add:t})}else e=e.update({filter:()=>!1});return e}});function setGutter(e,t,r,n){e.dispatch({effects:E.of({pos:t,on:n,type:r})})}const j=[q,(0,C.cU)({class:"query-status",markers:e=>e.state.field(q),initialSpacer:()=>P})];var A=r(2293),N=r(94866),k=r(28347);function useSQLCodeEditor(e){return(0,k.G)((()=>({get view(){return this.editorRef?.view??null},get state(){return this.editorRef?.view?.state??null},highlightActiveQuery(e,t){this.view&&(t&&t>this.view.state.doc.length||function highlightActiveQuery(e,t,r){e.dispatch({effects:_.of({from:t,to:r})})}(this.view,e,t))},clearActiveQueryHighlight(){this.view&&function clearActiveQueryHighlight(e){e.dispatch({effects:y.of(null)})}(this.view)},highlightExecutingLine(e,t){this.view&&setGutter(this.view,e,"run",t)},highlightExecutingErrorLine(e,t){this.view&&setGutter(this.view,e,"error",t)},resetLineStateHighlight(){this.view&&(setGutter(this.view,0,"run",!1),setGutter(this.view,0,"error",!1))}})),{editorRef:N.sH.ref},{editorRef:e})}var H=r(38857),M=r(77337),D=r(34227),B=r(56191);const G=(0,H.mC)((()=>Promise.resolve().then(r.bind(r,6307)))),I=/[\s()[\]{};:>,=\\*]/,R=/[\w*]*/;var U=r(49759);const O={reactCodemirrorPanel:"reactCodemirrorPanel___xKGx6 theme-typography--caption",box:"box___CKkvy"};var z=r(7167);const F={container:"container___MQJ2S",info:"info___YitVa theme-typography--caption"},K=(0,i.PA)((function SqlEditorInfoBar({state:e}){const t=(0,a.d)(F),r=e.selection.main.head,i=e.doc.lineAt(r),o=r-i.from+1;return(0,n.jsx)("div",{className:(0,z.s)(t,{container:!0}),children:(0,n.jsx)("div",{className:(0,z.s)(t,{info:!0}),children:`Ln ${i.number}, Col ${o}, Pos ${r}`})})}));var V=r(8385);const $=(0,i.PA)((function SQLCodeEditorPanel({data:e}){const t=(0,d.h)(u.NotificationService),r=(0,d.h)(h.NavNodeManagerService),i=(0,s.W)(),C=(0,a.d)(O),[_,y]=(0,o.useState)(null),w=useSQLCodeEditor(_),P=function useSQLCodeEditorPanel(e,t){const r=(0,k.G)((()=>({highlightActiveQuery(){this.editor.clearActiveQueryHighlight();const e=this.data.activeSegment;e&&this.editor.highlightActiveQuery(e.begin,e.end)},onQueryChange(e){this.data.setScript(e)},onCursorChange(e,t){this.data.setCursor(e,t)}})),{onQueryChange:N.XI.bound,onCursorChange:N.XI.bound},{editor:t,data:e}),n=(0,o.useCallback)((0,V.n)((()=>r.highlightActiveQuery()),1e3),[r]);return(0,c.H)({executor:e.onUpdate,handlers:[n]}),(0,c.H)({executor:e.onExecute,handlers:[function updateHighlight(){t.resetLineStateHighlight()}]}),(0,c.H)({executor:e.onSegmentExecute,handlers:[function highlightSegment(e){t.highlightExecutingLine(e.segment.begin,"start"===e.type),"error"===e.type&&t.highlightExecutingErrorLine(e.segment.begin,!0)}]}),r}(e,w),Q=(0,f.s)(void 0,[x,v.Nb.lowest(j)]),b=function useSqlDialectAutocompletion(e){const{closeCompletion:t,useEditorAutocompletion:r}=(0,H.NB)(G),n=(0,d.h)(D.LocalizationService),i=(0,M.U)({data:e}),[s]=(0,o.useState)((()=>{function getOptionsFromProposals(e,r,i){const o=r.toLocaleLowerCase(),s=i.some((({displayString:e})=>e.toLocaleLowerCase()===o)),a=i.filter((({displayString:e})=>"*"===r||e.toLocaleLowerCase()!==o&&e.toLocaleLowerCase().startsWith(o))).sort(((e,t)=>(t.score??0)-(e.score??0)));return 0===a.length&&!s&&e?[{apply:t,label:n.translate("sql_editor_hint_empty")}]:[...a.map((e=>({label:e.displayString,apply:e.replacementString,boost:e.score,icon:e.icon})))]}return{override:[async function completionSource(e){if(e.matchBefore(I)&&!e.explicit)return null;const r=e.matchBefore(R);if(null===r)return null;try{const n=e.pos,o=await i.data.getHintProposals(n,!e.explicit),s=i.data.hintsLimitIsMet,a={from:r.from,options:getOptionsFromProposals(e.explicit,r.text,o),update(e,r,i,a){if(n>a.pos)return null;if(e.options.some((e=>e.apply===t)))return null;if(s)return null;if(a.matchBefore(I)&&!a.explicit)return null;const c=a.matchBefore(R);return null===c?null:{...e,options:getOptionsFromProposals(a.explicit,c.text,o)}},filter:!1};return 0===a.options.length?null:a}catch{return null}}],addToOptions:[{render(e){const t=document.createElement("img");return t.classList.add("cm-completionIcon"),t.setAttribute("aria-hidden","true"),e.icon&&t.setAttribute("src",B.b.absoluteUrl(e.icon)),t},position:20}],icons:!1}}));return r(s)}(e),E=(0,U.n)(e.dialect);Q.set(...b),Q.set(...E);const q=(0,m.p)({canDrop:e=>e.has(p.G),onDrop:async(n,i)=>{const o=(0,g.x)(n),s=_?.view;if(s&&i)try{const t=s.posAtCoords({x:i.x,y:i.y})??1;await e.executeQueryAction(e.cursorSegment,(async()=>{const e=[];for(const t of o)e.push(await r.getNodeDatabaseAlias(t.id));const n=e.join(", ");n&&s.dispatch({changes:{from:t,to:t,insert:n},selection:{anchor:t,head:t+n.length}})}),!0,!0)}catch(e){t.logException(e,"sql_editor_alias_loading_error")}}});return(0,c.H)({executor:e.onExecute,handlers:[function updateHighlight(){w.view&&(0,S.N)(w.view)}]}),(0,n.jsx)("div",{ref:q.setRef,className:C.box,children:(0,n.jsxs)(A.m,{ref:y,getValue:()=>e.value,cursor:{anchor:e.cursor.begin,head:e.cursor.end},incomingValue:e.incomingValue,extensions:Q,readonly:e.readonly,autoFocus:!0,lineNumbers:!0,onChange:P.onQueryChange,onCursorChange:e=>P.onCursorChange(e.from,e.to),children:[e.isIncomingChanges&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(L.K,{className:C.reactCodemirrorPanel,top:!0,children:(0,n.jsx)(l.j,{title:i("plugin_sql_editor_new_merge_conflict_keep_current_tooltip"),onClick:function keepCurrent(){e.dataSource?.keepCurrent()},children:i("plugin_sql_editor_new_merge_conflict_keep_current_label")})}),(0,n.jsx)(L.K,{className:C.reactCodemirrorPanel,top:!0,incomingView:!0,children:(0,n.jsx)(l.j,{title:i("plugin_sql_editor_new_merge_conflict_accept_incoming_tooltip"),onClick:function applyIncoming(){e.dataSource?.applyIncoming()},children:i("plugin_sql_editor_new_merge_conflict_accept_incoming_label")})})]}),w.state&&(0,n.jsx)(L.K,{children:(0,n.jsx)(K,{state:w.state})})]})})}))},23521:(e,t,r)=>{r.r(t),r.d(t,{SQLCodeEditorPanelService:()=>l});var n=r(1118),i=r(50420),o=r(5576),s=r(80957),a=r(97469);const c=(0,i.j)((()=>Promise.all([r.e(11502),r.e(7542),r.e(97493),r.e(67557),r.e(44134),r.e(88761),r.e(46696),r.e(11116),r.e(62570),r.e(95860),r.e(15752)]).then(r.bind(r,13752)).then((e=>e.SQLCodeEditorPanel))));let l=class SQLCodeEditorPanelService{constructor(e){this.sqlEditorModeService=e}registerPanel(){this.sqlEditorModeService.tabsContainer.add({key:"sql-editor",icon:"/icons/sql_script_sm.svg",name:"sql_editor_script_editor",isHidden:(e,t)=>!0!==t?.data.dataSource?.hasFeature(s.A.script),panel:()=>c})}};l=(0,n.Cg)([(0,o._)(),(0,n.Sn)("design:paramtypes",[a.SqlEditorModeService])],l)},49759:(e,t,r)=>{r.d(t,{n:()=>useSqlDialectExtension});var n=r(15993),i=r(38857),o=r(87988),s=r(6307);const a=(0,i.mC)((()=>Promise.resolve().then(r.bind(r,6307)))),c=new o.xx;function useSqlDialectExtension(e){const{SQLDialect:t,SQL_EDITOR:r}=(0,i.NB)(a),o=function getDialectLoader(e){switch(e){case"PostgreSQL":return s.PostgreSQLLoader;case"MySQL":return s.MySQLLoader;case"MariaSQL":return s.MariaSQLLoader;case"SQLServer":return s.MSSQLLoader;case"SQLite":return s.SQLiteLoader;case"CQL":return s.CassandraLoader;case"PLSQL":return s.PLSQLLoader;default:return s.StandardSQLLoader}}(e?.name),l=(0,i.NB)(o);return(0,n.useMemo)((()=>{let n=l;return e&&(n=t.define({keywords:e.reservedWords.join(" ").toLowerCase(),builtin:e.functions.join(" ").toUpperCase(),types:e.dataTypes.join(" ").toUpperCase(),hashComments:e.singleLineComments.includes("#"),slashComments:e.singleLineComments.includes("//"),doubleDollarQuotedStrings:e.quoteStrings.some((e=>e.includes("$$"))),doubleQuotedStrings:e.quoteStrings.some((e=>e.includes('"')))})),[c,r({dialect:n})]}),[l,e])}}}]);