@sheetxl/react 0.4.13 → 0.4.14

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.
@@ -1,7 +0,0 @@
1
- /**
2
- * @license @sheetxl/react - React - React components needed to build advanced grid and spreadsheet UIs. - v0.4.13
3
- *
4
- * (C) 2025-present SheetXL Inc. & Michael T. Ford
5
- * License: The license can be found at https://www.sheetxl.com/license.
6
- */
7
- "use strict";function e(e,t){for(var r=0;r<t.length;r++){const n=t[r];if("string"!=typeof n&&!Array.isArray(n))for(const t in n)if("default"!==t&&!(t in e)){const r=Object.getOwnPropertyDescriptor(n,t);r&&Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>n[t]})}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var t,r={},n={},o={},i={};var a,s={};function c(){if(a)return s;a=1;var e=s&&s.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{c(n.next(e))}catch(e){i(e)}}function s(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,s)}c((n=n.apply(e,t||[])).next())})},t=s&&s.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};Object.defineProperty(s,"__esModule",{value:!0}),s.JsDelivrSourceResolver=void 0;var r=function(){function r(){}return r.prototype.resolvePackageJson=function(r,n,o){return e(this,void 0,void 0,function(){return t(this,function(e){switch(e.label){case 0:return[4,this.resolveFile("https://cdn.jsdelivr.net/npm/".concat(r).concat(n?"@".concat(n):"").concat(o?"/".concat(o):"","/package.json"))];case 1:return[2,e.sent()]}})})},r.prototype.resolveSourceFile=function(r,n,o){return e(this,void 0,void 0,function(){return t(this,function(e){switch(e.label){case 0:return[4,this.resolveFile("https://cdn.jsdelivr.net/npm/".concat(r).concat(n?"@".concat(n):"","/").concat(o))];case 1:return[2,e.sent()]}})})},r.prototype.resolveFile=function(r){return e(this,void 0,void 0,function(){var e;return t(this,function(t){switch(t.label){case 0:return[4,fetch(r,{method:"GET"})];case 1:return(e=t.sent()).ok?[4,e.text()]:[3,3];case 2:return[2,t.sent()];case 3:if(404===e.status)return[2,""];throw Error("Error other than 404 while fetching from Unpkg at ".concat(r));case 4:return[2]}})})},r}();return s.JsDelivrSourceResolver=r,s}var u,l,p,h={},f={};function d(){if(l)return u;function e(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function t(e,t){for(var r,n="",o=0,i=-1,a=0,s=0;s<=e.length;++s){if(s<e.length)r=e.charCodeAt(s);else{if(47===r)break;r=47}if(47===r){if(i===s-1||1===a);else if(i!==s-1&&2===a){if(n.length<2||2!==o||46!==n.charCodeAt(n.length-1)||46!==n.charCodeAt(n.length-2))if(n.length>2){var c=n.lastIndexOf("/");if(c!==n.length-1){-1===c?(n="",o=0):o=(n=n.slice(0,c)).length-1-n.lastIndexOf("/"),i=s,a=0;continue}}else if(2===n.length||1===n.length){n="",o=0,i=s,a=0;continue}t&&(n.length>0?n+="/..":n="..",o=2)}else n.length>0?n+="/"+e.slice(i+1,s):n=e.slice(i+1,s),o=s-i-1;i=s,a=0}else 46===r&&-1!==a?++a:a=-1}return n}l=1;var r={resolve:function(){for(var r,n="",o=!1,i=arguments.length-1;i>=-1&&!o;i--){var a;i>=0?a=arguments[i]:(void 0===r&&(r=process.cwd()),a=r),e(a),0!==a.length&&(n=a+"/"+n,o=47===a.charCodeAt(0))}return n=t(n,!o),o?n.length>0?"/"+n:"/":n.length>0?n:"."},normalize:function(r){if(e(r),0===r.length)return".";var n=47===r.charCodeAt(0),o=47===r.charCodeAt(r.length-1);return 0!==(r=t(r,!n)).length||n||(r="."),r.length>0&&o&&(r+="/"),n?"/"+r:r},isAbsolute:function(t){return e(t),t.length>0&&47===t.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var t,n=0;n<arguments.length;++n){var o=arguments[n];e(o),o.length>0&&(void 0===t?t=o:t+="/"+o)}return void 0===t?".":r.normalize(t)},relative:function(t,n){if(e(t),e(n),t===n)return"";if((t=r.resolve(t))===(n=r.resolve(n)))return"";for(var o=1;o<t.length&&47===t.charCodeAt(o);++o);for(var i=t.length,a=i-o,s=1;s<n.length&&47===n.charCodeAt(s);++s);for(var c=n.length-s,u=a<c?a:c,l=-1,p=0;p<=u;++p){if(p===u){if(c>u){if(47===n.charCodeAt(s+p))return n.slice(s+p+1);if(0===p)return n.slice(s+p)}else a>u&&(47===t.charCodeAt(o+p)?l=p:0===p&&(l=0));break}var h=t.charCodeAt(o+p);if(h!==n.charCodeAt(s+p))break;47===h&&(l=p)}var f="";for(p=o+l+1;p<=i;++p)p!==i&&47!==t.charCodeAt(p)||(0===f.length?f+="..":f+="/..");return f.length>0?f+n.slice(s+l):(s+=l,47===n.charCodeAt(s)&&++s,n.slice(s))},_makeLong:function(e){return e},dirname:function(t){if(e(t),0===t.length)return".";for(var r=t.charCodeAt(0),n=47===r,o=-1,i=!0,a=t.length-1;a>=1;--a)if(47===(r=t.charCodeAt(a))){if(!i){o=a;break}}else i=!1;return-1===o?n?"/":".":n&&1===o?"//":t.slice(0,o)},basename:function(t,r){if(void 0!==r&&"string"!=typeof r)throw new TypeError('"ext" argument must be a string');e(t);var n,o=0,i=-1,a=!0;if(void 0!==r&&r.length>0&&r.length<=t.length){if(r.length===t.length&&r===t)return"";var s=r.length-1,c=-1;for(n=t.length-1;n>=0;--n){var u=t.charCodeAt(n);if(47===u){if(!a){o=n+1;break}}else-1===c&&(a=!1,c=n+1),s>=0&&(u===r.charCodeAt(s)?-1===--s&&(i=n):(s=-1,i=c))}return o===i?i=c:-1===i&&(i=t.length),t.slice(o,i)}for(n=t.length-1;n>=0;--n)if(47===t.charCodeAt(n)){if(!a){o=n+1;break}}else-1===i&&(a=!1,i=n+1);return-1===i?"":t.slice(o,i)},extname:function(t){e(t);for(var r=-1,n=0,o=-1,i=!0,a=0,s=t.length-1;s>=0;--s){var c=t.charCodeAt(s);if(47!==c)-1===o&&(i=!1,o=s+1),46===c?-1===r?r=s:1!==a&&(a=1):-1!==r&&(a=-1);else if(!i){n=s+1;break}}return-1===r||-1===o||0===a||1===a&&r===o-1&&r===n+1?"":t.slice(r,o)},format:function(e){if(null===e||"object"!=typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return function(e,t){var r=t.dir||t.root,n=t.base||(t.name||"")+(t.ext||"");return r?r===t.root?r+n:r+e+n:n}("/",e)},parse:function(t){e(t);var r={root:"",dir:"",base:"",ext:"",name:""};if(0===t.length)return r;var n,o=t.charCodeAt(0),i=47===o;i?(r.root="/",n=1):n=0;for(var a=-1,s=0,c=-1,u=!0,l=t.length-1,p=0;l>=n;--l)if(47!==(o=t.charCodeAt(l)))-1===c&&(u=!1,c=l+1),46===o?-1===a?a=l:1!==p&&(p=1):-1!==a&&(p=-1);else if(!u){s=l+1;break}return-1===a||-1===c||0===p||1===p&&a===c-1&&a===s+1?-1!==c&&(r.base=r.name=0===s&&i?t.slice(1,c):t.slice(s,c)):(0===s&&i?(r.name=t.slice(1,a),r.base=t.slice(1,c)):(r.name=t.slice(s,a),r.base=t.slice(s,c)),r.ext=t.slice(a,c)),s>0?r.dir=t.slice(0,s-1):i&&(r.dir="/"),r},sep:"/",delimiter:":",win32:null,posix:null};return r.posix=r,u=r}var v,y={};function g(){if(v)return y;v=1;var e=y&&y.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(y,"__esModule",{value:!0}),y.importResourcePathToString=void 0;var t=e(d());return y.importResourcePathToString=function(e){var r;switch(e.kind){case"package":return t.default.join(e.packageName,null!==(r=e.importPath)&&void 0!==r?r:"","package.json");case"relative":return t.default.join(e.sourcePath,e.importPath);case"relative-in-package":return t.default.join(e.packageName,e.sourcePath,e.importPath)}},y}var m,b={};function k(){if(m)return b;m=1,Object.defineProperty(b,"__esModule",{value:!0}),b.invokeUpdate=void 0;return b.invokeUpdate=function(e,t){var r,n="".concat(e.type,": ");switch(e.type){case"CodeChanged":case"ResolveNewImports":n+="";break;case"LookedUpTypeFile":n+='"'.concat(e.path,'" was ').concat(e.success?"sucessfully":"not sucessfully"," looked up");break;case"AttemptedLookUpFile":n+='"'.concat(e.path,'" was ').concat(e.success?"sucessfully":"not sucessfully"," attempted to looked up");break;case"LookedUpPackage":n+='package.json for package "'.concat(e.package,'" was ').concat(e.success?"sucessfully":"not sucessfully"," looked up").concat(e.definitelyTyped?" (found in definitely typed repo)":"");break;case"LoadedFromCache":n+='"'.concat(e.importPath,'" was loaded from cache');break;case"StoredToCache":n+='"'.concat(e.importPath,'" was stored to cache')}n.endsWith(": ")&&(n=n.slice(void 0,-2)),null===(r=t.onUpdate)||void 0===r||r.call(t,e,n)},b}var w,_,P,O,j={};function R(){if(w)return j;w=1,Object.defineProperty(j,"__esModule",{value:!0}),j.RecursionDepth=void 0;var e=function(){function e(e,t,r){void 0===t&&(t=0),void 0===r&&(r=0),this.options=e,this.fileRecursionDepth=t,this.packageRecursionDepth=r}return e.prototype.nextPackage=function(){return new e(this.options,this.fileRecursionDepth,this.packageRecursionDepth+1)},e.prototype.nextFile=function(){return new e(this.options,this.fileRecursionDepth+1,this.packageRecursionDepth)},e.prototype.same=function(){return new e(this.options,this.fileRecursionDepth,this.packageRecursionDepth)},e.prototype.shouldStop=function(){return this.options.fileRecursionDepth>0&&this.fileRecursionDepth>=this.options.fileRecursionDepth||this.options.packageRecursionDepth>0&&this.packageRecursionDepth>=this.options.packageRecursionDepth},e}();return j.RecursionDepth=e,j}function C(){if(_)return h;_=1;var e=h&&h.__assign||function(){return e=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},e.apply(this,arguments)},t=h&&h.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=h&&h.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=h&&h.__importStar||function(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var o in e)"default"!==o&&Object.prototype.hasOwnProperty.call(e,o)&&t(n,e,o);return r(n,e),n},o=h&&h.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{c(n.next(e))}catch(e){i(e)}}function s(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,s)}c((n=n.apply(e,t||[])).next())})},i=h&&h.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},a=h&&h.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},s=h&&h.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(h,"__esModule",{value:!0}),h.ImportResolver=void 0;var c=function(){if(p)return f;p=1;var e=f&&f.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),t=f&&f.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=f&&f.__importStar||function(r){if(r&&r.__esModule)return r;var n={};if(null!=r)for(var o in r)"default"!==o&&Object.prototype.hasOwnProperty.call(r,o)&&e(n,r,o);return t(n,r),n},n=f&&f.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},o=f&&f.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(f,"__esModule",{value:!0}),f.DependencyParser=void 0;var i=r(d()),a=function(){function e(){this.REGEX_CLEAN=/[\n|\r]/g,this.REGEX_DETECT_IMPORT=/(?:(?:(?:import)|(?:export))(?:.)*?from\s+["']([^"']+)["'])|(?:((?:require|import))(?:\s+)?\(["']([^"']+)["']\))|(?:\/+\s+<reference\s+path=["']([^"']+)["']\s+\/>)/g,this.REGEX_NODE_MODULE=/^node:([\w\W\/]+)$/}return e.prototype.parseDependencies=function(e,t){var r=this;return o([],n(e.matchAll(this.REGEX_DETECT_IMPORT)),!1).map(function(e){var t,r;return null!==(r=null!==(t=e[1])&&void 0!==t?t:e[2])&&void 0!==r?r:e[3]}).filter(function(e){return!!e}).map(function(e){return r.resolvePath(e,t)})},e.prototype.resolvePath=function(e,t){var r=e.match(this.REGEX_NODE_MODULE);if(r)return{kind:"relative-in-package",packageName:"@types/node",importPath:"".concat(r[1],".d.ts"),sourcePath:""};if("string"==typeof t){if(e.startsWith("."))return{kind:"relative",importPath:e,sourcePath:t};if(e.startsWith("@")){var n=e.split("/");return{kind:"package",packageName:"".concat(n[0],"/").concat(n[1]),importPath:n.slice(2).join("/")}}return{kind:"package",packageName:(n=e.split("/"))[0],importPath:n.slice(1).join("/")}}switch(t.kind){case"package":throw Error("TODO?");case"relative":throw Error("TODO2?");case"relative-in-package":return e.startsWith(".")?{kind:"relative-in-package",packageName:t.packageName,sourcePath:i.join(t.sourcePath,t.importPath),importPath:e}:e.startsWith("@")?(n=e.split("/"),{kind:"package",packageName:"".concat(n[0],"/").concat(n[1]),importPath:n.slice(2).join("/")}):{kind:"package",packageName:(n=e.split("/"))[0],importPath:n.slice(1).join("/")}}},e}();return f.DependencyParser=a,f}(),u=g(),l=n(d()),v=k(),y=R(),m=function(){function t(e){var t,r;if(this.options=e,this.loadedFiles=[],this.dependencyParser=new c.DependencyParser,this.cache=e.sourceCache,this.sourceResolver=e.sourceResolver,this.newImportsResolved=!1,this.monaco=e.monaco,e.preloadPackages&&e.versions){this.versions=e.versions;try{for(var n=a(Object.entries(e.versions)),o=n.next();!o.done;o=n.next()){var i=s(o.value,2),u=i[0];i[1];this.resolveImport({kind:"package",packageName:u,importPath:""},new y.RecursionDepth(this.options)).catch(function(e){console.error(e)})}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}}}return t.prototype.wereNewImportsResolved=function(){return this.newImportsResolved},t.prototype.resetNewImportsResolved=function(){this.newImportsResolved=!1},t.prototype.resolveImportsInFile=function(e,t,r){var n,s,c;return o(this,void 0,void 0,function(){var o,u,l,p,h,f,d,v;return i(this,function(i){switch(i.label){case 0:if(r.shouldStop())return[2];o=this.dependencyParser.parseDependencies(e,t),i.label=1;case 1:i.trys.push([1,8,9,10]),u=a(o),l=u.next(),i.label=2;case 2:if(l.done)return[3,7];p=l.value,i.label=3;case 3:return i.trys.push([3,5,,6]),[4,this.resolveImport(p,r)];case 4:return i.sent(),[3,6];case 5:return h=i.sent(),this.options.onError?null===(s=(n=this.options).onError)||void 0===s||s.call(n,null!==(c=h.message)&&void 0!==c?c:h):console.error(h),[3,6];case 6:return l=u.next(),[3,2];case 7:return[3,10];case 8:return f=i.sent(),d={error:f},[3,10];case 9:try{l&&!l.done&&(v=u.return)&&v.call(u)}finally{if(d)throw d.error}return[7];case 10:return[2]}})})},t.prototype.resolveImport=function(e,t){return o(this,void 0,void 0,function(){var r,n;return i(this,function(o){switch(o.label){case 0:if(r=this.hashImportResourcePath(e),this.loadedFiles.includes(r))return[2];switch(this.loadedFiles.push(r),e.kind){case"package":return[3,1];case"relative":return[3,5];case"relative-in-package":return[3,6]}return[3,8];case 1:return[4,this.resolveImportFromPackageRoot(e)];case 2:return(n=o.sent())?[4,this.resolveImportInPackage(n,t.nextPackage().nextFile())]:[3,4];case 3:case 7:return[2,o.sent()];case 4:return[3,8];case 5:throw Error("Not implemented yet");case 6:return[4,this.resolveImportInPackage(e,t.nextFile())];case 8:return[2]}})})},t.prototype.resolveImportInPackage=function(e,t){return o(this,void 0,void 0,function(){var r,n,o;return i(this,function(i){switch(i.label){case 0:return[4,this.loadSourceFileContents(e)];case 1:return(r=i.sent())?(n=r.source,o=r.at,this.createModel(n,this.monaco.Uri.parse(this.options.fileRootPath+l.join("node_modules/".concat(e.packageName),o))),[4,this.resolveImportsInFile(n,{kind:"relative-in-package",packageName:e.packageName,sourcePath:l.dirname(o),importPath:""},t)]):[3,3];case 2:i.sent(),i.label=3;case 3:return[2]}})})},t.prototype.resolveImportFromPackageRoot=function(e){var t,r,n,a,s,c,u,p,h;return o(this,void 0,void 0,function(){var o,f,d,y,g,m,b,k,w;return i(this,function(i){switch(i.label){case 0:return o={type:"LookedUpPackage",package:e.packageName,definitelyTyped:!1,success:!1},!this.options.onlySpecifiedPackages||(null===(t=this.versions)||void 0===t?void 0:t[e.packageName])||(null===(r=this.versions)||void 0===r?void 0:r["@types/"+e.packageName])?(f=null!==(a=null===(n=e.importPath)||void 0===n?void 0:n.length)&&void 0!==a&&a,d=f?"/".concat(e.importPath):"",[4,this.resolvePackageJson(e.packageName,null===(s=this.versions)||void 0===s?void 0:s[e.packageName],f?e.importPath:void 0)]):((0,v.invokeUpdate)(o,this.options),[2]);case 1:return(y=i.sent())||!f?[3,3]:[4,this.resolvePackageJson(e.packageName,null===(c=this.versions)||void 0===c?void 0:c[e.packageName])];case 2:y=i.sent(),d="",i.label=3;case 3:return y?(g=JSON.parse(y)).typings||g.types?(w=g.typings||g.types,this.createModel(y,this.monaco.Uri.parse("".concat(this.options.fileRootPath,"node_modules/").concat(e.packageName).concat(d,"/package.json"))),(0,v.invokeUpdate)({type:"LookedUpPackage",package:e.packageName,definitelyTyped:!1,success:!0},this.options),this.setVersion(e.packageName,g.version),[2,{kind:"relative-in-package",packageName:e.packageName,sourcePath:"",importPath:l.join(null!==(u=e.importPath)&&void 0!==u?u:"",w.startsWith("./")?w.slice(2):w)}]):[3,4]:[3,7];case 4:return m="@types/".concat(e.packageName.startsWith("@")?e.packageName.slice(1).replace(/\//,"__"):e.packageName),[4,this.resolvePackageJson(m,null===(p=this.versions)||void 0===p?void 0:p[m])];case 5:if(b=i.sent()){if((k=JSON.parse(b)).typings||k.types)return w=k.typings||k.types,this.createModel(b,this.monaco.Uri.parse("".concat(this.options.fileRootPath,"node_modules/").concat(m,"/package.json"))),(0,v.invokeUpdate)({type:"LookedUpPackage",package:m,definitelyTyped:!0,success:!0},this.options),this.setVersion(m,k.version),[2,{kind:"relative-in-package",packageName:m,sourcePath:"",importPath:l.join(null!==(h=e.importPath)&&void 0!==h?h:"",w.startsWith("./")?w.slice(2):w)}];(0,v.invokeUpdate)(o,this.options)}else(0,v.invokeUpdate)(o,this.options);i.label=6;case 6:return[3,8];case 7:(0,v.invokeUpdate)(o,this.options),i.label=8;case 8:return[2]}})})},t.prototype.loadSourceFileContents=function(e){return o(this,void 0,void 0,function(){var t,r,n,o,s,c,u,p,h,f,d,y,g,m,b,k;return i(this,function(i){switch(i.label){case 0:return t=l.join(e.packageName,e.sourcePath,e.importPath),r={type:"LookedUpTypeFile",path:t,definitelyTyped:!1,success:!1},n=e.packageName,o=this.getVersion(e.packageName),(s=[".d.ts","/index.d.ts",".ts",".tsx","/index.ts","/index.tsx"]).map(function(t){return e.importPath.endsWith(t)}).reduce(function(e,t){return e||t},!1)?[4,this.resolveSourceFile(n,o,l.join(e.sourcePath,e.importPath))]:[3,2];case 1:return(m=i.sent())?[2,{source:m,at:l.join(e.sourcePath,e.importPath)}]:[3,9];case 2:i.trys.push([2,7,8,9]),c=a(s),u=c.next(),i.label=3;case 3:return u.done?[3,6]:(p=u.value,h=l.join(e.sourcePath,e.importPath),g=(".d.ts"===p&&h.endsWith(".js")?h.slice(0,-3):h)+p,[4,this.resolveSourceFile(n,o,g)]);case 4:if(m=i.sent(),(0,v.invokeUpdate)({type:"AttemptedLookUpFile",path:l.join(n,g),success:!!m},this.options),m)return(0,v.invokeUpdate)({type:"LookedUpTypeFile",path:l.join(n,g),success:!0},this.options),[2,{source:m,at:g}];i.label=5;case 5:return u=c.next(),[3,3];case 6:return[3,9];case 7:return f=i.sent(),b={error:f},[3,9];case 8:try{u&&!u.done&&(k=c.return)&&k.call(c)}finally{if(b)throw b.error}return[7];case 9:return[4,this.resolvePackageJson(n,o,l.join(e.sourcePath,e.importPath))];case 10:return(d=i.sent())&&(y=JSON.parse(d).types)?(g=l.join(e.sourcePath,e.importPath,y),[4,this.resolveSourceFile(n,o,g)]):[3,12];case 11:if(m=i.sent())return(0,v.invokeUpdate)({type:"LookedUpTypeFile",path:l.join(n,g),success:!0},this.options),[2,{source:m,at:g}];i.label=12;case 12:return(0,v.invokeUpdate)(r,this.options),[2,null]}})})},t.prototype.getVersion=function(e){var t;return null===(t=this.versions)||void 0===t?void 0:t[e]},t.prototype.setVersions=function(e){var t,r;this.versions=e,null===(r=(t=this.options).onUpdateVersions)||void 0===r||r.call(t,e)},t.prototype.setVersion=function(t,r){var n;this.setVersions(e(e({},this.versions),((n={})[t]=r,n)))},t.prototype.createModel=function(e,t){t=t.with({path:t.path.replace("@types/","")}),this.monaco.editor.getModel(t)||(this.monaco.editor.createModel(e,"typescript",t),this.newImportsResolved=!0)},t.prototype.hashImportResourcePath=function(e){return(0,u.importResourcePathToString)(e)},t.prototype.resolvePackageJson=function(e,t,r){return o(this,void 0,void 0,function(){var n,o,a,s;return i(this,function(i){switch(i.label){case 0:return n=l.join(e+(t?"@".concat(t):""),null!=r?r:"","package.json"),o=!1,a=void 0,this.cache.isFileAvailable?[4,this.cache.isFileAvailable(n)]:[3,2];case 1:return o=i.sent(),[3,4];case 2:return[4,this.cache.getFile(n)];case 3:a=i.sent(),o=void 0!==a,i.label=4;case 4:return o?null==a?[3,5]:(s=a,[3,7]):[3,8];case 5:return[4,this.cache.getFile(n)];case 6:s=i.sent(),i.label=7;case 7:return[2,s];case 8:return[4,this.sourceResolver.resolvePackageJson(e,t,r)];case 9:return(a=i.sent())&&this.cache.storeFile(n,a),[2,a]}})})},t.prototype.resolveSourceFile=function(e,t,r){return o(this,void 0,void 0,function(){var n,o,a,s;return i(this,function(i){switch(i.label){case 0:return n=l.join(e+(t?"@".concat(t):""),r),o=!1,a=void 0,this.cache.isFileAvailable?[4,this.cache.isFileAvailable(n)]:[3,2];case 1:return o=i.sent(),[3,4];case 2:return[4,this.cache.getFile(n)];case 3:a=i.sent(),o=void 0!==a,i.label=4;case 4:return o?((0,v.invokeUpdate)({type:"LoadedFromCache",importPath:n},this.options),null==a?[3,5]:(s=a,[3,7])):[3,8];case 5:return[4,this.cache.getFile(n)];case 6:s=i.sent(),i.label=7;case 7:return[2,s];case 8:return[4,this.sourceResolver.resolveSourceFile(e,t,r)];case 9:return(a=i.sent())&&((0,v.invokeUpdate)({type:"StoredToCache",importPath:n},this.options),this.cache.storeFile(n,a)),[2,a]}})})},t}();return h.ImportResolver=m,h}function S(){if(P)return o;P=1;var e=o&&o.__assign||function(){return e=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},e.apply(this,arguments)},r=o&&o.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),n=o&&o.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=o&&o.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var o in e)"default"!==o&&Object.prototype.hasOwnProperty.call(e,o)&&r(t,e,o);return n(t,e),t},s=o&&o.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{c(n.next(e))}catch(e){i(e)}}function s(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,s)}c((n=n.apply(e,t||[])).next())})},u=o&&o.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},l=o&&o.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(o,"__esModule",{value:!0}),o.AutoTypingsCore=void 0;var p=function(){if(t)return i;t=1,Object.defineProperty(i,"__esModule",{value:!0}),i.DummySourceCache=void 0;var e=function(){function e(){}return e.prototype.getFile=function(e){return Promise.resolve(void 0)},e.prototype.isFileAvailable=function(e){return Promise.resolve(!1)},e.prototype.storeFile=function(e,t){return Promise.resolve(void 0)},e.prototype.clear=function(){return Promise.resolve(void 0)},e}();return i.DummySourceCache=e,i}(),h=c(),f=C(),v=a(d()),y=k(),g=R(),m=function(){function t(t,r){var n=this;this.editor=t,this.options=r,this.disposables=[],this.importResolver=new f.ImportResolver(r);var o=t.onDidChangeModelContent(function(e){n.debouncedResolveContents()});this.disposables.push(o),this.resolveContents(),r.dontAdaptEditorOptions||r.monaco.languages.typescript.typescriptDefaults.setCompilerOptions(e(e({},r.monaco.languages.typescript.typescriptDefaults.getCompilerOptions()),{moduleResolution:r.monaco.languages.typescript.ModuleResolutionKind.NodeJs,allowSyntheticDefaultImports:!0,rootDir:r.fileRootPath}))}return t.create=function(r,n){var o,i;return s(this,void 0,void 0,function(){var a;return u(this,function(s){if((null==n?void 0:n.shareCache)&&n.sourceCache&&!t.sharedCache&&(t.sharedCache=n.sourceCache),!(a=null==n?void 0:n.monaco))throw new Error("monacoInstance not found, you can specify the monaco instance via options.monaco");return[2,new t(r,e(e({fileRootPath:"inmemory://model/",onlySpecifiedPackages:!1,preloadPackages:!1,shareCache:!1,dontAdaptEditorOptions:!1,dontRefreshModelValueAfterResolvement:!1,sourceCache:null!==(o=t.sharedCache)&&void 0!==o?o:new p.DummySourceCache,sourceResolver:null!==(i=null==n?void 0:n.sourceResolver)&&void 0!==i?i:new h.JsDelivrSourceResolver,debounceDuration:4e3,fileRecursionDepth:10,packageRecursionDepth:3},n),{monaco:a}))]})})},t.prototype.dispose=function(){var e,t;try{for(var r=l(this.disposables),n=r.next();!n.done;n=r.next()){n.value.dispose()}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}},t.prototype.setVersions=function(e){this.importResolver.setVersions(e),this.options.versions=e},t.prototype.clearCache=function(){return s(this,void 0,void 0,function(){return u(this,function(e){switch(e.label){case 0:return[4,this.options.sourceCache.clear()];case 1:return e.sent(),[2]}})})},t.prototype.debouncedResolveContents=function(){var e=this;this.isResolving||((0,y.invokeUpdate)({type:"CodeChanged"},this.options),this.options.debounceDuration<=0?this.resolveContents():(void 0!==this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(function(){return s(e,void 0,void 0,function(){return u(this,function(e){switch(e.label){case 0:return[4,this.resolveContents()];case 1:return e.sent(),this.debounceTimer=void 0,[2]}})})},this.options.debounceDuration)))},t.prototype.resolveContents=function(){var e;return s(this,void 0,void 0,function(){var t,r,n,o;return u(this,function(i){switch(i.label){case 0:if(this.isResolving=!0,(0,y.invokeUpdate)({type:"ResolveNewImports"},this.options),!(t=this.editor.getModel()))throw Error("No model");r=t.getLinesContent(),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.importResolver.resolveImportsInFile(r.join("\n"),v.dirname(t.uri.toString()),new g.RecursionDepth(this.options))];case 2:return i.sent(),[3,4];case 3:if(n=i.sent(),!this.options.onError)throw n;return this.options.onError(null!==(e=n.message)&&void 0!==e?e:n),[3,4];case 4:return this.importResolver.wereNewImportsResolved()&&(this.options.dontRefreshModelValueAfterResolvement||(o=this.editor.getPosition(),t.setValue(t.getValue()),o&&this.editor.setPosition(o)),this.importResolver.resetNewImportsResolved()),this.isResolving=!1,[2]}})})},t}();return o.AutoTypingsCore=m,o}var x,E={};function A(){if(x)return E;x=1;var e=E&&E.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{c(n.next(e))}catch(e){i(e)}}function s(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,s)}c((n=n.apply(e,t||[])).next())})},t=E&&E.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},r=E&&E.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(E,"__esModule",{value:!0}),E.LocalStorageCache=void 0;var n=function(){function n(){this.localCache={}}return n.prototype.getFile=function(r){var o;return e(this,void 0,void 0,function(){return t(this,function(e){try{return[2,null!==(o=localStorage.getItem(n.LOCALSTORAGE_PREFIX+r))&&void 0!==o?o:void 0]}catch(e){return[2,this.localCache[r]]}return[2]})})},n.prototype.storeFile=function(r,o){return e(this,void 0,void 0,function(){return t(this,function(e){this.localCache[r]=o;try{localStorage.setItem(n.LOCALSTORAGE_PREFIX+r,o)}catch(e){}return[2]})})},n.prototype.clear=function(){return e(this,void 0,void 0,function(){var e,o,i,a,s,c,u;return t(this,function(t){for(this.localCache={},e=[],o=0;o<localStorage.length;o++)(null==(s=localStorage.key(o))?void 0:s.startsWith(n.LOCALSTORAGE_PREFIX))&&e.push(s);try{for(i=r(e),a=i.next();!a.done;a=i.next())s=a.value,localStorage.removeItem(s)}catch(e){c={error:e}}finally{try{a&&!a.done&&(u=i.return)&&u.call(i)}finally{if(c)throw c.error}}return[2]})})},n.LOCALSTORAGE_PREFIX="__autotyper_cache_",n}();return E.LocalStorageCache=n,E}var D,F={};var T,N={};var I,M={};var U,L={};var G,J,V,W,X={};function B(){if(G)return X;G=1;var e=X&&X.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{c(n.next(e))}catch(e){i(e)}}function s(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,s)}c((n=n.apply(e,t||[])).next())})},t=X&&X.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};Object.defineProperty(X,"__esModule",{value:!0}),X.UnpkgSourceResolver=void 0;var r=function(){function r(){}return r.prototype.resolvePackageJson=function(r,n,o){return e(this,void 0,void 0,function(){return t(this,function(e){switch(e.label){case 0:return[4,this.resolveFile("https://unpkg.com/".concat(r).concat(n?"@".concat(n):"").concat(o?"/".concat(o):"","/package.json"))];case 1:return[2,e.sent()]}})})},r.prototype.resolveSourceFile=function(r,n,o){return e(this,void 0,void 0,function(){return t(this,function(e){switch(e.label){case 0:return[4,this.resolveFile("https://unpkg.com/".concat(r).concat(n?"@".concat(n):"","/").concat(o))];case 1:return[2,e.sent()]}})})},r.prototype.resolveFile=function(r){return e(this,void 0,void 0,function(){var e;return t(this,function(t){switch(t.label){case 0:return[4,fetch(r,{method:"GET"})];case 1:return(e=t.sent()).ok?[4,e.text()]:[3,3];case 2:return[2,t.sent()];case 3:if(404===e.status)return[2,""];throw Error("Error other than 404 while fetching from Unpkg at ".concat(r));case 4:return[2]}})})},r}();return X.UnpkgSourceResolver=r,X}function z(){return J||(J=1,function(e){var t=r&&r.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=r&&r.__exportStar||function(e,r){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(r,n)||t(r,e,n)};Object.defineProperty(e,"__esModule",{value:!0}),o(function(){if(O)return n;O=1;var e,t=n&&n.__extends||(e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)},function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)});Object.defineProperty(n,"__esModule",{value:!0}),n.AutoTypings=void 0;var r=function(e){function r(t,r){return e.call(this,t,r)||this}return t(r,e),r}(S().AutoTypingsCore);return n.AutoTypings=r,n}(),e),o(g(),e),o(A(),e),o((D||(D=1,Object.defineProperty(F,"__esModule",{value:!0})),F),e),o((T||(T=1,Object.defineProperty(N,"__esModule",{value:!0})),N),e),o((I||(I=1,Object.defineProperty(M,"__esModule",{value:!0})),M),e),o((U||(U=1,Object.defineProperty(L,"__esModule",{value:!0})),L),e),o(B(),e),o(c(),e)}(r)),r}const q=e({__proto__:null},[W?V:(W=1,V=z())]);exports.customEditor=q;
@@ -1,7 +0,0 @@
1
- /**
2
- * @license @sheetxl/react - React - React components needed to build advanced grid and spreadsheet UIs. - v0.4.13
3
- *
4
- * (C) 2025-present SheetXL Inc. & Michael T. Ford
5
- * License: The license can be found at https://www.sheetxl.com/license.
6
- */
7
- import e,{memo as t,useState as r,useRef as n,useCallback as o,useEffect as i}from"react";function c(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u(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 a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?u(Object(r),!0).forEach(function(t){c(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function l(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function d(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function f(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 g(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?f(Object(r),!0).forEach(function(t){d(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):f(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function p(e){return function t(){for(var r=this,n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return o.length>=e.length?e.apply(this,o):function(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];return t.apply(r,[].concat(o,n))}}}function h(e){return{}.toString.call(e).includes("Object")}function y(e){return"function"==typeof e}var v=p(function(e,t){throw new Error(e[t]||e.default)})({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"}),m={changes:function(e,t){return h(t)||v("changeType"),Object.keys(t).some(function(t){return r=e,n=t,!Object.prototype.hasOwnProperty.call(r,n);var r,n})&&v("changeField"),t},selector:function(e){y(e)||v("selectorType")},handler:function(e){y(e)||h(e)||v("handlerType"),h(e)&&Object.values(e).some(function(e){return!y(e)})&&v("handlersType")},initial:function(e){var t;e||v("initialIsRequired"),h(e)||v("initialType"),t=e,Object.keys(t).length||v("initialContent")}};function b(e,t){return y(t)?t(e.current):t}function w(e,t){return e.current=g(g({},e.current),t),t}function O(e,t,r){return y(t)?t(e.current):Object.keys(r).forEach(function(r){var n;return null===(n=t[r])||void 0===n?void 0:n.call(t,e.current[r])}),r}var j={create:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};m.initial(e),m.handler(t);var r={current:e},n=p(O)(r,t),o=p(w)(r),i=p(m.changes)(e),c=p(b)(r);return[function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(e){return e};return m.selector(e),e(r.current)},function(e){!function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e){return t.reduceRight(function(e,t){return t(e)},e)}}(n,o,i,c)(e)}]}};var M,P={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!\n You are using deprecated way of configuration.\n\n Instead of using\n monaco.config({ urls: { monacoBase: '...' } })\n use\n monaco.config({ paths: { vs: '...' } })\n\n For more please check the link https://github.com/suren-atoyan/monaco-loader#config\n "},E=(M=function(e,t){throw new Error(e[t]||e.default)},function e(){for(var t=this,r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return n.length>=M.length?M.apply(this,n):function(){for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return e.apply(t,[].concat(n,o))}})(P),S={config:function(e){var t;return e||E("configIsRequired"),t=e,{}.toString.call(t).includes("Object")||E("configType"),e.urls?(console.warn(P.deprecation),{paths:{vs:e.urls.monacoBase}}):e}};function k(e,t){return Object.keys(t).forEach(function(r){t[r]instanceof Object&&e[r]&&Object.assign(t[r],k(e[r],t[r]))}),a(a({},e),t)}var x={type:"cancelation",msg:"operation is manually canceled"};function I(e){var t=!1,r=new Promise(function(r,n){e.then(function(e){return t?n(x):r(e)}),e.catch(n)});return r.cancel=function(){return t=!0},r}var T,A,D=j.create({config:{paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.52.2/min/vs"}},isInitialized:!1,resolve:null,reject:null,monaco:null}),V=(A=2,function(e){if(Array.isArray(e))return e}(T=D)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],n=!0,o=!1,i=void 0;try{for(var c,u=e[Symbol.iterator]();!(n=(c=u.next()).done)&&(r.push(c.value),!t||r.length!==t);n=!0);}catch(e){o=!0,i=e}finally{try{n||null==u.return||u.return()}finally{if(o)throw i}}return r}}(T,A)||function(e,t){if(e){if("string"==typeof e)return s(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?s(e,t):void 0}}(T,A)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),C=V[0],L=V[1];function R(e){return document.body.appendChild(e)}function q(e){var t,r,n=C(function(e){return{config:e.config,reject:e.reject}}),o=(t="".concat(n.config.paths.vs,"/loader.js"),r=document.createElement("script"),t&&(r.src=t),r);return o.onload=function(){return e()},o.onerror=n.reject,o}function z(){var e=C(function(e){return{config:e.config,resolve:e.resolve,reject:e.reject}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(t){_(t),e.resolve(t)},function(t){e.reject(t)})}function _(e){C().monaco||L({monaco:e})}var N=new Promise(function(e,t){return L({resolve:e,reject:t})}),F={config:function(e){var t=S.config(e),r=t.monaco,n=l(t,["monaco"]);L(function(e){return{config:k(e.config,n),monaco:r}})},init:function(){var e=C(function(e){return{monaco:e.monaco,isInitialized:e.isInitialized,resolve:e.resolve}});if(!e.isInitialized){if(L({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),I(N);if(window.monaco&&window.monaco.editor)return _(window.monaco),e.resolve(window.monaco),I(N);!function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e){return t.reduceRight(function(e,t){return t(e)},e)}}(R,q)(z)}return I(N)},__getMonacoInstance:function(){return C(function(e){return e.monaco})}},U={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},B={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}};var W=function({children:t}){return e.createElement("div",{style:B.container},t)};var Y=t(function({width:t,height:r,isEditorReady:n,loading:o,_ref:i,className:c,wrapperProps:u}){return e.createElement("section",{style:{...U.wrapper,width:t,height:r},...u},!n&&e.createElement(W,null,o),e.createElement("div",{ref:i,style:{...U.fullWidth,...!n&&U.hide},className:c}))});var $=function(e){i(e,[])};var G=function(e,t,r=!0){let o=n(!0);i(o.current||!r?()=>{o.current=!1}:e,t)};function H(){}function J(e,t,r,n){return function(e,t){return e.editor.getModel(K(e,t))}(e,n)||function(e,t,r,n){return e.editor.createModel(t,r,n?K(e,n):void 0)}(e,t,r,n)}function K(e,t){return e.Uri.parse(t)}var Q=function({original:t,modified:c,language:u,originalLanguage:a,modifiedLanguage:l,originalModelPath:s,modifiedModelPath:d,keepCurrentOriginalModel:f=!1,keepCurrentModifiedModel:g=!1,theme:p="light",loading:h="Loading...",options:y={},height:v="100%",width:m="100%",className:b,wrapperProps:w={},beforeMount:O=H,onMount:j=H}){let[M,P]=r(!1),[E,S]=r(!0),k=n(null),x=n(null),I=n(null),T=n(j),A=n(O),D=n(!1);$(()=>{let e=F.init();return e.then(e=>(x.current=e)&&S(!1)).catch(e=>"cancelation"!==e?.type&&console.error("Monaco initialization: error:",e)),()=>k.current?function(){let e=k.current?.getModel();f||e?.original?.dispose(),g||e?.modified?.dispose(),k.current?.dispose()}():e.cancel()}),G(()=>{if(k.current&&x.current){let e=k.current.getOriginalEditor(),r=J(x.current,t||"",a||u||"text",s||"");r!==e.getModel()&&e.setModel(r)}},[s],M),G(()=>{if(k.current&&x.current){let e=k.current.getModifiedEditor(),t=J(x.current,c||"",l||u||"text",d||"");t!==e.getModel()&&e.setModel(t)}},[d],M),G(()=>{let e=k.current.getModifiedEditor();e.getOption(x.current.editor.EditorOption.readOnly)?e.setValue(c||""):c!==e.getValue()&&(e.executeEdits("",[{range:e.getModel().getFullModelRange(),text:c||"",forceMoveMarkers:!0}]),e.pushUndoStop())},[c],M),G(()=>{k.current?.getModel()?.original.setValue(t||"")},[t],M),G(()=>{let{original:e,modified:t}=k.current.getModel();x.current.editor.setModelLanguage(e,a||u||"text"),x.current.editor.setModelLanguage(t,l||u||"text")},[u,a,l],M),G(()=>{x.current?.editor.setTheme(p)},[p],M),G(()=>{k.current?.updateOptions(y)},[y],M);let V=o(()=>{if(!x.current)return;A.current(x.current);let e=J(x.current,t||"",a||u||"text",s||""),r=J(x.current,c||"",l||u||"text",d||"");k.current?.setModel({original:e,modified:r})},[u,c,l,t,a,s,d]),C=o(()=>{!D.current&&I.current&&(k.current=x.current.editor.createDiffEditor(I.current,{automaticLayout:!0,...y}),V(),x.current?.editor.setTheme(p),P(!0),D.current=!0)},[y,p,V]);return i(()=>{M&&T.current(k.current,x.current)},[M]),i(()=>{!E&&!M&&C()},[E,M,C]),e.createElement(Y,{width:m,height:v,isEditorReady:M,loading:h,_ref:I,className:b,wrapperProps:w})},X=t(Q);var Z=function(){let[e,t]=r(F.__getMonacoInstance());return $(()=>{let r;return e||(r=F.init(),r.then(e=>{t(e)})),()=>r?.cancel()}),e};var ee=function(e){let t=n();return i(()=>{t.current=e},[e]),t.current},te=new Map;var re=function({defaultValue:t,defaultLanguage:c,defaultPath:u,value:a,language:l,path:s,theme:d="light",line:f,loading:g="Loading...",options:p={},overrideServices:h={},saveViewState:y=!0,keepCurrentModel:v=!1,width:m="100%",height:b="100%",className:w,wrapperProps:O={},beforeMount:j=H,onMount:M=H,onChange:P,onValidate:E=H}){let[S,k]=r(!1),[x,I]=r(!0),T=n(null),A=n(null),D=n(null),V=n(M),C=n(j),L=n(),R=n(a),q=ee(s),z=n(!1),_=n(!1);$(()=>{let e=F.init();return e.then(e=>(T.current=e)&&I(!1)).catch(e=>"cancelation"!==e?.type&&console.error("Monaco initialization: error:",e)),()=>A.current?(L.current?.dispose(),v?y&&te.set(s,A.current.saveViewState()):A.current.getModel()?.dispose(),void A.current.dispose()):e.cancel()}),G(()=>{let e=J(T.current,t||a||"",c||l||"",s||u||"");e!==A.current?.getModel()&&(y&&te.set(q,A.current?.saveViewState()),A.current?.setModel(e),y&&A.current?.restoreViewState(te.get(s)))},[s],S),G(()=>{A.current?.updateOptions(p)},[p],S),G(()=>{!A.current||void 0===a||(A.current.getOption(T.current.editor.EditorOption.readOnly)?A.current.setValue(a):a!==A.current.getValue()&&(_.current=!0,A.current.executeEdits("",[{range:A.current.getModel().getFullModelRange(),text:a,forceMoveMarkers:!0}]),A.current.pushUndoStop(),_.current=!1))},[a],S),G(()=>{let e=A.current?.getModel();e&&l&&T.current?.editor.setModelLanguage(e,l)},[l],S),G(()=>{void 0!==f&&A.current?.revealLine(f)},[f],S),G(()=>{T.current?.editor.setTheme(d)},[d],S);let N=o(()=>{if(D.current&&T.current&&!z.current){C.current(T.current);let e=s||u,r=J(T.current,a||t||"",c||l||"",e||"");A.current=T.current?.editor.create(D.current,{model:r,automaticLayout:!0,...p},h),y&&A.current.restoreViewState(te.get(e)),T.current.editor.setTheme(d),void 0!==f&&A.current.revealLine(f),k(!0),z.current=!0}},[t,c,u,a,l,s,p,h,y,d,f]);return i(()=>{S&&V.current(A.current,T.current)},[S]),i(()=>{!x&&!S&&N()},[x,S,N]),R.current=a,i(()=>{S&&P&&(L.current?.dispose(),L.current=A.current?.onDidChangeModelContent(e=>{_.current||P(A.current.getValue(),e)}))},[S,P]),i(()=>{if(S){let e=T.current.editor.onDidChangeMarkers(e=>{let t=A.current.getModel()?.uri;if(t&&e.find(e=>e.path===t.path)){let e=T.current.editor.getModelMarkers({resource:t});E?.(e)}});return()=>{e?.dispose()}}return()=>{}},[S,E]),e.createElement(Y,{width:m,height:b,isEditorReady:S,loading:g,_ref:D,className:w,wrapperProps:O})},ne=t(re),oe=ne;export{X as DiffEditor,ne as Editor,oe as default,F as loader,Z as useMonaco};
@@ -1,7 +0,0 @@
1
- /**
2
- * @license @sheetxl/react - React - React components needed to build advanced grid and spreadsheet UIs. - v0.4.13
3
- *
4
- * (C) 2025-present SheetXL Inc. & Michael T. Ford
5
- * License: The license can be found at https://www.sheetxl.com/license.
6
- */
7
- function e(e,t){for(var r=0;r<t.length;r++){const n=t[r];if("string"!=typeof n&&!Array.isArray(n))for(const t in n)if("default"!==t&&!(t in e)){const r=Object.getOwnPropertyDescriptor(n,t);r&&Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>n[t]})}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var t,r={},n={},o={},i={};var a,s={};function c(){if(a)return s;a=1;var e=s&&s.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{c(n.next(e))}catch(e){i(e)}}function s(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,s)}c((n=n.apply(e,t||[])).next())})},t=s&&s.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};Object.defineProperty(s,"__esModule",{value:!0}),s.JsDelivrSourceResolver=void 0;var r=function(){function r(){}return r.prototype.resolvePackageJson=function(r,n,o){return e(this,void 0,void 0,function(){return t(this,function(e){switch(e.label){case 0:return[4,this.resolveFile("https://cdn.jsdelivr.net/npm/".concat(r).concat(n?"@".concat(n):"").concat(o?"/".concat(o):"","/package.json"))];case 1:return[2,e.sent()]}})})},r.prototype.resolveSourceFile=function(r,n,o){return e(this,void 0,void 0,function(){return t(this,function(e){switch(e.label){case 0:return[4,this.resolveFile("https://cdn.jsdelivr.net/npm/".concat(r).concat(n?"@".concat(n):"","/").concat(o))];case 1:return[2,e.sent()]}})})},r.prototype.resolveFile=function(r){return e(this,void 0,void 0,function(){var e;return t(this,function(t){switch(t.label){case 0:return[4,fetch(r,{method:"GET"})];case 1:return(e=t.sent()).ok?[4,e.text()]:[3,3];case 2:return[2,t.sent()];case 3:if(404===e.status)return[2,""];throw Error("Error other than 404 while fetching from Unpkg at ".concat(r));case 4:return[2]}})})},r}();return s.JsDelivrSourceResolver=r,s}var u,l,p,h={},f={};function d(){if(l)return u;function e(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function t(e,t){for(var r,n="",o=0,i=-1,a=0,s=0;s<=e.length;++s){if(s<e.length)r=e.charCodeAt(s);else{if(47===r)break;r=47}if(47===r){if(i===s-1||1===a);else if(i!==s-1&&2===a){if(n.length<2||2!==o||46!==n.charCodeAt(n.length-1)||46!==n.charCodeAt(n.length-2))if(n.length>2){var c=n.lastIndexOf("/");if(c!==n.length-1){-1===c?(n="",o=0):o=(n=n.slice(0,c)).length-1-n.lastIndexOf("/"),i=s,a=0;continue}}else if(2===n.length||1===n.length){n="",o=0,i=s,a=0;continue}t&&(n.length>0?n+="/..":n="..",o=2)}else n.length>0?n+="/"+e.slice(i+1,s):n=e.slice(i+1,s),o=s-i-1;i=s,a=0}else 46===r&&-1!==a?++a:a=-1}return n}l=1;var r={resolve:function(){for(var r,n="",o=!1,i=arguments.length-1;i>=-1&&!o;i--){var a;i>=0?a=arguments[i]:(void 0===r&&(r=process.cwd()),a=r),e(a),0!==a.length&&(n=a+"/"+n,o=47===a.charCodeAt(0))}return n=t(n,!o),o?n.length>0?"/"+n:"/":n.length>0?n:"."},normalize:function(r){if(e(r),0===r.length)return".";var n=47===r.charCodeAt(0),o=47===r.charCodeAt(r.length-1);return 0!==(r=t(r,!n)).length||n||(r="."),r.length>0&&o&&(r+="/"),n?"/"+r:r},isAbsolute:function(t){return e(t),t.length>0&&47===t.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var t,n=0;n<arguments.length;++n){var o=arguments[n];e(o),o.length>0&&(void 0===t?t=o:t+="/"+o)}return void 0===t?".":r.normalize(t)},relative:function(t,n){if(e(t),e(n),t===n)return"";if((t=r.resolve(t))===(n=r.resolve(n)))return"";for(var o=1;o<t.length&&47===t.charCodeAt(o);++o);for(var i=t.length,a=i-o,s=1;s<n.length&&47===n.charCodeAt(s);++s);for(var c=n.length-s,u=a<c?a:c,l=-1,p=0;p<=u;++p){if(p===u){if(c>u){if(47===n.charCodeAt(s+p))return n.slice(s+p+1);if(0===p)return n.slice(s+p)}else a>u&&(47===t.charCodeAt(o+p)?l=p:0===p&&(l=0));break}var h=t.charCodeAt(o+p);if(h!==n.charCodeAt(s+p))break;47===h&&(l=p)}var f="";for(p=o+l+1;p<=i;++p)p!==i&&47!==t.charCodeAt(p)||(0===f.length?f+="..":f+="/..");return f.length>0?f+n.slice(s+l):(s+=l,47===n.charCodeAt(s)&&++s,n.slice(s))},_makeLong:function(e){return e},dirname:function(t){if(e(t),0===t.length)return".";for(var r=t.charCodeAt(0),n=47===r,o=-1,i=!0,a=t.length-1;a>=1;--a)if(47===(r=t.charCodeAt(a))){if(!i){o=a;break}}else i=!1;return-1===o?n?"/":".":n&&1===o?"//":t.slice(0,o)},basename:function(t,r){if(void 0!==r&&"string"!=typeof r)throw new TypeError('"ext" argument must be a string');e(t);var n,o=0,i=-1,a=!0;if(void 0!==r&&r.length>0&&r.length<=t.length){if(r.length===t.length&&r===t)return"";var s=r.length-1,c=-1;for(n=t.length-1;n>=0;--n){var u=t.charCodeAt(n);if(47===u){if(!a){o=n+1;break}}else-1===c&&(a=!1,c=n+1),s>=0&&(u===r.charCodeAt(s)?-1===--s&&(i=n):(s=-1,i=c))}return o===i?i=c:-1===i&&(i=t.length),t.slice(o,i)}for(n=t.length-1;n>=0;--n)if(47===t.charCodeAt(n)){if(!a){o=n+1;break}}else-1===i&&(a=!1,i=n+1);return-1===i?"":t.slice(o,i)},extname:function(t){e(t);for(var r=-1,n=0,o=-1,i=!0,a=0,s=t.length-1;s>=0;--s){var c=t.charCodeAt(s);if(47!==c)-1===o&&(i=!1,o=s+1),46===c?-1===r?r=s:1!==a&&(a=1):-1!==r&&(a=-1);else if(!i){n=s+1;break}}return-1===r||-1===o||0===a||1===a&&r===o-1&&r===n+1?"":t.slice(r,o)},format:function(e){if(null===e||"object"!=typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return function(e,t){var r=t.dir||t.root,n=t.base||(t.name||"")+(t.ext||"");return r?r===t.root?r+n:r+e+n:n}("/",e)},parse:function(t){e(t);var r={root:"",dir:"",base:"",ext:"",name:""};if(0===t.length)return r;var n,o=t.charCodeAt(0),i=47===o;i?(r.root="/",n=1):n=0;for(var a=-1,s=0,c=-1,u=!0,l=t.length-1,p=0;l>=n;--l)if(47!==(o=t.charCodeAt(l)))-1===c&&(u=!1,c=l+1),46===o?-1===a?a=l:1!==p&&(p=1):-1!==a&&(p=-1);else if(!u){s=l+1;break}return-1===a||-1===c||0===p||1===p&&a===c-1&&a===s+1?-1!==c&&(r.base=r.name=0===s&&i?t.slice(1,c):t.slice(s,c)):(0===s&&i?(r.name=t.slice(1,a),r.base=t.slice(1,c)):(r.name=t.slice(s,a),r.base=t.slice(s,c)),r.ext=t.slice(a,c)),s>0?r.dir=t.slice(0,s-1):i&&(r.dir="/"),r},sep:"/",delimiter:":",win32:null,posix:null};return r.posix=r,u=r}var v,y={};function g(){if(v)return y;v=1;var e=y&&y.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(y,"__esModule",{value:!0}),y.importResourcePathToString=void 0;var t=e(d());return y.importResourcePathToString=function(e){var r;switch(e.kind){case"package":return t.default.join(e.packageName,null!==(r=e.importPath)&&void 0!==r?r:"","package.json");case"relative":return t.default.join(e.sourcePath,e.importPath);case"relative-in-package":return t.default.join(e.packageName,e.sourcePath,e.importPath)}},y}var m,b={};function k(){if(m)return b;m=1,Object.defineProperty(b,"__esModule",{value:!0}),b.invokeUpdate=void 0;return b.invokeUpdate=function(e,t){var r,n="".concat(e.type,": ");switch(e.type){case"CodeChanged":case"ResolveNewImports":n+="";break;case"LookedUpTypeFile":n+='"'.concat(e.path,'" was ').concat(e.success?"sucessfully":"not sucessfully"," looked up");break;case"AttemptedLookUpFile":n+='"'.concat(e.path,'" was ').concat(e.success?"sucessfully":"not sucessfully"," attempted to looked up");break;case"LookedUpPackage":n+='package.json for package "'.concat(e.package,'" was ').concat(e.success?"sucessfully":"not sucessfully"," looked up").concat(e.definitelyTyped?" (found in definitely typed repo)":"");break;case"LoadedFromCache":n+='"'.concat(e.importPath,'" was loaded from cache');break;case"StoredToCache":n+='"'.concat(e.importPath,'" was stored to cache')}n.endsWith(": ")&&(n=n.slice(void 0,-2)),null===(r=t.onUpdate)||void 0===r||r.call(t,e,n)},b}var w,_,P,O,j={};function R(){if(w)return j;w=1,Object.defineProperty(j,"__esModule",{value:!0}),j.RecursionDepth=void 0;var e=function(){function e(e,t,r){void 0===t&&(t=0),void 0===r&&(r=0),this.options=e,this.fileRecursionDepth=t,this.packageRecursionDepth=r}return e.prototype.nextPackage=function(){return new e(this.options,this.fileRecursionDepth,this.packageRecursionDepth+1)},e.prototype.nextFile=function(){return new e(this.options,this.fileRecursionDepth+1,this.packageRecursionDepth)},e.prototype.same=function(){return new e(this.options,this.fileRecursionDepth,this.packageRecursionDepth)},e.prototype.shouldStop=function(){return this.options.fileRecursionDepth>0&&this.fileRecursionDepth>=this.options.fileRecursionDepth||this.options.packageRecursionDepth>0&&this.packageRecursionDepth>=this.options.packageRecursionDepth},e}();return j.RecursionDepth=e,j}function C(){if(_)return h;_=1;var e=h&&h.__assign||function(){return e=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},e.apply(this,arguments)},t=h&&h.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=h&&h.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=h&&h.__importStar||function(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var o in e)"default"!==o&&Object.prototype.hasOwnProperty.call(e,o)&&t(n,e,o);return r(n,e),n},o=h&&h.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{c(n.next(e))}catch(e){i(e)}}function s(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,s)}c((n=n.apply(e,t||[])).next())})},i=h&&h.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},a=h&&h.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},s=h&&h.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(h,"__esModule",{value:!0}),h.ImportResolver=void 0;var c=function(){if(p)return f;p=1;var e=f&&f.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),t=f&&f.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=f&&f.__importStar||function(r){if(r&&r.__esModule)return r;var n={};if(null!=r)for(var o in r)"default"!==o&&Object.prototype.hasOwnProperty.call(r,o)&&e(n,r,o);return t(n,r),n},n=f&&f.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},o=f&&f.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(f,"__esModule",{value:!0}),f.DependencyParser=void 0;var i=r(d()),a=function(){function e(){this.REGEX_CLEAN=/[\n|\r]/g,this.REGEX_DETECT_IMPORT=/(?:(?:(?:import)|(?:export))(?:.)*?from\s+["']([^"']+)["'])|(?:((?:require|import))(?:\s+)?\(["']([^"']+)["']\))|(?:\/+\s+<reference\s+path=["']([^"']+)["']\s+\/>)/g,this.REGEX_NODE_MODULE=/^node:([\w\W\/]+)$/}return e.prototype.parseDependencies=function(e,t){var r=this;return o([],n(e.matchAll(this.REGEX_DETECT_IMPORT)),!1).map(function(e){var t,r;return null!==(r=null!==(t=e[1])&&void 0!==t?t:e[2])&&void 0!==r?r:e[3]}).filter(function(e){return!!e}).map(function(e){return r.resolvePath(e,t)})},e.prototype.resolvePath=function(e,t){var r=e.match(this.REGEX_NODE_MODULE);if(r)return{kind:"relative-in-package",packageName:"@types/node",importPath:"".concat(r[1],".d.ts"),sourcePath:""};if("string"==typeof t){if(e.startsWith("."))return{kind:"relative",importPath:e,sourcePath:t};if(e.startsWith("@")){var n=e.split("/");return{kind:"package",packageName:"".concat(n[0],"/").concat(n[1]),importPath:n.slice(2).join("/")}}return{kind:"package",packageName:(n=e.split("/"))[0],importPath:n.slice(1).join("/")}}switch(t.kind){case"package":throw Error("TODO?");case"relative":throw Error("TODO2?");case"relative-in-package":return e.startsWith(".")?{kind:"relative-in-package",packageName:t.packageName,sourcePath:i.join(t.sourcePath,t.importPath),importPath:e}:e.startsWith("@")?(n=e.split("/"),{kind:"package",packageName:"".concat(n[0],"/").concat(n[1]),importPath:n.slice(2).join("/")}):{kind:"package",packageName:(n=e.split("/"))[0],importPath:n.slice(1).join("/")}}},e}();return f.DependencyParser=a,f}(),u=g(),l=n(d()),v=k(),y=R(),m=function(){function t(e){var t,r;if(this.options=e,this.loadedFiles=[],this.dependencyParser=new c.DependencyParser,this.cache=e.sourceCache,this.sourceResolver=e.sourceResolver,this.newImportsResolved=!1,this.monaco=e.monaco,e.preloadPackages&&e.versions){this.versions=e.versions;try{for(var n=a(Object.entries(e.versions)),o=n.next();!o.done;o=n.next()){var i=s(o.value,2),u=i[0];i[1];this.resolveImport({kind:"package",packageName:u,importPath:""},new y.RecursionDepth(this.options)).catch(function(e){console.error(e)})}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}}}return t.prototype.wereNewImportsResolved=function(){return this.newImportsResolved},t.prototype.resetNewImportsResolved=function(){this.newImportsResolved=!1},t.prototype.resolveImportsInFile=function(e,t,r){var n,s,c;return o(this,void 0,void 0,function(){var o,u,l,p,h,f,d,v;return i(this,function(i){switch(i.label){case 0:if(r.shouldStop())return[2];o=this.dependencyParser.parseDependencies(e,t),i.label=1;case 1:i.trys.push([1,8,9,10]),u=a(o),l=u.next(),i.label=2;case 2:if(l.done)return[3,7];p=l.value,i.label=3;case 3:return i.trys.push([3,5,,6]),[4,this.resolveImport(p,r)];case 4:return i.sent(),[3,6];case 5:return h=i.sent(),this.options.onError?null===(s=(n=this.options).onError)||void 0===s||s.call(n,null!==(c=h.message)&&void 0!==c?c:h):console.error(h),[3,6];case 6:return l=u.next(),[3,2];case 7:return[3,10];case 8:return f=i.sent(),d={error:f},[3,10];case 9:try{l&&!l.done&&(v=u.return)&&v.call(u)}finally{if(d)throw d.error}return[7];case 10:return[2]}})})},t.prototype.resolveImport=function(e,t){return o(this,void 0,void 0,function(){var r,n;return i(this,function(o){switch(o.label){case 0:if(r=this.hashImportResourcePath(e),this.loadedFiles.includes(r))return[2];switch(this.loadedFiles.push(r),e.kind){case"package":return[3,1];case"relative":return[3,5];case"relative-in-package":return[3,6]}return[3,8];case 1:return[4,this.resolveImportFromPackageRoot(e)];case 2:return(n=o.sent())?[4,this.resolveImportInPackage(n,t.nextPackage().nextFile())]:[3,4];case 3:case 7:return[2,o.sent()];case 4:return[3,8];case 5:throw Error("Not implemented yet");case 6:return[4,this.resolveImportInPackage(e,t.nextFile())];case 8:return[2]}})})},t.prototype.resolveImportInPackage=function(e,t){return o(this,void 0,void 0,function(){var r,n,o;return i(this,function(i){switch(i.label){case 0:return[4,this.loadSourceFileContents(e)];case 1:return(r=i.sent())?(n=r.source,o=r.at,this.createModel(n,this.monaco.Uri.parse(this.options.fileRootPath+l.join("node_modules/".concat(e.packageName),o))),[4,this.resolveImportsInFile(n,{kind:"relative-in-package",packageName:e.packageName,sourcePath:l.dirname(o),importPath:""},t)]):[3,3];case 2:i.sent(),i.label=3;case 3:return[2]}})})},t.prototype.resolveImportFromPackageRoot=function(e){var t,r,n,a,s,c,u,p,h;return o(this,void 0,void 0,function(){var o,f,d,y,g,m,b,k,w;return i(this,function(i){switch(i.label){case 0:return o={type:"LookedUpPackage",package:e.packageName,definitelyTyped:!1,success:!1},!this.options.onlySpecifiedPackages||(null===(t=this.versions)||void 0===t?void 0:t[e.packageName])||(null===(r=this.versions)||void 0===r?void 0:r["@types/"+e.packageName])?(f=null!==(a=null===(n=e.importPath)||void 0===n?void 0:n.length)&&void 0!==a&&a,d=f?"/".concat(e.importPath):"",[4,this.resolvePackageJson(e.packageName,null===(s=this.versions)||void 0===s?void 0:s[e.packageName],f?e.importPath:void 0)]):((0,v.invokeUpdate)(o,this.options),[2]);case 1:return(y=i.sent())||!f?[3,3]:[4,this.resolvePackageJson(e.packageName,null===(c=this.versions)||void 0===c?void 0:c[e.packageName])];case 2:y=i.sent(),d="",i.label=3;case 3:return y?(g=JSON.parse(y)).typings||g.types?(w=g.typings||g.types,this.createModel(y,this.monaco.Uri.parse("".concat(this.options.fileRootPath,"node_modules/").concat(e.packageName).concat(d,"/package.json"))),(0,v.invokeUpdate)({type:"LookedUpPackage",package:e.packageName,definitelyTyped:!1,success:!0},this.options),this.setVersion(e.packageName,g.version),[2,{kind:"relative-in-package",packageName:e.packageName,sourcePath:"",importPath:l.join(null!==(u=e.importPath)&&void 0!==u?u:"",w.startsWith("./")?w.slice(2):w)}]):[3,4]:[3,7];case 4:return m="@types/".concat(e.packageName.startsWith("@")?e.packageName.slice(1).replace(/\//,"__"):e.packageName),[4,this.resolvePackageJson(m,null===(p=this.versions)||void 0===p?void 0:p[m])];case 5:if(b=i.sent()){if((k=JSON.parse(b)).typings||k.types)return w=k.typings||k.types,this.createModel(b,this.monaco.Uri.parse("".concat(this.options.fileRootPath,"node_modules/").concat(m,"/package.json"))),(0,v.invokeUpdate)({type:"LookedUpPackage",package:m,definitelyTyped:!0,success:!0},this.options),this.setVersion(m,k.version),[2,{kind:"relative-in-package",packageName:m,sourcePath:"",importPath:l.join(null!==(h=e.importPath)&&void 0!==h?h:"",w.startsWith("./")?w.slice(2):w)}];(0,v.invokeUpdate)(o,this.options)}else(0,v.invokeUpdate)(o,this.options);i.label=6;case 6:return[3,8];case 7:(0,v.invokeUpdate)(o,this.options),i.label=8;case 8:return[2]}})})},t.prototype.loadSourceFileContents=function(e){return o(this,void 0,void 0,function(){var t,r,n,o,s,c,u,p,h,f,d,y,g,m,b,k;return i(this,function(i){switch(i.label){case 0:return t=l.join(e.packageName,e.sourcePath,e.importPath),r={type:"LookedUpTypeFile",path:t,definitelyTyped:!1,success:!1},n=e.packageName,o=this.getVersion(e.packageName),(s=[".d.ts","/index.d.ts",".ts",".tsx","/index.ts","/index.tsx"]).map(function(t){return e.importPath.endsWith(t)}).reduce(function(e,t){return e||t},!1)?[4,this.resolveSourceFile(n,o,l.join(e.sourcePath,e.importPath))]:[3,2];case 1:return(m=i.sent())?[2,{source:m,at:l.join(e.sourcePath,e.importPath)}]:[3,9];case 2:i.trys.push([2,7,8,9]),c=a(s),u=c.next(),i.label=3;case 3:return u.done?[3,6]:(p=u.value,h=l.join(e.sourcePath,e.importPath),g=(".d.ts"===p&&h.endsWith(".js")?h.slice(0,-3):h)+p,[4,this.resolveSourceFile(n,o,g)]);case 4:if(m=i.sent(),(0,v.invokeUpdate)({type:"AttemptedLookUpFile",path:l.join(n,g),success:!!m},this.options),m)return(0,v.invokeUpdate)({type:"LookedUpTypeFile",path:l.join(n,g),success:!0},this.options),[2,{source:m,at:g}];i.label=5;case 5:return u=c.next(),[3,3];case 6:return[3,9];case 7:return f=i.sent(),b={error:f},[3,9];case 8:try{u&&!u.done&&(k=c.return)&&k.call(c)}finally{if(b)throw b.error}return[7];case 9:return[4,this.resolvePackageJson(n,o,l.join(e.sourcePath,e.importPath))];case 10:return(d=i.sent())&&(y=JSON.parse(d).types)?(g=l.join(e.sourcePath,e.importPath,y),[4,this.resolveSourceFile(n,o,g)]):[3,12];case 11:if(m=i.sent())return(0,v.invokeUpdate)({type:"LookedUpTypeFile",path:l.join(n,g),success:!0},this.options),[2,{source:m,at:g}];i.label=12;case 12:return(0,v.invokeUpdate)(r,this.options),[2,null]}})})},t.prototype.getVersion=function(e){var t;return null===(t=this.versions)||void 0===t?void 0:t[e]},t.prototype.setVersions=function(e){var t,r;this.versions=e,null===(r=(t=this.options).onUpdateVersions)||void 0===r||r.call(t,e)},t.prototype.setVersion=function(t,r){var n;this.setVersions(e(e({},this.versions),((n={})[t]=r,n)))},t.prototype.createModel=function(e,t){t=t.with({path:t.path.replace("@types/","")}),this.monaco.editor.getModel(t)||(this.monaco.editor.createModel(e,"typescript",t),this.newImportsResolved=!0)},t.prototype.hashImportResourcePath=function(e){return(0,u.importResourcePathToString)(e)},t.prototype.resolvePackageJson=function(e,t,r){return o(this,void 0,void 0,function(){var n,o,a,s;return i(this,function(i){switch(i.label){case 0:return n=l.join(e+(t?"@".concat(t):""),null!=r?r:"","package.json"),o=!1,a=void 0,this.cache.isFileAvailable?[4,this.cache.isFileAvailable(n)]:[3,2];case 1:return o=i.sent(),[3,4];case 2:return[4,this.cache.getFile(n)];case 3:a=i.sent(),o=void 0!==a,i.label=4;case 4:return o?null==a?[3,5]:(s=a,[3,7]):[3,8];case 5:return[4,this.cache.getFile(n)];case 6:s=i.sent(),i.label=7;case 7:return[2,s];case 8:return[4,this.sourceResolver.resolvePackageJson(e,t,r)];case 9:return(a=i.sent())&&this.cache.storeFile(n,a),[2,a]}})})},t.prototype.resolveSourceFile=function(e,t,r){return o(this,void 0,void 0,function(){var n,o,a,s;return i(this,function(i){switch(i.label){case 0:return n=l.join(e+(t?"@".concat(t):""),r),o=!1,a=void 0,this.cache.isFileAvailable?[4,this.cache.isFileAvailable(n)]:[3,2];case 1:return o=i.sent(),[3,4];case 2:return[4,this.cache.getFile(n)];case 3:a=i.sent(),o=void 0!==a,i.label=4;case 4:return o?((0,v.invokeUpdate)({type:"LoadedFromCache",importPath:n},this.options),null==a?[3,5]:(s=a,[3,7])):[3,8];case 5:return[4,this.cache.getFile(n)];case 6:s=i.sent(),i.label=7;case 7:return[2,s];case 8:return[4,this.sourceResolver.resolveSourceFile(e,t,r)];case 9:return(a=i.sent())&&((0,v.invokeUpdate)({type:"StoredToCache",importPath:n},this.options),this.cache.storeFile(n,a)),[2,a]}})})},t}();return h.ImportResolver=m,h}function S(){if(P)return o;P=1;var e=o&&o.__assign||function(){return e=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},e.apply(this,arguments)},r=o&&o.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),n=o&&o.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=o&&o.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var o in e)"default"!==o&&Object.prototype.hasOwnProperty.call(e,o)&&r(t,e,o);return n(t,e),t},s=o&&o.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{c(n.next(e))}catch(e){i(e)}}function s(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,s)}c((n=n.apply(e,t||[])).next())})},u=o&&o.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},l=o&&o.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(o,"__esModule",{value:!0}),o.AutoTypingsCore=void 0;var p=function(){if(t)return i;t=1,Object.defineProperty(i,"__esModule",{value:!0}),i.DummySourceCache=void 0;var e=function(){function e(){}return e.prototype.getFile=function(e){return Promise.resolve(void 0)},e.prototype.isFileAvailable=function(e){return Promise.resolve(!1)},e.prototype.storeFile=function(e,t){return Promise.resolve(void 0)},e.prototype.clear=function(){return Promise.resolve(void 0)},e}();return i.DummySourceCache=e,i}(),h=c(),f=C(),v=a(d()),y=k(),g=R(),m=function(){function t(t,r){var n=this;this.editor=t,this.options=r,this.disposables=[],this.importResolver=new f.ImportResolver(r);var o=t.onDidChangeModelContent(function(e){n.debouncedResolveContents()});this.disposables.push(o),this.resolveContents(),r.dontAdaptEditorOptions||r.monaco.languages.typescript.typescriptDefaults.setCompilerOptions(e(e({},r.monaco.languages.typescript.typescriptDefaults.getCompilerOptions()),{moduleResolution:r.monaco.languages.typescript.ModuleResolutionKind.NodeJs,allowSyntheticDefaultImports:!0,rootDir:r.fileRootPath}))}return t.create=function(r,n){var o,i;return s(this,void 0,void 0,function(){var a;return u(this,function(s){if((null==n?void 0:n.shareCache)&&n.sourceCache&&!t.sharedCache&&(t.sharedCache=n.sourceCache),!(a=null==n?void 0:n.monaco))throw new Error("monacoInstance not found, you can specify the monaco instance via options.monaco");return[2,new t(r,e(e({fileRootPath:"inmemory://model/",onlySpecifiedPackages:!1,preloadPackages:!1,shareCache:!1,dontAdaptEditorOptions:!1,dontRefreshModelValueAfterResolvement:!1,sourceCache:null!==(o=t.sharedCache)&&void 0!==o?o:new p.DummySourceCache,sourceResolver:null!==(i=null==n?void 0:n.sourceResolver)&&void 0!==i?i:new h.JsDelivrSourceResolver,debounceDuration:4e3,fileRecursionDepth:10,packageRecursionDepth:3},n),{monaco:a}))]})})},t.prototype.dispose=function(){var e,t;try{for(var r=l(this.disposables),n=r.next();!n.done;n=r.next()){n.value.dispose()}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}},t.prototype.setVersions=function(e){this.importResolver.setVersions(e),this.options.versions=e},t.prototype.clearCache=function(){return s(this,void 0,void 0,function(){return u(this,function(e){switch(e.label){case 0:return[4,this.options.sourceCache.clear()];case 1:return e.sent(),[2]}})})},t.prototype.debouncedResolveContents=function(){var e=this;this.isResolving||((0,y.invokeUpdate)({type:"CodeChanged"},this.options),this.options.debounceDuration<=0?this.resolveContents():(void 0!==this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(function(){return s(e,void 0,void 0,function(){return u(this,function(e){switch(e.label){case 0:return[4,this.resolveContents()];case 1:return e.sent(),this.debounceTimer=void 0,[2]}})})},this.options.debounceDuration)))},t.prototype.resolveContents=function(){var e;return s(this,void 0,void 0,function(){var t,r,n,o;return u(this,function(i){switch(i.label){case 0:if(this.isResolving=!0,(0,y.invokeUpdate)({type:"ResolveNewImports"},this.options),!(t=this.editor.getModel()))throw Error("No model");r=t.getLinesContent(),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.importResolver.resolveImportsInFile(r.join("\n"),v.dirname(t.uri.toString()),new g.RecursionDepth(this.options))];case 2:return i.sent(),[3,4];case 3:if(n=i.sent(),!this.options.onError)throw n;return this.options.onError(null!==(e=n.message)&&void 0!==e?e:n),[3,4];case 4:return this.importResolver.wereNewImportsResolved()&&(this.options.dontRefreshModelValueAfterResolvement||(o=this.editor.getPosition(),t.setValue(t.getValue()),o&&this.editor.setPosition(o)),this.importResolver.resetNewImportsResolved()),this.isResolving=!1,[2]}})})},t}();return o.AutoTypingsCore=m,o}var x,A={};function D(){if(x)return A;x=1;var e=A&&A.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{c(n.next(e))}catch(e){i(e)}}function s(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,s)}c((n=n.apply(e,t||[])).next())})},t=A&&A.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},r=A&&A.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(A,"__esModule",{value:!0}),A.LocalStorageCache=void 0;var n=function(){function n(){this.localCache={}}return n.prototype.getFile=function(r){var o;return e(this,void 0,void 0,function(){return t(this,function(e){try{return[2,null!==(o=localStorage.getItem(n.LOCALSTORAGE_PREFIX+r))&&void 0!==o?o:void 0]}catch(e){return[2,this.localCache[r]]}return[2]})})},n.prototype.storeFile=function(r,o){return e(this,void 0,void 0,function(){return t(this,function(e){this.localCache[r]=o;try{localStorage.setItem(n.LOCALSTORAGE_PREFIX+r,o)}catch(e){}return[2]})})},n.prototype.clear=function(){return e(this,void 0,void 0,function(){var e,o,i,a,s,c,u;return t(this,function(t){for(this.localCache={},e=[],o=0;o<localStorage.length;o++)(null==(s=localStorage.key(o))?void 0:s.startsWith(n.LOCALSTORAGE_PREFIX))&&e.push(s);try{for(i=r(e),a=i.next();!a.done;a=i.next())s=a.value,localStorage.removeItem(s)}catch(e){c={error:e}}finally{try{a&&!a.done&&(u=i.return)&&u.call(i)}finally{if(c)throw c.error}}return[2]})})},n.LOCALSTORAGE_PREFIX="__autotyper_cache_",n}();return A.LocalStorageCache=n,A}var E,F={};var T,N={};var I,M={};var U,L={};var G,J,V,W,X={};function B(){if(G)return X;G=1;var e=X&&X.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{c(n.next(e))}catch(e){i(e)}}function s(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,s)}c((n=n.apply(e,t||[])).next())})},t=X&&X.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};Object.defineProperty(X,"__esModule",{value:!0}),X.UnpkgSourceResolver=void 0;var r=function(){function r(){}return r.prototype.resolvePackageJson=function(r,n,o){return e(this,void 0,void 0,function(){return t(this,function(e){switch(e.label){case 0:return[4,this.resolveFile("https://unpkg.com/".concat(r).concat(n?"@".concat(n):"").concat(o?"/".concat(o):"","/package.json"))];case 1:return[2,e.sent()]}})})},r.prototype.resolveSourceFile=function(r,n,o){return e(this,void 0,void 0,function(){return t(this,function(e){switch(e.label){case 0:return[4,this.resolveFile("https://unpkg.com/".concat(r).concat(n?"@".concat(n):"","/").concat(o))];case 1:return[2,e.sent()]}})})},r.prototype.resolveFile=function(r){return e(this,void 0,void 0,function(){var e;return t(this,function(t){switch(t.label){case 0:return[4,fetch(r,{method:"GET"})];case 1:return(e=t.sent()).ok?[4,e.text()]:[3,3];case 2:return[2,t.sent()];case 3:if(404===e.status)return[2,""];throw Error("Error other than 404 while fetching from Unpkg at ".concat(r));case 4:return[2]}})})},r}();return X.UnpkgSourceResolver=r,X}function z(){return J||(J=1,e=r,t=r&&r.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=r&&r.__exportStar||function(e,r){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(r,n)||t(r,e,n)},Object.defineProperty(e,"__esModule",{value:!0}),o(function(){if(O)return n;O=1;var e,t=n&&n.__extends||(e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)},function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)});Object.defineProperty(n,"__esModule",{value:!0}),n.AutoTypings=void 0;var r=function(e){function r(t,r){return e.call(this,t,r)||this}return t(r,e),r}(S().AutoTypingsCore);return n.AutoTypings=r,n}(),e),o(g(),e),o(D(),e),o((E||(E=1,Object.defineProperty(F,"__esModule",{value:!0})),F),e),o((T||(T=1,Object.defineProperty(N,"__esModule",{value:!0})),N),e),o((I||(I=1,Object.defineProperty(M,"__esModule",{value:!0})),M),e),o((U||(U=1,Object.defineProperty(L,"__esModule",{value:!0})),L),e),o(B(),e),o(c(),e)),r;var e,t,o}const q=e({__proto__:null},[W?V:(W=1,V=z())]);export{q as c};