(()=>{var e,t={7513(e,t,o){"use strict";o.r(t),o.d(t,{initPage:()=>C});const n=window.ReactJSXRuntime,s=window.wp.element;function i(e,t){t&&(s.createRoot?(0,s.createRoot)(t).render(e):(0,s.render)(e,t))}const a=window.wp.domReady,l=o.n(a)(),r=window.NelioContent.components,c=window.wp.components;Object.assign(e=>(0,n.jsx)(c.BaseControl,Object.assign({__nextHasNoMarginBottom:!0},e)),c.BaseControl),Object.assign(e=>(0,n.jsx)(c.CheckboxControl,Object.assign({__nextHasNoMarginBottom:!0},e)),c.CheckboxControl),Object.assign(e=>(0,n.jsx)(c.FormTokenField,Object.assign({__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0},e)),c.FormTokenField),Object.assign(e=>(0,n.jsx)(c.RangeControl,Object.assign({__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0},e)),c.RangeControl),Object.assign(e=>(0,n.jsx)(c.TextControl,Object.assign({__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0},e)),c.TextControl),Object.assign(e=>(0,n.jsx)(c.TextareaControl,Object.assign({__nextHasNoMarginBottom:!0},e)),c.TextareaControl),Object.assign(e=>(0,n.jsx)(c.ToggleControl,Object.assign({__nextHasNoMarginBottom:!0},e)),c.ToggleControl);const d=window.wp.data;function u(e,t){return(0,d.useSelect)(e,t)}const g=window.wp.i18n,m=window.NelioContent.data,p=window.NelioContent.socialMessageEditor,x=window.NelioContent.socialTimeline,f=()=>(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(j,{}),(0,n.jsx)(p.SocialMessageEditor,{})]}),j=()=>{const{status:e,post:t}=h(),{setPageAttribute:o}=(0,d.useDispatch)(m.store),s=u(e=>e(m.store).getPageAttribute("post-list/social-media-details"),[]),i=()=>o("post-list/social-media-details",void 0);switch(e){case"no-post":return null;case"loading":case"not-found":return(0,n.jsx)(r.LoadingModal,{className:"nelio-content-social-timeline-modal",title:(0,g._x)("Social Timeline","text","nelio-content"),onClose:i,isLoading:"loading"===e,loadingErrorMessage:"not-found"===e?(0,g.sprintf)(/* translators: %d: Post ID. */ /* translators: %d: Post ID. */
(0,g._x)("Post %d not found.","text","nelio-content"),s):""});case"ready":return(0,n.jsx)(c.Modal,{className:"nelio-content-social-timeline-modal",title:(0,n.jsx)(b,{onClose:i}),isDismissible:!1,shouldCloseOnEsc:!1,shouldCloseOnClickOutside:!1,onRequestClose:()=>{},children:(0,n.jsx)(x.SocialTimeline,{post:t})})}},b=({onClose:e})=>(0,n.jsxs)("div",{className:"nelio-content-social-timeline-modal__custom-header",children:[(0,n.jsx)("span",{children:(0,g._x)("Social Timeline","text","nelio-content")}),(0,n.jsx)("span",{children:(0,n.jsx)("button",{type:"button",className:"components-button has-icon","aria-label":(0,g._x)("Close","command","nelio-content"),onClick:e,children:(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24","aria-hidden":"true",focusable:"false",children:(0,n.jsx)("path",{d:"M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"})})})})]}),h=()=>u(e=>{e(m.store);const t=e(m.store).getPageAttribute("post-list/social-media-details");if(!t)return{status:"no-post"};e(m.store).getPostRelatedItems(t);const{isResolving:o}=e(m.store);if(o("getPost",[t])||o("getPostRelatedItems",[t]))return{status:"loading"};const n=e(m.store).getPost(t);return n?{status:"ready",post:n}:{status:"not-found"}},[]),w=({postId:e})=>{const{setPageAttribute:t}=(0,d.useDispatch)(m.store);return(0,n.jsx)(c.Button,{className:"nelio-content-social-media-button",variant:"link",onClick:()=>t("post-list/social-media-details",e),children:(0,g._x)("Social Media","text","nelio-content")})};function C({customStatuses:e}){l(()=>{const e=Array.from(document.querySelectorAll(".nelio-content-share-post")),t=document.createElement("div");document.body.appendChild(t),i((0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(r.PremiumDialog,{}),(0,n.jsx)(f,{})]}),t),e.map(e=>[e.dataset.postId,e]).filter(e=>!!e[0]).map(([e,t])=>[Number.parseInt(e)||0,t]).filter(e=>!!e[0]).forEach(([e,t])=>i((0,n.jsx)(w,{postId:e}),t))}),function(e){jQuery(function(t){t('select[name="_status"]').each(function(){const o=t(this);e.forEach(function(e){o.append(new Option(e.name,e.slug))})})})}(e)}}},o={};function n(e){var s=o[e];if(void 0!==s)return s.exports;var i=o[e]={exports:{}};return t[e](i,i.exports,n),i.exports}n.m=t,e=[],n.O=(t,o,s,i)=>{if(!o){var a=1/0;for(d=0;d<e.length;d++){for(var[o,s,i]=e[d],l=!0,r=0;r<o.length;r++)(!1&i||a>=i)&&Object.keys(n.O).every(e=>n.O[e](o[r]))?o.splice(r--,1):(l=!1,i<a&&(a=i));if(l){e.splice(d--,1);var c=s();void 0!==c&&(t=c)}}return t}i=i||0;for(var d=e.length;d>0&&e[d-1][2]>i;d--)e[d]=e[d-1];e[d]=[o,s,i]},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e={2098:0,2287:0};n.O.j=t=>0===e[t];var t=(t,o)=>{var s,i,[a,l,r]=o,c=0;if(a.some(t=>0!==e[t])){for(s in l)n.o(l,s)&&(n.m[s]=l[s]);if(r)var d=r(n)}for(t&&t(o);c<a.length;c++)i=a[c],n.o(e,i)&&e[i]&&e[i][0](),e[i]=0;return n.O(d)},o=globalThis.webpackChunkNelioContent=globalThis.webpackChunkNelioContent||[];o.forEach(t.bind(null,0)),o.push=t.bind(null,o.push.bind(o))})();var s=n.O(void 0,[2287],()=>n(7513));s=n.O(s);var i=NelioContent="undefined"==typeof NelioContent?{}:NelioContent;for(var a in s)i[a]=s[a];s.__esModule&&Object.defineProperty(i,"__esModule",{value:!0})})();