AlkantarClanX12
Current Path : /home/thanudqk/thepball.com/wp-content/plugins/ml-slider/admin/assets/dist/js/ |
Current File : //home/thanudqk/thepball.com/wp-content/plugins/ml-slider/admin/assets/dist/js/editor-block.js |
!function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="/",r(r.s=1)}([function(e,t){!function(){e.exports=this.wp.blockEditor}()},function(e,t,r){e.exports=r(2)},function(e,t,r){"use strict";r.r(t);var n=React.createElement("svg",{key:"ms-icon",version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",width:"20px",height:"20px",viewBox:"0 0 20 20",className:"dashicon metaslider-icon"},React.createElement("path",{key:"icon-path",d:"M10,0C4.477,0,0,4.477,0,10s4.477,10,10,10s10-4.477,10-10S15.523,0,10,0z M2.95,12.667l5.796-7.218 l0.979,1.049l-4.817,6.169H2.95z M12.735,12.667l-2.5-3.015l0.959-1.25l3.46,4.265H12.735z M15.013,12.667l-3.838-4.915 l-3.838,4.915H5.378l5.777-7.382l5.895,7.382H15.013z"}));function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function l(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=d(e);if(t){var i=d(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return a(this,r)}}function a(e,t){return!t||"object"!==i(t)&&"function"!=typeof t?c(e):t}function c(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var u=window.wp,p=window.React,h=u.components,m=h.Placeholder,f=h.Spinner,w=u.i18n.__,v=u.apiRequest,g=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&s(e,t)}(d,e);var t,r,i,a=l(d);function d(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,d),(t=a.call(this,e)).state={height:200,previewIsLoading:!0,slideshowId:null,html:"",previewErrorMessage:""},t.handleOnLoad=t.handleOnLoad.bind(c(t)),t.setHeight=t.setHeight.bind(c(t)),t.getPreview=t.getPreview.bind(c(t)),t.handleResize=t.handleResize.bind(c(t)),t.iframe=p.createRef(),t}return t=d,(r=[{key:"componentDidMount",value:function(){this.getPreview(),window.addEventListener("resize",this.handleResize),this.props.componentDidMount&&this.props.componentDidMount(this)}},{key:"componentWillUnmount",value:function(){window.removeEventListener("resize",this.handleResize),this.props.componentWillUnmount&&this.props.componentWillUnmount()}},{key:"componentDidUpdate",value:function(e){this.props.slideshowId===e.slideshowId&&this.props.refresh===e.refresh||(this.setHeight(200),this.getPreview(),this.iframe.current.contentDocument.location.reload(!0))}},{key:"handleOnLoad",value:function(e){var t=this;this.state.html&&(this.iframe.current.contentDocument.editor_block=this,setTimeout((function(){clearInterval(t.loadInterval),t.setHeight(t.iframe.current.contentDocument.body.clientHeight)}),50),this.setState({previewIsLoading:!1}))}},{key:"handleResize",value:function(e){this.setHeight(this.iframe.current.contentDocument.body.clientHeight)}},{key:"setHeight",value:function(e){this.setState({height:e>200?e:200})}},{key:"getPreview",value:function(){var e=this;try{this.setState({html:"",previewIsLoading:!0,previewErrorMessage:""}),v({path:"/metaslider/v1/slideshow/preview",data:{action:"ms_get_preview",slideshow_id:this.props.slideshowId,override_preview_style:!0}}).then((function(t){e.setState({html:t.data}),e.setHeight(e.iframe.current.contentDocument.body.clientHeight)})).fail((function(t){410===t.status?(e.setState({previewIsLoading:!1,previewErrorMessage:t.responseJSON.data.message}),console.error("MetaSlider (Gutenberg): Slideshow not found:",t)):console.error("MetaSlider (Gutenberg): Could not load the preview:",t)}))}catch(e){console.error("MetaSlider (Gutenberg): A general error occured:",e)}}},{key:"render",value:function(){return p.createElement("div",{className:this.props.className+(this.state.previewIsLoading?"":" loading")+" ms-preview"},p.createElement("iframe",{key:"preview-iframe",height:this.state.height,srcDoc:this.state.html||"",onLoad:this.handleOnLoad,ref:this.iframe}),p.createElement("div",{key:"trigger",className:"ms-preview__trigger"}),this.state.previewIsLoading&&p.createElement(m,{key:"ms-loader",className:"ms-loader",label:[n," MetaSlider"]},p.createElement(f,null)," ",w("Loading slideshow","ml-slider")),this.state.previewErrorMessage&&p.createElement(m,{key:"ms-preview-empty",className:"ms-loader",label:[n," MetaSlider"]},this.state.previewErrorMessage))}}])&&o(t.prototype,r),i&&o(t,i),d}(p.Component);function b(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function y(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?b(Object(r),!0).forEach((function(t){S(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):b(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function S(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var E=window.wp,R=E.i18n.__,_=E.components.Toolbar,O={normal:{icon:"align-center",title:R("Normal width","ml-slider")},wide:{icon:"align-wide",title:R("Wide width","ml-slider")},full:{icon:"align-full-width",title:R("Full width","ml-slider")}},k=["normal","wide","full"];function P(e){var t=e.value,r=e.onChange,n=e.controls;var i=void 0===n?k:n;return React.createElement(_,{controls:i.map((function(e){return y(y({},O[e]),{},{isActive:t===e,onClick:(n=e,function(){return r(t===n?void 0:n)})});var n}))})}var C=window.wp,M=C.i18n.__,j=C.components.SelectControl;function I(e){var t=e.props,r=t.attributes.slideshowId,n=t.slideshows;return React.createElement(j,{label:M("Select a slideshow","ml-slider"),value:r,options:[{label:"-- "+M("Select a slideshow","ml-slider")+" --",value:0}].concat(n.items.map((function(e){return{key:e.id,label:C.htmlEntities.decodeEntities(e.title)+" (#"+e.id+")",value:e.id}}))),onChange:function(e){e=parseInt(e),t.setAttributes({slideshowId:e})}})}var L=window.wp,x=L.i18n.__,D=L.components.Toolbar;function N(e){e.value,e.onChange;var t=e.onClick;return React.createElement(D,{controls:[{icon:"update",title:x("Update preview","ml-slider"),isActive:!1,onClick:t}]})}var H=r(0),z=window.wp,T=z.i18n.__,A=z.element.Fragment,W=z.data.withSelect,U=z.components,B=U.TextControl,q=U.Placeholder,F=U.Spinner,G=U.PanelBody,J=U.BaseControl,K=window.metaslider_block_config||{},Q=W((function(e){return{wideControlsEnabled:e("core/editor").getEditorSettings().alignWide}}))((function(e){var t=e.slideshows,r=e.className,i=e.isSelected,o=e.wideControlsEnabled,s=void 0!==o&&o,l=e.attributes.slideshowId,a=e.attributes.stretch,c=e.attributes.containerClass,d=t.isLoading,u=t.items.length||!1,p=e.attributes.refreshPreview,h=i&&React.createElement(A,{key:"inspectorControls"},React.createElement(H.InspectorControls,{key:"inspector"},React.createElement(G,{title:T("Slideshow settings","ml-slider")},u&&React.createElement(I,{props:e}),0!==l&&React.createElement("a",{href:K.plugin_page+"&id="+l,target:"_blank",className:"ms-edit-current-slideshow"},T("Edit slideshow","ml-slider")),s&&React.createElement(J,{label:T("Slideshow width","ml-slider")},React.createElement(P,{value:a,onChange:function(t){setTimeout((function(){window.dispatchEvent(new Event("resize"))}),50),e.setAttributes({stretch:t})}})))),React.createElement(H.InspectorAdvancedControls,null,React.createElement(J,{label:T("Additional CSS Class","ml-slider")},React.createElement(B,{value:c,onChange:function(t){e.setAttributes({containerClass:t})}}))),React.createElement(H.BlockControls,{key:"controls"},s&&React.createElement(P,{label:T("Slideshow width","ml-slider"),value:a,onChange:function(t){setTimeout((function(){window.dispatchEvent(new Event("resize"))}),50),e.setAttributes({stretch:t})}}),0!==l&&React.createElement(N,{key:"refresh",label:T("Refresh preview","ml-slider"),onClick:function(){e.setAttributes({refreshPreview:!p})}})));return u||l||!d?u||l||d?[h,!!l&&React.createElement(g,{key:"preview",className:r,src:K.preview_url+"&slideshow_id="+l,slideshowId:l,isSelected:i,refresh:p}),!l&&React.createElement(q,{key:"instructions",className:e.className,label:[n," MetaSlider"]},React.createElement(I,{key:"slidehow-selector",props:e}))]:React.createElement(q,{className:r,label:[n," MetaSlider"]},T("No slideshows found.","ml-slider")," ",React.createElement("a",{target:"_blank",href:K.plugin_page},T("Create one now!","ml-slider"))):React.createElement(q,{className:r,label:[n," MetaSlider"]},React.createElement(F,{key:"spinner"})," ",T("Loading slideshows list...","ml-slider"))})),V=window.wp.element.Fragment,X=function(e){var t=e.attributes,r=t.slideshowId,n=t.stretch,i=t.containerClass,o=n?"align"+n:"";return!!r&&React.createElement(V,null,React.createElement("div",{class:o},"[metaslider id=",r,' cssclass="',i,'"]'))||""},Y=window.wp,Z=Y.i18n.__,$=Y.blocks.registerBlockType,ee=Y.data,te=ee.registerStore,re=ee.dispatch,ne=ee.withSelect,ie=Y.apiRequest,oe={items:[],isLoading:!0};te("metaslider",{reducer:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:oe,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"SET_SLIDESHOWS":return{items:t.items,isLoading:!1}}return e},actions:{setSlideshows:function(e){return{type:"SET_SLIDESHOWS",items:e}}},selectors:{getSlideshows:function(e){return e}},resolvers:{getSlideshows:function(e,t){try{ie({path:"/metaslider/v1/slideshow/list"}).then((function(e){!0===e.success?re("metaslider").setSlideshows(e.data):(console.warn("MetaSlider: API Request error:",e.data.message),re("metaslider").setSlideshows([]))}))}catch(e){console.warn("MetaSlider: API Request error:",e),re("metaslider").setSlideshows([])}}}}),$("metaslider/slider",{title:"MetaSlider",description:Z("Use MetaSlider to insert slideshows and sliders in your page","ml-slider"),icon:n,category:"common",keywords:[Z("slider","ml-slider"),Z("slideshow","ml-slider"),Z("gallery","ml-slider")],attributes:{slideshowId:{type:"number",default:0},stretch:{type:"string",default:"normal"},containerClass:{type:"string",default:""}},supports:{customClassName:!1},edit:ne((function(e,t){return{slideshows:(0,e("metaslider").getSlideshows)()}}))(Q),save:function(e){return X(e)},getEditWrapperProps:function(e){var t=e.stretch;if(-1!==["wide","full","normal"].indexOf(t))return{"data-align":t}}})}]);