"use strict";const R=require("../../../../../@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.cjs.js"),k=require("../../../../../@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/extends.cjs.js"),q=require("../../../../../@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/classCallCheck.cjs.js"),w=require("../../../../../@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/createClass.cjs.js"),A=require("../../../../../@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.cjs.js"),p=require("../../../../../@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.cjs.js"),C=require("../../../../../@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/inherits.cjs.js"),i=require("../../../../../@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/defineProperty.cjs.js"),L=require("../../../../../../../_virtual/index.cjs3.js"),y=require("react"),P=require("./highlight.cjs.js");function x(n,r,f){return r=p(r),A(n,v()?Reflect.construct(r,f||[],p(n).constructor):r.apply(n,f))}function v(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(v=function(){return!!n})()}const _=(function(n){var r,f=n.loader,G=n.isLanguageRegistered,g=n.registerLanguage,c=n.languageLoaders,m=n.noAsyncLoadingLanguages,a=(function(u){function e(){return q(this,e),x(this,e,arguments)}return C(e,u),w(e,[{key:"componentDidUpdate",value:function(){!e.isRegistered(this.props.language)&&c&&this.loadLanguage()}},{key:"componentDidMount",value:function(){var t=this;e.astGeneratorPromise||e.loadAstGenerator(),e.astGenerator||e.astGeneratorPromise.then(function(){t.forceUpdate()}),!e.isRegistered(this.props.language)&&c&&this.loadLanguage()}},{key:"loadLanguage",value:function(){var t=this,s=this.props.language;s!=="text"&&e.loadLanguage(s).then(function(){return t.forceUpdate()}).catch(function(){})}},{key:"normalizeLanguage",value:function(t){return e.isSupportedLanguage(t)?t:"text"}},{key:"render",value:function(){return y.createElement(e.highlightInstance,k({},this.props,{language:this.normalizeLanguage(this.props.language),astGenerator:e.astGenerator}))}}],[{key:"preload",value:function(){return e.loadAstGenerator()}},{key:"loadLanguage",value:(function(){var o=R(L.mark(function s(h){var d;return L.wrap(function(l){for(;;)switch(l.prev=l.next){case 0:if(d=c[h],typeof d!="function"){l.next=1;break}return l.abrupt("return",d(e.registerLanguage));case 1:throw new Error("Language ".concat(h," not supported"));case 2:case"end":return l.stop()}},s)}));function t(s){return o.apply(this,arguments)}return t})()},{key:"isSupportedLanguage",value:function(t){return e.isRegistered(t)||typeof c[t]=="function"}},{key:"loadAstGenerator",value:function(){return e.astGeneratorPromise=f().then(function(t){e.astGenerator=t,g&&e.languages.forEach(function(s,h){return g(t,h,s)})}),e.astGeneratorPromise}}])})(y.PureComponent);return r=a,i(a,"astGenerator",null),i(a,"highlightInstance",P(null,{})),i(a,"astGeneratorPromise",null),i(a,"languages",new Map),i(a,"supportedLanguages",n.supportedLanguages||Object.keys(c||{})),i(a,"isRegistered",function(u){if(m)return!0;if(!g)throw new Error("Current syntax highlighter doesn't support registration of languages");return r.astGenerator?G(r.astGenerator,u):r.languages.has(u)}),i(a,"registerLanguage",function(u,e){if(!g)throw new Error("Current syntax highlighter doesn't support registration of languages");if(r.astGenerator)return g(r.astGenerator,u,e);r.languages.set(u,e)}),a});module.exports=_;
//# sourceMappingURL=async-syntax-highlighter.cjs.js.map
