(()=>{"use strict";var e,t={5351:function(e,t,o){var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};t.__esModule=!0;var n=a(o(5311)),r=o(5781);function l(e){(0,n.default)("form.document-upload",e.body).on("submit",(function(){var t=new FormData(this);return n.default.ajax({url:this.action,data:t,processData:!1,contentType:!1,type:"POST",dataType:"text",success:e.loadResponseText,error:function(t,o,a){var r=jsonData.error_message+"<br />"+a+" - "+t.status;(0,n.default)("#tab-upload",e.body).append('<div class="help-block help-critical"><strong>'+jsonData.error_label+": </strong>"+r+"</div>")}}),!1}));var t=(0,n.default)("#id_document-chooser-upload-file",e.body);t.on("change",(function(){var o=(0,n.default)("#id_document-chooser-upload-title",e.body);if(""===o.val()){var a=t.val().split("\\"),r=a[a.length-1],l=parseInt(o.attr("maxLength")||"0",10)||null,i={title:r.replace(/\.[^.]+$/,"")};if(!t.closest("form").get(0).dispatchEvent(new CustomEvent("wagtail:documents-upload",{bubbles:!0,cancelable:!0,detail:{data:i,filename:r,maxTitleLength:l}})))return;o.val(i.title)}}))}window.DOCUMENT_CHOOSER_MODAL_ONLOAD_HANDLERS={chooser:function(e,t){function o(t){(0,n.default)("a.document-choice",t).on("click",(function(){return e.loadUrl(this.href),!1})),(0,n.default)(".pagination a",t).on("click",(function(){return d(this.href),!1})),(0,n.default)("a.upload-one-now").on("click",(function(e){var t=(0,n.default)("#collection_chooser_collection_id").val();t&&(0,n.default)("#id_document-chooser-upload-collection").val(t),e.preventDefault()})),(0,r.initTabs)()}var a,i=(0,n.default)("form.document-search",e.body),u=i.attr("action");function c(){return d(u,i.serialize()),!1}function d(e,t){var r={url:e,success:function(e,t){a=null,(0,n.default)("#search-results").html(e),o((0,n.default)("#search-results"))},error:function(){a=null}};t&&(r.data=t),a=n.default.ajax(r)}o(e.body),l(e),(0,n.default)("form.document-search",e.body).on("submit",c),(0,n.default)("#id_q").on("input",(function(){a&&a.abort(),clearTimeout(n.default.data(this,"timer"));var e=setTimeout(c,50);(0,n.default)(this).data("timer",e)})),(0,n.default)("#collection_chooser_collection_id").on("change",c)},document_chosen:function(e,t){e.respond("documentChosen",t.result),e.close()},reshow_upload_form:function(e,t){(0,n.default)("#tab-upload",e.body).replaceWith(t.htmlFragment),(0,r.initTabs)(),l(e)}}},5311:e=>{e.exports=jQuery}},o={};function a(e){var n=o[e];if(void 0!==n)return n.exports;var r=o[e]={exports:{}};return t[e].call(r.exports,r,r.exports,a),r.exports}a.m=t,e=[],a.O=(t,o,n,r)=>{if(!o){var l=1/0;for(d=0;d<e.length;d++){for(var[o,n,r]=e[d],i=!0,u=0;u<o.length;u++)(!1&r||l>=r)&&Object.keys(a.O).every((e=>a.O[e](o[u])))?o.splice(u--,1):(i=!1,r<l&&(l=r));if(i){e.splice(d--,1);var c=n();void 0!==c&&(t=c)}}return t}r=r||0;for(var d=e.length;d>0&&e[d-1][2]>r;d--)e[d]=e[d-1];e[d]=[o,n,r]},a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var o in t)a.o(t,o)&&!a.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.j=7882,(()=>{var e={7882:0};a.O.j=t=>0===e[t];var t=(t,o)=>{var n,r,[l,i,u]=o,c=0;if(l.some((t=>0!==e[t]))){for(n in i)a.o(i,n)&&(a.m[n]=i[n]);if(u)var d=u(a)}for(t&&t(o);c<l.length;c++)r=l[c],a.o(e,r)&&e[r]&&e[r][0](),e[r]=0;return a.O(d)},o=globalThis.webpackChunkwagtail=globalThis.webpackChunkwagtail||[];o.forEach(t.bind(null,0)),o.push=t.bind(null,o.push.bind(o))})();var n=a.O(void 0,[2751],(()=>a(5351)));n=a.O(n)})();