Current section
Files
Jump to
Current section
Files
priv/static/live_monaco_editor.min.js
var LiveMonacoEditor=(()=>{var y=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var G=Object.prototype.hasOwnProperty;var V=(e,t)=>{for(var n in t)y(e,n,{get:t[n],enumerable:!0})},Z=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of N(t))!G.call(e,o)&&o!==n&&y(e,o,{get:()=>t[o],enumerable:!(r=$(t,o))||r.enumerable});return e};var Y=e=>Z(y({},"__esModule",{value:!0}),e);var We={};V(We,{CodeEditorHook:()=>K});function Q(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function E(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function w(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?E(Object(n),!0).forEach(function(r){Q(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):E(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function X(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i<r.length;i++)o=r[i],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}function k(e,t){if(e==null)return{};var n=X(e,t),r,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)r=i[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function _(e,t){return ee(e)||te(e,t)||ne(e,t)||re()}function ee(e){if(Array.isArray(e))return e}function te(e,t){if(!(typeof Symbol=="undefined"||!(Symbol.iterator in Object(e)))){var n=[],r=!0,o=!1,i=void 0;try{for(var a=e[Symbol.iterator](),d;!(r=(d=a.next()).done)&&(n.push(d.value),!(t&&n.length===t));r=!0);}catch(s){o=!0,i=s}finally{try{!r&&a.return!=null&&a.return()}finally{if(o)throw i}}return n}}function ne(e,t){if(e){if(typeof e=="string")return A(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return A(e,t)}}function A(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function re(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function oe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function S(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function C(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?S(Object(n),!0).forEach(function(r){oe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):S(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function ie(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){return t.reduceRight(function(o,i){return i(o)},r)}}function l(e){return function t(){for(var n=this,r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return o.length>=e.length?e.apply(this,o):function(){for(var a=arguments.length,d=new Array(a),s=0;s<a;s++)d[s]=arguments[s];return t.apply(n,[].concat(o,d))}}}function h(e){return{}.toString.call(e).includes("Object")}function ae(e){return!Object.keys(e).length}function c(e){return typeof e=="function"}function se(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function de(e,t){return h(t)||u("changeType"),Object.keys(t).some(function(n){return!se(e,n)})&&u("changeField"),t}function ue(e){c(e)||u("selectorType")}function le(e){c(e)||h(e)||u("handlerType"),h(e)&&Object.values(e).some(function(t){return!c(t)})&&u("handlersType")}function ce(e){e||u("initialIsRequired"),h(e)||u("initialType"),ae(e)&&u("initialContent")}function fe(e,t){throw new Error(e[t]||e.default)}var pe={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},u=l(fe)(pe),g={changes:de,selector:ue,handler:le,initial:ce};function ge(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};g.initial(e),g.handler(t);var n={current:e},r=l(be)(n,t),o=l(me)(n),i=l(g.changes)(e),a=l(he)(n);function d(){var p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(J){return J};return g.selector(p),p(n.current)}function s(p){ie(r,o,i,a)(p)}return[d,s]}function he(e,t){return c(t)?t(e.current):t}function me(e,t){return e.current=C(C({},e.current),t),t}function be(e,t,n){return c(t)?t(e.current):Object.keys(n).forEach(function(r){var o;return(o=t[r])===null||o===void 0?void 0:o.call(t,e.current[r])}),n}var ve={create:ge},M=ve;var ye={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.43.0/min/vs"}},F=ye;function we(e){return function t(){for(var n=this,r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return o.length>=e.length?e.apply(this,o):function(){for(var a=arguments.length,d=new Array(a),s=0;s<a;s++)d[s]=arguments[s];return t.apply(n,[].concat(o,d))}}}var P=we;function je(e){return{}.toString.call(e).includes("Object")}var x=je;function Oe(e){return e||D("configIsRequired"),x(e)||D("configType"),e.urls?(Ue(),{paths:{vs:e.urls.monacoBase}}):e}function Ue(){console.warn(I.deprecation)}function Ee(e,t){throw new Error(e[t]||e.default)}var I={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
You are using deprecated way of configuration.
Instead of using
monaco.config({ urls: { monacoBase: '...' } })
use
monaco.config({ paths: { vs: '...' } })
For more please check the link https://github.com/suren-atoyan/monaco-loader#config
`},D=P(Ee)(I),Ae={config:Oe},T=Ae;var ke=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return function(o){return n.reduceRight(function(i,a){return a(i)},o)}},B=ke;function R(e,t){return Object.keys(t).forEach(function(n){t[n]instanceof Object&&e[n]&&Object.assign(t[n],R(e[n],t[n]))}),w(w({},e),t)}var W=R;var _e={type:"cancelation",msg:"operation is manually canceled"};function Se(e){var t=!1,n=new Promise(function(r,o){e.then(function(i){return t?o(_e):r(i)}),e.catch(o)});return n.cancel=function(){return t=!0},n}var m=Se;var Ce=M.create({config:F,isInitialized:!1,resolve:null,reject:null,monaco:null}),L=_(Ce,2),f=L[0],b=L[1];function Me(e){var t=T.config(e),n=t.monaco,r=k(t,["monaco"]);b(function(o){return{config:W(o.config,r),monaco:n}})}function Fe(){var e=f(function(t){var n=t.monaco,r=t.isInitialized,o=t.resolve;return{monaco:n,isInitialized:r,resolve:o}});if(!e.isInitialized){if(b({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),m(j);if(window.monaco&&window.monaco.editor)return H(window.monaco),e.resolve(window.monaco),m(j);B(Pe,De)(Ie)}return m(j)}function Pe(e){return document.body.appendChild(e)}function xe(e){var t=document.createElement("script");return e&&(t.src=e),t}function De(e){var t=f(function(r){var o=r.config,i=r.reject;return{config:o,reject:i}}),n=xe("".concat(t.config.paths.vs,"/loader.js"));return n.onload=function(){return e()},n.onerror=t.reject,n}function Ie(){var e=f(function(n){var r=n.config,o=n.resolve,i=n.reject;return{config:r,resolve:o,reject:i}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(n){H(n),e.resolve(n)},function(n){e.reject(n)})}function H(e){f().monaco||b({monaco:e})}function Te(){return f(function(e){var t=e.monaco;return t})}var j=new Promise(function(e,t){return b({resolve:e,reject:t})}),Be={config:Me,init:Fe,__getMonacoInstance:Te},v=Be;var O={background:"#282c34",default:"#c4cad6",lightRed:"#e06c75",blue:"#61afef",gray:"#8c92a3",green:"#98c379",purple:"#c678dd",red:"#be5046",teal:"#56b6c2",peach:"#d19a66"},Re=e=>[{token:"",foreground:e.default},{token:"variable",foreground:e.lightRed},{token:"constant",foreground:e.blue},{token:"constant.character.escape",foreground:e.blue},{token:"comment",foreground:e.gray},{token:"number",foreground:e.blue},{token:"regexp",foreground:e.lightRed},{token:"type",foreground:e.lightRed},{token:"string",foreground:e.green},{token:"keyword",foreground:e.purple},{token:"operator",foreground:e.peach},{token:"delimiter.bracket.embed",foreground:e.red},{token:"sigil",foreground:e.teal},{token:"function",foreground:e.blue},{token:"function.call",foreground:e.default},{token:"emphasis",fontStyle:"italic"},{token:"strong",fontStyle:"bold"},{token:"keyword.md",foreground:e.lightRed},{token:"keyword.table",foreground:e.lightRed},{token:"string.link.md",foreground:e.blue},{token:"variable.md",foreground:e.teal},{token:"string.md",foreground:e.default},{token:"variable.source.md",foreground:e.default},{token:"tag",foreground:e.lightRed},{token:"metatag",foreground:e.lightRed},{token:"attribute.name",foreground:e.peach},{token:"attribute.value",foreground:e.green},{token:"string.key",foreground:e.lightRed},{token:"keyword.json",foreground:e.blue},{token:"operator.sql",foreground:e.purple}],q={base:"vs-dark",inherit:!1,rules:Re(O),colors:{"editor.background":O.background,"editor.foreground":O.default,"editorLineNumber.foreground":"#636d83","editorCursor.foreground":"#636d83","editor.selectionBackground":"#3e4451","editor.findMatchHighlightBackground":"#528bff3d","editorSuggestWidget.background":"#21252b","editorSuggestWidget.border":"#181a1f","editorSuggestWidget.selectedBackground":"#2c313a","input.background":"#1b1d23","input.border":"#181a1f","editorBracketMatch.border":"#282c34","editorBracketMatch.background":"#3e4451"}};var U=class{constructor(t,n,r,o){this.el=t,this.path=n,this.value=r,this.opts=o,this.standalone_code_editor=null,this._onMount=[]}isMounted(){return!!this.standalone_code_editor}mount(){if(this.isMounted())throw new Error("The monaco editor is already mounted");this._mountEditor()}onMount(t){this._onMount.push(t)}dispose(){if(this.isMounted()){let t=this.standalone_code_editor.getModel();t&&t.dispose(),this.standalone_code_editor.dispose()}}_mountEditor(){this.opts.value=this.value,v.config({paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.52.2/min/vs"}}),v.init().then(t=>{t.editor.defineTheme("default",q);let n=t.Uri.parse(this.path),r=this.opts.language,o=t.editor.createModel(this.value,r,n);this.opts.language=void 0,this.opts.model=o,this.standalone_code_editor=t.editor.create(this.el,this.opts),this._onMount.forEach(a=>a(t)),this._setScreenDependantEditorOptions(),this.standalone_code_editor.addAction({contextMenuGroupId:"word-wrapping",id:"enable-word-wrapping",label:"Enable word wrapping",precondition:"config.editor.wordWrap == off",keybindings:[t.KeyMod.Alt|t.KeyCode.KeyZ],run:a=>a.updateOptions({wordWrap:"on"})}),this.standalone_code_editor.addAction({contextMenuGroupId:"word-wrapping",id:"disable-word-wrapping",label:"Disable word wrapping",precondition:"config.editor.wordWrap == on",keybindings:[t.KeyMod.Alt|t.KeyCode.KeyZ],run:a=>a.updateOptions({wordWrap:"off"})}),new ResizeObserver(a=>{a.forEach(()=>{this.el.offsetHeight>0&&(this._setScreenDependantEditorOptions(),this.standalone_code_editor.layout())})}).observe(this.el),this.standalone_code_editor.onDidContentSizeChange(()=>{let a=this.standalone_code_editor.getContentHeight();this.el.style.height=`${a}px`})})}_setScreenDependantEditorOptions(){window.screen.width<768?this.standalone_code_editor.updateOptions({folding:!1,lineDecorationsWidth:16,lineNumbersMinChars:Math.floor(Math.log10(this.standalone_code_editor.getModel().getLineCount()))+3}):this.standalone_code_editor.updateOptions({folding:!0,lineDecorationsWidth:10,lineNumbersMinChars:5})}},z=U;var K={mounted(){let e=JSON.parse(this.el.dataset.opts);this.codeEditor=new z(this.el,this.el.dataset.path,this.el.dataset.value,e),this.codeEditor.onMount(t=>{this.el.dataset.changeEvent&&this.el.dataset.changeEvent!==""&&this.codeEditor.standalone_code_editor.onDidChangeModelContent(()=>{this.el.dataset.target&&this.el.dataset.target!==""?this.pushEventTo(this.el.dataset.target,this.el.dataset.changeEvent,{value:this.codeEditor.standalone_code_editor.getValue()}):this.pushEvent(this.el.dataset.changeEvent,{value:this.codeEditor.standalone_code_editor.getValue()})}),this.handleEvent("lme:change_language:"+this.el.dataset.path,n=>{let r=this.codeEditor.standalone_code_editor.getModel();r.getLanguageId()!==n.mimeTypeOrLanguageId&&t.editor.setModelLanguage(r,n.mimeTypeOrLanguageId)}),this.handleEvent("lme:set_value:"+this.el.dataset.path,n=>{this.codeEditor.standalone_code_editor.setValue(n.value)}),this.el.querySelectorAll("textarea").forEach(n=>{n.setAttribute("name","live_monaco_editor["+this.el.dataset.path+"]")}),this.el.removeAttribute("data-value"),this.el.removeAttribute("data-opts"),this.el.dispatchEvent(new CustomEvent("lme:editor_mounted",{detail:{hook:this,editor:this.codeEditor},bubbles:!0}))}),this.codeEditor.isMounted()||this.codeEditor.mount()},destroyed(){this.codeEditor&&this.codeEditor.dispose()}};return Y(We);})();
//# sourceMappingURL=live_monaco_editor.min.js.map