TYPO3 v15 dev-main snapshot ()

This commit is contained in:
2026-08-10 22:31:00 +02:00
commit f9941541b7
1178 changed files with 135377 additions and 0 deletions
@@ -0,0 +1,13 @@
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
import{property as r,customElement as b}from"lit/decorators.js";import{LitElement as v,html as p,nothing as h}from"lit";import{classMap as y}from"lit/directives/class-map.js";import{SeverityEnum as n}from"@typo3/backend/enum/severity.js";import g from"@typo3/backend/severity.js";import"@typo3/backend/element/icon-element.js";import u from"~labels/core.mod_web_list";var s=function(a,t,o,l){var c=arguments.length,i=c<3?t:l===null?l=Object.getOwnPropertyDescriptor(t,o):l,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(a,t,o,l);else for(var m=a.length-1;m>=0;m--)(d=a[m])&&(i=(c<3?d(i):c>3?d(t,o,i):d(t,o))||i);return c>3&&i&&Object.defineProperty(t,o,i),i},f;let e=f=class extends v{constructor(){super(...arguments),this.severity=n.info,this.dismissible=!1,this.visible=!0,this.heading=null,this.message=null,this.showIcon=!1,this.randomSuffix=Math.random().toString(36).substring(7)}static getIconIdentifier(t){return{[n.notice]:"actions-lightbulb",[n.ok]:"actions-check",[n.warning]:"actions-exclamation",[n.error]:"actions-close",[n.info]:"actions-info"}[t]||"actions-info"}createRenderRoot(){return this}render(){return p`<div id=alert-${this.randomSuffix} class=${y(this.getClasses())} role=alert aria-labelledby=alert-title-${this.randomSuffix} aria-describedby=alert-message-${this.randomSuffix} @closed.bs.alert=${this.remove}><div class=alert-inner>${this.showIcon?p`<div class=alert-icon><span class=icon-emphasized> <typo3-backend-icon identifier=${f.getIconIdentifier(this.severity)} size=small></typo3-backend-icon> </span></div>`:h}<div class=alert-content>${this.heading?p`<h4 class=alert-title id=alert-title-${this.randomSuffix}>${this.heading}</h4>`:h}<p class=alert-body id=alert-message-${this.randomSuffix}>${this.message}</p></div></div>${this.dismissible?this.renderDismissButton():h}</div>`}getClasses(){return{alert:!0,["alert-"+g.getCssClass(this.severity)]:!0,"alert-dismissible":this.dismissible,fade:!0,show:this.visible,hidden:!this.visible}}renderDismissButton(){return p`<button type=button class=close data-bs-dismiss=alert aria-label=${u.get("button.close")}><span aria-hidden=true><typo3-backend-icon identifier=actions-close size=small></typo3-backend-icon></span> <span class=visually-hidden>${u.get("button.close")}</span></button>`}};s([r({type:Number})],e.prototype,"severity",void 0),s([r({type:Boolean})],e.prototype,"dismissible",void 0),s([r({type:Boolean})],e.prototype,"visible",void 0),s([r({type:String})],e.prototype,"heading",void 0),s([r({type:String})],e.prototype,"message",void 0),s([r({type:Boolean,attribute:"show-icon"})],e.prototype,"showIcon",void 0),e=f=s([b("typo3-backend-alert")],e);export{e as AlertElement};
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,13 @@
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
import{property as l,customElement as m}from"lit/decorators.js";import{PseudoButtonLitElement as u}from"@typo3/backend/element/pseudo-button.js";import g,{Positions as y,Sizes as h,Types as v}from"@typo3/backend/modal.js";import E from"@typo3/backend/notification.js";import p from"@typo3/backend/storage/persistent.js";import f from"~labels/backend.alt_doc";var c=function(s,e,i,n){var r=arguments.length,t=r<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,i):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")t=Reflect.decorate(s,e,i,n);else for(var o=s.length-1;o>=0;o--)(a=s[o])&&(t=(r<3?a(t):r>3?a(e,i,t):a(e,i))||t);return r>3&&t&&Object.defineProperty(e,i,t),t};let d=class extends u{async buttonActivated(){if(p.isset("contextualRecordEdit")&&p.get("contextualRecordEdit")==0){top?.TYPO3?.Backend?.ContentContainer&&top.TYPO3.Backend.ContentContainer.setUrl(this.editUrl);return}const e=g.advanced({type:v.iframe,title:"",content:this.url,size:h.expand,position:y.sheet,hideHeader:!0});this.setupMessageHandling(e)}setupMessageHandling(e){const i=top;let n="",r=!1,t=!1;const a=o=>{o.origin===window.location.origin&&(o.data?.actionName==="typo3:editform:saved"&&(r=!0,n=o.data.recordTitle??""),o.data?.actionName==="typo3:editform:closed"&&(t=!0,e.hideModal()),o.data?.actionName==="typo3:editform:navigate"&&(t=!0,e.hideModal()))};i.addEventListener("message",a),e.addEventListener("typo3-modal-hide",o=>{if(t)return;o.preventDefault(),e.querySelector("iframe")?.contentWindow?.postMessage({actionName:"typo3:editform:requestclose"},window.location.origin)}),e.addEventListener("typo3-modal-hidden",()=>{i.removeEventListener("message",a),r?(top.document.dispatchEvent(new CustomEvent("typo3:pagetree:refresh")),top.TYPO3?.Backend?.ContentContainer&&top.TYPO3.Backend.ContentContainer.refresh(),E.success(f.get("notification.record_updated.title"),n!==""?f.get("notification.record_updated.message",[n]):void 0)):this.focus()})}};c([l({type:String})],d.prototype,"url",void 0),c([l({type:String,attribute:"edit-url"})],d.prototype,"editUrl",void 0),d=c([m("typo3-backend-contextual-record-edit-trigger")],d);export{d as ContextualRecordEditTriggerElement};
@@ -0,0 +1,13 @@
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
import{LitElement as h,html as p,nothing as f}from"lit";import{property as c,state as T,customElement as D}from"lit/decorators.js";import{DateTime as u}from"luxon";var m=function(n,t,e,i){var o=arguments.length,a=o<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,t,e,i);else for(var l=n.length-1;l>=0;l--)(r=n[l])&&(a=(o<3?r(a):o>3?r(t,e,a):r(t,e))||a);return o>3&&a&&Object.defineProperty(t,e,a),a},d;(function(n){n.Relative="relative",n.Absolute="absolute"})(d||(d={}));let s=class extends h{constructor(){super(...arguments),this.datetime="",this.mode=d.Absolute,this.format="date",this.thresholdDays=0,this.relativeShowSeconds=!1,this.displayTime="",this.updateTimeoutId=null}disconnectedCallback(){super.disconnectedCallback(),this.clearUpdateTimeout()}willUpdate(t){(t.has("datetime")||t.has("mode")||t.has("format")||t.has("relativeShowSeconds"))&&(this.updateDisplayTime(),this.clearUpdateTimeout(),this.startUpdateTimeout())}createRenderRoot(){return this}render(){const t=this.parseDateTime(this.datetime),e=t?.toISO()||this.datetime,i=t&&this.mode===d.Relative?this.formatAbsoluteDateTime(this.getLocalizedDateTime(t)):"",o=i?`${this.displayTime||this.datetime}. ${i}`:null;return p`<time datetime=${e} title=${i||f} aria-label=${o||f}>${this.displayTime||this.datetime}</time>`}clearUpdateTimeout(){this.updateTimeoutId!==null&&(window.clearTimeout(this.updateTimeoutId),this.updateTimeoutId=null)}startUpdateTimeout(){if(this.mode===d.Relative){const t=this.parseDateTime(this.datetime),e=t?this.calculateNextStateChange(t):null,i=e?Math.abs(e.diffNow("milliseconds").milliseconds):1e3;this.updateTimeoutId=window.setTimeout(()=>{this.updateTimeoutId=null,this.updateDisplayTime(),this.startUpdateTimeout()},i)}}calculateNextStateChange(t){const e=["years","months","days","hours","minutes","seconds"],i=t.diffNow(e);for(const o of e){const a=i.get(o);if(a!==0){const r=a<0?-1:1;return t.minus({[o]:a+r})}}return t.plus({seconds:1})}updateDisplayTime(){const t=this.parseDateTime(this.datetime);t?this.displayTime=this.mode===d.Absolute?this.formatAbsoluteTime(t):this.formatRelativeTime(t):this.displayTime=this.datetime}formatAbsoluteTime(t){const e=this.getLocalizedDateTime(t),i=this.getConfiguredDateFormats();return this.format==="date"&&i?e.toFormat(i.formats.date):this.format==="datetime"&&i?e.toFormat(i.formats.datetime):this.format?e.toFormat(this.format):i?e.toFormat(i.formats.date):e.toLocaleString(u.DATE_SHORT)}parseDateTime(t){if(!t)return null;const i=this.getConfiguredDateFormats()?.timezone,o=Number(t);if(!isNaN(o)&&o>0){const r=i?{zone:i}:{},l=u.fromSeconds(o,r);if(l.isValid)return l}const a=u.fromISO(t);return a.isValid?a:null}getLocalizedDateTime(t){let e=document.documentElement.lang||"en";e==="ch"&&(e="zh");const o=this.getConfiguredDateFormats()?.timezone;let a=t.setLocale(e);return o&&(a=a.setZone(o)),a}formatRelativeTime(t){const e=this.getLocalizedDateTime(t);if(this.thresholdDays>0&&Math.abs(u.now().diff(e,"days").days)>this.thresholdDays)return this.formatAbsoluteDate(e);if(!this.relativeShowSeconds){const o=e.diffNow("seconds").seconds;if(Math.abs(o)<60)return e.toRelative({unit:"minutes",rounding:"expand"})||this.formatAbsoluteDateTime(e)}return e.toRelative()||this.formatAbsoluteDateTime(e)}formatAbsoluteDate(t){const e=this.getLocalizedDateTime(t),i=this.getConfiguredDateFormats();return i?e.toFormat(i.formats.date):e.toLocaleString(u.DATE_SHORT)}formatAbsoluteDateTime(t){const e=this.getLocalizedDateTime(t),i=this.getConfiguredDateFormats();return i?e.toFormat(i.formats.datetime):e.toLocaleString(u.DATETIME_SHORT)}getConfiguredDateFormats(){try{return(typeof opener?.top?.TYPO3<"u"?opener.top:top).TYPO3.settings.DateConfiguration}catch{return null}}};m([c({type:String})],s.prototype,"datetime",void 0),m([c()],s.prototype,"mode",void 0),m([c()],s.prototype,"format",void 0),m([c({type:Number,attribute:"threshold-days"})],s.prototype,"thresholdDays",void 0),m([c({type:Boolean,attribute:"relative-show-seconds"})],s.prototype,"relativeShowSeconds",void 0),m([T()],s.prototype,"displayTime",void 0),s=m([D("typo3-backend-datetime")],s);export{d as DateTimeDisplayMode,s as DateTimeElement};
@@ -0,0 +1,13 @@
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
import{property as s,customElement as m}from"lit/decorators.js";import{PseudoButtonLitElement as a}from"@typo3/backend/element/pseudo-button.js";import u from"@typo3/backend/modal.js";import{SeverityEnum as d}from"@typo3/backend/enum/severity.js";var f=function(i,e,o,n){var p=arguments.length,t=p<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,o):n,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")t=Reflect.decorate(i,e,o,n);else for(var c=i.length-1;c>=0;c--)(l=i[c])&&(t=(p<3?l(t):p>3?l(e,o,t):l(e,o))||t);return p>3&&t&&Object.defineProperty(e,o,t),t};let r=class extends a{buttonActivated(){this.url&&u.advanced({content:this.url,title:this.subject,severity:d.notice,size:u.sizes.large,type:u.types.iframe})}};f([s({type:String})],r.prototype,"url",void 0),f([s({type:String})],r.prototype,"subject",void 0),r=f([m("typo3-backend-dispatch-modal-button")],r);export{r as DispatchModalButton};
@@ -0,0 +1,13 @@
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
import{LitElement as u,html as f}from"lit";import{property as c,state as p,customElement as z}from"lit/decorators.js";import{Offset as v}from"@typo3/backend/offset.js";var l=function(n,e,t,r){var o=arguments.length,i=o<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,e,t,r);else for(var d=n.length-1;d>=0;d--)(a=n[d])&&(i=(o<3?a(i):o>3?a(e,t,i):a(e,t))||i);return o>3&&i&&Object.defineProperty(e,t,i),i},s;(function(n){n.move="move",n.resizeN="resizeN",n.resizeE="resizeE",n.resizeS="resizeS",n.resizeW="resizeW",n.resizeSE="resizeSE",n.resizeSW="resizeSW",n.resizeNE="resizeNE",n.resizeNW="resizeNW"})(s||(s={}));const g=[s.resizeNW,s.resizeN,s.resizeNE],m=[s.resizeNE,s.resizeE,s.resizeSE],b=[s.resizeSE,s.resizeS,s.resizeSW],E=[s.resizeSW,s.resizeW,s.resizeNW];let h=class extends u{constructor(){super(...arguments),this.reverting=!1,this.action=null,this.originOffset=null,this.originPosition=null,this.handleStart=e=>{const t=e.target;if(!(e.buttons!==1||!this.contains(t))){if(t.dataset.resize){const r="resize"+t.dataset.resize.toUpperCase();this.action=s[r]}else this.action=s.move;this.reverting=!1,this.originOffset=this.offset.clone(),this.originPosition={x:e.clientX,y:e.clientY},this.dispatchEvent(this.createEvent("draggable-resizable-started",{action:this.action,originOffset:this.originOffset}))}},this.handleUpdate=e=>{if(!this.action)return;const t={x:e.clientX-this.originPosition.x,y:e.clientY-this.originPosition.y};this.offset=this.adjustOffset(this.originOffset,t),this.dispatchEvent(this.createEvent("draggable-resizable-updated",{action:this.action,originOffset:this.originOffset}))},this.handleFinish=()=>{this.action&&(this.dispatchEvent(this.createEvent("draggable-resizable-finished",{action:this.action,originOffset:this.originOffset})),this.action=null,this.originOffset=null,this.originPosition=null)}}revert(e){this.reverting=!0,this.offset=e,setTimeout(()=>this.reverting=!1,500)}connectedCallback(){super.connectedCallback(),this.pointerEventNames.pointerDown.forEach(e=>document.addEventListener(e,this.handleStart,!0)),this.pointerEventNames.pointerMove.forEach(e=>document.addEventListener(e,this.handleUpdate,!0)),this.pointerEventNames.pointerUp.forEach(e=>document.addEventListener(e,this.handleFinish,!0))}disconnectedCallback(){super.disconnectedCallback(),this.pointerEventNames.pointerDown.forEach(e=>document.removeEventListener(e,this.handleStart,!0)),this.pointerEventNames.pointerMove.forEach(e=>document.removeEventListener(e,this.handleUpdate,!0)),this.pointerEventNames.pointerUp.forEach(e=>document.removeEventListener(e,this.handleFinish,!0))}render(){return f`<div class="cropper-focus-area ui-draggable ui-draggable-handle ui-resizable"><div class="ui-resizable-handle ui-resizable-n" data-resize=n></div><div class="ui-resizable-handle ui-resizable-e" data-resize=e></div><div class="ui-resizable-handle ui-resizable-s" data-resize=s></div><div class="ui-resizable-handle ui-resizable-w" data-resize=w></div><div class="ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se" data-resize=se></div><div class="ui-resizable-handle ui-resizable-sw" data-resize=sw></div><div class="ui-resizable-handle ui-resizable-ne" data-resize=ne></div><div class="ui-resizable-handle ui-resizable-nw" data-resize=nw></div></div>`}update(e){super.update(e),Object.assign(this.style,this.getOffsetStyles(this.offset))}createRenderRoot(){return this}adjustOffset(e,t){const o=this.parentElement.getBoundingClientRect(),i=e.clone();if(this.action===s.move&&(i.left=this.minMax(i.left+t.x,0,o.width-i.width),i.top=this.minMax(i.top+t.y,0,o.height-i.height)),g.includes(this.action)){const a=this.minMax(t.y,-i.top,i.height-2);i.top+=a,i.height-=a}else b.includes(this.action)&&(i.height=this.minMax(i.height+t.y,2,o.height-i.top));if(E.includes(this.action)){const a=this.minMax(t.x,-i.left,i.width-2);i.left+=a,i.width-=a}else m.includes(this.action)&&(i.width+=t.x);return i}minMax(e,t,r){return e<t?t:e>r?r:e}createEvent(e,t){return new CustomEvent(e,{detail:t,bubbles:!0,composed:!0})}getOffsetStyles(e){return{left:`${e.left}px`,top:`${e.top}px`,width:`${e.width}px`,height:`${e.height}px`}}};l([c({type:Object,converter:n=>v.fromObject(JSON.parse(n)),reflect:!0})],h.prototype,"offset",void 0),l([c({type:Object})],h.prototype,"pointerEventNames",void 0),l([c({type:Boolean,reflect:!0})],h.prototype,"reverting",void 0),l([p()],h.prototype,"action",void 0),h=l([z("typo3-backend-draggable-resizable")],h);export{h as DraggableResizableElement};
File diff suppressed because one or more lines are too long
@@ -0,0 +1,13 @@
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
import{LitElement as d,html as c,nothing as m}from"lit";import{Task as u}from"@lit/task";import{property as a,customElement as y}from"lit/decorators.js";import{unsafeHTML as h}from"lit/directives/unsafe-html.js";import{Sizes as v,States as g,MarkupIdentifiers as z}from"@typo3/backend/enum/icon-types.js";import w,{IconStyles as S}from"@typo3/backend/icons.js";import"@typo3/backend/element/spinner-element.js";var n=function(l,t,r,o){var s=arguments.length,e=s<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,r):o,p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")e=Reflect.decorate(l,t,r,o);else for(var f=l.length-1;f>=0;f--)(p=l[f])&&(e=(s<3?p(e):s>3?p(t,r,e):p(t,r))||e);return s>3&&e&&Object.defineProperty(t,r,e),e};let i=class extends d{constructor(){super(...arguments),this.size=v.default,this.state=g.default,this.overlay=null,this.markup=z.inline,this.raw=null,this.iconTask=new u(this,{task:async([t,r,o,s,e],{signal:p})=>await w.getIcon(t,r,o,s,e,p),args:()=>[this.identifier,this.size,this.overlay,this.state,this.markup]})}static{this.styles=S.getStyles()}render(){return this.raw?c`${h(this.raw)}`:this.identifier?this.iconTask.render({pending:()=>c`<typo3-backend-spinner size=${this.size}></typo3-backend-spinner>`,complete:t=>c`${h(t)}`,error:()=>c`<span class="t3js-icon icon icon-size-${this.size} icon-state-${this.state} icon-default-not-found" data-identifier=default-not-found aria-hidden=true> <span class=icon-markup><svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 16 16"><g><path fill="#CD201F" d="m11 12 3-2v6H2v-6l3 2 3-2z"/><path fill="#212121" d="m8 10.3 2.86 1.91.14.09.14-.09 2.61-1.74v5.28H2.25v-5.28l2.61 1.74.14.09.14-.09zm6-.3-3 2-3-2-3 2-3-2v6h12z" opacity=".2"/><path fill="#CD201F" d="M14 4v4l-3 2-3-2-3 2-3-2V0h8z"/><path fill="#212121" d="M13.75 7.87 11 9.7 8.14 7.79 8 7.7l-.14.09L5 9.7 2.25 7.87V.25H10V0H2v8l3 2 3-2 3 2 3-2V4h-.25z" opacity=".2"/><path fill="#FFF" d="M14 4h-4V0z" opacity=".3"/><path fill="#212121" d="m14 8-4-4h4z" opacity=".3"/></g></svg> </span> </span>`}):m}};n([a({type:String,reflect:!0})],i.prototype,"identifier",void 0),n([a({type:String,reflect:!0})],i.prototype,"size",void 0),n([a({type:String})],i.prototype,"state",void 0),n([a({type:String})],i.prototype,"overlay",void 0),n([a({type:String})],i.prototype,"markup",void 0),n([a({type:String})],i.prototype,"raw",void 0),i=n([y("typo3-backend-icon")],i);export{i as IconElement};
@@ -0,0 +1,13 @@
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
import n from"@typo3/backend/utility.js";import{EventDispatcher as i}from"@typo3/backend/event/event-dispatcher.js";class r extends HTMLElement{constructor(){super(...arguments),this.args=[]}static get observedAttributes(){return["action","args","args-list"]}static async getDelegate(t){switch(t){case"TYPO3.ModuleMenu.App.refreshMenu":const{default:s}=await import("@typo3/backend/module-menu.js");return s.App.refreshMenu.bind(s.App);case"TYPO3.Backend.Topbar.refresh":const{default:e}=await import("@typo3/backend/viewport.js");return e.Topbar.refresh.bind(e.Topbar);case"TYPO3.WindowManager.localOpen":const{default:a}=await import("@typo3/backend/window-manager.js");return a.localOpen.bind(a);case"TYPO3.Backend.Storage.ModuleStateStorage.update":return(await import("@typo3/backend/storage/module-state-storage.js")).ModuleStateStorage.update;case"TYPO3.Backend.Storage.ModuleStateStorage.updateWithCurrentMount":return(await import("@typo3/backend/storage/module-state-storage.js")).ModuleStateStorage.updateWithCurrentMount;case"TYPO3.Backend.Event.EventDispatcher.dispatchCustomEvent":return i.dispatchCustomEvent;default:throw Error('Unknown action "'+t+'"')}}attributeChangedCallback(t,s,e){if(t==="action")this.action=e;else if(t==="args"){const a=e.replace(/&quot;/g,'"'),o=JSON.parse(a);this.args=o instanceof Array?n.trimItems(o):[]}else if(t==="args-list"){const a=e.split(",");this.args=n.trimItems(a)}}connectedCallback(){if(!this.action)throw new Error("Missing mandatory action attribute");r.getDelegate(this.action).then(t=>t(...this.args))}}window.customElements.define("typo3-immediate-action",r);export{r as ImmediateActionElement};
@@ -0,0 +1,13 @@
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
import{LitElement as u,html as d,nothing as m}from"lit";import{property as f,state as s,customElement as p}from"lit/decorators.js";var r=function(o,e,n,a){var i=arguments.length,t=i<3?e:a===null?a=Object.getOwnPropertyDescriptor(e,n):a,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")t=Reflect.decorate(o,e,n,a);else for(var h=o.length-1;h>=0;h--)(c=o[h])&&(t=(i<3?c(t):i>3?c(e,n,t):c(e,n))||t);return i>3&&t&&Object.defineProperty(e,n,t),t};let l=class extends u{constructor(){super(...arguments),this.value="",this.checked=!1,this.filename=""}connectedCallback(){super.connectedCallback(),this.checked=this.value!=="",this.filename=this.value!==""&&this.value!=="true"?this.value:""}createRenderRoot(){return this}render(){return d`<input type=hidden name=ldownload .value=${this.computeValue()}><div class=form-check><input type=checkbox class=form-check-input id=ldownload-checkbox .checked=${this.checked} @change=${this.handleCheckboxChange}> <label class=form-check-label for=ldownload-checkbox>${this.getAttribute("label-download")??"Force download"}</label></div>${this.checked?d`<div class=mt-2><label for=ldownload-filename class=form-label>${this.getAttribute("label-filename")??"Custom filename"}</label> <input id=ldownload-filename type=text class=form-control .value=${this.filename} @input=${this.handleFilenameInput}></div>`:m}`}computeValue(){return this.checked?this.filename!==""?this.filename:"true":""}handleCheckboxChange(e){this.checked=e.target.checked}handleFilenameInput(e){this.filename=e.target.value}};r([f({type:String})],l.prototype,"value",void 0),r([s()],l.prototype,"checked",void 0),r([s()],l.prototype,"filename",void 0),l=r([p("typo3-backend-link-browser-download")],l);export{l as LinkBrowserDownloadElement};
@@ -0,0 +1,13 @@
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
import{property as u,customElement as m}from"lit/decorators.js";import{LitElement as d,html as g}from"lit";import{range as b}from"lit/directives/range.js";import{map as f}from"lit/directives/map.js";import{classMap as l}from"lit/directives/class-map.js";var c=function(i,t,n,a){var o=arguments.length,e=o<3?t:a===null?a=Object.getOwnPropertyDescriptor(t,n):a,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")e=Reflect.decorate(i,t,n,a);else for(var s=i.length-1;s>=0;s--)(r=i[s])&&(e=(o<3?r(e):o>3?r(t,n,e):r(t,n))||e);return o>3&&e&&Object.defineProperty(t,n,e),e};let p=class extends d{constructor(){super(...arguments),this.paging=null}createRenderRoot(){return this}render(){return g`<ul class=pagination><li class=${l({"page-item":!0,disabled:this.paging.currentPage===1})}><button type=button class=page-link data-action=previous ?disabled=${this.paging.currentPage===1}><typo3-backend-icon identifier=actions-view-paging-previous size=small></typo3-backend-icon></button></li>${f(b(1,this.paging.totalPages+1),t=>g`<li class=${l({"page-item":!0,active:this.paging.currentPage===t})}><button type=button class=page-link data-action=page data-page=${t}><span>${t}</span></button></li>`)}<li class=${l({"page-item":!0,disabled:this.paging.currentPage===this.paging.totalPages})}><button type=button class=page-link data-action=next ?disabled=${this.paging.currentPage===this.paging.totalPages}><typo3-backend-icon identifier=actions-view-paging-next size=small></typo3-backend-icon></button></li></ul>`}};c([u({type:Object})],p.prototype,"paging",void 0),p=c([m("typo3-backend-pagination")],p);export{p as PaginationElement};
File diff suppressed because one or more lines are too long
@@ -0,0 +1,13 @@
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
import{LitElement as l,css as d,nothing as h,html as b}from"lit";import{property as n,customElement as k}from"lit/decorators.js";import{styleMap as v}from"lit/directives/style-map.js";import m from"~labels/backend.layout";var p=function(s,r,t,i){var o=arguments.length,e=o<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,t):i,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")e=Reflect.decorate(s,r,t,i);else for(var g=s.length-1;g>=0;g--)(c=s[g])&&(e=(o<3?c(e):o>3?c(r,t,e):c(r,t))||e);return o>3&&e&&Object.defineProperty(r,t,e),e};let a=class extends l{constructor(){super(...arguments),this.stages=[],this.activeStage=0}static{this.styles=d`:host{--progress-tracker-margin:var(--typo3-spacing);--progress-tracker-stage:0;--progress-tracker-stages:0;--progress-tracker-gap:.25rem;--progress-tracker-bar-height:6px;--progress-tracker-bar-border-radius:3px;--progress-tracker-bar-bg:light-dark(var(--token-color-neutral-20),var(--token-color-neutral-80));--progress-tracker-bar-progress-bg:var(--typo3-state-primary-border-color);display:block;width:100%;margin-bottom:var(--progress-tracker-margin)}.tracker{position:relative;display:grid;gap:var(--progress-tracker-gap);grid-template-columns:auto min-content;grid-template-areas:"stage step" "bar bar"}.tracker-stage{grid-area:stage}.tracker-step{grid-area:step;white-space:nowrap}.tracker-bar{grid-area:bar;position:relative;width:100%;height:var(--progress-tracker-bar-height);border-radius:var(--progress-tracker-bar-border-radius);background-color:var(--progress-tracker-bar-bg)}.tracker-bar:after{content:"";height:100%;width:calc(100%/var(--progress-tracker-stages)*var(--progress-tracker-stage));display:block;border-radius:inherit;background-color:var(--progress-tracker-bar-progress-bg)}@media (prefers-reduced-motion:no-preference){.tracker-bar:after{transition:width .5s ease-in-out}}`}render(){if(this.stages.length<2)return h;this.activeStage=Math.min(Math.max(this.activeStage,this.stages.length>0?1:0),this.stages.length);const r=this.stages[this.activeStage-1],t=v({"--progress-tracker-stage":`${this.activeStage}`,"--progress-tracker-stages":`${this.stages.length}`});return b`<div class=tracker role=group aria-describedby=tracker-details style=${t}><div class=tracker-stage id=tracker-stage aria-live=polite>${r}</div><div class=tracker-step id=tracker-details>${m.get("progressTracker.steps",[this.activeStage,this.stages.length])||`Step ${this.activeStage} of ${this.stages.length}`}</div><div class=tracker-bar id=tracker-bar aria-hidden=true></div></div>`}};p([n({attribute:"stages",type:Array})],a.prototype,"stages",void 0),p([n({attribute:"active",type:Number,reflect:!0})],a.prototype,"activeStage",void 0),a=p([k("typo3-backend-progress-tracker")],a);export{a as ProgressTrackerElement};
@@ -0,0 +1,13 @@
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
import{property as f}from"lit/decorators.js";import{LitElement as a,css as d,html as v}from"lit";import{KeyTypesEnum as l}from"@typo3/backend/enum/key-types.js";var c=function(n,t,r,o){var i=arguments.length,e=i<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,r):o,p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")e=Reflect.decorate(n,t,r,o);else for(var s=n.length-1;s>=0;s--)(p=n[s])&&(e=(i<3?p(e):i>3?p(t,r,e):p(t,r))||e);return i>3&&e&&Object.defineProperty(t,r,e),e};class u extends a{static{this.styles=[d`:host{cursor:pointer;appearance:button}`]}constructor(){super(),this.role="button",this.tabIndex=0,this.addEventListener("click",t=>{t.preventDefault(),this.buttonActivated(t)}),this.addEventListener("keydown",t=>{t.key===l.SPACE&&t.preventDefault(),t.key===l.ENTER&&(t.preventDefault(),this.buttonActivated(t))}),this.addEventListener("keyup",t=>{t.key===l.SPACE&&(t.preventDefault(),this.buttonActivated(t))})}render(){return v`<slot></slot>`}}c([f({type:String,reflect:!0})],u.prototype,"role",void 0),c([f({type:String,reflect:!0})],u.prototype,"tabIndex",void 0);export{u as PseudoButtonLitElement};
@@ -0,0 +1,13 @@
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
import{property as d,state as h,customElement as b}from"lit/decorators.js";import{LitElement as y,html as s,nothing as f}from"lit";import v from"@typo3/core/ajax/ajax-request.js";import"@typo3/backend/element/spinner-element.js";import"@typo3/backend/element/icon-element.js";import"@typo3/backend/copy-to-clipboard.js";import{unsafeHTML as g}from"lit/directives/unsafe-html.js";import i from"~labels/backend.qrcode";var a=function(t,e,o,l){var c=arguments.length,r=c<3?e:l===null?l=Object.getOwnPropertyDescriptor(e,o):l,p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,o,l);else for(var m=t.length-1;m>=0;m--)(p=t[m])&&(r=(c<3?p(r):c>3?p(e,o,r):p(e,o))||r);return c>3&&r&&Object.defineProperty(e,o,r),r},u;(function(t){t[t.small=64]="small",t[t.medium=128]="medium",t[t.large=256]="large",t[t.mega=512]="mega"})(u||(u={}));let n=class extends y{constructor(){super(),this.content="",this.showDownload=!1,this.showUrl=!1,this.size=u.small,this.qrcodePreview=s`<typo3-backend-spinner size=large></typo3-backend-spinner>`,document.addEventListener("copy-to-clipboard-success",this.showCopySuccess.bind(this)),document.addEventListener("copy-to-clipboard-error",this.showCopyError.bind(this))}connectedCallback(){super.connectedCallback(),this.loadQrCode()}render(){return s`<div class=preview>${this.qrcodePreview}</div>${this.getUrlSection()} ${this.getControls()}`}createRenderRoot(){return this}getUrlSection(){if(!this.showUrl)return f;const e=i.get("qrcode.url"),o=i.get("qrcode.copyUrl");return s`<div class="form-group url-info-section"><label class=form-label>${e}</label><div class=input-group><input type=text class=form-control readonly .value=${this.content}><typo3-copy-to-clipboard text=${this.content} class="btn btn-default" silent><typo3-backend-icon identifier=actions-clipboard size=small></typo3-backend-icon>${o}</typo3-copy-to-clipboard></div></div>`}getControls(){if(!this.showDownload)return s`${f}`;const e=i.get("qrcode.format.png"),o=i.get("qrcode.format.svg"),l=i.get("qrcode.format"),c=i.get("qrcode.size"),r=i.get("qrcode.download");return s`<form name=qrcode-download method=POST action=${TYPO3.settings.ajaxUrls.qrcode_download}><div class=form-row><div class=form-group><input name=content type=hidden value=${this.content}> <label class=form-label>${l}</label> <select name=format class=form-select><option value=svg>${o}</option><option value=png>${e}</option></select></div><div class=form-group><label class=form-label>${c}</label> <select name=size class=form-select>${this.getSizeOptions()}</select></div><div class=form-group><button type=submit class="btn btn-primary">${r}</button></div></div></form>`}getSizeOptions(){return Object.entries(u).filter(([,e])=>typeof e=="number").map(([e,o])=>s`<option value=${e}>${o}x${o}</option>`)}async loadQrCode(){if(this.content===""){this.qrcodePreview=s`<typo3-backend-icon identifier=default-not-found size=small></typo3-backend-icon>`;return}await new v(TYPO3.settings.ajaxUrls.qrcode_generator).withQueryArguments({content:this.content,size:this.size}).get({cache:"no-cache"}).then(async e=>{this.qrcodePreview=s`${g(await e.resolve())}`})}showCopySuccess(){const e=this.querySelector(".url-info-section");e!==null&&(e.classList.add("copy-success"),setTimeout(()=>e.classList.remove("copy-success"),500))}showCopyError(){const e=this.querySelector(".url-info-section");e!==null&&(e.classList.add("copy-error"),setTimeout(()=>e.classList.remove("copy-error"),750))}};a([d({type:String,reflect:!0})],n.prototype,"content",void 0),a([d({type:Boolean,reflect:!0,attribute:"show-download"})],n.prototype,"showDownload",void 0),a([d({type:Boolean,reflect:!0,attribute:"show-url"})],n.prototype,"showUrl",void 0),a([d({type:String,reflect:!0})],n.prototype,"size",void 0),a([h()],n.prototype,"qrcodePreview",void 0),n=a([b("typo3-qrcode")],n);export{n as QrCodeElement};
@@ -0,0 +1,13 @@
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
import{property as d,customElement as m}from"lit/decorators.js";import{PseudoButtonLitElement as u}from"@typo3/backend/element/pseudo-button.js";import c from"@typo3/backend/modal.js";import{html as f}from"lit";import{topLevelModuleImport as w}from"@typo3/backend/utility/top-level-module-import.js";import h from"~labels/core.mod_web_list";var l=function(r,t,o,i){var a=arguments.length,e=a<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,o):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")e=Reflect.decorate(r,t,o,i);else for(var p=r.length-1;p>=0;p--)(s=r[p])&&(e=(a<3?s(e):a>3?s(t,o,e):s(t,o))||e);return a>3&&e&&Object.defineProperty(t,o,e),e};let n=class extends u{constructor(){super(...arguments),this.showUrl=!1,this.showDownload=!1}buttonActivated(){this.modalOpen()}async loadModuleFrameAgnostic(t){window.location!==window.parent.location?await w(t):await import(t)}async modalOpen(){await this.loadModuleFrameAgnostic("@typo3/backend/element/qrcode-element.js"),c.advanced({title:this.modalTitle||"QR Code",size:c.sizes.small,content:f`<div class=text-center><typo3-qrcode class=text-start content=${this.content} size=large ?show-download=${this.showDownload} ?show-url=${this.showUrl}></typo3-qrcode></div>`,buttons:[{text:h.get("button.close"),name:"close",trigger:function(t,o){o.hideModal()}}]})}};l([d({type:String,attribute:"modal-title"})],n.prototype,"modalTitle",void 0),l([d({type:String})],n.prototype,"content",void 0),l([d({type:Boolean,attribute:"show-url"})],n.prototype,"showUrl",void 0),l([d({type:Boolean,attribute:"show-download"})],n.prototype,"showDownload",void 0),n=l([m("typo3-qrcode-modal-button")],n);export{n as QrCodeModalButton};
@@ -0,0 +1,13 @@
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
import{css as h,html as f}from"lit";import{property as b,state as m,customElement as g}from"lit/decorators.js";import{PseudoButtonLitElement as c}from"@typo3/backend/element/pseudo-button.js";import{ScaffoldState as r,ScaffoldSidebarToggleEvent as u}from"@typo3/backend/viewport/scaffold-state.js";import"@typo3/backend/element/icon-element.js";var l=function(d,e,a,s){var n=arguments.length,t=n<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,a):s,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")t=Reflect.decorate(d,e,a,s);else for(var p=d.length-1;p>=0;p--)(o=d[p])&&(t=(n<3?o(t):n>3?o(e,a,t):o(e,a))||t);return n>3&&t&&Object.defineProperty(e,a,t),t};let i=class extends c{constructor(){super(...arguments),this.labelCollapse="Collapse sidebar",this.labelExpand="Expand sidebar",this.disabled=!1,this.expanded=!1,this.handleSidebarToggle=e=>{this.expanded=e.detail.expanded}}static{this.styles=[...c.styles,h`:host{display:inline-flex;align-items:center;justify-content:center;user-select:none}:host([disabled]){pointer-events:none;opacity:.5;cursor:default}`]}connectedCallback(){super.connectedCallback(),this.expanded=r.isLargeScreen()?r.isSidebarExpanded():r.isSidebarVisible(),this.updateLabels(),document.addEventListener(u.eventName,this.handleSidebarToggle)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener(u.eventName,this.handleSidebarToggle)}updated(){this.updateLabels(),this.updateDisabledState()}render(){const e=this.expanded?"actions-menu-sidebar-collapsed":"actions-menu-sidebar-expanded",a=this.disabled?"overlay-readonly":null;return f`<typo3-backend-icon identifier=${e} size=small overlay=${a}></typo3-backend-icon>`}buttonActivated(){this.disabled||r.toggleSidebar()}updateLabels(){const e=this.expanded?this.labelCollapse:this.labelExpand;this.title=e,this.setAttribute("aria-label",e)}updateDisabledState(){this.disabled?(this.setAttribute("aria-disabled","true"),this.tabIndex=-1):(this.removeAttribute("aria-disabled"),this.tabIndex=0)}};l([b({type:String,attribute:"label-collapse"})],i.prototype,"labelCollapse",void 0),l([b({type:String,attribute:"label-expand"})],i.prototype,"labelExpand",void 0),l([b({type:Boolean,reflect:!0})],i.prototype,"disabled",void 0),l([m()],i.prototype,"expanded",void 0),i=l([g("typo3-backend-sidebar-toggle")],i);export{i as SidebarToggleElement};
@@ -0,0 +1,13 @@
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
import{LitElement as a,html as m}from"lit";import{property as f,customElement as u}from"lit/decorators.js";import{Sizes as h}from"@typo3/backend/enum/icon-types.js";import{IconStyles as v}from"@typo3/backend/icons.js";var l=function(r,t,n,s){var o=arguments.length,e=o<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,n):s,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")e=Reflect.decorate(r,t,n,s);else for(var c=r.length-1;c>=0;c--)(i=r[c])&&(e=(o<3?i(e):o>3?i(t,n,e):i(t,n))||e);return o>3&&e&&Object.defineProperty(t,n,e),e};let p=class extends a{constructor(){super(...arguments),this.size=h.default}static{this.styles=v.getStyles()}render(){return m`<span class="icon icon-size-${this.size} icon-state-default icon-spin"> <span class=icon-markup><svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 16 16"><g fill="currentColor"><path d="M8 15c-3.86 0-7-3.141-7-7s3.14-7 7-7 7 3.14 7 7-3.141 7-7 7M8 3C5.243 3 3 5.243 3 8s2.243 5 5 5 5-2.243 5-5-2.243-5-5-5" opacity=".3"/><path d="M14 9a1 1 0 0 1-1-1c0-2.757-2.243-5-5-5a1 1 0 0 1 0-2c3.859 0 7 3.14 7 7a1 1 0 0 1-1 1"/></g></svg> </span> </span>`}};l([f({type:String})],p.prototype,"size",void 0),p=l([u("typo3-backend-spinner")],p);export{p as SpinnerElement};
@@ -0,0 +1,13 @@
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
import{property as p,customElement as d}from"lit/decorators.js";import{LitElement as h,html as f,nothing as c}from"lit";import{classMap as m}from"lit/directives/class-map.js";var l=function(n,t,o,a){var s=arguments.length,e=s<3?t:a===null?a=Object.getOwnPropertyDescriptor(t,o):a,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")e=Reflect.decorate(n,t,o,a);else for(var u=n.length-1;u>=0;u--)(r=n[u])&&(e=(s<3?r(e):s>3?r(t,o,e):r(t,o))||e);return s>3&&e&&Object.defineProperty(t,o,e),e};const g={online:"live",running:"loading"};let i=class extends h{constructor(){super(...arguments),this.state="default",this.live=!1,this.loading=!1,this.label=null}createRenderRoot(){return this}render(){const t=this.label!==null&&this.label!=="";return f`<span class=${m(this.getClasses())} title=${t?this.label:c} role=${t?"img":c} aria-label=${t?this.label:c} aria-hidden=${t?c:"true"}></span>`}getClasses(){const t=g[this.state];return{"status-indicator":!0,["status-indicator-"+this.state]:!0,"status-indicator-live":this.live||t==="live","status-indicator-loading":this.loading||t==="loading"}}};l([p({type:String})],i.prototype,"state",void 0),l([p({type:Boolean})],i.prototype,"live",void 0),l([p({type:Boolean})],i.prototype,"loading",void 0),l([p({type:String})],i.prototype,"label",void 0),i=l([d("typo3-backend-status-indicator")],i);export{i as StatusIndicatorElement};
@@ -0,0 +1,13 @@
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
import{property as p,customElement as d}from"lit/decorators.js";import{LitElement as b,html as c}from"lit";import{Task as y}from"@lit/task";import"@typo3/backend/element/spinner-element.js";import"@typo3/backend/element/icon-element.js";var l=function(m,t,n,s){var a=arguments.length,e=a<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,n):s,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")e=Reflect.decorate(m,t,n,s);else for(var r=m.length-1;r>=0;r--)(i=m[r])&&(e=(a<3?i(e):a>3?i(t,n,e):i(t,n))||e);return a>3&&e&&Object.defineProperty(t,n,e),e};const u={default:"default",small:"small",medium:"medium",large:"large"};let o=class extends b{constructor(){super(...arguments),this.size=u.default,this.keepAspectRatio=!1,this.thumbnailTask=new y(this,{task:async([t,n,s,a,e])=>{const i=new URL(t,window.origin);i.searchParams.set("size",n),i.searchParams.set("keepAspectRatio",s?"1":"0"),i.searchParams.set("bust",Date.now().toString(10));const r=new Image;return r.src=i.toString(),a>0&&(r.width=a),e>0&&!s&&(r.height=e),await new Promise((h,f)=>{r.onload=()=>h(),r.onerror=()=>f()}),c`${r}`},args:()=>[this.url,this.size,this.keepAspectRatio,this.width,this.height]})}createRenderRoot(){return this}render(){return this.thumbnailTask.render({pending:()=>c`<typo3-backend-spinner size=${this.size}></typo3-backend-spinner>`,complete:t=>c`${t}`,error:()=>c`<typo3-backend-icon identifier=default-not-found size=small></typo3-backend-icon>`})}};l([p({type:String,reflect:!0})],o.prototype,"url",void 0),l([p({type:String,reflect:!0})],o.prototype,"size",void 0),l([p({type:Boolean,reflect:!0})],o.prototype,"keepAspectRatio",void 0),l([p({type:Number,reflect:!0})],o.prototype,"width",void 0),l([p({type:Number,reflect:!0})],o.prototype,"height",void 0),o=l([d("typo3-backend-thumbnail")],o);export{o as ThumbnailElement,u as ThumbnailSize};