(()=>{"use strict";var t,e={944(t,e,o){const a=window.wp.apiFetch,n=t=>Math.max(0,Math.min(1,t)),r=t=>Math.max(0,Math.min(1,t));!function(t){const e=()=>{document&&document.body&&document.querySelectorAll(".moap-focal-point:not([data-moap-ready])").forEach(e=>function(t,e){if(t.dataset.moapReady)return;t.dataset.moapReady="1";const o=t.querySelector(".moap-focal-point__image"),a=t.querySelector(".moap-focal-point__stage")||o,i=t.querySelector(".moap-focal-point__marker"),c=t.querySelector(".moap-focal-point__save"),l=t.querySelector(".moap-focal-point__status"),d=parseInt(t.dataset.attachmentId,10);let s=function(t){const e=parseFloat(t.dataset.x),o=parseFloat(t.dataset.y);return{x:Number.isFinite(e)?r(e):.5,y:Number.isFinite(o)?r(o):.5}}(t),u={...s};const p=()=>{const t=function(t){return{left:`${Math.round(100*t.x)}%`,top:`${Math.round(100*t.y)}%`}}(s);i.style.left=t.left,i.style.top=t.top},f=()=>{c&&(c.hidden=!(s.x!==u.x||s.y!==u.y),c.disabled=!1)};p(),f(),a.addEventListener("click",t=>{const e=o.getBoundingClientRect();s=function(t,e,o){return{x:n((t-o.left)/o.width),y:n((e-o.top)/o.height)}}(t.clientX,t.clientY,e),p(),f(),l&&(l.textContent="")}),c&&c.addEventListener("click",async()=>{c.disabled=!0,l&&(l.textContent="");try{await function(t,e,o){const a=window.moapFocalPoint.metaKey;return t({path:`/wp/v2/media/${e}`,method:"POST",data:{meta:{[a]:o}}})}(e.apiFetch,d,s),u={...s},l&&(l.textContent="Saved")}catch(t){l&&(l.textContent="Save failed")}f()})}(e,t))};e(),new MutationObserver(e).observe(document.body,{childList:!0,subtree:!0})}({apiFetch:o.n(a)()})}},o={};function a(t){var n=o[t];if(void 0!==n)return n.exports;var r=o[t]={exports:{}};return e[t](r,r.exports,a),r.exports}a.m=e,t=[],a.O=(e,o,n,r)=>{if(!o){var i=1/0;for(s=0;s<t.length;s++){for(var[o,n,r]=t[s],c=!0,l=0;l<o.length;l++)(!1&r||i>=r)&&Object.keys(a.O).every(t=>a.O[t](o[l]))?o.splice(l--,1):(c=!1,r<i&&(i=r));if(c){t.splice(s--,1);var d=n();void 0!==d&&(e=d)}}return e}r=r||0;for(var s=t.length;s>0&&t[s-1][2]>r;s--)t[s]=t[s-1];t[s]=[o,n,r]},a.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return a.d(e,{a:e}),e},a.d=(t,e)=>{for(var o in e)a.o(e,o)&&!a.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},a.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{var t={57:0,350:0};a.O.j=e=>0===t[e];var e=(e,o)=>{var n,r,[i,c,l]=o,d=0;if(i.some(e=>0!==t[e])){for(n in c)a.o(c,n)&&(a.m[n]=c[n]);if(l)var s=l(a)}for(e&&e(o);d<i.length;d++)r=i[d],a.o(t,r)&&t[r]&&t[r][0](),t[r]=0;return a.O(s)},o=globalThis.webpackChunkmedia_on_autopilot=globalThis.webpackChunkmedia_on_autopilot||[];o.forEach(e.bind(null,0)),o.push=e.bind(null,o.push.bind(o))})();var n=a.O(void 0,[350],()=>a(944));n=a.O(n)})();