Commit 27881b60 authored by Benjamin Franzke's avatar Benjamin Franzke Committed by Benni Mack
Browse files

[TASK] Update bootstrap javascript to 5.0.0-beta1

Bootstrap v5 – introduced in #92616 – was added with CCS from beta1 but
JavaScript from alpha2. bootstrap.bundle.js was manually wrapped
into a AMD closure, and because bootstrap 5.0.0-beta1 contains alot of
changes regarding data tags, it couldn't be updated in the initial
patch.

Bootstrap is now bundled using rollup using the ES6 sources in order
to allow for automatic updates through `grunt build`.

popperjs – previously bundled into bootstrap distributed files –
is now added as dependency. The bootstap ES6 sources, that we now use
through rollup, do not bundle this external dependency (for good reasons).

Dependency added with:

   yarn add @popperjs/core

Further adaptions contained in this change to ensure beta1 compatibility:

a) Carousel "item" to "carousel-item" class migration
b) $.fn.modal(options) does no longer imply $.fn.modal('show')
c) Fix panels, both JS and CSS (card-group can't be used here)
d) All bootstrap data- tags are migrated to data-bs-.
   (see https://github.com/twbs/bootstrap/pull/31827)
   Migrated with

   # renderes a sed substition with the help of a nested sed from all the
   # data-bs attributes that where changed in the twbs/bootstrap commit
   git grep -l data- | xargs sed -i $( \
        curl -s \
        https://patch-diff.githubusercontent.com/raw/twbs/bootstrap/pull/31827.patch | \
        sed 's/data-bs-[a-z-]*/\n&\n/g' | grep "data-bs-[a-z-]" | \
        sort | uniq | \
        sed 's/data-bs-\(.*\)\([^a-z-]\|$\)/ -e s\/data-\1\\\([^a-z-]\\\)\/data-bs-\1\\1\/g -e s\/data('"'"'\1'"'"')\/data('"'"'bs-\1'"'"')\/g/g' \
   )

   # Revert false positives from the above auto-replacement
   git checkout -- typo3/sysext/core/Documentation/Changelog/ \
        typo3/sysext/backend/Classes/Form/Container/FlexFormContainerContainer.php \
        Build/Sources/TypeScript/backend/Resources/Public/TypeScript/LiveSearch.ts \
        Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngineFlexForm.ts \
        Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Settings/ExtensionConfiguration.ts \
        Build/Sources/Sass/typo3/_element_panel.scss

   (cd Build && grunt build)

Resolves: #93126
Resolves: #93123
Resolves: #93132
Related: #92616
Releases: master
Change-Id: Ie194d0f87d2c60df7b9e8a6de4893cfaaea55356
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/67215

Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: default avatarMartin Kutschker <mkutschker-typo3@yahoo.com>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: default avatarMartin Kutschker <mkutschker-typo3@yahoo.com>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
parent 89f2e9f8
......@@ -965,7 +965,7 @@ class PageLayoutView implements LoggerAwareInterface
{
$pasteIcon = json_encode(
' <button type="button"'
. ' data-content="' . htmlspecialchars((string)$pasteItem) . '"'
. ' data-bs-content="' . htmlspecialchars((string)$pasteItem) . '"'
. ' data-title="' . htmlspecialchars($pasteTitle) . '"'
. ' data-severity="warning"'
. ' class="t3js-paste t3js-paste' . htmlspecialchars($copyMode) . ' ' . htmlspecialchars($cssClass) . ' btn btn-default btn-sm"'
......@@ -1088,7 +1088,7 @@ class PageLayoutView implements LoggerAwareInterface
$out .= '<a class="btn btn-default t3js-modal-trigger" href="' . htmlspecialchars(BackendUtility::getLinkToDataHandlerAction($params)) . '"'
. ' data-severity="warning"'
. ' data-title="' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:backend/Resources/Private/Language/locallang_alt_doc.xlf:label.confirm.delete_record.title')) . '"'
. ' data-content="' . htmlspecialchars($confirm) . '" '
. ' data-bs-content="' . htmlspecialchars($confirm) . '" '
. ' data-button-close-text="' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_common.xlf:cancel')) . '"'
. ' title="' . htmlspecialchars($this->getLanguageService()->getLL('deleteItem')) . '">'
. $this->iconFactory->getIcon('actions-edit-delete', Icon::SIZE_SMALL)->render() . '</a>';
......@@ -1140,7 +1140,7 @@ class PageLayoutView implements LoggerAwareInterface
}
// Get record locking status:
if ($lockInfo = BackendUtility::isRecordLocked('tt_content', $row['uid'])) {
$additionalIcons[] = '<a href="#" data-toggle="tooltip" data-title="' . htmlspecialchars($lockInfo['msg']) . '">'
$additionalIcons[] = '<a href="#" data-bs-toggle="tooltip" data-title="' . htmlspecialchars($lockInfo['msg']) . '">'
. $this->iconFactory->getIcon('warning-in-use', Icon::SIZE_SMALL)->render() . '</a>';
}
// Call stats information hook
......
......@@ -101,7 +101,7 @@
<f:render partial="LoginNews" arguments="{_all}" />
<div class="card-footer">
<div class="typo3-login-copyright-wrap">
<a href="#loginCopyright" class="typo3-login-copyright-link collapsed" data-toggle="collapse" aria-expanded="false" aria-controls="loginCopyright">
<a href="#loginCopyright" class="typo3-login-copyright-link collapsed" data-bs-toggle="collapse" aria-expanded="false" aria-controls="loginCopyright">
<span><f:translate key="login.copyrightLink" /></span>
<img src="{images.typo3}" alt="{f:translate(key: 'login.typo3Logo')}" width="70" height="20" />
</a>
......
<div class="btn-group">
<button class="btn btn-default dropdown-toggle" type="button" id="copymodeSelector" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
<button class="btn btn-default dropdown-toggle" type="button" id="copymodeSelector" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
<f:if condition="{currentMode} == 'copy'">
<f:then>
{f:translate(key: 'LLL:EXT:core/Resources/Private/Language/locallang_misc.xlf:copyElements')}
......
<div class="btn-group">
<button class="btn btn-default dropdown-toggle" type="button" id="menuSelector" data-toggle="dropdown"
<button class="btn btn-default dropdown-toggle" type="button" id="menuSelector" data-bs-toggle="dropdown"
aria-haspopup="true" aria-expanded="true">
{f:translate(key: 'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:rm.menu')}
<span class="caret"></span>
......
<f:if condition="{loginNewsItems}">
<div class="panel-carousel carousel slide t3js-login-news-carousel" id="loginNews" data-interval="0" data-ride="carousel">
<div class="panel-carousel carousel slide t3js-login-news-carousel" id="loginNews" data-bs-interval="0" data-bs-ride="carousel">
<div class="carousel-inner">
<f:for each="{loginNewsItems}" as="item" iteration="loginNewsIterator">
<div class="item{f:if(condition: loginNewsIterator.isFirst,then: ' active')}">
<div class="carousel-item{f:if(condition: loginNewsIterator.isFirst,then: ' active')}">
<h3 class="typo3-login-news-heading">{item.header}</h3>
<f:format.html>{item.content}</f:format.html>
<span class="text-muted">{item.date}</span>
......@@ -10,11 +10,11 @@
</f:for>
</div>
<f:if condition="{loginNewsItems -> f:count()} > 1">
<a class="left typo3-login-carousel-control" href="#loginNews" role="button" data-slide="prev">
<a class="left typo3-login-carousel-control" href="#loginNews" role="button" data-bs-slide="prev">
<i class="fa fa-angle-left"></i>
<span class="sr-only"><f:translate key="login.news.previous" /></span>
</a>
<a class="right typo3-login-carousel-control" href="#loginNews" role="button" data-slide="next">
<a class="right typo3-login-carousel-control" href="#loginNews" role="button" data-bs-slide="next">
<i class="fa fa-angle-right"></i>
<span class="sr-only"><f:translate key="login.news.next" /></span>
</a>
......
......@@ -18,7 +18,7 @@
<a class="btn btn-default t3js-modal-trigger" href="{item.deleteUrl}"
data-severity="warning"
data-title="{item.deleteConfirmText}"
data-content="{item.deleteConfirmText}"
data-bs-content="{item.deleteConfirmText}"
data-button-close-text="{item.deleteCancelText}"
title="{item.deleteTitle}">
<core:icon identifier="actions-edit-delete" size="small" />
......
......@@ -17,7 +17,7 @@
<td>
<div class="btn-group">
<button class="btn btn-default dropdown-toggle" type="button" id="copymodeSelector"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
<f:for each="{currentSelection}" as="currentSelectionValue" key="currentSelectionKey">
<f:if condition="{currentSelectionKey} == {key}">
<f:then>
......
......@@ -3,7 +3,7 @@
<f:if condition="{item.content}">
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="{id}-{iteration.cycle}-heading">
<a data-toggle="collapse" title="{item.linkTitle}" data-parent="#{id}" href="#{id}-{iteration.cycle}" aria-expanded="true" aria-controls="{id}-{iteration.cycle}">
<a data-bs-toggle="collapse" title="{item.linkTitle}" data-bs-parent="#{id}" href="#{id}-{iteration.cycle}" aria-expanded="true" aria-controls="{id}-{iteration.cycle}">
<f:if condition="{item.icon}">
<f:format.raw>{item.icon}</f:format.raw>
</f:if>
......
......@@ -3,7 +3,7 @@
<f:for each="{items}" as="item" iteration="iteration">
<f:if condition="{item.content}">
<li role="presentation" class="t3js-tabmenu-item nav-item">
<a href="#{id}-{iteration.cycle}" class="nav-link {f:if(condition: '{iteration.cycle} == {defaultTabIndex}', then: ' active')}" title="{item.linkTitle}" aria-controls="{id}-{iteration.cycle}" role="tab" data-toggle="tab">
<a href="#{id}-{iteration.cycle}" class="nav-link {f:if(condition: '{iteration.cycle} == {defaultTabIndex}', then: ' active')}" title="{item.linkTitle}" aria-controls="{id}-{iteration.cycle}" role="tab" data-bs-toggle="tab">
<f:if condition="{item.icon}">
<f:format.raw>{item.icon}</f:format.raw>
</f:if>
......
......@@ -14,7 +14,7 @@
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="cropper-accordion-heading-{cropVariantIterator.cycle}">
<h4 class="panel-title">
<a role="button" data-toggle="collapse" data-parent="#accordion-cropper-variants"
<a role="button" data-bs-toggle="collapse" data-bs-parent="#accordion-cropper-variants"
href="#cropper-collapse-{cropVariantIterator.cycle}"
aria-expanded="{f:if(condition:cropVariantIterator.isFirst, then:'true', else:'false')}"
aria-controls="cropper-collapse-{cropVariantIterator.cycle}"
......@@ -48,9 +48,9 @@
<f:translate id="LLL:EXT:core/Resources/Private/Language/locallang_wizards.xlf:imwizard.aspect-ratio"/>
</label>
<div id="ratio-{cropVariantIterator.cycle}" class="ratio-buttons t3js-ratio-buttons"
data-toggle="buttons">
data-bs-toggle="buttons">
<f:for each="{cropVariant.allowedAspectRatios}" as="ratio" iteration="ratioIterator">
<label class="btn btn-secondary" data-method="setAspectRatio" data-option="{ratio.id}" title="{f:translate(id:'LLL:EXT:core/Resources/Private/Language/locallang_wizards.xlf:imwizard.set-aspect-ratio')}">
<label class="btn btn-secondary" data-method="setAspectRatio" data-bs-option="{ratio.id}" title="{f:translate(id:'LLL:EXT:core/Resources/Private/Language/locallang_wizards.xlf:imwizard.set-aspect-ratio')}">
<input
class="sr-only" id="aspectRatio-{cropVariantIterator.cycle}-{ratioIterator.cycle}"
name="aspectRatio-{cropVariantIterator.cycle}-{ratioIterator.cycle}" value="{cropVariant.id}"
......
......@@ -13,9 +13,9 @@
<f:render section="FilterNothingFound" />
</f:then>
<f:else>
<div id="new-content-element-wizard-carousel" class="carousel slide" data-ride="carousel" data-interval="false">
<div id="new-content-element-wizard-carousel" class="carousel slide" data-bs-ride="carousel" data-bs-interval="false">
<div class="carousel-inner" role="listbox">
<div class="item active" data-slide="next">
<div class="carousel-item active" data-bs-slide="next">
<div class="t3-new-content-element-wizard-title">
<h2>{f:translate(key: 'LLL:EXT:core/Resources/Private/Language/locallang_misc.xlf:1_selectType')}</h2>
</div>
......@@ -23,7 +23,7 @@
{renderedTabs -> f:format.raw()}
<f:render section="FilterNothingFound" />
</div>
<div class="item">
<div class="carousel-item">
<div class="t3-new-content-element-wizard-title">
<h2>{f:translate(key: 'LLL:EXT:core/Resources/Private/Language/locallang_misc.xlf:2_selectPosition') -> f:format.htmlspecialchars()}</h2>
</div>
......
......@@ -2,7 +2,7 @@
<div class="t3js-media-new-content-element-wizard media-new-content-element-wizard">
<f:if condition="{onClickEvent}">
<f:then>
<a href="#" class="media" onclick="{aOnClick -> f:format.htmlspecialchars()}" data-dismiss="modal">
<a href="#" class="media" onclick="{aOnClick -> f:format.htmlspecialchars()}" data-bs-dismiss="modal">
<f:if condition="{content}">
{content -> f:format.raw()}
</f:if>
......@@ -20,7 +20,7 @@
<input type="radio" class="hide" name="tempB" value="{wizardKey -> f:format.htmlspecialchars()}"
onclick="{wizardOnClick -> f:format.htmlspecialchars()}"/>
<a href="#new-content-element-wizard-carousel" class="media" onclick="{aOnClick -> f:format.htmlspecialchars()}"
data-slide="next">
data-bs-slide="next">
<f:if condition="{content}">
{content -> f:format.raw()}
</f:if>
......
......@@ -133,7 +133,7 @@
<div id="page_new_icon_{line.index}" class="input-group-addon input-group-icon">
<core:iconForRecord table="pages" row="{id: '0'}" />
</div>
<select id="page_new_select_{line.index}" class="form-control form-control-adapt t3js-newmultiplepages-select-doktype" name="pages[NEW{line.index}][doktype]" data-target="#page_new_icon_{line.index}">
<select id="page_new_select_{line.index}" class="form-control form-control-adapt t3js-newmultiplepages-select-doktype" name="pages[NEW{line.index}][doktype]" data-bs-target="#page_new_icon_{line.index}">
<f:for each="{line.pageTypes}" as="typegroup" key="group">
<optgroup label="{f:translate(key: '{group}')}">
<f:for each="{typegroup}" as="type">
......
......@@ -63,7 +63,7 @@
<core:iconForRecord table="pages" row="{page.record}" />
<f:if condition="!{page.canEdit}">
<span
data-toggle="tooltip"
data-bs-toggle="tooltip"
data-title="{f:translate(key:'LLL:EXT:backend/Resources/Private/Language/locallang_pages_sort.xlf:noEditPermissions')}"
>
<core:icon identifier="status-status-permission-denied" />
......@@ -96,7 +96,7 @@
data-severity="warning"
data-title="{f:translate(key: 'LLL:EXT:core/Resources/Private/Language/locallang_common.xlf:pleaseConfirm')}"
data-button-close-text="{f:translate(key: 'LLL:EXT:core/Resources/Private/Language/locallang_common.xlf:cancel')}"
data-content="{f:translate(key: 'LLL:EXT:backend/Resources/Private/Language/locallang_pages_sort.xlf:changeOrderConfirm')}"
data-bs-content="{f:translate(key: 'LLL:EXT:backend/Resources/Private/Language/locallang_pages_sort.xlf:changeOrderConfirm')}"
>
<f:translate key="LLL:EXT:backend/Resources/Private/Language/locallang_pages_sort.xlf:changeOrderByTitle" />
</a>
......@@ -105,7 +105,7 @@
data-severity="warning"
data-title="{f:translate(key: 'LLL:EXT:core/Resources/Private/Language/locallang_common.xlf:pleaseConfirm')}"
data-button-close-text="{f:translate(key: 'LLL:EXT:core/Resources/Private/Language/locallang_common.xlf:cancel')}"
data-content="{f:translate(key: 'LLL:EXT:backend/Resources/Private/Language/locallang_pages_sort.xlf:changeOrderConfirm')}"
data-bs-content="{f:translate(key: 'LLL:EXT:backend/Resources/Private/Language/locallang_pages_sort.xlf:changeOrderConfirm')}"
>
<f:translate key="LLL:EXT:backend/Resources/Private/Language/locallang_pages_sort.xlf:changeOrderBySubtitle" />
</a>
......@@ -114,7 +114,7 @@
data-severity="warning"
data-title="{f:translate(key: 'LLL:EXT:core/Resources/Private/Language/locallang_common.xlf:pleaseConfirm')}"
data-button-close-text="{f:translate(key: 'LLL:EXT:core/Resources/Private/Language/locallang_common.xlf:cancel')}"
data-content="{f:translate(key: 'LLL:EXT:backend/Resources/Private/Language/locallang_pages_sort.xlf:changeOrderConfirm')}"
data-bs-content="{f:translate(key: 'LLL:EXT:backend/Resources/Private/Language/locallang_pages_sort.xlf:changeOrderConfirm')}"
>
<f:translate key="LLL:EXT:backend/Resources/Private/Language/locallang_pages_sort.xlf:changeOrderByNavtitle" />
</a>
......@@ -123,7 +123,7 @@
data-severity="warning"
data-title="{f:translate(key: 'LLL:EXT:core/Resources/Private/Language/locallang_common.xlf:pleaseConfirm')}"
data-button-close-text="{f:translate(key: 'LLL:EXT:core/Resources/Private/Language/locallang_common.xlf:cancel')}"
data-content="{f:translate(key: 'LLL:EXT:backend/Resources/Private/Language/locallang_pages_sort.xlf:changeOrderConfirm')}"
data-bs-content="{f:translate(key: 'LLL:EXT:backend/Resources/Private/Language/locallang_pages_sort.xlf:changeOrderConfirm')}"
>
<f:translate key="LLL:EXT:backend/Resources/Private/Language/locallang_pages_sort.xlf:changeOrderByTstamp" />
</a>
......@@ -132,7 +132,7 @@
data-severity="warning"
data-title="{f:translate(key: 'LLL:EXT:core/Resources/Private/Language/locallang_common.xlf:pleaseConfirm')}"
data-button-close-text="{f:translate(key: 'LLL:EXT:core/Resources/Private/Language/locallang_common.xlf:cancel')}"
data-content="{f:translate(key: 'LLL:EXT:backend/Resources/Private/Language/locallang_pages_sort.xlf:changeOrderConfirm')}"
data-bs-content="{f:translate(key: 'LLL:EXT:backend/Resources/Private/Language/locallang_pages_sort.xlf:changeOrderConfirm')}"
>
<f:translate key="LLL:EXT:backend/Resources/Private/Language/locallang_pages_sort.xlf:changeOrderByCreate" />
</a>
......@@ -141,7 +141,7 @@
data-severity="warning"
data-title="{f:translate(key: 'LLL:EXT:core/Resources/Private/Language/locallang_common.xlf:pleaseConfirm')}"
data-button-close-text="{f:translate(key: 'LLL:EXT:core/Resources/Private/Language/locallang_common.xlf:cancel')}"
data-content="{f:translate(key: 'LLL:EXT:backend/Resources/Private/Language/locallang_pages_sort.xlf:changeOrderConfirm')}"
data-bs-content="{f:translate(key: 'LLL:EXT:backend/Resources/Private/Language/locallang_pages_sort.xlf:changeOrderConfirm')}"
>
<f:translate key="LLL:EXT:backend/Resources/Private/Language/locallang_pages_sort.xlf:changeOrderReverse" />
</a>
......
......@@ -12,6 +12,6 @@
</div>
</div>
</form>
<a href="#" class="dropdown-toggle t3js-toolbar-search-dropdowntoggle" data-bs-toggle="dropdown" aria-expanded="false"></a>
<a href="#" class="dropdown-toggle pull-right t3js-toolbar-search-dropdowntoggle" data-bs-toggle="dropdown" aria-expanded="false"></a>
<div class="dropdown-menu" role="menu"></div>
</html>
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -10,4 +10,4 @@
*
* The TYPO3 project - inspiring people to share!
*/
var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};define(["require","exports","TYPO3/CMS/Backend/BroadcastMessage","TYPO3/CMS/Core/Ajax/AjaxRequest","./Enum/Severity","jquery","TYPO3/CMS/Backend/BroadcastService","./Icons","./Modal","./Notification","./Viewport"],(function(e,t,a,n,s,i,r,o,l,d,c){"use strict";var h;i=__importDefault(i),function(e){e.hide=".t3js-record-hide",e.delete=".t3js-record-delete",e.icon=".t3js-icon"}(h||(h={}));class u{static refreshPageTree(){c.NavigationContainer&&c.NavigationContainer.PageTree&&c.NavigationContainer.PageTree.refreshTree()}static call(e){return new n(TYPO3.settings.ajaxUrls.record_process).withQueryArguments(e).get().then(async e=>await e.resolve())}constructor(){i.default(()=>{this.initialize()})}process(e,t){return u.call(e).then(e=>{if(e.hasErrors&&this.handleErrors(e),t){const n=Object.assign(Object.assign({},t),{hasErrors:e.hasErrors}),s=new a.BroadcastMessage("datahandler","process",n);r.post(s);const i=new CustomEvent("typo3:datahandler:process",{detail:{payload:n}});document.dispatchEvent(i)}return e})}initialize(){i.default(document).on("click",h.hide,e=>{e.preventDefault();const t=i.default(e.currentTarget),a=t.find(h.icon),n=t.closest("tr[data-uid]"),s=t.data("params");this._showSpinnerIcon(a),this.process(s).then(e=>{e.hasErrors?this.handleErrors(e):this.toggleRow(n)})}),i.default(document).on("click",h.delete,e=>{e.preventDefault();const t=i.default(e.currentTarget);t.tooltip("hide");l.confirm(t.data("title"),t.data("message"),s.SeverityEnum.warning,[{text:t.data("button-close-text")||TYPO3.lang["button.cancel"]||"Cancel",active:!0,btnClass:"btn-default",name:"cancel"},{text:t.data("button-ok-text")||TYPO3.lang["button.delete"]||"Delete",btnClass:"btn-warning",name:"delete"}]).on("button.clicked",e=>{"cancel"===e.target.getAttribute("name")?l.dismiss():"delete"===e.target.getAttribute("name")&&(l.dismiss(),this.deleteRecord(t))})})}toggleRow(e){const t=e.find(h.hide),a=t.closest("table[data-table]").data("table"),n=t.data("params");let s,r,l;"hidden"===t.data("state")?(r="visible",s=n.replace("=0","=1"),l="actions-edit-hide"):(r="hidden",s=n.replace("=1","=0"),l="actions-edit-unhide"),t.data("state",r).data("params",s),t.tooltip("hide").one("hidden.bs.tooltip",()=>{const e=t.data("toggleTitle");t.data("toggleTitle",t.attr("data-original-title")).attr("data-original-title",e)});const d=t.find(h.icon);o.getIcon(l,o.sizes.small).then(e=>{d.replaceWith(e)});const c=e.find(".col-icon "+h.icon);"hidden"===r?o.getIcon("miscellaneous-placeholder",o.sizes.small,"overlay-hidden").then(e=>{c.append(i.default(e).find(".icon-overlay"))}):c.find(".icon-overlay").remove(),e.fadeTo("fast",.4,()=>{e.fadeTo("fast",1)}),"pages"===a&&u.refreshPageTree()}deleteRecord(e){const t=e.data("params");let a=e.find(h.icon);this._showSpinnerIcon(a);const n=e.closest("table[data-table]"),s=n.data("table");let i=e.closest("tr[data-uid]");const r=i.data("uid"),l={component:"datahandler",action:"delete",table:s,uid:r};this.process(t,l).then(t=>{if(o.getIcon("actions-edit-delete",o.sizes.small).then(t=>{a=e.find(h.icon),a.replaceWith(t)}),t.hasErrors)this.handleErrors(t);else{const t=e.closest(".panel"),a=t.find(".panel-heading"),o=n.find("[data-l10nparent="+r+"]").closest("tr[data-uid]");if(i=i.add(o),i.fadeTo("slow",.4,()=>{i.slideUp("slow",()=>{i.remove(),0===n.find("tbody tr").length&&t.slideUp("slow")})}),"0"===e.data("l10parent")||""===e.data("l10parent")){const e=Number(a.find(".t3js-table-total-items").html());a.find(".t3js-table-total-items").text(e-1)}"pages"===s&&u.refreshPageTree()}})}handleErrors(e){i.default.each(e.messages,(e,t)=>{d.error(t.title,t.message)})}_showSpinnerIcon(e){o.getIcon("spinner-circle-dark",o.sizes.small).then(t=>{e.replaceWith(t)})}}return new u}));
\ No newline at end of file
var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};define(["require","exports","TYPO3/CMS/Backend/BroadcastMessage","TYPO3/CMS/Core/Ajax/AjaxRequest","./Enum/Severity","jquery","TYPO3/CMS/Backend/BroadcastService","./Icons","./Modal","./Notification","./Viewport"],(function(e,t,a,n,s,i,r,o,l,d,c){"use strict";var h;i=__importDefault(i),function(e){e.hide=".t3js-record-hide",e.delete=".t3js-record-delete",e.icon=".t3js-icon"}(h||(h={}));class u{static refreshPageTree(){c.NavigationContainer&&c.NavigationContainer.PageTree&&c.NavigationContainer.PageTree.refreshTree()}static call(e){return new n(TYPO3.settings.ajaxUrls.record_process).withQueryArguments(e).get().then(async e=>await e.resolve())}constructor(){i.default(()=>{this.initialize()})}process(e,t){return u.call(e).then(e=>{if(e.hasErrors&&this.handleErrors(e),t){const n=Object.assign(Object.assign({},t),{hasErrors:e.hasErrors}),s=new a.BroadcastMessage("datahandler","process",n);r.post(s);const i=new CustomEvent("typo3:datahandler:process",{detail:{payload:n}});document.dispatchEvent(i)}return e})}initialize(){i.default(document).on("click",h.hide,e=>{e.preventDefault();const t=i.default(e.currentTarget),a=t.find(h.icon),n=t.closest("tr[data-uid]"),s=t.data("params");this._showSpinnerIcon(a),this.process(s).then(e=>{e.hasErrors?this.handleErrors(e):this.toggleRow(n)})}),i.default(document).on("click",h.delete,e=>{e.preventDefault();const t=i.default(e.currentTarget);t.tooltip("hide");l.confirm(t.data("title"),t.data("message"),s.SeverityEnum.warning,[{text:t.data("button-close-text")||TYPO3.lang["button.cancel"]||"Cancel",active:!0,btnClass:"btn-default",name:"cancel"},{text:t.data("button-ok-text")||TYPO3.lang["button.delete"]||"Delete",btnClass:"btn-warning",name:"delete"}]).on("button.clicked",e=>{"cancel"===e.target.getAttribute("name")?l.dismiss():"delete"===e.target.getAttribute("name")&&(l.dismiss(),this.deleteRecord(t))})})}toggleRow(e){const t=e.find(h.hide),a=t.closest("table[data-table]").data("table"),n=t.data("params");let s,r,l;"hidden"===t.data("state")?(r="visible",s=n.replace("=0","=1"),l="actions-edit-hide"):(r="hidden",s=n.replace("=1","=0"),l="actions-edit-unhide"),t.data("state",r).data("params",s),t.tooltip("hide").one("hidden.bs.tooltip",()=>{const e=t.data("toggleTitle");t.data("toggleTitle",t.attr("data-bs-original-title")).attr("data-bs-original-title",e)});const d=t.find(h.icon);o.getIcon(l,o.sizes.small).then(e=>{d.replaceWith(e)});const c=e.find(".col-icon "+h.icon);"hidden"===r?o.getIcon("miscellaneous-placeholder",o.sizes.small,"overlay-hidden").then(e=>{c.append(i.default(e).find(".icon-overlay"))}):c.find(".icon-overlay").remove(),e.fadeTo("fast",.4,()=>{e.fadeTo("fast",1)}),"pages"===a&&u.refreshPageTree()}deleteRecord(e){const t=e.data("params");let a=e.find(h.icon);this._showSpinnerIcon(a);const n=e.closest("table[data-table]"),s=n.data("table");let i=e.closest("tr[data-uid]");const r=i.data("uid"),l={component:"datahandler",action:"delete",table:s,uid:r};this.process(t,l).then(t=>{if(o.getIcon("actions-edit-delete",o.sizes.small).then(t=>{a=e.find(h.icon),a.replaceWith(t)}),t.hasErrors)this.handleErrors(t);else{const t=e.closest(".panel"),a=t.find(".panel-heading"),o=n.find("[data-l10nparent="+r+"]").closest("tr[data-uid]");if(i=i.add(o),i.fadeTo("slow",.4,()=>{i.slideUp("slow",()=>{i.remove(),0===n.find("tbody tr").length&&t.slideUp("slow")})}),"0"===e.data("l10parent")||""===e.data("l10parent")){const e=Number(a.find(".t3js-table-total-items").html());a.find(".t3js-table-total-items").text(e-1)}"pages"===s&&u.refreshPageTree()}})}handleErrors(e){i.default.each(e.messages,(e,t)=>{d.error(t.title,t.message)})}_showSpinnerIcon(e){o.getIcon("spinner-circle-dark",o.sizes.small).then(t=>{e.replaceWith(t)})}}return new u}));
\ No newline at end of file
......@@ -10,4 +10,4 @@
*
* The TYPO3 project - inspiring people to share!
*/
var __importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};define(["require","exports","jquery","TYPO3/CMS/Core/Ajax/AjaxRequest","./Popover","bootstrap"],(function(t,e,a,o,l){"use strict";a=__importDefault(a);class i{constructor(){this.ajaxUrl=TYPO3.settings.ajaxUrls.context_help,this.trigger="click",this.placement="auto",this.selector=".help-link",this.initialize()}static resolveBackend(){return void 0!==window.opener&&null!==window.opener?window.opener.top:top}initialize(){const t=i.resolveBackend();void 0!==t.TYPO3.settings.ContextHelp&&(this.helpModuleUrl=t.TYPO3.settings.ContextHelp.moduleUrl),void 0===TYPO3.ShortcutMenu&&void 0===t.TYPO3.ShortcutMenu&&a.default(".icon-actions-system-shortcut-new").closest(".btn").hide();let e="&nbsp;";void 0!==t.TYPO3.lang&&(e=t.TYPO3.lang.csh_tooltip_loading);const o=a.default(this.selector);o.attr("data-loaded","false").attr("data-html","true").attr("data-original-title",e).attr("data-placement",this.placement).attr("data-trigger",this.trigger),l.popover(o),a.default(document).on("show.bs.popover",this.selector,t=>{const e=a.default(t.currentTarget),o=e.data("description");if(void 0!==o&&""!==o){const t={title:e.data("title"),content:o};l.setOptions(e,t)}else"false"===e.attr("data-loaded")&&e.data("table")&&this.loadHelp(e);e.closest(".t3js-module-docheader").length&&l.setOption(e,"placement","bottom")}).on("click",".help-has-link",t=>{a.default(".popover").each((e,o)=>{const l=a.default(o);l.has(t.target).length&&this.showHelpPopup(a.default('[aria-describedby="'+l.attr("id")+'"]'))})}).on("click","body",t=>{a.default(this.selector).each((e,o)=>{const i=a.default(o);i.is(t.target)||0!==i.has(t.target).length||0!==a.default(".popover").has(t.target).length||l.hide(i)})})}showHelpPopup(t){try{const e=window.open(this.helpModuleUrl+"&table="+t.data("table")+"&field="+t.data("field")+"&action=detail","ContextHelpWindow","height=400,width=600,status=0,menubar=0,scrollbars=1");return e.focus(),l.hide(t),e}catch(t){}}loadHelp(t){const e=t.data("table"),a=t.data("field");e&&new o(this.ajaxUrl).withQueryArguments({params:{action:"getContextHelp",table:e,field:a}}).get().then(async e=>{const a=await e.resolve(),o={title:a.title||"",content:a.content||"<p></p>"};l.setOptions(t,o),t.attr("data-loaded","true").one("hidden.bs.popover",()=>{l.show(t)}),l.hide(t)})}}return new i}));
\ No newline at end of file
var __importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};define(["require","exports","jquery","TYPO3/CMS/Core/Ajax/AjaxRequest","./Popover","bootstrap"],(function(t,e,a,o,l){"use strict";a=__importDefault(a);class s{constructor(){this.ajaxUrl=TYPO3.settings.ajaxUrls.context_help,this.trigger="click",this.placement="auto",this.selector=".help-link",this.initialize()}static resolveBackend(){return void 0!==window.opener&&null!==window.opener?window.opener.top:top}initialize(){const t=s.resolveBackend();void 0!==t.TYPO3.settings.ContextHelp&&(this.helpModuleUrl=t.TYPO3.settings.ContextHelp.moduleUrl),void 0===TYPO3.ShortcutMenu&&void 0===t.TYPO3.ShortcutMenu&&a.default(".icon-actions-system-shortcut-new").closest(".btn").hide();let e="&nbsp;";void 0!==t.TYPO3.lang&&(e=t.TYPO3.lang.csh_tooltip_loading);const o=a.default(this.selector);o.attr("data-loaded","false").attr("data-bs-html","true").attr("data-bs-original-title",e).attr("data-bs-placement",this.placement).attr("data-bs-trigger",this.trigger),l.popover(o),a.default(document).on("show.bs.popover",this.selector,t=>{const e=a.default(t.currentTarget),o=e.data("description");if(void 0!==o&&""!==o){const t={title:e.data("title"),content:o};l.setOptions(e,t)}else"false"===e.attr("data-loaded")&&e.data("table")&&this.loadHelp(e);e.closest(".t3js-module-docheader").length&&l.setOption(e,"placement","bottom")}).on("click",".help-has-link",t=>{a.default(".popover").each((e,o)=>{const l=a.default(o);l.has(t.target).length&&this.showHelpPopup(a.default('[aria-describedby="'+l.attr("id")+'"]'))})}).on("click","body",t=>{a.default(this.selector).each((e,o)=>{const s=a.default(o);s.is(t.target)||0!==s.has(t.target).length||0!==a.default(".popover").has(t.target).length||l.hide(s)})})}showHelpPopup(t){try{const e=window.open(this.helpModuleUrl+"&table="+t.data("table")+"&field="+t.data("field")+"&action=detail","ContextHelpWindow","height=400,width=600,status=0,menubar=0,scrollbars=1");return e.focus(),l.hide(t),e}catch(t){}}loadHelp(t){const e=t.data("table"),a=t.data("field");e&&new o(this.ajaxUrl).withQueryArguments({params:{action:"getContextHelp",table:e,field:a}}).get().then(async e=>{const a=await e.resolve(),o={title:a.title||"",content:a.content||"<p></p>"};l.setOptions(t,o),t.attr("data-loaded","true").one("hidden.bs.popover",()=>{l.show(t)}),l.hide(t)})}}return new s}));
\ No newline at end of file
......@@ -10,4 +10,4 @@
*
* The TYPO3 project - inspiring people to share!
*/
var __importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};define(["require","exports","jquery"],(function(t,e,s){"use strict";s=__importDefault(s);class a{constructor(){this.settings={autoscroll:!0},s.default(()=>{this.createDom()})}static incrementInactiveTabCounter(t){if(!t.hasClass("active")){const e=t.find(".badge");let s=parseInt(e.text(),10);isNaN(s)&&(s=0),e.text(++s)}}add(t,e,n){this.attachToViewport();const o=s.default("<p />").html(t);void 0!==e&&e.length>0&&o.prepend(s.default("<strong />").text(e)),void 0!==n&&0!==n.length||(n="Debug");const l="debugtab-"+n.toLowerCase().replace(/\W+/g,"-"),d=this.$consoleDom.find(".t3js-debuggroups"),i=this.$consoleDom.find(".t3js-debugcontent");let c=this.$consoleDom.find(".t3js-debuggroups li[data-identifier="+l+"]");0===c.length&&(c=s.default("<li />",{role:"presentation",class:"nav-item","data-identifier":l}).append(s.default("<a />",{"aria-controls":l,"data-toggle":"tab",class:"nav-link",href:"#"+l,role:"tab"}).text(n+" ").append(s.default("<span />",{class:"badge"}))).on("shown.bs.tab",t=>{s.default(t.currentTarget).find(".badge").text("")}),d.append(c),i.append(s.default("<div />",{role:"tabpanel",class:"tab-pane",id:l}).append(s.default("<div />",{class:"t3js-messages messages"})))),0===d.find(".active").length&&d.find("a:first").tab("show"),a.incrementInactiveTabCounter(c),this.incrementUnreadMessagesIfCollapsed();const r=s.default("#"+l+" .t3js-messages"),u=r.parent().hasClass("active");r.append(o),this.settings.autoscroll&&u&&r.scrollTop(r.prop("scrollHeight"))}createDom(){void 0===this.$consoleDom&&(this.$consoleDom=s.default("<div />",{id:"typo3-debug-console"}).append(s.default("<div />",{class:"t3js-topbar topbar"}).append(s.default("<p />",{class:"pull-left"}).text(" TYPO3 Debug Console").prepend(s.default("<span />",{class:"fa fa-terminal topbar-icon"})).append(s.default("<span />",{class:"badge"})),s.default("<div />",{class:"t3js-buttons btn-group pull-right"})),s.default("<div />").append(s.default("<div />",{role:"tabpanel"}).append(s.default("<ul />",{class:"nav nav-tabs t3js-debuggroups",role:"tablist"})),s.default("<div />",{class:"tab-content t3js-debugcontent"}))),this.addButton(s.default("<button />",{class:"btn btn-default btn-sm "+(this.settings.autoscroll?"active":""),title:TYPO3.lang["debuggerconsole.autoscroll"]}).append(s.default("<span />",{class:"t3-icon fa fa-magnet"})),()=>{s.default(this).button("toggle"),this.settings.autoscroll=!this.settings.autoscroll}).addButton(s.default("<button />",{class:"btn btn-default btn-sm",title:TYPO3.lang["debuggerconsole.toggle.collapse"]}).append(s.default("<span />",{class:"t3-icon fa fa-chevron-down"})),t=>{let e=s.default(t.currentTarget),a=e.find(".t3-icon"),n=this.$consoleDom.find(".t3js-topbar").next();n.toggle(),n.is(":visible")?(e.attr("title",TYPO3.lang["debuggerconsole.toggle.collapse"]),a.toggleClass("fa-chevron-down",!0).toggleClass("fa-chevron-up",!1),this.resetGlobalUnreadCounter()):(e.attr("title",TYPO3.lang["debuggerconsole.toggle.expand"]),a.toggleClass("fa-chevron-down",!1).toggleClass("fa-chevron-up",!0))}).addButton(s.default("<button />",{class:"btn btn-default btn-sm",title:TYPO3.lang["debuggerconsole.clear"]}).append(s.default("<span />",{class:"t3-icon fa fa-undo"})),()=>{this.flush()}).addButton(s.default("<button />",{class:"btn btn-default btn-sm",title:TYPO3.lang["debuggerconsole.close"]}).append(s.default("<span />",{class:"t3-icon fa fa-times"})),()=>{this.destroy(),this.createDom()}))}addButton(t,e){return t.on("click",e),this.$consoleDom.find(".t3js-buttons").append(t),this}attachToViewport(){const t=s.default(".t3js-scaffold-content");0===t.has(this.$consoleDom).length&&t.append(this.$consoleDom)}incrementUnreadMessagesIfCollapsed(){const t=this.$consoleDom.find(".t3js-topbar");if(t.next().is(":hidden")){const e=t.find(".badge");let s=parseInt(e.text(),10);isNaN(s)&&(s=0),e.text(++s)}}resetGlobalUnreadCounter(){this.$consoleDom.find(".t3js-topbar").find(".badge").text("")}flush(){const t=this.$consoleDom.find(".t3js-debuggroups"),e=this.$consoleDom.find(".t3js-debugcontent");t.children().remove(),e.children().remove()}destroy(){this.$consoleDom.remove(),this.$consoleDom=void 0}}const n=new a;return TYPO3.DebugConsole=n,n}));
\ No newline at end of file
var __importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};define(["require","exports","jquery"],(function(t,e,s){"use strict";s=__importDefault(s);class a{constructor(){this.settings={autoscroll:!0},s.default(()=>{this.createDom()})}static incrementInactiveTabCounter(t){if(!t.hasClass("active")){const e=t.find(".badge");let s=parseInt(e.text(),10);isNaN(s)&&(s=0),e.text(++s)}}add(t,e,n){this.attachToViewport();const o=s.default("<p />").html(t);void 0!==e&&e.length>0&&o.prepend(s.default("<strong />").text(e)),void 0!==n&&0!==n.length||(n="Debug");const l="debugtab-"+n.toLowerCase().replace(/\W+/g,"-"),d=this.$consoleDom.find(".t3js-debuggroups"),i=this.$consoleDom.find(".t3js-debugcontent");let c=this.$consoleDom.find(".t3js-debuggroups li[data-identifier="+l+"]");0===c.length&&(c=s.default("<li />",{role:"presentation",class:"nav-item","data-identifier":l}).append(s.default("<a />",{"aria-controls":l,"data-bs-toggle":"tab",class:"nav-link",href:"#"+l,role:"tab"}).text(n+" ").append(s.default("<span />",{class:"badge"}))).on("shown.bs.tab",t=>{s.default(t.currentTarget).find(".badge").text("")}),d.append(c),i.append(s.default("<div />",{role:"tabpanel",class:"tab-pane",id:l}).append(s.default("<div />",{class:"t3js-messages messages"})))),0===d.find(".active").length&&d.find("a:first").tab("show"),a.incrementInactiveTabCounter(c),this.incrementUnreadMessagesIfCollapsed();const r=s.default("#"+l+" .t3js-messages"),u=r.parent().hasClass("active");r.append(o),this.settings.autoscroll&&u&&r.scrollTop(r.prop("scrollHeight"))}createDom(){void 0===this.$consoleDom&&(this.$consoleDom=s.default("<div />",{id:"typo3-debug-console"}).append(s.default("<div />",{class:"t3js-topbar topbar"}).append(s.default("<p />",{class:"pull-left"}).text(" TYPO3 Debug Console").prepend(s.default("<span />",{class:"fa fa-terminal topbar-icon"})).append(s.default("<span />",{class:"badge"})),s.default("<div />",{class:"t3js-buttons btn-group pull-right"})),s.default("<div />").append(s.default("<div />",{role:"tabpanel"}).append(s.default("<ul />",{class:"nav nav-tabs t3js-debuggroups",role:"tablist"})),s.default("<div />",{class:"tab-content t3js-debugcontent"}))),this.addButton(s.default("<button />",{class:"btn btn-default btn-sm "+(this.settings.autoscroll?"active":""),title:TYPO3.lang["debuggerconsole.autoscroll"]}).append(s.default("<span />",{class:"t3-icon fa fa-magnet"})),()=>{s.default(this).button("toggle"),this.settings.autoscroll=!this.settings.autoscroll}).addButton(s.default("<button />",{class:"btn btn-default btn-sm",title:TYPO3.lang["debuggerconsole.toggle.collapse"]}).append(s.default("<span />",{class:"t3-icon fa fa-chevron-down"})),t=>{let e=s.default(t.currentTarget),a=e.find(".t3-icon"),n=this.$consoleDom.find(".t3js-topbar").next();n.toggle(),n.is(":visible")?(e.attr("title",TYPO3.lang["debuggerconsole.toggle.collapse"]),a.toggleClass("fa-chevron-down",!0).toggleClass("fa-chevron-up",!1),this.resetGlobalUnreadCounter()):(e.attr("title",TYPO3.lang["debuggerconsole.toggle.expand"]),a.toggleClass("fa-chevron-down",!1).toggleClass("fa-chevron-up",!0))}).addButton(s.default("<button />",{class:"btn btn-default btn-sm",title:TYPO3.lang["debuggerconsole.clear"]}).append(s.default("<span />",{class:"t3-icon fa fa-undo"})),()=>{this.flush()}).addButton(s.default("<button />",{class:"btn btn-default btn-sm",title:TYPO3.lang["debuggerconsole.close"]}).append(s.default("<span />",{class:"t3-icon fa fa-times"})),()=>{this.destroy(),this.createDom()}))}addButton(t,e){return t.on("click",e),this.$consoleDom.find(".t3js-buttons").append(t),this}attachToViewport(){const t=s.default(".t3js-scaffold-content");0===t.has(this.$consoleDom).length&&t.append(this.$consoleDom)}incrementUnreadMessagesIfCollapsed(){const t=this.$consoleDom.find(".t3js-topbar");if(t.next().is(":hidden")){const e=t.find(".badge");let s=parseInt(e.text(),10);isNaN(s)&&(s=0),e.text(++s)}}resetGlobalUnreadCounter(){this.$consoleDom.find(".t3js-topbar").find(".badge").text("")}flush(){const t=this.$consoleDom.find(".t3js-debuggroups"),e=this.$consoleDom.find(".t3js-debugcontent");t.children().remove(),e.children().remove()}destroy(){this.$consoleDom.remove(),this.$consoleDom=void 0}}const n=new a;return TYPO3.DebugConsole=n,n}));
\ No newline at end of file
......@@ -10,4 +10,4 @@
*
* The TYPO3 project - inspiring people to share!
*/
define(["require","exports","../../Utility/MessageUtility","./../InlineRelation/AjaxDispatcher","TYPO3/CMS/Core/DocumentService","nprogress","Sortable","TYPO3/CMS/Backend/FormEngine","TYPO3/CMS/Backend/FormEngineValidation","../../Icons","../../InfoWindow","../../Modal","../../Notification","TYPO3/CMS/Core/Event/RegularEvent","../../Severity","../../Utility"],(function(e,t,n,i,o,a,r,s,l,c,d,u,h,p,g,m){"use strict";var f,b,v,j;!function(e){e.toggleSelector='[data-toggle="formengine-inline"]',e.controlSectionSelector=".t3js-formengine-irre-control",e.createNewRecordButtonSelector=".t3js-create-new-button",e.createNewRecordBySelectorSelector=".t3js-create-new-selector",e.deleteRecordButtonSelector=".t3js-editform-delete-inline-record",e.enableDisableRecordButtonSelector=".t3js-toggle-visibility-button",e.infoWindowButton='[data-action="infowindow"]',e.synchronizeLocalizeRecordButtonSelector=".t3js-synchronizelocalize-button",e.uniqueValueSelectors="select.t3js-inline-unique",e.revertUniqueness=".t3js-revert-unique",e.controlContainer=".t3js-inline-controls"}(f||(f={})),function(e){e.new="inlineIsNewRecord",e.visible="panel-visible",e.collapsed="panel-collapsed",e.notLoaded="t3js-not-loaded"}(b||(b={})),function(e){e.structureSeparator="-"}(v||(v={})),function(e){e.DOWN="down",e.UP="up"}(j||(j={}));class S{constructor(e){this.container=null,this.ajaxDispatcher=null,this.appearance=null,this.requestQueue={},this.progessQueue={},this.noTitleString=TYPO3.lang?TYPO3.lang["FormEngine.noRecordTitle"]:"[No title]",this.handlePostMessage=e=>{if(!n.MessageUtility.verifyOrigin(e.origin))throw"Denied message sent by "+e.origin;if("typo3:foreignRelation:insert"===e.data.actionName){if(void 0===e.data.objectGroup)throw"No object group defined for message";if(e.data.objectGroup!==this.container.dataset.objectGroup)return;if(this.isUniqueElementUsed(parseInt(e.data.uid,10),e.data.table))return void h.error("There is already a relation to the selected element");this.importRecord([e.data.objectGroup,e.data.uid]).then(()=>{if(e.source){const t={actionName:"typo3:foreignRelation:inserted",objectGroup:e.data.objectId,table:e.data.table,uid:e.data.uid};n.MessageUtility.send(t,e.source)}})}else console.warn(`Unhandled action "${e.data.actionName}"`)},o.ready().then(t=>{this.container=t.getElementById(e),this.ajaxDispatcher=new i.AjaxDispatcher(this.container.dataset.objectGroup),this.registerEvents()})}static getInlineRecordContainer(e){return document.querySelector('[data-object-id="'+e+'"]')}static getCollapseButton(e){return document.querySelector('[aria-controls="'+e+'_fields"]')}static toggleElement(e){const t=S.getInlineRecordContainer(e);t.classList.contains(b.collapsed)?S.expandElement(t,e):S.collapseElement(t,e)}static collapseElement(e,t){const n=S.getCollapseButton(t);e.classList.remove(b.visible),e.classList.add(b.collapsed),n.setAttribute("aria-expanded","false")}static expandElement(e,t){const n=S.getCollapseButton(t);e.classList.remove(b.collapsed),e.classList.add(b.visible),n.setAttribute("aria-expanded","true")}static isNewRecord(e){return S.getInlineRecordContainer(e).classList.contains(b.new)}static updateExpandedCollapsedStateLocally(e,t){const n=S.getInlineRecordContainer(e),i="uc[inlineView]["+n.dataset.topmostParentTable+"]["+n.dataset.topmostParentUid+"]"+n.dataset.fieldName,o=document.getElementsByName(i);o.length&&(o[0].value=t?"1":"0")}static getValuesFromHashMap(e){return Object.keys(e).map(t=>e[t])}static selectOptionValueExists(e,t){return null!==e.querySelector('option[value="'+t+'"]')}static removeSelectOptionByValue(e,t){const n=e.querySelector('option[value="'+t+'"]');null!==n&&n.remove()}static reAddSelectOption(e,t,n){if(S.selectOptionValueExists(e,t))return;const i=e.querySelectorAll("option");let o=-1;for(let e of Object.keys(n.possible)){if(e===t)break;for(let t=0;t<i.length;++t){if(i[t].value===e){o=t;break}}}-1===o?o=0:o<i.length&&o++;const a=document.createElement("option");a.text=n.possible[t],a.value=t,e.insertBefore(a,e.options[o])}registerEvents(){if(this.registerInfoButton(),this.registerSort(),this.registerCreateRecordButton(),this.registerEnableDisableButton(),this.registerDeleteButton(),this.registerSynchronizeLocalize(),this.registerRevertUniquenessAction(),this.registerToggle(),this.registerCreateRecordBySelector(),this.registerUniqueSelectFieldChanged(),new p("message",this.handlePostMessage).bindTo(window),this.getAppearance().useSortable){const e=document.getElementById(this.container.getAttribute("id")+"_records");new r(e,{group:e.getAttribute("id"),handle:".sortableHandle",onSort:()=>{this.updateSorting()}})}}registerToggle(){const e=this;new p("click",(function(t){t.preventDefault(),t.stopImmediatePropagation(),e.loadRecordDetails(this.closest(f.toggleSelector).parentElement.dataset.objectId)})).delegateTo(this.container,`${f.toggleSelector} .form-irre-header-cell:not(${f.controlSectionSelector}`)}registerSort(){const e=this;new p("click",(function(t){t.preventDefault(),t.stopImmediatePropagation(),e.changeSortingByButton(this.closest("[data-object-id]").dataset.objectId,this.dataset.direction)})).delegateTo(this.container,f.controlSectionSelector+' [data-action="sort"]')}registerCreateRecordButton(){const e=this;new p("click",(function(t){var n,i;if(t.preventDefault(),t.stopImmediatePropagation(),e.isBelowMax()){let t=e.container.dataset.objectGroup;void 0!==this.dataset.recordUid&&(t+=v.structureSeparator+this.dataset.recordUid),e.importRecord([t,null===(n=e.container.querySelector(f.createNewRecordBySelectorSelector))||void 0===n?void 0:n.value],null!==(i=this.dataset.recordUid)&&void 0!==i?i:null)}})).delegateTo(this.container,f.createNewRecordButtonSelector)}registerCreateRecordBySelector(){const e=this;new p("change",(function(t){t.preventDefault(),t.stopImmediatePropagation();const n=this.options[this.selectedIndex].getAttribute("value");e.importRecord([e.container.dataset.objectGroup,n])})).delegateTo(this.container,f.createNewRecordBySelectorSelector)}createRecord(e,t,n=null,i=null){let o=this.container.dataset.objectGroup;null!==n&&(o+=v.structureSeparator+n),null!==n?(S.getInlineRecordContainer(o).insertAdjacentHTML("afterend",t),this.memorizeAddRecord(e,n,i)):(document.getElementById(this.container.getAttribute("id")+"_records").insertAdjacentHTML("beforeend",t),this.memorizeAddRecord(e,null,i))}async importRecord(e,t){return this.ajaxDispatcher.send(this.ajaxDispatcher.newRequest(this.ajaxDispatcher.getEndpoint("record_inline_create")),e).then(async e=>{this.isBelowMax()&&(this.createRecord(e.compilerInput.uid,e.data,void 0!==t?t:null,void 0!==e.compilerInput.childChildUid?e.compilerInput.childChildUid:null),s.reinitialize(),s.Validation.initializeInputFields(),s.Validation.validate())})}registerEnableDisableButton(){new p("click",(e,t)=>{e.preventDefault(),e.stopImmediatePropagation();const n=t.closest("[data-object-id]").dataset.objectId,i=S.getInlineRecordContainer(n),o="data"+i.dataset.fieldName+"["+t.dataset.hiddenField+"]",a=document.querySelector('[data-formengine-input-name="'+o+'"'),r=document.querySelector('[name="'+o+'"');null!==a&&null!==r&&(a.checked=!a.checked,r.value=a.checked?"1":"0",TBE_EDITOR.fieldChanged(this.container.dataset.localTable,this.container.dataset.uid,this.container.dataset.localField,o));const s="t3-form-field-container-inline-hidden";let l;i.classList.contains(s)?(l="actions-edit-hide",i.classList.remove(s)):(l="actions-edit-unhide",i.classList.add(s)),c.getIcon(l,c.sizes.small).then(e=>{t.replaceChild(document.createRange().createContextualFragment(e),t.querySelector(".t3js-icon"))})}).delegateTo(this.container,f.enableDisableRecordButtonSelector)}registerInfoButton(){new p("click",(function(e){e.preventDefault(),e.stopImmediatePropagation(),d.showItem(this.dataset.infoTable,this.dataset.infoUid)})).delegateTo(this.container,f.infoWindowButton)}registerDeleteButton(){const e=this;new p("click",(function(t){t.preventDefault(),t.stopImmediatePropagation();const n=TYPO3.lang["label.confirm.delete_record.title"]||"Delete this record?",i=TYPO3.lang["label.confirm.delete_record.content"]||"Are you sure you want to delete this record?";u.confirm(n,i,g.warning,[{text:TYPO3.lang["buttons.confirm.delete_record.no"]||"Cancel",active:!0,btnClass:"btn-default",name:"no"},{text:TYPO3.lang["buttons.confirm.delete_record.yes"]||"Yes, delete this record",btnClass:"btn-warning",name:"yes"}]).on("button.clicked",t=>{if("yes"===t.target.name){const t=this.closest("[data-object-id]").dataset.objectId;e.deleteRecord(t)}u.dismiss()})})).delegateTo(this.container,f.deleteRecordButtonSelector)}registerSynchronizeLocalize(){const e=this;new p("click",(function(t){t.preventDefault(),t.stopImmediatePropagation(),e.ajaxDispatcher.send(e.ajaxDispatcher.newRequest(e.ajaxDispatcher.getEndpoint("record_inline_synchronizelocalize")),[e.container.dataset.objectGroup,this.dataset.type]).then(async t=>{document.getElementById(e.container.getAttribute("id")+"_records").insertAdjacentHTML("beforeend",t.data);const n=e.container.dataset.objectGroup+v.structureSeparator;for(let i of t.compilerInput.delete)e.deleteRecord(n+i,!0);for(let i of Object.values(t.compilerInput.localize)){if(void 0!==i.remove){const e=S.getInlineRecordContainer(n+i.remove);e.parentElement.removeChild(e)}e.memorizeAddRecord(i.uid,null,i.selectedValue)}})})).delegateTo(this.container,f.synchronizeLocalizeRecordButtonSelector)}registerUniqueSelectFieldChanged(){const e=this;new p("change",(function(t){t.preventDefault(),t.stopImmediatePropagation();const n=this.closest("[data-object-id]");if(null!==n){const t=n.dataset.objectId,i=n.dataset.objectUid;e.handleChangedField(this,t);const o=e.getFormFieldForElements();if(null===o)return;e.updateUnique(this,o,i)}})).delegateTo(this.container,f.uniqueValueSelectors)}registerRevertUniquenessAction(){const e=this;new p("click",(function(t){t.preventDefault(),t.stopImmediatePropagation(),e.revertUnique(this.dataset.uid)})).delegateTo(this.container,f.revertUniqueness)}loadRecordDetails(e){const t=document.getElementById(e+"_fields"),n=S.getInlineRecordContainer(e),i=void 0!==this.requestQueue[e];if(null!==t&&!n.classList.contains(b.notLoaded))this.collapseExpandRecord(e);else{const o=this.getProgress(e,n.dataset.objectIdHash);if(i)this.requestQueue[e].abort(),delete this.requestQueue[e],delete this.progessQueue[e],o.done();else{const i=this.ajaxDispatcher.newRequest(this.ajaxDispatcher.getEndpoint("record_inline_details"));this.ajaxDispatcher.send(i,[e]).then(async i=>{if(delete this.requestQueue[e],delete this.progessQueue[e],n.classList.remove(b.notLoaded),t.innerHTML=i.data,this.collapseExpandRecord(e),o.done(),s.reinitialize(),s.Validation.initializeInputFields(),s.Validation.validate(),this.hasObjectGroupDefinedUniqueConstraints()){const t=S.getInlineRecordContainer(e);this.removeUsed(t)}}),this.requestQueue[e]=i,o.start()}}}collapseExpandRecord(e){const t=S.getInlineRecordContainer(e),n=!0===this.getAppearance().expandSingle,i=t.classList.contains(b.collapsed);let o=[];const a=[];n&&i&&(o=this.collapseAllRecords(t.dataset.objectUid)),S.toggleElement(e),S.isNewRecord(e)?S.updateExpandedCollapsedStateLocally(e,i):i?a.push(t.dataset.objectUid):i||o.push(t.dataset.objectUid),this.ajaxDispatcher.send(this.ajaxDispatcher.newRequest(this.ajaxDispatcher.getEndpoint("record_inline_expandcollapse")),[e,a.join(","),o.join(",")])}memorizeAddRecord(e,t=null,n=null){const i=this.getFormFieldForElements();if(null===i)return;let o=m.trimExplode(",",i.value);if(t){const n=[];for(let i=0;i<o.length;i++)o[i].length&&n.push(o[i]),t===o[i]&&n.push(e);o=n}else o.push(e);i.value=o.join(","),i.classList.add("has-change"),document.dispatchEvent(new Event("change")),this.redrawSortingButtons(this.container.dataset.objectGroup,o),this.setUnique(e,n),this.isBelowMax()||this.toggleContainerControls(!1),TBE_EDITOR.fieldChanged(this.container.dataset.localTable,this.container.dataset.uid,this.container.dataset.localField,i)}memorizeRemoveRecord(e){const t=this.getFormFieldForElements();if(null===t)return[];let n=m.trimExplode(",",t.value);const i=n.indexOf(e);return i>-1&&(delete n[i],t.value=n.join(","),t.classList.add("has-change"),document.dispatchEvent(new Event("change")),this.redrawSortingButtons(this.container.dataset.objectGroup,n)),n}changeSortingByButton(e,t){const n=S.getInlineRecordContainer(e),i=n.dataset.objectUid,o=document.getElementById(this.container.getAttribute("id")+"_records"),a=Array.from(o.children).map(e=>e.dataset.objectUid);let r=a.indexOf(i),s=!1;if(t===j.UP&&r>0?(a[r]=a[r-1],a[r-1]=i,s=!0):t===j.DOWN&&r<a.length-1&&(a[r]=a[r+1],a[r+1]=i,s=!0),s){const e=this.container.dataset.objectGroup+v.structureSeparator,i=t===j.UP?1:0;n.parentElement.insertBefore(S.getInlineRecordContainer(e+a[r-i]),S.getInlineRecordContainer(e+a[r+1-i])),this.updateSorting()}}updateSorting(){const e=this.getFormFieldForElements();if(null===e)return;const t=document.getElementById(this.container.getAttribute("id")+"_records"),n=Array.from(t.querySelectorAll('[data-placeholder-record="0"]')).map(e=>e.dataset.objectUid);e.value=n.join(","),e.classList.add("has-change"),document.dispatchEvent(new Event("inline:sorting-changed")),document.dispatchEvent(new Event("change")),this.redrawSortingButtons(this.container.dataset.objectGroup,n)}deleteRecord(e,t=!1){const n=S.getInlineRecordContainer(e),i=n.dataset.objectUid;if(n.classList.add("t3js-inline-record-deleted"),!S.isNewRecord(e)&&!t){const e=this.container.querySelector('[name="cmd'+n.dataset.fieldName+'[delete]"]');e.removeAttribute("disabled"),n.parentElement.insertAdjacentElement("afterbegin",e)}new p("transitionend",()=>{n.parentElement.removeChild(n),l.validate()}).bindTo(n),this.revertUnique(i),this.memorizeRemoveRecord(i),n.classList.add("form-irre-object--deleted"),this.isBelowMax()&&this.toggleContainerControls(!0)}toggleContainerControls(e){this.container.querySelector(f.controlContainer).querySelectorAll("a").forEach(t=>{t.style.display=e?null:"none"})}getProgress(e,t){const n="#"+t+"_header";let i;return void 0!==this.progessQueue[e]?i=this.progessQueue[e]:(i=a,i.configure({parent:n,showSpinner:!1}),this.progessQueue[e]=i),i}collapseAllRecords(e){const t=this.getFormFieldForElements(),n=[];if(null!==t){const i=m.trimExplode(",",t.value);for(let t of i){if(t===e)continue;const i=this.container.dataset.objectGroup+v.structureSeparator+t,o=S.getInlineRecordContainer(i);o.classList.contains(b.visible)&&(S.collapseElement(o,i),S.isNewRecord(i)?S.updateExpandedCollapsedStateLocally(i,!1):n.push(t))}}return n}getFormFieldForElements(){const e=document.getElementsByName(this.container.dataset.formField);return e.length>0?e[0]:null}redrawSortingButtons(e,t=[]){if(0===t.length){const e=this.getFormFieldForElements();null!==e&&(t=m.trimExplode(",",e.value))}0!==t.length&&t.forEach((n,i)=>{const o=S.getInlineRecordContainer(e+v.structureSeparator+n).dataset.objectIdHash+"_header",a=document.getElementById(o),r=a.querySelector('[data-action="sort"][data-direction="'+j.UP+'"]');if(null!==r){let e="actions-move-up";0===i?(r.classList.add("disabled"),e="empty-empty"):r.classList.remove("disabled"),c.getIcon(e,c.sizes.small).then(e=>{r.replaceChild(document.createRange().createContextualFragment(e),r.querySelector(".t3js-icon"))})}const s=a.querySelector('[data-action="sort"][data-direction="'+j.DOWN+'"]');if(null!==s){let e="actions-move-down";i===t.length-1?(s.classList.add("disabled"),e="empty-empty"):s.classList.remove("disabled"),c.getIcon(e,c.sizes.small).then(e=>{s.replaceChild(document.createRange().createContextualFragment(e),s.querySelector(".t3js-icon"))})}})}isBelowMax(){const e=this.getFormFieldForElements();if(null===e)return!0;if(void 0!==TYPO3.settings.FormEngineInline.config[this.container.dataset.objectGroup]){if(m.trimExplode(",",e.value).length>=TYPO3.settings.FormEngineInline.config[this.container.dataset.objectGroup].max)return!1;if(this.hasObjectGroupDefinedUniqueConstraints()){const e=TYPO3.settings.FormEngineInline.unique[this.container.dataset.objectGroup];if(e.used.length>=e.max&&e.max>=0)return!1}}return!0}isUniqueElementUsed(e,t){if(!this.hasObjectGroupDefinedUniqueConstraints())return!1;const n=TYPO3.settings.FormEngineInline.unique[this.container.dataset.objectGroup],i=S.getValuesFromHashMap(n.used);if("select"===n.type&&-1!==i.indexOf(e))return!0;if("groupdb"===n.type)for(let n=i.length-1;n>=0;n--)if(i[n].table===t&&i[n].uid===e)return!0;return!1}removeUsed(e){if(!this.hasObjectGroupDefinedUniqueConstraints())return;const t=TYPO3.settings.FormEngineInline.unique[this.container.dataset.objectGroup];if("select"!==t.type)return;let n=e.querySelector('[name="data['+t.table+"]["+e.dataset.objectUid+"]["+t.field+']"]');const i=S.getValuesFromHashMap(t.used);if(null!==n){const e=n.options[n.selectedIndex].value;for(let t of i)t!==e&&S.removeSelectOptionByValue(n,t)}}setUnique(e,t){if(!this.hasObjectGroupDefinedUniqueConstraints())return;const n=document.getElementById(this.container.dataset.objectGroup+"_selector"),i=TYPO3.settings.FormEngineInline.unique[this.container.dataset.objectGroup];if("select"===i.type){if(!i.selector||-1!==i.max){const o=this.getFormFieldForElements(),a=this.container.dataset.objectGroup+v.structureSeparator+e;let r=S.getInlineRecordContainer(a).querySelector('[name="data['+i.table+"]["+e+"]["+i.field+']"]');const s=S.getValuesFromHashMap(i.used);if(null!==n){if(null!==r){for(let e of s)S.removeSelectOptionByValue(r,e);i.selector||(t=r.options[0].value,r.options[0].selected=!0,this.updateUnique(r,o,e),this.handleChangedField(r,this.container.dataset.objectGroup+"["+e+"]"))}for(let e of s)S.removeSelectOptionByValue(r,e);void 0!==i.used.length&&(i.used={}),i.used[e]={table:i.elTable,uid:t}}if(null!==o&&S.selectOptionValueExists(n,t)){const n=m.trimExplode(",",o.value);for(let o of n)r=document.querySelector('[name="data['+i.table+"]["+o+"]["+i.field+']"]'),null!==r&&o!==e&&S.removeSelectOptionByValue(r,t)}}}else"groupdb"===i.type&&(i.used[e]={table:i.elTable,uid:t});"select"===i.selector&&S.selectOptionValueExists(n,t)&&(S.removeSelectOptionByValue(n,t),i.used[e]={table:i.elTable,uid:t})}updateUnique(e,t,n){if(!this.hasObjectGroupDefinedUniqueConstraints())return;const i=TYPO3.settings.FormEngineInline.unique[this.container.dataset.objectGroup],o=i.used[n];if("select"===i.selector){const t=document.getElementById(this.container.dataset.objectGroup+"_selector");S.removeSelectOptionByValue(t,e.value),void 0!==o&&S.reAddSelectOption(t,o,i)}if(i.selector&&-1===i.max)return;if(!i||null===t)return;const a=m.trimExplode(",",t.value);let r;for(let t of a)r=document.querySelector('[name="data['+i.table+"]["+t+"]["+i.field+']"]'),null!==r&&r!==e&&(S.removeSelectOptionByValue(r,e.value),void 0!==o&&S.reAddSelectOption(r,o,i));i.used[n]=e.value}revertUnique(e){if(!this.hasObjectGroupDefinedUniqueConstraints())return;const t=TYPO3.settings.FormEngineInline.unique[this.container.dataset.objectGroup],n=this.container.dataset.objectGroup+v.structureSeparator+e,i=S.getInlineRecordContainer(n);let o=i.querySelector('[name="data['+t.table+"]["+i.dataset.objectUid+"]["+t.field+']"]');if("select"===t.type){let n;if(null!==o)n=o.value;else{if(""===i.dataset.tableUniqueOriginalValue)return;n=i.dataset.tableUniqueOriginalValue}if("select"===t.selector&&!isNaN(parseInt(n,10))){const e=document.getElementById(this.container.dataset.objectGroup+"_selector");S.reAddSelectOption(e,n,t)}if(t.selector&&-1===t.max)return;const a=this.getFormFieldForElements();if(null===a)return;const r=m.trimExplode(",",a.value);let s;for(let e=0;e<r.length;e++)s=document.querySelector('[name="data['+t.table+"]["+r[e]+"]["+t.field+']"]'),null!==s&&S.reAddSelectOption(s,n,t);delete t.used[e]}else"groupdb"===t.type&&delete t.used[e]}hasObjectGroupDefinedUniqueConstraints(){return void 0!==TYPO3.settings.FormEngineInline.unique&&void 0!==TYPO3.settings.FormEngineInline.unique[this.container.dataset.objectGroup]}handleChangedField(e,t){let n;n=e instanceof HTMLSelectElement?e.options[e.selectedIndex].text:e.value,document.getElementById(t+"_label").textContent=n.length?n:this.noTitleString}getAppearance(){if(null===this.appearance&&(this.appearance={},"string"==typeof this.container.dataset.appearance))try{this.appearance=JSON.parse(this.container.dataset.appearance)}catch(e){console.error(e)}return this.appearance}}return S}));
\ No newline at end of file
define(["require","exports","../../Utility/MessageUtility","./../InlineRelation/AjaxDispatcher","TYPO3/CMS/Core/DocumentService","nprogress","Sortable","TYPO3/CMS/Backend/FormEngine","TYPO3/CMS/Backend/FormEngineValidation","../../Icons","../../InfoWindow","../../Modal","../../Notification","TYPO3/CMS/Core/Event/RegularEvent","../../Severity","../../Utility"],(function(e,t,n,i,o,a,r,s,l,c,d,u,h,p,g,m){"use strict";var f,b,v,j;!function(e){e.toggleSelector='[data-bs-toggle="formengine-inline"]',e.controlSectionSelector=".t3js-formengine-irre-control",e.createNewRecordButtonSelector=".t3js-create-new-button",e.createNewRecordBySelectorSelector=".t3js-create-new-selector",e.deleteRecordButtonSelector=".t3js-editform-delete-inline-record",e.enableDisableRecordButtonSelector=".t3js-toggle-visibility-button",e.infoWindowButton='[data-action="infowindow"]',e.synchronizeLocalizeRecordButtonSelector=".t3js-synchronizelocalize-button",e.uniqueValueSelectors="select.t3js-inline-unique",e.revertUniqueness=".t3js-revert-unique",e.controlContainer=".t3js-inline-controls"}(f||(f={})),function(e){e.new="inlineIsNewRecord",e.visible="panel-visible",e.collapsed="panel-collapsed",e.notLoaded="t3js-not-loaded"}(b||(b={})),function(e){e.structureSeparator="-"}(v||(v={})),function(e){e.DOWN="down",e.UP="up"}(j||(j={}));class S{constructor(e){this.container=null,this.ajaxDispatcher=null,this.appearance=null,this.requestQueue={},this.progessQueue={},this.noTitleString=TYPO3.lang?TYPO3.lang["FormEngine.noRecordTitle"]:"[No title]",this.handlePostMessage=e=>{if(!n.MessageUtility.verifyOrigin(e.origin))throw"Denied message sent by "+e.origin;if("typo3:foreignRelation:insert"===e.data.actionName){if(void 0===e.data.objectGroup)throw"No object group defined for message";if(e.data.objectGroup!==this.container.dataset.objectGroup)return;if(this.isUniqueElementUsed(parseInt(e.data.uid,10),e.data.table))return void h.error("There is already a relation to the selected element");this.importRecord([e.data.objectGroup,e.data.uid]).then(()=>{if(e.source){const t={actionName:"typo3:foreignRelation:inserted",objectGroup:e.data.objectId,table:e.data.table,uid:e.data.uid};n.MessageUtility.send(t,e.source)}})}else console.warn(`Unhandled action "${e.data.actionName}"`)},o.ready().then(t=>{this.container=t.getElementById(e),this.ajaxDispatcher=new i.AjaxDispatcher(this.container.dataset.objectGroup),this.registerEvents()})}static getInlineRecordContainer(e){return document.querySelector('[data-object-id="'+e+'"]')}static getCollapseButton(e){return document.querySelector('[aria-controls="'+e+'_fields"]')}static toggleElement(e){const t=S.getInlineRecordContainer(e);t.classList.contains(b.collapsed)?S.expandElement(t,e):S.collapseElement(t,e)}static collapseElement(e,t){const n=S.getCollapseButton(t);e.classList.remove(b.visible),e.classList.add(b.collapsed),n.setAttribute("aria-expanded","false")}static expandElement(e,t){const n=S.getCollapseButton(t);e.classList.remove(b.collapsed),e.classList.add(b.visible),n.setAttribute("aria-expanded","true")}static isNewRecord(e){return S.getInlineRecordContainer(e).classList.contains(b.new)}static updateExpandedCollapsedStateLocally(e,t){const n=S.getInlineRecordContainer(e),i="uc[inlineView]["+n.dataset.topmostParentTable+"]["+n.dataset.topmostParentUid+"]"+n.dataset.fieldName,o=document.getElementsByName(i);o.length&&(o[0].value=t?"1":"0")}static getValuesFromHashMap(e){return Object.keys(e).map(t=>e[t])}static selectOptionValueExists(e,t){return null!==e.querySelector('option[value="'+t+'"]')}static removeSelectOptionByValue(e,t){const n=e.querySelector('option[value="'+t+'"]');null!==n&&n.remove()}static reAddSelectOption(e,t,n){if(S.selectOptionValueExists(e,t))return;const i=e.querySelectorAll("option");let o=-1;for(let e of Object.keys(n.possible)){if(e===t)break;for(let t=0;t<i.length;++t){if(i[t].value===e){o=t;break}}}-1===o?o=0:o<i.length&&o++;const a=document.createElement("option");a.text=n.possible[t],a.value=t,e.insertBefore(a,e.options[o])}registerEvents(){if(this.registerInfoButton(),this.registerSort(),this.registerCreateRecordButton(),this.registerEnableDisableButton(),this.registerDeleteButton(),this.registerSynchronizeLocalize(),this.registerRevertUniquenessAction(),this.registerToggle(),this.registerCreateRecordBySelector(),this.registerUniqueSelectFieldChanged(),new p("message",this.handlePostMessage).bindTo(window),this.getAppearance().useSortable){const e=document.getElementById(this.container.getAttribute("id")+"_records");new r(e,{group:e.getAttribute("id"),handle:".sortableHandle",onSort:()=>{this.updateSorting()}})}}registerToggle(){const e=this;new p("click",(function(t){t.preventDefault(),t.stopImmediatePropagation(),e.loadRecordDetails(this.closest(f.toggleSelector).parentElement.dataset.objectId)})).delegateTo(this.container,`${f.toggleSelector} .form-irre-header-cell:not(${f.controlSectionSelector}`)}registerSort(){const e=this;new p("click",(function(t){t.preventDefault(),t.stopImmediatePropagation(),e.changeSortingByButton(this.closest("[data-object-id]").dataset.objectId,this.dataset.direction)})).delegateTo(this.container,f.controlSectionSelector+' [data-action="sort"]')}registerCreateRecordButton(){const e=this;new p("click",(function(t){var n,i;if(t.preventDefault(),t.stopImmediatePropagation(),e.isBelowMax()){let t=e.container.dataset.objectGroup;void 0!==this.dataset.recordUid&&(t+=v.structureSeparator+this.dataset.recordUid),e.importRecord([t,null===(n=e.container.querySelector(f.createNewRecordBySelectorSelector))||void 0===n?void 0:n.value],null!==(i=this.dataset.recordUid)&&void 0!==i?i:null)}})).delegateTo(this.container,f.createNewRecordButtonSelector)}registerCreateRecordBySelector(){const e=this;new p("change",(function(t){t.preventDefault(),t.stopImmediatePropagation();const n=this.options[this.selectedIndex].getAttribute("value");e.importRecord([e.container.dataset.objectGroup,n])})).delegateTo(this.container,f.createNewRecordBySelectorSelector)}createRecord(e,t,n=null,i=null){let o=this.container.dataset.objectGroup;null!==n&&(o+=v.structureSeparator+n),null!==n?(S.getInlineRecordContainer(o).insertAdjacentHTML("afterend",t),this.memorizeAddRecord(e,n,i)):(document.getElementById(this.container.getAttribute("id")+"_records").insertAdjacentHTML("beforeend",t),this.memorizeAddRecord(e,null,i))}async importRecord(e,t){return this.ajaxDispatcher.send(this.ajaxDispatcher.newRequest(this.ajaxDispatcher.getEndpoint("record_inline_create")),e).then(async e=>{this.isBelowMax()&&(this.createRecord(e.compilerInput.uid,e.data,void 0!==t?t:null,void 0!==e.compilerInput.childChildUid?e.compilerInput.childChildUid:null),s.reinitialize(),s.Validation.initializeInputFields(),s.Validation.validate())})}registerEnableDisableButton(){new p("click",(e,t)=>{e.preventDefault(),e.stopImmediatePropagation();const n=t.closest("[data-object-id]").dataset.objectId,i=S.getInlineRecordContainer(n),o="data"+i.dataset.fieldName+"["+t.dataset.hiddenField+"]",a=document.querySelector('[data-formengine-input-name="'+o+'"'),r=document.querySelector('[name="'+o+'"');null!==a&&null!==r&&(a.checked=!a.checked,r.value=a.checked?"1":"0",TBE_EDITOR.fieldChanged(this.container.dataset.localTable,this.container.dataset.uid,this.container.dataset.localField,o));const s="t3-form-field-container-inline-hidden";let l;i.classList.contains(s)?(l="actions-edit-hide",i.classList.remove(s)):(l="actions-edit-unhide",i.classList.add(s)),c.getIcon(l,c.sizes.small).then(e=>{t.replaceChild(document.createRange().createContextualFragment(e),t.querySelector(".t3js-icon"))})}).delegateTo(this.container,f.enableDisableRecordButtonSelector)}registerInfoButton(){new p("click",(function(e){e.preventDefault(),e.stopImmediatePropagation(),d.showItem(this.dataset.infoTable,this.dataset.infoUid)})).delegateTo(this.container,f.infoWindowButton)}registerDeleteButton(){const e=this;new p("click",(function(t){t.preventDefault(),t.stopImmediatePropagation();const n=TYPO3.lang["label.confirm.delete_record.title"]||"Delete this record?",i=TYPO3.lang["label.confirm.delete_record.content"]||"Are you sure you want to delete this record?";u.confirm(n,i,g.warning,[{text:TYPO3.lang["buttons.confirm.delete_record.no"]||"Cancel",active:!0,btnClass:"btn-default",name:"no"},{text:TYPO3.lang["buttons.confirm.delete_record.yes"]||"Yes, delete this record",btnClass:"btn-warning",name:"yes"}]).on("button.clicked",t=>{if("yes"===t.target.name){const t=this.closest("[data-object-id]").dataset.objectId;e.deleteRecord(t)}u.dismiss()})})).delegateTo(this.container,f.deleteRecordButtonSelector)}registerSynchronizeLocalize(){const e=this;new p("click",(function(t){t.preventDefault(),t.stopImmediatePropagation(),e.ajaxDispatcher.send(e.ajaxDispatcher.newRequest(e.ajaxDispatcher.getEndpoint("record_inline_synchronizelocalize")),[e.container.dataset.objectGroup,this.dataset.type]).then(async t=>{document.getElementById(e.container.getAttribute("id")+"_records").insertAdjacentHTML("beforeend",t.data);const n=e.container.dataset.objectGroup+v.structureSeparator;for(let i of t.compilerInput.delete)e.deleteRecord(n+i,!0);for(let i of Object.values(t.compilerInput.localize)){if(void 0!==i.remove){const e=S.getInlineRecordContainer(n+i.remove);e.parentElement.removeChild(e)}e.memorizeAddRecord(i.uid,null,i.selectedValue)}})})).delegateTo(this.container,f.synchronizeLocalizeRecordButtonSelector)}registerUniqueSelectFieldChanged(){const e=this;new p("change",(function(t){t.preventDefault(),t.stopImmediatePropagation();const n=this.closest("[data-object-id]");if(null!==n){const t=n.dataset.objectId,i=n.dataset.objectUid;e.handleChangedField(this,t);const o=e.getFormFieldForElements();if(null===o)return;e.updateUnique(this,o,i)}})).delegateTo(this.container,f.uniqueValueSelectors)}registerRevertUniquenessAction(){const e=this;new p("click",(function(t){t.preventDefault(),t.stopImmediatePropagation(),e.revertUnique(this.dataset.uid)})).delegateTo(this.container,f.revertUniqueness)}loadRecordDetails(e){const t=document.getElementById(e+"_fields"),n=S.getInlineRecordContainer(e),i=void 0!==this.requestQueue[e];if(null!==t&&!n.classList.contains(b.notLoaded))this.collapseExpandRecord(e);else{const o=this.getProgress(e,n.dataset.objectIdHash);if(i)this.requestQueue[e].abort(),delete this.requestQueue[e],delete this.progessQueue[e],o.done();else{const i=this.ajaxDispatcher.newRequest(this.ajaxDispatcher.getEndpoint("record_inline_details"));this.ajaxDispatcher.send(i,[e]).then(async i=>{if(delete this.requestQueue[e],delete this.progessQueue[e],n.classList.remove(b.notLoaded),t.innerHTML=i.data,this.collapseExpandRecord(e),o.done(),s.reinitialize(),s.Validation.initializeInputFields(),s.Validation.validate(),this.hasObjectGroupDefinedUniqueConstraints()){const t=S.getInlineRecordContainer(e);this.removeUsed(t)}}),this.requestQueue[e]=i,o.start()}}}collapseExpandRecord(e){const t=S.getInlineRecordContainer(e),n=!0===this.getAppearance().expandSingle,i=t.classList.contains(b.collapsed);let o=[];const a=[];n&&i&&(o=this.collapseAllRecords(t.dataset.objectUid)),S.toggleElement(e),S.isNewRecord(e)?S.updateExpandedCollapsedStateLocally(e,i):i?a.push(t.dataset.objectUid):i||o.push(t.dataset.objectUid),this.ajaxDispatcher.send(this.ajaxDispatcher.newRequest(this.ajaxDispatcher.getEndpoint("record_inline_expandcollapse")),[e,a.join(","),o.join(",")])}memorizeAddRecord(e,t=null,n=null){const i=this.getFormFieldForElements();if(null===i)return;let o=m.trimExplode(",",i.value);if(t){const n=[];for(let i=0;i<o.length;i++)o[i].length&&n.push(o[i]),t===o[i]&&n.push(e);o=n}else o.push(e);i.value=o.join(","),i.classList.add("has-change"),document.dispatchEvent(new Event("change")),this.redrawSortingButtons(this.container.dataset.objectGroup,o),this.setUnique(e,n),this.isBelowMax()||this.toggleContainerControls(!1),TBE_EDITOR.fieldChanged(this.container.dataset.localTable,this.container.dataset.uid,this.container.dataset.localField,i)}memorizeRemoveRecord(e){const t=this.getFormFieldForElements();if(null===t)return[];let n=m.trimExplode(",",t.value);const i=n.indexOf(e);return i>-1&&(delete n[i],t.value=n.join(","),t.classList.add("has-change"),document.dispatchEvent(new Event("change")),this.redrawSortingButtons(this.container.dataset.objectGroup,n)),n}changeSortingByButton(e,t){const n=S.getInlineRecordContainer(e),i=n.dataset.objectUid,o=document.getElementById(this.container.getAttribute("id")+"_records"),a=Array.from(o.children).map(e=>e.dataset.objectUid);let r=a.indexOf(i),s=!1;if(t===j.UP&&r>0?(a[r]=a[r-1],a[r-1]=i,s=!0):t===j.DOWN&&r<a.length-1&&(a[r]=a[r+1],a[r+1]=i,s=!0),s){const e=this.container.dataset.objectGroup+v.structureSeparator,i=t===j.UP?1:0;n.parentElement.insertBefore(S.getInlineRecordContainer(e+a[r-i]),S.getInlineRecordContainer(e+a[r+1-i])),this.updateSorting()}}updateSorting(){const e=this.getFormFieldForElements();if(null===e)return;const t=document.getElementById(this.container.getAttribute("id")+"_records"),n=Array.from(t.querySelectorAll('[data-placeholder-record="0"]')).map(e=>e.dataset.objectUid);e.value=n.join(","),e.classList.add("has-change"),document.dispatchEvent(new Event("inline:sorting-changed")),document.dispatchEvent(new Event("change")),this.redrawSortingButtons(this.container.dataset.objectGroup,n)}deleteRecord(e,t=!1){const n=S.getInlineRecordContainer(e),i=n.dataset.objectUid;if(n.classList.add("t3js-inline-record-deleted"),!S.isNewRecord(e)&&!t){const e=this.container.querySelector('[name="cmd'+n.dataset.fieldName+'[delete]"]');e.removeAttribute("disabled"),n.parentElement.insertAdjacentElement("afterbegin",e)}new p("transitionend",()=>{n.parentElement.removeChild(n),l.validate()}).bindTo(n),this.revertUnique(i),this.memorizeRemoveRecord(i),n.classList.add("form-irre-object--deleted"),this.isBelowMax()&&this.toggleContainerControls(!0)}toggleContainerControls(e){this.container.querySelector(f.controlContainer).querySelectorAll("a").forEach(t=>{t.style.display=e?null:"none"})}getProgress(e,t){const n="#"+t+"_header";let i;return void 0!==this.progessQueue[e]?i=this.progessQueue[e]:(i=a,i.configure({parent:n,showSpinner:!1}),this.progessQueue[e]=i),i}collapseAllRecords(e){const t=this.getFormFieldForElements(),n=[];if(null!==t){const i=m.trimExplode(",",t.value);for(let t of i){if(t===e)continue;const i=this.container.dataset.objectGroup+v.structureSeparator+t,o=S.getInlineRecordContainer(i);o.classList.contains(b.visible)&&(S.collapseElement(o,i),S.isNewRecord(i)?S.updateExpandedCollapsedStateLocally(i,!1):n.push(t))}}return n}getFormFieldForElements(){const e=document.getElementsByName(this.container.dataset.formField);return e.length>0?e[0]:null}redrawSortingButtons(e,t=[]){if(0===t.length){const e=this.getFormFieldForElements();null!==e&&(t=m.trimExplode(",",e.value))}0!==t.length&&t.forEach((n,i)=>{const o=S.getInlineRecordContainer(e+v.structureSeparator+n).dataset.objectIdHash+"_header",a=document.getElementById(o),r=a.querySelector('[data-action="sort"][data-direction="'+j.UP+'"]');if(null!==r){let e="actions-move-up";0===i?(r.classList.add("disabled"),e="empty-empty"):r.classList.remove("disabled"),c.getIcon(e,c.sizes.small).then(e=>{r.replaceChild(document.createRange().createContextualFragment(e),r.querySelector(".t3js-icon"))})}const s=a.querySelector('[data-action="sort"][data-direction="'+j.DOWN+'"]');if(null!==s){let e="actions-move-down";i===t.length-1?(s.classList.add("disabled"),e="empty-empty"):s.classList.remove("disabled"),c.getIcon(e,c.sizes.small).then(e=>{s.replaceChild(document.createRange().createContextualFragment(e),s.querySelector(".t3js-icon"))})}})}isBelowMax(){const e=this.getFormFieldForElements();if(null===e)return!0;if(void 0!==TYPO3.settings.FormEngineInline.config[this.container.dataset.objectGroup]){if(m.trimExplode(",",e.value).length>=TYPO3.settings.FormEngineInline.config[this.container.dataset.objectGroup].max)return!1;if(this.hasObjectGroupDefinedUniqueConstraints()){const e=TYPO3.settings.FormEngineInline.unique[this.container.dataset.objectGroup];if(e.used.length>=e.