@ws-ui/code-editor 1.8.0 → 1.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/editor/index.d.ts +0 -1
- package/dist/index.cjs.js +7 -7
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +517 -520
- package/dist/index.es.js.map +1 -1
- package/package.json +2 -2
package/dist/editor/index.d.ts
CHANGED
package/dist/index.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("react/jsx-runtime"),S=require("react"),ne=require("@monaco-editor/react"),j=require("@ws-ui/shared"),Ne=require("monaco-languageclient"),le=require("monaco-languageclient/vscode/services"),ce=require("@codingame/monaco-vscode-configuration-service-override"),we=require("@codingame/monaco-vscode-languages-service-override"),Le=require("@codingame/monaco-vscode-textmate-service-override");require("@codingame/monaco-vscode-theme-defaults-default-extension");const je=require("@codingame/monaco-vscode-editor-service-override"),ke=require("@codingame/monaco-vscode-theme-service-override"),L=require("monaco-editor"),Fe=require("monaco-languageclient/tools"),oe=require("vscode-languageclient"),te=require("vscode-ws-jsonrpc"),B=require("vscode-languageserver-protocol"),re=require("vscode/services"),ee=require("vscode/monaco");require("@codingame/monaco-vscode-standalone-languages");require("@codingame/monaco-vscode-standalone-html-language-features");require("@codingame/monaco-vscode-standalone-css-language-features");require("@codingame/monaco-vscode-standalone-json-language-features");require("@codingame/monaco-vscode-standalone-typescript-language-features");require("@codingame/monaco-vscode-css-default-extension");require("@codingame/monaco-vscode-json-default-extension");require("@codingame/monaco-vscode-html-default-extension");require("@codingame/monaco-vscode-javascript-default-extension");const We=require("vscode/extensions");var X=typeof document<"u"?document.currentScript:null;function Ze(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const a=Ze(L),Ke=()=>ce(),Ee=()=>je(()=>Promise.resolve(void 0)),Te=()=>{const n=ke(),e=n.themeService.ctor.prototype;return e.defineTheme=()=>{},n},Xe=`{
|
|
2
2
|
"workbench.colorTheme": "Default Dark+",
|
|
3
3
|
"workbench.iconTheme": "vs-seti",
|
|
4
4
|
"editor.autoClosingBrackets": "languageDefined",
|
|
@@ -83,27 +83,27 @@
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
-
`,ge=()=>ce.initUserConfiguration(
|
|
86
|
+
`,ge=()=>ce.initUserConfiguration(Xe),ue=async n=>{var o;const e=n.serviceConfig??{};e.debugLogging=((o=n.logger)==null?void 0:o.isEnabled())===!0&&(e.debugLogging===!0||n.logger.isDebugEnabled()===!0),await ge(),e.userServices=e.userServices??{};const t=e.userServices.configurationService??void 0,i=e.workspaceConfig??void 0;if(t===void 0){if(i)throw new Error("You provided a workspaceConfig without using the configurationServiceOverride");const r={...Ke(),...Te(),...Le(),...we(),...Ee()};le.mergeServices(r,e.userServices)}return i||(e.workspaceConfig={workspaceProvider:{trusted:!0,workspace:{workspaceUri:a.Uri.file("/workspace")},async open(){return!1}}}),e};class Be extends te.WebSocketMessageReader{constructor(e,t){super(e),this.onMessage=t}readMessage(e){this.onMessage&&this.onMessage();const[,t]=e.split(`\r
|
|
87
87
|
\r
|
|
88
|
-
`);if(this.state==="initial")this.events.splice(0,0,{message:t});else if(this.state==="listening"){const i=JSON.parse(t);this.callback(i)}}}class
|
|
88
|
+
`);if(this.state==="initial")this.events.splice(0,0,{message:t});else if(this.state==="listening"){const i=JSON.parse(t);this.callback(i)}}}class Oe extends te.WebSocketMessageWriter{constructor(e,t){super(e),this.onSend=t}async write(e){try{const t=JSON.stringify(e);this.socket.send(t),this.onSend&&this.onSend()}catch(t){this.errorCount++,this.fireError(t,e,this.errorCount)}}}function T(n,e=!0){const t=`/PACKAGE/Project/Sources/${n}`;return e?`file://${t}`:t}function ie(n,e=0){setTimeout(n,e)}function de(n,e){const t=new L.Selection(e.startLineNumber,e.startColumn,e.endLineNumber||e.startLineNumber,e.endColumn||e.startColumn);ie(()=>{n.setSelection(t),n.revealRangeInCenter(t),n.focus()})}function Ie(n,e,t=0){t>0&&(e=t+e),ie(()=>{n.setPosition({lineNumber:e,column:1}),n.revealLineInCenter(e),n.focus()})}function De(n,e,t){const o=n.getModel();if(o&&e){const r=o.getLineCount();for(let s=1;s<=r;s++){const p=o.getLineContent(s);if(new RegExp(`(?:Function|function) ${t}`).test(p))return s}}return 0}const Ge={provideCompletionItems:async(n,e)=>{const t=n.getWordUntilPosition(e);return{suggestions:[{label:"var",kind:a.languages.CompletionItemKind.Snippet,range:new a.Range(e.lineNumber,t.startColumn,e.lineNumber,t.endColumn),insertText:["var ${1:var_name} : ${2:var_type}"].join(`
|
|
89
89
|
`),insertTextRules:a.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"While",kind:a.languages.CompletionItemKind.Snippet,range:new a.Range(e.lineNumber,t.startColumn,e.lineNumber,t.endColumn),insertText:["While(${1:expression})"," ${2:body}","End while"].join(`
|
|
90
90
|
`),insertTextRules:a.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"Case of",kind:a.languages.CompletionItemKind.Snippet,range:new a.Range(e.lineNumber,t.startColumn,e.lineNumber,t.endColumn),insertText:["Case of"," :(${1:boolean_expression})"," ${2:body}","End case"].join(`
|
|
91
91
|
`),insertTextRules:a.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"Else",kind:a.languages.CompletionItemKind.Snippet,range:new a.Range(e.lineNumber,t.startColumn,e.lineNumber,t.endColumn),insertText:["Else"," "].join(`
|
|
92
92
|
`),insertTextRules:a.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"If",kind:a.languages.CompletionItemKind.Snippet,range:new a.Range(e.lineNumber,t.startColumn,e.lineNumber,t.endColumn),insertText:["If (${1:expression})"," ${5:body}","End if"].join(`
|
|
93
93
|
`),insertTextRules:a.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"For",kind:a.languages.CompletionItemKind.Snippet,range:new a.Range(e.lineNumber,t.startColumn,e.lineNumber,t.endColumn),insertText:["For(${1:counter};${2:start};${3:end}${4:;increment})"," ${5:body}","End for"].join(`
|
|
94
94
|
`),insertTextRules:a.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"Function",kind:a.languages.CompletionItemKind.Snippet,range:new a.Range(e.lineNumber,t.startColumn,e.lineNumber,t.endColumn),insertText:["Function ${1:function_name}(${2:params}) -> ${3:var_name} : ${4:var_type}"," ${5:body}"].join(`
|
|
95
|
-
`),insertTextRules:a.languages.CompletionItemInsertTextRule.InsertAsSnippet}]}}},
|
|
95
|
+
`),insertTextRules:a.languages.CompletionItemInsertTextRule.InsertAsSnippet}]}}},Pe={provideCompletionItems:async(n,e)=>{const t=n.getWordUntilPosition(e);return{suggestions:[{label:"var",kind:a.languages.CompletionItemKind.Snippet,range:new a.Range(e.lineNumber,t.startColumn,e.lineNumber,t.endColumn),insertText:["var ${1:var_name} : ${2:var_type}"].join(`
|
|
96
96
|
`),insertTextRules:a.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"while",kind:a.languages.CompletionItemKind.Snippet,range:new a.Range(e.lineNumber,t.startColumn,e.lineNumber,t.endColumn),insertText:["while(${1:expression})"," ${2:body}","end"].join(`
|
|
97
97
|
`),insertTextRules:a.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"switch",kind:a.languages.CompletionItemKind.Snippet,range:new a.Range(e.lineNumber,t.startColumn,e.lineNumber,t.endColumn),insertText:["switch"," :(${1:boolean_expression})"," ${2:body}","end"].join(`
|
|
98
98
|
`),insertTextRules:a.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"else",kind:a.languages.CompletionItemKind.Snippet,range:new a.Range(e.lineNumber,t.startColumn,e.lineNumber,t.endColumn),insertText:["else"," "].join(`
|
|
99
99
|
`),insertTextRules:a.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"if",kind:a.languages.CompletionItemKind.Snippet,range:new a.Range(e.lineNumber,t.startColumn,e.lineNumber,t.endColumn),insertText:["if (${1:expression})"," ${5:body}","end"].join(`
|
|
100
100
|
`),insertTextRules:a.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"for",kind:a.languages.CompletionItemKind.Snippet,range:new a.Range(e.lineNumber,t.startColumn,e.lineNumber,t.endColumn),insertText:["for(${1:counter},${2:start},${3:end}${4:,increment})"," ${5:body}","end"].join(`
|
|
101
101
|
`),insertTextRules:a.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"function",kind:a.languages.CompletionItemKind.Snippet,range:new a.Range(e.lineNumber,t.startColumn,e.lineNumber,t.endColumn),insertText:["function ${1:function_name}(${2:params}) -> ${3:var_name} : ${4:var_type}"," ${5:body}"].join(`
|
|
102
|
-
`),insertTextRules:a.languages.CompletionItemInsertTextRule.InsertAsSnippet}]}}},Je=[{keybinding:k.KeyMod.CtrlCmd|k.KeyCode.NumpadAdd,command:"editor.action.fontZoomIn"},{keybinding:k.KeyMod.CtrlCmd|k.KeyCode.Equal,command:"editor.action.fontZoomIn"},{keybinding:k.KeyMod.CtrlCmd|k.KeyCode.NumpadSubtract,command:"editor.action.fontZoomOut"},{keybinding:k.KeyMod.CtrlCmd|k.KeyCode.Minus,command:"editor.action.fontZoomOut"},{keybinding:k.KeyMod.CtrlCmd|k.KeyCode.Numpad0,command:"editor.action.fontZoomReset"},{keybinding:k.KeyMod.CtrlCmd|k.KeyCode.Digit0,command:"editor.action.fontZoomReset"}],Ve=({defaultZoom:n})=>(y.useEffect(()=>{n!==void 0&&k.editor.EditorZoom.setZoomLevel(n)},[]),null);ne.loader.config({monaco:a});var q=(n=>(n[n.NotSet=-1]="NotSet",n[n.None=0]="None",n[n.Italic=1]="Italic",n[n.Bold=2]="Bold",n[n.Underline=4]="Underline",n[n.Strikethrough=8]="Strikethrough",n))(q||{}),Ce=(n=>(n[n.None=0]="None",n[n.DefaultForeground=1]="DefaultForeground",n[n.DefaultBackground=2]="DefaultBackground",n))(Ce||{}),me=(n=>(n[n.Other=0]="Other",n[n.Comment=1]="Comment",n[n.String=2]="String",n[n.RegEx=3]="RegEx",n))(me||{});class Y{static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!==0}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static getClassNameFromMetadata(e){let i="mtk"+this.getForeground(e);const o=this.getFontStyle(e);return o&1&&(i+=" mtki"),o&2&&(i+=" mtkb"),o&4&&(i+=" mtku"),o&8&&(i+=" mtks"),i}static getInlineStyleFromMetadata(e,t){const i=this.getForeground(e),o=this.getFontStyle(e);let r=`color: ${t[i]};`;o&1&&(r+="font-style: italic;"),o&2&&(r+="font-weight: bold;");let s="";return o&4&&(s+=" underline"),o&8&&(s+=" line-through"),s&&(r+=`text-decoration:${s};`),r}static getPresentationFromMetadata(e){const t=this.getForeground(e),i=this.getFontStyle(e);return{foreground:t,italic:!!(i&1),bold:!!(i&2),underline:!!(i&4),strikethrough:!!(i&8)}}}function Ye(n,e,t,i){const o=t.tokens.data,r=n.getLanguageId();let s=0,m=0;const I=i.lineNumber-1,h=i.column-1;for(let C=0;C<o.length;C+=5){const f=o[C],p=o[C+1],N=o[C+2],j=o[C+3],x=o[C+4],w=s+f,b=f===0?m+p:p;if(I===w&&b<=h&&h<b+N){const W=t.legend.tokenTypes[j]||"not in legend (ignored)",A=[];let l=x;for(let V=0;l>0&&V<t.legend.tokenModifiers.length;V++)l&1&&A.push(t.legend.tokenModifiers[V]),l=l>>1;l>0&&A.push("not in legend (ignored)");const u=new k.Range(w+1,b+1,w+1,b+1+N),R={},Z=e.getColorTheme().tokenColorMap,v=e.getColorTheme().getTokenStyleMetadata(W,A,r,!0,R);let M;return v&&(M={languageId:void 0,tokenType:me.Other,bold:v==null?void 0:v.bold,italic:v==null?void 0:v.italic,underline:v==null?void 0:v.underline,strikethrough:v==null?void 0:v.strikethrough,foreground:Z[(v==null?void 0:v.foreground)||Ce.None],background:void 0}),{type:W,modifiers:A,range:u,metadata:M,definitions:R}}s=w,m=b}return null}function He(n,e,t){let i=null;for(let o=1;o<t;o++)i=e.tokenizeLine(n.getLineContent(o),i).ruleStack;return i}function qe(n,e,t){const i=n.getColorTheme().tokenColorMap,o=Y.getLanguageId(t),r=Y.getTokenType(t),s=Y.getFontStyle(t),m=Y.getForeground(t),I=Y.getBackground(t);return{languageId:e.languageIdCodec.decodeLanguageId(o),tokenType:r,bold:s&q.Bold?!0:void 0,italic:s&q.Italic?!0:void 0,underline:s&q.Underline?!0:void 0,strikethrough:s&q.Strikethrough?!0:void 0,foreground:i[m],background:i[I]}}function _e(n,e,t){const i=t.lineNumber,o=n,r=o._tokenizationTextModelPart.grammarTokens._tokenizer.tokenizationSupport._actual._grammar,s=He(n,r,i),m=r.tokenizeLine(n.getLineContent(i),s),I=r.tokenizeLine2(n.getLineContent(i),s);let h=0;for(let f=m.tokens.length-1;f>=0;f--){const p=m.tokens[f];if(t.column-1>=p.startIndex){h=f;break}}let C=0;for(let f=I.tokens.length>>>1;f>=0;f--)if(t.column-1>=I.tokens[f<<1]){C=f;break}return{token:m.tokens[h],metadata:qe(e,o._languageService,I.tokens[(C<<1)+1])}}const fe=y.createContext(void 0),Ue=({children:n,url:e,qodly:t,defaultZoom:i,openHandler:o,language:r="4d",defaultInited:s=!1})=>{const m=ne.useMonaco(),[I,h]=y.useState(s),[C,f]=y.useState(null),p=y.useRef(),N=y.useRef(0);y.useEffect(()=>{e&&m&&j()},[e,m]);const j=async()=>{if(!m)return;const d=new We.Logger({enabled:process.env.NODE_ENV==="development",debugEnabled:process.env.NODE_ENV==="development"}),c=await ue({logger:d});await le.initServices({caller:"Qodly Code Editor",logger:d,serviceConfig:c}),o&&re.StandaloneServices.get(re.ICodeEditorService).registerCodeEditorOpenHandler(o),m.languages.registerCompletionItemProvider(r,t?Me:Pe);const g=ee.KeybindingsRegistry.getDefaultKeybindings.bind(ee.KeybindingsRegistry);ee.KeybindingsRegistry.getDefaultKeybindings=()=>g().filter(E=>!["workbench.action.files.saveAs","workbench.action.files.save"].includes(E.command)),k.editor.addKeybindingRules(Je),m.languages.registerFoldingRangeProvider(r,{provideFoldingRanges:function(L){const E=[],O=/\\\s*$/;for(let K=1,J=L.getLineCount();K<=J;K++){const _=L.getLineContent(K);if(O.exec(_)){let D=K+1;for(;D<=J;){const Q=L.getLineContent(D);if(O.exec(Q)==null)break;D++}D>K&&(E.push({start:K,end:D,kind:m.languages.FoldingRangeKind.Region}),K=D)}}return E}}),x()},x=()=>{f(null);let d;try{d=new WebSocket(localStorage.LSP_SERVER||e)}catch{f(new Event("INVALID_URL"));return}d.onopen=w,d.onclose=b,d.onerror=W,N.current=0},w=async function(){const d=te.toSocket(this),c=new Oe(d),g=new De(d),L=new we.MonacoLanguageClient({name:"4D Language Client",clientOptions:{workspaceFolder:{uri:k.Uri.parse("file:///PACKAGE")},documentSelector:[{scheme:"file",language:r}],errorHandler:{error:()=>({action:oe.ErrorAction.Continue}),closed:()=>({action:oe.CloseAction.DoNotRestart})}},connectionProvider:{get:()=>Promise.resolve({reader:c,writer:g})}});p.current=L;const E=L.sendRequest.bind(L);p.current.sendRequest=function(O,K,J){return typeof O=="object"&&O.method==="textDocument/diagnostic"&&/file:\/\/\/PACKAGE\/Project\/Sources\/Methods\/__Debugger_.*/.test(K.textDocument.uri)?Promise.resolve():E(O,K,J)},c.onClose(()=>{L.stop(),N.current<3?setTimeout(()=>{N.current++,x()},1e3):f(new Event("WEBSOCKET_CLOSED"))}),L.needsStart()&&await L.start(),h(!0)},b=()=>{},W=d=>{f(d)};y.useEffect(()=>{const d=F.lspSubject.subscribe(({action:c,payload:g})=>{switch(c){case F.LspActions.WILL_SAVE:Z(g.filePath);break;case F.LspActions.DID_SAVE:P(g.filePath,g.content);break;case F.LspActions.WILL_CREATE:v(g.filePath);break;case F.LspActions.DID_CREATE:xe(g.filePath);break;case F.LspActions.WILL_RENAME:M(g.oldPath,g.newPath);break;case F.LspActions.DID_RENAME:Re(g.oldPath,g.newPath);break;case F.LspActions.WILL_DELETE:V(g.filePath);break;case F.LspActions.DID_DELETE:Ne(g.filePath);break;case F.LspActions.DIAGNOSTIC_REFRESH:R(g.filePath);break}});return()=>d.unsubscribe()},[]);const A=d=>{var c,g;return(g=(c=p.current)==null?void 0:c._features)==null?void 0:g.find(L=>{var E;return((E=L._registrationType)==null?void 0:E.method)===d})},l=d=>{const c=[],g=A(d);if(g)for(const[,L]of g._registrations)L.provider&&c.push(L.provider);return c},u=async(d,c,g)=>{var E,O,K;const L=l(B.SemanticTokensRegistrationType.method);if(L[0]){const J=new k.CancellationTokenSource,_=await Promise.resolve(L[0].full.provideDocumentSemanticTokens(c,J.token)),$=d,D=_?Ye(c,$._themeService,{tokens:_,legend:(K=(O=(E=p.current)==null?void 0:E._capabilities)==null?void 0:O.semanticTokensProvider)==null?void 0:K.legend},g):null,Q=_e(c,$._themeService,g);return{semanticTokenInfo:D,textmateTokenInfo:Q}}return null},R=d=>{if(p.current){const c=l(B.DocumentDiagnosticRequest.method);for(const g of c)g.onDidChangeDiagnosticsEmitter.fire()}},Z=(d,c=B.TextDocumentSaveReason.Manual)=>{var g;(g=p.current)==null||g.sendNotification(B.WillSaveTextDocumentNotification.type,{textDocument:{uri:T(d)},reason:c})},P=(d,c)=>{var g;(g=p.current)==null||g.sendNotification(B.DidSaveTextDocumentNotification.type,{textDocument:{uri:T(d)},text:c})},v=d=>{var c;(c=p.current)==null||c.sendRequest(B.WillCreateFilesRequest.type,{files:[{uri:T(d)}]})},M=(d,c)=>{var g;(g=p.current)==null||g.sendRequest(B.WillRenameFilesRequest.type,{files:[{oldUri:T(d),newUri:T(c)}]})},V=d=>{var c;(c=p.current)==null||c.sendRequest(B.WillDeleteFilesRequest.type,{files:[{uri:T(d)}]})},xe=d=>{var c;(c=p.current)==null||c.sendNotification(B.DidCreateFilesNotification.type,{files:[{uri:T(d)}]})},Re=(d,c)=>{var g;(g=p.current)==null||g.sendNotification(B.DidRenameFilesNotification.type,{files:[{oldUri:T(d),newUri:T(c)}]})},Ne=d=>{var c;(c=p.current)==null||c.sendNotification(B.DidDeleteFilesNotification.type,{files:[{uri:T(d)}]})};return S.jsxs(fe.Provider,{value:{inited:I||!!C,clientRef:p,lastError:C,reload:x,getTokenAtPosition:u},children:[n,S.jsx(Ve,{defaultZoom:i})]})};function ze(){const n=y.useContext(fe);if(n===void 0)throw new Error("useLSP must be used within an LSPContext");return n}const Ae=y.createContext(void 0),$e=y.memo(({children:n})=>{const[e,t]=y.useState(null);return S.jsx(Ae.Provider,{value:{editor:e,setEditor:t},children:n})});function pe(){const n=y.useContext(Ae),e=y.useState(null);if(n===void 0){const[t,i]=e;return{editor:t,setEditor:i}}return n}var be={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},se=y.createContext&&y.createContext(be),G=function(){return G=Object.assign||function(n){for(var e,t=1,i=arguments.length;t<i;t++){e=arguments[t];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o])}return n},G.apply(this,arguments)},Qe=function(n,e){var t={};for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,i=Object.getOwnPropertySymbols(n);o<i.length;o++)e.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(n,i[o])&&(t[i[o]]=n[i[o]]);return t};function he(n){return n&&n.map(function(e,t){return y.createElement(e.tag,G({key:t},e.attr),he(e.child))})}function ve(n){return function(e){return y.createElement(en,G({attr:G({},n.attr)},e),he(n.child))}}function en(n){var e=function(t){var i=n.attr,o=n.size,r=n.title,s=Qe(n,["attr","size","title"]),m=o||t.size||"1em",I;return t.className&&(I=t.className),n.className&&(I=(I?I+" ":"")+n.className),y.createElement("svg",G({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,i,s,{className:I,style:G(G({color:n.color||t.color},t.style),n.style),height:m,width:m,xmlns:"http://www.w3.org/2000/svg"}),r&&y.createElement("title",null,r),n.children)};return se!==void 0?y.createElement(se.Consumer,null,function(t){return e(t)}):e(be)}function nn(n){return ve({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 10.5858L9.17157 7.75736L7.75736 9.17157L10.5858 12L7.75736 14.8284L9.17157 16.2426L12 13.4142L14.8284 16.2426L16.2426 14.8284L13.4142 12L16.2426 9.17157L14.8284 7.75736L12 10.5858Z"}}]})(n)}function tn(n){return ve({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M449.07 399.08L278.64 82.58c-12.08-22.44-44.26-22.44-56.35 0L51.87 399.08A32 32 0 0080 446.25h340.89a32 32 0 0028.18-47.17zm-198.6-1.83a20 20 0 1120-20 20 20 0 01-20 20zm21.72-201.15l-5.74 122a16 16 0 01-32 0l-5.74-121.95a21.73 21.73 0 0121.5-22.69h.21a21.74 21.74 0 0121.73 22.7z"}}]})(n)}const Se=({lspProps:{lastError:n,reload:e}})=>{const[t,i]=y.useState(!1),o=()=>{e()},r=()=>{i(!1)};return y.useEffect(()=>{i(!!n)},[n]),t?S.jsxs("div",{className:"flex items-center border-b border-fd-gray-darker bg-grey-800 px-2 py-1.5 text-xs text-grey-50",children:[S.jsxs("span",{className:"flex flex-1 justify-center gap-1",children:[S.jsx(tn,{className:"h-4 w-4 text-yellow-600"}),S.jsxs("span",{children:["LSP not loaded."," ",S.jsx("button",{className:"text-primary-dark underline",onClick:o,children:"Reload?"})]})]}),S.jsx("button",{className:"focus:outline-none",children:S.jsx(nn,{className:"h-4 w-4 text-white",onClick:r})})]}):null},on={provideCompletionItems:(n,e)=>{const t=n.getWordUntilPosition(e);return{suggestions:[{label:"device:xs",kind:a.languages.CompletionItemKind.Snippet,documentation:"Media query for phone device",range:new a.Range(e.lineNumber,t.startColumn,e.lineNumber,t.endColumn),insertText:["@media screen and (max-width: ${1:365px}) {"," self {"," ${2:background-color}:${3:red};"," }","}"].join(`
|
|
103
|
-
`),insertTextRules:a.languages.CompletionItemInsertTextRule.InsertAsSnippet}]}}},
|
|
102
|
+
`),insertTextRules:a.languages.CompletionItemInsertTextRule.InsertAsSnippet}]}}},Me=[{keybinding:L.KeyMod.CtrlCmd|L.KeyCode.NumpadAdd,command:"editor.action.fontZoomIn"},{keybinding:L.KeyMod.CtrlCmd|L.KeyCode.Equal,command:"editor.action.fontZoomIn"},{keybinding:L.KeyMod.CtrlCmd|L.KeyCode.NumpadSubtract,command:"editor.action.fontZoomOut"},{keybinding:L.KeyMod.CtrlCmd|L.KeyCode.Minus,command:"editor.action.fontZoomOut"},{keybinding:L.KeyMod.CtrlCmd|L.KeyCode.Numpad0,command:"editor.action.fontZoomReset"},{keybinding:L.KeyMod.CtrlCmd|L.KeyCode.Digit0,command:"editor.action.fontZoomReset"}],Je=({defaultZoom:n})=>(S.useEffect(()=>{n!==void 0&&L.editor.EditorZoom.setZoomLevel(n)},[]),null);ne.loader.config({monaco:a});var H=(n=>(n[n.NotSet=-1]="NotSet",n[n.None=0]="None",n[n.Italic=1]="Italic",n[n.Bold=2]="Bold",n[n.Underline=4]="Underline",n[n.Strikethrough=8]="Strikethrough",n))(H||{}),Ce=(n=>(n[n.None=0]="None",n[n.DefaultForeground=1]="DefaultForeground",n[n.DefaultBackground=2]="DefaultBackground",n))(Ce||{}),me=(n=>(n[n.Other=0]="Other",n[n.Comment=1]="Comment",n[n.String=2]="String",n[n.RegEx=3]="RegEx",n))(me||{});class V{static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!==0}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static getClassNameFromMetadata(e){let i="mtk"+this.getForeground(e);const o=this.getFontStyle(e);return o&1&&(i+=" mtki"),o&2&&(i+=" mtkb"),o&4&&(i+=" mtku"),o&8&&(i+=" mtks"),i}static getInlineStyleFromMetadata(e,t){const i=this.getForeground(e),o=this.getFontStyle(e);let r=`color: ${t[i]};`;o&1&&(r+="font-style: italic;"),o&2&&(r+="font-weight: bold;");let s="";return o&4&&(s+=" underline"),o&8&&(s+=" line-through"),s&&(r+=`text-decoration:${s};`),r}static getPresentationFromMetadata(e){const t=this.getForeground(e),i=this.getFontStyle(e);return{foreground:t,italic:!!(i&1),bold:!!(i&2),underline:!!(i&4),strikethrough:!!(i&8)}}}function Ve(n,e,t,i){const o=t.tokens.data,r=n.getLanguageId();let s=0,p=0;const m=i.lineNumber-1,h=i.column-1;for(let C=0;C<o.length;C+=5){const A=o[C],f=o[C+1],k=o[C+2],w=o[C+3],y=o[C+4],R=s+A,b=A===0?p+f:f;if(m===R&&b<=h&&h<b+k){const d=t.legend.tokenTypes[w]||"not in legend (ignored)",K=[];let l=y;for(let J=0;l>0&&J<t.legend.tokenModifiers.length;J++)l&1&&K.push(t.legend.tokenModifiers[J]),l=l>>1;l>0&&K.push("not in legend (ignored)");const c=new L.Range(R+1,b+1,R+1,b+1+k),F={},W=e.getColorTheme().tokenColorMap,v=e.getColorTheme().getTokenStyleMetadata(d,K,r,!0,F);let q;return v&&(q={languageId:void 0,tokenType:me.Other,bold:v==null?void 0:v.bold,italic:v==null?void 0:v.italic,underline:v==null?void 0:v.underline,strikethrough:v==null?void 0:v.strikethrough,foreground:W[(v==null?void 0:v.foreground)||Ce.None],background:void 0}),{type:d,modifiers:K,range:c,metadata:q,definitions:F}}s=R,p=b}return null}function Ye(n,e,t){let i=null;for(let o=1;o<t;o++)i=e.tokenizeLine(n.getLineContent(o),i).ruleStack;return i}function He(n,e,t){const i=n.getColorTheme().tokenColorMap,o=V.getLanguageId(t),r=V.getTokenType(t),s=V.getFontStyle(t),p=V.getForeground(t),m=V.getBackground(t);return{languageId:e.languageIdCodec.decodeLanguageId(o),tokenType:r,bold:s&H.Bold?!0:void 0,italic:s&H.Italic?!0:void 0,underline:s&H.Underline?!0:void 0,strikethrough:s&H.Strikethrough?!0:void 0,foreground:i[p],background:i[m]}}function qe(n,e,t){const i=t.lineNumber,o=n,r=o._tokenizationTextModelPart.grammarTokens._tokenizer.tokenizationSupport._actual._grammar,s=Ye(n,r,i),p=r.tokenizeLine(n.getLineContent(i),s),m=r.tokenizeLine2(n.getLineContent(i),s);let h=0;for(let A=p.tokens.length-1;A>=0;A--){const f=p.tokens[A];if(t.column-1>=f.startIndex){h=A;break}}let C=0;for(let A=m.tokens.length>>>1;A>=0;A--)if(t.column-1>=m.tokens[A<<1]){C=A;break}return{token:p.tokens[h],metadata:He(e,o._languageService,m.tokens[(C<<1)+1])}}const fe=S.createContext(void 0),_e=({children:n,url:e,qodly:t,defaultZoom:i,openHandler:o,language:r="4d",defaultInited:s=!1})=>{const p=ne.useMonaco(),[m,h]=S.useState(s),[C,A]=S.useState(null),f=S.useRef(),k=S.useRef(0);S.useEffect(()=>{e&&p&&w()},[e,p]);const w=async()=>{if(!p)return;const I=new Fe.Logger({enabled:process.env.NODE_ENV==="development",debugEnabled:process.env.NODE_ENV==="development"}),g=await ue({logger:I});await le.initServices({caller:"Qodly Code Editor",logger:I,serviceConfig:g}),o&&re.StandaloneServices.get(re.ICodeEditorService).registerCodeEditorOpenHandler(o),p.languages.registerCompletionItemProvider(r,t?Pe:Ge);const u=ee.KeybindingsRegistry.getDefaultKeybindings.bind(ee.KeybindingsRegistry);ee.KeybindingsRegistry.getDefaultKeybindings=()=>u().filter(E=>!["workbench.action.files.saveAs","workbench.action.files.save"].includes(E.command)),L.editor.addKeybindingRules(Me),p.languages.registerFoldingRangeProvider(r,{provideFoldingRanges:function(N){const E=[],O=/\\\s*$/;for(let Z=1,M=N.getLineCount();Z<=M;Z++){const _=N.getLineContent(Z);if(O.exec(_)){let D=Z+1;for(;D<=M;){const Q=N.getLineContent(D);if(O.exec(Q)==null)break;D++}D>Z&&(E.push({start:Z,end:D,kind:p.languages.FoldingRangeKind.Region}),Z=D)}}return E}}),y()},y=()=>{A(null);let I;try{I=new WebSocket(localStorage.LSP_SERVER||e)}catch{A(new Event("INVALID_URL"));return}I.onopen=R,I.onclose=b,I.onerror=d,k.current=0},R=async function(){const I=te.toSocket(this),g=new Be(I),u=new Oe(I),N=new Ne.MonacoLanguageClient({name:"4D Language Client",clientOptions:{workspaceFolder:{uri:L.Uri.parse("file:///PACKAGE")},documentSelector:[{scheme:"file",language:r}],errorHandler:{error:()=>({action:oe.ErrorAction.Continue}),closed:()=>({action:oe.CloseAction.DoNotRestart})}},connectionProvider:{get:()=>Promise.resolve({reader:g,writer:u})}});f.current=N;const E=N.sendRequest.bind(N);f.current.sendRequest=function(O,Z,M){return typeof O=="object"&&O.method==="textDocument/diagnostic"&&/file:\/\/\/PACKAGE\/Project\/Sources\/Methods\/__Debugger_.*/.test(Z.textDocument.uri)?Promise.resolve():E(O,Z,M)},g.onClose(()=>{N.stop(),k.current<3?setTimeout(()=>{k.current++,y()},1e3):A(new Event("WEBSOCKET_CLOSED"))}),N.needsStart()&&await N.start(),h(!0)},b=()=>{},d=I=>{A(I)};S.useEffect(()=>{const I=j.lspSubject.subscribe(({action:g,payload:u})=>{switch(g){case j.LspActions.WILL_SAVE:W(u.filePath);break;case j.LspActions.DID_SAVE:P(u.filePath,u.content);break;case j.LspActions.WILL_CREATE:v(u.filePath);break;case j.LspActions.DID_CREATE:ye(u.filePath);break;case j.LspActions.WILL_RENAME:q(u.oldPath,u.newPath);break;case j.LspActions.DID_RENAME:xe(u.oldPath,u.newPath);break;case j.LspActions.WILL_DELETE:J(u.filePath);break;case j.LspActions.DID_DELETE:Re(u.filePath);break;case j.LspActions.DIAGNOSTIC_REFRESH:F(u.filePath);break}});return()=>I.unsubscribe()},[]);const K=I=>{var g,u;return(u=(g=f.current)==null?void 0:g._features)==null?void 0:u.find(N=>{var E;return((E=N._registrationType)==null?void 0:E.method)===I})},l=I=>{const g=[],u=K(I);if(u)for(const[,N]of u._registrations)N.provider&&g.push(N.provider);return g},c=async(I,g,u)=>{var E,O,Z;const N=l(B.SemanticTokensRegistrationType.method);if(N[0]){const M=new L.CancellationTokenSource,_=await Promise.resolve(N[0].full.provideDocumentSemanticTokens(g,M.token)),$=I,D=_?Ve(g,$._themeService,{tokens:_,legend:(Z=(O=(E=f.current)==null?void 0:E._capabilities)==null?void 0:O.semanticTokensProvider)==null?void 0:Z.legend},u):null,Q=qe(g,$._themeService,u);return{semanticTokenInfo:D,textmateTokenInfo:Q}}return null},F=I=>{if(f.current){const g=l(B.DocumentDiagnosticRequest.method);for(const u of g)u.onDidChangeDiagnosticsEmitter.fire()}},W=(I,g=B.TextDocumentSaveReason.Manual)=>{var u;(u=f.current)==null||u.sendNotification(B.WillSaveTextDocumentNotification.type,{textDocument:{uri:T(I)},reason:g})},P=(I,g)=>{var u;(u=f.current)==null||u.sendNotification(B.DidSaveTextDocumentNotification.type,{textDocument:{uri:T(I)},text:g})},v=I=>{var g;(g=f.current)==null||g.sendRequest(B.WillCreateFilesRequest.type,{files:[{uri:T(I)}]})},q=(I,g)=>{var u;(u=f.current)==null||u.sendRequest(B.WillRenameFilesRequest.type,{files:[{oldUri:T(I),newUri:T(g)}]})},J=I=>{var g;(g=f.current)==null||g.sendRequest(B.WillDeleteFilesRequest.type,{files:[{uri:T(I)}]})},ye=I=>{var g;(g=f.current)==null||g.sendNotification(B.DidCreateFilesNotification.type,{files:[{uri:T(I)}]})},xe=(I,g)=>{var u;(u=f.current)==null||u.sendNotification(B.DidRenameFilesNotification.type,{files:[{oldUri:T(I),newUri:T(g)}]})},Re=I=>{var g;(g=f.current)==null||g.sendNotification(B.DidDeleteFilesNotification.type,{files:[{uri:T(I)}]})};return x.jsxs(fe.Provider,{value:{inited:m||!!C,clientRef:f,lastError:C,reload:y,getTokenAtPosition:c},children:[n,x.jsx(Je,{defaultZoom:i})]})};function Ue(){const n=S.useContext(fe);if(n===void 0)throw new Error("useLSP must be used within an LSPContext");return n}const pe=S.createContext(void 0),ze=S.memo(({children:n})=>{const[e,t]=S.useState(null);return x.jsx(pe.Provider,{value:{editor:e,setEditor:t},children:n})});function Ae(){const n=S.useContext(pe),e=S.useState(null);if(n===void 0){const[t,i]=e;return{editor:t,setEditor:i}}return n}const $e={provideCompletionItems:(n,e)=>{const t=n.getWordUntilPosition(e);return{suggestions:[{label:"device:xs",kind:a.languages.CompletionItemKind.Snippet,documentation:"Media query for phone device",range:new a.Range(e.lineNumber,t.startColumn,e.lineNumber,t.endColumn),insertText:["@media screen and (max-width: ${1:365px}) {"," self {"," ${2:background-color}:${3:red};"," }","}"].join(`
|
|
103
|
+
`),insertTextRules:a.languages.CompletionItemInsertTextRule.InsertAsSnippet}]}}},Qe="#/definitions/Condition",en={Base:{type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id"]},Condition:{oneOf:[{$ref:"#/definitions/Datasource"},{$ref:"#/definitions/Privilege"},{$ref:"#/definitions/Combination"},{$ref:"#/definitions/CurrentState"},{$ref:"#/definitions/ParentState"},{$ref:"#/definitions/Reference"}]},Datasource:{allOf:[{$ref:"#/definitions/Base"}],properties:{type:{const:"datasource"},path:{type:"string"},value:{type:["number","string","boolean","object","array","null"]},valueType:{enum:["datasource","hardCoded"]},dataType:{enum:["string","number","date","boolean","array","object"]},op:{enum:["eq","neq","regex","in","nin","gt","gte","lt","lte"]}},required:["name","type","path","value","op"]},Privilege:{allOf:[{$ref:"#/definitions/Base"}],properties:{type:{const:"privilege"},value:{type:"string"},valueType:{enum:["datasource","hardCoded"]},op:{enum:["eq","neq","regex"]}},required:["name","type","value","op"]},Combination:{allOf:[{$ref:"#/definitions/Base"}],properties:{type:{const:"combination"},op:{enum:["and","or"]},conditions:{type:"array",items:{$ref:"#/definitions/Condition"}}},required:["type","conditions","op"]},CurrentState:{allOf:[{$ref:"#/definitions/Base"}],properties:{type:{const:"currentState"},value:{type:"string"},valueType:{enum:["datasource","hardCoded"]},dataType:{enum:["string","number","date","boolean","array","object"]},op:{enum:["eq","neq","regex"]}},required:["name","type","value","op"]},ParentState:{allOf:[{$ref:"#/definitions/Base"}],properties:{type:{const:"parentState"},value:{type:"string"},valueType:{enum:["datasource","hardCoded"]},dataType:{enum:["string","number","date","boolean","array","object"]},op:{enum:["eq","neq","regex"]}},required:["name","type","value","op"]},Reference:{allOf:[{$ref:"#/definitions/Base"}],properties:{type:{const:"reference"},ref:{type:"string"}},required:["type","ref"]}},nn={$ref:Qe,definitions:en},tn="array",on={type:"object",properties:{class:{type:"string"},method:{type:"string"},regexPattern:{type:"string"},verbs:{type:"string"}}},rn={type:tn,items:on};function sn(n,e){const t=document.createElement("style");t.dataset.id=e,t.textContent=n,document.head.append(t)}function an(n){return Array.from(document.styleSheets).find(e=>e.ownerNode.getAttribute("data-id")===n)}function ln(n,e){const t=[];let i=[];const o=[],r=(l,c,F,W)=>{t.push({startLineNumber:l,endLineNumber:F,startColumn:c,endColumn:W}),h(),m()},s=l=>{o.indexOf(l)<0&&o.push(l)},p=l=>{const c=o.indexOf(l);c<0||o.splice(c,1)},m=()=>{for(const l of o)try{l(i)}catch(c){console.error(c)}},h=()=>{const l=n.getModel();l&&(i=gn(t.map(c=>[l.getOffsetAt({lineNumber:c.startLineNumber,column:c.startColumn}),l.getOffsetAt({lineNumber:c.endLineNumber,column:c.endColumn})]),!0),i.length>0&&(i[0][0]<=0&&(i[0][0]=Number.NEGATIVE_INFINITY),i[i.length-1][1]>=l.getValueLength()&&(i[i.length-1][1]=Number.POSITIVE_INFINITY)))},C=l=>{const c={isDeletion:!1,isAddition:!1,isReplacement:!1};return l.text===""?c.isDeletion=!0:l.range.startLineNumber===l.range.endLineNumber&&l.range.startColumn===l.range.endColumn?c.isAddition=!0:c.isReplacement=!0,c},A=n.onDidChangeModel(l=>{h(),d()}),f=n.onDidChangeModelContent(l=>{if(!l.isUndoing)for(const c of l.changes){const F=C(c);if(F.isReplacement||F.isDeletion||F.isAddition){const W=t.some(v=>c.range.startLineNumber>=v.startLineNumber&&c.range.endLineNumber<=v.endLineNumber&&c.range.startColumn>=v.startColumn&&c.range.endColumn<=v.endColumn),P=!W&&e&&c.range.startLineNumber===1&&c.range.startColumn===1&&!j.hasAttributesString(c.text);if(W||P){const v=n.getModel();if(v){v.undo();return}}}}}),k=()=>{A.dispose(),f.dispose()};let w=[],y=`
|
|
104
104
|
.idoc-readonly-mark {
|
|
105
105
|
cursor: not-allowed;
|
|
106
106
|
z-index: 1;
|
|
107
107
|
}
|
|
108
|
-
`;if(x){const l="monaco-read-only";dn(l)||un(x,l),x=null}const w=()=>{s(W),W()},b=()=>{m(W),j=n.deltaDecorations(j,[])},W=()=>{const l=n.getModel();l&&(j=n.deltaDecorations(j,i.map(A(l))))},A=l=>u=>{const R=l.getPositionAt(u[0]),Z=l.getPositionAt(u[1]);return{range:new a.Range(R.lineNumber,R.column,Z.lineNumber,Z.column),options:{className:"idoc-readonly-mark"}}};return{get buffer(){return i},exclude:r,attach:s,detach:m,dispose:N,show:w,hide:b}}function Cn(n,e,t){let i=!1;const o=b=>b[1]<b[0]?(i=!0,[[b[1],b[0]]]):[[...b]],r=b=>i?b.map(W=>W[1]>W[0]?m(W):W).reverse():b;let s;const m=b=>(s=b[1],b[1]=b[0],b[0]=s,b),I=o(n);let h,C,f,p,N,j,x,w;f=I[0];for(C of e)for(x=C[0],w=C[1],p=0;p<I.length;p++){if(f=I[p],N=f[0],j=f[1],N<x)j<x?h=[f]:j<=w?h=[[N,x-1]]:h=[[N,x-1],[w+1,j]];else if(N<=w)if(x===Number.NEGATIVE_INFINITY){const b=w+1;h=t===0?[]:[[b,j>b?j:b]]}else w===Number.POSITIVE_INFINITY?h=t===0?[]:[[x-1,x-1]]:j<=w?h=t<0?[[x-1,x-1]]:t>0?[[w+1,w+1]]:[]:h=[[w+1,j]];else h=[f];if(I.splice(p,1,...h),I.length===1&&I[0][1]<x)return r(I)}return r(I)}function mn(n,e){if(n.length<2)return n;const t=[];let i=null,o,r;n=n.map(s=>(s[1]<s[0]&&(o=s[1],s[1]=s[0],s[1]=o),s)).sort((s,m)=>s[0]-m[0]),t.push(n[0]);for(let s=1;s<n.length;s++)i=t[t.length-1],r=n[s],i[1]===r[0]&&!e||(i[1]===r[0]-1&&e?(i[1]=r[1],t.splice(t.length-1,1,i)):i[1]<r[0]?t.push(r):i[1]<r[1]&&(i[1]=r[1],t.splice(t.length-1,1,i)));return t}function H(n,e){return e.bind(n)}class fn{constructor(e,t){var i;this.disposables=[],this.prefer=1,this.lastPrefer=1,this.onCursor=H(this,function(o){if(o.source==="api")return;const r=this.getApprovedSelections();r.length!==0&&this.editor.setSelections(r)}),this.onRectangleSelectionStart=H(this,function({event:o}){o.middleButton&&(this.lastPrefer=this.prefer,this.prefer=0,window.addEventListener("pointerup",this.onRectangleSelectionStop))}),this.onRectangleSelectionStop=H(this,function(){this.prefer=this.lastPrefer,window.removeEventListener("pointerup",this.onRectangleSelectionStop)}),this.onKey=H(this,function(o){const r=o.keyCode,s=a.KeyCode;if(o.altKey||s.F1<=r&&r<=s.F19||o.ctrlKey&&r!==s.Backspace)return;if(r===s.UpArrow||r===s.LeftArrow||r===s.Home||r===s.PageUp){this.prefer=-1;return}if(r===s.DownArrow||r===s.RightArrow||r===s.End||r===s.PageDown){this.prefer=1;return}const m=this.getSelections(),I=this.intervals.buffer;let h;if(r===s.Delete)h=C=>C[0]===C[1]&&I.find(f=>C[1]+1===f[0])!=null;else if(r===s.Backspace)h=C=>C[0]===C[1]&&I.find(f=>f[1]+1===C[0])!=null;else return;m.findIndex(h)!==-1&&(o.stopPropagation(),o.preventDefault())}),this.getOffsetAt=H(this,function(o){let r;for(let s=0;s<this.intervals.buffer.length;s++)if(r=this.intervals.buffer[s],o<=r[1])return r[0]-o<o-r[1]?r[0]:r[1]}),this.editor=e,this.intervals=In(e,t),(i=this.editor.getModel())==null||i.setEOL(a.editor.EndOfLineSequence.LF)}enable(){this.disposables.push(this.editor.onDidChangeCursorPosition(this.onCursor),this.editor.onKeyDown(this.onKey),this.editor.onMouseDown(this.onRectangleSelectionStart)),this.intervals.show()}dispose(){for(const e of this.disposables)e.dispose();this.disposables.splice(0)}exclude(e,t,i,o){arguments.length===1?this.intervals.exclude(e,0,e,Number.MAX_SAFE_INTEGER):this.intervals.exclude(e,t,i,o)}getApprovedSelections(){const e=this.editor.getModel();return this.getSelections().map(i=>Cn(i,this.intervals.buffer,this.prefer)).flat().map(i=>{const o=e.getPositionAt(i[0]),r=e.getPositionAt(i[1]);return new a.Selection(o.lineNumber,o.column,r.lineNumber,r.column)})}getSelections(){const e=this.editor.getModel();return(this.editor.getSelections()||[]).map(t=>[e.getOffsetAt({lineNumber:t.selectionStartLineNumber,column:t.selectionStartColumn}),e.getOffsetAt({lineNumber:t.positionLineNumber,column:t.positionColumn})])}}const An=new RegExp("^[ s]+(exposed|Function)","i"),ye=({lineNumber:n,editor:e,type:t,source:i})=>{var h;const o=t===F.FileFolderType.METHOD||t===F.FileFolderType.DEBUGGER&&((h=i==null?void 0:i.codeDescriptorInfo)==null?void 0:h.type)===F.SourceCodeDescriptor.METHOD;if(n===1)return o?"":"1";const r=e==null?void 0:e.getModel(),s=(r==null?void 0:r.getLinesContent())||[],m=Array(s.length).fill("-");let I=o?0:1;for(let C=1;C<s.length;C++)(C===1?"":s[C-1]).endsWith("\\")||(I+=1,m[C]=I.toString());return m[n-1]},ae=()=>S.jsx("div",{className:"absolute inset-0 animate-pulse",children:S.jsx("div",{className:"w-full space-y-4 px-4 py-1",children:S.jsxs("div",{className:"space-y-2",children:[S.jsx("div",{className:"h-3 w-3/4 rounded bg-grey-200"}),S.jsx("div",{className:"h-3 rounded bg-grey-200"}),S.jsx("div",{className:"h-3 w-5/6 rounded bg-grey-200"}),S.jsx("div",{className:"h-3 rounded bg-grey-200"}),S.jsx("div",{className:"h-3 rounded bg-grey-200"})]})})}),U=["fd-dark"],pn=({path:n,initialValue:e,type:t,language:i,onChange:o,options:r={},extra:s={},showAlerts:m=!1,lspProps:I,theme:h=U[0],...C})=>{const{initialLineInfo:f,initialSelectionInfo:p}=s,{editor:N,setEditor:j}=pe(),{inited:x}=I;function w(A){i==="css"&&A.languages.registerCompletionItemProvider("css",on),i==="json"&&A.languages.json&&A.languages.json.jsonDefaults.setDiagnosticsOptions({validate:!0,schemas:[{uri:"condition-schema.json",fileMatch:["*.condition.json"],schema:an},{uri:"handlers-schema.json",fileMatch:[F.HTTP_HANDLERS_TAB_PATH],schema:gn}]})}function b(A,l){j(A);const u=A.getModel();if(u&&(u.updateOptions({insertSpaces:!1}),A.onKeyUp(()=>{var Z;const R=(Z=A.getPosition())==null?void 0:Z.lineNumber;if(R){const P=u.getLineFirstNonWhitespaceColumn(R),v=u.getLineLength(R),M=u.getLineContent(R);An.test(M)&&A.executeEdits("edit-handler",[{range:new l.Range(R,0,R,v),text:M.substr(P-1,v-P)}])}})),t===F.FileFolderType.METHOD&&F.hasAttributesString(e)){const R=new fn(A,!0);R.exclude(1,1,1,Number.POSITIVE_INFINITY),R.enable()}}y.useEffect(()=>{if(!N)return;const{line:A,offset:l}=f||{};A&&Ie(N,A,l)},[f,N]),y.useEffect(()=>{if(!N)return;const{selection:A}=p||{};A&&de(N,A)},[p,N]);const W=A=>U.includes(A)?A:U[0];return x?S.jsxs(S.Fragment,{children:[m?S.jsx(Se,{lspProps:I}):null,S.jsx(ne.Editor,{options:{readOnly:!0,fontSize:12,"semanticHighlighting.enabled":!0,padding:{top:10},lineNumbers:i==="4d"?A=>ye({lineNumber:A,editor:N,type:t,source:s==null?void 0:s.source}):void 0,scrollBeyondLastLine:!1,...r},path:T(n),value:e,theme:W(h),onChange:A=>o&&o(A||""),language:i,beforeMount:w,onMount:b,loading:S.jsx(ae,{}),...C})]}):S.jsx("div",{className:"relative flex-1 w-full",children:S.jsx(ae,{})})},bn={name:"4d",displayName:"%displayName%",description:"%description%",version:"1.0.0",publisher:"vscode",engines:{vscode:"0.10.x"},categories:["Programming Languages"],contributes:{languages:[{id:"4d",aliases:["4D","4d"],extensions:[".4dm",".4qs"],configuration:"./language-configuration.json"}],grammars:[{language:"4d",scopeName:"source.4dm",path:"./syntaxes/4d.tmLanguage.json"}]}},{registerFileUrl:z,whenReady:vn}=Ze.registerExtension(bn,void 0,{system:!0});z("./syntaxes/4d.tmLanguage.json",new URL("data:application/json;base64,ewogICJuYW1lIjogIjREIiwKICAic2NvcGVOYW1lIjogInNvdXJjZS40ZG0iLAogICJwYXR0ZXJucyI6IFsKICAgIHsKICAgICAgImluY2x1ZGUiOiAiI3N0YXRlbWVudHMiCiAgICB9CiAgXSwKICAicmVwb3NpdG9yeSI6IHsKICAgICJzdGF0ZW1lbnRzIjogewogICAgICAicGF0dGVybnMiOiBbCiAgICAgICAgewogICAgICAgICAgImluY2x1ZGUiOiAiI2NvbW1lbnQiCiAgICAgICAgfQogICAgICBdCiAgICB9LAogICAgImNvbW1lbnQiOiB7CiAgICAgICJwYXR0ZXJucyI6IFsKICAgICAgICB7CiAgICAgICAgICAibmFtZSI6ICJjb21tZW50LmJsb2NrLjRkIiwKICAgICAgICAgICJiZWdpbiI6ICIoL1xcKikoPzpcXHMqKChAKWludGVybmFsKSg/PVxcc3woXFwqLykpKT8iLAogICAgICAgICAgImJlZ2luQ2FwdHVyZXMiOiB7CiAgICAgICAgICAgICIxIjogewogICAgICAgICAgICAgICJuYW1lIjogInB1bmN0dWF0aW9uLmRlZmluaXRpb24uY29tbWVudC40ZCIKICAgICAgICAgICAgfSwKICAgICAgICAgICAgIjIiOiB7CiAgICAgICAgICAgICAgIm5hbWUiOiAic3RvcmFnZS50eXBlLmludGVybmFsZGVjbGFyYXRpb24uNGQiCiAgICAgICAgICAgIH0sCiAgICAgICAgICAgICIzIjogewogICAgICAgICAgICAgICJuYW1lIjogInB1bmN0dWF0aW9uLmRlY29yYXRvci5pbnRlcm5hbGRlY2xhcmF0aW9uLjRkIgogICAgICAgICAgICB9CiAgICAgICAgICB9LAogICAgICAgICAgImVuZCI6ICJcXCovIiwKICAgICAgICAgICJlbmRDYXB0dXJlcyI6IHsKICAgICAgICAgICAgIjAiOiB7CiAgICAgICAgICAgICAgIm5hbWUiOiAicHVuY3R1YXRpb24uZGVmaW5pdGlvbi5jb21tZW50LjRkIgogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAiYmVnaW4iOiAiKF5bIFxcdF0rKT8oKC8vKSg/OlxccyooKEApaW50ZXJuYWwpKD89XFxzfCQpKT8pIiwKICAgICAgICAgICJiZWdpbkNhcHR1cmVzIjogewogICAgICAgICAgICAiMSI6IHsKICAgICAgICAgICAgICAibmFtZSI6ICJwdW5jdHVhdGlvbi53aGl0ZXNwYWNlLmNvbW1lbnQubGVhZGluZy40ZCIKICAgICAgICAgICAgfSwKICAgICAgICAgICAgIjIiOiB7CiAgICAgICAgICAgICAgIm5hbWUiOiAiY29tbWVudC5saW5lLmRvdWJsZS1zbGFzaC40ZCIKICAgICAgICAgICAgfSwKICAgICAgICAgICAgIjMiOiB7CiAgICAgICAgICAgICAgIm5hbWUiOiAicHVuY3R1YXRpb24uZGVmaW5pdGlvbi5jb21tZW50LjRkIgogICAgICAgICAgICB9LAogICAgICAgICAgICAiNCI6IHsKICAgICAgICAgICAgICAibmFtZSI6ICJzdG9yYWdlLnR5cGUuaW50ZXJuYWxkZWNsYXJhdGlvbi40ZCIKICAgICAgICAgICAgfSwKICAgICAgICAgICAgIjUiOiB7CiAgICAgICAgICAgICAgIm5hbWUiOiAicHVuY3R1YXRpb24uZGVjb3JhdG9yLmludGVybmFsZGVjbGFyYXRpb24uNGQiCiAgICAgICAgICAgIH0KICAgICAgICAgIH0sCiAgICAgICAgICAiZW5kIjogIig/PSQpIiwKICAgICAgICAgICJjb250ZW50TmFtZSI6ICJjb21tZW50LmxpbmUuZG91YmxlLXNsYXNoLjRkIgogICAgICAgIH0KICAgICAgXQogICAgfQogIH0KfQo=",typeof document>"u"?require("url").pathToFileURL(__filename).href:X&&X.tagName.toUpperCase()==="SCRIPT"&&X.src||new URL("index.cjs.js",document.baseURI).href).toString(),{mimeType:"application/json",size:1592});z("./language-configuration.json",new URL("data:application/json;base64,ewogICJjb21tZW50cyI6IHsKICAgICJsaW5lQ29tbWVudCI6ICIvLyIsCiAgICAiYmxvY2tDb21tZW50IjogWyIvKioiLCAiKiovIl0KICB9LAogIC8vIHN5bWJvbHMgdXNlZCBhcyBicmFja2V0cwogICJicmFja2V0cyI6IFsKICAgIFsieyIsICJ9Il0sCiAgICBbIigiLCAiKSJdLAogICAgWyJbIiwgIl0iXQogIF0sCiAgLy8gc3ltYm9scyB0aGF0IGFyZSBhdXRvIGNsb3NlZCB3aGVuIHR5cGluZwogIC8vIHN5bWJvbHMgdGhhdCB0aGF0IGNhbiBiZSB1c2VkIHRvIHN1cnJvdW5kIGEgc2VsZWN0aW9uCiAgInN1cnJvdW5kaW5nUGFpcnMiOiBbCiAgICBbInsiLCAifSJdLAogICAgWyJbIiwgIl0iXSwKICAgIFsiKCIsICIpIl0sCiAgICBbIlwiIiwgIlwiIl0sCiAgICBbIiciLCAiJyJdCiAgXSwKICAiYXV0b0Nsb3NpbmdQYWlycyI6IFsKICAgIHsKICAgICAgIm9wZW4iOiAiKCIsCiAgICAgICJjbG9zZSI6ICIpIgogICAgfSwKICAgIHsgIm9wZW4iOiAieyIsICJjbG9zZSI6ICJ9IiB9LAogICAgeyAib3BlbiI6ICJbIiwgImNsb3NlIjogIl0iIH0sCiAgICB7ICJvcGVuIjogIiciLCAiY2xvc2UiOiAiJyIsICJub3RJbiI6IFsic3RyaW5nIiwgImNvbW1lbnQiXSB9LAogICAgeyAib3BlbiI6ICJcIiIsICJjbG9zZSI6ICJcIiIsICJub3RJbiI6IFsic3RyaW5nIl0gfSwKICAgIHsgIm9wZW4iOiAiYCIsICJjbG9zZSI6ICJgIiwgIm5vdEluIjogWyJzdHJpbmciLCAiY29tbWVudCJdIH0sCiAgICB7ICJvcGVuIjogIi8qKiIsICJjbG9zZSI6ICIgKiovIiwgIm5vdEluIjogWyJzdHJpbmciXSB9CiAgXSwKICAiYXV0b0Nsb3NlQmVmb3JlIjogIjs6Liw9fV0pPmAgXG5cdCIsCiAgIndvcmRQYXR0ZXJuIjogIigtP1xcZCpcXC5cXGRcXHcqKXwoW15cXGBcXH5cXCFcXEBcXCNcXCVcXF5cXCZcXCpcXChcXClcXC1cXD1cXCtcXFtcXHtcXF1cXH1cXFxcXFx8XFw7XFw6XFwnXFxcIlxcLFxcLlxcPFxcPlxcL1xcP1xcclxcblxcdFxcZlxcdiBdKyl8KD88PVthLXpBLVpdKSA/KD89W2EtekEtWl0pIiwKICAiaW5kZW50YXRpb25SdWxlcyI6IHsKICAgICJpbmNyZWFzZUluZGVudFBhdHRlcm4iOiB7CiAgICAgICJwYXR0ZXJuIjogIiheKD8hW15cXHNdKSpcXHMqKGNsYXNzIGNvbnN0cnVjdG9yKSl8KF4oPyFbXlxcc10pKlxccyooZXhwb3NlZHxsb2NhbHxcXHMqKXsxfVxccypmdW5jdGlvbnsxfVxccypcXHcpfCheKD8hW15cXHNdKSpcXHMqKElmfEVsc2V8Rm9yfEZvciBlYWNofFdoaWxlfEJlZ2luIFNRTHxDYXNlIG9mfFVzZXxSZXBlYXR8OiAqXFwoLiopKS4qJCIsCiAgICAgICJmbGFncyI6ICJpIgogICAgfSwKICAgICJkZWNyZWFzZUluZGVudFBhdHRlcm4iOiB7CiAgICAgICJwYXR0ZXJuIjogIiheKD8hW15cXHNdKSpcXHMqKGV4cG9zZWR8bG9jYWx8XFxzKil7MX1cXHMqZnVuY3Rpb257MX1cXHMqXFx3KXwoRW5kIElmfEVuZCBGb3J8RWxzZXxFbmQgZm9yIGVhY2h8RW5kIFdoaWxlfEVuZCBTUUx8RW5kIGNhc2V8RW5kIHVzZXxVbnRpbHw6ICpcXCguKikuKiQiLAogICAgICAiZmxhZ3MiOiAiaSIKICAgIH0KICB9LAogICJvbkVudGVyUnVsZXMiOiBbCiAgICB7CiAgICAgICJiZWZvcmVUZXh0IjogewogICAgICAgICJwYXR0ZXJuIjogIl5leHBvc2VkIiwKICAgICAgICAiZmxhZ3MiOiAiaSIKICAgICAgfSwKICAgICAgImFjdGlvbiI6IHsgImluZGVudCI6ICJpbmRlbnQiLCAiaW5kZW50QWN0aW9uIjogMSB9CiAgICB9CiAgXQp9Cg==",typeof document>"u"?require("url").pathToFileURL(__filename).href:X&&X.tagName.toUpperCase()==="SCRIPT"&&X.src||new URL("index.cjs.js",document.baseURI).href).toString(),{mimeType:"application/json",size:1723});z("package.json",new URL("data:application/json;base64,ewogICJuYW1lIjogIjRkIiwKICAiZGlzcGxheU5hbWUiOiAiJWRpc3BsYXlOYW1lJSIsCiAgImRlc2NyaXB0aW9uIjogIiVkZXNjcmlwdGlvbiUiLAogICJ2ZXJzaW9uIjogIjEuMC4wIiwKICAicHVibGlzaGVyIjogInZzY29kZSIsCiAgImxpY2Vuc2UiOiAiTUlUIiwKICAiZW5naW5lcyI6IHsKICAgICJ2c2NvZGUiOiAiMC4xMC54IgogIH0sCiAgInNjcmlwdHMiOiB7CiAgICAidXBkYXRlLWdyYW1tYXIiOiAibm9kZSAuLi9ub2RlX21vZHVsZXMvdnNjb2RlLWdyYW1tYXItdXBkYXRlci9iaW4gbWljcm9zb2Z0L3ZzY29kZS00ZCBncmFtbWFycy80ZC5jc29uIC4vc3ludGF4ZXMvNGQudG1MYW5ndWFnZS5qc29uIgogIH0sCiAgImNhdGVnb3JpZXMiOiBbCiAgICAiUHJvZ3JhbW1pbmcgTGFuZ3VhZ2VzIgogIF0sCiAgImNvbnRyaWJ1dGVzIjogewogICAgImxhbmd1YWdlcyI6IFsKICAgICAgewogICAgICAgICJpZCI6ICI0ZCIsCiAgICAgICAgImFsaWFzZXMiOiBbCiAgICAgICAgICAiNEQiLAogICAgICAgICAgIjRkIgogICAgICAgIF0sCiAgICAgICAgImV4dGVuc2lvbnMiOiBbCiAgICAgICAgICAiLjRkbSIsCiAgICAgICAgICAiLjRxcyIKICAgICAgICBdLAogICAgICAgICJjb25maWd1cmF0aW9uIjogIi4vbGFuZ3VhZ2UtY29uZmlndXJhdGlvbi5qc29uIgogICAgICB9CiAgICBdLAogICAgImdyYW1tYXJzIjogWwogICAgICB7CiAgICAgICAgImxhbmd1YWdlIjogIjRkIiwKICAgICAgICAic2NvcGVOYW1lIjogInNvdXJjZS40ZG0iLAogICAgICAgICJwYXRoIjogIi4vc3ludGF4ZXMvNGQudG1MYW5ndWFnZS5qc29uIgogICAgICB9CiAgICBdCiAgfSwKICAicmVwb3NpdG9yeSI6IHsKICAgICJ0eXBlIjogImdpdCIsCiAgICAidXJsIjogImh0dHBzOi8vZ2l0aHViLmNvbS9taWNyb3NvZnQvdnNjb2RlLmdpdCIKICB9Cn0K",typeof document>"u"?require("url").pathToFileURL(__filename).href:X&&X.tagName.toUpperCase()==="SCRIPT"&&X.src||new URL("index.cjs.js",document.baseURI).href).toString(),{mimeType:"application/json",size:1006});z("package.nls.json",new URL("data:application/json;base64,ewogICJkaXNwbGF5TmFtZSI6ICI0RCBMYW5ndWFnZSBCYXNpY3MiLAogICJkZXNjcmlwdGlvbiI6ICJQcm92aWRlcyBzeW50YXggaGlnaGxpZ2h0aW5nIGFuZCBicmFja2V0IG1hdGNoaW5nIGZvciA0RE0gYW5kIDRRUyBmaWxlcy4iCn0K",typeof document>"u"?require("url").pathToFileURL(__filename).href:X&&X.tagName.toUpperCase()==="SCRIPT"&&X.src||new URL("index.cjs.js",document.baseURI).href).toString(),{mimeType:"application/json",size:135});exports.Alerts=Se;exports.CodeEditor=pn;exports.CodeEditorProvider=$e;exports.FdLineNumbers=ye;exports.LSPProvider=Ue;exports.SUPPORTED_THEMES=U;exports._await=ie;exports.configureServices=ue;exports.getFileSystemPath=T;exports.getFunctionOffset=Ge;exports.initMonacoUserConfiguration=ge;exports.jumpToLine=Ie;exports.jumpToSelection=de;exports.useCodeEditor=pe;exports.useLSP=ze;
|
|
108
|
+
`;if(y){const l="monaco-read-only";an(l)||sn(y,l),y=null}const R=()=>{s(d),d()},b=()=>{p(d),w=n.deltaDecorations(w,[])},d=()=>{const l=n.getModel();l&&(w=n.deltaDecorations(w,i.map(K(l))))},K=l=>c=>{const F=l.getPositionAt(c[0]),W=l.getPositionAt(c[1]);return{range:new a.Range(F.lineNumber,F.column,W.lineNumber,W.column),options:{className:"idoc-readonly-mark"}}};return{get buffer(){return i},exclude:r,attach:s,detach:p,dispose:k,show:R,hide:b}}function cn(n,e,t){let i=!1;const o=b=>b[1]<b[0]?(i=!0,[[b[1],b[0]]]):[[...b]],r=b=>i?b.map(d=>d[1]>d[0]?p(d):d).reverse():b;let s;const p=b=>(s=b[1],b[1]=b[0],b[0]=s,b),m=o(n);let h,C,A,f,k,w,y,R;A=m[0];for(C of e)for(y=C[0],R=C[1],f=0;f<m.length;f++){if(A=m[f],k=A[0],w=A[1],k<y)w<y?h=[A]:w<=R?h=[[k,y-1]]:h=[[k,y-1],[R+1,w]];else if(k<=R)if(y===Number.NEGATIVE_INFINITY){const b=R+1;h=t===0?[]:[[b,w>b?w:b]]}else R===Number.POSITIVE_INFINITY?h=t===0?[]:[[y-1,y-1]]:w<=R?h=t<0?[[y-1,y-1]]:t>0?[[R+1,R+1]]:[]:h=[[R+1,w]];else h=[A];if(m.splice(f,1,...h),m.length===1&&m[0][1]<y)return r(m)}return r(m)}function gn(n,e){if(n.length<2)return n;const t=[];let i=null,o,r;n=n.map(s=>(s[1]<s[0]&&(o=s[1],s[1]=s[0],s[1]=o),s)).sort((s,p)=>s[0]-p[0]),t.push(n[0]);for(let s=1;s<n.length;s++)i=t[t.length-1],r=n[s],i[1]===r[0]&&!e||(i[1]===r[0]-1&&e?(i[1]=r[1],t.splice(t.length-1,1,i)):i[1]<r[0]?t.push(r):i[1]<r[1]&&(i[1]=r[1],t.splice(t.length-1,1,i)));return t}function Y(n,e){return e.bind(n)}class un{constructor(e,t){var i;this.disposables=[],this.prefer=1,this.lastPrefer=1,this.onCursor=Y(this,function(o){if(o.source==="api")return;const r=this.getApprovedSelections();r.length!==0&&this.editor.setSelections(r)}),this.onRectangleSelectionStart=Y(this,function({event:o}){o.middleButton&&(this.lastPrefer=this.prefer,this.prefer=0,window.addEventListener("pointerup",this.onRectangleSelectionStop))}),this.onRectangleSelectionStop=Y(this,function(){this.prefer=this.lastPrefer,window.removeEventListener("pointerup",this.onRectangleSelectionStop)}),this.onKey=Y(this,function(o){const r=o.keyCode,s=a.KeyCode;if(o.altKey||s.F1<=r&&r<=s.F19||o.ctrlKey&&r!==s.Backspace)return;if(r===s.UpArrow||r===s.LeftArrow||r===s.Home||r===s.PageUp){this.prefer=-1;return}if(r===s.DownArrow||r===s.RightArrow||r===s.End||r===s.PageDown){this.prefer=1;return}const p=this.getSelections(),m=this.intervals.buffer;let h;if(r===s.Delete)h=C=>C[0]===C[1]&&m.find(A=>C[1]+1===A[0])!=null;else if(r===s.Backspace)h=C=>C[0]===C[1]&&m.find(A=>A[1]+1===C[0])!=null;else return;p.findIndex(h)!==-1&&(o.stopPropagation(),o.preventDefault())}),this.getOffsetAt=Y(this,function(o){let r;for(let s=0;s<this.intervals.buffer.length;s++)if(r=this.intervals.buffer[s],o<=r[1])return r[0]-o<o-r[1]?r[0]:r[1]}),this.editor=e,this.intervals=ln(e,t),(i=this.editor.getModel())==null||i.setEOL(a.editor.EndOfLineSequence.LF)}enable(){this.disposables.push(this.editor.onDidChangeCursorPosition(this.onCursor),this.editor.onKeyDown(this.onKey),this.editor.onMouseDown(this.onRectangleSelectionStart)),this.intervals.show()}dispose(){for(const e of this.disposables)e.dispose();this.disposables.splice(0)}exclude(e,t,i,o){arguments.length===1?this.intervals.exclude(e,0,e,Number.MAX_SAFE_INTEGER):this.intervals.exclude(e,t,i,o)}getApprovedSelections(){const e=this.editor.getModel();return this.getSelections().map(i=>cn(i,this.intervals.buffer,this.prefer)).flat().map(i=>{const o=e.getPositionAt(i[0]),r=e.getPositionAt(i[1]);return new a.Selection(o.lineNumber,o.column,r.lineNumber,r.column)})}getSelections(){const e=this.editor.getModel();return(this.editor.getSelections()||[]).map(t=>[e.getOffsetAt({lineNumber:t.selectionStartLineNumber,column:t.selectionStartColumn}),e.getOffsetAt({lineNumber:t.positionLineNumber,column:t.positionColumn})])}}const dn=new RegExp("^[ s]+(exposed|Function)","i"),be=({lineNumber:n,editor:e,type:t,source:i})=>{var h;const o=t===j.FileFolderType.METHOD||t===j.FileFolderType.DEBUGGER&&((h=i==null?void 0:i.codeDescriptorInfo)==null?void 0:h.type)===j.SourceCodeDescriptor.METHOD;if(n===1)return o?"":"1";const r=e==null?void 0:e.getModel(),s=(r==null?void 0:r.getLinesContent())||[],p=Array(s.length).fill("-");let m=o?0:1;for(let C=1;C<s.length;C++)(C===1?"":s[C-1]).endsWith("\\")||(m+=1,p[C]=m.toString());return p[n-1]},se=()=>x.jsx("div",{className:"absolute inset-0 animate-pulse",children:x.jsx("div",{className:"w-full space-y-4 px-4 py-1",children:x.jsxs("div",{className:"space-y-2",children:[x.jsx("div",{className:"h-3 w-3/4 rounded bg-grey-200"}),x.jsx("div",{className:"h-3 rounded bg-grey-200"}),x.jsx("div",{className:"h-3 w-5/6 rounded bg-grey-200"}),x.jsx("div",{className:"h-3 rounded bg-grey-200"}),x.jsx("div",{className:"h-3 rounded bg-grey-200"})]})})}),U=["fd-dark"],In=({path:n,initialValue:e,type:t,language:i,onChange:o,options:r={},extra:s={},lspProps:p,theme:m=U[0],...h})=>{const{initialLineInfo:C,initialSelectionInfo:A}=s,{editor:f,setEditor:k}=Ae(),{inited:w}=p;function y(d){i==="css"&&d.languages.registerCompletionItemProvider("css",$e),i==="json"&&d.languages.json&&d.languages.json.jsonDefaults.setDiagnosticsOptions({validate:!0,schemas:[{uri:"condition-schema.json",fileMatch:["*.condition.json"],schema:nn},{uri:"handlers-schema.json",fileMatch:[j.HTTP_HANDLERS_TAB_PATH],schema:rn}]})}function R(d,K){k(d);const l=d.getModel();if(l&&(l.updateOptions({insertSpaces:!1}),d.onKeyUp(()=>{var F;const c=(F=d.getPosition())==null?void 0:F.lineNumber;if(c){const W=l.getLineFirstNonWhitespaceColumn(c),P=l.getLineLength(c),v=l.getLineContent(c);dn.test(v)&&d.executeEdits("edit-handler",[{range:new K.Range(c,0,c,P),text:v.substr(W-1,P-W)}])}})),t===j.FileFolderType.METHOD&&j.hasAttributesString(e)){const c=new un(d,!0);c.exclude(1,1,1,Number.POSITIVE_INFINITY),c.enable()}}S.useEffect(()=>{if(!f)return;const{line:d,offset:K}=C||{};d&&Ie(f,d,K)},[C,f]),S.useEffect(()=>{if(!f)return;const{selection:d}=A||{};d&&de(f,d)},[A,f]);const b=d=>U.includes(d)?d:U[0];return w?x.jsx(ne.Editor,{options:{readOnly:!0,fontSize:12,"semanticHighlighting.enabled":!0,padding:{top:10},lineNumbers:i==="4d"?d=>be({lineNumber:d,editor:f,type:t,source:s==null?void 0:s.source}):void 0,scrollBeyondLastLine:!1,...r},path:T(n),value:e,theme:b(m),onChange:d=>o&&o(d||""),language:i,beforeMount:y,onMount:R,loading:x.jsx(se,{}),...h}):x.jsx("div",{className:"relative flex-1 w-full",children:x.jsx(se,{})})};var he={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},ae=S.createContext&&S.createContext(he),G=function(){return G=Object.assign||function(n){for(var e,t=1,i=arguments.length;t<i;t++){e=arguments[t];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o])}return n},G.apply(this,arguments)},Cn=function(n,e){var t={};for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,i=Object.getOwnPropertySymbols(n);o<i.length;o++)e.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(n,i[o])&&(t[i[o]]=n[i[o]]);return t};function ve(n){return n&&n.map(function(e,t){return S.createElement(e.tag,G({key:t},e.attr),ve(e.child))})}function Se(n){return function(e){return S.createElement(mn,G({attr:G({},n.attr)},e),ve(n.child))}}function mn(n){var e=function(t){var i=n.attr,o=n.size,r=n.title,s=Cn(n,["attr","size","title"]),p=o||t.size||"1em",m;return t.className&&(m=t.className),n.className&&(m=(m?m+" ":"")+n.className),S.createElement("svg",G({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,i,s,{className:m,style:G(G({color:n.color||t.color},t.style),n.style),height:p,width:p,xmlns:"http://www.w3.org/2000/svg"}),r&&S.createElement("title",null,r),n.children)};return ae!==void 0?S.createElement(ae.Consumer,null,function(t){return e(t)}):e(he)}function fn(n){return Se({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 10.5858L9.17157 7.75736L7.75736 9.17157L10.5858 12L7.75736 14.8284L9.17157 16.2426L12 13.4142L14.8284 16.2426L16.2426 14.8284L13.4142 12L16.2426 9.17157L14.8284 7.75736L12 10.5858Z"}}]})(n)}function pn(n){return Se({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M449.07 399.08L278.64 82.58c-12.08-22.44-44.26-22.44-56.35 0L51.87 399.08A32 32 0 0080 446.25h340.89a32 32 0 0028.18-47.17zm-198.6-1.83a20 20 0 1120-20 20 20 0 01-20 20zm21.72-201.15l-5.74 122a16 16 0 01-32 0l-5.74-121.95a21.73 21.73 0 0121.5-22.69h.21a21.74 21.74 0 0121.73 22.7z"}}]})(n)}const An=({lspProps:{lastError:n,reload:e}})=>{const[t,i]=S.useState(!1),o=()=>{e()},r=()=>{i(!1)};return S.useEffect(()=>{i(!!n)},[n]),t?x.jsxs("div",{className:"flex items-center border-b border-fd-gray-darker bg-grey-800 px-2 py-1.5 text-xs text-grey-50",children:[x.jsxs("span",{className:"flex flex-1 justify-center gap-1",children:[x.jsx(pn,{className:"h-4 w-4 text-yellow-600"}),x.jsxs("span",{children:["LSP not loaded."," ",x.jsx("button",{className:"text-primary-dark underline",onClick:o,children:"Reload?"})]})]}),x.jsx("button",{className:"focus:outline-none",children:x.jsx(fn,{className:"h-4 w-4 text-white",onClick:r})})]}):null},bn={name:"4d",displayName:"%displayName%",description:"%description%",version:"1.0.0",publisher:"vscode",engines:{vscode:"0.10.x"},categories:["Programming Languages"],contributes:{languages:[{id:"4d",aliases:["4D","4d"],extensions:[".4dm",".4qs"],configuration:"./language-configuration.json"}],grammars:[{language:"4d",scopeName:"source.4dm",path:"./syntaxes/4d.tmLanguage.json"}]}},{registerFileUrl:z,whenReady:vn}=We.registerExtension(bn,void 0,{system:!0});z("./syntaxes/4d.tmLanguage.json",new URL("data:application/json;base64,ewogICJuYW1lIjogIjREIiwKICAic2NvcGVOYW1lIjogInNvdXJjZS40ZG0iLAogICJwYXR0ZXJucyI6IFsKICAgIHsKICAgICAgImluY2x1ZGUiOiAiI3N0YXRlbWVudHMiCiAgICB9CiAgXSwKICAicmVwb3NpdG9yeSI6IHsKICAgICJzdGF0ZW1lbnRzIjogewogICAgICAicGF0dGVybnMiOiBbCiAgICAgICAgewogICAgICAgICAgImluY2x1ZGUiOiAiI2NvbW1lbnQiCiAgICAgICAgfQogICAgICBdCiAgICB9LAogICAgImNvbW1lbnQiOiB7CiAgICAgICJwYXR0ZXJucyI6IFsKICAgICAgICB7CiAgICAgICAgICAibmFtZSI6ICJjb21tZW50LmJsb2NrLjRkIiwKICAgICAgICAgICJiZWdpbiI6ICIoL1xcKikoPzpcXHMqKChAKWludGVybmFsKSg/PVxcc3woXFwqLykpKT8iLAogICAgICAgICAgImJlZ2luQ2FwdHVyZXMiOiB7CiAgICAgICAgICAgICIxIjogewogICAgICAgICAgICAgICJuYW1lIjogInB1bmN0dWF0aW9uLmRlZmluaXRpb24uY29tbWVudC40ZCIKICAgICAgICAgICAgfSwKICAgICAgICAgICAgIjIiOiB7CiAgICAgICAgICAgICAgIm5hbWUiOiAic3RvcmFnZS50eXBlLmludGVybmFsZGVjbGFyYXRpb24uNGQiCiAgICAgICAgICAgIH0sCiAgICAgICAgICAgICIzIjogewogICAgICAgICAgICAgICJuYW1lIjogInB1bmN0dWF0aW9uLmRlY29yYXRvci5pbnRlcm5hbGRlY2xhcmF0aW9uLjRkIgogICAgICAgICAgICB9CiAgICAgICAgICB9LAogICAgICAgICAgImVuZCI6ICJcXCovIiwKICAgICAgICAgICJlbmRDYXB0dXJlcyI6IHsKICAgICAgICAgICAgIjAiOiB7CiAgICAgICAgICAgICAgIm5hbWUiOiAicHVuY3R1YXRpb24uZGVmaW5pdGlvbi5jb21tZW50LjRkIgogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAiYmVnaW4iOiAiKF5bIFxcdF0rKT8oKC8vKSg/OlxccyooKEApaW50ZXJuYWwpKD89XFxzfCQpKT8pIiwKICAgICAgICAgICJiZWdpbkNhcHR1cmVzIjogewogICAgICAgICAgICAiMSI6IHsKICAgICAgICAgICAgICAibmFtZSI6ICJwdW5jdHVhdGlvbi53aGl0ZXNwYWNlLmNvbW1lbnQubGVhZGluZy40ZCIKICAgICAgICAgICAgfSwKICAgICAgICAgICAgIjIiOiB7CiAgICAgICAgICAgICAgIm5hbWUiOiAiY29tbWVudC5saW5lLmRvdWJsZS1zbGFzaC40ZCIKICAgICAgICAgICAgfSwKICAgICAgICAgICAgIjMiOiB7CiAgICAgICAgICAgICAgIm5hbWUiOiAicHVuY3R1YXRpb24uZGVmaW5pdGlvbi5jb21tZW50LjRkIgogICAgICAgICAgICB9LAogICAgICAgICAgICAiNCI6IHsKICAgICAgICAgICAgICAibmFtZSI6ICJzdG9yYWdlLnR5cGUuaW50ZXJuYWxkZWNsYXJhdGlvbi40ZCIKICAgICAgICAgICAgfSwKICAgICAgICAgICAgIjUiOiB7CiAgICAgICAgICAgICAgIm5hbWUiOiAicHVuY3R1YXRpb24uZGVjb3JhdG9yLmludGVybmFsZGVjbGFyYXRpb24uNGQiCiAgICAgICAgICAgIH0KICAgICAgICAgIH0sCiAgICAgICAgICAiZW5kIjogIig/PSQpIiwKICAgICAgICAgICJjb250ZW50TmFtZSI6ICJjb21tZW50LmxpbmUuZG91YmxlLXNsYXNoLjRkIgogICAgICAgIH0KICAgICAgXQogICAgfQogIH0KfQo=",typeof document>"u"?require("url").pathToFileURL(__filename).href:X&&X.tagName.toUpperCase()==="SCRIPT"&&X.src||new URL("index.cjs.js",document.baseURI).href).toString(),{mimeType:"application/json",size:1592});z("./language-configuration.json",new URL("data:application/json;base64,ewogICJjb21tZW50cyI6IHsKICAgICJsaW5lQ29tbWVudCI6ICIvLyIsCiAgICAiYmxvY2tDb21tZW50IjogWyIvKioiLCAiKiovIl0KICB9LAogIC8vIHN5bWJvbHMgdXNlZCBhcyBicmFja2V0cwogICJicmFja2V0cyI6IFsKICAgIFsieyIsICJ9Il0sCiAgICBbIigiLCAiKSJdLAogICAgWyJbIiwgIl0iXQogIF0sCiAgLy8gc3ltYm9scyB0aGF0IGFyZSBhdXRvIGNsb3NlZCB3aGVuIHR5cGluZwogIC8vIHN5bWJvbHMgdGhhdCB0aGF0IGNhbiBiZSB1c2VkIHRvIHN1cnJvdW5kIGEgc2VsZWN0aW9uCiAgInN1cnJvdW5kaW5nUGFpcnMiOiBbCiAgICBbInsiLCAifSJdLAogICAgWyJbIiwgIl0iXSwKICAgIFsiKCIsICIpIl0sCiAgICBbIlwiIiwgIlwiIl0sCiAgICBbIiciLCAiJyJdCiAgXSwKICAiYXV0b0Nsb3NpbmdQYWlycyI6IFsKICAgIHsKICAgICAgIm9wZW4iOiAiKCIsCiAgICAgICJjbG9zZSI6ICIpIgogICAgfSwKICAgIHsgIm9wZW4iOiAieyIsICJjbG9zZSI6ICJ9IiB9LAogICAgeyAib3BlbiI6ICJbIiwgImNsb3NlIjogIl0iIH0sCiAgICB7ICJvcGVuIjogIiciLCAiY2xvc2UiOiAiJyIsICJub3RJbiI6IFsic3RyaW5nIiwgImNvbW1lbnQiXSB9LAogICAgeyAib3BlbiI6ICJcIiIsICJjbG9zZSI6ICJcIiIsICJub3RJbiI6IFsic3RyaW5nIl0gfSwKICAgIHsgIm9wZW4iOiAiYCIsICJjbG9zZSI6ICJgIiwgIm5vdEluIjogWyJzdHJpbmciLCAiY29tbWVudCJdIH0sCiAgICB7ICJvcGVuIjogIi8qKiIsICJjbG9zZSI6ICIgKiovIiwgIm5vdEluIjogWyJzdHJpbmciXSB9CiAgXSwKICAiYXV0b0Nsb3NlQmVmb3JlIjogIjs6Liw9fV0pPmAgXG5cdCIsCiAgIndvcmRQYXR0ZXJuIjogIigtP1xcZCpcXC5cXGRcXHcqKXwoW15cXGBcXH5cXCFcXEBcXCNcXCVcXF5cXCZcXCpcXChcXClcXC1cXD1cXCtcXFtcXHtcXF1cXH1cXFxcXFx8XFw7XFw6XFwnXFxcIlxcLFxcLlxcPFxcPlxcL1xcP1xcclxcblxcdFxcZlxcdiBdKyl8KD88PVthLXpBLVpdKSA/KD89W2EtekEtWl0pIiwKICAiaW5kZW50YXRpb25SdWxlcyI6IHsKICAgICJpbmNyZWFzZUluZGVudFBhdHRlcm4iOiB7CiAgICAgICJwYXR0ZXJuIjogIiheKD8hW15cXHNdKSpcXHMqKGNsYXNzIGNvbnN0cnVjdG9yKSl8KF4oPyFbXlxcc10pKlxccyooZXhwb3NlZHxsb2NhbHxcXHMqKXsxfVxccypmdW5jdGlvbnsxfVxccypcXHcpfCheKD8hW15cXHNdKSpcXHMqKElmfEVsc2V8Rm9yfEZvciBlYWNofFdoaWxlfEJlZ2luIFNRTHxDYXNlIG9mfFVzZXxSZXBlYXR8OiAqXFwoLiopKS4qJCIsCiAgICAgICJmbGFncyI6ICJpIgogICAgfSwKICAgICJkZWNyZWFzZUluZGVudFBhdHRlcm4iOiB7CiAgICAgICJwYXR0ZXJuIjogIiheKD8hW15cXHNdKSpcXHMqKGV4cG9zZWR8bG9jYWx8XFxzKil7MX1cXHMqZnVuY3Rpb257MX1cXHMqXFx3KXwoRW5kIElmfEVuZCBGb3J8RWxzZXxFbmQgZm9yIGVhY2h8RW5kIFdoaWxlfEVuZCBTUUx8RW5kIGNhc2V8RW5kIHVzZXxVbnRpbHw6ICpcXCguKikuKiQiLAogICAgICAiZmxhZ3MiOiAiaSIKICAgIH0KICB9LAogICJvbkVudGVyUnVsZXMiOiBbCiAgICB7CiAgICAgICJiZWZvcmVUZXh0IjogewogICAgICAgICJwYXR0ZXJuIjogIl5leHBvc2VkIiwKICAgICAgICAiZmxhZ3MiOiAiaSIKICAgICAgfSwKICAgICAgImFjdGlvbiI6IHsgImluZGVudCI6ICJpbmRlbnQiLCAiaW5kZW50QWN0aW9uIjogMSB9CiAgICB9CiAgXQp9Cg==",typeof document>"u"?require("url").pathToFileURL(__filename).href:X&&X.tagName.toUpperCase()==="SCRIPT"&&X.src||new URL("index.cjs.js",document.baseURI).href).toString(),{mimeType:"application/json",size:1723});z("package.json",new URL("data:application/json;base64,ewogICJuYW1lIjogIjRkIiwKICAiZGlzcGxheU5hbWUiOiAiJWRpc3BsYXlOYW1lJSIsCiAgImRlc2NyaXB0aW9uIjogIiVkZXNjcmlwdGlvbiUiLAogICJ2ZXJzaW9uIjogIjEuMC4wIiwKICAicHVibGlzaGVyIjogInZzY29kZSIsCiAgImxpY2Vuc2UiOiAiTUlUIiwKICAiZW5naW5lcyI6IHsKICAgICJ2c2NvZGUiOiAiMC4xMC54IgogIH0sCiAgInNjcmlwdHMiOiB7CiAgICAidXBkYXRlLWdyYW1tYXIiOiAibm9kZSAuLi9ub2RlX21vZHVsZXMvdnNjb2RlLWdyYW1tYXItdXBkYXRlci9iaW4gbWljcm9zb2Z0L3ZzY29kZS00ZCBncmFtbWFycy80ZC5jc29uIC4vc3ludGF4ZXMvNGQudG1MYW5ndWFnZS5qc29uIgogIH0sCiAgImNhdGVnb3JpZXMiOiBbCiAgICAiUHJvZ3JhbW1pbmcgTGFuZ3VhZ2VzIgogIF0sCiAgImNvbnRyaWJ1dGVzIjogewogICAgImxhbmd1YWdlcyI6IFsKICAgICAgewogICAgICAgICJpZCI6ICI0ZCIsCiAgICAgICAgImFsaWFzZXMiOiBbCiAgICAgICAgICAiNEQiLAogICAgICAgICAgIjRkIgogICAgICAgIF0sCiAgICAgICAgImV4dGVuc2lvbnMiOiBbCiAgICAgICAgICAiLjRkbSIsCiAgICAgICAgICAiLjRxcyIKICAgICAgICBdLAogICAgICAgICJjb25maWd1cmF0aW9uIjogIi4vbGFuZ3VhZ2UtY29uZmlndXJhdGlvbi5qc29uIgogICAgICB9CiAgICBdLAogICAgImdyYW1tYXJzIjogWwogICAgICB7CiAgICAgICAgImxhbmd1YWdlIjogIjRkIiwKICAgICAgICAic2NvcGVOYW1lIjogInNvdXJjZS40ZG0iLAogICAgICAgICJwYXRoIjogIi4vc3ludGF4ZXMvNGQudG1MYW5ndWFnZS5qc29uIgogICAgICB9CiAgICBdCiAgfSwKICAicmVwb3NpdG9yeSI6IHsKICAgICJ0eXBlIjogImdpdCIsCiAgICAidXJsIjogImh0dHBzOi8vZ2l0aHViLmNvbS9taWNyb3NvZnQvdnNjb2RlLmdpdCIKICB9Cn0K",typeof document>"u"?require("url").pathToFileURL(__filename).href:X&&X.tagName.toUpperCase()==="SCRIPT"&&X.src||new URL("index.cjs.js",document.baseURI).href).toString(),{mimeType:"application/json",size:1006});z("package.nls.json",new URL("data:application/json;base64,ewogICJkaXNwbGF5TmFtZSI6ICI0RCBMYW5ndWFnZSBCYXNpY3MiLAogICJkZXNjcmlwdGlvbiI6ICJQcm92aWRlcyBzeW50YXggaGlnaGxpZ2h0aW5nIGFuZCBicmFja2V0IG1hdGNoaW5nIGZvciA0RE0gYW5kIDRRUyBmaWxlcy4iCn0K",typeof document>"u"?require("url").pathToFileURL(__filename).href:X&&X.tagName.toUpperCase()==="SCRIPT"&&X.src||new URL("index.cjs.js",document.baseURI).href).toString(),{mimeType:"application/json",size:135});exports.Alerts=An;exports.CodeEditor=In;exports.CodeEditorProvider=ze;exports.FdLineNumbers=be;exports.LSPProvider=_e;exports.SUPPORTED_THEMES=U;exports._await=ie;exports.configureServices=ue;exports.getFileSystemPath=T;exports.getFunctionOffset=De;exports.initMonacoUserConfiguration=ge;exports.jumpToLine=Ie;exports.jumpToSelection=de;exports.useCodeEditor=Ae;exports.useLSP=Ue;
|
|
109
109
|
//# sourceMappingURL=index.cjs.js.map
|