芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/.trash/media.7/vendor/bootstrap/js/modal.min.js
import{M as Manipulator,j as isElement,S as SelectorEngine,k as execute,r as reflow,f as getElement,a as typeCheckConfig,E as EventHandler,l as executeAfterTransition,B as BaseComponent,c as isRTL,g as getElementFromSelector,i as isVisible,d as defineJQueryPlugin}from"./dom.min.js?1629745661";const SELECTOR_FIXED_CONTENT=".fixed-top, .fixed-bottom, .is-fixed, .sticky-top",SELECTOR_STICKY_CONTENT=".sticky-top";class ScrollBarHelper{constructor(){this._element=document.body}getWidth(){const e=document.documentElement.clientWidth;return Math.abs(window.innerWidth-e)}hide(){const e=this.getWidth();this._disableOverFlow(),this._setElementAttributes(this._element,"paddingRight",(t=>t+e)),this._setElementAttributes(SELECTOR_FIXED_CONTENT,"paddingRight",(t=>t+e)),this._setElementAttributes(".sticky-top","marginRight",(t=>t-e))}_disableOverFlow(){this._saveInitialAttribute(this._element,"overflow"),this._element.style.overflow="hidden"}_setElementAttributes(e,t,i){const s=this.getWidth();this._applyManipulationCallback(e,(e=>{if(e!==this._element&&window.innerWidth>e.clientWidth+s)return;this._saveInitialAttribute(e,t);const o=window.getComputedStyle(e)[t];e.style[t]=`${i(Number.parseFloat(o))}px`}))}reset(){this._resetElementAttributes(this._element,"overflow"),this._resetElementAttributes(this._element,"paddingRight"),this._resetElementAttributes(SELECTOR_FIXED_CONTENT,"paddingRight"),this._resetElementAttributes(".sticky-top","marginRight")}_saveInitialAttribute(e,t){const i=e.style[t];i&&Manipulator.setDataAttribute(e,t,i)}_resetElementAttributes(e,t){this._applyManipulationCallback(e,(e=>{const i=Manipulator.getDataAttribute(e,t);void 0===i?e.style.removeProperty(t):(Manipulator.removeDataAttribute(e,t),e.style[t]=i)}))}_applyManipulationCallback(e,t){isElement(e)?t(e):SelectorEngine.find(e,this._element).forEach(t)}isOverflowing(){return this.getWidth()>0}}const Default$1={isVisible:!0,isAnimated:!1,rootElement:"body",clickCallback:null},DefaultType$1={isVisible:"boolean",isAnimated:"boolean",rootElement:"(element|string)",clickCallback:"(function|null)"},NAME$1="backdrop",CLASS_NAME_BACKDROP="modal-backdrop",CLASS_NAME_FADE$1="fade",CLASS_NAME_SHOW$1="show",EVENT_MOUSEDOWN="mousedown.bs.backdrop";class Backdrop{constructor(e){this._config=this._getConfig(e),this._isAppended=!1,this._element=null}show(e){this._config.isVisible?(this._append(),this._config.isAnimated&&reflow(this._getElement()),this._getElement().classList.add("show"),this._emulateAnimation((()=>{execute(e)}))):execute(e)}hide(e){this._config.isVisible?(this._getElement().classList.remove("show"),this._emulateAnimation((()=>{this.dispose(),execute(e)}))):execute(e)}_getElement(){if(!this._element){const e=document.createElement("div");e.className="modal-backdrop",this._config.isAnimated&&e.classList.add("fade"),this._element=e}return this._element}_getConfig(e){return(e={...Default$1,..."object"==typeof e?e:{}}).rootElement=getElement(e.rootElement),typeCheckConfig(NAME$1,e,DefaultType$1),e}_append(){this._isAppended||(this._config.rootElement.appendChild(this._getElement()),EventHandler.on(this._getElement(),EVENT_MOUSEDOWN,(()=>{execute(this._config.clickCallback)})),this._isAppended=!0)}dispose(){this._isAppended&&(EventHandler.off(this._element,EVENT_MOUSEDOWN),this._element.remove(),this._isAppended=!1)}_emulateAnimation(e){executeAfterTransition(e,this._getElement(),this._config.isAnimated)}}const NAME="modal",DATA_KEY="bs.modal",EVENT_KEY=".bs.modal",DATA_API_KEY=".data-api",ESCAPE_KEY="Escape",Default={backdrop:!0,keyboard:!0,focus:!0},DefaultType={backdrop:"(boolean|string)",keyboard:"boolean",focus:"boolean"},EVENT_HIDE="hide.bs.modal",EVENT_HIDE_PREVENTED="hidePrevented.bs.modal",EVENT_HIDDEN="hidden.bs.modal",EVENT_SHOW="show.bs.modal",EVENT_SHOWN="shown.bs.modal",EVENT_FOCUSIN="focusin.bs.modal",EVENT_RESIZE="resize.bs.modal",EVENT_CLICK_DISMISS="click.dismiss.bs.modal",EVENT_KEYDOWN_DISMISS="keydown.dismiss.bs.modal",EVENT_MOUSEUP_DISMISS="mouseup.dismiss.bs.modal",EVENT_MOUSEDOWN_DISMISS="mousedown.dismiss.bs.modal",EVENT_CLICK_DATA_API="click.bs.modal.data-api",CLASS_NAME_OPEN="modal-open",CLASS_NAME_FADE="fade",CLASS_NAME_SHOW="show",CLASS_NAME_STATIC="modal-static",SELECTOR_DIALOG=".modal-dialog",SELECTOR_MODAL_BODY=".modal-body",SELECTOR_DATA_TOGGLE='[data-bs-toggle="modal"]',SELECTOR_DATA_DISMISS='[data-bs-dismiss="modal"]';class Modal extends BaseComponent{constructor(e,t){super(e),this._config=this._getConfig(t),this._dialog=SelectorEngine.findOne(".modal-dialog",this._element),this._backdrop=this._initializeBackDrop(),this._isShown=!1,this._ignoreBackdropClick=!1,this._isTransitioning=!1,this._scrollBar=new ScrollBarHelper}static get Default(){return Default}static get NAME(){return NAME}toggle(e){return this._isShown?this.hide():this.show(e)}show(e){if(this._isShown||this._isTransitioning)return;EventHandler.trigger(this._element,EVENT_SHOW,{relatedTarget:e}).defaultPrevented||(this._isShown=!0,this._isAnimated()&&(this._isTransitioning=!0),this._scrollBar.hide(),document.body.classList.add("modal-open"),this._adjustDialog(),this._setEscapeEvent(),this._setResizeEvent(),EventHandler.on(this._element,EVENT_CLICK_DISMISS,SELECTOR_DATA_DISMISS,(e=>this.hide(e))),EventHandler.on(this._dialog,EVENT_MOUSEDOWN_DISMISS,(()=>{EventHandler.one(this._element,EVENT_MOUSEUP_DISMISS,(e=>{e.target===this._element&&(this._ignoreBackdropClick=!0)}))})),this._showBackdrop((()=>this._showElement(e))))}hide(e){if(e&&["A","AREA"].includes(e.target.tagName)&&e.preventDefault(),!this._isShown||this._isTransitioning)return;if(EventHandler.trigger(this._element,EVENT_HIDE).defaultPrevented)return;this._isShown=!1;const t=this._isAnimated();t&&(this._isTransitioning=!0),this._setEscapeEvent(),this._setResizeEvent(),EventHandler.off(document,EVENT_FOCUSIN),this._element.classList.remove("show"),EventHandler.off(this._element,EVENT_CLICK_DISMISS),EventHandler.off(this._dialog,EVENT_MOUSEDOWN_DISMISS),this._queueCallback((()=>this._hideModal()),this._element,t)}dispose(){[window,this._dialog].forEach((e=>EventHandler.off(e,EVENT_KEY))),this._backdrop.dispose(),super.dispose(),EventHandler.off(document,EVENT_FOCUSIN)}handleUpdate(){this._adjustDialog()}_initializeBackDrop(){return new Backdrop({isVisible:Boolean(this._config.backdrop),isAnimated:this._isAnimated()})}_getConfig(e){return e={...Default,...Manipulator.getDataAttributes(this._element),..."object"==typeof e?e:{}},typeCheckConfig(NAME,e,DefaultType),e}_showElement(e){const t=this._isAnimated(),i=SelectorEngine.findOne(".modal-body",this._dialog);this._element.parentNode&&this._element.parentNode.nodeType===Node.ELEMENT_NODE||document.body.appendChild(this._element),this._element.style.display="block",this._element.removeAttribute("aria-hidden"),this._element.setAttribute("aria-modal",!0),this._element.setAttribute("role","dialog"),this._element.scrollTop=0,i&&(i.scrollTop=0),t&&reflow(this._element),this._element.classList.add("show"),this._config.focus&&this._enforceFocus();this._queueCallback((()=>{this._config.focus&&this._element.focus(),this._isTransitioning=!1,EventHandler.trigger(this._element,EVENT_SHOWN,{relatedTarget:e})}),this._dialog,t)}_enforceFocus(){EventHandler.off(document,EVENT_FOCUSIN),EventHandler.on(document,EVENT_FOCUSIN,(e=>{document===e.target||this._element===e.target||this._element.contains(e.target)||this._element.focus()}))}_setEscapeEvent(){this._isShown?EventHandler.on(this._element,EVENT_KEYDOWN_DISMISS,(e=>{this._config.keyboard&&"Escape"===e.key?(e.preventDefault(),this.hide()):this._config.keyboard||"Escape"!==e.key||this._triggerBackdropTransition()})):EventHandler.off(this._element,EVENT_KEYDOWN_DISMISS)}_setResizeEvent(){this._isShown?EventHandler.on(window,EVENT_RESIZE,(()=>this._adjustDialog())):EventHandler.off(window,EVENT_RESIZE)}_hideModal(){this._element.style.display="none",this._element.setAttribute("aria-hidden",!0),this._element.removeAttribute("aria-modal"),this._element.removeAttribute("role"),this._isTransitioning=!1,this._backdrop.hide((()=>{document.body.classList.remove("modal-open"),this._resetAdjustments(),this._scrollBar.reset(),EventHandler.trigger(this._element,EVENT_HIDDEN)}))}_showBackdrop(e){EventHandler.on(this._element,EVENT_CLICK_DISMISS,(e=>{this._ignoreBackdropClick?this._ignoreBackdropClick=!1:e.target===e.currentTarget&&(!0===this._config.backdrop?this.hide():"static"===this._config.backdrop&&this._triggerBackdropTransition())})),this._backdrop.show(e)}_isAnimated(){return this._element.classList.contains("fade")}_triggerBackdropTransition(){if(EventHandler.trigger(this._element,EVENT_HIDE_PREVENTED).defaultPrevented)return;const{classList:e,scrollHeight:t,style:i}=this._element,s=t>document.documentElement.clientHeight;!s&&"hidden"===i.overflowY||e.contains("modal-static")||(s||(i.overflowY="hidden"),e.add("modal-static"),this._queueCallback((()=>{e.remove("modal-static"),s||this._queueCallback((()=>{i.overflowY=""}),this._dialog)}),this._dialog),this._element.focus())}_adjustDialog(){const e=this._element.scrollHeight>document.documentElement.clientHeight,t=this._scrollBar.getWidth(),i=t>0;(!i&&e&&!isRTL()||i&&!e&&isRTL())&&(this._element.style.paddingLeft=`${t}px`),(i&&!e&&!isRTL()||!i&&e&&isRTL())&&(this._element.style.paddingRight=`${t}px`)}_resetAdjustments(){this._element.style.paddingLeft="",this._element.style.paddingRight=""}static jQueryInterface(e,t){return this.each((function(){const i=Modal.getOrCreateInstance(this,e);if("string"==typeof e){if(void 0===i[e])throw new TypeError(`No method named "${e}"`);i[e](t)}}))}}EventHandler.on(document,EVENT_CLICK_DATA_API,SELECTOR_DATA_TOGGLE,(function(e){const t=getElementFromSelector(this);["A","AREA"].includes(this.tagName)&&e.preventDefault(),EventHandler.one(t,EVENT_SHOW,(e=>{e.defaultPrevented||EventHandler.one(t,EVENT_HIDDEN,(()=>{isVisible(this)&&this.focus()}))}));Modal.getOrCreateInstance(t).toggle(this)})),defineJQueryPlugin(Modal),Joomla=Joomla||{},Joomla.Modal=Joomla.Modal||{},window.bootstrap=window.bootstrap||{},window.bootstrap.Modal=Modal;const allowed={iframe:["src","name","width","height"]};if(Joomla.initialiseModal=(e,t)=>{e instanceof Element&&(new window.bootstrap.Modal(e,t),e.open=()=>{window.bootstrap.Modal.getInstance(e).show(e)},e.close=()=>{window.bootstrap.Modal.getInstance(e).hide()},e.addEventListener("show.bs.modal",(()=>{if(Joomla.Modal.setCurrent(e),e.dataset.url){const t=e.querySelector(".modal-body"),i=t.querySelector("iframe");if(i){const t=e.querySelector("joomla-field-mediamore");t&&t.parentNode.removeChild(t),i.parentNode.removeChild(i)}if(e.dataset.iframe.indexOf("document.getElementById")>0){const i=e.dataset.iframe.split("+"),s=i[1].split('"');let o;if(s[0]=s[0].replace(/"/g,'"'),document.getElementById(s[1]))o=document.getElementById(s[1]).value;else{o=new Function(`return ${s[0]}`).call(null)}t.insertAdjacentHTML("afterbegin",Joomla.sanitizeHtml(`${i[0]}${o}${i[2]}`,allowed))}else t.insertAdjacentHTML("afterbegin",Joomla.sanitizeHtml(e.dataset.iframe,allowed))}})),e.addEventListener("shown.bs.modal",(()=>{const t=e.querySelector(".modal-body"),i=e.querySelector(".modal-header"),s=e.querySelector(".modal-footer");let o=0,n=0,a=0,l=0,r=0;if(t){if(i){o=i.getBoundingClientRect().height,r=t.offsetHeight}s&&(n=parseFloat(getComputedStyle(s,null).height.replace("px","")));const e=parseFloat(getComputedStyle(t,null).height.replace("px","")),d=t.offsetTop;l=r-e,a=parseFloat(getComputedStyle(document.body,null).height.replace("px",""))-2*d-(o+n+l)}if(e.dataset.url){const i=e.querySelector("iframe");parseFloat(getComputedStyle(i,null).height.replace("px",""))>a&&(t.style.maxHeight=a,t.style.overflowY="auto",i.style.maxHeight=a-l)}})),e.addEventListener("hide.bs.modal",(()=>{e.querySelector(".modal-body").style.maxHeight="initial"})),e.addEventListener("hidden.bs.modal",(()=>{Joomla.Modal.setCurrent("")})))},Joomla.iframeButtonClick=e=>{if(!e.iframeSelector||!e.buttonSelector)throw new Error("Selector is missing");const t=document.querySelector(`${e.iframeSelector} iframe`);if(t){const i=t.contentWindow.document.querySelector(e.buttonSelector);i&&i.click()}},Joomla&&Joomla.getOptions){const e=Joomla.getOptions("bootstrap.modal");"object"==typeof e&&null!==e&&Object.keys(e).forEach((t=>{const i=e[t],s={backdrop:!i.backdrop||i.backdrop,keyboard:!i.keyboard||i.keyboard,focus:!i.focus||i.focus};Array.from(document.querySelectorAll(t)).map((e=>Joomla.initialiseModal(e,s)))}))}export{Backdrop as B,Modal as M,ScrollBarHelper as S};