|
1
|
|
-!function(){"use strict";var e={5251:function(e,s,t){var n=t(9196),a=60103;if(s.Fragment=60107,"function"===typeof Symbol&&Symbol.for){var r=Symbol.for;a=r("react.element"),s.Fragment=r("react.fragment")}var i=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l=Object.prototype.hasOwnProperty,o={key:!0,ref:!0,__self:!0,__source:!0};function c(e,s,t){var n,r={},c=null,u=null;for(n in void 0!==t&&(c=""+t),void 0!==s.key&&(c=""+s.key),void 0!==s.ref&&(u=s.ref),s)l.call(s,n)&&!o.hasOwnProperty(n)&&(r[n]=s[n]);if(e&&e.defaultProps)for(n in s=e.defaultProps)void 0===r[n]&&(r[n]=s[n]);return{$$typeof:a,type:e,key:c,ref:u,props:r,_owner:i.current}}s.jsx=c,s.jsxs=c},5893:function(e,s,t){e.exports=t(5251)},9196:function(e){e.exports=window.React}},s={};function t(n){var a=s[n];if(void 0!==a)return a.exports;var r=s[n]={exports:{}};return e[n](r,r.exports,t),r.exports}t.n=function(e){var s=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(s,{a:s}),s},t.d=function(e,s){for(var n in s)t.o(s,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:s[n]})},t.o=function(e,s){return Object.prototype.hasOwnProperty.call(e,s)},function(){var e=window.wp.element,s=window.wp.i18n,n=window.wp.components,a=window.wp.data,r=window.wp.notices,i=t(5893);const l=(0,e.createContext)(),o=({children:s,title:t})=>{const{createNotice:o,removeNotice:c}=(0,a.useDispatch)(r.store),{notices:u}=(0,a.useSelect)((e=>({notices:e(r.store).getNotices()})),[]),d=(0,e.useMemo)((()=>({createNotice:o,removeNotice:c})),[o,c]);return(0,i.jsx)(l.Provider,{value:d,children:(0,i.jsxs)("div",{className:"ep-settings-page",children:[(0,i.jsxs)("div",{className:"ep-settings-page__wrap",children:[(0,i.jsx)("h1",{className:"ep-settings-page__title",children:t}),s]}),(0,i.jsx)(n.SnackbarList,{className:"ep-settings-page__snackbar-list",notices:u,onRemove:e=>c(e)})]})})},{apiUrl:c,epioLogoUrl:u,features:d,indexMeta:p,settings:g,settingsDraft:h,syncUrl:f}=window.epDashboard;var y=window.wp.apiFetch,m=t.n(y),_=window.lodash;const x=(0,e.createContext)(),b=({apiUrl:s,children:t,defaultSettings:n,epioLogoUrl:a,features:r,indexMeta:l,syncedSettings:o})=>{const[c,u]=(0,e.useState)(!1),[d,p]=(0,e.useState)(!!l),[g,h]=(0,e.useState)({...n}),[f,y]=(0,e.useState)({...o}),b=(0,e.useCallback)((e=>r.find((s=>s.slug===e))),[r]),v=(0,e.useMemo)((()=>!(0,_.isEqual)(g,f)),[g,f]),S=(0,e.useCallback)(((e,s,t)=>t&&e&&"0"!==e&&e!==s),[]),w=(0,e.useCallback)((e=>{const{slug:s,settingsSchema:t}=e;return t.some((e=>{if(!0!==g?.[s]?.active)return!1;const t=e.requires_sync,n=g?.[s]?.[e.key],a=o?.[s]?.[e.key];return S(n,a,t)}))}),[g,o,S]),j=(0,e.useMemo)((()=>r.reduce(((e,s)=>(w(s)&&e.push(s.slug),e)),[])),[r,w]),C=(0,e.useMemo)((()=>!!j.length),[j]),F={epioLogoUrl:a,features:r,featuresRequiringSync:j,getFeature:b,isBusy:c,isModified:v,isSyncing:d,setIsSyncing:p,isSyncRequired:C,resetSettings:()=>{h({...f})},saveSettings:async()=>{try{u(!0);const e=await m()({body:JSON.stringify(g),headers:{"Content-Type":"application/json"},method:"PUT",url:s});y(e.data)}finally{u(!1)}},savedSettings:f,syncedSettings:o,settings:g,setSettings:h,willSettingRequireSync:S};return(0,i.jsx)(x.Provider,{value:F,children:t})},v=()=>(0,e.useContext)(x);var S=window.wp.dom,w=({disabled:t,help:a,label:r,name:l,onChange:o,options:c,requiresFeature:u,requiresSync:d,syncedValue:p,type:g,value:h})=>{const{getFeature:f,isBusy:y,settings:m,willSettingRequireSync:_}=v(),x=a?(0,i.jsx)("span",{dangerouslySetInnerHTML:{__html:(0,S.safeHTML)(a)}}):null,b=c?c.map((e=>({value:e.value,label:(0,i.jsx)("span",{dangerouslySetInnerHTML:{__html:(0,S.safeHTML)(e.label)}})}))):[],w=!(!u||!0===m[u]?.active)&&f(u),j="active"===l?(0,s.__)("The %s feature must be enabled to use this feature.","elasticpress"):(0,s.__)("The %s feature must be enabled to use the following setting.","elasticpress"),C="active"===l?(0,s.__)("Enabling this feature requires re-syncing your content.","elasticpress"):(0,s.__)("A change to following setting requires re-syncing your content.","elasticpress"),F=y||t||w,T=_(h,p,d),M=e=>{o(e?"1":"0")},N=e=>{const s=e.map((e=>c.find((s=>s.label===e))?.value)).filter(Boolean).join(",");o(s)};return(0,i.jsxs)(i.Fragment,{children:[w?(0,i.jsx)(n.Notice,{isDismissible:!1,status:"active"===l?"error":"warning",children:(0,s.sprintf)(j,w.shortTitle)}):null,T?(0,i.jsx)(n.Notice,{isDismissible:!1,status:"warning",children:C}):null,(0,i.jsx)("div",{className:"ep-dashboard-control",children:(()=>{switch(g){case"checkbox":return(0,i.jsx)(n.CheckboxControl,{checked:"1"===h,help:x,label:r,onChange:M,disabled:F});case"hidden":return null;case"markup":return(0,i.jsx)(e.RawHTML,{children:(0,S.safeHTML)(r)});case"multiple":{const e=c.map((e=>e.label)),s=h.split(",").map((e=>c.find((s=>s.value===e))?.label)).filter(Boolean);return(0,i.jsx)(n.FormTokenField,{__experimentalExpandOnFocus:!0,__experimentalShowHowTo:!1,label:r,onChange:N,disabled:F,suggestions:e,value:s})}case"radio":return(0,i.jsx)(n.RadioControl,{help:x,label:r,onChange:o,options:b,disabled:F,selected:h});case"select":return(0,i.jsx)(n.SelectControl,{help:x,label:r,onChange:o,options:c,disabled:F,value:h});case"toggle":return(0,i.jsx)(n.ToggleControl,{checked:h,help:x,label:r,onChange:o,disabled:F});case"textarea":return(0,i.jsx)(n.TextareaControl,{help:x,label:r,onChange:o,disabled:F,value:h});default:return(0,i.jsx)(n.TextControl,{help:x,label:r,onChange:o,disabled:F,value:h,type:g})}})()})]})},j=({feature:e,settingsSchema:s})=>{const{getFeature:t,settings:n,setSettings:a,syncedSettings:r}=v(),{isAvailable:l}=t(e);return s.map((s=>{const{default:t,disabled:o,help:c,key:u,label:d,options:p,requires_feature:g,requires_sync:h,type:f}=s;let y="undefined"!==typeof n[e]?.[u]?n[e][u]:t;return"active"!==u||l||(y=!1),(0,i.jsx)(w,{disabled:o||!l,help:c,label:d,name:u,onChange:s=>((s,t)=>{a({...n,[e]:{...n[e],[s]:t}})})(u,s),options:p,syncedValue:r?.[e]?.[u],requiresFeature:g,requiresSync:h,type:f,value:y},u)}))},C=({feature:t})=>{const{epioLogoUrl:a,getFeature:r}=v(),{isPoweredByEpio:l,reqStatusCode:o,reqStatusMessages:c,settingsSchema:u,summary:d,title:p}=r(t);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("h3",{className:"ep-dashboard-heading",children:[(0,i.jsx)(e.RawHTML,{children:(0,S.safeHTML)(p)}),l?(0,i.jsx)("img",{alt:(0,s.__)("ElasticPress.io logo"),height:"20",src:a,width:"110"}):null]}),(0,i.jsx)("p",{dangerouslySetInnerHTML:{__html:(0,S.safeHTML)(d)}}),c.map(((e,s)=>(0,i.jsx)(n.Notice,{isDismissible:!1,status:2===o?"error":"warning",children:(0,i.jsx)("span",{dangerouslySetInnerHTML:{__html:(0,S.safeHTML)(e)}})},s))),(0,i.jsx)(j,{feature:t,settingsSchema:u})]})},F=({feature:e})=>{const{getFeature:t,featuresRequiringSync:n}=v(),{shortTitle:a,isAvailable:r}=t(e),l=r?"":(0,s.__)("Unavailable","elasticpress"),o=n.includes(e)?(0,s.__)("Sync required","elasticpress"):l;return(0,i.jsxs)("div",{className:"ep-feature-tab",children:[a,o?(0,i.jsx)("small",{className:"ep-feature-tab__status",children:o}):null]})},T=()=>{const{createNotice:t}=(0,e.useContext)(l),{features:a,isBusy:r,isModified:o,isSyncing:c,isSyncRequired:u,resetSettings:d,saveSettings:p,setIsSyncing:g}=v(),h=(0,e.useMemo)((()=>{const e=new URL(f);return e.searchParams.append("do_sync","features"),e.toString()}),[]),y=(0,s.__)("Could not save feature settings. Please try again.","elasticpress"),m=[{url:f,label:(0,s.__)("View sync status","elasticpress")}],_=(0,s.__)("Cannot save settings while a sync is in progress.","elasticpress"),x=(0,s.__)("Changes to feature settings discarded.","elasticpress"),b=[{url:h,label:(0,s.__)("Sync","elasticpress")}],S=(0,s.__)("If you choose to sync later some settings changes may not take effect until the sync is performed. Save and sync later?","elasticpress"),w=(0,s.__)("Saving these settings will begin re-syncing your content. Save and sync now?","elasticpress"),j=(0,s.__)("Feature settings saved. Starting sync…","elasticpress"),T=(0,s.__)("Feature settings saved.","elasticpress"),[M,N]=(0,e.useState)(!1),k=a.filter((e=>e.isVisible)).map((e=>({name:e.slug,title:(0,i.jsx)(F,{feature:e.slug})}))),L=e=>{if("is_syncing"===e.data)return t("error",_,{actions:m}),void g(!0);const n=`${(0,s.__)("ElasticPress: Could not save feature settings.","elasticpress")}\n${e.message}`;console.error(n),t("error",y)};return(0,i.jsxs)("form",{onReset:e=>{e.preventDefault(),d(),t("success",x)},onSubmit:async e=>{if(e.preventDefault(),!u||window.confirm(w)){N(!1);try{await p(),u?(t("success",j),window.location=h):t("success",T)}catch(e){L(e)}}},children:[(0,i.jsx)(n.Panel,{className:"ep-dashboard-panel",children:(0,i.jsxs)(n.PanelBody,{children:[c?(0,i.jsx)(n.Notice,{actions:m,isDismissible:!1,status:"warning",children:_}):null,(0,i.jsx)(n.TabPanel,{className:"ep-dashboard-tabs",orientation:"vertical",tabs:k,children:({name:e})=>(0,i.jsx)(C,{feature:e},e)})]})}),(0,i.jsxs)(n.Flex,{justify:"start",children:[(0,i.jsx)(n.FlexItem,{children:(0,i.jsx)(n.Button,{disabled:r||c,isBusy:r&&!M,type:"submit",variant:"primary",children:u?(0,s.__)("Save and sync now","elasticpress"):(0,s.__)("Save changes","elasticpress")})}),u?(0,i.jsx)(n.FlexItem,{children:(0,i.jsx)(n.Button,{disabled:r||c,isBusy:r&&M,onClick:async()=>{if(window.confirm(S)){N(!0);try{await p(!1),t("success",T,{actions:b})}catch(e){L(e)}}},type:"button",variant:"secondary",children:(0,s.__)("Save and sync later","elasticpress")})}):null,o?(0,i.jsx)(n.FlexItem,{children:(0,i.jsx)(n.Button,{disabled:r,type:"reset",variant:"tertiary",children:(0,s.__)("Discard changes","elasticpress")})}):null]})]})};const M=()=>(0,i.jsx)(o,{title:(0,s.__)("Features","elasticpress"),children:(0,i.jsxs)(b,{apiUrl:c,defaultSettings:h||g,epioLogoUrl:u,features:d,indexMeta:p,syncedSettings:g,syncUrl:f,children:[(0,i.jsx)("p",{children:(0,e.createInterpolateElement)((0,s.__)("ElasticPress Features add functionality to enhance search and queries on your site. You may choose to activate some or all of these Features depending on your needs. You can learn more about each Feature <a>here</a>.","elasticpress"),{a:(0,i.jsx)("a",{target:"_blank",href:"https://elasticpress.zendesk.com/hc/en-us/articles/16671825423501-Features",rel:"noreferrer"})})}),(0,i.jsx)(T,{})]})});if("function"===typeof e.createRoot){(0,e.createRoot)(document.getElementById("ep-dashboard")).render((0,i.jsx)(M,{}))}else(0,e.render)((0,i.jsx)(M,{}),document.getElementById("ep-dashboard"))}()}(); |
|
1
|
+!function(){"use strict";var e={9306:function(e,t,n){var r=n(4901),a=n(6823),o=TypeError;e.exports=function(e){if(r(e))return e;throw new o(a(e)+" is not a function")}},6469:function(e,t,n){var r=n(8227),a=n(2360),o=n(4913).f,i=r("unscopables"),s=Array.prototype;void 0===s[i]&&o(s,i,{configurable:!0,value:a(null)}),e.exports=function(e){s[i][e]=!0}},8551:function(e,t,n){var r=n(34),a=String,o=TypeError;e.exports=function(e){if(r(e))return e;throw new o(a(e)+" is not an object")}},9617:function(e,t,n){var r=n(5397),a=n(5610),o=n(6198),i=function(e){return function(t,n,i){var s=r(t),l=o(s);if(0===l)return!e&&-1;var u,c=a(i,l);if(e&&n!==n){for(;l>c;)if((u=s[c++])!==u)return!0}else for(;l>c;c++)if((e||c in s)&&s[c]===n)return e||c||0;return!e&&-1}};e.exports={includes:i(!0),indexOf:i(!1)}},2195:function(e,t,n){var r=n(9504),a=r({}.toString),o=r("".slice);e.exports=function(e){return o(a(e),8,-1)}},7740:function(e,t,n){var r=n(9297),a=n(5031),o=n(7347),i=n(4913);e.exports=function(e,t,n){for(var s=a(t),l=i.f,u=o.f,c=0;c<s.length;c++){var p=s[c];r(e,p)||n&&r(n,p)||l(e,p,u(t,p))}}},6699:function(e,t,n){var r=n(3724),a=n(4913),o=n(6980);e.exports=r?function(e,t,n){return a.f(e,t,o(1,n))}:function(e,t,n){return e[t]=n,e}},6980:function(e){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},6840:function(e,t,n){var r=n(4901),a=n(4913),o=n(283),i=n(9433);e.exports=function(e,t,n,s){s||(s={});var l=s.enumerable,u=void 0!==s.name?s.name:t;if(r(n)&&o(n,u,s),s.global)l?e[t]=n:i(t,n);else{try{s.unsafe?e[t]&&(l=!0):delete e[t]}catch(e){}l?e[t]=n:a.f(e,t,{value:n,enumerable:!1,configurable:!s.nonConfigurable,writable:!s.nonWritable})}return e}},9433:function(e,t,n){var r=n(4576),a=Object.defineProperty;e.exports=function(e,t){try{a(r,e,{value:t,configurable:!0,writable:!0})}catch(n){r[e]=t}return t}},3724:function(e,t,n){var r=n(9039);e.exports=!r((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}))},4055:function(e,t,n){var r=n(4576),a=n(34),o=r.document,i=a(o)&&a(o.createElement);e.exports=function(e){return i?o.createElement(e):{}}},8727:function(e){e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},2839:function(e,t,n){var r=n(4576).navigator,a=r&&r.userAgent;e.exports=a?String(a):""},9519:function(e,t,n){var r,a,o=n(4576),i=n(2839),s=o.process,l=o.Deno,u=s&&s.versions||l&&l.version,c=u&&u.v8;c&&(a=(r=c.split("."))[0]>0&&r[0]<4?1:+(r[0]+r[1])),!a&&i&&(!(r=i.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=i.match(/Chrome\/(\d+)/))&&(a=+r[1]),e.exports=a},6518:function(e,t,n){var r=n(4576),a=n(7347).f,o=n(6699),i=n(6840),s=n(9433),l=n(7740),u=n(2796);e.exports=function(e,t){var n,c,p,f,d,h=e.target,m=e.global,g=e.stat;if(n=m?r:g?r[h]||s(h,{}):r[h]&&r[h].prototype)for(c in t){if(f=t[c],p=e.dontCallGetSet?(d=a(n,c))&&d.value:n[c],!u(m?c:h+(g?".":"#")+c,e.forced)&&void 0!==p){if(typeof f==typeof p)continue;l(f,p)}(e.sham||p&&p.sham)&&o(f,"sham",!0),i(n,c,f,e)}}},9039:function(e){e.exports=function(e){try{return!!e()}catch(e){return!0}}},616:function(e,t,n){var r=n(9039);e.exports=!r((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}))},9565:function(e,t,n){var r=n(616),a=Function.prototype.call;e.exports=r?a.bind(a):function(){return a.apply(a,arguments)}},350:function(e,t,n){var r=n(3724),a=n(9297),o=Function.prototype,i=r&&Object.getOwnPropertyDescriptor,s=a(o,"name"),l=s&&"something"===function(){}.name,u=s&&(!r||r&&i(o,"name").configurable);e.exports={EXISTS:s,PROPER:l,CONFIGURABLE:u}},9504:function(e,t,n){var r=n(616),a=Function.prototype,o=a.call,i=r&&a.bind.bind(o,o);e.exports=r?i:function(e){return function(){return o.apply(e,arguments)}}},7751:function(e,t,n){var r=n(4576),a=n(4901);e.exports=function(e,t){return arguments.length<2?(n=r[e],a(n)?n:void 0):r[e]&&r[e][t];var n}},5966:function(e,t,n){var r=n(9306),a=n(4117);e.exports=function(e,t){var n=e[t];return a(n)?void 0:r(n)}},4576:function(e,t,n){var r=function(e){return e&&e.Math===Math&&e};e.exports=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof n.g&&n.g)||r("object"==typeof this&&this)||function(){return this}()||Function("return this")()},9297:function(e,t,n){var r=n(9504),a=n(8981),o=r({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,t){return o(a(e),t)}},421:function(e){e.exports={}},397:function(e,t,n){var r=n(7751);e.exports=r("document","documentElement")},5917:function(e,t,n){var r=n(3724),a=n(9039),o=n(4055);e.exports=!r&&!a((function(){return 7!==Object.defineProperty(o("div"),"a",{get:function(){return 7}}).a}))},7055:function(e,t,n){var r=n(9504),a=n(9039),o=n(2195),i=Object,s=r("".split);e.exports=a((function(){return!i("z").propertyIsEnumerable(0)}))?function(e){return"String"===o(e)?s(e,""):i(e)}:i},3706:function(e,t,n){var r=n(9504),a=n(4901),o=n(7629),i=r(Function.toString);a(o.inspectSource)||(o.inspectSource=function(e){return i(e)}),e.exports=o.inspectSource},1181:function(e,t,n){var r,a,o,i=n(8622),s=n(4576),l=n(34),u=n(6699),c=n(9297),p=n(7629),f=n(6119),d=n(421),h="Object already initialized",m=s.TypeError,g=s.WeakMap;if(i||p.state){var y=p.state||(p.state=new g);y.get=y.get,y.has=y.has,y.set=y.set,r=function(e,t){if(y.has(e))throw new m(h);return t.facade=e,y.set(e,t),t},a=function(e){return y.get(e)||{}},o=function(e){return y.has(e)}}else{var v=f("state");d[v]=!0,r=function(e,t){if(c(e,v))throw new m(h);return t.facade=e,u(e,v,t),t},a=function(e){return c(e,v)?e[v]:{}},o=function(e){return c(e,v)}}e.exports={set:r,get:a,has:o,enforce:function(e){return o(e)?a(e):r(e,{})},getterFor:function(e){return function(t){var n;if(!l(t)||(n=a(t)).type!==e)throw new m("Incompatible receiver, "+e+" required");return n}}}},4901:function(e){var t="object"==typeof document&&document.all;e.exports="undefined"==typeof t&&void 0!==t?function(e){return"function"==typeof e||e===t}:function(e){return"function"==typeof e}},2796:function(e,t,n){var r=n(9039),a=n(4901),o=/#|\.prototype\./,i=function(e,t){var n=l[s(e)];return n===c||n!==u&&(a(t)?r(t):!!t)},s=i.normalize=function(e){return String(e).replace(o,".").toLowerCase()},l=i.data={},u=i.NATIVE="N",c=i.POLYFILL="P";e.exports=i},4117:function(e){e.exports=function(e){return null===e||void 0===e}},34:function(e,t,n){var r=n(4901);e.exports=function(e){return"object"==typeof e?null!==e:r(e)}},6395:function(e){e.exports=!1},757:function(e,t,n){var r=n(7751),a=n(4901),o=n(1625),i=n(7040),s=Object;e.exports=i?function(e){return"symbol"==typeof e}:function(e){var t=r("Symbol");return a(t)&&o(t.prototype,s(e))}},6198:function(e,t,n){var r=n(8014);e.exports=function(e){return r(e.length)}},283:function(e,t,n){var r=n(9504),a=n(9039),o=n(4901),i=n(9297),s=n(3724),l=n(350).CONFIGURABLE,u=n(3706),c=n(1181),p=c.enforce,f=c.get,d=String,h=Object.defineProperty,m=r("".slice),g=r("".replace),y=r([].join),v=s&&!a((function(){return 8!==h((function(){}),"length",{value:8}).length})),b=String(String).split("String"),w=e.exports=function(e,t,n){"Symbol("===m(d(t),0,7)&&(t="["+g(d(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),n&&n.getter&&(t="get "+t),n&&n.setter&&(t="set "+t),(!i(e,"name")||l&&e.name!==t)&&(s?h(e,"name",{value:t,configurable:!0}):e.name=t),v&&n&&i(n,"arity")&&e.length!==n.arity&&h(e,"length",{value:n.arity});try{n&&i(n,"constructor")&&n.constructor?s&&h(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var r=p(e);return i(r,"source")||(r.source=y(b,"string"==typeof t?t:"")),e};Function.prototype.toString=w((function(){return o(this)&&f(this).source||u(this)}),"toString")},741:function(e){var t=Math.ceil,n=Math.floor;e.exports=Math.trunc||function(e){var r=+e;return(r>0?n:t)(r)}},2360:function(e,t,n){var r,a=n(8551),o=n(6801),i=n(8727),s=n(421),l=n(397),u=n(4055),c=n(6119),p="prototype",f="script",d=c("IE_PROTO"),h=function(){},m=function(e){return"<"+f+">"+e+"</"+f+">"},g=function(e){e.write(m("")),e.close();var t=e.parentWindow.Object;return e=null,t},y=function(){try{r=new ActiveXObject("htmlfile")}catch(e){}y="undefined"!=typeof document?document.domain&&r?g(r):function(){var e,t=u("iframe"),n="java"+f+":";return t.style.display="none",l.appendChild(t),t.src=String(n),(e=t.contentWindow.document).open(),e.write(m("document.F=Object")),e.close(),e.F}():g(r);for(var e=i.length;e--;)delete y[p][i[e]];return y()};s[d]=!0,e.exports=Object.create||function(e,t){var n;return null!==e?(h[p]=a(e),n=new h,h[p]=null,n[d]=e):n=y(),void 0===t?n:o.f(n,t)}},6801:function(e,t,n){var r=n(3724),a=n(8686),o=n(4913),i=n(8551),s=n(5397),l=n(1072);t.f=r&&!a?Object.defineProperties:function(e,t){i(e);for(var n,r=s(t),a=l(t),u=a.length,c=0;u>c;)o.f(e,n=a[c++],r[n]);return e}},4913:function(e,t,n){var r=n(3724),a=n(5917),o=n(8686),i=n(8551),s=n(6969),l=TypeError,u=Object.defineProperty,c=Object.getOwnPropertyDescriptor,p="enumerable",f="configurable",d="writable";t.f=r?o?function(e,t,n){if(i(e),t=s(t),i(n),"function"===typeof e&&"prototype"===t&&"value"in n&&d in n&&!n[d]){var r=c(e,t);r&&r[d]&&(e[t]=n.value,n={configurable:f in n?n[f]:r[f],enumerable:p in n?n[p]:r[p],writable:!1})}return u(e,t,n)}:u:function(e,t,n){if(i(e),t=s(t),i(n),a)try{return u(e,t,n)}catch(e){}if("get"in n||"set"in n)throw new l("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},7347:function(e,t,n){var r=n(3724),a=n(9565),o=n(8773),i=n(6980),s=n(5397),l=n(6969),u=n(9297),c=n(5917),p=Object.getOwnPropertyDescriptor;t.f=r?p:function(e,t){if(e=s(e),t=l(t),c)try{return p(e,t)}catch(e){}if(u(e,t))return i(!a(o.f,e,t),e[t])}},8480:function(e,t,n){var r=n(1828),a=n(8727).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,a)}},3717:function(e,t){t.f=Object.getOwnPropertySymbols},1625:function(e,t,n){var r=n(9504);e.exports=r({}.isPrototypeOf)},1828:function(e,t,n){var r=n(9504),a=n(9297),o=n(5397),i=n(9617).indexOf,s=n(421),l=r([].push);e.exports=function(e,t){var n,r=o(e),u=0,c=[];for(n in r)!a(s,n)&&a(r,n)&&l(c,n);for(;t.length>u;)a(r,n=t[u++])&&(~i(c,n)||l(c,n));return c}},1072:function(e,t,n){var r=n(1828),a=n(8727);e.exports=Object.keys||function(e){return r(e,a)}},8773:function(e,t){var n={}.propertyIsEnumerable,r=Object.getOwnPropertyDescriptor,a=r&&!n.call({1:2},1);t.f=a?function(e){var t=r(this,e);return!!t&&t.enumerable}:n},4270:function(e,t,n){var r=n(9565),a=n(4901),o=n(34),i=TypeError;e.exports=function(e,t){var n,s;if("string"===t&&a(n=e.toString)&&!o(s=r(n,e)))return s;if(a(n=e.valueOf)&&!o(s=r(n,e)))return s;if("string"!==t&&a(n=e.toString)&&!o(s=r(n,e)))return s;throw new i("Can't convert object to primitive value")}},5031:function(e,t,n){var r=n(7751),a=n(9504),o=n(8480),i=n(3717),s=n(8551),l=a([].concat);e.exports=r("Reflect","ownKeys")||function(e){var t=o.f(s(e)),n=i.f;return n?l(t,n(e)):t}},7750:function(e,t,n){var r=n(4117),a=TypeError;e.exports=function(e){if(r(e))throw new a("Can't call method on "+e);return e}},6119:function(e,t,n){var r=n(5745),a=n(3392),o=r("keys");e.exports=function(e){return o[e]||(o[e]=a(e))}},7629:function(e,t,n){var r=n(6395),a=n(4576),o=n(9433),i="__core-js_shared__",s=e.exports=a[i]||o(i,{});(s.versions||(s.versions=[])).push({version:"3.39.0",mode:r?"pure":"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.39.0/LICENSE",source:"https://github.com/zloirock/core-js"})},5745:function(e,t,n){var r=n(7629);e.exports=function(e,t){return r[e]||(r[e]=t||{})}},4495:function(e,t,n){var r=n(9519),a=n(9039),o=n(4576).String;e.exports=!!Object.getOwnPropertySymbols&&!a((function(){var e=Symbol("symbol detection");return!o(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&r&&r<41}))},5610:function(e,t,n){var r=n(1291),a=Math.max,o=Math.min;e.exports=function(e,t){var n=r(e);return n<0?a(n+t,0):o(n,t)}},5397:function(e,t,n){var r=n(7055),a=n(7750);e.exports=function(e){return r(a(e))}},1291:function(e,t,n){var r=n(741);e.exports=function(e){var t=+e;return t!==t||0===t?0:r(t)}},8014:function(e,t,n){var r=n(1291),a=Math.min;e.exports=function(e){var t=r(e);return t>0?a(t,9007199254740991):0}},8981:function(e,t,n){var r=n(7750),a=Object;e.exports=function(e){return a(r(e))}},2777:function(e,t,n){var r=n(9565),a=n(34),o=n(757),i=n(5966),s=n(4270),l=n(8227),u=TypeError,c=l("toPrimitive");e.exports=function(e,t){if(!a(e)||o(e))return e;var n,l=i(e,c);if(l){if(void 0===t&&(t="default"),n=r(l,e,t),!a(n)||o(n))return n;throw new u("Can't convert object to primitive value")}return void 0===t&&(t="number"),s(e,t)}},6969:function(e,t,n){var r=n(2777),a=n(757);e.exports=function(e){var t=r(e,"string");return a(t)?t:t+""}},6823:function(e){var t=String;e.exports=function(e){try{return t(e)}catch(e){return"Object"}}},3392:function(e,t,n){var r=n(9504),a=0,o=Math.random(),i=r(1..toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+i(++a+o,36)}},7040:function(e,t,n){var r=n(4495);e.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},8686:function(e,t,n){var r=n(3724),a=n(9039);e.exports=r&&a((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},8622:function(e,t,n){var r=n(4576),a=n(4901),o=r.WeakMap;e.exports=a(o)&&/native code/.test(String(o))},8227:function(e,t,n){var r=n(4576),a=n(5745),o=n(9297),i=n(3392),s=n(4495),l=n(7040),u=r.Symbol,c=a("wks"),p=l?u.for||u:u&&u.withoutSetter||i;e.exports=function(e){return o(c,e)||(c[e]=s&&o(u,e)?u[e]:p("Symbol."+e)),c[e]}},4423:function(e,t,n){var r=n(6518),a=n(9617).includes,o=n(9039),i=n(6469);r({target:"Array",proto:!0,forced:o((function(){return!Array(1).includes()}))},{includes:function(e){return a(this,e,arguments.length>1?arguments[1]:void 0)}}),i("includes")}},t={};function n(r){var a=t[r];if(void 0!==a)return a.exports;var o=t[r]={exports:{}};return e[r].call(o.exports,o,o.exports,n),o.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},function(){var e,t=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__};n.t=function(r,a){if(1&a&&(r=this(r)),8&a)return r;if("object"===typeof r&&r){if(4&a&&r.__esModule)return r;if(16&a&&"function"===typeof r.then)return r}var o=Object.create(null);n.r(o);var i={};e=e||[null,t({}),t([]),t(t)];for(var s=2&a&&r;("object"==typeof s||"function"==typeof s)&&!~e.indexOf(s);s=t(s))Object.getOwnPropertyNames(s).forEach((function(e){i[e]=function(){return r[e]}}));return i.default=function(){return r},n.d(o,i),o}}(),n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"===typeof window)return window}}(),n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r=window.wp.element,a=window.wp.i18n,o=window.wp.components,i=window.wp.data,s=window.wp.notices;const l=(0,r.createContext)(),{Fill:u,Slot:c}=(0,o.createSlotFill)("SettingsPageAction"),p=({children:e,title:t})=>{const{createNotice:n,removeNotice:a}=(0,i.useDispatch)(s.store),{notices:p}=(0,i.useSelect)((e=>({notices:e(s.store).getNotices()})),[]),f=(0,r.useMemo)((()=>({ActionSlot:u,createNotice:n,removeNotice:a})),[n,a]);return React.createElement(o.SlotFillProvider,null,React.createElement(l.Provider,{value:f},React.createElement("div",{className:"ep-settings-page"},React.createElement("div",{className:"ep-settings-page__wrap"},React.createElement("header",{className:"ep-settings-page__header"},React.createElement("h1",{className:"ep-settings-page__title"},t),React.createElement(c,null)),e),React.createElement(o.SnackbarList,{className:"ep-settings-page__snackbar-list",notices:p,onRemove:e=>a(e)}))))},{apiUrl:f,epioLogoUrl:d,features:h,indexMeta:m,settings:g,settingsDraft:y,syncUrl:v,syncNonce:b,featureGroups:w}=window.epDashboard;var E=window.wp.apiFetch,R=n.n(E),S=window.lodash;const x=(0,r.createContext)(),_=({apiUrl:e,children:t,defaultSettings:n,epioLogoUrl:a,features:o,indexMeta:i,syncedSettings:s})=>{const[l,u]=(0,r.useState)(!1),[c,p]=(0,r.useState)(!!i),[f,d]=(0,r.useState)({...n}),[h,m]=(0,r.useState)({...s}),[g,y]=(0,r.useState)(o),v=(0,r.useCallback)((async()=>{const t=await R()({method:"GET",url:e});y(t.features),m(t.settings),d(t.settingsDraft??t.settings)}),[e]),b=(0,r.useCallback)((e=>g.find((t=>t.slug===e))),[g]),w=(0,r.useMemo)((()=>{const e=e=>{Object.keys(e).forEach((t=>{delete e[t].force_inactive}))};return e(f),e(h),!(0,S.isEqual)(f,h)}),[f,h]),E=(0,r.useCallback)(((e,t,n)=>n&&e&&"0"!==e&&e!==t),[]),_=(0,r.useCallback)((e=>{const{slug:t,settingsSchema:n}=e;return n.some((e=>{if(!0!==f?.[t]?.active)return!1;const n=e.requires_sync,r=f?.[t]?.[e.key],a=s?.[t]?.[e.key];return E(r,a,n)}))}),[f,s,E]),C=(0,r.useMemo)((()=>g.reduce(((e,t)=>(_(t)&&e.push(t.slug),e)),[])),[g,_]),O=(0,r.useMemo)((()=>!!C.length),[C]),k={epioLogoUrl:a,features:g,featuresRequiringSync:C,getFeature:b,isBusy:l,isModified:w,isSyncing:c,setIsSyncing:p,isSyncRequired:O,refresh:v,resetSettings:()=>{d({...h})},saveSettings:async()=>{try{u(!0),await R()({body:JSON.stringify(f),headers:{"Content-Type":"application/json"},method:"PUT",url:e}),await v()}finally{u(!1)}},savedSettings:h,syncedSettings:s,settings:f,setSettings:d,willSettingRequireSync:E};return React.createElement(x.Provider,{value:k},t)},C=()=>(0,r.useContext)(x);var O=window.React,k=n.t(O,2),$=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,T=/^[\\/]{2}/;function N(e,t){return t+e.replace(/\\/g,"/")}var P="popstate";function M(e){return"object"===typeof e&&null!=e&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function j(e={}){return U((function(e,t){let{pathname:n="/",search:r="",hash:a=""}=B(e.location.hash.substring(1));return n.startsWith("/")||n.startsWith(".")||(n="/"+n),D("",{pathname:n,search:r,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||"default")}),(function(e,t){let n=e.document.querySelector("base"),r="";if(n&&n.getAttribute("href")){let t=e.location.href,n=t.indexOf("#");r=-1===n?t:t.slice(0,n)}return r+"#"+("string"===typeof t?t:H(t))}),(function(e,t){F("/"===e.pathname.charAt(0),`relative pathnames are not supported in hash history.push(${JSON.stringify(t)})`)}),e)}function L(e,t){if(!1===e||null===e||"undefined"===typeof e)throw new Error(t)}function F(e,t){if(!e){"undefined"!==typeof console&&console.warn(t);try{throw new Error(t)}catch(e){}}}function A(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function D(e,t,n=null,r,a){return{pathname:"string"===typeof e?e:e.pathname,search:"",hash:"",..."string"===typeof t?B(t):t,state:n,key:t&&t.key||r||Math.random().toString(36).substring(2,10),mask:a}}function H({pathname:e="/",search:t="",hash:n=""}){return t&&"?"!==t&&(e+="?"===t.charAt(0)?t:"?"+t),n&&"#"!==n&&(e+="#"===n.charAt(0)?n:"#"+n),e}function B(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function U(e,t,n,r={}){let{window:a=document.defaultView,v5Compat:o=!1}=r,i=a.history,s="POP",l=null,u=c();function c(){return(i.state||{idx:null}).idx}function p(){s="POP";let e=c(),t=null==e?null:e-u;u=e,l&&l({action:s,location:d.location,delta:t})}function f(e){return W(a,e)}null==u&&(u=0,i.replaceState({...i.state,idx:u},""));let d={get action(){return s},get location(){return e(a,i)},listen(e){if(l)throw new Error("A history only accepts one active listener");return a.addEventListener(P,p),l=e,()=>{a.removeEventListener(P,p),l=null}},createHref(e){return t(a,e)},createURL:f,encodeLocation(e){let t=f(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:function(e,t){s="PUSH";let r=M(e)?e:D(d.location,e,t);n&&n(r,e),u=c()+1;let p=A(r,u),f=d.createHref(r.mask||r);try{i.pushState(p,"",f)}catch(e){if(e instanceof DOMException&&"DataCloneError"===e.name)throw e;a.location.assign(f)}o&&l&&l({action:s,location:d.location,delta:1})},replace:function(e,t){s="REPLACE";let r=M(e)?e:D(d.location,e,t);n&&n(r,e),u=c();let a=A(r,u),p=d.createHref(r.mask||r);i.replaceState(a,"",p),o&&l&&l({action:s,location:d.location,delta:0})},go(e){return i.go(e)}};return d}function W(e,t,n=!1){let r="http://localhost";e&&(r="null"!==e.location.origin?e.location.origin:e.location.href),L(r,"No window.location.(origin|href) available to create URL");let a="string"===typeof t?t:H(t);return a=a.replace(/ $/,"%20"),!n&&T.test(a)&&(a=r+a),new URL(a,r)}new WeakMap;function I(e,t,n="/"){return q(e,t,n,!1)}function q(e,t,n,r,a){let o=se(("string"===typeof t?B(t):t).pathname||"/",n);if(null==o)return null;let i=a??z(e),s=null,l=ie(o);for(let e=0;null==s&&e<i.length;++e)s=ne(i[e],l,r);return s}function z(e){let t=J(e);return function(e){e.sort(((e,t)=>e.score!==t.score?t.score-e.score:function(e,t){let n=e.length===t.length&&e.slice(0,-1).every(((e,n)=>e===t[n]));return n?e[e.length-1]-t[t.length-1]:0}(e.routesMeta.map((e=>e.childrenIndex)),t.routesMeta.map((e=>e.childrenIndex)))))}(t),t}function J(e,t=[],n=[],r="",a=!1){let o=(e,o,i=a,s)=>{let l={relativePath:void 0===s?e.path||"":s,caseSensitive:!0===e.caseSensitive,childrenIndex:o,route:e};if(l.relativePath.startsWith("/")){if(!l.relativePath.startsWith(r)&&i)return;L(l.relativePath.startsWith(r),`Absolute route path "${l.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),l.relativePath=l.relativePath.slice(r.length)}let u=he([r,l.relativePath]),c=n.concat(l);e.children&&e.children.length>0&&(L(!0!==e.index,`Index routes must not have child routes. Please remove all child routes from route path "${u}".`),J(e.children,t,c,u,i)),(null!=e.path||e.index)&&t.push({path:u,score:te(u,e.index),routesMeta:c.map(((e,t)=>{let[n,r]=oe(e.relativePath,e.caseSensitive,t===c.length-1);return{...e,matcher:n,compiledParams:r}}))})};return e.forEach(((e,t)=>{if(""!==e.path&&e.path?.includes("?"))for(let n of V(e.path))o(e,t,!0,n);else o(e,t)})),t}function V(e){let t=e.split("/");if(0===t.length)return[];let[n,...r]=t,a=n.endsWith("?"),o=n.replace(/\?$/,"");if(0===r.length)return a?[o,""]:[o];let i=V(r.join("/")),s=[];return s.push(...i.map((e=>""===e?o:[o,e].join("/")))),a&&s.push(...i),s.map((t=>e.startsWith("/")&&""===t?"/":t))}var Y=/^:[\w-]+$/,K=3,G=2,X=1,Q=10,Z=-2,ee=e=>"*"===e;function te(e,t){let n=e.split("/"),r=n.length;return n.some(ee)&&(r+=Z),t&&(r+=G),n.filter((e=>!ee(e))).reduce(((e,t)=>e+(Y.test(t)?K:""===t?X:Q)),r)}function ne(e,t,n=!1){let{routesMeta:r}=e,a={},o="/",i=[];for(let e=0;e<r.length;++e){let s=r[e],l=e===r.length-1,u="/"===o?t:t.slice(o.length)||"/",c={path:s.relativePath,caseSensitive:s.caseSensitive,end:l},p=s.matcher&&s.compiledParams?ae(c,u,s.matcher,s.compiledParams):re(c,u),f=s.route;if(!p&&l&&n&&!r[r.length-1].route.index&&(p=re({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},u)),!p)return null;Object.assign(a,p.params),i.push({params:a,pathname:he([o,p.pathname]),pathnameBase:ge(he([o,p.pathnameBase])),route:f}),"/"!==p.pathnameBase&&(o=he([o,p.pathnameBase]))}return i}function re(e,t){"string"===typeof e&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=oe(e.path,e.caseSensitive,e.end);return ae(e,t,n,r)}function ae(e,t,n,r){let a=t.match(n);if(!a)return null;let o=a[0],i=o.replace(/(.)\/+$/,"$1"),s=a.slice(1);return{params:r.reduce(((e,{paramName:t,isOptional:n},r)=>{if("*"===t){let e=s[r]||"";i=o.slice(0,o.length-e.length).replace(/(.)\/+$/,"$1")}const a=s[r];return e[t]=n&&!a?void 0:(a||"").replace(/%2F/g,"/"),e}),{}),pathname:o,pathnameBase:i,pattern:e}}function oe(e,t=!1,n=!0){F("*"===e||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,((e,t,n,a,o)=>{if(r.push({paramName:t,isOptional:null!=n}),n){let t=o.charAt(a+e.length);return t&&"/"!==t?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"})).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),a+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":""!==e&&"/"!==e&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),r]}function ie(e){try{return e.split("/").map((e=>decodeURIComponent(e).replace(/\//g,"%2F"))).join("/")}catch(t){return F(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function se(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&"/"!==r?null:e.slice(n)||"/"}function le(e,t){let n=me(t).split("/");return e.split("/").forEach((e=>{".."===e?n.length>1&&n.pop():"."!==e&&n.push(e)})),n.length>1?n.join("/"):"/"}function ue(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function ce(e){return e.filter(((e,t)=>0===t||e.route.path&&e.route.path.length>0))}function pe(e){let t=ce(e);return t.map(((e,n)=>n===t.length-1?e.pathname:e.pathnameBase))}function fe(e,t,n,r=!1){let a;"string"===typeof e?a=B(e):(a={...e},L(!a.pathname||!a.pathname.includes("?"),ue("?","pathname","search",a)),L(!a.pathname||!a.pathname.includes("#"),ue("#","pathname","hash",a)),L(!a.search||!a.search.includes("#"),ue("#","search","hash",a)));let o,i=""===e||""===a.pathname,s=i?"/":a.pathname;if(null==s)o=n;else{let e=t.length-1;if(!r&&s.startsWith("..")){let t=s.split("/");for(;".."===t[0];)t.shift(),e-=1;a.pathname=t.join("/")}o=e>=0?t[e]:"/"}let l=function(e,t="/"){let n,{pathname:r,search:a="",hash:o=""}="string"===typeof e?B(e):e;return r?(r=de(r),n=r.startsWith("/")?le(r.substring(1),"/"):le(r,t)):n=t,{pathname:n,search:ye(a),hash:ve(o)}}(a,o),u=s&&"/"!==s&&s.endsWith("/"),c=(i||"."===s)&&n.endsWith("/");return l.pathname.endsWith("/")||!u&&!c||(l.pathname+="/"),l}var de=e=>e.replace(/[\\/]{2,}/g,"/"),he=e=>de(e.join("/")),me=e=>e.replace(/\/+$/,""),ge=e=>me(e).replace(/^\/*/,"/"),ye=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",ve=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"";var be=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function we(e){return null!=e&&"number"===typeof e.status&&"string"===typeof e.statusText&&"boolean"===typeof e.internal&&"data"in e}function Ee(e){let t=e.map((e=>e.route.path)).filter(Boolean);return he(t)||"/"}var Re="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement;function Se(e,t){let n=e;if("string"!==typeof n||!$.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,a=!1;if(Re)try{let e=new URL(window.location.href),r=T.test(n)?new URL(N(n,e.protocol)):new URL(n),o=se(r.pathname,t);r.origin===e.origin&&null!=o?n=o+r.search+r.hash:a=!0}catch(e){F(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:a,to:n}}Symbol("Uninstrumented");Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var xe=["POST","PUT","PATCH","DELETE"],_e=(new Set(xe),["GET",...xe]);new Set(_e),Symbol("ResetLoaderData");new WeakMap,new WeakMap,new WeakMap,new WeakMap;var Ce=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function Oe(e){try{return Ce.includes(new URL(e).protocol)}catch{return!1}}var ke=O.createContext(null);ke.displayName="DataRouter";var $e=O.createContext(null);$e.displayName="DataRouterState";var Te=O.createContext(!1);function Ne(){return O.useContext(Te)}var Pe=O.createContext({isTransitioning:!1});Pe.displayName="ViewTransition";var Me=O.createContext(new Map);Me.displayName="Fetchers";var je=O.createContext(null);je.displayName="Await";var Le=O.createContext(null);Le.displayName="Navigation";var Fe=O.createContext(null);Fe.displayName="Location";var Ae=O.createContext({outlet:null,matches:[],isDataRoute:!1});Ae.displayName="Route";var De=O.createContext(null);De.displayName="RouteError";var He="REACT_ROUTER_ERROR";function Be(){return null!=O.useContext(Fe)}function Ue(){return L(Be(),"useLocation() may be used only in the context of a <Router> component."),O.useContext(Fe).location}var We="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Ie(e){O.useContext(Le).static||O.useLayoutEffect(e)}function qe(){let{isDataRoute:e}=O.useContext(Ae);return e?function(){let{router:e}=nt("useNavigate"),t=at("useNavigate"),n=O.useRef(!1);return Ie((()=>{n.current=!0})),O.useCallback((async(r,a={})=>{F(n.current,We),n.current&&("number"===typeof r?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...a}))}),[e,t])}():function(){L(Be(),"useNavigate() may be used only in the context of a <Router> component.");let e=O.useContext(ke),{basename:t,navigator:n}=O.useContext(Le),{matches:r}=O.useContext(Ae),{pathname:a}=Ue(),o=JSON.stringify(pe(r)),i=O.useRef(!1);return Ie((()=>{i.current=!0})),O.useCallback(((r,s={})=>{if(F(i.current,We),!i.current)return;if("number"===typeof r)return void n.go(r);let l=fe(r,JSON.parse(o),a,"path"===s.relative);null==e&&"/"!==t&&(l.pathname="/"===l.pathname?t:he([t,l.pathname])),(s.replace?n.replace:n.push)(l,s.state,s)}),[t,n,o,a,e])}()}O.createContext(null);function ze(){let{matches:e}=O.useContext(Ae),t=e[e.length-1];return t?.params??{}}function Je(e,{relative:t}={}){let{matches:n}=O.useContext(Ae),{pathname:r}=Ue(),a=JSON.stringify(pe(n));return O.useMemo((()=>fe(e,JSON.parse(a),r,"path"===t)),[e,a,r,t])}function Ve(e,t,n){L(Be(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=O.useContext(Le),{matches:a}=O.useContext(Ae),o=a[a.length-1],i=o?o.params:{},s=o?o.pathname:"/",l=o?o.pathnameBase:"/",u=o&&o.route;{let e=u&&u.path||"";st(s,!u||e.endsWith("*")||e.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${s}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.\n\nPlease change the parent <Route path="${e}"> to <Route path="${"/"===e?"*":`${e}/*`}">.`)}let c,p=Ue();if(t){let e="string"===typeof t?B(t):t;L("/"===l||e.pathname?.startsWith(l),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${l}" but pathname "${e.pathname}" was given in the \`location\` prop.`),c=e}else c=p;let f=c.pathname||"/",d=f;if("/"!==l){let e=l.replace(/^\//,"").split("/");d="/"+f.replace(/^\//,"").split("/").slice(e.length).join("/")}let h=n&&n.state.matches.length?n.state.matches.map((e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route}))):I(e,{pathname:d});F(u||null!=h,`No routes matched location "${c.pathname}${c.search}${c.hash}" `),F(null==h||void 0!==h[h.length-1].route.element||void 0!==h[h.length-1].route.Component||void 0!==h[h.length-1].route.lazy,`Matched leaf route at location "${c.pathname}${c.search}${c.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let m=et(h&&h.map((e=>Object.assign({},e,{params:Object.assign({},i,e.params),pathname:he([l,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:e.pathname]),pathnameBase:"/"===e.pathnameBase?l:he([l,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:e.pathnameBase])}))),a,n);return t&&m?O.createElement(Fe.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...c},navigationType:"POP"}},m):m}function Ye(){let e=ot(),t=we(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",a={padding:"0.5rem",backgroundColor:r},o={padding:"2px 4px",backgroundColor:r},i=null;return console.error("Error handled by React Router default ErrorBoundary:",e),i=O.createElement(O.Fragment,null,O.createElement("p",null,"💿 Hey developer 👋"),O.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",O.createElement("code",{style:o},"ErrorBoundary")," or"," ",O.createElement("code",{style:o},"errorElement")," prop on your route.")),O.createElement(O.Fragment,null,O.createElement("h2",null,"Unexpected Application Error!"),O.createElement("h3",{style:{fontStyle:"italic"}},t),n?O.createElement("pre",{style:a},n):null,i)}var Ke=O.createElement(Ye,null),Ge=class extends O.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||"idle"!==t.revalidation&&"idle"===e.revalidation?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:void 0!==e.error?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&"object"===typeof e&&e&&"digest"in e&&"string"===typeof e.digest){const t=function(e){if(e.startsWith(`${He}:ROUTE_ERROR_RESPONSE:{`))try{let t=JSON.parse(e.slice(40));if("object"===typeof t&&t&&"number"===typeof t.status&&"string"===typeof t.statusText)return new be(t.status,t.statusText,t.data)}catch{}}(e.digest);t&&(e=t)}let t=void 0!==e?O.createElement(Ae.Provider,{value:this.props.routeContext},O.createElement(De.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?O.createElement(Qe,{error:e},t):t}};Ge.contextType=Te;var Xe=new WeakMap;function Qe({children:e,error:t}){let{basename:n}=O.useContext(Le);if("object"===typeof t&&t&&"digest"in t&&"string"===typeof t.digest){let e=function(e){if(e.startsWith(`${He}:REDIRECT:{`))try{let t=JSON.parse(e.slice(28));if("object"===typeof t&&t&&"number"===typeof t.status&&"string"===typeof t.statusText&&"string"===typeof t.location&&"boolean"===typeof t.reloadDocument&&"boolean"===typeof t.replace)return t}catch{}}(t.digest);if(e){let r=Xe.get(t);if(r)throw r;let a=Se(e.location,n),o=a.absoluteURL||a.to;if(Oe(o))throw new Error("Invalid redirect location");if(Re&&!Xe.get(t)){if(!a.isExternal&&!e.reloadDocument){const n=Promise.resolve().then((()=>window.__reactRouterDataRouter.navigate(a.to,{replace:e.replace})));throw Xe.set(t,n),n}window.location.href=o}return O.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o}`})}}return e}function Ze({routeContext:e,match:t,children:n}){let r=O.useContext(ke);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),O.createElement(Ae.Provider,{value:e},n)}function et(e,t=[],n){let r=n?.state;if(null==e){if(!r)return null;if(r.errors)e=r.matches;else{if(0!==t.length||r.initialized||!(r.matches.length>0))return null;e=r.matches}}let a=e,o=r?.errors;if(null!=o){let e=a.findIndex((e=>e.route.id&&void 0!==o?.[e.route.id]));L(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),a=a.slice(0,Math.min(a.length,e+1))}let i=!1,s=-1;if(n&&r){i=r.renderFallback;for(let e=0;e<a.length;e++){let t=a[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:o}=r,l=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!o||void 0===o[t.route.id]);if(t.route.lazy||l){n.isStatic&&(i=!0),a=s>=0?a.slice(0,s+1):[a[0]];break}}}}let l=n?.onError,u=r&&l?(e,t)=>{l(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:Ee(r.matches),errorInfo:t})}:void 0;return a.reduceRight(((e,n,l)=>{let c,p=!1,f=null,d=null;r&&(c=o&&n.route.id?o[n.route.id]:void 0,f=n.route.errorElement||Ke,i&&(s<0&&0===l?(st("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),p=!0,d=null):s===l&&(p=!0,d=n.route.hydrateFallbackElement||null)));let h=t.concat(a.slice(0,l+1)),m=()=>{let t;return t=c?f:p?d:n.route.Component?O.createElement(n.route.Component,null):n.route.element?n.route.element:e,O.createElement(Ze,{match:n,routeContext:{outlet:e,matches:h,isDataRoute:null!=r},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||0===l)?O.createElement(Ge,{location:r.location,revalidation:r.revalidation,component:f,error:c,children:m(),routeContext:{outlet:null,matches:h,isDataRoute:!0},onError:u}):m()}),null)}function tt(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function nt(e){let t=O.useContext(ke);return L(t,tt(e)),t}function rt(e){let t=O.useContext($e);return L(t,tt(e)),t}function at(e){let t=function(e){let t=O.useContext(Ae);return L(t,tt(e)),t}(e),n=t.matches[t.matches.length-1];return L(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function ot(){let e=O.useContext(De),t=rt("useRouteError"),n=at("useRouteError");return void 0!==e?e:t.errors?.[n]}var it={};function st(e,t,n){t||it[e]||(it[e]=!0,F(!1,n))}var lt={};function ut(e,t){e||lt[t]||(lt[t]=!0,console.warn(t))}k.useOptimistic;O.memo(ct);function ct({routes:e,manifest:t,future:n,state:r,isStatic:a,onError:o}){return Ve(e,void 0,{manifest:t,state:r,isStatic:a,onError:o,future:n})}function pt({to:e,replace:t,state:n,relative:r}){L(Be(),"<Navigate> may be used only in the context of a <Router> component.");let{static:a}=O.useContext(Le);F(!a,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:o}=O.useContext(Ae),{pathname:i}=Ue(),s=qe(),l=fe(e,pe(o),i,"path"===r),u=JSON.stringify(l);return O.useEffect((()=>{s(JSON.parse(u),{replace:t,state:n,relative:r})}),[s,u,r,t,n]),null}function ft(e){L(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function dt({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:a,static:o=!1,useTransitions:i}){L(!Be(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let s=e.replace(/^\/*/,"/"),l=O.useMemo((()=>({basename:s,navigator:a,static:o,useTransitions:i,future:{}})),[s,a,o,i]);"string"===typeof n&&(n=B(n));let{pathname:u="/",search:c="",hash:p="",state:f=null,key:d="default",mask:h}=n,m=O.useMemo((()=>{let e=se(u,s);return null==e?null:{location:{pathname:e,search:c,hash:p,state:f,key:d,mask:h},navigationType:r}}),[s,u,c,p,f,d,r,h]);return F(null!=m,`<Router basename="${s}"> is not able to match the URL "${u}${c}${p}" because it does not start with the basename, so the <Router> won't render anything.`),null==m?null:O.createElement(Le.Provider,{value:l},O.createElement(Fe.Provider,{children:t,value:m}))}function ht({children:e,location:t}){return Ve(mt(e),t)}O.Component;function mt(e,t=[]){let n=[];return O.Children.forEach(e,((e,r)=>{if(!O.isValidElement(e))return;let a=[...t,r];if(e.type===O.Fragment)return void n.push.apply(n,mt(e.props.children,a));L(e.type===ft,`[${"string"===typeof e.type?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),L(!e.props.index||!e.props.children,"An index route cannot have child routes.");let o={id:e.props.id||a.join("-"),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:!0===e.props.hasErrorBoundary||null!=e.props.ErrorBoundary||null!=e.props.errorElement,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(o.children=mt(e.props.children,a)),n.push(o)})),n}var gt="get",yt="application/x-www-form-urlencoded";function vt(e){return"undefined"!==typeof HTMLElement&&e instanceof HTMLElement}var bt=null;var wt=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Et(e){return null==e||wt.has(e)?e:(F(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${yt}"`),null)}function Rt(e,t){let n,r,a,o,i;if(vt(s=e)&&"form"===s.tagName.toLowerCase()){let i=e.getAttribute("action");r=i?se(i,t):null,n=e.getAttribute("method")||gt,a=Et(e.getAttribute("enctype"))||yt,o=new FormData(e)}else if(function(e){return vt(e)&&"button"===e.tagName.toLowerCase()}(e)||function(e){return vt(e)&&"input"===e.tagName.toLowerCase()}(e)&&("submit"===e.type||"image"===e.type)){let i=e.form;if(null==i)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let s=e.getAttribute("formaction")||i.getAttribute("action");if(r=s?se(s,t):null,n=e.getAttribute("formmethod")||i.getAttribute("method")||gt,a=Et(e.getAttribute("formenctype"))||Et(i.getAttribute("enctype"))||yt,o=new FormData(i,e),!function(){if(null===bt)try{new FormData(document.createElement("form"),0),bt=!1}catch(e){bt=!0}return bt}()){let{name:t,type:n,value:r}=e;if("image"===n){let e=t?`${t}.`:"";o.append(`${e}x`,"0"),o.append(`${e}y`,"0")}else t&&o.append(t,r)}}else{if(vt(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=gt,r=null,a=yt,i=e}var s;return o&&"text/plain"===a&&(i=o,o=void 0),{action:r,method:n.toLowerCase(),encType:a,formData:o,body:i}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");"undefined"!==typeof window?window:"undefined"!==typeof globalThis&&globalThis;function St(e,t){if(!1===e||null===e||"undefined"===typeof e)throw new Error(t)}Symbol("SingleFetchRedirect");function xt(e,t,n,r){let a="string"===typeof e?new URL(e,"undefined"===typeof window?"server://singlefetch/":window.location.origin):e;return n?a.pathname.endsWith("/")?a.pathname=`${a.pathname}_.${r}`:a.pathname=`${a.pathname}.${r}`:"/"===a.pathname?a.pathname=`_root.${r}`:t&&"/"===se(a.pathname,t)?a.pathname=`${me(t)}/_root.${r}`:a.pathname=`${me(a.pathname)}.${r}`,a}async function _t(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise((()=>{}))}}function Ct(e){return null!=e&&"string"===typeof e.page}function Ot(e){return null!=e&&(null==e.href?"preload"===e.rel&&"string"===typeof e.imageSrcSet&&"string"===typeof e.imageSizes:"string"===typeof e.rel&&"string"===typeof e.href)}function kt(e,t,n,r,a,o){let i=(e,t)=>!n[t]||e.route.id!==n[t].route.id,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith("*")&&n[t].params["*"]!==e.params["*"];return"assets"===o?t.filter(((e,t)=>i(e,t)||s(e,t))):"data"===o?t.filter(((t,o)=>{let l=r.routes[t.route.id];if(!l||!l.hasLoader)return!1;if(i(t,o)||s(t,o))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(a.pathname+a.search+a.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if("boolean"===typeof r)return r}return!0})):[]}function $t(e,t,{includeHydrateFallback:n}={}){return r=e.map((e=>{let r=t.routes[e.route.id];if(!r)return[];let a=[r.module];return r.clientActionModule&&(a=a.concat(r.clientActionModule)),r.clientLoaderModule&&(a=a.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(a=a.concat(r.hydrateFallbackModule)),r.imports&&(a=a.concat(r.imports)),a})).flat(1),[...new Set(r)];var r}function Tt(e,t){let n=new Set,r=new Set(t);return e.reduce(((e,a)=>{if(t&&!Ct(a)&&"script"===a.as&&a.href&&r.has(a.href))return e;let o=JSON.stringify(function(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}(a));return n.has(o)||(n.add(o),e.push({key:o,link:a})),e}),[])}function Nt(e,t){return"lazy"===e.mode&&!0===t}function Pt(){let e=O.useContext(ke);return St(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function Mt(){let e=O.useContext($e);return St(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var jt=O.createContext(void 0);function Lt(){let e=O.useContext(jt);return St(e,"You must render this element inside a <HydratedRouter> element"),e}function Ft(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function At(e,t,n){if(n&&!Wt)return[e[0]];if(t){let n=e.findIndex((e=>void 0!==t[e.route.id]));return e.slice(0,n+1)}return e}jt.displayName="FrameworkContext";function Dt({page:e,...t}){let n=Ne(),{nonce:r}=Lt(),{router:a}=Pt(),o=O.useMemo((()=>I(a.routes,e,a.basename)),[a.routes,e,a.basename]);return o?(null==t.nonce&&r&&(t={...t,nonce:r}),n?O.createElement(Bt,{page:e,matches:o,...t}):O.createElement(Ut,{page:e,matches:o,...t})):null}function Ht(e){let{manifest:t,routeModules:n}=Lt(),[r,a]=O.useState([]);return O.useEffect((()=>{let r=!1;return async function(e,t,n){return Tt((await Promise.all(e.map((async e=>{let r=t.routes[e.route.id];if(r){let e=await _t(r,n);return e.links?e.links():[]}return[]})))).flat(1).filter(Ot).filter((e=>"stylesheet"===e.rel||"preload"===e.rel)).map((e=>"stylesheet"===e.rel?{...e,rel:"prefetch",as:"style"}:{...e,rel:"prefetch"})))}(e,t,n).then((e=>{r||a(e)})),()=>{r=!0}}),[e,t,n]),r}function Bt({page:e,matches:t,...n}){let r=Ue(),{future:a}=Lt(),{basename:o}=Pt(),i=O.useMemo((()=>{if(e===r.pathname+r.search+r.hash)return[];let n=xt(e,o,a.v8_trailingSlashAwareDataRequests,"rsc"),i=!1,s=[];for(let e of t)"function"===typeof e.route.shouldRevalidate?i=!0:s.push(e.route.id);return i&&s.length>0&&n.searchParams.set("_routes",s.join(",")),[n.pathname+n.search]}),[o,a.v8_trailingSlashAwareDataRequests,e,r,t]);return O.createElement(O.Fragment,null,i.map((e=>O.createElement("link",{key:e,rel:"prefetch",as:"fetch",href:e,...n}))))}function Ut({page:e,matches:t,...n}){let r=Ue(),{future:a,manifest:o,routeModules:i}=Lt(),{basename:s}=Pt(),{loaderData:l,matches:u}=Mt(),c=O.useMemo((()=>kt(e,t,u,o,r,"data")),[e,t,u,o,r]),p=O.useMemo((()=>kt(e,t,u,o,r,"assets")),[e,t,u,o,r]),f=O.useMemo((()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,u=!1;if(t.forEach((e=>{let t=o.routes[e.route.id];t&&t.hasLoader&&(!c.some((t=>t.route.id===e.route.id))&&e.route.id in l&&i[e.route.id]?.shouldRevalidate||t.hasClientLoader?u=!0:n.add(e.route.id))})),0===n.size)return[];let p=xt(e,s,a.v8_trailingSlashAwareDataRequests,"data");return u&&n.size>0&&p.searchParams.set("_routes",t.filter((e=>n.has(e.route.id))).map((e=>e.route.id)).join(",")),[p.pathname+p.search]}),[s,a.v8_trailingSlashAwareDataRequests,l,r,o,c,t,e,i]),d=O.useMemo((()=>$t(p,o)),[p,o]),h=Ht(p);return O.createElement(O.Fragment,null,f.map((e=>O.createElement("link",{key:e,rel:"prefetch",as:"fetch",href:e,...n}))),d.map((e=>O.createElement("link",{key:e,rel:"modulepreload",href:e,...n}))),h.map((({key:e,link:t})=>O.createElement("link",{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin}))))}var Wt=!1;function It(e){let{manifest:t,serverHandoffString:n,isSpaMode:r,renderMeta:a,routeDiscovery:o,ssr:i,nonce:s}=Lt(),{router:l,static:u,staticContext:c}=Pt(),{matches:p}=Mt(),f=Ne(),d=Nt(o,i);null==e.nonce&&s&&(e={...e,nonce:s}),a&&(a.didRenderScripts=!0);let h=At(p,null,r);O.useEffect((()=>{Wt=!0}),[]);let m=O.useMemo((()=>{if(f)return null;let r=c?`window.__reactRouterContext = ${n};window.__reactRouterContext.stream = new ReadableStream({start(controller){window.__reactRouterContext.streamController = controller;}}).pipeThrough(new TextEncoderStream());`:" ",a=u?`${t.hmr?.runtime?`import ${JSON.stringify(t.hmr.runtime)};`:""}${d?"":`import ${JSON.stringify(t.url)}`};\n${h.map(((e,n)=>{let r=`route${n}`,a=t.routes[e.route.id];St(a,`Route ${e.route.id} not found in manifest`);let{clientActionModule:o,clientLoaderModule:i,clientMiddlewareModule:s,hydrateFallbackModule:l,module:u}=a,c=[...o?[{module:o,varName:`${r}_clientAction`}]:[],...i?[{module:i,varName:`${r}_clientLoader`}]:[],...s?[{module:s,varName:`${r}_clientMiddleware`}]:[],...l?[{module:l,varName:`${r}_HydrateFallback`}]:[],{module:u,varName:`${r}_main`}];return 1===c.length?`import * as ${r} from ${JSON.stringify(u)};`:[c.map((e=>`import * as ${e.varName} from "${e.module}";`)).join("\n"),`const ${r} = {${c.map((e=>`...${e.varName}`)).join(",")}};`].join("\n")})).join("\n")}\n ${d?`window.__reactRouterManifest = ${JSON.stringify(function({sri:e,...t},n){let r=new Set(n.state.matches.map((e=>e.route.id))),a=n.state.location.pathname.split("/").filter(Boolean),o=["/"];for(a.pop();a.length>0;)o.push(`/${a.join("/")}`),a.pop();o.forEach((e=>{let t=q(n.routes,e,n.basename||"/",!1,n.branches);t&&t.forEach((e=>r.add(e.route.id)))}));let i=[...r].reduce(((e,n)=>Object.assign(e,{[n]:t.routes[n]})),{});return{...t,routes:i,sri:!!e||void 0}}(t,l),null,2)};`:""}\n window.__reactRouterRouteModules = {${h.map(((e,t)=>`${JSON.stringify(e.route.id)}:route${t}`)).join(",")}};\n\nimport(${JSON.stringify(t.entry.module)});`:" ";return O.createElement(O.Fragment,null,O.createElement("script",{...e,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:r},type:void 0}),O.createElement("script",{...e,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:a},type:"module",async:!0}))}),[]),g=Wt||f?[]:[...new Set(t.entry.imports.concat($t(h,t,{includeHydrateFallback:!0})))],y="object"===typeof t.sri?t.sri:{};return ut(!f,"The <Scripts /> element is a no-op when using RSC and can be safely removed."),Wt||f?null:O.createElement(O.Fragment,null,"object"===typeof t.sri?O.createElement("script",{...e,"rr-importmap":"",type:"importmap",suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:JSON.stringify({integrity:y})}}):null,d?null:O.createElement("link",{rel:"modulepreload",href:t.url,crossOrigin:e.crossOrigin,integrity:y[t.url],nonce:e.nonce,suppressHydrationWarning:!0}),O.createElement("link",{rel:"modulepreload",href:t.entry.module,crossOrigin:e.crossOrigin,integrity:y[t.entry.module],nonce:e.nonce,suppressHydrationWarning:!0}),g.map((t=>O.createElement("link",{key:t,rel:"modulepreload",href:t,crossOrigin:e.crossOrigin,integrity:y[t],nonce:e.nonce,suppressHydrationWarning:!0}))),m)}function qt(...e){return t=>{e.forEach((e=>{"function"===typeof e?e(t):null!=e&&(e.current=t)}))}}O.Component;function zt({error:e,isOutsideRemixApp:t}){let{nonce:n}=Lt();console.error(e);let r,a=O.createElement("script",{nonce:n,dangerouslySetInnerHTML:{__html:'\n console.log(\n "💿 Hey developer 👋. You can provide a way better UX than this when your app throws errors. Check out https://reactrouter.com/how-to/error-boundary for more information."\n );\n '}});if(we(e))return O.createElement(Jt,{title:"Unhandled Thrown Response!"},O.createElement("h1",{style:{fontSize:"24px"}},e.status," ",e.statusText),a);if(e instanceof Error)r=e;else{let t=null==e?"Unknown Error":"object"===typeof e&&"toString"in e?e.toString():JSON.stringify(e);r=new Error(t)}return O.createElement(Jt,{title:"Application Error!",isOutsideRemixApp:t},O.createElement("h1",{style:{fontSize:"24px"}},"Application Error"),O.createElement("pre",{style:{padding:"2rem",background:"hsla(10, 50%, 50%, 0.1)",color:"red",overflow:"auto"}},r.stack),a)}function Jt({title:e,renderScripts:t,isOutsideRemixApp:n,children:r}){let{routeModules:a}=Lt();return a.root?.Layout&&!n?r:O.createElement("html",{lang:"en"},O.createElement("head",null,O.createElement("meta",{charSet:"utf-8"}),O.createElement("meta",{name:"viewport",content:"width=device-width,initial-scale=1,viewport-fit=cover"}),O.createElement("title",null,e)),O.createElement("body",null,O.createElement("main",{style:{fontFamily:"system-ui, sans-serif",padding:"2rem"}},r,t?O.createElement(It,null):null)))}var Vt="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement;try{Vt&&(window.__reactRouterVersion="7.18.2")}catch(e){}function Yt({basename:e,children:t,useTransitions:n,window:r}){let a=O.useRef();null==a.current&&(a.current=j({window:r,v5Compat:!0}));let o=a.current,[i,s]=O.useState({action:o.action,location:o.location}),l=O.useCallback((e=>{!1===n?s(e):O.startTransition((()=>s(e)))}),[n]);return O.useLayoutEffect((()=>o.listen(l)),[o,l]),O.createElement(dt,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:o,useTransitions:n})}var Kt=O.forwardRef((function({onClick:e,discover:t="render",prefetch:n="none",relative:r,reloadDocument:a,replace:o,mask:i,state:s,target:l,to:u,preventScrollReset:c,viewTransition:p,defaultShouldRevalidate:f,...d},h){let{basename:m,navigator:g,useTransitions:y}=O.useContext(Le),v="string"===typeof u&&$.test(u),b=Se(u,m),w=function(e,{relative:t}={}){L(Be(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=O.useContext(Le),{hash:a,pathname:o,search:i}=Je(e,{relative:t}),s=o;return"/"!==n&&(s="/"===o?n:he([n,o])),r.createHref({pathname:s,search:i,hash:a})}(u=b.to,{relative:r}),E=Ue(),R=null;if(i){let e=fe(i,[],E.mask?E.mask.pathname:"/",!0);"/"!==m&&(e.pathname="/"===e.pathname?m:he([m,e.pathname])),R=g.createHref(e)}let[S,x,_]=function(e,t){let n=O.useContext(jt),[r,a]=O.useState(!1),[o,i]=O.useState(!1),{onFocus:s,onBlur:l,onMouseEnter:u,onMouseLeave:c,onTouchStart:p}=t,f=O.useRef(null);O.useEffect((()=>{if("render"===e&&i(!0),"viewport"===e){let e=new IntersectionObserver((e=>{e.forEach((e=>{i(e.isIntersecting)}))}),{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}}),[e]),O.useEffect((()=>{if(r){let e=setTimeout((()=>{i(!0)}),100);return()=>{clearTimeout(e)}}}),[r]);let d=()=>{a(!0)},h=()=>{a(!1),i(!1)};return n?"intent"!==e?[o,f,{}]:[o,f,{onFocus:Ft(s,d),onBlur:Ft(l,h),onMouseEnter:Ft(u,d),onMouseLeave:Ft(c,h),onTouchStart:Ft(p,d)}]:[!1,f,{}]}(n,d),C=function(e,{target:t,replace:n,mask:r,state:a,preventScrollReset:o,relative:i,viewTransition:s,defaultShouldRevalidate:l,useTransitions:u}={}){let c=qe(),p=Ue(),f=Je(e,{relative:i});return O.useCallback((d=>{if(function(e,t){return 0===e.button&&(!t||"_self"===t)&&!function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e)}(d,t)){d.preventDefault();let t=void 0!==n?n:H(p)===H(f),h=()=>c(e,{replace:t,mask:r,state:a,preventScrollReset:o,relative:i,viewTransition:s,defaultShouldRevalidate:l});u?O.startTransition((()=>h())):h()}}),[p,c,f,n,r,a,t,e,o,i,s,l,u])}(u,{replace:o,mask:i,state:s,target:l,preventScrollReset:c,relative:r,viewTransition:p,defaultShouldRevalidate:f,useTransitions:y});let k=!(b.isExternal||a),T=O.createElement("a",{...d,..._,href:(k?R:void 0)||b.absoluteURL||w,onClick:k?function(t){e&&e(t),t.defaultPrevented||C(t)}:e,ref:qt(h,x),target:l,"data-discover":v||"render"!==t?void 0:"true"});return S&&!v?O.createElement(O.Fragment,null,T,O.createElement(Dt,{page:w})):T}));Kt.displayName="Link",O.forwardRef((function({"aria-current":e="page",caseSensitive:t=!1,className:n="",end:r=!1,style:a,to:o,viewTransition:i,children:s,...l},u){let c=Je(o,{relative:l.relative}),p=Ue(),f=O.useContext($e),{navigator:d,basename:h}=O.useContext(Le),m=null!=f&&function(e,{relative:t}={}){let n=O.useContext(Pe);L(null!=n,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Qt("useViewTransitionState"),a=Je(e,{relative:t});if(!n.isTransitioning)return!1;let o=se(n.currentLocation.pathname,r)||n.currentLocation.pathname,i=se(n.nextLocation.pathname,r)||n.nextLocation.pathname;return null!=re(a.pathname,i)||null!=re(a.pathname,o)}(c)&&!0===i,g=d.encodeLocation?d.encodeLocation(c).pathname:c.pathname,y=p.pathname,v=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(y=y.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&h&&(v=se(v,h)||v);const b="/"!==g&&g.endsWith("/")?g.length-1:g.length;let w,E=y===g||!r&&y.startsWith(g)&&"/"===y.charAt(b),R=null!=v&&(v===g||!r&&v.startsWith(g)&&"/"===v.charAt(g.length)),S={isActive:E,isPending:R,isTransitioning:m},x=E?e:void 0;w="function"===typeof n?n(S):[n,E?"active":null,R?"pending":null,m?"transitioning":null].filter(Boolean).join(" ");let _="function"===typeof a?a(S):a;return O.createElement(Kt,{...l,"aria-current":x,className:w,ref:u,style:_,to:o,viewTransition:i},"function"===typeof s?s(S):s)})).displayName="NavLink";var Gt=O.forwardRef((({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:a,state:o,method:i=gt,action:s,onSubmit:l,relative:u,preventScrollReset:c,viewTransition:p,defaultShouldRevalidate:f,...d},h)=>{let{useTransitions:m}=O.useContext(Le),g=tn(),y=function(e,{relative:t}={}){let{basename:n}=O.useContext(Le),r=O.useContext(Ae);L(r,"useFormAction must be used inside a RouteContext");let[a]=r.matches.slice(-1),o={...Je(e||".",{relative:t})},i=Ue();if(null==e){o.search=i.search;let e=new URLSearchParams(o.search),t=e.getAll("index");if(t.some((e=>""===e))){e.delete("index"),t.filter((e=>e)).forEach((t=>e.append("index",t)));let n=e.toString();o.search=n?`?${n}`:""}}e&&"."!==e||!a.route.index||(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index");"/"!==n&&(o.pathname="/"===o.pathname?n:he([n,o.pathname]));return H(o)}(s,{relative:u}),v="get"===i.toLowerCase()?"get":"post",b="string"===typeof s&&$.test(s);return O.createElement("form",{ref:h,method:v,action:y,onSubmit:r?l:e=>{if(l&&l(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute("formmethod")||i,d=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:a,state:o,relative:u,preventScrollReset:c,viewTransition:p,defaultShouldRevalidate:f});m&&!1!==n?O.startTransition((()=>d())):d()},...d,"data-discover":b||"render"!==e?void 0:"true"})}));function Xt(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Qt(e){let t=O.useContext(ke);return L(t,Xt(e)),t}Gt.displayName="Form";var Zt=0,en=()=>`__${String(++Zt)}__`;function tn(){let{router:e}=Qt("useSubmit"),{basename:t}=O.useContext(Le),n=at("useRouteId"),r=e.fetch,a=e.navigate;return O.useCallback((async(e,o={})=>{let{action:i,method:s,encType:l,formData:u,body:c}=Rt(e,t);if(!1===o.navigate){let e=o.fetcherKey||en();await r(e,n,o.action||i,{defaultShouldRevalidate:o.defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:u,body:c,formMethod:o.method||s,formEncType:o.encType||l,flushSync:o.flushSync})}else await a(o.action||i,{defaultShouldRevalidate:o.defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:u,body:c,formMethod:o.method||s,formEncType:o.encType||l,replace:o.replace,state:o.state,fromRouteId:n,flushSync:o.flushSync,viewTransition:o.viewTransition})}),[r,a,t,n])}n(4423);var nn=window.wp.dom;var rn=({disabled:e,help:t,label:n,name:i,onChange:s,options:l,requiresFeature:u,requiresSync:c,syncedValue:p,type:f,value:d})=>{const{getFeature:h,isBusy:m,settings:g,willSettingRequireSync:y}=C();let v=[];u&&(v=Array.isArray(u)?u:[u]);const b=v.map((e=>h(e))).filter((e=>!e.isAvailable||!0!==g[e.slug]?.active)),w=t?React.createElement("span",{dangerouslySetInnerHTML:{__html:(0,nn.safeHTML)(t)}}):null,E=l?l.map((e=>({value:e.value,label:React.createElement("span",{dangerouslySetInnerHTML:{__html:(0,nn.safeHTML)(e.label)}})}))):[],R=b.map((e=>e.shortTitle)),S="active"===i?(0,a._n)("The %s feature must be enabled to use this feature.","The %s features must be enabled to use this feature.",R.length,"elasticpress"):(0,a._n)("The %s feature must be enabled to use the following setting.","The %s features must be enabled to use the following setting.",R.length,"elasticpress"),x="active"===i?(0,a.__)("Enabling this feature requires re-syncing your content.","elasticpress"):(0,a.__)("A change to following setting requires re-syncing your content.","elasticpress"),_=m||e||b.length>0,O=y(d,p,c),k=e=>{s(e?"1":"0")},$=e=>{const t=e.map((e=>l.find((t=>t.label===e))?.value)).filter(Boolean).join(",");s(t)},T=0===R.length?"":1===R.length?R[0]:2===R.length?(0,a.sprintf)((0,a._x)("%1$s and %2$s","two feature names","elasticpress"),R[0],R[1]):(0,a.sprintf)((0,a._x)("%1$s and %2$s","multiple feature names","elasticpress"),R.slice(0,-1).join((0,a.__)(", ","elasticpress")),R[R.length-1]);return React.createElement(React.Fragment,null,b.length>0?React.createElement(o.Notice,{isDismissible:!1,status:"active"===i?"error":"warning"},(0,a.sprintf)(S,T)):null,O?React.createElement(o.Notice,{isDismissible:!1,status:"warning"},x):null,React.createElement("div",{className:"ep-dashboard-control"},(()=>{switch(f){case"checkbox":return React.createElement(o.CheckboxControl,{checked:"1"===d,help:w,label:n,onChange:k,disabled:_,__nextHasNoMarginBottom:!0});case"hidden":return null;case"markup":return React.createElement(r.RawHTML,null,(0,nn.safeHTML)(n));case"multiple":{const e=l.map((e=>e.label)),t=d.split(",").map((e=>l.find((t=>t.value===e))?.label)).filter(Boolean);return React.createElement(o.FormTokenField,{__experimentalExpandOnFocus:!0,help:"",label:n,onChange:$,disabled:_,suggestions:e,value:t,__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0})}case"radio":return React.createElement(o.RadioControl,{help:w,label:n,onChange:s,options:E,disabled:_,selected:d});case"select":return React.createElement(o.SelectControl,{help:w,label:n,onChange:s,options:l,disabled:_,value:d,__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0});case"toggle":return React.createElement(o.ToggleControl,{checked:d,help:w,label:n,onChange:s,disabled:_,__nextHasNoMarginBottom:!0});case"textarea":return React.createElement(o.TextareaControl,{help:w,label:n,onChange:s,disabled:_,value:d,__nextHasNoMarginBottom:!0});default:return React.createElement(o.TextControl,{help:w,label:n,onChange:s,disabled:_,value:d,type:f,__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0})}})()))},an=({feature:e,settingsSchema:t})=>{const{getFeature:n,settings:r,setSettings:a,syncedSettings:i}=C(),{isAvailable:s,defaultSettings:l,fieldGroups:u}=n(e),c=t=>{if(!t||0===Object.keys(t).length)return!0;let n;if(t.conditions&&(n=Object.entries(t.conditions)),0===n.length)return!0;const a=([t,n])=>{const a=l[t]??!1;return(r[e]?.[t]||a)===n};return"OR"===(t.relationship||"AND").toUpperCase()?n.some(a):n.every(a)},p=t=>{const{default:n,disabled:o,help:l,key:u,label:p,options:f,requires_feature:d,requires_sync:h,requires_fields:m,type:g,fields:y}=t;if(!c(m))return null;let v="undefined"!==typeof r[e]?.[u]?r[e][u]:n;return"active"!==u||s||(v=!1),React.createElement(rn,{disabled:o||!s,key:u,help:l,label:p,name:u,onChange:t=>((t,n)=>{a({...r,[e]:{...r[e],[t]:n}})})(u,t),options:f,syncedValue:i?.[e]?.[u],requiresFeature:d,requiresSync:h,type:g,value:v,fields:y})},f=[];let d=null,h=[],m=0;const g=()=>{if(0===h.length)return;const e=u[h[0].field_group_slug];c(e.requires_fields)&&(f.push(React.createElement("div",{className:"ep-field-group",key:`${d}-${m}`},React.createElement(o.Card,null,e&&React.createElement(o.CardHeader,null,React.createElement("strong",null,e.label)),React.createElement(o.CardBody,null,h.map(p))))),h=[],m++)};return t.forEach((e=>{const t=e.field_group_slug;t&&d!==t&&(g(),d=t),t?h.push(e):(g(),d=null,f.push(p(e)))})),g(),f.length>1?f:1===f.length?f[0]:null},on=({feature:e})=>{const{epioLogoUrl:t,getFeature:n}=C(),{isPoweredByEpio:i,reqStatusCode:s,reqStatusMessages:l,settingsSchema:u,summary:c,title:p}=n(e);return React.createElement(React.Fragment,null,React.createElement("h3",{className:"ep-dashboard-heading"},React.createElement(r.RawHTML,null,(0,nn.safeHTML)(p)),i?React.createElement("img",{alt:(0,a.__)("ElasticPress.io logo"),height:"20",src:t,width:"110"}):null),React.createElement("p",{dangerouslySetInnerHTML:{__html:(0,nn.safeHTML)(c)}}),l.map(((e,t)=>React.createElement(o.Notice,{isDismissible:!1,key:t,status:[2,3].includes(s)?"error":"warning"},React.createElement("span",{dangerouslySetInnerHTML:{__html:(0,nn.safeHTML)(e)}})))),React.createElement(an,{feature:e,settingsSchema:u}))};const sn=({title:e,to:t,isActive:n})=>{const r=qe();return React.createElement("button",{className:"ep-dashboard-tab "+(n?"is-active":""),"aria-current":n?"page":void 0,onClick:()=>r(t),type:"button",id:`title-${e}-to-${t}`},e)},ln=({groupedFeatures:e,activeFeature:t})=>{const n=e.find((e=>e.features.some((e=>e.slug===t)))),r=n?.groupSlug||e[0]?.groupSlug;return React.createElement("div",{className:"ep-dashboard-outer-tabs"},React.createElement("div",{className:"ep-dashboard-tabs-nav"},e.map((({groupSlug:e,title:t,features:n})=>React.createElement(sn,{key:e,slug:e,title:t,to:`/${n[0]?.slug||""}`,isActive:e===r})))))},un=({groupedFeatures:e,activeFeature:t})=>{const n=e.find((e=>e.features.some((e=>e.slug===t))));return n?React.createElement(o.Panel,{className:"ep-dashboard-panel"},React.createElement(o.PanelBody,null,React.createElement("div",{className:"ep-dashboard-tabs"},React.createElement("div",{className:"ep-dashboard-tabs-nav"},n.features.map((({slug:e,shortTitle:n,title:r})=>React.createElement(sn,{key:e,slug:e,title:n||r||e,to:`/${e}`,isActive:t===e}))))))):null},cn=()=>{const{createNotice:e}=(0,r.useContext)(l),{features:t,isBusy:n,isModified:i,isSyncing:s,isSyncRequired:u,resetSettings:c,saveSettings:p,setIsSyncing:f}=C(),{feature:d}=ze(),h=(0,r.useMemo)((()=>{const e=new URL(v);return e.searchParams.append("do_sync","features"),e.searchParams.append("ep_sync_nonce",b),e.toString()}),[]),m=(0,a.__)("Could not save feature settings. Please try again.","elasticpress"),g=[{url:v,label:(0,a.__)("View sync status","elasticpress")}],y=(0,a.__)("Cannot save settings while a sync is in progress.","elasticpress"),E=(0,a.__)("Changes to feature settings discarded.","elasticpress"),R=[{url:h,label:(0,a.__)("Sync","elasticpress")}],S=(0,a.__)("If you choose to sync later some settings changes may not take effect until the sync is performed. Save and sync later?","elasticpress"),x=(0,a.__)("Saving these settings will begin re-syncing your content. Save and sync now?","elasticpress"),_=(0,a.__)("Feature settings saved. Starting sync…","elasticpress"),O=(0,a.__)("Feature settings saved.","elasticpress"),[k,$]=(0,r.useState)(!1),T=(0,r.useMemo)((()=>{const e=Object.keys(w||{}).map((e=>({title:w[e].label,groupSlug:e,features:[]}))),n=e.reduce(((e,t)=>(e[t.groupSlug]=t,e)),{});t.forEach((e=>{e.isVisible&&e.group&&w[e.group]&&n[e.group].features.push(e)}));const r=e.filter((e=>e.features.length>0)),o=t.filter((e=>e.isVisible&&(!e.group||!w[e.group])));return o.length>0&&r.push({title:(0,a.__)("Other","elasticpress"),groupSlug:"other",features:o}),r}),[t]),N=t=>{if("is_syncing"===t.data)return e("error",y,{actions:g}),void f(!0);const n=`${(0,a.__)("ElasticPress: Could not save feature settings.","elasticpress")}\n${t.message}`;console.error(n),e("error",m)},P=T.find((e=>e.features.some((e=>e.slug===d))))?.title||null||T[0];return React.createElement("form",{onReset:t=>{t.preventDefault(),c(),e("success",E)},onSubmit:async t=>{if(t.preventDefault(),!u||window.confirm(x)){$(!1);try{await p(),u?(e("success",_),window.location=h):e("success",O)}catch(e){N(e)}}}},s?React.createElement(o.Notice,{actions:g,isDismissible:!1,status:"warning"},y):null,React.createElement("div",{className:"form-grid"},React.createElement(ln,{groupedFeatures:T,activeFeature:d}),React.createElement("div",{className:"group-content",id:`${P}-view`},React.createElement(un,{groupedFeatures:T,activeFeature:d}),React.createElement("div",{className:"ep-dashboard-content",id:`${d}-view`},d?React.createElement(on,{feature:d}):React.createElement(o.Notice,{status:"info",isDismissible:!1},(0,a.__)("Select a feature above.","elasticpress"))))),s&&React.createElement(o.Notice,{actions:g,isDismissible:!1,status:"warning"},y),React.createElement(o.Flex,{justify:"start"},React.createElement(o.FlexItem,null,React.createElement(o.Button,{disabled:n||s,isBusy:n&&!k,type:"submit",variant:"primary"},u?(0,a.__)("Save and sync now","elasticpress"):(0,a.__)("Save changes","elasticpress"))),u?React.createElement(o.FlexItem,null,React.createElement(o.Button,{disabled:n||s,isBusy:n&&k,onClick:async()=>{if(window.confirm(S)){$(!0);try{await p(!1),e("success",O,{actions:R})}catch(e){N(e)}}},type:"button",variant:"secondary"},(0,a.__)("Save and sync later","elasticpress"))):null,i?React.createElement(o.FlexItem,null,React.createElement(o.Button,{disabled:n,type:"reset",variant:"tertiary"},(0,a.__)("Discard changes","elasticpress"))):null))};var pn=()=>{const{features:e}=C(),t=(0,r.useMemo)((()=>{const t=e.filter((e=>e.isVisible));return{defaultFeature:t[0]?.slug||"",hasFeatures:t.length>0}}),[e]);return React.createElement(Yt,null,React.createElement(ht,null,React.createElement(ft,{path:"/:feature",element:React.createElement(cn,null)}),t.hasFeatures?React.createElement(ft,{path:"*",element:React.createElement(pt,{to:`/${t.defaultFeature}`,replace:!0})}):React.createElement(ft,{path:"*",element:React.createElement(o.Notice,{status:"info",isDismissible:!1},(0,a.__)("No features available.","elasticpress"))})))};const fn=()=>React.createElement(p,{title:(0,a.__)("Features","elasticpress")},React.createElement(_,{apiUrl:f,defaultSettings:y||g,epioLogoUrl:d,features:h,indexMeta:m,syncedSettings:g,syncUrl:v},React.createElement("p",null,(0,r.createInterpolateElement)((0,a.__)("ElasticPress Features add functionality to enhance search and queries on your site. You may choose to activate some or all of these Features depending on your needs. You can learn more about each Feature <a>here</a>.","elasticpress"),{a:React.createElement("a",{target:"_blank",href:"https://www.elasticpress.io/resources/articles/configuring-elasticpress-via-the-plugin-dashboard/",rel:"noreferrer"})})),React.createElement(pn,null)));if("function"===typeof r.createRoot){(0,r.createRoot)(document.getElementById("ep-dashboard")).render(React.createElement(fn,null))}else(0,r.render)(React.createElement(fn,null),document.getElementById("ep-dashboard"))}(); |