From 4aad0b1cbece4fbb31f018dfccd1e295fc97ce1d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 24 Oct 2023 12:23:20 +0000 Subject: [PATCH 1/2] [TASK] Update lit to v3 | datasource | package | from | to | | ---------- | ------- | ----- | ----- | | npm | lit | 2.8.0 | 3.0.0 | --- Resources/Private/Frontend/package.json | 2 +- Resources/Private/Frontend/yarn.lock | 48 ++++++++++++------------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Resources/Private/Frontend/package.json b/Resources/Private/Frontend/package.json index a3e70a0a..6b1089a5 100644 --- a/Resources/Private/Frontend/package.json +++ b/Resources/Private/Frontend/package.json @@ -30,7 +30,7 @@ "cross-env": "^7.0.3", "eslint": "^8.39.0", "eslint-plugin-sonarjs": "^0.21.0", - "lit": "^2.7.6", + "lit": "^3.0.0", "npm-run-all": "^4.1.5", "postcss": "^8.4.24", "rollup": "^4.0.0", diff --git a/Resources/Private/Frontend/yarn.lock b/Resources/Private/Frontend/yarn.lock index cfc5bb77..79163123 100644 --- a/Resources/Private/Frontend/yarn.lock +++ b/Resources/Private/Frontend/yarn.lock @@ -140,17 +140,17 @@ "@jridgewell/resolve-uri" "^3.1.0" "@jridgewell/sourcemap-codec" "^1.4.14" -"@lit-labs/ssr-dom-shim@^1.0.0", "@lit-labs/ssr-dom-shim@^1.1.0": +"@lit-labs/ssr-dom-shim@^1.1.2-pre.0": version "1.1.2" resolved "https://registry.yarnpkg.com/@lit-labs/ssr-dom-shim/-/ssr-dom-shim-1.1.2.tgz#d693d972974a354034454ec1317eb6afd0b00312" integrity sha512-jnOD+/+dSrfTWYfSXBXlo5l5f0q1UuJo3tkbMDCYA2lKUYq79jaxqtGEvnRoh049nt1vdo1+45RinipU6FGY2g== -"@lit/reactive-element@^1.3.0", "@lit/reactive-element@^1.6.0": - version "1.6.3" - resolved "https://registry.yarnpkg.com/@lit/reactive-element/-/reactive-element-1.6.3.tgz#25b4eece2592132845d303e091bad9b04cdcfe03" - integrity sha512-QuTgnG52Poic7uM1AN5yJ09QMe0O28e10XzSvWDz02TJiiKee4stsiownEIadWm8nYzyDAyT+gKzUoZmiWQtsQ== +"@lit/reactive-element@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@lit/reactive-element/-/reactive-element-2.0.0.tgz#da14a256ac5533873b935840f306d572bac4a2ab" + integrity sha512-wn+2+uDcs62ROBmVAwssO4x5xue/uKD3MGGZOXL2sMxReTRIT0JXKyMXeu7gh0aJ4IJNEIG/3aOnUaQvM7BMzQ== dependencies: - "@lit-labs/ssr-dom-shim" "^1.0.0" + "@lit-labs/ssr-dom-shim" "^1.1.2-pre.0" "@nodelib/fs.scandir@2.1.5": version "2.1.5" @@ -1856,30 +1856,30 @@ lines-and-columns@^1.1.6: resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== -lit-element@^3.3.0: - version "3.3.3" - resolved "https://registry.yarnpkg.com/lit-element/-/lit-element-3.3.3.tgz#10bc19702b96ef5416cf7a70177255bfb17b3209" - integrity sha512-XbeRxmTHubXENkV4h8RIPyr8lXc+Ff28rkcQzw3G6up2xg5E8Zu1IgOWIwBLEQsu3cOVFqdYwiVi0hv0SlpqUA== +lit-element@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/lit-element/-/lit-element-4.0.0.tgz#8343891bc9159a5fcb7f534914b37f2c0161e036" + integrity sha512-N6+f7XgusURHl69DUZU6sTBGlIN+9Ixfs3ykkNDfgfTkDYGGOWwHAYBhDqVswnFGyWgQYR2KiSpu4J76Kccs/A== dependencies: - "@lit-labs/ssr-dom-shim" "^1.1.0" - "@lit/reactive-element" "^1.3.0" - lit-html "^2.8.0" + "@lit-labs/ssr-dom-shim" "^1.1.2-pre.0" + "@lit/reactive-element" "^2.0.0" + lit-html "^3.0.0" -lit-html@^2.8.0: - version "2.8.0" - resolved "https://registry.yarnpkg.com/lit-html/-/lit-html-2.8.0.tgz#96456a4bb4ee717b9a7d2f94562a16509d39bffa" - integrity sha512-o9t+MQM3P4y7M7yNzqAyjp7z+mQGa4NS4CxiyLqFPyFWyc4O+nodLrkrxSaCTrla6M5YOLaT3RpbbqjszB5g3Q== +lit-html@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/lit-html/-/lit-html-3.0.0.tgz#77d6776ee488642c74c5575315ef81aa09d24ea9" + integrity sha512-DNJIE8dNY0dQF2Gs0sdMNUppMQT2/CvV4OVnSdg7BXAsGqkVwsE5bqQ04POfkYH5dBIuGnJYdFz5fYYyNnOxiA== dependencies: "@types/trusted-types" "^2.0.2" -lit@^2.7.6: - version "2.8.0" - resolved "https://registry.yarnpkg.com/lit/-/lit-2.8.0.tgz#4d838ae03059bf9cafa06e5c61d8acc0081e974e" - integrity sha512-4Sc3OFX9QHOJaHbmTMk28SYgVxLN3ePDjg7hofEft2zWlehFL3LiAuapWc4U/kYwMYJSh2hTCPZ6/LIC7ii0MA== +lit@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/lit/-/lit-3.0.0.tgz#204bd65935892a73670471e893ee8ca55d2f9a3b" + integrity sha512-nQ0teRzU1Kdj++VdmttS2WvIen8M79wChJ6guRKIIym2M3Ansg3Adj9O6yuQh2IpjxiUXlNuS81WKlQ4iL3BmA== dependencies: - "@lit/reactive-element" "^1.6.0" - lit-element "^3.3.0" - lit-html "^2.8.0" + "@lit/reactive-element" "^2.0.0" + lit-element "^4.0.0" + lit-html "^3.0.0" load-json-file@^4.0.0: version "4.0.0" From b59aa15d106b9d2a8c2bf54febe7c41820406ffa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20H=C3=A4u=C3=9Fler?= Date: Tue, 24 Oct 2023 12:24:01 +0000 Subject: [PATCH 2/2] [TASK] Automatically rebuild frontend assets --- .../Public/JavaScript/backend/toolbar-menu.js | 2 +- Resources/Public/JavaScript/cache-warmer.js | 50 +++++++++---------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/Resources/Public/JavaScript/backend/toolbar-menu.js b/Resources/Public/JavaScript/backend/toolbar-menu.js index 70ff3000..76f85251 100644 --- a/Resources/Public/JavaScript/backend/toolbar-menu.js +++ b/Resources/Public/JavaScript/backend/toolbar-menu.js @@ -1 +1 @@ -import e from"@typo3/core/document-service.js";import t from"@typo3/core/event/regular-event.js";import{_ as r,e as n,C as o,L as i,I as a}from"../cache-warmer.js";import{LitElement as s}from"lit";import l from"@typo3/backend/icons.js";import c from"@typo3/backend/modal.js";import u from"@typo3/backend/notification.js";import"@typo3/backend/action-button/immediate-action.js";import"@typo3/core/ajax/ajax-request.js";const d=({finisher:e,descriptor:t})=>(r,n)=>{var o;if(void 0===n){const n=null!==(o=r.originalKey)&&void 0!==o?o:r.key,i=null!=t?{kind:"method",placement:"prototype",key:n,descriptor:t(r.key)}:{...r,key:n};return null!=e&&(i.finisher=function(t){e(t,n)}),i}{const o=r.constructor;void 0!==t&&Object.defineProperty(r,n,t(n)),null==e||e(o,n)}};function p(e,t){return d({descriptor:r=>{const n={get(){var t,r;return null!==(r=null===(t=this.renderRoot)||void 0===t?void 0:t.querySelector(e))&&void 0!==r?r:null},enumerable:!0,configurable:!0};if(t){const t="symbol"==typeof r?Symbol():"__"+r;n.get=function(){var r,n;return void 0===this[t]&&(this[t]=null!==(n=null===(r=this.renderRoot)||void 0===r?void 0:r.querySelector(e))&&void 0!==n?n:null),this[t]}}return n}})}function g(e){return d({descriptor:t=>({get(){var t,r;return null!==(r=null===(t=this.renderRoot)||void 0===t?void 0:t.querySelectorAll(e))&&void 0!==r?r:[]},enumerable:!0,configurable:!0})})}var h="text/plain",m=e=>{};function f(e){m(e)}var v=!0;(function(){(console.warn||console.log).apply(console,arguments)}).bind("[clipboard-polyfill]");var y,b,w,x="undefined"==typeof window?void 0:window,C="undefined"==typeof globalThis?void 0:globalThis,k=null!=(w=null==(y=x)?void 0:y.Promise)?w:null==(b=C)?void 0:b.Promise;var T,S,_,E,I,A="undefined"==typeof navigator?void 0:navigator,D=null==A?void 0:A.clipboard,G=null==(T=null==D?void 0:D.read)?void 0:T.bind(D),j=null==(S=null==D?void 0:D.readText)?void 0:S.bind(D),L=null==(_=null==D?void 0:D.write)?void 0:_.bind(D),R=null==(E=null==D?void 0:D.writeText)?void 0:E.bind(D),O=null==(I=x)?void 0:I.ClipboardItem,U=function(){if(!k)throw new Error("No `Promise` implementation available for `clipboard-polyfill`. Consider using: /~https://github.com/lgarron/clipboard-polyfill#flat-file-version-with-promise-included");return k}(),B=x;function M(){return"undefined"==typeof ClipboardEvent&&void 0!==(null==B?void 0:B.clipboardData)&&void 0!==(null==B?void 0:B.clipboardData.setData)}function P(e,t,r){for(var n in f("listener called"),e.success=!0,t){var o=t[n],i=r.clipboardData;i.setData(n,o),n===h&&i.getData(n)!==o&&(f("setting text/plain failed"),e.success=!1)}r.preventDefault()}function W(e){var t={success:!1},r=P.bind(this,t,e);document.addEventListener("copy",r);try{document.execCommand("copy")}finally{document.removeEventListener("copy",r)}return t.success}function N(e,t){q(e);var r=W(t);return z(),r}function q(e){var t=document.getSelection();if(t){var r=document.createRange();r.selectNodeContents(e),t.removeAllRanges(),t.addRange(r)}}function z(){var e=document.getSelection();e&&e.removeAllRanges()}function H(e){var t=h in e;if(M()){if(!t)throw new Error("No `text/plain` value was specified.");if(function(e){if(!B.clipboardData)return!1;var t=B.clipboardData.setData("Text",e);return t&&f("writeTextIE worked"),t}(e[h]))return!0;throw new Error("Copying failed, possibly because the user rejected it.")}return W(e)?(f("regular execCopy worked"),!0):navigator.userAgent.indexOf("Edge")>-1?(f('UA "Edge" => assuming success'),!0):N(document.body,e)?(f("copyUsingTempSelection worked"),!0):function(e){var t=document.createElement("div");t.setAttribute("style","-webkit-user-select: text !important"),t.textContent="temporary element",document.body.appendChild(t);var r=N(t,e);return document.body.removeChild(t),r}(e)?(f("copyUsingTempElem worked"),!0):!!function(e){f("copyTextUsingDOM");var t=document.createElement("div");t.setAttribute("style","-webkit-user-select: text !important");var r=t;t.attachShadow&&(f("Using shadow DOM."),r=t.attachShadow({mode:"open"}));var n=document.createElement("span");n.innerText=e,r.appendChild(n),document.body.appendChild(t),q(n);var o=document.execCommand("copy");return z(),document.body.removeChild(t),o}(e[h])&&(f("copyTextUsingDOM worked"),!0)}function Y(e,t){var r=[];for(var n in e){var o=e[n];r.push(t(o))}return U.all(r).then((t=>{for(var r={},n=0;nU.resolve(!0),$=U.resolve(!1);function V(e){return new U(((t,r)=>{try{t(e())}catch(e){r(e)}}))}function K(e){if(!H(function(e){var t={};return t[h]=e,t}(e)))throw new Error("writeText() failed")}function Q(){return V((()=>{if(j)return f("Using `navigator.clipboard.readText()`."),j();if(M()){var e=function(){if(!B.clipboardData)throw new Error("Cannot read IE clipboard Data ");var e=B.clipboardData.getData("Text");if(""===e)throw new Error("Empty clipboard or could not read plain text from clipboard");return e}();return U.resolve(e)}throw new Error("Read is not supported in your browser.")}))}function X(e,t){for(var r in e){if(-1!==e[r].types.indexOf(t))return!0}return!1}var Z=function(e,t){var r,n=Object.keys(e),o={};for(var i in e){var a=e[i];o[i]="string"==typeof a?ee(i,a):a}return{types:n,presentationStyle:null!=(r=null==t?void 0:t.presentationStyle)?r:"unspecified",getType:function(e){return U.resolve(o[e])}}};function ee(e,t){return new Blob([t],{type:e})}function te(e){return Y(e.types,(function(t){return e.getType(t)})).then((t=>new Promise(((r,n)=>{var o={};e.presentationStyle&&(o.presentationStyle=e.presentationStyle),O?r(new O(t,o)):n("window.ClipboardItem is not defined")}))))}function re(e){var t={};return t[h]=ee(e,h),new Z(t)}function ne(e,t){return e.getType(t).then((e=>{return t=e,new U(((e,r)=>{var n=new FileReader;n.addEventListener("load",(()=>{var t=n.result;"string"==typeof t?e(t):r("could not convert blob to string")})),n.readAsText(t)}));var t}))}var oe,ie,ae=Object.freeze({__proto__:null,ClipboardItem:Z,read:function(){return V((()=>G?(f("Using `navigator.clipboard.read()`."),G()):Q().then((e=>[re(e)]))))},readText:Q,setDebugLog:function(e){m=e},suppressWarnings:function(){v=!1},write:function(e){return V((()=>{if(L&&O){var t=L;return f("Using `navigator.clipboard.write()`."),U.all(e.map(te)).then((r=>t(r).then(J).catch((t=>{if(!X(e,h)&&!X(e,"text/html"))throw t;return $}))))}return $})).then((t=>{if(t)return F;var r=X(e,h);return v&&!r&&f("clipboard.write() was called without a `text/plain` data type. On some platforms, this may result in an empty clipboard. Call suppressWarnings() to suppress this warning."),function(e){return Y(e.types,(function(t){return ne(e,t)}))}(e[0]).then((e=>{if(!H(e))throw new Error("write() failed")}))}))},writeText:function(e){return V((()=>R?(f("Using `navigator.clipboard.writeText()`."),R(e).catch(K)):U.resolve(K(e))))}});class se extends Error{static create(){return new se("The given site selection object is invalid.")}}class le{constructor(e,t,r){this.site=e,this.language=t,this.group=r}static fromJson(e){const t=JSON.parse(e);if("object"!=typeof t)throw se.create();if(!("site"in t))throw se.create();return new le(t.site,t.language??null,t.group??null)}getSiteIdentifier(){return this.site}getLanguageId(){return this.language}getGroupName(){return this.group}isWithinGroup(){return null!==this.group}isGroupRoot(){return this.isWithinGroup()&&null===this.language}isGroupItem(){return this.isWithinGroup()&&null!==this.language}}!function(e){e.form=".tx-warming-sites-modal",e.siteCheckbox=".tx-warming-sites-group-selector > input",e.siteCheckboxAll=".tx-warming-sites-group-selector > input[data-select-all]",e.useragentCopy="button.tx-warming-user-agent-copy-action",e.useragentCopyIcon="button.tx-warming-user-agent-copy-action .t3js-icon",e.useragentCopyText=".tx-warming-user-agent-copy-text"}(oe||(oe={})),function(e){e.startButton="tx-warming-start-warmup"}(ie||(ie={}));let ce=class extends s{constructor(){super(),this.cacheWarmer=new o,this.modal=c.currentModal}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.initializeSites()}initializeSites(){const e=this.modal.querySelector(".modal-footer");e.classList.add("tx-warming-modal-footer","visually-hidden"),new t("submit",(e=>(e.preventDefault(),this.performCacheWarmup(),!1))).bindTo(this._form),this._checkboxes.forEach((r=>{new t("input",(t=>{e.classList.remove("visually-hidden"),this.toggleInputs(t.target)})).bindTo(r)})),new t("click",(e=>{e.preventDefault(),e.stopImmediatePropagation();const t=e.currentTarget.dataset.text;t&&this.copyUserAgentToClipboard(t)})).bindTo(this._useragentCopyButton)}performCacheWarmup(){if(!this.areSitesSelected())return void u.warning(TYPO3.lang[i.notificationNoSitesSelectedTitle],TYPO3.lang[i.notificationNoSitesSelectedMessage],15);const{configuration:e,sites:t}=this.parseFormValues();this.cacheWarmer.warmupCache(t,[],e)}parseFormValues(){const e=new FormData(this._form),t={},r={};for(const[n,o]of e)switch(n){case"site":try{const e=le.fromJson(o.toString()),t=e.getSiteIdentifier();if(e.isGroupRoot())continue;r[t]??(r[t]=[]),r[t].push(e.getLanguageId())}catch(e){}break;case"limit":t.limit=parseInt(o.toString());break;case"strategy":t.strategy=o.toString()}return{configuration:t,sites:r}}toggleInputs(e){if(e.dataset.selectAll)this.toggleAll(e.checked);else{const t=le.fromJson(e.value);t.isWithinGroup()&&this.toggleGroup(t,e),this.toggleSelectAll(e)}this.areSitesSelected()?this.getStartButton().classList.remove("disabled"):this.getStartButton().classList.add("disabled")}areSitesSelected(){let e=!1;return this._enabledCheckboxesWithoutGroupElements.forEach((t=>{if(t.checked)return e=!0,!1})),e}toggleGroup(e,t){let r=t.checked;null===e.getLanguageId()?this.getCheckboxesByGroup(e.getGroupName()).forEach((e=>{e.checked=r})):(r&&this.getCheckboxesByGroup(e.getGroupName()).forEach((e=>{if(e.id!==t.id&&!e.checked)return r=!1,!1})),this.getCheckboxGroupRoot(e.getGroupName()).checked=r)}toggleAll(e){this._enabledCheckboxes.forEach((t=>{t.checked=e}))}toggleSelectAll(e){let t=e.checked;t&&this._enabledCheckboxesWithoutGroupElements.forEach((r=>{if(r.id!==e.id&&!r.checked)return t=!1,!1})),this._selectAllCheckbox.checked=t}getCheckboxesByGroup(e){return this.renderRoot.querySelectorAll(`input[data-group="${e}"]:enabled`)}getCheckboxGroupRoot(e){return this.renderRoot.querySelector(`input[data-group-root="${e}"]:enabled`)}getStartButton(){return this.modal.querySelector(`button[name=${ie.startButton}]`)}copyUserAgentToClipboard(e){const t=this._useragentCopyIcon.cloneNode(!0);l.getIcon(a.spinner,l.sizes.small).then((e=>{this._useragentCopyIcon.innerHTML=e})),Promise.all([(navigator.clipboard??ae).writeText(e),l.getIcon(a.check,l.sizes.small)]).then((async([,e])=>{const r=this._useragentCopyText.innerText;this._useragentCopyText.innerText=TYPO3.lang[i.modalSitesUserAgentActionSuccessful],this._useragentCopyIcon.innerHTML=e,window.setTimeout((()=>{this._useragentCopyIcon.innerHTML=t.innerHTML,this._useragentCopyText.innerText=r,this._useragentCopyButton.blur()}),3e3)}),(()=>{this._useragentCopyIcon.innerHTML=t.innerHTML}))}static createModal(){const e=new URL(TYPO3.settings.ajaxUrls.tx_warming_fetch_sites,window.location.origin);c.dismiss(),c.advanced({type:c.types.ajax,content:e.toString(),title:TYPO3.lang[i.modalSitesTitle],size:c.sizes.medium,buttons:[{text:TYPO3.lang[i.modalSitesButtonStart],icon:a.rocket,btnClass:"btn-primary disabled",name:ie.startButton,trigger:()=>{c.currentModal.querySelector(oe.form).requestSubmit()}}]})}};var ue;r([p(oe.form)],ce.prototype,"_form",void 0),r([p(oe.siteCheckboxAll)],ce.prototype,"_selectAllCheckbox",void 0),r([g(oe.siteCheckbox)],ce.prototype,"_checkboxes",void 0),r([g(oe.siteCheckbox+":enabled")],ce.prototype,"_enabledCheckboxes",void 0),r([g(oe.siteCheckbox+":enabled:not([data-select-all])")],ce.prototype,"_enabledCheckboxesWithoutGroupElements",void 0),r([p(oe.useragentCopy)],ce.prototype,"_useragentCopyButton",void 0),r([p(oe.useragentCopyIcon)],ce.prototype,"_useragentCopyIcon",void 0),r([p(oe.useragentCopyText)],ce.prototype,"_useragentCopyText",void 0),ce=r([n("warming-sites-modal")],ce),function(e){e.container="#eliashaeussler-typo3warming-backend-toolbaritems-cachewarmuptoolbaritem"}(ue||(ue={}));var de=new class{constructor(){e.ready().then((()=>{new t("click",(()=>{ce.createModal()})).delegateTo(document,ue.container)}))}};export{de as default}; +import e from"@typo3/core/document-service.js";import t from"@typo3/core/event/regular-event.js";import{_ as r,t as n,C as o,L as i,I as a}from"../cache-warmer.js";import{LitElement as s}from"lit";import c from"@typo3/backend/icons.js";import l from"@typo3/backend/modal.js";import u from"@typo3/backend/notification.js";import"@typo3/backend/action-button/immediate-action.js";import"@typo3/core/ajax/ajax-request.js";const d=(e,t,r)=>(r.configurable=!0,r.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,r),r);function p(e,t){return(r,n,o)=>{const i=t=>t.renderRoot?.querySelector(e)??null;if(t){const{get:e,set:a}="object"==typeof n?r:o??(()=>{const e=Symbol();return{get(){return this[e]},set(t){this[e]=t}}})();return d(r,n,{get(){if(t){let t=e.call(this);return void 0===t&&(t=i(this),a.call(this,t)),t}return i(this)}})}return d(r,n,{get(){return i(this)}})}}let g;function h(e){return(t,r)=>d(t,r,{get(){return(this.renderRoot??(g??=document.createDocumentFragment())).querySelectorAll(e)}})}var m="text/plain",f=e=>{};function b(e){f(e)}var y=!0;(function(){(console.warn||console.log).apply(console,arguments)}).bind("[clipboard-polyfill]");var v,w,x,C="undefined"==typeof window?void 0:window,T="undefined"==typeof globalThis?void 0:globalThis,k=null!=(x=null==(v=C)?void 0:v.Promise)?x:null==(w=T)?void 0:w.Promise;var S,_,E,I,A,D="undefined"==typeof navigator?void 0:navigator,j=null==D?void 0:D.clipboard,G=null==(S=null==j?void 0:j.read)?void 0:S.bind(j),L=null==(_=null==j?void 0:j.readText)?void 0:_.bind(j),R=null==(E=null==j?void 0:j.write)?void 0:E.bind(j),O=null==(I=null==j?void 0:j.writeText)?void 0:I.bind(j),U=null==(A=C)?void 0:A.ClipboardItem,B=function(){if(!k)throw new Error("No `Promise` implementation available for `clipboard-polyfill`. Consider using: /~https://github.com/lgarron/clipboard-polyfill#flat-file-version-with-promise-included");return k}(),M=C;function P(){return"undefined"==typeof ClipboardEvent&&void 0!==(null==M?void 0:M.clipboardData)&&void 0!==(null==M?void 0:M.clipboardData.setData)}function W(e,t,r){for(var n in b("listener called"),e.success=!0,t){var o=t[n],i=r.clipboardData;i.setData(n,o),n===m&&i.getData(n)!==o&&(b("setting text/plain failed"),e.success=!1)}r.preventDefault()}function N(e){var t={success:!1},r=W.bind(this,t,e);document.addEventListener("copy",r);try{document.execCommand("copy")}finally{document.removeEventListener("copy",r)}return t.success}function q(e,t){z(e);var r=N(t);return H(),r}function z(e){var t=document.getSelection();if(t){var r=document.createRange();r.selectNodeContents(e),t.removeAllRanges(),t.addRange(r)}}function H(){var e=document.getSelection();e&&e.removeAllRanges()}function Y(e){var t=m in e;if(P()){if(!t)throw new Error("No `text/plain` value was specified.");if(function(e){if(!M.clipboardData)return!1;var t=M.clipboardData.setData("Text",e);return t&&b("writeTextIE worked"),t}(e[m]))return!0;throw new Error("Copying failed, possibly because the user rejected it.")}return N(e)?(b("regular execCopy worked"),!0):navigator.userAgent.indexOf("Edge")>-1?(b('UA "Edge" => assuming success'),!0):q(document.body,e)?(b("copyUsingTempSelection worked"),!0):function(e){var t=document.createElement("div");t.setAttribute("style","-webkit-user-select: text !important"),t.textContent="temporary element",document.body.appendChild(t);var r=q(t,e);return document.body.removeChild(t),r}(e)?(b("copyUsingTempElem worked"),!0):!!function(e){b("copyTextUsingDOM");var t=document.createElement("div");t.setAttribute("style","-webkit-user-select: text !important");var r=t;t.attachShadow&&(b("Using shadow DOM."),r=t.attachShadow({mode:"open"}));var n=document.createElement("span");n.innerText=e,r.appendChild(n),document.body.appendChild(t),z(n);var o=document.execCommand("copy");return H(),document.body.removeChild(t),o}(e[m])&&(b("copyTextUsingDOM worked"),!0)}function F(e,t){var r=[];for(var n in e){var o=e[n];r.push(t(o))}return B.all(r).then((t=>{for(var r={},n=0;nB.resolve(!0),V=B.resolve(!1);function K(e){return new B(((t,r)=>{try{t(e())}catch(e){r(e)}}))}function Q(e){if(!Y(function(e){var t={};return t[m]=e,t}(e)))throw new Error("writeText() failed")}function X(){return K((()=>{if(L)return b("Using `navigator.clipboard.readText()`."),L();if(P()){var e=function(){if(!M.clipboardData)throw new Error("Cannot read IE clipboard Data ");var e=M.clipboardData.getData("Text");if(""===e)throw new Error("Empty clipboard or could not read plain text from clipboard");return e}();return B.resolve(e)}throw new Error("Read is not supported in your browser.")}))}function Z(e,t){for(var r in e){if(-1!==e[r].types.indexOf(t))return!0}return!1}var ee=function(e,t){var r,n=Object.keys(e),o={};for(var i in e){var a=e[i];o[i]="string"==typeof a?te(i,a):a}return{types:n,presentationStyle:null!=(r=null==t?void 0:t.presentationStyle)?r:"unspecified",getType:function(e){return B.resolve(o[e])}}};function te(e,t){return new Blob([t],{type:e})}function re(e){return F(e.types,(function(t){return e.getType(t)})).then((t=>new Promise(((r,n)=>{var o={};e.presentationStyle&&(o.presentationStyle=e.presentationStyle),U?r(new U(t,o)):n("window.ClipboardItem is not defined")}))))}function ne(e){var t={};return t[m]=te(e,m),new ee(t)}function oe(e,t){return e.getType(t).then((e=>{return t=e,new B(((e,r)=>{var n=new FileReader;n.addEventListener("load",(()=>{var t=n.result;"string"==typeof t?e(t):r("could not convert blob to string")})),n.readAsText(t)}));var t}))}var ie,ae,se=Object.freeze({__proto__:null,ClipboardItem:ee,read:function(){return K((()=>G?(b("Using `navigator.clipboard.read()`."),G()):X().then((e=>[ne(e)]))))},readText:X,setDebugLog:function(e){f=e},suppressWarnings:function(){y=!1},write:function(e){return K((()=>{if(R&&U){var t=R;return b("Using `navigator.clipboard.write()`."),B.all(e.map(re)).then((r=>t(r).then($).catch((t=>{if(!Z(e,m)&&!Z(e,"text/html"))throw t;return V}))))}return V})).then((t=>{if(t)return J;var r=Z(e,m);return y&&!r&&b("clipboard.write() was called without a `text/plain` data type. On some platforms, this may result in an empty clipboard. Call suppressWarnings() to suppress this warning."),function(e){return F(e.types,(function(t){return oe(e,t)}))}(e[0]).then((e=>{if(!Y(e))throw new Error("write() failed")}))}))},writeText:function(e){return K((()=>O?(b("Using `navigator.clipboard.writeText()`."),O(e).catch(Q)):B.resolve(Q(e))))}});class ce extends Error{static create(){return new ce("The given site selection object is invalid.")}}class le{constructor(e,t,r){this.site=e,this.language=t,this.group=r}static fromJson(e){const t=JSON.parse(e);if("object"!=typeof t)throw ce.create();if(!("site"in t))throw ce.create();return new le(t.site,t.language??null,t.group??null)}getSiteIdentifier(){return this.site}getLanguageId(){return this.language}getGroupName(){return this.group}isWithinGroup(){return null!==this.group}isGroupRoot(){return this.isWithinGroup()&&null===this.language}isGroupItem(){return this.isWithinGroup()&&null!==this.language}}!function(e){e.form=".tx-warming-sites-modal",e.siteCheckbox=".tx-warming-sites-group-selector > input",e.siteCheckboxAll=".tx-warming-sites-group-selector > input[data-select-all]",e.useragentCopy="button.tx-warming-user-agent-copy-action",e.useragentCopyIcon="button.tx-warming-user-agent-copy-action .t3js-icon",e.useragentCopyText=".tx-warming-user-agent-copy-text"}(ie||(ie={})),function(e){e.startButton="tx-warming-start-warmup"}(ae||(ae={}));let ue=class extends s{constructor(){super(),this.cacheWarmer=new o,this.modal=l.currentModal}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.initializeSites()}initializeSites(){const e=this.modal.querySelector(".modal-footer");e.classList.add("tx-warming-modal-footer","visually-hidden"),new t("submit",(e=>(e.preventDefault(),this.performCacheWarmup(),!1))).bindTo(this._form),this._checkboxes.forEach((r=>{new t("input",(t=>{e.classList.remove("visually-hidden"),this.toggleInputs(t.target)})).bindTo(r)})),new t("click",(e=>{e.preventDefault(),e.stopImmediatePropagation();const t=e.currentTarget.dataset.text;t&&this.copyUserAgentToClipboard(t)})).bindTo(this._useragentCopyButton)}performCacheWarmup(){if(!this.areSitesSelected())return void u.warning(TYPO3.lang[i.notificationNoSitesSelectedTitle],TYPO3.lang[i.notificationNoSitesSelectedMessage],15);const{configuration:e,sites:t}=this.parseFormValues();this.cacheWarmer.warmupCache(t,[],e)}parseFormValues(){const e=new FormData(this._form),t={},r={};for(const[n,o]of e)switch(n){case"site":try{const e=le.fromJson(o.toString()),t=e.getSiteIdentifier();if(e.isGroupRoot())continue;r[t]??(r[t]=[]),r[t].push(e.getLanguageId())}catch(e){}break;case"limit":t.limit=parseInt(o.toString());break;case"strategy":t.strategy=o.toString()}return{configuration:t,sites:r}}toggleInputs(e){if(e.dataset.selectAll)this.toggleAll(e.checked);else{const t=le.fromJson(e.value);t.isWithinGroup()&&this.toggleGroup(t,e),this.toggleSelectAll(e)}this.areSitesSelected()?this.getStartButton().classList.remove("disabled"):this.getStartButton().classList.add("disabled")}areSitesSelected(){let e=!1;return this._enabledCheckboxesWithoutGroupElements.forEach((t=>{if(t.checked)return e=!0,!1})),e}toggleGroup(e,t){let r=t.checked;null===e.getLanguageId()?this.getCheckboxesByGroup(e.getGroupName()).forEach((e=>{e.checked=r})):(r&&this.getCheckboxesByGroup(e.getGroupName()).forEach((e=>{if(e.id!==t.id&&!e.checked)return r=!1,!1})),this.getCheckboxGroupRoot(e.getGroupName()).checked=r)}toggleAll(e){this._enabledCheckboxes.forEach((t=>{t.checked=e}))}toggleSelectAll(e){let t=e.checked;t&&this._enabledCheckboxesWithoutGroupElements.forEach((r=>{if(r.id!==e.id&&!r.checked)return t=!1,!1})),this._selectAllCheckbox.checked=t}getCheckboxesByGroup(e){return this.renderRoot.querySelectorAll(`input[data-group="${e}"]:enabled`)}getCheckboxGroupRoot(e){return this.renderRoot.querySelector(`input[data-group-root="${e}"]:enabled`)}getStartButton(){return this.modal.querySelector(`button[name=${ae.startButton}]`)}copyUserAgentToClipboard(e){const t=this._useragentCopyIcon.cloneNode(!0);c.getIcon(a.spinner,c.sizes.small).then((e=>{this._useragentCopyIcon.innerHTML=e})),Promise.all([(navigator.clipboard??se).writeText(e),c.getIcon(a.check,c.sizes.small)]).then((async([,e])=>{const r=this._useragentCopyText.innerText;this._useragentCopyText.innerText=TYPO3.lang[i.modalSitesUserAgentActionSuccessful],this._useragentCopyIcon.innerHTML=e,window.setTimeout((()=>{this._useragentCopyIcon.innerHTML=t.innerHTML,this._useragentCopyText.innerText=r,this._useragentCopyButton.blur()}),3e3)}),(()=>{this._useragentCopyIcon.innerHTML=t.innerHTML}))}static createModal(){const e=new URL(TYPO3.settings.ajaxUrls.tx_warming_fetch_sites,window.location.origin);l.dismiss(),l.advanced({type:l.types.ajax,content:e.toString(),title:TYPO3.lang[i.modalSitesTitle],size:l.sizes.medium,buttons:[{text:TYPO3.lang[i.modalSitesButtonStart],icon:a.rocket,btnClass:"btn-primary disabled",name:ae.startButton,trigger:()=>{l.currentModal.querySelector(ie.form).requestSubmit()}}]})}};var de;r([p(ie.form)],ue.prototype,"_form",void 0),r([p(ie.siteCheckboxAll)],ue.prototype,"_selectAllCheckbox",void 0),r([h(ie.siteCheckbox)],ue.prototype,"_checkboxes",void 0),r([h(ie.siteCheckbox+":enabled")],ue.prototype,"_enabledCheckboxes",void 0),r([h(ie.siteCheckbox+":enabled:not([data-select-all])")],ue.prototype,"_enabledCheckboxesWithoutGroupElements",void 0),r([p(ie.useragentCopy)],ue.prototype,"_useragentCopyButton",void 0),r([p(ie.useragentCopyIcon)],ue.prototype,"_useragentCopyIcon",void 0),r([p(ie.useragentCopyText)],ue.prototype,"_useragentCopyText",void 0),ue=r([n("warming-sites-modal")],ue),function(e){e.container="#eliashaeussler-typo3warming-backend-toolbaritems-cachewarmuptoolbaritem"}(de||(de={}));var pe=new class{constructor(){e.ready().then((()=>{new t("click",(()=>{ue.createModal()})).delegateTo(document,de.container)}))}};export{pe as default}; diff --git a/Resources/Public/JavaScript/cache-warmer.js b/Resources/Public/JavaScript/cache-warmer.js index b47e159d..f2e1f0a1 100644 --- a/Resources/Public/JavaScript/cache-warmer.js +++ b/Resources/Public/JavaScript/cache-warmer.js @@ -1,4 +1,4 @@ -import t from"@typo3/backend/action-button/immediate-action.js";import e from"@typo3/backend/notification.js";import r from"@typo3/core/ajax/ajax-request.js";import s from"@typo3/backend/modal.js";import{LitElement as i,html as o}from"lit";import n from"@typo3/core/event/regular-event.js";function a(t,e,r,s){var i,o=arguments.length,n=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,r,s);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(n=(o<3?i(n):o>3?i(e,r,n):i(e,r))||n);return o>3&&n&&Object.defineProperty(e,r,n),n}var l;"function"==typeof SuppressedError&&SuppressedError;const d=window,c=d.trustedTypes,u=c?c.createPolicy("lit-html",{createHTML:t=>t}):void 0,p="$lit$",h=`lit$${(Math.random()+"").slice(9)}$`,g="?"+h,m=`<${g}>`,f=document,v=()=>f.createComment(""),$=t=>null===t||"object"!=typeof t&&"function"!=typeof t,y=Array.isArray,b="[ \t\n\f\r]",w=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,A=/-->/g,_=/>/g,P=RegExp(`>|${b}(?:([^\\s"'>=/]+)(${b}*=${b}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),S=/'/g,x=/"/g,N=/^(?:script|style|textarea|title)$/i,R=Symbol.for("lit-noChange"),T=Symbol.for("lit-nothing"),O=new WeakMap,U=f.createTreeWalker(f,129,null,!1);function E(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==u?u.createHTML(e):e}const C=(t,e)=>{const r=t.length-1,s=[];let i,o=2===e?"":"",n=w;for(let e=0;e"===l[0]?(n=null!=i?i:w,d=-1):void 0===l[1]?d=-2:(d=n.lastIndex-l[2].length,a=l[1],n=void 0===l[3]?P:'"'===l[3]?x:S):n===x||n===S?n=P:n===A||n===_?n=w:(n=P,i=void 0);const u=n===P&&t[e+1].startsWith("/>")?" ":"";o+=n===w?r+m:d>=0?(s.push(a),r.slice(0,d)+p+r.slice(d)+h+u):r+h+(-2===d?(s.push(void 0),e):u)}return[E(t,o+(t[r]||"")+(2===e?"":"")),s]};class M{constructor({strings:t,_$litType$:e},r){let s;this.parts=[];let i=0,o=0;const n=t.length-1,a=this.parts,[l,d]=C(t,e);if(this.el=M.createElement(l,r),U.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(s=U.nextNode())&&a.length0){s.textContent=c?c.emptyScript:"";for(let r=0;ry(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==T&&$(this._$AH)?this._$AA.nextSibling.data=t:this.$(f.createTextNode(t)),this._$AH=t}g(t){var e;const{values:r,_$litType$:s}=t,i="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=M.createElement(E(s.h,s.h[0]),this.options)),s);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===i)this._$AH.v(r);else{const t=new H(i,this),e=t.u(this.options);t.v(r),this.$(e),this._$AH=t}}_$AC(t){let e=O.get(t.strings);return void 0===e&&O.set(t.strings,e=new M(t)),e}T(t){y(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let r,s=0;for(const i of t)s===e.length?e.push(r=new j(this.k(v()),this.k(v()),this,this.options)):r=e[s],r._$AI(i),s++;s2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=T}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,r,s){const i=this.strings;let o=!1;if(void 0===i)t=k(this,t,e,0),o=!$(t)||t!==this._$AH&&t!==R,o&&(this._$AH=t);else{const s=t;let n,a;for(t=i[0],n=0;n(...e)=>({_$litDirective$:t,values:e});let Q=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,r){this._$Ct=t,this._$AM=e,this._$Ci=r}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};const J=V(class extends Q{constructor(t){var e;if(super(t),t.type!==z||"class"!==t.name||(null===(e=t.strings)||void 0===e?void 0:e.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return" "+Object.keys(t).filter((e=>t[e])).join(" ")+" "}update(t,[e]){var r,s;if(void 0===this.it){this.it=new Set,void 0!==t.strings&&(this.nt=new Set(t.strings.join(" ").split(/\s/).filter((t=>""!==t))));for(const t in e)e[t]&&!(null===(r=this.nt)||void 0===r?void 0:r.has(t))&&this.it.add(t);return this.render(e)}const i=t.element.classList;this.it.forEach((t=>{t in e||(i.remove(t),this.it.delete(t))}));for(const t in e){const r=!!e[t];r===this.it.has(t)||(null===(s=this.nt)||void 0===s?void 0:s.has(t))||(r?(i.add(t),this.it.add(t)):(i.remove(t),this.it.delete(t)))}return R}}),Z=t=>e=>"function"==typeof e?((t,e)=>(customElements.define(t,e),e))(t,e):((t,e)=>{const{kind:r,elements:s}=e;return{kind:r,elements:s,finisher(e){customElements.define(t,e)}}})(t,e),K=(t,e)=>"method"===e.kind&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(r){r.createProperty(e.key,t)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){"function"==typeof e.initializer&&(this[e.key]=e.initializer.call(this))},finisher(r){r.createProperty(e.key,t)}};function G(t){return(e,r)=>void 0!==r?((t,e,r)=>{e.constructor.createProperty(r,t)})(t,e,r):K(t,e)}var X;null===(X=window.HTMLSlotElement)||void 0===X||X.prototype.assignedElements;const tt="important",et=" !"+tt,rt=V(class extends Q{constructor(t){var e;if(super(t),t.type!==z||"style"!==t.name||(null===(e=t.strings)||void 0===e?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(t){return Object.keys(t).reduce(((e,r)=>{const s=t[r];return null==s?e:e+`${r=r.includes("-")?r:r.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${s};`}),"")}update(t,[e]){const{style:r}=t.element;if(void 0===this.ht){this.ht=new Set;for(const t in e)this.ht.add(t);return this.render(e)}this.ht.forEach((t=>{null==e[t]&&(this.ht.delete(t),t.includes("-")?r.removeProperty(t):r[t]="")}));for(const t in e){const s=e[t];if(null!=s){this.ht.add(t);const e="string"==typeof s&&s.endsWith(et);t.includes("-")||e?r.setProperty(t,e?s.slice(0,-11):s,e?tt:""):r[t]=s}}return R}});class st extends Q{constructor(t){if(super(t),this.et=T,t.type!==D)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===T||null==t)return this.ft=void 0,this.et=t;if(t===R)return t;if("string"!=typeof t)throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.et)return this.ft;this.et=t;const e=[t];return e.raw=e,this.ft={_$litType$:this.constructor.resultType,strings:e,values:[]}}}st.directiveName="unsafeHTML",st.resultType=1;const it=V(st);var ot,nt;let at;!function(t){t.approved="overlay-approved",t.check="actions-check",t.exclamationCircle="actions-exclamation-circle-alt",t.info="actions-info",t.listAlternative="actions-list-alternative",t.readonly="overlay-readonly",t.refresh="actions-refresh",t.rocket="actions-rocket",t.spinner="spinner-circle",t.viewPage="actions-view-page",t.warning="overlay-warning"}(ot||(ot={})),function(t){t.notificationShowReport="warming.notification.action.showReport",t.notificationActionRetry="warming.notification.action.retry",t.notificationAbortedTitle="warming.notification.aborted.title",t.notificationAbortedMessage="warming.notification.aborted.message",t.notificationErrorTitle="warming.notification.error.title",t.notificationErrorMessage="warming.notification.error.message",t.notificationNoSitesSelectedTitle="warming.notification.noSitesSelected.title",t.notificationNoSitesSelectedMessage="warming.notification.noSitesSelected.message",t.modalProgressTitle="warming.modal.progress.title",t.modalProgressButtonReport="warming.modal.progress.button.report",t.modalProgressButtonRetry="warming.modal.progress.button.retry",t.modalProgressButtonClose="warming.modal.progress.button.close",t.modalProgressFailedCounter="warming.modal.progress.failedCounter",t.modalProgressAllCounter="warming.modal.progress.allCounter",t.modalProgressPlaceholder="warming.modal.progress.placeholder",t.modalReportTitle="warming.modal.report.title",t.modalReportPanelFailed="warming.modal.report.panel.failed",t.modalReportPanelFailedSummary="warming.modal.report.panel.failed.summary",t.modalReportPanelSuccessful="warming.modal.report.panel.successful",t.modalReportPanelSuccessfulSummary="warming.modal.report.panel.successful.summary",t.modalReportPanelExcluded="warming.modal.report.panel.excluded",t.modalReportPanelExcludedSummary="warming.modal.report.panel.excluded.summary",t.modalReportPanelExcludedSitemaps="warming.modal.report.panel.excluded.sitemaps",t.modalReportPanelExcludedUrls="warming.modal.report.panel.excluded.urls",t.modalReportActionView="warming.modal.report.action.view",t.modalReportRequestId="warming.modal.report.message.requestId",t.modalReportTotal="warming.modal.report.message.total",t.modalReportNoUrlsCrawled="warming.modal.report.message.noUrlsCrawled",t.modalSitesTitle="warming.modal.sites.title",t.modalSitesUserAgentActionSuccessful="warming.modal.sites.userAgent.action.successful",t.modalSitesButtonStart="warming.modal.sites.button.start"}(nt||(nt={}));const lt=new Uint8Array(16);function dt(){if(!at&&(at="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!at))throw new Error("crypto.getRandomValues() not supported. See /~https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return at(lt)}const ct=[];for(let t=0;t<256;++t)ct.push((t+256).toString(16).slice(1));var ut={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function pt(t,e,r){if(ut.randomUUID&&!e&&!t)return ut.randomUUID();const s=(t=t||{}).random||(t.rng||dt)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,e){r=r||0;for(let t=0;t<16;++t)e[r+t]=s[t];return e}return function(t,e=0){return ct[t[e+0]]+ct[t[e+1]]+ct[t[e+2]]+ct[t[e+3]]+"-"+ct[t[e+4]]+ct[t[e+5]]+"-"+ct[t[e+6]]+ct[t[e+7]]+"-"+ct[t[e+8]]+ct[t[e+9]]+"-"+ct[t[e+10]]+ct[t[e+11]]+ct[t[e+12]]+ct[t[e+13]]+ct[t[e+14]]+ct[t[e+15]]}(s)}class ht{static formatString(t,...e){return e.reduce(((t,e,r)=>t.replace(new RegExp(`\\{${r}}`),e)),t)}static generateUniqueId(){return pt()}}let gt=class extends i{constructor(){super(),this.id=`tx-warming-report-panel-${ht.generateUniqueId()}`}createRenderRoot(){return this}render(){return o` +import t from"@typo3/backend/action-button/immediate-action.js";import e from"@typo3/backend/notification.js";import s from"@typo3/core/ajax/ajax-request.js";import r from"@typo3/backend/modal.js";import{LitElement as i,html as o}from"lit";import n from"@typo3/core/event/regular-event.js";function a(t,e,s,r){var i,o=arguments.length,n=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,s,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(n=(o<3?i(n):o>3?i(e,s,n):i(e,s))||n);return o>3&&n&&Object.defineProperty(e,s,n),n}"function"==typeof SuppressedError&&SuppressedError;const l=globalThis,c=l.trustedTypes,d=c?c.createPolicy("lit-html",{createHTML:t=>t}):void 0,h="$lit$",u=`lit$${(Math.random()+"").slice(9)}$`,p="?"+u,g=`<${p}>`,m=document,f=()=>m.createComment(""),$=t=>null===t||"object"!=typeof t&&"function"!=typeof t,y=Array.isArray,b="[ \t\n\f\r]",v=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,w=/-->/g,_=/>/g,A=RegExp(`>|${b}(?:([^\\s"'>=/]+)(${b}*=${b}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),S=/'/g,P=/"/g,E=/^(?:script|style|textarea|title)$/i,x=Symbol.for("lit-noChange"),U=Symbol.for("lit-nothing"),O=new WeakMap,R=m.createTreeWalker(m,129);function N(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==d?d.createHTML(e):e}const T=(t,e)=>{const s=t.length-1,r=[];let i,o=2===e?"":"",n=v;for(let e=0;e"===l[0]?(n=i??v,c=-1):void 0===l[1]?c=-2:(c=n.lastIndex-l[2].length,a=l[1],n=void 0===l[3]?A:'"'===l[3]?P:S):n===P||n===S?n=A:n===w||n===_?n=v:(n=A,i=void 0);const p=n===A&&t[e+1].startsWith("/>")?" ":"";o+=n===v?s+g:c>=0?(r.push(a),s.slice(0,c)+h+s.slice(c)+u+p):s+u+(-2===c?e:p)}return[N(t,o+(t[s]||"")+(2===e?"":"")),r]};class C{constructor({strings:t,_$litType$:e},s){let r;this.parts=[];let i=0,o=0;const n=t.length-1,a=this.parts,[l,d]=T(t,e);if(this.el=C.createElement(l,s),R.currentNode=this.el.content,2===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(r=R.nextNode())&&a.length0){r.textContent=c?c.emptyScript:"";for(let s=0;sy(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==U&&$(this._$AH)?this._$AA.nextSibling.data=t:this.$(m.createTextNode(t)),this._$AH=t}g(t){const{values:e,_$litType$:s}=t,r="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=C.createElement(N(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===r)this._$AH.p(e);else{const t=new k(r,this),s=t.u(this.options);t.p(e),this.$(s),this._$AH=t}}_$AC(t){let e=O.get(t.strings);return void 0===e&&O.set(t.strings,e=new C(t)),e}T(t){y(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,r=0;for(const i of t)r===e.length?e.push(s=new j(this.k(f()),this.k(f()),this,this.options)):s=e[r],s._$AI(i),r++;r2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=U}_$AI(t,e=this,s,r){const i=this.strings;let o=!1;if(void 0===i)t=M(this,t,e,0),o=!$(t)||t!==this._$AH&&t!==x,o&&(this._$AH=t);else{const r=t;let n,a;for(t=i[0],n=0;n(...e)=>({_$litDirective$:t,values:e});let D=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,s){this._$Ct=t,this._$AM=e,this._$Ci=s}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};const V=z(class extends D{constructor(t){if(super(t),t.type!==F||"class"!==t.name||t.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return" "+Object.keys(t).filter((e=>t[e])).join(" ")+" "}update(t,[e]){if(void 0===this.it){this.it=new Set,void 0!==t.strings&&(this.st=new Set(t.strings.join(" ").split(/\s/).filter((t=>""!==t))));for(const t in e)e[t]&&!this.st?.has(t)&&this.it.add(t);return this.render(e)}const s=t.element.classList;for(const t of this.it)t in e||(s.remove(t),this.it.delete(t));for(const t in e){const r=!!e[t];r===this.it.has(t)||this.st?.has(t)||(r?(s.add(t),this.it.add(t)):(s.remove(t),this.it.delete(t)))}return x}}),J=t=>(e,s)=>{void 0!==s?s.addInitializer((()=>{customElements.define(t,e)})):customElements.define(t,e)},Q=globalThis,Z=Q.ShadowRoot&&(void 0===Q.ShadyCSS||Q.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,K=Symbol(),G=new WeakMap;let X=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==K)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(Z&&void 0===t){const s=void 0!==e&&1===e.length;s&&(t=G.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&G.set(e,t))}return t}toString(){return this.cssText}};const tt=(t,e)=>{if(Z)t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const s of e){const e=document.createElement("style"),r=Q.litNonce;void 0!==r&&e.setAttribute("nonce",r),e.textContent=s.cssText,t.appendChild(e)}},et=Z?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return(t=>new X("string"==typeof t?t:t+"",void 0,K))(e)})(t):t,{is:st,defineProperty:rt,getOwnPropertyDescriptor:it,getOwnPropertyNames:ot,getOwnPropertySymbols:nt,getPrototypeOf:at}=Object,lt=globalThis,ct=lt.trustedTypes,dt=ct?ct.emptyScript:"",ht=lt.reactiveElementPolyfillSupport,ut=(t,e)=>t,pt={toAttribute(t,e){switch(e){case Boolean:t=t?dt:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let s=t;switch(e){case Boolean:s=null!==t;break;case Number:s=null===t?null:Number(t);break;case Object:case Array:try{s=JSON.parse(t)}catch(t){s=null}}return s}},gt=(t,e)=>!st(t,e),mt={attribute:!0,type:String,converter:pt,reflect:!1,hasChanged:gt};Symbol.metadata??=Symbol("metadata"),lt.litPropertyMetadata??=new WeakMap;class ft extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=mt){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const s=Symbol(),r=this.getPropertyDescriptor(t,s,e);void 0!==r&&rt(this.prototype,t,r)}}static getPropertyDescriptor(t,e,s){const{get:r,set:i}=it(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get(){return r?.call(this)},set(e){const o=r?.call(this);i.call(this,e),this.requestUpdate(t,o,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??mt}static _$Ei(){if(this.hasOwnProperty(ut("elementProperties")))return;const t=at(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(ut("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(ut("properties"))){const t=this.properties,e=[...ot(t),...nt(t)];for(const s of e)this.createProperty(s,t[s])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,s]of e)this.elementProperties.set(t,s)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const s=this._$Eu(t,e);void 0!==s&&this._$Eh.set(s,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const t of s)e.unshift(et(t))}else void 0!==t&&e.push(et(t));return e}static _$Eu(t,e){const s=e.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$Eg=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$ES??=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$ES?.splice(this._$ES.indexOf(t)>>>0,1)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return tt(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$ES?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$ES?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$EO(t,e){const s=this.constructor.elementProperties.get(t),r=this.constructor._$Eu(t,s);if(void 0!==r&&!0===s.reflect){const i=(void 0!==s.converter?.toAttribute?s.converter:pt).toAttribute(e,s.type);this._$Em=t,null==i?this.removeAttribute(r):this.setAttribute(r,i),this._$Em=null}}_$AK(t,e){const s=this.constructor,r=s._$Eh.get(t);if(void 0!==r&&this._$Em!==r){const t=s.getPropertyOptions(r),i="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:pt;this._$Em=r,this[r]=i.fromAttribute(e,t.type),this._$Em=null}}requestUpdate(t,e,s,r=!1,i){if(void 0!==t){if(s??=this.constructor.getPropertyOptions(t),!(s.hasChanged??gt)(r?i:this[t],e))return;this.C(t,e,s)}!1===this.isUpdatePending&&(this._$Eg=this._$EP())}C(t,e,s){this._$AL.has(t)||this._$AL.set(t,e),!0===s.reflect&&this._$Em!==t&&(this._$Ej??=new Set).add(t)}async _$EP(){this.isUpdatePending=!0;try{await this._$Eg}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,s]of t)!0!==s.wrapped||this._$AL.has(e)||void 0===this[e]||this.C(e,this[e],s)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$ES?.forEach((t=>t.hostUpdate?.())),this.update(e)):this._$ET()}catch(e){throw t=!1,this._$ET(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$ES?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$ET(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Eg}shouldUpdate(t){return!0}update(t){this._$Ej&&=this._$Ej.forEach((t=>this._$EO(t,this[t]))),this._$ET()}updated(t){}firstUpdated(t){}}ft.elementStyles=[],ft.shadowRootOptions={mode:"open"},ft[ut("elementProperties")]=new Map,ft[ut("finalized")]=new Map,ht?.({ReactiveElement:ft}),(lt.reactiveElementVersions??=[]).push("2.0.0");const $t={attribute:!0,type:String,converter:pt,reflect:!1,hasChanged:gt},yt=(t=$t,e,s)=>{const{kind:r,metadata:i}=s;let o=globalThis.litPropertyMetadata.get(i);if(void 0===o&&globalThis.litPropertyMetadata.set(i,o=new Map),o.set(s.name,t),"accessor"===r){const{name:r}=s;return{set(s){const i=e.get.call(this);e.set.call(this,s),this.requestUpdate(r,i,t)},init(e){return void 0!==e&&this.C(r,void 0,t),e}}}if("setter"===r){const{name:r}=s;return function(s){const i=this[r];e.call(this,s),this.requestUpdate(r,i,t)}}throw Error("Unsupported decorator location: "+r)};function bt(t){return(e,s)=>"object"==typeof s?yt(t,e,s):((t,e,s)=>{const r=e.hasOwnProperty(s);return e.constructor.createProperty(s,r?{...t,wrapped:!0}:t),r?Object.getOwnPropertyDescriptor(e,s):void 0})(t,e,s)}const vt="important",wt=" !"+vt,_t=z(class extends D{constructor(t){if(super(t),t.type!==F||"style"!==t.name||t.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(t){return Object.keys(t).reduce(((e,s)=>{const r=t[s];return null==r?e:e+`${s=s.includes("-")?s:s.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${r};`}),"")}update(t,[e]){const{style:s}=t.element;if(void 0===this.ut)return this.ut=new Set(Object.keys(e)),this.render(e);for(const t of this.ut)null==e[t]&&(this.ut.delete(t),t.includes("-")?s.removeProperty(t):s[t]=null);for(const t in e){const r=e[t];if(null!=r){this.ut.add(t);const e="string"==typeof r&&r.endsWith(wt);t.includes("-")||e?s.setProperty(t,e?r.slice(0,-11):r,e?vt:""):s[t]=r}}return x}});class At extends D{constructor(t){if(super(t),this.et=U,t.type!==W)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===U||null==t)return this.vt=void 0,this.et=t;if(t===x)return t;if("string"!=typeof t)throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.et)return this.vt;this.et=t;const e=[t];return e.raw=e,this.vt={_$litType$:this.constructor.resultType,strings:e,values:[]}}}At.directiveName="unsafeHTML",At.resultType=1;const St=z(At);var Pt,Et;let xt;!function(t){t.approved="overlay-approved",t.check="actions-check",t.exclamationCircle="actions-exclamation-circle-alt",t.info="actions-info",t.listAlternative="actions-list-alternative",t.readonly="overlay-readonly",t.refresh="actions-refresh",t.rocket="actions-rocket",t.spinner="spinner-circle",t.viewPage="actions-view-page",t.warning="overlay-warning"}(Pt||(Pt={})),function(t){t.notificationShowReport="warming.notification.action.showReport",t.notificationActionRetry="warming.notification.action.retry",t.notificationAbortedTitle="warming.notification.aborted.title",t.notificationAbortedMessage="warming.notification.aborted.message",t.notificationErrorTitle="warming.notification.error.title",t.notificationErrorMessage="warming.notification.error.message",t.notificationNoSitesSelectedTitle="warming.notification.noSitesSelected.title",t.notificationNoSitesSelectedMessage="warming.notification.noSitesSelected.message",t.modalProgressTitle="warming.modal.progress.title",t.modalProgressButtonReport="warming.modal.progress.button.report",t.modalProgressButtonRetry="warming.modal.progress.button.retry",t.modalProgressButtonClose="warming.modal.progress.button.close",t.modalProgressFailedCounter="warming.modal.progress.failedCounter",t.modalProgressAllCounter="warming.modal.progress.allCounter",t.modalProgressPlaceholder="warming.modal.progress.placeholder",t.modalReportTitle="warming.modal.report.title",t.modalReportPanelFailed="warming.modal.report.panel.failed",t.modalReportPanelFailedSummary="warming.modal.report.panel.failed.summary",t.modalReportPanelSuccessful="warming.modal.report.panel.successful",t.modalReportPanelSuccessfulSummary="warming.modal.report.panel.successful.summary",t.modalReportPanelExcluded="warming.modal.report.panel.excluded",t.modalReportPanelExcludedSummary="warming.modal.report.panel.excluded.summary",t.modalReportPanelExcludedSitemaps="warming.modal.report.panel.excluded.sitemaps",t.modalReportPanelExcludedUrls="warming.modal.report.panel.excluded.urls",t.modalReportActionView="warming.modal.report.action.view",t.modalReportRequestId="warming.modal.report.message.requestId",t.modalReportTotal="warming.modal.report.message.total",t.modalReportNoUrlsCrawled="warming.modal.report.message.noUrlsCrawled",t.modalSitesTitle="warming.modal.sites.title",t.modalSitesUserAgentActionSuccessful="warming.modal.sites.userAgent.action.successful",t.modalSitesButtonStart="warming.modal.sites.button.start"}(Et||(Et={}));const Ut=new Uint8Array(16);function Ot(){if(!xt&&(xt="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!xt))throw new Error("crypto.getRandomValues() not supported. See /~https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return xt(Ut)}const Rt=[];for(let t=0;t<256;++t)Rt.push((t+256).toString(16).slice(1));var Nt={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Tt(t,e,s){if(Nt.randomUUID&&!e&&!t)return Nt.randomUUID();const r=(t=t||{}).random||(t.rng||Ot)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,e){s=s||0;for(let t=0;t<16;++t)e[s+t]=r[t];return e}return function(t,e=0){return Rt[t[e+0]]+Rt[t[e+1]]+Rt[t[e+2]]+Rt[t[e+3]]+"-"+Rt[t[e+4]]+Rt[t[e+5]]+"-"+Rt[t[e+6]]+Rt[t[e+7]]+"-"+Rt[t[e+8]]+Rt[t[e+9]]+"-"+Rt[t[e+10]]+Rt[t[e+11]]+Rt[t[e+12]]+Rt[t[e+13]]+Rt[t[e+14]]+Rt[t[e+15]]}(r)}class Ct{static formatString(t,...e){return e.reduce(((t,e,s)=>t.replace(new RegExp(`\\{${s}}`),e)),t)}static generateUniqueId(){return Tt()}}let Mt=class extends i{constructor(){super(),this.id=`tx-warming-report-panel-${Ct.generateUniqueId()}`}createRenderRoot(){return this}render(){return o`

@@ -24,7 +24,7 @@ import t from"@typo3/backend/action-button/immediate-action.js";import e from"@t @@ -35,7 +35,7 @@ import t from"@typo3/backend/action-button/immediate-action.js";import e from"@t

- `}};a([G({type:String})],gt.prototype,"title",void 0),a([G({type:String})],gt.prototype,"state",void 0),a([G({type:Array})],gt.prototype,"urls",void 0),a([G({attribute:!1})],gt.prototype,"id",void 0),gt=a([Z("warming-report-panel")],gt);let mt=class extends i{constructor(){super(...arguments),this.totalNumber=null}createRenderRoot(){return this}render(){return o` + `}};a([bt({type:String})],Mt.prototype,"title",void 0),a([bt({type:String})],Mt.prototype,"state",void 0),a([bt({type:Array})],Mt.prototype,"urls",void 0),a([bt({attribute:!1})],Mt.prototype,"id",void 0),Mt=a([J("warming-report-panel")],Mt);let kt=class extends i{constructor(){super(...arguments),this.totalNumber=null}createRenderRoot(){return this}render(){return o`
@@ -50,13 +50,13 @@ import t from"@typo3/backend/action-button/immediate-action.js";import e from"@t

${this.body}

- `}};var ft;a([G({type:String})],mt.prototype,"title",void 0),a([G({type:String})],mt.prototype,"body",void 0),a([G({type:String})],mt.prototype,"state",void 0),a([G({type:String})],mt.prototype,"icon",void 0),a([G({type:Number})],mt.prototype,"currentNumber",void 0),a([G({type:Number})],mt.prototype,"totalNumber",void 0),mt=a([Z("warming-report-summary-card")],mt);let vt=ft=class extends i{constructor(t){super(),this.progress=t}createRenderRoot(){return this}render(){if(0===this.progress.getTotalNumberOfCrawledUrls())return this.createEmptyCrawlingNotice();const t=this.progress.getNumberOfExcludedSitemaps()+this.progress.getNumberOfExcludedUrls();return o` + `}};var jt;a([bt({type:String})],kt.prototype,"title",void 0),a([bt({type:String})],kt.prototype,"body",void 0),a([bt({type:String})],kt.prototype,"state",void 0),a([bt({type:String})],kt.prototype,"icon",void 0),a([bt({type:Number})],kt.prototype,"currentNumber",void 0),a([bt({type:Number})],kt.prototype,"totalNumber",void 0),kt=a([J("warming-report-summary-card")],kt);let Ht=jt=class extends i{constructor(t){super(),this.progress=t}createRenderRoot(){return this}render(){if(0===this.progress.getTotalNumberOfCrawledUrls())return this.createEmptyCrawlingNotice();const t=this.progress.getNumberOfExcludedSitemaps()+this.progress.getNumberOfExcludedUrls();return o`
${this.progress.getNumberOfFailedUrls()>0?o` 0?o` 0?o` ${this.progress.getNumberOfFailedUrls()>0?o` @@ -99,7 +99,7 @@ import t from"@typo3/backend/action-button/immediate-action.js";import e from"@t ${this.progress.getNumberOfSuccessfulUrls()>0?o` @@ -107,7 +107,7 @@ import t from"@typo3/backend/action-button/immediate-action.js";import e from"@t ${this.progress.getNumberOfExcludedSitemaps()>0?o` @@ -115,7 +115,7 @@ import t from"@typo3/backend/action-button/immediate-action.js";import e from"@t ${this.progress.getNumberOfExcludedUrls()>0?o` @@ -123,46 +123,46 @@ import t from"@typo3/backend/action-button/immediate-action.js";import e from"@t
- ${TYPO3.lang[nt.modalReportRequestId]} ${this.progress.requestId}${this.progress.requestId} `}createEmptyCrawlingNotice(){return o`
- +
- ${TYPO3.lang[nt.modalReportNoUrlsCrawled]} + ${TYPO3.lang[Et.modalReportNoUrlsCrawled]}
- `}static createModal(t,e){s.dismiss();const r=[{text:TYPO3.lang[nt.modalProgressButtonRetry],icon:ot.refresh,btnClass:"btn-default",trigger:e},{text:TYPO3.lang[nt.modalProgressButtonClose],btnClass:"btn-default",trigger:()=>s.dismiss()}];t.progress.current>0&&r.unshift({text:`${TYPO3.lang[nt.modalReportTotal]} ${t.progress.current}`,icon:ot.exclamationCircle,btnClass:"disabled border-0"}),s.advanced({title:TYPO3.lang[nt.modalReportTitle],content:new ft(t),size:s.sizes.large,buttons:r})}};var $t,yt,bt;vt=ft=a([Z("warming-report-modal")],vt),function(t){t.Failed="failed",t.Warning="warning",t.Success="success",t.Aborted="aborted",t.Unknown="unknown"}($t||($t={})),function(t){t.reportButton="tx-warming-open-report",t.retryButton="tx-warming-retry"}(bt||(bt={}));let wt=yt=class extends i{constructor(t){super(),this.progress=t,this.modal=s.currentModal}createRenderRoot(){return this}render(){const t=this.progress.progress.current>0,e=this.progress.getNumberOfFailedUrls(),r=this.progress.getProgressInPercent(),s={"progress-bar":!0,"progress-bar-striped":!0,active:t&&!this.progress.isFinished(),"progress-bar-animated":t&&!this.progress.isFinished(),"bg-danger":e>0&&this.progress.isFinished(),"bg-success":0===e&&this.progress.isFinished(),"progress-bar-danger":e>0&&this.progress.isFinished(),"progress-bar-success":0===e&&this.progress.isFinished(),"bg-warning":e>0,"progress-bar-warning":e>0&&!this.progress.isFinished()},i={width:`${t?r:0}%`};return o` + `}static createModal(t,e){r.dismiss();const s=[{text:TYPO3.lang[Et.modalProgressButtonRetry],icon:Pt.refresh,btnClass:"btn-default",trigger:e},{text:TYPO3.lang[Et.modalProgressButtonClose],btnClass:"btn-default",trigger:()=>r.dismiss()}];t.progress.current>0&&s.unshift({text:`${TYPO3.lang[Et.modalReportTotal]} ${t.progress.current}`,icon:Pt.exclamationCircle,btnClass:"disabled border-0"}),r.advanced({title:TYPO3.lang[Et.modalReportTitle],content:new jt(t),size:r.sizes.large,buttons:s})}};var qt,It,Yt;Ht=jt=a([J("warming-report-modal")],Ht),function(t){t.Failed="failed",t.Warning="warning",t.Success="success",t.Aborted="aborted",t.Unknown="unknown"}(qt||(qt={})),function(t){t.reportButton="tx-warming-open-report",t.retryButton="tx-warming-retry"}(Yt||(Yt={}));let Lt=It=class extends i{constructor(t){super(),this.progress=t,this.modal=r.currentModal}createRenderRoot(){return this}render(){const t=this.progress.progress.current>0,e=this.progress.getNumberOfFailedUrls(),s=this.progress.getProgressInPercent(),r={"progress-bar":!0,"progress-bar-striped":!0,active:t&&!this.progress.isFinished(),"progress-bar-animated":t&&!this.progress.isFinished(),"bg-danger":e>0&&this.progress.isFinished(),"bg-success":0===e&&this.progress.isFinished(),"progress-bar-danger":e>0&&this.progress.isFinished(),"progress-bar-success":0===e&&this.progress.isFinished(),"bg-warning":e>0,"progress-bar-warning":e>0&&!this.progress.isFinished()},i={width:`${t?s:0}%`};return o`
-
- ${t?`${r.toFixed(2)}%`:""} + ${t?`${s.toFixed(2)}%`:""}
${t?"":o`
- ${TYPO3.lang[nt.modalProgressPlaceholder]} + ${TYPO3.lang[Et.modalProgressPlaceholder]}
`}
- ${it(ht.formatString(TYPO3.lang[nt.modalProgressAllCounter],this.progress.progress.current.toString(),this.progress.progress.total.toString()))} + ${St(Ct.formatString(TYPO3.lang[Et.modalProgressAllCounter],this.progress.progress.current.toString(),this.progress.progress.total.toString()))}
${e>0?o`
- ${ht.formatString(TYPO3.lang[nt.modalProgressFailedCounter],e.toString())} + ${Ct.formatString(TYPO3.lang[Et.modalProgressFailedCounter],e.toString())}
`:""}
@@ -172,4 +172,4 @@ import t from"@typo3/backend/action-button/immediate-action.js";import e from"@t
`}
- `}finishProgress(t,e){const r=this.getReportButton();if(r.classList.remove("hidden"),new n("click",(()=>{vt.createModal(t,e)})).bindTo(r),t.state!==$t.Aborted){const t=this.getRetryButton();t.classList.remove("hidden"),new n("click",e).bindTo(t)}}getModal(){return this.modal}getFooter(){return this.modal.querySelector(".modal-footer")}getReportButton(){return this.getFooter().querySelector(`button[name=${bt.reportButton}]`)}getRetryButton(){return this.getFooter().querySelector(`button[name=${bt.retryButton}]`)}static createModal(t){const e=new yt(t);return s.dismiss(),e.modal=s.advanced({title:TYPO3.lang[nt.modalProgressTitle],content:e,size:s.sizes.small,staticBackdrop:!0,buttons:[{text:TYPO3.lang[nt.modalProgressButtonReport],icon:ot.listAlternative,btnClass:"btn-primary hidden",name:bt.reportButton},{text:TYPO3.lang[nt.modalProgressButtonRetry],icon:ot.refresh,btnClass:"btn-default hidden",name:bt.retryButton},{text:TYPO3.lang[nt.modalProgressButtonClose],btnClass:"btn-default",trigger:()=>s.dismiss()}]}),e}};a([G({attribute:!1,type:Object,hasChanged:()=>!0})],wt.prototype,"progress",void 0),a([G({attribute:!1})],wt.prototype,"modal",void 0),wt=yt=a([Z("warming-progress-modal")],wt);class At{static mergeUrlWithQueryParams(t,e){for(const[r,s]of e.entries())t.searchParams.append(r,s);return t}}class _t{constructor(t){this.requestId=t,this.state=$t.Unknown,this.progress={current:0,total:0},this.urls={current:"",failed:[],successful:[]},this.excluded={sitemaps:[],urls:[]},this.response={title:"",message:""}}update(t){return t.state&&Object.values($t).includes(t.state)&&(this.state=t.state),t.progress&&(this.progress=t.progress),t.urls&&(this.urls=t.urls),t.excluded&&(this.excluded=t.excluded),t.title&&(this.response.title=t.title),t.messages&&(this.response.message=t.messages.join("\n\n")),this}getCurrentUrl(){return this.urls.current}getNumberOfFailedUrls(){return this.urls.failed.length}getNumberOfSuccessfulUrls(){return this.urls.successful.length}getTotalNumberOfCrawledUrls(){return this.progress.total}getProgressInPercent(){return 0!==this.progress.total?Number(this.progress.current/this.progress.total*100):Number(100)}getNumberOfExcludedSitemaps(){return this.excluded.sitemaps.length}getNumberOfExcludedUrls(){return this.excluded.urls.length}isFinished(){return this.progress.current>=this.progress.total}}class Pt{startRequestWithQueryParams(t,e){return this.progress=new _t(t.get("requestId")),this.progressModal=wt.createModal(this.progress),this.request=new r(this.getUrl(t).toString()),this.progressModal.getModal().addEventListener("typo3-modal-hide",(()=>{this.abortWarmup()})),this.request.post({}).then((async t=>{const r=await t.resolve();return this.finishWarmup(r,e),this.progress})).catch((async t=>(this.reject(),await t.resolve(),this.progress)))}getUrl(t){const e=new URL(TYPO3.settings.ajaxUrls.tx_warming_cache_warmup_legacy,window.location.origin);return At.mergeUrlWithQueryParams(e,t)}cancelRequest(){this.request.abort()}finishWarmup(t,e){this.progress.update(t),this.progressModal.progress=this.progress,this.cancelRequest(),this.progressModal.finishProgress(this.progress,e)}abortWarmup(){this.cancelRequest(),this.progress.update({state:$t.Aborted})}reject(){this.cancelRequest(),s.dismiss()}}class St{startRequestWithQueryParams(t,e){return this.progress=new _t(t.get("requestId")),this.progressModal=wt.createModal(this.progress),this.source=new EventSource(this.getUrl(t).toString(),{withCredentials:!0}),new Promise(((t,r)=>{this.progressModal.getModal().addEventListener("typo3-modal-hide",(()=>{this.abortWarmup(),t(this.progress)})),this.source.addEventListener("warmupProgress",(t=>this.updateProgress(t)),!1),this.source.addEventListener("warmupFinished",(r=>{this.finishWarmup(r,e),t(this.progress)}),!1),this.source.addEventListener("message",(()=>this.reject(r)),!1),this.source.addEventListener("error",(()=>this.reject(r)),!1)}))}getUrl(t){const e=new URL(TYPO3.settings.ajaxUrls.tx_warming_cache_warmup,window.location.origin);return At.mergeUrlWithQueryParams(e,t)}static isSupported(){return!!window.EventSource}closeSource(){return this.source.close(),EventSource.CLOSED===this.source.readyState}updateProgress(t){const e=JSON.parse(t.data);this.progress.update(e),this.progressModal.progress=this.progress}finishWarmup(t,e){const r=JSON.parse(t.data);this.progress.update(r),this.closeSource(),this.progressModal.progress=this.progress,this.progressModal.finishProgress(this.progress,e)}abortWarmup(){this.closeSource(),this.progress.update({state:$t.Aborted})}reject(t){this.closeSource(),s.dismiss(),t()}}class xt{constructor(){this.handler=this.initializeRequestHandler()}warmupCache(e,r,s={}){const i=this.buildQueryParams(e,r,s),o=()=>this.warmupCache(e,r,s);return this.handler.startRequestWithQueryParams(i,o).then((e=>{let r;return e.state===$t.Aborted&&(r={label:TYPO3.lang[nt.notificationActionRetry],action:new t(o)}),xt.showNotification(e,o,r),e}),(t=>(xt.errorNotification(),t)))}initializeRequestHandler(){return St.isSupported()?new St:new Pt}buildQueryParams(t,e,r={}){const s=new URLSearchParams({requestId:ht.generateUniqueId()});let i=0,o=0;for(const[e,r]of Object.entries(t)){const t=i++;s.set(`sites[${t}][site]`,e),r.forEach(((e,r)=>s.set(`sites[${t}][languageIds][${r}]`,(e??0).toString())))}for(const[t,r]of Object.entries(e)){const e=o++;s.set(`pages[${e}][page]`,t.toString()),r.forEach(((t,r)=>s.set(`pages[${e}][languageIds][${r}]`,(t??0).toString())))}for(const[t,e]of Object.entries(r))s.set(`configuration[${t}]`,e.toString());return s}static showNotification(r,s,i){let{title:o,message:n}=r.response;const a=[{label:TYPO3.lang[nt.notificationShowReport],action:new t((()=>{vt.createModal(r,s)}))}];switch(i&&a.push(i),r.state){case $t.Failed:e.error(o,n,0,a);break;case $t.Warning:e.warning(o,n,0,a);break;case $t.Success:e.success(o,n,15,a);break;case $t.Aborted:o=TYPO3.lang[nt.notificationAbortedTitle],n=TYPO3.lang[nt.notificationAbortedMessage],e.info(o,n,15,a);break;case $t.Unknown:e.notice(o,n,15);break;default:xt.errorNotification()}}static errorNotification(){e.error(TYPO3.lang[nt.notificationErrorTitle],TYPO3.lang[nt.notificationErrorMessage])}}export{xt as C,ot as I,nt as L,a as _,Z as e}; + `}finishProgress(t,e){const s=this.getReportButton();if(s.classList.remove("hidden"),new n("click",(()=>{Ht.createModal(t,e)})).bindTo(s),t.state!==qt.Aborted){const t=this.getRetryButton();t.classList.remove("hidden"),new n("click",e).bindTo(t)}}getModal(){return this.modal}getFooter(){return this.modal.querySelector(".modal-footer")}getReportButton(){return this.getFooter().querySelector(`button[name=${Yt.reportButton}]`)}getRetryButton(){return this.getFooter().querySelector(`button[name=${Yt.retryButton}]`)}static createModal(t){const e=new It(t);return r.dismiss(),e.modal=r.advanced({title:TYPO3.lang[Et.modalProgressTitle],content:e,size:r.sizes.small,staticBackdrop:!0,buttons:[{text:TYPO3.lang[Et.modalProgressButtonReport],icon:Pt.listAlternative,btnClass:"btn-primary hidden",name:Yt.reportButton},{text:TYPO3.lang[Et.modalProgressButtonRetry],icon:Pt.refresh,btnClass:"btn-default hidden",name:Yt.retryButton},{text:TYPO3.lang[Et.modalProgressButtonClose],btnClass:"btn-default",trigger:()=>r.dismiss()}]}),e}};a([bt({attribute:!1,type:Object,hasChanged:()=>!0})],Lt.prototype,"progress",void 0),a([bt({attribute:!1})],Lt.prototype,"modal",void 0),Lt=It=a([J("warming-progress-modal")],Lt);class Bt{static mergeUrlWithQueryParams(t,e){for(const[s,r]of e.entries())t.searchParams.append(s,r);return t}}class Ft{constructor(t){this.requestId=t,this.state=qt.Unknown,this.progress={current:0,total:0},this.urls={current:"",failed:[],successful:[]},this.excluded={sitemaps:[],urls:[]},this.response={title:"",message:""}}update(t){return t.state&&Object.values(qt).includes(t.state)&&(this.state=t.state),t.progress&&(this.progress=t.progress),t.urls&&(this.urls=t.urls),t.excluded&&(this.excluded=t.excluded),t.title&&(this.response.title=t.title),t.messages&&(this.response.message=t.messages.join("\n\n")),this}getCurrentUrl(){return this.urls.current}getNumberOfFailedUrls(){return this.urls.failed.length}getNumberOfSuccessfulUrls(){return this.urls.successful.length}getTotalNumberOfCrawledUrls(){return this.progress.total}getProgressInPercent(){return 0!==this.progress.total?Number(this.progress.current/this.progress.total*100):Number(100)}getNumberOfExcludedSitemaps(){return this.excluded.sitemaps.length}getNumberOfExcludedUrls(){return this.excluded.urls.length}isFinished(){return this.progress.current>=this.progress.total}}class Wt{startRequestWithQueryParams(t,e){return this.progress=new Ft(t.get("requestId")),this.progressModal=Lt.createModal(this.progress),this.request=new s(this.getUrl(t).toString()),this.progressModal.getModal().addEventListener("typo3-modal-hide",(()=>{this.abortWarmup()})),this.request.post({}).then((async t=>{const s=await t.resolve();return this.finishWarmup(s,e),this.progress})).catch((async t=>(this.reject(),await t.resolve(),this.progress)))}getUrl(t){const e=new URL(TYPO3.settings.ajaxUrls.tx_warming_cache_warmup_legacy,window.location.origin);return Bt.mergeUrlWithQueryParams(e,t)}cancelRequest(){this.request.abort()}finishWarmup(t,e){this.progress.update(t),this.progressModal.progress=this.progress,this.cancelRequest(),this.progressModal.finishProgress(this.progress,e)}abortWarmup(){this.cancelRequest(),this.progress.update({state:qt.Aborted})}reject(){this.cancelRequest(),r.dismiss()}}class zt{startRequestWithQueryParams(t,e){return this.progress=new Ft(t.get("requestId")),this.progressModal=Lt.createModal(this.progress),this.source=new EventSource(this.getUrl(t).toString(),{withCredentials:!0}),new Promise(((t,s)=>{this.progressModal.getModal().addEventListener("typo3-modal-hide",(()=>{this.abortWarmup(),t(this.progress)})),this.source.addEventListener("warmupProgress",(t=>this.updateProgress(t)),!1),this.source.addEventListener("warmupFinished",(s=>{this.finishWarmup(s,e),t(this.progress)}),!1),this.source.addEventListener("message",(()=>this.reject(s)),!1),this.source.addEventListener("error",(()=>this.reject(s)),!1)}))}getUrl(t){const e=new URL(TYPO3.settings.ajaxUrls.tx_warming_cache_warmup,window.location.origin);return Bt.mergeUrlWithQueryParams(e,t)}static isSupported(){return!!window.EventSource}closeSource(){return this.source.close(),EventSource.CLOSED===this.source.readyState}updateProgress(t){const e=JSON.parse(t.data);this.progress.update(e),this.progressModal.progress=this.progress}finishWarmup(t,e){const s=JSON.parse(t.data);this.progress.update(s),this.closeSource(),this.progressModal.progress=this.progress,this.progressModal.finishProgress(this.progress,e)}abortWarmup(){this.closeSource(),this.progress.update({state:qt.Aborted})}reject(t){this.closeSource(),r.dismiss(),t()}}class Dt{constructor(){this.handler=this.initializeRequestHandler()}warmupCache(e,s,r={}){const i=this.buildQueryParams(e,s,r),o=()=>this.warmupCache(e,s,r);return this.handler.startRequestWithQueryParams(i,o).then((e=>{let s;return e.state===qt.Aborted&&(s={label:TYPO3.lang[Et.notificationActionRetry],action:new t(o)}),Dt.showNotification(e,o,s),e}),(t=>(Dt.errorNotification(),t)))}initializeRequestHandler(){return zt.isSupported()?new zt:new Wt}buildQueryParams(t,e,s={}){const r=new URLSearchParams({requestId:Ct.generateUniqueId()});let i=0,o=0;for(const[e,s]of Object.entries(t)){const t=i++;r.set(`sites[${t}][site]`,e),s.forEach(((e,s)=>r.set(`sites[${t}][languageIds][${s}]`,(e??0).toString())))}for(const[t,s]of Object.entries(e)){const e=o++;r.set(`pages[${e}][page]`,t.toString()),s.forEach(((t,s)=>r.set(`pages[${e}][languageIds][${s}]`,(t??0).toString())))}for(const[t,e]of Object.entries(s))r.set(`configuration[${t}]`,e.toString());return r}static showNotification(s,r,i){let{title:o,message:n}=s.response;const a=[{label:TYPO3.lang[Et.notificationShowReport],action:new t((()=>{Ht.createModal(s,r)}))}];switch(i&&a.push(i),s.state){case qt.Failed:e.error(o,n,0,a);break;case qt.Warning:e.warning(o,n,0,a);break;case qt.Success:e.success(o,n,15,a);break;case qt.Aborted:o=TYPO3.lang[Et.notificationAbortedTitle],n=TYPO3.lang[Et.notificationAbortedMessage],e.info(o,n,15,a);break;case qt.Unknown:e.notice(o,n,15);break;default:Dt.errorNotification()}}static errorNotification(){e.error(TYPO3.lang[Et.notificationErrorTitle],TYPO3.lang[Et.notificationErrorMessage])}}export{Dt as C,Pt as I,Et as L,a as _,J as t};