(()=>{"use strict";const e=window.wp.element,t=window.wp.components,o=window.wp.data,r=window.ReactJSXRuntime,n=()=>{const{featuredImageId:e,featuredImageUrl:n,focalPoint:i}=(0,o.useSelect)(e=>{const t=e("core/editor").getEditedPostAttribute("featured_media"),o=t?e("core").getMedia(t):null,r=e("core/editor").getEditedPostAttribute("meta");return{featuredImageId:t,featuredImageUrl:o?.source_url||null,focalPoint:r?.thumbnail_focal_point||{x:.5,y:.5}}}),{editPost:d}=(0,o.useDispatch)("core/editor");return e&&n?(0,r.jsxs)("div",{style:{marginTop:"16px",paddingTop:"16px",borderTop:"1px solid #ddd"},children:[(0,r.jsx)("div",{style:{marginBottom:"12px"},children:(0,r.jsx)("strong",{style:{fontSize:"13px",color:"#1e1e1e"},children:"Point focal de recadrage"})}),(0,r.jsx)("p",{style:{marginBottom:"12px",fontSize:"13px",color:"#757575"},children:"Cliquez sur l'image pour définir le point focal utilisé lors du recadrage automatique."}),(0,r.jsx)(t.FocalPointPicker,{url:n,value:i,onChange:e=>{d({meta:{thumbnail_focal_point:e}})}}),(0,r.jsxs)("p",{style:{marginTop:"12px",fontSize:"12px",color:"#757575"},children:["Position :"," ",(0,r.jsxs)("strong",{style:{color:"#2271b1"},children:[Math.round(100*i.x),"% / ",Math.round(100*i.y),"%"]})]})]}):null};function i(){const t=document.querySelector('.editor-post-featured-image, [aria-label="Featured image"]');if(!t)return!1;if(!t.querySelector("img"))return!1;let o=document.getElementById("gutenberg-focal-point-inline-root");return o||(o=document.createElement("div"),o.id="gutenberg-focal-point-inline-root",t.appendChild(o)),(0,e.render)((0,r.jsx)(n,{}),o),!0}const d=new MutationObserver(()=>{i()});window.addEventListener("DOMContentLoaded",()=>{setTimeout(()=>{i()&&document.querySelector(".editor-styles-wrapper, .edit-post-visual-editor")&&d.observe(document.body,{childList:!0,subtree:!0})},500)});let l=0;const a=setInterval(()=>{(i()||l>10)&&clearInterval(a),l++},500)})();