- md5
- 4f073039a5829cd9335dcbe8cda8ba74
- sha1
- cc284a8102ca0b54e288d94a8d911612af8f480f
- sha256
- 1110e027293ecb05d0914985beb7c2672d98061e30e6a2ab73b8f06044355fed
!function(){"use strict";function t(t,e,n,i,r,o,u){try{var s=t[o](u),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(i,r)}function e(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function n(t){return(n=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function r(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function o(t,e,n){return(o=r()?Reflect.construct:function(t,e,n){var r=[null];r.push.apply(r,e);var o=new(Function.bind.apply(t,r));return n&&i(o,n.prototype),o}).apply(null,arguments)}function u(t){var e="function"==typeof Map?new Map:void 0;return(u=function(t){if(null===t||(r=t,-1===Function.toString.call(r).indexOf("[native code]")))return t;var r;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,u)}function u(){return o(t,arguments,n(this).constructor)}return u.prototype=Object.create(t.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),i(u,t)})(t)}function s(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}!function(n,r){if(!r)throw new Error("Joomla API is not properly initiated");var o=function(n){var o,u;function l(){var t;return(t=n.call(this)||this).onSelected=t.onSelected.bind(s(t)),t.show=t.show.bind(s(t)),t.clearValue=t.clearValue.bind(s(t)),t.modalClose=t.modalClose.bind(s(t)),t.setValue=t.setValue.bind(s(t)),t.updatePreview=t.updatePreview.bind(s(t)),t}u=n,(o=l).prototype=Object.create(u.prototype),o.prototype.constructor=o,i(o,u);var a,c,h,p=l.prototype;return p.connectedCallback=function(){if(this.button=this.querySelector(this.buttonSelect),this.inputElement=this.querySelector(this.input),this.buttonClearEl=this.querySelector(this.buttonClear),this.modalElement=this.querySelector(".joomla-modal"),this.buttonSaveSelectedElement=this.querySelector(this.buttonSaveSelected),this.previewElement=this.querySelector(".field-media-preview"),!(this.button&&this.inputElement&&this.buttonClearEl&&this.modalElement&&this.buttonSaveSelectedElement))throw new Error("Misconfiguaration...");this.button.addEventListener("click",this.show),this.modalElement&&window.bootstrap&&window.bootstrap.Modal&&!window.bootstrap.Modal.getInstance(this.modalElement)&&r.initialiseModal(this.modalElement,{isJoomla:!0}),this.buttonClearEl&&this.buttonClearEl.addEventListener("click",this.clearValue),this.updatePreview()},p.disconnectedCallback=function(){this.button&&this.button.removeEventListener("click",this.show),this.buttonClearEl&&this.buttonClearEl.removeEventListener("click",this.clearValue)},p.onSelected=function(t){return t.preventDefault(),t.stopPropagation(),this.modalClose(),!1},p.show=function(){this.modalElement.open(),r.selectedMediaFile={},this.buttonSaveSelectedElement.addEventListener("click",this.onSelected)},p.modalClose=function(){var e,n=(e=regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,r.getImage(r.selectedMediaFile,this.inputElement,this);case 3:t.next=8;break;case 5:t.prev=5,t.t0=t.catch(0),r.renderMessages({error:[r.Text._("JLIB_APPLICATION_ERROR_SERVER")]});case 8:r.selectedMediaFile={},r.Modal.getCurrent().close();case 10:case"end":return t.stop()}}),t,this,[[0,5]])})),function(){var n=this,i=arguments;return new Promise((function(r,o){var u=e.apply(n,i);function s(e){t(u,r,o,s,l,"next",e)}function l(e){t(u,r,o,s,l,"throw",e)}s(void 0)}))});return function(){return n.apply(this,arguments)}}(),p.setValue=function(t){this.inputElement.value=t,this.updatePreview(),this.inputElement.dispatchEvent(new Event("change")),this.dispatchEvent(new CustomEvent("change",{detail:{value:t},bubbles:!0}))},p.clearValue=function(){this.setValue("")},p.updatePreview=function(){if(-1!==["true","static"].indexOf(this.preview)&&"false"!==this.preview&&this.previewElement&&this.preview){var t=this.inputElement.value;if(t){this.previewElement.innerHTML="";var e=new Image;({image:function(){e.src=/http/.test(t)?t:r.getOptions("system.paths").rootFull+t,e.setAttribute("alt","")}})[this.type](),this.previewElement.style.width=this.previewWidth,this.previewElement.appendChild(e)}else this.previewElement.innerHTML='<span class="field-media-preview-icon"></span>'}},a=l,h=[{key:"observedAttributes",get:function(){return["type","base-path","root-folder","url","modal-container","modal-width","modal-height","input","button-select","button-clear","button-save-selected","preview","preview-width","preview-height"]}}],(c=[{key:"type",get:function(){return this.getAttribute("type")},set:function(t){this.setAttribute("type",t)}},{key:"basePath",get:function(){return this.getAttribute("base-path")},set:function(t){this.setAttribute("base-path",t)}},{key:"rootFolder",get:function(){return this.getAttribute("root-folder")},set:function(t){this.setAttribute("root-folder",t)}},{key:"url",get:function(){return this.getAttribute("url")},set:function(t){this.setAttribute("url",t)}},{key:"modalContainer",get:function(){return this.getAttribute("modal-container")},set:function(t){this.setAttribute("modal-container",t)}},{key:"input",get:function(){return this.getAttribute("input")},set:function(t){this.setAttribute("input",t)}},{key:"buttonSelect",get:function(){return this.getAttribute("button-select")},set:function(t){this.setAttribute("button-select",t)}},{key:"buttonClear",get:function(){return this.getAttribute("button-clear")},set:function(t){this.setAttribute("button-clear",t)}},{key:"buttonSaveSelected",get:function(){return this.getAttribute("button-save-selected")},set:function(t){this.setAttribute("button-save-selected",t)}},{key:"modalWidth",get:function(){return this.getAttribute(parseInt("modal-width",10))},set:function(t){this.setAttribute("modal-width",t)}},{key:"modalHeight",get:function(){return this.getAttribute(parseInt("modal-height",10))},set:function(t){this.setAttribute("modal-height",t)}},{key:"previewWidth",get:function(){return this.getAttribute(parseInt("preview-width",10))},set:function(t){this.setAttribute("preview-width",t)}},{key:"previewHeight",get:function(){return this.getAttribute(parseInt("preview-height",10))},set:function(t){this.setAttribute("preview-height",t)}},{key:"preview",get:function(){return this.getAttribute("preview")},set:function(t){this.setAttribute("preview",t)}},{key:"previewContainer",get:function(){return this.getAttribute("preview-container")}}])&&e(a.prototype,c),h&&e(a,h),l}(u(HTMLElement));n.define("joomla-field-media",o)}(customElements,Joomla)}();
No other release has this exact content. See every version of this file.