[Back] (()=>{"use strict";var e={n:t=>{var o=t&&t.__esModule?()=>t.default:()=>t;return e.d(o,{a:o}),o},d:(t,o)=>{for(var n in o)e.o(o,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:o[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.jQuery;var o=e.n(t);const n=window.wp.components,i=window.wp.compose,a=window.wp.data,r=window.wp.editor,s=window.wp.element,l=window.wp.i18n,d=window.wp.plugins,p=window.ReactJSXRuntime,{ajaxurl:c,VPGutenbergMetaVariables:u}=window;class m extends s.Component{constructor(e){var t,o,n,i,a,r,s,l;super(e),this.state={oembedQuery:"",oembedHTML:""},this.maybePrepareOembed=(t=300,a=this.maybePrepareOembed.bind(this),r=[],s=null,l=function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];r=t,s||(s=requestAnimationFrame((function(){s=null,a.apply(void 0,r)})))},l.cancel=function(){s&&(cancelAnimationFrame(s),s=null)},o=l,i=(n||{}).atBegin,function(e,t,o){var n,i=o||{},a=i.noTrailing,r=void 0!==a&&a,s=i.noLeading,l=void 0!==s&&s,d=i.debounceMode,p=void 0===d?void 0:d,c=!1,u=0;function m(){n&&clearTimeout(n)}function h(){for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];var s=this,d=Date.now()-u;function h(){u=Date.now(),t.apply(s,i)}function _(){n=void 0}c||(l||!p||n||h(),m(),void 0===p&&d>e?l?(u=Date.now(),r||(n=setTimeout(p?_:h,e))):h():!0!==r&&(n=setTimeout(p?_:h,void 0===p?e-d:e)))}return h.cancel=function(e){var t=(e||{}).upcomingOnly,o=void 0!==t&&t;m(),c=!o},h}(t,o,{debounceMode:!1!==(void 0!==i&&i)}))}componentDidMount(){this.maybePrepareOembed()}componentDidUpdate(){this.maybePrepareOembed()}maybePrepareOembed(){const{oembedQuery:e,oembedHTML:t}=this.state,{getMeta:n,postFormat:i}=this.props;if("video"!==i)return;const a=n("_vp_format_video_url");e!==a&&(this.oembedAjax&&this.oembedAjax.abort&&this.oembedAjax.abort(),e||!t?this.oembedAjax=o().ajax({url:c,method:"POST",dataType:"json",data:{action:"vp_find_oembed",q:a,nonce:u.nonce},complete:e=>{const t=e.responseJSON,o={oembedQuery:a,oembedHTML:""};t&&void 0!==t.html&&(o.oembedHTML=t.html),this.setState(o),this.oembedAjax=null}}):this.setState({oembedHTML:""}))}render(){const{getMeta:e,postFormat:t,updateMeta:o}=this.props,{oembedHTML:i}=this.state;return"video"!==t?null:(0,p.jsxs)(r.PluginDocumentSettingPanel,{name:"VPVideo",title:(0,l.__)("Video","visual-portfolio"),icon:(0,p.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,p.jsx)("path",{d:"M19.25 10C19.25 15.1086 15.1086 19.25 10 19.25C4.89137 19.25 0.75 15.1086 0.75 10C0.75 4.89137 4.89137 0.75 10 0.75C15.1086 0.75 19.25 4.89137 19.25 10Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"transparent"}),(0,p.jsx)("path",{d:"M8 12.6326V7.36671C8.00011 7.30082 8.01856 7.23618 8.05342 7.17955C8.08828 7.12293 8.13826 7.0764 8.19812 7.04485C8.25798 7.0133 8.32552 6.99789 8.39367 7.00023C8.46181 7.00257 8.52805 7.02258 8.58544 7.05816L12.8249 9.69035C12.8786 9.72358 12.9228 9.76933 12.9534 9.82337C12.984 9.87742 13 9.93803 13 9.99963C13 10.0612 12.984 10.1218 12.9534 10.1759C12.9228 10.2299 12.8786 10.2757 12.8249 10.3089L8.58544 12.9418C8.52805 12.9774 8.46181 12.9974 8.39367 12.9998C8.32552 13.0021 8.25798 12.9867 8.19812 12.9551C8.13826 12.9236 8.08828 12.8771 8.05342 12.8204C8.01856 12.7638 8.00011 12.6992 8 12.6333V12.6326Z",fill:"currentColor"})]}),className:"vpf-meta-video-panel",children:[(0,p.jsx)(n.PanelRow,{children:(0,p.jsxs)("p",{className:"description",children:[(0,l.sprintf)((0,l.__)("Video will be used in %s layouts only. Full list of supported links","visual-portfolio"),u.plugin_name)," ",(0,p.jsx)("a",{href:"https://visualportfolio.co/docs/projects/project-formats/#supported-video-platforms",target:"_blank",rel:"noopener noreferrer",children:(0,l.__)("see here","visual-portfolio")})]})}),(0,p.jsx)(n.PanelRow,{children:(0,p.jsx)(n.TextControl,{label:(0,l.__)("Video URL","visual-portfolio"),value:e("_vp_format_video_url")||"",onChange:e=>{o("_vp_format_video_url",e)},type:"url",placeholder:"https://",__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0})}),(0,p.jsx)(n.PanelRow,{children:(0,p.jsx)("div",{className:"vp-oembed-preview",dangerouslySetInnerHTML:{__html:i}})})]})}}const h=(0,i.compose)([(0,a.withSelect)((e=>({getMeta:t=>(e("core/editor").getEditedPostAttribute("meta")||{})[t],postFormat:e("core/editor").getEditedPostAttribute("format")}))),(0,a.withDispatch)((e=>({updateMeta(t,o){e("core/editor").editPost({meta:{[t]:o}})}}))),i.withInstanceId])(m);wp.editPost&&(0,d.registerPlugin)("vp-video",{render:h});const _=window.wp.hooks,v=n.UnitControl||n.__experimentalUnitControl;class w extends s.Component{render(){const{getMeta:e,featuredImageId:t,updateMeta:o}=this.props;if(!t)return null;let i=e("_vp_image_focal_point");return i&&i.x&&i.y||(i={x:.5,y:.5}),(0,p.jsxs)("div",{className:"vpf-post-image-focal-point-panel",children:[(0,p.jsx)(n.PanelRow,{children:(0,p.jsx)("p",{className:"description",children:(0,l.__)("Focal point will be used in Visual Portfolio layouts only:","visual-portfolio")})}),(0,p.jsxs)(n.PanelRow,{children:[(0,p.jsx)(v,{label:(0,l.__)("Left","visual-portfolio"),value:100*i.x+"%",onChange:e=>{const t={...i};t.x=parseFloat(e)/100,o("_vp_image_focal_point",t)},min:0,max:100,step:1,units:[{value:"%",label:"%"}],__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0}),(0,p.jsx)(v,{label:(0,l.__)("Top","visual-portfolio"),value:100*i.y+"%",onChange:e=>{const t={...i};t.y=parseFloat(e)/100,o("_vp_image_focal_point",t)},min:0,max:100,step:1,units:[{value:"%",label:"%"}],__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0})]})]})}}const f=(0,i.compose)([(0,a.withSelect)((e=>{const{getEditedPostAttribute:t}=e("core/editor"),o=t("featured_media"),n=t("meta")||{};return{featuredImageId:o,getMeta:e=>n[e]}})),(0,a.withDispatch)((e=>({updateMeta(t,o){e("core/editor").editPost({meta:{[t]:o}})}}))),i.withInstanceId])(w);(0,_.addFilter)("editor.PostFeaturedImage","vpf/post-featured-image-focal-point",(e=>function(t){return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(e,{...t}),(0,p.jsx)(f,{})]})}))})();