/*1698776452000*/ (()=>{"use strict";(()=>{var e=function e(){throw function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),new Error("Don't construct ResolvablePromise objects directly: rely on ResolvablePromise.new() instead")};function t(e){if(e.fulfilled)throw new Error("Promise already fulfilled")}function n(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&void 0!==arguments[0]?arguments[0]:{};l(this,e),this._modules={},this._maps={},this._paths={},this._config={maps:{},paths:{}},this._parse(t,"defaultURLParams",{}),this._parse(t,"explainResolutions",!1),this._parse(t,"showWarnings",!1),this._parse(t,"waitTimeout",7e3),this._parse(t,"basePath","/"),this._parse(t,"resolvePath","/o/js_resolve_modules"),this._parse(t,"combine",!1),this._parse(t,"url",""),this._parse(t,"urlMaxLength",2e3),this._parse(t,"logLevel","error"),this._parse(t,"moduleType","module")}var t,n;return t=e,(n=[{key:"explainResolutions",get:function(){return this._config.explainResolutions}},{key:"showWarnings",get:function(){return this._config.showWarnings}},{key:"waitTimeout",get:function(){return this._config.waitTimeout}},{key:"basePath",get:function(){return this._config.basePath}},{key:"resolvePath",get:function(){return this._config.resolvePath}},{key:"combine",get:function(){return this._config.combine}},{key:"url",get:function(){return this._config.url}},{key:"urlMaxLength",get:function(){return this._config.urlMaxLength}},{key:"logLevel",get:function(){return this._config.logLevel}},{key:"moduleType",get:function(){return this._config.moduleType}},{key:"defaultURLParams",get:function(){return this._config.defaultURLParams}},{key:"paths",get:function(){return this._paths}},{key:"addModule",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this._modules[e])throw new Error("Module is already registered: ".concat(e));var n=new r(e);return Object.entries(t).forEach((function(e){var t=i(e,2),r=t[0],o=t[1];n[r]=o})),this._modules[e]=n,n}},{key:"addMappings",value:function(e){Object.assign(this._maps,e)}},{key:"addPaths",value:function(e){Object.assign(this._paths,e)}},{key:"getModules",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;return void 0===t?Object.values(this._modules):t.map((function(t){return e.getModule(t)}))}},{key:"getModule",value:function(e){var t=this._modules[e];if(!t){var n=this._mapModule(e);t=this._modules[n]}return t}},{key:"getDependency",value:function(e,t){var n=this.getModule(e),r=this._modules[t];if(!r){var o=this._mapModule(t,n.map);r=this._modules[o]}return r}},{key:"_parse",value:function(e,t,n){this._config[t]=Object.prototype.hasOwnProperty.call(e,t)?e[t]:n}},{key:"_mapModule",value:function(e,t){return t&&(e=this._mapMatches(e,t)),Object.keys(this._maps).length&&(e=this._mapMatches(e,this._maps)),e}},{key:"_mapMatches",value:function(e,t){var n=t[e];return n?"object"===o(n)?n.value:n:((n=this._mapExactMatch(e,t))||(n=this._mapPartialMatch(e,t)),n||(n=this._mapWildcardMatch(e,t)),n||e)}},{key:"_mapExactMatch",value:function(e,t){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=t[n];if(r.value&&r.exactMatch&&e===n)return r.value}}},{key:"_mapPartialMatch",value:function(e,t){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=t[n];if(!r.exactMatch&&(r.value&&(r=r.value),e===n||0===e.indexOf(n+"/")))return r+e.substring(n.length)}}},{key:"_mapWildcardMatch",value:function(e,t){if("function"==typeof t["*"])return t["*"](e)}}])&&u(t.prototype,n),e}();function c(e,t){for(var n=0;nn.urlMaxLength&&(l=n.resolvePath,u={body:a,method:"POST"}),fetch(l,u).then((function(e){return e.text()})).then((function(n){var o=JSON.parse(n);t._cachedResolutions[e]=o,r(o)})).catch(o)}}))}}])&&c(t.prototype,n),e}();function h(e,t){for(var n=0;n-1?"&":"?")+r}}])&&_(t.prototype,n),e}();function b(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&void 0!==arguments[0]?arguments[0]:null,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;O(this,e),this._config=new s(t||window.__CONFIG__),this._log=new p(this._config),this._dependencyResolver=new f(this._config),this._urlBuilder=new w(this._config),this._scriptLoader=new M(n||window.document,this._config,this._log),this._requireCallId=0}var t,n;return t=e,(n=[{key:"version",value:function(){return"5.2.0"}},{key:"define",value:function(){for(var e=this._config,t=arguments.length,n=new Array(t),r=0;r1)throw Object.assign(new Error("The server generated some errors while resolving modules"),{resolutionErrors:t.errors});return u.addMappings(t.configMap),u.addPaths(t.pathMap),r=t.resolvedModules,(o=a._getUnregisteredModuleNames(r)).forEach((function(e){var n={map:t.moduleMap[e]},r=t.moduleFlags?t.moduleFlags[e]:{};(r=r||{}).esModule&&(n.esModule=!0),r.useESM&&(n.useESM=!0),u.addModule(e,n)})),i=a._setRejectTimeout(e,t,(function(){w=!0,n.apply(void 0,arguments)})),a._log.resolution("Fetching",o,"from require call",s),l.loadModules(o)})).then((function(){if(!w)return a._waitForModuleDefinitions(r)})).then((function(){if(!w){clearTimeout(i),a._setModuleImplementations(s,r);var n=a._getModuleImplementations(e);t.apply(void 0,k(n))}})).catch((function(e){w||(i&&clearTimeout(i),n(e))}))}},{key:"_interceptHandler",value:function(e,t,n){var r=this;return function(){r._log.resolution("Invoking",t,"handler for","require call",n);try{e.apply(void 0,arguments)}catch(e){r._log.error("\n","A require() call",t,"handler has thrown an error.\n","Note that even if the call stack of this error trace","looks like coming from the Liferay AMD Loader, it is not","an error in the Loader what has caused it, but an error","in the handler's code.\n","The reason why the Loader is in the stack trace is","because it is printing the error on behalf of the handler","so that it doesn't get lost.\n","However, we recommend wrapping all handler code inside a","try/catch to be able to recover from errors better and to","avoid the appearance of this message.\n","\n",e)}}}},{key:"_getUnregisteredModuleNames",value:function(e){var t=this._config;return e.filter((function(e){return!t.getModule(e)}))}},{key:"_logServerMessages",value:function(e,t){t.errors&&t.errors.length&&this._log.error("Errors returned from server for require(",e,"):",t.errors),t.warnings&&t.warnings.length&&this._log.warn("Warnings returned from server for require(",e,"):",t.warnings)}},{key:"_setRejectTimeout",value:function(e,t,n){var r=this._config;if(0!==r.waitTimeout)return setTimeout((function(){var o=t.resolvedModules.filter((function(e){var t=r.getModule(e);return!t||!t.implemented})),i=Object.assign(new Error("Load timeout for modules: "+e),{missingModules:o,modules:e,resolution:t});n(i)}),r.waitTimeout)}},{key:"_throwOnLegacyProtocolResolutionErrors",value:function(e){var t=e.resolvedModules.filter((function(e){return 0===e.indexOf(":ERROR:")})).map((function(e){return e.substr(7)}));if(t.length)throw Object.assign(new Error("The following problems where detected while resolving modules:\n"+t.map((function(e){return" 路 ".concat(e)})).join("\n")),{resolutionErrors:t})}},{key:"_waitForModuleDefinitions",value:function(e){var t=this._config;return Promise.all(t.getModules(e).map((function(e){return e.define})))}},{key:"_waitForModuleImplementations",value:function(e){var t=this._config;return Promise.all(t.getModules(e).map((function(e){return e.implement})))}},{key:"_setModuleImplementations",value:function(e,t){var n=this,r=this._config;r.getModules(t).forEach((function(t){if(!t.implemented){if(t.implement.rejected)throw t.implement.rejection;n._log.resolution("Implementing",t.name,"from require call",e);try{var o={get exports(){return t.implementation},set exports(e){t.implementation=e}},i=t.dependencies.map((function(e){if("exports"===e)return o.exports;if("module"===e)return o;if("require"===e)return n._createLocalRequire(t);var i=r.getDependency(t.name,e);if(!i)throw new Error("Unsatisfied dependency: ".concat(e," ")+"found in module ".concat(t.name));if(!i.implementation&&!i.implemented)throw new Error('Module "'+i.name+'" has not been loaded yet for context: '+t.name);return i.implementation})),a=t.factory.apply(t,k(i));void 0!==a&&(t.implementation=a),t.implement.resolve(t.implementation)}catch(e){throw t.implement.fulfilled||t.implement.reject(e),e}}}))}},{key:"_createLocalRequire",value:function(e){var t=this,n=this._config,r=function(r){for(var o=arguments.length,i=new Array(o>1?o-1:0),a=1;a