File: /home/dtptviut/domains/teleweb.dk/public_html/wp-content/plugins/wp-seopress/public/admin/header.js
(()=>{"use strict";var e={n:t=>{var a=t&&t.__esModule?()=>t.default:()=>t;return e.d(a,{a}),a},d:(t,a)=>{for(var n in a)e.o(a,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:a[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),p:"/public/"};const t=window.wp.element,a=window.wp.i18n,n=window.wp.components,s=e=>React.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24","aria-hidden":"true",focusable:"false"},React.createElement("path",{d:e,fill:"currentColor"})),r=(s("M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"),s("M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.061L12 10.939 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z")),o=(s("M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6.9 1.2z"),s("M12 2l2.6 7.6H22l-6.2 4.5L18.2 22 12 17.3 5.8 22l2.4-7.9L2 9.6h7.4z"),s("M19.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7zm-13 14h11v-7H16v5.5H8V8h5.5V6.5h-7v12z"),s("M12 4.75a7.25 7.25 0 100 14.5 7.25 7.25 0 000-14.5zM3.25 12a8.75 8.75 0 1117.5 0 8.75 8.75 0 01-17.5 0zM12 8.75a1.5 1.5 0 01.167 2.99c-.465.052-.917.44-.917.96V14h1.5v-.845A3 3 0 109 9.25h1.5a1.5 1.5 0 011.5-1.5zM11.25 15v1.5h1.5V15h-1.5z")),l=s("M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zM5.5 10.5V18a.5.5 0 00.5.5h4v-8H5.5zm6 0v8H18a.5.5 0 00.5-.5v-7.5h-7zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"),i=s("M12 22a2 2 0 002-2h-4a2 2 0 002 2zm6.4-6V11a6.4 6.4 0 00-5-6.24V4a1.4 1.4 0 10-2.8 0v.76A6.4 6.4 0 005.6 11v5l-2 2v1h16.8v-1z"),c=window.SEOPRESS_HEADER_DATA||{},d=c.HELP||{},p=window.wp.apiFetch;var m=e.n(p);const u=(window.SEOPRESS_HEADER_DATA||{}).DISPLAY||{toggles:[]},_=(window.SEOPRESS_HEADER_DATA||{}).NOTIFICATIONS||{total:0,activeItems:[],hiddenItems:[]};window.SEOPRESS_DISMISSED_NOTICE_IDS||(window.SEOPRESS_DISMISSED_NOTICE_IDS=new Set);const h=window.SEOPRESS_DISMISSED_NOTICE_IDS,E=e=>{const t=document.createElement("template");return t.innerHTML=e,t.content.querySelectorAll("button[data-notice]").forEach((e=>e.remove())),t.content.querySelectorAll(".seopress-alert-actions").forEach((e=>{0===e.children.length&&""===e.textContent.trim()&&e.remove()})),t.innerHTML},w=()=>window.innerWidth<=782?46:32,f={help:()=>(0,a.__)("Documentation","wp-seopress"),display:()=>(0,a.__)("Choose the way it looks","wp-seopress"),notifications:()=>(0,a.__)("Notifications","wp-seopress")},R={help:()=>{const[e,s]=(0,t.useState)("");return c.HELP?React.createElement("div",{className:"seopress-admin-header-help"},d.searchUrl&&React.createElement("form",{className:"seopress-admin-header-help__search",onSubmit:t=>{t.preventDefault();const a=-1===d.searchUrl.indexOf("?")?"?":"&";window.open(`${d.searchUrl}${a}s=${encodeURIComponent(e)}`,"_blank","noopener,noreferrer")}},React.createElement(n.Flex,{align:"center",gap:2},React.createElement(n.FlexBlock,null,React.createElement(n.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,type:"search",label:(0,a.__)("Search our documentation","wp-seopress"),hideLabelFromVision:!0,placeholder:(0,a.__)("Search our documentation","wp-seopress"),value:e,onChange:s,maxLength:150})),React.createElement(n.FlexItem,null,React.createElement(n.Button,{__next40pxDefaultSize:!0,variant:"secondary",type:"submit"},(0,a.__)("Search","wp-seopress"))))),d.guides&&d.guides.length>0&&React.createElement("section",{className:"seopress-admin-header-help__section"},React.createElement("h3",null,(0,a.__)("Get started guides","wp-seopress")),React.createElement("ul",{className:"seopress-admin-header-help__guides"},d.guides.map((e=>React.createElement("li",{key:e.link},React.createElement("a",{href:e.link,target:"_blank",rel:"noopener noreferrer"},e.iconUrl&&React.createElement("img",{src:e.iconUrl,width:40,height:40,alt:""}),React.createElement("span",null,React.createElement("strong",null,e.title),React.createElement("small",null,e.desc)),React.createElement("span",{className:"screen-reader-text"},(0,a.__)("(opens in a new tab)","wp-seopress")))))))),d.products&&d.products.length>0&&React.createElement("section",{className:"seopress-admin-header-help__section"},React.createElement("h3",null,(0,a.__)("By product","wp-seopress")),React.createElement("p",null,(0,a.__)("Quickly filter our documentation by a specific plugin.","wp-seopress")),React.createElement("div",{className:"seopress-admin-header-help__products"},d.products.map((e=>e.url?React.createElement("a",{key:e.label,href:e.url,target:"_blank",rel:"noopener noreferrer",title:e.label,"aria-label":(0,a.sprintf)((0,a.__)("%s documentation (opens in a new tab)","wp-seopress"),e.label)},React.createElement("img",{src:e.logoUrl,alt:""})):null)))),d.translationsUrl&&React.createElement("section",{className:"seopress-admin-header-help__section"},React.createElement("h3",null,(0,a.__)("Translations","wp-seopress")),React.createElement("p",null,(0,a.__)("The plugin is translated into dozens of languages.","wp-seopress")),React.createElement("p",null,(0,t.createInterpolateElement)((0,a.__)("Go to <a>Updates</a> and click <strong>Update translations</strong> to get the latest available translations for your language.","wp-seopress"),{a:React.createElement("a",{href:d.updatesUrl}),strong:React.createElement("strong",null)})),React.createElement(n.ExternalLink,{href:d.translationsUrl},(0,a.__)("Translate SEOPress","wp-seopress"))),d.supportUrl&&React.createElement("section",{className:"seopress-admin-header-help__section"},React.createElement("h3",null,(0,a.__)("Open a support ticket","wp-seopress")),React.createElement("p",null,(0,a.__)("Can't find the info you're looking for?","wp-seopress")),React.createElement(n.Button,{variant:"primary",href:d.supportUrl,target:"_blank",rel:"noopener noreferrer"},(0,a.__)("Open a support ticket","wp-seopress"),React.createElement("span",{className:"screen-reader-text"}," ",(0,a.__)("(opens in a new tab)","wp-seopress"))))):null},display:()=>{const[e,s]=(0,t.useState)(u.toggles||[]),[r,o]=(0,t.useState)({}),[l,i]=(0,t.useState)(null),[c,d]=(0,t.useState)("");return e.length?React.createElement("div",{className:"seopress-admin-header-display"},React.createElement("h3",null,(0,a.__)("Show / Hide your dashboard blocks:","wp-seopress")),React.createElement(n.VisuallyHidden,{as:"div","aria-live":"polite",role:"status"},c),l&&React.createElement(n.Notice,{status:"error",isDismissible:!0,onRemove:()=>i(null)},l),React.createElement("ul",{className:"seopress-admin-header-display__list"},e.map((t=>React.createElement("li",{key:t.key},React.createElement(n.ToggleControl,{__nextHasNoMarginBottom:!0,label:t.label,checked:Boolean(t.checked),disabled:Boolean(r[t.key]),onChange:n=>(async(t,n)=>{o((e=>({...e,[t]:!0}))),i(null);const r=e;s((e=>e.map((e=>e.key===t?{...e,checked:n}:e))));try{await m()({path:"/seopress/v1/dashboard/display-preference",method:"POST",data:{key:t,value:n}}),window.dispatchEvent(new CustomEvent("seopress:display-preference-changed",{detail:{key:t,value:n}})),d((0,a.__)("Preference saved.","wp-seopress"))}catch(e){s(r),i(e&&e.message?e.message:(0,a.__)("Unable to save your preference. Please try again.","wp-seopress"))}finally{o((e=>{const a={...e};return delete a[t],a}))}})(t.key,n)})))))):React.createElement("p",{className:"seopress-admin-header-panel__placeholder"},(0,a.__)("Display preferences are only available on the dashboard.","wp-seopress"))},notifications:()=>{const{total:e,activeItems:s,hiddenItems:r,emptyIconUrl:o,hiddenIconUrl:l,hideNonce:i,ajaxUrl:c}=_,[d,p]=(0,t.useState)(!1),[m,u]=(0,t.useState)((()=>Array.from(h))),w=s||[],f=r||[],R=e=>`id="${e}-alert"`,v=w.filter((e=>!(e=>m.some((t=>-1!==e.indexOf(R(t)))))(e))),S=[...m.filter((e=>!((e,t)=>e.some((e=>-1!==e.indexOf(R(t)))))(f,e))).map((e=>w.find((t=>-1!==t.indexOf(R(e)))))).filter(Boolean).map(E),...f],g=Math.max(0,(e||0)-m.length),y=(0,t.useCallback)((e=>{const t=e.target.closest("button[data-notice]");if(!t)return;e.preventDefault();const a=t.getAttribute("data-notice");if(a&&!h.has(a)&&(h.add(a),u((e=>e.includes(a)?e:[...e,a])),window.dispatchEvent(new CustomEvent("seopress:notification-dismissed",{detail:{id:a}})),window.dispatchEvent(new CustomEvent("seopress:notifications-count",{detail:{delta:-1}})),c)){const e=new FormData;e.append("action","seopress_hide_notices"),e.append("notice",a),e.append("notice_value","1"),e.append("_ajax_nonce",i||""),fetch(c,{method:"POST",body:e,credentials:"same-origin"}).catch((()=>{}))}}),[c,i]);(0,t.useEffect)((()=>{const e=e=>{const t=e.detail&&e.detail.id;t&&(h.add(t),u((e=>e.includes(t)?e:[...e,t])))};return window.addEventListener("seopress:notification-dismissed",e),()=>window.removeEventListener("seopress:notification-dismissed",e)}),[]);const b=!g||0===g;return React.createElement("div",{className:"seopress-admin-header-notifications"},React.createElement("p",{className:"seopress-admin-header-notifications__count"},(0,a.sprintf)((0,a._n)("%d notification","%d notifications",g,"wp-seopress"),g)),!b&&v&&v.length>0&&React.createElement("ul",{className:"seopress-admin-header-notifications__list",onClick:y},v.map(((e,t)=>React.createElement("li",{key:t,dangerouslySetInnerHTML:{__html:e}})))),b&&React.createElement("div",{className:"seopress-admin-header-notifications__empty"},o&&React.createElement("img",{src:o,width:56,height:56,alt:""}),React.createElement("h3",null,(0,a.__)("You don't have any notifications yet!","wp-seopress"))),S&&S.length>0&&React.createElement("div",{className:"seopress-admin-header-notifications__hidden"},React.createElement(n.Button,{variant:"tertiary",onClick:()=>p((e=>!e)),"aria-expanded":d},l&&React.createElement("img",{src:l,width:20,height:20,alt:""}),(0,a.sprintf)((0,a._n)("Hidden notification (%d)","Hidden notifications (%d)",S.length,"wp-seopress"),S.length)),d&&React.createElement("ul",{className:"seopress-admin-header-notifications__list"},S.map(((e,t)=>React.createElement("li",{key:t,dangerouslySetInnerHTML:{__html:e}}))))))}},v=({openPanel:e,onClose:s})=>{const o=(0,t.useRef)(null),l=(0,t.useRef)(null),i=Boolean(e),[c,d]=(0,t.useState)(w());(0,t.useEffect)((()=>{const e=document.getElementById("seopress-header-wrapper"),t=()=>{const t=w();if(!e)return void d(t);const a=e.getBoundingClientRect();d(Math.max(t,Math.round(a.bottom)))};t(),window.addEventListener("resize",t),window.addEventListener("scroll",t,{passive:!0});let a=null;return"undefined"!=typeof ResizeObserver&&e&&(a=new ResizeObserver(t),a.observe(e)),()=>{window.removeEventListener("resize",t),window.removeEventListener("scroll",t),a&&a.disconnect()}}),[]),(0,t.useEffect)((()=>{if(!i)return;const e=e=>{"Escape"===e.key&&s()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)}),[i,s]),(0,t.useEffect)((()=>{if(!i)return;const e=e=>{!o.current||o.current.contains(e.target)||e.target.closest(".seopress-admin-header__action")||s()};return window.addEventListener("mousedown",e),()=>window.removeEventListener("mousedown",e)}),[i,s]),(0,t.useEffect)((()=>{if(i)return void(l.current=document.activeElement);const e=l.current;e&&"function"==typeof e.focus&&o.current&&!o.current.contains(document.activeElement)||e&&"function"==typeof e.focus&&e.focus(),l.current=null}),[i]);const p=e&&f[e]?f[e]():"",m=e?R[e]:null;return React.createElement("aside",{ref:o,id:"seopress-admin-header-panel",className:"seopress-admin-header-panel"+(i?" is-open":""),role:"dialog","aria-modal":"false","aria-hidden":!i,"aria-label":p,inert:i?void 0:"",style:{"--seopress-panel-top":`${c}px`}},React.createElement("header",{className:"seopress-admin-header-panel__head"},React.createElement("h2",{className:"seopress-admin-header-panel__title"},p),React.createElement(n.Button,{icon:r,iconSize:24,label:(0,a.__)("Close panel","wp-seopress"),onClick:s,className:"seopress-admin-header-panel__close"})),React.createElement("div",{className:"seopress-admin-header-panel__body"},m?React.createElement(m,null):null))},S=(window.SEOPRESS_HEADER_DATA||{}).TOP_BANNER||null,g=()=>{const[e,s]=(0,t.useState)(!1);if((0,t.useEffect)((()=>{if(S&&!e)return document.body.classList.add("has-promo-banner"),()=>document.body.classList.remove("has-promo-banner")}),[e]),!S||e)return null;const{id:o,icon:l,title:i,body:c,ctaUrl:d,ctaText:p,buttonStyle:m,dismissible:u,dismissDuration:_,dismissNonce:h,ajaxUrl:E}=S;return React.createElement("div",{id:"seopress-promo-banner",className:"seopress-promo-banner","data-promo-id":o},React.createElement("div",{className:"seopress-promo-banner__content"},l&&React.createElement("span",{className:`seopress-promo-banner__icon dashicons dashicons-${l}`,"aria-hidden":"true"}),i&&React.createElement("strong",{className:"seopress-promo-banner__title"},i),c&&React.createElement("span",{className:"seopress-promo-banner__body"},c),d&&p&&React.createElement("a",{href:d,target:"_blank",rel:"noopener noreferrer",className:"seopress-promo-banner__cta","data-button-style":m||"primary"},p)),u&&React.createElement(n.Button,{icon:r,iconSize:24,label:(0,a.__)("Dismiss","wp-seopress"),onClick:()=>{if(s(!0),!E||!o)return;const e=new FormData;e.append("action","seopress_dismiss_promotion"),e.append("promo_id",o),e.append("duration",String(_||30)),e.append("_ajax_nonce",h||""),fetch(E,{method:"POST",credentials:"same-origin",body:e}).catch((()=>{}))},className:"seopress-promo-banner__dismiss"}))},y=window.SEOPRESS_HEADER_DATA||{},b=y.BREADCRUMB||{},N=Math.max(0,parseInt(y.NOTIFICATIONS&&y.NOTIFICATIONS.total,10)||0),D=["help","display","notifications"],L=()=>{const[e,s]=(0,t.useState)(null),[r,c]=(0,t.useState)(N),[d,p]=(0,t.useState)(""),m=(0,t.useRef)(!1),u=e=>{s((t=>t===e?null:e))};return(0,t.useEffect)((()=>{const e=e=>{const t=e.detail&&e.detail.panel;"string"==typeof t&&D.includes(t)&&s(t)};return window.addEventListener("seopress:open-activity-panel",e),()=>window.removeEventListener("seopress:open-activity-panel",e)}),[]),(0,t.useEffect)((()=>{const e=e=>{const t=e.detail||{};c((e=>"number"==typeof t.total?Math.max(0,t.total):"number"==typeof t.delta?Math.max(0,e+t.delta):e))};return window.addEventListener("seopress:notifications-count",e),()=>window.removeEventListener("seopress:notifications-count",e)}),[]),(0,t.useEffect)((()=>{m.current?p((0,a.sprintf)((0,a._n)("%d notification remaining","%d notifications remaining",r,"wp-seopress"),r)):m.current=!0}),[r]),React.createElement(React.Fragment,null,React.createElement(g,null),React.createElement("div",{className:"seopress-admin-header"},React.createElement("nav",{className:"seopress-admin-header__breadcrumb","aria-label":(0,a.__)("Breadcrumb","wp-seopress")},React.createElement("ol",null,React.createElement("li",null,React.createElement("a",{href:b.rootUrl},b.rootLabel)),b.currentPage&&React.createElement("li",{"aria-current":"page"},b.currentPage))),React.createElement("div",{className:"seopress-admin-header__actions",role:"toolbar","aria-label":(0,a.__)("Activity panel","wp-seopress")},y.IS_DASHBOARD&&React.createElement(n.Button,{icon:l,iconSize:24,label:(0,a.__)("Display","wp-seopress"),showTooltip:!0,className:"seopress-admin-header__action"+("display"===e?" is-active":""),"aria-expanded":"display"===e,"aria-controls":"seopress-admin-header-panel",onClick:()=>u("display")}),y.HELP&&React.createElement(n.Button,{icon:o,iconSize:24,label:(0,a.__)("Help","wp-seopress"),showTooltip:!0,className:"seopress-admin-header__action"+("help"===e?" is-active":""),"aria-expanded":"help"===e,"aria-controls":"seopress-admin-header-panel",onClick:()=>u("help")}),React.createElement(n.Button,{icon:i,iconSize:24,label:r>0?(0,a.sprintf)((0,a._n)("Notifications, %d pending","Notifications, %d pending",r,"wp-seopress"),r):(0,a.__)("Notifications","wp-seopress"),showTooltip:!0,className:"seopress-admin-header__action seopress-admin-header__action--notifications"+("notifications"===e?" is-active":""),"aria-expanded":"notifications"===e,"aria-controls":"seopress-admin-header-panel",onClick:()=>u("notifications")},r>0&&React.createElement("span",{className:"seopress-admin-header__badge","aria-hidden":"true"},r>99?"99+":r)))),React.createElement(v,{openPanel:e,onClose:()=>s(null)}),React.createElement(n.VisuallyHidden,{as:"div",role:"status","aria-live":"polite"},d))};"undefined"!=typeof SEOPRESS_HEADER_DATA&&SEOPRESS_HEADER_DATA.ASSETS_URL&&(e.p=SEOPRESS_HEADER_DATA.ASSETS_URL+"/"),document.addEventListener("DOMContentLoaded",(()=>{const e=document.getElementById("seopress-admin-header-root");e&&(0,t.createRoot)(e).render(React.createElement(L,null))}))})();