(()=>{"use strict";var e={49:(e,t,r)=>{r.d(t,{Z:()=>o});var i=r(140);class o{static isNode(e){return"object"==typeof e&&null!==e&&(e===document||e===window||e instanceof Node)}static hasAttribute(e,t){if(!o.isNode(e))throw Error("The element must be a valid HTML Node!");return"function"==typeof e.hasAttribute&&e.hasAttribute(t)}static getAttribute(e,t){let r=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(r&&!1===o.hasAttribute(e,t))throw Error('The required property "'.concat(t,'" does not exist!'));if("function"!=typeof e.getAttribute){if(r)throw Error("This node doesn't support the getAttribute function!");return}return e.getAttribute(t)}static getDataAttribute(e,t){let r=!(arguments.length>2)||void 0===arguments[2]||arguments[2],n=t.replace(/^data(|-)/,""),s=i.Z.toLowerCamelCase(n,"-");if(!o.isNode(e)){if(r)throw Error("The passed node is not a valid HTML Node!");return}if(void 0===e.dataset){if(r)throw Error("This node doesn't support the dataset attribute!");return}let a=e.dataset[s];if(void 0===a){if(r)throw Error('The required data attribute "'.concat(t,'" does not exist on ').concat(e,"!"));return a}return i.Z.parsePrimitive(a)}static querySelector(e,t){let r=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(r&&!o.isNode(e))throw Error("The parent node is not a valid HTML Node!");let i=e.querySelector(t)||!1;if(r&&!1===i)throw Error('The required element "'.concat(t,'" does not exist in parent node!'));return i}static querySelectorAll(e,t){let r=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(r&&!o.isNode(e))throw Error("The parent node is not a valid HTML Node!");let i=e.querySelectorAll(t);if(0===i.length&&(i=!1),r&&!1===i)throw Error('At least one item of "'.concat(t,'" must exist in parent node!'));return i}static getFocusableElements(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document.body;return e.querySelectorAll('\n            input:not([tabindex^="-"]):not([disabled]):not([type="hidden"]),\n            select:not([tabindex^="-"]):not([disabled]),\n            textarea:not([tabindex^="-"]):not([disabled]),\n            button:not([tabindex^="-"]):not([disabled]),\n            a[href]:not([tabindex^="-"]):not([disabled]),\n            [tabindex]:not([tabindex^="-"]):not([disabled])\n        ')}static getFirstFocusableElement(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document.body;return this.getFocusableElements(e)[0]}static getLastFocusableElement(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,t=this.getFocusableElements(e);return t[t.length-1]}}},140:(e,t,r)=>{r.d(t,{Z:()=>i});class i{static ucFirst(e){return e.charAt(0).toUpperCase()+e.slice(1)}static lcFirst(e){return e.charAt(0).toLowerCase()+e.slice(1)}static toDashCase(e){return e.replace(/([A-Z])/g,"-$1").replace(/^-/,"").toLowerCase()}static toLowerCamelCase(e,t){let r=i.toUpperCamelCase(e,t);return i.lcFirst(r)}static toUpperCamelCase(e,t){return t?e.split(t).map(e=>i.ucFirst(e.toLowerCase())).join(""):i.ucFirst(e.toLowerCase())}static parsePrimitive(e){try{return/^\d+(.|,)\d+$/.test(e)&&(e=e.replace(",",".")),JSON.parse(e)}catch(t){return e.toString()}}}}},t={};function r(i){var o=t[i];if(void 0!==o)return o.exports;var n=t[i]={exports:{}};return e[i].call(n.exports,n,n.exports,r),n.exports}r.m=e,(()=>{r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t}})(),(()=>{r.d=(e,t)=>{for(var i in t)r.o(t,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})}})(),(()=>{r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce((t,i)=>(r.f[i](e,t),t),[]))})(),(()=>{r.u=e=>"./js/tmms-cms-element-period-request-form/"+e+".js"})(),(()=>{r.miniCssF=e=>{}})(),(()=>{r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}()})(),(()=>{r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{var e={};r.l=(t,i,o,n)=>{if(e[t]){e[t].push(i);return}if(void 0!==o)for(var s,a,d=document.getElementsByTagName("script"),l=0;l<d.length;l++){var u=d[l];if(u.getAttribute("src")==t){s=u;break}}s||(a=!0,(s=document.createElement("script")).charset="utf-8",s.timeout=120,r.nc&&s.setAttribute("nonce",r.nc),s.src=t),e[t]=[i];var c=(r,i)=>{s.onerror=s.onload=null,clearTimeout(p);var o=e[t];if(delete e[t],s.parentNode&&s.parentNode.removeChild(s),o&&o.forEach(e=>e(i)),r)return r(i)},p=setTimeout(c.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=c.bind(null,s.onerror),s.onload=c.bind(null,s.onload),a&&document.head.appendChild(s)}})(),(()=>{r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}})(),(()=>{r.g.importScripts&&(e=r.g.location+"");var e,t=r.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var i=t.getElementsByTagName("script");if(i.length)for(var o=i.length-1;o>-1&&!e;)e=i[o--].src}if(!e)throw Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),r.p=e+"../../"})(),(()=>{var e={"tmms-cms-element-period-request-form":0};r.f.j=(t,i)=>{var o=r.o(e,t)?e[t]:void 0;if(0!==o){if(o)i.push(o[2]);else{var n=new Promise((r,i)=>o=e[t]=[r,i]);i.push(o[2]=n);var s=r.p+r.u(t),a=Error();r.l(s,i=>{if(r.o(e,t)&&(0!==(o=e[t])&&(e[t]=void 0),o)){var n=i&&("load"===i.type?"missing":i.type),s=i&&i.target&&i.target.src;a.message="Loading chunk "+t+" failed.\n("+n+": "+s+")",a.name="ChunkLoadError",a.type=n,a.request=s,o[1](a)}},"chunk-"+t,t)}}};var t=(t,i)=>{var o,n,[s,a,d]=i,l=0;if(s.some(t=>0!==e[t])){for(o in a)r.o(a,o)&&(r.m[o]=a[o]);d&&d(r)}for(t&&t(i);l<s.length;l++)n=s[l],r.o(e,n)&&e[n]&&e[n][0](),e[n]=0},i=self.webpackChunk=self.webpackChunk||[];i.forEach(t.bind(null,0)),i.push=t.bind(null,i.push.bind(i))})(),(()=>{class e extends window.PluginBaseClass{init(){this.$emitter.publish("beforeSavePeriodRequestFormInit"),this._registerEvents(),this.$emitter.publish("afterSavePeriodRequestFormInit")}_registerEvents(){var e;let t,r,i;t=(e=this.el.closest("form")).getAttribute("data-form-element-id"),r=e.getAttribute("data-input-max-length"),i=e.getAttribute("data-textarea-max-length"),document.querySelectorAll("#period-request-form-"+t+" input, #period-request-form-"+t+" textarea").forEach(function(e){"hidden"!==e.getAttribute("type")&&"checkbox"!==e.getAttribute("type")&&"submit"!==e.getAttribute("type")&&"shopware_surname_confirm"!==e.getAttribute("name")&&"date"!==e.getAttribute("name")&&"_grecaptcha_v3"!==e.getAttribute("name")&&("TEXTAREA"===e.tagName?e.setAttribute("maxlength",i):e.setAttribute("maxlength",r))})}}var t=r(49);class i{get(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"application/json",i=this._createPreparedRequest("GET",e,r);return this._sendRequest(i,null,t)}post(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"application/json";i=this._getContentType(t,i);let o=this._createPreparedRequest("POST",e,i);return this._sendRequest(o,t,r)}delete(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"application/json";i=this._getContentType(t,i);let o=this._createPreparedRequest("DELETE",e,i);return this._sendRequest(o,t,r)}patch(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"application/json";i=this._getContentType(t,i);let o=this._createPreparedRequest("PATCH",e,i);return this._sendRequest(o,t,r)}abort(){if(this._request)return this._request.abort()}setErrorHandlingInternal(e){this._errorHandlingInternal=e}_registerOnLoaded(e,t){t&&(!0===this._errorHandlingInternal?(e.addEventListener("load",()=>{t(e.responseText,e)}),e.addEventListener("abort",()=>{console.warn("the request to ".concat(e.responseURL," was aborted"))}),e.addEventListener("error",()=>{console.warn("the request to ".concat(e.responseURL," failed with status ").concat(e.status))}),e.addEventListener("timeout",()=>{console.warn("the request to ".concat(e.responseURL," timed out"))})):e.addEventListener("loadend",()=>{t(e.responseText,e)}))}_sendRequest(e,t,r){return this._registerOnLoaded(e,r),e.send(t),e}_getContentType(e,t){return e instanceof FormData&&(t=!1),t}_createPreparedRequest(e,t,r){return this._request=new XMLHttpRequest,this._request.open(e,t),this._request.setRequestHeader("X-Requested-With","XMLHttpRequest"),r&&this._request.setRequestHeader("Content-type",r),this._request}constructor(){this._request=null,this._errorHandlingInternal=!1}}class o extends window.PluginBaseClass{init(){this.$emitter.publish("beforeGetDisabledDatesInit"),this._registerEvents(),this.$emitter.publish("afterGetDisabledDatesInit")}_registerEvents(){this._client=new i,this.fetch(),this.$emitter.publish("afterGetDisabledDatesRegisterEvents")}fetch(){this._client.get("".concat(this.options.dataurl,"?placeholder=").concat(this.options.placeholder,"&origin=").concat(this.options.origin,"&originid=").concat(this.options.originid,"&dateisrequired=").concat(this.options.dateisrequired,"&defaultdatevalue=").concat(this.options.defaultdatevalue,"&mindatevalue=").concat(this.options.mindatevalue,"&maxdatevalue=").concat(this.options.maxdatevalue,"&inputdisableddates=").concat(this.options.inputdisableddates,"&dateformat=").concat(this.options.dateformat,"&showweeksnumbers=").concat(this.options.showweeksnumbers,"&locale=").concat(this.options.locale,"&showperiodselection=").concat(this.options.showperiodselection,"&showcalendarpermanentlyopen=").concat(this.options.showcalendarpermanentlyopen,"&showselectfieldformonth=").concat(this.options.showselectfieldformonth,"&showtwomonthssidebyside=").concat(this.options.showtwomonthssidebyside,"&formelementid=").concat(this.options.formelementid),e=>{let i=t.Z.querySelector(document,"#period-request-form-"+this.options.formelementid+' input[name="date"]');i.setAttribute("data-date-picker-periodrequestform",!0),i.setAttribute("data-date-picker-options",e.trim().replace(/&quot;/g,'"')),window.PluginManager.register("DatePicker",()=>r.e("plugin_date-picker_date-picker_plugin_js").then(r.bind(r,78)),"[data-date-picker-periodrequestform]"),window.PluginManager.initializePlugin("DatePicker","[data-date-picker-periodrequestform]"),this.$emitter.publish("afterGetDisabledDatesFetch")})}destroy(){this.el.lastChild.remove()}}o.options={dataurl:"/periodrequestform/getdisableddates",placeholder:"",origin:"Kategorie",originid:0,dateisrequired:0,defaultdatevalue:"",mindatevalue:"",maxdatevalue:"",inputdisableddates:"",dateformat:"d.m.Y",showweeksnumbers:1,locale:"de-DE",showperiodselection:1,showcalendarpermanentlyopen:0,showselectfieldformonth:1,showtwomonthssidebyside:0,formelementid:0};class n extends window.PluginBaseClass{init(){this.$emitter.publish("beforeSetHiddenFieldsForPeriodRequestFormInModalInit"),this._registerEvents(),this.$emitter.publish("afterSetHiddenFieldsForPeriodRequestFormInModalInit")}_registerEvents(){if(document.querySelector(".period-request-form-modal-btn")){let e=t.Z.querySelector(document,".period-request-form-modal-btn");window.PluginManager.getPluginInstanceFromElement(e,"AjaxModal").$emitter.subscribe("ajaxModalOpen",()=>{this.$emitter.publish("beforeSetHiddenFieldsForPeriodRequestFormInModalAjaxModalOpen");let r=e.dataset.formElementId,i=t.Z.querySelector(document,(r?".cms-element-period-request-form #period-request-form-card-body-"+r:".cms-element-period-request-form")+" .form-hidden-fields"),o=document.createElement("input"),n=document.createElement("input"),s=document.createElement("input");o.setAttribute("type","hidden"),o.setAttribute("name","origin"),o.setAttribute("value",e.dataset.origin),n.setAttribute("type","hidden"),n.setAttribute("name","originId"),n.setAttribute("value",e.dataset.originId),s.setAttribute("type","hidden"),s.setAttribute("name","originName"),s.setAttribute("value",e.dataset.originName),i.appendChild(o),i.appendChild(n),i.appendChild(s),this.$emitter.publish("afterSetHiddenFieldsForPeriodRequestFormInModalAjaxModalOpen")})}}}let s=window.PluginManager;s.register("SavePeriodRequestFormPlugin",e,'[data-save-period-request-form="true"]'),s.register("GetDisabledDates",o,'[data-get-disabled-dates="true"]'),s.register("SetHiddenFieldsForPeriodRequestFormInModalPlugin",n,".period-request-form-modal-btn")})()})();