UNPKG

@digital-blueprint/formalize-app

Version:

[GitHub Repository](https://github.com/digital-blueprint/formalize-app) | [npmjs package](https://www.npmjs.com/package/@digital-blueprint/formalize-app) | [Unpkg CDN](https://unpkg.com/browse/@digital-blueprint/formalize-app/) | [Formalize Bundle](https:

1,033 lines • 143 kB
/*!
* License: LGPL-2.1-or-later
* Dependencies:
* 
* @webcomponents/scoped-custom-element-registry: BSD-3-Clause
* @dbp-toolkit/app-shell: LGPL-2.1-or-later
* lit-html: BSD-3-Clause
* @dbp-toolkit/language-select: LGPL-2.1-or-later
* @dbp-toolkit/auth: LGPL-2.1-or-later
* @dbp-toolkit/theme-switcher: LGPL-2.1-or-later
* universal-router: MIT
* @dbp-toolkit/matomo: LGPL-2.1-or-later
* cssfilter: MIT
* xss: MIT
*/
import{A as e,C as t,S as n,T as r,_ as i,a,g as o,n as s,o as c,p as l,r as u,s as d,t as f,w as p,x as m,y as h}from"./shared/ref.DqB7ABXf.js";import{A as g,C as _,F as v,J as y,O as b,X as x,Z as S,b as C,et as w,g as T,h as E,j as D,k as O,p as k,s as A,v as j,w as M}from"./shared/directive-helpers.C6Xz79AM.js";import{t as N}from"./shared/class-map.B2bFA_il.js";import{t as ee}from"./shared/translated.Blxt0tjK.js";import{t as P}from"./shared/modal.DfjeZb2d.js";import{d as te,h as ne,m as re,p as F,s as ie}from"./shared/select2.min.DRitHUO_.js";import{t as ae}from"./shared/notification.0izelRLi.js";import{i as oe,n as I,r as se,t as ce}from"./shared/dbp-formalize-lit-element.a7wlQ90-.js";import{n as le,r as ue,t as de}from"./shared/pdf-viewer.CsTRBfhh.js";import{n as L,t as fe}from"./shared/deletion-confirmation-modal.BhX5RxrE.js";var pe=/* @__PURE__ */ r((e=>{function t(){var e={};return e[`align-content`]=!1,e[`align-items`]=!1,e[`align-self`]=!1,e[`alignment-adjust`]=!1,e[`alignment-baseline`]=!1,e.all=!1,e[`anchor-point`]=!1,e.animation=!1,e[`animation-delay`]=!1,e[`animation-direction`]=!1,e[`animation-duration`]=!1,e[`animation-fill-mode`]=!1,e[`animation-iteration-count`]=!1,e[`animation-name`]=!1,e[`animation-play-state`]=!1,e[`animation-timing-function`]=!1,e.azimuth=!1,e[`backface-visibility`]=!1,e.background=!0,e[`background-attachment`]=!0,e[`background-clip`]=!0,e[`background-color`]=!0,e[`background-image`]=!0,e[`background-origin`]=!0,e[`background-position`]=!0,e[`background-repeat`]=!0,e[`background-size`]=!0,e[`baseline-shift`]=!1,e.binding=!1,e.bleed=!1,e[`bookmark-label`]=!1,e[`bookmark-level`]=!1,e[`bookmark-state`]=!1,e.border=!0,e[`border-bottom`]=!0,e[`border-bottom-color`]=!0,e[`border-bottom-left-radius`]=!0,e[`border-bottom-right-radius`]=!0,e[`border-bottom-style`]=!0,e[`border-bottom-width`]=!0,e[`border-collapse`]=!0,e[`border-color`]=!0,e[`border-image`]=!0,e[`border-image-outset`]=!0,e[`border-image-repeat`]=!0,e[`border-image-slice`]=!0,e[`border-image-source`]=!0,e[`border-image-width`]=!0,e[`border-left`]=!0,e[`border-left-color`]=!0,e[`border-left-style`]=!0,e[`border-left-width`]=!0,e[`border-radius`]=!0,e[`border-right`]=!0,e[`border-right-color`]=!0,e[`border-right-style`]=!0,e[`border-right-width`]=!0,e[`border-spacing`]=!0,e[`border-style`]=!0,e[`border-top`]=!0,e[`border-top-color`]=!0,e[`border-top-left-radius`]=!0,e[`border-top-right-radius`]=!0,e[`border-top-style`]=!0,e[`border-top-width`]=!0,e[`border-width`]=!0,e.bottom=!1,e[`box-decoration-break`]=!0,e[`box-shadow`]=!0,e[`box-sizing`]=!0,e[`box-snap`]=!0,e[`box-suppress`]=!0,e[`break-after`]=!0,e[`break-before`]=!0,e[`break-inside`]=!0,e[`caption-side`]=!1,e.chains=!1,e.clear=!0,e.clip=!1,e[`clip-path`]=!1,e[`clip-rule`]=!1,e.color=!0,e[`color-interpolation-filters`]=!0,e[`column-count`]=!1,e[`column-fill`]=!1,e[`column-gap`]=!1,e[`column-rule`]=!1,e[`column-rule-color`]=!1,e[`column-rule-style`]=!1,e[`column-rule-width`]=!1,e[`column-span`]=!1,e[`column-width`]=!1,e.columns=!1,e.contain=!1,e.content=!1,e[`counter-increment`]=!1,e[`counter-reset`]=!1,e[`counter-set`]=!1,e.crop=!1,e.cue=!1,e[`cue-after`]=!1,e[`cue-before`]=!1,e.cursor=!1,e.direction=!1,e.display=!0,e[`display-inside`]=!0,e[`display-list`]=!0,e[`display-outside`]=!0,e[`dominant-baseline`]=!1,e.elevation=!1,e[`empty-cells`]=!1,e.filter=!1,e.flex=!1,e[`flex-basis`]=!1,e[`flex-direction`]=!1,e[`flex-flow`]=!1,e[`flex-grow`]=!1,e[`flex-shrink`]=!1,e[`flex-wrap`]=!1,e.float=!1,e[`float-offset`]=!1,e[`flood-color`]=!1,e[`flood-opacity`]=!1,e[`flow-from`]=!1,e[`flow-into`]=!1,e.font=!0,e[`font-family`]=!0,e[`font-feature-settings`]=!0,e[`font-kerning`]=!0,e[`font-language-override`]=!0,e[`font-size`]=!0,e[`font-size-adjust`]=!0,e[`font-stretch`]=!0,e[`font-style`]=!0,e[`font-synthesis`]=!0,e[`font-variant`]=!0,e[`font-variant-alternates`]=!0,e[`font-variant-caps`]=!0,e[`font-variant-east-asian`]=!0,e[`font-variant-ligatures`]=!0,e[`font-variant-numeric`]=!0,e[`font-variant-position`]=!0,e[`font-weight`]=!0,e.grid=!1,e[`grid-area`]=!1,e[`grid-auto-columns`]=!1,e[`grid-auto-flow`]=!1,e[`grid-auto-rows`]=!1,e[`grid-column`]=!1,e[`grid-column-end`]=!1,e[`grid-column-start`]=!1,e[`grid-row`]=!1,e[`grid-row-end`]=!1,e[`grid-row-start`]=!1,e[`grid-template`]=!1,e[`grid-template-areas`]=!1,e[`grid-template-columns`]=!1,e[`grid-template-rows`]=!1,e[`hanging-punctuation`]=!1,e.height=!0,e.hyphens=!1,e.icon=!1,e[`image-orientation`]=!1,e[`image-resolution`]=!1,e[`ime-mode`]=!1,e[`initial-letters`]=!1,e[`inline-box-align`]=!1,e[`justify-content`]=!1,e[`justify-items`]=!1,e[`justify-self`]=!1,e.left=!1,e[`letter-spacing`]=!0,e[`lighting-color`]=!0,e[`line-box-contain`]=!1,e[`line-break`]=!1,e[`line-grid`]=!1,e[`line-height`]=!1,e[`line-snap`]=!1,e[`line-stacking`]=!1,e[`line-stacking-ruby`]=!1,e[`line-stacking-shift`]=!1,e[`line-stacking-strategy`]=!1,e[`list-style`]=!0,e[`list-style-image`]=!0,e[`list-style-position`]=!0,e[`list-style-type`]=!0,e.margin=!0,e[`margin-bottom`]=!0,e[`margin-left`]=!0,e[`margin-right`]=!0,e[`margin-top`]=!0,e[`marker-offset`]=!1,e[`marker-side`]=!1,e.marks=!1,e.mask=!1,e[`mask-box`]=!1,e[`mask-box-outset`]=!1,e[`mask-box-repeat`]=!1,e[`mask-box-slice`]=!1,e[`mask-box-source`]=!1,e[`mask-box-width`]=!1,e[`mask-clip`]=!1,e[`mask-image`]=!1,e[`mask-origin`]=!1,e[`mask-position`]=!1,e[`mask-repeat`]=!1,e[`mask-size`]=!1,e[`mask-source-type`]=!1,e[`mask-type`]=!1,e[`max-height`]=!0,e[`max-lines`]=!1,e[`max-width`]=!0,e[`min-height`]=!0,e[`min-width`]=!0,e[`move-to`]=!1,e[`nav-down`]=!1,e[`nav-index`]=!1,e[`nav-left`]=!1,e[`nav-right`]=!1,e[`nav-up`]=!1,e[`object-fit`]=!1,e[`object-position`]=!1,e.opacity=!1,e.order=!1,e.orphans=!1,e.outline=!1,e[`outline-color`]=!1,e[`outline-offset`]=!1,e[`outline-style`]=!1,e[`outline-width`]=!1,e.overflow=!1,e[`overflow-wrap`]=!1,e[`overflow-x`]=!1,e[`overflow-y`]=!1,e.padding=!0,e[`padding-bottom`]=!0,e[`padding-left`]=!0,e[`padding-right`]=!0,e[`padding-top`]=!0,e.page=!1,e[`page-break-after`]=!1,e[`page-break-before`]=!1,e[`page-break-inside`]=!1,e[`page-policy`]=!1,e.pause=!1,e[`pause-after`]=!1,e[`pause-before`]=!1,e.perspective=!1,e[`perspective-origin`]=!1,e.pitch=!1,e[`pitch-range`]=!1,e[`play-during`]=!1,e.position=!1,e[`presentation-level`]=!1,e.quotes=!1,e[`region-fragment`]=!1,e.resize=!1,e.rest=!1,e[`rest-after`]=!1,e[`rest-before`]=!1,e.richness=!1,e.right=!1,e.rotation=!1,e[`rotation-point`]=!1,e[`ruby-align`]=!1,e[`ruby-merge`]=!1,e[`ruby-position`]=!1,e[`shape-image-threshold`]=!1,e[`shape-outside`]=!1,e[`shape-margin`]=!1,e.size=!1,e.speak=!1,e[`speak-as`]=!1,e[`speak-header`]=!1,e[`speak-numeral`]=!1,e[`speak-punctuation`]=!1,e[`speech-rate`]=!1,e.stress=!1,e[`string-set`]=!1,e[`tab-size`]=!1,e[`table-layout`]=!1,e[`text-align`]=!0,e[`text-align-last`]=!0,e[`text-combine-upright`]=!0,e[`text-decoration`]=!0,e[`text-decoration-color`]=!0,e[`text-decoration-line`]=!0,e[`text-decoration-skip`]=!0,e[`text-decoration-style`]=!0,e[`text-emphasis`]=!0,e[`text-emphasis-color`]=!0,e[`text-emphasis-position`]=!0,e[`text-emphasis-style`]=!0,e[`text-height`]=!0,e[`text-indent`]=!0,e[`text-justify`]=!0,e[`text-orientation`]=!0,e[`text-overflow`]=!0,e[`text-shadow`]=!0,e[`text-space-collapse`]=!0,e[`text-transform`]=!0,e[`text-underline-position`]=!0,e[`text-wrap`]=!0,e.top=!1,e.transform=!1,e[`transform-origin`]=!1,e[`transform-style`]=!1,e.transition=!1,e[`transition-delay`]=!1,e[`transition-duration`]=!1,e[`transition-property`]=!1,e[`transition-timing-function`]=!1,e[`unicode-bidi`]=!1,e[`vertical-align`]=!1,e.visibility=!1,e[`voice-balance`]=!1,e[`voice-duration`]=!1,e[`voice-family`]=!1,e[`voice-pitch`]=!1,e[`voice-range`]=!1,e[`voice-rate`]=!1,e[`voice-stress`]=!1,e[`voice-volume`]=!1,e.volume=!1,e[`white-space`]=!1,e.widows=!1,e.width=!0,e[`will-change`]=!1,e[`word-break`]=!0,e[`word-spacing`]=!0,e[`word-wrap`]=!0,e[`wrap-flow`]=!1,e[`wrap-through`]=!1,e[`writing-mode`]=!1,e[`z-index`]=!1,e}function n(e,t,n){}function r(e,t,n){}var i=/javascript\s*\:/gim;function a(e,t){return i.test(t)?``:t}e.whiteList=t(),e.getDefaultWhiteList=t,e.onAttr=n,e.onIgnoreAttr=r,e.safeAttrValue=a})),R=/* @__PURE__ */ r(((e,t)=>{t.exports={indexOf:function(e,t){var n,r;if(Array.prototype.indexOf)return e.indexOf(t);for(n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},forEach:function(e,t,n){var r,i;if(Array.prototype.forEach)return e.forEach(t,n);for(r=0,i=e.length;r<i;r++)t.call(n,e[r],r,e)},trim:function(e){return String.prototype.trim?e.trim():e.replace(/(^\s*)|(\s*$)/g,``)},trimRight:function(e){return String.prototype.trimRight?e.trimRight():e.replace(/(\s*$)/g,``)}}})),me=/* @__PURE__ */ r(((e,t)=>{var n=R();function r(e,t){e=n.trimRight(e),e[e.length-1]!==`;`&&(e+=`;`);var r=e.length,i=!1,a=0,o=0,s=``;function c(){if(!i){var r=n.trim(e.slice(a,o)),c=r.indexOf(`:`);if(c!==-1){var l=n.trim(r.slice(0,c)),u=n.trim(r.slice(c+1));if(l){var d=t(a,s.length,l,u,r);d&&(s+=d+`; `)}}}a=o+1}for(;o<r;o++){var l=e[o];if(l===`/`&&e[o+1]===`*`){var u=e.indexOf(`*/`,o+2);if(u===-1)break;o=u+1,a=o+1,i=!1}else l===`(`?i=!0:l===`)`?i=!1:l===`;`?i||c():l===`
`&&c()}return n.trim(s)}t.exports=r})),he=/* @__PURE__ */ r(((e,t)=>{var n=pe(),r=me();R();function i(e){return e==null}function a(e){var t={};for(var n in e)t[n]=e[n];return t}function o(e){e=a(e||{}),e.whiteList=e.whiteList||n.whiteList,e.onAttr=e.onAttr||n.onAttr,e.onIgnoreAttr=e.onIgnoreAttr||n.onIgnoreAttr,e.safeAttrValue=e.safeAttrValue||n.safeAttrValue,this.options=e}o.prototype.process=function(e){if(e||=``,e=e.toString(),!e)return``;var t=this.options,n=t.whiteList,a=t.onAttr,o=t.onIgnoreAttr,s=t.safeAttrValue;return r(e,function(e,t,r,c,l){var u=n[r],d=!1;if(u===!0?d=u:typeof u==`function`?d=u(c):u instanceof RegExp&&(d=u.test(c)),d!==!0&&(d=!1),c=s(r,c),c){var f={position:t,sourcePosition:e,source:l,isWhite:d};if(d){var p=a(r,c,f);return i(p)?r+`:`+c:p}var p=o(r,c,f);if(!i(p))return p}})},t.exports=o})),z=/* @__PURE__ */ r(((e,t)=>{var n=pe(),r=he();function i(e,t){return new r(t).process(e)}for(var a in e=t.exports=i,e.FilterCSS=r,n)e[a]=n[a];typeof window<`u`&&(window.filterCSS=t.exports)})),B=/* @__PURE__ */ r(((e,t)=>{t.exports={indexOf:function(e,t){var n,r;if(Array.prototype.indexOf)return e.indexOf(t);for(n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},forEach:function(e,t,n){var r,i;if(Array.prototype.forEach)return e.forEach(t,n);for(r=0,i=e.length;r<i;r++)t.call(n,e[r],r,e)},trim:function(e){return String.prototype.trim?e.trim():e.replace(/(^\s*)|(\s*$)/g,``)},spaceIndex:function(e){var t=/\s|\n|\t/.exec(e);return t?t.index:-1}}})),ge=/* @__PURE__ */ r((e=>{var t=z().FilterCSS,n=z().getDefaultWhiteList,r=B();function i(){return{a:[`target`,`href`,`title`],abbr:[`title`],address:[],area:[`shape`,`coords`,`href`,`alt`],article:[],aside:[],audio:[`autoplay`,`controls`,`crossorigin`,`loop`,`muted`,`preload`,`src`],b:[],bdi:[`dir`],bdo:[`dir`],big:[],blockquote:[`cite`],br:[],caption:[],center:[],cite:[],code:[],col:[`align`,`valign`,`span`,`width`],colgroup:[`align`,`valign`,`span`,`width`],dd:[],del:[`datetime`],details:[`open`],div:[],dl:[],dt:[],em:[],figcaption:[],figure:[],font:[`color`,`size`,`face`],footer:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],header:[],hr:[],i:[],img:[`src`,`alt`,`title`,`width`,`height`,`loading`],ins:[`datetime`],kbd:[],li:[],mark:[],nav:[],ol:[],p:[],pre:[],s:[],section:[],small:[],span:[],sub:[],summary:[],sup:[],strong:[],strike:[],table:[`width`,`border`,`align`,`valign`],tbody:[`align`,`valign`],td:[`width`,`rowspan`,`colspan`,`align`,`valign`],tfoot:[`align`,`valign`],th:[`width`,`rowspan`,`colspan`,`align`,`valign`],thead:[`align`,`valign`],tr:[`rowspan`,`align`,`valign`],tt:[],u:[],ul:[],video:[`autoplay`,`controls`,`crossorigin`,`loop`,`muted`,`playsinline`,`poster`,`preload`,`src`,`height`,`width`]}}var a=new t;function o(e,t,n){}function s(e,t,n){}function c(e,t,n){}function l(e,t,n){}function u(e){return e.replace(f,`&lt;`).replace(p,`&gt;`)}function d(e,t,n,i){if(n=D(n),t===`href`||t===`src`){if(n=r.trim(n),n===`#`)return`#`;if(n.substr(0,7)!==`http://`&&n.substr(0,8)!==`https://`&&n.substr(0,7)!==`mailto:`&&n.substr(0,4)!==`tel:`&&n.substr(0,11)!==`data:image/`&&n.substr(0,6)!==`ftp://`&&n.substr(0,2)!==`./`&&n.substr(0,3)!==`../`&&n[0]!==`#`&&n[0]!==`/`)return``}else if(t===`background`){if(y.lastIndex=0,y.test(n))return``}else if(t===`style`){if(b.lastIndex=0,b.test(n)||(x.lastIndex=0,x.test(n)&&(y.lastIndex=0,y.test(n))))return``;i!==!1&&(i||=a,n=i.process(n))}return n=O(n),n}var f=/</g,p=/>/g,m=/"/g,h=/&quot;/g,g=/&#([a-zA-Z0-9]*);?/gim,_=/&colon;?/gim,v=/&newline;?/gim,y=/((j\s*a\s*v\s*a|v\s*b|l\s*i\s*v\s*e)\s*s\s*c\s*r\s*i\s*p\s*t\s*|m\s*o\s*c\s*h\s*a):/gi,b=/e\s*x\s*p\s*r\s*e\s*s\s*s\s*i\s*o\s*n\s*\(.*/gi,x=/u\s*r\s*l\s*\(.*/gi;function S(e){return e.replace(m,`&quot;`)}function C(e){return e.replace(h,`"`)}function w(e){return e.replace(g,function(e,t){return t[0]===`x`||t[0]===`X`?String.fromCharCode(parseInt(t.substr(1),16)):String.fromCharCode(parseInt(t,10))})}function T(e){return e.replace(_,`:`).replace(v,` `)}function E(e){for(var t=``,n=0,i=e.length;n<i;n++)t+=e.charCodeAt(n)<32?` `:e.charAt(n);return r.trim(t)}function D(e){return e=C(e),e=w(e),e=T(e),e=E(e),e}function O(e){return e=S(e),e=u(e),e}function k(){return``}function A(e,t){typeof t!=`function`&&(t=function(){});var n=!Array.isArray(e);function i(t){return n?!0:r.indexOf(e,t)!==-1}var a=[],o=!1;return{onIgnoreTag:function(e,n,r){if(i(e)){if(r.isClosing){var s=`[/removed]`,c=r.position+s.length;return a.push([o===!1?r.position:o,c]),o=!1,s}return o||=r.position,`[removed]`}return t(e,n,r)},remove:function(e){var t=``,n=0;return r.forEach(a,function(r){t+=e.slice(n,r[0]),n=r[1]}),t+=e.slice(n),t}}}function j(e){for(var t=``,n=0;n<e.length;){var r=e.indexOf(`<!--`,n);if(r===-1){t+=e.slice(n);break}t+=e.slice(n,r);var i=e.indexOf(`-->`,r);if(i===-1)break;n=i+3}return t}function M(e){var t=e.split(``);return t=t.filter(function(e){var t=e.charCodeAt(0);return t===127?!1:t<=31?t===10||t===13:!0}),t.join(``)}e.whiteList=i(),e.getDefaultWhiteList=i,e.onTag=o,e.onIgnoreTag=s,e.onTagAttr=c,e.onIgnoreTagAttr=l,e.safeAttrValue=d,e.escapeHtml=u,e.escapeQuote=S,e.unescapeQuote=C,e.escapeHtmlEntities=w,e.escapeDangerHtml5Entities=T,e.clearNonPrintableCharacter=E,e.friendlyAttrValue=D,e.escapeAttrValue=O,e.onIgnoreTagStripAll=k,e.StripTagBody=A,e.stripCommentTag=j,e.stripBlankChar=M,e.attributeWrapSign=`"`,e.cssFilter=a,e.getDefaultCSSWhiteList=n})),_e=/* @__PURE__ */ r((e=>{var t=B();function n(e){var n=t.spaceIndex(e),r=n===-1?e.slice(1,-1):e.slice(1,n+1);return r=t.trim(r).toLowerCase(),r.slice(0,1)===`/`&&(r=r.slice(1)),r.slice(-1)===`/`&&(r=r.slice(0,-1)),r}function r(e){return e.slice(0,2)===`</`}function i(e,t,i){var a=``,o=0,s=!1,c=!1,l=0,u=e.length,d=``,f=``;chariterator:for(l=0;l<u;l++){var p=e.charAt(l);if(s===!1){if(p===`<`){s=l;continue}}else if(c===!1){if(p===`<`){a+=i(e.slice(o,l)),s=l,o=l;continue}if(p===`>`||l===u-1){a+=i(e.slice(o,s)),f=e.slice(s,l+1),d=n(f),a+=t(s,a.length,d,f,r(f)),o=l+1,s=!1;continue}if(p===`"`||p===`'`)for(var m=1,h=e.charAt(l-m);h.trim()===``||h===`=`;){if(h===`=`){c=p;continue chariterator}h=e.charAt(l-++m)}}else if(p===c){c=!1;continue}}return o<u&&(a+=i(e.substr(o))),a}var a=/[^a-zA-Z0-9\\_:.-]/gim;function o(e,n){var r=0,i=0,o=[],u=!1,f=e.length;function p(e,r){if(e=t.trim(e),e=e.replace(a,``).toLowerCase(),!(e.length<1)){var i=n(e,r||``);i&&o.push(i)}}for(var m=0;m<f;m++){var h=e.charAt(m),g,_;if(u===!1&&h===`=`){u=e.slice(r,m),r=m+1,i=e.charAt(r)===`"`||e.charAt(r)===`'`?r:c(e,m+1);continue}if(u!==!1&&m===i){if(_=e.indexOf(h,m+1),_===-1)break;g=t.trim(e.slice(i+1,_)),p(u,g),u=!1,m=_,r=m+1;continue}if(/\s|\n|\t/.test(h)){if(e=e.replace(/\s|\n|\t/g,` `),u===!1){if(_=s(e,m),_===-1){g=t.trim(e.slice(r,m)),p(g),u=!1,r=m+1;continue}m=_-1;continue}if(_=l(e,m-1),_===-1){g=t.trim(e.slice(r,m)),g=d(g),p(u,g),u=!1,r=m+1;continue}continue}}return r<e.length&&(u===!1?p(e.slice(r)):p(u,d(t.trim(e.slice(r))))),t.trim(o.join(` `))}function s(e,t){for(;t<e.length;t++){var n=e[t];if(n!==` `)return n===`=`?t:-1}}function c(e,t){for(;t<e.length;t++){var n=e[t];if(n!==` `)return n===`'`||n===`"`?t:-1}}function l(e,t){for(;t>0;t--){var n=e[t];if(n!==` `)return n===`=`?t:-1}}function u(e){return e[0]===`"`&&e[e.length-1]===`"`||e[0]===`'`&&e[e.length-1]===`'`}function d(e){return u(e)?e.substr(1,e.length-2):e}e.parseTag=i,e.parseAttr=o})),ve=/* @__PURE__ */ r(((e,t)=>{var n=z().FilterCSS,r=ge(),i=_e(),a=i.parseTag,o=i.parseAttr,s=B();function c(e){return e==null}function l(e){var t=s.spaceIndex(e);if(t===-1)return{html:``,closing:e[e.length-2]===`/`};e=s.trim(e.slice(t+1,-1));var n=e[e.length-1]===`/`;return n&&(e=s.trim(e.slice(0,-1))),{html:e,closing:n}}function u(e){var t={};for(var n in e)t[n]=e[n];return t}function d(e){var t={};for(var n in e)Array.isArray(e[n])?t[n.toLowerCase()]=e[n].map(function(e){return e.toLowerCase()}):t[n.toLowerCase()]=e[n];return t}function f(e){e=u(e||{}),e.stripIgnoreTag&&(e.onIgnoreTag&&console.error(`Notes: cannot use these two options "stripIgnoreTag" and "onIgnoreTag" at the same time`),e.onIgnoreTag=r.onIgnoreTagStripAll),e.whiteList||e.allowList?e.whiteList=d(e.whiteList||e.allowList):e.whiteList=r.whiteList,this.attributeWrapSign=e.singleQuotedAttributeValue===!0?`'`:r.attributeWrapSign,e.onTag=e.onTag||r.onTag,e.onTagAttr=e.onTagAttr||r.onTagAttr,e.onIgnoreTag=e.onIgnoreTag||r.onIgnoreTag,e.onIgnoreTagAttr=e.onIgnoreTagAttr||r.onIgnoreTagAttr,e.safeAttrValue=e.safeAttrValue||r.safeAttrValue,e.escapeHtml=e.escapeHtml||r.escapeHtml,this.options=e,e.css===!1?this.cssFilter=!1:(e.css=e.css||{},this.cssFilter=new n(e.css))}f.prototype.process=function(e){if(e||=``,e=e.toString(),!e)return``;var t=this,n=t.options,i=n.whiteList,u=n.onTag,d=n.onIgnoreTag,f=n.onTagAttr,p=n.onIgnoreTagAttr,m=n.safeAttrValue,h=n.escapeHtml,g=t.attributeWrapSign,_=t.cssFilter;n.stripBlankChar&&(e=r.stripBlankChar(e)),n.allowCommentTag||(e=r.stripCommentTag(e));var v=!1;n.stripIgnoreTagBody&&(v=r.StripTagBody(n.stripIgnoreTagBody,d),d=v.onIgnoreTag);var y=a(e,function(e,t,n,r,a){var v={sourcePosition:e,position:t,isClosing:a,isWhite:Object.prototype.hasOwnProperty.call(i,n)},y=u(n,r,v);if(!c(y))return y;if(v.isWhite){if(v.isClosing)return`</`+n+`>`;var b=l(r),x=i[n],S=o(b.html,function(e,t){var r=s.indexOf(x,e)!==-1,i=f(n,e,t,r);return c(i)?r?(t=m(n,e,t,_),t?e+`=`+g+t+g:e):(i=p(n,e,t,r),c(i)?void 0:i):i});return r=`<`+n,S&&(r+=` `+S),b.closing&&(r+=` /`),r+=`>`,r}return y=d(n,r,v),c(y)?h(r):y},h);return v&&(y=v.remove(y)),y},t.exports=f})),V=/* @__PURE__ */ e((/* @__PURE__ */ r(((e,t)=>{var n=ge(),r=_e(),i=ve();function a(e,t){return new i(t).process(e)}e=t.exports=a,e.filterXSS=a,e.FilterXSS=i,(function(){for(var t in n)e[t]=n[t];for(var i in r)e[i]=r[i]})(),typeof window<`u`&&(window.filterXSS=t.exports);function o(){return typeof self<`u`&&typeof DedicatedWorkerGlobalScope<`u`&&self instanceof DedicatedWorkerGlobalScope}o()&&(self.filterXSS=t.exports)})))(),1),ye=class extends O(k){constructor(){super(),this._i18n=h(),this.lang=this._i18n.language,this.langDir=``,this.loadingFormsTable=!1,this.showFormsTable=!1,this.showSubmissionTables=!1,this.optionsForms={},this.paginationSizeStorageKey=``,this.noFormsAvailable=!1,this.creatableModulesCount=0,this.actions=[],this.selectedFormsCount=0,this.searchInProgress=!1}static get scopedElements(){return{"dbp-mini-spinner":p,"dbp-icon":g,"dbp-tabulator-table":I,"dbp-select":ne}}static get properties(){return{...super.properties,lang:{type:String},langDir:{type:String,attribute:`lang-dir`},loadingFormsTable:{type:Boolean,attribute:!1},showFormsTable:{type:Boolean,attribute:!1},showSubmissionTables:{type:Boolean,attribute:!1},optionsForms:{type:Object,attribute:!1},paginationSizeStorageKey:{type:String,attribute:!1},noFormsAvailable:{type:Boolean,attribute:!1},creatableModulesCount:{type:Number,attribute:!1},actions:{type:Array,attribute:!1},selectedFormsCount:{type:Number,attribute:!1},searchInProgress:{type:Boolean,attribute:!1}}}update(e){e.forEach((e,t)=>{t===`lang`&&this._i18n.changeLanguage(this.lang),(t===`lang`||t===`langDir`)&&this.langDir&&w(this._i18n,this)}),super.update(e)}connectedCallback(){super.connectedCallback(),this.langDir&&w(this._i18n,this)}static get styles(){return[L,x`
                .forms-table-toolbar {
                    display: flex;
                    align-items: center;
                    gap: 1rem;
                    margin-bottom: 1rem;
                }

                .forms-table-actions {
                    display: flex;
                    align-items: center;
                    gap: 1rem;
                    margin-bottom: 0.5rem;
                }

                .forms-table-actions-select {
                    --dbp-select-border-color: var(--dbp-content);
                    --dbp-select-chevron-color: var(--dbp-content);
                    --dbp-select-placeholder-color: var(--dbp-content);
                    --dbp-select-placeholder-font-weight: var(--dbp-content);
                }

                .forms-search {
                    flex: 1;
                    min-width: 12rem;
                }

                .forms-search label {
                    clip: rect(0 0 0 0);
                    clip-path: inset(50%);
                    height: 1px;
                    overflow: hidden;
                    position: absolute;
                    white-space: nowrap;
                    width: 1px;
                }

                .forms-search .searchbar {
                    background: calc(100% - 0.5em) center no-repeat
                        url('${S(D(`search`))}');
                    background-size: 1em;
                }

                @media (max-width: 530px) {
                    .forms-table-actions {
                        align-items: stretch;
                        flex-wrap: wrap;
                    }

                    .forms-search {
                        flex-basis: 100%;
                    }
                }

                .create-form-btn {
                    display: inline-flex;
                    align-items: center;
                    gap: 0.4rem;
                }

                .create-form-btn-icon {
                    flex-shrink: 0;
                    top: 0;
                }

                .hidden {
                    display: none;
                }
            `]}getFormsTable(){return this.renderRoot?.querySelector(`#tabulator-table-forms`)??null}getSearchbar(){return this.renderRoot?.querySelector(`#forms-searchbar`)??null}handleSearch(e){e?.preventDefault();let t=this.getSearchbar();t&&(this.searchInProgress=t.value.trim()!==``,this.applySearch(t.value.trim()),this.dispatchSearchChange(t.value.trim()))}applySearch(e){let t=this.getFormsTable();if(!t)return;if(e===``){t.clearFilter();return}let n=(this.optionsForms.columns??[]).filter(e=>e.field&&e.visible!==!1&&e.formatter!==`html`).map(t=>({field:t.field,type:`like`,value:e}));t.setFilter([n])}dispatchSearchChange(e){this.dispatchEvent(new CustomEvent(`forms-search-change`,{detail:{value:e},bubbles:!0,composed:!0}))}handleResetSearch(){let e=this.getSearchbar(),t=this.getFormsTable();e&&t&&(this.searchInProgress=!1,e.value=``,t.clearFilter(),this.dispatchSearchChange(``),e.focus())}_onCreateFormClick(){this.dispatchEvent(new CustomEvent(`create-form-request`,{bubbles:!0,composed:!0}))}_onFormAction(e){let t=e.detail?.option?.value;t&&this.dispatchEvent(new CustomEvent(`form-action`,{detail:{action:t},bubbles:!0,composed:!0}))}render(){let e=this._i18n,t=this.actions;return y`
            <div class="container forms-table ${N({hidden:!this.showFormsTable})}">
                <div class="forms-table-toolbar">
                    <span
                        class="${N({hidden:!this.loadingFormsTable||this.showSubmissionTables})}">
                        <dbp-mini-spinner text="${e.t(`loading-message`)}"></dbp-mini-spinner>
                    </span>
                    <button
                        class="button is-primary create-form-btn ${N({hidden:this.creatableModulesCount===0})}"
                        type="button"
                        @click="${this._onCreateFormClick}">
                        <dbp-icon
                            class="create-form-btn-icon"
                            name="plus"
                            aria-hidden="true"></dbp-icon>
                        ${e.t(`manage-forms.create-form-button`)}
                    </button>
                </div>
                <div class="forms-table-actions">
                    <dbp-select
                        ?disabled=${this.selectedFormsCount===0||!t.some(e=>!e.disabled)}
                        @change=${this._onFormAction}
                        id="forms-table-actions-select"
                        class="forms-table-actions-select"
                        label="${e.t(`manage-forms.actions-button-text`)}"
                        align="left"
                        allow-expand
                        .options=${t}></dbp-select>
                    <form class="search-input forms-search" @submit=${this.handleSearch}>
                        <label for="forms-searchbar">
                            ${e.t(`manage-forms.search-input-label`)}:
                        </label>
                        <input
                            type="text"
                            id="forms-searchbar"
                            class="searchbar"
                            placeholder="${e.t(`manage-forms.searchbar-placeholder`)}"
                            @input=${this.handleSearch} />
                    </form>
                    <button
                        type="button"
                        class="reset-search"
                        @click=${this.handleResetSearch}
                        ?disabled=${!this.searchInProgress}>
                        <dbp-icon name="spinner-arrow" aria-hidden="true"></dbp-icon>
                        ${e.t(`manage-forms.reset-search-label`)}
                    </button>
                </div>
                <dbp-tabulator-table
                    lang="${this.lang}"
                    class="tabulator-table"
                    id="tabulator-table-forms"
                    identifier="forms-table"
                    pagination-enabled
                    pagination-size="5"
                    .paginationSizeStorageKey=${this.paginationSizeStorageKey}
                    .options=${this.optionsForms}></dbp-tabulator-table>
                ${this.noFormsAvailable?y`
                              <p class="no-forms-message">
                                  ${e.t(`manage-forms.no-forms-available`)}
                              </p>
                          `:``}
            </div>
        `}},be=class extends O(k){constructor(){super(),this._i18n=h(),this.lang=this._i18n.language,this.langDir=``,this.showFormsTable=!1,this.showSubmissionTables=!1,this.loadingSubmissionTables=!1,this.activeFormName=``,this.columnConfigurationStorageKeys={draft:``,submitted:``},this.paginationSizeStorageKey=``,this.createSubmissionUrl=``,this.hideCreateSubmissionButton=!1,this.enabledStates={draft:!1,submitted:!1},this.noSubmissionAvailable={draft:!0,submitted:!0},this.searchWidgetIsOpen={draft:!1,submitted:!1},this.isEditSubmissionEnabled={draft:!1,submitted:!1},this.enableSubmissionPermissionEditing=!1,this.isEditSubmissionPermissionEnabled={draft:!1,submitted:!1},this.isBatchTaggingEnabled={draft:!1,submitted:!1},this.isDeleteAllSubmissionEnabled={draft:!1,submitted:!1},this.isDeleteSelectedSubmissionEnabled={draft:!1,submitted:!1},this.optionsSubmissions={draft:{},submitted:{}},this.submissions={draft:[],submitted:[]},this.selectedRowCount={draft:0,submitted:0},this.allRowCount={draft:0,submitted:0},this.visibleRowCount={draft:0,submitted:0},this.searchIsActive={draft:!1,submitted:!1},this.submissionsHasAttachment={draft:!1,submitted:!1}}static get scopedElements(){return{"dbp-icon":g,"dbp-mini-spinner":p,"dbp-tabulator-table":I,"dbp-select":ne}}static get properties(){return{...super.properties,lang:{type:String},langDir:{type:String,attribute:`lang-dir`},showFormsTable:{type:Boolean,attribute:!1},showSubmissionTables:{type:Boolean,attribute:!1},loadingSubmissionTables:{type:Boolean,attribute:!1},activeFormName:{type:String,attribute:!1},columnConfigurationStorageKeys:{type:Object,attribute:!1},paginationSizeStorageKey:{type:String,attribute:!1},createSubmissionUrl:{type:String,attribute:!1},hideCreateSubmissionButton:{type:Boolean,attribute:!1},enabledStates:{type:Object,attribute:!1},noSubmissionAvailable:{type:Object,attribute:!1},searchWidgetIsOpen:{type:Object,attribute:!1},isEditSubmissionEnabled:{type:Object,attribute:!1},enableSubmissionPermissionEditing:{type:Boolean,attribute:!1},isEditSubmissionPermissionEnabled:{type:Object,attribute:!1},isBatchTaggingEnabled:{type:Object,attribute:!1},isDeleteAllSubmissionEnabled:{type:Object,attribute:!1},isDeleteSelectedSubmissionEnabled:{type:Object,attribute:!1},optionsSubmissions:{type:Object,attribute:!1},submissions:{type:Object,attribute:!1},selectedRowCount:{type:Object,attribute:!1},allRowCount:{type:Object,attribute:!1},visibleRowCount:{type:Object,attribute:!1},searchIsActive:{type:Object,attribute:!1},submissionsHasAttachment:{type:Object,attribute:!1}}}update(e){e.forEach((e,t)=>{t===`lang`&&this._i18n.changeLanguage(this.lang),(t===`lang`||t===`langDir`)&&this.langDir&&w(this._i18n,this)}),super.update(e)}connectedCallback(){super.connectedCallback(),this.langDir&&w(this._i18n,this)}static get styles(){return L}getSubmissionTable(e){return this.renderRoot?.querySelector(`#tabulator-table-submissions-${e}`)??null}getSearchbar(e){return this.renderRoot?.querySelector(`#searchbar--${e}`)??null}getSearchSelect(e){return this.renderRoot?.querySelector(`#search-select--${e}`)??null}getSearchOperator(e){return this.renderRoot?.querySelector(`#search-operator--${e}`)??null}getActionsContainers(){return this.renderRoot?.querySelectorAll(`.actions-container`)??[]}closeAllSearchWidgets(){this.searchWidgetIsOpen={draft:!1,submitted:!1}}handleBackToOverview(){this.closeAllSearchWidgets(),this.dispatchEvent(new CustomEvent(`back-to-overview`,{bubbles:!0,composed:!0}))}handleSearch(e){this.dispatchEvent(new CustomEvent(`submission-search`,{detail:{state:e},bubbles:!0,composed:!0}))}handleResetSearch(e){this.dispatchEvent(new CustomEvent(`submission-search-reset`,{detail:{state:e},bubbles:!0,composed:!0}))}handleAction(e,t,n=null){this.dispatchEvent(new CustomEvent(`submission-action`,{detail:{action:e,state:t,payload:n},bubbles:!0,composed:!0}))}toggleSearchFilters(e){let t=!this.searchWidgetIsOpen[e];this.searchWidgetIsOpen={...this.searchWidgetIsOpen,[e]:t},this.dispatchEvent(new CustomEvent(`submission-search-toggle`,{detail:{state:e,open:t},bubbles:!0,composed:!0}))}getTableHeaderOptions(e){let t=this._i18n;if(this.submissions[e].length===0)return[];let n=[];n.push(y`
            <option value="all">${t.t(`manage-forms.all-columns`)}</option>
        `);let r=Object.keys(this.submissions[e][0]);for(let e of r)e&&e!==`htmlButtons`&&n.push(y`
                    <option value="${e}">${e}</option>
                `);return n}getTableFilterOptions(){let e=this._i18n;return y`
            <option value="like">${e.t(`manage-forms.search-operator-like`)}</option>
            <option value="=">${e.t(`manage-forms.search-operator-equal`)}</option>
            <option value="!=">${e.t(`manage-forms.search-operator-notequal`)}</option>
            <option value="starts">${e.t(`manage-forms.search-operator-starts`)}</option>
            <option value="ends">${e.t(`manage-forms.search-operator-ends`)}</option>
            <option value="<">${e.t(`manage-forms.search-operator-less`)}</option>
            <option value="<=">${e.t(`manage-forms.search-operator-lessthanorequal`)}</option>
            <option value=">">${e.t(`manage-forms.search-operator-greater`)}</option>
            <option value=">=">${e.t(`manage-forms.search-operator-greaterorequal`)}</option>
            <option value="regex">${e.t(`manage-forms.search-operator-regex`)}</option>
            <option value="keywords">${e.t(`manage-forms.search-operator-keywords`)}</option>
        `}getExportOptions(e){let t=this._i18n,n=this.selectedRowCount[e]>0?this.selectedRowCount[e]:this.searchIsActive[e]?this.visibleRowCount[e]:this.allRowCount[e],r=[];return r.push({value:`csv`,label:t.t(`manage-forms.export-csv-label`,{n}),iconName:`download`}),r.push({value:`xlsx`,label:t.t(`manage-forms.export-xlsx-label`,{n}),iconName:`download`}),r.push({value:`pdf`,label:t.t(`manage-forms.export-pdf-label`,{n}),iconName:`download`}),this.submissionsHasAttachment[e]&&r.push({value:`attachments`,label:t.t(`manage-forms.export-attachments-label`,{n}),iconName:`folder`}),r}renderExportWidget(e){let t=this._i18n;return y`
            <div class="export-container">
                <dbp-select
                    id="export-dropdown--${e}"
                    class="export-dropdown"
                    @change="${t=>{this.handleAction(`export`,e,{event:t})}}"
                    label="${t.t(`manage-forms.default-export-select`)}"
                    align="right"
                    allow-expand
                    .options="${this.getExportOptions(e)}"></dbp-select>
            </div>
        `}handleActionsDropdownChange(e,t){if(e.detail&&e.detail.option&&e.detail.value){let n=e.detail.option;if(n.value===`edit-submission`){this.handleAction(`edit-submission`,t,{event:e});return}if(n.value===`batch-tagging`){this.handleAction(`batch-tagging`,t);return}if(n.value===`edit-permission`){this.handleAction(`edit-permission`,t);return}if(n.value===`delete-all`){this.handleAction(`delete-all`,t);return}if(n.value===`delete-selected`){this.handleAction(`delete-selected`,t);return}}}renderActionsWidget(e){let t=this._i18n,n=[];return n.push({value:`edit-submission`,disabled:!this.isEditSubmissionEnabled[e],label:t.t(`manage-forms.edit-submission-button-text`),iconName:`pencil`}),n.push({value:`batch-tagging`,disabled:!this.isBatchTaggingEnabled[e],label:t.t(`manage-forms.batch-tagging-button-text`),iconName:`tags`}),this.enableSubmissionPermissionEditing&&n.push({value:`edit-permission`,disabled:!this.isEditSubmissionPermissionEnabled[e],label:t.t(`manage-forms.edit-permission-button-text`),iconName:`edit-permission`}),this.isDeleteAllSubmissionEnabled[e]&&n.push({value:`delete-all`,label:t.t(`manage-forms.delete-all-submissions-button-text`,{n:this.allRowCount[e]}),iconName:`trash`}),this.isDeleteSelectedSubmissionEnabled[e]&&n.push({value:`delete-selected`,label:t.t(`manage-forms.delete-selected-submissions-button-text`,{n:this.selectedRowCount[e]}),iconName:`delete-selection`}),y`
            <div class="actions-container" id="actions-container--${e}">
                <dbp-select
                    id="action-dropdown--${e}"
                    class="action-dropdown-state"
                    ?disabled=${!this.isActionAvailable[e]}
                    @change="${t=>this.handleActionsDropdownChange(t,e)}"
                    label="${t.t(`manage-forms.actions-button-text`)}"
                    align="left"
                    allow-expand
                    .options="${n}"></dbp-select>
            </div>
        `}renderSearchWidget(e,t){let n=this._i18n;return y`
            <div class="search-input">
                <label for="searchbar--${e}">
                    ${n.t(`manage-forms.search-input-label`)}:
                </label>

                <input
                    type="text"
                    id="searchbar--${e}"
                    data-state="${e}"
                    class="searchbar"
                    placeholder="${n.t(`manage-forms.searchbar-placeholder`)}"
                    @input=${()=>this.handleSearch(e)} />

                <button
                    class="button search-button"
                    id="search-button--${e}"
                    title="${n.t(`manage-forms.search-button`)}"
                    aria-label="${n.t(`manage-forms.search-button-aria`,{tableName:t})}"
                    @click="${()=>{this.handleSearch(e)}}">
                    <dbp-icon name="search" aria-hidden="true"></dbp-icon>
                </button>

                <button
                    class="button search-toggle-filters-button"
                    id="search-toggle-filters-button--${e}"
                    aria-expanded="${this.searchWidgetIsOpen[e]}"
                    aria-controls="search-filter-columns--${e} search-filter-operator--${e}"
                    title="${n.t(`manage-forms.open-search-filters`)}"
                    @click="${()=>{this.toggleSearchFilters(e)}}">
                    <dbp-icon name="chevron-down" aria-hidden="true"></dbp-icon>
                    <span class="button-text">
                        ${this.searchWidgetIsOpen[e]?n.t(`manage-forms.close-search-filters`):n.t(`manage-forms.open-search-filters`)}
                    </span>
                </button>
            </div>

            <div
                id="search-filter-columns--${e}"
                role="region"
                aria-label="${n.t(`manage-forms.search-filters-region`)}"
                class="search-filter-columns ${N({open:this.searchWidgetIsOpen[e]})}">
                <label for="search-select-${e}">${n.t(`manage-forms.search-in`)}:</label>
                <select
                    id="search-select--${e}"
                    class="button dropdown-menu search-select"
                    title="${n.t(`manage-forms.search-in-column`)}"
                    @change="${()=>{this.handleSearch(e)}}">
                    <optgroup label="${n.t(`manage-forms.search-in-column`)}">
                        <legend>${n.t(`manage-forms.search-in-column`)}:</legend>
                        ${this.getTableHeaderOptions(e)}
                    </optgroup>
                </select>
                <!-- Purely decorative chevron, the adjacent select already carries the label -->
                <dbp-icon name="chevron-down" aria-hidden="true"></dbp-icon>
            </div>

            <div
                id="search-filter-operator--${e}"
                role="region"
                aria-label="${n.t(`manage-forms.search-operator`)}"
                class="search-filter-operator ${N({open:this.searchWidgetIsOpen[e]})}">
                <label for="search-operator--${e}">
                    ${n.t(`manage-forms.search-operator`)}:
                </label>
                <select
                    id="search-operator--${e}"
                    title="${n.t(`manage-forms.search-operator`)}"
                    class="button dropdown-menu search-operator"
                    @change="${()=>{this.handleSearch(e)}}">
                    <optgroup label="${n.t(`manage-forms.search-operator`)}">
                        <legend>${n.t(`manage-forms.search-operator`)}:</legend>
                        ${this.getTableFilterOptions()}
                    </optgroup>
                </select>
                <!-- Purely decorative chevron, the adjacent select already carries the label -->
                <dbp-icon name="chevron-down" aria-hidden="true"></dbp-icon>
            </div>
            <button
                class="button search-toggle-filters-button"
                id="search-toggle-filters-button--${e}"
                aria-expanded="${this.searchWidgetIsOpen[e]}"
                aria-controls="search-filter-columns--${e} search-filter-operator--${e}"
                title="${n.t(`manage-forms.open-search-filters`)}"
                @click="${()=>{this.toggleSearchFilters(e)}}">
                <dbp-icon name="chevron-down" aria-hidden="true"></dbp-icon>
                <span class="button-text">
                    ${this.searchWidgetIsOpen[e]?n.t(`manage-forms.close-search-filters`):n.t(`manage-forms.open-search-filters`)}
                </span>
            </button>
        `}renderStatusBar(e){let t=this._i18n,n=this.visibleRowCount?.[e]??0,r=this.selectedRowCount?.[e]??0;return y`
            <div class="statusbar" role="status" aria-live="polite" aria-atomic="true">
                <span class="selection-info">
                    ${t.t(`manage-forms.n-items-shown-label`,{n})}
                    ${r>0?y`
                                  ,
                                  ${t.t(`manage-forms.n-items-selected-label`,{n:r})}
                              `:``}
                </span>
                <button
                    class="reset-search"
                    ?disabled="${this.searchIsActive[e]===!1}"
                    @click="${()=>{this.handleResetSearch(e)}}">
                    <dbp-icon name="spinner-arrow" aria-hidden="true"></dbp-icon>
                    ${t.t(`manage-forms.reset-search-label`)}
                </button>
            </div>
        `}handleSelectionCountChanged(e,t){let n=t.detail?.count??0;this.selectedRowCount={...this.selectedRowCount,[e]:n}}render(){let e=this._i18n,t={draft:e.t(`manage-forms.submission-table-draft-title`),submitted:e.t(`manage-forms.submission-table-submitted-title`)};return y`
            <div
                class="table-wrapper submissions${N({hideWithoutDisplay:!this.showSubmissionTables})}">
                <div class="submissions-top-bar">
                    <span class="back-navigation">
                        <button
                            type="button"
                            @click="${()=>this.handleBackToOverview()}"
                            title="${e.t(`manage-forms.back-text`)}">
                            <dbp-icon name="chevron-left"></dbp-icon>
                            ${e.t(`manage-forms.back-text`)}
                        </button>
                    </span>
                    <span
                        class="loading submissions-spinner ${N({hidden:!this.loadingSubmissionTables||this.showFormsTable})}">
                        <dbp-mini-spinner text="${e.t(`loading-message`)}"></dbp-mini-spinner>
                    </span>
                </div>
                <div class="table-header submissions">
                    <h2 class="form-name">${this.activeFormName}</h2>
                    ${this.createSubmissionUrl&&!this.hideCreateSubmissionButton?y`
                                  <a
                                      class="button is-primary"
                                      href="${this.createSubmissionUrl}"
                                      target="_blank">
                                      <dbp-icon name="plus" aria-hidden="true"></dbp-icon>
                                      ${e.t(`manage-forms.create-submission-button`)}
                                  </a>
                              `:``}
                </div>
            </div>

            <div
                class="container submissions-table ${N({hidden:!this.showSubmissionTables})}">
                ${Object.values(c).map(e=>y`
                        <div
                            class="${N({hidden:!this.enabledStates[e]})}">
                            <h3 class="table-title">${t[e]}</h3>

                            <div
                                class="${N({open:this.searchWidgetIsOpen[e],"table-action-header":!0,[`table-action-header--${e}`]:!0})}">
                                ${this.noSubmissionAvailable[e]===!0?``:y`
                                              ${this.renderActionsWidget(e)}
                                              ${this.renderSearchWidget(e,t[e])}
                                              ${this.renderExportWidget(e)}
                                          `}
                            </div>
                            ${this.noSubmissionAvailable[e]===!0?``:y`
                                          ${this.renderStatusBar(e)}
                                      `}

                            <dbp-tabulator-table
                                lang="${this.lang}"
                                class="tabulator-table tabulator-table--${e}"
                                id="tabulator-table-submissions-${e}"
                                data-state="${e}"
                                identifier="submissions-table-${e}"
                                .options=${this.optionsSubmissions[e]}
                                pagination-size="5"
                                .paginationSizeStorageKey=${this.paginationSizeStorageKey}
                                sticky-header
                                select-rows-enabled
                                column-configuration-enabled
                                column-configuration-in-header
                                .columnConfigurationExcludedFields=${[`rowIndex`,`htmlButtons`]}
                                .columnConfigurationStorageKey=${this.columnConfigurationStorageKeys[e]}
                                @dbp-tabulator-table-selection-count-changed=${t=>this.handleSelectionCountChanged(e,t)}></dbp-tabulator-table>
                        </div>
                    `)}
            </div>
        `}},xe=class extends O(k){constructor(){super(),this._i18n=h(),this.lang=this._i18n.language,this.state=``,this.hiddenColumns=!1,this.isPrevEnabled=!1,this.isNextEnabled=!1,this.currentBeautyId=0,this.totalItems=0,this.auth={},this.isPdfPreviewOpen=!1,this.contentItems=[],this.boundHandleKeydown=this.handleKeydown.bind(this),this.boundHandlePdfModalClosed=this.handlePdfModalClosed.bind(this),this.boundHandleModalClosed=this.handleModalClosed.bind(this)}static get scopedElements(){return{"dbp-button":m,"dbp-icon":g,"dbp-file-sink":ue,"dbp-modal":P,"dbp-pdf-viewer":de}}static get properties(){return{...super.properties,lang:{type:String},state:{type:String},hiddenColumns:{type:Boolean,attribute:!1},isPrevEnabled:{type:Boolean,attribute:!1},isNextEnabled:{type:Boolean,attribute:!1},currentBeautyId:{type:Number,attribute:!1},totalItems:{type:Number,attribute:!1},auth:{type:Object,attribute:!1},isPdfPreviewOpen:{type:Boolean,attribute:!1},contentItems:{type:Array,attribute:!1}}}update(e){e.forEach((e,t)=>{t===`lang`&&this._i18n.changeLanguage(this.lang)}),super.update(e)}static get styles(){return[L,x`
                .submitted-files .file-block + .file-block {
                    margin-top: 0.75rem;
                }

                .submitted-files .file-action-buttons {
                    margin-top: 0.5rem;
                }

                dbp-modal.detailed-submission-modal {
                    --dbp-modal-width: 65vw;
                    --dbp-modal-max-width: 1280px;
                    --dbp-modal-min-width: 768px;
                    --dbp-modal-min-height: 0;
                    --dbp-modal-content-overflow-y: hidden;
                }

                .detailed-submission-footer .modal-footer-btn {
                    padding: 16px 0 0;
                }

                @media only screen and (max-width: 900px) {
                    dbp-modal.detailed-submission-modal {
                        --dbp-modal-width: calc(100vw - 40px);
                        --dbp-modal-max-width: calc(100vw - 40px);
                        --dbp-modal-min-width: 0;
                    }

                    .detailed-submission-footer .modal-footer-btn {
                        padding: 16px 12px 6px;
                        flex-direction: column;
                        gap: 10px;
                    }
                }
            `]}getModalElement(){return this.renderRoot?.querySelector(`#detailed-submission-modal`)??null}show(){let e=this.getModalElement(),t=this.renderRoot?.querySelector(`#pdf-view-modal`);e&&(t?.addEventListener(`dbp-modal-closed`,this.boundHandlePdfModalClosed),e.addEventListener(`dbp-modal-closed`,this.boundHandleModalClosed),document.addEventListener(`keydown`,this.boundHandleKeydown,!0),e.open())}close(){let e=this.getModalElement();e&&e.close()}handleModalClosed(){let e=this.getModalElement(),t=this.renderRoot?.querySelector(`#pdf-view-modal`);document.removeEventListener(`keydown`,this.boundHandleKeydown,!0),e?.removeEventListener(`dbp-modal-closed`,this.boundHandleModalClosed),t?.removeEventListener(`dbp-modal-closed`,this.boundHandlePdfModalClosed),this.isPdfPreviewOpen=!1,this.dispatchEvent(new CustomEvent(`detail-modal-close`,{detail:{state:this.state},bubbles:!0,composed:!0}))}handleKeydown(e){if(this.isPdfPreviewOpen&&e.key===`Escape`){e.stopPropagation();return}e.keyCode===37&&this.isPrevEnabled&&this.dispatchEvent(new CustomEvent(`detail-modal-previous`,{detail:{state:this.state},bubbles:!0,composed:!0})),e.keyCode===39&&this.isNextEnabled&&this.dispatchEvent(new CustomEvent(`detail-modal-next`,{detail:{state:this.state},bubbles:!0,composed:!0}))}handlePdfModalClosed(){this.isPdfPreviewOpen=!1}formatFileSize(e){let t=Number(e);return Number.isFinite(t)?`${(t/1024).toFixed(2)} KB`:``}isPdfFile(e){let t=(e?.mimeType||``).toLowerCase(),n=(e?.fileName||``).toLowerCase();return t===`application/pdf`||n.endsWith(`.pdf`)}async fetchDownloadableFile(e){if(!e?.downloadUrl)return null;let t={};this.auth?.token&&(t.Authorization=`Bearer `+this.auth.token);let n=await fetch(e.downloadUrl,{method:`GET`,headers:t});if(!n.ok)throw Error(`Failed to fetch file: ${n.status}`);let r=await n.blob(),i=new File([r],e.fileName,{type:e.mimeType||r.type||`application/octet-stream`});return i.filename=e.fileName,i}async downloadFile(e){let t=this.renderRoot?.querySelector(`#file-sink`);if(t)try{let n=await this.fetchDownloadableFile(e);if(!n)return;t.files=[n]}catch(e){console.error(e),A({summary:this._i18n.t(`errors.other-title`),body:this._i18n.t(`errors.other-body`),type:`danger`,timeout:0})}}async previewPdfFile(e){let t=this.renderRoot?.querySelector(`#pdf-view-modal`),n=this.renderRoot?.querySelector(`#dbp-pdf-viewer`);if(t&&n&&e?.downloadUrl)try{let r=await this.fetchDownloadableFile(e);if(!r)return;this.isPdfPreviewOpen=!0,t.open(),await n.showPDF(r)}catch(e){console.error(e),A({summary:this._i18n.t(`errors.other-title`),body:this._i18n.t(`errors.other-body`),type:`danger`,timeout:0})}}renderFileItem(e){let t=this.formatFileSize(e.fileSize);return y`
            <div class="file-block">
                <span class="file-info">
                    <strong class="file-name">${e.fileName}</strong>
                    <span class="additional-data">
                        ${e.mimeType?y`
                                      <span class="file-type">(${e.mimeType})</span>
                                  `:``}
                        ${t?y`
                                      <span class="file-size">${t}</span>
                                  `:``}
                    </span>
                </span>
                <div class="file-action-buttons">
                    ${this.isPdfFile(e)?y`
                                  <button
                                      class="view-file-button button is-secondary"
                                      title="${this._i18n.t(`render-form.download-widget.view-attachment-title`,{filename:e.fileName})}"
                                      aria-label="${this._i18n.t(`render-form.download-widget.view-attachment-title`,{filename:e.fileName})}"
                                      @click=${t=>{t.preventDefault(),this.previewPdfFile(e)}}>
                                      <dbp-icon name="eye" aria-hidden="true"></dbp-icon>
                                      ${this._i18n.t(`render-form.download-widget.view-attachment`)}
                                  </button>
                              `:``}
                    <button
                        class="download-file-button button is-secondary"
                        title="${this._i18n.t(`render-form.download-widget.download-attachment-title`,{filename:e.fileName})}"
                        aria-label="${this._i18n.t(`render-form.download-widget.download-attachment-title`,{filename:e.fileName})}"
                        @click=${t=>{t.preventDefault(),this.downloadFile(e)}}>
                        <dbp-icon name="download" aria-hidden="true"></dbp-icon>
                        ${this._i18n.t(`render-form.download-widget.download-attachment`)}
                    </button>
                </div>
            </div>
        `}renderContentItem(e){return e.type===`files`&&e.files?.length>0?y`
                <div class="fileblock-container submitted-files">
                    ${e.files.map(e=>this.renderFileItem(e))}
                </div>
            `:e.value}render(){let e=this._i18n;return y`
            <dbp-modal
                id="detailed-submission-modal"
                class="detailed-submission-modal"
                modal-id="detailed-submission-modal-${this.state}"
                title="${e.t(`manage-forms.detailed-submission-dialog-title`)}"
                sticky-footer
                subscribe="lang">
                <div
                    slot="content"
                    class="detailed-submission-modal-content"
                    id="detailed-submission-modal-content-${this.state}">
                    <div class="content-wrapper">
                        ${this.contentItems.map((e,t)=>y`
                                <div class="element-left ${N({first:t===0})}">
                                    ${e.label}:
                                </div>
                                <div class="element-right ${N({first:t===0})}">
                                    ${this.renderContentItem(e)}
                                </div>
                            `)}
                    </div>
                </div>
                <div slot="footer" class="detailed-submission-footer">
                    <div class="modal-footer-btn">
                        <label
                            class="button-container ${N({hidden:!this.hiddenColumns})}">
                            ${e.t(`manage-forms.apply-col-settings`)}
                            <input
                                type="checkbox"
                                id="apply-col-settings-${this.state}"
                                class="apply-col-settings"
                                name="apply-col-settings"
                                checked />
                            <span class="checkmark"></span>
                        </label>
                        <div class="btn-row-left">
                            <dbp-button
                                class="back-btn"
                                no-spinner-on-click
                                title="${e.t(`manage-forms.previous-entry-btn-title`)}"
                                @click="${()=>{this.dispatchEvent(new CustomEvent(`detail-modal-previous`,{detail:{state:this.state},bubbles:!0,composed:!0}))}}"
                                ?disabled=${!this.isPrevEnabled}>
                                <dbp-icon name="chevron-left" aria-hidden="true"></dbp-icon>
                                <span class="button-label">
                                    ${e.t(`manage-forms.previous-entry-btn-title`)}
                                </span>
                            </dbp-button>
                            <div class="page-numbering">
                                ${e.t(`manage-forms.detailed-submission-dialog-id`,{id:this.currentBeautyId,nItems:this.totalItems})}
                            </div>
                            <dbp-button
                                class="next-btn"
                                no-spinner-on-click
                                title="${e.t(`manage-forms.next-entry-btn-title`)}"
                                @click="${()=>{this.dispatchEvent(new CustomEvent(`detail-modal-next`,{detail:{state:this.state},bubbles:!0,composed:!0}))}}"
                                ?disabled=${!this.isNextEnabled}>
                                <span class="button-label">
                                    ${e.t(`manage-forms.next-entry-btn-title`)}
                                </span>
                                <dbp-icon name="chevron-right" aria-hidden="true"></dbp-icon>
                            </dbp-button>
                        </div>
                    </div>
                </div>
            </dbp-modal>

            <dbp-file-sink
                id="file-sink"
                class="file-sink"
                lang="${this.lang}"
                allowed-mime-types="*/*"
                decompress-zip
                enabled-targets="local,clipboard,nextcloud"
                subscribe="auth,nextcloud-auth-url,nextcloud-web-dav-url,nextcloud-name,nextcloud-file-url"></dbp-file-sink>

            <dbp-modal
                id="pdf-view-modal"
                class="pdf-view-modal"
                modal-id="pdf-viewer-modal-${this.state}"
                subscribe="lang">
                <div slot="content">
                    <dbp-pdf-viewer
                        id="dbp-pdf-viewer"
                        lang="${this.lang}"
                        auto-resize="cover"></dbp-pdf-viewer>
                </div>
            </dbp-modal>
        `}},Se=class extends O(k){constructor(){super(),this._i18n=h(),this.lang=this._i18n.language,this.availableTags=[],this.selectedTags=[],this.justAddTags=!1,this.submissionCount=0,this.modalRef=f(),this.confirmButtonRef=f()}static get scopedElements(){return{"dbp-button":m,"dbp-icon":g,"dbp-loading-button":t,"dbp-modal":P}}static get properties(){return{...super.properties,lang:{type:String},availableTags:{type:Array,attribute:!1},selectedTags:{type:Array,attribute:!1},justAddTags:{type:Boolean,attribute:!1},submissionCount:{type:Number,attribute:!1}}}update(e){e.forEach((e,t)=>{t===`lang`&&this._i18n.changeLanguage(this.lang)}),super.update(e)}static get styles(){return L}open(){this.selectedTags=[],this.justAddTags=!1,this.requestUpdate(),this.modalRef.value?.open()}close(){this.selectedTags=[],this.requestUpdate(),this.modalRef.value?.close()}getConfirmButton(){return this.confirmButtonRef.value??null}handleConfirm(){this.dispatchEvent(new CustomEvent(`batch-tagging-confirm`,{detail:{tags:[...this.selectedTags],justAdd:this.justAddTags},bubbles:!0,composed:!0}))}handleCancel(){this.close(),this.dispatchEvent(new CustomEvent(`batch-tagging-cancel`,{bubbles:!0,composed:!0}))}render(){let e=this._i18n;return y`
            <dbp-modal
                ${s(this.modalRef)}
                id="batch-tagging-dialog-modal"
                class="modal modal--batch-tagging"
                modal-id="batch-tagging-dialog"
                title="${e.t(`manage-forms.batch-tagging-title`)}"
                subscribe="lang">
                <div slot="content">
                    <div class="batch-tagging-modal-content">
                        <p>
                            ${e.t(`manage-forms.batch-tagging-message`,{count:this.submissionCount})}
                        </p>
                        <fieldset class="checkbox-container">
                            <legend>
                                <dbp-icon name="tags" aria-hidden="true"></dbp-icon>
                                Available tags
                            </legend>
                            ${this.availableTags&&this.availableTags.length>0?y`
                                          ${this.availableTags.map(e=>y`
                                                  <div class="tag-checkbox">
                                                      <input
                                                          type="checkbox"
                                                          id="batch-tagging-tag-${e.identifier}"
                                                          name="batch-tagging-tag-${e.identifier}"
                                                          value="${e.identifier}"
                                                          .checked="${this.selectedTags.includes(e.identifier)}"
                                                          @change="${t=>{this.selectedTags=t.target.checked?[...this.selectedTags,e.identifier]:this.selectedTags.filter(t=>t!==e.identifier)}}" />
                                                      <label
                                                          for="batch-tagging-tag-${e.identifier}">
                                                          ${e.identifier}
                                                      </label>
                                                  </div>
                                              `)}
                                      `:y`
                                          <p>
                                              <dbp-icon
                                                  name="warning"
                                                  aria-hidden="true"></dbp-icon>
                                              ${e.t(`manage-forms.no-available-tags-label`)}
                                          </p>
                                      `}
                        </fieldset>
                    </div>
                </div>
                <menu slot="footer" class="footer-menu">
                    <div class="just-add-tags">
                        <input
                            type="checkbox"
                            id="just-add-tags-checkbox"
                            name="just-add-tags-checkbox"
                            value="just-add-tags"
                            @change="${e=>{this.justAddTags=e.target.checked}}" />
                        <label for="just-add-tags-checkbox">
                            ${e.t(`manage-forms.just-add-tags-label`)}
                        </label>
                    </div>
                    <div class="button-container">
                        <dbp-button
                            type="is-secondary"
                            no-spinner-on-click
                            @click="${()=>this.handleCancel()}">
                            ${e.t(`manage-forms.abort`)}
                        </dbp-button>
                        <dbp-button
                            ${s(this.confirmButtonRef)}
                            id="process-batch-tagging-button"
                            type="is-danger"
                            @click="${()=>this.handleConfirm()}">
                            ${this.justAddTags?e.t(`manage-forms.batch-tagging-button-text-add`):e.t(`manage-forms.batch-tagging-button-text-replace`)}
                        </dbp-button>
                    </div>
                </menu>
            </dbp-modal>
        `}},Ce=class extends O(k){static get scopedElements(){return{"dbp-icon":g,"dbp-button":m,"dbp-modal":P,"dbp-mini-spinner":p,"dbp-notification":ae}}constructor(){super(),this._i18n=h(),this.lang=this._i18n.language,this.langDir=``,this.creatableModules=[],this._selectedModuleSlug=``,this._isSubmitting=!1,this._formComponentTag=null,this._formComponentInstance=null,this.auth={},this.entryPointUrl=``,this.existingForm=null}static get properties(){return{...super.properties,lang:{type:String},langDir:{type:String,attribute:`lang-dir`},auth:{type:Object},entryPointUrl:{type:String,attribute:`entry-point-url`},creatableModules:{type:Array,attribute:!1},existingForm:{type:Object,attribute:!1},_selectedModuleSlug:{state:!0},_isSubmitting:{state:!0},_formComponentTag:{state:!0}}}connectedCallback(){super.connectedCallback(),this.langDir&&w(this._i18n,this)}update(e){e.forEach((e,t)=>{t===`lang`&&this._i18n.changeLanguage(this.lang),(t===`lang`||t===`langDir`)&&this.langDir&&w(this._i18n,this)}),super.update(e)}updated(e){super.updated(e),e.has(`creatableModules`)&&!this._isEditMode&&this.creatableModules.length===1&&this._selectedModuleSlug===``&&(this._selectedModuleSlug=this.creatableModules[0].formSlug,this._registerAndSetFormComponent(this.creatableModules[0])),(e.has(`_formComponentTag`)||e.has(`lang`)||e.has(`auth`)||e.has(`entryPointUrl`)||e.has(`existingForm`))&&this._syncFormComponent()}_syncFormComponent(){let e=this.renderRoot?.querySelector(`#form-component-container`);if(e){if(!this._formComponentTag){e.innerHTML=``,this._formComponentInstance=null;return}(!this._formComponentInstance||this._formComponentInstance.tagName.toLowerCase()!==this._formComponentTag)&&(e.innerHTML=``,this._formComponentInstance=this.createScopedElement(this._formComponentTag),e.appendChild(this._formComponentInstance)),this._formComponentInstance.lang=this.lang,this._formComponentInstance.langDir=this.langDir,this._formComponentInstance.auth=this.auth,this._formComponentInstance.entryPointUrl=this.entryPointUrl,this._formComponentInstance.existingForm=this.existingForm||null}}get _selectedModule(){return this.creatableModules.find(e=>e.formSlug===this._selectedModuleSlug)||null}get _isEditMode(){return this.existingForm!==null&&this.existingForm!==void 0}get _isFormValid(){return this._selectedModuleSlug!==``&&this._formComponentTag!==null}_resetForm(){this._selectedModuleSlug=``,this._isSubmitting=!1,this._formComponentTag=null,this._formComponentInstance=null;let e=this.renderRoot?.querySelector(`#form-component-container`);e&&e.replaceChildren()}open(){this._resetForm(),this._isEditMode?(this._selectedModuleSlug=this.existingForm.formSlug,this._registerAndSetFormComponent(this.existingForm)):this.creatableModules.length===1&&(this._selectedModuleSlug=this.creatableModules[0].formSlug,this._registerAndSetFormComponent(this.creatableModules[0]));let e=this.renderRoot?.querySelector(`dbp-modal`);e&&e.open()}close(){let e=this.renderRoot?.querySelector(`dbp-modal`);e&&e.close(),this._resetForm()}_registerAndSetFormComponent(e){if(!e||typeof e.moduleInstance.getEditFormComponent!=`function`){this._formComponentTag=null;return}let t=e.moduleInstance.getEditFormComponent();if(!t){this._formComponentTag=null;return}let n=`dbp-edit-form-${e.formSlug}`;this.defineScopedElement(n,t),this._formComponentTag=n}_onFormTypeChange(e){this._selectedModuleSlug=e.target.value;let t=this.creatableModules.find(e=>e.formSlug===this._selectedModuleSlug);this._registerAndSetFormComponent(t||null)}async _onSave(){if(!this._isFormValid||this._isSubmitting)return;this._isSubmitting=!0;let e=this._formComponentInstance;if(e&&typeof e.submit==`function`){let t=await e.submit();t&&(this._isEditMode?this.dispatchEvent(new CustomEvent(`dbp-edit-form-saved`,{detail:{form:t},bubbles:!0,composed:!0})):this.dispatchEvent(new CustomEvent(`dbp-create-form-created`,{detail:{form:t},bubbles:!0,composed:!0})),this.close())}this._isSubmitting=!1}_skipToSaveButton(){let e=this._(`#dialog-save-btn`);if(e&&!e.disabled){e.focus();return}let t=this._(`#dialog-actions-bar`);t&&t.focus()}_skipToCloseButton(){let e=this._(`dbp-modal`);e&&typeof e.focusCloseButton==`function`&&e.focusCloseButton()}submitComplete(){this._isSubmitting=!1}render(){let e=this._i18n,t=(t,n)=>e?e.t(t,n):t,n=this._isEditMode,r=!this._isFormValid||this._isSubmitting,i=t(n?`edit-form.save`:`create-form.create`),a=!n&&this.creatableModules.length>1,o=t(`create-form.section-general`);return y`
            <dbp-modal
                modal-id="edit-form-dialog"
                lang="${this.lang}"
                sticky-footer
                class="modal-width">
                <!-- Title -->
                <div slot="title">
                    <h2 class="dialog-title">
                        <dbp-icon
                            class="title-icon"
                            name="${n?`pencil`:`add-job`}"
                            aria-hidden="true"></dbp-icon>
                        ${t(n?`edit-form.dialog-title`:`create-form.dialog-title`)}
                    </h2>
                </div>

                <!-- Header content stays pinned above the scrollable modal content. -->
                <div slot="header">
                    <!-- Action bar: Cancel (left) + Create/Save (right) -->
                    <div id="dialog-actions-bar" class="dialog-actions-bar" tabindex="-1">
                        <p class="required-fields-hint">
                            <span class="required-marker">
                                ${t(`render-form.required-files-asterisk`)}
                            </span>
                            ${t(`render-form.required-files-text`)}
                        </p>
                        <button
                            id="dialog-save-btn"
                            class="button is-primary save-btn"
                            type="button"
                            ?disabled="${r}"
                            @click="${this._onSave}">
                            ${this._isSubmitting?y`
                                          <dbp-mini-spinner></dbp-mini-spinner>
                                      `:y`
                                          <dbp-icon
                                              class="btn-icon"
                                              name="save"
                                              aria-hidden="true"></dbp-icon>
                                      `}
                            <span class="button-label">${i}</span>
                        </button>
                    </div>

                    <!-- In-dialog notifications (appear above the modal, anchored to it) -->
                    <dbp-notification
                        id="edit-form-dialog-notification"
                        inline
                        lang="${this.lang}"></dbp-notification>
                </div>

                <!-- Form content -->
                <div slot="content" class="dialog-content">
                    ${o?y`
                                  <h4 class="form-section-heading">${o}</h4>
                              `:``}

                    <!-- Form type selector: only shown when there are multiple create options -->
                    ${a?y`
                                  <div class="form-field">
                                      <label class="form-label" for="form-type-select">
                                          ${t(`create-form.field-form-type`)}
                                          <span class="required-marker">*</span>
                                      </label>
                                      <div class="select-wrapper">
                                          <select
                                              id="form-type-select"
                                              class="form-select"
                                              .value="${this._selectedModuleSlug}"
                                              @change="${this._onFormTypeChange}">
                                              <option
                                                  value=""
                                                  ?selected="${this._selectedModuleSlug===``}">
                                                  ${t(`create-form.field-form-type-placeholder`)}
                                              </option>
                                              ${this.creatableModules.map(e=>y`
                                                      <option
                                                          value="${e.formSlug}"
                                                          ?selected="${this._selectedModuleSlug===e.formSlug}">
                                                          ${e.formName||e.formSlug}
                                                      </option>
                                                  `)}
                                          </select>
                                      </div>
                                  </div>
                              `:``}

                    <!-- Container where the edit-form component is mounted imperatively -->
                    <div
                        id="form-component-container"
                        class="form-component-area"
                        @dbp-edit-form-skip-to-save-button="${this._skipToSaveButton}"
                        ?hidden="${!this._formComponentTag}"></div>

                    <!--
                        Skip links to the dialog actions, which sit in the pinned modal header
                        and therefore come before the form in the tab order.
                    -->
                    ${this._formComponentTag?y`
                                  <div class="skip-links">
                                      <button
                                          type="button"
                                          class="skip-link"
                                          @click="${this._skipToSaveButton}">
                                          ${t(`edit-form-dialog.skip-to-save-button`,{label:i})}
                                      </button>
                                      <button
                                          type="button"
                                          class="skip-link"
                                          @click="${this._skipToCloseButton}">
                                          ${t(`edit-form-dialog.skip-to-close-button`)}
                                      </button>
                                  </div>
                              `:``}
                </div>
            </dbp-modal>
        `}static get styles(){return x`
            ${b()}
            ${j()}
            ${T()}
            ${F()}

            .modal-width {
                --dbp-modal-min-width: min(95vw, 700px);
                --dbp-modal-max-width: min(95vw, 700px);
                --dbp-modal-max-height: 90vh;
                --dbp-modal-content-overflow-y: auto;
            }
            /* Match the color of the modal's own close button (--dbp-accent) */
            .title-icon {
                color: var(--dbp-accent);
                top: 5px;
            }

            /* Dialog title layout */
            .dialog-title {
                display: inline-flex;
                align-items: start;
                gap: 0.4rem;
                margin: 0;
                font-size: 1.4rem;
            }

            /* Action bar: Cancel on the left, Save on the right */
            .dialog-actions-bar {
                display: flex;
                justify-content: space-between;
                align-items: center;
                padding-bottom: 1em;
            }

            .cancel-btn,
            .save-btn {
                display: inline-flex;
                align-items: center;
                gap: 0.4rem;
            }

            /* Icon inside buttons: override the default top offset */
            .btn-icon {
                flex-shrink: 0;
                top: 0;
            }

            /* Section headings */
            .form-section-heading {
                font-size: 1rem;
                font-weight: 700;
                margin: 1.25rem 0 0.75rem;
            }

            /* Form field wrapper for native elements (select) */
            .form-field {
                margin-bottom: 0.75rem;
            }

            .form-label {
                display: block;
                font-weight: 600;
                margin-bottom: 0.35rem;
            }

            .required-marker {
                color: var(--dbp-danger, #e4154b);
            }

            /* Wrapper provides relative positioning for the chevron icon */
            .select-wrapper {
                position: relative;
            }

            /* Native select styled to match the manage-forms table action header selectors */
            .form-select {
                box-sizing: border-box;
                width: 100%;
                height: 2.25rem;
                padding: 0 2rem 0 0.6rem;
                border: var(--dbp-border);
                border-radius: var(--dbp-border-radius, 0);
                font-size: 1rem;
                color: var(--dbp-content);
                background-color: var(--dbp-background);
                /* background-size is controlled by getSelectorFixCSS() to fix oversized chevron */
                cursor: pointer;
                appearance: auto;
            }

            .form-select:focus {
                outline: none;
                border-color: var(--dbp-accent, #007bff);
            }

            .form-select:disabled {
                opacity: 0.4;
                cursor: not-allowed;
            }

            /* Edit-form component area */
            .form-component-area {
                margin-top: 1rem;
            }

            /* Skip links: hidden until they receive keyboard focus */
            .skip-link {
                position: absolute !important;
                clip: rect(1px, 1px, 1px, 1px);
                overflow: hidden;
                height: 1px;
                width: 1px;
                word-wrap: normal;
                appearance: none;
                border: none;
                padding: 0;
                background: none;
                font: inherit;
                color: var(--dbp-accent);
                text-decoration: underline;
                cursor: pointer;
            }

            .skip-link:focus-visible {
                position: static !important;
                clip: auto;
                overflow: visible;
                display: inline-block;
                height: auto;
                width: auto;
            }

            /* Only the focused link becomes visible, so the gap never shows twice */
            .skip-links:focus-within {
                display: flex;
                margin-top: 1rem;
            }

            /* Fallback focus target while the save button is disabled */
            #dialog-actions-bar:focus {
                outline: none;
            }

            #dialog-actions-bar:focus-visible {
                outline: 1px solid var(--dbp-accent);
                outline-offset: 2px;
            }

            @media (max-width: 560px) {
                .modal-width {
                    --dbp-modal-min-width: unset;
                    --dbp-modal-max-width: unset;
                    --dbp-modal-max-height: 90vh;
                    --dbp-modal-content-overflow-y: auto;
                }
            }
        `}};const H={ROW:`row`,DROPDOWN:`dropdown`},U=e=>Array.isArray(e?.grantedActions)?e.grantedActions:[],we=e=>{let t=U(e);return typeof e?.moduleInstance?.getEditFormComponent==`function`&&(t.includes(u.UPDATE)||t.includes(u.MANAGE))},Te=e=>{let t=U(e);return t.includes(u.DELETE)||t.includes(u.MANAGE)},Ee=e=>U(e).includes(u.MANAGE);function W(e,t=[],n=null){return{host:e,items:t,form:t[0]??null,event:n,t:e._i18n.t.bind(e._i18n)}}function De(){return[{id:`open-submissions`,iconName:`keyword-research`,placements:[H.ROW],label:({t:e,form:t})=>e(`manage-forms.open-forms`,{formName:t?.formName??``}),ariaLabel:({t:e,form:t})=>e(`manage-forms.open-forms-aria`,{formName:t?.formName??``}),isEnabled:({items:e})=>e.length===1,handler:({host:e,form:t})=>{t?.formId&&(e.loadingSubmissionTables=!0,e.sendSetPropertyEvent(`routing-url`,e.getRoutingUrlWithQueryPrefixes(`/${t.formId}`,[`forms-`]),!0))}},{id:`delete`,iconName:`trash`,placements:[H.DROPDOWN],label:({t:e})=>e(`manage-forms.delete`),ariaLabel:({t:e,form:t})=>e(`manage-forms.delete-form-aria`,{formName:t?.formName??``}),isVisible:({host:e})=>e.enableFormsBulkDelete,isEnabled:({items:e})=>e.length>0&&e.every(Te),handler:({host:e,items:t})=>{e.handleDeleteForms(t.map(e=>e.formId))}},{id:`edit`,iconName:`pencil`,placements:[H.DROPDOWN],label:({t:e})=>e(`manage-forms.edit-button-text`),title:({t:e})=>e(`manage-forms.edit-form-button`),ariaLabel:({t:e,form:t})=>e(`manage-forms.edit-form-aria`,{formName:t?.formName??``}),isEnabled:({items:e})=>e.length===1&&we(e[0]),handler:({host:e,form:t})=>{t?.formId&&e.handleOpenEditFormDialog(t.formId)}},{id:`edit-permission`,iconName:`edit-permission`,placements:[H.DROPDOWN],label:({t:e})=>e(`manage-forms.edit-permission-button-text`),ariaLabel:({t:e,form:t})=>e(`manage-forms.edit-form-permission-aria`,{formName:t?.formName??``}),isEnabled:({items:e})=>e.length>0&&e.every(Ee),handler:({host:e,items:t})=>e.handleEditFormPermission(t.map(e=>e.formId))}]}const G=(e,t)=>typeof e==`function`?e(t):e??``;function K(e,t){return{...e,label:G(e.label,t),title:G(e.title??e.label,t),ariaLabel:G(e.ariaLabel??e.label,t),visible:typeof e.isVisible!=`function`||e.isVisible(t),enabled:typeof e.isEnabled!=`function`||e.isEnabled(t)}}function q(e){let t=new Date(Date.parse(e)),n=t.getFullYear(),r=(`0`+(t.getMonth()+1)).slice(-2),i=(`0`+t.getDate()).slice(-2),a=(`0`+t.getHours()).slice(-2),o=(`0`+t.getMinutes()).slice(-2);return n+`-`+r+`-`+i+` `+a+`:`+o}function Oe(e){let t=e._i18n;A({summary:t.t(`manage-forms.something-went-wrong-title`),body:t.t(`manage-forms.something-went-wrong-body`),type:`danger`,timeout:0})}function J(e){return e.loadModulesPromise?e.loadModulesPromise:(e.isLoadingModules=!0,e.loadModulesPromise=(async()=>{try{let t=await(await fetch(e.basePath+`modules.json`)).json();for(let n of Object.values(t.forms)){let t=new(await(import(new URL(n,window.location.origin+e.basePath).href))).default;t.getFormIdentifier&&t.getUrlSlug&&(e.forms.set(t.getFormIdentifier(),{formName:null,formId:t.getFormIdentifier(),formSlug:t.getUrlSlug(),moduleInstance:t}),e.loadedModules.set(t.getUrlSlug(),{formId:t.getFormIdentifier(),formSlug:t.getUrlSlug(),formName:null,moduleInstance:t}))}}catch(e){console.error(`Error loading modules:`,e)}finally{e.isLoadingModules=!1,e.loadModulesPromise=null}})(),e.loadModulesPromise)}function ke(e,t,n){let r=e.createScopedElement(`dbp-formalize-get-details-button`);r.setAttribute(`subscribe`,`lang`),r.dataset.action=t.id,t.iconName&&(r.iconName=t.iconName);let i=K(t,typeof n==`function`?n():n);return r.title=i.title,r.ariaLabel=i.ariaLabel,r.addEventListener(`click`,e=>{let r={...typeof n==`function`?n():n,event:e},i=K(t,r);i.visible&&i.enabled&&t.handler(r)}),r}async function Y(e){let t=e._i18n;e.loadModulesPromise&&await e.loadModulesPromise;try{e.loadCourses=!1,(!e.allForms||e.allForms.length===0)&&(e.loadingFormsTable=!0);let t=await fetch(e.entryPointUrl+`/formalize/forms?perPage=9999`,{headers:{"Content-Type":`application/ld+json`,Authorization:`Bearer `+e.auth.token}});if(!t.ok)e.handleErrorResponse(t);else{let n=[],r=[];try{n=await t.json()}catch(t){e.sendErrorAnalyticsEvent(`LoadListOfAllCourses`,`WrongResponse`,t),Oe(e),e.loadCourses=!0;return}let i=Array.isArray(e.allowListFrontendKeys)?e.allowListFrontendKeys:[],o=Array.isArray(e.denyListFrontendKeys)?e.denyListFrontendKeys:[],s=/* @__PURE__ */ new Set;for(let t of e.loadedModules.values())s.add(t.formId);e.formsGrantedActions instanceof Map&&e.formsGrantedActions.clear();let c=0,l=/* @__PURE__ */ new Map;for(let t=0;t<n[`hydra:member`].length;t++){let s=n[`hydra:member`][t],d=s.localizedNames.find(t=>t.languageTag===e.lang),f=d?d.name:s.name,p=s.identifier,m=s.frontendKey??null,h=s.dateCreated??null;if(i.length>0&&(m===null||!i.includes(m))||o.length>0&&m!==null&&o.includes(m))continue;let g=s.grantedFormActions??[],_=s.grantedSubmissionCollectionActions??[],v=g.some(e=>[u.UPDATE,u.DELETE,u.MANAGE].includes(e)),y=_.some(e=>[a.READ,a.MANAGE].includes(e));if(!v&&!y)continue;c++;let b=s.allowedActionsWhenSubmitted,x=s.tagPermissionsForSubmitters,S=s.allowedSubmissionStates,C=s.dataFeedSchema,w=s.grantedActions??[],T=s.additionalData??null,E=s.localizedNames??[],D=e.forms.get(p)?.moduleInstance??null;if(!D&&m){for(let t of e.loadedModules.values())if(t.moduleInstance&&typeof t.moduleInstance.getFormFrontendKey==`function`&&t.moduleInstance.getFormFrontendKey()===m){D=t.moduleInstance;break}}e.forms.set(p,{...e.forms.get(p),formName:f,dateCreated:h,formId:p,formSlug:e.forms.get(p)?.formSlug??D?.getUrlSlug?.()??p,moduleInstance:D,allowedSubmissionStates:S,allowedActionsWhenSubmitted:b,dataFeedSchema:C,tagPermissionsForSubmitters:x,additionalData:T,localizedNames:E,grantedActions:w}),e.formsGrantedActions instanceof Map&&e.formsGrantedActions.set(p,w);let O=e.forms.get(p),k=document.createElement(`span`);k.style.cssText=`display: inline-flex; gap: 0.5rem; align-items: center;`;let A=W(e,[O]),j=()=>W(e,[e.forms.get(p)]),M=De(),N=D?.getManageFormsOverviewActions?.(A,M);(Array.isArray(N)?N:M).forEach(t=>{let n=Array.isArray(t?.placements)?t.placements:[`row`];t?.id&&l.set(t.id,t);let r=K(t,A);n.includes(`row`)&&t?.id&&typeof t.handler==`function`&&r.visible&&r.enabled&&k.appendChild(ke(e,t,j))});let ee=m===`job-offer`?T?.jobOfferType===`external`?T?.companyName||``:`TU Graz`:``,P={id:c,name:f,employer:ee,formId:p,dateCreated:h,grantedActions:w,actionButton:k};r.push(P)}e.formsOverviewActionDefinitions=[...l.values()];let d=(e.allForms||[]).map(({formId:e,name:t,employer:n,grantedActions:r})=>[e,t,n,r]),f=r.map(({formId:e,name:t,employer:n,grantedActions:r})=>[e,t,n,r]);if(JSON.stringify(d)===JSON.stringify(f)&&(e.allForms||[]).length>0){e.loadingFormsTable=!1;return}e.allForms=r,e.options_forms.data=e.allForms}}catch(n){e.loadCourses=!0,console.error(`[updated] Error getting list of forms:`,n),A({summary:t.t(`manage-forms.failed-to-get-forms-title`),body:t.t(`manage-forms.failed-to-get-forms-body`),type:`danger`,timeout:0})}}async function Ae(e,t){let n=e._i18n,r,i;e.rawSubmissions=[],e.submittedFileDetails={draft:/* @__PURE__ */ new Map,submitted:/* @__PURE__ */ new Map},e.submissionsHasAttachment={draft:!1,submitted:!1};let a={method:`GET`,headers:{"Content-Type":`application/ld+json`,Authorization:`Bearer `+e.auth.token}};try{r=await fetch(e.entryPointUrl+`/formalize/submissions?formIdentifier=`+t+`&perPage=9999`,a),i=await r.json()}catch(t){throw e.sendErrorAnalyticsEvent(`getAllSubmissions`,`WrongResponse`,t),Oe(e),t}if(e.rawSubmissions=i[`hydra:member`],e.submissionsGrantedActions=/* @__PURE__ */ new Map,e.rawSubmissions.forEach(t=>{e.submissionsGrantedActions.set(t.identifier,t.grantedActions)}),i[`hydra:member`].length===0)return e.noSubmissionAvailable={draft:!0,submitted:!0},r;let o={};o.submitted=i[`hydra:member`].filter(e=>e.submissionState===d.SUBMITTED),o.draft=i[`hydra:member`].filter(e=>e.submissionState===d.DRAFT);for(let r of Object.keys(e.submissions)){if(o[r].length===0){e.noSubmissionAvailable={...e.noSubmissionAvailable,[r]:!0};continue}e.noSubmissionAvailable={...e.noSubmissionAvailable,[r]:!1};let i=[],a=e.forms.get(t),s=a?.moduleInstance?.getEnumTranslations?a.moduleInstance.getEnumTranslations(e.lang):{},c=s._common||{};for(let[t,u]of o[r].entries()){let o=q(u.dateCreated),d=JSON.parse(u.dataFeedElement),f=u.identifier,p=u.tags||[],m=u.submittedFiles||[];e.submittedFileDetails[r].set(f,m),m.length>0&&(e.submissionsHasAttachment[r]=!0);let h={};for(let e of m){let t=`form_files-${e.fileAttributeName}`;h[t]===void 0&&(h[t]=[]),h[t].push(e.fileName)}for(let e of Object.keys(h))h[e]=h[e].join(`, `);for(let[t,n]of Object.entries(d))if(Array.isArray(n)&&(d[t]=n.join(`, `)),t===`identifier`&&n){if(e.userNameCache.has(n))d[t]=e.userNameCache.get(n);else try{let r=await(await e.apiGetUserDetails(n)).json(),i=`${r.givenName} ${r.familyName}`;d[t]=i,e.userNameCache.set(n,i)}catch(e){console.error(e),d[t]=n}}for(let[e,t]of Object.entries(d)){if(typeof t!=`string`)continue;let n=s[e]||c;n&&Object.keys(n).length!==0&&(d[e]=t.split(`, `).map(e=>n[e.trim()]||e.trim()).join(`, `))}let g=t+1,_={dateCreated:o,tags:Array.isArray(p)?p.map(e=>`<span class="tag">${(0,V.default)(e)}</span>`).join(` `):``,...d,...h,submissionId:f},v=e.createScopedElement(`div`);if(a.formSlug&&a.moduleInstance&&typeof a.moduleInstance.hasReadOnlyMode==`function`&&a.moduleInstance.hasReadOnlyMode()){let t=e.createScopedElement(`dbp-formalize-get-submission-link`),r=l(a.formSlug,e.lang)+`/${f}/readonly`;t.ariaLabel=n.t(`manage-forms.open-detailed-view-form`,{id:g}),t.submissionUrl=r,t.iconName=`open-new-window`,t.title=n.t(`manage-forms.open-detailed-view-form`,{id:g}),t.id=g.toString(),t.setAttribute(`subscribe`,`lang`),t.addEventListener(`click`,e=>{e.stopPropagation()}),v.appendChild(t)}let y=e.createScopedElement(`dbp-formalize-get-details-button`);y.ariaLabel=n.t(`manage-forms.open-detailed-view-modal`,{id:g}),y.title=n.t(`manage-forms.open-detailed-view-modal`,{id:g}),y.id=g.toString(),y.setAttribute(`subscribe`,`lang`),y.addEventListener(`click`,t=>{t.stopPropagation(),e.getRoutingData().pathSegments[0].match(/[0-9a-f-]+/)&&(e.setSubmissionDetailsRoute(f),e.requestDetailedSubmission(r,_,g))}),v.appendChild(y),v.classList.add(`actions-buttons`),_.htmlButtons=v,i.push(_)}i=i.every(e=>e.attachments===``)?i.map(({attachments:e,...t})=>t):i,e.submissions={...e.submissions,[r]:i},e.options_submissions[r].autoColumnsDefinitions=t=>(t.forEach(t=>{t.field===`submissionId`&&(t.visible=!0,t.title=e._i18n.t(`manage-forms.submission-id`)),t.field===`dateCreated`&&(t.visible=!0,t.title=e.lang===`de`?`Erstellt am`:`Date created`),t.field===`tags`&&(t.formatter=`html`),t.field===`htmlButtons`?(t.title=``,t.formatter=`html`,t.hozAlign=`right`,t.vertAlign=`middle`,t.headerSort=!1,t.minWidth=64,t.frozen=!0,t.headerHozAlign=`right`,t.download=!1):t.sorter=`string`,t.field.includes(`date`)&&(t.sorter=(e,t)=>X(e)-X(t))}),[{title:`ID`,formatter:function(e){let t=e.getRow(),n=t.getTable(),r=n.getPage(),i=n.getPageSize(),a=t.getPosition(!0);return(r-1)*i+a},field:`rowIndex`,hozAlign:`center`,headerHozAlign:`center`,headerSort:!1,frozen:!0,width:30,download:!1},...t]),e.options_submissions[r].data=e.submissions[r],e.totalNumberOfItems[r]=i.length}return r}async function je(e,t){if(!t)return A({summary:e._i18n.t(`errors.error-title`),body:e._i18n.t(`errors.no-submission-id-provided`),type:`danger`,timeout:0}),!1;try{let n=await fetch(e.entryPointUrl+`/formalize/submissions/${t}`,{method:`DELETE`,headers:{Authorization:`Bearer `+e.auth.token}});return n.ok?!0:(console.warn(`Failed to delete submission. Response status: ${n.status}`),!1)}catch(e){return console.error(e.message),!1}}async function Me(e,t,n){if(!t||!e.activeFormId)return A({summary:e._i18n.t(`errors.error-title`),body:e._i18n.t(`errors.no-submission-id-provided`),type:`danger`,timeout:0}),!1;let r=new FormData;r.append(`form`,`/formalize/forms/`+e.activeFormId),r.append(`tags`,JSON.stringify(n));let i={method:`PATCH`,headers:{Authorization:`Bearer ${e.auth.token}`},body:r},a=e.entryPointUrl+`/formalize/submissions/`+t;try{let e=await fetch(a,i);if(!e.ok){console.warn(`Failed to update submission tags. Response status: ${e.status}`);let t=await e.json().catch(()=>({}));return console.warn(`Error details:`,t),!1}return!0}catch(e){return console.error(e.message),!1}}async function Ne(e,t){if(e.auth.token===``){e.availableTags=[];return}let n,r=[],i={method:`GET`,headers:{"Content-Type":`application/ld+json`,Authorization:`Bearer `+e.auth.token}};try{n=await fetch(e.entryPointUrl+`/formalize/forms/`+t,i),n.ok||(e.availableTags=[]),r=await n.json()}catch(t){e.sendErrorAnalyticsEvent(`checkPermissionsToForm`,`WrongResponse`,t),console.error(t),e.availableTags=[]}r.error&&(console.error(`checkPermissionsToForm data.error`,r.error),e.availableTags=[]),r[`@type`]===`hydra:Error`&&(console.error(`checkPermissionsToForm hydra:Error`,r.detail),e.availableTags=[]),e.availableTags=r.availableTags||[]}async function Pe(e,t){if(!t)return A({summary:e._i18n.t(`errors.error-title`),body:e._i18n.t(`errors.no-form-id-provided`),type:`danger`,timeout:0}),!1;try{let n=await fetch(e.entryPointUrl+`/formalize/forms/`+t,{method:`DELETE`,headers:{Authorization:`Bearer `+e.auth.token}});return n.ok?!0:(console.warn(`Failed to delete form. Response status: ${n.status}`),!1)}catch(e){return console.error(e.message),!1}}function X(e){let t=new Date(e);if(isNaN(t))throw Error(`Invalid date`);return Math.floor(t.getTime()/1e3)}function Z(e,t,n={}){let r=n.successKey||`success.submissions-processed`,i=n.failureKey||`errors.submissions-processing-failed`,a=t.filter(e=>e===!0).length;a>0&&A({summary:e._i18n.t(`success.success-title`),body:e._i18n.t(r,{count:a}),type:`success`,timeout:5});let o=t.filter(e=>e===!1).length;o>0&&A({summary:e._i18n.t(`errors.error-title`),body:e._i18n.t(i,{count:o}),type:`danger`,timeout:0})}function Q(e,t){let n={langs:{en:{columns:{}},de:{columns:{}}},autoColumns:`full`,rowHeight:64,layout:`fitDataStretch`,selectableRows:`highlight`,rowHeader:{formatter:`rowSelection`,titleFormatter:`rowSelection`,titleFormatterParams:{rowRange:`visible`},headerSort:!1,resizable:!1,frozen:!0,headerHozAlign:`center`,hozAlign:`center`},columnDefaults:{vertAlign:`middle`,hozAlign:`left`,resizable:!1},initialSort:[{column:`dateCreated`,dir:`desc`}],placeholder:e._i18n?e._i18n.t(`manage-forms.no-submission-data-available`):`No submission data available`};n.autoColumnsDefinitions=t=>(t.forEach(t=>{t.field===`submissionId`&&(t.visible=!1,t.title=e._i18n.t(`manage-forms.submission-id`)),t.field===`dateCreated`&&(t.visible=!0,t.title=e.lang===`de`?`Erstellt am`:`Date created`),t.field===`htmlButtons`?(t.title=``,t.formatter=`html`,t.hozAlign=`right`,t.vertAlign=`middle`,t.headerSort=!1,t.minWidth=64,t.frozen=!0,t.headerHozAlign=`right`,t.download=!1):t.sorter=`string`,t.field.includes(`date`)&&(t.sorter=(e,t)=>X(e)-X(t))}),[{title:`ID`,field:`rowIndex`,formatter:function(e){let t=e.getRow(),n=t.getTable(),r=n.getPage(),i=n.getPageSize(),a=t.getPosition(!0);return(r-1)*i+a},hozAlign:`center`,headerHozAlign:`center`,headerSort:!1,frozen:!0,width:30,download:!1},...t]),e.options_submissions[t]={...n}}function Fe(e,t){e.options_submissions[t].rowHeader={formatter:`rowSelection`,titleFormatter:`rowSelection`,titleFormatterParams:{rowRange:`visible`},headerSort:!1,resizable:!1,frozen:!0,headerHozAlign:`center`,hozAlign:`center`},e.options_submissions[t].headerVisible=!0}function Ie(e,t){e.options_submissions[t].rowHeader=!1,e.options_submissions[t].headerVisible=!1}function Le(e,t){e.submissionTables[t].paginationEnabled=!1}function Re(e,t){e.submissionTables[t].paginationEnabled===!1&&(e.submissionTables[t].paginationEnabled=!0)}function ze(e){if(!e.dataFeedSchema)return null;try{let t=JSON.parse(e.dataFeedSchema),n=e.moduleInstance?.getDataFeedSchema?.();if(!n)return t;let r=typeof n==`string`?JSON.parse(n):n;for(let[e,n]of Object.entries(t.properties??{}))n.localizedName??=r.properties?.[e]?.localizedName??r.files?.[e]?.localizedName;for(let[e,n]of Object.entries(t.files??{}))n.localizedName??=r.files?.[e]?.localizedName;return t}catch(e){return console.log(`Failed parsing json data`,e),null}}function Be(e){let t=e.getColumns();return!t||t.length===0?[]:t.map(e=>e.getDefinition())}function Ve(e){return!e?.properties||Object.keys(e?.properties).length===0}function He(e,t,n,r,i,a){let o=[],s=r.find(e=>e.field===`dateCreated`);if(s&&o.push(s),a){let e=r.find(e=>e.field===`tags`);if(e){let t={...e};t.frozen=!1,t.formatter=`html`,t.visible===void 0&&(t.visible=!0),o.push(t)}}return n?r.forEach(e=>{e.field&&e.field!==`rowIndex`&&e.field!==`dateCreated`&&e.field!==`tags`&&e.field!==`identifier`&&e.field!==`submissionId`&&e.field!==`htmlButtons`&&(e.visible=!0,o.push(e))}):Object.keys(t.properties).forEach(n=>{let r=t.properties[n],i={field:n,visible:r?.tableViewVisibleDefault??!0,title:r?.localizedName?.[e.lang]||n};o.push(i)}),o}function Ue(e,t){let n=[];return t?.files&&typeof t.files==`object`&&Object.keys(t.files).forEach(r=>{n.push({field:`form_files-${r}`,title:t.files[r]?.localizedName?.[e.lang]||r,visible:!0})}),n}function We(e,t){let n=t?.properties||{};return e.filter(e=>e.field===`identifier`&&!Object.hasOwn(n,`identifier`)||e.field===`submissionId`||e.field===`htmlButtons`)}function Ge(e,t){let n=e.forms.get(e.activeFormId);if(!n)return;let r=ze(n);e.downloadFolderNamePattern=r?.submissionExport?.downloadFolderPattern||``,e.useSubFoldersForExports=r?.submissionExport?.subfolders??!0;let i=e.submissionTables[t];if(!i)return;let a=Be(i);if(a.length===0)return;let o=Array.isArray(e.availableTags)&&e.availableTags.length>0,s=He(e,r,Ve(r),a,t,o),c=Ue(e,r),l=We(a,r),u=a.find(e=>e.field===`rowIndex`),d={title:`ID`,field:`rowIndex`,formatter:function(e){let t=e.getRow(),n=t.getTable(),r=n.getPage(),i=n.getPageSize(),a=t.getPosition(!0);return(r-1)*i+a},hozAlign:`center`,headerHozAlign:`center`,headerSort:!1,frozen:!0,width:30,download:!1},f=l.find(e=>e.field===`htmlButtons`),p=l.filter(e=>e.field!==`htmlButtons`),m=[u||d,...s,...c,...p];f&&m.push(f),e.submissionsColumnsInitial[t]=Ke(m)}function Ke(e){return Array.isArray(e)?e.map(e=>qe(e)):[]}function qe(e){if(!e||typeof e!=`object`)return e;let t={...e};return Array.isArray(e.columns)&&(t.columns=Ke(e.columns)),t}const Je=e=>{e(`success.forms-processed`,{count:0}),e(`errors.forms-processing-failed`,{count:0}),e(`success.submissions-processed`,{count:0}),e(`errors.submissions-processing-failed`,{count:0})},Ye=[5,10,20,50,100];function Xe(e){if(console.log(`parseFormListAttribute input:`,e),Array.isArray(e))return e.map(e=>`${e}`.trim()).filter(e=>e!==``);if(typeof e!=`string`)return[];let t=e.trim();if(t===``)return[];try{let e=JSON.parse(t);if(Array.isArray(e))return e.map(e=>`${e}`.trim()).filter(e=>e!==``)}catch{}return t.split(`,`).map(e=>e.trim()).filter(e=>e!==``)}var $=class extends O(ce){constructor(){super(),this.allForms=[],this.isLoadingModules=!1,this.loadModulesPromise=null,this.boundKeyEventHandler=this.handleKeyEvents.bind(this),this.boundCloseActionsDropdownHandler=this.closeActionsDropdown.bind(this),this.boundTableSelectionChanges=this.handleTableSelectionChanges.bind(this),this.boundTablePaginationPageLoaded=this.handleTablePaginationPageLoaded.bind(this),this.selectedRowCount={draft:0,submitted:0},this.allRowCount={draft:0,submitted:0},this.visibleRowCount={draft:0,submitted:0},this.searchIsActive={draft:!1,submitted:!1},this.options_submissions={draft:{},submitted:{}},this.options_forms={},this.enableFormsBulkDelete=!1,this.formsOverviewActionDefinitions=[],this.formsOverviewDropdownActions=[],this.enableSubmissionPermissionEditing=!1,this.updateFormsTableOptions(),this._overridesReady=null,this.forms=/* @__PURE__ */ new Map,this.loadedModules=/* @__PURE__ */ new Map,this.rawSubmissions=[],this.submissionsGrantedActions=/* @__PURE__ */ new Map,this.formsGrantedActions=/* @__PURE__ */ new Map,this.selectedFormsCount=0,this.submissions={draft:[],submitted:[]},this.showSubmissionTables=!1,this.showFormsTable=!1,this.submissionSlug=``,this.submissionsColumnsInitial={draft:[],submitted:[]},this.activeFormName=``,this.activeFormId=``,this.currentBeautyId=0,this.totalNumberOfItems={draft:0,submitted:0},this.isPrevEnabled=!1,this.isNextEnabled=!1,this.storeSession=!0,this.loadingFormsTable=!1,this.loadingSubmissionTables=!1,this.noSubmissionAvailable={draft:!0,submitted:!0},this.modalContentHeight=0,this.loadCourses=!0,this.hiddenColumns=!1,this.currentDetailPosition=0,this.submissionTables={submitted:null,draft:null},this.formsTable=null,this.submissionsHasAttachment={draft:!1,submitted:!1},this.submittedFileDetails={draft:/* @__PURE__ */ new Map,submitted:/* @__PURE__ */ new Map},this.isDeleteSelectedSubmissionEnabled={draft:!1,submitted:!1},this.isDeleteAllSubmissionEnabled={draft:!1,submitted:!1},this.isEditSubmissionEnabled={draft:!1,submitted:!1},this.isEditSubmissionPermissionEnabled={draft:!1,submitted:!1},this.isBatchTaggingEnabled={draft:!1,submitted:!1},this.enabledStates={draft:!1,submitted:!1},this.searchWidgetIsOpen={draft:!1,submitted:!1},this.actionsWidgetIsOpen={draft:!1,submitted:!1},this.isActionAvailable={draft:!1,submitted:!1},this.needTableRebuild={draft:!1,submitted:!1},this.createSubmissionUrl=``,this.useSubFoldersForExports=!0,this.downloadFolderNamePattern=``,this.allowListFrontendKeys=[],this.denyListFrontendKeys=[],this.hideCreateSubmissionButton=!1,this.noFormsAvailable=!1,this.creatableModulesCount=0,this.userNameCache=/* @__PURE__ */ new Map,this.isRequestDetailedView=!1,this.submissionIdToOpen=null,this.submissionIdsForTagging=[],this.availableTags=[],this.attachmentsAreLoading={draft:!1,submitted:!1},this._abortAttachmentLoading=!1,this._isSwitchingTable=!1,this._switchGeneration=0,this._restoringUrlStateTables=/* @__PURE__ */ new Set,this._urlStateReadyTables=/* @__PURE__ */ new Set}static get scopedElements(){return{"dbp-button":m,"dbp-icon":g,"dbp-icon-button":n,"dbp-translated":ee,"dbp-mini-spinner":p,"dbp-tabulator-table":I,"dbp-grant-permission-dialog":le,"dbp-modal":P,"dbp-file-sink":ue,"dbp-formalize-get-details-button":se,"dbp-formalize-get-submission-link":oe,"dbp-formalize-manage-forms-overview-page":ye,"dbp-formalize-manage-form-submissions-page":be,"dbp-formalize-manage-submission-modal":xe,"dbp-formalize-batch-tagging-modal":Se,"dbp-formalize-deletion-confirmation-modal":fe,"dbp-formalize-edit-form-dialog":Ce}}static get properties(){return{...super.properties,allForms:{type:Array,attribute:!1},form:{type:String},name:{type:String},activeFormName:{type:String,attribute:!1},forms:{type:Object,attribute:!1},submissions:{type:Object,attribute:!1},emptyCoursesTable:{type:Boolean,attribute:!0},showFormsTable:{type:Boolean,attribute:!1},showSubmissionTables:{type:Boolean,attribute:!1},loadingFormsTable:{type:Boolean,attribute:!1},loadingSubmissionTables:{type:Boolean,attribute:!1},isPrevEnabled:{type:Boolean,attribute:!1},isNextEnabled:{type:Boolean,attribute:!1},currentBeautyId:{type:Number,attribute:!1},totalNumberOfItems:{type:Object,attribute:!1},modalContentHeight:{type:Number,attribute:!1},loadCourses:{type:Boolean,attribute:!0},hasPermissions:{type:Boolean,attribute:!1},hiddenColumns:{type:Boolean,attribute:!1},options_submissions:{type:Object,attribute:!1},options_forms:{type:Object,attribute:!1},searchWidgetIsOpen:{type:Object,attribute:!1},actionsWidgetIsOpen:{type:Object,attribute:!1},isActionAvailable:{type:Object,attribute:!1},noSubmissionAvailable:{type:Object,attribute:!1},createSubmissionUrl:{type:String,attribute:!1},schemaVisibilitySet:{type:Boolean,attribute:!1},isDeleteSelectedSubmissionEnabled:{type:Boolean,attribute:!1},isDeleteAllSubmissionEnabled:{type:Boolean,attribute:!1},isEditSubmissionEnabled:{type:Boolean,attribute:!1},isEditSubmissionPermissionEnabled:{type:Object,attribute:!1},selectedFormsCount:{type:Number,attribute:!1},formsOverviewActionDefinitions:{type:Array,attribute:!1},formsOverviewDropdownActions:{type:Array,attribute:!1},selectedRowCount:{type:Object,attribute:!1},allRowCount:{type:Object,attribute:!1},visibleRowCount:{type:Object,attribute:!1},searchIsActive:{type:Object,attribute:!1},justAddTagsForBatchTagging:{type:Boolean,attribute:!1},attachmentsAreLoading:{type:Object,attribute:!1},noFormsAvailable:{type:Boolean,attribute:!1},creatableModulesCount:{type:Number,attribute:!1},allowListFrontendKeys:{type:Array,attribute:`allow-list-frontend-keys`,converter:{fromAttribute:Xe}},denyListFrontendKeys:{type:Array,attribute:`deny-list-frontend-keys`,converter:{fromAttribute:Xe}},hideCreateSubmissionButton:{type:Boolean,attribute:`hide-create-submission-button`},enableFormsBulkDelete:{type:Boolean,attribute:`enable-forms-bulk-delete`},enableSubmissionPermissionEditing:{type:Boolean,attribute:`enable-submission-permission-editing`}}}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener(`keyup`,this.boundKeyEventHandler),document.removeEventListener(`click`,this.boundCloseActionsDropdownHandler),document.removeEventListener(`dbp-tabulator-table-row-selection-changed-event`,this.boundTableSelectionChanges),document.removeEventListener(`dbp-tabulator-table-page-loaded-event`,this.boundTablePaginationPageLoaded),document.removeEventListener(`dbp-tabulator-table-page-size-changed-event`,this.boundTablePaginationPageLoaded),document.removeEventListener(`dbp-file-sink-download-started`,this.boundFileSinkDownloadStartedHandler),navigator.serviceWorker.removeEventListener(`message`,this.boundSwMessageHandler)}getOverviewPage(){return this._(`dbp-formalize-manage-forms-overview-page`)}getSubmissionsPage(){return this._(`dbp-formalize-manage-form-submissions-page`)}getSubmissionModal(e){return this._(`#submission-modal-${e}`)}refreshTableReferences(){let e=this.getOverviewPage();e&&(this.formsTable=e.getFormsTable());let t=this.getSubmissionsPage();if(t)for(let e of Object.values(c))this.submissionTables[e]=t.getSubmissionTable(e)}connectedCallback(){super.connectedCallback();let e=async()=>{this.langDir&&await w(this._i18n,this),this.updateFormsTableOptions(),Q(this,`draft`),Q(this,`submitted`)};this._overridesReady=e(),this.updateComplete.then(()=>{document.addEventListener(`keyup`,this.boundKeyEventHandler),document.addEventListener(`click`,this.boundCloseActionsDropdownHandler),document.addEventListener(`dbp-tabulator-table-row-selection-changed-event`,this.boundTableSelectionChanges),document.addEventListener(`dbp-tabulator-table-page-loaded-event`,this.boundTablePaginationPageLoaded),document.addEventListener(`dbp-tabulator-table-page-size-changed-event`,this.boundTablePaginationPageLoaded),document.addEventListener(`dbp-file-sink-download-started`,this.boundFileSinkDownloadStartedHandler),navigator.serviceWorker.addEventListener(`message`,this.boundSwMessageHandler),document.addEventListener(`dbp-tabulator-table-built`,e=>{if(e.detail.id){let t=this.getTableState(e.detail.id);if(t){if(Ge(this,t),this.submissionTables[t].setColumns(this.submissionsColumnsInitial[t]),this.setIsActionAvailable(t),this.setVisibleRowCount(t),this.isRequestDetailedView){let e=this.submissions[t].findIndex(e=>e.submissionId===this.submissionIdToOpen),n=e===-1?null:this.submissions[t][e];if(n){let r=n,i=e+1;this.requestDetailedSubmission(t,r,i)}}this.restoreSubmissionTableState(t)}else e.detail.id===this.formsTable?.identifier&&this.restoreFormsTableState()}})})}updateFormsTableOptions(){let e=this._i18n,t=this.allowListFrontendKeys?.length===1&&this.allowListFrontendKeys[0]===`job-offer`,n={en:{columns:{id:e.t(`manage-forms.id`,{lng:`en`}),name:e.t(`manage-forms.name`,{lng:`en`}),employer:e.t(`manage-forms.employer`,{lng:`en`})}},de:{columns:{id:e.t(`manage-forms.id`,{lng:`de`}),name:e.t(`manage-forms.name`,{lng:`de`}),employer:e.t(`manage-forms.employer`,{lng:`de`})}}};this.options_forms={langs:n,layout:`fitColumns`,columns:[{field:`id`,width:50,sorter:`number`},{field:`name`,sorter:`string`,widthGrow:t?2:4},...t?[{field:`employer`,sorter:`string`,widthGrow:2}]:[],{field:`formId`,visible:!1},{field:`grantedActions`,visible:!1},{field:`dateCreated`,visible:!1},{field:`actionButton`,formatter:`html`,hozAlign:`right`,widthShrink:1,minWidth:44,headerSort:!1}],columnDefaults:{vertAlign:`middle`,hozAlign:`left`,resizable:!1},initialSort:[{column:`dateCreated`,dir:`desc`}]},this.options_forms.selectableRows=`highlight`,this.options_forms.rowHeader={formatter:`rowSelection`,titleFormatter:`rowSelection`,titleFormatterParams:{rowRange:`visible`},headerSort:!1,resizable:!1,frozen:!0,headerHozAlign:`center`,hozAlign:`center`,width:40,minWidth:40,widthGrow:0,widthShrink:0}}getTableState(e){for(let t of Object.keys(this.submissionTables))if(this.submissionTables[t]&&e===this.submissionTables[t].identifier)return t;return null}getColumnConfigurationStorageKey(e){let t=this.auth?.[`user-id`];return!this.storeSession||!this.isLoggedIn()||!t?``:`formalize-${e}-${t}`}getPaginationSizeStorageKey(){let e=this.auth?.[`user-id`];return!this.storeSession||!this.isLoggedIn()||!e?``:`formalize-manage-forms-${e}`}rebuildFormsTable(){this.refreshTableReferences(),this.formsTable&&(this.formsTable.options=this.options_forms,this.formsTable.data=this.allForms,this.formsTable.tabulatorTable&&this.formsTable.tabulatorTable.destroy(),this.formsTable.tableReady=!1,this.formsTable.tableBuilding=!1,this.formsTable.buildTable())}async firstUpdated(){this.refreshTableReferences(),!(this.auth.token===``||this.allForms.length>0)&&(this.forms.size===0&&(await J(this),this.getCreatableModules()),await Y(this))}async loginCallback(){this.forms.size===0&&(await J(this),this.getCreatableModules()),await Y(this)}async updated(e){if((e.has(`lang`)||e.has(`langDir`))&&(this.langDir&&await w(this._i18n,this),this.updateFormsTableOptions(),Q(this,`draft`),Q(this,`submitted`),this.rebuildFormsTable()),e.has(`enableFormsBulkDelete`)&&!e.has(`lang`)&&!e.has(`langDir`)&&(this.updateFormsTableOptions(),this.setFormsActionButtonsState(),this.rebuildFormsTable()),e.has(`formsOverviewActionDefinitions`)&&this.setFormsActionButtonsState(),e.has(`enableSubmissionPermissionEditing`))for(let e of Object.values(c))this.submissionTables[e]?.tabulatorTable?this.setIsActionAvailable(e):this.enableSubmissionPermissionEditing||(this.isEditSubmissionPermissionEnabled={...this.isEditSubmissionPermissionEnabled,[e]:!1});if(e.has(`allForms`)){if(this._overridesReady!==null&&await this._overridesReady,this.allForms&&this.allForms.length>0){this.noFormsAvailable=!1;let e=this.getRoutingData().pathSegments[0]||``;if(e){let t=this.forms.get(e);t?this.showRoutedForm(t):A({summary:this._i18n.t(`errors.notfound-title`),body:this._i18n.t(`errors.notfound-body`),type:`danger`,timeout:0})}else this.showFormsOverview()}else this.allForms&&(this.noFormsAvailable=!0,this.refreshTableReferences(),this.formsTable&&(this.formsTable.options=this.options_forms,this.formsTable.data=[],!this.formsTable.tableReady&&!this.formsTable.tableBuilding?this.formsTable.buildTable():this.formsTable.tableReady&&this.formsTable.setData([])),this.loadingFormsTable=!1,this.showFormsTable=!0,this.showSubmissionTables=!1)}if(e.has(`routingUrl`)){let t=this.routingUrl.match(/^\//)?this.routingUrl:`/${this.routingUrl}`,n=e.get(`routingUrl`),r=n&&!n.match(/^\//)?`/`+n:n;if(r===void 0)return;if(t=t.replace(/^(.*)#.*$/,`$1`),r=r.replace(/^(.*)#.*$/,`$1`),r!==t){let e=new URL(t,window.location.origin).search!==new URL(r,window.location.origin).search;this.forms.size===0&&this.isLoggedIn()&&(await J(this),this.getCreatableModules(),await Y(this));let n=this.getRoutingData().pathSegments[0]||``;if(n){let e=this.forms.get(n);e&&this.showRoutedForm(e)}else this.closeEditFormDialog(),this.showFormsOverview();e&&this.restoreVisibleTableState()}}if(e.has(`submissions`)&&!this._isSwitchingTable){this.refreshTableReferences();for(let e in this.submissions)this.submissionTables[e]&&(this.submissions[e]?.length===0?(this.noSubmissionAvailable={...this.noSubmissionAvailable,[e]:!0},Le(this,e),this.submissionTables[e].tabulatorTable&&(this.submissionTables[e].tabulatorTable.destroy(),Q(this,e),Ie(this,e),this.submissionTables[e].options=this.options_submissions[e],this.submissionTables[e].data=[],this.submissionTables[e].buildTable())):(this.noSubmissionAvailable={...this.noSubmissionAvailable,[e]:!1},Fe(this,e),Re(this,e)),this.needTableRebuild[e]&&(this.submissionTables[e].buildTable(),this.needTableRebuild[e]=!1))}if(e.has(`lang`)){await Y(this);let e=this.forms.get(this.activeFormId);if(e){let t=e?e.formSlug:null;this.createSubmissionUrl=t?l(t,this.lang):``,this.switchToSubmissionTable(e)}}if(e.has(`allowListFrontendKeys`)||e.has(`denyListFrontendKeys`)){let t=e.get(`allowListFrontendKeys`),n=e.get(`denyListFrontendKeys`),r=e.has(`allowListFrontendKeys`)&&JSON.stringify(t)!==JSON.stringify(this.allowListFrontendKeys),i=e.has(`denyListFrontendKeys`)&&JSON.stringify(n)!==JSON.stringify(this.denyListFrontendKeys);r&&!e.has(`lang`)&&!e.has(`langDir`)&&(this.updateFormsTableOptions(),this.rebuildFormsTable()),(r||i)&&this.isLoggedIn()&&(console.log(`updated: allowListFrontendKeys/denyListFrontendKeys changed`,this.allowListFrontendKeys,this.denyListFrontendKeys,`isLoggedIn:`,this.isLoggedIn()),await Y(this))}super.updated(e)}switchToSubmissionTable(e){this.activeFormName=e.formName,this.activeFormId=e.formId,this.showFormsTable=!1,this.loadingSubmissionTables=!0,this.availableTags=[],this._isSwitchingTable=!0,this.submissions={submitted:[],draft:[]};let t=++this._switchGeneration;Ae(this,this.activeFormId).then(async()=>{if(t!==this._switchGeneration)return;let e=this.getSubmissionsPage();e&&await e.updateComplete,this.refreshTableReferences();let n=this.forms.get(this.activeFormId),r=n?n.formSlug:null;if(this.createSubmissionUrl=r&&!r.match(/[\w\d]{8}-[\w\d]{4}-[\w\d]{4}-[\w\d]{4}-[\w\d]{12}/)?l(r,this.lang):``,await Ne(this,this.activeFormId),t===this._switchGeneration){for(let e of Object.keys(this.submissionTables))if(this.submissionTables[e]){let t=this.submissionTables[e];if(t.tabulatorTable&&t.tabulatorTable.destroy(),t.tableReady=!1,t.tableBuilding=!1,t.data=[],Q(this,e),this.submissions[e].length===0)this.loadingSubmissionTables=!1,this.showSubmissionTables=!0,this.showFormsTable=!1,Ie(this,e),Le(this,e),this.options_submissions[e].data=[];else{Fe(this,e),Re(this,e),this.options_submissions[e].data=this.submissions[e],this.loadingSubmissionTables=!1,this.showSubmissionTables=!0,this.showFormsTable=!1;let t=this.getRoutingData();this.submissionIdToOpen=t.pathSegments[2]&&t.pathSegments[2].match(/[0-9a-f-]+/)?t.pathSegments[2]:null;let n=t.pathSegments[1]===`details`&&this.submissionIdToOpen;this.isRequestDetailedView=n}}this.options_submissions={...this.options_submissions},this._isSwitchingTable=!1}}).catch(()=>{this._isSwitchingTable=!1})}getSubmittedFilesForField(e,t,n){if(!n?.startsWith(`form_files-`)||!t)return[];let r=this.submittedFileDetails[e]?.get(t)||[],i=n.replace(`form_files-`,``);return r.filter(e=>e.fileAttributeName===i)}requestDetailedSubmission(e,t,n){let r=this.getSubmissionModal(e);if(!r)return;let i=[],a=this.submissionTables[e]?.getColumnDefinitions?.()||this.submissionsColumnsInitial[e];if(a.length!==0){for(let n of a)if(n&&n.field&&n.field!==`htmlButtons`&&n.field!==`rowIndex`){let r=n.title?(0,V.default)(n.title):(0,V.default)(n.field),a=this.getSubmittedFilesForField(e,t.submissionId,n.field),o=n.field===`dateCreated`?q(t[n.field]):(0,V.default)(t[n.field]??``);i.push(a.length>0?{label:r,type:`files`,files:a}:{label:r,value:o})}}else for(let[n,r]of Object.entries(t)){if(!n||n===`htmlButtons`||n===`rowIndex`)continue;let a=this.getSubmittedFilesForField(e,t.submissionId,n);i.push(a.length>0?{label:(0,V.default)(n),type:`files`,files:a}:{label:(0,V.default)(n),value:n===`dateCreated`?q(r):(0,V.default)(r??``)})}this.currentDetailPosition=n,this.currentBeautyId=n,this.isPrevEnabled=n!==1,this.isNextEnabled=n+1<=this.totalNumberOfItems[e],r.lang=this.lang,r.state=e,r.hiddenColumns=this.hiddenColumns,r.isPrevEnabled=this.isPrevEnabled,r.isNextEnabled=this.isNextEnabled,r.currentBeautyId=this.currentBeautyId,r.totalItems=this.totalNumberOfItems[e],r.auth=this.auth,r.contentItems=i,this.showDetailedModal(e)}showDetailedModal(e){let t=this.getSubmissionModal(e);t&&t.show()}showEntryOfPos(e,t,n){if(t>this.totalNumberOfItems[e]||t<1)return;let r=this.submissionTables[e];if(!r)return;let i=r.getRows()[t-1].getCells(),a={};for(let e of i)e.getColumn().getDefinition().formatter!==`html`&&(a[e.getField()]=e.getValue());this.setSubmissionDetailsRoute(a.submissionId),this.requestDetailedSubmission(e,a,t)}exportSubmissionTable(e,t){let n=e.target;if(!n)return;let r=n.value;if(r&&r!==``){if(e&&e.stopPropagation(),r===`attachments`){let e=[],n=this.submissionTables[t].tabulatorTable.getSelectedRows(),r,i=[];r=n&&n.length>0?n:this.submissionTables[t].tabulatorTable.getRows(),r.forEach(e=>{let t=e.getData();i.push(t.submissionId)});for(let[n,r]of this.submittedFileDetails[t]){if(i.length>0&&!i.some(e=>e===n)||!r||r.length===0)continue;let a=this.getDownloadFolderName(n,t);r.forEach(t=>{this.useSubFoldersForExports===!1?e.push({name:t.fileName,url:t.downloadUrl}):e.push({name:`${a}/${t.fileName}`,url:t.downloadUrl})})}this._(`#file-sink`).files=e}else this.submissionTables[t].download(r,this.activeFormName);n.value=`-`}}getDownloadFolderName(e,t){let n=`schemaField/`,r=`systemAttribute/`,i=!1;if(this.useSubFoldersForExports===!1)return``;let a=this.submissions[t].find(t=>t.submissionId===e);if(!a||!a.submissionId)throw Error(`Submission data not found for submissionId: `+e);if(!this.downloadFolderNamePattern||this.downloadFolderNamePattern===``||!a)return a.submissionId;let o=this.downloadFolderNamePattern.split(`_`),s=[];for(let t of o){let o=t.replace(/\${([a-zA-Z/]+)}/,`$1`);if(o&&o.startsWith(r)){let t=o.replace(r,``),n=this.rawSubmissions.find(t=>t.identifier===e);n&&n[t]?s.push(n[t].replace(/\s+/g,`-`)):i=!0}if(o&&o.startsWith(n)){let e=o.replace(n,``);a[e]?s.push(`${a[e]}`.replace(/\s+/g,`-`)):i=!0}}return i||s.length===0?a.submissionId:s.join(`_`).substring(0,230)}getUrlPaginationValue(e,t){let n=Number.parseInt(e??``,10);return Number.isInteger(n)&&n>0?n:t}updateRoutingQuery(e){let{pathname:t,queryParams:n,hash:r}=this.getRoutingData(),i=new URLSearchParams(n);for(let[t,n]of Object.entries(e))n==null||n===``?i.delete(t):i.set(t,`${n}`);let a=i.toString(),o=`${t}${a?`?${a}`:``}${r}`;o!==this.routingUrl&&this.sendSetPropertyEvent(`routing-url`,o,!0)}getRoutingUrlWithQueryPrefixes(e,t){let n=new URLSearchParams,r=this.getRoutingData().queryParams??new URLSearchParams;for(let[e,i]of r)t.some(t=>e.startsWith(t))&&n.append(e,i);let i=n.toString();return`${e}${i?`?${i}`:``}`}syncFormsFilterToUrl(e){this.updateRoutingQuery({"forms-search":e,"forms-page":null})}syncSubmissionFilterToUrl(e){let t=this.getSubmissionsPage(),n=t?.getSearchbar(e),r=t?.getSearchSelect(e),i=t?.getSearchOperator(e);n&&r&&i&&this.updateRoutingQuery({[`${e}-search`]:n.value,[`${e}-search-column`]:r.value===`all`?null:r.value,[`${e}-search-operator`]:i.value===`like`?null:i.value,[`${e}-page`]:null})}async restoreFormsTableState(){let e=this.getOverviewPage(),t=e?.getSearchbar(),n=this.formsTable;if(!t||!n?.tabulatorTable)return;let{queryParams:r}=this.getRoutingData(),i=r.get(`forms-search`)??``,a=this.getUrlPaginationValue(r.get(`forms-page`),1),o=this.getUrlPaginationValue(r.get(`forms-page-size`),n.paginationSize),s=Ye.includes(o)?o:5;this._restoringUrlStateTables.add(n.identifier);try{t.value=i,n.paginationSize=s,await n.tabulatorTable.setPageSize(s),e.applySearch(i),await n.tabulatorTable.setPage(a)}finally{this._restoringUrlStateTables.delete(n.identifier),this._urlStateReadyTables.add(n.identifier)}}async restoreSubmissionTableState(e){let t=this.getSubmissionsPage(),n=t?.getSearchbar(e),r=t?.getSearchSelect(e),i=t?.getSearchOperator(e),a=this.submissionTables[e];if(!n||!r||!i||!a?.tabulatorTable)return;let{queryParams:o}=this.getRoutingData(),s=o.get(`${e}-search-column`)??`all`,c=o.get(`${e}-search-operator`)??`like`,l=this.getUrlPaginationValue(o.get(`${e}-page`),1),u=this.getUrlPaginationValue(o.get(`${e}-page-size`),a.paginationSize),d=Ye.includes(u)?u:5;this._restoringUrlStateTables.add(a.identifier);try{n.value=o.get(`${e}-search`)??``,r.value=Array.from(r.options).some(e=>e.value===s)?s:`all`,i.value=Array.from(i.options).some(e=>e.value===c)?c:`like`,a.paginationSize=d,await a.tabulatorTable.setPageSize(d),this.filterTable(e,!1),await a.tabulatorTable.setPage(l)}finally{this._restoringUrlStateTables.delete(a.identifier),this._urlStateReadyTables.add(a.identifier)}}async restoreVisibleTableState(){if(this.showFormsTable){await this.restoreFormsTableState();return}if(this.showSubmissionTables)for(let e of Object.values(c))await this.restoreSubmissionTableState(e)}filterTable(e,t=!0){let n=this.getSubmissionsPage(),r=n?.getSearchbar(e),i=n?.getSearchSelect(e),a=n?.getSearchOperator(e),o=this.submissionTables[e];if(!r||!i||!a||!o)return;if(r.value===``){o.clearFilter(),this.searchIsActive={...this.searchIsActive,[e]:!1},this.setVisibleRowCount(e),t&&this.syncSubmissionFilterToUrl(e);return}let s=r.value,c=i.value,l=a.value;if(c!==`all`){let t={field:c,type:l,value:s};o.tabulatorTable.deselectRow(),o.setFilter([t]),this.setVisibleRowCount(e),this.searchIsActive={...this.searchIsActive,[e]:!0}}else{let t=o.getColumnsFields(),n=[];for(let e of t)if(e&&e!==`htmlButtons`){let t={field:e,type:l,value:s};n.push(t)}o.tabulatorTable.deselectRow(),o.setFilter([n]),this.setVisibleRowCount(e),this.searchIsActive={...this.searchIsActive,[e]:!0}}t&&this.syncSubmissionFilterToUrl(e)}clearAllFilters(e=null,t=!0){let n=e?[e]:Object.keys(this.submissionTables),r={};for(let e of n){let t=this.getSubmissionsPage(),n=t?.getSearchbar(e),i=t?.getSearchSelect(e),a=t?.getSearchOperator(e),o=this.submissionTables[e];o&&n&&i&&a&&(n.value=``,i.value=`all`,a.value=`like`,o.clearFilter(),this.searchIsActive={...this.searchIsActive,[e]:!1},this.setVisibleRowCount(e),r[`${e}-search`]=null,r[`${e}-search-column`]=null,r[`${e}-search-operator`]=null,r[`${e}-page`]=null)}t&&this.updateRoutingQuery(r)}handleKeyEvents(e){let t=this.getSubmissionsPage()?.shadowRoot?.activeElement;if(t&&t.classList.contains(`searchbar`)&&e.keyCode===13){e.preventDefault();let n=t.getAttribute(`data-state`);this.filterTable(n)}}closeActionsDropdown(e){let t=e.composedPath(),n=this.getSubmissionsPage()?.getActionsContainers()??[];Array.from(n).some(e=>t.includes(e))||this.closeAllActionsDropdown()}handleTablePaginationPageLoaded(e){let t=e.detail.tableId,n=this.getTableState(t);if(n&&this.setVisibleRowCount(n),this._restoringUrlStateTables.has(t)||!this._urlStateReadyTables.has(t))return;let r=n??(t===this.formsTable?.identifier?`forms`:null);if(!r)return;let i=e.detail.page??1,a=e.detail.paginationSize??e.detail.pageSize??5;this.updateRoutingQuery({[`${r}-page`]:i===1?null:i,[`${r}-page-size`]:a===5?null:a})}setVisibleRowCount(e){this.visibleRowCount={...this.visibleRowCount,[e]:this.submissionTables[e].tabulatorTable.getRows(`active`).length}}setSelectedRowCount(e){let t=this.submissionTables[e].tabulatorTable.getSelectedRows();this.selectedRowCount={...this.selectedRowCount,[e]:t.length}}handleLoadingIndicatorModalClosed(){if(this._downloadStreamingStarted)return;let e=this._(`#file-sink`);e&&e.cancelStreamedDownload()}handleTableSelectionChanges(e){let t=e.detail.selected,n=e.detail.deselected,r=t[0]??n[0];if(!r){this.setFormsActionButtonsState();return}let i=r.getTable().element.getRootNode();if(i instanceof ShadowRoot){let e=i.host;if(e.identifier===`forms-table`){this.setFormsActionButtonsState();return}let n=this.getTableState(e.identifier);this.selectedRowCount={...this.selectedRowCount,[n]:t.length},this.setIsActionAvailable(n)}}setFormsActionButtonsState(){let e=this.formsTable?.tabulatorTable?.getSelectedRows()??[];this.selectedFormsCount=e.length;let t=e.map(e=>{let t=e.getData();return{...t,...this.forms.get(t.formId)??{}}}).filter(Boolean),n=W(this,t);this.formsOverviewDropdownActions=this.formsOverviewActionDefinitions.filter(e=>e.placements?.includes(`dropdown`)).map(e=>K(e,n)).filter(e=>e.visible).map(e=>({value:e.id,label:e.label,iconName:e.iconName,disabled:!e.enabled}))}handleFormsPageAction(e){let t=this.formsOverviewActionDefinitions.find(t=>t.id===e.detail?.action);if(!t)return;let n=this.formsTable?.tabulatorTable?.getSelectedData()?.map(e=>({...e,...this.forms.get(e.formId)??{}})).filter(Boolean)??[],r=W(this,n,e),i=K(t,r);i.visible&&i.enabled&&t.handler(r)}handleEditFormPermission(e){let t=this._(`#form-grant-permission-dialog`);t&&Array.isArray(e)&&e.length!==0&&(t.resourceIdentifier=e.length===1?e[0]:``,t.resourceIdentifiers=e,t.open())}async handleDeleteForms(e=null){if(!this.enableFormsBulkDelete||!this.formsTable?.tabulatorTable)return;let t=this.formsTable.tabulatorTable,n=t.getSelectedData(),r=(Array.isArray(e)?e.filter(Boolean):n.map(e=>e.formId).filter(Boolean)).map(e=>this.forms.get(e)??this.allForms.find(t=>t.formId===e)).filter(Boolean);if(r.length===0){A({summary:this._i18n.t(`errors.warning-title`),body:this._i18n.t(`manage-forms.no-form-selected`),type:`warning`,timeout:10});return}let i=this._(`#deletion-modal`);if(!(i&&await i.confirm({messageKey:`manage-forms.delete-forms-confirmation-message`,messageLi2Key:`manage-forms.delete-forms-confirmation-message-li2`})))return;let a=[];for(let e of r){let n=e.formId,r=this.formsGrantedActions.get(n)??e.grantedActions??[];if(!r.includes(u.DELETE)&&!r.includes(u.MANAGE))continue;let i=await Pe(this,n);a.push(i),i===!0&&(t.getRows().find(e=>e.getData().formId===n)?.delete(),this.formsGrantedActions.delete(n),this.allForms=this.allForms.filter(e=>e.formId!==n),this.forms.delete(n))}this.noFormsAvailable=this.allForms.length===0,this.setFormsActionButtonsState(),Je(e=>this._i18n.t(e)),Z(this,a,{successKey:`success.forms-processed`,failureKey:`errors.forms-processing-failed`})}setIsActionAvailable(e){this.setActionButtonsStates(e),this.isActionAvailable=this.isEditSubmissionEnabled[e]===!1&&this.isEditSubmissionPermissionEnabled[e]===!1&&this.isDeleteAllSubmissionEnabled[e]===!1&&this.isDeleteSelectedSubmissionEnabled[e]===!1&&this.isBatchTaggingEnabled[e]===!1?{...this.isActionAvailable,[e]:!1}:{...this.isActionAvailable,[e]:!0}}toggleActionsDropdown(e){this.actionsWidgetIsOpen={...this.actionsWidgetIsOpen,[e]:!this.actionsWidgetIsOpen[e]}}closeAllActionsDropdown(){this.actionsWidgetIsOpen={draft:!1,submitted:!1}}setActionButtonsStates(e){if(!this.submissionTables[e].tabulatorTable)return;let t=this.submissionTables[e].tabulatorTable.getSelectedRows(),n=this.submissionTables[e].tabulatorTable.getRows(`all`),r=/* @__PURE__ */ new Set;for(let e of t){let t=e.getData().submissionId;this.submissionsGrantedActions.get(t)?.forEach(e=>r.add(e))}let i=/* @__PURE__ */ new Set;for(let e of n){let t=e.getData().submissionId;this.submissionsGrantedActions.get(t)?.forEach(e=>i.add(e))}console.log(`allSubmissionsGrants`,i);let o=t.length,s=n.length;this.selectedRowCount={...this.selectedRowCount,[e]:o},this.allRowCount={...this.allRowCount,[e]:s},this.isDeleteSelectedSubmissionEnabled={...this.isDeleteSelectedSubmissionEnabled,[e]:o>0&&(r.has(a.MANAGE)||r.has(a.DELETE))},this.isDeleteAllSubmissionEnabled={...this.isDeleteAllSubmissionEnabled,[e]:o===0&&(i.has(a.MANAGE)||i.has(a.DELETE))},this.isEditSubmissionEnabled={...this.isEditSubmissionEnabled,[e]:o===1&&(r.has(a.MANAGE)||r.has(a.UPDATE))},this.isEditSubmissionPermissionEnabled={...this.isEditSubmissionPermissionEnabled,[e]:this.enableSubmissionPermissionEditing&&o>0&&t.every(e=>{let t=e.getData().submissionId;return(this.submissionsGrantedActions.get(t)??[]).includes(a.MANAGE)})},this.isBatchTaggingEnabled[e]=!1}async handleOpenBatchTaggingModal(e){let t=this.submissionTables[e].tabulatorTable.getSelectedData();this.submissionIdsForTagging=t.map(e=>e.submissionId),await Ne(this,this.activeFormId),this.currentStateForBatchTagging=e;let n=this._(`#batch-tagging-modal`);n&&(n.availableTags=this.availableTags,n.submissionCount=this.submissionIdsForTagging.length,n.open())}handleEditSubmissionsPermission(e){if(!this.enableSubmissionPermissionEditing)return;let t=this.submissionTables[e]?.tabulatorTable?.getSelectedData()?.map(e=>e.submissionId).filter(Boolean)??[],n=this._(`#submission-grant-permission-dialog`);n&&t.length!==0&&(n.resourceIdentifier=t.length===1?t[0]:``,n.resourceIdentifiers=t,n.open())}async handleBatchTaggingConfirm(e){let{tags:t,justAdd:n}=e.detail,r=this._(`#batch-tagging-modal`),i=r?.getConfirmButton();i&&(i.spinner=!0,i.start());let a=[],o=[],s=/* @__PURE__ */ new Map;for(let e of this.submissionIdsForTagging)try{let r=this.rawSubmissions.find(t=>t.identifier===e),i=r?.tags||[],c;if(n){let e=[...i,...t];c=[...new Set(e)]}else c=[...t];let l=await Me(this,e,c);a.push(l),o.push({status:l,submissionId:e}),l&&r&&(s.set(e,c),r.tags=c)}catch(t){console.error(`Failed to update tags for submission ${e}:`,t),a.push(!1),o.push({status:!1,submissionId:e})}let c=this.currentStateForBatchTagging,l=this.submissionTables[c].tabulatorTable;l.getRows().filter(e=>{let t=o.find(t=>t.submissionId===e.getData().submissionId);return t&&t.status===!0}).forEach(e=>{let t=e.getData().submissionId,n=s.get(t)||[];e.update({tags:Array.isArray(n)?n.map(e=>`<span class="tag">${(0,V.default)(e)}</span>`).join(` `):``}),e.deselect()}),l.redraw(!0),i&&(i.spinner=!1,i.stop()),r&&r.close(),this.requestUpdate(),Z(this,a)}getCreatableModules(){let e=[];for(let t of this.loadedModules.values()){if(!t.moduleInstance||typeof t.moduleInstance.getEditFormComponent!=`function`)continue;let n=typeof t.moduleInstance.getFormFrontendKey==`function`?t.moduleInstance.getFormFrontendKey():null;if(this.allowListFrontendKeys.length>0&&(n===null||!this.allowListFrontendKeys.includes(n))||this.denyListFrontendKeys.length>0&&n!==null&&this.denyListFrontendKeys.includes(n))continue;let r=typeof t.moduleInstance.getFormName==`function`?t.moduleInstance.getFormName(this.lang):t.formSlug;e.push({formId:t.formId,formSlug:t.formSlug,formName:r,moduleInstance:t.moduleInstance})}return this.creatableModulesCount=e.length,e}handleOpenCreateFormDialog(){let e=this._(`#edit-form-dialog`);e&&(e.existingForm=null,e.creatableModules=this.getCreatableModules(),e.open())}handleOpenEditFormDialog(e,t=!0){let n=this._(`#edit-form-dialog`);if(!n)return;let r=this.forms.get(e);r&&(n.existingForm={formId:r.formId,formSlug:r.formSlug,formName:r.formName,moduleInstance:r.moduleInstance,additionalData:r.additionalData||null,localizedNames:r.localizedNames||[]},t&&this.sendSetPropertyEvent(`routing-url`,this.getRoutingUrlWithQueryPrefixes(`/${e}/edit`,[`forms-`]),!0),n.open())}handleEditFormDialogClosed(e){if(e.detail?.id!==`edit-form-dialog`)return;let t=this._(`#edit-form-dialog`);t&&(t.existingForm=null);let{pathSegments:n}=this.getRoutingData();n[0]&&n[1]===`edit`&&this.sendSetPropertyEvent(`routing-url`,this.getRoutingUrlWithQueryPrefixes(`/`,[`forms-`]),!0)}async handleCreateFormCreated(e){await Y(this)}async handleEditFormSaved(e){await Y(this)}handleEditSubmissions(e,t){let n=this.submissionTables[t].tabulatorTable.getSelectedData()[0].submissionId,r=this.forms.get(this.activeFormId),i=r?r.formSlug:null;if(r&&i&&r.moduleInstance&&typeof r.moduleInstance.hasReadOnlyMode==`function`&&r.moduleInstance.hasReadOnlyMode()){let t=l(i,this.lang)+`/${n}`,r=new URL(t);r.searchParams.set(`validate`,`true`),window.history.pushState({},``,r),e.button===1?window.open(r.toString(),`_blank`):window.location.href=r.toString()}else A({summary:this._i18n.t(`errors.warning-title`),body:this._i18n.t(`errors.feature-not-implemented`),type:`warning`,timeout:10})}async handleDeleteSubmissions(e,t=!1){let n=t?this.submissionTables[e].tabulatorTable.getSelectedData():this.submissionTables[e].tabulatorTable.getData(`all`),r=t?this.submissionTables[e].tabulatorTable.getSelectedRows():this.submissionTables[e].tabulatorTable.getRows(`all`);if(n.length>0){let t=this._(`#deletion-modal`);if(!(t&&await t.confirm()))return;let i=[],a=[],o=0;for(let t of n){let n=await je(this,t.submissionId);if(i.push(n),n===!0){r[o].delete();let n=this.submissions[e].filter(e=>e.submissionId!==t.submissionId);this.submissions={...this.submissions,[e]:n},this.options_submissions={...this.options_submissions,[e]:{...this.options_submissions[e],data:this.options_submissions[e].data.filter(e=>e.submissionId!==t.submissionId)}}}else a.push(t.submissionId);o++}if(this.submissions[e].length===0&&this.submissionTables[e].tabulatorTable.clearData(),this.setVisibleRowCount(e),this.setSelectedRowCount(e),this.setIsActionAvailable(e),this.submissionTables[e].tabulatorTable.redraw(!0),Z(this,i),a.length>0){let t=this.submissionTables[e];for(let e of a)t.getRows().filter(t=>t.getData().submissionId===e).forEach(e=>e.select())}}else A({summary:this._i18n.t(`errors.warning-title`),body:this._i18n.t(`errors.no-submission-selected`),type:`warning`,timeout:10})}setSubmissionDetailsRoute(e=null){let{pathSegments:t,queryParams:n,hash:r}=this.getRoutingData(),i=this.activeFormId||t[0];if(!i)return;let a=e?`/${i}/details/${encodeURIComponent(e)}`:`/${i}`,o=n?.toString()??``,s=`${a}${o?`?${o}`:``}${r??``}`;s!==this.routingUrl&&this.sendSetPropertyEvent(`routing-url`,s,!0)}showFormsOverview(){if(this.refreshTableReferences(),this.formsTable){if(this.formsTable.options=this.options_forms,this.formsTable.data=this.allForms,!this.formsTable.tableReady&&!this.formsTable.tableBuilding)this.formsTable.buildTable();else if(this.formsTable.tableReady){let e=this.formsTable.identifier;this._urlStateReadyTables.delete(e);let t=this.formsTable.setData(this.allForms);Promise.resolve(t).then(()=>{if(this.showFormsTable&&this.formsTable?.identifier===e)return this.restoreFormsTableState()})}}this.loadingFormsTable=!1,this.showFormsTable=!0,this.showSubmissionTables=!1}closeEditFormDialog(){let e=this._(`#edit-form-dialog`);e?.existingForm&&(e.close(),e.existingForm=null)}showRoutedForm(e){let{pathSegments:t}=this.getRoutingData();if(t[1]===`edit`){this.showFormsOverview(),this._(`#edit-form-dialog`)?.existingForm?.formId!==e.formId&&this.handleOpenEditFormDialog(e.formId,!1);return}this.closeEditFormDialog(),(this.activeFormId!==e.formId||!this.showSubmissionTables||this.loadingSubmissionTables)&&this.switchToSubmissionTable(e)}closeAllSearchWidgets(){this.searchWidgetIsOpen={draft:!1,submitted:!1}}handleBackToOverview(){this.showSubmissionTables=!1,this.loadingSubmissionTables=!1,this.clearAllFilters(null,!1),this.closeAllSearchWidgets(),this.loadingFormsTable=!1,this.showFormsTable=!0,this.activeFormId=null,this.showFormsOverview(),this.sendSetPropertyEvent(`routing-url`,this.getRoutingUrlWithQueryPrefixes(`/`,[`forms-`]),!0)}handleSubmissionsPageSearchToggle(e){let{state:t,open:n}=e.detail;this.searchWidgetIsOpen={...this.searchWidgetIsOpen,[t]:n}}handleSubmissionsPageActionsToggle(e){let{state:t,open:n}=e.detail;this.actionsWidgetIsOpen={...this.actionsWidgetIsOpen,[t]:n}}handleSubmissionsPageAction(e){let{action:t,state:n,payload:r}=e.detail,i=(r??{}).event;switch(t){case`prepare-actions`:this.setActionButtonsStates(n);break;case`edit-submission`:this.handleEditSubmissions(i,n);break;case`batch-tagging`:this.handleOpenBatchTaggingModal(n);break;case`edit-permission`:this.isEditSubmissionPermissionEnabled[n]&&this.handleEditSubmissionsPermission(n);break;case`delete-all`:this.handleDeleteSubmissions(n);break;case`delete-selected`:this.handleDeleteSubmissions(n,!0);break;case`export`:this.exportSubmissionTable(i,n)}}handleSubmissionModalClose(){this.setSubmissionDetailsRoute()}handleSubmissionModalPrevious(e){let{state:t}=e.detail;this.showEntryOfPos(t,this.currentDetailPosition-1,`previous`)}handleSubmissionModalNext(e){let{state:t}=e.detail;this.showEntryOfPos(t,this.currentDetailPosition+1,`next`)}_onLoginClicked(e){this.sendSetPropertyEvent(`requested-login-status`,`logged-in`),e.preventDefault()}static get styles(){return x`
            @layer theme, utility, formalize;
            @layer theme {
                ${b()}
                ${C()}
                ${M()}
                ${j(!1)}
                ${_()}
                ${E()}
                ${T()}
                ${F()}
                ${ie()}
                ${re()}
            }

            @layer formalize {
                ${te()}

                .visually-hidden {
                    clip: rect(0 0 0 0);
                    clip-path: inset(50%);
                    height: 1px;
                    overflow: hidden;
                    position: absolute;
                    white-space: nowrap;
                    width: 1px;
                }
            }
        `}render(){let e=this._i18n;if(this.activeFormId){let e=this.forms.get(this.activeFormId)?.allowedSubmissionStates;this.enabledStates={draft:o(e),submitted:i(e)}}return y`
            <div
                class="notification is-warning ${N({hidden:this.isLoggedIn()||this.isLoading()})}">
                ${e.t(`error-login-message`)}
                <a href="#" @click="${this._onLoginClicked}">${e.t(`error-login-link`)}</a>
            </div>

            <div class="control ${N({hidden:this.isLoggedIn()||!this.isAuthPending()})}">
                <span class="loading">
                    <dbp-mini-spinner text="${e.t(`loading-message`)}"></dbp-mini-spinner>
                </span>
            </div>

            <div
                class="${N({hidden:!this.isLoggedIn()||this.isAuthPending()})}">
                <div>
                    <slot name="additional-information"></slot>
                </div>

                <dbp-formalize-manage-forms-overview-page
                    lang="${this.lang}"
                    lang-dir="${this.langDir}"
                    id="overview-page"
                    .loadingFormsTable=${this.loadingFormsTable}
                    .showFormsTable=${this.showFormsTable}
                    .showSubmissionTables=${this.showSubmissionTables}
                    .optionsForms=${this.options_forms}
                    .paginationSizeStorageKey=${this.getPaginationSizeStorageKey()}
                    .noFormsAvailable=${this.noFormsAvailable}
                    .creatableModulesCount=${this.creatableModulesCount}
                    .actions=${this.formsOverviewDropdownActions}
                    .selectedFormsCount=${this.selectedFormsCount}
                    @forms-search-change=${e=>this.syncFormsFilterToUrl(e.detail.value)}
                    @create-form-request=${()=>this.handleOpenCreateFormDialog()}
                    @form-action=${e=>this.handleFormsPageAction(e)}></dbp-formalize-manage-forms-overview-page>

                <dbp-formalize-manage-form-submissions-page
                    lang="${this.lang}"
                    lang-dir="${this.langDir}"
                    id="submissions-page"
                    .showFormsTable=${this.showFormsTable}
                    .showSubmissionTables=${this.showSubmissionTables}
                    .loadingSubmissionTables=${this.loadingSubmissionTables}
                    .activeFormName=${this.activeFormName}
                    .paginationSizeStorageKey=${this.getPaginationSizeStorageKey()}
                    .columnConfigurationStorageKeys=${Object.fromEntries(Object.values(c).map(e=>[e,this.getColumnConfigurationStorageKey(`submissions-${this.activeFormId}-${e}`)]))}
                    .createSubmissionUrl=${this.createSubmissionUrl}
                    .hideCreateSubmissionButton=${this.hideCreateSubmissionButton}
                    .enabledStates=${this.enabledStates}
                    .noSubmissionAvailable=${this.noSubmissionAvailable}
                    .searchWidgetIsOpen=${this.searchWidgetIsOpen}
                    .actionsWidgetIsOpen=${this.actionsWidgetIsOpen}
                    .isActionAvailable=${this.isActionAvailable}
                    .isEditSubmissionEnabled=${this.isEditSubmissionEnabled}
                    .enableSubmissionPermissionEditing=${this.enableSubmissionPermissionEditing}
                    .isEditSubmissionPermissionEnabled=${this.isEditSubmissionPermissionEnabled}
                    .isBatchTaggingEnabled=${this.isBatchTaggingEnabled}
                    .isDeleteAllSubmissionEnabled=${this.isDeleteAllSubmissionEnabled}
                    .isDeleteSelectedSubmissionEnabled=${this.isDeleteSelectedSubmissionEnabled}
                    .optionsSubmissions=${this.options_submissions}
                    .submissions=${this.submissions}
                    .selectedRowCount=${this.selectedRowCount}
                    .allRowCount=${this.allRowCount}
                    .visibleRowCount=${this.visibleRowCount}
                    .searchIsActive=${this.searchIsActive}
                    .submissionsHasAttachment=${this.submissionsHasAttachment}
                    @back-to-overview=${()=>this.handleBackToOverview()}
                    @submission-search-toggle=${e=>this.handleSubmissionsPageSearchToggle(e)}
                    @submission-actions-toggle=${e=>this.handleSubmissionsPageActionsToggle(e)}
                    @submission-search=${e=>this.filterTable(e.detail.state)}
                    @submission-search-reset=${e=>this.clearAllFilters(e.detail.state)}
                    @submission-action=${e=>this.handleSubmissionsPageAction(e)}></dbp-formalize-manage-form-submissions-page>
            </div>

            ${Object.values(c).map(e=>y`
                    <dbp-formalize-manage-submission-modal
                        lang="${this.lang}"
                        id="submission-modal-${e}"
                        .auth=${this.auth}
                        .state=${e}
                        @detail-modal-close=${()=>this.handleSubmissionModalClose()}
                        @detail-modal-previous=${e=>this.handleSubmissionModalPrevious(e)}
                        @detail-modal-next=${e=>this.handleSubmissionModalNext(e)}></dbp-formalize-manage-submission-modal>
                `)}

            <dbp-grant-permission-dialog
                id="form-grant-permission-dialog"
                lang="${this.lang}"
                modal-title="${e.t(`manage-forms.edit-permission-modal-title`)}"
                subscribe="auth"
                entry-point-url="${this.entryPointUrl}"
                resource-class-identifier="DbpRelayFormalizeForm"></dbp-grant-permission-dialog>

            ${this.enableSubmissionPermissionEditing?y`
                          <dbp-grant-permission-dialog
                              id="submission-grant-permission-dialog"
                              lang="${this.lang}"
                              modal-title="${e.t(`manage-forms.edit-permission-modal-title`)}"
                              subscribe="auth"
                              entry-point-url="${this.entryPointUrl}"
                              resource-class-identifier="DbpRelayFormalizeSubmission"></dbp-grant-permission-dialog>
                      `:``}

            <dbp-file-sink
                streamed
                id="file-sink"
                class="file-sink"
                lang="${this.lang}"
                allowed-mime-types="application/pdf,.pdf"
                decompress-zip
                enabled-targets="local,nextcloud"
                subscribe="auth,nextcloud-auth-url,nextcloud-web-dav-url,nextcloud-name,nextcloud-file-url"></dbp-file-sink>

            <dbp-formalize-deletion-confirmation-modal
                id="deletion-modal"
                lang-dir="${this.langDir}"
                subscribe="lang"></dbp-formalize-deletion-confirmation-modal>

            <dbp-formalize-batch-tagging-modal
                id="batch-tagging-modal"
                subscribe="lang"
                @batch-tagging-confirm=${e=>this.handleBatchTaggingConfirm(e)}></dbp-formalize-batch-tagging-modal>

            <dbp-formalize-edit-form-dialog
                id="edit-form-dialog"
                lang="${this.lang}"
                lang-dir="${this.langDir}"
                .auth="${this.auth}"
                entry-point-url="${this.entryPointUrl}"
                @dbp-modal-closed=${e=>this.handleEditFormDialogClosed(e)}
                @dbp-create-form-created=${e=>this.handleCreateFormCreated(e)}
                @dbp-edit-form-saved=${e=>this.handleEditFormSaved(e)}></dbp-formalize-edit-form-dialog>
        `}};v(`dbp-formalize-manage-forms`,$);export{$ as ManageForms};
//# sourceMappingURL=dbp-formalize-manage-forms.js.map