All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ide.main.worker.js Maven / Gradle / Ivy

!function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=33)}([function(e,t,r){"use strict";(function(e){r.d(t,"d",(function(){return o})),r.d(t,"e",(function(){return i})),r.d(t,"h",(function(){return s})),r.d(t,"g",(function(){return a})),r.d(t,"f",(function(){return c})),r.d(t,"c",(function(){return l})),r.d(t,"a",(function(){return u})),r.d(t,"b",(function(){return h}));var n=e||self||void 0,o=function(e,t,r){var o=new(0,n.prompto.parser[t+"CleverParser"])(e);return o.removeErrorListeners(),r&&o.addErrorListener(r),o},i=function(e,t,r){var n=o(e,t,r),i=n.parse();return i.forEach((e=>{e.sourceCode={dialect:t,body:e.fetchBody(n)}})),i},s=function(e,t,r){var o=n.prompto,i=o.parser.Dialect[r],s=new o.utils.CodeWriter(i,e.newChildContext());return s.context.problemListener=new o.problem.ProblemCollector,t.comments&&t.comments.forEach((e=>e.toDialect(s))),t.annotations&&t.annotations.forEach((e=>e.toDialect(s))),t.toDialect(s),s.toString()},a=function(e,t,r,o){var s=n.prompto,a=i(t,r),c=s.parser.Dialect[o],l=new s.utils.CodeWriter(c,e.newChildContext());return a.toDialect(l),l.toString()},c=function(e,t){return e.sort((function(e,r){return e[t]>r[t]?1:e[t]r[n]=e(t[n])),this),r}return t};var h=function e(t){if(!t)return t;if(Array.isArray(t))return t.map(e);if(typeof t==typeof{}){var r={};return Object.getOwnPropertyNames(t).forEach((n=>r[n]=e(t[n])),this),{type:"Document",value:r}}return t}}).call(this,r(4))},function(e,t,r){"use strict";var n=r(6),o=Object.prototype.toString;function i(e){return"[object Array]"===o.call(e)}function s(e){return void 0===e}function a(e){return null!==e&&"object"==typeof e}function c(e){if("[object Object]"!==o.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function l(e){return"[object Function]"===o.call(e)}function u(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),i(e))for(var r=0,n=e.length;rnull===t.contextForDeclaration(e))))}filterOutMethods(e){this.methods&&(this.methods=this.methods.filter((t=>this.filterOutMethod(t,e))))}filterOutMethod(e,t){if(null===t.contextForDeclaration(e.name))return!0;if(1===e.protos.length)return!1;var r=t.getRegisteredDeclaration(e.name);return e.protos=e.protos.filter((e=>!r.hasPrototype(e.proto))),e.protos.length>0}}}).call(this,r(4))},function(e,t,r){e.exports=r(16)},function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(0),o=r(2);function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t0){var r=t[0];return"methods"===e?s(s({},{name:r.name}),r.protos[0]):r}}return null}filterOutDuplicates(){if(!this.removed&&!this.added)return 0;if(!this.removed)return this.added.length();if(!this.added)return this.removed.length();var e=this.filterOutDuplicatesInField("attributes");return e+=this.filterOutDuplicatesInField("methods"),e+=this.filterOutDuplicatesInField("categories"),e+=this.filterOutDuplicatesInField("enumerations"),e+=this.filterOutDuplicatesInField("tests"),e+=this.filterOutDuplicatesInField("widgets")}filterOutDuplicatesInField(e){var t=this.filterOutDuplicatesInLists;"methods"===e?t=this.filterOutDuplicatesInMethods:"enumerations"===e&&(t=(e,t)=>this.filterOutDuplicatesInLists(e,t,"name"));var r=t.bind(this)(this.removed[e],this.added[e]);return this.removed[e]&&!this.removed[e].length&&delete this.removed[e],this.added[e]&&!this.added[e].length&&delete this.added[e],r}filterOutDuplicatesInLists(e,t,r){if(e&&t){r?(Object(n.f)(e,r),Object(n.f)(t,r)):(e.sort(),t.sort());for(var o=0,i=0;oa?i++:o++}return e.length+t.length}return e?e.length:t?t.length:0}filterOutDuplicatesInMethods(e,t){if(e&&t){Object(n.f)(e,"name"),Object(n.f)(t,"name");for(var r=0,o=0;rt[o].name?o++:r++;return e.length+t.length}return e?e.length:t?t.length:0}adjustForMovingProtos(e){this.removed&&this.removed.methods&&this.removed.methods.forEach((t=>{var r=e.getRegisteredDeclaration(t.name);r&&1===Object.keys(r.protos).length&&!this.isModifiedProto(t)&&this.adjustMethodForRemovedProtos(t,r)}),this),this.added&&this.added.methods&&this.added.methods.forEach((t=>{var r=e.getRegisteredDeclaration(t.name);r&&Object.keys(r.protos).length-t.protos.length==1&&this.adjustMethodForAddedProtos(t,r)}),this),this.removed&&this.removed.methods&&this.removed.methods.forEach((e=>{e.proto_to_remove&&(e.protos.push(e.proto_to_remove),Object(n.f)(e.protos,"proto"),delete e.proto_to_remove)})),this.added&&this.added.methods&&this.added.methods.forEach((e=>{e.proto_to_add&&(e.protos.push(e.proto_to_add),Object(n.f)(e.protos,"proto"),delete e.proto_to_add)}))}isModifiedProto(e){return!(!this.added||!this.added.methods)&&0!==this.added.methods.filter((t=>t.name===e.name)).length}adjustMethodForAddedProtos(e,t){var r=this.findPreExistingProto(e,t);if(r){var n={proto:r,main:t.protos[r].isEligibleAsMain()};this.removed||(this.removed=new o.a),this.findOrCreateMethod(this.removed,e.name).proto_to_remove=n,e.proto_to_add=n}}findPreExistingProto(e,t){for(var r in t.protos)if(t.protos.hasOwnProperty(r)){for(var n=!1,o=0;!n&&o{n&&n.proto===e.proto&&(n=null)})),n&&(i.proto_to_add=n)}findOrCreateMethod(e,t){e.methods||(e.methods=[]);for(var r=0;r=200&&e<300}};c.headers={common:{Accept:"application/json, text/plain, */*"}},n.forEach(["delete","get","head"],(function(e){c.headers[e]={}})),n.forEach(["post","put","patch"],(function(e){c.headers[e]=n.merge(i)})),e.exports=c}).call(this,r(21))},function(e,t,r){"use strict";var n=r(1),o=r(23),i=r(25),s=r(7),a=r(26),c=r(29),l=r(30),u=r(11);e.exports=function(e){return new Promise((function(t,r){var h=e.data,d=e.headers;n.isFormData(h)&&delete d["Content-Type"];var p=new XMLHttpRequest;if(e.auth){var m=e.auth.username||"",f=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";d.Authorization="Basic "+btoa(m+":"+f)}var g=a(e.baseURL,e.url);if(p.open(e.method.toUpperCase(),s(g,e.params,e.paramsSerializer),!0),p.timeout=e.timeout,p.onreadystatechange=function(){if(p&&4===p.readyState&&(0!==p.status||p.responseURL&&0===p.responseURL.indexOf("file:"))){var n="getAllResponseHeaders"in p?c(p.getAllResponseHeaders()):null,i={data:e.responseType&&"text"!==e.responseType?p.response:p.responseText,status:p.status,statusText:p.statusText,headers:n,config:e,request:p};o(t,r,i),p=null}},p.onabort=function(){p&&(r(u("Request aborted",e,"ECONNABORTED",p)),p=null)},p.onerror=function(){r(u("Network Error",e,null,p)),p=null},p.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(u(t,e,"ECONNABORTED",p)),p=null},n.isStandardBrowserEnv()){var v=(e.withCredentials||l(g))&&e.xsrfCookieName?i.read(e.xsrfCookieName):void 0;v&&(d[e.xsrfHeaderName]=v)}if("setRequestHeader"in p&&n.forEach(d,(function(e,t){void 0===h&&"content-type"===t.toLowerCase()?delete d[t]:p.setRequestHeader(t,e)})),n.isUndefined(e.withCredentials)||(p.withCredentials=!!e.withCredentials),e.responseType)try{p.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&p.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&p.upload&&p.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){p&&(p.abort(),r(e),p=null)})),h||(h=null),p.send(h)}))}},function(e,t,r){"use strict";var n=r(24);e.exports=function(e,t,r,o,i){var s=new Error(e);return n(s,t,r,o,i)}},function(e,t,r){"use strict";var n=r(1);e.exports=function(e,t){t=t||{};var r={},o=["url","method","data"],i=["headers","auth","proxy","params"],s=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],a=["validateStatus"];function c(e,t){return n.isPlainObject(e)&&n.isPlainObject(t)?n.merge(e,t):n.isPlainObject(t)?n.merge({},t):n.isArray(t)?t.slice():t}function l(o){n.isUndefined(t[o])?n.isUndefined(e[o])||(r[o]=c(void 0,e[o])):r[o]=c(e[o],t[o])}n.forEach(o,(function(e){n.isUndefined(t[e])||(r[e]=c(void 0,t[e]))})),n.forEach(i,l),n.forEach(s,(function(o){n.isUndefined(t[o])?n.isUndefined(e[o])||(r[o]=c(void 0,e[o])):r[o]=c(void 0,t[o])})),n.forEach(a,(function(n){n in t?r[n]=c(e[n],t[n]):n in e&&(r[n]=c(void 0,e[n]))}));var u=o.concat(i).concat(s).concat(a),h=Object.keys(e).concat(Object.keys(t)).filter((function(e){return-1===u.indexOf(e)}));return n.forEach(h,l),r}},function(e,t,r){"use strict";function n(e){this.message=e}n.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},n.prototype.__CANCEL__=!0,e.exports=n},function(e,t,r){"use strict";(function(e){r.d(t,"a",(function(){return a}));var n=r(0),o=r(2),i=r(5),s=null;class a{constructor(){!function(){var t=e||window||self||this;s=t.prompto}(),this.librariesContext=s.runtime.Context.newGlobalsContext(),this.projectContext=s.runtime.Context.newGlobalsContext(),this.projectContext.setParentContext(this.librariesContext),this.moduleId=null,this.lastSuccess=new s.declaration.DeclarationList,this.statuses={}}reset(){this.lastSuccess=new s.declaration.DeclarationList}registerLibraryCode(e,t){Object(n.e)(e,t).register(this.librariesContext)}registerLibraryDeclarations(e){e.forEach((e=>{Object(n.e)(e.value.body,e.value.dialect).register(this.librariesContext)}),this)}clearLibrariesContext(){this.librariesContext=s.runtime.Context.newGlobalsContext(),this.projectContext.setParentContext(this.librariesContext)}publishLibraries(){return{type:"Document",value:{removed:{type:"Document",value:{}},added:this.librariesContext.getCatalog(),library:!0}}}publishProject(){return{type:"Document",value:{removed:{type:"Document",value:{}},added:this.projectContext.getLocalCatalog(),project:!0}}}unpublishProject(){var e={type:"Document",value:{removed:this.projectContext.getLocalCatalog(),added:{type:"Document",value:{}}}};return this.projectContext=s.runtime.Context.newGlobalsContext(),this.projectContext.setParentContext(this.librariesContext),this.statuses={},e}registerProjectDeclarations(e,t,r){var o=t.length,i=0;this.moduleId=e,t.forEach((e=>{Object(n.e)(e.value.body,e.value.dialect).register(this.projectContext),r&&r("Parsing project code "+ ++i+"/"+o),e.value.module&&(delete e.value.module.value.dependencies,delete e.value.module.value.image),this.registerClean(e)}),this)}getContentBody(e,t){var r=this.getDeclaration(e);return this.getDeclarationBody(r,t)}getDeclarationBody(e,t){return e.sourceCode&&e.sourceCode.dialect===t?e.sourceCode.body:Object(n.h)(this.projectContext,e,t)}getDeclaration(e){if("TestRef"===e.type)return this.projectContext.getRegisteredTest(e.name);if("MethodRef"===e.type){var t=this.projectContext.getRegisteredDeclaration({name:e.name});return t.protos[e.prototype||""]||t.getFirst()}return this.projectContext.getRegisteredDeclaration({name:e.name})}idFromDbDecl(e){return"MethodDeclaration"===e.type?e.value.name+"/"+(e.value.prototype||""):e.value.name}idFromContent(e){return"MethodRef"===e.type?e.name+"/"+(e.prototype||""):e.name}idFromDecl(e){return e.name+(void 0!==e.getProto?"/"+(e.getProto()||""):"")}registerClean(e){var t=this.idFromDbDecl(e);this.statuses[t]={resource:e,editStatus:"CLEAN"}}registerDestroyed(e){var t=this.statuses[e];t&&(t.editStatus="DELETED")}registerDirty(e,t,r){e.forEach((e=>{var n,o=this.idFromDecl(e),i=this.statuses[o];if(i){n=i.resource.value;var s=e.fetchBody(t);n.dialect===r&&n.body===s||(n.dialect=r,n.body=s,"CREATED"!==i.editStatus&&(i.editStatus="DIRTY"),void 0!==e.getProto&&(n.prototype=e.getProto()),void 0!==e.storable&&(n.storable=e.storable),e.symbols&&(n.symbols=e.symbols.map((function(e){return e.name}))),e.derivedFrom?n.derivedFrom=e.derivedFrom.map((function(e){return e.name})):n.derivedFrom&&(n.derivedFrom=[]),e.annotations?n.annotations=e.annotations.map((function(e){return e.name})):n.annotations&&(n.annotations=[]))}else n={name:e.name,version:{type:"Version",value:"0.0.1"},dialect:r,body:e.fetchBody(t),module:{type:"Module",value:{dbId:this.moduleId}}},void 0!==e.getProto&&(n.prototype=e.getProto()),void 0!==e.storable&&(n.storable=e.storable),e.symbols&&(n.symbols=e.symbols.map((function(e){return e.name}))),e.derivedFrom&&(n.derivedFrom=e.derivedFrom.map((function(e){return e.name}))),e.annotations&&(n.annotations=e.annotations.map((function(e){return e.name}))),this.statuses[o]={editStatus:"CREATED",resource:{type:e.getDeclarationType()+"Declaration",value:n}}}),this)}markChangesCommitted(e){e.forEach((e=>{var t=this.idFromDbDecl(e);this.statuses[t].resource.value.dbId=e.value.dbId,this.statuses[t].editStatus="CLEAN"}),this)}clearDeleted(){var e=[];for(var t in this.statuses)this.statuses.hasOwnProperty(t)&&"DELETED"===this.statuses[t].editStatus&&e.push(t);e.forEach((e=>{delete this.statuses[e]}),this)}getEditedDeclarations(e){return e.map((e=>{var t=this.idFromContent(e);return{type:"EditedResource",value:this.statuses[t]}}),this)}translate(e,t,r){return Object(n.g)(this.projectContext,e,t,r)}handleDestroyed(e){var t=this.idFromContent(e);this.registerDestroyed(t);var r=this.statuses[t];if(r&&"DELETED"===r.editStatus){var s=Object(n.e)(r.resource.value.body,r.resource.value.dialect);s[0].unregister(this.projectContext);var a=new i.a;return a.removed=new o.a(s,this.librariesContext),a.filterOutDuplicates(),a}return null}handleSetContent(e,t,r){try{return this.doHandleSetContent(e,t,r)}catch(e){return this.handleUnhandled(e,r)}}doHandleSetContent(e,t,r){var o=Object(n.e)(e,t,r),i=this.projectContext.newChildContext();i.pushProblemListener(r);try{o.check(i)}finally{i.popProblemListener()}this.lastSuccess=o}handleEditContent(e,t,r,n){try{return this.doHandleEditContent(e,t,r,n)}catch(e){return this.handleUnhandled(e,r)}}handleUnhandled(e,t){if(!t.problems.length){t.collectProblem({startLine:1,startColumn:0,endLine:1e3,endColumn:1e3,type:"error",message:"Invalid syntax!"})}return null}doHandleEditContent(e,t,r,o){var i=this.lastSuccess,s=Object(n.d)(e,t,r),a=s.parse();a.forEach((e=>{e.sourceCode={dialect:t,body:e.fetchBody(s)}}));this.checkDuplicates(i,a,r);if(0===r.problems.length){this.lastSuccess=a;var c=this.updateCodebase(i,a,s,t,r);if(c){var l=c.getContent();return o&&1===a.length&&(l.selected=a[0].name),l.editedCount=a.length,i.length<=1&&1===a.length&&(l.newContent=c.getFirstAdded()),l}return null}return null}checkDuplicates(e,t,r){return t.some((t=>!!this.isDuplicate(t,e)&&(r.reportDuplicate(t.name,t),!0)),this)}isDuplicate(e,t){if(t.some((t=>t.name===e.name)))return!1;var r=this.projectContext.getRegisteredDeclaration(e.id);return r instanceof s.runtime.MethodDeclarationMap?!(e instanceof s.declaration.BaseMethodDeclaration)||r.hasProto(e.getProto()):!!r}updateCodebase(e,t,r,n,s){var a=new i.a;a.removed=new o.a(e,this.projectContext,this.librariesContext),a.added=new o.a(t,this.projectContext,this.librariesContext);var c=a.filterOutDuplicates(),l=this.updateRenamed(c,e,t,r,n);return this.updateAppContext(e,t,s),l||this.registerDirty(t,r,n),0!==c?(a.adjustForMovingProtos(this.projectContext),a):null}updateRenamed(e,t,r,n,o){if(2!==e||0===t.length||r.length!==t.length)return!1;var i=r.filter((e=>{var t=this.idFromDecl(e);return null===(this.statuses[t]||null)}),this);if(1===i.length){var s=i[0],a=this.idFromDecl(s),c=this.statuses[a],l=t.filter((function(e){var t=this.idFromDecl(e);return 0===r.filter((function(e){return t===this.idFromDecl(e)}),this).length}),this);if(1===l.length){var u=l[0],h=this.idFromDecl(u),d=this.statuses[h];if(d&&!c){this.statuses[a]=this.statuses[h],delete this.statuses[h],"CREATED"!==(c=d).editStatus&&(c.editStatus="DIRTY"),c.resource.type=s.getDeclarationType()+"Declaration";var p=c.resource.value;return p.name=s.name,p.dialect=o,p.body=s.fetchBody(n),void 0!==s.getProto&&(p.prototype=s.getProto()),void 0!==s.storable&&(p.storable=s.storable),!0}}}return!1}updateAppContext(e,t,r){e.unregister(this.projectContext),t.unregister(this.projectContext);var n=this.projectContext.problemListener;try{this.projectContext.problemListener=r,t.register(this.projectContext),t.check(this.projectContext.newChildContext())}finally{this.projectContext.problemListener=n}}contentForStackFrame(e){return e.categoryName&&e.categoryName.length?this.categoryForStackFrame(e):this.methodForStackFrame(e)}categoryForStackFrame(e){var t=this.projectContext.getRegisteredDeclaration({name:e.categoryName});return t?{type:this.typeFromDeclaration(this.projectContext,t),name:e.categoryName}:null}typeFromDeclaration(e,t){return t instanceof s.declaration.BaseMethodDeclaration?"MethodRef":t instanceof s.declaration.AttributeDeclaration?"AttributeRef":t instanceof s.declaration.CategoryDeclaration?t.isWidget(e)?"WidgetRef":"CategoryRef":t instanceof s.declaration.EnumeratedCategoryDeclaration||t instanceof s.declaration.EnumeratedNativeDeclaration?"EnumerationRef":t instanceof s.declaration.TestMethodDeclaration?"TestRef":null}methodForStackFrame(e){var t=this.projectContext.getRegisteredTest(e.methodName);if(!t){var r=this.projectContext.getRegisteredDeclaration({name:e.methodName});r&&(t=e.methodProto?r.protos[e.methodProto]:r.getFirst())}return t?{type:this.typeFromDeclaration(this.projectContext,t),name:e.methodName,prototype:e.methodProto||null}:null}createBreakpointAtLine(e,t,r){if(null===e)return null;var o=null;switch(e.type){case"MethodRef":o=this.createBreakpointAtMethodLine;break;case"TestRef":o=this.createBreakpointAtTestLine;break;case"CategoryRef":case"WidgetRef":o=this.createBreakpointAtCategoryLine}if(null===o)return null;var i=this.getDeclaration(e);if(null===i)return null;if(i.sourceCode.dialect!==r){var s=this.getDeclarationBody(i,r);i=Object(n.e)(s,r)[0]}var a=o.bind(this)(i,t);return a?{type:"LineBreakpoint",value:a}:null}createBreakpointAtMethodLine(e,t){var r=e.locateSectionAtLine(t);return null===r?null:{methodName:e.name,methodProto:e.getProto(this.projectContext),statementLine:r.startLocation.line}}createBreakpointAtTestLine(e,t){var r=e.locateSectionAtLine(t);return null===r?null:{methodName:e.name,statementLine:r.startLocation.line}}createBreakpointAtCategoryLine(e,t){if(!e.methods)return null;for(var r=0;r1)for(var r=1;r=0)return;s[t]="set-cookie"===t?(s[t]?s[t]:[]).concat([r]):s[t]?s[t]+", "+r:r}})),s):s}},function(e,t,r){"use strict";var n=r(1);e.exports=n.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function o(e){var n=e;return t&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return e=o(window.location.href),function(t){var r=n.isString(t)?o(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0}},function(e,t,r){"use strict";var n=r(13);function o(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var r=this;e((function(e){r.reason||(r.reason=new n(e),t(r.reason))}))}o.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},o.source=function(){var e;return{token:new o((function(t){e=t})),cancel:e}},e.exports=o},function(e,t,r){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},function(e,t,r){"use strict";r.r(t);r(15);var n=function(){this.propagationStopped=!0},o=function(){this.defaultPrevented=!0};class i{constructor(){this._emit=this._dispatchEvent,this.on=this.addEventListener,this.off=this.removeEventListener,this.removeListener=this.removeEventListener}dispatchEvent(e,t){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var r=this._eventRegistry[e]||[],i=this._defaultHandlers[e];if(r.length||i){"object"==typeof t&&t||(t={}),t.type||(t.type=e),t.stopPropagation||(t.stopPropagation=n),t.preventDefault||(t.preventDefault=o),r=r.slice();for(var s=0;s ["+this.end.row+"/"+this.end.column+"]"}contains(e,t){return 0===this.compare(e,t)}compareRange(e){var t,r=e.end,n=e.start;return 1===(t=this.compare(r.row,r.column))?1===(t=this.compare(n.row,n.column))?2:0===t?1:0:-1===t?-2:-1===(t=this.compare(n.row,n.column))?-1:1===t?42:0}comparePoint(e){return this.compare(e.row,e.column)}containsRange(e){return 0===this.comparePoint(e.start)&&0===this.comparePoint(e.end)}intersects(e){var t=this.compareRange(e);return-1===t||0===t||1===t}isEnd(e,t){return this.end.row===e&&this.end.column===t}isStart(e,t){return this.start.row===e&&this.start.column===t}setStart(e,t){"object"==typeof e?(this.start.column=e.column,this.start.row=e.row):(this.start.row=e,this.start.column=t)}setEnd(e,t){"object"==typeof e?(this.end.column=e.column,this.end.row=e.row):(this.end.row=e,this.end.column=t)}inside(e,t){return 0===this.compare(e,t)&&(!this.isEnd(e,t)&&!this.isStart(e,t))}insideStart(e,t){return 0===this.compare(e,t)&&!this.isEnd(e,t)}insideEnd(e,t){return 0===this.compare(e,t)&&!this.isStart(e,t)}compare(e,t){return this.isMultiLine()||e!==this.start.row?ethis.end.row?1:this.start.row===e?t>=this.start.column?0:-1:this.end.row===e?t<=this.end.column?0:1:0:tthis.end.column?1:0}compareStart(e,t){return this.start.row===e&&this.start.column===t?-1:this.compare(e,t)}compareEnd(e,t){return this.end.row===e&&this.end.column===t?1:this.compare(e,t)}compareInside(e,t){return this.end.row===e&&this.end.column===t?1:this.start.row===e&&this.start.column===t?-1:this.compare(e,t)}clipRows(e,t){var r,n;return this.end.row>t?n={row:t+1,column:0}:this.end.rowt?r={row:t+1,column:0}:this.start.rowthis.row)){var t=function(e,t,r){var n="insert"===e.action,o=(n?1:-1)*(e.end.row-e.start.row),i=(n?1:-1)*(e.end.column-e.start.column),s=e.start,c=n?s:e.end;return a(t,s,r)?{row:t.row,column:t.column}:a(c,t,!r)?{row:t.row+o,column:t.column+(t.row===c.row?i:0)}:{row:s.row,column:s.column}}(e,{row:this.row,column:this.column},this.$insertRight);this.setPosition(t.row,t.column,!0)}}setPosition(e,t,r){var n;if(n=r?{row:e,column:t}:this.$clipPositionToDocument(e,t),this.row!==n.row||this.column!==n.column){var o={row:this.row,column:this.column};this.row=n.row,this.column=n.column,this._signal("change",{old:o,value:n})}}detach(){this.document.removeEventListener("change",this.$onChange)}attach(e){this.document=e||this.document,this.document.on("change",this.$onChange)}$clipPositionToDocument(e,t){var r={};return e>=this.document.getLength()?(r.row=Math.max(0,this.document.getLength()-1),r.column=this.document.getLine(r.row).length):e<0?(r.row=0,r.column=0):(r.row=e,r.column=Math.min(this.document.getLine(r.row).length,Math.max(0,t))),t<0&&(r.column=0),r}}class l extends i{constructor(e){super(),this.$lines=[""],this.$autoNewLine="",this.$newLineMode="auto",0===e.length?this.$lines=[""]:Array.isArray(e)?this.insertMergedLines({row:0,column:0},e):this.insert({row:0,column:0},e)}setValue(e){var t=this.getLength()-1;this.remove(new s(0,0,t,this.getLine(t).length)),this.insert({row:0,column:0},e)}getValue(){return this.getAllLines().join(this.getNewLineCharacter())}createAnchor(e,t){return new c(this,e,t)}$split(e){return e.split(/\r\n|\r|\n/)}$detectNewLine(e){var t=e.match(/^.*?(\r\n|\r|\n)/m);this.$autoNewLine=t?t[1]:"\n",this._signal("changeNewLineMode")}getNewLineCharacter(){switch(this.$newLineMode){case"windows":return"\r\n";case"unix":return"\n";default:return this.$autoNewLine||"\n"}}setNewLineMode(e){this.$newLineMode!==e&&(this.$newLineMode=e,this._signal("changeNewLineMode"))}getNewLineMode(){return this.$newLineMode}isNewLine(e){return"\r\n"===e||"\r"===e||"\n"===e}getLine(e){return this.$lines[e]||""}getLines(e,t){return this.$lines.slice(e,t+1)}getAllLines(){return this.getLines(0,this.getLength())}getLength(){return this.$lines.length}getTextRange(e){return this.getLinesForRange(e).join(this.getNewLineCharacter())}getLinesForRange(e){var t;if(e.start.row===e.end.row)t=[this.getLine(e.start.row).substring(e.start.column,e.end.column)];else{(t=this.getLines(e.start.row,e.end.row))[0]=(t[0]||"").substring(e.start.column);var r=t.length-1;e.end.row-e.start.row===r&&(t[r]=t[r].substring(0,e.end.column))}return t}insertLines(e,t){return console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead."),this.insertFullLines(e,t)}removeLines(e,t){return console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead."),this.removeFullLines(e,t)}insertNewLine(e){return console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead."),this.insertMergedLines(e,["",""])}insert(e,t){return this.getLength()<=1&&this.$detectNewLine(t),this.insertMergedLines(e,this.$split(t))}insertInLine(e,t){var r=this.clippedPos(e.row,e.column),n=this.pos(e.row,e.column+t.length);return this.applyDelta({start:r,end:n,action:"insert",lines:[t]},!0),this.clonePos(n)}clippedPos(e,t){var r=this.getLength();void 0===e?e=r:e<0?e=0:e>=r&&(e=r-1,t=void 0);var n=this.getLine(e);return void 0===t&&(t=n.length),{row:e,column:t=Math.min(Math.max(t,0),n.length)}}clonePos(e){return{row:e.row,column:e.column}}pos(e,t){return{row:e,column:t}}$clipPosition(e){var t=this.getLength();return e.row>=t?(e.row=Math.max(0,t-1),e.column=this.getLine(t-1).length):(e.row=Math.max(0,e.row),e.column=Math.min(Math.max(e.column,0),this.getLine(e.row).length)),e}insertFullLines(e,t){var r=0;(e=Math.min(Math.max(e,0),this.getLength()))0,n=t=0&&this.applyDelta({start:this.pos(e,this.getLine(e).length),end:this.pos(e+1,0),action:"remove",lines:["",""]})}replace(e,t){return e instanceof s||(e=s.fromPoints(e.start,e.end)),0===t.length&&e.isEmpty()?e.start:t===this.getTextRange(e)?e.end:(this.remove(e),t?this.insert(e.start,t):e.start)}applyDeltas(e){for(var t=0;t=0;t--)this.revertDelta(e[t])}applyDelta(e,t){var r="insert"===e.action;(r?e.lines.length<=1&&!e.lines[0]:!s.comparePoints(e.start,e.end))||(r&&e.lines.length>2e4?this.$splitAndapplyLargeDelta(e,2e4):(!function(e,t,r){var n=t.start.row,o=t.start.column,i=e[n]||"";switch(t.action){case"insert":if(1===t.lines.length)e[n]=i.substring(0,o)+t.lines[0]+i.substring(o);else{var s=[n,1].concat(t.lines);e.splice.apply(e,s),e[n]=i.substring(0,o)+e[n],e[n+t.lines.length-1]+=i.substring(o)}break;case"remove":var a=t.end.column,c=t.end.row;n===c?e[n]=i.substring(0,o)+i.substring(a):e.splice(n,c-n+1,i.substring(0,o)+e[c].substring(a));break;default:throw new Error("Unsupported: "+t.action)}}(this.$lines,e),this._signal("change",e)))}$splitAndapplyLargeDelta(e,t){for(var r=e.lines,n=r.length-t+1,o=e.start.row,i=e.start.column,s=0,a=0;s{var t="string"==typeof e?JSON.parse(e):e;r(t)}),n)}postTEXT(e,t,r,n){n=n||console.log;var o=this.prepareConfig(e);p.a.post(e,t,o).then((t=>this.onSuccess(t,e,r,n))).catch(n)}getJSON(e,t,r,n){this.getTEXT(e,t,(e=>{var t="string"==typeof e?JSON.parse(e):e;r(t)}),n)}getTEXT(e,t,r,n){n=n||console.log;var o=this.prepareConfig(e);t&&(o=f(f({},o),{},{params:t})),p.a.get(e,o).then((t=>this.onSuccess(t,e,r,n))).catch(n)}onSuccess(e,t,r,n){200===e.status?(this.collectHeaders(e,t),r(e.data)):n("Failed to load "+t+", error: "+e.status)}collectHeaders(e,t){"/"!==t[0]&&"."!==t[0]||(this.$authorization=e.headers["X-Authorization"]||null)}clearModuleContext(e,t,r){var n=[{name:"dbId",value:e}],o={params:JSON.stringify(n)};p.a.get("/ws/run/clearModuleContext",{params:o}).then((e=>{var r=e.data;r.error||(-1===r.data?alert("Server is not running!"):t&&t(r.data))})).catch((e=>r?r(e):{}))}fetchModulePort(e,t,r,n){var o=[{name:"dbId",value:e},{name:"action",type:"Text",value:t}],i={params:JSON.stringify(o)};p.a.get("/ws/run/fetchModulePort",{params:i}).then((e=>{var t=e.data;t.error||(-1===t.data?alert("Server is not running!"):r(t.data))})).catch((e=>n(e)))}fetchModuleURL(e,t,r,n){this.fetchModulePort(e,t,(e=>{var t=v.location.protocol+"//"+v.location.hostname+":"+e+"/";r(t)}),n)}}w.instance=new w;var y=(self||window).prompto;class b extends class{runMethod(e,t,r,n){throw new Error("Unsupported!")}runTest(e,t,r,n){throw new Error("Unsupported!")}}{runMethod(e,t,r){try{y.runtime.Interpreter.interpret(e.projectContext,t.name,"")}finally{r()}}runTest(e,t,r){var n=y.store.$DataStore.instance;y.store.$DataStore.instance=new y.memstore.MemStore;try{y.runtime.Interpreter.interpretTest(e.projectContext,t.name)}finally{y.store.$DataStore.instance=n,r()}}}var C=r(0),L=self||window;class j extends class{constructor(e){var t,r,n,o,i;this.sender=e,this.$timeout=0,this.doc=new l(""),this.deferredUpdate=(t=this.onUpdate.bind(this),n=null,o=function(){n=null,t()},(i=function(e){null==n&&(n=setTimeout(o,e||r))}).delay=function(e){n&&clearTimeout(n),n=setTimeout(o,e||r)},i.schedule=i,i.call=function(){this.cancel(),t()},i.cancel=function(){n&&clearTimeout(n),n=null},i.isPending=function(){return n},i),e.on("change",this.processChange.bind(this)),e.on("changes",this.processChanges.bind(this))}processChanges(e){for(var t=e.data,r=0;r{this.progress("Loading Core code"),this.$repo.registerLibraryCode(e,"E"),this.markLoaded("Core")}))}setProject(e,t){this.$projectId=e,this.unpublishProject(),this.loadProject(t)}setContent(e,t){this.$selected=e,t&&(this.$value=null,this.$repo.reset())}handleSetContent(e){if(this.$value)return null;if(this.$selected&&e.length){var t=new L.AnnotatingErrorListener;return this.$repo.handleSetContent(e,this.$dialect,t),t.problems}return null}handleEditContent(e){if(e!==this.$value){var t=new L.AnnotatingErrorListener,r=this.$repo.handleEditContent(e,this.$dialect,t,this.$selected);if(r){var n=Object(C.b)(r);this.sender.emit("catalogUpdated",n)}else this.$selected&&this.sender.emit("bodyEdited",this.$selected);return t.problems}return[]}setDialect(e){var t=this.$dialect;if(this.$dialect=e,t&&e!==t){var r=this.doc.getValue();r&&(this.$value=this.$repo.translate(r,t,e),this.sender.emit("value",this.$value))}}getContentBody(e){var t=arguments[arguments.length-1],r=e?this.$repo.getContentBody(e,this.$dialect):"";this.sender.callback(r,t)}getEditedContents(e){var t=arguments[arguments.length-1],r=this.$repo.getEditedDeclarations(e);this.sender.callback(r,t)}locateSection(e){var t=arguments[arguments.length-1],r=this.$repo.locateSection(e);this.sender.callback(r,t)}locateSections(e){var t=arguments[arguments.length-1],r=e.map((e=>this.$repo.locateSection(e)));this.sender.callback(r,t)}createBreakpointAtLine(e){var t=arguments[arguments.length-1],r=this.$selected?this.$repo.createBreakpointAtLine(this.$selected,e,this.$dialect):null;this.sender.callback(r,t)}contentForStackFrame(e){var t=arguments[arguments.length-1],r=this.$repo.contentForStackFrame(e);this.sender.callback(r,t)}destroyContent(e){this.$value="";var t=this.$repo.handleDestroyed(e);if(t){var r=Object(C.b)(t.getContent());this.sender.emit("catalogUpdated",r)}this.sender.emit("value",this.$value)}loadProject(e){this.progress("Fetching project description"),j.fetchProjectDescription(this.$projectId,!0,(t=>{this.progress("Fetching project description complete"),t.error?(this.handleError(t.error),this.markFailed("%Description%")):(this.projectLoaded(t.data,e),this.markLoaded("%Description%"))}))}projectLoaded(e,t){if(this.$project=e.value,t&&this.loadDependencies(),this.$project.stubResource)try{L.importScripts("/stub?moduleId="+this.$project.dbId+"&resourceName="+this.$project.stubResource)}catch(e){var r=e.stack;console.error(r)}this.progress("Fetching project code"),j.fetchModuleDeclarations(this.$projectId,(e=>{if(e.error)this.handleError(e.error),this.markFailed("Project");else{this.progress("Parsing project code");var t=e.data.value;this.$repo.registerProjectDeclarations(this.$projectId,t.items,this.progress.bind(this)),this.markLoaded("Project")}}))}loadDependencies(){this.$project.dependencies&&this.$project.dependencies.value.filter((e=>null!=e)).map((e=>this.loadDependency(e.value||e)),this)}loadDependency(e){this.markLoading(e.name),j.fetchModuleDescription(e.name,e.version,(t=>{if(t.error)this.handleError(t.error),this.markFailed(e.name);else{var r=t.data.value;if(r.stubResource)try{L.importScripts("/stub?moduleId="+r.dbId+"&resourceName="+r.stubResource)}catch(e){var n=e.stack;console.error(n)}this.progress("Fetching "+e.name+" code"),j.fetchModuleDeclarations(r.dbId,(t=>{if(t.error)this.handleError(t.error),this.markFailed(e.name);else{this.progress("Parsing "+e.name+" code");var r=t.data.value;this.$repo.registerLibraryDeclarations(r.items),this.markLoaded(e.name)}}))}}))}handleError(e){}dependenciesUpdated(){this.$repo.clearLibrariesContext(),this.markLoading("Project"),this.markLoading("%Description%"),this.loadCore(),this.loadProject(!0)}static fetchProjectDescription(e,t,r){var n=[{name:"dbId",value:e.toString()},{name:"register",type:"Boolean",value:t}];w.instance.getJSON("/ws/run/fetchModuleDescription",{params:JSON.stringify(n)},r)}static fetchModuleDescription(e,t,r){var n=[{name:"name",type:"Text",value:e},{name:"version",type:t.type,value:t.value},{name:"register",type:"Boolean",value:!1}];w.instance.getJSON("/ws/run/fetchModuleDescription",{params:JSON.stringify(n)},r)}static fetchModuleDeclarations(e,t){var r=[{name:"dbId",value:e.toString()}];w.instance.getJSON("/ws/run/fetchModuleDeclarations",{params:JSON.stringify(r)},t)}publishLibraries(e){var t=this.$repo.publishLibraries();this.sender.emit("catalogLoaded",[t,e])}publishProject(e){var t=this.$repo.publishProject();this.sender.emit("catalogLoaded",[t,e])}unpublishProject(){var e=this.$repo.unpublishProject();this.sender.emit("catalogLoaded",[e,!1])}markLoading(e){this.$loading[e]=!0}markFailed(e){"%Description%"!==e&&this.progress("Loading "+e+" failed"),delete this.$loading[e],this.checkLoadingComplete(e)}markLoaded(e){"%Description%"!==e&&this.progress("Loading "+e+" complete"),delete this.$loading[e],this.checkLoadingComplete(e)}checkLoadingComplete(e){var t=0===Object.keys(this.$loading).length;"Project"===e?this.publishProject(t):(1===Object.keys(this.$loading).length&&"Project"in this.$loading||t)&&this.publishLibraries(t)}markChangesCommitted(){j.fetchModuleDeclarations(this.$projectId,(e=>{if(e.error)this.handleError(e.error);else{var t=e.data.value;this.$repo.markChangesCommitted(t.items),this.$repo.clearDeleted()}}))}runMethod(e){var t=arguments[arguments.length-1],r=console.log;console.log=this.progress.bind(this);var n=new b;try{n.runMethod(this.$repo,e,(()=>this.sender.callback(null,t)))}finally{console.log=r}}runTest(e){var t=arguments[arguments.length-1],r=console.log;console.log=this.progress.bind(this);var n=new b;try{n.runTest(this.$repo,e,(()=>this.sender.callback(null,t)))}finally{console.log=r}}}var D=new class extends i{callback(e,t){postMessage({type:"call",id:t,data:e})}emit(e,t){postMessage({type:"event",name:e,data:t})}},x=new j(D),P=self;onmessage=function(e){var t=e.data;if(t.event&&D)D._signal(t.event,t.data);else if(t.command)if(x[t.command])x[t.command].apply(x,t.args);else{if(!P[t.command])throw new Error("Unknown command: "+t.command);P[t.command].apply(P,t.args)}else t.init}}]);
//# sourceMappingURL=main.worker.js.map




© 2015 - 2025 Weber Informatics LLC | Privacy Policy