@ws-ui/code-editor 0.3.12 → 1.1.0
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/index.cjs.js +19 -19
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +648 -686
- package/dist/index.es.js.map +1 -1
- package/dist/package.json +99 -0
- package/dist/style.css +1 -1
- package/package.json +10 -17
- package/README.md +0 -27
- package/dist/editor/loader/monaco-workers.d.ts +0 -1
- package/dist/main.d.ts +0 -1
- /package/dist/{studio/assets → assets}/css.worker.bundle.js +0 -0
- /package/dist/{studio/assets → assets}/editor.worker.bundle.js +0 -0
- /package/dist/{studio/assets → assets}/html.worker.bundle.js +0 -0
- /package/dist/{studio/assets → assets}/json.worker.bundle.js +0 -0
- /package/dist/{studio/assets → assets}/textmate.worker.bundle.js +0 -0
- /package/dist/{studio/assets → assets}/ts.worker.bundle.js +0 -0
package/dist/index.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react/jsx-runtime"),S=require("react"),z=require("@monaco-editor/react"),Z=require("@ws-ui/shared"),Ne=require("monaco-languageclient"),se=require("monaco-languageclient/vscode/services"),ae=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"),j=require("monaco-editor"),Fe=require("monaco-languageclient/tools"),ne=require("vscode-languageclient"),$=require("vscode-ws-jsonrpc"),T=require("vscode-languageserver-protocol"),ie=require("vscode/services"),U=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(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,i.get?i:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const a=Ze(j),Ke=()=>ae(),Ee=()=>je(()=>Promise.resolve(void 0)),Xe=()=>{const t=ke(),e=t.themeService.ctor.prototype;return e.defineTheme=()=>{},t},Te=`{
|
|
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
|
-
`,le=()=>ae.initUserConfiguration(
|
|
86
|
+
`,le=()=>ae.initUserConfiguration(Te),ce=async t=>{var o;const e=t.serviceConfig??{};e.debugLogging=((o=t.logger)==null?void 0:o.isEnabled())===!0&&(e.debugLogging===!0||t.logger.isDebugEnabled()===!0),await le(),e.userServices=e.userServices??{};const n=e.userServices.configurationService??void 0,i=e.workspaceConfig??void 0;if(n===void 0){if(i)throw new Error("You provided a workspaceConfig without using the configurationServiceOverride");const r={...Ke(),...Xe(),...Le(),...we(),...Ee()};se.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 $.WebSocketMessageReader{constructor(e,n){super(e),this.onMessage=n}readMessage(e){this.onMessage&&this.onMessage();const[,n]=e.split(`\r
|
|
87
87
|
\r
|
|
88
|
-
`);if(this.state==="initial")this.events.splice(0,0,{message:
|
|
89
|
-
`),insertTextRules:
|
|
90
|
-
`),insertTextRules:
|
|
91
|
-
`),insertTextRules:
|
|
92
|
-
`),insertTextRules:
|
|
93
|
-
`),insertTextRules:
|
|
94
|
-
`),insertTextRules:
|
|
95
|
-
`),insertTextRules:
|
|
96
|
-
`),insertTextRules:
|
|
97
|
-
`),insertTextRules:
|
|
98
|
-
`),insertTextRules:
|
|
99
|
-
`),insertTextRules:
|
|
100
|
-
`),insertTextRules:
|
|
101
|
-
`),insertTextRules:
|
|
102
|
-
`),insertTextRules:s.languages.CompletionItemInsertTextRule.InsertAsSnippet}]}}},Ve=[{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"}],Ye=({defaultZoom:n})=>(h.useEffect(()=>{n!==void 0&&k.editor.EditorZoom.setZoomLevel(n)},[]),null);({}).VITE_DISABLE_MONACO_LOADER||$.loader.config({monaco:s});var Y=(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))(Y||{}),de=(n=>(n[n.None=0]="None",n[n.DefaultForeground=1]="DefaultForeground",n[n.DefaultBackground=2]="DefaultBackground",n))(de||{}),Ie=(n=>(n[n.Other=0]="Other",n[n.Comment=1]="Comment",n[n.String=2]="String",n[n.RegEx=3]="RegEx",n))(Ie||{});class P{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 a=`color: ${t[i]};`;o&1&&(a+="font-style: italic;"),o&2&&(a+="font-weight: bold;");let r="";return o&4&&(r+=" underline"),o&8&&(r+=" line-through"),r&&(a+=`text-decoration:${r};`),a}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 He(n,e,t,i){const o=t.tokens.data,a=n.getLanguageId();let r=0,I=0;const C=i.lineNumber-1,x=i.column-1;for(let N=0;N<o.length;N+=5){const p=o[N],m=o[N+1],R=o[N+2],L=o[N+3],S=o[N+4],w=r+p,f=p===0?I+m:m;if(C===w&&f<=x&&x<f+R){const j=t.legend.tokenTypes[L]||"not in legend (ignored)",A=[];let l=S;for(let J=0;l>0&&J<t.legend.tokenModifiers.length;J++)l&1&&A.push(t.legend.tokenModifiers[J]),l=l>>1;l>0&&A.push("not in legend (ignored)");const u=new k.Range(w+1,f+1,w+1,f+1+R),y={},W=e.getColorTheme().tokenColorMap,b=e.getColorTheme().getTokenStyleMetadata(j,A,a,!0,y);let D;return b&&(D={languageId:void 0,tokenType:Ie.Other,bold:b==null?void 0:b.bold,italic:b==null?void 0:b.italic,underline:b==null?void 0:b.underline,strikethrough:b==null?void 0:b.strikethrough,foreground:W[(b==null?void 0:b.foreground)||de.None],background:void 0}),{type:j,modifiers:A,range:u,metadata:D,definitions:y}}r=w,I=f}return null}function qe(n,e,t){let i=null;for(let o=1;o<t;o++)i=e.tokenizeLine(n.getLineContent(o),i).ruleStack;return i}function _e(n,e,t){const i=n.getColorTheme().tokenColorMap,o=P.getLanguageId(t),a=P.getTokenType(t),r=P.getFontStyle(t),I=P.getForeground(t),C=P.getBackground(t);return{languageId:e.languageIdCodec.decodeLanguageId(o),tokenType:a,bold:r&Y.Bold?!0:void 0,italic:r&Y.Italic?!0:void 0,underline:r&Y.Underline?!0:void 0,strikethrough:r&Y.Strikethrough?!0:void 0,foreground:i[I],background:i[C]}}function ze(n,e,t){const i=t.lineNumber,o=n,a=o._tokenizationTextModelPart.grammarTokens._tokenizer.tokenizationSupport._actual._grammar,r=qe(n,a,i),I=a.tokenizeLine(n.getLineContent(i),r),C=a.tokenizeLine2(n.getLineContent(i),r);let x=0;for(let p=I.tokens.length-1;p>=0;p--){const m=I.tokens[p];if(t.column-1>=m.startIndex){x=p;break}}let N=0;for(let p=C.tokens.length>>>1;p>=0;p--)if(t.column-1>=C.tokens[p<<1]){N=p;break}return{token:I.tokens[x],metadata:_e(e,o._languageService,C.tokens[(N<<1)+1])}}const Ce=h.createContext(void 0),$e=({children:n,url:e,qodly:t,defaultZoom:i,openHandler:o,language:a="4d",defaultInited:r=!1})=>{const I=$.useMonaco(),[C,x]=h.useState(r),[N,p]=h.useState(null),m=h.useRef(),R=h.useRef(0);h.useEffect(()=>{e&&I&&L()},[e,I]);const L=async()=>{if(!I)return;const d=new Ze.Logger({enabled:process.env.NODE_ENV==="development",debugEnabled:process.env.NODE_ENV==="development"}),c=await ce({logger:d});await se.initServices({caller:"Qodly Code Editor",logger:d,serviceConfig:c}),o&&ie.StandaloneServices.get(ie.ICodeEditorService).registerCodeEditorOpenHandler(o),I.languages.registerCompletionItemProvider(a,t?Pe:Me);const g=z.KeybindingsRegistry.getDefaultKeybindings.bind(z.KeybindingsRegistry);z.KeybindingsRegistry.getDefaultKeybindings=()=>g().filter(E=>!["workbench.action.files.saveAs","workbench.action.files.save"].includes(E.command)),k.editor.addKeybindingRules(Ve),S()},S=()=>{p(null);let d;try{d=new WebSocket(localStorage.LSP_SERVER||e)}catch{p(new Event("INVALID_URL"));return}d.onopen=w,d.onclose=f,d.onerror=j,R.current=0},w=async function(){const d=U.toSocket(this),c=new De(d),g=new Ge(d),F=new Le.MonacoLanguageClient({name:"4D Language Client",clientOptions:{workspaceFolder:{uri:k.Uri.parse("file:///PACKAGE")},documentSelector:[{scheme:"file",language:a}],errorHandler:{error:()=>({action:ne.ErrorAction.Continue}),closed:()=>({action:ne.CloseAction.DoNotRestart})}},connectionProvider:{get:()=>Promise.resolve({reader:c,writer:g})}});m.current=F;const E=F.sendRequest.bind(F);m.current.sendRequest=function(G,M,_){return typeof G=="object"&&G.method==="textDocument/diagnostic"&&/file:\/\/\/PACKAGE\/Project\/Sources\/Methods\/__Debugger_.*/.test(M.textDocument.uri)?Promise.resolve():E(G,M,_)},c.onClose(()=>{F.stop(),R.current<3?setTimeout(()=>{R.current++,S()},1e3):p(new Event("WEBSOCKET_CLOSED"))}),F.needsStart()&&await F.start(),x(!0)},f=()=>{},j=d=>{p(d)};h.useEffect(()=>{const d=Z.lspSubject.subscribe(({action:c,payload:g})=>{switch(c){case Z.LspActions.WILL_SAVE:W(g.filePath);break;case Z.LspActions.DID_SAVE:O(g.filePath,g.content);break;case Z.LspActions.WILL_CREATE:b(g.filePath);break;case Z.LspActions.DID_CREATE:ve(g.filePath);break;case Z.LspActions.WILL_RENAME:D(g.oldPath,g.newPath);break;case Z.LspActions.DID_RENAME:Se(g.oldPath,g.newPath);break;case Z.LspActions.WILL_DELETE:J(g.filePath);break;case Z.LspActions.DID_DELETE:ye(g.filePath);break;case Z.LspActions.DIAGNOSTIC_REFRESH:y(g.filePath);break}});return()=>d.unsubscribe()},[]);const A=d=>{var c,g;return(g=(c=m.current)==null?void 0:c._features)==null?void 0:g.find(F=>{var E;return((E=F._registrationType)==null?void 0:E.method)===d})},l=d=>{const c=[],g=A(d);if(g)for(const[F,E]of g._registrations)E.provider&&c.push(E.provider);return c},u=async(d,c,g)=>{var E,G,M;const F=l(B.SemanticTokensRegistrationType.method);if(F[0]){const _=new k.CancellationTokenSource,ee=await Promise.resolve(F[0].full.provideDocumentSemanticTokens(c,_.token)),te=d,xe=ee?He(c,te._themeService,{tokens:ee,legend:(M=(G=(E=m.current)==null?void 0:E._capabilities)==null?void 0:G.semanticTokensProvider)==null?void 0:M.legend},g):null,Ne=ze(c,te._themeService,g);return{semanticTokenInfo:xe,textmateTokenInfo:Ne}}return null},y=d=>{if(m.current){const c=l(B.DocumentDiagnosticRequest.method);for(const g of c)g.onDidChangeDiagnosticsEmitter.fire()}},W=(d,c=B.TextDocumentSaveReason.Manual)=>{var g;(g=m.current)==null||g.sendNotification(B.WillSaveTextDocumentNotification.type,{textDocument:{uri:X(d)},reason:c})},O=(d,c)=>{var g;(g=m.current)==null||g.sendNotification(B.DidSaveTextDocumentNotification.type,{textDocument:{uri:X(d)},text:c})},b=d=>{var c;(c=m.current)==null||c.sendRequest(B.WillCreateFilesRequest.type,{files:[{uri:X(d)}]})},D=(d,c)=>{var g;(g=m.current)==null||g.sendRequest(B.WillRenameFilesRequest.type,{files:[{oldUri:X(d),newUri:X(c)}]})},J=d=>{var c;(c=m.current)==null||c.sendRequest(B.WillDeleteFilesRequest.type,{files:[{uri:X(d)}]})},ve=d=>{var c;(c=m.current)==null||c.sendNotification(B.DidCreateFilesNotification.type,{files:[{uri:X(d)}]})},Se=(d,c)=>{var g;(g=m.current)==null||g.sendNotification(B.DidRenameFilesNotification.type,{files:[{oldUri:X(d),newUri:X(c)}]})},ye=d=>{var c;(c=m.current)==null||c.sendNotification(B.DidDeleteFilesNotification.type,{files:[{uri:X(d)}]})};return v.jsxs(Ce.Provider,{value:{inited:C||!!N,clientRef:m,lastError:N,reload:S,getTokenAtPosition:u},children:[n,v.jsx(Ye,{defaultZoom:i})]})};function Ue(){const n=h.useContext(Ce);if(n===void 0)throw new Error("useLSP must be used within an LSPContext");return n}const me=h.createContext(void 0),Qe=h.memo(({children:n})=>{const[e,t]=h.useState(null);return v.jsx(me.Provider,{value:{editor:e,setEditor:t},children:n})});function fe(){const n=h.useContext(me),e=h.useState(null);if(n===void 0){const[t,i]=e;return{editor:t,setEditor:i}}return n}var Ae={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},oe=h.createContext&&h.createContext(Ae),T=globalThis&&globalThis.__assign||function(){return T=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},T.apply(this,arguments)},et=globalThis&&globalThis.__rest||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 pe(n){return n&&n.map(function(e,t){return h.createElement(e.tag,T({key:t},e.attr),pe(e.child))})}function be(n){return function(e){return h.createElement(tt,T({attr:T({},n.attr)},e),pe(n.child))}}function tt(n){var e=function(t){var i=n.attr,o=n.size,a=n.title,r=et(n,["attr","size","title"]),I=o||t.size||"1em",C;return t.className&&(C=t.className),n.className&&(C=(C?C+" ":"")+n.className),h.createElement("svg",T({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,i,r,{className:C,style:T(T({color:n.color||t.color},t.style),n.style),height:I,width:I,xmlns:"http://www.w3.org/2000/svg"}),a&&h.createElement("title",null,a),n.children)};return oe!==void 0?h.createElement(oe.Consumer,null,function(t){return e(t)}):e(Ae)}function nt(n){return be({tag:"svg",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 it(n){return be({tag:"svg",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 he=({lspProps:{lastError:n,reload:e}})=>{const[t,i]=h.useState(!1),o=()=>{e()},a=()=>{i(!1)};return h.useEffect(()=>{i(!!n)},[n]),t?v.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:[v.jsxs("span",{className:"flex flex-1 justify-center gap-1",children:[v.jsx(it,{className:"h-4 w-4 text-yellow-600"}),v.jsxs("span",{children:["LSP not loaded."," ",v.jsx("button",{className:"text-primary-dark underline",onClick:o,children:"Reload?"})]})]}),v.jsx("button",{className:"focus:outline-none",children:v.jsx(nt,{className:"h-4 w-4 text-white",onClick:a})})]}):null},ot={provideCompletionItems:(n,e)=>{const t=n.getWordUntilPosition(e);return{suggestions:[{label:"device:xs",kind:s.languages.CompletionItemKind.Snippet,documentation:"Media query for phone device",range:new s.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:
|
|
88
|
+
`);if(this.state==="initial")this.events.splice(0,0,{message:n});else if(this.state==="listening"){const i=JSON.parse(n);this.callback(i)}}}class Oe extends $.WebSocketMessageWriter{constructor(e,n){super(e),this.onSend=n}async write(e){try{const n=JSON.stringify(e);this.socket.send(n),this.onSend&&this.onSend()}catch(n){this.errorCount++,this.fireError(n,e,this.errorCount)}}}function E(t,e=!0){const n=`/PACKAGE/Project/Sources/${t}`;return e?`file://${n}`:n}function Q(t,e=0){setTimeout(t,e)}function ge(t,e){const n=new j.Selection(e.startLineNumber,e.startColumn,e.endLineNumber||e.startLineNumber,e.endColumn||e.startColumn);Q(()=>{t.setSelection(n),t.revealRangeInCenter(n),t.focus()})}function ue(t,e,n=0){n>0&&(e=n+e),Q(()=>{t.setPosition({lineNumber:e,column:1}),t.revealLineInCenter(e),t.focus()})}function De(t,e,n){const o=t.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) ${n}`).test(p))return s}}return 0}const Ge={provideCompletionItems:async(t,e)=>{const n=t.getWordUntilPosition(e);return{suggestions:[{label:"var",kind:a.languages.CompletionItemKind.Snippet,range:new a.Range(e.lineNumber,n.startColumn,e.lineNumber,n.endColumn),insertText:["var ${1:var_name} : ${2:var_type}"].join(`
|
|
89
|
+
`),insertTextRules:a.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"While",kind:a.languages.CompletionItemKind.Snippet,range:new a.Range(e.lineNumber,n.startColumn,e.lineNumber,n.endColumn),insertText:["While(${1:expression})"," ${2:body}","End while"].join(`
|
|
90
|
+
`),insertTextRules:a.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"Case of",kind:a.languages.CompletionItemKind.Snippet,range:new a.Range(e.lineNumber,n.startColumn,e.lineNumber,n.endColumn),insertText:["Case of"," :(${1:boolean_expression})"," ${2:body}","End case"].join(`
|
|
91
|
+
`),insertTextRules:a.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"Else",kind:a.languages.CompletionItemKind.Snippet,range:new a.Range(e.lineNumber,n.startColumn,e.lineNumber,n.endColumn),insertText:["Else"," "].join(`
|
|
92
|
+
`),insertTextRules:a.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"If",kind:a.languages.CompletionItemKind.Snippet,range:new a.Range(e.lineNumber,n.startColumn,e.lineNumber,n.endColumn),insertText:["If (${1:expression})"," ${5:body}","End if"].join(`
|
|
93
|
+
`),insertTextRules:a.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"For",kind:a.languages.CompletionItemKind.Snippet,range:new a.Range(e.lineNumber,n.startColumn,e.lineNumber,n.endColumn),insertText:["For(${1:counter};${2:start};${3:end}${4:;increment})"," ${5:body}","End for"].join(`
|
|
94
|
+
`),insertTextRules:a.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"Function",kind:a.languages.CompletionItemKind.Snippet,range:new a.Range(e.lineNumber,n.startColumn,e.lineNumber,n.endColumn),insertText:["Function ${1:function_name}(${2:params}) -> ${3:var_name} : ${4:var_type}"," ${5:body}"].join(`
|
|
95
|
+
`),insertTextRules:a.languages.CompletionItemInsertTextRule.InsertAsSnippet}]}}},Pe={provideCompletionItems:async(t,e)=>{const n=t.getWordUntilPosition(e);return{suggestions:[{label:"var",kind:a.languages.CompletionItemKind.Snippet,range:new a.Range(e.lineNumber,n.startColumn,e.lineNumber,n.endColumn),insertText:["var ${1:var_name} : ${2:var_type}"].join(`
|
|
96
|
+
`),insertTextRules:a.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"while",kind:a.languages.CompletionItemKind.Snippet,range:new a.Range(e.lineNumber,n.startColumn,e.lineNumber,n.endColumn),insertText:["while(${1:expression})"," ${2:body}","end"].join(`
|
|
97
|
+
`),insertTextRules:a.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"switch",kind:a.languages.CompletionItemKind.Snippet,range:new a.Range(e.lineNumber,n.startColumn,e.lineNumber,n.endColumn),insertText:["switch"," :(${1:boolean_expression})"," ${2:body}","end"].join(`
|
|
98
|
+
`),insertTextRules:a.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"else",kind:a.languages.CompletionItemKind.Snippet,range:new a.Range(e.lineNumber,n.startColumn,e.lineNumber,n.endColumn),insertText:["else"," "].join(`
|
|
99
|
+
`),insertTextRules:a.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"if",kind:a.languages.CompletionItemKind.Snippet,range:new a.Range(e.lineNumber,n.startColumn,e.lineNumber,n.endColumn),insertText:["if (${1:expression})"," ${5:body}","end"].join(`
|
|
100
|
+
`),insertTextRules:a.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"for",kind:a.languages.CompletionItemKind.Snippet,range:new a.Range(e.lineNumber,n.startColumn,e.lineNumber,n.endColumn),insertText:["for(${1:counter},${2:start},${3:end}${4:,increment})"," ${5:body}","end"].join(`
|
|
101
|
+
`),insertTextRules:a.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"function",kind:a.languages.CompletionItemKind.Snippet,range:new a.Range(e.lineNumber,n.startColumn,e.lineNumber,n.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:j.KeyMod.CtrlCmd|j.KeyCode.NumpadAdd,command:"editor.action.fontZoomIn"},{keybinding:j.KeyMod.CtrlCmd|j.KeyCode.Equal,command:"editor.action.fontZoomIn"},{keybinding:j.KeyMod.CtrlCmd|j.KeyCode.NumpadSubtract,command:"editor.action.fontZoomOut"},{keybinding:j.KeyMod.CtrlCmd|j.KeyCode.Minus,command:"editor.action.fontZoomOut"},{keybinding:j.KeyMod.CtrlCmd|j.KeyCode.Numpad0,command:"editor.action.fontZoomReset"},{keybinding:j.KeyMod.CtrlCmd|j.KeyCode.Digit0,command:"editor.action.fontZoomReset"}],Me=({defaultZoom:t})=>(S.useEffect(()=>{t!==void 0&&j.editor.EditorZoom.setZoomLevel(t)},[]),null);z.loader.config({monaco:a});var Y=(t=>(t[t.NotSet=-1]="NotSet",t[t.None=0]="None",t[t.Italic=1]="Italic",t[t.Bold=2]="Bold",t[t.Underline=4]="Underline",t[t.Strikethrough=8]="Strikethrough",t))(Y||{}),de=(t=>(t[t.None=0]="None",t[t.DefaultForeground=1]="DefaultForeground",t[t.DefaultBackground=2]="DefaultBackground",t))(de||{}),Ie=(t=>(t[t.Other=0]="Other",t[t.Comment=1]="Comment",t[t.String=2]="String",t[t.RegEx=3]="RegEx",t))(Ie||{});class M{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,n){const i=this.getForeground(e),o=this.getFontStyle(e);let r=`color: ${n[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 n=this.getForeground(e),i=this.getFontStyle(e);return{foreground:n,italic:!!(i&1),bold:!!(i&2),underline:!!(i&4),strikethrough:!!(i&8)}}}function Ve(t,e,n,i){const o=n.tokens.data,r=t.getLanguageId();let s=0,p=0;const I=i.lineNumber-1,v=i.column-1;for(let b=0;b<o.length;b+=5){const C=o[b],m=o[b+1],N=o[b+2],L=o[b+3],x=o[b+4],w=s+C,f=C===0?p+m:m;if(I===w&&f<=v&&v<f+N){const k=n.legend.tokenTypes[L]||"not in legend (ignored)",A=[];let l=x;for(let P=0;l>0&&P<n.legend.tokenModifiers.length;P++)l&1&&A.push(n.legend.tokenModifiers[P]),l=l>>1;l>0&&A.push("not in legend (ignored)");const u=new j.Range(w+1,f+1,w+1,f+1+N),R={},F=e.getColorTheme().tokenColorMap,h=e.getColorTheme().getTokenStyleMetadata(k,A,r,!0,R);let D;return h&&(D={languageId:void 0,tokenType:Ie.Other,bold:h==null?void 0:h.bold,italic:h==null?void 0:h.italic,underline:h==null?void 0:h.underline,strikethrough:h==null?void 0:h.strikethrough,foreground:F[(h==null?void 0:h.foreground)||de.None],background:void 0}),{type:k,modifiers:A,range:u,metadata:D,definitions:R}}s=w,p=f}return null}function Ye(t,e,n){let i=null;for(let o=1;o<n;o++)i=e.tokenizeLine(t.getLineContent(o),i).ruleStack;return i}function qe(t,e,n){const i=t.getColorTheme().tokenColorMap,o=M.getLanguageId(n),r=M.getTokenType(n),s=M.getFontStyle(n),p=M.getForeground(n),I=M.getBackground(n);return{languageId:e.languageIdCodec.decodeLanguageId(o),tokenType:r,bold:s&Y.Bold?!0:void 0,italic:s&Y.Italic?!0:void 0,underline:s&Y.Underline?!0:void 0,strikethrough:s&Y.Strikethrough?!0:void 0,foreground:i[p],background:i[I]}}function He(t,e,n){const i=n.lineNumber,o=t,r=o._tokenizationTextModelPart.grammarTokens._tokenizer.tokenizationSupport._actual._grammar,s=Ye(t,r,i),p=r.tokenizeLine(t.getLineContent(i),s),I=r.tokenizeLine2(t.getLineContent(i),s);let v=0;for(let C=p.tokens.length-1;C>=0;C--){const m=p.tokens[C];if(n.column-1>=m.startIndex){v=C;break}}let b=0;for(let C=I.tokens.length>>>1;C>=0;C--)if(n.column-1>=I.tokens[C<<1]){b=C;break}return{token:p.tokens[v],metadata:qe(e,o._languageService,I.tokens[(b<<1)+1])}}const Ce=S.createContext(void 0),_e=({children:t,url:e,qodly:n,defaultZoom:i,openHandler:o,language:r="4d",defaultInited:s=!1})=>{const p=z.useMonaco(),[I,v]=S.useState(s),[b,C]=S.useState(null),m=S.useRef(),N=S.useRef(0);S.useEffect(()=>{e&&p&&L()},[e,p]);const L=async()=>{if(!p)return;const d=new Fe.Logger({enabled:process.env.NODE_ENV==="development",debugEnabled:process.env.NODE_ENV==="development"}),c=await ce({logger:d});await se.initServices({caller:"Qodly Code Editor",logger:d,serviceConfig:c}),o&&ie.StandaloneServices.get(ie.ICodeEditorService).registerCodeEditorOpenHandler(o),p.languages.registerCompletionItemProvider(r,n?Pe:Ge);const g=U.KeybindingsRegistry.getDefaultKeybindings.bind(U.KeybindingsRegistry);U.KeybindingsRegistry.getDefaultKeybindings=()=>g().filter(K=>!["workbench.action.files.saveAs","workbench.action.files.save"].includes(K.command)),j.editor.addKeybindingRules(Je),x()},x=()=>{C(null);let d;try{d=new WebSocket(localStorage.LSP_SERVER||e)}catch{C(new Event("INVALID_URL"));return}d.onopen=w,d.onclose=f,d.onerror=k,N.current=0},w=async function(){const d=$.toSocket(this),c=new Be(d),g=new Oe(d),W=new Ne.MonacoLanguageClient({name:"4D Language Client",clientOptions:{workspaceFolder:{uri:j.Uri.parse("file:///PACKAGE")},documentSelector:[{scheme:"file",language:r}],errorHandler:{error:()=>({action:ne.ErrorAction.Continue}),closed:()=>({action:ne.CloseAction.DoNotRestart})}},connectionProvider:{get:()=>Promise.resolve({reader:c,writer:g})}});m.current=W;const K=W.sendRequest.bind(W);m.current.sendRequest=function(G,J,_){return typeof G=="object"&&G.method==="textDocument/diagnostic"&&/file:\/\/\/PACKAGE\/Project\/Sources\/Methods\/__Debugger_.*/.test(J.textDocument.uri)?Promise.resolve():K(G,J,_)},c.onClose(()=>{W.stop(),N.current<3?setTimeout(()=>{N.current++,x()},1e3):C(new Event("WEBSOCKET_CLOSED"))}),W.needsStart()&&await W.start(),v(!0)},f=()=>{},k=d=>{C(d)};S.useEffect(()=>{const d=Z.lspSubject.subscribe(({action:c,payload:g})=>{switch(c){case Z.LspActions.WILL_SAVE:F(g.filePath);break;case Z.LspActions.DID_SAVE:O(g.filePath,g.content);break;case Z.LspActions.WILL_CREATE:h(g.filePath);break;case Z.LspActions.DID_CREATE:ve(g.filePath);break;case Z.LspActions.WILL_RENAME:D(g.oldPath,g.newPath);break;case Z.LspActions.DID_RENAME:Se(g.oldPath,g.newPath);break;case Z.LspActions.WILL_DELETE:P(g.filePath);break;case Z.LspActions.DID_DELETE:ye(g.filePath);break;case Z.LspActions.DIAGNOSTIC_REFRESH:R(g.filePath);break}});return()=>d.unsubscribe()},[]);const A=d=>{var c,g;return(g=(c=m.current)==null?void 0:c._features)==null?void 0:g.find(W=>{var K;return((K=W._registrationType)==null?void 0:K.method)===d})},l=d=>{const c=[],g=A(d);if(g)for(const[W,K]of g._registrations)K.provider&&c.push(K.provider);return c},u=async(d,c,g)=>{var K,G,J;const W=l(T.SemanticTokensRegistrationType.method);if(W[0]){const _=new j.CancellationTokenSource,ee=await Promise.resolve(W[0].full.provideDocumentSemanticTokens(c,_.token)),te=d,xe=ee?Ve(c,te._themeService,{tokens:ee,legend:(J=(G=(K=m.current)==null?void 0:K._capabilities)==null?void 0:G.semanticTokensProvider)==null?void 0:J.legend},g):null,Re=He(c,te._themeService,g);return{semanticTokenInfo:xe,textmateTokenInfo:Re}}return null},R=d=>{if(m.current){const c=l(T.DocumentDiagnosticRequest.method);for(const g of c)g.onDidChangeDiagnosticsEmitter.fire()}},F=(d,c=T.TextDocumentSaveReason.Manual)=>{var g;(g=m.current)==null||g.sendNotification(T.WillSaveTextDocumentNotification.type,{textDocument:{uri:E(d)},reason:c})},O=(d,c)=>{var g;(g=m.current)==null||g.sendNotification(T.DidSaveTextDocumentNotification.type,{textDocument:{uri:E(d)},text:c})},h=d=>{var c;(c=m.current)==null||c.sendRequest(T.WillCreateFilesRequest.type,{files:[{uri:E(d)}]})},D=(d,c)=>{var g;(g=m.current)==null||g.sendRequest(T.WillRenameFilesRequest.type,{files:[{oldUri:E(d),newUri:E(c)}]})},P=d=>{var c;(c=m.current)==null||c.sendRequest(T.WillDeleteFilesRequest.type,{files:[{uri:E(d)}]})},ve=d=>{var c;(c=m.current)==null||c.sendNotification(T.DidCreateFilesNotification.type,{files:[{uri:E(d)}]})},Se=(d,c)=>{var g;(g=m.current)==null||g.sendNotification(T.DidRenameFilesNotification.type,{files:[{oldUri:E(d),newUri:E(c)}]})},ye=d=>{var c;(c=m.current)==null||c.sendNotification(T.DidDeleteFilesNotification.type,{files:[{uri:E(d)}]})};return y.jsxs(Ce.Provider,{value:{inited:I||!!b,clientRef:m,lastError:b,reload:x,getTokenAtPosition:u},children:[t,y.jsx(Me,{defaultZoom:i})]})};function Ue(){const t=S.useContext(Ce);if(t===void 0)throw new Error("useLSP must be used within an LSPContext");return t}const me=S.createContext(void 0),ze=S.memo(({children:t})=>{const[e,n]=S.useState(null);return y.jsx(me.Provider,{value:{editor:e,setEditor:n},children:t})});function fe(){const t=S.useContext(me),e=S.useState(null);if(t===void 0){const[n,i]=e;return{editor:n,setEditor:i}}return t}var Ae={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},oe=S.createContext&&S.createContext(Ae),B=function(){return B=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},B.apply(this,arguments)},$e=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,i=Object.getOwnPropertySymbols(t);o<i.length;o++)e.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(t,i[o])&&(n[i[o]]=t[i[o]]);return n};function pe(t){return t&&t.map(function(e,n){return S.createElement(e.tag,B({key:n},e.attr),pe(e.child))})}function be(t){return function(e){return S.createElement(Qe,B({attr:B({},t.attr)},e),pe(t.child))}}function Qe(t){var e=function(n){var i=t.attr,o=t.size,r=t.title,s=$e(t,["attr","size","title"]),p=o||n.size||"1em",I;return n.className&&(I=n.className),t.className&&(I=(I?I+" ":"")+t.className),S.createElement("svg",B({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,i,s,{className:I,style:B(B({color:t.color||n.color},n.style),t.style),height:p,width:p,xmlns:"http://www.w3.org/2000/svg"}),r&&S.createElement("title",null,r),t.children)};return oe!==void 0?S.createElement(oe.Consumer,null,function(n){return e(n)}):e(Ae)}function et(t){return be({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"}}]})(t)}function tt(t){return be({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"}}]})(t)}const he=({lspProps:{lastError:t,reload:e}})=>{const[n,i]=S.useState(!1),o=()=>{e()},r=()=>{i(!1)};return S.useEffect(()=>{i(!!t)},[t]),n?y.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:[y.jsxs("span",{className:"flex flex-1 justify-center gap-1",children:[y.jsx(tt,{className:"h-4 w-4 text-yellow-600"}),y.jsxs("span",{children:["LSP not loaded."," ",y.jsx("button",{className:"text-primary-dark underline",onClick:o,children:"Reload?"})]})]}),y.jsx("button",{className:"focus:outline-none",children:y.jsx(et,{className:"h-4 w-4 text-white",onClick:r})})]}):null},nt={provideCompletionItems:(t,e)=>{const n=t.getWordUntilPosition(e);return{suggestions:[{label:"device:xs",kind:a.languages.CompletionItemKind.Snippet,documentation:"Media query for phone device",range:new a.Range(e.lineNumber,n.startColumn,e.lineNumber,n.endColumn),insertText:["@media screen and (max-width: ${1:365px}) {"," self {"," ${2:background-color}:${3:red};"," }","}"].join(`
|
|
103
|
+
`),insertTextRules:a.languages.CompletionItemInsertTextRule.InsertAsSnippet}]}}},it="#/definitions/Condition",ot={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"]}},rt={$ref:it,definitions:ot},st="array",at={type:"object",properties:{class:{type:"string"},method:{type:"string"},regexPattern:{type:"string"},verbs:{type:"string"}}},lt={type:st,items:at};function ct(t,e){const n=document.createElement("style");n.dataset.id=e,n.textContent=t,document.head.append(n)}function gt(t){return Array.from(document.styleSheets).find(e=>e.ownerNode.getAttribute("data-id")===t)}function ut(t,e){const n=[];let i=[];const o=[],r=(l,u,R,F)=>{n.push({startLineNumber:l,endLineNumber:R,startColumn:u,endColumn:F}),v(),I()},s=l=>{o.indexOf(l)<0&&o.push(l)},p=l=>{const u=o.indexOf(l);u<0||o.splice(u,1)},I=()=>{for(const l of o)try{l(i)}catch(u){console.error(u)}},v=()=>{const l=t.getModel();l&&(i=It(n.map(u=>[l.getOffsetAt({lineNumber:u.startLineNumber,column:u.startColumn}),l.getOffsetAt({lineNumber:u.endLineNumber,column:u.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)))},b=l=>{const u={isDeletion:!1,isAddition:!1,isReplacement:!1};return l.text===""?u.isDeletion=!0:l.range.startLineNumber===l.range.endLineNumber&&l.range.startColumn===l.range.endColumn?u.isAddition=!0:u.isReplacement=!0,u},C=t.onDidChangeModel(l=>{v(),k()}),m=t.onDidChangeModelContent(l=>{if(!l.isUndoing)for(const u of l.changes){const R=b(u);if(R.isReplacement||R.isDeletion||R.isAddition){const F=n.some(h=>u.range.startLineNumber>=h.startLineNumber&&u.range.endLineNumber<=h.endLineNumber&&u.range.startColumn>=h.startColumn&&u.range.endColumn<=h.endColumn),O=!F&&e&&u.range.startLineNumber===1&&u.range.startColumn===1&&!Z.hasAttributesString(u.text);if(F||O){const h=t.getModel();if(h){h.undo();return}}}}}),N=()=>{C.dispose(),m.dispose()};let L=[],x=`
|
|
104
104
|
.idoc-readonly-mark {
|
|
105
105
|
cursor: not-allowed;
|
|
106
106
|
z-index: 1;
|
|
107
107
|
}
|
|
108
|
-
`;if(S){const l="monaco-read-only";dt(l)||ut(S,l),S=null}const w=()=>{r(j),j()},f=()=>{I(j),L=n.deltaDecorations(L,[])},j=()=>{const l=n.getModel();l&&(L=n.deltaDecorations(L,i.map(A(l))))},A=l=>u=>{const y=l.getPositionAt(u[0]),W=l.getPositionAt(u[1]);return{range:new s.Range(y.lineNumber,y.column,W.lineNumber,W.column),options:{className:"idoc-readonly-mark"}}};return{get buffer(){return i},exclude:a,attach:r,detach:I,dispose:R,show:w,hide:f}}function Ct(n,e,t){let i=!1;const o=f=>f[1]<f[0]?(i=!0,[[f[1],f[0]]]):[[...f]],a=f=>i?f.map(j=>j[1]>j[0]?I(j):j).reverse():f;let r;const I=f=>(r=f[1],f[1]=f[0],f[0]=r,f),C=o(n);let x,N,p,m,R,L,S,w;p=C[0];for(N of e)for(S=N[0],w=N[1],m=0;m<C.length;m++){if(p=C[m],R=p[0],L=p[1],R<S)L<S?x=[p]:L<=w?x=[[R,S-1]]:x=[[R,S-1],[w+1,L]];else if(R<=w)if(S===Number.NEGATIVE_INFINITY){const f=w+1;x=t===0?[]:[[f,L>f?L:f]]}else w===Number.POSITIVE_INFINITY?x=t===0?[]:[[S-1,S-1]]:L<=w?x=t<0?[[S-1,S-1]]:t>0?[[w+1,w+1]]:[]:x=[[w+1,L]];else x=[p];if(C.splice(m,1,...x),C.length===1&&C[0][1]<S)return a(C)}return a(C)}function mt(n,e){if(n.length<2)return n;const t=[];let i=null,o,a;n=n.map(r=>(r[1]<r[0]&&(o=r[1],r[1]=r[0],r[1]=o),r)).sort((r,I)=>r[0]-I[0]),t.push(n[0]);for(let r=1;r<n.length;r++)i=t[t.length-1],a=n[r],i[1]===a[0]&&!e?t.push(a):i[1]===a[0]-1&&e?(i[1]=a[1],t.splice(t.length-1,1,i)):i[1]<a[0]?t.push(a):i[1]<a[1]&&(i[1]=a[1],t.splice(t.length-1,1,i));return t}function V(n,e){return e.bind(n)}class ft{constructor(e,t){K(this,"editor");K(this,"intervals");K(this,"disposables",[]);K(this,"prefer",1);K(this,"lastPrefer",1);K(this,"onCursor",V(this,function(e){if(e.source==="api")return;const t=this.getApprovedSelections();t.length!==0&&this.editor.setSelections(t)}));K(this,"onRectangleSelectionStart",V(this,function({event:e}){e.middleButton&&(this.lastPrefer=this.prefer,this.prefer=0,window.addEventListener("pointerup",this.onRectangleSelectionStop))}));K(this,"onRectangleSelectionStop",V(this,function(){this.prefer=this.lastPrefer,window.removeEventListener("pointerup",this.onRectangleSelectionStop)}));K(this,"onKey",V(this,function(e){const t=e.keyCode,i=s.KeyCode;if(e.altKey||i.F1<=t&&t<=i.F19||e.ctrlKey&&t!==i.Backspace)return;if(t===i.UpArrow||t===i.LeftArrow||t===i.Home||t===i.PageUp){this.prefer=-1;return}if(t===i.DownArrow||t===i.RightArrow||t===i.End||t===i.PageDown){this.prefer=1;return}const o=this.getSelections(),a=this.intervals.buffer;let r;if(t===i.Delete)r=I=>I[0]===I[1]&&a.find(C=>I[1]+1===C[0])!=null;else if(t===i.Backspace)r=I=>I[0]===I[1]&&a.find(C=>C[1]+1===I[0])!=null;else return;o.findIndex(r)!==-1&&(e.stopPropagation(),e.preventDefault())}));K(this,"getOffsetAt",V(this,function(e){let t;for(let i=0;i<this.intervals.buffer.length;i++)if(t=this.intervals.buffer[i],e<=t[1])return t[0]-e<e-t[1]?t[0]:t[1]}));var i;this.editor=e,this.intervals=It(e,t),(i=this.editor.getModel())==null||i.setEOL(s.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=>Ct(i,this.intervals.buffer,this.prefer)).flat().map(i=>{const o=e.getPositionAt(i[0]),a=e.getPositionAt(i[1]);return new s.Selection(o.lineNumber,o.column,a.lineNumber,a.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 At=new RegExp("^[ s]+(exposed|Function)","i"),re=()=>v.jsx("div",{className:"absolute inset-0 animate-pulse",children:v.jsx("div",{className:"w-full space-y-4 px-4 py-1",children:v.jsxs("div",{className:"space-y-2",children:[v.jsx("div",{className:"h-3 w-3/4 rounded bg-grey-200"}),v.jsx("div",{className:"h-3 rounded bg-grey-200"}),v.jsx("div",{className:"h-3 w-5/6 rounded bg-grey-200"}),v.jsx("div",{className:"h-3 rounded bg-grey-200"}),v.jsx("div",{className:"h-3 rounded bg-grey-200"})]})})}),H=["fd-dark"],pt=({path:n,initialValue:e,type:t,language:i,onChange:o,options:a={},extra:r={},showAlerts:I=!1,lspProps:C,theme:x=H[0],...N})=>{const{initialLineInfo:p,initialSelectionInfo:m}=r,{editor:R,setEditor:L}=fe(),{inited:S}=C;function w(A){i==="css"&&A.languages.registerCompletionItemProvider("css",ot),i==="json"&&A.languages.json&&A.languages.json.jsonDefaults.setDiagnosticsOptions({validate:!0,schemas:[{uri:"condition-schema.json",fileMatch:["*.condition.json"],schema:at},{uri:"handlers-schema.json",fileMatch:[Z.HTTP_HANDLERS_PATH],schema:gt}]})}function f(A,l){L(A);const u=A.getModel();if(u&&(u.updateOptions({insertSpaces:!1}),A.onKeyUp(()=>{var W;const y=(W=A.getPosition())==null?void 0:W.lineNumber;if(y){const O=u.getLineFirstNonWhitespaceColumn(y),b=u.getLineLength(y),D=u.getLineContent(y);At.test(D)&&A.executeEdits("edit-handler",[{range:new l.Range(y,0,y,b),text:D.substr(O-1,b-O)}])}})),t===Z.FileFolderType.METHOD&&Z.hasAttributesString(e)){const y=new ft(A,!0);y.exclude(1,1,1,Number.POSITIVE_INFINITY),y.enable()}}h.useEffect(()=>{if(!R)return;const{line:A,offset:l}=p||{};A&&ue(R,A,l)},[p,R]),h.useEffect(()=>{if(!R)return;const{selection:A}=m||{};A&&ge(R,A)},[m,R]);const j=A=>H.includes(A)?A:H[0];return S?v.jsxs(v.Fragment,{children:[I?v.jsx(he,{lspProps:C}):null,v.jsx($.Editor,{options:{readOnly:!0,fontSize:12,"semanticHighlighting.enabled":!0,padding:{top:10},...a},path:X(n),value:e,theme:j(x),onChange:A=>o&&o(A||""),language:i,beforeMount:w,onMount:f,loading:v.jsx(re,{}),...N})]}):v.jsx(re,{})},bt={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:q,whenReady:vt}=Ke.registerExtension(bt,void 0,{system:!0});q("./syntaxes/4d.tmLanguage.json",new URL("data:application/json;base64,ewogICJuYW1lIjogIjREIiwKICAic2NvcGVOYW1lIjogInNvdXJjZS40ZG0iLAogICJwYXR0ZXJucyI6IFsKICAgIHsKICAgICAgImluY2x1ZGUiOiAiI3N0YXRlbWVudHMiCiAgICB9CiAgXSwKICAicmVwb3NpdG9yeSI6IHsKICAgICJzdGF0ZW1lbnRzIjogewogICAgICAicGF0dGVybnMiOiBbCiAgICAgICAgewogICAgICAgICAgImluY2x1ZGUiOiAiI2NvbW1lbnQiCiAgICAgICAgfQogICAgICBdCiAgICB9LAogICAgImNvbW1lbnQiOiB7CiAgICAgICJwYXR0ZXJucyI6IFsKICAgICAgICB7CiAgICAgICAgICAibmFtZSI6ICJjb21tZW50LmJsb2NrLjRkIiwKICAgICAgICAgICJiZWdpbiI6ICIoL1xcKikoPzpcXHMqKChAKWludGVybmFsKSg/PVxcc3woXFwqLykpKT8iLAogICAgICAgICAgImJlZ2luQ2FwdHVyZXMiOiB7CiAgICAgICAgICAgICIxIjogewogICAgICAgICAgICAgICJuYW1lIjogInB1bmN0dWF0aW9uLmRlZmluaXRpb24uY29tbWVudC40ZCIKICAgICAgICAgICAgfSwKICAgICAgICAgICAgIjIiOiB7CiAgICAgICAgICAgICAgIm5hbWUiOiAic3RvcmFnZS50eXBlLmludGVybmFsZGVjbGFyYXRpb24uNGQiCiAgICAgICAgICAgIH0sCiAgICAgICAgICAgICIzIjogewogICAgICAgICAgICAgICJuYW1lIjogInB1bmN0dWF0aW9uLmRlY29yYXRvci5pbnRlcm5hbGRlY2xhcmF0aW9uLjRkIgogICAgICAgICAgICB9CiAgICAgICAgICB9LAogICAgICAgICAgImVuZCI6ICJcXCovIiwKICAgICAgICAgICJlbmRDYXB0dXJlcyI6IHsKICAgICAgICAgICAgIjAiOiB7CiAgICAgICAgICAgICAgIm5hbWUiOiAicHVuY3R1YXRpb24uZGVmaW5pdGlvbi5jb21tZW50LjRkIgogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAiYmVnaW4iOiAiKF5bIFxcdF0rKT8oKC8vKSg/OlxccyooKEApaW50ZXJuYWwpKD89XFxzfCQpKT8pIiwKICAgICAgICAgICJiZWdpbkNhcHR1cmVzIjogewogICAgICAgICAgICAiMSI6IHsKICAgICAgICAgICAgICAibmFtZSI6ICJwdW5jdHVhdGlvbi53aGl0ZXNwYWNlLmNvbW1lbnQubGVhZGluZy40ZCIKICAgICAgICAgICAgfSwKICAgICAgICAgICAgIjIiOiB7CiAgICAgICAgICAgICAgIm5hbWUiOiAiY29tbWVudC5saW5lLmRvdWJsZS1zbGFzaC40ZCIKICAgICAgICAgICAgfSwKICAgICAgICAgICAgIjMiOiB7CiAgICAgICAgICAgICAgIm5hbWUiOiAicHVuY3R1YXRpb24uZGVmaW5pdGlvbi5jb21tZW50LjRkIgogICAgICAgICAgICB9LAogICAgICAgICAgICAiNCI6IHsKICAgICAgICAgICAgICAibmFtZSI6ICJzdG9yYWdlLnR5cGUuaW50ZXJuYWxkZWNsYXJhdGlvbi40ZCIKICAgICAgICAgICAgfSwKICAgICAgICAgICAgIjUiOiB7CiAgICAgICAgICAgICAgIm5hbWUiOiAicHVuY3R1YXRpb24uZGVjb3JhdG9yLmludGVybmFsZGVjbGFyYXRpb24uNGQiCiAgICAgICAgICAgIH0KICAgICAgICAgIH0sCiAgICAgICAgICAiZW5kIjogIig/PSQpIiwKICAgICAgICAgICJjb250ZW50TmFtZSI6ICJjb21tZW50LmxpbmUuZG91YmxlLXNsYXNoLjRkIgogICAgICAgIH0KICAgICAgXQogICAgfQogIH0KfQo=",self.location).toString(),{mimeType:"application/json",size:1592});q("./language-configuration.json",new URL("data:application/json;base64,ewogICJjb21tZW50cyI6IHsKICAgICJsaW5lQ29tbWVudCI6ICIvLyIsCiAgICAiYmxvY2tDb21tZW50IjogWyIvKioiLCAiKiovIl0KICB9LAogIC8vIHN5bWJvbHMgdXNlZCBhcyBicmFja2V0cwogICJicmFja2V0cyI6IFsKICAgIFsieyIsICJ9Il0sCiAgICBbIigiLCAiKSJdLAogICAgWyJbIiwgIl0iXQogIF0sCiAgLy8gc3ltYm9scyB0aGF0IGFyZSBhdXRvIGNsb3NlZCB3aGVuIHR5cGluZwogIC8vIHN5bWJvbHMgdGhhdCB0aGF0IGNhbiBiZSB1c2VkIHRvIHN1cnJvdW5kIGEgc2VsZWN0aW9uCiAgInN1cnJvdW5kaW5nUGFpcnMiOiBbCiAgICBbInsiLCAifSJdLAogICAgWyJbIiwgIl0iXSwKICAgIFsiKCIsICIpIl0sCiAgICBbIlwiIiwgIlwiIl0sCiAgICBbIiciLCAiJyJdCiAgXSwKICAiYXV0b0Nsb3NpbmdQYWlycyI6IFsKICAgIHsKICAgICAgIm9wZW4iOiAiKCIsCiAgICAgICJjbG9zZSI6ICIpIgogICAgfSwKICAgIHsgIm9wZW4iOiAieyIsICJjbG9zZSI6ICJ9IiB9LAogICAgeyAib3BlbiI6ICJbIiwgImNsb3NlIjogIl0iIH0sCiAgICB7ICJvcGVuIjogIiciLCAiY2xvc2UiOiAiJyIsICJub3RJbiI6IFsic3RyaW5nIiwgImNvbW1lbnQiXSB9LAogICAgeyAib3BlbiI6ICJcIiIsICJjbG9zZSI6ICJcIiIsICJub3RJbiI6IFsic3RyaW5nIl0gfSwKICAgIHsgIm9wZW4iOiAiYCIsICJjbG9zZSI6ICJgIiwgIm5vdEluIjogWyJzdHJpbmciLCAiY29tbWVudCJdIH0sCiAgICB7ICJvcGVuIjogIi8qKiIsICJjbG9zZSI6ICIgKiovIiwgIm5vdEluIjogWyJzdHJpbmciXSB9CiAgXSwKICAiYXV0b0Nsb3NlQmVmb3JlIjogIjs6Liw9fV0pPmAgXG5cdCIsCiAgIndvcmRQYXR0ZXJuIjogIigtP1xcZCpcXC5cXGRcXHcqKXwoW15cXGBcXH5cXCFcXEBcXCNcXCVcXF5cXCZcXCpcXChcXClcXC1cXD1cXCtcXFtcXHtcXF1cXH1cXFxcXFx8XFw7XFw6XFwnXFxcIlxcLFxcLlxcPFxcPlxcL1xcP1xcclxcblxcdFxcZlxcdiBdKyl8KD88PVthLXpBLVpdKSA/KD89W2EtekEtWl0pIiwKICAiaW5kZW50YXRpb25SdWxlcyI6IHsKICAgICJpbmNyZWFzZUluZGVudFBhdHRlcm4iOiB7CiAgICAgICJwYXR0ZXJuIjogIiheKD8hW15cXHNdKSpcXHMqKGNsYXNzIGNvbnN0cnVjdG9yKSl8KF4oPyFbXlxcc10pKlxccyooZXhwb3NlZHxsb2NhbHxcXHMqKXsxfVxccypmdW5jdGlvbnsxfVxccypcXHcpfCheKD8hW15cXHNdKSpcXHMqKElmfEVsc2V8Rm9yfEZvciBlYWNofFdoaWxlfEJlZ2luIFNRTHxDYXNlIG9mfFVzZXxSZXBlYXR8OiAqXFwoLiopKS4qJCIsCiAgICAgICJmbGFncyI6ICJpIgogICAgfSwKICAgICJkZWNyZWFzZUluZGVudFBhdHRlcm4iOiB7CiAgICAgICJwYXR0ZXJuIjogIiheKD8hW15cXHNdKSpcXHMqKGV4cG9zZWR8bG9jYWx8XFxzKil7MX1cXHMqZnVuY3Rpb257MX1cXHMqXFx3KXwoRW5kIElmfEVuZCBGb3J8RWxzZXxFbmQgZm9yIGVhY2h8RW5kIFdoaWxlfEVuZCBTUUx8RW5kIGNhc2V8RW5kIHVzZXxVbnRpbHw6ICpcXCguKikuKiQiLAogICAgICAiZmxhZ3MiOiAiaSIKICAgIH0KICB9LAogICJvbkVudGVyUnVsZXMiOiBbCiAgICB7CiAgICAgICJiZWZvcmVUZXh0IjogewogICAgICAgICJwYXR0ZXJuIjogIl5leHBvc2VkIiwKICAgICAgICAiZmxhZ3MiOiAiaSIKICAgICAgfSwKICAgICAgImFjdGlvbiI6IHsgImluZGVudCI6ICJpbmRlbnQiLCAiaW5kZW50QWN0aW9uIjogMSB9CiAgICB9CiAgXQp9Cg==",self.location).toString(),{mimeType:"application/json",size:1723});q("package.json",new URL("data:application/json;base64,ewogICJuYW1lIjogIjRkIiwKICAiZGlzcGxheU5hbWUiOiAiJWRpc3BsYXlOYW1lJSIsCiAgImRlc2NyaXB0aW9uIjogIiVkZXNjcmlwdGlvbiUiLAogICJ2ZXJzaW9uIjogIjEuMC4wIiwKICAicHVibGlzaGVyIjogInZzY29kZSIsCiAgImxpY2Vuc2UiOiAiTUlUIiwKICAiZW5naW5lcyI6IHsKICAgICJ2c2NvZGUiOiAiMC4xMC54IgogIH0sCiAgInNjcmlwdHMiOiB7CiAgICAidXBkYXRlLWdyYW1tYXIiOiAibm9kZSAuLi9ub2RlX21vZHVsZXMvdnNjb2RlLWdyYW1tYXItdXBkYXRlci9iaW4gbWljcm9zb2Z0L3ZzY29kZS00ZCBncmFtbWFycy80ZC5jc29uIC4vc3ludGF4ZXMvNGQudG1MYW5ndWFnZS5qc29uIgogIH0sCiAgImNhdGVnb3JpZXMiOiBbCiAgICAiUHJvZ3JhbW1pbmcgTGFuZ3VhZ2VzIgogIF0sCiAgImNvbnRyaWJ1dGVzIjogewogICAgImxhbmd1YWdlcyI6IFsKICAgICAgewogICAgICAgICJpZCI6ICI0ZCIsCiAgICAgICAgImFsaWFzZXMiOiBbCiAgICAgICAgICAiNEQiLAogICAgICAgICAgIjRkIgogICAgICAgIF0sCiAgICAgICAgImV4dGVuc2lvbnMiOiBbCiAgICAgICAgICAiLjRkbSIsCiAgICAgICAgICAiLjRxcyIKICAgICAgICBdLAogICAgICAgICJjb25maWd1cmF0aW9uIjogIi4vbGFuZ3VhZ2UtY29uZmlndXJhdGlvbi5qc29uIgogICAgICB9CiAgICBdLAogICAgImdyYW1tYXJzIjogWwogICAgICB7CiAgICAgICAgImxhbmd1YWdlIjogIjRkIiwKICAgICAgICAic2NvcGVOYW1lIjogInNvdXJjZS40ZG0iLAogICAgICAgICJwYXRoIjogIi4vc3ludGF4ZXMvNGQudG1MYW5ndWFnZS5qc29uIgogICAgICB9CiAgICBdCiAgfSwKICAicmVwb3NpdG9yeSI6IHsKICAgICJ0eXBlIjogImdpdCIsCiAgICAidXJsIjogImh0dHBzOi8vZ2l0aHViLmNvbS9taWNyb3NvZnQvdnNjb2RlLmdpdCIKICB9Cn0K",self.location).toString(),{mimeType:"application/json",size:1006});q("package.nls.json",new URL("data:application/json;base64,ewogICJkaXNwbGF5TmFtZSI6ICI0RCBMYW5ndWFnZSBCYXNpY3MiLAogICJkZXNjcmlwdGlvbiI6ICJQcm92aWRlcyBzeW50YXggaGlnaGxpZ2h0aW5nIGFuZCBicmFja2V0IG1hdGNoaW5nIGZvciA0RE0gYW5kIDRRUyBmaWxlcy4iCn0K",self.location).toString(),{mimeType:"application/json",size:135});exports.Alerts=he;exports.CodeEditor=pt;exports.CodeEditorProvider=Qe;exports.LSPProvider=$e;exports.SUPPORTED_THEMES=H;exports._await=Q;exports.configureServices=ce;exports.getFileSystemPath=X;exports.getFunctionOffset=Je;exports.initMonacoUserConfiguration=le;exports.jumpToLine=ue;exports.jumpToSelection=ge;exports.useCodeEditor=fe;exports.useLSP=Ue;
|
|
108
|
+
`;if(x){const l="monaco-read-only";gt(l)||ct(x,l),x=null}const w=()=>{s(k),k()},f=()=>{p(k),L=t.deltaDecorations(L,[])},k=()=>{const l=t.getModel();l&&(L=t.deltaDecorations(L,i.map(A(l))))},A=l=>u=>{const R=l.getPositionAt(u[0]),F=l.getPositionAt(u[1]);return{range:new a.Range(R.lineNumber,R.column,F.lineNumber,F.column),options:{className:"idoc-readonly-mark"}}};return{get buffer(){return i},exclude:r,attach:s,detach:p,dispose:N,show:w,hide:f}}function dt(t,e,n){let i=!1;const o=f=>f[1]<f[0]?(i=!0,[[f[1],f[0]]]):[[...f]],r=f=>i?f.map(k=>k[1]>k[0]?p(k):k).reverse():f;let s;const p=f=>(s=f[1],f[1]=f[0],f[0]=s,f),I=o(t);let v,b,C,m,N,L,x,w;C=I[0];for(b of e)for(x=b[0],w=b[1],m=0;m<I.length;m++){if(C=I[m],N=C[0],L=C[1],N<x)L<x?v=[C]:L<=w?v=[[N,x-1]]:v=[[N,x-1],[w+1,L]];else if(N<=w)if(x===Number.NEGATIVE_INFINITY){const f=w+1;v=n===0?[]:[[f,L>f?L:f]]}else w===Number.POSITIVE_INFINITY?v=n===0?[]:[[x-1,x-1]]:L<=w?v=n<0?[[x-1,x-1]]:n>0?[[w+1,w+1]]:[]:v=[[w+1,L]];else v=[C];if(I.splice(m,1,...v),I.length===1&&I[0][1]<x)return r(I)}return r(I)}function It(t,e){if(t.length<2)return t;const n=[];let i=null,o,r;t=t.map(s=>(s[1]<s[0]&&(o=s[1],s[1]=s[0],s[1]=o),s)).sort((s,p)=>s[0]-p[0]),n.push(t[0]);for(let s=1;s<t.length;s++)i=n[n.length-1],r=t[s],i[1],r[0],i[1]===r[0]-1&&e?(i[1]=r[1],n.splice(n.length-1,1,i)):i[1]<r[0]?n.push(r):i[1]<r[1]&&(i[1]=r[1],n.splice(n.length-1,1,i));return n}function V(t,e){return e.bind(t)}class Ct{constructor(e,n){var i;this.disposables=[],this.prefer=1,this.lastPrefer=1,this.onCursor=V(this,function(o){if(o.source==="api")return;const r=this.getApprovedSelections();r.length!==0&&this.editor.setSelections(r)}),this.onRectangleSelectionStart=V(this,function({event:o}){o.middleButton&&(this.lastPrefer=this.prefer,this.prefer=0,window.addEventListener("pointerup",this.onRectangleSelectionStop))}),this.onRectangleSelectionStop=V(this,function(){this.prefer=this.lastPrefer,window.removeEventListener("pointerup",this.onRectangleSelectionStop)}),this.onKey=V(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(),I=this.intervals.buffer;let v;if(r===s.Delete)v=b=>b[0]===b[1]&&I.find(C=>b[1]+1===C[0])!=null;else if(r===s.Backspace)v=b=>b[0]===b[1]&&I.find(C=>C[1]+1===b[0])!=null;else return;p.findIndex(v)!==-1&&(o.stopPropagation(),o.preventDefault())}),this.getOffsetAt=V(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=ut(e,n),(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,n,i,o){arguments.length===1?this.intervals.exclude(e,0,e,Number.MAX_SAFE_INTEGER):this.intervals.exclude(e,n,i,o)}getApprovedSelections(){const e=this.editor.getModel();return this.getSelections().map(i=>dt(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(n=>[e.getOffsetAt({lineNumber:n.selectionStartLineNumber,column:n.selectionStartColumn}),e.getOffsetAt({lineNumber:n.positionLineNumber,column:n.positionColumn})])}}const mt=new RegExp("^[ s]+(exposed|Function)","i"),re=()=>y.jsx("div",{className:"absolute inset-0 animate-pulse",children:y.jsx("div",{className:"w-full space-y-4 px-4 py-1",children:y.jsxs("div",{className:"space-y-2",children:[y.jsx("div",{className:"h-3 w-3/4 rounded bg-grey-200"}),y.jsx("div",{className:"h-3 rounded bg-grey-200"}),y.jsx("div",{className:"h-3 w-5/6 rounded bg-grey-200"}),y.jsx("div",{className:"h-3 rounded bg-grey-200"}),y.jsx("div",{className:"h-3 rounded bg-grey-200"})]})})}),q=["fd-dark"],ft=({path:t,initialValue:e,type:n,language:i,onChange:o,options:r={},extra:s={},showAlerts:p=!1,lspProps:I,theme:v=q[0],...b})=>{const{initialLineInfo:C,initialSelectionInfo:m}=s,{editor:N,setEditor:L}=fe(),{inited:x}=I;function w(A){i==="css"&&A.languages.registerCompletionItemProvider("css",nt),i==="json"&&A.languages.json&&A.languages.json.jsonDefaults.setDiagnosticsOptions({validate:!0,schemas:[{uri:"condition-schema.json",fileMatch:["*.condition.json"],schema:rt},{uri:"handlers-schema.json",fileMatch:[Z.HTTP_HANDLERS_PATH],schema:lt}]})}function f(A,l){L(A);const u=A.getModel();if(u&&(u.updateOptions({insertSpaces:!1}),A.onKeyUp(()=>{var F;const R=(F=A.getPosition())==null?void 0:F.lineNumber;if(R){const O=u.getLineFirstNonWhitespaceColumn(R),h=u.getLineLength(R),D=u.getLineContent(R);mt.test(D)&&A.executeEdits("edit-handler",[{range:new l.Range(R,0,R,h),text:D.substr(O-1,h-O)}])}})),n===Z.FileFolderType.METHOD&&Z.hasAttributesString(e)){const R=new Ct(A,!0);R.exclude(1,1,1,Number.POSITIVE_INFINITY),R.enable()}}S.useEffect(()=>{if(!N)return;const{line:A,offset:l}=C||{};A&&ue(N,A,l)},[C,N]),S.useEffect(()=>{if(!N)return;const{selection:A}=m||{};A&&ge(N,A)},[m,N]);const k=A=>q.includes(A)?A:q[0];return x?y.jsxs(y.Fragment,{children:[p?y.jsx(he,{lspProps:I}):null,y.jsx(z.Editor,{options:{readOnly:!0,fontSize:12,"semanticHighlighting.enabled":!0,padding:{top:10},...r},path:E(t),value:e,theme:k(v),onChange:A=>o&&o(A||""),language:i,beforeMount:w,onMount:f,loading:y.jsx(re,{}),...b})]}):y.jsx(re,{})},At={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:H,whenReady:pt}=We.registerExtension(At,void 0,{system:!0});H("./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});H("./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});H("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});H("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=he;exports.CodeEditor=ft;exports.CodeEditorProvider=ze;exports.LSPProvider=_e;exports.SUPPORTED_THEMES=q;exports._await=Q;exports.configureServices=ce;exports.getFileSystemPath=E;exports.getFunctionOffset=De;exports.initMonacoUserConfiguration=le;exports.jumpToLine=ue;exports.jumpToSelection=ge;exports.useCodeEditor=fe;exports.useLSP=Ue;
|
|
109
109
|
//# sourceMappingURL=index.cjs.js.map
|