File: /home/ezpgggd/www/wp-content/plugins/modula/assets/js/gutenberg/modula-link.js
(()=>{"use strict";function e(){return e=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var a in l)Object.prototype.hasOwnProperty.call(l,a)&&(e[a]=l[a])}return e},e.apply(this,arguments)}const t=window.wp.i18n,l=window.wp.element,a=window.wp.blockEditor,o=window.wp.components;class n extends l.Component{constructor(e){super(...arguments)}selectOptions(){let e=[{value:0,label:(0,t.__)("none")}];return this.props.galleries.forEach((function(l){0==l.title.rendered.length?e.push({value:l.id,label:(0,t.__)("Unnamed Gallery","modula-pro")+l.id}):e.push({value:l.id,label:l.title.rendered})})),e}render(){const{attributes:e,setAttributes:n,galleries:r}=this.props,{id:c,fontSize:i,buttonSize:s,buttonTextColor:d,buttonBackgroundColor:u,buttonHoverTextColor:m,buttonHoverBackgroundColor:p,borderWidth:h,borderRadius:g,borderColor:b,borderType:f}=e,C=[{name:(0,t.__)("Small"),slug:"small",size:12},{name:(0,t.__)("Medium"),slug:"medium",size:18},{name:(0,t.__)("Big"),slug:"big",size:26}];return React.createElement(l.Fragment,null,React.createElement(a.InspectorControls,null,React.createElement(o.PanelBody,{title:(0,t.__)("Gallery Settings","modula-pro"),initialOpen:!0},0===r.length&&React.createElement(l.Fragment,null,React.createElement("p",null,(0,t.__)("You don't seem to have any galleries.","modula-pro")),React.createElement(o.Button,{href:modulaVars.adminURL+"post-new.php?post_type=modula-gallery",target:"_blank",isDefault:!0},(0,t.__)("Add New Gallery","modula-pro"))),r.length>0&&React.createElement(l.Fragment,null,React.createElement(o.SelectControl,{key:c,label:(0,t.__)("Select Gallery"),value:c,options:this.selectOptions(),onChange:e=>this.props.onIdChange(parseInt(e))}),0!=c&&React.createElement(o.Button,{target:"_blank",href:modulaVars.adminURL+"post.php?post="+c+"&action=edit",isDefault:!0},(0,t.__)("Edit gallery","modula-pro")))),React.createElement(o.PanelBody,{title:(0,t.__)("Button Style Settings","modula-pro"),initialOpen:!0},React.createElement("h3",null," ",(0,t.__)("Button Font Size")," "),React.createElement(o.FontSizePicker,{fontSizes:C,value:i,fallbackFontSize:16,onChange:e=>{n({fontSize:e})}}),React.createElement(o.RadioControl,{label:(0,t.__)("Button Size","modula-pro"),selected:null==s?"modula-link-button-small":s,options:[{label:"Small",value:"modula-link-button-small"},{label:"Medium",value:"modula-link-button-medium"},{label:"Large",value:"modula-link-button-large"},{label:"X-Large",value:"modula-link-button-x-large"}],onChange:e=>n({buttonSize:e})}),React.createElement("h4",null,(0,t.__)("Button Text Color","modula-pro")," "),React.createElement(o.ColorPicker,{color:null==d?"#fff":d,onChangeComplete:e=>n({buttonTextColor:e}),disableAlpha:!0}),React.createElement("h4",null,(0,t.__)("Background Color","modula-pro")," "),React.createElement(o.ColorPicker,{color:u,onChangeComplete:e=>n({buttonBackgroundColor:e}),disableAlpha:!0}),React.createElement("h4",null," ",(0,t.__)("Hover Text Color","modula-pro")," "),React.createElement(o.ColorPicker,{color:m,onChangeComplete:e=>n({buttonHoverTextColor:e}),disableAlpha:!0}),React.createElement("h4",null," ",(0,t.__)("Hover Background Color","modula-pro")," "),React.createElement(o.ColorPicker,{color:p,onChangeComplete:e=>n({buttonHoverBackgroundColor:e}),disableAlpha:!0}),React.createElement("h2",null," ",(0,t.__)("Border Settings","modula-pro")," "),React.createElement(o.RadioControl,{label:(0,t.__)("Border Type","modula-pro"),selected:f,options:[{label:(0,t.__)("Solid"),value:"solid"},{label:(0,t.__)("Double"),value:"double"},{label:(0,t.__)("Dotted"),value:"dotted"},{label:(0,t.__)("Ridge"),value:"ridge"}],onChange:e=>n({borderType:e})}),React.createElement(o.RangeControl,{beforeIcon:"arrow-left-alt2",afterIcon:"arrow-right-alt2",label:(0,t.__)("Border Width"),value:h,onChange:e=>n({borderWidth:e}),min:0,max:10}),React.createElement("h4",null," ",(0,t.__)("Border Color","modula-pro")," "),React.createElement(o.ColorPicker,{color:b,onChangeComplete:e=>n({borderColor:e}),disableAlpha:!0}),React.createElement(o.RangeControl,{beforeIcon:"arrow-left-alt2",afterIcon:"arrow-right-alt2",label:(0,t.__)("Border Radius"),value:g,onChange:e=>n({borderRadius:e}),min:0,max:100}))))}}const r=window.wp.data;class c extends l.Component{constructor(e){super(...arguments),this.props.attributes.status="ready"}componentDidMount(){0!==this.props.attributes.id&&this.onIdChange(this.props.attributes.id)}onIdChange(e){this.props.setAttributes({status:"loading"}),this.onGalleryLoaded(e)}onGalleryLoaded(e){this.props.setAttributes({id:e,status:"ready"})}selectOptions(){let e=[{value:0,label:(0,t.__)("select a gallery","modula-pro")}];return this.props.galleries.forEach((function(l){0==l.title.rendered.length?e.push({value:l.id,label:(0,t.__)("Unnamed Gallery ","modula-pro")+l.id}):e.push({value:l.id,label:l.title.rendered})})),e}render(){const{attributes:r,galleries:c,setAttributes:i}=this.props,{id:s,images:d,status:u,textAlignment:m,buttonText:p,fontSize:h,buttonSize:g,buttonTextColor:b,buttonBackgroundColor:f,buttonHoverTextColor:C,buttonHoverBackgroundColor:_,borderWidth:v,borderColor:R,borderType:w,borderRadius:E}=r,y=`modula-link-button-${s}`;return 0==s?[React.createElement(l.Fragment,null,React.createElement(n,e({onIdChange:e=>this.onIdChange(e)},this.props)),React.createElement("div",{className:"modula-block-preview"},React.createElement("div",{className:"modula-block-preview__content"},React.createElement("div",{className:"modula-block-preview__logo"}),0===c.length&&React.createElement(l.Fragment,null,React.createElement("p",null,(0,t.__)("You don't seem to have any galleries.","modula-pro")),React.createElement(o.Button,{href:modulaLinkVars.adminURL+"post-new.php?post_type=modula-gallery",target:"_blank",isDefault:!0},(0,t.__)("Add New Gallery","modula-pro"))),c.length>0&&React.createElement(l.Fragment,null,React.createElement(o.SelectControl,{key:s,value:s,options:this.selectOptions(),onChange:e=>this.onIdChange(parseInt(e))})))))]:[React.createElement("div",null,React.createElement("style",{dangerouslySetInnerHTML:{__html:`\n #${y}{\n font-size: ${h}px;\n background: ${f.hex};\n padding: 20px;\n color: ${b.hex};\n border: ${v}px ${w} ${R.hex};\n border-radius: ${E}%;\n }\n #${y} span {\n width: 100%;\n text-align: ${m};\n }\n #${y}:hover{\n color: ${C.hex};\n background: ${_.hex};\n }\n `}}),React.createElement(n,e({onIdChange:e=>this.onIdChange(e)},this.props)),React.createElement(a.BlockControls,null,React.createElement(a.AlignmentToolbar,{value:m,onChange:e=>i({textAlignment:e})})),React.createElement(o.Button,{id:y,className:g,isPrimary:!0,style:{width:"auto",minWidth:"fit-content"}}," ",React.createElement(a.RichText,{key:"editable",tagName:"span",placeholder:(0,t.__)("Enter your message here","modula-pro"),value:p,onChange:e=>i({buttonText:e})})))]}}const i=(0,r.withSelect)(((e,t)=>{const{getEntityRecords:l}=e("core");return{galleries:l("postType","modula-gallery",{post_status:"publish",per_page:-1})||[]}}))(c),s={};s.modula=React.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"364 242.9 312.2 357"},React.createElement("g",null,React.createElement("path",{d:"M528.1,242.9c8.5,16.9,17,33.8,25.6,50.6c13.4,26.4,26.9,52.7,39.9,79.7c-41.8-23.3-83.6-46.7-125.4-70.1 c0.3-1.9,1.7-2.6,2.7-3.5c17.7-17.7,35.4-35.4,53.1-53c1.1-1.1,2.6-2,3.1-3.7C527.4,242.9,527.8,242.9,528.1,242.9z"}),React.createElement("path",{d:"M602.3,463.3c11.3-6.9,22.6-13.9,33.9-20.8c5.5-3.4,11.1-6.7,16.5-10.3c2.2-1.4,2.9-1.1,3.5,1.5 c6.4,25.3,13,50.6,19.6,75.8c0.6,2.2,1,3.7-2.4,3.5c-46.7-2.1-93.5-4.1-140.2-6.1c-0.2,0-0.3-0.1-0.5-0.2c0.5-1.7,2.1-2,3.3-2.7 c20-12.3,39.9-24.7,60-36.8c3.4-2.1,5.1-3.7,4.8-8.5c-1.4-21.3-1.8-42.6-2.6-63.9c-0.9-24.1-1.8-48.3-2.8-72.4 c-0.2-6.1-0.2-6.1,5.5-4.6c23.8,6.2,47.6,12.5,71.5,18.5c3.9,1,4.2,1.9,2.1,5.4c-23.4,38.5-46.7,77.1-70,115.7c-1,1.7-2,3.4-3,5.1 C601.7,462.8,602,463,602.3,463.3z"}),React.createElement("path",{d:"M372.8,326.9c48,2.6,95.8,5.1,143.9,7.7c-0.9,2-2.5,2.3-3.7,3.1c-38.6,23.2-77.3,46.4-115.9,69.6c-3,1.8-4.3,2.6-5.4-1.9 c-5.9-24.9-12.2-49.7-18.3-74.6C373.1,329.6,373,328.4,372.8,326.9z"}),React.createElement("path",{d:"M517.6,599.9c-23.2-43.7-45.9-86.6-69.2-130.5c2.3,1.2,3.5,1.8,4.7,2.4c39.8,21.5,79.5,43.1,119.3,64.5 c3.2,1.7,4.1,2.5,1,5.6c-17.7,17.8-35.2,35.9-52.8,53.9C519.7,596.9,518.9,598.2,517.6,599.9z"}),React.createElement("path",{d:"M364.9,505.1c26.6-40.5,53.1-80.8,79.7-121.3c1.3,1.3,0.9,2.5,0.9,3.6c0,46-0.1,92-0.1,137.9c0,3.1-0.2,4.5-4,3.3 c-24.9-7.7-49.9-15.2-74.9-22.8C366,505.8,365.7,505.5,364.9,505.1z"}))),s.twitter=React.createElement("svg",{"aria-hidden":"true","data-prefix":"fab","data-icon":"twitter",class:"svg-inline--fa fa-twitter fa-w-16",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"},React.createElement("path",{fill:"currentColor",d:"M459.37 151.716c.325 4.548.325 9.097.325 13.645 0 138.72-105.583 298.558-298.558 298.558-59.452 0-114.68-17.219-161.137-47.106 8.447.974 16.568 1.299 25.34 1.299 49.055 0 94.213-16.568 130.274-44.832-46.132-.975-84.792-31.188-98.112-72.772 6.498.974 12.995 1.624 19.818 1.624 9.421 0 18.843-1.3 27.614-3.573-48.081-9.747-84.143-51.98-84.143-102.985v-1.299c13.969 7.797 30.214 12.67 47.431 13.319-28.264-18.843-46.781-51.005-46.781-87.391 0-19.492 5.197-37.36 14.294-52.954 51.655 63.675 129.3 105.258 216.365 109.807-1.624-7.797-2.599-15.918-2.599-24.04 0-57.828 46.782-104.934 104.934-104.934 30.213 0 57.502 12.67 76.67 33.137 23.715-4.548 46.456-13.32 66.599-25.34-7.798 24.366-24.366 44.833-46.132 57.827 21.117-2.273 41.584-8.122 60.426-16.243-14.292 20.791-32.161 39.308-52.628 54.253z"})),s.facebook=React.createElement("svg",{"aria-hidden":"true","data-prefix":"fab","data-icon":"facebook-f",class:"svg-inline--fa fa-facebook-f fa-w-9",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 264 512"},React.createElement("path",{fill:"currentColor",d:"M76.7 512V283H0v-91h76.7v-71.7C76.7 42.4 124.3 0 193.8 0c33.3 0 61.9 2.5 70.2 3.6V85h-48.2c-37.8 0-45.1 18-45.1 44.3V192H256l-11.7 91h-73.6v229"})),s.whatsapp=React.createElement("svg",{"aria-hidden":"true",focusable:"false",preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 1536 1600"},React.createElement("path",{d:"M985 878q13 0 97.5 44t89.5 53q2 5 2 15q0 33-17 76q-16 39-71 65.5T984 1158q-57 0-190-62q-98-45-170-118T476 793q-72-107-71-194v-8q3-91 74-158q24-22 52-22q6 0 18 1.5t19 1.5q19 0 26.5 6.5T610 448q8 20 33 88t25 75q0 21-34.5 57.5T599 715q0 7 5 15q34 73 102 137q56 53 151 101q12 7 22 7q15 0 54-48.5t52-48.5zm-203 530q127 0 243.5-50t200.5-134t134-200.5t50-243.5t-50-243.5T1226 336t-200.5-134T782 152t-243.5 50T338 336T204 536.5T154 780q0 203 120 368l-79 233l242-77q158 104 345 104zm0-1382q153 0 292.5 60T1315 247t161 240.5t60 292.5t-60 292.5t-161 240.5t-240.5 161t-292.5 60q-195 0-365-94L0 1574l136-405Q28 991 28 780q0-153 60-292.5T249 247T489.5 86T782 26z",fill:"currentColor"})),s.pinterest=React.createElement("svg",{"aria-hidden":"true","data-prefix":"fab","data-icon":"pinterest-p",class:"svg-inline--fa fa-pinterest-p fa-w-12",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 384 512"},React.createElement("path",{fill:"currentColor",d:"M204 6.5C101.4 6.5 0 74.9 0 185.6 0 256 39.6 296 63.6 296c9.9 0 15.6-27.6 15.6-35.4 0-9.3-23.7-29.1-23.7-67.8 0-80.4 61.2-137.4 140.4-137.4 68.1 0 118.5 38.7 118.5 109.8 0 53.1-21.3 152.7-90.3 152.7-24.9 0-46.2-18-46.2-43.8 0-37.8 26.4-74.4 26.4-113.4 0-66.2-93.9-54.2-93.9 25.8 0 16.8 2.1 35.4 9.6 50.7-13.8 59.4-42 147.9-42 209.1 0 18.9 2.7 37.5 4.5 56.4 3.4 3.8 1.7 3.4 6.9 1.5 50.4-69 48.6-82.5 71.4-172.8 12.3 23.4 44.1 36 69.3 36 106.2 0 153.9-103.5 153.9-196.8C384 71.3 298.2 6.5 204 6.5z"})),s.linkedin=React.createElement("svg",{"aria-hidden":"true",focusable:"false","data-prefix":"fab","data-icon":"linkedin-in",class:"svg-inline--fa fa-linkedin-in fa-w-14",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512"},React.createElement("path",{fill:"currentColor",d:"M100.28 448H7.4V148.9h92.88zM53.79 108.1C24.09 108.1 0 83.5 0 53.8a53.79 53.79 0 0 1 107.58 0c0 29.7-24.1 54.3-53.79 54.3zM447.9 448h-92.68V302.4c0-34.7-.7-79.2-48.29-79.2-48.29 0-55.69 37.7-55.69 76.7V448h-92.78V148.9h89.08v40.8h1.3c12.4-23.5 42.69-48.3 87.88-48.3 94 0 111.28 61.9 111.28 142.3V448z"})),s.email=React.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},React.createElement("path",{d:"M0 3v18h24v-18h-24zm6.623 7.929l-4.623 5.712v-9.458l4.623 3.746zm-4.141-5.929h19.035l-9.517 7.713-9.518-7.713zm5.694 7.188l3.824 3.099 3.83-3.104 5.612 6.817h-18.779l5.513-6.812zm9.208-1.264l4.616-3.741v9.348l-4.616-5.607z",fill:"currentColor"}));const d=s,u=window.wp.blocks;new class{constructor(){this.registerBlock()}registerBlock(){this.blockName="modula/link",this.blockAttributes={id:{type:"number",default:0},textAlignment:{type:"string"},buttonText:{type:"string"},fontSize:{type:"number",default:16},buttonSize:{type:"string",default:"modula-link-button-small"},buttonTextColor:{type:"object",default:"#fff"},buttonBackgroundColor:{type:"object",default:"#007cba"},buttonHoverTextColor:{type:"object",default:"#fff"},buttonHoverBackgroundColor:{type:"object",default:"#006ba1"},borderWidth:{type:"number",default:0},borderRadius:{type:"number",default:0},borderColor:{type:"object",default:"transparent"},borderType:{type:"string",default:"solid"}},(0,u.registerBlockType)(this.blockName,{title:modulaLinkVars.gutenbergLinkTitle,icon:d.modula,description:(0,t.__)("Make your galleries stand out.","modula-pro"),keywords:[(0,t.__)("gallery"),(0,t.__)("modula"),(0,t.__)("link")],category:"common",supports:{align:["wide","full"],customClassName:!1},attributes:this.blockAttributes,edit:i,save:()=>null})}}})();