Liferay.Loader.define("frontend-js-web@5.0.33/liferay/component.es",["module","exports","require"],(function(e,t,n){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.initComponentCache=t.getComponentCache=t.destroyUnfulfilledPromises=t.destroyComponents=t.destroyComponent=t.componentReady=t.component=void 0;const e={};let n={};const r={};let s={};const a={},i=["p_p_id","p_p_lifecycle"],c=["ddmStructureKey","fileEntryTypeId","folderId","navigation","status"],l="liferay.component",d=function(e){let t;if(e)t={promise:Promise.resolve(e),resolve(){}};else{let e;t={promise:new Promise((t=>{e=t})),resolve:e}}return t},f=function(e,t,n){const o=e.data;Object.keys(o).forEach((e=>{const t=n.querySelector("#".concat(e));t&&(t.innerHTML=o[e].html)}))},u=function(t){const n=new URL(window.location.href),o=new URL(t.path,window.location.href);if(i.every((e=>o.searchParams.get(e)===n.searchParams.get(e)))){var a=Object.keys(r);a=a.filter((t=>{const s=r[t];if(!s)return!1;const a=e[t],i=c.every((e=>{let t=!1;if(a){const r="_".concat(a.portletId,"_").concat(e);t=o.searchParams.get(r)===n.searchParams.get(r)}return t}));return"function"==typeof s.isCacheable&&s.isCacheable(o)&&i&&a&&a.cacheState&&s.element&&s.getState})),s=a.reduce(((t,n)=>{const o=r[n],s=e[n],a=o.getState(),i=s.cacheState.reduce(((e,t)=>(e[t]=a[t],e)),{});return t[n]={html:o.element.innerHTML,state:i},t}),[]),Liferay.DOMTaskRunner.addTask({action:f,condition:e=>e.owner===l}),Liferay.DOMTaskRunner.addTaskState({data:s,owner:l})}else s={}},m=function(t,o,s){let i;if(1===arguments.length){let e=r[t];e&&"function"==typeof e&&(a[t]=e,e=e(),r[t]=e),i=e}else if(r[t]&&null!==o&&(delete e[t],delete n[t],console.warn('Component with id "'+t+'" is being registered twice. This can lead to unexpected behaviour in the "Liferay.component" and "Liferay.componentReady" APIs, as well as in the "*:registered" events.')),i=r[t]=o,null===o)delete e[t],delete n[t];else{e[t]=s,Liferay.fire(t+":registered");const r=n[t];r?r.resolve(o):n[t]=d(o)}return i};t.component=m;const p=function e(){let t,o;if(1===arguments.length)t=arguments[0];else{t=[];for(var r=0;r<arguments.length;r++)t[r]=arguments[r]}if(Array.isArray(t))o=Promise.all(t.map((t=>e(t))));else{let e=n[t];e||(n[t]=e=d()),o=e.promise}return o};t.componentReady=p;const y=function(t){const o=r[t];if(o){const s=o.destroy||o.dispose;s&&s.call(o),delete e[t],delete n[t],delete a[t],delete r[t]}};t.destroyComponent=y;const h=function(t){var n=Object.keys(r);t&&(n=n.filter((n=>t(r[n],e[n]||{})))),n.forEach(y)};t.destroyComponents=h;const g=function(){n={}};t.destroyUnfulfilledPromises=g;const v=function(e){const t=s[e];return t?t.state:{}};t.getComponentCache=v;const w=function(){Liferay.on("startNavigate",u)};t.initComponentCache=w;var o=m;t.default=o}}));
//# sourceMappingURL=component.es.js.map