!function(e){function a(a){for(var n,o,s=a[0],l=a[1],d=a[2],c=0,f=[];c':"';return this.isValueOnly()?e+='\n
\n \n '+a+"\n ":e+='\n
\n \n \n '+a+"\n ",e+='\n \n \n
'}}]),e}(),u=function(){function e(){var a=this;s(this,e),l.on("input",'[data-grav-array-type="key"], [data-grav-array-type="value"]',function(e){return a.actionInput(e)}),l.on("click touch",'[data-grav-array-action]:not([data-grav-array-action="sort"])',function(e){return a.actionEvent(e)}),this.arrays=(0,r.default)(),(0,r.default)('[data-grav-field="array"]').each(function(e,t){return a.addArray(t)}),(0,r.default)("body").on("mutation._grav",this._onAddedNodes.bind(this))}return n(e,[{key:"addArray",value:function(e){(e=(0,r.default)(e)).find('[data-grav-array-type="container"]').each(function(e,a){(a=(0,r.default)(a)).data("array-sort")||a[0].hasAttribute("data-array-nosort")||a.data("array-sort",new i.default(a.get(0),{handle:".fa-bars",animation:150}))})}},{key:"actionInput",value:function(e){var a=(0,r.default)(e.target),t=a.data("grav-array-type");this._setTemplate(a);var n=a.data("array-template"),i="key"===t?a:a.siblings('[data-grav-array-type="key"]:first'),o="value"===t?a:a.siblings('[data-grav-array-type="value"]:first'),s=n.isValueOnly()?this.getIndexFor(a):i.val();s=s.toString().replace(/\[/g,"%5B").replace(/]/g,"%5D");var l=n.getName()+"["+s+"]";o.attr("name",o.val()?l:n.getName()),this.refreshNames(n)}},{key:"actionEvent",value:function(e){e&&e.preventDefault();var a=(0,r.default)(e.target),t=a.data("grav-array-action"),n=a.parents('[data-grav-array-type="container"]');this._setTemplate(a),this[t+"Action"](a),n[n.find("> div").length>1?"removeClass":"addClass"]("one-child")}},{key:"addAction",value:function(e){var a=e.data("array-template");e.closest('[data-grav-array-type="row"]').after(a.getNewRow())}},{key:"remAction",value:function(e){var a=e.data("array-template"),t=e.closest('[data-grav-array-type="row"]');if(!t.siblings().length){var n=(0,r.default)(a.getNewRow());t.after(n),n.find('[data-grav-array-type="value"]:last').attr("name",a.getName())}t.remove(),this.refreshNames(a)}},{key:"refreshNames",value:function(e){if(e.isValueOnly()){var a=e.container.find('> div > [data-grav-array-type="row"]'),t=a.find('[name]:not([name=""])');t.each(function(e,a){var t=(a=(0,r.default)(a)).attr("name");t=t.replace(/\[\d+\]$/,"["+e+"]"),a.attr("name",t)}),t.length||a.find('[data-grav-array-type="value"]').attr("name",e.getName())}}},{key:"getIndexFor",value:function(e){var a=e.data("array-template"),t=e.closest('[data-grav-array-type="row"]');return a.container.find((a.isValueOnly()?"> div ":"")+' > [data-grav-array-type="row"]').index(t)}},{key:"_setTemplate",value:function(e){e.data("array-template")||e.data("array-template",new d(e.closest("[data-grav-array-name]")))}},{key:"_onAddedNodes",value:function(e,a){var t=this,n=(0,r.default)(a).find('[data-grav-field="array"]');n.length&&n.each(function(e,a){a=(0,r.default)(a),~t.arrays.index(a)||t.addArray(a)})}}]),e}();a.default=u;a.Instance=new u},"./app/fields/file.js": /*!****************************!*\ !*** ./app/fields/file.js ***! \****************************/ /*! no static exports found */function(e,a,t){"use strict";(function(e){Object.defineProperty(a,"__esModule",{value:!0}),a.Instances=void 0;var n=function(){function e(e,a){for(var t=0;t0&&void 0!==arguments[0]?arguments[0]:{},t=e.container,n=void 0===t?".dropzone.files-upload":t,o=e.options,l=void 0===o?{}:o;!function(e,a){if(!(e instanceof a))throw new TypeError("Cannot call a class as a function")}(this,a),this.container=(0,r.default)(n),this.container.length&&(this.urls={},u.previewTemplate=(0,r.default)("#dropzone-template").html(),this.options=Object.assign({},d,u,{klass:this,url:this.container.data("file-url-add")||s.config.current_url,acceptedFiles:this.container.data("media-types"),init:this.initDropzone},this.container.data("dropzone-options"),l),this.dropzone=new i.default(n,this.options),this.dropzone.on("complete",this.onDropzoneComplete.bind(this)),this.dropzone.on("success",this.onDropzoneSuccess.bind(this)),this.dropzone.on("removedfile",this.onDropzoneRemovedFile.bind(this)),this.dropzone.on("sending",this.onDropzoneSending.bind(this)),this.dropzone.on("error",this.onDropzoneError.bind(this)))}return n(a,[{key:"initDropzone",value:function(){var e=this,a=this.options.klass.container.find("[data-file]"),t=this;a.length&&a.each(function(a,n){var o=(n=(0,r.default)(n)).data("file"),s={name:o.name,size:o.size,type:o.type,status:i.default.ADDED,accepted:!0,url:e.options.url,removeUrl:o.remove};t.files.push(s),t.options.addedfile.call(t,s),s.type.match(/^image\//)&&t.options.thumbnail.call(t,s,o.path),n.remove()})}},{key:"getURI",value:function(){return this.container.data("mediaUri")||""}},{key:"onDropzoneSending",value:function(e,a,t){t.append("__form-name__",this.container.closest("form").find('[name="__form-name__"]').val()),t.append("__form-file-uploader__",1),t.append("name",this.options.dotNotation),t.append("form-nonce",s.config.form_nonce),t.append("task","filesupload"),t.append("uri",this.getURI())}},{key:"onDropzoneSuccess",value:function(a,t,n){if(this.options.reloadPage&&e.location.reload(),t.session){a.sessionParams=t.session,a.removeUrl=this.options.url;var r=this.container.find('[name][type="hidden"]'),i=r.val();r.val(i+" ")}return this.handleError({file:a,data:t,mode:"removeFile",msg:"

"+s.translations.PLUGIN_FORM.FILE_ERROR_UPLOAD+" "+a.name+"

\n
"+t.message+"
"})}},{key:"onDropzoneComplete",value:function(a){if(!a.accepted&&!a.rejected){var t={status:"error",message:s.translations.PLUGIN_FORM.FILE_UNSUPPORTED+": "+a.name.match(/\..+/).join("")};return this.handleError({file:a,data:t,mode:"removeFile",msg:"

"+s.translations.PLUGIN_FORM.FILE_ERROR_ADD+" "+a.name+"

\n
"+t.message+"
"})}this.options.reloadPage&&e.location.reload()}},{key:"onDropzoneRemovedFile",value:function(a){var t=this;if(a.accepted&&!a.rejected){var n=a.removeUrl||this.urls.delete||location.href+".json",i=(n||"").match(/path:(.*)\//),o=new FormData;o.append("filename",a.name),o.append("__form-name__",this.container.closest("form").find('[name="__form-name__"]').val()),o.append("name",this.options.dotNotation),o.append("form-nonce",s.config.form_nonce),o.append("uri",this.getURI()),a.sessionParams&&(o.append("__form-file-remover__","1"),o.append("session",a.sessionParams)),r.default.ajax({url:n,data:o,method:"POST",contentType:!1,processData:!1,success:function(){if(i){i=e.atob(i[1]);var a=t.container.find('[name][type="hidden"]'),n=JSON.parse(a.val()||"{}");delete n[i],a.val(JSON.stringify(n))}}})}}},{key:"onDropzoneError",value:function(e,a,t){var n=t&&a.error?a.error.message:a;return(0,r.default)(e.previewElement).find("[data-dz-errormessage]").html(n),this.handleError({file:e,data:{status:"error"},msg:"
"+n+"
"})}},{key:"handleError",value:function(e){return!0}}]),a}();a.default=c;var f=[],p=(0,r.default)(),v=function(e,a){var t=(0,r.default)(a).find(".dropzone.files-upload");t.length&&t.each(function(e,a){a=(0,r.default)(a),~p.index(a)||m(a)})},m=function(e){var a=(e=(0,r.default)(e)).find('input[type="file"]'),t=e.data("grav-file-settings")||{};t.accept&&~t.accept.indexOf("*")&&(t.accept=[""]);var n={url:e.data("file-url-add")||(e.closest("form").attr("action")||s.config.current_url)+".json",paramName:t.paramName||"file",dotNotation:t.name||"file",acceptedFiles:t.accept?t.accept.join(","):a.attr("accept")||e.data("media-types"),maxFilesize:t.filesize||256,maxFiles:t.limit||null,resizeWidth:t.resizeWidth||null,resizeHeight:t.resizeHeight||null,resizeQuality:t.resizeQuality||null,accept:function(e,a){var n=t.resolution;if(!n)return a();setTimeout(function(){var r="";return n.min&&Object.keys(n.min).forEach(function(a){e[a]n.max[a]&&(r+=s.translations.PLUGIN_FORM.RESOLUTION_MAX.replace(/{{attr}}/g,a).replace(/{{max}}/g,n.max[a]))}),a(r)},50)}};p=p.add(e),e=e[0],f.push(new c({container:e,options:n}))};a.Instances=((0,r.default)(document).ready(function(){(0,r.default)(".dropzone.files-upload").each(function(e,a){return m(a)}),(0,r.default)("body").on("mutation._grav",v)}),f)}).call(this,t(/*! ./../../node_modules/webpack/buildin/global.js */"./node_modules/webpack/buildin/global.js"))},"./app/fields/index.js": /*!*****************************!*\ !*** ./app/fields/index.js ***! \*****************************/ /*! no static exports found */function(e,a,t){"use strict";Object.defineProperty(a,"__esModule",{value:!0});var n=i(t(/*! ./file */"./app/fields/file.js")),r=i(t(/*! ./array */"./app/fields/array.js"));function i(e){return e&&e.__esModule?e:{default:e}}a.default={FileInstances:n.default,ArrayInstances:r.default}},"./app/main.js": /*!*********************!*\ !*** ./app/main.js ***! \*********************/ /*! no static exports found */function(e,a,t){"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.Instances=void 0;var n,r=t(/*! ./fields */"./app/fields/index.js"),i=(n=r)&&n.__esModule?n:{default:n};t(/*! ./utils/keep-alive */"./app/utils/keep-alive.js"),a.Instances=i.default},"./app/utils/keep-alive.js": /*!*********************************!*\ !*** ./app/utils/keep-alive.js ***! \*********************************/ /*! no static exports found */function(e,a,t){"use strict";var n,r=t(/*! jquery */"jquery"),i=(n=r)&&n.__esModule?n:{default:n},o=t(/*! grav-form */"grav-form");(0,i.default)(document).ready(function(){if((0,i.default)("[data-grav-keepalive]").length){var e=o.config.session_timeout/1.5*1e3;setInterval(function(){i.default.ajax({url:o.config.base_url_relative+"/task"+o.config.param_sep+"keep-alive"})},e)}})},"grav-form": /*!***************************!*\ !*** external "GravForm" ***! \***************************/ /*! no static exports found */function(e,a){e.exports=GravForm},jquery: /*!*************************!*\ !*** external "jQuery" ***! \*************************/ /*! no static exports found */function(e,a){e.exports=jQuery}});