uikit/dist/js/vdm.min.js
Llewellyn van der Merwe 78271fea45
refactor: Rename and enhance UikitUploader, refactor URL building, and update package
- Renamed 'UikitUploader' to 'UploadFile' for improved clarity and updated related imports.
- Refactored methods to handle null element cases and enhanced notification system, improving code readability and functionality.
- Renamed 'UploadHelper' to 'FileType' to better reflect its purpose.
- Simplified URL building by utilizing class properties directly and reducing parameters.
- Updated package details, bumped version to 3.0.0, and modified the main entry point.
- Renamed 'Uploader' to 'vdm-uikit' across the project documentation for consistency.
- Enhanced rollup config by updating references from Uploader to VDMUikit, including file names, banner text, and global objects.
- Added support for delete endpoint in configuration and updated script source URLs to use the unified 'vdm.min.js'.
- Renamed 'Uploader.js' to 'vdm.js', updated import statements to reflect new modules 'UploadFile' and 'DeleteFile'.
- Implemented initialization and error handling for 'delete_file' in the VDM namespace.
- Removed obsolete 'Uploader.js' and 'Uploader.min.js' files from distribution.
2024-09-14 17:50:43 +02:00

3 lines
20 KiB
JavaScript

/*! VDM Uikit v3.0.0 | https://git.vdm.dev/joomla/uikit | (c) 2020 - 2024 Llewellyn van der Merwe | MIT License */
!function(){"use strict";function t(t,e,n){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}function e(t,e,n,r,i,o,a){try{var c=t[o](a),l=c.value}catch(t){return void n(t)}c.done?e(l):Promise.resolve(l).then(r,i)}function n(t){return function(){var n=this,r=arguments;return new Promise((function(i,o){var a=t.apply(n,r);function c(t){e(a,i,o,c,l,"next",t)}function l(t){e(a,i,o,c,l,"throw",t)}c(void 0)}))}}function r(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(e,n){return e.get(t(e,n))}function a(t,e,n){r(t,e),e.set(t,n)}function c(e,n,r){return e.set(t(e,n),r),r}function l(t,e){r(t,e),e.add(t)}function u(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,v(r.key),r)}}function s(t,e,n){return e&&u(t.prototype,e),n&&u(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function f(t,e,n){return(e=v(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function h(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function d(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?h(Object(n),!0).forEach((function(e){f(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):h(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function p(){p=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var o=e&&e.prototype instanceof g?e:g,a=Object.create(o.prototype),c=new P(r||[]);return i(a,"_invoke",{value:L(t,n,c)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var h="suspendedStart",d="suspendedYield",v="executing",y="completed",m={};function g(){}function b(){}function w(){}var E={};u(E,a,(function(){return this}));var k=Object.getPrototypeOf,x=k&&k(k(T([])));x&&x!==n&&r.call(x,a)&&(E=x);var I=w.prototype=g.prototype=Object.create(E);function O(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function j(t,e){function n(i,o,a,c){var l=f(t[i],t,o);if("throw"!==l.type){var u=l.arg,s=u.value;return s&&"object"==typeof s&&r.call(s,"__await")?e.resolve(s.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):e.resolve(s).then((function(t){u.value=t,a(u)}),(function(t){return n("throw",t,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(t,r){function i(){return new e((function(e,i){n(t,r,e,i)}))}return o=o?o.then(i,i):i()}})}function L(e,n,r){var i=h;return function(o,a){if(i===v)throw Error("Generator is already running");if(i===y){if("throw"===o)throw a;return{value:t,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=M(c,r);if(l){if(l===m)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===h)throw i=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=v;var u=f(e,n,r);if("normal"===u.type){if(i=r.done?y:d,u.arg===m)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(i=y,r.method="throw",r.arg=u.arg)}}}function M(e,n){var r=n.method,i=e.iterator[r];if(i===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,M(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),m;var o=f(i,e.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,m;var a=o.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,m):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function T(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return o.next=o}}throw new TypeError(typeof e+" is not iterable")}return b.prototype=w,i(I,"constructor",{value:w,configurable:!0}),i(w,"constructor",{value:b,configurable:!0}),b.displayName=u(w,l,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===b||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,u(t,l,"GeneratorFunction")),t.prototype=Object.create(I),t},e.awrap=function(t){return{__await:t}},O(j.prototype),u(j.prototype,c,(function(){return this})),e.AsyncIterator=j,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var a=new j(s(t,n,r,i),o);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(I),u(I,l,"Generator"),u(I,a,(function(){return this})),u(I,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=T,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(_),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(r,i){return c.type="throw",c.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),u=r.call(a,"finallyLoc");if(l&&u){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;_(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:T(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),m}},e}function v(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}function y(t){return y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},y(t)}var m=new WeakMap,g=new WeakMap,b=new WeakMap,w=new WeakMap,E=s((function t(e){var r=this;i(this,t),a(this,m,void 0),a(this,g,{}),f(this,"set",(function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;o(g,r)[t]=o(g,r)[t]||{},"object"===y(e)?Object.assign(o(g,r)[t],e):o(g,r)[t][e]=n})),f(this,"get",(function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=o(g,r)[t];return a?null===n?a:null!==(e=a[n])&&void 0!==e?e:i:i})),f(this,"init",function(){var t=n(p().mark((function t(e,n){var i,a,c,l=arguments;return p().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i=l.length>2&&void 0!==l[2]&&l[2],!o(g,r)[e]||i){t.next=4;break}return t.abrupt("return");case 4:return t.prev=4,a=o(w,r).call(r,n),t.next=8,o(b,r).call(r,a);case 8:if(null==(c=t.sent)||!c.data||"object"!==y(c.data)){t.next=14;break}r.set(e,c.data),t.next=16;break;case 14:if(null==c||!c.error){t.next=16;break}throw new Error(c.error||"An error occurred during the file type request.");case 16:t.next=21;break;case 18:t.prev=18,t.t0=t.catch(4);case 21:case"end":return t.stop()}}),t,null,[[4,18]])})));return function(e,n){return t.apply(this,arguments)}}()),a(this,b,function(){var t=n(p().mark((function t(e){var n;return p().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch(e,{method:"GET",headers:{"Content-Type":"application/json"}});case 2:if((n=t.sent).ok){t.next=6;break}return t.abrupt("return");case 6:return t.next=8,n.json();case 8:return t.abrupt("return",t.sent);case 9:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),f(this,"getParams",(function(t){var e={};return Array.isArray(t)&&0!==t.length?(t.forEach((function(t){var n=document.getElementById(t);n&&(e[t]=n.value)})),e):e})),a(this,w,(function(t){var e=o(m,r).includes("?")?"&":"?";return"".concat(o(m,r)).concat(e,"guid=").concat(t)})),c(m,this,e)})),k=new WeakSet,x=new WeakMap,I=s((function e(){var r=this;i(this,e),l(this,k),f(this,"set",function(){var e=n(p().mark((function e(n,i,a){var c,l,u;return p().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,t(k,r,O).call(r,"beforeGetFilesDisplay",{endpoint:n,element:i,params:a}),c=o(x,r).call(r,n,a),e.next=5,fetch(c,{method:"GET",headers:{"Content-Type":"application/json"}});case 5:if((l=e.sent).ok){e.next=9;break}return e.abrupt("return");case 9:return e.next=11,l.json();case 11:if(!(u=e.sent).error){e.next=15;break}return e.abrupt("return");case 15:u.data&&""!==u.data.trim()?(t(k,r,O).call(r,"beforeFilesDisplay",{result:u,element:i}),i.innerHTML=u.data,i.removeAttribute("hidden"),t(k,r,O).call(r,"afterFilesDisplay",{result:u,element:i})):(t(k,r,O).call(r,"beforeHideFilesDisplay",{result:u,element:i}),i.innerHTML="",i.setAttribute("hidden","hidden"),t(k,r,O).call(r,"afterHideFilesDisplay",{result:u,element:i})),e.next=21;break;case 18:e.prev=18,e.t0=e.catch(0);case 21:case"end":return e.stop()}}),e,null,[[0,18]])})));return function(t,n,r){return e.apply(this,arguments)}}()),a(this,x,(function(t,e){if(!e||0===Object.keys(e).length)return t;var n=t.includes("?")?"&":"?",r=new URLSearchParams(e);return"".concat(t).concat(n).concat(r.toString())}))}));function O(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};document.dispatchEvent(new CustomEvent("vdm.uikit.display.".concat(t),{detail:e}))}var j=new WeakMap,L=new WeakMap,M=new WeakMap,S=new WeakSet,_=s((function e(n,r,o){i(this,e),l(this,S),a(this,j,void 0),a(this,L,void 0),a(this,M,void 0),c(j,this,new E(r)),c(L,this,new I),c(M,this,o),t(S,this,P).call(this,n)}));function P(e){var n=this;Object.keys(e).forEach((function(r){t(S,n,T).call(n,r,e[r])}))}function T(e,r){var i=this,o=r.bar,a=r.typeId,c=r.endpoint,l=r.successId,u=r.errorId,s=r.allowedFormatId,f=r.fileTypeId,h=r.displayId,d=r.displayEndpoint;t(S,this,B).call(this,d,h);var v=document.getElementById(a);if(v){var y=function(){var r=n(p().mark((function n(r){return p().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!(r&&r.length>1)){n.next=9;break}return n.prev=1,n.next=4,t(S,i,D).call(i,e,r,o,c,l,u,s,f,h,d);case 4:n.next=9;break;case 6:n.prev=6,n.t0=n.catch(1),t(S,i,G).call(i,n.t0.message,"danger");case 9:case"end":return n.stop()}}),n,null,[[1,6]])})));return function(t){return r.apply(this,arguments)}}();v.addEventListener("change",(function(){return y(v.value)})),y(v.value).catch((function(e){return t(S,i,G).call(i,e.message,"danger")}))}else t(S,this,W).call(this,"Type field with ID ".concat(a," not found"))}function D(t,e,n,r,i,o,a,c,l,u){return A.apply(this,arguments)}function A(){return(A=n(p().mark((function e(n,r,i,a,c,l,u,s,f,h){var v,y,m=this;return p().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,t(S,this,C).call(this,"beforeInit",{id:n,typeGuid:r,progressBarId:i,uploadEndpoint:a,successId:c,errorId:l,allowedFormatId:u,fileTypeId:s,displayId:f,displayEndpoint:h}),v="".concat(n).concat(r),e.next=5,o(j,this).init(v,r,!0);case 5:y=t(S,this,F).call(this,i,c,l,u,s,f),t(S,this,C).call(this,"afterElementsInit",d({},y)),t(S,this,V).call(this,y,v,c,l),o(M,this).upload("#".concat(n),{url:t(S,this,N).call(this,a,r),multiple:!0,allow:o(j,this).get(v,"allow",!1),name:o(j,this).get(v,"name","files"),beforeSend:function(e){return t(S,m,U).call(m,v,e)},beforeAll:function(e){return t(S,m,C).call(m,"beforeAll",{files:e})},load:function(e){return t(S,m,C).call(m,"load",{event:e})},error:function(e){return t(S,m,H).call(m,e,y.errorMessage)},complete:function(e){return t(S,m,R).call(m,e,y.successMessage)},loadStart:function(e){return t(S,m,q).call(m,e,y.progressBar)},progress:function(e){return t(S,m,Y).call(m,e,y.progressBar)},loadEnd:function(e){return t(S,m,z).call(m,e,y.progressBar)},completeAll:function(e){return t(S,m,J).call(m,e,y.progressBar,y.successMessage,y.errorMessage,h,f,v)}}),e.next=14;break;case 11:throw e.prev=11,e.t0=e.catch(0),e.t0;case 14:case"end":return e.stop()}}),e,this,[[0,11]])})))).apply(this,arguments)}function F(t,e,n,r,i,o){return{progressBar:t?document.getElementById(t):null,successMessage:e?document.getElementById(e):null,errorMessage:n?document.getElementById(n):null,allowedFormatSpan:r?document.getElementById(r):null,fileTypeSpan:i?document.getElementById(i):null,displayArea:o?document.getElementById(o):null}}function B(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=e?document.getElementById(e):null;t&&r&&o(L,this).set(t,r,n)}function G(t,e){o(M,this).notification({message:t,status:e,pos:"top-center",timeout:7e3})}function W(t){}function C(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};document.dispatchEvent(new CustomEvent("vdm.uikit.uploader.".concat(t),{detail:e}))}function N(t,e){var n=t.includes("?")?"&":"?";return"".concat(t).concat(n,"guid=").concat(e)}function V(t,e,n,r){t.successMessage&&t.successMessage.setAttribute("hidden","hidden"),t.errorMessage&&t.errorMessage.setAttribute("hidden","hidden"),t.allowedFormatSpan&&(t.allowedFormatSpan.innerHTML=o(j,this).get(e,"allow_span","")),t.fileTypeSpan&&(t.fileTypeSpan.innerHTML=o(j,this).get(e,"file_type_span","file"))}function U(e,n){t(S,this,C).call(this,"beforeSend",{environment:n}),n.data.params=o(j,this).getParams(o(j,this).get(e,"param_fields")),t(S,this,C).call(this,"afterSendPreparation",{environment:n})}function H(e,n){t(S,this,C).call(this,"error",{error:e}),n&&(n.removeAttribute("hidden"),n.textContent="Upload failed.")}function R(e,n){t(S,this,C).call(this,"complete",{xhr:e}),n?(n.removeAttribute("hidden"),n.textContent="Upload completed successfully."):t(S,this,G).call(this,"Upload completed successfully.","primary")}function q(e,n){t(S,this,C).call(this,"loadStart",{event:e}),n&&(n.removeAttribute("hidden"),n.max=e.total,n.value=e.loaded)}function Y(e,n){t(S,this,C).call(this,"progress",{event:e}),n&&(n.max=e.total,n.value=e.loaded)}function z(e,n){t(S,this,C).call(this,"loadEnd",{event:e}),n&&(n.max=e.total,n.value=e.loaded)}function J(e,n,r,i,a,c,l){t(S,this,C).call(this,"completeAll",{xhr:e}),n&&setTimeout((function(){n.setAttribute("hidden","hidden"),r&&r.setAttribute("hidden","hidden"),i&&i.setAttribute("hidden","hidden")}),5e3),t(S,this,B).call(this,a,c,o(j,this).getParams(o(j,this).get(l,"display_fields")))}var K=new WeakMap,Q=new WeakMap,X=new WeakSet,Z=function(){return s((function t(e,n){i(this,t),l(this,X),a(this,K,void 0),a(this,Q,void 0),c(K,this,e),c(Q,this,n)}),[{key:"delete",value:function(e){var n=this;!e||e.length<=30||o(Q,this).modal.confirm("Are you sure you want to delete this file! It can not be undone!").then((function(){return t(X,n,$).call(n,e)}))}}])}();function $(e){o(K,this)&&(t(X,this,rt).call(this,"beforeFileDelete",{guid:e}),fetch(t(X,this,it).call(this,e),{method:"GET",headers:{"Content-Type":"application/json"}}).then((function(t){return t.json()})).then(t(X,this,tt).bind(this,e)).catch(console.error))}function tt(e,n){n.success?(t(X,this,nt).call(this,e),t(X,this,et).call(this,n.success,"primary"),t(X,this,rt).call(this,"afterFileDelete",{data:n,guid:e})):n.error&&(t(X,this,rt).call(this,"onFileDeleteError",{data:n,guid:e}),t(X,this,et).call(this,n.error,"danger"))}function et(t,e){o(Q,this).notification({message:t,status:e,pos:"top-center",timeout:7e3})}function nt(e){var n=document.getElementById(e);n&&(t(X,this,rt).call(this,"beforeFileRemoveFromUI",{element:n,guid:e}),n.remove())}function rt(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};document.dispatchEvent(new CustomEvent("vdm.uikit.delete.".concat(t),{detail:e}))}function it(t){var e=o(K,this).includes("?")?"&":"?";return"".concat(o(K,this)).concat(e,"guid=").concat(t)}f(Z,"ERROR_ENDPOINT","Error: The delete endpoint is not configured.");var ot,at=["endpoint_type","target_class"];ot=window,document.addEventListener("DOMContentLoaded",(function(){var t;if(t=ot.UIkit?ot.UIkit:require("uikit").default,ot.VDM){var e=ot.VDM.uikit.config||{},n=e.endpoint_type,r=e.target_class,i=function(t,e){if(null==t)return{};var n,r,i=function(t,e){if(null==t)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.includes(r))continue;n[r]=t[r]}return n}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r<o.length;r++)n=o[r],e.includes(n)||{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}(e,at);if(n&&r){var o=document.querySelectorAll("."+r),a={};ot.VDM.uikit.delete_file||(ot.VDM.uikit.delete_file={}),o.forEach((function(e){var n,r,o,c,l,u,s,f=e.getAttribute("id"),h=null!==(n=null===(r=i[f])||void 0===r?void 0:r.endpoint_upload)&&void 0!==n?n:null;if(h){var d=e.dataset.typeId,p=null!==(o=e.dataset.progressbarId)&&void 0!==o?o:null,v=null!==(c=null===(l=i[f])||void 0===l?void 0:l.endpoint_display)&&void 0!==c?c:null,y=e.dataset.displayId||null,m=null!==(u=null===(s=i[f])||void 0===s?void 0:s.endpoint_delete)&&void 0!==u?u:null,g=e.dataset.successId||null,b=e.dataset.errorId||null,w=e.dataset.allowedFormatId||null,E=e.dataset.fileTypeId||null;a[f]={bar:p,typeId:d,endpoint:h,successId:g,errorId:b,allowedFormatId:w,fileTypeId:E,displayId:y,displayEndpoint:v},m&&(ot.VDM.uikit.delete_file[f]=new Z(m,t))}})),Object.keys(a).length>0&&new _(a,n,t)}}})),ot.VDMDeleteFile=function(t,e){ot.VDM.uikit.delete_file[t]&&ot.VDM.uikit.delete_file[t]instanceof Z&&ot.VDM.uikit.delete_file[t].delete(e)}}();