"use strict";(self.webpackChunkwebpackcloud=self.webpackChunkwebpackcloud||[]).push([[591],{62941:(e,r,t)=>{t.r(r),t.d(r,{runEndPageScript:()=>m});t(41539),t(54747),t(74916),t(23123),t(21249),t(69720),t(57327),t(92222),t(82526),t(41817),t(32165),t(66992),t(78783),t(33948),t(47042),t(68309),t(91038);var n=t(22398),a=t(66157),o=t(81311),i=t(1703),u=t(80821),l=t(33488);function c(e){return function(e){if(Array.isArray(e))return p(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||s(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==t)return;var n,a,o=[],i=!0,u=!1;try{for(t=t.call(e);!(i=(n=t.next()).done)&&(o.push(n.value),!r||o.length!==r);i=!0);}catch(e){u=!0,a=e}finally{try{i||null==t.return||t.return()}finally{if(u)throw a}}return o}(e,r)||s(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,r){if(e){if("string"==typeof e)return p(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?p(e,r):void 0}}function p(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function d(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function m(e){n.Z.afterCreateAllForms.isStopped?y.script(e):n.Z.afterCreateAllForms.subscribe((function(){return y.script(e)}))}var y=function(){function e(){!function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}(this,e)}var r,t,s;return r=e,s=[{key:"script",value:function(r){var t=r.scope,n=r.isMultiColumn,o=r.hasModules;e.handleParams(t),e.createReturnUrlParam(t),e.handleRequiredFields(t),e.handleClickSubmit(o),(0,a.T0)(n,!0)}},{key:"handleFiltros",value:function(e){var r=e.Filtros,t=e.Class;r&&n.Z.loadCadastro({_ACadastro:t,_AFiltros:r})}},{key:"handleParams",value:function(e){var r=e.Params;r&&(0,i.Q1)(r)}},{key:"createReturnUrlParam",value:function(e){var r=e.RedirectURL,t=e.RedirectParams,a=e.VerificaSelecao;if(r){var o=n.Z.byname("TnDMSelecao");if(!o)return;var i=$('<input type="hidden" name="p.REDIRECTPARAMS">');i.val(JSON.stringify(t)),o.element.append($('<input type="hidden" name="p.REDIRECTURL" value="'.concat(r,'">'))).append($('<input type="hidden" name="p.VERIFICASELECAO" value="'.concat(a,'">'))).append(i)}}},{key:"handleRequiredFields",value:function(e){var r=e.VerificaSelecao;if(r){var t=n.Z.byname("TnDMSelecao");if(!t)return;r.split(";").forEach((function(e){t.setrequired(e.toUpperCase(),!0)}))}}},{key:"handleClickSubmit",value:function(r){$("#btnDefaultSubmit").on("click",(function(t){var n=$(t.currentTarget.form).data("q-form");o.n.ValidarCamposObrigatorios(n)?((0,u.B)(void 0,r),KTApp.blockPage(),e.submitForm(n)):t.preventDefault()}))}},{key:"submitForm",value:function(e){var r=Object.entries(e.getValues()).map((function(e){var r=f(e,2),t=r[0],n=r[1];return["p.".concat(t),n]})),t=["p.REDIRECTPARAMS","p.REDIRECTURL","p.VERIFICASELECAO"].map((function(r){var t=$('[name="'.concat(r,'"]'),e.element);if(t.length)return[r,t.val()]})),n=new l.tC(e.element.attr("action"));[].concat(c(r),c(t)).filter((function(e){return e})).forEach((function(e){var r=f(e,2),t=r[0],a=r[1];return n.addParam(t,a)})),n.submit(),n.remove()}}],(t=null)&&d(r.prototype,t),s&&d(r,s),Object.defineProperty(r,"prototype",{writable:!1}),e}()}}]);