| Current Path : /home/blindman/www/wp-content/plugins/redirection/build/ |
| Current File : /home/blindman/www/wp-content/plugins/redirection/build/redirection.js |
/*! Redirection v5.10.0 - please refer to license.txt for license information */
(()=>{var e={405(e,t,r){"use strict";var n=r.cw(function(e,t){var r=o(),n="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},i=r.useSyncExternalStore,s=r.useRef,a=r.useEffect,l=r.useMemo,c=r.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,r,o,u){var d=s(null);if(null===d.current){var p={hasValue:!1,value:null};d.current=p}else p=d.current;d=l(function(){function e(e){if(!a){if(a=!0,i=e,e=o(e),void 0!==u&&p.hasValue){var t=p.value;if(u(t,e))return s=t}return s=e}if(t=s,n(i,e))return t;var r=o(e);return void 0!==u&&u(t,r)?(i=e,t):(i=e,s=r)}var i,s,a=!1,l=void 0===r?null:r;return[function(){return e(t())},null===l?void 0:function(){return e(l())}]},[t,r,o,u]);var h=i(e,d[0],d[1]);return a(function(){p.hasValue=!0,p.value=h},[h]),c(h),h}}),i=r.cw(function(e,t){e.exports=n()}),o=()=>r(609);const s=window.ReactDOM,a=window.wp.i18n;function l(){return l.c||(l.c=r.t(o(),2))}function c(){return c.c||(c.c=r.n(o()))}o();const u=window.ReactJSXRuntime,d=o().createContext(void 0),p=e=>{const t=o().useContext(d);if(e)return e;if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},h=({client:e,children:t})=>(o().useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,u.jsx)(d.Provider,{value:e,children:t}));function f(e){var t,r,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(r=f(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}const m=function(){for(var e,t,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=f(e))&&(n&&(n+=" "),n+=t);return n};function g(){return g=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},g.apply(null,arguments)}function _(e,t){if(null==e)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}var y=o().useLayoutEffect,v=function(e,t){"function"!=typeof e?e.current=t:e(t)},b={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0",display:"block"},x=function(e){Object.keys(b).forEach(function(t){e.style.setProperty(t,b[t],"important")})},w=null,j=function(e,t){var r=e.scrollHeight;return"border-box"===t.sizingStyle.boxSizing?r+t.borderSize:r-t.paddingSize},S=function(){},k=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width","wordBreak","wordSpacing","scrollbarGutter"],C=!!document.documentElement.currentStyle;function T(e,t,r){var n,i,s=(n=r,i=c()().useRef(n),y(function(){i.current=n}),i);o().useLayoutEffect(function(){var r=function(e){return s.current(e)};if(e)return e.addEventListener(t,r),function(){return e.removeEventListener(t,r)}},[])}var E=["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"],R=function(e,t){var r,n=e.cacheMeasurements,i=e.maxRows,s=e.minRows,a=e.onChange,l=void 0===a?S:a,u=e.onHeightChange,d=void 0===u?S:u,p=_(e,E),h=void 0!==p.value,f=o().useRef(null),m=function(e,t){var r=c()().useRef();return c()().useCallback(function(n){e.current=n,r.current&&v(r.current,null),r.current=t,t&&v(t,n)},[t])}(f,t),y=o().useRef(0),b=o().useRef(),R=function(){var e=f.current,t=n&&b.current?b.current:function(e){var t=window.getComputedStyle(e);if(null===t)return null;var r,n=(r=t,k.reduce(function(e,t){return e[t]=r[t],e},{})),i=n.boxSizing;return""===i?null:(C&&"border-box"===i&&(n.width=parseFloat(n.width)+parseFloat(n.borderRightWidth)+parseFloat(n.borderLeftWidth)+parseFloat(n.paddingRight)+parseFloat(n.paddingLeft)+"px"),{sizingStyle:n,paddingSize:parseFloat(n.paddingBottom)+parseFloat(n.paddingTop),borderSize:parseFloat(n.borderBottomWidth)+parseFloat(n.borderTopWidth)})}(e);if(t){b.current=t;var r=function(e,t,r,n){void 0===r&&(r=1),void 0===n&&(n=1/0),w||((w=document.createElement("textarea")).setAttribute("tabindex","-1"),w.setAttribute("aria-hidden","true"),x(w)),null===w.parentNode&&document.body.appendChild(w);var i=e.paddingSize,o=e.borderSize,s=e.sizingStyle,a=s.boxSizing;Object.keys(s).forEach(function(e){var t=e;w.style[t]=s[t]}),x(w),w.value=t;var l=j(w,e);w.value=t,l=j(w,e),w.value="x";var c=w.scrollHeight-i,u=c*r;"border-box"===a&&(u=u+i+o),l=Math.max(u,l);var d=c*n;return"border-box"===a&&(d=d+i+o),[l=Math.min(d,l),c]}(t,e.value||e.placeholder||"x",s,i),o=r[0],a=r[1];y.current!==o&&(y.current=o,e.style.setProperty("height",o+"px","important"),d(o,{rowHeight:a}))}};return o().useLayoutEffect(R),function(e,t){T(document.body,"reset",function(r){e.current.form===r.target&&t()})}(f,function(){if(!h){var e=f.current.value;requestAnimationFrame(function(){var t=f.current;t&&e!==t.value&&R()})}}),T(window,"resize",R),r=R,T(document.fonts,"loadingdone",r),o().createElement("textarea",g({},p,{onChange:function(e){h||R(),l(e)},ref:m}))},P=o().forwardRef(R);const N=function(e){const{error:t,mini:r,context:n,renderDebug:i,versions:s,noParse:l=!1,details:c=[],locale:d}=e,[p,h]=(0,o().useState)(!r);if(!p)return(0,u.jsx)("p",{children:(0,u.jsx)("button",{className:"button button-secondary",type:"button",onClick:()=>h(!0),children:(0,a.__)("Show debug",d)})});const f=l?[t]:function(e,t,r){const n=t?[t]:[],{request:i=!1,data:o}=e;n.push("");const{apiFetch:s}=i||{};s&&s.status&&s.statusText&&(n.push("Action: "+s.action),s.body&&"{}"!==s.body&&n.push("Params: "+s.body),n.push("Code: "+s.status+" "+s.statusText),n.push(""));const a=function(e){if("string"==typeof e)return e;const t=e;return 0===t.code?t.message:t.data&&t.data.wpdb?`${t.message} (${t.code}): ${t.data.wpdb}`:t.code?`${t.message} (${t.code})`:t.message}(e);return"string"==typeof a&&a.length>0&&n.push("Error: "+a),o&&n.push("Raw: "+o),r&&(n.push(""),n.push("Context:"),n.push(r)),n}(t,s,n);return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("h3",{children:(0,a.__)("Debug Information",d)}),i&&i(c.concat(f).join("\n")),(0,u.jsx)("p",{children:(0,u.jsx)(P,{readOnly:!0,cols:120,value:c.concat(f).join("\n"),maxRows:40,spellCheck:!1})})]})},O=function(e){const{locale:t}=e;return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("h2",{children:(0,a.__)("You are using an old or cached session",t)}),(0,u.jsx)("p",{children:(0,a.__)("This is usually fixed by doing one of the following:",t)}),(0,u.jsxs)("ul",{children:[(0,u.jsx)("li",{children:(0,a.__)("Reload the page - your current session is old.",t)}),(0,u.jsx)("li",{children:(0,a.__)("Log out, clear your browser cache, and log in again - your browser has cached an old session.",t)}),(0,u.jsx)("li",{children:(0,a.__)("Your admin pages are being cached. Clear this cache and try again. There may be multiple caches involved.",t)})]}),(0,u.jsx)(N,{...e,error:e.error||{},mini:!0})]})},A=({url:e,children:t,title:r,className:n})=>(0,u.jsx)("a",{href:e,target:"_blank",rel:"noopener noreferrer",title:r,className:n,children:t});function I(e){return 404===e?.request?.apiFetch?.status}function F(e){const t=e.code;return"disabled"===t||"rest_disabled"===t}function L(e){return"rest_api_redirected"===e?.code}function D(e){const t=e;return 0===t.code?t.message:t.data&&t.data.wpdb?(0,u.jsxs)("span",{children:[`${t.message} (${t.code})`,": ",(0,u.jsx)("code",{children:t.data.wpdb})]}):t.code?(0,u.jsxs)(u.Fragment,{children:[t.message," (",(0,u.jsx)("code",{children:t.code}),")"]}):t.message}const z=window.wp.element;function M(e,t){try{return(0,z.createInterpolateElement)(e.replace(/\{\{/g,"<").replace(/\}\}/g,">"),t)}catch(t){return e}}const $=({error:e,links:t,locale:r})=>{if("string"==typeof e)return(0,u.jsx)("p",{children:e});if(function(e){return void 0!==e.code&&0===e.code}(e))return(0,u.jsx)("p",{children:(0,a.__)("WordPress did not return a response. This could mean an error occurred or that the request was blocked. Please check your server error_log.",r)});if(function(e){const t=e,{request:r,code:n}=t;return!!(r&&r.status&&n)&&(-1!==[400,401,403,405].indexOf(r.status)||"rest_no_route"===n)&&0===parseInt(String(n),10)}(e))return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("p",{children:D(e)}),(0,u.jsx)("p",{children:(0,a.__)("Your REST API is probably being blocked by a security plugin. Please disable this, or configure it to allow REST API requests.",r)}),(0,u.jsx)("p",{children:(0,u.jsx)(A,{url:t.api,children:(0,a.__)("Read this REST API guide for more information.",r)})})]});if(I(e))return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("p",{children:(0,a.__)("Your WordPress REST API is returning a 404 page. This is almost certainly an external plugin or server configuration issue.",r)}),(0,u.jsx)("p",{className:"wpl-error__highlight",children:(0,u.jsx)("strong",{children:(0,a.__)("You will will need to fix this on your site. Redirection is not causing the error.",r)})}),(0,u.jsxs)("ul",{children:[(0,u.jsx)("li",{children:M((0,a.__)("Can you access your {{api}}REST API{{/api}} without it redirecting?",r),{api:(0,u.jsx)(A,{url:t.rootUrl,children:t.rootUrl})})}),(0,u.jsx)("li",{children:M((0,a.__)("Check your {{link}}Site Health{{/link}} and fix any issues.",r),{link:(0,u.jsx)(A,{url:t.siteHealth,children:t.siteHealth})})}),(0,u.jsx)("li",{children:(0,a.__)("Your server configuration is blocking access to the REST API.",r)}),(0,u.jsx)("li",{children:(0,a.__)("A security plugin or firewall is blocking access. You will need to whitelist the REST API.",r)})]}),(0,u.jsx)("p",{children:(0,u.jsx)(A,{url:t.api,children:(0,a.__)("Read this REST API guide for more information.",r)})})]});if(L(e))return(0,u.jsx)("p",{children:(0,a.__)("Your REST API is being redirected. Please remove the redirection for the API.",r)});if(function(e){return"rest_api_cors_mismatch"===e?.code}(e)){const t=e?.request?.origins?.current,n=e?.request?.origins?.test;return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("p",{children:D(e)}),(0,u.jsx)("p",{children:(0,a.__)("This admin page is loaded from a different origin than the REST API URL that WordPress is advertising. The browser will block the request until both use the same protocol, host, and port.",r)}),t&&n&&(0,u.jsxs)("ul",{children:[(0,u.jsxs)("li",{children:[(0,a.__)("Current admin page origin:",r)," ",(0,u.jsx)("code",{children:t})]}),(0,u.jsxs)("li",{children:[(0,a.__)("REST API origin:",r)," ",(0,u.jsx)("code",{children:n})]})]}),(0,u.jsx)("p",{children:(0,a.__)("Check your WordPress URL and Site URL settings, and make sure any local proxy or port-forwarded admin URL matches the REST API URL.",r)})]})}if(function(e){return 413===e?.request?.apiFetch?.status}(e))return(0,u.jsx)("p",{children:(0,a.__)("Your server has rejected the request for being too big. You will need to reconfigure it to continue.",r)});if(function(e){return void 0===e.message}(e))return(0,u.jsx)("p",{children:(0,a.__)("An unknown error occurred.",r)});if(function(e){const t=e.data;return"string"==typeof t&&-1!==t.indexOf("<b>Deprecated</b>: Directive")}(e))return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("p",{children:D(e)}),(0,u.jsx)("p",{children:(0,a.__)("Your REST API is showing a deprecated PHP error. Please fix this error.",r)})]});if(function(e){return-1!==[500,502,503].indexOf(e?.request?.apiFetch?.status??0)}(e))return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("p",{children:D(e)}),(0,u.jsx)("p",{children:(0,a.__)("This could be a security plugin, or your server is out of memory or has an external error. Please check your server error log",r)}),(0,u.jsx)("p",{children:(0,u.jsx)(A,{url:t.http,children:(0,a.__)("Read this REST API guide for more information.",r)})})]});if(F(e))return(0,u.jsx)("p",{children:(0,a.__)("Your WordPress REST API has been disabled. You will need to enable it to continue.",r)});if(function(e){return"SyntaxError"===e.code}(e)){const t=function(e){const t=e.lastIndexOf("}");if(t!==e.length)return e.substring(t+1).trim();const r=e.split("<br />").filter(e=>e);return r.slice(0,r.length-1).join(" ").trim()}(e?.request?.apiFetch?.body||"");return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("p",{children:D(e)}),(0,u.jsx)("p",{children:(0,a.__)("WordPress returned an unexpected message. This could be a PHP error from another plugin, or data inserted by your theme.",r)}),t.length>1&&(0,u.jsxs)("p",{children:[(0,u.jsxs)("strong",{children:[(0,a.__)("Possible cause",r),":"]})," ",(0,u.jsx)("code",{children:t.slice(0,1e3)})]})]})}return function(e){const t=e?.message?.toString().toLowerCase();return!!t&&("failed to fetch"===t||"not allowed to request resource"===t||-1!==t.indexOf("networkerror"))}(e)?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("p",{children:D(e)}),(0,u.jsx)("p",{children:(0,a.__)("Unable to make request due to browser security. This is typically because your WordPress and Site URL settings are inconsistent, or the request was blocked by your site CORS policy.",r)}),(0,u.jsx)("p",{children:(0,u.jsx)(A,{url:t.url,children:(0,a.__)("Read this REST API guide for more information.",r)})})]}):function(e){const{headers:t}=e.request??{};if(t&&Symbol.iterator in Object(t))for(const[e]of t)if(-1!==e.toLowerCase().indexOf("cf-"))return!0;return!1}(e)?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("p",{children:D(e)}),(0,u.jsx)("p",{children:(0,a.__)("Your REST API appears to be cached and this will cause problems. Please exclude your REST API from your caching system.",r)})]}):(0,u.jsx)("p",{children:D(e)})};function U(e,t,r){return I(e)?(0,a.__)("REST API 404"):t||(0,a.__)("Something went wrong 🙁",r)}const B=function(e){const{title:t,children:r,error:n,links:i,locale:o}=e,s=function(e){return!I(e)&&!L(e)&&!F(e)}(n),a=function(e){return!!I(e)||!!L(e)||!!F(e)}(n),l=!I(n);return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("h2",{children:U(n,t,o)}),(0,u.jsx)("div",{className:"wpl-error__title",children:(0,u.jsx)($,{error:n,links:i,locale:o})}),s&&r,(0,u.jsx)(N,{error:n,locale:o,...a?{mini:!0}:{},...!l&&e.renderDebug?{renderDebug:e.renderDebug}:{},...e.details?{details:e.details}:{},...e.versions?{versions:e.versions}:{},...e.context?{context:e.context}:{}})]})},q=function(e){const{title:t,children:r,error:n,links:i,locale:o}=e;return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("h2",{children:t||(0,a.__)("Something went wrong 🙁",o)}),(0,u.jsx)("div",{className:"wpl-error__detail",children:(0,u.jsx)($,{error:n,links:i,locale:o})}),r,(0,u.jsx)(N,{...e})]})},H=function(e){const{title:t,children:r,error:n,links:i,locale:o}=e;return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("h2",{children:t||(0,a.__)("Something went wrong 🙁",o)}),(0,u.jsx)("div",{className:"wpl-error__detail",children:(0,u.jsx)($,{error:n,links:i,locale:o})}),r,(0,u.jsx)(N,{...e})]})},W=function(e){const{locale:t}=e;return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("h2",{children:(0,a.__)("Bad data",t)}),(0,u.jsx)("p",{children:(0,a.__)("There was a problem making a request to your site. This could indicate you provided data that did not match requirements, or that the plugin sent a bad request.",t)}),(0,u.jsx)("p",{children:(0,a.__)("Please review your data and try again.",t)}),(0,u.jsx)(N,{...e,error:e.error||{},mini:!0})]})};function G({current:e,change:t,total:r}){return(0,u.jsxs)("div",{className:"wpl-error__page",children:[e>0&&(0,u.jsx)("span",{onClick:()=>t(e-1),onKeyDown:r=>{"Enter"!==r.key&&" "!==r.key||(r.preventDefault(),t(e-1))},role:"button",tabIndex:0,children:"←"}),`${e+1}/${r}`,e+1<r&&(0,u.jsx)("span",{onClick:()=>t(e+1),onKeyDown:r=>{"Enter"!==r.key&&" "!==r.key||(r.preventDefault(),t(e+1))},role:"button",tabIndex:0,children:"→"})]})}const V=function(e){const{onClear:t,mini:r=!1,type:n=""}=e,i=(0,o().useMemo)(()=>Array.isArray(e.errors)?e.errors:[e.errors],[e.errors]),[s,a]=(0,o().useState)(0);(0,o().useEffect)(()=>{!r&&i.length>0&&window.scrollTo(0,0)},[i,r]);const l=e=>{"click"!==e.type&&("keydown"!==e.type||"Enter"!==e.key&&" "!==e.key)||("keydown"===e.type&&e.preventDefault(),t&&t())};if(0===i.length)return null;const c=function(e,t){const r=e[0];return"rest_cookie_invalid_nonce"===r?.code?O:400===r?.jsonData?.status?W:"error"===t?q:"fixed"===t?H:B}(i,n);return(0,u.jsxs)("div",{className:m("wpl-error",{"wpl-error__mini":r}),children:[t&&(0,u.jsx)("div",{className:"closer",onClick:l,onKeyDown:l,role:"button",tabIndex:0,children:(0,u.jsx)("span",{className:"dashicons dashicons-no-alt"})}),i.length>1&&(0,u.jsx)(G,{current:s,change:a,total:i.length}),(0,u.jsx)(c,{error:i[s],...e})]})};class Z extends o().Component{constructor(e){super(e),this.state={error:!1,stack:null,errorInfo:null}}static getDerivedStateFromError(e){return{error:!0,stack:e}}componentDidCatch(e,t){this.setState({error:!0,stack:e,errorInfo:t}),console.error(e,t)}render(){const{error:e,stack:t,errorInfo:r}=this.state,{renderCrash:n,children:i,extra:o}=this.props;return e?n(t,r,o):i}}const K=Z;function Q(){return{url:"https://redirection.me/support/problems/rest-api/#url",http:"https://redirection.me/support/problems/rest-api/#http",api:"https://redirection.me/support/problems/rest-api/",rootUrl:Redirectioni10n.api.WP_API_root,siteHealth:Redirectioni10n.api.site_health}}function J(){return Redirectioni10n.versions.split("\n").concat(["Query: "+document.location.search])}const Y=e=>{let t;const r=new Set,n=(e,n)=>{const i="function"==typeof e?e(t):e;if(!Object.is(i,t)){const e=t;t=(null!=n?n:"object"!=typeof i||null===i)?i:Object.assign({},t,i),r.forEach(r=>r(t,e))}},i=()=>t,o={setState:n,getState:i,getInitialState:()=>s,subscribe:e=>(r.add(e),()=>r.delete(e))},s=t=e(n,i,o);return o},X=e=>e,ee=e=>{const t=(e=>e?Y(e):Y)(e),r=e=>function(e,t=X){const r=o().useSyncExternalStore(e.subscribe,o().useCallback(()=>t(e.getState()),[e,t]),o().useCallback(()=>t(e.getInitialState()),[e,t]));return o().useDebugValue(r),r}(t,e);return Object.assign(r,t),r},te=e=>e?ee(e):ee,re=e=>!!e.dispatchFromDevtools&&"function"==typeof e.dispatch,ne=new Map,ie=e=>{const t=ne.get(e);return t?Object.fromEntries(Object.entries(t.stores).map(([e,t])=>[e,t.getState()])):{}},oe=/^at (?:new |async )?(.+?) \(/,se=/^([^@]+)@/;function ae(e){var t,r,n;if(!e)return;const i=e.split("\n"),o=i.findIndex(e=>e.includes("api.setState"));if(o<0)return;const s=(null==(t=i[o+1])?void 0:t.trim())||"";return(null==(r=oe.exec(s))?void 0:r[1])||(null==(n=se.exec(s))?void 0:n[1])}const le=(e,t={})=>(r,n,i)=>{const{enabled:o,anonymousActionType:s,store:a,...l}=t;let c;try{c=null!=o&&o&&window.__REDUX_DEVTOOLS_EXTENSION__}catch(e){}if(!c)return e(r,n,i);const{connection:u,...d}=((e,t,r)=>{if(void 0===e)return{type:"untracked",connection:t.connect(r)};const n=ne.get(r.name);if(n)return{type:"tracked",store:e,...n};const i={connection:t.connect(r),stores:{}};return ne.set(r.name,i),{type:"tracked",store:e,...i}})(a,c,l);let p=!0;i.setState=(e,t,o)=>{const c=r(e,t);if(!p)return c;const d=void 0===o?{type:s||ae((new Error).stack)||"anonymous"}:"string"==typeof o?{type:o}:o;return void 0===a?(null==u||u.send(d,n()),c):(null==u||u.send({...d,type:`${a}/${d.type}`},{...ie(l.name),[a]:i.getState()}),c)},i.devtools={cleanup:()=>{u&&"function"==typeof u.unsubscribe&&u.unsubscribe(),((e,t)=>{if(void 0===t)return;const r=ne.get(e);r&&(delete r.stores[t],0===Object.keys(r.stores).length&&ne.delete(e))})(l.name,a)}};const h=(...e)=>{const t=p;p=!1,r(...e),p=t},f=e(i.setState,n,i);if("untracked"===d.type?null==u||u.init(f):(d.stores[d.store]=i,null==u||u.init(Object.fromEntries(Object.entries(d.stores).map(([e,t])=>[e,e===d.store?f:t.getState()])))),re(i)){const e=i.dispatch;i.dispatch=(...t)=>{e(...t)}}return u.subscribe(e=>{var t;switch(e.type){case"ACTION":return"string"!=typeof e.payload?void console.error("[zustand devtools middleware] Unsupported action format"):ce(e.payload,e=>{if("__setState"===e.type){if(void 0===a)return void h(e.state);1!==Object.keys(e.state).length&&console.error('\n [zustand devtools middleware] Unsupported __setState action format.\n When using \'store\' option in devtools(), the \'state\' should have only one key, which is a value of \'store\' that was passed in devtools(),\n and value of this only key should be a state object. Example: { "type": "__setState", "state": { "abc123Store": { "foo": "bar" } } }\n ');const t=e.state[a];if(null==t)return;return void(JSON.stringify(i.getState())!==JSON.stringify(t)&&h(t))}re(i)&&i.dispatch(e)});case"DISPATCH":switch(e.payload.type){case"RESET":return h(f),void 0===a?null==u?void 0:u.init(i.getState()):null==u?void 0:u.init(ie(l.name));case"COMMIT":return void 0===a?void(null==u||u.init(i.getState())):null==u?void 0:u.init(ie(l.name));case"ROLLBACK":return ce(e.state,e=>{if(void 0===a)return h(e),void(null==u||u.init(i.getState()));h(e[a]),null==u||u.init(ie(l.name))});case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return ce(e.state,e=>{void 0!==a?JSON.stringify(i.getState())!==JSON.stringify(e[a])&&h(e[a]):h(e)});case"IMPORT_STATE":{const{nextLiftedState:r}=e.payload,n=null==(t=r.computedStates.slice(-1)[0])?void 0:t.state;if(!n)return;return h(void 0===a?n:n[a]),void(null==u||u.send(null,r))}case"PAUSE_RECORDING":return p=!p}return}}),f},ce=(e,t)=>{let r;try{r=JSON.parse(e)}catch(e){console.error("[zustand devtools middleware] Could not parse the received json",e)}void 0!==r&&t(r)};function ue(e,t){let r;try{r=e()}catch(e){return}const n={getItem:e=>{var n;const i=e=>null===e?null:JSON.parse(e,null==t?void 0:t.reviver),o=null!=(n=r.getItem(e))?n:null;return o instanceof Promise?o.then(i):i(o)},setItem:(e,n)=>r.setItem(e,JSON.stringify(n,null==t?void 0:t.replacer)),removeItem:e=>r.removeItem(e)};return n}const de=e=>t=>{try{const r=e(t);return r instanceof Promise?r:{then:e=>de(e)(r),catch(e){return this}}}catch(e){return{then(e){return this},catch:t=>de(t)(e)}}},pe={values:null,loadStatus:"idle",saveStatus:!1,error:!1,database:{current:"",next:"",debug:[],reason:"",inProgress:!1,result:"ok",status:"ok",complete:0},showDatabase:!1,api:{routes:{},current:""},apiTest:{},pluginStatus:{status:[],debug:!1}};if("undefined"!=typeof window)try{window.localStorage.removeItem("redirection-settings")}catch(e){}const he=te()(le(e=>({...pe,setValues:t=>e({values:t}),updateValues:t=>e(e=>({values:e.values?{...e.values,...t}:null})),setLoadStatus:t=>e({loadStatus:t}),setSaveStatus:t=>e({saveStatus:t}),setError:t=>e({error:t}),setDatabase:t=>e(e=>({database:{...e.database,...t}})),setShowDatabase:t=>e({showDatabase:t}),setApi:t=>e(e=>({api:{...e.api,...t}})),setApiTest:t=>e(e=>{const r={...e.apiTest};return Object.keys(t).forEach(e=>{t[e]&&(r[e]=t[e])}),{apiTest:r}}),clearApiTest:()=>e({apiTest:{}}),setPluginStatus:t=>e(e=>({pluginStatus:{...e.pluginStatus,...t}})),reset:()=>e(pe)}),{name:"SettingsStore"})),fe=function(e){const t="mailto:john@redirection.me?subject=Redirection%20Error&body="+encodeURIComponent(e),r="https://github.com/johngodley/redirection/issues/new?title=Redirection%20Error&body="+encodeURIComponent("```\n"+e.trim()+"\n```\n\n");return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("p",{className:"wpl-error__highlight",children:M((0,a.__)("Please check the {{link}}support site{{/link}} before proceeding further.","redirection"),{link:(0,u.jsx)(A,{url:"https://redirection.me/support/"})})}),(0,u.jsx)("p",{children:M((0,a.__)("If that did not help then {{strong}}create an issue{{/strong}} or send it in an {{strong}}email{{/strong}}.","redirection"),{strong:(0,u.jsx)("strong",{})})}),(0,u.jsxs)("p",{children:[(0,u.jsx)("a",{href:r,className:"button-primary",children:(0,a.__)("Create An Issue","redirection")})," ",(0,u.jsx)("a",{href:t,className:"button-secondary",children:(0,a.__)("Email","redirection")})]}),(0,u.jsx)("p",{children:(0,a.__)("Include these details in your report along with a description of what you were doing and a screenshot.","redirection")})]})};function me({setStep:e,setOptions:t}){return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("h2",{children:(0,a.__)("Welcome to Redirection 🚀🎉","redirection")}),(0,u.jsx)("p",{children:(0,a.sprintf)(
// translators: %(version)s is the plugin version number
// translators: %(version)s is the plugin version number
(0,a.__)("Thank you for installing and using Redirection v%(version)s. This plugin will allow you to manage 301 redirections, keep track of 404 errors, and improve your site, with no knowledge of Apache or Nginx needed.","redirection"),{version:window.Redirectioni10n.version})}),(0,u.jsx)("p",{children:(0,a.__)("Redirection is designed to be used on sites with a few redirects to sites with thousands of redirects.","redirection")}),(0,u.jsx)("h3",{children:(0,a.__)("How do I use this plugin?","redirection")}),(0,u.jsx)("p",{children:M((0,a.__)("A simple redirect involves setting a {{strong}}source URL{{/strong}} (the old URL) and a {{strong}}target URL{{/strong}} (the new URL). Here's an example:","redirection"),{strong:(0,u.jsx)("strong",{})})}),(0,u.jsx)("table",{className:"redirect-edit",children:(0,u.jsxs)("tbody",{children:[(0,u.jsxs)("tr",{children:[(0,u.jsxs)("th",{children:[(0,a.__)("Source URL","redirection"),":"]}),(0,u.jsx)("td",{children:(0,u.jsx)("input",{type:"text",className:"regular-text",readOnly:!0,value:(0,a.__)("(Example) The source URL is your old or original URL","redirection")})})]}),(0,u.jsxs)("tr",{children:[(0,u.jsxs)("th",{children:[(0,a.__)("Target URL","redirection"),":"]}),(0,u.jsx)("td",{children:(0,u.jsx)("input",{type:"text",className:"regular-text",readOnly:!0,value:(0,a.__)("(Example) The target URL is the new URL","redirection")})})]})]})}),(0,u.jsx)("p",{children:(0,a.__)("That's all there is to it - you are now redirecting! Note that the above is just an example.","redirection")}),(0,u.jsx)("p",{children:M((0,a.__)("Full documentation can be found on the {{link}}Redirection website.{{/link}}","redirection"),{link:(0,u.jsx)(A,{url:"https://redirection.me/support/"})})}),(0,u.jsxs)("h3",{children:[(0,a.__)("Some features you may find useful are","redirection"),":"]}),(0,u.jsxs)("ul",{children:[(0,u.jsx)("li",{children:M((0,a.__)("{{link}}Monitor 404 errors{{/link}}, get detailed information about the visitor, and fix any problems","redirection"),{link:(0,u.jsx)(A,{url:"https://redirection.me/support/tracking-404-errors/"})})}),(0,u.jsx)("li",{children:M((0,a.__)("{{link}}Import{{/link}} from .htaccess, CSV, and a variety of other plugins","redirection"),{link:(0,u.jsx)(A,{url:"https://redirection.me/support/import-export-redirects/"})})}),(0,u.jsx)("li",{children:M((0,a.__)("More powerful URL matching, including {{regular}}regular expressions{{/regular}}, and {{other}}other conditions{{/other}}","redirection"),{regular:(0,u.jsx)(A,{url:"https://redirection.me/support/redirect-regular-expressions/"}),other:(0,u.jsx)(A,{url:"https://redirection.me/support/matching-redirects/"})})}),(0,u.jsx)("li",{children:(0,a.__)("Check a URL is being redirected","redirection")})]}),(0,u.jsx)("h3",{children:(0,a.__)("What's next?","redirection")}),(0,u.jsx)("p",{children:(0,a.__)("First you will be asked a few questions, and then Redirection will set up your database.","redirection")}),(0,u.jsxs)("div",{className:"wizard-buttons",children:[(0,u.jsx)("button",{className:"button-primary button",onClick:function(){t({manual:!1}),e(1)},children:(0,a.__)("Start Setup","redirection")})," ",(0,u.jsx)("button",{className:"button-secondary button",onClick:function(){t({manual:!0}),e(4)},children:(0,a.__)("Manual Setup","redirection")})]})]})}const ge=o().createContext(!1);ge.Provider;const _e=o().createContext(function(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}()),ye={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},ve=new class{#e=ye;#t=!1;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}},be="undefined"==typeof window||"Deno"in globalThis;function xe(){}function we(e){return"number"==typeof e&&e>=0&&e!==1/0}function je(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Se(e,t){return"function"==typeof e?e(t):e}function ke(e,t){const{type:r="all",exact:n,fetchStatus:i,predicate:o,queryKey:s,stale:a}=e;if(s)if(n){if(t.queryHash!==Te(s,t.options))return!1}else if(!Re(t.queryKey,s))return!1;if("all"!==r){const e=t.isActive();if("active"===r&&!e)return!1;if("inactive"===r&&e)return!1}return!("boolean"==typeof a&&t.isStale()!==a||i&&i!==t.state.fetchStatus||o&&!o(t))}function Ce(e,t){const{exact:r,status:n,predicate:i,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(r){if(Ee(t.options.mutationKey)!==Ee(o))return!1}else if(!Re(t.options.mutationKey,o))return!1}return!(n&&t.state.status!==n||i&&!i(t))}function Te(e,t){return(t?.queryKeyHashFn||Ee)(e)}function Ee(e){return JSON.stringify(e,(e,t)=>Ie(t)?Object.keys(t).sort().reduce((e,r)=>(e[r]=t[r],e),{}):t)}function Re(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&"object"==typeof e&&"object"==typeof t){if(Array.isArray(e)&&Array.isArray(t)){for(let r=0;r<t.length;r++)if(!Re(e[r],t[r]))return!1;return!0}const r=Object.keys(t);for(const n of r)if(!Re(e[n],t[n]))return!1;return!0}return!1}const Pe=Object.prototype.hasOwnProperty;function Ne(e,t,r=0){if(e===t)return e;if(r>500)return t;const n=Ae(e)&&Ae(t);if(!(n||Ie(e)&&Ie(t)))return t;const i=(n?e:Object.keys(e)).length,o=n?t:Object.keys(t),s=o.length,a=n?new Array(s):{};let l=0;for(let c=0;c<s;c++){const s=n?c:o[c],u=e[s],d=t[s];if(u===d){a[s]=u,(n?c<i:Pe.call(e,s))&&l++;continue}if(null===u||null===d||"object"!=typeof u||"object"!=typeof d){a[s]=d;continue}const p=Ne(u,d,r+1);a[s]=p,p===u&&l++}return i===s&&l===i?e:a}function Oe(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function Ae(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Ie(e){if(!Fe(e))return!1;const t=e.constructor;if(void 0===t)return!0;const r=t.prototype;return!!Fe(r)&&!!r.hasOwnProperty("isPrototypeOf")&&Object.getPrototypeOf(e)===Object.prototype}function Fe(e){return"[object Object]"===Object.prototype.toString.call(e)}function Le(e,t,r){return"function"==typeof r.structuralSharing?r.structuralSharing(e,t):!1!==r.structuralSharing?Ne(e,t):t}function De(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function ze(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}const Me=Symbol();function $e(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:e.queryFn&&e.queryFn!==Me?e.queryFn:()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`))}function Ue(e,t){return"function"==typeof e?e(...t):!!e}const Be=function(e){setTimeout(e,0)},qe=function(){let e=[],t=0,r=e=>{e()},n=e=>{e()},i=Be;const o=n=>{t?e.push(n):i(()=>{r(n)})};return{batch:o=>{let s;t++;try{s=o()}finally{t--,t||(()=>{const t=e;e=[],t.length&&i(()=>{n(()=>{t.forEach(e=>{r(e)})})})})()}return s},batchCalls:e=>(...t)=>{o(()=>{e(...t)})},schedule:o,setNotifyFunction:e=>{r=e},setBatchNotifyFunction:e=>{n=e},setScheduler:e=>{i=e}}}();const He=()=>be;var We=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}};const Ge=new class extends We{#r;#n;#i;constructor(){super(),this.#i=e=>{if("undefined"!=typeof window&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#n||this.setEventListener(this.#i)}onUnsubscribe(){this.hasListeners()||(this.#n?.(),this.#n=void 0)}setEventListener(e){this.#i=e,this.#n?.(),this.#n=e(e=>{"boolean"==typeof e?this.setFocused(e):this.onFocus()})}setFocused(e){this.#r!==e&&(this.#r=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return"boolean"==typeof this.#r?this.#r:"hidden"!==globalThis.document?.visibilityState}},Ve=new class extends We{#o=!0;#n;#i;constructor(){super(),this.#i=e=>{if("undefined"!=typeof window&&window.addEventListener){const t=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",r)}}}}onSubscribe(){this.#n||this.setEventListener(this.#i)}onUnsubscribe(){this.hasListeners()||(this.#n?.(),this.#n=void 0)}setEventListener(e){this.#i=e,this.#n?.(),this.#n=e(this.setOnline.bind(this))}setOnline(e){this.#o!==e&&(this.#o=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#o}};function Ze(e){return Math.min(1e3*2**e,3e4)}function Ke(e){return"online"!==(e??"online")||Ve.isOnline()}var Qe=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function Je(e){let t,r,n,i=!1,o=0,s="pending";const a=new Promise((e,t)=>{r=e,n=t});a.catch(xe);const l=()=>"pending"!==s,c=()=>Ge.isFocused()&&("always"===e.networkMode||Ve.isOnline())&&e.canRun(),u=()=>Ke(e.networkMode)&&e.canRun(),d=e=>{l()||(t?.(),s="resolved",r(e))},p=e=>{l()||(t?.(),s="rejected",n(e))},h=()=>new Promise(r=>{t=e=>{(l()||c())&&r(e)},e.onPause?.()}).then(()=>{t=void 0,l()||e.onContinue?.()}),f=()=>{if(l())return;let t;const r=0===o?e.initialPromise:void 0;try{t=r??e.fn()}catch(e){t=Promise.reject(e)}Promise.resolve(t).then(d).catch(t=>{if(l())return;const r=e.retry??(He()?0:3),n=e.retryDelay??Ze,s="function"==typeof n?n(o,t):n,a=!0===r||"number"==typeof r&&o<r||"function"==typeof r&&r(o,t);var u;!i&&a?(o++,e.onFail?.(o,t),(u=s,new Promise(e=>{ve.setTimeout(e,u)})).then(()=>c()?void 0:h()).then(()=>{i?p(t):f()})):p(t)})};return{promise:a,status:()=>s,cancel:t=>{if(!l()){const r=new Qe(t);p(r),e.onCancel?.(r)}},continue:()=>(t?.(),a),cancelRetry:()=>{i=!0},continueRetry:()=>{i=!1},canStart:u,start:()=>(u()?f():h().then(f),a)}}var Ye=class{#s;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),we(this.gcTime)&&(this.#s=ve.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(He()?1/0:3e5))}clearGcTimeout(){void 0!==this.#s&&(ve.clearTimeout(this.#s),this.#s=void 0)}};function Xe(e){return{onFetch:(t,r)=>{const n=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,o=t.state.data?.pages||[],s=t.state.data?.pageParams||[];let a={pages:[],pageParams:[]},l=0;const c=async()=>{let r=!1;const c=e=>{!function(e,r,n){let i,o=!1;Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t.signal,o||(o=!0,i.aborted?n():i.addEventListener("abort",n,{once:!0})),i)})}(e,0,()=>r=!0)},u=$e(t.options,t.fetchOptions),d=async(e,n,i)=>{if(r)return Promise.reject(t.signal.reason);if(null==n&&e.pages.length)return Promise.resolve(e);const o=(()=>{const e={client:t.client,queryKey:t.queryKey,pageParam:n,direction:i?"backward":"forward",meta:t.options.meta};return c(e),e})(),s=await u(o),{maxPages:a}=t.options,l=i?ze:De;return{pages:l(e.pages,s,a),pageParams:l(e.pageParams,n,a)}};if(i&&o.length){const e="backward"===i,t=e?tt:et,r={pages:o,pageParams:s};a=await d(r,t(n,r),e)}else{const t=e??o.length;do{const e=0===l?s[0]??n.initialPageParam:et(n,a);if(l>0&&null==e)break;a=await d(a,e),l++}while(l<t)}return a};t.options.persister?t.fetchFn=()=>t.options.persister?.(c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=c}}}function et(e,{pages:t,pageParams:r}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function tt(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}var rt=class extends Ye{#a;#l;#c;#u;#d;#p;#h;#f;constructor(e){super(),this.#f=!1,this.#h=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#d=e.client,this.#u=this.#d.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#l=ot(this.options),this.state=e.state??this.#l,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#a}get promise(){return this.#p?.promise}setOptions(e){if(this.options={...this.#h,...e},e?._type&&(this.#a=e._type),this.updateGcTime(this.options.gcTime),this.state&&void 0===this.state.data){const e=ot(this.options);void 0!==e.data&&(this.setState(it(e.data,e.dataUpdatedAt)),this.#l=e)}}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||this.#u.remove(this)}setData(e,t){const r=Le(this.state.data,e,this.options);return this.#m({data:r,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),r}setState(e){this.#m({type:"setState",state:e})}cancel(e){const t=this.#p?.promise;return this.#p?.cancel(e),t?t.then(xe).catch(xe):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#l}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>!1!==Se(e.options.enabled,this))}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Me||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>"static"===Se(e.options.staleTime,this))}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):void 0===this.state.data||this.state.isInvalidated}isStaleByTime(e=0){return void 0===this.state.data||"static"!==e&&(!!this.state.isInvalidated||!je(this.state.dataUpdatedAt,e))}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#p?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#p?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#u.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){const t=this.observers.indexOf(e);-1!==t&&(this.observers.splice(t,1),this.observers.length||(this.#p&&(this.#f||"paused"===this.state.fetchStatus&&"pending"===this.state.status?this.#p.cancel({revert:!0}):this.#p.cancelRetry()),this.scheduleGc()),this.#u.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#m({type:"invalidate"})}async fetch(e,t){if("idle"!==this.state.fetchStatus&&"rejected"!==this.#p?.status())if(void 0!==this.state.data&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#p)return this.#p.continueRetry(),this.#p.promise;if(e&&this.setOptions(e),!this.options.queryFn){const e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}const r=new AbortController,n=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#f=!0,r.signal)})},i=()=>{const e=$e(this.options,t),r=(()=>{const e={client:this.#d,queryKey:this.queryKey,meta:this.meta};return n(e),e})();return this.#f=!1,this.options.persister?this.options.persister(e,r,this):e(r)},o=(()=>{const e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#d,state:this.state,fetchFn:i};return n(e),e})();("infinite"===this.#a?Xe(this.options.pages):this.options.behavior)?.onFetch(o,this),this.#c=this.state,"idle"!==this.state.fetchStatus&&this.state.fetchMeta===o.fetchOptions?.meta||this.#m({type:"fetch",meta:o.fetchOptions?.meta});const s=this.#p=Je({initialPromise:t?.initialPromise,fn:o.fetchFn,onCancel:e=>{e instanceof Qe&&e.revert&&this.setState({...this.#c,fetchStatus:"idle"}),r.abort()},onFail:(e,t)=>{this.#m({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#m({type:"pause"})},onContinue:()=>{this.#m({type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0});try{const e=await s.start();if(void 0===e)throw new Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#u.config.onSuccess?.(e,this),this.#u.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Qe){if(e.silent)return this.#p.promise;if(e.revert){if(void 0===this.state.data)throw e;return this.state.data}}throw this.#m({type:"error",error:e}),this.#u.config.onError?.(e,this),this.#u.config.onSettled?.(this.state.data,e,this),e}finally{this.#p===s&&(this.#p=void 0),this.scheduleGc()}}#m(e){this.state=(t=>{switch(e.type){case"failed":return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...t,fetchStatus:"paused"};case"continue":return{...t,fetchStatus:"fetching"};case"fetch":return{...t,...nt(t.data,this.options),fetchMeta:e.meta??null};case"success":const r={...t,...it(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#c=e.manual?r:void 0,r;case"error":const n=e.error;return{...t,error:n,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:n,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...t,isInvalidated:!0};case"setState":return{...t,...e.state}}})(this.state),qe.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#u.notify({query:this,type:"updated",action:e})})}};function nt(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ke(t.networkMode)?"fetching":"paused",...void 0===e&&{error:null,status:"pending"}}}function it(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function ot(e){const t="function"==typeof e.initialData?e.initialData():e.initialData,r=void 0!==t,n=r?"function"==typeof e.initialDataUpdatedAt?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var st=class extends We{#d;#g=void 0;#_=void 0;#y=void 0;#v;#b;#x;#w;#j;#S;#k;#C;#T;#E=new Set;constructor(e,t){super(),this.options=t,this.#d=e,this.#x=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#g.addObserver(this),at(this.#g,this.options)?this.#R():this.updateResult(),this.#P())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return lt(this.#g,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return lt(this.#g,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#N(),this.#O(),this.#g.removeObserver(this)}setOptions(e){const t=this.options,r=this.#g;if(this.options=this.#d.defaultQueryOptions(e),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof Se(this.options.enabled,this.#g))throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#A(),this.#g.setOptions(this.options),t._defaulted&&!Oe(this.options,t)&&this.#d.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#g,observer:this});const n=this.hasListeners();n&&ct(this.#g,r,this.options,t)&&this.#R(),this.updateResult(),!n||this.#g===r&&Se(this.options.enabled,this.#g)===Se(t.enabled,this.#g)&&Se(this.options.staleTime,this.#g)===Se(t.staleTime,this.#g)||this.#I();const i=this.#F();!n||this.#g===r&&Se(this.options.enabled,this.#g)===Se(t.enabled,this.#g)&&i===this.#T||this.#L(i)}getOptimisticResult(e){const t=this.#d.getQueryCache().build(this.#d,e),r=this.createResult(t,e);return Oe(this.getCurrentResult(),r)||(this.#y=r,this.#b=this.options,this.#v=this.#g.state),r}getCurrentResult(){return this.#y}trackResult(e,t){return new Proxy(e,{get:(e,r)=>(this.trackProp(r),t?.(r),Reflect.get(e,r))})}trackProp(e){this.#E.add(e)}getCurrentQuery(){return this.#g}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#d.defaultQueryOptions(e),r=this.#d.getQueryCache().build(this.#d,t);let n,i=()=>{};const o=new Promise(e=>{n=e,i=this.#d.getQueryCache().subscribe(n=>{"updated"===n.type&&n.query.queryHash===r.queryHash&&void 0!==r.state.data&&(i(),e(this.createResult(r,t)))})});return Promise.race([r.fetch().then(()=>{const e=this.createResult(r,t);return n?.(e),e}).finally(()=>{i()}),o])}fetch(e){return this.#R({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#y))}#R(e){this.#A();let t=this.#g.fetch(this.options,e);return e?.throwOnError||(t=t.catch(xe)),t}#D(e){return!He()&&!1!==Se(this.options.enabled,this.#g)&&we(e)}#I(){this.#N();const e=Se(this.options.staleTime,this.#g);if(this.#y.isStale||!this.#D(e))return;const t=je(this.#y.dataUpdatedAt,e)+1;this.#k=ve.setTimeout(()=>{this.#y.isStale||this.updateResult()},t)}#F(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#g):this.options.refetchInterval)??!1}#L(e){this.#O(),this.#T=e,0!==this.#T&&this.#D(this.#T)&&(this.#C=ve.setInterval(()=>{(this.options.refetchIntervalInBackground||Ge.isFocused())&&this.#R()},this.#T))}#P(){this.#I(),this.#L(this.#F())}#N(){void 0!==this.#k&&(ve.clearTimeout(this.#k),this.#k=void 0)}#O(){void 0!==this.#C&&(ve.clearInterval(this.#C),this.#C=void 0)}createResult(e,t){const r=this.#g,n=this.options,i=this.#y,o=this.#v,s=this.#b,a=e!==r?e.state:this.#_,{state:l}=e;let c,u={...l},d=!1;if(t._optimisticResults){const i=this.hasListeners(),o=!i&&at(e,t),s=i&&ct(e,r,t,n);(o||s)&&(u={...u,...nt(l.data,e.options)}),"isRestoring"===t._optimisticResults&&(u.fetchStatus="idle")}let{error:p,errorUpdatedAt:h,status:f}=u;c=u.data;let m=!1;if(void 0!==t.placeholderData&&void 0===c&&"pending"===f){let e;i?.isPlaceholderData&&t.placeholderData===s?.placeholderData?(e=i.data,m=!0):e="function"==typeof t.placeholderData?t.placeholderData(this.#S?.state.data,this.#S):t.placeholderData,void 0!==e&&(f="success",c=Le(i?.data,e,t),d=!0)}if(t.select&&void 0!==c&&!m)if(i&&c===o?.data&&t.select===this.#w)c=this.#j;else try{this.#w=t.select,c=t.select(c),c=Le(i?.data,c,t),this.#j=c,this.#x=null}catch(e){this.#x=e}else void 0===c&&(this.#x=null);this.#x&&(p=this.#x,c=this.#j,h=Date.now(),f="error",d=!1);const g="fetching"===u.fetchStatus,_="pending"===f,y="error"===f,v=_&&g,b=void 0!==c;return{status:f,fetchStatus:u.fetchStatus,isPending:_,isSuccess:"success"===f,isError:y,isInitialLoading:v,isLoading:v,data:c,dataUpdatedAt:u.dataUpdatedAt,error:p,errorUpdatedAt:h,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:u.dataUpdateCount>a.dataUpdateCount||u.errorUpdateCount>a.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:y&&!b,isPaused:"paused"===u.fetchStatus,isPlaceholderData:d,isRefetchError:y&&b,isStale:ut(e,t),refetch:this.refetch,isEnabled:!1!==Se(t.enabled,e)}}updateResult(){const e=this.#y,t=this.createResult(this.#g,this.options);if(this.#v=this.#g.state,this.#b=this.options,void 0!==this.#v.data&&(this.#S=this.#g),Oe(t,e))return;this.#y=t;const r=(()=>{if(!e)return!0;const{notifyOnChangeProps:t}=this.options,r="function"==typeof t?t():t;if("all"===r||!r&&!this.#E.size)return!0;const n=new Set(r??this.#E);return this.options.throwOnError&&n.add("error"),Object.keys(this.#y).some(t=>{const r=t;return this.#y[r]!==e[r]&&n.has(r)})})();qe.batch(()=>{r&&this.listeners.forEach(e=>{e(this.#y)}),this.#d.getQueryCache().notify({query:this.#g,type:"observerResultsUpdated"})})}#A(){const e=this.#d.getQueryCache().build(this.#d,this.options);if(e===this.#g)return;const t=this.#g;this.#g=e,this.#_=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#P()}};function at(e,t){return function(e,t){return!1!==Se(t.enabled,e)&&void 0===e.state.data&&!("error"===e.state.status&&!1===Se(t.retryOnMount,e))}(e,t)||void 0!==e.state.data&<(e,t,t.refetchOnMount)}function lt(e,t,r){if(!1!==Se(t.enabled,e)&&"static"!==Se(t.staleTime,e)){const n="function"==typeof r?r(e):r;return"always"===n||!1!==n&&ut(e,t)}return!1}function ct(e,t,r,n){return(e!==t||!1===Se(n.enabled,e))&&(!r.suspense||"error"!==e.state.status)&&ut(e,r)}function ut(e,t){return!1!==Se(t.enabled,e)&&e.isStaleByTime(Se(t.staleTime,e))}function dt(e,t){return function(e,t,r){const n=o().useContext(ge),i=o().useContext(_e),s=p(r),a=s.defaultQueryOptions(e),l=s.getQueryCache().get(a.queryHash),c=!1!==e.subscribed;a._optimisticResults=n?"isRestoring":c?"optimistic":void 0,(e=>{if(e.suspense){const t=1e3,r=e=>"static"===e?e:Math.max(e??t,t),n=e.staleTime;e.staleTime="function"==typeof n?(...e)=>r(n(...e)):r(n),"number"==typeof e.gcTime&&(e.gcTime=Math.max(e.gcTime,t))}})(a),((e,t,r)=>{const n=r?.state.error&&"function"==typeof e.throwOnError?Ue(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||n)&&(t.isReset()||(e.retryOnMount=!1))})(a,i,l),(e=>{o().useEffect(()=>{e.clearReset()},[e])})(i);const[u]=o().useState(()=>new t(s,a)),d=u.getOptimisticResult(a),h=!n&&c;if(o().useSyncExternalStore(o().useCallback(e=>{const t=h?u.subscribe(qe.batchCalls(e)):xe;return u.updateResult(),t},[u,h]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),o().useEffect(()=>{u.setOptions(a)},[a,u]),((e,t)=>e?.suspense&&t.isPending)(a,d))throw((e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()}))(a,u,i);if((({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(i&&void 0===e.data||Ue(r,[e.error,n])))({result:d,errorResetBoundary:i,throwOnError:a.throwOnError,query:l,suspense:a.suspense}))throw d.error;return a.notifyOnChangeProps?d:u.trackResult(d)}(e,st,t)}var pt=class extends Ye{#d;#z;#M;#p;constructor(e){super(),this.#d=e.client,this.mutationId=e.mutationId,this.#M=e.mutationCache,this.#z=[],this.state=e.state||{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0},this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#z.includes(e)||(this.#z.push(e),this.clearGcTimeout(),this.#M.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#z=this.#z.filter(t=>t!==e),this.scheduleGc(),this.#M.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#z.length||("pending"===this.state.status?this.scheduleGc():this.#M.remove(this))}continue(){return this.#p?.continue()??("pending"===this.state.status?this.execute(this.state.variables):Promise.resolve())}async execute(e){const t=()=>{this.#m({type:"continue"})},r={client:this.#d,meta:this.options.meta,mutationKey:this.options.mutationKey},n=this.#p=Je({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(new Error("No mutationFn found")),onFail:(e,t)=>{this.#m({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#m({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#M.canRun(this)}),i="pending"===this.state.status,o=!n.canStart();try{if(i)t();else{this.#m({type:"pending",variables:e,isPaused:o}),this.#M.config.onMutate&&await this.#M.config.onMutate(e,this,r);const t=await(this.options.onMutate?.(e,r));t!==this.state.context&&this.#m({type:"pending",context:t,variables:e,isPaused:o})}const s=await n.start();return await(this.#M.config.onSuccess?.(s,e,this.state.context,this,r)),await(this.options.onSuccess?.(s,e,this.state.context,r)),await(this.#M.config.onSettled?.(s,null,this.state.variables,this.state.context,this,r)),await(this.options.onSettled?.(s,null,e,this.state.context,r)),this.#m({type:"success",data:s}),s}catch(t){try{await(this.#M.config.onError?.(t,e,this.state.context,this,r))}catch(e){Promise.reject(e)}try{await(this.options.onError?.(t,e,this.state.context,r))}catch(e){Promise.reject(e)}try{await(this.#M.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,r))}catch(e){Promise.reject(e)}try{await(this.options.onSettled?.(void 0,t,e,this.state.context,r))}catch(e){Promise.reject(e)}throw this.#m({type:"error",error:t}),t}finally{this.#p===n&&(this.#p=void 0),this.#M.runNext(this)}}#m(e){this.state=(t=>{switch(e.type){case"failed":return{...t,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};case"pending":return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}})(this.state),qe.batch(()=>{this.#z.forEach(t=>{t.onMutationUpdate(e)}),this.#M.notify({mutation:this,type:"updated",action:e})})}},ht=class extends We{#d;#y=void 0;#$;#U;constructor(e,t){super(),this.#d=e,this.setOptions(t),this.bindMethods(),this.#B()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){const t=this.options;this.options=this.#d.defaultMutationOptions(e),Oe(this.options,t)||this.#d.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#$,observer:this}),t?.mutationKey&&this.options.mutationKey&&Ee(t.mutationKey)!==Ee(this.options.mutationKey)?this.reset():"pending"===this.#$?.state.status&&this.#$.setOptions(this.options)}onSubscribe(){1===this.listeners.size&&this.#$&&(this.#$.addObserver(this),this.#B())}onUnsubscribe(){this.hasListeners()||this.#$?.removeObserver(this)}onMutationUpdate(e){this.#B(),this.#q(e)}getCurrentResult(){return this.#y}reset(){this.#$?.removeObserver(this),this.#$=void 0,this.#B(),this.#q()}mutate(e,t){return this.#U=t,this.#$?.removeObserver(this),this.#$=this.#d.getMutationCache().build(this.#d,this.options),this.#$.addObserver(this),this.#$.execute(e)}#B(){const e=this.#$?.state??{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0};this.#y={...e,isPending:"pending"===e.status,isSuccess:"success"===e.status,isError:"error"===e.status,isIdle:"idle"===e.status,mutate:this.mutate,reset:this.reset}}#q(e){qe.batch(()=>{if(this.#U&&this.hasListeners()){const t=this.#y.variables,r=this.#y.context,n={client:this.#d,meta:this.options.meta,mutationKey:this.options.mutationKey};if("success"===e?.type){try{this.#U.onSuccess?.(e.data,t,r,n)}catch(e){Promise.reject(e)}try{this.#U.onSettled?.(e.data,null,t,r,n)}catch(e){Promise.reject(e)}}else if("error"===e?.type){try{this.#U.onError?.(e.error,t,r,n)}catch(e){Promise.reject(e)}try{this.#U.onSettled?.(void 0,e.error,t,r,n)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#y)})})}};function ft(e,t){const r=p(t),[n]=o().useState(()=>new ht(r,e));o().useEffect(()=>{n.setOptions(e)},[n,e]);const i=o().useSyncExternalStore(o().useCallback(e=>n.subscribe(qe.batchCalls(e)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),s=o().useCallback((...e)=>{n.mutate(e[0],e[1]).catch(xe)},[n]);if(i.error&&Ue(n.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:s,mutateAsync:i.mutate}}const mt=e=>"object"==typeof e&&null!==e,gt=e=>0===e?"Admin AJAX returned 0":"string"==typeof e?e:mt(e)&&e.message?e.message:(console.error(e),"Unknown error "+(mt(e)?Object.keys(e):e));let _t=[];function yt(e,t,r){return{code:(n=e,"number"==typeof n?`${n}`:mt(n)&&n.error_code?n.error_code:mt(n)&&n.code?n.code:mt(n)&&n.name?n.name:mt(n)&&n.data?.error_code?n.data.error_code:String(n)),message:gt(t),request:r,data:r.apiFetch?.data?r.apiFetch?.data:null,jsonData:e&&e.data?e.data:null};var n}const vt=e=>{if(e.status>=200&&e.status<300)return e;throw e};function bt(e){return e.headers.get("x-wp-nonce")&&wt.nonceMiddleware&&(wt.nonceMiddleware.nonce=e.headers.get("x-wp-nonce")??wt.nonceMiddleware.nonce),e}const xt=e=>e.text(),wt=e=>{const t=[..._t,e=>(e=>fetch(e.url,e).then(bt).then(t=>((e,t)=>(t.apiFetch={action:t.url.replace(/[\?&]_wpnonce=[a-f0-9]*/,"")+" "+t.method.toUpperCase(),body:"object"==typeof t.body?JSON.stringify(t.body):t.body},t.headers=e.headers,e.status&&void 0!==e.statusText&&(t.apiFetch.status=e.status,t.apiFetch.statusText=e.statusText),e))(t,e)).then(xt).then(t=>((e,t)=>(t.apiFetch&&(t.apiFetch.data=e),e))(t,e)).then(t=>((e,t)=>{const r=t.apiFetch?.status;if(""===e&&void 0!==r&&(r<200||r>300))return e;try{const r=JSON.parse(e.replace(/\ufeff/,""));if(0===r)throw yt("json-zero","Failed to get data",t);return r}catch(e){throw yt(e,e?.message,t)}})(t,e)).then(t=>((e,t)=>{if(e?.error||e?.error_code)throw yt(e,e.message,t);if(t.apiFetch){const{status:r,statusText:n}=t.apiFetch;if(e?.code&&e?.message)throw yt(e,e,t);if(void 0!==r&&(r<200||r>=300))throw yt(r,n,t)}return e})(t,e)))(e)],r=e=>n=>{const i=t[e];return i?i(n,e===t.length-1?()=>Promise.resolve():r(e+1)):Promise.reject(new Error("Middleware step is undefined"))};return new Promise((t,n)=>{r(0)(e).then(e=>t(e)).catch(r=>"rest_cookie_invalid_nonce"!==r.code?n(r):e.apiFetch?.nonceRefreshed?n(yt("rest_cookie_invalid_nonce","REST API nonce refresh was rejected after retry.",e)):void window.fetch("admin-ajax.php?action=rest-nonce").then(vt).then(xt).then(r=>{if(!r)throw yt("rest_cookie_invalid_nonce","REST API nonce refresh failed.",e);wt.nonceMiddleware.nonce=r,e.apiFetch={...e.apiFetch||{},nonceRefreshed:!0},wt(e).then(t).catch(n)}).catch(n))})};wt.getUrl=e=>wt.rootURLMiddleware({url:e},e=>wt.nonceMiddleware(e,e=>e.url)),wt.use=function(e){_t.unshift(e)},wt.createNonceMiddleware=e=>{const t=(e=>{const t=(e,r)=>{const{headers:n={}}=e;for(const i in n)if("x-wp-nonce"===i.toLowerCase()&&n[i]===t.nonce)return r(e);return r({...e,headers:{...n,"X-WP-Nonce":t.nonce}})};return t.nonce=e,t})(e);return wt.nonceMiddleware=t,t},wt.createRootURLMiddleware=e=>{const t=function(e){const t=(t,r)=>{return t.url.startsWith("http")?r(t):r({...t,url:(n=e,i=t.url,function(e){return e.replace("wp-json/wp-json","wp-json").replace("=/wp-json","=")}((o=function(e){return e.replace(/\/$/,"")}(n),s=function(e,t){return-1!==e.indexOf("?")?t.replace("?","&"):t}(n,function(e){return e.replace(/^\//,"")}(i)),o+"/"+s)))});var n,i,o,s};return t.rootURL=e,t}(e);return wt.rootURLMiddleware=t,t},wt.resetMiddlewares=()=>{_t=[]},wt.replaceRootURLMiddleware=e=>{for(let t=0;t<_t.length;t++)_t[t]===wt.rootURLMiddleware&&(_t[t]=wt.createRootURLMiddleware(e))};const jt=wt,St=(e,t={})=>{const r=e+"/";if(Object.keys(t).length>0){const e=function(e){const t=new URLSearchParams;function r(e,n){for(const i in n){const o=n[i];if(null!=o)if(Array.isArray(o))for(const r of o)null!=r&&t.append(`${e}[${i}][]`,String(r));else"object"==typeof o?r(`${e}[${i}]`,o):t.append(`${e}[${i}]`,String(o))}}for(const n in e){const i=e[n];if(null!=i)if(Array.isArray(i))for(const e of i)null!=e&&t.append(`${n}[]`,String(e));else"object"==typeof i?r(n,i):t.append(n,String(i))}return t.toString()}(t);if(e.length>0)return r+(-1===r.indexOf("?")?"?":"&")+e}return r},kt=(e,t={})=>({headers:{Accept:"application/json, */*;q=0.1"},url:St(e,t),credentials:"include",method:"get",redirect:"error"}),Ct=(e,t={},r={})=>{const n={headers:{"Content-Type":"application/json; charset=utf-8",Accept:"application/json, */*;q=0.1"},url:St(e,r),credentials:"include",method:"post",body:"{}"};return Object.keys(t).length>0&&(n.body=JSON.stringify(t)),n},Tt=(e,t={},r={})=>Ct(e,t,r),Et=()=>kt("redirection/v1/setting"),Rt=e=>Ct("redirection/v1/setting",e),Pt=e=>kt("redirection/v1/redirect",e),Nt=(e,t)=>Ct("redirection/v1/redirect/"+e,t),Ot=(e,t)=>Ct("redirection/v1/redirect",e,t),At=e=>kt("redirection/v1/redirect/post",{text:e}),It=e=>kt("redirection/v1/group",e),Ft=()=>kt("redirection/v1/group/dropdown"),Lt=(e,t)=>Ct("redirection/v1/group/"+e,t),Dt=(e,t)=>Ct("redirection/v1/group",e,t),zt=e=>kt("redirection/v1/log",e),Mt=e=>kt("redirection/v1/404",e),$t=(e,t,r={})=>((e,t,r)=>{const n=Ct(e,t);delete n.headers["Content-Type"];const i=new FormData;function o(e,t){if(null!=t)if(Array.isArray(t))for(const r of t)o(`${e}[]`,r);else if("object"!=typeof t)i.append(e,String(t));else for(const r in t)o(`${e}[${r}]`,t[r])}i.append("file",r);for(const e in t)o(e,t[e]);return n.body=i,n})("redirection/v1/import/file/"+e,r,t),Ut=()=>kt("redirection/v1/import/plugin"),Bt=e=>Ct("redirection/v1/import/plugin",e),qt=(e,t)=>kt("redirection/v1/import/plugin/"+encodeURIComponent(e)+"/preview",t),Ht=e=>kt("redirection/v1/export/redirect",e),Wt=e=>kt("redirection/v1/export/redirect/preview",e),Gt=e=>kt("redirection/v1/export/bundle",e),Vt=e=>kt("redirection/v1/export/bundle/preview",e),Zt=(e,t={})=>kt("redirection/v1/export/group/"+e,t),Kt=(e,t={})=>kt("redirection/v1/export/log/"+e,t),Qt=(e={})=>kt("redirection/v1/export/log/preview",e),Jt=(e,t={})=>kt("redirection/v1/export/404/"+e,t),Yt=(e={})=>kt("redirection/v1/export/404/preview",e),Xt=()=>kt("redirection/v1/plugin"),er=()=>Tt("redirection/v1/plugin/delete"),tr=e=>Ct("redirection/v1/plugin/data",e?{upgrade:e}:{}),rr=()=>Ct("redirection/v1/plugin/finish",{}),nr=(e,t)=>Ct("redirection/v1/plugin/fix",{reason:e,current:t}),ir=(e,t,r)=>Ct("redirection/v1/bulk/redirect/"+e,t,r),or=(e,t,r)=>Ct("redirection/v1/bulk/group/"+e,t,r),sr=(e,t,r)=>Ct("redirection/v1/bulk/log/"+e,t,r),ar=(e,t,r)=>Ct("redirection/v1/bulk/404/"+e,t,r),lr=(e,t=1)=>`https://api.redirect.li/v${t}/`+e,cr=e=>({url:lr("useragent/"+encodeURIComponent(e)),method:"get"}),ur=e=>({url:lr("http?url="+encodeURIComponent(e),2),method:"get"});function dr(e){return"json"===e?"application/json;charset=utf-8":"csv"===e?"text/csv;charset=utf-8":"text/plain;charset=utf-8"}var pr;function hr(e,t,r){function n(r,n){if(r._zod||Object.defineProperty(r,"_zod",{value:{def:n,constr:s,traits:new Set},enumerable:!1}),r._zod.traits.has(e))return;r._zod.traits.add(e),t(r,n);const i=s.prototype,o=Object.keys(i);for(let e=0;e<o.length;e++){const t=o[e];t in r||(r[t]=i[t].bind(r))}}const i=r?.Parent??Object;class o extends i{}function s(e){var t;const i=r?.Parent?new o:this;n(i,e),(t=i._zod).deferred??(t.deferred=[]);for(const e of i._zod.deferred)e();return i}return Object.defineProperty(o,"name",{value:e}),Object.defineProperty(s,"init",{value:n}),Object.defineProperty(s,Symbol.hasInstance,{value:t=>!!(r?.Parent&&t instanceof r.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}Symbol("zod_brand");class fr extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class mr extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}(pr=globalThis).__zod_globalConfig??(pr.__zod_globalConfig={});const gr=globalThis.__zod_globalConfig;function _r(e){return e&&Object.assign(gr,e),gr}function yr(e){const t=Object.values(e).filter(e=>"number"==typeof e),r=Object.entries(e).filter(([e,r])=>-1===t.indexOf(+e)).map(([e,t])=>t);return r}function vr(e,t){return"bigint"==typeof t?t.toString():t}function br(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function xr(e){return null==e}function wr(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}const jr=Symbol("evaluating");function Sr(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==jr)return void 0===n&&(n=jr,n=r()),n},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function kr(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Cr(...e){const t={};for(const r of e){const e=Object.getOwnPropertyDescriptors(r);Object.assign(t,e)}return Object.defineProperties({},t)}function Tr(e){return JSON.stringify(e)}const Er="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Rr(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const Pr=br(()=>{if(gr.jitless)return!1;if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function Nr(e){if(!1===Rr(e))return!1;const t=e.constructor;if(void 0===t)return!0;if("function"!=typeof t)return!0;const r=t.prototype;return!1!==Rr(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}function Or(e){return Nr(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const Ar=new Set(["string","number","symbol"]);function Ir(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Fr(e,t,r){const n=new e._zod.constr(t??e._zod.def);return t&&!r?.parent||(n._zod.parent=e),n}function Lr(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}const Dr={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function zr(e,t=0){if(!0===e.aborted)return!0;for(let r=t;r<e.issues.length;r++)if(!0!==e.issues[r]?.continue)return!0;return!1}function Mr(e,t=0){if(!0===e.aborted)return!0;for(let r=t;r<e.issues.length;r++)if(!1===e.issues[r]?.continue)return!0;return!1}function $r(e,t){return t.map(t=>{var r;return(r=t).path??(r.path=[]),t.path.unshift(e),t})}function Ur(e){return"string"==typeof e?e:e?.message}function Br(e,t,r){const n=e.message?e.message:Ur(e.inst?._zod.def?.error?.(e))??Ur(t?.error?.(e))??Ur(r.customError?.(e))??Ur(r.localeError?.(e))??"Invalid input",{inst:i,continue:o,input:s,...a}=e;return a.path??(a.path=[]),a.message=n,t?.reportInput&&(a.input=s),a}function qr(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function Hr(...e){const[t,r,n]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:n}:{...t}}const Wr=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,vr,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Gr=hr("$ZodError",Wr),Vr=hr("$ZodError",Wr,{Parent:Error}),Zr=(e,t)=>{Gr.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t=e=>e.message){const r={_errors:[]},n=(e,i=[])=>{for(const o of e.issues)if("invalid_union"===o.code&&o.errors.length)o.errors.map(e=>n({issues:e},[...i,...o.path]));else if("invalid_key"===o.code)n({issues:o.issues},[...i,...o.path]);else if("invalid_element"===o.code)n({issues:o.issues},[...i,...o.path]);else{const e=[...i,...o.path];if(0===e.length)r._errors.push(t(o));else{let n=r,i=0;for(;i<e.length;){const r=e[i];i===e.length-1?(n[r]=n[r]||{_errors:[]},n[r]._errors.push(t(o))):n[r]=n[r]||{_errors:[]},n=n[r],i++}}}};return n(e),r}(e,t)},flatten:{value:t=>function(e,t=e=>e.message){const r={},n=[];for(const i of e.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i))):n.push(t(i));return{formErrors:n,fieldErrors:r}}(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,vr,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,vr,2)}},isEmpty:{get:()=>0===e.issues.length}})},Kr=hr("ZodError",Zr),Qr=hr("ZodError",Zr,{Parent:Error});class Jr extends Error{constructor(e,t){const r=e.issues,n=r.map(e=>{const t=e.path.join(".");return`${t?`${t}: `:""}${e.message}`}).join("\n");super(r.length>0?`API response validation failed:\n${n}`:"API response validation failed"),this.zodError=e,this.response=t,this.name="ApiValidationError"}getErrors(){return this.zodError.format()}getFirstError(){const e=this.zodError.issues;return e.length>0&&e[0]?e[0].message:"Validation error"}}function Yr(e){if(e instanceof Kr)return console.error("API Validation Error:",e.format()),new Jr(e);if(e instanceof Error)return e;if("object"==typeof e&&null!==e&&"message"in e){const t=e,r=new Error(t.message||"Unknown error");return void 0!==t.code&&(r.code=t.code),void 0!==t.data&&(r.data=t.data),void 0!==t.jsonData&&(r.jsonData=t.jsonData),void 0!==t.request&&(r.request=t.request),"string"==typeof t.code&&t.code.length>0&&(r.name=t.code),r}return new Error("Unknown error occurred")}const Xr={redirects:{all:["redirects"],lists:()=>[...Xr.redirects.all,"list"],list:e=>[...Xr.redirects.lists(),e],detail:e=>[...Xr.redirects.all,"detail",e]},groups:{all:["groups"],lists:()=>[...Xr.groups.all,"list"],list:e=>[...Xr.groups.lists(),e],detail:e=>[...Xr.groups.all,"detail",e],dropdown:()=>[...Xr.groups.all,"dropdown"]},logs:{all:["logs"],lists:()=>[...Xr.logs.all,"list"],list:e=>[...Xr.logs.lists(),e]},errors:{all:["errors"],lists:()=>[...Xr.errors.all,"list"],list:e=>[...Xr.errors.lists(),e]},settings:{all:["settings"],get:()=>[...Xr.settings.all,"get"],status:()=>[...Xr.settings.all,"status"]},pluginInfo:{all:["pluginInfo"],get:()=>[...Xr.pluginInfo.all,"get"]},io:{all:["io"],importers:()=>[...Xr.io.all,"importers"]},info:{all:["info"],ip:e=>[...Xr.info.all,"ip",e],agent:e=>[...Xr.info.all,"agent",e],http:e=>[...Xr.info.all,"http",e]}},en={errors:[],notices:[],inProgress:0},tn=te()(le(e=>({...en,addError:t=>e(e=>({errors:[...e.errors,"string"==typeof t?{message:t,type:"error"}:t]})),addNotice:t=>e(e=>({notices:[...e.notices,"string"==typeof t?{message:t,type:"notice"}:t]})),clearErrors:()=>e({errors:[]}),clearNotices:()=>e({notices:[]}),incrementProgress:()=>e(e=>({inProgress:e.inProgress+1})),decrementProgress:()=>e(e=>({inProgress:Math.max(0,e.inProgress-1)})),reset:()=>e(en)}),{name:"MessageStore"}));function rn(e){return!(!e||0===e.length)&&(e.length>1||"group"===e[0]||"setting"===e[0])}function nn(e,t,r){return"group"===e?r:"module"===e?t:"all"}function on(e){return dt({queryKey:Xr.io.importers(),queryFn:async()=>{const e=await jt(Ut());return e?.importers||[]},...e})}function sn(e){const t=p(),{addNotice:r,incrementProgress:n,decrementProgress:i}=tn();return ft({mutationFn:async e=>{if("file"===e.sourceType){n();try{return await jt($t(String(e.groupId),e.file,{dry_run:"preview"===e.mode?1:0,duplicate_mode:e.duplicateMode,delete_source:e.deleteSource?1:0,import_sections:e.importSections||[],format:e.format}))}catch(e){throw Yr(e)}}if("preview"===e.mode){if(Array.isArray(e.pluginId))throw new Error("Plugin preview only supports a single importer");return await jt(qt(e.pluginId,{group_id:e.groupId,duplicate_mode:e.duplicateMode,delete_source:e.deleteSource?1:0}))}return await jt(Bt({plugin:Array.isArray(e.pluginId)?e.pluginId:[e.pluginId],group_id:e.groupId,duplicate_mode:e.duplicateMode,delete_source:e.deleteSource?1:0}))},onSuccess:(e,n)=>{"file"===n.sourceType&&i(),"preview"===n.mode?r("Preview completed"):(r(`Imported ${e?.created||0} new redirects, updated ${e?.updated||0} existing redirects, ignored ${e?.ignored||0} redirects, ${e?.groups_created||0} groups created, ${e?.groups_updated||0} groups updated, ${e?.groups_ignored||0} groups ignored, ${e?.logs_imported||0} logs imported, ${e?.errors_imported||0} 404 logs imported, ${e?.settings_imported||0} settings imported`),t.invalidateQueries({queryKey:Xr.redirects.lists()}),t.invalidateQueries({queryKey:Xr.groups.all}),t.invalidateQueries({queryKey:Xr.logs.all}),t.invalidateQueries({queryKey:Xr.errors.all}),t.invalidateQueries({queryKey:Xr.settings.all}))},onError:(e,t)=>{"file"===t.sourceType&&i()},...e})}function an(e){const{addNotice:t,incrementProgress:r,decrementProgress:n}=tn();return ft({mutationFn:async e=>{r();try{const t=await jt(function(e){if(rn(e.exportTypes)){const t=e.redirectScopeType||"all",r=e.redirectModule||"all",n=e.redirectGroup||0;return Gt({types:e.exportTypes,scope_type:t,scope_value:nn(t,r,n),format:e.format})}if("redirect"===e.exportType){if(e.params)return Ht({...e.params,format:e.format});const t=e.redirectScopeType||"all",r=e.redirectModule||"all",n=e.redirectGroup||0;return Ht({scope_type:t,scope_value:nn(t,r,n),format:e.format})}return"group"===e.exportType?Zt(e.format,e.params||{}):"log"===e.exportType?Kt(e.format,e.params||{}):Jt(e.format,e.params||{})}(e));return e.download&&e.filename&&function(e,t,r){const n=new Blob([t],{type:dr(r)}),i=window.URL.createObjectURL(n),o=document.createElement("a");o.href=i,o.download=e,document.body.appendChild(o),o.click(),o.remove(),window.URL.revokeObjectURL(i)}(e.filename,t.data,e.format),e.copy&&await async function(e){if(navigator.clipboard?.writeText)return void await navigator.clipboard.writeText(e);const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="absolute",t.style.left="-9999px",document.body.appendChild(t),t.select();const r=document.execCommand("copy");if(t.remove(),!r)throw new Error("Unable to copy export data")}(t.data),t}catch(e){throw Yr(e)}},onSuccess:(e,r)=>{n(),!1!==r.completionNotice&&t(r.completionNotice||function(e){return e.copy?"Export copied":e.download?"Export downloaded":"Export viewed"}(r))},onError:()=>{n()},...e})}function ln({setStep:e,step:t,options:r,setOptions:n}){const{log:i=!1,ip:o=!1,monitor:s=!1}=r?.settings??{},{data:l=[]}=on(),c=0===l.length?t+2:t+1;function d(e){n({settings:{...r.settings,[e.target.name]:e.target.checked}})}return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("h2",{children:(0,a.__)("Basic Setup","redirection")}),(0,u.jsx)("p",{children:(0,a.__)("These are some options you may want to enable now. They can be changed at any time.","redirection")}),(0,u.jsxs)("div",{className:"wizard-option",children:[(0,u.jsxs)("p",{children:[(0,u.jsx)("input",{id:"wizard-monitor",name:"monitor",type:"checkbox",checked:s,onChange:d}),(0,u.jsxs)("label",{htmlFor:"wizard-monitor",children:[(0,a.__)("Monitor permalink changes in WordPress posts and pages","redirection"),"."]})]}),(0,u.jsxs)("p",{children:[(0,a.__)("If you change the permalink in a post or page then Redirection can automatically create a redirect for you.","redirection")," ",M((0,a.__)("{{link}}Read more about this.{{/link}}","redirection"),{link:(0,u.jsx)(A,{url:"https://redirection.me/support/options/#monitor"})})]})]}),(0,u.jsxs)("div",{className:"wizard-option",children:[(0,u.jsxs)("p",{children:[(0,u.jsx)("input",{id:"wizard-log",name:"log",type:"checkbox",checked:i,onChange:function(e){n({settings:{...r.settings,[e.target.name]:e.target.checked,ip:!!e.target.checked&&o}})}}),(0,u.jsx)("label",{htmlFor:"wizard-log",children:(0,a.__)("Keep a log of all redirects and 404 errors.","redirection")})]}),(0,u.jsxs)("p",{children:[(0,a.__)("Storing logs for redirects and 404s will allow you to see what is happening on your site. This will increase your database storage requirements.","redirection")," ",M((0,a.__)("{{link}}Read more about this.{{/link}}","redirection"),{link:(0,u.jsx)(A,{url:"https://redirection.me/support/logs/"})})]})]}),(0,u.jsxs)("div",{className:i?"wizard-option":"wizard-option wizard-option_disabled",children:[(0,u.jsxs)("p",{children:[(0,u.jsx)("input",{id:"wizard-ip",name:"ip",type:"checkbox",disabled:!i,checked:o,onChange:d}),(0,u.jsx)("label",{htmlFor:"wizard-ip",children:(0,a.__)("Store IP information for redirects and 404 errors.","redirection")})]}),(0,u.jsxs)("p",{children:[(0,a.__)("Storing the IP address allows you to perform additional log actions. Note that you will need to adhere to local laws regarding the collection of data (for example GDPR).","redirection")," ",M((0,a.__)("{{link}}Read more about this.{{/link}}","redirection"),{link:(0,u.jsx)(A,{url:"https://redirection.me/support/privacy-gdpr/"})})]})]}),(0,u.jsxs)("div",{className:"wizard-buttons",children:[(0,u.jsx)("button",{className:"button-primary button",onClick:()=>e(c),children:(0,a.__)("Continue","redirection")})," ",(0,u.jsx)("button",{className:"button",onClick:()=>e(t-1),children:(0,a.__)("Go back","redirection")})]})]})}const cn=function({error:e}){const{request:t}=e,r=function(e){return!!(e&&e.raw&&e.raw.length>500)}(t),[n,i]=(0,o().useState)(r);return t&&t.raw?(0,u.jsxs)(u.Fragment,{children:[r&&n&&(0,u.jsx)("button",{className:"api-result-hide",type:"button",onClick:e=>{e.preventDefault(),i(!1)},children:(0,a.__)("Show Full","redirection")}),r&&!n&&(0,u.jsx)("button",{className:"api-result-hide",type:"button",onClick:e=>{e.preventDefault(),i(!0)},children:(0,a.__)("Hide","redirection")}),(0,u.jsx)("pre",{children:n?t.raw.substring(0,500)+" ...":t.raw})]}):null},un=(e,t)=>{const r=e.data?.status;return"number"==typeof r&&r>0?`${t} ${r}`:`${t} ${"rest_api_cors_mismatch"===e.code?"blocked":"failed"}`},dn=({error:e,methods:t})=>{const r=(e=>e.code?e.code:e.name?e.name:null)(e);return(0,u.jsxs)("div",{className:"api-result-log_details",children:[(0,u.jsx)("p",{children:(0,u.jsx)("span",{className:"dashicons dashicons-no"})}),(0,u.jsxs)("div",{children:[(0,u.jsxs)("p",{children:[t.map((t,r)=>(0,u.jsx)("span",{className:"api-result-method_fail",children:un(e,t)},r)),r&&(0,u.jsxs)("strong",{children:[r,": "]}),e.message]}),(0,u.jsx)($,{error:e,links:Q(),locale:"redirection"}),(0,u.jsx)(cn,{error:e})]})]},t.join(""))},pn=({methods:e})=>(0,u.jsxs)("p",{children:[(0,u.jsx)("span",{className:"dashicons dashicons-yes"}),e.map((e,t)=>(0,u.jsx)("span",{className:"api-result-method_pass",children:e},t)),(0,a.__)("Working!","redirection")]},e.join("")),hn=e=>e.code?e.code:0,fn=({result:e})=>{const t=[],{GET:r,POST:n}=e;return r.status===n.status&&hn(r)===hn(n)?("fail"===r.status&&r.error?t.push((0,u.jsx)(dn,{error:r.error,methods:["GET","POST"]},"get-post")):t.push((0,u.jsx)(pn,{methods:["GET","POST"]},"get-post")),t):("fail"===r.status&&r.error?t.push((0,u.jsx)(dn,{error:r.error,methods:["GET"]},"get")):t.push((0,u.jsx)(pn,{methods:["GET"]},"get")),"fail"===n.status&&n.error?t.push((0,u.jsx)(dn,{error:n.error,methods:["POST"]},"post")):t.push((0,u.jsx)(pn,{methods:["POST"]},"post")),t)},mn=({item:e,result:t,routes:r,isCurrent:n,allowChange:i})=>(e=>0===Object.keys(e).length||"loading"===e.GET.status||"loading"===e.POST.status)(t)?null:(0,u.jsxs)("div",{className:"api-result-log",children:[(0,u.jsxs)("form",{className:"api-result-select",action:window.Redirectioni10n.pluginRoot+"&sub=support",method:"POST",children:[i&&!n&&(0,u.jsx)("input",{type:"submit",className:"button button-secondary",value:(0,a.__)("Switch to this API","redirection")}),i&&n&&(0,u.jsx)("span",{children:(0,a.__)("Current API","redirection")}),(0,u.jsx)("input",{type:"hidden",name:"rest_api",value:e.value}),(0,u.jsx)("input",{type:"hidden",name:"_wpnonce",value:jt.nonceMiddleware.nonce}),(0,u.jsx)("input",{type:"hidden",name:"action",value:"rest_api"})]}),(0,u.jsx)("h4",{children:e.text}),(0,u.jsxs)("p",{children:["URL:"," ",(0,u.jsx)("code",{children:(0,u.jsx)(A,{url:r[e.value]||"",children:r[e.value]||""})})]}),(0,u.jsx)(fn,{result:t})]}),gn=({size:e=""})=>{const t=m("wpl-spinner__container",e&&" spinner-"+e);return(0,u.jsx)("div",{className:t,children:(0,u.jsx)("span",{className:"wpl-spinner__item"})})},yn=e=>{const{title:t,url:r=!1,children:n}=e;return(0,u.jsxs)("tr",{children:[(0,u.jsxs)("th",{children:[!r&&t,r&&(0,u.jsx)("a",{href:r,target:"_blank",rel:"noreferrer",children:t})]}),(0,u.jsx)("td",{children:n})]})},vn=e=>(0,u.jsx)("table",{className:"form-table",children:(0,u.jsx)("tbody",{children:e.children})}),bn=({value:e,label:t,disabled:r=!1})=>Array.isArray(e)?(0,u.jsx)("optgroup",{label:String(t),disabled:r,children:e.map((e,t)=>(0,u.jsx)(bn,{label:e.label,value:e.value,disabled:e.disabled||!1},t))}):(0,u.jsx)("option",{value:e,disabled:r,children:t}),xn=bn,wn=({items:e,value:t,name:r,onChange:n,disabled:i=!1,className:o})=>(0,u.jsx)("select",{name:r,value:t,onChange:n,disabled:i,className:o,children:e.map((e,t)=>(0,u.jsx)(xn,{value:e.value,label:e.label,disabled:e.disabled||!1},t))}),jn=()=>[{value:0,label:(0,a.__)("Default REST API","redirection")},{value:1,label:(0,a.__)("Raw REST API","redirection")},{value:3,label:(0,a.__)("Relative REST API","redirection")}],Sn=function(e){const{settings:t,onChange:r,getLink:n,installed:i,warning:o}=e,{location:s,token:l,rest_api:c,plugin_update:d}=t;return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("tr",{className:"redirect-option__row",children:(0,u.jsx)("th",{colSpan:2,children:(0,u.jsx)("h2",{className:"title",children:(0,a.__)("Advanced","redirection")})})}),(0,u.jsxs)(yn,{title:(0,a.__)("RSS Token","redirection")+":",url:n("options","rsstoken"),children:[(0,u.jsx)("input",{className:"regular-text",type:"text",value:l,name:"token",onChange:r}),(0,u.jsx)("br",{}),(0,u.jsx)("span",{className:"sub",children:(0,a.__)("A unique token allowing feed readers access to Redirection log RSS (leave blank to auto-generate)","redirection")})]}),(0,u.jsxs)(yn,{title:(0,a.__)("Apache .htaccess","redirection"),url:n("options","apache"),children:[(0,u.jsxs)("p",{children:[(0,u.jsx)("label",{className:"screen-reader-text",htmlFor:"apache-htaccess-location",children:(0,a.__)("Apache .htaccess location","redirection")}),(0,u.jsx)("input",{id:"apache-htaccess-location",type:"text",className:"regular-text",name:"location",value:s,onChange:r})]}),(0,u.jsx)("p",{className:"sub",children:M((0,a.sprintf)(
// translators: %(installed)s is the path where WordPress is installed
// translators: %(installed)s is the path where WordPress is installed
(0,a.__)("Redirects added to an Apache group can be saved to an {{code}}.htaccess{{/code}} file by adding the full path here. For reference, your WordPress is installed to {{code}}%(installed)s{{/code}}.","redirection"),{installed:i}),{code:(0,u.jsx)("code",{})})}),o&&(0,u.jsxs)("p",{className:"inline-notice",children:[(0,a.__)("Unable to save .htaccess file","redirection")," ",(0,u.jsx)("code",{children:o})]})]}),(0,u.jsxs)(yn,{title:(0,a.__)("REST API","redirection"),url:n("options","restapi"),children:[(0,u.jsx)(wn,{items:jn(),name:"rest_api",value:String(c),onChange:r})," "," ",(0,u.jsx)("span",{className:"sub",children:(0,a.__)("How Redirection uses the REST API - don't change unless necessary","redirection")})]}),(0,u.jsxs)(yn,{title:(0,a.__)("Data Upgrade","redirection"),children:[(0,u.jsx)(wn,{items:[{value:"prompt",
// translators: Upgrade manually when prompted
label:(0,a.__)("Upgrade manually when prompted","redirection")},{value:"admin",
// translators: Automatically upgrade on admin pages
label:(0,a.__)("Automatically upgrade on admin pages","redirection")}],name:"plugin_update",value:d,onChange:r})," "," ",(0,u.jsx)("span",{className:"sub",children:(0,a.__)("Decide how Redirection updates itself, if needed.","redirection")})]})]})},kn=/^[cC][0-9a-z]{6,}$/,Cn=/^[0-9a-z]+$/,Tn=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,En=/^[0-9a-vA-V]{20}$/,Rn=/^[A-Za-z0-9]{27}$/,Pn=/^[a-zA-Z0-9_-]{21}$/,Nn=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,On=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,An=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,In=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Fn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ln=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Dn=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,zn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Mn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,$n=/^[A-Za-z0-9_-]*$/,Un=/^https?$/,Bn=/^\+[1-9]\d{6,14}$/,qn="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Hn=new RegExp(`^${qn}$`);function Wn(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}const Gn=/^-?\d+$/,Vn=/^-?\d+(?:\.\d+)?$/,Zn=/^(?:true|false)$/i,Kn=/^[^A-Z]*$/,Qn=/^[^a-z]*$/,Jn=hr("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Yn={number:"number",bigint:"bigint",object:"date"},Xn=hr("$ZodCheckLessThan",(e,t)=>{Jn.init(e,t);const r=Yn[typeof t.value];e._zod.onattach.push(e=>{const r=e._zod.bag,n=(t.inclusive?r.maximum:r.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<n&&(t.inclusive?r.maximum=t.value:r.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:"object"==typeof t.value?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ei=hr("$ZodCheckGreaterThan",(e,t)=>{Jn.init(e,t);const r=Yn[typeof t.value];e._zod.onattach.push(e=>{const r=e._zod.bag,n=(t.inclusive?r.minimum:r.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>n&&(t.inclusive?r.minimum=t.value:r.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:"object"==typeof t.value?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ti=hr("$ZodCheckMultipleOf",(e,t)=>{Jn.init(e,t),e._zod.onattach.push(e=>{var r;(r=e._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof r.value?r.value%t.value===BigInt(0):0===function(e,t){const r=e/t,n=Math.round(r),i=Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-n)<i?0:r-n}(r.value,t.value))||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),ri=hr("$ZodCheckNumberFormat",(e,t)=>{Jn.init(e,t),t.format=t.format||"float64";const r=t.format?.includes("int"),n=r?"int":"number",[i,o]=Dr[t.format];e._zod.onattach.push(e=>{const n=e._zod.bag;n.format=t.format,n.minimum=i,n.maximum=o,r&&(n.pattern=Gn)}),e._zod.check=s=>{const a=s.value;if(r){if(!Number.isInteger(a))return void s.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});if(!Number.isSafeInteger(a))return void(a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}))}a<i&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),a>o&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),ni=hr("$ZodCheckMaxLength",(e,t)=>{var r;Jn.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!xr(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const r=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<r&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const n=r.value;if(n.length<=t.maximum)return;const i=qr(n);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),ii=hr("$ZodCheckMinLength",(e,t)=>{var r;Jn.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!xr(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const r=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>r&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const n=r.value;if(n.length>=t.minimum)return;const i=qr(n);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),oi=hr("$ZodCheckLengthEquals",(e,t)=>{var r;Jn.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!xr(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const r=e._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=r=>{const n=r.value,i=n.length;if(i===t.length)return;const o=qr(n),s=i>t.length;r.issues.push({origin:o,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),si=hr("$ZodCheckStringFormat",(e,t)=>{var r,n;Jn.init(e,t),e._zod.onattach.push(e=>{const r=e._zod.bag;r.format=t.format,t.pattern&&(r.patterns??(r.patterns=new Set),r.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),ai=hr("$ZodCheckRegex",(e,t)=>{si.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),li=hr("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Kn),si.init(e,t)}),ci=hr("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Qn),si.init(e,t)}),ui=hr("$ZodCheckIncludes",(e,t)=>{Jn.init(e,t);const r=Ir(t.includes),n=new RegExp("number"==typeof t.position?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),di=hr("$ZodCheckStartsWith",(e,t)=>{Jn.init(e,t);const r=new RegExp(`^${Ir(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),pi=hr("$ZodCheckEndsWith",(e,t)=>{Jn.init(e,t);const r=new RegExp(`.*${Ir(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),hi=hr("$ZodCheckOverwrite",(e,t)=>{Jn.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class fi{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter(e=>e),r=Math.min(...t.map(e=>e.length-e.trimStart().length)),n=t.map(e=>e.slice(r)).map(e=>" ".repeat(2*this.indent)+e);for(const e of n)this.content.push(e)}compile(){const e=Function,t=this?.args;return new e(...t,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}}const mi=e=>(t,r,n,i)=>{const o=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new fr;if(s.issues.length){const t=new(i?.Err??e)(s.issues.map(e=>Br(e,o,_r())));throw Er(t,i?.callee),t}return s.value},gi=e=>async(t,r,n,i)=>{const o=n?{...n,async:!0}:{async:!0};let s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){const t=new(i?.Err??e)(s.issues.map(e=>Br(e,o,_r())));throw Er(t,i?.callee),t}return s.value},_i=e=>(t,r,n)=>{const i=n?{...n,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},i);if(o instanceof Promise)throw new fr;return o.issues.length?{success:!1,error:new(e??Gr)(o.issues.map(e=>Br(e,i,_r())))}:{success:!0,data:o.value}},yi=_i(Vr),vi=e=>async(t,r,n)=>{const i=n?{...n,async:!0}:{async:!0};let o=t._zod.run({value:r,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(e=>Br(e,i,_r())))}:{success:!0,data:o.value}},bi=vi(Vr),xi=e=>(t,r,n)=>{const i=n?{...n,direction:"backward"}:{direction:"backward"};return mi(e)(t,r,i)},wi=e=>(t,r,n)=>mi(e)(t,r,n),ji=e=>async(t,r,n)=>{const i=n?{...n,direction:"backward"}:{direction:"backward"};return gi(e)(t,r,i)},Si=e=>async(t,r,n)=>gi(e)(t,r,n),ki=e=>(t,r,n)=>{const i=n?{...n,direction:"backward"}:{direction:"backward"};return _i(e)(t,r,i)},Ci=e=>(t,r,n)=>_i(e)(t,r,n),Ti=e=>async(t,r,n)=>{const i=n?{...n,direction:"backward"}:{direction:"backward"};return vi(e)(t,r,i)},Ei=e=>async(t,r,n)=>vi(e)(t,r,n),Ri={major:4,minor:4,patch:3},Pi=hr("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ri;const n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(const t of n)for(const r of t._zod.onattach)r(e);if(0===n.length)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const t=(e,t,r)=>{let n,i=zr(e);for(const o of t){if(o._zod.def.when){if(Mr(e))continue;if(!o._zod.def.when(e))continue}else if(i)continue;const t=e.issues.length,s=o._zod.check(e);if(s instanceof Promise&&!1===r?.async)throw new fr;if(n||s instanceof Promise)n=(n??Promise.resolve()).then(async()=>{await s,e.issues.length!==t&&(i||(i=zr(e,t)))});else{if(e.issues.length===t)continue;i||(i=zr(e,t))}}return n?n.then(()=>e):e},r=(r,i,o)=>{if(zr(r))return r.aborted=!0,r;const s=t(i,n,o);if(s instanceof Promise){if(!1===o.async)throw new fr;return s.then(t=>e._zod.parse(t,o))}return e._zod.parse(s,o)};e._zod.run=(i,o)=>{if(o.skipChecks)return e._zod.parse(i,o);if("backward"===o.direction){const t=e._zod.parse({value:i.value,issues:[]},{...o,skipChecks:!0});return t instanceof Promise?t.then(e=>r(e,i,o)):r(t,i,o)}const s=e._zod.parse(i,o);if(s instanceof Promise){if(!1===o.async)throw new fr;return s.then(e=>t(e,n,o))}return t(s,n,o)}}Sr(e,"~standard",()=>({validate:t=>{try{const r=yi(e,t);return r.success?{value:r.data}:{issues:r.error?.issues}}catch(r){return bi(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),Ni=hr("$ZodString",(e,t)=>{var r;Pi.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(r=e._zod.bag,new RegExp(`^${r?`[\\s\\S]{${r?.minimum??0},${r?.maximum??""}}`:"[\\s\\S]*"}$`)),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(n){}return"string"==typeof r.value||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),Oi=hr("$ZodStringFormat",(e,t)=>{si.init(e,t),Ni.init(e,t)}),Ai=hr("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=On),Oi.init(e,t)}),Ii=hr("$ZodUUID",(e,t)=>{if(t.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=An(e))}else t.pattern??(t.pattern=An());Oi.init(e,t)}),Fi=hr("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=In),Oi.init(e,t)}),Li=hr("$ZodURL",(e,t)=>{Oi.init(e,t),e._zod.check=r=>{try{const n=r.value.trim();if(!t.normalize&&t.protocol?.source===Un.source&&!/^https?:\/\//i.test(n))return void r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});const i=new URL(n);return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),void(t.normalize?r.value=i.href:r.value=n)}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Di=hr("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Oi.init(e,t)}),zi=hr("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Pn),Oi.init(e,t)}),Mi=hr("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=kn),Oi.init(e,t)}),$i=hr("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Cn),Oi.init(e,t)}),Ui=hr("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Tn),Oi.init(e,t)}),Bi=hr("$ZodXID",(e,t)=>{t.pattern??(t.pattern=En),Oi.init(e,t)}),qi=hr("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Rn),Oi.init(e,t)}),Hi=hr("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=Wn({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${t}(?:${r.join("|")})`;return new RegExp(`^${qn}T(?:${n})$`)}(t)),Oi.init(e,t)}),Wi=hr("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Hn),Oi.init(e,t)}),Gi=hr("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${Wn(t)}$`)),Oi.init(e,t)}),Vi=hr("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Nn),Oi.init(e,t)}),Zi=hr("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Fn),Oi.init(e,t),e._zod.bag.format="ipv4"}),Ki=hr("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Ln),Oi.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),Qi=hr("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Dn),Oi.init(e,t)}),Ji=hr("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=zn),Oi.init(e,t),e._zod.check=r=>{const n=r.value.split("/");try{if(2!==n.length)throw new Error;const[e,t]=n;if(!t)throw new Error;const r=Number(t);if(`${r}`!==t)throw new Error;if(r<0||r>128)throw new Error;new URL(`http://[${e}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Yi(e){if(""===e)return!0;if(/\s/.test(e))return!1;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const Xi=hr("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Mn),Oi.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Yi(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),eo=hr("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=$n),Oi.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{(function(e){if(!$n.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return Yi(t.padEnd(4*Math.ceil(t.length/4),"="))})(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),to=hr("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Bn),Oi.init(e,t)}),ro=hr("$ZodJWT",(e,t)=>{Oi.init(e,t),e._zod.check=r=>{(function(e,t=null){try{const r=e.split(".");if(3!==r.length)return!1;const[n]=r;if(!n)return!1;const i=JSON.parse(atob(n));return!("typ"in i&&"JWT"!==i?.typ||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}})(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),no=hr("$ZodNumber",(e,t)=>{Pi.init(e,t),e._zod.pattern=e._zod.bag.pattern??Vn,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch(e){}const i=r.value;if("number"==typeof i&&!Number.isNaN(i)&&Number.isFinite(i))return r;const o="number"==typeof i?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...o?{received:o}:{}}),r}}),io=hr("$ZodNumberFormat",(e,t)=>{ri.init(e,t),no.init(e,t)}),oo=hr("$ZodBoolean",(e,t)=>{Pi.init(e,t),e._zod.pattern=Zn,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(e){}const i=r.value;return"boolean"==typeof i||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),r}}),so=hr("$ZodUnknown",(e,t)=>{Pi.init(e,t),e._zod.parse=e=>e}),ao=hr("$ZodNever",(e,t)=>{Pi.init(e,t),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function lo(e,t,r){e.issues.length&&t.issues.push(...$r(r,e.issues)),t.value[r]=e.value}const co=hr("$ZodArray",(e,t)=>{Pi.init(e,t),e._zod.parse=(r,n)=>{const i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);const o=[];for(let e=0;e<i.length;e++){const s=i[e],a=t.element._zod.run({value:s,issues:[]},n);a instanceof Promise?o.push(a.then(t=>lo(t,r,e))):lo(a,r,e)}return o.length?Promise.all(o).then(()=>r):r}});function uo(e,t,r,n,i,o){const s=r in n;if(e.issues.length){if(i&&o&&!s)return;t.issues.push(...$r(r,e.issues))}s||i?void 0===e.value?s&&(t.value[r]=void 0):t.value[r]=e.value:e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]})}function po(e){const t=Object.keys(e.shape);for(const r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);const r=(n=e.shape,Object.keys(n).filter(e=>"optional"===n[e]._zod.optin&&"optional"===n[e]._zod.optout));var n;return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function ho(e,t,r,n,i,o){const s=[],a=i.keySet,l=i.catchall._zod,c=l.def.type,u="optional"===l.optin,d="optional"===l.optout;for(const i in t){if("__proto__"===i)continue;if(a.has(i))continue;if("never"===c){s.push(i);continue}const o=l.run({value:t[i],issues:[]},n);o instanceof Promise?e.push(o.then(e=>uo(e,r,i,t,u,d))):uo(o,r,i,t,u,d)}return s.length&&r.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:o}),e.length?Promise.all(e).then(()=>r):r}const fo=hr("$ZodObject",(e,t)=>{Pi.init(e,t);const r=Object.getOwnPropertyDescriptor(t,"shape");if(!r?.get){const e=t.shape;Object.defineProperty(t,"shape",{get:()=>{const r={...e};return Object.defineProperty(t,"shape",{value:r}),r}})}const n=br(()=>po(t));Sr(e._zod,"propValues",()=>{const e=t.shape,r={};for(const t in e){const n=e[t]._zod;if(n.values){r[t]??(r[t]=new Set);for(const e of n.values)r[t].add(e)}}return r});const i=Rr,o=t.catchall;let s;e._zod.parse=(t,r)=>{s??(s=n.value);const a=t.value;if(!i(a))return t.issues.push({expected:"object",code:"invalid_type",input:a,inst:e}),t;t.value={};const l=[],c=s.shape;for(const e of s.keys){const n=c[e],i="optional"===n._zod.optin,o="optional"===n._zod.optout,s=n._zod.run({value:a[e],issues:[]},r);s instanceof Promise?l.push(s.then(r=>uo(r,t,e,a,i,o))):uo(s,t,e,a,i,o)}return o?ho(l,a,t,r,n.value,e):l.length?Promise.all(l).then(()=>t):t}}),mo=hr("$ZodObjectJIT",(e,t)=>{fo.init(e,t);const r=e._zod.parse,n=br(()=>po(t));let i;const o=Rr,s=!gr.jitless,a=s&&Pr.value,l=t.catchall;let c;e._zod.parse=(u,d)=>{c??(c=n.value);const p=u.value;return o(p)?s&&a&&!1===d?.async&&!0!==d.jitless?(i||(i=(e=>{const t=new fi(["shape","payload","ctx"]),r=n.value,i=e=>{const t=Tr(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const o=Object.create(null);let s=0;for(const e of r.keys)o[e]="key_"+s++;t.write("const newResult = {};");for(const n of r.keys){const r=o[n],s=Tr(n),a=e[n],l="optional"===a?._zod?.optin,c="optional"===a?._zod?.optout;t.write(`const ${r} = ${i(n)};`),l&&c?t.write(`\n if (${r}.issues.length) {\n if (${s} in input) {\n payload.issues = payload.issues.concat(${r}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${s}, ...iss.path] : [${s}]\n })));\n }\n }\n \n if (${r}.value === undefined) {\n if (${s} in input) {\n newResult[${s}] = undefined;\n }\n } else {\n newResult[${s}] = ${r}.value;\n }\n \n `):l?t.write(`\n if (${r}.issues.length) {\n payload.issues = payload.issues.concat(${r}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${s}, ...iss.path] : [${s}]\n })));\n }\n \n if (${r}.value === undefined) {\n if (${s} in input) {\n newResult[${s}] = undefined;\n }\n } else {\n newResult[${s}] = ${r}.value;\n }\n \n `):t.write(`\n const ${r}_present = ${s} in input;\n if (${r}.issues.length) {\n payload.issues = payload.issues.concat(${r}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${s}, ...iss.path] : [${s}]\n })));\n }\n if (!${r}_present && !${r}.issues.length) {\n payload.issues.push({\n code: "invalid_type",\n expected: "nonoptional",\n input: undefined,\n path: [${s}]\n });\n }\n\n if (${r}_present) {\n if (${r}.value === undefined) {\n newResult[${s}] = undefined;\n } else {\n newResult[${s}] = ${r}.value;\n }\n }\n\n `)}t.write("payload.value = newResult;"),t.write("return payload;");const a=t.compile();return(t,r)=>a(e,t,r)})(t.shape)),u=i(u,d),l?ho([],p,u,d,c,e):u):r(u,d):(u.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),u)}});function go(e,t,r,n){for(const r of e)if(0===r.issues.length)return t.value=r.value,t;const i=e.filter(e=>!zr(e));return 1===i.length?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(e=>e.issues.map(e=>Br(e,n,_r())))}),t)}const _o=hr("$ZodUnion",(e,t)=>{Pi.init(e,t),Sr(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),Sr(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),Sr(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),Sr(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){const e=t.options.map(e=>e._zod.pattern);return new RegExp(`^(${e.map(e=>wr(e.source)).join("|")})$`)}});const r=1===t.options.length?t.options[0]._zod.run:null;e._zod.parse=(n,i)=>{if(r)return r(n,i);let o=!1;const s=[];for(const e of t.options){const t=e._zod.run({value:n.value,issues:[]},i);if(t instanceof Promise)s.push(t),o=!0;else{if(0===t.issues.length)return t;s.push(t)}}return o?Promise.all(s).then(t=>go(t,n,e,i)):go(s,n,e,i)}}),yo=hr("$ZodIntersection",(e,t)=>{Pi.init(e,t),e._zod.parse=(e,r)=>{const n=e.value,i=t.left._zod.run({value:n,issues:[]},r),o=t.right._zod.run({value:n,issues:[]},r);return i instanceof Promise||o instanceof Promise?Promise.all([i,o]).then(([t,r])=>bo(e,t,r)):bo(e,i,o)}});function vo(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(Nr(e)&&Nr(t)){const r=Object.keys(t),n=Object.keys(e).filter(e=>-1!==r.indexOf(e)),i={...e,...t};for(const r of n){const n=vo(e[r],t[r]);if(!n.valid)return{valid:!1,mergeErrorPath:[r,...n.mergeErrorPath]};i[r]=n.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let n=0;n<e.length;n++){const i=vo(e[n],t[n]);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function bo(e,t,r){const n=new Map;let i;for(const r of t.issues)if("unrecognized_keys"===r.code){i??(i=r);for(const e of r.keys)n.has(e)||n.set(e,{}),n.get(e).l=!0}else e.issues.push(r);for(const t of r.issues)if("unrecognized_keys"===t.code)for(const e of t.keys)n.has(e)||n.set(e,{}),n.get(e).r=!0;else e.issues.push(t);const o=[...n].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(o.length&&i&&e.issues.push({...i,keys:o}),zr(e))return e;const s=vo(t.value,r.value);if(!s.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return e.value=s.data,e}const xo=hr("$ZodRecord",(e,t)=>{Pi.init(e,t),e._zod.parse=(r,n)=>{const i=r.value;if(!Nr(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;const o=[],s=t.keyType._zod.values;if(s){r.value={};const a=new Set;for(const l of s)if("string"==typeof l||"number"==typeof l||"symbol"==typeof l){a.add("number"==typeof l?l.toString():l);const s=t.keyType._zod.run({value:l,issues:[]},n);if(s instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(s.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:s.issues.map(e=>Br(e,n,_r())),input:l,path:[l],inst:e});continue}const c=s.value,u=t.valueType._zod.run({value:i[l],issues:[]},n);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...$r(l,e.issues)),r.value[c]=e.value})):(u.issues.length&&r.issues.push(...$r(l,u.issues)),r.value[c]=u.value)}let l;for(const e in i)a.has(e)||(l=l??[],l.push(e));l&&l.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:l})}else{r.value={};for(const s of Reflect.ownKeys(i)){if("__proto__"===s)continue;if(!Object.prototype.propertyIsEnumerable.call(i,s))continue;let a=t.keyType._zod.run({value:s,issues:[]},n);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if("string"==typeof s&&Vn.test(s)&&a.issues.length){const e=t.keyType._zod.run({value:Number(s),issues:[]},n);if(e instanceof Promise)throw new Error("Async schemas not supported in object keys currently");0===e.issues.length&&(a=e)}if(a.issues.length){"loose"===t.mode?r.value[s]=i[s]:r.issues.push({code:"invalid_key",origin:"record",issues:a.issues.map(e=>Br(e,n,_r())),input:s,path:[s],inst:e});continue}const l=t.valueType._zod.run({value:i[s],issues:[]},n);l instanceof Promise?o.push(l.then(e=>{e.issues.length&&r.issues.push(...$r(s,e.issues)),r.value[a.value]=e.value})):(l.issues.length&&r.issues.push(...$r(s,l.issues)),r.value[a.value]=l.value)}}return o.length?Promise.all(o).then(()=>r):r}}),wo=hr("$ZodEnum",(e,t)=>{Pi.init(e,t);const r=yr(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(e=>Ar.has(typeof e)).map(e=>"string"==typeof e?Ir(e):e.toString()).join("|")})$`),e._zod.parse=(t,i)=>{const o=t.value;return n.has(o)||t.issues.push({code:"invalid_value",values:r,input:o,inst:e}),t}}),jo=hr("$ZodTransform",(e,t)=>{Pi.init(e,t),e._zod.optin="optional",e._zod.parse=(r,n)=>{if("backward"===n.direction)throw new mr(e.constructor.name);const i=t.transform(r.value,r);if(n.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(r.value=e,r.fallback=!0,r));if(i instanceof Promise)throw new fr;return r.value=i,r.fallback=!0,r}});function So(e,t){return void 0===t&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const ko=hr("$ZodOptional",(e,t)=>{Pi.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Sr(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Sr(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${wr(e.source)})?$`):void 0}),e._zod.parse=(e,r)=>{if("optional"===t.innerType._zod.optin){const n=e.value,i=t.innerType._zod.run(e,r);return i instanceof Promise?i.then(e=>So(e,n)):So(i,n)}return void 0===e.value?e:t.innerType._zod.run(e,r)}}),Co=hr("$ZodExactOptional",(e,t)=>{ko.init(e,t),Sr(e._zod,"values",()=>t.innerType._zod.values),Sr(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(e,r)=>t.innerType._zod.run(e,r)}),To=hr("$ZodNullable",(e,t)=>{Pi.init(e,t),Sr(e._zod,"optin",()=>t.innerType._zod.optin),Sr(e._zod,"optout",()=>t.innerType._zod.optout),Sr(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${wr(e.source)}|null)$`):void 0}),Sr(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,r)=>null===e.value?e:t.innerType._zod.run(e,r)}),Eo=hr("$ZodDefault",(e,t)=>{Pi.init(e,t),e._zod.optin="optional",Sr(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);if(void 0===e.value)return e.value=t.defaultValue,e;const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(e=>Ro(e,t)):Ro(n,t)}});function Ro(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const Po=hr("$ZodPrefault",(e,t)=>{Pi.init(e,t),e._zod.optin="optional",Sr(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>("backward"===r.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,r))}),No=hr("$ZodNonOptional",(e,t)=>{Pi.init(e,t),Sr(e._zod,"values",()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(r,n)=>{const i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(t=>Oo(t,e)):Oo(i,e)}});function Oo(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Ao=hr("$ZodCatch",(e,t)=>{Pi.init(e,t),e._zod.optin="optional",Sr(e._zod,"optout",()=>t.innerType._zod.optout),Sr(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(n=>(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>Br(e,r,_r()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>Br(e,r,_r()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),Io=hr("$ZodPipe",(e,t)=>{Pi.init(e,t),Sr(e._zod,"values",()=>t.in._zod.values),Sr(e._zod,"optin",()=>t.in._zod.optin),Sr(e._zod,"optout",()=>t.out._zod.optout),Sr(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,r)=>{if("backward"===r.direction){const n=t.out._zod.run(e,r);return n instanceof Promise?n.then(e=>Fo(e,t.in,r)):Fo(n,t.in,r)}const n=t.in._zod.run(e,r);return n instanceof Promise?n.then(e=>Fo(e,t.out,r)):Fo(n,t.out,r)}});function Fo(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},r)}const Lo=hr("$ZodReadonly",(e,t)=>{Pi.init(e,t),Sr(e._zod,"propValues",()=>t.innerType._zod.propValues),Sr(e._zod,"values",()=>t.innerType._zod.values),Sr(e._zod,"optin",()=>t.innerType?._zod?.optin),Sr(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(Do):Do(n)}});function Do(e){return e.value=Object.freeze(e.value),e}const zo=hr("$ZodCustom",(e,t)=>{Jn.init(e,t),Pi.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=r=>{const n=r.value,i=t.fn(n);if(i instanceof Promise)return i.then(t=>Mo(t,r,n,e));Mo(i,r,n,e)}});function Mo(e,t,r,n){if(!e){const e={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(e.params=n._zod.def.params),t.issues.push(Hr(e))}}var $o;Symbol("ZodOutput"),Symbol("ZodInput");($o=globalThis).__zod_globalRegistry??($o.__zod_globalRegistry=new class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const r=t[0];return this._map.set(e,r),r&&"object"==typeof r&&"id"in r&&this._idmap.set(r.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const r={...this.get(t)??{}};delete r.id;const n={...r,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}});const Uo=globalThis.__zod_globalRegistry;function Bo(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Lr(t)})}function qo(e,t){return new Xn({check:"less_than",...Lr(t),value:e,inclusive:!1})}function Ho(e,t){return new Xn({check:"less_than",...Lr(t),value:e,inclusive:!0})}function Wo(e,t){return new ei({check:"greater_than",...Lr(t),value:e,inclusive:!1})}function Go(e,t){return new ei({check:"greater_than",...Lr(t),value:e,inclusive:!0})}function Vo(e,t){return new ti({check:"multiple_of",...Lr(t),value:e})}function Zo(e,t){return new ni({check:"max_length",...Lr(t),maximum:e})}function Ko(e,t){return new ii({check:"min_length",...Lr(t),minimum:e})}function Qo(e,t){return new oi({check:"length_equals",...Lr(t),length:e})}function Jo(e){return new hi({check:"overwrite",tx:e})}function Yo(e){let t=e?.target??"draft-2020-12";return"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Uo,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function Xo(e,t,r={path:[],schemaPath:[]}){var n;const i=e._zod.def,o=t.seen.get(e);if(o)return o.count++,r.schemaPath.includes(e)&&(o.cycle=r.path),o.schema;const s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s);const a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{const n={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,n);else{const r=s.schema,o=t.processors[i.type];if(!o)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);o(e,t,r,n)}const o=e._zod.parent;o&&(s.ref||(s.ref=o),Xo(o,t,n),t.seen.get(o).isParent=!0)}const l=t.metadataRegistry.get(e);return l&&Object.assign(s.schema,l),"input"===t.io&&rs(e)&&(delete s.schema.examples,delete s.schema.default),"input"===t.io&&"_prefault"in s.schema&&((n=s.schema).default??(n.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function es(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=new Map;for(const t of e.seen.entries()){const r=e.metadataRegistry.get(t[0])?.id;if(r){const e=n.get(r);if(e&&e!==t[0])throw new Error(`Duplicate schema id "${r}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(r,t[0])}}const i=t=>{if(t[1].schema.$ref)return;const n=t[1],{ref:i,defId:o}=(t=>{const n="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){const r=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(r)return{ref:i(r)};const o=t[1].defId??t[1].schema.id??"schema"+e.counter++;return t[1].defId=o,{defId:o,ref:`${i("__shared")}#/${n}/${o}`}}if(t[1]===r)return{ref:"#"};const i=`#/${n}/`,o=t[1].schema.id??"__schema"+e.counter++;return{defId:o,ref:i+o}})(t);n.def={...n.schema},o&&(n.defId=o);const s=n.schema;for(const e in s)delete s[e];s.$ref=i};if("throw"===e.cycles)for(const t of e.seen.entries()){const e=t[1];if(e.cycle)throw new Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>\n\nSet the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const r of e.seen.entries()){const n=r[1];if(t===r[0]){i(r);continue}if(e.external){const n=e.external.registry.get(r[0])?.id;if(t!==r[0]&&n){i(r);continue}}const o=e.metadataRegistry.get(r[0])?.id;(o||n.cycle||n.count>1&&"ref"===e.reused)&&i(r)}}function ts(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=t=>{const r=e.seen.get(t);if(null===r.ref)return;const i=r.def??r.schema,o={...i},s=r.ref;if(r.ref=null,s){n(s);const r=e.seen.get(s),a=r.schema;if(!a.$ref||"draft-07"!==e.target&&"draft-04"!==e.target&&"openapi-3.0"!==e.target?Object.assign(i,a):(i.allOf=i.allOf??[],i.allOf.push(a)),Object.assign(i,o),t._zod.parent===s)for(const e in i)"$ref"!==e&&"allOf"!==e&&(e in o||delete i[e]);if(a.$ref&&r.def)for(const e in i)"$ref"!==e&&"allOf"!==e&&e in r.def&&JSON.stringify(i[e])===JSON.stringify(r.def[e])&&delete i[e]}const a=t._zod.parent;if(a&&a!==s){n(a);const t=e.seen.get(a);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(const e in i)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:r.path??[]})};for(const t of[...e.seen.entries()].reverse())n(t[0]);const i={};if("draft-2020-12"===e.target?i.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?i.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const r=e.external.registry.get(t)?.id;if(!r)throw new Error("Schema is missing an `id` property");i.$id=e.external.uri(r)}Object.assign(i,r.def??r.schema);const o=e.metadataRegistry.get(t)?.id;void 0!==o&&i.id===o&&delete i.id;const s=e.external?.defs??{};for(const t of e.seen.entries()){const e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,s[e.defId]=e.def)}e.external||Object.keys(s).length>0&&("draft-2020-12"===e.target?i.$defs=s:i.definitions=s);try{const r=JSON.parse(JSON.stringify(i));return Object.defineProperty(r,"~standard",{value:{...t["~standard"],jsonSchema:{input:ns(t,"input",e.processors),output:ns(t,"output",e.processors)}},enumerable:!1,writable:!1}),r}catch(e){throw new Error("Error converting schema to JSON.")}}function rs(e,t){const r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);const n=e._zod.def;if("transform"===n.type)return!0;if("array"===n.type)return rs(n.element,r);if("set"===n.type)return rs(n.valueType,r);if("lazy"===n.type)return rs(n.getter(),r);if("promise"===n.type||"optional"===n.type||"nonoptional"===n.type||"nullable"===n.type||"readonly"===n.type||"default"===n.type||"prefault"===n.type)return rs(n.innerType,r);if("intersection"===n.type)return rs(n.left,r)||rs(n.right,r);if("record"===n.type||"map"===n.type)return rs(n.keyType,r)||rs(n.valueType,r);if("pipe"===n.type)return!!e._zod.traits.has("$ZodCodec")||rs(n.in,r)||rs(n.out,r);if("object"===n.type){for(const e in n.shape)if(rs(n.shape[e],r))return!0;return!1}if("union"===n.type){for(const e of n.options)if(rs(e,r))return!0;return!1}if("tuple"===n.type){for(const e of n.items)if(rs(e,r))return!0;return!(!n.rest||!rs(n.rest,r))}return!1}const ns=(e,t,r={})=>n=>{const{libraryOptions:i,target:o}=n??{},s=Yo({...i??{},target:o,io:t,processors:r});return Xo(e,s),es(s,e),ts(s,e)},is={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},os=(e,t,r,n)=>{const i=e._zod.def;Xo(i.innerType,t,n),t.seen.get(e).ref=i.innerType},ss=hr("ZodISODateTime",(e,t)=>{Hi.init(e,t),Es.init(e,t)});const as=hr("ZodISODate",(e,t)=>{Wi.init(e,t),Es.init(e,t)});const ls=hr("ZodISOTime",(e,t)=>{Gi.init(e,t),Es.init(e,t)});const cs=hr("ZodISODuration",(e,t)=>{Vi.init(e,t),Es.init(e,t)});const us=mi(Qr),ds=gi(Qr),ps=_i(Qr),hs=vi(Qr),fs=xi(Qr),ms=wi(Qr),gs=ji(Qr),_s=Si(Qr),ys=ki(Qr),vs=Ci(Qr),bs=Ti(Qr),xs=Ei(Qr),ws=new WeakMap;function js(e,t,r){const n=Object.getPrototypeOf(e);let i=ws.get(n);if(i||(i=new Set,ws.set(n,i)),!i.has(t)){i.add(t);for(const e in r){const t=r[e];Object.defineProperty(n,e,{configurable:!0,enumerable:!1,get(){const r=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:r}),r},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}const Ss=hr("ZodType",(e,t)=>(Pi.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:ns(e,"input"),output:ns(e,"output")}}),e.toJSONSchema=((e,t={})=>r=>{const n=Yo({...r,processors:t});return Xo(e,n),es(n,e),ts(n,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,r)=>us(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>ps(e,t,r),e.parseAsync=async(t,r)=>ds(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>hs(e,t,r),e.spa=e.safeParseAsync,e.encode=(t,r)=>fs(e,t,r),e.decode=(t,r)=>ms(e,t,r),e.encodeAsync=async(t,r)=>gs(e,t,r),e.decodeAsync=async(t,r)=>_s(e,t,r),e.safeEncode=(t,r)=>ys(e,t,r),e.safeDecode=(t,r)=>vs(e,t,r),e.safeEncodeAsync=async(t,r)=>bs(e,t,r),e.safeDecodeAsync=async(t,r)=>xs(e,t,r),js(e,"ZodType",{check(...e){const t=this.def;return this.clone(Cr(t,{checks:[...t.checks??[],...e.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Fr(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(function(e,t={}){return function(e,t,r){return new e({type:"custom",check:"custom",fn:t,...Lr(r)})}(Ta,e,t)}(e,t))},superRefine(e,t){return this.check(function(e,t){return function(e,t){const r=function(e,t){const r=new Jn({check:"custom",...Lr(t)});return r._zod.check=e,r}(t=>(t.addIssue=e=>{if("string"==typeof e)t.issues.push(Hr(e,t.value,r._zod.def));else{const n=e;n.fatal&&(n.continue=!1),n.code??(n.code="custom"),n.input??(n.input=t.value),n.inst??(n.inst=r),n.continue??(n.continue=!r._zod.def.abort),t.issues.push(Hr(n))}},e(t.value,t)),t);return r}(e,t)}(e,t))},overwrite(e){return this.check(Jo(e))},optional(){return ga(this)},exactOptional(){return new _a({type:"optional",innerType:this})},nullable(){return va(this)},nullish(){return ga(va(this))},nonoptional(e){return function(e,t){return new wa({type:"nonoptional",innerType:e,...Lr(t)})}(this,e)},array(){return ia(this)},or(e){return la([this,e])},and(e){return new ca({type:"intersection",left:this,right:e})},transform(e){return ka(this,new fa({type:"transform",transform:e}))},default(e){return t=e,new ba({type:"default",innerType:this,get defaultValue(){return"function"==typeof t?t():Or(t)}});var t},prefault(e){return t=e,new xa({type:"prefault",innerType:this,get defaultValue(){return"function"==typeof t?t():Or(t)}});var t},catch(e){return new ja({type:"catch",innerType:this,catchValue:"function"==typeof(t=e)?t:()=>t});var t},pipe(e){return ka(this,e)},readonly(){return new Ca({type:"readonly",innerType:this})},describe(e){const t=this.clone();return Uo.add(t,{description:e}),t},meta(...e){if(0===e.length)return Uo.get(this);const t=this.clone();return Uo.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get:()=>Uo.get(e)?.description,configurable:!0}),e)),ks=hr("_ZodString",(e,t)=>{Ni.init(e,t),Ss.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r)=>{const n=r;n.type="string";const{minimum:i,maximum:o,format:s,patterns:a,contentEncoding:l}=e._zod.bag;if("number"==typeof i&&(n.minLength=i),"number"==typeof o&&(n.maxLength=o),s&&(n.format=is[s]??s,""===n.format&&delete n.format,"time"===s&&delete n.format),l&&(n.contentEncoding=l),a&&a.size>0){const e=[...a];1===e.length?n.pattern=e[0].source:e.length>1&&(n.allOf=[...e.map(e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source}))])}})(e,t,r);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,js(e,"_ZodString",{regex(...e){return this.check(function(e,t){return new ai({check:"string_format",format:"regex",...Lr(t),pattern:e})}(...e))},includes(...e){return this.check(function(e,t){return new ui({check:"string_format",format:"includes",...Lr(t),includes:e})}(...e))},startsWith(...e){return this.check(function(e,t){return new di({check:"string_format",format:"starts_with",...Lr(t),prefix:e})}(...e))},endsWith(...e){return this.check(function(e,t){return new pi({check:"string_format",format:"ends_with",...Lr(t),suffix:e})}(...e))},min(...e){return this.check(Ko(...e))},max(...e){return this.check(Zo(...e))},length(...e){return this.check(Qo(...e))},nonempty(...e){return this.check(Ko(1,...e))},lowercase(e){return this.check(function(e){return new li({check:"string_format",format:"lowercase",...Lr(e)})}(e))},uppercase(e){return this.check(function(e){return new ci({check:"string_format",format:"uppercase",...Lr(e)})}(e))},trim(){return this.check(Jo(e=>e.trim()))},normalize(...e){return this.check(function(e){return Jo(t=>t.normalize(e))}(...e))},toLowerCase(){return this.check(Jo(e=>e.toLowerCase()))},toUpperCase(){return this.check(Jo(e=>e.toUpperCase()))},slugify(){return this.check(Jo(e=>function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(e)))}})}),Cs=hr("ZodString",(e,t)=>{Ni.init(e,t),ks.init(e,t),e.email=t=>e.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Lr(t)})}(Rs,t)),e.url=t=>e.check(function(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Lr(t)})}(Os,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Lr(t)})}(Vs,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Lr(t)})}(As,t)),e.guid=t=>e.check(Bo(Ps,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Lr(t)})}(Ns,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Lr(t)})}(Ns,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Lr(t)})}(Ns,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Lr(t)})}(Ns,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Lr(t)})}(Is,t)),e.guid=t=>e.check(Bo(Ps,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Lr(t)})}(Fs,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Lr(t)})}(Ls,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Lr(t)})}(Ds,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Lr(t)})}(Hs,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Lr(t)})}(Ws,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Lr(t)})}(zs,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Lr(t)})}(Ms,t)),e.ipv4=t=>e.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Lr(t)})}($s,t)),e.ipv6=t=>e.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Lr(t)})}(Us,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Lr(t)})}(Bs,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Lr(t)})}(qs,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Lr(t)})}(Gs,t)),e.datetime=t=>e.check(function(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Lr(t)})}(ss,e)}(t)),e.date=t=>e.check(function(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...Lr(t)})}(as,e)}(t)),e.time=t=>e.check(function(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Lr(t)})}(ls,e)}(t)),e.duration=t=>e.check(function(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...Lr(t)})}(cs,e)}(t))});function Ts(e){return function(e,t){return new e({type:"string",...Lr(t)})}(Cs,e)}const Es=hr("ZodStringFormat",(e,t)=>{Oi.init(e,t),ks.init(e,t)}),Rs=hr("ZodEmail",(e,t)=>{Fi.init(e,t),Es.init(e,t)}),Ps=hr("ZodGUID",(e,t)=>{Ai.init(e,t),Es.init(e,t)}),Ns=hr("ZodUUID",(e,t)=>{Ii.init(e,t),Es.init(e,t)}),Os=hr("ZodURL",(e,t)=>{Li.init(e,t),Es.init(e,t)}),As=hr("ZodEmoji",(e,t)=>{Di.init(e,t),Es.init(e,t)}),Is=hr("ZodNanoID",(e,t)=>{zi.init(e,t),Es.init(e,t)}),Fs=hr("ZodCUID",(e,t)=>{Mi.init(e,t),Es.init(e,t)}),Ls=hr("ZodCUID2",(e,t)=>{$i.init(e,t),Es.init(e,t)}),Ds=hr("ZodULID",(e,t)=>{Ui.init(e,t),Es.init(e,t)}),zs=hr("ZodXID",(e,t)=>{Bi.init(e,t),Es.init(e,t)}),Ms=hr("ZodKSUID",(e,t)=>{qi.init(e,t),Es.init(e,t)}),$s=hr("ZodIPv4",(e,t)=>{Zi.init(e,t),Es.init(e,t)}),Us=hr("ZodIPv6",(e,t)=>{Ki.init(e,t),Es.init(e,t)}),Bs=hr("ZodCIDRv4",(e,t)=>{Qi.init(e,t),Es.init(e,t)}),qs=hr("ZodCIDRv6",(e,t)=>{Ji.init(e,t),Es.init(e,t)}),Hs=hr("ZodBase64",(e,t)=>{Xi.init(e,t),Es.init(e,t)}),Ws=hr("ZodBase64URL",(e,t)=>{eo.init(e,t),Es.init(e,t)}),Gs=hr("ZodE164",(e,t)=>{to.init(e,t),Es.init(e,t)}),Vs=hr("ZodJWT",(e,t)=>{ro.init(e,t),Es.init(e,t)}),Zs=hr("ZodNumber",(e,t)=>{no.init(e,t),Ss.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r)=>{const n=r,{minimum:i,maximum:o,format:s,multipleOf:a,exclusiveMaximum:l,exclusiveMinimum:c}=e._zod.bag;"string"==typeof s&&s.includes("int")?n.type="integer":n.type="number";const u="number"==typeof c&&c>=(i??Number.NEGATIVE_INFINITY),d="number"==typeof l&&l<=(o??Number.POSITIVE_INFINITY),p="draft-04"===t.target||"openapi-3.0"===t.target;u?p?(n.minimum=c,n.exclusiveMinimum=!0):n.exclusiveMinimum=c:"number"==typeof i&&(n.minimum=i),d?p?(n.maximum=l,n.exclusiveMaximum=!0):n.exclusiveMaximum=l:"number"==typeof o&&(n.maximum=o),"number"==typeof a&&(n.multipleOf=a)})(e,t,r),js(e,"ZodNumber",{gt(e,t){return this.check(Wo(e,t))},gte(e,t){return this.check(Go(e,t))},min(e,t){return this.check(Go(e,t))},lt(e,t){return this.check(qo(e,t))},lte(e,t){return this.check(Ho(e,t))},max(e,t){return this.check(Ho(e,t))},int(e){return this.check(Js(e))},safe(e){return this.check(Js(e))},positive(e){return this.check(Wo(0,e))},nonnegative(e){return this.check(Go(0,e))},negative(e){return this.check(qo(0,e))},nonpositive(e){return this.check(Ho(0,e))},multipleOf(e,t){return this.check(Vo(e,t))},step(e,t){return this.check(Vo(e,t))},finite(){return this}});const r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function Ks(e){return function(e,t){return new e({type:"number",checks:[],...Lr(t)})}(Zs,e)}const Qs=hr("ZodNumberFormat",(e,t)=>{io.init(e,t),Zs.init(e,t)});function Js(e){return function(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Lr(t)})}(Qs,e)}const Ys=hr("ZodBoolean",(e,t)=>{oo.init(e,t),Ss.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t,r)=>{r.type="boolean"})(0,0,t)});function Xs(e){return function(e,t){return new e({type:"boolean",...Lr(t)})}(Ys,e)}const ea=hr("ZodUnknown",(e,t)=>{so.init(e,t),Ss.init(e,t),e._zod.processJSONSchema=(e,t,r)=>{}});function ta(){return new ea({type:"unknown"})}const ra=hr("ZodNever",(e,t)=>{ao.init(e,t),Ss.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t,r)=>{r.not={}})(0,0,t)});const na=hr("ZodArray",(e,t)=>{co.init(e,t),Ss.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const i=r,o=e._zod.def,{minimum:s,maximum:a}=e._zod.bag;"number"==typeof s&&(i.minItems=s),"number"==typeof a&&(i.maxItems=a),i.type="array",i.items=Xo(o.element,t,{...n,path:[...n.path,"items"]})})(e,t,r,n),e.element=t.element,js(e,"ZodArray",{min(e,t){return this.check(Ko(e,t))},nonempty(e){return this.check(Ko(1,e))},max(e,t){return this.check(Zo(e,t))},length(e,t){return this.check(Qo(e,t))},unwrap(){return this.element}})});function ia(e,t){return function(e,t,r){return new e({type:"array",element:t,...Lr(r)})}(na,e,t)}const oa=hr("ZodObject",(e,t)=>{mo.init(e,t),Ss.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const i=r,o=e._zod.def;i.type="object",i.properties={};const s=o.shape;for(const e in s)i.properties[e]=Xo(s[e],t,{...n,path:[...n.path,"properties",e]});const a=new Set(Object.keys(s)),l=new Set([...a].filter(e=>{const r=o.shape[e]._zod;return"input"===t.io?void 0===r.optin:void 0===r.optout}));l.size>0&&(i.required=Array.from(l)),"never"===o.catchall?._zod.def.type?i.additionalProperties=!1:o.catchall?o.catchall&&(i.additionalProperties=Xo(o.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):"output"===t.io&&(i.additionalProperties=!1)})(e,t,r,n),Sr(e,"shape",()=>t.shape),js(e,"ZodObject",{keyof(){return ha(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:ta()})},loose(){return this.clone({...this._zod.def,catchall:ta()})},strict(){return this.clone({...this._zod.def,catchall:function(e,t){return new e({type:"never",...Lr(t)})}(ra,e)});var e},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return function(e,t){if(!Nr(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0){const r=e._zod.def.shape;for(const e in t)if(void 0!==Object.getOwnPropertyDescriptor(r,e))throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const n=Cr(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return kr(this,"shape",r),r}});return Fr(e,n)}(this,e)},safeExtend(e){return function(e,t){if(!Nr(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r=Cr(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return kr(this,"shape",r),r}});return Fr(e,r)}(this,e)},merge(e){return function(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const r=Cr(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return kr(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Fr(e,r)}(this,e)},pick(e){return function(e,t){const r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");return Fr(e,Cr(e._zod.def,{get shape(){const e={};for(const n in t){if(!(n in r.shape))throw new Error(`Unrecognized key: "${n}"`);t[n]&&(e[n]=r.shape[n])}return kr(this,"shape",e),e},checks:[]}))}(this,e)},omit(e){return function(e,t){const r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=Cr(e._zod.def,{get shape(){const n={...e._zod.def.shape};for(const e in t){if(!(e in r.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete n[e]}return kr(this,"shape",n),n},checks:[]});return Fr(e,i)}(this,e)},partial(...e){return function(e,t,r){const n=t._zod.def.checks;if(n&&n.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const i=Cr(t._zod.def,{get shape(){const n=t._zod.def.shape,i={...n};if(r)for(const t in r){if(!(t in n))throw new Error(`Unrecognized key: "${t}"`);r[t]&&(i[t]=e?new e({type:"optional",innerType:n[t]}):n[t])}else for(const t in n)i[t]=e?new e({type:"optional",innerType:n[t]}):n[t];return kr(this,"shape",i),i},checks:[]});return Fr(t,i)}(ma,this,e[0])},required(...e){return function(e,t,r){const n=Cr(t._zod.def,{get shape(){const n=t._zod.def.shape,i={...n};if(r)for(const t in r){if(!(t in i))throw new Error(`Unrecognized key: "${t}"`);r[t]&&(i[t]=new e({type:"nonoptional",innerType:n[t]}))}else for(const t in n)i[t]=new e({type:"nonoptional",innerType:n[t]});return kr(this,"shape",i),i}});return Fr(t,n)}(wa,this,e[0])}})});function sa(e,t){const r={type:"object",shape:e??{},...Lr(t)};return new oa(r)}const aa=hr("ZodUnion",(e,t)=>{_o.init(e,t),Ss.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const i=e._zod.def,o=!1===i.inclusive,s=i.options.map((e,r)=>Xo(e,t,{...n,path:[...n.path,o?"oneOf":"anyOf",r]}));o?r.oneOf=s:r.anyOf=s})(e,t,r,n),e.options=t.options});function la(e,t){return new aa({type:"union",options:e,...Lr(t)})}const ca=hr("ZodIntersection",(e,t)=>{yo.init(e,t),Ss.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const i=e._zod.def,o=Xo(i.left,t,{...n,path:[...n.path,"allOf",0]}),s=Xo(i.right,t,{...n,path:[...n.path,"allOf",1]}),a=e=>"allOf"in e&&1===Object.keys(e).length,l=[...a(o)?o.allOf:[o],...a(s)?s.allOf:[s]];r.allOf=l})(e,t,r,n)}),ua=hr("ZodRecord",(e,t)=>{xo.init(e,t),Ss.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const i=r,o=e._zod.def;i.type="object";const s=o.keyType,a=s._zod.bag,l=a?.patterns;if("loose"===o.mode&&l&&l.size>0){const e=Xo(o.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});i.patternProperties={};for(const t of l)i.patternProperties[t.source]=e}else"draft-07"!==t.target&&"draft-2020-12"!==t.target||(i.propertyNames=Xo(o.keyType,t,{...n,path:[...n.path,"propertyNames"]})),i.additionalProperties=Xo(o.valueType,t,{...n,path:[...n.path,"additionalProperties"]});const c=s._zod.values;if(c){const e=[...c].filter(e=>"string"==typeof e||"number"==typeof e);e.length>0&&(i.required=e)}})(e,t,r,n),e.keyType=t.keyType,e.valueType=t.valueType});function da(e,t,r){return t&&t._zod?new ua({type:"record",keyType:e,valueType:t,...Lr(r)}):new ua({type:"record",keyType:Ts(),valueType:e,...Lr(t)})}const pa=hr("ZodEnum",(e,t)=>{wo.init(e,t),Ss.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r)=>{const n=yr(e._zod.def.entries);n.every(e=>"number"==typeof e)&&(r.type="number"),n.every(e=>"string"==typeof e)&&(r.type="string"),r.enum=n})(e,0,r),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(e,n)=>{const i={};for(const n of e){if(!r.has(n))throw new Error(`Key ${n} not found in enum`);i[n]=t.entries[n]}return new pa({...t,checks:[],...Lr(n),entries:i})},e.exclude=(e,n)=>{const i={...t.entries};for(const t of e){if(!r.has(t))throw new Error(`Key ${t} not found in enum`);delete i[t]}return new pa({...t,checks:[],...Lr(n),entries:i})}});function ha(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new pa({type:"enum",entries:r,...Lr(t)})}const fa=hr("ZodTransform",(e,t)=>{jo.init(e,t),Ss.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Transforms cannot be represented in JSON Schema")})(0,e),e._zod.parse=(r,n)=>{if("backward"===n.direction)throw new mr(e.constructor.name);r.addIssue=n=>{if("string"==typeof n)r.issues.push(Hr(n,r.value,t));else{const t=n;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=r.value),t.inst??(t.inst=e),r.issues.push(Hr(t))}};const i=t.transform(r.value,r);return i instanceof Promise?i.then(e=>(r.value=e,r.fallback=!0,r)):(r.value=i,r.fallback=!0,r)}});const ma=hr("ZodOptional",(e,t)=>{ko.init(e,t),Ss.init(e,t),e._zod.processJSONSchema=(t,r,n)=>os(e,t,0,n),e.unwrap=()=>e._zod.def.innerType});function ga(e){return new ma({type:"optional",innerType:e})}const _a=hr("ZodExactOptional",(e,t)=>{Co.init(e,t),Ss.init(e,t),e._zod.processJSONSchema=(t,r,n)=>os(e,t,0,n),e.unwrap=()=>e._zod.def.innerType}),ya=hr("ZodNullable",(e,t)=>{To.init(e,t),Ss.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const i=e._zod.def,o=Xo(i.innerType,t,n),s=t.seen.get(e);"openapi-3.0"===t.target?(s.ref=i.innerType,r.nullable=!0):r.anyOf=[o,{type:"null"}]})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});function va(e){return new ya({type:"nullable",innerType:e})}const ba=hr("ZodDefault",(e,t)=>{Eo.init(e,t),Ss.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const i=e._zod.def;Xo(i.innerType,t,n),t.seen.get(e).ref=i.innerType,r.default=JSON.parse(JSON.stringify(i.defaultValue))})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}),xa=hr("ZodPrefault",(e,t)=>{Po.init(e,t),Ss.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const i=e._zod.def;Xo(i.innerType,t,n),t.seen.get(e).ref=i.innerType,"input"===t.io&&(r._prefault=JSON.parse(JSON.stringify(i.defaultValue)))})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType}),wa=hr("ZodNonOptional",(e,t)=>{No.init(e,t),Ss.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const i=e._zod.def;Xo(i.innerType,t,n),t.seen.get(e).ref=i.innerType})(e,t,0,n),e.unwrap=()=>e._zod.def.innerType}),ja=hr("ZodCatch",(e,t)=>{Ao.init(e,t),Ss.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const i=e._zod.def;let o;Xo(i.innerType,t,n),t.seen.get(e).ref=i.innerType;try{o=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=o})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}),Sa=hr("ZodPipe",(e,t)=>{Io.init(e,t),Ss.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const i=e._zod.def,o=i.in._zod.traits.has("$ZodTransform"),s="input"===t.io?o?i.out:i.in:i.out;Xo(s,t,n),t.seen.get(e).ref=s})(e,t,0,n),e.in=t.in,e.out=t.out});function ka(e,t){return new Sa({type:"pipe",in:e,out:t})}const Ca=hr("ZodReadonly",(e,t)=>{Lo.init(e,t),Ss.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const i=e._zod.def;Xo(i.innerType,t,n),t.seen.get(e).ref=i.innerType,r.readOnly=!0})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType}),Ta=hr("ZodCustom",(e,t)=>{zo.init(e,t),Ss.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Custom types cannot be represented in JSON Schema")})(0,e)}),Ea=sa({support:Xs().optional(),token:Ts().optional(),ip_logging:Ks().int().optional(),expire_redirect:Ks().int().optional(),expire_404:Ks().int().optional(),auto_target:Ts().optional(),location:Ts().optional(),monitor_post:Ks().int().optional(),monitor_types:ia(Ts()).optional(),associated_redirect:Ts().optional(),redirect_cache:Ks().int().optional(),rest_api:Ks().int().optional(),https:Xs().optional(),headers:ia(ta()).optional(),flag_regex:Xs().optional(),flag_query:Ts().optional(),flag_trailing:Xs().optional(),flag_case:Xs().optional(),postTypes:da(Ts(),Ts()).optional(),installed:Ts().optional(),warning:Ts().optional(),plugin_update:Ts().optional()}).passthrough(),Ra=sa({status:ha(["ok","need-update","error"]),version:Ts().optional(),required:Ts().optional(),reason:Ts().optional()});function Pa(e){return dt({queryKey:Xr.settings.get(),queryFn:async()=>{he.getState().setLoadStatus("loading"),he.getState().setError(!1);try{const e=await jt(Et()),t=e?.settings||e,r={...t,postTypes:e?.post_types||t.postTypes,installed:e?.installed||t.installed,warning:e?.warning||t.warning};try{const e=Ea.parse(r);return he.getState().setValues(e),he.getState().setLoadStatus("success"),e}catch(e){if(e instanceof Kr)return he.getState().setValues(r),he.getState().setLoadStatus("success"),tn.getState().addError("Settings validation failed, using unvalidated data."),r;throw e}}catch(e){const t=Yr(e);throw he.getState().setLoadStatus("error"),he.getState().setError(t.message||"Failed to load settings"),tn.getState().addError(t.message||"Failed to load settings"),t}},...e})}function Na(e){const t=p(),{updateValues:r,setSaveStatus:n}=he(),{incrementProgress:i,decrementProgress:o,addNotice:s,addError:a}=tn();return ft({mutationFn:async e=>{i(),n(!0);try{const t=await jt(Rt(e)),r=t?.settings||t;return Ea.parse(r)}catch(e){throw o(),n(!1),Yr(e)}},onSuccess:e=>{o(),n(!1),r(e),s("Settings saved"),t.invalidateQueries({queryKey:Xr.settings.all})},onError:e=>{a(e.message||"Failed to save settings")},...e})}function Oa(e){const{setDatabase:t}=he(),{incrementProgress:r,decrementProgress:n,addError:i}=tn();return ft({mutationFn:async e=>{r(),t({inProgress:!0});try{return await jt(tr("skip"===e||"stop"===e?{upgrade:e}:void 0))}catch(e){throw n(),t({inProgress:!1,result:"failed"}),Yr(e)}},onSuccess:e=>{n(),t({inProgress:!1,...e})},onError:e=>{i(e.message||"Database upgrade failed")},...e})}function Aa(e){const t=p(),{setShowDatabase:r}=he(),{addError:n}=tn();return ft({mutationFn:async()=>{try{return await jt(rr())}catch(e){throw Yr(e)}},onSuccess:()=>{r(!1),t.invalidateQueries({queryKey:Xr.settings.all}),window.location.href=window.Redirectioni10n.pluginRoot},onError:e=>{n(e.message||"Failed to finish setup")},...e})}function Ia(e){const t=p(),{setDatabase:r}=he(),{onSuccess:n,...i}=e||{};return ft({mutationFn:async({reason:e,current:t})=>await jt(nr(e,t)),onSuccess:(...e)=>{const[i]=e;r(i.database||{}),t.invalidateQueries({queryKey:Xr.settings.all}),n?.(...e)},...i})}sa({version:Ts(),database:Ra,groups:ia(ta()).optional(),postTypes:ia(Ts()).optional(),canDelete:Xs().optional(),autoTarget:Ts().optional()});const Fa="ok",La="fail",Da="loading",za="warning-current",Ma="warning-not-selected";function $a(e){return e===Fa?(0,a.__)("Good","redirection"):e===Ma||e===za?(0,a.__)("Working but some issues","redirection"):(0,a.__)("Unavailable","redirection")}function Ua({allowChange:e=!0}){const[t,r]=c()().useState(!1),n=he(e=>e.apiTest),i=he(e=>e.clearApiTest),s=he(e=>e.api),{mutate:l}=function(){const{setApiTest:e}=he();return ft({mutationFn:async t=>{const r=(e,t,r)=>({message:(0,a.__)("This REST API URL uses a different origin and cannot be tested from the current admin page. Check your WordPress URL/Site URL or proxy configuration.","redirection"),code:"rest_api_cors_mismatch",data:{status:0},request:{url:e,origins:{current:r,test:t}}}),n={};for(const e of t){const{id:t}=e;n[t]={GET:{status:"loading"},POST:{status:"loading"}}}e(n);for(const i of t){const{id:t,url:o}=i,s=o.endsWith("/")?`${o}redirection/v1/plugin/test`:`${o}/redirection/v1/plugin/test`,a=window.location.origin;try{const i=new URL(s,window.location.href).origin;if(i!==a){const o=r(s,i,a);n[t].GET={status:"fail",error:o,code:"cors"},n[t].POST={status:"fail",error:o,code:"cors"},e(n);continue}}catch(e){}try{await jt({url:s,method:"GET"}),n[t].GET={status:"ok"}}catch(e){n[t].GET={status:"fail",error:e,code:e?.data?.status||e?.code}}e(n);try{await jt({url:s,method:"POST",data:{}}),n[t].POST={status:"ok"}}catch(e){n[t].POST={status:"fail",error:e,code:e?.data?.status||e?.code}}e(n)}return n}})}(),{routes:d,current:p}=s;(0,o().useEffect)(()=>{const e=Object.keys(d).map(e=>({id:e,url:d[e]}));e.length>0&&0===Object.keys(n).length&&l(e.filter(e=>!!e&&!!e.url))},[d,n,l]);const h=()=>{r(!0)},f=e=>t||e===La,g=jn().map(e=>({text:e.label,value:String(e.value)})),_=function(e,t){if(0===Object.keys(e).length)return 0;const r=2*t.length;let n=0;for(let t=0;t<Object.keys(e).length;t++){const r=Object.keys(e)[t];r&&e[r]&&e[r].GET&&e[r].GET.status!==Da&&n++,r&&e[r]&&e[r].POST&&e[r].POST.status!==Da&&n++}return Math.round(n/r*100)}(n,g),y=function(e,t,r){const n=Object.keys(e).filter(t=>{return!(!(r=e[t])||!r.GET||!r.POST||r.GET.status!==La&&r.POST.status!==La);var r}).length;return 0===n?"ok":n<t.length?(i=e[r])&&i.GET&&i.POST&&i.GET.status===Fa&&i.POST.status===Fa?za:Ma:"fail";var i}(n,g,p),v=_>=100&&f(y)||t,b=m({"api-result-status":!0,"api-result-status_good":y===Fa&&_>=100,"api-result-status_problem":y===za&&Ma&&_>=100,"api-result-status_failed":y===La&&_>=100});return(0,u.jsxs)("div",{className:"api-result-wrapper",children:[(0,u.jsxs)("div",{className:"api-result-header",children:[(0,u.jsx)("strong",{children:"REST API:"}),(0,u.jsxs)("div",{className:"api-result-progress",children:[(0,u.jsxs)("span",{className:b,children:[_<100&&(0,a.sprintf)(
// translators: %s is the percentage complete
// translators: %s is the percentage complete
(0,a.__)("Testing - %s%%","redirection"),String(_)),_>=100&&$a(y)]}),_<100&&(0,u.jsx)(gn,{})]}),_>=100&&y!==Fa&&(0,u.jsx)("button",{className:"button button-secondary api-result-retry",onClick:e=>{e.preventDefault(),r(!1),i();const t=Object.keys(d).map(e=>({id:e,url:d[e]}));l(t.filter(e=>!!e&&!!e.url))},children:(0,a.__)("Check Again","redirection")})]}),_>=100&&y!==Fa&&(e=>{const t=f(e);let r=(0,a.__)("There are some problems connecting to your REST API. It is not necessary to fix these problems and the plugin is able to work.","redirection");return e===La&&(r=(0,a.__)("Your REST API is not working and the plugin will not be able to continue until this is fixed.","redirection")),(0,u.jsxs)("div",{className:"api-result-log",children:[(0,u.jsxs)("p",{children:[(0,u.jsx)("strong",{children:(0,a.__)("Summary","redirection")}),": ",r]}),!t&&(0,u.jsx)("p",{children:(0,u.jsx)("button",{className:"button-secondary",onClick:h,children:(0,a.__)("Show Problems","redirection")})})]})})(y),v&&g.map((t,r)=>{return(0,u.jsx)(mn,{item:t,result:(i=n,o=t.value,i&&i[o]?i[o]:{}),routes:d,isCurrent:p===t.value,allowChange:e||!1},r);var i,o})]})}function Ba(e){const t=Object.keys(e);for(let r=0;r<t.length;r++){const n=t[r];if(n&&e[n]&&"ok"===e[n].GET.status&&"ok"===e[n].POST.status)return!0}return!1}function qa(e){const t=Object.keys(e);for(let r=0;r<t.length;r++){const n=t[r];if(n&&e[n]&&"ok"===e[n].GET.status&&"ok"===e[n].POST.status)return n}return null}function Ha({setStep:e,step:t}){let r=null,n=null,i=null;try{r=new URL(window.Redirectioni10n.api.WP_API_root),n=new URL(window.Redirectioni10n.pluginBaseUrl),i=new URL(window.location.href)}catch(e){}const s=r&&n&&(r.protocol!==n.protocol||r.host!==n.host),l=r&&i&&r.origin!==i.origin,c=he(e=>e.apiTest),d=Ba(c);return(0,o().useEffect)(()=>()=>{const e=qa(c);null!==e&&window.Redirectioni10n.api.routes[e]&&jt.replaceRootURLMiddleware(window.Redirectioni10n.api.routes[e])},[c]),(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("h2",{children:(0,a.__)("REST API","redirection")}),(0,u.jsx)("p",{children:M((0,a.__)("Redirection uses the {{link}}WordPress REST API{{/link}} to communicate with WordPress. This is enabled and working by default. Sometimes the REST API is blocked by:","redirection"),{link:(0,u.jsx)(A,{url:"https://developer.wordpress.org/rest-api/"})})}),(0,u.jsxs)("ul",{children:[(0,u.jsx)("li",{children:(0,a.__)("A security plugin (e.g Wordfence)","redirection")}),(0,u.jsx)("li",{children:(0,a.__)("A server firewall or other server configuration (e.g OVH)","redirection")}),(0,u.jsx)("li",{children:(0,a.__)("Caching software (e.g Cloudflare)","redirection")}),(0,u.jsx)("li",{children:(0,a.__)("Some other plugin that blocks the REST API","redirection")})]}),(0,u.jsx)("p",{children:M((0,a.__)("If you do experience a problem then please consult your plugin documentation, or try contacting your host support. This is generally {{link}}not a problem caused by Redirection{{/link}}.","redirection"),{link:(0,u.jsx)(A,{url:"https://redirection.me/support/problems/rest-api/"})})}),s&&(0,u.jsxs)("div",{className:"wpl-error",children:[(0,a.__)("You have different URLs configured on your WordPress Settings > General page, which is usually an indication of a misconfiguration, and it can cause problems with the REST API. Please review your settings.","redirection"),(0,u.jsx)("p",{children:(0,u.jsx)("code",{children:r?r.protocol+"//"+r.host:"unknown url"})}),(0,u.jsx)("p",{children:(0,u.jsx)("code",{children:n?n.protocol+"//"+n.host:"unknown url"})})]}),l&&(0,u.jsxs)("div",{className:"wpl-error",children:[(0,a.__)("This admin page is being loaded from a different origin than your REST API. The browser will block the setup request until both URLs use the same protocol, host, and port.","redirection"),(0,u.jsx)("p",{children:(0,u.jsx)("code",{children:i?i.origin:"unknown url"})}),(0,u.jsx)("p",{children:(0,u.jsx)("code",{children:r?r.origin:"unknown url"})})]}),(0,u.jsx)(Ua,{allowChange:!1}),(0,u.jsx)("p",{children:(0,a.__)("You will need at least one working REST API to continue.","redirection")}),(0,u.jsx)("div",{className:"wizard-buttons",children:(0,u.jsx)("button",{className:"button-primary button",onClick:()=>e(t+1),disabled:!d,children:(0,a.__)("Finish Setup","redirection")})})]})}function Wa(e){return Wa="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Wa(e)}function Ga(e,t,r){return(t=function(e){var t=function(e){if("object"!=Wa(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=Wa(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Wa(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Va(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Za(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Va(Object(r),!0).forEach(function(t){Ga(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Va(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var Ka=r(500),Qa=r.n(Ka),Ja={percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,trailColor:"#D9D9D9",trailWidth:1,gapPosition:"bottom"},Ya=["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"];const Xa=function(e){var t=Za(Za({},Ja),e),r=t.className,n=t.percent,i=t.prefixCls,s=t.strokeColor,a=t.strokeLinecap,l=t.strokeWidth,c=t.style,u=t.trailColor,d=t.trailWidth,p=t.transition,h=function(e,t){if(null==e)return{};var r,n,i=_(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],-1===t.indexOf(r)&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}(t,Ya);delete h.gapPosition;var f,m,y=Array.isArray(n)?n:[n],v=Array.isArray(s)?s:[s],b=(f=(0,o().useRef)([]),m=(0,o().useRef)(null),(0,o().useEffect)(function(){var e=Date.now(),t=!1;f.current.forEach(function(r){if(r){t=!0;var n=r.style;n.transitionDuration=".3s, .3s, .3s, .06s",m.current&&e-m.current<100&&(n.transitionDuration="0s, 0s")}}),t&&(m.current=Date.now())}),f.current),x=l/2,w=100-l/2,j="M ".concat("round"===a?x:0,",").concat(x,"\n L ").concat("round"===a?w:100,",").concat(x),S="0 0 100 ".concat(l),k=0;return o().createElement("svg",g({className:Qa()("".concat(i,"-line"),r),viewBox:S,preserveAspectRatio:"none",style:c},h),o().createElement("path",{className:"".concat(i,"-line-trail"),d:j,strokeLinecap:a,stroke:u,strokeWidth:d||l,fillOpacity:"0"}),y.map(function(e,t){var r=1;switch(a){case"round":r=1-l/100;break;case"square":r=1-l/2/100;break;default:r=1}var n={strokeDasharray:"".concat(e*r,"px, 100px"),strokeDashoffset:"-".concat(k,"px"),transition:p||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},s=v[t]||v[v.length-1];return k+=e,o().createElement("path",{key:t,className:"".concat(i,"-line-path"),d:j,strokeLinecap:a,stroke:s,strokeWidth:l,fillOpacity:"0",ref:function(e){b[t]=e},style:n})}))};var el,tl=0,rl=!("undefined"==typeof window||!window.document||!window.document.createElement);r.dn(function(e){var t=(void 0)(el.useState(),2),r=t[0],n=t[1];return el.useEffect(function(){var e;n("rc_progress_".concat((rl?(e=tl,tl+=1):e="TEST_OR_SSR",e)))},[]),e||r});const nl=function({message:e,prevent:t=!0}){const r=(0,o().useRef)();return(0,o().useEffect)(()=>{r.current=t=>(t.returnValue=e,t.returnValue)},[e]),(0,o().useEffect)(()=>{if(!t||!r.current)return;const e=e=>{if(r.current)return r.current(e)};return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}},[t]),null};function il({onRetry:e}){return(0,u.jsxs)("div",{className:"redirection-database_error wpl-error",children:[(0,u.jsx)("h3",{children:(0,a.__)("Database problem","redirection")}),(0,u.jsx)("p",{children:(0,u.jsx)("button",{className:"button button-primary",onClick:e,children:(0,a.__)("Try again","redirection")})})]})}function ol({onRetry:e,error:t}){const{current:r,next:n,debug:i,reason:o}=he(e=>e.database),{mutate:s}=Oa(),l=function(e,t,r,n){return[e?"Message: "+e:null,"Installed: "+t,"Next: "+r,n.length>0?"Debug: "+n.join("\n"):null].filter(e=>e).join("\n")}(o,r,n,i),c="mailto:john@redirection.me?subject=Redirection%20Database&body="+encodeURIComponent("Redirection: "+window.Redirectioni10n.versions);return(0,u.jsxs)("div",{className:"redirection-database_error wpl-error",children:[(0,u.jsx)("h3",{children:(0,a.__)("Database problem","redirection")}),(0,u.jsx)("p",{children:t}),(0,u.jsxs)("p",{children:[(0,u.jsx)("button",{className:"button button-primary",onClick:e,children:(0,a.__)("Try again","redirection")})," ","-"!==r&&(0,u.jsx)("button",{className:"button button-secondary",onClick:function(){s("skip")},children:(0,a.__)("Skip this stage","redirection")})," ","-"!==r&&(0,u.jsx)("button",{className:"button button-secondary",onClick:function(){s("stop")},children:(0,a.__)("Stop upgrade","redirection")})]}),(0,u.jsx)("p",{children:M((0,a.__)("If you want to {{support}}ask for support{{/support}} please include these details:","redirection"),{support:(0,u.jsx)("button",{type:"button",onClick:function(){window.location.href=c}})})}),(0,u.jsx)(P,{readOnly:!0,value:l,rows:15})]})}function sl(e){return"need-update"===e?(0,a.__)("Upgrading Redirection","redirection"):(0,a.__)("Setting up Redirection","redirection")}function al(e,t){return"error"!==t&&"failed"!==t&&("need-install"===e||"need-update"===e)}function ll(e){return"finish-install"===e||"finish-update"===e}function cl({children:e}){const t=he(e=>e.database),{status:r,reason:n,result:i,complete:s}=t,l="ok"===i&&!ll(r),{mutate:c,mutateAsync:d}=Oa(),p=he(e=>e.setDatabase),h=(0,o().useRef)(0),f=(0,o().useRef)(null),m=(0,o().useCallback)(()=>{h.current=0,f.current=null,c("retry")},[c]);return(0,o().useEffect)(()=>{if(!al(r,i))return h.current=0,void(f.current=null);let e,t=!1;return e=setTimeout(async function r(){const n=he.getState().database;if(al(n.status,n.result))if(f.current===n.complete?h.current+=1:(h.current=0,f.current=n.complete),h.current>=30)p({result:"error",reason:(0,a.__)("The process made no progress for a while and may be stuck. You can retry, skip this stage, or stop the process.","redirection")});else{try{await d("")}catch{}t||(e=setTimeout(r,1e3))}},1e3),()=>{t=!0,clearTimeout(e)}},[r,i,d,p]),(0,u.jsxs)("div",{className:"redirection-database",children:[(0,u.jsx)(nl,{message:(0,a.__)("Leaving before the process has completed may cause problems.","redirection"),prevent:"error"!==i&&"failed"!==i&&!ll(r)}),(0,u.jsx)("h1",{children:sl(r)}),(0,u.jsx)("p",{children:(0,a.__)("Please remain on this page until complete.","redirection")}),(0,u.jsxs)("div",{className:"redirection-database_progress",children:[(0,u.jsx)("h3",{children:
// translators: %(complete)d is percentage complete as a number
// translators: %(complete)d is percentage complete as a number
(0,a.sprintf)((0,a.__)("Progress: %(complete)d%%","redirection"),{complete:s})}),(0,u.jsx)(Xa,{percent:s,strokeWidth:4,trailWidth:4,strokeLinecap:"square"}),n&&"ok"===i&&(0,u.jsx)("p",{children:n}),l&&(0,u.jsx)("div",{className:"redirection-database_spinner",children:(0,u.jsx)(gn,{})}),"error"===i&&(0,u.jsx)(ol,{error:n||"",onRetry:m}),"failed"===i&&(0,u.jsx)(il,{error:n||"",onRetry:m}),ll(r)&&e]})]})}function ul({onCancel:e,onComplete:t}){const r=he(e=>e.loadStatus),{mutate:n}=Ia({onSuccess:()=>{t&&t()}});return(0,u.jsxs)("div",{className:"redirection-database",children:[(0,u.jsx)("h1",{children:(0,a.__)("Manual Install","redirection")}),(0,u.jsxs)("p",{children:[(0,a.__)("If your site needs special database permissions, or you would rather do it yourself, you can manually run the following SQL.","redirection")," ",(0,a.__)('Click "Finished! 🎉" when finished.',"redirection")]}),(0,u.jsx)("p",{children:(0,u.jsx)(P,{readOnly:!0,cols:120,value:Redirectioni10n.database.manual.join(";\n\n")+";",spellCheck:!1})}),"error"===r&&(0,u.jsxs)("div",{className:"redirection-database_error wpl-error",children:[(0,u.jsx)("h3",{children:(0,a.__)("Database problem","redirection")}),(0,u.jsx)("p",{children:(0,a.__)("The Redirection database does not appear to exist. Have you run the above SQL?","redirection")})]}),(0,u.jsx)("button",{className:"button button-primary",onClick:function(){n({reason:"database",current:Redirectioni10n.database.next})},type:"button",children:(0,a.__)("Finished! 🎉","redirection")})," ",(0,u.jsx)("button",{className:"button button-secondary",onClick:e,type:"button",children:(0,a.__)("Go back","redirection")}),(0,u.jsx)("p",{children:(0,a.__)("If you do not complete the manual install you will be returned here.","redirection")})]})}function dl({step:e,setStep:t,options:r,setOptions:n}){const{manual:i}=r;return i?(0,u.jsx)(ul,{onCancel:function(){t(0),n({manual:!1})},onComplete:function(){t(e+1)}}):(0,u.jsx)(cl,{children:(0,u.jsx)("div",{className:"wizard-buttons",children:(0,u.jsx)("button",{className:"button-primary button",onClick:()=>t(e+1),children:(0,a.__)("Continue","redirection")})})})}const pl="wordpress-old-slugs";function hl({setOptions:e,options:t,setStep:r,step:n}){const{importers:i=[pl]}=t,{data:o=[]}=on(),s=o.find(e=>e.id===pl),l=o.filter(e=>e.id!==pl);function c(t){const r=i.filter(e=>e!==t.target.name);t.target.checked?e({importers:r.concat(t.target.name)}):e({importers:r})}return(0,u.jsxs)("div",{children:[(0,u.jsx)("h2",{children:(0,a.__)("Import Existing Redirects","redirection")}),(0,u.jsx)("p",{children:(0,a.__)("Importing existing redirects from WordPress or other plugins is a good way to get started with Redirection. Check each set of redirects you wish to import.","redirection")}),s&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("p",{children:(0,a.__)("WordPress automatically creates redirects when you change a post URL. Importing these into Redirection will allow you to manage and monitor them.","redirection")}),(0,u.jsx)("ul",{children:(0,u.jsxs)("li",{children:[(0,u.jsx)("input",{id:"wizard-importer-wordpress-old-slugs",type:"checkbox",name:pl,onChange:c,checked:i.includes(pl)}),(0,u.jsxs)("label",{htmlFor:"wizard-importer-wordpress-old-slugs",children:[s.name," (",s.total,")"]})]})})]}),l.length>0&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("p",{children:(0,a.__)("The following plugins have been detected.","redirection")}),(0,u.jsx)("ul",{children:l.map(e=>{const t=`wizard-importer-${e.id}`;return(0,u.jsxs)("li",{children:[(0,u.jsx)("input",{id:t,type:"checkbox",name:e.id,onChange:c,checked:i.includes(e.id)}),(0,u.jsxs)("label",{htmlFor:t,children:[e.name," (",e.total,")"]})]},e.id)})})]}),(0,u.jsxs)("div",{className:"wizard-buttons",children:[(0,u.jsx)("button",{className:"button-primary button",onClick:()=>r(n+1),children:(0,a.__)("Continue","redirection")})," ",(0,u.jsx)("button",{className:"button",onClick:()=>r(n-1),children:(0,a.__)("Go back","redirection")})]})]})}function fl({step:e,setStep:t,options:r}){const n=sn(),{mutate:i}=n;let s="idle";n.isPending?s="loading":n.isSuccess?s="success":n.isError&&(s="error");const l=(0,o().useCallback)(()=>{const n=r.importers.filter(e=>e.length>0);0!==n.length?i({sourceType:"plugin",mode:"import",pluginId:n,groupId:1,duplicateMode:"import"}):t(e+1)},[i,r.importers,t,e]);return(0,o().useEffect)(()=>{l()},[l]),(0,u.jsxs)("div",{children:[(0,u.jsx)("h2",{children:(0,a.__)("Import Existing Redirects","redirection")}),"loading"===s&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("p",{children:(0,a.__)("Please wait, importing.","redirection")}),(0,u.jsx)("div",{className:"loader-wrapper loader-textarea",children:(0,u.jsx)("div",{className:"wpl-placeholder__loading"})})]}),("success"===s||"error"===s)&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("p",{children:"success"===s?(0,a.__)("Import finished.","redirection"):(0,a.__)("Importing failed.","redirection")}),(0,u.jsxs)("div",{className:"wizard-buttons",children:["error"===s&&(0,u.jsx)("button",{className:"button-secondary button",onClick:l,children:(0,a.__)("Retry","redirection")}),(0,u.jsx)("button",{className:"button-primary button",onClick:()=>t(e+1),children:(0,a.__)("Continue","redirection")})]})]})]})}function ml({options:e}){const t=he(e=>e.apiTest),{addError:r}=tn(),{mutate:n}=Na(),{mutate:i}=Aa(),o=Ba(t);return(0,u.jsxs)("div",{children:[(0,u.jsx)("h2",{children:(0,a.__)("Installation Complete","redirection")}),(0,u.jsx)("p",{children:(0,a.__)("Redirection is now installed!","redirection")}),(0,u.jsx)("p",{children:M((0,a.__)("Please take a moment to consult the {{support}}support site{{/support}} for information about how to use Redirection.","redirection"),{support:(0,u.jsx)(A,{url:"https://redirection.me"})})}),(0,u.jsx)("button",{className:"button button-primary",onClick:function(){if(!o)return void r((0,a.__)("You need at least one working REST API to finish setup.","redirection"));const{ip:s,log:l,monitor:c}=e.settings,u=qa(t);n({expire_redirect:l?7:-1,expire_404:l?7:-1,ip_logging:s?1:0,rest_api:null!==u?Number(u):void 0,monitor_types:c?["post","page"]:void 0,monitor_post:c?1:0},{onSuccess:()=>i()})},type:"button",disabled:!o,children:(0,a.__)("Ready to begin! 🎉","redirection")})]})}const gl=function(){const[e,t]=(0,o().useState)(0),[r,n]=(0,o().useState)({settings:{log:!1,ip:!1,monitor:!1},importers:[]}),i=he(e=>e.database.status),s=he(e=>e.database.reason),l=function(e){return 2===e?hl:4===e?dl:3===e?Ha:1===e?ln:5===e?fl:6===e?ml:me}(e);return(0,u.jsxs)(u.Fragment,{children:["error"===i&&(0,u.jsx)(V,{details:J(),errors:s,renderDebug:fe,links:Q(),locale:"redirection",children:(0,a.__)("Something went wrong when installing Redirection.","redirection")}),(0,u.jsxs)("div",{className:"wizard-wrapper",children:[0!==e&&3!==e&&(0,u.jsx)("h1",{children:(0,a.__)("Redirection","redirection")}),(0,u.jsx)("div",{className:"wizard",children:(0,u.jsx)(l,{options:r,step:e,setStep:function(e){let n=e;5===e&&0===r.importers.length&&(n=e+1),t(n)},setOptions:e=>n({...r,...e})})})]}),(0,u.jsx)("div",{className:"wizard-support",children:(0,u.jsx)(A,{url:"https://redirection.me/contact/",children:(0,a.__)("I need support!","redirection")})})]})};function _l(e){return"finish-install"===e||"finish-update"===e}function yl(){const{current:e,next:t}=window.Redirectioni10n.database;return e===t?(0,u.jsx)("p",{children:(0,a.__)("A database upgrade is in progress. Please continue to finish.","redirection")}):(0,u.jsx)(u.Fragment,{children:(0,u.jsx)("p",{children:M((0,a.sprintf)(
// translators: %(current)s is the current database version, %(latest)s is the latest database version
// translators: %(current)s is the current database version, %(latest)s is the latest database version
(0,a.__)("Redirection stores data in your database and sometimes this needs upgrading. Your database is at version {{strong}}%(current)s{{/strong}} and the latest is {{strong}}%(latest)s{{/strong}}.","redirection"),{current:window.Redirectioni10n.database.current,latest:window.Redirectioni10n.database.next}),{strong:(0,u.jsx)("strong",{})})})})}function vl(){const{mutate:e}=Ia();function t(){e({reason:"database",current:window.Redirectioni10n.database.next})}return 0===window.Redirectioni10n.database.manual.length?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("p",{children:(0,a.__)("Your site already has the latest SQL.","redirection")+" "+(0,a.__)('Click "Complete Upgrade" when finished.',"redirection")}),(0,u.jsx)("p",{children:(0,u.jsx)("button",{className:"button-primary",onClick:t,children:(0,a.__)("Complete Upgrade","redirection")})})]}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsxs)("p",{children:[(0,a.__)("If your site needs special database permissions, or you would rather do it yourself, you can manually run the following SQL.")," ",(0,a.__)('Click "Complete Upgrade" when finished.',"redirection")]}),(0,u.jsx)("p",{children:(0,u.jsx)(P,{readOnly:!0,cols:120,value:window.Redirectioni10n.database.manual.join(";\n")+";",spellCheck:!1})}),(0,u.jsx)("p",{children:(0,u.jsx)("button",{className:"button-primary",onClick:t,children:(0,a.__)("Complete Upgrade","redirection")})})]})}function bl({onShowUpgrade:e}){return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("p",{children:(0,a.__)('Click the "Upgrade Database" button to automatically upgrade the database.',"redirection")}),(0,u.jsx)("p",{children:(0,u.jsx)("input",{className:"button-primary",type:"submit",value:(0,a.__)("Upgrade Database","redirection"),onClick:e})})]})}function xl(){const e=he(e=>e.database.reason),t=he(e=>e.database.status),r=he(e=>e.database.result),{mutate:n}=Aa();return(0,u.jsxs)(u.Fragment,{children:["error"===r&&(0,u.jsx)(V,{details:J(),errors:e,renderDebug:fe,links:Q(),locale:"redirection",children:(0,a.__)("Something went wrong when upgrading Redirection.","redirection")}),(0,u.jsx)("div",{className:"wizard-wrapper",children:(0,u.jsxs)("div",{className:"wizard",children:[(0,u.jsx)(cl,{}),_l(t)&&(0,u.jsx)("button",{className:"button button-primary",onClick:function(){n()},children:(0,a.__)("Finished! 🎉","redirection")})]})})]})}function wl({children:e}){const t=an();return(0,u.jsx)("button",{type:"button",className:"button-link",onClick:function(e){e.preventDefault(),t.isPending||t.mutate({exportType:"redirect",format:"json",redirectScopeType:"all",redirectModule:"all",redirectGroup:0,download:!0,filename:"redirection-backup.json",completionNotice:{message:(0,a.__)("Backup downloaded","redirection")}})},disabled:t.isPending,children:e})}function jl({onShowUpgrade:e}){const[t,r]=(0,o().useState)(!1);function n(e){e.preventDefault(),r(!t)}return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("h1",{className:"wp-heading-inline",children:(0,a.__)("Upgrade Required","redirection")}),(0,u.jsxs)("div",{className:"wpl-error",children:[(0,u.jsx)("h3",{children:(0,a.__)("Redirection database needs upgrading","redirection")}),yl(),(0,u.jsx)("p",{children:M((0,a.__)("Please make a backup of your Redirection data: {{download}}downloading a backup{{/download}}. If you experience any issues you can import this back into Redirection.","redirection"),{download:(0,u.jsx)(wl,{}),import:(0,u.jsx)(A,{url:"https://redirection.me/support/import-export-redirects/"})})}),t?(0,u.jsx)(vl,{}):(0,u.jsx)(bl,{onShowUpgrade:e})]}),(0,u.jsxs)("div",{className:"database-switch",children:[!t&&(0,u.jsx)("button",{type:"button",onClick:n,children:(0,a.__)("Manual Upgrade","redirection")}),t&&(0,u.jsx)("button",{type:"button",onClick:n,children:(0,a.__)("Automatic Upgrade","redirection")})]})]})}function Sl({showDatabase:e,onShowUpgrade:t}){return e?(0,u.jsx)(xl,{}):(0,u.jsx)(jl,{onShowUpgrade:t})}const kl=({item:e,isCurrent:t,onClick:r,isLast:n,urlBase:i})=>{const o=i+(""===e.value?"":"&sub="+e.value);return(0,u.jsxs)("li",{children:[(0,u.jsx)("a",{className:t?"current":"",href:o,onClick:t=>{t.preventDefault(),r(e.value,o)},children:e.name})," ",!n&&"|"," "]})},Cl=(e,t,r)=>e===t.value||e===r&&""===t.value,Tl=({onChangePage:e,menu:t,home:r,urlBase:n,currentPage:i})=>t.length<2?null:(0,u.jsx)("div",{className:"subsubsub-container",children:(0,u.jsx)("ul",{className:"subsubsub",children:t.map((o,s)=>(0,u.jsx)(kl,{item:o,isCurrent:Cl(i,o,r),isLast:s===t.length-1,onClick:e,urlBase:n},s))})});let El=!1;function Rl({notices:e}){const t=e[e.length-1],r=t?.message??"";return(0,u.jsx)(u.Fragment,{children:r+(e.length>1?" ("+e.length+")":"")})}const Pl=function({notices:e,onClear:t,snackBarViewText:r}){const[n,i]=(0,o().useState)(!1);if((0,o().useEffect)(()=>(e.length>0&&(i(!1),El&&clearTimeout(El),El=setTimeout(()=>i(!0),5e3)),()=>{El&&clearTimeout(El)}),[e]),0===e.length)return null;function s(){n?i(!1):t()}const a=m("notice","notice-info","wpl-notice",n&&"wpl-notice_shrunk");return(0,u.jsxs)("div",{className:a,onClick:s,onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),s())},role:"button",tabIndex:0,children:[(0,u.jsx)("div",{className:"closer",children:(0,u.jsx)("span",{className:"dashicons dashicons-yes"})}),(0,u.jsx)("p",{children:n?(0,u.jsx)("span",{className:"dashicons dashicons-warning",title:r}):(0,u.jsx)(Rl,{notices:e})})]})};function Nl(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!Nl(e[r],t[r]))return!1;return!0}const r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(const n of r){if(!Object.prototype.hasOwnProperty.call(t,n))return!1;if(!Nl(e[n],t[n]))return!1}return!0}return!1}function Ol(e){return function(e){const t=new URLSearchParams(e),r={},n=new Map;t.forEach((e,t)=>{const r=t.replace(/\[\d*\]$/,"");n.has(r)||n.set(r,[]),n.get(r).push({key:t,value:e})});for(const[e,t]of n){const n=t.map(e=>e.value);n.length>1?r[e]=n:1===n.length&&(r[e]=n[0])}return r}(e?e.slice(1):document.location.search.slice(1))}function Al(e,t,r){const n=Ol(r);for(const r in e){const i=Nl(t[r],e[r]);e[r]&&!i||"page"===r?n[r.toLowerCase()]=e[r]:i&&delete n[r.toLowerCase()]}return"?"+function(e){const t=new URLSearchParams;for(const r in e){const n=e[r];if(null!=n)if(Array.isArray(n))if(n.some(e=>"object"==typeof e&&null!==e))t.append(r,JSON.stringify(n));else for(const e of n)null!=e&&t.append(`${r}[]`,String(e));else"object"==typeof n?t.append(r,JSON.stringify(n)):t.append(r,String(n))}return t.toString()}(n)}function Il(e,t){const r=Ol(t);return r.sub&&-1!==e.indexOf(r.sub)?r.sub:e[0]}const Fl=function(e){const{page:t,setPage:r,children:n,onPageChange:i,defaultPage:s,baseUrl:a,allowedPages:l}=e,c=(0,o().useRef)(void 0),d=(0,o().useCallback)(()=>{const e=Il(window.Redirectioni10n?.caps?.pages||l);r(e)},[l,r]);return(0,o().useEffect)(()=>(window.addEventListener("popstate",d),()=>{window.removeEventListener("popstate",d)}),[d]),(0,o().useEffect)(()=>{i(),c.current&&c.current!==t&&history.pushState({},"",Al({sub:t},{sub:s},a)),c.current=t},[a,s,i,t]),(0,u.jsx)(u.Fragment,{children:n})},Ll=function(){return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(Ua,{}),(0,u.jsx)("h3",{children:(0,a.__)("What do I do next?","redirection")}),(0,u.jsxs)("ol",{children:[(0,u.jsx)("li",{children:M((0,a.__)('Take a look at the {{link}}plugin status{{/link}}. It may be able to identify and "magic fix" the problem.',"redirection"),{link:(0,u.jsx)("a",{href:"?page=redirection.php&sub=support"})})}),(0,u.jsx)("li",{children:M((0,a.__)("{{link}}Caching software{{/link}}, in particular Cloudflare, can cache the wrong thing. Try clearing all your caches.","redirection"),{link:(0,u.jsx)(A,{url:"https://redirection.me/support/problems/cloudflare/"})})}),(0,u.jsx)("li",{children:M((0,a.__)("{{link}}Please temporarily disable other plugins!{{/link}} This fixes so many problems.","redirection"),{link:(0,u.jsx)(A,{url:"https://redirection.me/support/problems/plugins/"})})}),(0,u.jsx)("li",{children:M((0,a.__)("Look at your {{link}}Site Health{{/link}} and resolve any issues.","redirection"),{link:(0,u.jsx)(A,{url:Q().siteHealth})})})]})]})};function Dl(){return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("p",{children:(0,a.__)("This error may be caused by a browser extension modifying the page. Please try disabling browser extensions for this page.","redirection")}),(0,u.jsx)("p",{children:(0,a.__)("You can also try using a different browser, or using private/incognito mode.","redirection")})]})}function zl(){return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsxs)("p",{children:[(0,a.__)("Redirection is not working. Try clearing your browser cache and reloading this page.","redirection")," ",(0,a.__)("If you are using a page caching plugin or service (CloudFlare, OVH, etc) then you can also try clearing that cache.","redirection")]}),(0,u.jsx)("p",{children:M((0,a.__)("If that doesn't help, open your browser's error console and create a {{link}}new issue{{/link}} with the details.","redirection"),{link:(0,u.jsx)(A,{url:"https://github.com/johngodley/redirection/issues"})})})]})}const Ml=function(e,t,r){const n=e?.stack||"",i=function(e,t){if(e&&(e.includes("chrome-extension://")||e.includes("moz-extension://")))return!0;const r=["Failed to execute 'removeChild'","Failed to execute 'insertBefore'","Failed to execute 'appendChild'","The node to be removed is not a child of this node"];if(t)for(const e of r)if(t.includes(e))return!0;return!1}(n,e?.message||"");return(0,u.jsx)(V,{errors:"",renderDebug:fe,type:"fixed",links:Q(),details:J().concat([n,t?.componentStack||""]),locale:"redirection",children:i?(0,u.jsx)(Dl,{}):(0,u.jsx)(zl,{})})},$l=()=>(0,u.jsx)("div",{className:"wpl-placeholder__container",children:(0,u.jsx)("div",{className:"wpl-placeholder__loading"})}),Ul=function(e){const{isPrimary:t=!1,isSecondary:r=!0,isSubmit:n=!1,isSaving:i=!1,className:o,children:s,disabled:a=!1,isDestructive:l=!1,...c}=e,d=m("button",o,{"button-primary":t,"button-secondary":r,"button-delete":l,"wpl-spinner":i});return(0,u.jsxs)("button",{className:d,disabled:a,type:n?"submit":"button",...c,children:[i&&(0,u.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",children:(0,u.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0l3.181 3.183a8.25 8.25 0 0013.803-3.7M4.031 9.865a8.25 8.25 0 0113.803-3.7l3.181 3.182m0-4.991v4.99"})}),s]})};var Bl="data-focus-lock",ql="data-focus-lock-disabled";function Hl(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var Wl="undefined"!=typeof window?o().useLayoutEffect:o().useEffect,Gl=new WeakMap;var Vl={width:"1px",height:"0px",padding:0,overflow:"hidden",position:"fixed",top:"1px",left:"1px"},Zl=function(){return Zl=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Zl.apply(this,arguments)};function Kl(e){return e}function Ql(e,t){void 0===t&&(t=Kl);var r=[],n=!1;return{read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(e){var i=t(e,n);return r.push(i),function(){r=r.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(n=!0;r.length;){var t=r;r=[],t.forEach(e)}r={push:function(t){return e(t)},filter:function(){return r}}},assignMedium:function(e){n=!0;var t=[];if(r.length){var i=r;r=[],i.forEach(e),t=r}var o=function(){var r=t;t=[],r.forEach(e)},s=function(){return Promise.resolve().then(o)};s(),r={push:function(e){t.push(e),s()},filter:function(e){return t=t.filter(e),r}}}}}function Jl(e,t){return void 0===t&&(t=Kl),Ql(e,t)}Object.create,Object.create;var Yl=Jl({},function(e){return{target:e.target,currentTarget:e.currentTarget}}),Xl=Jl(),ec=Jl(),tc=function(e){void 0===e&&(e={});var t=Ql(null);return t.options=Zl({async:!0,ssr:!1},e),t}({async:!0,ssr:"undefined"!=typeof document}),rc=(0,o().createContext)(void 0),nc=[],ic=(0,o().forwardRef)(function(e,t){var r,n,i,s,a,l,u,d=(0,o().useState)(),p=d[0],h=d[1],f=(0,o().useRef)(),m=(0,o().useRef)(!1),_=(0,o().useRef)(null),y=(0,o().useState)({})[1],v=e.children,b=e.disabled,x=void 0!==b&&b,w=e.noFocusGuards,j=void 0!==w&&w,S=e.persistentFocus,k=void 0!==S&&S,C=e.crossFrame,T=void 0===C||C,E=e.autoFocus,R=void 0===E||E,P=(e.allowTextSelection,e.group),N=e.className,O=e.whiteList,A=e.hasPositiveIndices,I=e.shards,F=void 0===I?nc:I,L=e.as,D=void 0===L?"div":L,z=e.lockProps,M=void 0===z?{}:z,$=e.sideCar,U=e.returnFocus,B=void 0!==U&&U,q=e.focusOptions,H=e.onActivation,W=e.onDeactivation,G=(0,o().useState)({})[0],V=(0,o().useCallback)(function(e){var t=e.captureFocusRestore;if(!_.current){var r,n=null==(r=document)?void 0:r.activeElement;_.current=n,n!==document.body&&(_.current=t(n))}f.current&&H&&H(f.current),m.current=!0,y()},[H]),Z=(0,o().useCallback)(function(){m.current=!1,W&&W(f.current),y()},[W]),K=(0,o().useCallback)(function(e){var t=_.current;if(t){var r=("function"==typeof t?t():t)||document.body,n="function"==typeof B?B(r):B;if(n){var i="object"==typeof n?n:void 0;_.current=null,e?Promise.resolve().then(function(){return r.focus(i)}):r.focus(i)}}},[B]),Q=(0,o().useCallback)(function(e){m.current&&Yl.useMedium(e)},[]),J=Xl.useMedium,Y=(0,o().useCallback)(function(e){f.current!==e&&(f.current=e,h(e))},[]),X=g(((r={})[ql]=x&&"disabled",r[Bl]=P,r),M),ee=!0!==j,te=ee&&"tail"!==j,re=(n=[t,Y],s=i||null,a=function(e){return n.forEach(function(t){return Hl(t,e)})},(l=(0,o().useState)(function(){return{value:s,callback:a,facade:{get current(){return l.value},set current(e){var t=l.value;t!==e&&(l.value=e,l.callback(e,t))}}}})[0]).callback=a,u=l.facade,Wl(function(){var e=Gl.get(u);if(e){var t=new Set(e),r=new Set(n),i=u.current;t.forEach(function(e){r.has(e)||Hl(e,null)}),r.forEach(function(e){t.has(e)||Hl(e,i)})}Gl.set(u,n)},[n]),u),ne=(0,o().useMemo)(function(){return{observed:f,shards:F,enabled:!x,get active(){return m.current}}},[x,m,F,f]);return c()().createElement(o().Fragment,null,ee&&[c()().createElement("div",{key:"guard-first","data-focus-guard":!0,tabIndex:x?-1:0,style:Vl}),A?c()().createElement("div",{key:"guard-nearest","data-focus-guard":!0,tabIndex:x?-1:1,style:Vl}):null],!x&&c()().createElement($,{id:G,sideCar:tc,observed:p,disabled:x,persistentFocus:k,crossFrame:T,autoFocus:R,whiteList:O,shards:F,onActivation:V,onDeactivation:Z,returnFocus:K,focusOptions:q,noFocusGuards:j}),c()().createElement(D,g({ref:re},X,{className:N,onBlur:J,onFocus:Q}),c()().createElement(rc.Provider,{value:ne},v)),te&&c()().createElement("div",{"data-focus-guard":!0,tabIndex:x?-1:0,style:Vl}))});ic.propTypes={};const oc=ic;function sc(e,t){return sc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},sc(e,t)}var ac=function(e){for(var t=Array(e.length),r=0;r<e.length;++r)t[r]=e[r];return t},lc=function(e){return Array.isArray(e)?e:[e]},cc=function(e){return Array.isArray(e)?e[0]:e},uc=function(e){return e.parentNode&&e.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE?e.parentNode.host:e.parentNode},dc=function(e){return e===document||e&&e.nodeType===Node.DOCUMENT_NODE},pc=function(e,t){var r=e.get(t);if(void 0!==r)return r;var n=function(e,t){return!e||dc(e)||!function(e){if(e.nodeType!==Node.ELEMENT_NODE)return!1;var t=window.getComputedStyle(e,null);return!(!t||!t.getPropertyValue||"none"!==t.getPropertyValue("display")&&"hidden"!==t.getPropertyValue("visibility"))}(e)&&!function(e){return e.hasAttribute("inert")}(e)&&t(uc(e))}(t,pc.bind(void 0,e));return e.set(t,n),n},hc=function(e,t){var r=e.get(t);if(void 0!==r)return r;var n=function(e,t){return!(e&&!dc(e))||!!_c(e)&&t(uc(e))}(t,hc.bind(void 0,e));return e.set(t,n),n},fc=function(e){return e.dataset},mc=function(e){return"INPUT"===e.tagName},gc=function(e){return mc(e)&&"radio"===e.type},_c=function(e){var t=e.getAttribute("data-no-autofocus");return![!0,"true",""].includes(t)},yc=function(e){var t;return Boolean(e&&(null===(t=fc(e))||void 0===t?void 0:t.focusGuard))},vc=function(e){return!yc(e)},bc=function(e){return Boolean(e)},xc=function(e,t){var r=Math.max(0,e.tabIndex),n=Math.max(0,t.tabIndex),i=r-n,o=e.index-t.index;if(i){if(!r)return 1;if(!n)return-1}return i||o},wc=function(e,t,r){return ac(e).map(function(e,t){var n=function(e){return e.tabIndex<0&&!e.hasAttribute("tabindex")?0:e.tabIndex}(e);return{node:e,index:t,tabIndex:r&&-1===n?(e.dataset||{}).focusGuard?0:-1:n}}).filter(function(e){return!t||e.tabIndex>=0}).sort(xc)},jc=["button:enabled","select:enabled","textarea:enabled","input:enabled","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[tabindex]","[contenteditable]","[autofocus]"].join(","),Sc="".concat(jc,", [data-focus-guard]"),kc=function(e,t){return ac((e.shadowRoot||e).children).reduce(function(e,r){return e.concat(r.matches(t?Sc:jc)?[r]:[],kc(r))},[])},Cc=function(e,t){return e.reduce(function(e,r){var n,i=kc(r,t),o=(n=[]).concat.apply(n,i.map(function(e){return function(e,t){var r;return e instanceof HTMLIFrameElement&&(null===(r=e.contentDocument)||void 0===r?void 0:r.body)?Cc([e.contentDocument.body],t):[e]}(e,t)}));return e.concat(o,r.parentNode?ac(r.parentNode.querySelectorAll(jc)).filter(function(e){return e===r}):[])},[])},Tc=function(e,t){return ac(e).filter(function(e){return pc(t,e)}).filter(function(e){return function(e){return!((mc(e)||function(e){return"BUTTON"===e.tagName}(e))&&("hidden"===e.type||e.disabled))}(e)})},Ec=function(e,t){return void 0===t&&(t=new Map),ac(e).filter(function(e){return hc(t,e)})},Rc=function(e,t,r){return wc(Tc(Cc(e,r),t),!0,r)},Pc=function(e,t){return wc(Tc(Cc(e),t),!1)},Nc=function(e,t){return e.shadowRoot?Nc(e.shadowRoot,t):!(void 0===Object.getPrototypeOf(e).contains||!Object.getPrototypeOf(e).contains.call(e,t))||ac(e.children).some(function(e){var r;if(e instanceof HTMLIFrameElement){var n=null===(r=e.contentDocument)||void 0===r?void 0:r.body;return!!n&&Nc(n,t)}return Nc(e,t)})},Oc=function(e){if(void 0===e&&(e=document),e&&e.activeElement){var t=e.activeElement;return t.shadowRoot?Oc(t.shadowRoot):t instanceof HTMLIFrameElement&&function(){try{return t.contentWindow.document}catch(e){return}}()?Oc(t.contentWindow.document):t}},Ac=function(e){return e.parentNode?Ac(e.parentNode):e},Ic=function(e){return lc(e).filter(Boolean).reduce(function(e,t){var r=t.getAttribute(Bl);return e.push.apply(e,r?function(e){for(var t=new Set,r=e.length,n=0;n<r;n+=1)for(var i=n+1;i<r;i+=1){var o=e[n].compareDocumentPosition(e[i]);(o&Node.DOCUMENT_POSITION_CONTAINED_BY)>0&&t.add(i),(o&Node.DOCUMENT_POSITION_CONTAINS)>0&&t.add(n)}return e.filter(function(e,r){return!t.has(r)})}(ac(Ac(t).querySelectorAll("[".concat(Bl,'="').concat(r,'"]:not([').concat(ql,'="disabled"])')))):[t]),e},[])},Fc=function(e,t){return void 0===t&&(t=Oc(cc(e).ownerDocument)),!(!t||t.dataset&&t.dataset.focusGuard)&&Ic(e).some(function(e){return Nc(e,t)||function(e,t){return Boolean(ac(e.querySelectorAll("iframe")).some(function(e){return function(e,t){return e===t}(e,t)}))}(e,t)})},Lc=function(e,t){e&&("focus"in e&&e.focus(t),"contentWindow"in e&&e.contentWindow&&e.contentWindow.focus())},Dc=function(e,t){return gc(e)&&e.name?function(e,t){return t.filter(gc).filter(function(t){return t.name===e.name}).filter(function(e){return e.checked})[0]||e}(e,t):e},zc=function(e){return e[0]&&e.length>1?Dc(e[0],e):e[0]},Mc=function(e,t){return e.indexOf(Dc(t,e))},$c="NEW_FOCUS",Uc=function(e,t,r){var n,i=e.map(function(e){return e.node}),o=Ec(i.filter((n=r,function(e){var t,r=null===(t=fc(e))||void 0===t?void 0:t.autofocus;return e.autofocus||void 0!==r&&"false"!==r||n.indexOf(e)>=0})));return o&&o.length?zc(o):zc(Ec(t))},Bc=function(e,t){return void 0===t&&(t=[]),t.push(e),e.parentNode&&Bc(e.parentNode.host||e.parentNode,t),t},qc=function(e,t){for(var r=Bc(e),n=Bc(t),i=0;i<r.length;i+=1){var o=r[i];if(n.indexOf(o)>=0)return o}return!1},Hc=function(e,t,r){var n=lc(e),i=lc(t),o=n[0],s=!1;return i.filter(Boolean).forEach(function(e){s=qc(s||e,e)||s,r.filter(Boolean).forEach(function(e){var t=qc(o,e);t&&(s=!s||Nc(t,s)?t:qc(t,s))})}),s},Wc=function(e,t){return e.reduce(function(e,r){return e.concat(function(e,t){return Tc((r=e.querySelectorAll("[".concat("data-autofocus-inside","]")),ac(r).map(function(e){return Cc([e])}).reduce(function(e,t){return e.concat(t)},[])),t);var r}(r,t))},[])},Gc=function(e,t){var r=Oc(lc(e).length>0?document:cc(e).ownerDocument),n=Ic(e).filter(vc),i=Hc(r||e,e,n),o=new Map,s=Pc(n,o),a=s.filter(function(e){var t=e.node;return vc(t)});if(a[0]){var l,c,u,d=Pc([i],o).map(function(e){return e.node}),p=(l=d,c=a,u=new Map,c.forEach(function(e){return u.set(e.node,e)}),l.map(function(e){return u.get(e)}).filter(bc)),h=p.map(function(e){return e.node}),f=p.filter(function(e){return e.tabIndex>=0}).map(function(e){return e.node}),m=function(e,t,r,n,i){var o=e.length,s=e[0],a=e[o-1],l=yc(n);if(!(n&&e.indexOf(n)>=0)){var c=void 0!==n?r.indexOf(n):-1,u=i?r.indexOf(i):c,d=i?e.indexOf(i):-1;if(-1===c)return-1!==d?d:$c;if(-1===d)return $c;var p,h,f=c-u,m=r.indexOf(s),g=r.indexOf(a),_=(p=r,h=new Set,p.forEach(function(e){return h.add(Dc(e,p))}),p.filter(function(e){return h.has(e)})),y=void 0!==n?_.indexOf(n):-1,v=i?_.indexOf(i):y,b=_.filter(function(e){return e.tabIndex>=0}),x=void 0!==n?b.indexOf(n):-1,w=i?b.indexOf(i):x,j=x>=0&&w>=0?w-x:v-y;if(!f&&d>=0)return d;if(0===t.length)return d;var S=Mc(e,t[0]),k=Mc(e,t[t.length-1]);return c<=m&&l&&Math.abs(f)>1?k:c>=g&&l&&Math.abs(f)>1?S:f&&Math.abs(j)>1?d:c<=m?k:c>g?S:f?Math.abs(f)>1?d:(o+d+f)%o:void 0}}(h,f,d,r,t);if(m===$c){var g=Uc(s,f,Wc(n,o))||Uc(s,h,Wc(n,o));return g?{node:g}:void console.warn("focus-lock: cannot find any node to move focus into")}return void 0===m?m:p[m]}},Vc=0,Zc=!1,Kc=function(e,t,r){void 0===r&&(r={});var n=Gc(e,t);if(!Zc&&n){if(Vc>2)return console.error("FocusLock: focus-fighting detected. Only one focus management system could be active. See https://github.com/theKashey/focus-lock/#focus-fighting"),Zc=!0,void setTimeout(function(){Zc=!1},1);Vc++,Lc(n.node,r.focusOptions),Vc--}};function Qc(e){if(!e)return null;if("undefined"==typeof WeakRef)return function(){return e||null};var t=e?new WeakRef(e):null;return function(){return(null==t?void 0:t.deref())||null}}var Jc=function(e){var t=function(e){if(!e)return null;for(var t=[],r=e;r&&r!==document.body;)t.push({current:Qc(r),parent:Qc(r.parentElement),left:Qc(r.previousElementSibling),right:Qc(r.nextElementSibling)}),r=r.parentElement;return{element:Qc(e),stack:t,ownerDocument:e.ownerDocument}}(e);return function(){return function(e){var t,r,n,i,o;if(e)for(var s=e.stack,a=e.ownerDocument,l=new Map,c=0,u=s;c<u.length;c++){var d=u[c],p=null===(t=d.parent)||void 0===t?void 0:t.call(d);if(p&&a.contains(p)){for(var h=null===(r=d.left)||void 0===r?void 0:r.call(d),f=d.current(),m=p.contains(f)?f:void 0,g=null===(n=d.right)||void 0===n?void 0:n.call(d),_=Rc([p],l),y=null!==(o=null!==(i=null!=m?m:null==h?void 0:h.nextElementSibling)&&void 0!==i?i:g)&&void 0!==o?o:h;y;){for(var v=0,b=_;v<b.length;v++){var x=b[v];if(null==y?void 0:y.contains(x.node))return x.node}y=y.nextElementSibling}if(_.length)return _[0].node}}}(t)}},Yc=function(e,t,r){void 0===t&&(t={});var n=function(e){return Object.assign({scope:document.body,cycle:!0,onlyTabbable:!0},e)}(t),i=function(e,t,r){if(!e||!t)return console.error("no element or scope given"),{};var n=lc(t);if(n.every(function(t){return!Nc(t,e)}))return console.error("Active element is not contained in the scope"),{};var i=r?Rc(n,new Map):Pc(n,new Map),o=i.findIndex(function(t){return t.node===e});return-1!==o?{prev:i[o-1],next:i[o+1],first:i[0],last:i[i.length-1]}:void 0}(e,n.scope,n.onlyTabbable);if(i){var o=r(i,n.cycle);o&&Lc(o.node,n.focusOptions)}},Xc=function(e,t,r){var n,i,o,s,a=(i=e,o=null===(n=t.onlyTabbable)||void 0===n||n,{first:(s=o?Rc(lc(i),new Map):Pc(lc(i),new Map))[0],last:s[s.length-1]})[r];a&&Lc(a.node,t.focusOptions)};function eu(e){setTimeout(e,1)}var tu=function(e){return e&&"current"in e?e.current:e},ru=function(){return document&&document.activeElement===document.body},nu=null,iu=null,ou=function(){return null},su=null,au=!1,lu=!1,cu=function(){return!0};function uu(e,t,r,n){var i=null,o=e;do{var s=n[o];if(s.guard)s.node.dataset.focusAutoGuard&&(i=s);else{if(!s.lockItem)break;if(o!==e)return;i=null}}while((o+=r)!==t);i&&(i.node.tabIndex=0)}var du=function e(t,r,n){return r&&(r.host===t&&(!r.activeElement||n.contains(r.activeElement))||r.parentNode&&e(t,r.parentNode,n))},pu=function(e){return Pc(e,new Map)},hu=function(){var e,t,r,n,i,o,s,a=!1;if(nu){var l=nu,c=l.observed,u=l.persistentFocus,d=l.autoFocus,p=l.shards,h=l.crossFrame,f=l.focusOptions,m=l.noFocusGuards,g=c||su&&su.portaledElement;if(ru()&&iu&&iu!==document.body&&(!document.body.contains(iu)||!pu([(s=iu).parentNode]).some(function(e){return e.node===s}))){var _=ou();_&&_.focus()}var y=document&&document.activeElement;if(g){var v=[g].concat(p.map(tu).filter(Boolean));if(y&&!function(e){return(nu.whiteList||cu)(e)}(y)||(u||function(){if(!(h?Boolean(au):"meanwhile"===au)||!m||!iu||lu)return!1;var e=pu(v),t=e.findIndex(function(e){return e.node===iu});return 0===t||t===e.length-1}()||!(ru()||function(e){void 0===e&&(e=document);var t=Oc(e);return!!t&&ac(e.querySelectorAll("[".concat("data-no-focus-lock","]"))).some(function(e){return Nc(e,t)})}())||!iu&&d)&&(g&&!(Fc(v)||y&&function(e,t){return t.some(function(t){return du(e,t,t)})}(y,v)||(o=y,su&&su.portaledElement===o))&&(document&&!iu&&y&&!d?(y.blur&&y.blur(),document.body.focus()):(a=Kc(v,iu,{focusOptions:f}),su={})),(iu=document&&document.activeElement)!==document.body&&(ou=Jc(iu)),au=!1),document&&y!==document.activeElement&&document.querySelector("[data-focus-auto-guard]")){var b=document&&document.activeElement,x=(t=Ic(e=v).filter(vc),r=Hc(e,e,t),n=wc(Cc([r],!0),!0,!0),i=Cc(t,!1),n.map(function(e){var t=e.node;return{node:t,index:e.index,lockItem:i.indexOf(t)>=0,guard:yc(t)}})),w=x.map(function(e){return e.node}).indexOf(b);w>-1&&(x.filter(function(e){var t=e.guard,r=e.node;return t&&r.dataset.focusAutoGuard}).forEach(function(e){return e.node.removeAttribute("tabIndex")}),uu(w,x.length,1,x),uu(w,-1,-1,x))}}}return a},fu=function(e){hu()&&e&&(e.stopPropagation(),e.preventDefault())},mu=function(){return eu(hu)},gu=function(){lu=!0},_u=function(){lu=!1,au="just",eu(function(){au="meanwhile"})},yu={moveFocusInside:Kc,focusInside:Fc,focusNextElement:function(e,t){void 0===t&&(t={}),Yc(e,t,function(e,t){var r=e.next,n=e.first;return r||t&&n})},focusPrevElement:function(e,t){void 0===t&&(t={}),Yc(e,t,function(e,t){var r=e.prev,n=e.last;return r||t&&n})},focusFirstElement:function(e,t){void 0===t&&(t={}),Xc(e,t,"first")},focusLastElement:function(e,t){void 0===t&&(t={}),Xc(e,t,"last")},captureFocusRestore:Jc};Yl.assignSyncMedium(function(e){var t=e.target,r=e.currentTarget;r.contains(t)||(su={observerNode:r,portaledElement:t})}),Xl.assignMedium(mu),ec.assignMedium(function(e){return e(yu)});const vu=(bu=function(e){return e.filter(function(e){return!e.disabled})},xu=function(e){var t=e.slice(-1)[0];t&&!nu&&(document.addEventListener("focusin",fu),document.addEventListener("focusout",mu),window.addEventListener("focus",gu),window.addEventListener("blur",_u));var r=nu,n=r&&t&&t.id===r.id;nu=t,r&&!n&&(r.onDeactivation(),e.filter(function(e){return e.id===r.id}).length||r.returnFocus(!t)),t?(iu=null,n&&r.observed===t.observed||t.onActivation(yu),hu(),eu(hu)):(document.removeEventListener("focusin",fu),document.removeEventListener("focusout",mu),window.removeEventListener("focus",gu),window.removeEventListener("blur",_u),iu=null)},function(e){var t,r=[];function n(){t=bu(r.map(function(e){return e.props})),xu(t)}var i=function(i){function o(){return i.apply(this,arguments)||this}!function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,sc(e,t)}(o,i),o.peek=function(){return t};var s=o.prototype;return s.componentDidMount=function(){r.push(this),n()},s.componentDidUpdate=function(){n()},s.componentWillUnmount=function(){var e=r.indexOf(this);r.splice(e,1),n()},s.render=function(){return c()().createElement(e,this.props)},o}(o().PureComponent);return Ga(i,"displayName","SideEffect("+function(e){return e.displayName||e.name||"Component"}(e)+")"),i})(function(){return null});var bu,xu,wu=(0,o().forwardRef)(function(e,t){return c()().createElement(oc,g({sideCar:vu,ref:t},e))}),ju=oc.propTypes||{};ju.sideCar,_(ju,["sideCar"]),wu.propTypes={};const Su=wu;function ku(e){if(null===e)return null;const{left:t,top:r,height:n}=e;return{left:t,top:r+n}}function Cu(e,t){return t?{...e,width:t.getBoundingClientRect().width}:e}function Tu({style:e,align:t}){const r=m("wpl-popover__arrows",{"wpl-popover__arrows__left":"left"===t,"wpl-popover__arrows__right":"right"===t,"wpl-popover__arrows__centre":"centre"===t});return(0,u.jsx)("div",{className:r,style:e})}const Eu=function(e){const{position:t,children:r,popoverPosition:n,align:i,valign:s,hasArrow:a}=e,[l,c]=(0,o().useState)({arrow:{},content:{visibility:"hidden",...t}}),d=(0,o().useCallback)(e=>{if(e){const r=function(e,t,r,n,i,o){if(null===e||null===t)return{};if(!i)return{...e,visibility:"hidden"};const s=e.width?e.width:i.getBoundingClientRect().width,a=t.parentWidth-s-20,l=function(e,t,r,n){return"right"===n?e+t-r:"centre"===n?e-r/2:e}(t.left,t.width,e.width?e.width:s,r);return{...e,left:Math.min(a,l),top:o?e.top+5:e.top}}(t,n,i,0,e,!!a);c({content:r,arrow:Cu(r,e)})}},[t,n,i,s,a]);return(0,u.jsxs)(u.Fragment,{children:[a&&(0,u.jsx)(Tu,{style:l.arrow,align:i}),(0,u.jsx)("div",{className:"wpl-popover__content",style:{...l.content,visibility:t&&t.left?"visible":"hidden",...null!==e.style?e.style:{}},ref:d,children:r})]})};function Ru(e,t){if(!t)return!1;const r=e.target;return!(r&&t.contains(r)||"keydown"===e.type||r&&(r.closest(".wpl-dropdowntext__suggestions")||r.closest(".wpl-multioption")))}function Pu(e){const t=(0,o().useRef)(null),{children:r,onOutside:n,className:i}=e,s=(0,o().useCallback)(e=>{(Ru(e,t.current)||"key"in e&&"Escape"===e.key)&&n(e)},[n]);return(0,o().useEffect)(()=>(addEventListener("mousedown",s),addEventListener("keydown",s),()=>{removeEventListener("mousedown",s),removeEventListener("keydown",s)}),[s]),(0,u.jsx)("div",{className:i,ref:t,children:r})}function Nu(e){let t=document.getElementById(e);if(null===t){const r=document.getElementById("wpbody");t=document.createElement("div"),r&&r.parentNode&&(t.setAttribute("id",e),r.parentNode.appendChild(t))}return t}function Ou(e,t="bottom"){const r=document.getElementById("wpwrap");if(null===e||null===r)return null;const n=r.getBoundingClientRect(),{height:i,width:o,left:s,top:a}=e.getBoundingClientRect();return{left:"bottom"===t?s-n.left:s+o/2-n.left-7,top:a-n.top+1,width:o,height:i,parentWidth:n.width,parentHeight:n.height,ref:e}}const Au=function(e){const{children:t,className:r,align:n="left",valign:i="bottom",onClose:a,hasArrow:l=!1,popoverPosition:c,style:d=null,focusLock:p=!0}=e;return(0,o().useEffect)(()=>(window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a)}),[a]),(0,s.createPortal)((0,u.jsx)(Pu,{className:m("wpl-popover",r),onOutside:e=>{c&&!1===Ru(e,c.ref)&&"Escape"!==e.key||a()},children:(0,u.jsx)(Su,{returnFocus:!0,disabled:!p,children:(0,u.jsx)(Eu,{position:ku(c),popoverPosition:c,align:n,hasArrow:l,valign:i,style:d,children:t})})}),Nu("wpl-dropdown-portal")||document.body)},Iu=function(e){const{renderContent:t,className:r,renderToggle:n,align:i="left",valign:s="bottom",hasArrow:a=!1,matchMinimum:l=!1,disabled:c=!1,onClose:d}=e,[p,h]=(0,o().useState)(!1),[f,g]=(0,o().useState)(null),_=(0,o().useRef)(null);return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("div",{className:m("wpl-popover__toggle",r,c&&"wpl-popover__toggle__disabled"),ref:_,children:n(p,e=>{if(!_.current)return;const t=Ou(_.current,s);e?.stopPropagation(),c||(g(t),h(!p))})}),p&&f&&(0,u.jsx)(Au,{align:i,valign:s,hasArrow:a,...void 0!==r?{className:r}:{},onClose:function(){h(!1),d?.()},popoverPosition:f,...l&&f.width?{style:{minWidth:`${f.width}px`}}:{},children:t(()=>h(!1))})]})};function Fu({option:e,onChange:t,isSelected:r,optionsType:n="checkbox",name:i}){const{value:o,disabled:s=!1,label:a}=e,l="radio"===n?`multi_${o}`:`multi_${i}_${o}`;return(0,u.jsxs)("p",{children:[(0,u.jsx)("input",{id:l,type:n,name:i||o,value:o,onChange:e=>t(i,o,"checkbox"!==n||e.target.checked),checked:r(i,o),disabled:s,tabIndex:0}),(0,u.jsx)("label",{"aria-label":e.label,htmlFor:l,children:a})]})}const Lu=function(e){const{option:t,optionsType:r,onChange:n,isSelected:i}=e,{options:o=[],label:s,value:a}=t;return(0,u.jsxs)("div",{className:"wpl-multioption__group",children:[(0,u.jsx)("h5",{children:s}),o.map((e,t)=>(0,u.jsx)(Fu,{option:e,isSelected:i,onChange:n,name:a||e.value,optionsType:r},t))]})},Du=function(e){const{option:t,isSelected:r,onChange:n}=e;if(t.options){const{optionsType:e="checkbox"}=t;return(0,u.jsx)(Lu,{option:t,optionsType:e,isSelected:r,onChange:n})}const i=t.value||"";return(0,u.jsx)(Fu,{option:{label:t.label,value:i,disabled:t.disabled??!1,default:t.default??!1},isSelected:r,onChange:n,optionsType:"checkbox",name:i})},zu=e=>{const{children:t,className:r,onClick:n,title:i="",onCancel:o,disabled:s=!1,small:a=!1}=e,l={title:i,onClick:n};return(0,u.jsxs)("div",{className:m("wpl-badge",r,{"wpl-badge__click":n,"wpl-badge__small":a,"wpl-badge__disabled":s}),...l,children:[(0,u.jsx)("div",{className:"wpl-badge__content",children:t}),o&&(0,u.jsx)("div",{className:"wpl-badge__close dashicons dashicons-no-alt",onClick:e=>{e.preventDefault(),!s&&o&&o(e)},onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),!s&&o&&o(e))},role:"button",tabIndex:0})]})};function Mu(e,t){for(let r=0;r<e.length;r++){const n=e[r];if(n){if(n.value===t)return n;if(n.options){const e=Mu(n.options,t);if(e)return e}}}return null}function $u(e,t){return e&&t?{title:e.badge||e.label,default:e.default??!1,onRemove:r=>{if(e.value===t.value)return r(e.value||"",e.value||"",!1);const n=(t.options||[]).find(e=>e.default);n?r(t.value||"",n.value,!0):r(t.value||"",e.value||"",!1)}}:null}function Uu(e){const t=Mu(e,""),r=$u(t,t);return r?[r]:[]}function Bu({selected:e,title:t,options:r,showBadges:n,onChange:i,disabled:o}){let s;if(s=function(e){return Array.isArray(e)?-1!==e.indexOf(""):Boolean(e?.[""])}(e)&&r.length>0?Uu(r):Array.isArray(e)?function(e,t){return-1!==e.indexOf("")?Uu(t):e.map(e=>{const r=Mu(t,e);return $u(r,r)}).filter(e=>null!==e)}(e,r):function(e,t){return Object.keys(e).map(r=>{const n=Mu(t,r);return"string"==typeof e[r]?$u(Mu(t,e[r]),n):e[r]?$u(n,n):null}).filter(e=>null!==e).filter(e=>e&&!0!==e.default)}(e,r),s.length>0&&n){const e=s.slice(0,3).map((e,t)=>e?(0,u.jsx)(zu,{small:!0,onCancel:t=>function(e,t){e.preventDefault(),e.stopPropagation(),t.onRemove(i)}(t,e),disabled:o,children:e.title},t):null);return s.length>3?e.concat([(0,u.jsx)("span",{children:"..."},"end")]):e}return t.length>0&&(!n||0===s.length)?(0,u.jsx)("h5",{children:t}):null}const qu=function({onClick:e}){return(0,u.jsx)("svg",{height:"20",width:"20",viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",onClick:e,children:(0,u.jsx)("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"})})},Hu=function(e){const{options:t,selected:r,onChange:n,title:i="",badges:o=!1,compact:s=!1,disabled:a=!1,className:l,asObject:c=!1}=e,d=m(l,s&&"wpl-multioption__compact");function p(e,t){if(c){const n=r;return e===t?Boolean(n[t]):n[e]===t}return-1!==r.indexOf(t)}function h(e,t,i){if(c)n({...r,[e]:e===t?i:t});else{const o=r,s=e===t?e:t;n(i?[...o,s]:o.filter(e=>e!==s))}}return(0,u.jsx)(Iu,{className:d,renderToggle:(e,n)=>(0,u.jsxs)("div",{className:m("action","wpl-multioption__button",a&&"wpl-multioption__disabled",e?"wpl-multioption__button_enabled":null),onClick:n,tabIndex:0,"aria-label":i||"",children:[(0,u.jsx)(Bu,{selected:r,title:i,showBadges:o,options:t,disabled:a,onChange:h}),(0,u.jsx)(qu,{})]}),disabled:a,align:"right",matchMinimum:!0,renderContent:()=>(0,u.jsx)("div",{className:m("wpl-multioption",d),children:t.map((e,t)=>(0,u.jsx)(Du,{option:e,isSelected:p,onChange:h},t))})})},Wu=function({level:e="notice",children:t,className:r}){return(0,u.jsx)("div",{className:m(`inline-notice inline-${e}`,r),children:t})},Gu=()=>[{value:-1,label:(0,a.__)("No logs","redirection")},{value:1,label:(0,a.__)("A day","redirection")},{value:7,label:(0,a.__)("A week","redirection")},{value:30,label:(0,a.__)("A month","redirection")},{value:60,label:(0,a.__)("Two months","redirection")},{value:0,label:(0,a.__)("Forever","redirection")}],Vu=function(e){const{settings:t,onChange:r,getLink:n}=e,{expire_redirect:i,expire_404:o,ip_logging:s,log_external:l,track_hits:c,log_header:d,ip_proxy:p=[],ip_headers:h=[]}=t;return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("tr",{className:"redirect-option__row",children:(0,u.jsx)("th",{colSpan:2,children:(0,u.jsx)("h2",{className:"title",children:(0,a.__)("Logs","redirection")})})}),(0,u.jsxs)(yn,{title:(0,a.__)("Redirect Logs","redirection")+":",url:n("logs"),children:[(0,u.jsx)(wn,{items:Gu(),name:"expire_redirect",value:String(i),onChange:r})," ",(0,a.__)("(time to keep logs for)","redirection")]}),(0,u.jsxs)(yn,{title:(0,a.__)("404 Logs","redirection")+":",url:n("tracking-404-errors"),children:[(0,u.jsx)(wn,{items:Gu(),name:"expire_404",value:String(o),onChange:r})," ",(0,a.__)("(time to keep logs for)","redirection")]}),(0,u.jsxs)(yn,{title:(0,a.__)("IP Logging","redirection")+":",url:n("options","iplogging"),children:[(0,u.jsx)(wn,{items:[{value:0,label:(0,a.__)("No IP logging","redirection")},{value:1,label:(0,a.__)("Full IP logging","redirection")},{value:2,label:(0,a.__)("Anonymize IP (mask last part)","redirection")}],name:"ip_logging",value:String(s),onChange:r})," ",(0,a.__)("(IP logging level)","redirection")]}),(0,u.jsxs)(yn,{title:(0,a.__)("IP Address","redirection")+":",url:n("options","ipaddress"),children:[(0,u.jsx)(Hu,{options:[{value:"HTTP_CF_CONNECTING_IP",label:"HTTP_CF_CONNECTING_IP"},{value:"HTTP_CLIENT_IP",label:"HTTP_CLIENT_IP"},{value:"HTTP_X_FORWARDED_FOR",label:"HTTP_X_FORWARDED_FOR"},{value:"HTTP_X_FORWARDED",label:"HTTP_X_FORWARDED"},{value:"HTTP_X_CLUSTER_CLIENT_IP",label:"HTTP_X_CLUSTER_CLIENT_IP"},{value:"HTTP_FORWARDED_FOR",label:"HTTP_FORWARDED_FOR"},{value:"HTTP_FORWARDED",label:"HTTP_FORWARDED"},{value:"HTTP_VIA",label:"HTTP_VIA"}],selected:h,multiple:!0,badges:h.length>0,hideTitle:h.length>0,onChange:e=>r({ip_headers:e}),title:0===h.length?(0,a.__)("REMOTE_ADDR","redirection"):""}),(0,u.jsx)("p",{children:M((0,a.__)("Only set custom IP headers if your server does not use <code>REMOTE_ADDR</code> to store the client IP address.","redirection"),{code:(0,u.jsx)("code",{})})}),h.length>0&&(0,u.jsx)(Wu,{level:"warning",children:(0,u.jsx)("p",{children:M((0,a.__)("Please ensure you trust the data in these headers. If using a proxy then set its address below.","redirection"),{code:(0,u.jsx)("code",{})})})})]}),h.length>0&&(0,u.jsxs)(yn,{title:(0,a.__)("Proxy Address","redirection")+":",url:n("options","proxy"),children:[(0,u.jsx)(P,{minRows:3,value:p.join("\n"),onChange:e=>r({ip_proxy:e.target.value.split("\n")}),rows:5}),(0,u.jsx)("p",{children:(0,a.__)("If using a proxy then add any IP addresses here to only trust IP headers from those addresses.","redirection")})]}),(0,u.jsxs)(yn,{title:(0,a.__)("Logging","redirection")+":",url:n("options","iplogging"),children:[(0,u.jsxs)("p",{children:[(0,u.jsx)("input",{id:"log-options-log-external",type:"checkbox",disabled:-1===parseInt(i.toString(),10),name:"log_external",onChange:r,checked:-1!==parseInt(i.toString(),10)&&l}),(0,u.jsx)("label",{htmlFor:"log-options-log-external",children:(0,a.__)('Log "external" redirects - those not from Redirection. This can increase your log size and contains no user information.',"redirection")})]}),(0,u.jsxs)("p",{children:[(0,u.jsx)("input",{id:"log-options-track-hits",type:"checkbox",name:"track_hits",onChange:r,checked:c}),(0,u.jsx)("label",{htmlFor:"log-options-track-hits",children:(0,a.__)("Track redirect hits and date of last access. Contains no user information.","redirection")})]}),(0,u.jsxs)("p",{children:[(0,u.jsx)("input",{id:"log-options-log-header",type:"checkbox",name:"log_header",onChange:r,checked:d}),(0,u.jsx)("label",{htmlFor:"log-options-log-header",children:(0,a.__)("Capture HTTP header information with logs (except cookies). It may include user information, and could increase your log size.","redirection")})]})]}),(0,u.jsxs)("tr",{children:[(0,u.jsx)("th",{}),(0,u.jsx)("td",{children:M((0,a.__)("Redirection stores no user identifiable information other than what is configured above. It is your responsibility to ensure your site meets any applicable {{link}}privacy requirements{{/link}}.","redirection"),{link:(0,u.jsx)(A,{url:n("privacy-gdpr")})})})]})]})};function Zu(e,t,r){const n=[];for(const i in e){const o=e[i],s=!!t.find(e=>e===i);o&&n.push((0,u.jsxs)("p",{children:[(0,u.jsx)("input",{id:"monitor-type-"+i,type:"checkbox",name:"monitor_type_"+i,onChange:r,checked:s}),(0,u.jsx)("label",{htmlFor:"monitor-type-"+i,children:(0,a.sprintf)(
// translators: %(type)s is the post type name (e.g. post, page)
// translators: %(type)s is the post type name (e.g. post, page)
(0,a.__)("Monitor changes to %(type)s","redirection"),{type:o.toLowerCase()})})]},i))}return n}function Ku(e,t){return 0===parseInt(e.toString(),10)&&t.length>0?t.length>0&&t[0]?Array.isArray(t[0].value)?t[0].value[0]?.value||0:t[0].value:0:e}const Qu=function(e){const{onChange:t,settings:r,groups:n,getLink:i,postTypes:o}=e,{associated_redirect:s,monitor_post:l,monitor_types:c}=r,d=c.length>0;return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(yn,{title:(0,a.__)("URL Monitor","redirection")+":",url:i("options","monitor"),children:Zu(o,c,function(e){const r=e.target.name.replace("monitor_type_",""),i=c.filter(e=>e!==r);e.target.checked&&i.push(r),t({monitor_types:i,monitor_post:i.length>0?Ku(l,n):0,associated_redirect:i.length>0?s:""})})}),d&&(0,u.jsxs)(yn,{title:(0,a.__)("URL Monitor Changes","redirection")+":",url:i("options","monitor"),children:[(0,u.jsx)(wn,{items:n,name:"monitor_post",value:String(l),onChange:t})," ",(0,a.__)("Save changes to this group","redirection"),(0,u.jsxs)("p",{children:[(0,u.jsx)("input",{type:"text",className:"regular-text",name:"associated_redirect",onChange:t,placeholder:(0,a.__)('For example "/amp"',"redirection"),value:s})," ",(0,a.__)("Create associated redirect (added to end of URL)","redirection")]})]})]})},Ju=function(e){const{settings:t,onChange:r,getLink:n,groups:i,postTypes:o}=e,{flag_case:s,flag_trailing:l,flag_query:c,auto_target:d,redirect_cache:p,cache_key:h}=t;return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("tr",{className:"redirect-option__row",children:(0,u.jsx)("th",{colSpan:2,children:(0,u.jsx)("h2",{className:"title",children:(0,a.__)("URL","redirection")})})}),(0,u.jsx)(Qu,{settings:t,onChange:r,groups:i,getLink:n,postTypes:o}),(0,u.jsxs)(yn,{title:(0,a.__)("Default URL settings","redirection")+":",url:n("options","urlsettings"),children:[(0,u.jsx)("p",{children:(0,a.__)("Applies to all redirections unless you configure them otherwise.","redirection")}),(0,u.jsxs)("p",{children:[(0,u.jsx)("input",{type:"checkbox",id:"url-options-flag-case",name:"flag_case",onChange:r,checked:s}),(0,u.jsx)("label",{htmlFor:"url-options-flag-case",children:M((0,a.__)("Case insensitive matches (i.e. {{code}}/Exciting-Post{{/code}} will match {{code}}/exciting-post{{/code}})","redirection"),{code:(0,u.jsx)("code",{})})})]}),(0,u.jsxs)("p",{children:[(0,u.jsx)("input",{type:"checkbox",id:"url-options-flag-trailing",name:"flag_trailing",onChange:r,checked:l}),(0,u.jsx)("label",{htmlFor:"url-options-flag-trailing",children:M((0,a.__)("Ignore trailing slashes (i.e. {{code}}/exciting-post/{{/code}} will match {{code}}/exciting-post{{/code}})","redirection"),{code:(0,u.jsx)("code",{})})})]})]}),(0,u.jsxs)(yn,{title:(0,a.__)("Default query matching","redirection")+":",url:n("options","querysettings"),children:[(0,u.jsx)("p",{children:(0,a.__)("Applies to all redirections unless you configure them otherwise.","redirection")}),(0,u.jsx)("p",{children:(0,u.jsx)(wn,{items:[{value:"exact",label:(0,a.__)("Exact match in any order","redirection")},{value:"ignore",label:(0,a.__)("Ignore all query parameters","redirection")},{value:"pass",label:(0,a.__)("Ignore and pass all query parameters","redirection")}],name:"flag_query",value:c,onChange:r})}),(0,u.jsxs)("ul",{children:[(0,u.jsx)("li",{children:(0,a.__)("Exact - matches the query parameters exactly defined in your source, in any order","redirection")}),(0,u.jsx)("li",{children:(0,a.__)("Ignore - as exact, but ignores any query parameters not in your source","redirection")}),(0,u.jsx)("li",{children:(0,a.__)("Pass - as ignore, but also copies the query parameters to the target","redirection")})]})]}),(0,u.jsxs)(yn,{title:(0,a.__)("Auto-generate URL","redirection")+":",url:n("options","autogenerate"),children:[(0,u.jsx)("input",{className:"regular-text",type:"text",value:d,name:"auto_target",onChange:r}),(0,u.jsx)("br",{}),(0,u.jsx)("span",{className:"sub",children:M((0,a.__)("Used to auto-generate a URL if no URL is given. Use the special tags {{code}}$dec${{/code}} or {{code}}$hex${{/code}} to insert a unique ID instead","redirection"),{code:(0,u.jsx)("code",{})})})]}),(0,u.jsxs)(yn,{title:(0,a.__)("HTTP Cache Header","redirection"),url:n("options","cache"),children:[(0,u.jsx)(wn,{items:[{value:-1,label:(0,a.__)("Never cache","redirection")},{value:1,label:(0,a.__)("An hour","redirection")},{value:24,label:(0,a.__)("A day","redirection")},{value:168,label:(0,a.__)("A week","redirection")},{value:0,label:(0,a.__)("Forever","redirection")}],name:"redirect_cache",value:String(p),onChange:r})," "," ",(0,u.jsx)("span",{className:"sub",children:(0,a.__)('How long to cache redirected 301 URLs (via "Expires" HTTP header)',"redirection")})]}),(0,u.jsxs)(yn,{title:(0,a.__)("Redirect Caching","redirection"),url:n("options","cache"),children:[(0,u.jsx)("input",{id:"url-options-cache-key",type:"checkbox",name:"cache_key",onChange:r,checked:0!==h&&!1!==h})," ",(0,u.jsx)("label",{htmlFor:"url-options-cache-key",children:(0,u.jsx)("span",{className:"sub",children:(0,a.__)("(beta) Enable caching of redirects via WordPress object cache. Can improve performance. Requires an object cache.","redirection")})})]})]})},Yu=sa({source:sa({flag_regex:Xs(),flag_trailing:Xs(),flag_case:Xs(),flag_query:Ts()}).optional(),options:da(Ts(),ta()).optional()}),Xu=sa({id:Ks().int(),url:Ts(),match_url:Ts().optional(),match_type:Ts(),action_type:Ts(),action_code:Ks().int(),action_data:ta(),match_data:Yu.nullish(),group_id:Ks().int(),title:Ts(),position:Ks().int().nonnegative(),regex:Xs().optional(),last_access:Ts().optional(),enabled:Xs().optional(),hits:Ks().int().nonnegative().optional()}),ed=(sa({url:Ts().min(1,"Source URL is required"),title:Ts().optional(),match_type:Ts(),action_type:Ts(),action_code:Ks().int().min(100).max(599).optional(),action_data:ta().optional(),match_data:Yu.optional(),group_id:Ks().int().positive(),position:Ks().int().nonnegative().default(0),enabled:Xs().optional()}).partial().extend({id:Ks().int()}),sa({items:ia(Ks().int()),action:ha(["delete","enable","disable","reset"])}),sa({id:Ks().int(),name:Ts(),redirects:Ks().int().nonnegative(),module_id:Ks().int(),moduleName:Ts().optional(),enabled:Xs()})),td=(sa({name:Ts().min(1,"Group name is required"),moduleId:Ks().int().positive(),position:Ks().int().nonnegative().default(0),enabled:Xs().optional()}).partial().extend({id:Ks().int()}),sa({page:Ks().int().nonnegative(),per_page:Ks().int().positive().max(100),orderby:Ts(),direction:ha(["asc","desc"]),selected:ia(la([Ks(),Ts()])),selectAll:Xs().optional(),displayType:Ts().optional(),displaySelected:ia(Ts()).optional(),filterBy:da(Ts(),Ts()).optional(),groupBy:Ts().optional()})),rd=e=>sa({items:ia(e),total:Ks().int().nonnegative(),table:td.optional()}),nd=(sa({item:ta(),items:ia(ta()).optional(),total:Ks().int().nonnegative().optional()}),sa({code:la([Ts(),Ks()]).optional(),message:Ts().optional(),data:ta().optional(),jsonData:ta().optional(),request:sa({url:Ts(),method:Ts()}).optional()}),rd(Xu)),id=sa({item:Xu}),od=rd(ed),sd=sa({item:ed});function ad(e){return{...!0===e?.global?{page:0}:{},selected:[],selectAll:!1}}function ld(e,t){return"ip"===e?{ip:t}:"agent"===e?{agent:t}:{"url-exact":t}}sa({deleted:Ks().int().nonnegative().optional(),updated:Ks().int().nonnegative().optional(),items:ia(ta()).optional(),total:Ks().int().nonnegative().optional()});const cd=["selected","selectAll","displayType","displaySelected"];function ud(e){const t={};for(const r in e){const n=e[r];cd.includes(r)||null!=n&&("object"!=typeof n||Array.isArray(n)||0!==Object.keys(n).length)&&(Array.isArray(n)&&0===n.length||"string"==typeof n&&""===n.trim()||(t[r]=n))}return t}function dd(e){return dt({queryKey:Xr.groups.dropdown(),refetchOnMount:"always",refetchOnReconnect:!0,placeholderData:e=>e,queryFn:async()=>{try{const e=await jt(Ft());return od.parse(e)}catch(e){const t=Yr(e);throw tn.getState().addError(t.message||"Failed to fetch groups"),t}},...e})}function pd(e){return window.Redirectioni10n.pluginRoot+"&sub=rss&module=1&token="+encodeURIComponent(e)}function hd(e,t){return e.replace(/\/$/,"")+"/"+t.replace(/^\//,"")}function fd(e){return e?/^https?:\/\//i.test(e)?e:"https://"+e:document.location.origin}function md(e){const t={};for(const r of e)r&&(t[r.moduleName]||(t[r.moduleName]=[]),t[r.moduleName].push({value:r.id,label:r.name}));return Object.keys(t).map(e=>({label:e,value:t[e]}))}function gd(e,t){return"https://redirection.me/support/"+e+(t?"/#"+t:"")}const _d={},yd={},vd=function(){const e=he(e=>e.values),t=he(e=>e.saveStatus),r=he(e=>e.values?.installed??""),n=he(e=>e.values?.warning??""),i=he(e=>e.values?.postTypes),{data:s}=dd(),l=s?.items?md(s.items):[],{mutate:c}=Na(),[d,p]=(0,o().useState)(e??yd),h=i??_d;function f(e){if("target"in e){const{target:t}=e,r="checkbox"===t.type?t.checked:t.value;p({...d,[t.name]:r})}else p({...d,...e})}return(0,o().useEffect)(()=>{e&&p(e)},[e]),(0,u.jsxs)("form",{onSubmit:function(e){e.preventDefault(),c(d)},children:[(0,u.jsxs)(vn,{children:[(0,u.jsx)(Vu,{settings:d,onChange:f,getLink:gd}),(0,u.jsx)(Ju,{settings:d,onChange:f,getLink:gd,groups:l,postTypes:h}),(0,u.jsx)(Sn,{settings:d,onChange:f,getLink:gd,installed:r,warning:n})]}),(0,u.jsx)(Ul,{isPrimary:!0,isSubmit:!0,disabled:t,children:(0,a.__)("Update","redirection")})]})},bd=function({onClose:e,children:t,className:r}){return(0,u.jsx)(Pu,{className:"wpl-click-outside",onOutside:t=>{t.target instanceof HTMLElement&&t.target.classList.contains("wpl-modal_main")&&e()},children:(0,u.jsxs)("div",{className:m("wpl-modal_content",r),children:[(0,u.jsx)("div",{className:"wpl-modal_close",children:(0,u.jsx)("button",{type:"button",onClick:e,children:"✖"})}),t]})})},xd="wpl-modal_shown",wd=function({padding:e=!0,onClose:t,...r}){const n=(0,o().useCallback)(e=>{"Escape"===e.key&&t()},[t]);(0,o().useEffect)(()=>(document.body.classList.add(xd),document.addEventListener("keydown",n),()=>{document.body.classList.remove(xd),document.removeEventListener("keydown",n)}),[n]);const i=m({"wpl-modal_wrapper":!0,"wpl-modal_wrapper-padding":e});return(0,u.jsxs)("div",{className:i,children:[(0,u.jsx)("div",{className:"wpl-modal_backdrop"}),(0,u.jsx)("div",{className:"wpl-modal_main",children:(0,u.jsx)(bd,{onClose:t,...r})})]})},jd=e=>(0,s.createPortal)((0,u.jsx)(wd,{...e}),Nu("wpl-modal")||document.body),Sd=function(e){const[t,r]=(0,o().useState)(!1);function n(){r(!1)}return(0,u.jsxs)("div",{className:"wrap",children:[(0,u.jsxs)("form",{action:"",method:"post",onSubmit:function(e){r(!0),e.preventDefault()},children:[(0,u.jsx)("h2",{children:(0,a.__)("Delete Redirection","redirection")}),(0,u.jsx)("p",{children:(0,a.__)("Selecting this option will delete all redirections, all logs, and any options associated with the Redirection plugin. Make sure this is what you want to do.","redirection")}),(0,u.jsx)("input",{className:"button-secondary button-delete",type:"submit",name:"delete",value:(0,a.__)("Delete","redirection")})]}),t&&(0,u.jsx)(jd,{onClose:n,children:(0,u.jsxs)("div",{style:{padding:"15px 10px 5px 15px"},children:[(0,u.jsx)("h1",{children:(0,a.__)("Delete the plugin - are you sure?","redirection")}),(0,u.jsx)("p",{children:(0,a.__)("Deleting the plugin will remove all your redirections, logs, and settings. Do this if you want to remove the plugin for good, or if you want to reset the plugin.","redirection")}),(0,u.jsx)("p",{children:(0,a.__)("Once deleted your redirections will stop working. If they appear to continue working then please clear your browser cache.","redirection")}),(0,u.jsxs)("p",{children:[(0,u.jsx)("button",{className:"button-primary button-delete",onClick:function(){e.onDelete(),n()},children:(0,a.__)("Yes! Delete the plugin","redirection")})," ",(0,u.jsx)("button",{className:"button-secondary",onClick:n,children:(0,a.__)("No! Don't delete the plugin")})]})]})})]})},kd=function(){const e=he(e=>e.loadStatus),t=he(e=>e.values);Pa();const r=function(){const{incrementProgress:e,decrementProgress:t,addNotice:r,addError:n}=tn();return ft({mutationFn:async()=>{e();try{return await jt(er())}catch(e){throw t(),Yr(e)}},onSuccess:()=>{t(),r("Plugin deleted"),window.location.href="/wp-admin/plugins.php"},onError:e=>{n(e.message||"Failed to delete plugin")}})}(),n="success"===e;return"loading"!==e&&t?(0,u.jsxs)("div",{children:["success"===e&&(0,u.jsx)(vd,{}),(0,u.jsx)("hr",{}),n&&(0,u.jsx)(Sd,{onDelete:()=>{r.mutate()}})]}):(0,u.jsx)($l,{})},Cd=()=>(0,u.jsxs)("div",{children:[(0,u.jsx)("h2",{children:(0,a.__)("Need help?","redirection")}),(0,u.jsx)("p",{children:M((0,a.__)("Full documentation for Redirection can be found at {{site}}https://redirection.me{{/site}}. If you have a problem please check the {{faq}}FAQ{{/faq}} first.","redirection"),{site:(0,u.jsx)(A,{url:"https://redirection.me"}),faq:(0,u.jsx)(A,{url:"https://redirection.me/support/faq/"})})}),(0,u.jsx)("p",{children:(0,u.jsx)("strong",{children:M((0,a.__)("If you want to report a bug please read the {{report}}Reporting Bugs{{/report}} guide.","redirection"),{report:(0,u.jsx)(A,{url:"https://redirection.me/support/reporting-bugs/"})})})}),(0,u.jsx)("div",{className:"inline-notice inline-general",children:(0,u.jsxs)("p",{className:"github",children:[(0,u.jsx)(A,{url:"https://github.com/johngodley/redirection/issues",children:(0,u.jsx)("img",{src:window.Redirectioni10n.pluginBaseUrl+"/images/GitHub-Mark-64px.png",width:"32",height:"32",alt:"GitHub"})}),(0,u.jsx)(A,{url:"https://github.com/johngodley/redirection/issues",children:"https://github.com/johngodley/redirection/"})]})}),(0,u.jsx)("p",{children:(0,a.__)("Please note that any support is provide on as-time-is-available basis and is not guaranteed. I do not provide paid support.","redirection")}),(0,u.jsx)("p",{children:M((0,a.__)("If you want to submit information that you don't want in a public repository then send it directly via {{email}}email{{/email}} - include as much information as you can!","redirection"),{email:(0,u.jsx)("button",{type:"button",className:"button-link",onClick:()=>{window.location.href="mailto:john@redirection.me?subject=Redirection%20Issue&body="+encodeURIComponent("Redirection: "+window.Redirectioni10n.versions)}})})}),(0,u.jsx)("h2",{children:(0,a.__)("Need to search and replace?","redirection")}),(0,u.jsx)("p",{children:M((0,a.__)("The companion plugin <link>Search Regex</link> allows you to search and replace data on your site and is handy if you want to bulk update a lot of URLs in your posts and pages.","redirection"),{link:(0,u.jsx)(A,{url:"https://searchregex.com/"})})})]});function Td(e,t){return"http"===e.slice(0,4)?e:hd(t||document.location.origin,e)}function Ed(e){return"object"==typeof e&&void 0!==e.url_from?e.url_from:e}function Rd({status:e,headers:t,statusMessage:r,isMatch:n}){if(0===e)return r.length>0?(0,u.jsx)(u.Fragment,{children:r}):(0,u.jsx)(u.Fragment,{children:(0,a.__)("An unknown error","redirection")});if(e>=500)return(0,u.jsx)(u.Fragment,{children:(0,a.__)("Something is wrong with the server. This is not a problem with Redirection and you will need to resolve the error yourself.","redirection")});if(e>=400&&e<500)return(0,u.jsx)(u.Fragment,{children:M((0,a.__)("An error page was returned. This is unlikely to be a problem with Redirection. {{support}}What does this mean?{{/support}}.","redirection"),{support:(0,u.jsx)(A,{url:"https://redirection.me/support/problems/redirect-returning-404/"})})});if(e>=300&&e<400){if(n)return(0,u.jsxs)(u.Fragment,{children:[(0,a.__)("Redirected by Redirection.","redirection")," ",(0,u.jsxs)("span",{className:"redirection-httpstep__match",children:[(0,a.__)("Matches your redirect","redirection")," ",(0,u.jsx)("span",{className:"dashicons dashicons-yes"})]})]});const e=t.find(e=>"x-redirect-agent"===e.name||"x-redirect-by"===e.name)||null;return e?"redirection"===e.value.toLowerCase()?(0,u.jsx)(u.Fragment,{children:(0,a.__)("Redirected by Redirection.","redirection")}):(0,u.jsx)(u.Fragment,{children:M((0,a.sprintf)(
// translators: %1$s is the name of the agent that performed the redirect
// translators: %1$s is the name of the agent that performed the redirect
(0,a.__)("Redirected by %1$s. {{support}}What does this mean?{{/support}}.","redirection"),e.value),{support:(0,u.jsx)(A,{url:"https://redirection.me/support/problems/redirected-by-another-agent/"})})}):(0,u.jsx)(u.Fragment,{children:M((0,a.__)("Redirected by an unknown agent. {{support}}What does this mean?{{/support}}.","redirection"),{support:(0,u.jsx)(A,{url:"https://redirection.me/support/problems/redirected-by-another-agent/"})})})}return e>=200&&e<300?(0,u.jsx)(u.Fragment,{children:(0,a.__)("Page was loaded.","redirection")}):null}function Pd({step:e,isFirst:t,isLast:r,isMatch:n}){const{request:i,status:o,statusMessage:s,headers:a}=e,l=100*Math.floor(o/100);return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsxs)("div",{className:"redirection-httpstep",children:[(0,u.jsx)("div",{className:`redirection-httpstep__status redirection-httpstep__${l>0?l:"500"}`,children:parseInt(o.toString(),10)>0?(0,u.jsx)(A,{url:`https://redirect.li/http/status/code/${o}/`,title:s,children:o}):"Fail"}),(0,u.jsxs)("div",{className:"redirection-httpstep__details",children:[(0,u.jsx)("p",{children:(0,u.jsx)("code",{children:i.url})}),(0,u.jsx)("p",{children:(0,u.jsx)(Rd,{status:parseInt(o.toString(),10),statusMessage:s,headers:a,isFirst:t,isMatch:n})})]})]}),!r&&(0,u.jsx)("div",{children:(0,u.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:(0,u.jsx)("path",{fillRule:"evenodd",d:"M16.707 10.293a1 1 0 010 1.414l-6 6a1 1 0 01-1.414 0l-6-6a1 1 0 111.414-1.414L9 14.586V3a1 1 0 012 0v11.586l4.293-4.293a1 1 0 011.414 0z",clipRule:"evenodd"})})})]})}function Nd(e,t,r,n){if(!Array.isArray(e)||!r||!n)return!1;const i=e.find(e=>"x-redirect-agent"===e.name||"x-redirect-by"===e.name),o=e.find(e=>"location"===e.name);if(i&&o){if("object"==typeof r&&void 0===r.url_from)return"redirection"===i.value.toLowerCase()&&n===t&&Td(o.value)===Ed(r);if("object"==typeof r)return"redirection"===i.value.toLowerCase()&&n===t&&Td(o.value,r.server)===Ed(r)}return!1}const Od=function({desiredTarget:e,desiredCode:t,http:r,url:n}){const{steps:i}=r;return!r||"error"!==r.status&&"fail"!==r.status||0!==i.length?(0,u.jsxs)("div",{children:[i.map((r,n)=>(0,u.jsx)(Pd,{step:r,isFirst:0===n,isLast:n===i.length-1,isMatch:Nd(r.headers,r.status,e,t)},n)),(0,u.jsxs)("p",{children:[e&&t&&(0,u.jsxs)(u.Fragment,{children:[M((0,a.__)("If this is not expected then this {{support}}support page{{/support}} may help.","redirection"),{support:(0,u.jsx)(A,{url:"https://redirection.me/support/problems/url-not-redirecting/"})})," "]}),(0,a.__)("If your browser is behaving differently then you should clear your browser cache.","redirection")]}),(0,u.jsx)("p",{children:(0,u.jsx)(A,{url:`https://redirect.li/http/?url=${encodeURIComponent(n)}`,className:"button",children:(0,a.__)("View full redirect.li results.","redirection")})})]}):(0,u.jsx)("div",{children:(0,a.__)("Unable to check that URL. It may not be valid or accessible.","redirection")})};function Ad({error:e}){return(0,u.jsxs)("div",{className:"wpl-modal_error",children:[(0,u.jsx)("h2",{children:(0,a.__)("Error","redirection")}),(0,u.jsx)("p",{children:(0,a.__)("Something went wrong obtaining this information. It may work in the future.","redirection")}),(0,u.jsx)("p",{children:(0,u.jsx)("code",{children:e})})]})}function Id({url:e,desiredCode:t=0,desiredTarget:r=null}){const{data:n,isLoading:i,isError:o,error:s}=function(e,t){return dt({queryKey:Xr.info.http(e),queryFn:async()=>await jt(ur(e)),enabled:!!e,staleTime:0,...t})}(e,{enabled:!!e}),l=o&&s&&s.message||"";if(!i&&!o&&!n)return null;const c=m({"redirection-httpcheck":!0,"wpl-modal_loading":i,"redirection-httpcheck_small":o});return(0,u.jsxs)("div",{className:c,children:[i&&(0,u.jsx)(gn,{}),o&&l&&(0,u.jsx)(Ad,{error:l}),!i&&!o&&n&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("h2",{children:M((0,a.sprintf)(
// translators: %s is the URL being checked
// translators: %s is the URL being checked
(0,a.__)("Check redirect for: {{code}}%s{{/code}}","redirection"),e),{code:(0,u.jsx)("code",{})})}),(0,u.jsx)(Od,{http:n,url:e,desiredCode:t,desiredTarget:r})]})]})}const Fd=function(){const[e,t]=(0,o().useState)(""),[r,n]=(0,o().useState)(""),i=r.length>0;return(0,u.jsxs)("form",{className:"http-tester",onSubmit:function(t){t.preventDefault(),e.length>0&&n(e)},children:[(0,u.jsx)("h3",{children:(0,a.__)("Redirect Tester","redirection")}),(0,u.jsx)("p",{children:M((0,a.__)("Sometimes your browser can cache a URL, making it hard to know if it's working as expected. Use this service from {{link}}redirect.li{{/link}} to get accurate results.","redirection"),{link:(0,u.jsx)(A,{url:"https://redirect.li"})})}),(0,u.jsxs)("div",{className:"redirection-httptest__input",children:[(0,u.jsxs)("span",{children:[(0,a.__)("URL","redirection"),":"]}),(0,u.jsx)("input",{className:"regular-text",type:"text",value:e,onChange:e=>t(e.target.value),placeholder:(0,a.__)("Enter full URL, including http:// or https://","redirection")}),(0,u.jsx)("input",{type:"submit",className:"button-secondary",disabled:0===e.length,value:(0,a.__)("Check","redirection")})]}),i&&(0,u.jsx)("div",{className:"redirection-httptest",children:(0,u.jsx)(Id,{url:r})})]})},Ld=()=>(0,u.jsxs)("form",{action:Redirectioni10n.pluginRoot+"&sub=support",method:"POST",children:[(0,u.jsx)("input",{type:"hidden",name:"_wpnonce",value:jt.nonceMiddleware.nonce}),(0,u.jsx)("input",{type:"hidden",name:"action",value:"fixit"}),(0,u.jsx)("p",{children:(0,a.__)("If the magic button doesn't work then you should read the error and see if you can fix it manually, otherwise follow the 'Need help' section below.","redirection")}),(0,u.jsx)("p",{children:(0,u.jsx)("input",{type:"submit",className:"button-primary",value:(0,a.__)("⚡️ Magic fix ⚡️","redirection")})})]}),Dd=e=>{const{item:t}=e;return(0,u.jsxs)("tr",{children:[(0,u.jsx)("th",{children:t.name}),(0,u.jsxs)("td",{children:[(0,u.jsx)("span",{className:"plugin-status-"+t.status,children:"good"===t.status?(0,a.__)("Good","redirection"):(0,a.__)("Problem","redirection")})," ",t.message]})]})},zd=e=>{const{status:t}=e,r=t.filter(e=>"good"!==e.status);return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("table",{className:"plugin-status",children:(0,u.jsx)("tbody",{children:t.map((e,t)=>(0,u.jsx)(Dd,{item:e},t))})}),r.length>0&&(0,u.jsx)(Ld,{})]})},Md=function(e){const{debug:t}=e,[r,n]=(0,o().useState)(t.database.current),{mutate:i}=Ia({onSuccess:()=>{window.location.reload()}}),{ip_header:s,database:l}=t;return(0,u.jsx)("table",{className:"plugin-status",children:(0,u.jsxs)("tbody",{children:[(0,u.jsxs)("tr",{children:[(0,u.jsx)("th",{children:(0,a.__)("Database version","redirection")}),(0,u.jsxs)("td",{children:[(0,u.jsx)(wn,{items:[{value:"2.3.1",label:"2.3.1"},{value:"2.3.2",label:"2.3.2"},{value:"2.4",label:"2.4"},{value:"4.0",label:"4.0"},{value:"4.1",label:"4.1"},{value:"4.2",label:"4.2"}],value:r,name:"database_version",onChange:function(e){n(e.target.value)}})," "," ",r!==l.current&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("strong",{children:(0,a.__)("Do not change unless advised to do so!","redirection")})," "," ",(0,u.jsx)("button",{className:"button-secondary button",onClick:function(e){e.preventDefault(),i({reason:"database",current:r})},children:(0,a.__)("Save","redirection")})]})]})]}),(0,u.jsxs)("tr",{children:[(0,u.jsx)("th",{children:(0,a.__)("IP Headers","redirection")}),(0,u.jsx)("td",{children:Object.keys(s).filter(e=>s[e]).map((e,t)=>(0,u.jsxs)("code",{children:[e," = ",s[e]?s[e]:"-"," "]},t))})]})]})})},$d=function(){const e=he(e=>e.pluginStatus.status),t=he(e=>e.pluginStatus.debug);return dt({queryKey:Xr.settings.status(),queryFn:async()=>{try{const e=await jt(Xt());return he.getState().setPluginStatus(e),e}catch(e){throw Yr(e)}}}),(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("h2",{children:(0,a.__)("WordPress REST API","redirection")}),(0,u.jsx)("p",{children:(0,a.__)("Redirection communicates with WordPress through the WordPress REST API. This is a standard part of WordPress, and you will experience problems if you cannot use it.","redirection")}),(0,u.jsx)(Ua,{}),(0,u.jsx)("h2",{children:(0,a.__)("Plugin Status","redirection")}),e.length>0&&(0,u.jsx)(zd,{status:e}),0===e.length&&(0,u.jsx)("div",{className:"placeholder-inline",children:(0,u.jsx)("div",{className:"wpl-placeholder__loading"})}),(0,u.jsx)("h2",{children:(0,a.__)("Plugin Debug","redirection")}),(0,u.jsx)("p",{children:(0,a.__)("This information is provided for debugging purposes. Be careful making any changes.","redirection")}),t&&(0,u.jsx)(Md,{debug:t}),!t&&(0,u.jsx)("div",{className:"placeholder-inline",children:(0,u.jsx)("div",{className:"wpl-placeholder__loading"})})]})},Ud=function(){return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)($d,{}),(0,u.jsx)(Fd,{}),(0,u.jsx)(Cd,{})]})};function Bd(e,t){if(!1===e)return!1;const r=function(e){try{let t=e;"http:"!==e.slice(0,5)&&"https:"!==e.slice(0,6)&&(t=document.location.protocol+"//"+e);const r=new URL(t);return{protocol:r.protocol,host:r.host,pathname:r.pathname}}catch(e){return{}}}(e);return r.host&&r.host.length>0?t(r):""}function qd(e){return Bd(e,e=>e.protocol+"//"+(e.host||"")+(e.pathname||""))}function Hd(e){return Bd(e,e=>e.protocol+"//"+(e.host||""))}const Wd=({domain:e,asDomain:t,onChange:r,onDelete:n,site:i})=>(0,u.jsxs)("tr",{className:"redirect-alias__item",children:[(0,u.jsx)("td",{children:(0,u.jsx)("input",{className:"regular-text",type:"text",name:"domain",value:e,onChange:r})}),(0,u.jsx)("td",{className:"redirect-alias__item__asdomain",children:e.length>0&&(0,u.jsxs)(o().Fragment,{children:[(0,u.jsx)("code",{children:t})," ⇒ ",(0,u.jsx)("code",{children:i})]})}),(0,u.jsx)("td",{className:"redirect-alias__delete",children:(0,u.jsx)("button",{onClick:e=>{e.preventDefault(),n()},children:(0,u.jsx)("span",{className:"dashicons dashicons-trash"})})})]}),Gd=({aliases:e,siteDomain:t,onChange:r})=>(0,u.jsxs)(o().Fragment,{children:[(0,u.jsx)("h3",{children:(0,a.__)("Site Aliases","redirection")}),(0,u.jsx)("p",{children:(0,a.__)("A site alias is another domain that you want to be redirected to this site. For example, an old domain, or a subdomain. This will redirect all URLs, including WordPress login and admin.","redirection")}),(0,u.jsx)("p",{children:(0,a.__)("You will need to configure your system (DNS and server) to pass requests for these domains to this WordPress install.","redirection")}),(0,u.jsxs)("table",{className:"wp-list-table widefat fixed striped items redirect-aliases table-auto inline-edit-row",children:[(0,u.jsx)("thead",{children:(0,u.jsxs)("tr",{children:[(0,u.jsx)("th",{children:(0,a.__)("Aliased Domain","redirection")}),(0,u.jsx)("th",{className:"redirect-alias__item__asdomain",children:(0,a.__)("Alias","redirection")}),(0,u.jsx)("th",{className:"redirect-alias__delete"})]})}),(0,u.jsxs)("tbody",{children:[e.map((n,i)=>(0,u.jsx)(Wd,{domain:n,asDomain:(Hd(n)||"").replace(/https?:\/\//,""),onChange:t=>((e,t,r,n)=>{const i=t.slice();i[e]=n.target.value,r({aliases:i})})(i,e,r,t),onDelete:()=>((e,t,r)=>{r({aliases:[...t.slice(0,e),...t.slice(e+1)]})})(i,e,r),site:t},i)),0===e.length&&(0,u.jsx)("tr",{children:(0,u.jsx)("td",{colSpan:3,children:(0,a.__)("No aliases","redirection")})})]})]}),(0,u.jsx)("p",{children:(0,u.jsx)("button",{className:"button-secondary",onClick:t=>((e,t,r)=>{r.preventDefault(),t({aliases:e.concat("").slice(0,20)})})(e,r,t),children:(0,a.__)("Add Alias","redirection")})})]}),Vd=({relocate:e,siteDomain:t,onChange:r})=>{const n=((e,t)=>{if(t){const r=qd(t);if(r&&r.length>0)return(0,u.jsxs)("p",{children:[(0,u.jsx)("code",{children:e})," ⇒ ",(0,u.jsx)("code",{children:r})]})}return null})(t,e);return(0,u.jsxs)(o().Fragment,{children:[(0,u.jsx)("h3",{children:(0,a.__)("Relocate Site","redirection")}),(0,u.jsx)("p",{children:(0,a.__)("Want to redirect the entire site? Enter a domain to redirect everything, except WordPress login and admin. Enabling this option will disable any site aliases or canonical settings.","redirection")}),(0,u.jsxs)("p",{children:[(0,u.jsxs)("strong",{children:[(0,a.__)("Relocate to domain","redirection"),":"]})," ",(0,u.jsx)("input",{type:"text",className:"regular-text",name:"relocate",value:e||"",onChange:e=>r({relocate:e.target.value})})]}),n]})};function Zd(e,t,r){return e=e.replace(/https?:\/\//,""),"www"===r?e="www."+e.replace("www.",""):"nowww"===r&&(e=e.replace("www.","")),(t?"https://":"http://")+e}const Kd=function({https:e,preferredDomain:t,siteDomain:r,onChange:n}){const i=function(e,t,r){return!(!t||e.includes("https:"))||"www"===r&&!e.includes("www.")||!("nowww"!==r||!e.includes("www."))}(r,e,t),o=e=>{n({[e.target.name]:e.target.value})};return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("h3",{children:(0,a.__)("Canonical Settings","redirection")}),(0,u.jsxs)("p",{children:[(0,u.jsx)("input",{id:"canonical-https",type:"checkbox",name:"https",onChange:e=>{n({[e.target.name]:e.target.checked})},checked:e})," ",(0,u.jsx)("label",{htmlFor:"canonical-https",children:M((0,a.sprintf)(
// translators: %(site)s is HTTP site URL, %(siteHTTPS)s is HTTPS site URL
// translators: %(site)s is HTTP site URL, %(siteHTTPS)s is HTTPS site URL
(0,a.__)("Force a redirect from HTTP to HTTPS - {{code}}%(site)s{{/code}} ⇒ {{code}}%(siteHTTPS)s{{/code}}","redirection"),{site:r.replace("https","http"),siteHTTPS:r.replace("http:","https:")}),{code:(0,u.jsx)("code",{})})})]}),e&&(0,u.jsx)("div",{className:"inline-notice inline-warning",children:(0,u.jsx)("p",{children:M(
// translators: %(strong)s is the warning title
// translators: %(strong)s is the warning title
(0,a.__)("{{strong}}Warning{{/strong}}: ensure your HTTPS is working before forcing a redirect.","redirection"),{strong:(0,u.jsx)("strong",{})})})}),(0,u.jsxs)("p",{children:[(0,a.__)("Preferred domain","redirection"),":"]}),(s=r,[{
// translators: %(site)s is the site domain
label:M((0,a.sprintf)(
// translators: %(site)s is the site domain
// translators: %(site)s is the site domain
(0,a.__)("Don't set a preferred domain - {{code}}%(site)s{{/code}}","redirection"),{site:s}),{code:(0,u.jsx)("code",{})}),value:""},{
// translators: %(site)s is the site domain without www, %(siteWWW)s is the site domain with www
label:M((0,a.sprintf)(
// translators: %(site)s is the site domain without www, %(siteWWW)s is the site domain with www
// translators: %(site)s is the site domain without www, %(siteWWW)s is the site domain with www
(0,a.__)("Remove www from domain - {{code}}%(siteWWW)s{{/code}} ⇒ {{code}}%(site)s{{/code}}","redirection"),{site:s.replace("www.",""),siteWWW:s.replace("www.","").replace("://","://www.")}),{code:(0,u.jsx)("code",{})}),value:"nowww"},{
// translators: %(site)s is the site domain without www, %(siteWWW)s is the site domain with www
label:M((0,a.sprintf)(
// translators: %(site)s is the site domain without www, %(siteWWW)s is the site domain with www
// translators: %(site)s is the site domain without www, %(siteWWW)s is the site domain with www
(0,a.__)("Add www to domain - {{code}}%(site)s{{/code}} ⇒ {{code}}%(siteWWW)s{{/code}}","redirection"),{site:s.replace("www.",""),siteWWW:s.replace("www.","").replace("://","://www.")}),{code:(0,u.jsx)("code",{})}),value:"www"}]).map(e=>{const r=`canonical-preferred-${e.value||"none"}`;return(0,u.jsxs)("p",{children:[(0,u.jsx)("input",{id:r,type:"radio",name:"preferred_domain",value:e.value,onChange:o,checked:e.value===t})," ",(0,u.jsx)("label",{htmlFor:r,children:e.label})]},e.value)}),i&&(0,u.jsx)("div",{className:"inline-notice inline-error",children:(0,u.jsx)("p",{children:M((0,a.sprintf)(
// translators: %(current)s is current site URL, %(site)s is recommended canonical URL
// translators: %(current)s is current site URL, %(site)s is recommended canonical URL
(0,a.__)("You should update your site URL to match your canonical settings: {{code}}%(current)s{{/code}} ⇒ {{code}}%(site)s{{/code}}","redirection"),{current:r,site:Zd(r,e,t)}),{code:(0,u.jsx)("code",{})})})})]});var s},Qd=e=>{return"object"==typeof(t=e)&&null!=t&&"window"in t&&t.window===t?e.document:function(e){return Yd(e)&&9===e.nodeType}(e)?e:e?.ownerDocument??("undefined"!=typeof document?document:void 0);var t},Jd=e=>{let t=Qd(e);return t?.defaultView??("undefined"!=typeof window?window:void 0)};function Yd(e){return null!==e&&"object"==typeof e&&"nodeType"in e&&"number"==typeof e.nodeType}function Xd(e,t){return!(!t||!e)&&e.contains(t)}const ep=(e=document)=>e.activeElement;function tp(e){return e.target}const rp="undefined"!=typeof document?o().useLayoutEffect:()=>{};function np(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function ip(e){let t=(0,o().useRef)({isFocused:!1,observer:null});return rp(()=>{const e=t.current;return()=>{e.observer&&(e.observer.disconnect(),e.observer=null)}},[]),(0,o().useCallback)(r=>{let n=tp(r);if(n instanceof HTMLButtonElement||n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement||n instanceof HTMLSelectElement){t.current.isFocused=!0;let r=n,i=n=>{if(t.current.isFocused=!1,r.disabled){let t=np(n);e?.(t)}t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)};r.addEventListener("focusout",i,{once:!0}),t.current.observer=new MutationObserver(()=>{if(t.current.isFocused&&r.disabled){t.current.observer?.disconnect();let e=r===ep()?null:ep();r.dispatchEvent(new FocusEvent("blur",{relatedTarget:e})),r.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:e}))}}),t.current.observer.observe(r,{attributes:!0,attributeFilter:["disabled"]})}},[e])}function op(e){if("undefined"==typeof window||null==window.navigator)return!1;let t=window.navigator.userAgentData?.brands;return Array.isArray(t)&&t.some(t=>e.test(t.brand))||e.test(window.navigator.userAgent)}function sp(e){return"undefined"!=typeof window&&null!=window.navigator&&e.test(window.navigator.userAgentData?.platform||window.navigator.platform)}function ap(e){let t=null;return()=>(null==t&&(t=e()),t)}const lp=ap(function(){return sp(/^Mac/i)}),cp=ap(function(){return sp(/^iPhone/i)}),up=ap(function(){return sp(/^iPad/i)||lp()&&navigator.maxTouchPoints>1}),dp=ap(function(){return cp()||up()}),pp=(ap(function(){return lp()||dp()}),ap(function(){return op(/AppleWebKit/i)&&(dp()||!hp())})),hp=(ap(function(){return pp()&&!hp()&&!mp()}),ap(function(){return op(/Chrome|CriOS|CrMo/i)})),fp=ap(function(){return op(/Android/i)}),mp=ap(function(){return op(/(Firefox|FxiOS)/i)});let gp=null;function _p(e,t,r=!0){let{metaKey:n,ctrlKey:i,altKey:o,shiftKey:s}=t;!pp()&&mp()&&window.event?.type?.startsWith("key")&&"_blank"===e.target&&(lp()?n=!0:i=!0);let a=pp()&&lp()&&!up()?new KeyboardEvent("keydown",{keyIdentifier:"Enter",metaKey:n,ctrlKey:i,altKey:o,shiftKey:s}):new MouseEvent("click",{metaKey:n,ctrlKey:i,altKey:o,shiftKey:s,detail:1,bubbles:!0,cancelable:!0});_p.isOpening=r,function(e){if(function(){if(null==gp){gp=!1;try{document.createElement("div").focus({get preventScroll(){return gp=!0,!0}})}catch{}}return gp}())e.focus({preventScroll:!0});else{let t=function(e){let t=e.parentNode,r=[],n=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==n;)(t.offsetHeight<t.scrollHeight||t.offsetWidth<t.scrollWidth)&&r.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t=t.parentNode;return n instanceof HTMLElement&&r.push({element:n,scrollTop:n.scrollTop,scrollLeft:n.scrollLeft}),r}(e);e.focus(),function(e){for(let{element:t,scrollTop:r,scrollLeft:n}of e)t.scrollTop=r,t.scrollLeft=n}(t)}}(e),e.dispatchEvent(a),_p.isOpening=!1}_p.isOpening=!1;let yp=null,vp="keyboard";const bp=new Set;let xp=new Map,wp=!1,jp=!1;const Sp={Tab:!0,Escape:!0};function kp(e,t){for(let r of bp)r(e,t)}function Cp(e){wp=!0,!_p.isOpening&&function(e){return!(e.metaKey||!lp()&&e.altKey||e.ctrlKey||"Control"===e.key||"Shift"===e.key||"Meta"===e.key)}(e)&&(yp="keyboard",vp="keyboard",kp("keyboard",e))}function Tp(e){yp="pointer",vp="pointerType"in e?e.pointerType:"mouse","mousedown"!==e.type&&"pointerdown"!==e.type||(wp=!0,kp("pointer",e))}function Ep(e){var t;!_p.isOpening&&(""===(t=e).pointerType&&t.isTrusted||(fp()&&t.pointerType?"click"===t.type&&1===t.buttons:0===t.detail&&!t.pointerType))&&(wp=!0,yp="virtual",vp="virtual")}function Rp(e){let t=Jd(tp(e)),r=Qd(tp(e));tp(e)!==t&&tp(e)!==r&&e.isTrusted&&(wp||jp||(yp="virtual",vp="virtual",kp("virtual",e)),wp=!1,jp=!1)}function Pp(){wp=!1,jp=!0}function Np(e){if("undefined"==typeof window||"undefined"==typeof document)return;const t=Jd(e),r=Qd(e);if(xp.get(t))return;let n=t.HTMLElement.prototype.focus;Reflect.defineProperty(t.HTMLElement.prototype,"focus",{configurable:!0,writable:!0,value:function(){wp=!0,n.apply(this,arguments)}}),r.addEventListener("keydown",Cp,!0),r.addEventListener("keyup",Cp,!0),r.addEventListener("click",Ep,!0),t.addEventListener("focus",Rp,!0),t.addEventListener("blur",Pp,!1),"undefined"!=typeof PointerEvent&&(r.addEventListener("pointerdown",Tp,!0),r.addEventListener("pointermove",Tp,!0),r.addEventListener("pointerup",Tp,!0)),t.addEventListener("beforeunload",()=>{Op(e)},{once:!0}),xp.set(t,{focus:n})}const Op=(e,t)=>{const r=Jd(e),n=Qd(e);t&&n.removeEventListener("DOMContentLoaded",t),xp.has(r)&&(Reflect.defineProperty(r.HTMLElement.prototype,"focus",{configurable:!0,writable:!0,value:xp.get(r).focus}),n.removeEventListener("keydown",Cp,!0),n.removeEventListener("keyup",Cp,!0),n.removeEventListener("click",Ep,!0),r.removeEventListener("focus",Rp,!0),r.removeEventListener("blur",Pp,!1),"undefined"!=typeof PointerEvent&&(n.removeEventListener("pointerdown",Tp,!0),n.removeEventListener("pointermove",Tp,!0),n.removeEventListener("pointerup",Tp,!0)),xp.delete(r))};function Ap(){return"pointer"!==yp}"undefined"!=typeof document&&function(e){const t=Qd(e);let r;"loading"!==t.readyState?Np(e):(r=()=>{Np(e)},t.addEventListener("DOMContentLoaded",r))}();const Ip=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function Fp(){let e=(0,o().useRef)(new Map),t=(0,o().useCallback)((t,r,n,i)=>{let o=i?.once?(...t)=>{e.current.delete(n),n(...t)}:n;e.current.set(n,{type:r,eventTarget:t,fn:o,options:i}),t.addEventListener(r,o,i)},[]),r=(0,o().useCallback)((t,r,n,i)=>{let o=e.current.get(n)?.fn||n;t.removeEventListener(r,o,i),e.current.delete(n)},[]),n=(0,o().useCallback)(()=>{e.current.forEach((e,t)=>{r(e.eventTarget,e.type,t,e.options)})},[r]);return(0,o().useEffect)(()=>n,[n]),{addGlobalListener:t,removeGlobalListener:r,removeAllGlobalListeners:n}}function Lp(e){let{isDisabled:t,onBlurWithin:r,onFocusWithin:n,onFocusWithinChange:i}=e,s=(0,o().useRef)({isFocusWithin:!1}),{addGlobalListener:a,removeAllGlobalListeners:l}=Fp(),c=(0,o().useCallback)(e=>{Xd(e.currentTarget,tp(e))&&s.current.isFocusWithin&&!Xd(e.currentTarget,e.relatedTarget)&&(s.current.isFocusWithin=!1,l(),r&&r(e),i&&i(!1))},[r,i,s,l]),u=ip(c),d=(0,o().useCallback)(e=>{if(!Xd(e.currentTarget,tp(e)))return;let t=tp(e);const r=Qd(t),o=ep(r);if(!s.current.isFocusWithin&&o===t){n&&n(e),i&&i(!0),s.current.isFocusWithin=!0,u(e);let t=e.currentTarget;a(r,"focus",e=>{let n=tp(e);if(s.current.isFocusWithin&&!Xd(t,n)){let e=new r.defaultView.FocusEvent("blur",{relatedTarget:n});!function(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}(e,t);let i=np(e);c(i)}},{capture:!0})}},[n,i,u,a,c]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:d,onBlur:c}}}function Dp(e={}){let{autoFocus:t=!1,isTextInput:r,within:n}=e,i=(0,o().useRef)({isFocused:!1,isFocusVisible:t||Ap()}),[s,a]=(0,o().useState)(!1),[l,c]=(0,o().useState)(()=>i.current.isFocused&&i.current.isFocusVisible),u=(0,o().useCallback)(()=>c(i.current.isFocused&&i.current.isFocusVisible),[]),d=(0,o().useCallback)(e=>{i.current.isFocused=e,i.current.isFocusVisible=Ap(),a(e),u()},[u]);var p,h,f;p=e=>{i.current.isFocusVisible=e,u()},h=[r,s],f={enabled:s,isTextInput:r},Np(),(0,o().useEffect)(()=>{if(!1===f?.enabled)return;let e=(e,t)=>{(function(e,t,r){let n=r?tp(r):void 0,i=Qd(n),o=Jd(n);const s=void 0!==o?o.HTMLInputElement:HTMLInputElement,a=void 0!==o?o.HTMLTextAreaElement:HTMLTextAreaElement,l=void 0!==o?o.HTMLElement:HTMLElement,c=void 0!==o?o.KeyboardEvent:KeyboardEvent;let u=ep(i);return!((e=e||u instanceof s&&!Ip.has(u.type)||u instanceof a||u instanceof l&&u.isContentEditable)&&"keyboard"===t&&r instanceof c&&!Sp[r.key])})(!!f?.isTextInput,e,t)&&p(Ap())};return bp.add(e),()=>{bp.delete(e)}},h);let{focusProps:m}=function(e){let{isDisabled:t,onFocus:r,onBlur:n,onFocusChange:i}=e;const s=(0,o().useCallback)(e=>{if(tp(e)===e.currentTarget)return n&&n(e),i&&i(!1),!0},[n,i]),a=ip(s),l=(0,o().useCallback)(e=>{let t=tp(e);const n=Qd(t),o=n?ep(n):ep();t===e.currentTarget&&t===o&&(r&&r(e),i&&i(!0),a(e))},[i,r,a]);return{focusProps:{onFocus:!t&&(r||i||n)?l:void 0,onBlur:t||!n&&!i?void 0:s}}}({isDisabled:n,onFocusChange:d}),{focusWithinProps:g}=Lp({isDisabled:!n,onFocusWithinChange:d});return{isFocused:s,isFocusVisible:l,focusProps:n?g:m}}let zp=!1,Mp=0;function $p(e){"touch"===e.pointerType&&(zp=!0,setTimeout(()=>{zp=!1},500))}function Up(){let e=Qd(null);if(void 0!==e)return 0===Mp&&"undefined"!=typeof PointerEvent&&e.addEventListener("pointerup",$p),Mp++,()=>{Mp--,Mp>0||"undefined"!=typeof PointerEvent&&e.removeEventListener("pointerup",$p)}}function Bp(e){let{onHoverStart:t,onHoverChange:r,onHoverEnd:n,isDisabled:i}=e,[s,a]=(0,o().useState)(!1),l=(0,o().useRef)({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;(0,o().useEffect)(Up,[]);let{addGlobalListener:c,removeAllGlobalListeners:u}=Fp(),{hoverProps:d,triggerHoverEnd:p}=(0,o().useMemo)(()=>{let e=(e,t)=>{let i=l.target;l.pointerType="",l.target=null,"touch"!==t&&l.isHovered&&i&&(l.isHovered=!1,u(),n&&n({type:"hoverend",target:i,pointerType:t}),r&&r(!1),a(!1))},o={};return"undefined"!=typeof PointerEvent&&(o.onPointerEnter=n=>{zp&&"mouse"===n.pointerType||((n,o)=>{if(l.pointerType=o,i||"touch"===o||l.isHovered||!Xd(n.currentTarget,tp(n)))return;l.isHovered=!0;let s=n.currentTarget;l.target=s,c(Qd(tp(n)),"pointerover",t=>{l.isHovered&&l.target&&!Xd(l.target,tp(t))&&e(0,t.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:s,pointerType:o}),r&&r(!0),a(!0)})(n,n.pointerType)},o.onPointerLeave=t=>{!i&&Xd(t.currentTarget,tp(t))&&e(0,t.pointerType)}),{hoverProps:o,triggerHoverEnd:e}},[t,r,n,i,l,c,u]);return(0,o().useEffect)(()=>{i&&p({currentTarget:l.target},l.pointerType)},[i]),{hoverProps:d,isHovered:s}}var qp=Object.defineProperty,Hp=(e,t,r)=>(((e,t,r)=>{t in e?qp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r})(e,"symbol"!=typeof t?t+"":t,r),r);let Wp=new class{constructor(){Hp(this,"current",this.detect()),Hp(this,"handoffState","pending"),Hp(this,"currentId",0)}set(e){this.current!==e&&(this.handoffState="pending",this.currentId=0,this.current=e)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return"server"===this.current}get isClient(){return"client"===this.current}detect(){return"undefined"==typeof window||"undefined"==typeof document?"server":"client"}handoff(){"pending"===this.handoffState&&(this.handoffState="complete")}get isHandoffComplete(){return"complete"===this.handoffState}};function Gp(e){var t;return Wp.isServer?null:null==e?document:null!=(t=null==e?void 0:e.ownerDocument)?t:document}function Vp(e){var t,r;return Wp.isServer?null:null==e?document:null!=(r=null==(t=null==e?void 0:e.getRootNode)?void 0:t.call(e))?r:document}function Zp(e){var t,r;return null!=(r=null==(t=Vp(e))?void 0:t.activeElement)?r:null}function Kp(e){"function"==typeof queueMicrotask?queueMicrotask(e):Promise.resolve().then(e).catch(e=>setTimeout(()=>{throw e}))}function Qp(){let e=[],t={addEventListener:(e,r,n,i)=>(e.addEventListener(r,n,i),t.add(()=>e.removeEventListener(r,n,i))),requestAnimationFrame(...e){let r=requestAnimationFrame(...e);return t.add(()=>cancelAnimationFrame(r))},nextFrame:(...e)=>t.requestAnimationFrame(()=>t.requestAnimationFrame(...e)),setTimeout(...e){let r=setTimeout(...e);return t.add(()=>clearTimeout(r))},microTask(...e){let r={current:!0};return Kp(()=>{r.current&&e[0]()}),t.add(()=>{r.current=!1})},style(e,t,r){let n=e.style.getPropertyValue(t);return Object.assign(e.style,{[t]:r}),this.add(()=>{Object.assign(e.style,{[t]:n})})},group(e){let t=Qp();return e(t),this.add(()=>t.dispose())},add:t=>(e.includes(t)||e.push(t),()=>{let r=e.indexOf(t);if(r>=0)for(let t of e.splice(r,1))t()}),dispose(){for(let t of e.splice(0))t()}};return t}function Jp(){let[e]=(0,o().useState)(Qp);return(0,o().useEffect)(()=>()=>e.dispose(),[e]),e}let Yp=(e,t)=>{Wp.isServer?(0,o().useEffect)(e,t):(0,o().useLayoutEffect)(e,t)};function Xp(e){let t=(0,o().useRef)(e);return Yp(()=>{t.current=e},[e]),t}let eh=function(e){let t=Xp(e);return o().useCallback((...e)=>t.current(...e),[t])};function th({disabled:e=!1}={}){let t=(0,o().useRef)(null),[r,n]=(0,o().useState)(!1),i=Jp(),s=eh(()=>{t.current=null,n(!1),i.dispose()}),a=eh(e=>{if(i.dispose(),null===t.current){t.current=e.currentTarget,n(!0);{let r=Gp(e.currentTarget);i.addEventListener(r,"pointerup",s,!1),i.addEventListener(r,"pointermove",e=>{if(t.current){let r=function(e){let t=e.width/2,r=e.height/2;return{top:e.clientY-r,right:e.clientX+t,bottom:e.clientY+r,left:e.clientX-t}}(e);n(function(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}(r,t.current.getBoundingClientRect()))}},!1),i.addEventListener(r,"pointercancel",s,!1)}}});return{pressed:r,pressProps:e?{}:{onPointerDown:a,onPointerUp:s,onClick:s}}}function rh(e){if(null===e)return{width:0,height:0};let{width:t,height:r}=e.getBoundingClientRect();return{width:t,height:r}}function nh(e,t,r=!1){let[n,i]=(0,o().useState)(()=>rh(t));return Yp(()=>{if(!t||!e)return;let r=Qp();return r.requestAnimationFrame(function e(){r.requestAnimationFrame(e),i(e=>{let r=rh(t);return r.width===e.width&&r.height===e.height?e:r})}),()=>{r.dispose()}},[t,e]),r?{width:`${n.width}px`,height:`${n.height}px`}:n}function ih(e){return function(e){return"object"==typeof e&&null!==e&&"nodeType"in e}(e)&&"tagName"in e}function oh(e){return ih(e)&&"accessKey"in e}function sh(e){return ih(e)&&"tabIndex"in e}function ah(e){return oh(e)&&"FIELDSET"===e.nodeName}function lh(e){return oh(e)&&"LEGEND"===e.nodeName}function ch(e,t,...r){if(e in t){let n=t[e];return"function"==typeof n?n(...r):n}let n=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(e=>`"${e}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,ch),n}let uh=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","details>summary","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(","),dh=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var ph,hh=((ph=hh||{})[ph.First=1]="First",ph[ph.Previous=2]="Previous",ph[ph.Next=4]="Next",ph[ph.Last=8]="Last",ph[ph.WrapAround=16]="WrapAround",ph[ph.NoScroll=32]="NoScroll",ph[ph.AutoFocus=64]="AutoFocus",ph),fh=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(fh||{}),mh=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(mh||{});function gh(e=document.body){return null==e?[]:Array.from(e.querySelectorAll(uh)).sort((e,t)=>Math.sign((e.tabIndex||Number.MAX_SAFE_INTEGER)-(t.tabIndex||Number.MAX_SAFE_INTEGER)))}var _h=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(_h||{});function yh(e,t=0){var r;return e!==(null==(r=Gp(e))?void 0:r.body)&&ch(t,{0:()=>e.matches(uh),1(){let t=e;for(;null!==t;){if(t.matches(uh))return!0;t=t.parentElement}return!1}})}var vh=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(vh||{});"undefined"!=typeof window&&"undefined"!=typeof document&&(document.addEventListener("keydown",e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",e=>{1===e.detail?delete document.documentElement.dataset.headlessuiFocusVisible:0===e.detail&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));let bh=["textarea","input"].join(",");function xh(e,t,{sorted:r=!0,relativeTo:n=null,skipElements:i=[]}={}){let o=Array.isArray(e)?e.length>0?Vp(e[0]):document:Vp(e),s=Array.isArray(e)?r?function(e,t=e=>e){return e.slice().sort((e,r)=>{let n=t(e),i=t(r);if(null===n||null===i)return 0;let o=n.compareDocumentPosition(i);return o&Node.DOCUMENT_POSITION_FOLLOWING?-1:o&Node.DOCUMENT_POSITION_PRECEDING?1:0})}(e):e:64&t?function(e=document.body){return null==e?[]:Array.from(e.querySelectorAll(dh)).sort((e,t)=>Math.sign((e.tabIndex||Number.MAX_SAFE_INTEGER)-(t.tabIndex||Number.MAX_SAFE_INTEGER)))}(e):gh(e);i.length>0&&s.length>1&&(s=s.filter(e=>!i.some(t=>null!=t&&"current"in t?(null==t?void 0:t.current)===e:t===e))),n=null!=n?n:null==o?void 0:o.activeElement;let a,l=(()=>{if(5&t)return 1;if(10&t)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),c=(()=>{if(1&t)return 0;if(2&t)return Math.max(0,s.indexOf(n))-1;if(4&t)return Math.max(0,s.indexOf(n))+1;if(8&t)return s.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),u=32&t?{preventScroll:!0}:{},d=0,p=s.length;do{if(d>=p||d+p<=0)return 0;let e=c+d;if(16&t)e=(e+p)%p;else{if(e<0)return 3;if(e>=p)return 1}a=s[e],null==a||a.focus(u),d+=l}while(a!==Zp(a));return 6&t&&function(e){var t,r;return null!=(r=null==(t=null==e?void 0:e.matches)?void 0:t.call(e,bh))&&r}(a)&&a.select(),2}function wh(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function jh(){return wh()||/Android/gi.test(window.navigator.userAgent)}function Sh(e,t,r,n){let i=Xp(r);(0,o().useEffect)(()=>{if(e)return document.addEventListener(t,r,n),()=>document.removeEventListener(t,r,n);function r(e){i.current(e)}},[e,t,n])}function kh(e,t,r,n){let i=Xp(r);(0,o().useEffect)(()=>{if(e)return window.addEventListener(t,r,n),()=>window.removeEventListener(t,r,n);function r(e){i.current(e)}},[e,t,n])}function Ch(e,t,r){let n=Xp(r),i=(0,o().useCallback)(function(e,r){if(e.defaultPrevented)return;let i=r(e);if(null===i||!i.getRootNode().contains(i)||!i.isConnected)return;let o=function e(t){return"function"==typeof t?e(t()):Array.isArray(t)||t instanceof Set?t:[t]}(t);for(let t of o)if(null!==t&&(t.contains(i)||e.composed&&e.composedPath().includes(t)))return;return!yh(i,_h.Loose)&&-1!==i.tabIndex&&e.preventDefault(),n.current(e,i)},[n,t]),s=(0,o().useRef)(null);Sh(e,"pointerdown",e=>{var t,r;jh()||(s.current=(null==(r=null==(t=e.composedPath)?void 0:t.call(e))?void 0:r[0])||e.target)},!0),Sh(e,"pointerup",e=>{if(jh()||!s.current)return;let t=s.current;return s.current=null,i(e,()=>t)},!0);let a=(0,o().useRef)({x:0,y:0});Sh(e,"touchstart",e=>{a.current.x=e.touches[0].clientX,a.current.y=e.touches[0].clientY},!0),Sh(e,"touchend",e=>{let t=e.changedTouches[0].clientX,r=e.changedTouches[0].clientY;if(!(Math.abs(t-a.current.x)>=30||Math.abs(r-a.current.y)>=30))return i(e,()=>sh(e.target)?e.target:null)},!0),kh(e,"blur",e=>i(e,()=>{return oh(e=window.document.activeElement)&&"IFRAME"===e.nodeName?window.document.activeElement:null;var e}),!0)}function Th(...e){return(0,o().useMemo)(()=>Gp(...e),[...e])}function Eh(...e){return Array.from(new Set(e.flatMap(e=>"string"==typeof e?e.split(" "):[]))).filter(Boolean).join(" ")}var Rh=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(Rh||{}),Ph=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(Ph||{});function Nh(){let e=function(){let e=(0,o().useRef)([]),t=(0,o().useCallback)(t=>{for(let r of e.current)null!=r&&("function"==typeof r?r(t):r.current=t)},[]);return(...r)=>{if(!r.every(e=>null==e))return e.current=r,t}}();return(0,o().useCallback)(t=>function({ourProps:e,theirProps:t,slot:r,defaultTag:n,features:i,visible:o=!0,name:s,mergeRefs:a}){a=null!=a?a:Ah;let l=Ih(t,e);if(o)return Oh(l,r,n,s,a);let c=null!=i?i:0;if(2&c){let{static:e=!1,...t}=l;if(e)return Oh(t,r,n,s,a)}if(1&c){let{unmount:e=!0,...t}=l;return ch(e?0:1,{0:()=>null,1:()=>Oh({...t,hidden:!0,style:{display:"none"}},r,n,s,a)})}return Oh(l,r,n,s,a)}({mergeRefs:e,...t}),[e])}function Oh(e,t={},r,n,i){let{as:s=r,children:a,refName:l="ref",...c}=zh(e,["unmount","static"]),u=void 0!==e.ref?{[l]:e.ref}:{},d="function"==typeof a?a(t):a;d=$h(d),"className"in c&&c.className&&"function"==typeof c.className&&(c.className=c.className(t)),c["aria-labelledby"]&&c["aria-labelledby"]===c.id&&(c["aria-labelledby"]=void 0);let p={};if(t){let e=!1,r=[];for(let[n,i]of Object.entries(t))"boolean"==typeof i&&(e=!0),!0===i&&r.push(n.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`));if(e){p["data-headlessui-state"]=r.join(" ");for(let e of r)p[`data-${e}`]=""}}if(Uh(s)&&(Object.keys(Dh(c)).length>0||Object.keys(Dh(p)).length>0)){if(!(!(0,o().isValidElement)(d)||Array.isArray(d)&&d.length>1||function(e){return Uh(e.type)}(d))){let e=d.props,t=null==e?void 0:e.className,r="function"==typeof t?(...e)=>Eh(t(...e),c.className):Eh(t,c.className),n=r?{className:r}:{},s=Ih(d.props,Dh(zh(c,["ref"])));for(let e in p)e in s&&delete p[e];return(0,o().cloneElement)(d,Object.assign({},s,p,u,{ref:i(Mh(d),u.ref)},n))}if(Object.keys(Dh(c)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${n} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(Dh(c)).concat(Object.keys(Dh(p))).map(e=>` - ${e}`).join("\n"),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(e=>` - ${e}`).join("\n")].join("\n"))}return(0,o().createElement)(s,Object.assign({},zh(c,["ref"]),!Uh(s)&&u,!Uh(s)&&p),d)}function Ah(...e){return e.every(e=>null==e)?void 0:t=>{for(let r of e)null!=r&&("function"==typeof r?r(t):r.current=t)}}function Ih(...e){if(0===e.length)return{};if(1===e.length)return e[0];let t={},r={};for(let n of e)for(let e in n)e.startsWith("on")&&"function"==typeof n[e]?(null!=r[e]||(r[e]=[]),r[e].push(n[e])):t[e]=n[e];if(t.disabled||t["aria-disabled"])for(let e in r)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(e)&&(r[e]=[e=>{var t;return null==(t=null==e?void 0:e.preventDefault)?void 0:t.call(e)}]);for(let e in r)Object.assign(t,{[e](t,...n){let i=r[e];for(let e of i){if((t instanceof Event||(null==t?void 0:t.nativeEvent)instanceof Event)&&t.defaultPrevented)return;e(t,...n)}}});return t}function Fh(...e){if(0===e.length)return{};if(1===e.length)return e[0];let t={},r={};for(let n of e)for(let e in n)e.startsWith("on")&&"function"==typeof n[e]?(null!=r[e]||(r[e]=[]),r[e].push(n[e])):t[e]=n[e];for(let e in r)Object.assign(t,{[e](...t){let n=r[e];for(let e of n)null==e||e(...t)}});return t}function Lh(e){var t;return Object.assign((0,o().forwardRef)(e),{displayName:null!=(t=e.displayName)?t:e.name})}function Dh(e){let t=Object.assign({},e);for(let e in t)void 0===t[e]&&delete t[e];return t}function zh(e,t=[]){let r=Object.assign({},e);for(let e of t)e in r&&delete r[e];return r}function Mh(e){return o().version.split(".")[0]>="19"?e.props.ref:e.ref}function $h(e){if(null!=e&&e.$$typeof===Symbol.for("react.lazy")){let t=e._payload;if(null!=t&&"fulfilled"===t.status)return $h(t.value)}return e}function Uh(e){return e===o().Fragment||e===Symbol.for("react.fragment")}var Bh,qh=((Bh=qh||{})[Bh.None=1]="None",Bh[Bh.Focusable=2]="Focusable",Bh[Bh.Hidden=4]="Hidden",Bh);let Hh=Lh(function(e,t){var r;let{features:n=1,...i}=e,o={ref:t,"aria-hidden":!(2&~n)||(null!=(r=i["aria-hidden"])?r:void 0),hidden:!(4&~n)||void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...!(4&~n)&&!!(2&~n)&&{display:"none"}}};return Nh()({ourProps:o,theirProps:i,slot:{},defaultTag:"span",name:"Hidden"})}),Wh=(0,o().createContext)(null);function Gh({children:e,node:t}){let[r,n]=(0,o().useState)(null),i=Vh(null!=t?t:r);return o().createElement(Wh.Provider,{value:i},e,null===i&&o().createElement(Hh,{features:qh.Hidden,ref:e=>{var t,r;if(e)for(let i of null!=(r=null==(t=Gp(e))?void 0:t.querySelectorAll("html > *, body > *"))?r:[])if(i!==document.body&&i!==document.head&&ih(i)&&null!=i&&i.contains(e)){n(i);break}}}))}function Vh(e=null){var t;return null!=(t=(0,o().useContext)(Wh))?t:e}function Zh(){let e;return{before({doc:t}){var r;let n=t.documentElement,i=null!=(r=t.defaultView)?r:window;e=Math.max(0,i.innerWidth-n.clientWidth)},after({doc:t,d:r}){let n=t.documentElement,i=Math.max(0,n.clientWidth-n.offsetWidth),o=Math.max(0,e-i);r.style(n,"paddingRight",`${o}px`)}}}function Kh(){return wh()?{before({doc:e,d:t,meta:r}){function n(e){for(let t of r().containers)for(let r of t())if(r.contains(e))return!0;return!1}t.microTask(()=>{var r;if("auto"!==window.getComputedStyle(e.documentElement).scrollBehavior){let r=Qp();r.style(e.documentElement,"scrollBehavior","auto"),t.add(()=>t.microTask(()=>r.dispose()))}let i=null!=(r=window.scrollY)?r:window.pageYOffset,o=null;t.addEventListener(e,"click",t=>{if(sh(t.target))try{let r=t.target.closest("a");if(!r)return;let{hash:i}=new URL(r.href),s=e.querySelector(i);sh(s)&&!n(s)&&(o=s)}catch{}},!0),t.group(r=>{t.addEventListener(e,"touchstart",e=>{if(r.dispose(),sh(e.target)&&function(e){return ih(e)&&"style"in e}(e.target))if(n(e.target)){let t=e.target;for(;t.parentElement&&n(t.parentElement);)t=t.parentElement;r.style(t,"overscrollBehavior","contain")}else r.style(e.target,"touchAction","none")})}),t.addEventListener(e,"touchmove",e=>{if(sh(e.target)){if(function(e){return oh(e)&&"INPUT"===e.nodeName}(e.target))return;if(n(e.target)){let t=e.target;for(;t.parentElement&&""!==t.dataset.headlessuiPortal&&!(t.scrollHeight>t.clientHeight||t.scrollWidth>t.clientWidth);)t=t.parentElement;""===t.dataset.headlessuiPortal&&e.preventDefault()}else e.preventDefault()}},{passive:!1}),t.add(()=>{var e;let t=null!=(e=window.scrollY)?e:window.pageYOffset;i!==t&&window.scrollTo(0,i),o&&o.isConnected&&(o.scrollIntoView({block:"nearest"}),o=null)})})}}:{}}function Qh(e){let t={};for(let r of e)Object.assign(t,r(t));return t}let Jh=function(e,t){let r=new Map,n=new Set;return{getSnapshot:()=>r,subscribe:e=>(n.add(e),()=>n.delete(e)),dispatch(e,...i){let o=t[e].call(r,...i);o&&(r=o,n.forEach(e=>e()))}}}(0,{PUSH(e,t){var r;let n=null!=(r=this.get(e))?r:{doc:e,count:0,d:Qp(),meta:new Set,computedMeta:{}};return n.count++,n.meta.add(t),n.computedMeta=Qh(n.meta),this.set(e,n),this},POP(e,t){let r=this.get(e);return r&&(r.count--,r.meta.delete(t),r.computedMeta=Qh(r.meta)),this},SCROLL_PREVENT(e){let t={doc:e.doc,d:e.d,meta:()=>e.computedMeta},r=[Kh(),Zh(),{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}];r.forEach(({before:e})=>null==e?void 0:e(t)),r.forEach(({after:e})=>null==e?void 0:e(t))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});Jh.subscribe(()=>{let e=Jh.getSnapshot(),t=new Map;for(let[r]of e)t.set(r,r.documentElement.style.overflow);for(let r of e.values()){let e="hidden"===t.get(r.doc),n=0!==r.count;(n&&!e||!n&&e)&&Jh.dispatch(r.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",r),0===r.count&&Jh.dispatch("TEARDOWN",r)}});class Yh extends Map{constructor(e){super(),this.factory=e}get(e){let t=super.get(e);return void 0===t&&(t=this.factory(e),this.set(e,t)),t}}var Xh,ef,tf,rf=Object.defineProperty,nf=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},of=(e,t,r)=>(nf(e,t,"read from private field"),r?r.call(e):t.get(e)),sf=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},af=(e,t,r,n)=>(nf(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class lf{constructor(e){sf(this,Xh,{}),sf(this,ef,new Yh(()=>new Set)),sf(this,tf,new Set),((e,t,r)=>{((e,t,r)=>{t in e?rf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r})(e,"symbol"!=typeof t?t+"":t,r)})(this,"disposables",Qp()),af(this,Xh,e),Wp.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return of(this,Xh)}subscribe(e,t){if(Wp.isServer)return()=>{};let r={selector:e,callback:t,current:e(of(this,Xh))};return of(this,tf).add(r),this.disposables.add(()=>{of(this,tf).delete(r)})}on(e,t){return Wp.isServer?()=>{}:(of(this,ef).get(e).add(t),this.disposables.add(()=>{of(this,ef).get(e).delete(t)}))}send(e){let t=this.reduce(of(this,Xh),e);if(t!==of(this,Xh)){af(this,Xh,t);for(let e of of(this,tf)){let t=e.selector(of(this,Xh));cf(e.current,t)||(e.current=t,e.callback(t))}for(let t of of(this,ef).get(e.type))t(of(this,Xh),e)}}}function cf(e,t){return!!Object.is(e,t)||"object"==typeof e&&null!==e&&"object"==typeof t&&null!==t&&(Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&uf(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size===t.size&&uf(e.entries(),t.entries()):!(!df(e)||!df(t))&&uf(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()))}function uf(e,t){for(;;){let r=e.next(),n=t.next();if(r.done&&n.done)return!0;if(r.done||n.done||!Object.is(r.value,n.value))return!1}}function df(e){if("[object Object]"!==Object.prototype.toString.call(e))return!1;let t=Object.getPrototypeOf(e);return null===t||null===Object.getPrototypeOf(t)}Xh=new WeakMap,ef=new WeakMap,tf=new WeakMap;var pf=Object.defineProperty,hf=(e,t,r)=>(((e,t,r)=>{t in e?pf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r})(e,"symbol"!=typeof t?t+"":t,r),r),ff=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(ff||{});let mf={0(e,t){let r=t.id,n=e.stack,i=e.stack.indexOf(r);if(-1!==i){let t=e.stack.slice();return t.splice(i,1),t.push(r),n=t,{...e,stack:n}}return{...e,stack:[...e.stack,r]}},1(e,t){let r=t.id,n=e.stack.indexOf(r);if(-1===n)return e;let i=e.stack.slice();return i.splice(n,1),{...e,stack:i}}};class gf extends lf{constructor(){super(...arguments),hf(this,"actions",{push:e=>this.send({type:0,id:e}),pop:e=>this.send({type:1,id:e})}),hf(this,"selectors",{isTop:(e,t)=>e.stack[e.stack.length-1]===t,inStack:(e,t)=>e.stack.includes(t)})}static new(){return new gf({stack:[]})}reduce(e,t){return ch(t.type,mf,e,t)}}const _f=new Yh(()=>gf.new());function yf(e,t,r=cf){return(0,n().useSyncExternalStoreWithSelector)(eh(t=>e.subscribe(vf,t)),eh(()=>e.state),eh(()=>e.state),eh(t),r)}function vf(e){return e}function bf(e,t,r=()=>[document.body]){let n=function(e){let t=(0,o().useId)(),r=_f.get("scroll-lock"),[n,i]=yf(r,(0,o().useCallback)(e=>[r.selectors.isTop(e,t),r.selectors.inStack(e,t)],[r,t]));return Yp(()=>{if(e)return r.actions.push(t),()=>r.actions.pop(t)},[r,e,t]),!!e&&(!i||n)}(e);!function(e,t,r=()=>({containers:[]})){let n=function(e){return(0,o().useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot)}(Jh),i=t?n.get(t):void 0,s=!!i&&i.count>0;Yp(()=>{if(t&&e)return Jh.dispatch("PUSH",t,r),()=>Jh.dispatch("POP",t,r)},[e,t])}(n,t,e=>{var t;return{containers:[...null!=(t=e.containers)?t:[],r]}})}function xf(e){return(0,o().useMemo)(()=>e,Object.values(e))}i();let wf=Symbol();function jf(e,t=!0){return Object.assign(e,{[wf]:t})}function Sf(...e){let t=(0,o().useRef)(e);(0,o().useEffect)(()=>{t.current=e},[e]);let r=eh(e=>{for(let r of t.current)null!=r&&("function"==typeof r?r(e):r.current=e)});return e.every(e=>null==e||(null==e?void 0:e[wf]))?void 0:r}var kf,Cf,Tf=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(Tf||{});function Ef(){let e=(0,o().useRef)(0);return kh(!0,"keydown",t=>{"Tab"===t.key&&(e.current=t.shiftKey?1:0)},!0),e}"undefined"!=typeof process&&"undefined"!=typeof globalThis&&"undefined"!=typeof Element&&"test"===(null==(kf=null==process?void 0:{NODE_ENV:"production"})?void 0:kf.NODE_ENV)&&void 0===(null==(Cf=null==Element?void 0:Element.prototype)?void 0:Cf.getAnimations)&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join("\n")),[]});var Rf=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(Rf||{});function Pf(e){let t={};for(let r in e)!0===e[r]&&(t[`data-${r}`]="");return t}function Nf(e,t,r,n){let[i,s]=(0,o().useState)(r),{hasFlag:a,addFlag:l,removeFlag:c}=function(e=0){let[t,r]=(0,o().useState)(e),n=(0,o().useCallback)(e=>r(e),[]),i=(0,o().useCallback)(e=>r(t=>t|e),[]),s=(0,o().useCallback)(e=>(t&e)===e,[t]),a=(0,o().useCallback)(e=>r(t=>t&~e),[]),l=(0,o().useCallback)(e=>r(t=>t^e),[]);return{flags:t,setFlag:n,addFlag:i,hasFlag:s,removeFlag:a,toggleFlag:l}}(e&&i?3:0),u=(0,o().useRef)(!1),d=(0,o().useRef)(!1),p=Jp();return Yp(()=>{var i;if(e)return r&&s(!0),t?(null==(i=null==n?void 0:n.start)||i.call(n,r),function(e,{prepare:t,run:r,done:n,inFlight:i}){let o=Qp();return function(e,{inFlight:t,prepare:r}){if(null!=t&&t.current)return void r();let n=e.style.transition;e.style.transition="none",r(),e.offsetHeight,e.style.transition=n}(e,{prepare:t,inFlight:i}),o.nextFrame(()=>{r(),o.requestAnimationFrame(()=>{o.add(function(e,t){var r,n;let i=Qp();if(!e)return i.dispose;let o=!1;i.add(()=>{o=!0});let s=null!=(n=null==(r=e.getAnimations)?void 0:r.call(e).filter(e=>e instanceof CSSTransition))?n:[];return 0===s.length?(t(),i.dispose):(Promise.allSettled(s.map(e=>e.finished)).then(()=>{o||t()}),i.dispose)}(e,n))})}),o.dispose}(t,{inFlight:u,prepare(){d.current?d.current=!1:d.current=u.current,u.current=!0,!d.current&&(r?(l(3),c(4)):(l(4),c(2)))},run(){d.current?r?(c(3),l(4)):(c(4),l(3)):r?c(1):l(1)},done(){var e;d.current&&function(e){var t,r;return(null!=(r=null==(t=e.getAnimations)?void 0:t.call(e))?r:[]).some(e=>e instanceof CSSTransition&&"finished"!==e.playState)}(t)||(u.current=!1,c(7),r||s(!1),null==(e=null==n?void 0:n.end)||e.call(n,r))}})):void(r&&l(3))},[e,r,t,p]),e?[i,{closed:a(1),enter:a(2),leave:a(4),transition:a(2)||a(4)}]:[r,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}let Of=(0,o().createContext)(()=>{});function Af({value:e,children:t}){return o().createElement(Of.Provider,{value:e},t)}const If=Math.min,Ff=Math.max,Lf=Math.round,Df=Math.floor,zf=e=>({x:e,y:e}),Mf={left:"right",right:"left",bottom:"top",top:"bottom"};function $f(e,t){return"function"==typeof e?e(t):e}function Uf(e){return e.split("-")[0]}function Bf(e){return e.split("-")[1]}function qf(e){return"x"===e?"y":"x"}function Hf(e){return"y"===e?"height":"width"}function Wf(e){const t=e[0];return"t"===t||"b"===t?"y":"x"}function Gf(e){return qf(Wf(e))}function Vf(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Zf=["left","right"],Kf=["right","left"],Qf=["top","bottom"],Jf=["bottom","top"];function Yf(e){const t=Uf(e);return Mf[t]+e.slice(t.length)}function Xf(e){const{x:t,y:r,width:n,height:i}=e;return{width:n,height:i,top:r,left:t,right:t+n,bottom:r+i,x:t,y:r}}function em(){return"undefined"!=typeof window}function tm(e){return im(e)?(e.nodeName||"").toLowerCase():"#document"}function rm(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function nm(e){var t;return null==(t=(im(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function im(e){return!!em()&&(e instanceof Node||e instanceof rm(e).Node)}function om(e){return!!em()&&(e instanceof Element||e instanceof rm(e).Element)}function sm(e){return!!em()&&(e instanceof HTMLElement||e instanceof rm(e).HTMLElement)}function am(e){return!(!em()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof rm(e).ShadowRoot)}function lm(e){const{overflow:t,overflowX:r,overflowY:n,display:i}=ym(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&"inline"!==i&&"contents"!==i}function cm(e){return/^(table|td|th)$/.test(tm(e))}function um(e){try{if(e.matches(":popover-open"))return!0}catch(e){}try{return e.matches(":modal")}catch(e){return!1}}const dm=/transform|translate|scale|rotate|perspective|filter/,pm=/paint|layout|strict|content/,hm=e=>!!e&&"none"!==e;let fm;function mm(e){const t=om(e)?ym(e):e;return hm(t.transform)||hm(t.translate)||hm(t.scale)||hm(t.rotate)||hm(t.perspective)||!gm()&&(hm(t.backdropFilter)||hm(t.filter))||dm.test(t.willChange||"")||pm.test(t.contain||"")}function gm(){return null==fm&&(fm="undefined"!=typeof CSS&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),fm}function _m(e){return/^(html|body|#document)$/.test(tm(e))}function ym(e){return rm(e).getComputedStyle(e)}function vm(e){return om(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function bm(e){if("html"===tm(e))return e;const t=e.assignedSlot||e.parentNode||am(e)&&e.host||nm(e);return am(t)?t.host:t}function xm(e){const t=bm(e);return _m(t)?(e.ownerDocument||e).body:sm(t)&&lm(t)?t:xm(t)}function wm(e,t,r){var n;void 0===t&&(t=[]),void 0===r&&(r=!0);const i=xm(e),o=i===(null==(n=e.ownerDocument)?void 0:n.body),s=rm(i);if(o){const e=jm(s);return t.concat(s,s.visualViewport||[],lm(i)?i:[],e&&r?wm(e):[])}return t.concat(i,wm(i,[],r))}function jm(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Sm(e,t,r){let{reference:n,floating:i}=e;const o=Wf(t),s=Gf(t),a=Hf(s),l=Uf(t),c="y"===o,u=n.x+n.width/2-i.width/2,d=n.y+n.height/2-i.height/2,p=n[a]/2-i[a]/2;let h;switch(l){case"top":h={x:u,y:n.y-i.height};break;case"bottom":h={x:u,y:n.y+n.height};break;case"right":h={x:n.x+n.width,y:d};break;case"left":h={x:n.x-i.width,y:d};break;default:h={x:n.x,y:n.y}}const f=Bf(t);return f&&(h[s]+=p*("end"===f?1:-1)*(r&&c?-1:1)),h}async function km(e,t){var r;void 0===t&&(t={});const{x:n,y:i,platform:o,rects:s,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:p=!1,padding:h=0}=$f(t,e),f=function(e){return"number"!=typeof e?function(e){var t,r,n,i;return{top:null!=(t=e.top)?t:0,right:null!=(r=e.right)?r:0,bottom:null!=(n=e.bottom)?n:0,left:null!=(i=e.left)?i:0}}(e):{top:e,right:e,bottom:e,left:e}}(h),m=a[p?"floating"===d?"reference":"floating":d],g=Xf(await o.getClippingRect({element:null==(r=await(null==o.isElement?void 0:o.isElement(m)))||r?m:m.contextElement||await(null==o.getDocumentElement?void 0:o.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),_="floating"===d?{x:n,y:i,width:s.floating.width,height:s.floating.height}:s.reference,y=await(null==o.getOffsetParent?void 0:o.getOffsetParent(a.floating)),v=await(null==o.isElement?void 0:o.isElement(y))&&await(null==o.getScale?void 0:o.getScale(y))||{x:1,y:1},b=Xf(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:_,offsetParent:y,strategy:l}):_);return{top:(g.top-b.top+f.top)/v.y,bottom:(b.bottom-g.bottom+f.bottom)/v.y,left:(g.left-b.left+f.left)/v.x,right:(b.right-g.right+f.right)/v.x}}const Cm=new Set(["left","top"]);function Tm(e){const t=ym(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const i=sm(e),o=i?e.offsetWidth:r,s=i?e.offsetHeight:n,a=Lf(r)!==o||Lf(n)!==s;return a&&(r=o,n=s),{width:r,height:n,$:a}}function Em(e){return om(e)?e:e.contextElement}function Rm(e){const t=Em(e);if(!sm(t))return zf(1);const r=t.getBoundingClientRect(),{width:n,height:i,$:o}=Tm(t);let s=(o?Lf(r.width):r.width)/n,a=(o?Lf(r.height):r.height)/i;return s&&Number.isFinite(s)||(s=1),a&&Number.isFinite(a)||(a=1),{x:s,y:a}}const Pm=zf(0);function Nm(e){const t=rm(e);return gm()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:Pm}function Om(e,t,r,n){void 0===t&&(t=!1),void 0===r&&(r=!1);const i=e.getBoundingClientRect(),o=Em(e);let s=zf(1);t&&(n?om(n)&&(s=Rm(n)):s=Rm(e));const a=function(e,t,r){return void 0===t&&(t=!1),!!r&&t&&r===rm(e)}(o,r,n)?Nm(o):zf(0);let l=(i.left+a.x)/s.x,c=(i.top+a.y)/s.y,u=i.width/s.x,d=i.height/s.y;if(o&&n){const e=rm(o),t=om(n)?rm(n):n;let r=e,i=jm(r);for(;i&&t!==r;){const e=Rm(i),t=i.getBoundingClientRect(),n=ym(i),o=t.left+(i.clientLeft+parseFloat(n.paddingLeft))*e.x,s=t.top+(i.clientTop+parseFloat(n.paddingTop))*e.y;l*=e.x,c*=e.y,u*=e.x,d*=e.y,l+=o,c+=s,r=rm(i),i=jm(r)}}return Xf({width:u,height:d,x:l,y:c})}function Am(e,t){const r=vm(e).scrollLeft;return t?t.left+r:Om(nm(e)).left+r}function Im(e,t){const r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-Am(e,r),y:r.top+t.scrollTop}}function Fm(e,t,r){let n;if("viewport"===t||"layoutViewport"===t)n=function(e,t,r){void 0===r&&(r="viewport");const n="layoutViewport"===r,i=rm(e),o=nm(e),s=i.visualViewport;let a=o.clientWidth,l=o.clientHeight,c=0,u=0;if(s){const e=!gm()||"fixed"===t;n?e||(c=-s.offsetLeft,u=-s.offsetTop):(a=s.width,l=s.height,e&&(c=s.offsetLeft,u=s.offsetTop))}if(Am(o)<=0){const e=o.ownerDocument,t=e.body,r=getComputedStyle(t),n="CSS1Compat"===e.compatMode&&parseFloat(r.marginLeft)+parseFloat(r.marginRight)||0,i=Math.abs(o.clientWidth-t.clientWidth-n),s="stable both-edges"===getComputedStyle(o).scrollbarGutter?i/2:i;s<=25&&(a-=s)}return{width:a,height:l,x:c,y:u}}(e,r,t);else if("document"===t)n=function(e){const t=vm(e),r=e.ownerDocument.body,n=Ff(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),i=Ff(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-t.scrollLeft+Am(e);const s=-t.scrollTop;return"rtl"===ym(r).direction&&(o+=Ff(e.clientWidth,r.clientWidth)-n),{width:n,height:i,x:o,y:s}}(nm(e));else if(om(t))n=function(e,t){const r=Om(e,!0,"fixed"===t),n=r.top+e.clientTop,i=r.left+e.clientLeft,o=Rm(e);return{width:e.clientWidth*o.x,height:e.clientHeight*o.y,x:i*o.x,y:n*o.y}}(t,r);else{const r=Nm(e);n={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return Xf(n)}function Lm(e,t,r){const n=sm(t),i=nm(t),o="fixed"===r,s=Om(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const l=zf(0);if((n||!o)&&(("body"!==tm(t)||lm(i))&&(a=vm(t)),n)){const e=Om(t,!0,o,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}!n&&i&&(l.x=Am(i));const c=!i||n||o?zf(0):Im(i,a);return{x:s.left+a.scrollLeft-l.x-c.x,y:s.top+a.scrollTop-l.y-c.y,width:s.width,height:s.height}}function Dm(e){return"static"===ym(e).position}function zm(e,t){if(!sm(e)||"fixed"===ym(e).position)return null;if(t)return t(e);let r=e.offsetParent;return nm(e)===r&&(r=r.ownerDocument.body),r}function Mm(e,t){const r=rm(e);if(um(e))return r;if(!sm(e)){let t=bm(e);for(;t&&!_m(t);){if(om(t)&&!Dm(t))return t;t=bm(t)}return r}let n=zm(e,t);for(;n&&cm(n)&&Dm(n);)n=zm(n,t);return n&&_m(n)&&Dm(n)&&!mm(n)?r:n||function(e){let t=bm(e);for(;sm(t)&&!_m(t);){if(mm(t))return t;if(um(t))return null;t=bm(t)}return null}(e)||r}const $m={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:r,offsetParent:n,strategy:i}=e;const o="fixed"===i,s=nm(n),a=!!t&&um(t.floating);if(n===s||a&&o)return r;let l={scrollLeft:0,scrollTop:0},c=zf(1);const u=zf(0),d=sm(n);if((d||!o)&&(("body"!==tm(n)||lm(s))&&(l=vm(n)),d)){const e=Om(n);c=Rm(n),u.x=e.x+n.clientLeft,u.y=e.y+n.clientTop}const p=!s||d||o?zf(0):Im(s,l);return{width:r.width*c.x,height:r.height*c.y,x:r.x*c.x-l.scrollLeft*c.x+u.x+p.x,y:r.y*c.y-l.scrollTop*c.y+u.y+p.y}},getDocumentElement:nm,getClippingRect:function(e){let{element:t,boundary:r,rootBoundary:n,strategy:i}=e;const o=[..."clippingAncestors"===r?um(t)?[]:function(e,t){const r=t.get(e);if(r)return r;let n=wm(e,[],!1).filter(e=>om(e)&&"body"!==tm(e)),i=null;const o="fixed"===ym(e).position;let s=o?bm(e):e;for(;om(s)&&!_m(s);){const e=ym(s),t=mm(s),r=i?i.position:o?"fixed":"";t||"fixed"!==r&&("absolute"!==r||"static"!==e.position)?i=e:n=n.filter(e=>e!==s),s=bm(s)}return t.set(e,n),n}(t,this._c):[].concat(r),n],s=Fm(t,o[0],i);let a=s.top,l=s.right,c=s.bottom,u=s.left;for(let e=1;e<o.length;e++){const r=Fm(t,o[e],i);a=Ff(r.top,a),l=If(r.right,l),c=If(r.bottom,c),u=Ff(r.left,u)}return{width:l-u,height:c-a,x:u,y:a}},getOffsetParent:Mm,getElementRects:async function(e){const t=this.getOffsetParent||Mm,r=this.getDimensions,n=await r(e.floating);return{reference:Lm(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}},getClientRects:function(e){return e.getClientRects?Array.from(e.getClientRects()):[]},getDimensions:function(e){const{width:t,height:r}=Tm(e);return{width:t,height:r}},getScale:Rm,isElement:om,isRTL:function(e){return"rtl"===ym(e).direction}};function Um(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Bm(e,t,r,n){void 0===n&&(n={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:s="function"==typeof ResizeObserver,layoutShift:a="function"==typeof IntersectionObserver,animationFrame:l=!1}=n,c=Em(e),u=i||o?[...c?wm(c):[],...t?wm(t):[]]:[];u.forEach(e=>{i&&e.addEventListener("scroll",r),o&&e.addEventListener("resize",r)});const d=c&&a?function(e,t,r){let n,i=null;const o=nm(e);function s(){var e;clearTimeout(n),null==(e=i)||e.disconnect(),i=null}function a(r,l){void 0===r&&(r=!1),void 0===l&&(l=1),s();const c=e.getBoundingClientRect(),{left:u,top:d,width:p,height:h}=c;if(r||t(),!p||!h)return;const f={rootMargin:-Df(d)+"px "+-Df(o.clientWidth-(u+p))+"px "+-Df(o.clientHeight-(d+h))+"px "+-Df(u)+"px",threshold:Ff(0,If(1,l))||1};let m=!0;function g(t){const r=t[0].intersectionRatio;if(!Um(c,e.getBoundingClientRect()))return a();if(r!==l){if(!m)return a();r?a(!1,r):n=setTimeout(()=>{a(!1,1e-7)},1e3)}m=!1}try{i=new IntersectionObserver(g,{...f,root:o.ownerDocument})}catch(e){i=new IntersectionObserver(g,f)}i.observe(e)}const l=rm(e),c=()=>a(r);return l.addEventListener("resize",c),a(!0),()=>{l.removeEventListener("resize",c),s()}}(c,r,o):null;let p,h=-1,f=null;s&&(f=new ResizeObserver(e=>{let[n]=e;n&&n.target===c&&f&&t&&(f.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var e;null==(e=f)||e.observe(t)})),r()}),c&&!l&&f.observe(c),t&&f.observe(t));let m=l?Om(e):null;return l&&function t(){const n=Om(e);m&&!Um(m,n)&&r(),m=n,p=requestAnimationFrame(t)}(),r(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener("scroll",r),o&&e.removeEventListener("resize",r)}),null==d||d(),null==(e=f)||e.disconnect(),f=null,l&&cancelAnimationFrame(p)}}const qm=km,Hm=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var r,n;const{placement:i,middlewareData:o,rects:s,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:p,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:f="none",flipAlignment:m=!0,...g}=$f(e,t);if(null!=(r=o.arrow)&&r.alignmentOffset)return{};const _=Uf(i),y=Wf(a),v=Uf(a)===a,b=await(null==l.isRTL?void 0:l.isRTL(c.floating)),x=p||(v||!m?[Yf(a)]:function(e){const t=Yf(e);return[Vf(e),t,Vf(t)]}(a)),w="none"!==f;!p&&w&&x.push(...function(e,t,r,n){const i=Bf(e);let o=function(e,t,r){switch(e){case"top":case"bottom":return r?t?Kf:Zf:t?Zf:Kf;case"left":case"right":return t?Qf:Jf;default:return[]}}(Uf(e),"start"===r,n);return i&&(o=o.map(e=>e+"-"+i),t&&(o=o.concat(o.map(Vf)))),o}(a,m,f,b));const j=[a,...x],S=await l.detectOverflow(t,g),k=[];let C=(null==(n=o.flip)?void 0:n.overflows)||[];if(u&&k.push(S[_]),d){const e=function(e,t,r){void 0===r&&(r=!1);const n=Bf(e),i=Gf(e),o=Hf(i);let s="x"===i?n===(r?"end":"start")?"right":"left":"start"===n?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=Yf(s)),[s,Yf(s)]}(i,s,b);k.push(S[e[0]],S[e[1]])}if(C=[...C,{placement:i,overflows:k}],!k.every(e=>e<=0)){var T,E;const e=((null==(T=o.flip)?void 0:T.index)||0)+1,t=j[e];if(t&&("alignment"!==d||y===Wf(t)||C.every(e=>Wf(e.placement)!==y||e.overflows[0]>0)))return{data:{index:e,overflows:C},reset:{placement:t}};let r=null==(E=C.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:E.placement;if(!r)switch(h){case"bestFit":{var R;const e=null==(R=C.filter(e=>{if(w){const t=Wf(e.placement);return t===y||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:R[0];e&&(r=e);break}case"initialPlacement":r=a}if(i!==r)return{reset:{placement:r}}}return{}}}},Wm=(e,t,r)=>{const n=new Map,i=null!=r?r:{},o={...$m,...i.platform,_c:n};return(async(e,t,r)=>{const{placement:n="bottom",strategy:i="absolute",middleware:o=[],platform:s}=r,a=s.detectOverflow?s:{...s,detectOverflow:km},l=await(null==s.isRTL?void 0:s.isRTL(t));let c=await s.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Sm(c,n,l),p=n,h=0;const f={};for(let r=0;r<o.length;r++){const m=o[r];if(!m)continue;const{name:g,fn:_}=m,{x:y,y:v,data:b,reset:x}=await _({x:u,y:d,initialPlacement:n,placement:p,strategy:i,middlewareData:f,rects:c,platform:a,elements:{reference:e,floating:t}});u=null!=y?y:u,d=null!=v?v:d,f[g]={...f[g],...b},x&&h<50&&(h++,"object"==typeof x&&(x.placement&&(p=x.placement),x.rects&&(c=!0===x.rects?await s.getElementRects({reference:e,floating:t,strategy:i}):x.rects),({x:u,y:d}=Sm(c,p,l))),r=-1)}return{x:u,y:d,placement:p,strategy:i,middlewareData:f}})(e,t,{...i,platform:o})};var Gm="undefined"!=typeof document?o().useLayoutEffect:function(){};function Vm(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let r,n,i;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(n=r;0!==n--;)if(!Vm(e[n],t[n]))return!1;return!0}if(i=Object.keys(e),r=i.length,r!==Object.keys(t).length)return!1;for(n=r;0!==n--;)if(!{}.hasOwnProperty.call(t,i[n]))return!1;for(n=r;0!==n--;){const r=i[n];if(!("_owner"===r&&e.$$typeof||Vm(e[r],t[r])))return!1}return!0}return e!=e&&t!=t}function Zm(e){return"undefined"==typeof window?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Km(e,t){const r=Zm(e);return Math.round(t*r)/r}function Qm(e){const t=o().useRef(e);return Gm(()=>{t.current=e}),t}const Jm=(e,t)=>{const r=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:i,y:o,placement:s,middlewareData:a}=t,l=await async function(e,t){const{placement:r,platform:n,elements:i}=e,o=await(null==n.isRTL?void 0:n.isRTL(i.floating)),s=Uf(r),a=Bf(r),l="y"===Wf(r),c=Cm.has(s)?-1:1,u=o&&l?-1:1,d=$f(t,e);let{mainAxis:p,crossAxis:h,alignmentAxis:f}="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&"number"==typeof f&&(h="end"===a?-1*f:f),l?{x:h*u,y:p*c}:{x:p*c,y:h*u}}(t,e);return s===(null==(r=a.offset)?void 0:r.placement)&&null!=(n=a.arrow)&&n.alignmentOffset?{}:{x:i+l.x,y:o+l.y,data:{...l,placement:s}}}}}(e);return{name:r.name,fn:r.fn,options:[e,t]}},Ym=(e,t)=>{const r=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:i,platform:o}=t,{mainAxis:s=!0,crossAxis:a=!1,limiter:l={fn:e=>{let{x:t,y:r}=e;return{x:t,y:r}}},...c}=$f(e,t),u={x:r,y:n},d=await o.detectOverflow(t,c),p=Wf(i),h=qf(p);let f=u[h],m=u[p];const g=(e,t)=>{return r=t+d["y"===e?"top":"left"],n=t,i=t-d["y"===e?"bottom":"right"],Ff(r,If(n,i));var r,n,i};s&&(f=g(h,f)),a&&(m=g(p,m));const _=l.fn({...t,[h]:f,[p]:m});return{..._,data:{x:_.x-r,y:_.y-n,enabled:{[h]:s,[p]:a}}}}}}(e);return{name:r.name,fn:r.fn,options:[e,t]}},Xm=(e,t)=>{const r=Hm(e);return{name:r.name,fn:r.fn,options:[e,t]}},eg=(e,t)=>{const r=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){const{placement:r,rects:n,platform:i,elements:o}=t,{apply:s=()=>{},...a}=$f(e,t),l=await i.detectOverflow(t,a),c=Uf(r),u=Bf(r),d="y"===Wf(r),{width:p,height:h}=n.floating;let f,m;"top"===c||"bottom"===c?(f=c,m=u===(await(null==i.isRTL?void 0:i.isRTL(o.floating))?"start":"end")?"left":"right"):(m=c,f="end"===u?"top":"bottom");const g=h-l.top-l.bottom,_=p-l.left-l.right,y=If(h-l[f],g),v=If(p-l[m],_),b=t.middlewareData.shift,x=!b;let w=y,j=v;null!=b&&b.enabled.x&&(j=_),null!=b&&b.enabled.y&&(w=g),x&&!u&&(d?j=p-2*Ff(l.left,l.right):w=h-2*Ff(l.top,l.bottom)),await s({...t,availableWidth:j,availableHeight:w});const S=await i.getDimensions(o.floating);return p!==S.width||h!==S.height?{reset:{rects:!0}}:{}}}}(e);return{name:r.name,fn:r.fn,options:[e,t]}},tg={...l()},rg=tg.useInsertionEffect||(e=>e());function ng(e){const t=o().useRef(()=>{});return rg(()=>{t.current=e}),o().useCallback(function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return null==t.current?void 0:t.current(...r)},[])}var ig="undefined"!=typeof document?o().useLayoutEffect:o().useEffect;let og=!1,sg=0;const ag=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+sg++,lg=tg.useId||function(){const[e,t]=o().useState(()=>og?ag():void 0);return ig(()=>{null==e&&t(ag())},[]),o().useEffect(()=>{og=!0},[]),e};const cg=o().createContext(null),ug=o().createContext(null),dg="data-floating-ui-focusable";function pg(e){void 0===e&&(e={});const{nodeId:t}=e,r=function(e){const{open:t=!1,onOpenChange:r,elements:n}=e,i=lg(),s=o().useRef({}),[a]=o().useState(()=>function(){const e=new Map;return{emit(t,r){var n;null==(n=e.get(t))||n.forEach(e=>e(r))},on(t,r){e.set(t,[...e.get(t)||[],r])},off(t,r){var n;e.set(t,(null==(n=e.get(t))?void 0:n.filter(e=>e!==r))||[])}}}()),l=null!=((null==(f=o().useContext(cg))?void 0:f.id)||null),[c,u]=o().useState(n.reference),d=ng((e,t,n)=>{s.current.openEvent=e?t:void 0,a.emit("openchange",{open:e,event:t,reason:n,nested:l}),null==r||r(e,t,n)}),p=o().useMemo(()=>({setPositionReference:u}),[]),h=o().useMemo(()=>({reference:c||n.reference||null,floating:n.floating||null,domReference:n.reference}),[c,n.reference,n.floating]);var f;return o().useMemo(()=>({dataRef:s,open:t,onOpenChange:d,elements:h,events:a,floatingId:i,refs:p}),[t,d,h,a,i,p])}({...e,elements:{reference:null,floating:null,...e.elements}}),n=e.rootContext||r,i=n.elements,[a,l]=o().useState(null),[c,u]=o().useState(null),d=(null==i?void 0:i.domReference)||a,p=o().useRef(null),h=o().useContext(ug);ig(()=>{d&&(p.current=d)},[d]);const f=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:i,elements:{reference:a,floating:l}={},transform:c=!0,whileElementsMounted:u,open:d}=e,[p,h]=o().useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[f,m]=o().useState(n);Vm(f,n)||m(n);const[g,_]=o().useState(null),[y,v]=o().useState(null),b=o().useCallback(e=>{e!==S.current&&(S.current=e,_(e))},[]),x=o().useCallback(e=>{e!==k.current&&(k.current=e,v(e))},[]),w=a||g,j=l||y,S=o().useRef(null),k=o().useRef(null),C=o().useRef(p),T=null!=u,E=Qm(u),R=Qm(i),P=Qm(d),N=o().useCallback(()=>{if(!S.current||!k.current)return;const e={placement:t,strategy:r,middleware:f};R.current&&(e.platform=R.current),Wm(S.current,k.current,e).then(e=>{const t={...e,isPositioned:!1!==P.current};O.current&&!Vm(C.current,t)&&(C.current=t,s.flushSync(()=>{h(t)}))})},[f,t,r,R,P]);Gm(()=>{!1===d&&C.current.isPositioned&&(C.current.isPositioned=!1,h(e=>({...e,isPositioned:!1})))},[d]);const O=o().useRef(!1);Gm(()=>(O.current=!0,()=>{O.current=!1}),[]),Gm(()=>{if(w&&(S.current=w),j&&(k.current=j),w&&j){if(E.current)return E.current(w,j,N);N()}},[w,j,N,E,T]);const A=o().useMemo(()=>({reference:S,floating:k,setReference:b,setFloating:x}),[b,x]),I=o().useMemo(()=>({reference:w,floating:j}),[w,j]),F=o().useMemo(()=>{const e={position:r,left:0,top:0};if(!I.floating)return e;const t=Km(I.floating,p.x),n=Km(I.floating,p.y);return c?{...e,transform:"translate("+t+"px, "+n+"px)",...Zm(I.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}},[r,c,I.floating,p.x,p.y]);return o().useMemo(()=>({...p,update:N,refs:A,elements:I,floatingStyles:F}),[p,N,A,I,F])}({...e,elements:{...i,...c&&{reference:c}}}),m=o().useCallback(e=>{const t=om(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;u(t),f.refs.setReference(t)},[f.refs]),g=o().useCallback(e=>{(om(e)||null===e)&&(p.current=e,l(e)),(om(f.refs.reference.current)||null===f.refs.reference.current||null!==e&&!om(e))&&f.refs.setReference(e)},[f.refs]),_=o().useMemo(()=>({...f.refs,setReference:g,setPositionReference:m,domReference:p}),[f.refs,g,m]),y=o().useMemo(()=>({...f.elements,domReference:d}),[f.elements,d]),v=o().useMemo(()=>({...f,...n,refs:_,elements:y,nodeId:t}),[f,_,y,t,n]);return ig(()=>{n.dataRef.current.floatingContext=v;const e=null==h?void 0:h.nodesRef.current.find(e=>e.id===t);e&&(e.context=v)}),o().useMemo(()=>({...f,context:v,refs:_,elements:y}),[f,_,y,v])}const hg="active",fg="selected";function mg(e,t,r){const n=new Map,i="item"===r;let o=e;if(i&&e){const{[hg]:t,[fg]:__,...r}=e;o=r}return{..."floating"===r&&{tabIndex:-1,[dg]:""},...o,...t.map(t=>{const n=t?t[r]:null;return"function"==typeof n?e?n(e):null:n}).concat(e).reduce((e,t)=>t?(Object.entries(t).forEach(t=>{let[r,o]=t;var s;i&&[hg,fg].includes(r)||(0===r.indexOf("on")?(n.has(r)||n.set(r,[]),"function"==typeof o&&(null==(s=n.get(r))||s.push(o),e[r]=function(){for(var e,t=arguments.length,i=new Array(t),o=0;o<t;o++)i[o]=arguments[o];return null==(e=n.get(r))?void 0:e.map(e=>e(...i)).find(e=>void 0!==e)})):e[r]=o)}),e):e,{})}}function gg(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}let _g=(0,o().createContext)({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});_g.displayName="FloatingContext";let yg=(0,o().createContext)(null);function vg(e=null){!1===e&&(e=null),"string"==typeof e&&(e={to:e});let t=(0,o().useContext)(yg),r=(0,o().useMemo)(()=>e,[JSON.stringify(e,(e,t)=>{var r;return null!=(r=null==t?void 0:t.outerHTML)?r:t})]);Yp(()=>{null==t||t(null!=r?r:null)},[t,r]);let n=(0,o().useContext)(_g);return(0,o().useMemo)(()=>[n.setFloating,e?n.styles:{}],[n.setFloating,e,n.styles])}function bg({children:e,enabled:t=!0}){let[r,n]=(0,o().useState)(null),[i,a]=(0,o().useState)(0),l=(0,o().useRef)(null),[c,u]=(0,o().useState)(null);!function(e){Yp(()=>{if(!e)return;let t=new MutationObserver(()=>{let t=window.getComputedStyle(e).maxHeight,r=parseFloat(t);if(isNaN(r))return;let n=parseInt(t);isNaN(n)||r!==n&&(e.style.maxHeight=`${Math.ceil(r)}px`)});return t.observe(e,{attributes:!0,attributeFilter:["style"]}),()=>{t.disconnect()}},[e])}(c);let d=t&&null!==r&&null!==c,{to:p="bottom",gap:h=0,offset:f=0,padding:m=0,inner:g}=function(e,t){var r,n,i;let o=xg(null!=(r=null==e?void 0:e.gap)?r:"var(--anchor-gap, 0)",t),s=xg(null!=(n=null==e?void 0:e.offset)?n:"var(--anchor-offset, 0)",t),a=xg(null!=(i=null==e?void 0:e.padding)?i:"var(--anchor-padding, 0)",t);return{...e,gap:o,offset:s,padding:a}}(r,c),[_,y="center"]=p.split(" ");Yp(()=>{d&&a(0)},[d]);let{refs:v,floatingStyles:b,context:x}=pg({open:d,placement:"selection"===_?"center"===y?"bottom":`bottom-${y}`:"center"===y?`${_}`:`${_}-${y}`,strategy:"absolute",transform:!1,middleware:[Jm({mainAxis:"selection"===_?0:h,crossAxis:f}),Ym({padding:m}),"selection"!==_&&Xm({padding:m}),"selection"===_&&g?(S={...g,padding:m,overflowRef:l,offset:i,minItemsVisible:4,referenceOverflowThreshold:m,onFallbackChange(e){var t,r;if(!e)return;let n=x.elements.floating;if(!n)return;let i=parseFloat(getComputedStyle(n).scrollPaddingBottom)||0,o=Math.min(4,n.childElementCount),s=0,l=0;for(let e of null!=(r=null==(t=x.elements.floating)?void 0:t.childNodes)?r:[])if(oh(e)){let t=e.offsetTop,r=t+e.clientHeight+i,a=n.scrollTop,c=a+n.clientHeight;if(!(t>=a&&r<=c)){l=Math.max(0,Math.min(r,c)-Math.max(t,a)),s=e.clientHeight;break}o--}o>=1&&a(e=>{let t=s*o-l+i;return e>=t?e:t})}},{name:"inner",options:S,async fn(e){const{listRef:t,overflowRef:r,onFallbackChange:n,offset:i=0,index:o=0,minItemsVisible:a=4,referenceOverflowThreshold:l=0,scrollRef:c,...u}=$f(S,e),{rects:d,elements:{floating:p}}=e,h=t.current[o],f=(null==c?void 0:c.current)||p,m=p.clientTop||f.clientTop,g=0!==p.clientTop,_=0!==f.clientTop,y=p===f;if(!h)return{};const v={...e,...await Jm(-h.offsetTop-p.clientTop-d.reference.height/2-h.offsetHeight/2-i).fn(e)},b=await qm(gg(v,f.scrollHeight+m+p.clientTop),u),x=await qm(v,{...u,elementContext:"reference"}),w=Ff(0,b.top),j=v.y+w,k=f.scrollHeight>f.clientHeight?e=>e:Lf,C=k(Ff(0,f.scrollHeight+(g&&y||_?2*m:0)-w-Ff(0,b.bottom)));if(f.style.maxHeight=C+"px",f.scrollTop=w,n){const e=f.offsetHeight<h.offsetHeight*If(a,t.current.length)-1||x.top>=-l||x.bottom>=-l;s.flushSync(()=>n(e))}return r&&(r.current=await qm(gg({...v,y:j},f.offsetHeight+m+p.clientTop),u)),{y:j}}}):null,eg({padding:m,apply({availableWidth:e,availableHeight:t,elements:r}){Object.assign(r.floating.style,{overflow:"auto",maxWidth:`${e}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${t}px)`})}})].filter(Boolean),whileElementsMounted:Bm}),[w=_,j=y]=x.placement.split("-");var S;"selection"===_&&(w="selection");let k=(0,o().useMemo)(()=>({anchor:[w,j].filter(Boolean).join(" ")}),[w,j]),C=function(e,t){const{open:r,elements:n}=e,{enabled:i=!0,overflowRef:a,scrollRef:l,onChange:c}=t,u=ng(c),d=o().useRef(!1),p=o().useRef(null),h=o().useRef(null);o().useEffect(()=>{if(!i)return;function e(e){if(e.ctrlKey||!t||null==a.current)return;const r=e.deltaY,n=a.current.top>=-.5,i=a.current.bottom>=-.5,o=t.scrollHeight-t.clientHeight,l=r<0?-1:1,c=r<0?"max":"min";t.scrollHeight<=t.clientHeight||(!n&&r>0||!i&&r<0?(e.preventDefault(),s.flushSync(()=>{u(e=>e+Math[c](r,o*l))})):/firefox/i.test(function(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(e=>{let{brand:t,version:r}=e;return t+"/"+r}).join(" "):navigator.userAgent}())&&(t.scrollTop+=r))}const t=(null==l?void 0:l.current)||n.floating;return r&&t?(t.addEventListener("wheel",e),requestAnimationFrame(()=>{p.current=t.scrollTop,null!=a.current&&(h.current={...a.current})}),()=>{p.current=null,h.current=null,t.removeEventListener("wheel",e)}):void 0},[i,r,n.floating,a,l,u]);const f=o().useMemo(()=>({onKeyDown(){d.current=!0},onWheel(){d.current=!1},onPointerMove(){d.current=!1},onScroll(){const e=(null==l?void 0:l.current)||n.floating;if(a.current&&e&&d.current){if(null!==p.current){const t=e.scrollTop-p.current;(a.current.bottom<-.5&&t<-1||a.current.top<-.5&&t>1)&&s.flushSync(()=>u(e=>e+t))}requestAnimationFrame(()=>{p.current=e.scrollTop})}}}),[n.floating,u,a,l]);return o().useMemo(()=>i?{floating:f}:{},[i,f])}(x,{overflowRef:l,onChange:a}),{getReferenceProps:T,getFloatingProps:E}=function(e){void 0===e&&(e=[]);const t=e.map(e=>null==e?void 0:e.reference),r=e.map(e=>null==e?void 0:e.floating),n=e.map(e=>null==e?void 0:e.item),i=o().useCallback(t=>mg(t,e,"reference"),t),s=o().useCallback(t=>mg(t,e,"floating"),r),a=o().useCallback(t=>mg(t,e,"item"),n);return o().useMemo(()=>({getReferenceProps:i,getFloatingProps:s,getItemProps:a}),[i,s,a])}([C]),R=eh(e=>{u(e),v.setFloating(e)});return o().createElement(yg.Provider,{value:n},o().createElement(_g.Provider,{value:{setFloating:R,setReference:v.setReference,styles:b,getReferenceProps:T,getFloatingProps:E,slot:k}},e))}function xg(e,t,r=void 0){let n=Jp(),i=eh((e,t)=>{if(null==e)return[r,null];if("number"==typeof e)return[e,null];if("string"==typeof e){if(!t)return[r,null];let i=jg(e,t);return[i,r=>{let o=wg(e);{let s=o.map(e=>window.getComputedStyle(t).getPropertyValue(e));n.requestAnimationFrame(function a(){n.nextFrame(a);let l=!1;for(let[e,r]of o.entries()){let n=window.getComputedStyle(t).getPropertyValue(r);if(s[e]!==n){s[e]=n,l=!0;break}}if(!l)return;let c=jg(e,t);i!==c&&(r(c),i=c)})}return n.dispose}]}return[r,null]}),s=(0,o().useMemo)(()=>i(e,t)[0],[e,t]),[a=s,l]=(0,o().useState)();return Yp(()=>{let[r,n]=i(e,t);if(l(r),n)return n(l)},[e,t]),a}function wg(e){let t=/var\((.*)\)/.exec(e);if(t){let e=t[1].indexOf(",");if(-1===e)return[t[1]];let r=t[1].slice(0,e).trim(),n=t[1].slice(e+1).trim();return n?[r,...wg(n)]:[r]}return[]}function jg(e,t){let r=document.createElement("div");t.appendChild(r),r.style.setProperty("margin-top","0px","important"),r.style.setProperty("margin-top",e,"important");let n=parseFloat(window.getComputedStyle(r).marginTop)||0;return t.removeChild(r),n}yg.displayName="PlacementContext";let Sg=(0,o().createContext)(null);Sg.displayName="OpenClosedContext";var kg=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(kg||{});function Cg(){return(0,o().useContext)(Sg)}function Tg({value:e,children:t}){return o().createElement(Sg.Provider,{value:e},t)}function Eg({children:e}){return o().createElement(Sg.Provider,{value:null},e)}function Rg(e){let t=e.parentElement,r=null;for(;t&&!ah(t);)lh(t)&&(r=t),t=t.parentElement;let n=""===(null==t?void 0:t.getAttribute("disabled"));return(!n||!function(e){if(!e)return!1;let t=e.previousElementSibling;for(;null!==t;){if(lh(t))return!1;t=t.previousElementSibling}return!0}(r))&&n}var Pg=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(Pg||{});function Ng(e){let t=eh(e),r=(0,o().useRef)(!1);(0,o().useEffect)(()=>(r.current=!1,()=>{r.current=!0,Kp(()=>{r.current&&t()})}),[t])}let Og=(0,o().createContext)(!1);let Ag=o().Fragment,Ig=Lh(function(e,t){let{ownerDocument:r=null,...n}=e,i=(0,o().useRef)(null),a=Sf(jf(e=>{i.current=e}),t),c=Th(i.current),u=function(e){let t=(0,o().useContext)(Og),r=(0,o().useContext)(Lg),[n,i]=(0,o().useState)(()=>{var n;if(!t&&null!==r)return null!=(n=r.current)?n:null;if(Wp.isServer)return null;let i=null==e?void 0:e.getElementById("headlessui-portal-root");if(i)return i;if(null===e)return null;let o=e.createElement("div");return o.setAttribute("id","headlessui-portal-root"),e.body.appendChild(o)});return(0,o().useEffect)(()=>{null!==n&&(null!=e&&e.body.contains(n)||null==e||e.body.appendChild(n))},[n,e]),(0,o().useEffect)(()=>{t||null!==r&&i(r.current)},[r,i,t]),n}(null!=r?r:c),d=(0,o().useContext)(Dg),p=Jp(),h=function(){let e=function(){let e="undefined"==typeof document;return"useSyncExternalStore"in l()&&(e=>e.useSyncExternalStore)(l())(()=>()=>{},()=>!1,()=>!e)}(),[t,r]=o().useState(Wp.isHandoffComplete);return t&&!1===Wp.isHandoffComplete&&r(!1),o().useEffect(()=>{!0!==t&&r(!0)},[t]),o().useEffect(()=>Wp.handoff(),[]),!e&&t}(),f=Nh();return Ng(()=>{var e;u&&u.childNodes.length<=0&&(null==(e=u.parentElement)||e.removeChild(u))}),u&&h?(0,s.createPortal)(o().createElement("div",{"data-headlessui-portal":"",ref:e=>{p.dispose(),d&&e&&p.add(d.register(e))}},f({ourProps:{ref:a},theirProps:n,slot:{},defaultTag:Ag,name:"Portal"})),u):null}),Fg=o().Fragment,Lg=(0,o().createContext)(null),Dg=(0,o().createContext)(null),zg=Lh(function(e,t){let r=Sf(t),{enabled:n=!0,ownerDocument:i,...s}=e,a=Nh();return n?o().createElement(Ig,{...s,ownerDocument:i,ref:r}):a({ourProps:{ref:r},theirProps:s,slot:{},defaultTag:Ag,name:"Portal"})}),Mg=Lh(function(e,t){let{target:r,...n}=e,i={ref:Sf(t)},s=Nh();return o().createElement(Lg.Provider,{value:r},s({ourProps:i,theirProps:n,defaultTag:Fg,name:"Popover.Group"}))}),$g=Object.assign(zg,{Group:Mg});var Ug=Object.defineProperty,Bg=(e,t,r)=>(((e,t,r)=>{t in e?Ug(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r})(e,"symbol"!=typeof t?t+"":t,r),r),qg=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(qg||{}),Hg=(e=>(e[e.OpenPopover=0]="OpenPopover",e[e.ClosePopover=1]="ClosePopover",e[e.SetButton=2]="SetButton",e[e.SetButtonId=3]="SetButtonId",e[e.SetPanel=4]="SetPanel",e[e.SetPanelId=5]="SetPanelId",e))(Hg||{});let Wg={0:e=>0===e.popoverState?e:{...e,popoverState:0,__demoMode:!1},1:e=>1===e.popoverState?e:{...e,popoverState:1,__demoMode:!1},2:(e,t)=>e.button===t.button?e:{...e,button:t.button},3:(e,t)=>e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId},4:(e,t)=>e.panel===t.panel?e:{...e,panel:t.panel},5:(e,t)=>e.panelId===t.panelId?e:{...e,panelId:t.panelId}};class Gg extends lf{constructor(e){super(e),Bg(this,"actions",{close:()=>this.send({type:1}),refocusableClose:e=>{this.actions.close();let t=(()=>e?oh(e)?e:"current"in e&&oh(e.current)?e.current:this.state.button:this.state.button)();null==t||t.focus()},open:()=>this.send({type:0}),setButtonId:e=>this.send({type:3,buttonId:e}),setButton:e=>this.send({type:2,button:e}),setPanelId:e=>this.send({type:5,panelId:e}),setPanel:e=>this.send({type:4,panel:e})}),Bg(this,"selectors",{isPortalled:e=>{var t;if(!e.button||!e.panel)return!1;let r=null!=(t=Gp(e.button))?t:document;for(let t of r.querySelectorAll("body > *"))if(Number(null==t?void 0:t.contains(e.button))^Number(null==t?void 0:t.contains(e.panel)))return!0;let n=gh(r),i=n.indexOf(e.button),o=(i+n.length-1)%n.length,s=(i+1)%n.length,a=n[o],l=n[s];return!e.panel.contains(a)&&!e.panel.contains(l)}});{let e=this.state.id,t=_f.get(null);this.on(0,()=>t.actions.push(e)),this.on(1,()=>t.actions.pop(e))}}static new({id:e,__demoMode:t=!1}){return new Gg({id:e,__demoMode:t,popoverState:t?0:1,buttons:{current:[]},button:null,buttonId:null,panel:null,panelId:null,beforePanelSentinel:{current:null},afterPanelSentinel:{current:null},afterButtonSentinel:{current:null}})}reduce(e,t){return ch(t.type,Wg,e,t)}}const Vg=(0,o().createContext)(null);function Zg(e){let t=(0,o().useContext)(Vg);if(null===t){let t=new Error(`<${e} /> is missing a parent <Popover /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,Zg),t}return t}let Kg=(0,o().createContext)(null);function Qg(){return(0,o().useContext)(Kg)}Kg.displayName="PopoverGroupContext";let Jg=(0,o().createContext)(null);Jg.displayName="PopoverPanelContext";let Yg=Rh.RenderStrategy|Rh.Static;function Xg(e,t){let r=(0,o().useId)(),{id:n=`headlessui-popover-backdrop-${r}`,transition:i=!1,...s}=e,a=Zg("Popover.Backdrop"),l=yf(a,(0,o().useCallback)(e=>e.popoverState,[])),[c,u]=(0,o().useState)(null),d=Sf(t,u),p=Cg(),[h,f]=Nf(i,c,null!==p?(p&kg.Open)===kg.Open:l===qg.Open),m=eh(e=>{if(Rg(e.currentTarget))return e.preventDefault();a.actions.close()}),g=xf({open:l===qg.Open}),_={ref:d,id:n,"aria-hidden":!0,onClick:m,...Pf(f)};return Nh()({ourProps:_,theirProps:s,slot:g,defaultTag:"div",features:Yg,visible:h,name:"Popover.Backdrop"})}let e_=Rh.RenderStrategy|Rh.Static,t_=Lh(function(e,t){var r;let n=(0,o().useId)(),{__demoMode:i=!1,...s}=e,a=function({id:e,__demoMode:t=!1}){let r=(0,o().useMemo)(()=>Gg.new({id:e,__demoMode:t}),[]);return Ng(()=>r.dispose()),r}({id:n,__demoMode:i}),l=(0,o().useRef)(null),c=Sf(t,jf(e=>{l.current=e})),[u,d,p,h,f]=yf(a,(0,o().useCallback)(e=>[e.popoverState,e.button,e.panel,e.buttonId,e.panelId],[])),m=function(...e){return(0,o().useMemo)(()=>Vp(...e),[...e])}(null!=(r=l.current)?r:d),g=Xp(h),_=Xp(f),y=(0,o().useMemo)(()=>({buttonId:g,panelId:_,close:a.actions.close}),[g,_,a]),v=Qg(),b=null==v?void 0:v.registerPopover,x=eh(()=>{var e,t;let r=Zp(null!=(e=l.current)?e:d);return null!=(t=null==v?void 0:v.isFocusWithinPopoverGroup())?t:r&&((null==d?void 0:d.contains(r))||(null==p?void 0:p.contains(r)))});(0,o().useEffect)(()=>null==b?void 0:b(y),[b,y]);let[w,j]=function(){let e=(0,o().useContext)(Dg),t=(0,o().useRef)([]),r=eh(r=>(t.current.push(r),e&&e.register(r),()=>n(r))),n=eh(r=>{let n=t.current.indexOf(r);-1!==n&&t.current.splice(n,1),e&&e.unregister(r)}),i=(0,o().useMemo)(()=>({register:r,unregister:n,portals:t}),[r,n,t]);return[t,(0,o().useMemo)(()=>function({children:e}){return o().createElement(Dg.Provider,{value:i},e)},[i])]}(),S=Vh(d),k=function({defaultContainers:e=[],portals:t,mainTreeNode:r}={}){let n=eh(()=>{var n,i;let o=Gp(r),s=[];for(let t of e)null!==t&&(ih(t)?s.push(t):"current"in t&&ih(t.current)&&s.push(t.current));if(null!=t&&t.current)for(let e of t.current)s.push(e);for(let e of null!=(n=null==o?void 0:o.querySelectorAll("html > *, body > *"))?n:[])e!==document.body&&e!==document.head&&ih(e)&&"headlessui-portal-root"!==e.id&&(r&&(e.contains(r)||e.contains(null==(i=null==r?void 0:r.getRootNode())?void 0:i.host))||s.some(t=>e.contains(t))||s.push(e));return s});return{resolveContainers:n,contains:eh(e=>n().some(t=>t.contains(e)))}}({mainTreeNode:S,portals:w,defaultContainers:[{get current(){return a.state.button}},{get current(){return a.state.panel}}]});!function(e,t,r,n){let i=Xp(r);(0,o().useEffect)(()=>{function r(e){i.current(e)}return(e=null!=e?e:window).addEventListener(t,r,n),()=>e.removeEventListener(t,r,n)},[e,t,n])}(m,"focus",e=>{var t,r,n,i,o,s;e.target!==window&&sh(e.target)&&a.state.popoverState===qg.Open&&(x()||a.state.button&&a.state.panel&&(k.contains(e.target)||null!=(r=null==(t=a.state.beforePanelSentinel.current)?void 0:t.contains)&&r.call(t,e.target)||null!=(i=null==(n=a.state.afterPanelSentinel.current)?void 0:n.contains)&&i.call(n,e.target)||null!=(s=null==(o=a.state.afterButtonSentinel.current)?void 0:o.contains)&&s.call(o,e.target)||a.actions.close()))},!0),Ch(u===qg.Open,k.resolveContainers,(e,t)=>{a.actions.close(),yh(t,_h.Loose)||(e.preventDefault(),null==d||d.focus())});let C=xf({open:u===qg.Open,close:a.actions.refocusableClose}),T=yf(a,(0,o().useCallback)(e=>ch(e.popoverState,{[qg.Open]:kg.Open,[qg.Closed]:kg.Closed}),[])),E={ref:c},R=Nh();return o().createElement(Gh,{node:S},o().createElement(bg,null,o().createElement(Jg.Provider,{value:null},o().createElement(Vg.Provider,{value:a},o().createElement(Af,{value:a.actions.refocusableClose},o().createElement(Tg,{value:T},o().createElement(j,null,R({ourProps:E,theirProps:s,slot:C,defaultTag:"div",name:"Popover"}))))))))}),r_=Lh(function(e,t){let r=(0,o().useId)(),{id:n=`headlessui-popover-button-${r}`,disabled:i=!1,autoFocus:s=!1,...a}=e,l=Zg("Popover.Button"),[c,u,d,p,h,f,m]=yf(l,(0,o().useCallback)(e=>[e.popoverState,l.selectors.isPortalled(e),e.button,e.buttonId,e.panel,e.panelId,e.afterButtonSentinel],[])),g=(0,o().useRef)(null),_=`headlessui-focus-sentinel-${(0,o().useId)()}`,y=Qg(),v=null==y?void 0:y.closeOthers,b=null!==(0,o().useContext)(Jg);(0,o().useEffect)(()=>{if(!b)return l.actions.setButtonId(n),()=>l.actions.setButtonId(null)},[b,n,l]);let[x]=(0,o().useState)(()=>Symbol()),w=Sf(g,t,(0,o().useContext)(_g).setReference,eh(e=>{if(!b){if(e)l.state.buttons.current.push(x);else{let e=l.state.buttons.current.indexOf(x);-1!==e&&l.state.buttons.current.splice(e,1)}l.state.buttons.current.length>1&&console.warn("You are already using a <Popover.Button /> but only 1 <Popover.Button /> is supported."),e&&l.actions.setButton(e)}})),j=Sf(g,t),S=eh(e=>{var t,r,n;if(b){if(l.state.popoverState===qg.Closed)return;switch(e.key){case Pg.Space:case Pg.Enter:e.preventDefault(),null==(r=(t=e.target).click)||r.call(t),l.actions.close(),null==(n=l.state.button)||n.focus()}}else switch(e.key){case Pg.Space:case Pg.Enter:e.preventDefault(),e.stopPropagation(),l.state.popoverState===qg.Closed?(null==v||v(l.state.buttonId),l.actions.open()):l.actions.close();break;case Pg.Escape:if(l.state.popoverState!==qg.Open)return null==v?void 0:v(l.state.buttonId);if(!g.current)return;let t=Zp(g.current);if(t&&!g.current.contains(t))return;e.preventDefault(),e.stopPropagation(),l.actions.close()}}),k=eh(e=>{b||e.key===Pg.Space&&e.preventDefault()}),C=eh(e=>{var t,r;Rg(e.currentTarget)||i||(b?(l.actions.close(),null==(t=l.state.button)||t.focus()):(e.preventDefault(),e.stopPropagation(),l.state.popoverState===qg.Closed?(null==v||v(l.state.buttonId),l.actions.open()):l.actions.close(),null==(r=l.state.button)||r.focus()))}),T=eh(e=>{e.preventDefault(),e.stopPropagation()}),{isFocusVisible:E,focusProps:R}=Dp({autoFocus:s}),{isHovered:P,hoverProps:N}=Bp({isDisabled:i}),{pressed:O,pressProps:A}=th({disabled:i}),I=c===qg.Open,F=xf({open:I,active:O||I,disabled:i,hover:P,focus:E,autofocus:s}),L=function(e,t){return(0,o().useMemo)(()=>{var r;if(e.type)return e.type;let n=null!=(r=e.as)?r:"button";return"string"==typeof n&&"button"===n.toLowerCase()||"BUTTON"===(null==t?void 0:t.tagName)&&!t.hasAttribute("type")?"button":void 0},[e.type,e.as,t])}(e,d),D=Fh(b?{ref:j,type:L,onKeyDown:S,onClick:C,disabled:i||void 0,autoFocus:s}:{ref:w,id:p,type:L,"aria-expanded":c===qg.Open,"aria-controls":h?f:void 0,disabled:i||void 0,autoFocus:s,onKeyDown:S,onKeyUp:k,onClick:C,onMouseDown:T},R,N,A),z=Ef(),M=eh(()=>{if(!oh(l.state.panel))return;let e=l.state.panel;ch(z.current,{[Tf.Forwards]:()=>xh(e,hh.First),[Tf.Backwards]:()=>xh(e,hh.Last)})===fh.Error&&xh(gh(Vp(l.state.button)).filter(e=>"true"!==e.dataset.headlessuiFocusGuard),ch(z.current,{[Tf.Forwards]:hh.Next,[Tf.Backwards]:hh.Previous}),{relativeTo:l.state.button})}),$=Nh();return o().createElement(o().Fragment,null,$({ourProps:D,theirProps:a,slot:F,defaultTag:"button",name:"Popover.Button"}),I&&!b&&u&&o().createElement(Hh,{id:_,ref:m,features:qh.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:M}))}),n_=Lh(Xg),i_=Lh(Xg),o_=Lh(function(e,t){let r=(0,o().useId)(),{id:n=`headlessui-popover-panel-${r}`,focus:i=!1,anchor:s,portal:a=!1,modal:l=!1,transition:c=!1,...u}=e,d=Zg("Popover.Panel"),p=yf(d,d.selectors.isPortalled),[h,f,m,g,_]=yf(d,(0,o().useCallback)(e=>[e.popoverState,e.button,e.__demoMode,e.beforePanelSentinel,e.afterPanelSentinel],[])),y=`headlessui-focus-sentinel-before-${r}`,v=`headlessui-focus-sentinel-after-${r}`,b=(0,o().useRef)(null),x=function(e){return(0,o().useMemo)(()=>e?"string"==typeof e?{to:e}:e:null,[e])}(s),[w,j]=vg(x),S=function(){let{getFloatingProps:e,slot:t}=(0,o().useContext)(_g);return(0,o().useCallback)((...r)=>Object.assign({},e(...r),{"data-anchor":t.anchor}),[e,t])}();x&&(a=!0);let[k,C]=(0,o().useState)(null),T=Sf(b,t,x?w:null,d.actions.setPanel,C),E=Th(f),R=Th(b.current);Yp(()=>(d.actions.setPanelId(n),()=>d.actions.setPanelId(null)),[n,d]);let P=Cg(),[N,O]=Nf(c,k,null!==P?(P&kg.Open)===kg.Open:h===qg.Open);(function(e,t,r){let n=Xp(e=>{let t=e.getBoundingClientRect();0===t.x&&0===t.y&&0===t.width&&0===t.height&&r()});(0,o().useEffect)(()=>{if(!e)return;let r=null===t?null:oh(t)?t:t.current;if(!r)return;let i=Qp();if("undefined"!=typeof ResizeObserver){let e=new ResizeObserver(()=>n.current(r));e.observe(r),i.add(()=>e.disconnect())}if("undefined"!=typeof IntersectionObserver){let e=new IntersectionObserver(()=>n.current(r));e.observe(r),i.add(()=>e.disconnect())}return()=>i.dispose()},[t,n,e])})(N,f,d.actions.close),bf(!m&&l&&N,R);let A=eh(e=>{var t;if(e.key===Pg.Escape){if(d.state.popoverState!==qg.Open||!b.current)return;let r=Zp(b.current);if(r&&!b.current.contains(r))return;e.preventDefault(),e.stopPropagation(),d.actions.close(),null==(t=d.state.button)||t.focus()}});(0,o().useEffect)(()=>{var t;e.static||h===qg.Closed&&(null==(t=e.unmount)||t)&&d.actions.setPanel(null)},[h,e.unmount,e.static,d]),(0,o().useEffect)(()=>{if(m||!i||h!==qg.Open||!b.current)return;let e=Zp(b.current);b.current.contains(e)||xh(b.current,hh.First)},[m,i,b.current,h]);let I=xf({open:h===qg.Open,close:d.actions.refocusableClose}),F=Fh(x?S():{},{ref:T,id:n,onKeyDown:A,onBlur:i&&h===qg.Open?e=>{var t,r,n,i,o;let s=e.relatedTarget;s&&b.current&&(null!=(t=b.current)&&t.contains(s)||(d.actions.close(),(null!=(n=null==(r=g.current)?void 0:r.contains)&&n.call(r,s)||null!=(o=null==(i=_.current)?void 0:i.contains)&&o.call(i,s))&&s.focus({preventScroll:!0})))}:void 0,tabIndex:-1,style:{...u.style,...j,"--button-width":nh(N,f,!0).width},...Pf(O)}),L=Ef(),D=eh(()=>{let e=b.current;e&&ch(L.current,{[Tf.Forwards]:()=>{var t;xh(e,hh.First)===fh.Error&&(null==(t=d.state.afterPanelSentinel.current)||t.focus())},[Tf.Backwards]:()=>{var e;null==(e=d.state.button)||e.focus({preventScroll:!0})}})}),z=eh(()=>{let e=b.current;e&&ch(L.current,{[Tf.Forwards]:()=>{var e;if(!d.state.button)return;let t=gh(null!=(e=Vp(d.state.button))?e:document.body),r=t.indexOf(d.state.button),n=t.slice(0,r+1),i=[...t.slice(r+1),...n];for(let e of i.slice())if("true"===e.dataset.headlessuiFocusGuard||null!=k&&k.contains(e)){let t=i.indexOf(e);-1!==t&&i.splice(t,1)}xh(i,hh.First,{sorted:!1})},[Tf.Backwards]:()=>{var t;xh(e,hh.Previous)===fh.Error&&(null==(t=d.state.button)||t.focus())}})}),M=Nh();return o().createElement(Eg,null,o().createElement(Jg.Provider,{value:n},o().createElement(Af,{value:d.actions.refocusableClose},o().createElement($g,{enabled:!!a&&(e.static||N),ownerDocument:E},N&&p&&o().createElement(Hh,{id:y,ref:g,features:qh.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:D}),M({ourProps:F,theirProps:u,slot:I,defaultTag:"div",features:e_,visible:N,name:"Popover.Panel"}),N&&p&&o().createElement(Hh,{id:v,ref:_,features:qh.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:z})))))}),s_=Lh(function(e,t){let r=(0,o().useRef)(null),n=Sf(r,t),[i,s]=(0,o().useState)([]),a=eh(e=>{s(t=>{let r=t.indexOf(e);if(-1!==r){let e=t.slice();return e.splice(r,1),e}return t})}),l=eh(e=>(s(t=>[...t,e]),()=>a(e))),c=eh(()=>{var e;let t=Vp(r.current);if(!t)return!1;let n=Zp(r.current);return!(null==(e=r.current)||!e.contains(n))||i.some(e=>{var r,i;return(null==(r=t.getElementById(e.buttonId.current))?void 0:r.contains(n))||(null==(i=t.getElementById(e.panelId.current))?void 0:i.contains(n))})}),u=eh(e=>{for(let t of i)t.buttonId.current!==e&&t.close()}),d=(0,o().useMemo)(()=>({registerPopover:l,unregisterPopover:a,isFocusWithinPopoverGroup:c,closeOthers:u}),[l,a,c,u]),p=xf({}),h=e,f={ref:n},m=Nh();return o().createElement(Gh,null,o().createElement(Kg.Provider,{value:d},m({ourProps:f,theirProps:h,slot:p,defaultTag:"div",name:"Popover.Group"})))}),a_=Object.assign(t_,{Button:r_,Backdrop:i_,Overlay:n_,Panel:o_,Group:s_}),l_=(0,o().createContext)(void 0),c_=Lh(function(e,t){var r;let n=(0,o().useContext)(l_),{disabled:i=n||!1,autoFocus:s=!1,...a}=e,{isFocusVisible:l,focusProps:c}=Dp({autoFocus:s}),{isHovered:u,hoverProps:d}=Bp({isDisabled:i}),{pressed:p,pressProps:h}=th({disabled:i}),f=Fh({ref:t,type:null!=(r=a.type)?r:"button",disabled:i||void 0,autoFocus:s},c,d,h),m=xf({disabled:i,hover:u,focus:l,active:p,autofocus:s});return Nh()({ourProps:f,theirProps:a,slot:m,defaultTag:"button",name:"Button"})}),u_=Lh(function(e,t){let r=(0,o().useContext)(Of);return o().createElement(c_,{ref:t,...Fh({onClick:r},e)})});function d_(e){const{options:t,disabled:r=!1,title:n,selected:i}=e;return(0,u.jsxs)(a_,{className:m("wpl-dropdownbutton",t.length<=1?"wpl-dropdownbutton__single":null),children:[(0,u.jsx)("button",{onClick:function(r){r.preventDefault();const n=i||t[0]?.value;n&&e.onSelect(n)},type:"button",className:m("wpl-dropdownbutton__main",r&&"wpl-dropdownbutton__disabled"),children:(0,u.jsx)("h5",{children:n})}),t.length>1&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(r_,{disabled:r,className:m("wpl-dropdownbutton","wpl-popover__toggle",r&&"wpl-dropdownbutton__disabled"),children:(0,u.jsx)(qu,{})}),(0,u.jsx)(o_,{anchor:"bottom start",className:"wpl-dropdownbutton__popover wpl-popover wpl-popover__content",children:({close:r})=>(0,u.jsx)("ul",{children:t.map(({label:t,value:n,description:o})=>(0,u.jsxs)("li",{className:m({"wpl-dropdownbutton__item":!0,["wpl-dropdownbutton__"+n]:!0,"wpl-dropdownbutton__selected":i===n}),children:[i===n?(0,u.jsx)("span",{className:"wpl-dropdownbutton__selected-icon",children:"✓"}):(0,u.jsx)("span",{className:"wpl-dropdownbutton__selected-icon"}),(0,u.jsxs)(u_,{as:"button",className:"button",onClick:t=>function(t,r,n){t.preventDefault(),t.stopPropagation(),n(),e.onSelect(r)}(t,n,r),children:[t,o&&(0,u.jsx)("span",{children:o})]})]},n))})})]})]})}const p_=({headerValue:e,options:t,onChange:r})=>(0,u.jsx)(wn,{items:t,name:"headerValue",value:e,onChange:e=>r({[e.target.name]:e.target.value})}),h_=e=>"<"+e+">",f_=(e,t)=>e.includes(h_(t));function m_(e,t){return"uri"===t?e.replace(/[^A-Za-z0-9-._~:/?#\[\]@!$&'()*+,;=]/g,""):"integer"===t?parseInt(e,10):e}const g_=({headerValue:e,headerSettings:t,options:r,onChange:n})=>{const{choices:i,replace:o,replaceType:s}=r,a=t.selected?t.selected:e,l=t.replaceValue?t.replaceValue:"";return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(wn,{items:i,name:"headerValue",value:a,onChange:e=>{n({headerValue:e.target.value,headerSettings:{selected:e.target.value,replaceValue:""}})}}),f_(a,o)&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("label",{htmlFor:`header-replace-${o}`,children:h_(o).replace(/</g,"").replace(/>/g,"")}),(0,u.jsx)("input",{id:`header-replace-${o}`,type:"text",className:"regular-text",name:"replaceValue",value:l,onChange:e=>{n({headerValue:a.replace(h_(o),e.target.value),headerSettings:{selected:a,replaceValue:m_(e.target.value,s)}})}})]})]})},y_=({headerValue:e,onChange:t})=>(0,u.jsxs)(u.Fragment,{children:[(0,u.jsxs)("label",{htmlFor:"header-plain-value",children:[(0,a.__)("Value","redirection"),":"]})," ",(0,u.jsx)("input",{id:"header-plain-value",type:"text",className:"regular-text",name:"headerValue",value:e,onChange:e=>t({[e.target.name]:e.target.value})})]}),v_=({headerValue:e,options:t,onChange:r})=>{const{choices:n,implode:i,wildCard:o}=t,s=e.split(i);return(0,u.jsx)(Hu,{options:o?n.concat([{value:o,label:(0,a.__)("All","redirection")}]):n,selected:s,onChange:e=>{if(!Array.isArray(e))return;const t=s,n=e.find(e=>!t.includes(e))||t.find(t=>!e.includes(t));if(o&&n===o){const e=1===t.length&&t[0]===o;return void r({headerValue:e?"":o})}r({headerValue:e.filter(e=>e!==o).filter(e=>e).join(i)})},title:(0,a.__)("Values","redirection"),hideTitle:!0,multiple:!0,badges:!0})},b_=e=>e.map(e=>({label:e,value:e})),x_={"X-UA-Compatible":{component:p_,info:"https://frankcode.net/2013/10/17/a-guide-to-ie-compatibility-view-and-x-ua-compatible/",default:"Chrome=1",options:b_(["IE=EmulateIE7","IE=edge","Chrome=1"])},"X-Frame-Options":{component:g_,info:"",default:"deny",options:{choices:b_(["deny","sameorigin","allow-from <URI>"]),replace:"URI",replaceType:"uri"}},"Strict-Transport-Security":{component:g_,default:"max-age=<expire-time>",info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security",options:{choices:b_(["max-age=<expire-time>","max-age=<expire-time>; includeSubDomains","max-age=<expire-time>; preload","max-age=<expire-time>; includeSubDomains; preload"]),replace:"expire-time",replaceType:"integer"}},"X-XSS-Protection":{component:g_,default:"1; mode=block",info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-XSS-Protection",options:{choices:b_(["0","1","1; mode=block","1; report=<URI>"]),replace:"URI",replaceType:"uri"}},"X-Content-Type-Options":{component:p_,default:"nosniff",info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options",options:b_(["nosniff"])},"Feature-Policy":{component:y_,info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Feature-Policy"},"Permissions-Policy":{component:y_,info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Permissions-Policy",default:"camera=(), display-capture=(), geolocation=(), microphone=()"},"Clear-Site-Data":{component:v_,info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Clear-Site-Data",default:"cache",options:{choices:b_(["cache","cookies","storage","executionContexts"]),implode:",",wildCard:"*"}},"Referrer-Policy":{component:p_,default:"no-referrer-when-downgrade",info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy",options:b_(["no-referrer","no-referrer-when-downgrade","origin","origin-when-cross-origin","same-origin","strict-origin","strict-origin-when-cross-origin","unsafe-url"])},"Content-Security-Policy-Report-Only":{component:y_,info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only"},Custom:{component:({headerValue:e,headerName:t,onChange:r})=>(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("input",{type:"text",className:"regular-text",name:"headerName",value:t,onChange:e=>r({[e.target.name]:e.target.value})}),"Value:"," ",(0,u.jsx)("input",{type:"text",className:"regular-text",name:"headerValue",value:e,onChange:e=>r({[e.target.name]:e.target.value})})]})},"Access-Control-Allow-Methods":{component:v_,info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Methods",default:"GET",options:{choices:b_(["GET","POST","PUT","HEAD","DELETE","OPTIONS"]),implode:",",wildCard:"*"}},"Access-Control-Allow-Credentials":{component:p_,default:"true",info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Credentials",options:b_(["true"])},"Access-Control-Allow-Origin":{component:g_,default:"<origin>",info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin",options:{choices:b_(["<origin>","*"]),replace:"origin",replaceType:"uri"}},"X-Robots-Tag":{component:v_,default:"noindex",info:"https://developers.google.com/search/reference/robots_meta_tag#xrobotstag",options:{choices:b_(["noindex","nofollow","none","noarchive","nosnippet","notranslate","noimageindex"]),implode:",",wildCard:"all"}},"Access-Control-Allow-Headers":{component:y_,info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Headers"},"Access-Control-Max-Age":{component:y_,info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Max-Age"},"Access-Control-Expose-Headers":{component:y_,info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Expose-Headers"}},w_=e=>{const t=x_[e];return t&&t.options?t.options:null},j_=e=>{const t=x_[e];return t&&t.default?t.default:""},S_=({header:e,onChange:t,onDelete:r})=>{const{location:n,headerName:i,headerValue:o,headerSettings:s,type:l}=e,c=r=>{t({...e,...r})},d=t=>{const{name:r,value:n}=t.target;let o=i;"type"===r&&"Custom"===n?o="":"type"===r&&(o=n),c({headerValue:"type"===r?j_(n):e.headerValue,headerSettings:"type"===r?w_(o):e.headerSettings,headerName:o,[r]:n})},p=((e,t,r,n,i)=>{const o=x_[s=e]?x_[s].component:y_;var s;return(0,u.jsx)(o,{headerName:t,headerValue:""===r?j_(e):r,headerSettings:n,options:w_(e),onChange:i})})(l,i,o,s,c),h=(e=>{const t=x_[e];return t&&t.info?t.info:null})(i);return(0,u.jsxs)("tr",{className:"redirect-headers__item",children:[(0,u.jsx)("td",{className:"redirect-headers__type",children:(0,u.jsx)(wn,{items:[{label:(0,a.__)("Site","redirection"),value:"site"},{label:(0,a.__)("Redirect","redirection"),value:"redirect"}],name:"location",value:n,onChange:d})}),(0,u.jsxs)("td",{className:"redirect-headers__name",children:[(0,u.jsxs)("div",{className:"redirect-headers__name__content",children:[(0,u.jsx)(wn,{items:[{label:(0,a.__)("General","redirection"),value:b_(["X-UA-Compatible","X-Robots-Tag"])},{label:"CORS",value:b_(["Access-Control-Allow-Headers","Access-Control-Allow-Methods","Access-Control-Max-Age","Access-Control-Allow-Credentials","Access-Control-Allow-Origin","Access-Control-Expose-Headers"])},{label:"Security",value:b_(["X-Frame-Options","X-XSS-Protection","X-Content-Type-Options","Strict-Transport-Security","Feature-Policy","Permissions-Policy","Clear-Site-Data","Referrer-Policy","Content-Security-Policy","Content-Security-Policy-Report-Only","P3P"])},{label:(0,a.__)("Custom Header","redirection"),value:"Custom"}],name:"type",value:l,onChange:d}),p]}),h&&(0,u.jsx)(A,{url:h,children:(0,u.jsx)("span",{className:"dashicons dashicons-editor-help"})})]}),(0,u.jsx)("td",{className:"redirect-headers__delete",children:(0,u.jsx)("button",{onClick:t=>{t.preventDefault(),r(e.id)},children:(0,u.jsx)("span",{className:"dashicons dashicons-trash"})})})]})},k_=(e="X-Robots-Tag",t="nofollow",r={})=>({location:"site",type:e,headerName:e,headerValue:t,headerSettings:r}),C_=({headers:e,onChange:t})=>{const[r,n]=(0,o().useState)("header"),i=[{label:(0,a.__)("Add Header","redirection"),value:"header"},{label:(0,a.__)("Add Security Presets","redirection"),value:"security"},{label:(0,a.__)("Add CORS Presets","redirection"),value:"cors"}],s=i.find(e=>e.value===r);return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("h3",{children:(0,a.__)("HTTP Headers","redirection")}),(0,u.jsx)("p",{children:(0,a.__)("Site headers are added across your site, including redirects. Redirect headers are only added to redirects.","redirection")}),(0,u.jsxs)("table",{className:"wp-list-table widefat fixed striped items redirect-headers table-auto inline-edit-row",children:[(0,u.jsx)("thead",{children:(0,u.jsxs)("tr",{children:[(0,u.jsx)("th",{children:(0,a.__)("Location","redirection")}),(0,u.jsx)("th",{children:(0,a.__)("Header","redirection")}),(0,u.jsx)("th",{})]})}),(0,u.jsxs)("tbody",{children:[e.map((r,n)=>(0,u.jsx)(S_,{header:r,onChange:r=>((e,t,r,n)=>{const i=r.slice();i[e]=t,n({headers:i})})(n,r,e,t),onDelete:()=>((e,t,r)=>{r({headers:[...t.slice(0,e),...t.slice(e+1)]})})(n,e,t)},n)),0===e.length&&(0,u.jsx)("tr",{children:(0,u.jsx)("td",{colSpan:3,children:(0,a.__)("No headers","redirection")})})]})]}),(0,u.jsx)(d_,{options:i,selected:r,title:s?s.label:i[0]?.label||"",onSelect:r=>{n(r),((e,t,r)=>{"header"===e?r({headers:t.concat([k_()])}):"security"===e?r({headers:t.concat([k_("X-Frame-Options","deny"),k_("X-XSS-Protection","1; mode=block"),k_("X-Content-Type-Options","nosniff"),k_("Content-Security-Policy","default-src 'none'; script-src 'self'; connect-src 'self'; img-src 'self'; style-src 'self';base-uri 'self';form-action 'self'"),"https"===document.location.protocol?k_("Strict-Transport-Security","max-age: 31536000; includeSubDomains"):null,k_("Referrer-Policy","no-referrer-when-downgrade")].filter(e=>e))}):"cors"===e&&r({headers:t.concat([k_("Access-Control-Allow-Origin","*"),k_("Access-Control-Allow-Credentials","true"),k_("Access-Control-Allow-Methods","POST,GET,OPTIONS"),k_("Access-Control-Allow-Headers","origin"),k_("Referrer-Policy","no-referrer-when-downgrade"),k_("P3P",'CP="CAO PSA OUR"')])})})(r,e,t)}}),(0,u.jsx)("p",{children:(0,a.__)("Note that some HTTP headers are set by your server and cannot be changed.","redirection")})]})},T_=function({link:e,onChange:t,onDelete:r}){return(0,u.jsxs)("tr",{className:"redirect-alias__item",children:[(0,u.jsx)("td",{children:(0,u.jsx)("input",{className:"regular-text",type:"text",name:"link",value:e,onChange:t})}),(0,u.jsx)("td",{className:"redirect-alias__delete",children:(0,u.jsx)("button",{onClick:e=>{e.preventDefault(),r()},children:(0,u.jsx)("span",{className:"dashicons dashicons-trash"})})})]})},E_=function(e){const{permalinks:t,onChange:r}=e;return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("h3",{children:(0,a.__)("Permalink Migration","redirection")}),(0,u.jsx)("p",{children:(0,a.__)("Enter old permalinks structures to automatically migrate them to your current one.","redirection")}),(0,u.jsx)("p",{children:(0,a.__)("Note: this is in beta and will only migrate posts. Certain permalinks will not work. If yours does not work then you will need to wait until it is out of beta.","redirection")}),(0,u.jsxs)("table",{className:"wp-list-table widefat fixed striped items redirect-aliases table-auto inline-edit-row",children:[(0,u.jsx)("thead",{children:(0,u.jsxs)("tr",{children:[(0,u.jsx)("th",{children:(0,a.__)("Permalinks","redirection")}),(0,u.jsx)("th",{className:"redirect-alias__delete"})]})}),(0,u.jsxs)("tbody",{children:[t.map((e,n)=>(0,u.jsx)(T_,{link:e,onChange:e=>((e,t,r,n)=>{const i=t.slice();i[e]=n.target.value,r({permalinks:i})})(n,t,r,e),onDelete:()=>((e,t,r)=>{r({permalinks:[...t.slice(0,e),...t.slice(e+1)]})})(n,t,r)},n)),0===t.length&&(0,u.jsx)("tr",{children:(0,u.jsx)("td",{colSpan:2,children:(0,a.__)("No migrated permalinks","redirection")})})]})]}),(0,u.jsx)("p",{children:(0,u.jsx)("button",{className:"button-secondary",onClick:e=>((e,t,r)=>{r.preventDefault(),t({permalinks:e.concat("").slice(0,10)})})(t,r,e),children:(0,a.__)("Add Permalink","redirection")})})]})};function R_(){const e=Hd(Redirectioni10n.pluginRoot),t=he(e=>e.loadStatus),r=he(e=>e.values),n=he(e=>e.saveStatus);Pa();const{mutate:i}=Na(),[s,l]=(0,o().useState)(!1),[c,d]=(0,o().useState)(""),[p,h]=(0,o().useState)([]),[f,m]=(0,o().useState)(""),[g,_]=(0,o().useState)([]),[y,v]=(0,o().useState)([]);(0,o().useEffect)(()=>{r&&(l(r.https||!1),d(r.preferred_domain||""),h(r.headers||[]),m(r.relocate||""),_(r.aliases||[]),v(r.permalinks||[]))},[r]);const b=e=>{void 0!==e.https&&l(e.https),void 0!==e.preferred_domain&&d(e.preferred_domain),void 0!==e.headers&&h(e.headers),void 0!==e.relocate&&m(e.relocate),void 0!==e.aliases&&_(e.aliases),void 0!==e.permalinks&&v(e.permalinks)};return"loading"!==t&&r?(0,u.jsxs)("form",{onSubmit:e=>{e.preventDefault(),i({https:s,headers:p,preferred_domain:c,aliases:g.filter(e=>e).map(Hd),relocate:qd(f),permalinks:y})},children:[(0,u.jsx)("div",{className:"inline-notice inline-warning",children:(0,u.jsx)("p",{children:M((0,a.__)("Options on this page can cause problems if used incorrectly. You can {{link}}temporarily disable them{{/link}} to make changes.","redirection"),{link:(0,u.jsx)(A,{url:"https://redirection.me/support/disable-redirection/"})})})}),(0,u.jsx)(Vd,{relocate:f,siteDomain:e,onChange:b}),0===f.length&&(0,u.jsx)(Gd,{aliases:g,siteDomain:e,onChange:b}),0===f.length&&(0,u.jsx)(Kd,{https:s,siteDomain:e,preferredDomain:c,onChange:b}),0===f.length&&(0,u.jsx)(E_,{permalinks:y,onChange:b}),(0,u.jsx)(C_,{headers:p,onChange:b}),(0,u.jsx)("input",{className:"button-primary",type:"submit",name:"update",value:(0,a.__)("Update","redirection"),disabled:n})]}):(0,u.jsx)($l,{})}const P_=e=>"url"===e?[{name:"url",title:(0,a.__)("Source URL","redirection"),primary:!0,sortable:!1},{name:"count",title:(0,a.__)("Count","redirection"),sortable:!0}]:"ip"===e?[{name:"ip",title:(0,a.__)("IP","redirection"),primary:!0,sortable:!1},{name:"count",title:(0,a.__)("Count","redirection"),sortable:!0}]:"agent"===e?[{name:"agent",title:(0,a.__)("User Agent","redirection"),primary:!0,sortable:!1},{name:"count",title:(0,a.__)("Count","redirection"),sortable:!0}]:[{name:"date",title:(0,a.__)("Date","redirection")},{name:"method",title:(0,a.__)("Method","redirection"),sortable:!1},{name:"domain",title:(0,a.__)("Domain","redirection"),sortable:!1},{name:"url",title:(0,a.__)("Source URL","redirection"),primary:!0},{name:"target",title:(0,a.__)("Target URL","redirection"),sortable:!1},{name:"redirect_by",title:(0,a.__)("Redirect By","redirection"),sortable:!1},{name:"code",title:(0,a.__)("HTTP code","redirection"),sortable:!1},{name:"referrer",title:(0,a.__)("Referrer","redirection"),sortable:!1},{name:"agent",title:(0,a.__)("User Agent","redirection"),sortable:!1},{name:"ip",title:(0,a.__)("IP","redirection"),sortable:!1}],N_=e=>e?[{value:"group",label:(0,a.__)("Group","redirection"),grouping:[e,"count"]}]:[{value:"standard",label:(0,a.__)("Standard Display","redirection"),grouping:["date","url","target","agent","ip"]},{value:"minimal",label:(0,a.__)("Compact Display","redirection"),grouping:["date","url"]},{value:"all",label:(0,a.__)("Display All","redirection"),grouping:O_(e).map(e=>e.value)}],O_=e=>"url"===e?[{value:"url",label:(0,a.__)("URL","redirection")},{value:"count",label:(0,a.__)("Count","redirection")}]:"agent"===e?[{value:"agent",label:(0,a.__)("User Agent","redirection")},{value:"count",label:(0,a.__)("Count","redirection")}]:"ip"===e?[{value:"ip",label:(0,a.__)("IP","redirection")},{value:"count",label:(0,a.__)("Count","redirection")}]:[{value:"date",label:(0,a.__)("Date","redirection")},{value:"method",label:(0,a.__)("Method","redirection")},{value:"domain",label:(0,a.__)("Domain","redirection")},{value:"url",label:(0,a.__)("URL","redirection")},{value:"redirect_by",label:(0,a.__)("Redirect By","redirection")},{value:"code",label:(0,a.__)("HTTP code","redirection")},{value:"referrer",label:(0,a.__)("Referrer","redirection")},{value:"agent",label:(0,a.__)("User Agent","redirection")},{value:"target",label:(0,a.__)("Target","redirection")},{value:"ip",label:(0,a.__)("IP","redirection")}],A_=e=>{const t=[{value:"",label:(0,a.__)("No grouping","redirection")},{value:"url",label:(0,a.__)("Group by URL","redirection")},{value:"agent",label:(0,a.__)("Group by user agent","redirection")}];return e>0&&t.push({value:"ip",label:(0,a.__)("Group by IP","redirection")}),t},I_=window.Redirectioni10n?.per_page?parseInt(window.Redirectioni10n.per_page,10):25,F_={page:0,per_page:I_,orderby:"id",direction:"desc",selected:[],filterBy:{},displayType:"standard",displaySelected:["last_count","last_access","source","target","code","title"],groupBy:""},L_={page:0,per_page:I_,orderby:"name",direction:"desc",selected:[],filterBy:{},displayType:"standard",displaySelected:["name","module","redirects"],groupBy:""},D_={page:0,per_page:I_,orderby:"",direction:"desc",selected:[],filterBy:{},displayType:"standard",displaySelected:["date","url","target","agent","ip"],groupBy:""},z_={page:0,per_page:I_,orderby:"",direction:"desc",selected:[],filterBy:{},displayType:"standard",displaySelected:["date","url","agent","ip"],groupBy:""},M_={redirects:F_,groups:L_,logs:D_,errors:z_,redirectsAddTop:!1},$_=te()(le(((e,t)=>(r,n,i)=>{let o={storage:ue(()=>window.localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},s=!1,a=0;const l=new Set,c=new Set;let u=o.storage;if(!u)return e((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),r(...e)},n,i);const d=()=>{const e=o.partialize({...n()});return u.setItem(o.name,{state:e,version:o.version})},p=i.setState;i.setState=(e,t)=>(p(e,t),d());const h=e((...e)=>(r(...e),d()),n,i);let f;i.getInitialState=()=>h;const m=()=>{var e,t;if(!u)return;const i=++a;s=!1,l.forEach(e=>{var t;return e(null!=(t=n())?t:h)});const p=(null==(t=o.onRehydrateStorage)?void 0:t.call(o,null!=(e=n())?e:h))||void 0;return de(u.getItem.bind(u))(o.name).then(e=>{if(e){if("number"!=typeof e.version||e.version===o.version)return[!1,e.state];if(o.migrate){const t=o.migrate(e.state,e.version);return t instanceof Promise?t.then(e=>[!0,e]):[!0,t]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}return[!1,void 0]}).then(e=>{var t;if(i!==a)return;const[s,l]=e;return f=o.merge(l,null!=(t=n())?t:h),r(f,!0),s?d():void 0}).then(()=>{i===a&&(null==p||p(n(),void 0),f=n(),s=!0,c.forEach(e=>e(f)))}).catch(e=>{i===a&&(null==p||p(void 0,e))})};return i.persist={setOptions:e=>{o={...o,...e},e.storage&&(u=e.storage)},clearStorage:()=>{++a,null==u||u.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>m(),hasHydrated:()=>s,onHydrate:e=>(l.add(e),()=>{l.delete(e)}),onFinishHydration:e=>(c.add(e),()=>{c.delete(e)})},o.skipHydration||m(),f||h})(e=>({...M_,setRedirectsTable:t=>e(e=>({redirects:{...e.redirects,...t}})),clearRedirectsSelected:()=>e(e=>({redirects:{...e.redirects,selected:[]}})),setRedirectsSelected:t=>e(e=>({redirects:{...e.redirects,selected:t,selectAll:!1}})),setRedirectsAddTop:t=>e({redirectsAddTop:t}),resetRedirectsTable:()=>e({redirects:F_,redirectsAddTop:!1}),setGroupsTable:t=>e(e=>({groups:{...e.groups,...t}})),clearGroupsSelected:()=>e(e=>({groups:{...e.groups,selected:[]}})),setGroupsSelected:t=>e(e=>({groups:{...e.groups,selected:t,selectAll:!1}})),resetGroupsTable:()=>e({groups:L_}),setLogsTable:t=>e(e=>({logs:{...e.logs,...t}})),clearLogsSelected:()=>e(e=>({logs:{...e.logs,selected:[]}})),setLogsSelected:t=>e(e=>({logs:{...e.logs,selected:t,selectAll:!1}})),resetLogsTable:()=>e({logs:D_}),setErrorsTable:t=>e(e=>({errors:{...e.errors,...t}})),clearErrorsSelected:()=>e(e=>({errors:{...e.errors,selected:[]}})),setErrorsSelected:t=>e(e=>({errors:{...e.errors,selected:t,selectAll:!1}})),resetErrorsTable:()=>e({errors:z_}),reset:()=>e(M_)}),{name:"redirection-display",partialize:e=>({redirects:{displayType:e.redirects.displayType,displaySelected:e.redirects.displaySelected},groups:{displayType:e.groups.displayType,displaySelected:e.groups.displaySelected},logs:{displayType:e.logs.displayType,displaySelected:e.logs.displaySelected},errors:{displayType:e.errors.displayType,displaySelected:e.errors.displaySelected}}),merge:(e,t)=>{const r=e??{};return{...t,redirects:{...t.redirects,...r.redirects},groups:{...t.groups,...r.groups},logs:{...t.logs,...r.logs},errors:{...t.errors,...r.errors}}}}),{name:"TableStore"}));function U_(e){return function(e,t){return new e({type:"number",coerce:!0,checks:[],...Lr(t)})}(Zs,e)}const B_=sa({id:la([Ks().int(),Ts()]),created:Ts().optional(),created_time:Ts().optional(),url:Ts().optional(),sent_to:Ts().optional().nullable(),agent:Ts().optional().nullable(),referrer:Ts().optional().nullable(),ip:Ts().optional().nullable(),domain:Ts().optional().nullable(),redirect_id:Ks().int().optional(),redirection_id:Ks().int().optional(),request_method:Ts().optional().nullable(),http_code:Ks().int().optional(),request_data:ta().optional().nullable(),redirect_by:Ts().optional().nullable(),count:U_().int().optional()}),q_=sa({id:la([Ks().int(),Ts()]),created:Ts().optional(),created_time:Ts().optional(),url:Ts().optional(),agent:Ts().optional().nullable(),referrer:Ts().optional().nullable(),domain:Ts().optional().nullable(),ip:Ts().optional().nullable(),http_code:Ks().int().optional(),request_method:Ts().optional().nullable(),request_data:ta().optional().nullable(),count:U_().int().optional()}),H_=rd(B_),W_=rd(q_);function G_(e){const t=p(),{incrementProgress:r,decrementProgress:n,addNotice:i,addError:o}=tn(),{setErrorsTable:s}=$_();return ft({mutationFn:async({action:e,items:t,params:i={}})=>{r();try{return await jt(ar(e,{items:t},i))}catch(e){throw n(),Yr(e)}},onSuccess:(e,r)=>{n();const o="delete"===r.action?"deleted":r.action;i(`404 errors ${o}`),s(ad(r.params)),t.invalidateQueries({queryKey:Xr.errors.all})},onError:e=>{o(e.message||"Failed to perform 404 error action")},...e})}function V_(e){const{table:t,setTable:r,allowedOrder:n=[],allowedGroup:i=[],allowedFilters:s=[],defaultOrder:a="",pageName:l}=e,c=(0,o().useRef)(!1),u=(0,o().useRef)(null);(0,o().useEffect)(()=>{if(c.current)return;const e=function(e){const t=new URLSearchParams(e?e.slice(1):document.location.search.slice(1)),r={};return t.forEach((e,t)=>{r[t]=e}),r}();if(e.sub!==l&&"redirect"!==l)return void(c.current=!0);const o={};e.orderby&&n.includes(e.orderby)&&(o.orderby=e.orderby),"asc"!==e.direction&&"desc"!==e.direction||(o.direction=e.direction),e.offset&&parseInt(e.offset,10)>0&&(o.page=parseInt(e.offset,10)),e.groupby&&i.includes(e.groupby)&&(o.groupBy=e.groupby);const a={};for(const[t,r]of Object.entries(e)){const e=t.match(/^filterby\[(\w+)\]$/);if(e&&e[1]){const t=e[1];(0===s.length||s.includes(t))&&(a[t]=String(r))}}if(e.filterby&&"object"==typeof e.filterby)for(const t of Object.keys(e.filterby))(0===s.length||s.includes(t))&&(a[t]=e.filterby[t]);Object.keys(a).length>0&&(o.filterBy=a),Object.keys(o).length>0&&r(o),c.current=!0,u.current={...t,...o}},[t,r,n,i,s,l]),(0,o().useEffect)(()=>{if(!c.current)return;const e=u.current;if(e&&e.groupBy===t.groupBy&&e.orderby===t.orderby&&e.direction===t.direction&&e.page===t.page&&JSON.stringify(e.filterBy)===JSON.stringify(t.filterBy))return;u.current=t;const r=new URLSearchParams(document.location.search),n=function(e,t){const r={...e};return"desc"===r.direction&&delete r.direction,r.orderby===t&&delete r.orderby,0===r.page&&delete r.page,r.per_page===parseInt(Redirectioni10n.per_page,10)&&delete r.per_page,"object"==typeof r.filterBy&&0===Object.keys(r.filterBy||{}).length&&(delete r.filterBy,delete r.filter),""===r.groupBy&&(delete r.groupBy,delete r.group),25!==parseInt(Redirectioni10n.per_page,10)&&(r.per_page=parseInt(Redirectioni10n.per_page,10)),delete r.selected,delete r.displaySelected,delete r.displayType,delete r.selectAll,r}(t,a);"redirect"!==l&&r.set("sub",l),n.orderby?r.set("orderby",n.orderby):r.delete("orderby"),n.direction?r.set("direction",n.direction):r.delete("direction"),n.page&&n.page>0?r.set("offset",String(n.page)):r.delete("offset"),n.groupBy?r.set("groupby",n.groupBy):r.delete("groupby");const i=[];if(r.forEach((e,t)=>{t.startsWith("filterby[")&&i.push(t)}),i.forEach(e=>r.delete(e)),t.filterBy&&"object"==typeof t.filterBy)for(const[e,n]of Object.entries(t.filterBy))n&&r.set(`filterby[${e}]`,String(n));const o="?"+r.toString();history.replaceState({},"",o)},[t,a,l])}const Z_="loading",K_="complete",Q_=e=>{const{name:t,title:r,table:n,primary:i,onSetOrderBy:o}=e,{direction:s,orderBy:a}=n,l=m({"manage-column":!0,sortable:!0,asc:a===t&&"asc"===s,desc:a===t&&"desc"===s||a!==t,"column-primary":i,["column-"+t]:!0}),c=a===t,d=m("sorting-indicator",{asc:c&&"asc"===s,desc:c&&"desc"===s});return(0,u.jsx)("th",{scope:"col",className:l,children:(0,u.jsxs)("button",{type:"button",className:"button-link",onClick:e=>{e.preventDefault(),o(t,a===t&&"desc"===s?"asc":"desc")},children:[(0,u.jsx)("span",{children:r}),(0,u.jsx)("span",{className:d})]})})},J_=e=>{const{name:t,title:r,primary:n}=e,i=m({"manage-column":!0,"column-primary":n,["column-"+t]:!0});return(0,u.jsx)("th",{scope:"col",className:i,children:(0,u.jsx)("span",{children:r})})},Y_=e=>{const{onSelect:t,disabled:r,selected:n}=e;return(0,u.jsxs)("th",{scope:"col",className:"manage-column column-cb check-column-red",children:[(0,u.jsx)("label",{className:"screen-reader-text",htmlFor:"redirection-select-all",children:(0,a.__)("Select All","redirection")}),(0,u.jsx)("input",{id:"redirection-select-all",type:"checkbox",disabled:r,checked:n,onChange:e=>t(e.target.checked)})]})},X_=e=>{const{disabled:t,onSelect:r,onSetOrderBy:n,headers:i,table:o,hasBulk:s,allSelected:a,isSaving:l}=e;return(0,u.jsxs)("tr",{children:[s&&(0,u.jsx)(Y_,{onSelect:r,disabled:t||l,selected:a}),i.map(e=>{const{primary:t=!1,sortable:r=!0}=e;return r?(0,u.jsx)(Q_,{table:o,name:e.name,title:e.title,onSetOrderBy:n,primary:t},e.name):(0,u.jsx)(J_,{name:e.name,title:e.title,primary:t},e.name)})]})},ey=e=>{const{columns:t}=e;return(0,u.jsxs)("tr",{className:"is-placeholder",children:[t.map((e,t)=>(0,u.jsx)("td",{children:(0,u.jsx)("div",{className:"wpl-placeholder__loading"})},t)),(0,u.jsx)("td",{children:(0,u.jsx)("div",{className:"wpl-placeholder__loading"})})]})},ty=e=>{const{headers:t,rows:r}=e;return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(ey,{columns:t}),r.slice(0,-1).map((e,r)=>(0,u.jsx)(ey,{columns:t},r))]})},ry=e=>{const{headers:t}=e;return(0,u.jsx)("tr",{children:(0,u.jsx)("td",{colSpan:t.length+1,children:(0,a.__)("Nothing to display.","redirection")})})},ny=e=>{const{headers:t}=e;return(0,u.jsx)("tr",{children:(0,u.jsx)("td",{colSpan:t.length+1,children:(0,u.jsx)("p",{children:(0,a.__)("Sorry, something went wrong loading the data - please try again","redirection")})})})},iy=(0,o().memo)(function(e){const{isSaving:t,disabled:r,id:n,rowIndex:i,onSelect:s,onShiftSelect:a,isSelected:l}=e,c=(0,o().useCallback)(e=>{e.shiftKey&&a&&(e.preventDefault(),a(i))},[a,i]),d=(0,o().useCallback)(e=>{const t=e.target.value,r=/^\d+$/.test(t)?parseInt(t,10):t;s([r],i)},[s,i]);return(0,u.jsx)("th",{scope:"row",className:"check-column",children:t?(0,u.jsx)(gn,{size:"small"}):(0,u.jsx)("input",{type:"checkbox",name:"item[]",value:n,disabled:r,checked:l,onChange:d,onClick:c})})});function oy(e){const{row:t,rowData:r,displaySelected:n,getRow:i,getRowActions:s,primary:a,total:l}=e,[c,d]=(0,o().useState)(!1),p={...r,rowMode:c,setRowMode:d},h=i(t,p),f=s(t,p);return Array.isArray(h)?(0,u.jsx)(u.Fragment,{children:h.filter(e=>n.includes(e.name)||!0===e.alwaysDisplay).map(e=>(0,u.jsxs)("td",{className:m(`column-${e.name}`,{"column-primary":e.name===a?.name}),children:[e.content,e.name===(a?a.name:h[0]?.name)&&f]},e.name))}):(0,u.jsx)("td",{colSpan:l,children:h})}const sy=(0,o().memo)(function(e){const{row:t,rowIndex:r,status:n,isSelected:i,isSaving:o,isAllSaving:s,displaySelected:a,table:l,getRow:c,getRowActions:d,onSelect:p,onShiftSelect:h,primary:f,headersLength:g}=e,_=function(e,t,r){return{isLoading:e===Z_,isSelected:!!Array.isArray(r.selected)&&r.selected.some(e=>e===t.id),table:r}}(n,t,l);return(0,u.jsxs)("tr",{className:m({disabled:n===Z_||"saving"===n,saving:o||s}),children:[!!p&&(0,u.jsx)(iy,{id:t.id,rowIndex:r,onSelect:p,...h?{onShiftSelect:h}:{},disabled:n===Z_,isSelected:i,isSaving:o||s}),(0,u.jsx)(oy,{row:t,rowData:_,displaySelected:a,getRow:c,getRowActions:d,primary:f,total:g})]})},(e,t)=>e.row===t.row&&e.status===t.status&&e.isSelected===t.isSelected&&e.isSaving===t.isSaving&&e.isAllSaving===t.isAllSaving&&e.displaySelected===t.displaySelected&&e.primary===t.primary&&e.headersLength===t.headersLength),ay=function(e){const{rows:t,headers:r,status:n,table:i,getRow:s,getRowActions:a,onSelect:l,saving:c}=e,{selected:d=[],displaySelected:p}=i,h=r.find(e=>e.primary),f=c.some(e=>-1===e),m=(0,o().useRef)(null),g=(0,o().useCallback)((e,t)=>{void 0!==t&&(m.current=t),l&&l(e)},[l]),_=(0,o().useCallback)(e=>{if(!l)return;if(null===m.current){m.current=e;const r=t[e];return void(r&&l([r.id]))}const r=t.length-1,n=Math.min(m.current,r),i=Math.min(e,r),o=Math.min(n,i),s=Math.max(n,i),a=new Set(d),c=[];for(let e=o;e<=s;e++){const r=t[e];r&&!a.has(r.id)&&c.push(r.id)}c.length>0&&l(c),m.current=e},[l,t,d]);return n===Z_&&0===t.length?(0,u.jsx)(ty,{headers:r,rows:t}):n===K_&&0===t.length?(0,u.jsx)(ry,{headers:r}):"error"===n?(0,u.jsx)(ny,{headers:r}):(0,u.jsx)(u.Fragment,{children:t.map((e,t)=>(0,u.jsx)(sy,{row:e,rowIndex:t,status:n,isSelected:d.some(t=>t===e.id),isSaving:c.some(t=>t===e.id),isAllSaving:f,displaySelected:p,table:i,getRow:s,getRowActions:a,...l?{onSelect:g,onShiftSelect:_}:{},primary:h,headersLength:r.length},e.id))})},ly=e=>{const{headers:t,getRow:r,getRowActions:n,rows:i,table:o,status:s,saving:a,onSelect:l,onSetOrderBy:c}=e,d=(0,u.jsx)(X_,{table:o,disabled:s!==K_||0===i.length,headers:t,onSetOrderBy:c,onSelect:e=>{l&&l(e?i.map(e=>e.id):[])},hasBulk:!!l,allSelected:o.selected.length===i.length&&0!==i.length,isSaving:a.length>0}),p=m("wp-list-table","widefat","fixed","striped","items",{["redirect-log__display__"+o.displayType]:!0,["redirect-log__group__"+o.groupBy]:o.groupBy});return(0,u.jsx)("div",{className:"redirect-table-wrapper",children:(0,u.jsxs)("table",{className:p,children:[(0,u.jsx)("thead",{children:d}),(0,u.jsx)("tbody",{children:(0,u.jsx)(ay,{rows:i,table:o,headers:t,status:s,getRow:r,getRowActions:n,...l?{onSelect:l}:{},saving:a})}),(0,u.jsx)("tfoot",{children:d})]})})},cy=function(e){const{title:t,button:r,className:n,disabled:i,onClick:o}=e;return i?(0,u.jsx)("span",{className:"tablenav-pages-navspan button disabled","aria-hidden":"true",children:(0,u.jsx)("span",{children:r})}):(0,u.jsxs)("button",{className:n+" button",type:"button",onClick:function(e){e.preventDefault(),o()},children:[(0,u.jsx)("span",{className:"screen-reader-text",children:t}),(0,u.jsx)("span",{"aria-hidden":"true",children:r})]})},uy=function(e){const{page:t,total:r,perPage:n,onChangePage:i}=e,s=r<=n,[l,c]=(0,o().useState)(String(t+1));if((0,o().useEffect)(()=>{c(String(t+1))},[t]),s)return null;const d=function(e,t){return Math.ceil(e/t)}(r,n);return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(cy,{title:(0,a.__)("First page","redirection"),button:"«",className:"first-page",disabled:t<=0,onClick:()=>i(0)}),(0,u.jsx)(cy,{title:(0,a.__)("Prev page","redirection"),button:"‹",className:"prev-page",disabled:t<=0,onClick:()=>i(t-1)}),(0,u.jsxs)("span",{className:"paging-input",children:[(0,u.jsx)("label",{htmlFor:"current-page-selector",className:"screen-reader-text",children:(0,a.__)("Current Page","redirection")}),(0,u.jsx)("input",{className:"current-page",type:"number",min:"1",max:d,name:"paged",value:l,size:2,"aria-describedby":"table-paging",onBlur:()=>{if(!/^\d+$/.test(l))return void c(String(t+1));const e=Number(l),r=Math.min(d,Math.max(1,e));c(String(r)),i(r-1)},onChange:e=>c(e.target.value)}),(0,u.jsx)("span",{className:"tablenav-paging-text",children:(0,a.sprintf)(
// translators: %s is the total number of pages
// translators: %s is the total number of pages
(0,a.__)("of %s","redirection"),new Intl.NumberFormat(window.Redirectioni10n.locale).format(d))})]}),(0,u.jsx)(cy,{title:(0,a.__)("Next page","redirection"),button:"›",className:"next-page",disabled:t>=d-1,onClick:()=>i(t+1)}),(0,u.jsx)(cy,{title:(0,a.__)("Last page","redirection"),button:"»",className:"last-page",disabled:t>=d-1,onClick:()=>i(d-1)})]})},dy=function(e){const{total:t,perPage:r,page:n,rowCount:i,onChangePage:o,selected:s,onSelectAll:l,isEverything:c}=e,d=m({"tablenav-pages":!0});return(0,u.jsxs)("div",{className:d,children:[(0,u.jsxs)("span",{className:m("displaying-num",c?"displaying-num-all":null),children:[(0===s||!c&&(s<i||t<=r))&&(0,a.sprintf)(
// translators: %s is the number of items
// translators: %s is the number of items
(0,a._n)("%s item","%s items",t,"redirection"),new Intl.NumberFormat(window.Redirectioni10n.locale).format(t)),s>0&&s>=i&&t>r&&!c&&M((0,a.sprintf)(
// translators: 1: number of selected items, 2: total number of items
// translators: 1: number of selected items, 2: total number of items
(0,a.__)("%1$d of %2$d selected. {{all}}Select All.{{/all}}","redirection"),s,t),{all:(0,u.jsx)("button",{type:"button",onClick:function(){l(!0)}})}),c&&M((0,a.sprintf)(
// translators: 1: number of selected items, 2: total number of items
// translators: 1: number of selected items, 2: total number of items
(0,a.__)("%1$d of %2$d selected. {{all}}Clear All.{{/all}}","redirection"),s,t),{all:(0,u.jsx)("button",{type:"button",onClick:function(){l(!1)}})})]}),(0,u.jsx)("span",{className:"pagination-links",children:(0,u.jsx)(uy,{onChangePage:o,total:t,perPage:r,page:n},n)})]})},py=function(e){const{total:t,rowCount:r,table:n,children:i=null,onChangePage:o,disabled:s,className:a,onSelectAll:l}=e;return(0,u.jsxs)("div",{className:m("tablenav",a),children:[(0,u.jsx)("div",{className:"redirect-table__actions",children:i}),t>0&&(0,u.jsx)(dy,{perPage:n.perPage,page:n.page,total:t,rowCount:r,onChangePage:o,onSelectAll:l,disabled:s,selected:n.selectAll?t:n.selected.length,isEverything:n.selectAll})]})},hy=({children:e})=>(0,u.jsx)("div",{className:"alignleft actions",children:e}),fy=function({selected:e,options:t,isEnabled:r,onGroup:n}){const[i,s]=(0,o().useState)(e);return(0,u.jsxs)("div",{className:"alignleft actions",children:[(0,u.jsx)(wn,{items:t,value:i,name:"filter",onChange:e=>{s(e.target.value)},disabled:!r}),(0,u.jsx)("button",{className:"button",onClick:()=>{n(i)},disabled:!r,children:(0,a.__)("Apply","redirection")})]})};function my(e,t){return e.options.find(e=>e.value===t)}function gy(e,t){const r=[];return Object.keys(e).forEach(n=>{const i=t.find(e=>e.value===n);if(i){const t=e[n];t&&i.options.find(e=>e.value===t)&&r.push(t)}}),r}const _y=function(e){const{table:t,disabled:r,groupOptions:n,filterOptions:i,onGroup:o,onFilter:s}=e;return(0,u.jsxs)(u.Fragment,{children:[n.length>0&&(0,u.jsx)(fy,{selected:t.groupBy?t.groupBy:"",options:n,isEnabled:!r,onGroup:o},t.groupBy),i.length>0&&(0,u.jsx)(hy,{children:(0,u.jsx)(Hu,{options:i,selected:gy(t.filterBy,i),onChange:function(e){const t={};if(Array.isArray(e)){for(let r=0;r<e.length;r++){const n=e[r];if(n){const e=i.find(e=>my(e,n));e&&(t[e.value]=n)}}s(t)}},title:(0,a.__)("Filters","redirection"),disabled:r,multiple:!0,badges:!0})})]})},yy=function(e){const{bulk:t,disabled:r,onBulk:n}=e,[i,s]=(0,o().useState)("-1");return(0,u.jsxs)("div",{className:"alignleft actions bulkactions",children:[(0,u.jsxs)("select",{name:"action",value:i,disabled:r,onChange:e=>s(e.target.value),children:[(0,u.jsx)("option",{value:"-1",children:(0,a.__)("Bulk Actions","redirection")}),t.map(e=>(0,u.jsx)("option",{value:e.id,children:e.name},e.id))]}),(0,u.jsx)("button",{type:"button",className:"button action",disabled:r||-1===parseInt(i,10),onClick:function(){-1!==parseInt(i,10)&&(n(i),s("-1"))},children:(0,a.__)("Apply","redirection")})]})};function vy(e,t){if("custom"===e)return(0,a.__)("Custom Display","redirection");for(let r=0;r<t.length;r++){const n=t[r]?.options.find(t=>t.value===e);if(n)return n.label}return t[0]?.label||""}const by=function(e){const{disabled:t,predefinedGroups:r,customOptions:n,table:i,setDisplay:o,validation:s}=e,{displayType:l,displaySelected:c}=i,d=[{label:(0,a.__)("Pre-defined","redirection"),value:"pre",options:r},{label:(0,a.__)("Custom","redirection"),value:"custom",options:n}];return(0,u.jsx)(Hu,{className:"redirect-table-display__filter",options:d,selected:c.concat([l]),onChange:function(e){if(!Array.isArray(e))return;const t=c.concat([l]),r=e.filter(e=>!t.includes(e));if(r.length>0){const e=d[0]?.options?.find(e=>e.value===r[0]);if(e)return void o(e.value,e.grouping)}const i=e.filter(e=>{if(e===l)return!1;const t=d[0]?.options.find(t=>t.value===e);return!t&&n.find(t=>t.value===e)});o("custom",s?s(i):i)},title:vy(l,d),disabled:t})};function xy(e,t){if(e){const r=e.find(e=>t[e.name]);return r&&t[r.name]||""}return""}const wy=function({table:e,onSearch:t,searchTypes:r,selected:n,disabled:i=!1,name:s=""}){const a=r?.find(e=>n[e.name]),l=xy(r,n),c=a?a.name:r?.[0]?.name||"",[d,p]=(0,o().useState)(l),[h,f]=(0,o().useState)(c),[m,g]=(0,o().useState)(l);(0,o().useEffect)(()=>{const e=xy(r,n);if(e!==m){const t=r?.find(e=>n[e.name]),i=t?t.name:r?.[0]?.name||"";g(e),p(e),f(i)}},[r,n,m]);const _=i||""===d&&""===e.filter,y=r?r.map(e=>({value:e.name,label:e.title})):[],v=r?.find(e=>e.name===h),b=v?v.title:"";return(0,u.jsxs)("form",{onSubmit:e=>{e?.preventDefault(),t(d,h)},className:"redirect-searchbox",children:[(0,u.jsx)("input",{type:"search",name:"s",value:d,onChange:e=>{p(e.target.value)}}),r&&(0,u.jsx)(d_,{options:y,disabled:i,title:b,onSelect:e=>{f(e),t(d,e)},selected:h}),!r&&(0,u.jsx)("input",{type:"submit",className:"button",value:s,disabled:_})]})},jy=function(e){const{disabled:t,filterOptions:r,searchOptions:n,predefinedGroups:i,table:o,onSetDisplay:s,onFilter:a,validateDisplay:l}=e;return(0,u.jsxs)("div",{className:"redirect-table-display tablenav",children:[(0,u.jsx)(by,{disabled:t,customOptions:r,predefinedGroups:i,table:o,setDisplay:s,...l?{validation:l}:{}}),(0,u.jsx)(wy,{disabled:t,table:o,onSearch:function(e,t){const r={...o.filterBy};n.map(e=>delete r[e.name]),e&&(r[t]=e),a(r)},selected:o.filterBy,searchTypes:n})]})},Sy=function(e){const{logOptions:t,logActions:r,table:n,total:i,rows:o,getRow:s,getRowActions:a,renderTableActions:l,status:c,saving:d}=e,{displayFilters:p,displayGroups:h,searchOptions:f,groupBy:m,rowFilters:g,bulk:_,headers:y,validateDisplay:v}=t,{onChangePage:b,onFilter:x,onSetDisplay:w,onBulk:j,onGroup:S,onSetOrder:k,onSetAll:C,onSelect:T}=r,E=c===Z_;return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(jy,{filterOptions:p,predefinedGroups:h,searchOptions:f,disabled:E,table:n,onFilter:x,onSetDisplay:w,...v?{validateDisplay:v}:{}}),(0,u.jsxs)(py,{total:i,rowCount:o.length,table:n,disabled:E,onChangePage:b,className:"top",onSelectAll:C,children:[(0,u.jsx)(yy,{bulk:_,disabled:E||0===n.selected.length,onBulk:j}),(0,u.jsx)(_y,{disabled:E,table:n,groupOptions:m,filterOptions:g,onGroup:S,onFilter:x})]}),(0,u.jsx)(ly,{headers:y,rows:o,getRow:s,getRowActions:a,table:n,status:c,onSelect:e=>{0===e.length?T(!1):1===e.length&&void 0!==e[0]?T(e[0]):T(e)},onSetOrderBy:k,saving:d}),(0,u.jsxs)(py,{total:i,rowCount:o.length,table:n,disabled:E,onChangePage:b,className:"bottom",onSelectAll:C,children:[(0,u.jsx)(yy,{bulk:_,disabled:E||0===n.selected.length,onBulk:j}),l&&l()]})]})};function ky(e){return Redirectioni10n?.caps?.capabilities.includes(e)}function Cy(e){return Redirectioni10n?.caps?.pages.includes(e)}const Ty="redirection_cap_redirect_manage",Ey="redirection_cap_redirect_add",Ry="redirection_cap_group_add",Py="redirection_cap_404_delete";function Ny(e){const{actions:t,disabled:r=!1}=e;return(0,u.jsx)("div",{className:"row-actions",children:r?(0,u.jsx)("span",{children:" "}):t.length>0&&t.filter(e=>e).reduce((e,t)=>[...e," | ",t],[]).slice(1)})}function Oy(e){const{onClick:t,children:r,href:n="",capability:i=""}=e;return i&&!ky(i)?null:(0,u.jsx)("a",{href:n||"#",onClick:function(e){t&&(e.preventDefault(),t())},children:r})}const Ay=()=>(0,u.jsx)("div",{className:"redirection-poweredby",children:M((0,a.__)("Powered by {{link}}redirect.li{{/link}}","redirection"),{link:(0,u.jsx)(A,{url:"https://redirect.li"})})});function Iy(e){return!!(e&&e.name&&e.version)&&e.name+" "+e.version}function Fy({error:e}){return(0,u.jsxs)("div",{className:"wpl-modal_error",children:[(0,u.jsx)("h2",{children:(0,a.__)("Useragent Error","redirection")}),(0,u.jsx)("p",{children:(0,a.__)("Something went wrong obtaining this information","redirection")}),(0,u.jsx)("p",{children:(0,u.jsx)("code",{children:e})})]})}function Ly({agent:e}){return(0,u.jsxs)("div",{className:"redirection-useragent_unknown",children:[(0,u.jsx)("h2",{children:(0,a.__)("Unknown Useragent","redirection")}),(0,u.jsx)("br",{}),(0,u.jsx)("p",{children:e})]})}function Dy({agent:e,detail:t}){const r=function(e,t){if(!e)return null;const r=e.slice(0,1).toUpperCase()+e.slice(1);return t?(0,u.jsx)(A,{url:t,children:r}):r}(t.device.type,t.url),n=function(e){const t=[];return e.vendor&&t.push(e.vendor),e.name&&t.push(e.name),t.join(" ")}(t.device),i=Iy(t.os),o=Iy(t.browser),s=Iy(t.engine),l=[];return n&&l.push([(0,a.__)("Device","redirection"),n]),i&&l.push([(0,a.__)("Operating System","redirection"),i]),o&&l.push([(0,a.__)("Browser","redirection"),o]),s&&l.push([(0,a.__)("Engine","redirection"),s]),(0,u.jsxs)("div",{children:[(0,u.jsxs)("h2",{children:[(0,a.__)("Useragent","redirection"),": ",r]}),(0,u.jsx)("table",{children:(0,u.jsxs)("tbody",{children:[(0,u.jsxs)("tr",{children:[(0,u.jsx)("th",{children:(0,a.__)("Agent","redirection")}),(0,u.jsx)("td",{className:"redirection-useragent_agent",children:e})]}),l.map((e,t)=>(0,u.jsxs)("tr",{children:[(0,u.jsx)("th",{children:e[0]}),(0,u.jsx)("td",{children:e[1]})]},t))]})}),(0,u.jsx)(Ay,{})]})}function zy({agent:e}){const{data:t,isLoading:r,isError:n,error:i}=function(e,t){return dt({queryKey:Xr.info.agent(e),queryFn:async()=>await jt(cr(e)),enabled:!!e,staleTime:864e5,...t})}(e,{enabled:!!e}),o=m({"redirection-useragent":!0,"wpl-modal_loading":r}),s=t,a=n&&i&&i.message||"";return(0,u.jsxs)("div",{className:o,children:[r&&(0,u.jsx)(gn,{}),n&&a&&(0,u.jsx)(Fy,{error:a}),!r&&!n&&!s&&(0,u.jsx)(Ly,{agent:e}),!r&&!n&&s&&(0,u.jsx)(Dy,{agent:e,detail:s})]})}const My=function(e){const{agent:t}=e,[r,n]=(0,o().useState)(!1);return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(Oy,{href:"https://redirect.li/agent/?agent="+encodeURIComponent(t),onClick:()=>n(!0),children:(0,a.__)("Agent Info","redirection")}),r&&(0,u.jsx)(jd,{onClose:()=>n(!1),children:(0,u.jsx)(zy,{agent:t})})]})},$y=({headers:e})=>e&&0!==Object.keys(e).length?(0,u.jsxs)(o().Fragment,{children:[(0,u.jsx)("h3",{children:(0,a.__)("Request Headers","redirection")}),(0,u.jsx)("table",{children:(0,u.jsx)("tbody",{children:Object.keys(e).map(t=>(0,u.jsxs)("tr",{children:[(0,u.jsx)("th",{children:t}),(0,u.jsx)("td",{children:e[t]})]},t))})})]}):null,Uy=({source:e})=>e&&0!==e.length?(0,u.jsxs)(o().Fragment,{children:[(0,u.jsx)("h3",{children:(0,a.__)("Redirect Source","redirection")}),(0,u.jsx)("ul",{children:e.map((e,t)=>(0,u.jsx)("li",{children:e},t))})]}):null,By=({data:e})=>{const{headers:t,source:r}=e;return(0,u.jsxs)("div",{className:"redirect-requestdata",children:[t&&(0,u.jsx)($y,{headers:t}),r&&(0,u.jsx)(Uy,{source:r})]})},qy=function(e){const{data:t}=e,[r,n]=(0,o().useState)(!1);return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(Oy,{onClick:()=>n(!0),children:(0,a.__)("View Data","redirection")}),r&&(0,u.jsx)(jd,{onClose:()=>n(!1),children:(0,u.jsx)(By,{data:t})})]})},Hy=function(e){const{row:t,onDelete:r,disabled:n,groupBy:i}=e,{agent:o,id:s,request_data:l,redirection_id:c}=t,{setLogsTable:d}=$_(),p=[];return p.push((0,u.jsx)(Oy,{onClick:()=>r(s),capability:"redirection_cap_log_delete",children:(0,a.__)("Delete","redirection")},"0")),o&&p.unshift((0,u.jsx)(My,{agent:o},"3")),l&&p.push((0,u.jsx)(qy,{data:l},"4")),c&&c>0&&p.push((0,u.jsx)(Oy,{href:Redirectioni10n.pluginRoot+"&"+encodeURIComponent("filterby[id]")+"="+c,children:(0,a.__)("View Redirect","redirection")},"5")),i&&p.push((0,u.jsx)(Oy,{onClick:()=>d({filterBy:ld(i,String(s)),page:0,groupBy:"",selected:[],selectAll:!1}),capability:Ty,children:(0,a.__)("Show All","redirection")},"6")),(0,u.jsx)(Ny,{disabled:n,actions:p})},Wy=e=>{const{enabled:t=!0,children:r}=e;return t?(0,u.jsx)("div",{className:"table-buttons",children:r}):null};var Gy=r(465),Vy=r.n(Gy);function Zy(e){return e.url?hd(fd(e.domain),e.url):""}function Ky(e,t){if(!e.sent_to)return"";const r=t.target||"",n=/^https?:\/\//i.test(e.sent_to)?e.sent_to:hd(fd(e.domain),e.sent_to);return(0,u.jsx)(A,{url:n,children:(0,u.jsx)(Vy(),{searchWords:[r],textToHighlight:e.sent_to,autoEscape:!0})})}function Qy(e){return e.map(e=>function(e){return"redirect"===e?(0,a.__)("Redirects","redirection"):"log"===e?(0,a.__)("Redirect logs","redirection"):"404"===e?(0,a.__)("404 logs","redirection"):"group"===e?(0,a.__)("Groups","redirection"):(0,a.__)("Settings","redirection")}(e)).join(", ")}function Jy(e){return"1"===e?(0,a.__)("WordPress redirects","redirection"):"2"===e?(0,a.__)("Apache redirects","redirection"):"3"===e?(0,a.__)("Nginx redirects","redirection"):(0,a.__)("Everything","redirection")}function Yy(e){return"json"===e?(0,a.__)("JSON","redirection"):"csv"===e?(0,a.__)("CSV","redirection"):"apache"===e?(0,a.__)("Apache .htaccess","redirection"):"redirects-file"===e?(0,a.__)("_redirects (Netlify/Cloudflare)","redirection"):(0,a.__)("Nginx rewrite rules","redirection")}function Xy(e){return"json"===e?(0,a.__)("JSON (complete data)","redirection"):Yy(e)}function ev(e,t){return"redirects-file"===t?"_redirects":"redirect"===e?"apache"===t?"redirects.htaccess":"nginx"===t?"redirects.nginx":`redirects.${t}`:"log"===e?`redirect-logs.${t}`:"404"===e?`404-logs.${t}`:"group"===e?`groups.${t}`:`settings.${t}`}function tv(e){return e.includes("url")?e:e.concat(["url"])}const rv=function(){const e=$_(e=>e.logs),{setLogsTable:t,setLogsSelected:r}=$_(),n=he(e=>e.values),i=n?.token||"";V_({table:e,setTable:t,allowedGroup:["url","ip","agent"],allowedFilters:["url","url-exact","referrer","agent","ip","target","domain","method","redirect_by"],pageName:"log"});const o=function(){const e=p(),{incrementProgress:t,decrementProgress:r,addNotice:n,addError:i}=tn(),{setLogsTable:o}=$_();return ft({mutationFn:async({action:e,items:n,params:i={}})=>{t();try{return await jt(sr(e,{items:n},i))}catch(e){throw r(),Yr(e)}},onSuccess:(t,i)=>{r();const s="delete"===i.action?"deleted":i.action;n(`Logs ${s}`),o(ad(i.params)),e.invalidateQueries({queryKey:Xr.logs.all})},onError:e=>{i(e.message||"Failed to perform log action")}})}(),s=an(),{data:l,isLoading:c,isSuccess:d}=function(e={},t){const r=ud(e);return dt({queryKey:Xr.logs.list(r),placeholderData:e=>e,queryFn:async()=>{try{const e=await jt(zt(r));return H_.parse(e)}catch(e){const t=Yr(e);throw tn.getState().addError(t.message||"Failed to fetch logs"),t}},...t})}(e),h=l?.items??[],f=l?.total??0;let m="idle";c&&!l?m=Z_:(d||l)&&(m=K_);const g=t=>{if(!window.confirm((0,a.__)("Are you sure you want to delete this item?","redirection")))return;const r=e.groupBy?{groupBy:e.groupBy}:{};o.mutate({action:"delete",items:[t],params:r})},_=e=>{t({filterBy:e,page:0,selected:[],selectAll:!1})},y={...e,...(v=e.groupBy,v?{displayOptions:O_(v),displaySelected:N_(v)[0]?.grouping||[]}:{})};var v;const b={page:e.page,perPage:e.per_page,orderBy:e.orderby||"date",direction:e.direction,selected:e.selected??[],selectAll:e.selectAll??!1,filter:"",filterBy:e.filterBy??{},displayType:e.displayType??"standard",displaySelected:y.displaySelected??[],groupBy:e.groupBy??""},x={displayFilters:O_(y.groupBy),displayGroups:N_(y.groupBy),searchOptions:[{name:"url",title:(0,a.__)("Search URL","redirection")},{name:"url-exact",title:(0,a.__)("Search exact URL","redirection")},{name:"referrer",title:(0,a.__)("Search referrer","redirection")},{name:"agent",title:(0,a.__)("Search user agent","redirection")},{name:"ip",title:(0,a.__)("Search IP","redirection")},{name:"target",title:(0,a.__)("Search target URL","redirection")},{name:"domain",title:(0,a.__)("Search domain","redirection")}],groupBy:A_(n?.ip_logging||0),bulk:[{id:"delete",name:(0,a.__)("Delete","redirection")},{id:"export-csv",name:(0,a.__)("Export as CSV","redirection")},{id:"export-json",name:(0,a.__)("Export as JSON","redirection")}],rowFilters:y.groupBy?[]:[{label:(0,a.__)("Method","redirection"),value:"method",options:[{label:"GET",value:"get"},{label:"POST",value:"post"},{label:"HEAD",value:"head"}]},{label:(0,a.__)("Redirect By","redirection"),value:"redirect_by",options:[{label:(0,a.__)("WordPress","redirection"),value:"wordpress"},{label:(0,a.__)("Redirection","redirection"),value:"redirection"}]}],headers:P_(y.groupBy).filter(e=>function(e,t){return t.displaySelected.includes(e)}(e.name,y)),validateDisplay:tv},w={onChangePage:e=>{t({page:e,selected:[],selectAll:!1})},onBulk:t=>{if(0===e.selected.length&&!e.selectAll)return;if("export-csv"===t||"export-json"===t){const r={...ud({...e.groupBy?{groupBy:e.groupBy}:{},...e.selectAll?{global:!0,filterBy:e.filterBy}:{items:e.selected}}),displaySelected:y.displaySelected??[]};return void s.mutate({exportType:"log",format:"export-csv"===t?"csv":"json",download:!0,filename:ev("log","export-csv"===t?"csv":"json"),params:r})}if("delete"===t){const t=e.selectAll?(0,a.__)("Are you sure you want to delete all items?","redirection"):(0,a.__)("Are you sure you want to delete the selected items?","redirection");if(!window.confirm(t))return}const r=e.groupBy?{groupBy:e.groupBy}:{};e.selectAll?o.mutate({action:t,items:[],params:ud({...r,global:!0,filterBy:e.filterBy})}):o.mutate({action:t,items:e.selected,params:r})},onGroup:e=>{t({groupBy:e,selected:[],selectAll:!1})},onSetOrder:(e,r)=>{t({orderby:"date"===e?"":e,direction:r})},onFilter:_,onSetDisplay:(e,r)=>{t({displayType:e,displaySelected:r})},onSelect:n=>{if("boolean"==typeof n)r(n?h.map(e=>e.id):[]);else if("number"==typeof n||"string"==typeof n){const r=Array.isArray(e.selected)?e.selected:[],i=r.some(e=>e===n)?r.filter(e=>e!==n):[...r,n];t({selected:i,selectAll:!1})}else r(n)},onSetAll:e=>{t({selected:e?h.map(e=>e.id):[],selectAll:e})}};return(0,u.jsx)(Sy,{logOptions:x,logActions:w,table:b,status:m,total:f,rows:h,saving:[],getRow:(e,t)=>function(e,t){const{created:r,created_time:n,url:i,agent:o,referrer:s,ip:l,request_method:c,http_code:d,domain:p,redirect_by:h,count:f}=e,m=t?.table?.filterBy||{},g=m.url||m["url-exact"]||"";return[{name:"date",content:r?(0,u.jsxs)(u.Fragment,{children:[r,n&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("br",{}),n]})]}):""},{name:"method",content:c?c.toUpperCase():""},{name:"domain",content:p||""},{name:"url",content:i?(0,u.jsx)(A,{url:Zy(e),children:(0,u.jsx)(Vy(),{searchWords:[g],textToHighlight:i,autoEscape:!0})}):""},{name:"target",content:Ky(e,m)},{name:"redirect_by",content:h||""},{name:"code",content:d??""},{name:"referrer",content:s?(0,u.jsx)(Vy(),{searchWords:[m.referrer||""],textToHighlight:s,autoEscape:!0}):""},{name:"agent",content:o?(0,u.jsx)(Vy(),{searchWords:[m.agent||""],textToHighlight:o,autoEscape:!0}):""},{name:"ip",content:l?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("a",{href:"https://redirect.li/ip/?ip="+encodeURIComponent(l),children:(0,u.jsx)(Vy(),{searchWords:[m.ip||""],textToHighlight:l,autoEscape:!0})}),""===t?.table?.groupBy&&t?.onFilter&&(0,u.jsx)(Ny,{actions:[(0,u.jsx)(Oy,{onClick:()=>{t.onFilter?.({ip:l})},children:(0,a.__)("Filter by IP","redirection")},"filter-ip")]})]}):""},{name:"count",content:f?new Intl.NumberFormat(window.Redirectioni10n.locale).format(f):""}]}(e,{...t,onFilter:_}),getRowActions:t=>(0,u.jsx)(Hy,{disabled:!1,row:t,onDelete:g,groupBy:e.groupBy}),renderTableActions:()=>(0,u.jsx)(u.Fragment,{children:(0,u.jsx)(Wy,{enabled:h.length>0,children:i&&(0,u.jsx)("div",{className:"table-button-item",children:(0,u.jsx)("a",{href:pd(i),className:"button-secondary",children:(0,a.__)("RSS","redirection")})})})})})},nv="pass",iv="nothing",ov="login",sv="referrer",av="agent",lv="cookie",cv="header",uv="custom",dv="role",pv="server",hv="language";function fv(e){return"url"===e||e===nv}function mv(e,t){if(e===ov)return{logged_in:t?.logged_in||"",logged_out:t?.logged_out||""};if(e===sv)return{referrer:t?.referrer||"",regex:t?.regex||!1,url_from:t?.url_from||"",url_notfrom:t?.url_notfrom||""};if(e===av)return{agent:t?.agent||"",regex:t?.regex||!1,url_from:t?.url_from||"",url_notfrom:t?.url_notfrom||""};if(e===lv)return{name:t?.name||"",value:t?.value||"",regex:t?.regex||!1,url_from:t?.url_from||"",url_notfrom:t?.url_notfrom||""};if(e===cv)return{name:t?.name||"",value:t?.value||"",regex:t?.regex||!1,url_from:t?.url_from||"",url_notfrom:t?.url_notfrom||""};if(e===uv)return{filter:t?.filter||"",url_from:t?.url_from||"",url_notfrom:t?.url_notfrom||""};if(e===dv)return{role:t?.role||"",url_from:t?.url_from||"",url_notfrom:t?.url_notfrom||""};if(e===pv)return{server:t?.server||"",url_from:t?.url_from||"",url_notfrom:t?.url_notfrom||""};if("ip"===e){let e=[];return Array.isArray(t?.ip)?e=t.ip:t?.ip&&(e=[String(t.ip)]),{ip:e,url_from:t?.url_from||"",url_notfrom:t?.url_notfrom||""}}return e===hv?{language:t?.language||"",url_from:t?.url_from||"",url_notfrom:t?.url_notfrom||""}:t||{}}function gv(e,t,r){return{url:e,title:"",match_data:{source:{flag_regex:r.flag_regex||!1,flag_trailing:r.flag_trailing||!1,flag_case:r.flag_case||!1,flag_query:r.flag_query||"exact"},options:{}},match_type:"url",action_type:"url",action_code:301,action_data:{},group_id:t,position:0}}const _v=()=>[{value:"url",label:(0,a.__)("URL only","redirection")},{value:"login",label:(0,a.__)("URL and login status","redirection")},{value:"role",label:(0,a.__)("URL and role/capability","redirection")},{value:sv,label:(0,a.__)("URL and referrer","redirection")},{value:"agent",label:(0,a.__)("URL and user agent","redirection")},{value:"cookie",label:(0,a.__)("URL and cookie","redirection")},{value:"ip",label:(0,a.__)("URL and IP","redirection")},{value:"server",label:(0,a.__)("URL and server","redirection")},{value:"header",label:(0,a.__)("URL and HTTP header","redirection")},{value:"custom",label:(0,a.__)("URL and custom filter","redirection")},{value:"page",label:(0,a.__)("URL and WordPress page type","redirection")},{value:hv,label:(0,a.__)("URL and language","redirection")}],yv=()=>[{value:"url",label:(0,a.__)("Redirect to URL","redirection")},{value:"random",label:(0,a.__)("Redirect to random post","redirection")},{value:"pass",label:(0,a.__)("Pass-through","redirection")},{value:"error",label:(0,a.__)("Error (404)","redirection")},{value:iv,label:(0,a.__)("Do nothing (ignore)","redirection")}],vv=()=>[{value:"301",label:(0,a.__)("301 - Moved Permanently","redirection")},{value:"302",label:(0,a.__)("302 - Found","redirection")},{value:"303",label:(0,a.__)("303 - See Other","redirection")},{value:"304",label:(0,a.__)("304 - Not Modified","redirection")},{value:"307",label:(0,a.__)("307 - Temporary Redirect","redirection")},{value:"308",label:(0,a.__)("308 - Permanent Redirect","redirection")}],bv=()=>[{value:"400",label:(0,a.__)("400 - Bad Request","redirection")},{value:"401",label:(0,a.__)("401 - Unauthorized","redirection")},{value:"403",label:(0,a.__)("403 - Forbidden","redirection")},{value:"404",label:(0,a.__)("404 - Not Found","redirection")},{value:"410",label:(0,a.__)("410 - Gone","redirection")},{value:"418",label:(0,a.__)("418 - I'm a teapot","redirection")},{value:"451",label:(0,a.__)("451 - Unavailable For Legal Reasons","redirection")},{value:"500",label:(0,a.__)("500 - Internal Server Error","redirection")},{value:"501",label:(0,a.__)("501 - Not implemented","redirection")},{value:"502",label:(0,a.__)("502 - Bad Gateway","redirection")},{value:"503",label:(0,a.__)("503 - Service Unavailable","redirection")},{value:"504",label:(0,a.__)("504 - Gateway Timeout","redirection")}],xv=()=>vv().concat(bv()),wv=()=>[{value:"flag_regex",label:(0,a.__)("Regex","redirection")},{value:"flag_trailing",label:(0,a.__)("Ignore Slash","redirection")},{value:"flag_case",label:(0,a.__)("Ignore Case","redirection")}],jv=()=>[{value:"exactorder",label:(0,a.__)("Exact match","redirection")},{value:"exact",label:(0,a.__)("Exact match in any order","redirection")},{value:"ignore",label:(0,a.__)("Ignore all parameters","redirection")},{value:"pass",label:(0,a.__)("Ignore & pass parameters to the target","redirection")}],Sv=e=>"url"===e?[{name:"url",title:(0,a.__)("Source URL","redirection"),primary:!0,sortable:!1},{name:"count",title:(0,a.__)("Count","redirection"),sortable:!0}]:"agent"===e?[{name:"agent",title:(0,a.__)("User Agent","redirection"),primary:!0,sortable:!1},{name:"count",title:(0,a.__)("Count","redirection"),sortable:!0}]:"ip"===e?[{name:"ip",title:(0,a.__)("IP","redirection"),primary:!0,sortable:!1},{name:"count",title:(0,a.__)("Count","redirection"),sortable:!0}]:[{name:"date",title:(0,a.__)("Date","redirection")},{name:"method",title:(0,a.__)("Method","redirection"),sortable:!1},{name:"domain",title:(0,a.__)("Domain","redirection"),sortable:!1},{name:"url",title:(0,a.__)("Source URL","redirection"),primary:!0},{name:"code",title:(0,a.__)("HTTP code","redirection"),sortable:!1},{name:"referrer",title:(0,a.__)("Referrer","redirection"),sortable:!1},{name:"agent",title:(0,a.__)("User Agent","redirection"),sortable:!1},{name:"ip",title:(0,a.__)("IP","redirection")}],kv=e=>{const t=[{id:"delete",name:(0,a.__)("Delete","redirection")},{id:"export-csv",name:(0,a.__)("Export as CSV","redirection")},{id:"export-json",name:(0,a.__)("Export as JSON","redirection")}];return"ip"===e?t.concat([{id:"redirect-ip",name:(0,a.__)("Redirect All","redirection")},{id:"block",name:(0,a.__)("Block IP","redirection")}]):"agent"===e?t:t.concat([{id:"redirect-url",name:(0,a.__)("Redirect All","redirection"),isEverything:!1},{id:"ignore",name:(0,a.__)("Ignore URL","redirection"),isEverything:!1}])},Cv=e=>{const t=[{value:"",label:(0,a.__)("No grouping","redirection")},{value:"url",label:(0,a.__)("Group by URL","redirection")},{value:"agent",label:(0,a.__)("Group by user agent","redirection")}];return e>0&&t.push({value:"ip",label:(0,a.__)("Group by IP","redirection")}),t};function Tv(e){return e?[{value:"group",label:(0,a.__)("Group","redirection"),grouping:[e,"count"]}]:[{value:"standard",label:(0,a.__)("Standard Display","redirection"),grouping:["date","url","agent","ip"]},{value:"minimal",label:(0,a.__)("Compact Display","redirection"),grouping:["date","url"]},{value:"all",label:(0,a.__)("Display All","redirection"),grouping:Ev(e).map(e=>e.value)}]}function Ev(e){return"url"===e?[{value:"url",label:(0,a.__)("URL","redirection")},{value:"count",label:(0,a.__)("Count","redirection")}]:"agent"===e?[{value:"agent",label:(0,a.__)("User Agent","redirection")},{value:"count",label:(0,a.__)("Count","redirection")}]:"ip"===e?[{value:"ip",label:(0,a.__)("IP","redirection")},{value:"count",label:(0,a.__)("Count","redirection")}]:[{value:"date",label:(0,a.__)("Date","redirection")},{value:"method",label:(0,a.__)("Method","redirection")},{value:"domain",label:(0,a.__)("Domain","redirection")},{value:"url",label:(0,a.__)("URL","redirection")},{value:"code",label:(0,a.__)("HTTP code","redirection")},{value:"referrer",label:(0,a.__)("Referrer","redirection")},{value:"agent",label:(0,a.__)("User Agent","redirection")},{value:"ip",label:(0,a.__)("IP","redirection")}]}const Rv="^/.*$";function Pv(e){return{url:Rv,match_type:"ip",action_data:{ip:e},match_data:{source:{flag_regex:!0}}}}function Nv(e,t){return"redirect-ip"===e||"ip"===e?{...Pv(t),action_type:"url"}:"block"===e?{...Pv(t),action_type:"error",action_code:403}:"agent"===e?{url:Rv,match_type:"agent",action_data:{agent:t},match_data:{source:{flag_regex:!0}}}:{url:t,match_type:"url",action_type:"ignore"===e?iv:"url"}}const Ov=({title:e=null,children:t,className:r=""})=>(0,u.jsxs)("tr",{className:r,children:[(0,u.jsx)("th",{children:e}),(0,u.jsx)("td",{children:t})]}),Av=({flag_case:e,flag_regex:t,flag_trailing:r})=>[e?"flag_case":null,t?"flag_regex":null,r?"flag_trailing":null].filter(e=>null!==e),Iv=({url:e,flags:t,onFlagChange:r,onChange:n,autoFocus:i=!1})=>{const o=wv();return Array.isArray(e)?(0,u.jsx)(Ov,{title:(0,a.__)("Source URL","redirection"),className:"top",children:(0,u.jsx)("textarea",{value:e.join("\n"),readOnly:!0})}):(0,u.jsxs)(Ov,{title:(0,a.__)("Source URL","redirection"),className:"redirect-edit__source",children:[(0,u.jsx)("input",{type:"text",name:"url",value:e,onChange:n,autoFocus:i,className:"regular-text",placeholder:(0,a.__)("The relative URL you want to redirect from","redirection")}),(0,u.jsx)(Hu,{options:o,selected:Av(t),onChange:function(e){const t=Array.isArray(e)?e:[e];r({flag_case:t.includes("flag_case"),flag_trailing:t.includes("flag_trailing"),flag_regex:t.includes("flag_regex")})},title:(0,a.__)("URL options / Regex","redirection"),badges:!0,multiple:!0,hideTitle:!0})]})},Fv=({query:e,regex:t,onChange:r,url:n})=>{if(t)return null;const i=!1===(Array.isArray(n)?n.join(""):n).includes("?")?jv().filter(e=>"exactorder"!==e.value):jv();return(0,u.jsx)(Ov,{title:(0,a.__)("Query Parameters","redirection"),className:"redirect-edit__sourcequery",children:(0,u.jsx)(wn,{name:"flag_query",items:i,value:e,onChange:r})})},Lv=({groups:e,currentGroup:t,onChange:r})=>(0,u.jsx)(wn,{name:"group",value:String(t),items:md(e),onChange:r}),Dv=({position:e,onChange:t})=>(0,u.jsxs)("span",{className:"redirect-edit-position",children:[(0,u.jsx)("strong",{children:(0,a.__)("Position","redirection")})," ",(0,u.jsx)("input",{type:"number",value:e,name:"position",min:"0",size:3,onChange:t})]}),zv=function({title:e,onChange:t}){return(0,u.jsx)(Ov,{title:(0,a.__)("Title","redirection"),className:"redirect-edit__title",children:(0,u.jsx)("input",{type:"text",name:"title",value:e,onChange:e=>t({title:e.target.value}),placeholder:(0,a.__)("Describe the purpose of this redirect (optional)","redirection")})})},Mv=({actionType:e,actionCode:t,onChange:r})=>{const n=function(e){return"error"===e?bv():"url"===e||"random"===e?vv():null}(e);return n?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("strong",{className:"small-flex",children:(0,a.__)("with HTTP code","redirection")}),(0,u.jsx)(wn,{name:"action_code",value:String(t),items:n,onChange:r})]}):null},$v=({actionType:e,matchType:t,onChange:r})=>(0,u.jsx)(wn,{name:"action_type",value:e,items:yv().filter(e=>!("login"===t&&!fv(e.value))),onChange:r}),Uv=({matchType:e,onChange:t})=>(0,u.jsx)(Ov,{title:(0,a.__)("Match","redirection"),children:(0,u.jsx)(wn,{name:"match_type",value:e,items:_v(),onChange:t})}),Bv=function({onChange:e,data:t}){const[r,n]=(0,o().useState)(""),{agent:i,regex:s}=t;return(0,u.jsxs)(Ov,{title:(0,a.__)("User Agent","redirection"),className:"redirect-edit__match",children:[(0,u.jsx)("input",{type:"text",name:"agent",value:i,onChange:e,className:"regular-text",placeholder:(0,a.__)("Match against this browser user agent","redirection")}),(0,u.jsxs)("select",{name:"agent_dropdown",onChange:t=>{""!==t.target.value&&e({target:{name:"agent",value:{mobile:"iPad|iPod|iPhone|Android|BlackBerry|SymbianOS|SCH-Md+|Opera Mini|Windows CE|Nokia|SonyEricsson|webOS|PalmOS",feed:"Bloglines|feed|rss",lib:"cURL|Java|libwww-perl|PHP|urllib"}[t.target.value]}}),n("")},value:r,className:"medium",children:[(0,u.jsx)("option",{value:"",children:(0,a.__)("Custom","redirection")}),(0,u.jsx)("option",{value:"mobile",children:(0,a.__)("Mobile","redirection")}),(0,u.jsxs)("option",{value:"feed",children:[(0,a.__)("Feed Readers","redirection")," "]}),(0,u.jsx)("option",{value:"lib",children:(0,a.__)("Libraries","redirection")})]}),(0,u.jsx)("input",{id:"redirect-agent-regex",type:"checkbox",name:"regex",checked:s,onChange:e}),(0,u.jsxs)("label",{className:"redirect-edit-regex",htmlFor:"redirect-agent-regex",children:[(0,a.__)("Regex","redirection")," ",(0,u.jsx)("sup",{children:(0,u.jsx)(A,{url:"https://redirection.me/support/redirect-regular-expressions/",children:"?"})})]})]})},qv=({data:e,onChange:t})=>{const{referrer:r,regex:n}=e;return(0,u.jsxs)(Ov,{title:(0,a.__)("Referrer","redirection"),className:"redirect-edit__match",children:[(0,u.jsx)("input",{type:"text",className:"regular-text",name:"referrer",value:r,onChange:t,placeholder:(0,a.__)("Match against this browser referrer text","redirection")}),(0,u.jsx)("input",{id:"redirect-referrer-regex",type:"checkbox",name:"regex",checked:n,onChange:t}),(0,u.jsxs)("label",{className:"redirect-edit-regex",htmlFor:"redirect-referrer-regex",children:[(0,a.__)("Regex","redirection")," ",(0,u.jsx)("sup",{children:(0,u.jsx)(A,{url:"https://redirection.me/support/redirect-regular-expressions/",children:"?"})})]})]})},Hv=function({onChange:e,data:t}){const[r,n]=(0,o().useState)(""),{name:i,value:s,regex:l}=t;return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsxs)(Ov,{title:(0,a.__)("HTTP Header","redirection"),className:"redirect-edit__match",children:[(0,u.jsx)("input",{type:"text",name:"name",value:i,onChange:e,className:"regular-text",placeholder:(0,a.__)("Header name","redirection")}),(0,u.jsx)("input",{type:"text",name:"value",value:s,onChange:e,className:"regular-text",placeholder:(0,a.__)("Header value","redirection")}),(0,u.jsxs)("select",{name:"agent_dropdown",onChange:t=>{""!==t.target.value&&e({target:{name:"name",value:{accept:"Accept-Language"}[t.target.value]}}),n("")},value:r,className:"medium",children:[(0,u.jsx)("option",{value:"",children:(0,a.__)("Custom","redirection")}),(0,u.jsx)("option",{value:"accept",children:(0,a.__)("Accept Language","redirection")})]}),(0,u.jsx)("input",{id:"redirect-header-regex",type:"checkbox",name:"regex",checked:l,onChange:e}),(0,u.jsxs)("label",{className:"redirect-edit-regex",htmlFor:"redirect-header-regex",children:[(0,a.__)("Regex","redirection")," ",(0,u.jsx)("sup",{children:(0,u.jsx)(A,{url:"https://redirection.me/support/redirect-regular-expressions/",children:"?"})})]})]}),(0,u.jsx)(Ov,{children:(0,a.__)("Note it is your responsibility to pass HTTP headers to PHP. Please contact your hosting provider for support about this.","redirection")})]})},Wv=({data:e,onChange:t})=>{const{filter:r}=e;return(0,u.jsx)(Ov,{title:(0,a.__)("Filter Name","redirection"),className:"redirect-edit__match",children:(0,u.jsx)("input",{type:"text",name:"filter",value:r,onChange:t,className:"regular-text",placeholder:(0,a.__)("WordPress filter name","redirection")})})},Gv=({data:e,onChange:t})=>{const{name:r,value:n,regex:i}=e;return(0,u.jsxs)(Ov,{title:(0,a.__)("Cookie","redirection"),className:"redirect-edit__match",children:[(0,u.jsx)("input",{type:"text",name:"name",value:r,onChange:t,className:"regular-text",placeholder:(0,a.__)("Cookie name","redirection")}),(0,u.jsx)("input",{type:"text",name:"value",value:n,onChange:t,className:"regular-text",placeholder:(0,a.__)("Cookie value","redirection")}),(0,u.jsx)("input",{id:"redirect-cookie-regex",type:"checkbox",name:"regex",checked:i,onChange:t}),(0,u.jsxs)("label",{className:"redirect-edit-regex",htmlFor:"redirect-cookie-regex",children:[(0,a.__)("Regex","redirection")," ",(0,u.jsx)("sup",{children:(0,u.jsx)(A,{url:"https://redirection.me/support/redirect-regular-expressions/",children:"?"})})]})]})},Vv=({data:e,onChange:t})=>{const{role:r}=e;return(0,u.jsx)(Ov,{title:(0,a.__)("Role","redirection"),className:"redirect-edit__match",children:(0,u.jsx)("input",{type:"text",className:"regular-text",value:r,name:"role",placeholder:(0,a.__)("Enter role or capability value","redirection"),onChange:t})})},Zv=({data:e,onChange:t})=>{const{server:r}=e;return(0,u.jsx)(Ov,{title:(0,a.__)("Server","redirection"),className:"redirect-edit__match",children:(0,u.jsx)("input",{type:"text",className:"regular-text",name:"server",value:r,placeholder:(0,a.__)("Enter server URL to match against","redirection"),onChange:t})})},Kv=({data:e,onChange:t})=>{const{ip:r=[]}=e;return(0,u.jsx)(Ov,{title:(0,a.__)("IP","redirection"),className:"redirect-edit__match",children:(0,u.jsx)("textarea",{value:r.join("\n"),name:"ip",placeholder:(0,a.__)("Enter IP addresses (one per line)","redirection"),onChange:e=>{t({target:{name:e.target.name,value:e.target.value.split("\n")}})}})})},Qv=()=>(0,u.jsx)(Ov,{title:(0,a.__)("Page Type","redirection"),className:"redirect-edit__match",children:(0,u.jsxs)("p",{children:[(0,a.__)("Only the 404 page type is currently supported.","redirection")," ",(0,a.__)("Please do not try and redirect all your 404s - this is not a good thing to do.","redirection")]})}),Jv=({data:e,onChange:t})=>{const{language:r}=e;return(0,u.jsx)(Ov,{title:(0,a.__)("Language","redirection"),className:"redirect-edit__match",children:(0,u.jsx)("input",{type:"text",className:"regular-text",name:"language",value:r,onChange:t,placeholder:(0,a.__)("Comma separated list of languages to match against (i.e. da, en-GB)","redirection")})})},Yv=({matchType:e,actionData:t,onChange:r})=>{const n={[sv]:qv,agent:Bv,cookie:Gv,header:Hv,custom:Wv,role:Vv,server:Zv,ip:Kv,page:Qv,[hv]:Jv};if(n[e]){const i=n[e];return(0,u.jsx)(i,{data:null===t?{}:t,onChange:r})}return null},Xv=({onChange:e,data:t})=>{const{logged_in:r,logged_out:n}=t;return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(Ov,{title:(0,a.__)("Logged In","redirection"),className:"redirect-edit__target__matched",children:(0,u.jsx)("input",{type:"text",className:"regular-text",name:"logged_in",value:r,onChange:e,placeholder:(0,a.__)("Target URL when matched (empty to ignore)","redirection")})}),(0,u.jsx)(Ov,{title:(0,a.__)("Logged Out","redirection"),className:"redirect-edit__target__unmatched",children:(0,u.jsx)("input",{type:"text",className:"regular-text",name:"logged_out",value:n,onChange:e,placeholder:(0,a.__)("Target URL when not matched (empty to ignore)","redirection")})})]})};const eb=function(){return(0,u.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:[(0,u.jsx)("circle",{transform:"translate(8 0)",cx:"0",cy:"16",r:"0",children:(0,u.jsx)("animate",{attributeName:"r",values:"0; 4; 0; 0",dur:"1.2s",repeatCount:"indefinite",begin:"0",keyTimes:"0;0.2;0.7;1",keySplines:"0.2 0.2 0.4 0.8;0.2 0.6 0.4 0.8;0.2 0.6 0.4 0.8",calcMode:"spline"})}),(0,u.jsx)("circle",{transform:"translate(16 0)",cx:"0",cy:"16",r:"0",children:(0,u.jsx)("animate",{attributeName:"r",values:"0; 4; 0; 0",dur:"1.2s",repeatCount:"indefinite",begin:"0.3",keyTimes:"0;0.2;0.7;1",keySplines:"0.2 0.2 0.4 0.8;0.2 0.6 0.4 0.8;0.2 0.6 0.4 0.8",calcMode:"spline"})}),(0,u.jsx)("circle",{transform:"translate(24 0)",cx:"0",cy:"16",r:"0",children:(0,u.jsx)("animate",{attributeName:"r",values:"0; 4; 0; 0",dur:"1.2s",repeatCount:"indefinite",begin:"0.6",keyTimes:"0;0.2;0.7;1",keySplines:"0.2 0.2 0.4 0.8;0.2 0.6 0.4 0.8;0.2 0.6 0.4 0.8",calcMode:"spline"})})]})},tb=function({options:e,value:t,onSelect:r,onClose:n}){return(0,u.jsx)("ul",{children:e.map((e,i)=>(0,u.jsx)("li",{children:(0,u.jsx)("button",{type:"button",onClick:t=>function(e,t){e.preventDefault(),r(t),n()}(t,e),onKeyDown:t=>function(e,t){"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),r(t),n())}(t,e),children:(0,u.jsx)(Vy(),{searchWords:[t],textToHighlight:e.title,autoEscape:!0})})},i))})},rb=function(e){const{placeholder:t="",onChange:r,value:n,fetchData:i,name:s="text",disabled:a=!1,className:l,maxChoices:c=-1,maxLength:d=0,canMakeRequest:p=e=>e.length>0,onBlur:h,getLabel:f,setLabel:g=()=>{},loadOnFocus:_=!1,onlyChoices:y=!1}=e,[v,b]=(0,o().useState)(!1),[x,w]=(0,o().useState)([]),[j,S]=(0,o().useState)(Array.isArray(n)?"":n),k=(0,o().useRef)(null),C={"wpl-dropdowntext__suggestion__hide":c>0&&Array.isArray(n)&&n.length>=c,"wpl-dropdowntext__suggestion":c>1},T=function(e,t,r,n){var i=this,s=(0,o().useRef)(null),a=(0,o().useRef)(0),l=(0,o().useRef)(0),c=(0,o().useRef)(null),u=(0,o().useRef)([]),d=(0,o().useRef)(),p=(0,o().useRef)(),h=(0,o().useRef)(e),f=(0,o().useRef)(!0),m=(0,o().useRef)(),g=(0,o().useRef)();h.current=e;var _="undefined"!=typeof window,y=!t&&0!==t&&_;if("function"!=typeof e)throw new TypeError("Expected a function");t=+t||0;var v=!!(r=r||{}).leading,b=!("trailing"in r)||!!r.trailing,x=!!r.flushOnExit&&b,w="maxWait"in r,j="debounceOnServer"in r&&!!r.debounceOnServer,S=w?Math.max(+r.maxWait||0,t):null,k=(0,o().useMemo)(function(){var e=function(e){var t=u.current,r=d.current;return u.current=d.current=null,a.current=e,l.current=l.current||e,p.current=h.current.apply(r,t)},r=function(e,t){y&&cancelAnimationFrame(c.current),c.current=y?requestAnimationFrame(e):setTimeout(e,t)},o=function(e){if(!f.current)return!1;var r=e-s.current;return!s.current||r>=t||r<0||w&&e-a.current>=S},k=function(t){return c.current=null,b&&u.current?e(t):(u.current=d.current=null,p.current)},C=function e(){var n=Date.now();if(v&&l.current===a.current&&T(),o(n))return k(n);if(f.current){var i=t-(n-s.current),c=w?Math.min(i,S-(n-a.current)):i;r(e,c)}},T=function(){n&&n({})},E=function(){if(_||j){var n,l=Date.now(),h=o(l);if(u.current=[].slice.call(arguments),d.current=i,s.current=l,x&&!m.current&&(m.current=function(){var e;"hidden"===(null==(e=globalThis.document)?void 0:e.visibilityState)&&g.current.flush()},null==(n=globalThis.document)||null==n.addEventListener||n.addEventListener("visibilitychange",m.current)),h){if(!c.current&&f.current)return a.current=s.current,r(C,t),v?e(s.current):p.current;if(w)return r(C,t),e(s.current)}return c.current||r(C,t),p.current}};return E.cancel=function(){var e=c.current;e&&(y?cancelAnimationFrame(c.current):clearTimeout(c.current)),a.current=0,u.current=s.current=d.current=c.current=null,e&&n&&n({})},E.isPending=function(){return!!c.current},E.flush=function(){return c.current?k(Date.now()):p.current},E},[v,w,t,S,b,x,y,_,j,n]);return g.current=k,(0,o().useEffect)(function(){return f.current=!0,function(){var e;x&&g.current.flush(),m.current&&(null==(e=globalThis.document)||null==e.removeEventListener||e.removeEventListener("visibilitychange",m.current),m.current=null),f.current=!1}},[x]),k}(E,450);function E(e){i&&(b(!0),i(e).then(e=>{k.current&&k.current.ownerDocument.activeElement===k.current&&w(e),b(!1)}).catch(()=>{w([]),b(!1)}))}function R(e){if(f)return N(e).map(t=>f(t,e))}function P(e){if(c>0){if(!N(n).find(t=>t===`${e.value}`)){const t=[`${e.value}`].concat(N(n).filter(t=>t!==`${e.value}`)).slice(0,c);r(1!==c||y?t:t[0],[e.title].concat(R(t)?.slice(1)||[])),g(e.value,e.title)}S("")}else S(e.value),r(e.value,R(n));w([])}function N(e){return Array.isArray(e)?e:e?[e]:[]}return(0,o().useEffect)(()=>{n!==j&&S(Array.isArray(n)?"":n)},[n,j]),(0,u.jsxs)("div",{className:m("wpl-dropdowntext",l,C),children:[c>0&&N(n).map(e=>(0,u.jsx)(zu,{title:e,onCancel:()=>function(e){const t=N(n).filter(t=>t!==e);g(e,null),Array.isArray(n)?r(1===c?t[0]:t,R(t)):r(""),k.current?.focus()}(e),disabled:a,children:f?f(e,n):e},e)),(0,u.jsx)("input",{type:"text",className:m("regular-text",{"wpl-dropdowntext__max":c>=0&&N(n).length>=c}),name:s,value:j,disabled:a,onChange:function(e){S(e.target.value),c<1&&r(e.target.value),i&&T&&(p(e.target.value.trim())?T(e.target.value):w([]))},maxLength:d>0?d:void 0,placeholder:t,ref:k,onFocus:function(){const e=(Array.isArray(n),n.length>0);_&&!e&&E("")},onBlur:function(e){if(e.relatedTarget&&e.relatedTarget.closest(".wpl-dropdowntext__suggestions"))return;const t=`${(h?h(j):j)??""}`;0===x.length?y?S(""):c>0&&i?P({value:t,label:t,title:t}):r(t):t!==j&&S(t),b(!1)},onKeyDown:function(e){"Enter"===e.code&&(b(!1),w([]))}}),v&&(0,u.jsx)("div",{className:"wpl-dropdowntext__loading",children:(0,u.jsx)(eb,{})}),x.length>0&&k.current&&(0,u.jsx)(Au,{align:"left",onClose:()=>w([]),popoverPosition:Ou(k.current),className:"wpl-dropdowntext__suggestions",focusLock:!1,children:(0,u.jsx)(tb,{options:x,value:j,onSelect:P,onClose:()=>w([])})})]})},nb=function(e){const{onChange:t,url:r}=e;return(0,u.jsx)(rb,{placeholder:(0,a.__)("The target URL you want to redirect, or auto-complete on post name or permalink.","redirection"),onChange:t,fetchData:function(e){return jt(At(e))},value:Array.isArray(r)?r.join(""):r||""})},ib=({onChange:e,data:t})=>{const{url:r}=t;return(0,u.jsx)(Ov,{title:(0,a.__)("Target URL","redirection"),className:"redirect-edit__target",children:(0,u.jsx)(nb,{...void 0!==r?{url:r}:{},onChange:t=>e({target:{name:"url",value:t,type:"input"}})})})},ob=({onChange:e,data:t})=>{const{url_from:r,url_notfrom:n}=t;return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(Ov,{title:(0,a.__)("Matched Target","redirection"),className:"redirect-edit__target__matched",children:(0,u.jsx)("input",{type:"text",className:"regular-text",name:"url_from",value:r,onChange:e,placeholder:(0,a.__)("Target URL when matched (empty to ignore)","redirection")})}),(0,u.jsx)(Ov,{title:(0,a.__)("Unmatched Target","redirection"),className:"redirect-edit__target__unmatched",children:(0,u.jsx)("input",{type:"text",className:"regular-text",name:"url_notfrom",value:n,onChange:e,placeholder:(0,a.__)("Target URL when not matched (empty to ignore)","redirection")})})]})},sb=({actionType:e,matchType:t,actionData:r,onChange:n})=>{if(fv(e)){const e="login"===(i=t)?Xv:"url"===i||"page"===i?ib:ob,o=mv(t,r);return(0,u.jsx)(e,{data:null===o?{}:o,onChange:n})}var i;return null},ab=(e,t)=>t.startsWith(e)||e.slice(0,t.length)===t,lb=e=>{const{url:t,flag_regex:r,action_data:n={}}=e;if(null===n||!t||!e||"string"!=typeof t)return[];const i=[],{url:o="",logged_in:s="",logged_out:l="",url_from:c="",url_notfrom:d=""}=n;if(Array.isArray(t)||0===t.length||void 0===t)return i;if(t.includes("#")&&i.push((0,u.jsx)(A,{url:"https://redirection.me/support/faq/#anchor",children:(0,a.__)("Anchor values are not sent to the server and cannot be redirected.","redirection")})),"http"===t.slice(0,4)&&!t.includes(document.location.origin))try{const e=new URL(t);i.push((0,u.jsx)(A,{url:"https://redirection.me/support/matching-redirects/#server",children:M((0,a.sprintf)(
// translators: %(server)s is the domain name
// translators: %(server)s is the domain name
(0,a.__)("This will be converted to a server redirect for the domain {{code}}%(server)s{{/code}}.","redirection"),{server:e.hostname}),{code:(0,u.jsx)("code",{})})}))}catch(e){}var p;"http"!==t.slice(0,4)&&"/"!==t.slice(0,1)&&t.length>0&&!1===r&&!t.includes("[source]")&&i.push(M((0,a.__)("The source URL should probably start with a {{code}}/{{/code}}","redirection"),{code:(0,u.jsx)("code",{})})),null===(p=t).match(/[\*\\\(\)\^\$]/)&&!p.includes(".?")||!1!==r||i.push((0,u.jsx)(A,{url:"https://redirection.me/support/redirect-regular-expressions/",children:(0,a.__)('Remember to enable the "regex" option if this is a regular expression.',"redirection")})),t.match(/%\w+%/)&&i.push((0,u.jsx)(A,{url:"tools.php?page=redirection.php&sub=site",children:(0,a.__)('Please add migrated permalinks to the Site page under the "Permalink Migration" section.',"redirection")})),t.includes("^")||t.includes("$")||!r||i.push(
// translators: %(example)s is an example regular expression
M((0,a.sprintf)(
// translators: %(example)s is an example regular expression
// translators: %(example)s is an example regular expression
(0,a.__)("To prevent a greedy regular expression you can use {{code}}^{{/code}} to anchor it to the start of the URL. For example: {{code}}%(example)s{{/code}}","redirection"),{example:"^"+t}),{code:(0,u.jsx)("code",{})})),r&&t.includes("^")&&t.indexOf("^")>0&&i.push(
// translators: %(example)s is an example regular expression with corrected caret position
M((0,a.sprintf)(
// translators: %(example)s is an example regular expression with corrected caret position
// translators: %(example)s is an example regular expression with corrected caret position
(0,a.__)("The caret {{code}}^{{/code}} should be at the start. For example: {{code}}%(example)s{{/code}}","redirection"),{example:"^"+t.replace("^","")}),{code:(0,u.jsx)("code",{})})),r&&t.match(/[a-zA-Z0-9\/]\?/)&&i.push(M((0,a.__)("To match {{code}}?{{/code}} you need to escape it with {{code}}\\?{{/code}}","redirection"),{code:(0,u.jsx)("code",{})})),r&&t.match(/[a-zA-Z0-9 ]\*/)&&i.push(M((0,a.__)("Wildcards are not supported. You need to use a {{link}}regular expression{{/link}}.","redirection"),{link:(0,u.jsx)(A,{url:"https://redirection.me/support/redirect-regular-expressions/"})})),"/(.*)"!==t&&"^/(.*)"!==t||i.push((0,a.__)("If you want to redirect everything please use a site relocation or alias from the Site page.","redirection")),t.length>0&&(c===t||d===t||s===t||l===t||o===t)&&i.push((0,a.__)("Your source is the same as a target and this will create a loop. Leave a target blank if you do not want to take action.","redirection"));const h=[n.url,n.url_from,n.url_notfrom,n.logged_in,n.logged_out].filter(e=>e);return!o||ab(o,"https://")||ab(o,"http://")||"/"===o.slice(0,1)||i.push(
// translators: %(url)s is the user's target URL
M((0,a.sprintf)(
// translators: %(url)s is the user's target URL
// translators: %(url)s is the user's target URL
(0,a.__)("Your target URL should be an absolute URL like {{code}}https://domain.com/%(url)s{{/code}} or start with a slash {{code}}/%(url)s{{/code}}.","redirection"),{url:n.url}),{code:(0,u.jsx)("code",{})})),!1===r&&h.forEach(e=>{const t=e.match(/[|\\\$]/g);null!==t&&i.push(
// translators: %(invalid)s is an invalid character in the URL
M((0,a.sprintf)(
// translators: %(invalid)s is an invalid character in the URL
// translators: %(invalid)s is an invalid character in the URL
(0,a.__)("Your target URL contains the invalid character {{code}}%(invalid)s{{/code}}","redirection"),{invalid:t}),{code:(0,u.jsx)("code",{})}))}),[t,...h].forEach(e=>{const t=(e=>{const t=e.match(/^\/([a-zA-Z0-9_\-%]*\..*)\//);return t&&!e.includes("index.php")?t[0]:null})(e);t&&i.push(
// translators: %(relative)s is the relative URL, %(absolute)s is the suggested absolute URL
M((0,a.sprintf)(
// translators: %(relative)s is the relative URL, %(absolute)s is the suggested absolute URL
// translators: %(relative)s is the relative URL, %(absolute)s is the suggested absolute URL
(0,a.__)("Your URL appears to contain a domain inside the path: {{code}}%(relative)s{{/code}}. Did you mean to use {{code}}%(absolute)s{{/code}} instead?","redirection"),{relative:t,absolute:"https://"+t}),{code:(0,u.jsx)("code",{})}))}),null!==t.match(/(\.html|\.htm|\.php|\.pdf|\.jpg)$/)&&i.push((0,u.jsx)(A,{url:"https://redirection.me/support/problems/url-not-redirecting/",children:(0,a.__)("Some servers may be configured to serve file resources directly, preventing a redirect occurring.","redirection")})),i},cb=({warnings:e})=>0===e.length?null:(0,u.jsx)(Ov,{children:(0,u.jsx)("div",{className:"redirect-edit_warning notice notice-warning redirection-notice",children:e.map((e,t)=>(0,u.jsxs)("p",{children:[(0,u.jsx)("span",{className:"dashicons dashicons-info"}),e]},t))})});function ub(e){const t=p(),{incrementProgress:r,decrementProgress:n,addNotice:i,addError:o}=tn(),{setRedirectsTable:s}=$_();return ft({mutationFn:async({items:e,params:i={}})=>{r();try{return await t.cancelQueries({queryKey:Xr.redirects.lists()}),await jt(ir("delete",{items:e},i))}catch(e){throw n(),Yr(e)}},onSuccess:(e,r)=>{n(),i("Redirects deleted"),s(ad(r.params)),t.invalidateQueries({queryKey:Xr.redirects.lists()})},onError:e=>{o(e.message||"Failed to delete redirects")},...e})}function db(e,t){const r=p(),{incrementProgress:n,decrementProgress:i,addNotice:o,addError:s}=tn(),{setRedirectsSelected:a}=$_();return ft({mutationFn:async({items:t})=>{n();try{return await r.cancelQueries({queryKey:Xr.redirects.lists()}),await jt(ir(e,{items:t},{}))}catch(e){throw i(),Yr(e)}},onSuccess:()=>{i(),o(`Redirects ${e}d`),a([]),r.invalidateQueries({queryKey:Xr.redirects.lists()})},onError:t=>{s(t.message||`Failed to ${e} redirects`)},...t})}const pb=function(e){const{item:t,onCancel:r,saveButton:n=(0,a.__)("Save","redirection"),childSave:i,callback:s,canSave:l,autoFocus:c,children:d}=e,{data:h,isSuccess:f,refetch:m}=dd(),g=(0,o().useMemo)(()=>h?.items??[],[h]),_=$_(e=>e.redirectsAddTop),y=$_(e=>e.redirects),{setRedirectsAddTop:v}=$_(),b=he(e=>e.values),x=tn(e=>e.addError),w=b?.auto_target||"",j=(0,o().useMemo)(()=>b?{flag_case:b.flag_case,flag_trailing:b.flag_trailing,flag_regex:b.flag_regex,flag_query:b.flag_query}:{},[b]),{mutate:S}=function(){const e=p(),{incrementProgress:t,decrementProgress:r,addNotice:n,addError:i}=tn();return ft({mutationFn:async n=>{t();try{await e.cancelQueries({queryKey:Xr.redirects.lists()});const{id:t,...r}=n,i=await jt(Nt(t,r));return id.parse(i).item}catch(e){throw r(),Yr(e)}},onSuccess:t=>{r(),n("Redirect saved"),e.invalidateQueries({queryKey:Xr.redirects.lists()}),e.invalidateQueries({queryKey:Xr.redirects.detail(t.id)})},onError:e=>{i(e.message||"Failed to update redirect")}})}(),{mutate:k}=function(){const e=p(),{incrementProgress:t,decrementProgress:r,addNotice:n,addError:i}=tn();return ft({mutationFn:async n=>{t();try{await e.cancelQueries({queryKey:Xr.redirects.lists()});const t=await jt(Ot(n));return nd.parse(t).items[0]??null}catch(e){throw r(),Yr(e)}},onSuccess:()=>{r(),n("Redirect created"),e.invalidateQueries({queryKey:Xr.redirects.lists()})},onError:e=>{i(e.message||"Failed to create redirect")}})}(),C=(0,o().useRef)(null),T=(0,o().useRef)(!1),E=(0,o().useCallback)(e=>{if(((e,t)=>e.find(e=>e.id===t))(g,e))return e;if(y.filterBy&&"object"==typeof y.filterBy&&"group"in y.filterBy&&y.filterBy.group&&parseInt(String(y.filterBy.group),10)>0)return parseInt(String(y.filterBy.group),10);if(g&&g.length>0){const e=g.find(e=>e.default);return e?e.id:g[0].id}return 0},[g,y.filterBy]),R=g.length>0,P=f&&!R;(0,o().useEffect)(()=>{R?T.current=!1:f&&!T.current&&(T.current=!0,m())},[R,f,m]);const{url:N,match_data:O,match_type:A,action_type:I,action_data:F,group_id:L=0,title:D,action_code:z,position:M=0}=t,{flag_regex:$=!1,flag_trailing:U=!1,flag_case:B=!1,flag_query:q="exact"}=O?.source??{},H={url:N,title:D,flag_regex:$,flag_trailing:U,flag_case:B,flag_query:q,match_type:A,action_type:I,action_code:z,action_data:mv(A,F),options:O?.options??{},group_id:E(L),position:M,warning:[],advanced:!1},[W,G]=(0,o().useState)(H),V=(0,o().useCallback)(()=>{const{match_type:e,action_type:t,title:r,action_code:n}=W;return"url"===e&&"url"===t&&""===r&&301===n},[W]);(0,o().useEffect)(()=>{G(e=>({...e,advanced:!V()}))},[]),(0,o().useEffect)(()=>{G(e=>({...e,warning:lb(e)}))},[W.url,W.action_type,W.match_type,W.action_data]),(0,o().useEffect)(()=>{s&&C.current&&s(C.current.clientHeight)},[W,s]);const Z=(0,o().useCallback)(()=>{const e=gv("",W.group_id,j);G(t=>({...t,url:e.url,title:"",flag_regex:e.match_data.source.flag_regex,flag_trailing:e.match_data.source.flag_trailing,flag_case:e.match_data.source.flag_case,flag_query:e.match_data.source.flag_query,match_type:e.match_type,action_type:e.action_type,action_code:e.action_code,action_data:e.action_data,options:e.match_data.options,position:0,advanced:!1,warning:[]}))},[W.group_id,j]),K=(0,o().useCallback)(e=>{e.preventDefault();const{url:n,title:o,flag_regex:s,flag_trailing:c,flag_case:u,flag_query:d,match_type:p,action_type:h,group_id:f,action_code:m,position:_,action_data:y,options:v}=W,b=f>0?f:g[0]?.id;if(void 0===b)return void x((0,a.__)("Unable to create a redirect because no groups are available. Please reload the page.","redirection"));const w={...t.id?{id:parseInt(String(t.id),10)}:{},url:n,title:o,match_data:{source:{flag_regex:s,flag_trailing:c,flag_case:u,flag_query:d},...v?{options:v}:{}},match_type:p,action_type:h,...void 0!==_?{position:_}:{},...void 0!==b?{group_id:b}:{},action_code:"number"==typeof m?m:parseInt(String(m),10),action_data:mv(p,y)};l&&!l(Array.isArray(n))||(w.id?S({id:w.id,...w}):k(w),r?r(e):Z(),i&&i())},[W,g,t.id,l,S,k,r,Z,i,x]),Q=(0,o().useCallback)(e=>{G(t=>({...t,...e,warning:lb({...t,...e})}))},[]),J=(0,o().useCallback)(e=>{e.preventDefault(),Q({advanced:!W.advanced})},[W.advanced,Q]),Y=(0,o().useCallback)(e=>{G(t=>({...t,group_id:parseInt(e.target.value,10)}))},[]),X=(0,o().useCallback)(e=>{const t={};Object.keys(j).filter(e=>"flag_query"!==e).forEach(e=>{t[e]=!1}),Q({...t,...e})},[j,Q]),ee=(0,o().useCallback)(e=>{const{target:t}=e,r="checkbox"===t.type?t.checked:t.value;return{[t.name]:r}},[]),te=(0,o().useCallback)(e=>{const t=ee(e);t.action_data=mv(t.match_type,W.action_data),"login"===t.match_type&&(t.action_type="url"),Q(t)},[W.action_data,ee,Q]),re=(0,o().useCallback)(e=>{Q(ee(e))},[ee,Q]),ne=(0,o().useCallback)(e=>{G(t=>({...t,options:{...t.options,[e.target.name]:e.target.checked??e.target.value}}))},[]),ie=(0,o().useCallback)(e=>{const t=ee(e).action_type;var r;Q({action_type:t,action_code:(r=t,"error"===r?404:r===nv?200:301),action_data:mv(W.match_type,W.action_data||{})})},[W.match_type,W.action_data,ee,Q]),oe=(0,o().useCallback)(e=>{const t={action_data:{...W.action_data,...ee(e)}};Q(t)},[W.action_data,ee,Q]),se=(0,o().useCallback)(()=>{const{match_type:e,action_type:t,action_data:r,url:n,group_id:i}=W;return!(!R&&i<=0||0===n.length&&!w||fv(t)&&(o=e,(!(s=r)||"url"!==o&&"page"!==o&&!(o===ov?s.logged_in||s.logged_out:o===sv?s.referrer:o===av?s.agent:o===lv||o===cv?s.name&&s.value:o===uv?s.filter:o===dv?s.role:o===pv?s.server:"ip"===o?s.ip:o===hv&&s.language))&&""===w));var o,s},[W,w,R]),{url:ae,advanced:le,flag_regex:ce,action_type:ue,match_type:de,action_data:pe,flag_query:fe,group_id:me,position:ge,title:_e,action_code:ye,options:ve,warning:be}=W,xe=P?[(0,a.__)("No groups are available. Reload the page before creating a redirect.","redirection"),...be]:be;return(0,u.jsx)("form",{onSubmit:K,ref:C,children:(0,u.jsx)("table",{className:"redirect-edit inline-edit-row",children:(0,u.jsxs)("tbody",{children:[(0,u.jsx)(Iv,{url:ae,flags:W,defaultFlags:j,autoFocus:c??!1,onFlagChange:X,onChange:re}),(0,u.jsx)(Fv,{query:fe,regex:ce,onChange:re,url:ae}),le&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(zv,{title:_e,onChange:e=>Q(e)}),(0,u.jsx)(Uv,{matchType:de,onChange:te}),(0,u.jsx)(Yv,{matchType:de,actionData:pe,onChange:oe}),(0,u.jsxs)(Ov,{title:(0,a.__)("When matched","redirection"),className:"redirect-edit__action",children:[(0,u.jsx)($v,{actionType:ue,matchType:de,onChange:ie}),(0,u.jsx)(Mv,{actionType:ue,actionCode:ye,onChange:re}),le&&["url","random"].includes(ue)?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("input",{id:"redirect-log-exclude",type:"checkbox",name:"log_exclude",checked:Boolean(ve.log_exclude),onChange:ne}),(0,u.jsx)("label",{htmlFor:"redirect-log-exclude",children:(0,a.__)("Exclude from logs","redirection")})]}):null]})]}),(0,u.jsx)(sb,{actionType:ue,matchType:de,actionData:pe,onChange:oe}),(0,u.jsxs)(Ov,{title:(0,a.__)("Group","redirection"),className:"redirect-edit__group",children:[(0,u.jsx)(Lv,{groups:g,currentGroup:me,onChange:Y}),le&&(0,u.jsx)(Dv,{position:ge,onChange:re})]}),d&&d,(0,u.jsx)(Ov,{children:(0,u.jsxs)("div",{className:"table-actions",children:[(0,u.jsx)(Ul,{isPrimary:!0,isSecondary:!1,isSubmit:!0,disabled:!se(),children:n})," "," ",r&&(0,u.jsx)(Ul,{onClick:r,children:(0,a.__)("Cancel","redirection")}),_&&!r&&(0,u.jsx)(Ul,{onClick:e=>{e.preventDefault(),v(!1)},children:(0,a.__)("Close","redirection")})," ",V()&&(0,u.jsx)("button",{type:"button",onClick:J,className:"redirection-edit_advanced",title:(0,a.__)("Show advanced options","redirection"),children:(0,u.jsx)("svg",{"aria-hidden":"true",role:"img",focusable:"false",xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",children:(0,u.jsx)("path",{d:"M18 12h-2.18c-.17.7-.44 1.35-.81 1.93l1.54 1.54-2.1 2.1-1.54-1.54c-.58.36-1.23.63-1.91.79V19H8v-2.18c-.68-.16-1.33-.43-1.91-.79l-1.54 1.54-2.12-2.12 1.54-1.54c-.36-.58-.63-1.23-.79-1.91H1V9.03h2.17c.16-.7.44-1.35.8-1.94L2.43 5.55l2.1-2.1 1.54 1.54c.58-.37 1.24-.64 1.93-.81V2h3v2.18c.68.16 1.33.43 1.91.79l1.54-1.54 2.12 2.12-1.54 1.54c.36.59.64 1.24.8 1.94H18V12zm-8.5 1.5c1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3 1.34 3 3 3z"})})})]})}),(0,u.jsx)(cb,{warnings:xe})]})})})};const hb=function(e){const{onClose:t,redirect:r,rows:n}=e,i=he(e=>e.values),s={flag_regex:i?.flag_regex||!1,flag_trailing:i?.flag_trailing||!1,flag_case:i?.flag_case||!1,flag_query:i?.flag_query||"exact"},{mutate:l}=G_(),c=function(e,t){return e?Array.isArray(e)?[...new Set(e.map(e=>function(e,t){const r=t.find(t=>t.id===e||t.id===parseInt(e,10));return r?r.url:e}(e,t)))]:e:""}(r.url,n),[d,p]=(0,o().useState)(!1),h={...gv(Array.isArray(c)?c[0]??"":c,0,s),...r,url:c};return(0,u.jsx)(jd,{onClose:t,padding:!0,children:(0,u.jsx)("div",{className:"add-new",children:(0,u.jsx)(pb,{item:h,saveButton:(0,a.__)("Add Redirect","redirection"),onCancel:t,childSave:()=>{return d&&(e=Array.isArray(c)?c:[c],void l({action:"delete",items:e,params:{groupBy:"url",deleteConfirm:!0}}));var e},canSave:e=>d&&confirm(e?(0,a.__)("Are you sure you want to delete the selected items?","redirection"):(0,a.__)("Are you sure you want to delete this item?","redirection"))||!d,autoFocus:!0,children:ky(Py)&&(0,u.jsxs)("tr",{children:[(0,u.jsx)("th",{children:(0,a.__)("Delete Log Entries","redirection")}),(0,u.jsxs)("td",{className:"edit-left",style:{padding:"7px 0px"},children:[(0,u.jsx)("input",{id:"create-redirect-delete-log",type:"checkbox",checked:d,onChange:e=>p(e.target.checked)}),(0,u.jsx)("label",{htmlFor:"create-redirect-delete-log",children:Array.isArray(c)&&c.length<=1||!Array.isArray(c)?(0,a.__)("Delete logs for this entry","redirection"):(0,a.__)("Delete logs for these entries","redirection")})]})]})})})})},fb=function(e){const{row:t,onDelete:r,onCreate:n,table:i,disabled:o}=e,{setErrorsTable:s}=$_(),{url:l,ip:c,agent:d,id:p}=t,{groupBy:h}=i,f=[];return f.push((0,u.jsx)(Oy,{onClick:()=>r(p),capability:Py,children:(0,a.__)("Delete","redirection")},"0")),f.push((0,u.jsx)(Oy,{onClick:()=>n(Nv(h,"ip"===h?[p]:""===h?l:p)),capability:Ey,children:(0,a.__)("Add Redirect","redirection")},"1")),d&&f.unshift((0,u.jsx)(My,{agent:d},"3")),f.push((0,u.jsx)(Oy,{onClick:()=>{return e=ld(h,""===h?t.url:String(t.id)),void s({filterBy:e,page:0,groupBy:"",selected:[],selectAll:!1});var e},capability:Ty,children:(0,a.__)("Show All","redirection")},"4")),"ip"===h?f.push((0,u.jsx)(Oy,{onClick:()=>n(Nv("block",[c])),capability:Ey,children:(0,a.__)("Block IP","redirection")},"5")):"agent"!==h&&f.push((0,u.jsx)(Oy,{onClick:()=>n(Nv("ignore",l)),capability:Ey,children:(0,a.__)("Ignore URL","redirection")},"6")),(0,u.jsx)(Ny,{disabled:o,actions:f})};function mb(e){return e.url?hd(fd(e.domain),e.url):""}function gb(e){return e.includes("url")?e:e.concat(["url"])}const _b=function(){const e=$_(e=>e.errors),{setErrorsTable:t,setErrorsSelected:r}=$_(),n=he(e=>e.values),[i,s]=(0,o().useState)(null);V_({table:e,setTable:t,allowedGroup:["url","ip","agent"],allowedFilters:["url","url-exact","referrer","agent","ip","domain","method"],pageName:"404s"});const l=G_(),c=an(),{data:d,isFetching:p}=function(e={},t){const r=ud(e);return dt({queryKey:Xr.errors.list(r),placeholderData:e=>e,queryFn:async()=>{try{const e=await jt(Mt(r));return W_.parse(e)}catch(e){const t=Yr(e);throw tn.getState().addError(t.message||"Failed to fetch 404 errors"),t}},...t})}(e),h=d?.items??[],f=d?.total??0;let m="idle";function g(e){r([]),s(e)}function _(t){if(!window.confirm((0,a.__)("Are you sure you want to delete this item?","redirection")))return;const r=e.groupBy?{groupBy:e.groupBy}:{};l.mutate({action:"delete",items:[t],params:r})}p&&!d?m=Z_:d&&(m=K_);const y=e=>{t({filterBy:e,page:0,selected:[],selectAll:!1})},v={...e,...(b=e.groupBy,b?{displayOptions:Ev(b),displaySelected:Tv(b)[0]?.grouping||[]}:{})};var b;const x={page:e.page,perPage:e.per_page,orderBy:e.orderby||"date",direction:e.direction,selected:e.selected??[],selectAll:e.selectAll??!1,filter:"",filterBy:e.filterBy??{},displayType:e.displayType??"standard",displaySelected:v.displaySelected??[],groupBy:e.groupBy??""},w={displayFilters:Ev(v.groupBy),displayGroups:Tv(v.groupBy),searchOptions:[{name:"url",title:(0,a.__)("Search URL","redirection")},{name:"url-exact",title:(0,a.__)("Search exact URL","redirection")},{name:"referrer",title:(0,a.__)("Search referrer","redirection")},{name:"agent",title:(0,a.__)("Search user agent","redirection")},{name:"ip",title:(0,a.__)("Search IP","redirection")},{name:"domain",title:(0,a.__)("Search domain","redirection")}],groupBy:Cv(n?.ip_logging||0),bulk:kv(v.groupBy),rowFilters:v.groupBy?[]:[{label:(0,a.__)("Method","redirection"),value:"method",options:[{label:"GET",value:"get"},{label:"POST",value:"post"},{label:"HEAD",value:"head"}]},{label:(0,a.__)("HTTP Status Code","redirection"),value:"http",options:xv().filter(e=>parseInt(e.value,10)>=400&&parseInt(e.value,10)<500)}],headers:Sv(v.groupBy).filter(e=>function(e,t){return t.displaySelected.includes(e)}(e.name,v)),validateDisplay:gb},j={onChangePage:e=>{t({page:e,selected:[],selectAll:!1})},onBulk:function(t){if(0===e.selected.length&&!e.selectAll)return;if("export-csv"===t||"export-json"===t){const r={...ud({...e.groupBy?{groupBy:e.groupBy}:{},...e.selectAll?{global:!0,filterBy:e.filterBy}:{items:e.selected}}),displaySelected:v.displaySelected??[]};return void c.mutate({exportType:"404",format:"export-csv"===t?"csv":"json",download:!0,filename:ev("404","export-csv"===t?"csv":"json"),params:r})}if("delete"===t){const t=e.selectAll?(0,a.__)("Are you sure you want to delete all items?","redirection"):(0,a.__)("Are you sure you want to delete the selected items?","redirection");if(!window.confirm(t))return}const r=e.groupBy?{groupBy:e.groupBy}:{};"delete"===t?e.selectAll?l.mutate({action:"delete",items:[],params:ud({...r,global:!0,filterBy:e.filterBy})}):l.mutate({action:"delete",items:e.selected,params:r}):s(Nv(t,e.selected))},onGroup:e=>{t({groupBy:e,selected:[],selectAll:!1})},onSetOrder:(e,r)=>{t({orderby:"date"===e?"":e,direction:r})},onFilter:y,onSetDisplay:(e,r)=>{t({displayType:e,displaySelected:r})},onSelect:n=>{if("boolean"==typeof n)r(n?h.map(e=>e.id):[]);else if("number"==typeof n||"string"==typeof n){const r=Array.isArray(e.selected)?e.selected:[],i=r.includes(n)?r.filter(e=>e!==n):[...r,n];t({selected:i,selectAll:!1})}else r(n)},onSetAll:e=>{t({selected:e?h.map(e=>e.id):[],selectAll:e})}};return(0,u.jsxs)(u.Fragment,{children:[i&&(0,u.jsx)(hb,{onClose:()=>s(null),redirect:i,rows:h}),(0,u.jsx)(Sy,{logOptions:w,logActions:j,table:x,status:m,total:f,rows:h,saving:[],getRow:(e,t)=>function(e,t){const{created:r,created_time:n,url:i,agent:o,referrer:s,ip:l,domain:c,request_method:d,http_code:p,count:h}=e,f=t?.table?.filterBy||{},m=f.url||f["url-exact"]||"";return[{name:"date",content:r?(0,u.jsxs)(u.Fragment,{children:[r,n&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("br",{}),n]})]}):""},{name:"method",content:d?d.toUpperCase():""},{name:"domain",content:c??""},{name:"url",content:i?(0,u.jsx)(A,{url:mb(e),children:(0,u.jsx)(Vy(),{searchWords:[m],textToHighlight:i,autoEscape:!0})}):""},{name:"code",content:p??""},{name:"referrer",content:s?(0,u.jsx)(Vy(),{searchWords:[f.referrer||""],textToHighlight:s,autoEscape:!0}):""},{name:"agent",content:o?(0,u.jsx)(Vy(),{searchWords:[f.agent||""],textToHighlight:o,autoEscape:!0}):""},{name:"ip",content:l?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("a",{href:"https://redirect.li/ip/?ip="+encodeURIComponent(l),children:(0,u.jsx)(Vy(),{searchWords:[f.ip||""],textToHighlight:l,autoEscape:!0})}),""===t?.table?.groupBy&&t?.onFilter&&(0,u.jsx)(Ny,{actions:[(0,u.jsx)(Oy,{onClick:()=>{t.onFilter?.({ip:l})},children:(0,a.__)("Filter by IP","redirection")},"filter-ip")]})]}):""},{name:"count",content:h?new Intl.NumberFormat(window.Redirectioni10n.locale).format(h):""}]}(e,{...t,onFilter:y}),getRowActions:(e,t)=>(0,u.jsx)(fb,{disabled:!1,row:e,onCreate:g,onDelete:_,table:t.table}),renderTableActions:()=>ky(Py)&&function(e){const{filterBy:t,groupBy:r}=e;return void 0!==t.url||!r&&0===Object.keys(t).length}(v)?(0,u.jsx)(Wy,{enabled:h.length>0,children:null}):(0,u.jsx)(u.Fragment,{})})]})},yb=function({error:e}){if(!e||"object"!=typeof e)return null;const t=e,r=function(e){return void 0!==e.code?String(e.code):e.name&&"Error"!==e.name?e.name:null}(t);return(0,u.jsxs)("div",{className:"wpl-error import-export-error",children:[(0,u.jsxs)("p",{children:[r&&(0,u.jsxs)("strong",{children:[r,": "]}),t.message||(0,a.__)("An unknown error occurred.","redirection")]}),(0,u.jsx)($,{error:t,links:Q(),locale:"redirection"}),(0,u.jsx)(cn,{error:t})]})},vb=function({title:e,badge:t,meta:r=[],stats:n=[],className:i="",actions:o,children:s,variant:a="default",wrapped:l=!0}){const c=(0,u.jsxs)(u.Fragment,{children:[(0,u.jsxs)("div",{className:"file-sniff__header",children:[(0,u.jsx)("div",{className:"file-sniff__name",children:e}),t&&(0,u.jsx)("div",{className:"file-sniff__badge",children:t})]}),r.length>0&&(0,u.jsx)("div",{className:"file-sniff__meta",children:r.map(e=>(0,u.jsxs)("div",{className:m("file-sniff__meta-row",{"file-sniff__meta-row--full-width":e.fullWidth}),children:[(0,u.jsx)("div",{className:"file-sniff__meta-label",children:e.label}),(0,u.jsx)("div",{className:"file-sniff__meta-value",children:e.value}),e.description&&(0,u.jsx)("div",{className:"file-sniff__meta-description",children:e.description})]},e.label))}),n.length>0&&(0,u.jsx)("div",{className:"file-sniff__stats",children:n.map(e=>(0,u.jsxs)("div",{className:"file-sniff__stat",children:[(0,u.jsx)("div",{className:"file-sniff__stat-value",children:e.value}),(0,u.jsx)("div",{className:"file-sniff__stat-label",children:e.label})]},e.label))}),s,o&&(0,u.jsx)("div",{className:"import-source-card__actions",children:o})]});return l?(0,u.jsx)("div",{className:m("file-sniff__card",i,{"file-sniff__card--success":"success"===a}),children:c}):c},bb=function(e){const{plugin:t,onSelect:r,isActive:n=!1,isImporting:i=!1}=e,{name:o,description:s,source:l,total:c}=t;return(0,u.jsx)(vb,{title:o,badge:(0,a.__)("Plugin","redirection"),meta:[{label:(0,a.__)("Import type","redirection"),value:s},{label:(0,a.__)("Stored in","redirection"),value:l}],stats:[{label:(0,a._n)("Redirect","Redirects",c,"redirection"),value:c}],actions:(0,u.jsx)("button",{type:"button",onClick:()=>{r(t)},className:"button-secondary",disabled:i,children:n?(0,a.__)("Clear importer","redirection"):(0,a.__)("Use importer","redirection")}),className:m("import-source-card","import-source-card--plugin",{"import-source-card--active":n})})},xb=[",",";","|","\t"];function wb(e){return e.name.toLowerCase().endsWith(".json")}function jb(e){const t=e.replace(/^\ufeff/,"").trim();if(0===t.length)return{format:"other",valid:!1,error:"read-failed"};if(t.startsWith("{")||t.startsWith("["))return Tb(e);const r=Sb(e);if(r.valid)return r;const n=Cb(e);return n.valid?n:Eb(e)}function Sb(e){const t=e.replace(/^\ufeff/,"").replace(/\r\n/g,"\n").replace(/\r/g,"\n").split("\n").map(e=>e.trim()).filter(e=>e.length>0&&!e.startsWith("#"));if(0===t.length)return{format:"apache",valid:!1,error:"unknown-apache-layout"};let r=0;const n=new Set;return t.forEach(e=>{/^rewriterule\s+/i.test(e)?(r+=1,n.add("rewrite")):/^redirectmatch\s+/i.test(e)?(r+=1,n.add("redirectmatch")):/^redirect\s+/i.test(e)&&(r+=1,n.add("redirect"))}),0===r?{format:"apache",valid:!1,error:"unknown-apache-layout"}:{format:"apache",valid:!0,importSupported:!0,rules:r,ruleTypes:Array.from(n)}}const kb=["301","302","303","307","308"];function Cb(e){const t=e.replace(/^\ufeff/,"").replace(/\r\n/g,"\n").replace(/\r/g,"\n").split("\n").map(e=>e.trim()).filter(e=>e.length>0&&!e.startsWith("#"));let r=0;return t.forEach(e=>{const t=e.split(/\s+/);if(t.length<2||t.length>3)return;const n=t[0]||"",i=t[1]||"",o=(t[2]||"301").replace(/!$/,"");if(!kb.includes(o))return;if(/:(?!splat\b)[a-zA-Z_]/.test(`${n} ${i}`))return;const s=(n.match(/\*/g)||[]).length;s>1||1===s&&!n.endsWith("*")||0===s&&i.includes(":splat")||r++}),0===r?{format:"redirects-file",valid:!1,error:"unknown-redirects-file-layout"}:{format:"redirects-file",valid:!0,importSupported:!0,rules:r}}function Tb(e){try{const t=JSON.parse(e.replace(/^\ufeff/,"")),r={};if("object"!=typeof t||null===t||Array.isArray(t))return{format:"json",valid:!1,error:"not-redirection-json"};if(Array.isArray(t.groups)&&(r.groups=t.groups.length),Array.isArray(t.redirects)&&(r.redirects=t.redirects.length),"object"==typeof t.settings&&null!==t.settings&&(r.settings=Object.keys(t.settings).length),Array.isArray(t.logs)&&(r.logs=t.logs.length),Array.isArray(t.errors_404)&&(r.errors_404=t.errors_404.length),0===Object.keys(r).length)return{format:"json",valid:!1,error:"not-redirection-json"};const n={format:"json",valid:!0,contents:r};return"string"==typeof t.plugin?.version&&(n.version=t.plugin.version),n}catch{return{format:"json",valid:!1,error:"invalid-json"}}}function Eb(e){const t=e.replace(/^\ufeff/,"").replace(/\r\n/g,"\n").replace(/\r/g,"\n").split("\n").map(e=>e.trim()).filter(e=>e.length>0);if(0===t.length)return{format:"csv",valid:!1,error:"empty-csv"};const r=t.slice(0,5),n=function(e){let t=null;for(const r of xb){const n=e.map(e=>Rb(e,r).length),i=n[0]||0;if(i<2)continue;const o=n.filter(e=>e===i).length,s=10*o+i;(null===t||s>t.score)&&(t={separator:r,columns:i,score:s})}return t}(r);if(null===n)return{format:"csv",valid:!1,error:"separator-not-detected"};const i=function(e){return Nb(e,["source","target"])||Nb(e,["source url","target url"])?"redirects":Nb(e,["id","name","module_id","status"])?"groups":Nb(e,["date","source","target","ip","referrer","agent"])?"logs":Nb(e,["date","source","ip","referrer","useragent"])?"errors_404":null}(Rb(r[0]||"",n.separator).map(Pb));return null===i?function(e){if(e.length<2||e.length>4)return!1;const t=e[0]?.trim()||"",r=e[1]?.trim()||"",n=e[2]?.trim(),i=e[3]?.trim();if(0===t.length||0===r.length)return!1;if(void 0!==n&&""!==n&&"0"!==n&&"1"!==n)return!1;if(void 0!==i&&""!==i){const e=Number(i);if(!Number.isInteger(e)||e<100||e>599)return!1}return!0}(Rb(r[0]||"",n.separator))?{format:"csv",valid:!0,type:"redirects",importSupported:!0,separator:n.separator,columns:n.columns,rows:t.length}:{format:"csv",valid:!1,separator:n.separator,columns:n.columns,rows:Math.max(t.length-1,0),error:"unknown-csv-layout"}:{format:"csv",valid:!0,type:i,importSupported:"redirects"===i,separator:n.separator,columns:n.columns,rows:Math.max(t.length-1,0)}}function Rb(e,t){const r=[];let n="",i=!1;for(let o=0;o<e.length;o++){const s=e[o],a=e[o+1];'"'===s?i&&'"'===a?(n+='"',o++):i=!i:s!==t||i?n+=s:(r.push(n),n="")}return r.push(n),r}function Pb(e){return e.trim().toLowerCase().replace(/\s+/g," ")}function Nb(e,t){return!(e.length<t.length)&&t.every((t,r)=>e[r]===t)}function Ob(e){if(null!==e&&e.valid){if("json"===e.format)return e.format;if("apache"===e.format||"csv"===e.format||"redirects-file"===e.format)return e.importSupported?e.format:void 0}}const Ab=function({activeImportType:e,file:t,fileInfo:r,fileInputRef:n,hover:i,importingStatus:o,isImporting:s,isSniffing:l,onAddFileClick:c,onClearFile:d,onClick:p,onFileInputChange:h}){const f=e=>(0,a._n)("Redirect rule","Redirect rules",e,"redirection"),g=m("dropzone","import-source-card",{"dropzone-dropped":!1!==t,"dropzone-importing":"loading"===o,"dropzone-hover":i,"import-source-card--active":"file"===e&&!1!==t}),_="file"!==e&&!1!==t;return(0,u.jsxs)("div",{className:g,onClick:_?p:void 0,onKeyDown:_?e=>{_&&("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),p()))}:void 0,role:_?"button":void 0,tabIndex:_?0:void 0,children:[(0,u.jsx)("input",{ref:n,type:"file",style:{display:"none"},onChange:h}),!1===t?(0,u.jsx)(vb,{title:(0,a.__)("Import file","redirection"),badge:(0,a.__)("File","redirection"),meta:[{label:(0,a.__)("Import type","redirection"),value:(0,a.__)("Upload a file","redirection")},{label:(0,a.__)("Supported formats","redirection"),value:(0,a.__)("CSV, JSON, .htaccess, and _redirects","redirection")}],children:(0,u.jsx)("div",{className:"file-sniff__meta-description",children:(0,a.__)("Drag and drop a file anywhere on this page.","redirection")}),actions:(0,u.jsx)("button",{type:"button",className:"button-secondary",onClick:c,children:(0,a.__)("Add file","redirection")}),wrapped:!1}):(0,u.jsxs)("div",{className:"dropzone-selected",children:[(()=>{if(!1===t)return null;if(l)return(0,u.jsx)("p",{children:(0,a.__)("Inspecting file…","redirection")});if(null===r)return null;if(!r.valid)return(0,u.jsx)("div",{className:"inline-notice inline-error",children:(0,u.jsx)("p",{children:"not-redirection-json"===r?.error?(0,a.__)("Not a Redirection JSON export","redirection"):"invalid-json"===r?.error?(0,a.__)("Invalid JSON","redirection"):"empty-csv"===r?.error?(0,a.__)("Empty CSV file","redirection"):"separator-not-detected"===r?.error?(0,a.__)("Unable to detect a CSV separator","redirection"):"unknown-csv-layout"===r?.error?(0,a.__)("Unknown CSV layout","redirection"):"unknown-apache-layout"===r?.error?(0,a.__)("Unknown Apache .htaccess layout","redirection"):"unknown-redirects-file-layout"===r?.error?(0,a.__)("This doesn't look like a valid _redirects file — check the from/to/status syntax on each line.","redirection"):"unsupported-file-type"===r?.error?(0,a.__)("Unsupported file type","redirection"):"read-failed"===r?.error?(0,a.__)("Unable to read file","redirection"):""})});const e=[{label:(0,a.__)("Details","redirection"),value:!1===t?"":t.size<1024?`${t.size} B`:t.size<1048576?`${(t.size/1024).toFixed(1)} KB`:`${(t.size/1048576).toFixed(1)} MB`}],n=[];let i="",o="";var s,c,d,p;return"json"===r.format&&(o=(0,a.__)("JSON","redirection"),r.version&&e.push({label:(0,a.__)("Plugin version","redirection"),value:r.version}),void 0!==r.contents?.groups&&n.push({label:(0,a._n)("Group","Groups",r.contents.groups||0,"redirection"),value:r.contents.groups||0}),void 0!==r.contents?.redirects&&n.push({label:(0,a._n)("Redirect","Redirects",r.contents.redirects||0,"redirection"),value:r.contents.redirects||0}),void 0!==r.contents?.logs&&n.push({label:(0,a._n)("Log","Logs",r.contents.logs||0,"redirection"),value:r.contents.logs||0}),void 0!==r.contents?.errors_404&&n.push({label:(0,a._n)("404 log","404 logs",r.contents.errors_404||0,"redirection"),value:r.contents.errors_404||0}),void 0!==r.contents?.settings&&n.push({label:(0,a.__)("Settings","redirection"),value:r.contents.settings||0})),"csv"===r.format&&(o=(0,a.__)("CSV","redirection"),"redirects"===r.type?i=(0,a.__)("This redirect CSV can be imported.","redirection"):"groups"===r.type?i=(0,a.__)("Group CSV exports can be viewed, but group import is only supported with JSON.","redirection"):"logs"===r.type?i=(0,a.__)("Redirect log CSV exports can be viewed, but log import is only supported with JSON.","redirection"):"errors_404"===r.type&&(i=(0,a.__)("404 log CSV exports can be viewed, but 404 log import is only supported with JSON.","redirection")),"redirects"===r.type&&e.push({label:(0,a.__)("Contains","redirection"),value:(0,a.__)("Redirects","redirection")}),"groups"===r.type&&e.push({label:(0,a.__)("Contains","redirection"),value:(0,a.__)("Groups","redirection")}),"logs"===r.type&&e.push({label:(0,a.__)("Contains","redirection"),value:(0,a.__)("Redirect logs","redirection")}),"errors_404"===r.type&&e.push({label:(0,a.__)("Contains","redirection"),value:(0,a.__)("404 logs","redirection")}),e.push({label:(0,a.__)("Separator","redirection"),value:"csv"===r?.format&&r.separator?","===r.separator?(0,a.__)("Comma","redirection"):";"===r.separator?(0,a.__)("Semicolon","redirection"):"|"===r.separator?(0,a.__)("Pipe","redirection"):(0,a.__)("Tab","redirection"):""}),n.push({label:(s=r,c=r.rows||0,"groups"===s.type?(0,a._n)("Group","Groups",c,"redirection"):"logs"===s.type?(0,a._n)("Log","Logs",c,"redirection"):"errors_404"===s.type?(0,a._n)("404 log","404 logs",c,"redirection"):(0,a._n)("Redirect","Redirects",c,"redirection")),value:r.rows||0})),"apache"===r.format&&(o=(0,a.__)("Apache .htaccess","redirection"),i=(0,a.__)("This Apache .htaccess content can be imported.","redirection"),e.push({label:(0,a.__)("Contains","redirection"),value:(0,a.__)("Apache redirect rules","redirection")}),n.push({label:(d=r,p=r.rules||0,d.ruleTypes?.includes("rewrite")&&1===d.ruleTypes.length?(0,a._n)("Rewrite rule","Rewrite rules",p,"redirection"):d.ruleTypes?.includes("redirect")&&1===d.ruleTypes.length?(0,a._n)("Redirect rule","Redirect rules",p,"redirection"):d.ruleTypes?.includes("redirectmatch")&&1===d.ruleTypes.length?(0,a._n)("RedirectMatch rule","RedirectMatch rules",p,"redirection"):(0,a._n)("Apache rule","Apache rules",p,"redirection")),value:r.rules||0})),"redirects-file"===r.format&&(o=(0,a.__)("_redirects","redirection"),i=(0,a.__)("This _redirects file can be imported.","redirection"),e.push({label:(0,a.__)("Contains","redirection"),value:(0,a.__)("Netlify/Cloudflare Pages redirect rules","redirection")}),n.push({label:f(r.rules||0),value:r.rules||0})),(0,u.jsx)(vb,{title:t.name,badge:(0,a.__)("File","redirection"),meta:[{label:(0,a.__)("Import type","redirection"),value:o,description:i||void 0},...e],stats:n,wrapped:!1})})(),(0,u.jsx)("div",{className:"import-source-card__actions",children:(0,u.jsx)("button",{type:"button",className:"button-secondary",onClick:d,disabled:s,children:(0,a.__)("Clear file","redirection")})})]})]})},Ib=function({activeImportType:e,activePluginId:t,file:r,disabled:n=!1,deleteSource:i,duplicateMode:o,group:s,groupRows:l,fileInfo:c,isJsonFile:d,selectedSections:p,onChange:h}){const f=md(l),m="plugin"===e&&("wordpress-old-slugs"===t||"safe-redirect-manager"===t),g="file"===e||"paste"===e,_=g&&r&&d(r)?[{value:"0",label:(0,a.__)("Use groups in file","redirection")},...f]:f,y=g&&"json"===c?.format&&c.valid&&c.contents?c.contents:null,v=g&&"csv"===c?.format&&c.valid&&!0===c.importSupported,b=g&&"apache"===c?.format&&c.valid,x=g&&"redirects-file"===c?.format&&c.valid,w=y?Number(y.redirects||0)>0&&p.includes("redirects"):"plugin"===e||v||b||x,j=null!==y||w||m;return(0,u.jsxs)("fieldset",{className:"groups inline-edit-row",disabled:n,children:[(0,u.jsx)("h3",{children:(0,a.__)("Import options","redirection")}),!j&&(0,u.jsx)("p",{children:(0,a.__)("Select an import source to see available options.","redirection")}),y&&(0,u.jsxs)("div",{className:"groups__row",children:[(0,u.jsx)("div",{className:"groups__label",children:(0,a.__)("Contents","redirection")}),(0,u.jsx)("div",{className:"groups__control groups__control--stacked",children:Object.entries(y).map(([e,t])=>(0,u.jsxs)("label",{className:"groups__checkbox",htmlFor:`import_section_${e}`,children:[(0,u.jsx)("input",{id:`import_section_${e}`,type:"checkbox",name:`import_section_${e}`,checked:p.includes(e),onChange:h,disabled:n})," ",(0,u.jsxs)("span",{children:["settings"===e&&(0,a.__)("Settings","redirection"),"groups"===e&&(0,a.__)("Groups","redirection"),"redirects"===e&&(0,a.__)("Redirects","redirection"),"logs"===e&&(0,a.__)("Redirect logs","redirection"),"errors_404"===e&&(0,a.__)("404 logs","redirection")," (",t,")"]})]},e))})]}),w&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsxs)("div",{className:"groups__row",children:[(0,u.jsx)("div",{className:"groups__label",children:(0,a.__)("Group","redirection")}),(0,u.jsx)("div",{className:"groups__control",children:(0,u.jsx)(wn,{items:_,name:"group",value:String(s),onChange:h,disabled:n})})]}),(0,u.jsxs)("div",{className:"groups__row",children:[(0,u.jsx)("div",{className:"groups__label",children:(0,a.__)("Duplicates","redirection")}),(0,u.jsx)("div",{className:"groups__control",children:(0,u.jsx)(wn,{items:[{value:"import",label:(0,a.__)("Do not check duplicates","redirection")},{value:"ignore",label:(0,a.__)("Ignore duplicates","redirection")},{value:"update",label:(0,a.__)("Update duplicates","redirection")}],name:"duplicate_mode",value:o,onChange:h,disabled:n})})]})]}),m&&(0,u.jsxs)("div",{className:"groups__row",children:[(0,u.jsx)("div",{className:"groups__label",children:(0,a.__)("Delete original data","redirection")}),(0,u.jsx)("div",{className:"groups__control",children:(0,u.jsxs)("label",{className:"groups__checkbox",htmlFor:"delete_source",children:[(0,u.jsx)("input",{id:"delete_source",type:"checkbox",name:"delete_source",checked:i,onChange:h,disabled:n})," ",(0,u.jsx)("span",{children:(0,a.__)("Remove the original redirect data after import","redirection")})]})})]})]})},Fb=function({activeImportType:e,lastImport:t,lastImportWasDryRun:r}){if(!1===t)return null;const n=!0===r;let i=[];0===t.created&&0===t.updated&&t.ignored>0?i=[{label:(0,a.__)("Status","redirection"),value:n?(0,a.__)("All matching redirects would be ignored.","redirection"):(0,a.__)("All matching redirects were ignored.","redirection")}]:0===t.created&&0===t.updated&&0===t.groups_created&&0===t.groups_updated&&0===t.groups_ignored&&0===t.logs_imported&&0===t.errors_imported&&0===t.settings_imported&&(i=[{label:(0,a.__)("Status","redirection"),value:n?(0,a.__)("No redirects were found to preview.","redirection"):(0,a.__)("No redirects were imported.","redirection")}]),n&&(i=i.concat([{label:(0,a.__)("Mode","redirection"),value:(0,a.__)("Preview only. No changes have been made.","redirection")}]));const o=[{label:(0,a._n)("Redirect created","Redirects created",t.created,"redirection"),value:t.created},{label:(0,a._n)("Redirect updated","Redirects updated",t.updated,"redirection"),value:t.updated},{label:(0,a._n)("Redirect ignored","Redirects ignored",t.ignored,"redirection"),value:t.ignored},{label:(0,a._n)("Group created","Groups created",t.groups_created,"redirection"),value:t.groups_created},{label:(0,a._n)("Group updated","Groups updated",t.groups_updated,"redirection"),value:t.groups_updated},{label:(0,a._n)("Group ignored","Groups ignored",t.groups_ignored,"redirection"),value:t.groups_ignored},{label:(0,a._n)("Log imported","Logs imported",t.logs_imported,"redirection"),value:t.logs_imported},{label:(0,a._n)("404 log imported","404 logs imported",t.errors_imported,"redirection"),value:t.errors_imported},{label:(0,a._n)("Setting imported","Settings imported",t.settings_imported,"redirection"),value:t.settings_imported}],s=e=>{return"updated"===e.result&&e.redirect_id?(0,u.jsx)("a",{href:(t=e.redirect_id,t?window.Redirectioni10n.pluginRoot+"&"+encodeURIComponent("filterby[id]")+"="+t:""),children:e.source||" "}):e.source||" ";var t};return(0,u.jsx)("div",{className:"file-sniff",children:(0,u.jsx)(vb,{title:n?(0,a.__)("Preview results","redirection"):(0,a.__)("Import results","redirection"),badge:(0,a.__)("Success","redirection"),meta:i,stats:o,variant:"success",children:null!==e&&t.preview.length>0&&(0,u.jsx)("div",{className:"io-preview-table",children:(0,u.jsxs)("table",{className:"wp-list-table widefat fixed striped items table-auto inline-edit-row",children:[(0,u.jsx)("thead",{children:(0,u.jsxs)("tr",{children:[(0,u.jsx)("th",{children:(0,a.__)("Source","redirection")}),(0,u.jsx)("th",{children:(0,a.__)("Target","redirection")}),(0,u.jsx)("th",{className:"io-preview-table__code",children:(0,a.__)("HTTP","redirection")}),(0,u.jsx)("th",{className:"io-preview-table__regex",children:(0,a.__)("Regex","redirection")}),(0,u.jsx)("th",{children:(0,a.__)("Group","redirection")})]})}),(0,u.jsx)("tbody",{children:t.preview.map((e,t)=>(0,u.jsxs)("tr",{className:"ignored"===e.result?"io-preview-table__row--ignored":void 0,children:[(0,u.jsx)("td",{children:s(e)}),(0,u.jsx)("td",{children:e.target||" "}),(0,u.jsx)("td",{className:"io-preview-table__code",children:e.code||""}),(0,u.jsx)("td",{className:"io-preview-table__regex",children:e.regex?(0,a.__)("Yes","redirection"):(0,a.__)("No","redirection")}),(0,u.jsx)("td",{children:e.group||""})]},`${e.source}-${e.target}-${t}`))})]})})})})},Lb=function({activeImportType:e,isImporting:t,pasteInfo:r,pasteText:n,onClearPaste:i,onPasteTextChange:o,onSelect:s}){const l="paste"===e&&n.trim().length>0,c=()=>{const e=new Blob([n]).size;return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`},d=e=>(0,a._n)("Redirect rule","Redirect rules",e,"redirection");return(0,u.jsxs)(vb,{title:(0,a.__)("Copy/paste","redirection"),badge:(0,a.__)("Paste","redirection"),meta:(()=>{const e=[{label:(0,a.__)("Import type","redirection"),value:(0,a.__)("Paste redirects or export data","redirection")},{label:(0,a.__)("Supported formats","redirection"),value:(0,a.__)("CSV, JSON, .htaccess, and _redirects","redirection")}];if(0===n.trim().length||null===r||!r.valid)return e;let t=(0,a.__)("CSV","redirection");return"json"===r.format?t=(0,a.__)("JSON","redirection"):"apache"===r.format?t=(0,a.__)("Apache .htaccess","redirection"):"redirects-file"===r.format&&(t=(0,a.__)("_redirects","redirection")),e[0]={label:(0,a.__)("Import type","redirection"),value:t},e[1]={label:(0,a.__)("Details","redirection"),value:c()},"json"===r.format&&r.version&&e.push({label:(0,a.__)("Plugin version","redirection"),value:r.version}),"csv"===r.format&&e.push({label:(0,a.__)("Separator","redirection"),value:"csv"===r?.format&&r.separator?","===r.separator?(0,a.__)("Comma","redirection"):";"===r.separator?(0,a.__)("Semicolon","redirection"):"|"===r.separator?(0,a.__)("Pipe","redirection"):(0,a.__)("Tab","redirection"):""}),"apache"===r.format&&e.push({label:(0,a.__)("Contains","redirection"),value:(0,a.__)("Apache redirect rules","redirection")}),"redirects-file"===r.format&&e.push({label:(0,a.__)("Contains","redirection"),value:(0,a.__)("Netlify/Cloudflare Pages redirect rules","redirection")}),e})(),stats:(()=>{if(0===n.trim().length||null===r||!r.valid)return[];if("json"===r.format){const e=[];return void 0!==r.contents?.groups&&e.push({label:(0,a._n)("Group","Groups",r.contents.groups||0,"redirection"),value:r.contents.groups||0}),void 0!==r.contents?.redirects&&e.push({label:(0,a._n)("Redirect","Redirects",r.contents.redirects||0,"redirection"),value:r.contents.redirects||0}),void 0!==r.contents?.logs&&e.push({label:(0,a._n)("Log","Logs",r.contents.logs||0,"redirection"),value:r.contents.logs||0}),void 0!==r.contents?.errors_404&&e.push({label:(0,a._n)("404 log","404 logs",r.contents.errors_404||0,"redirection"),value:r.contents.errors_404||0}),void 0!==r.contents?.settings&&e.push({label:(0,a.__)("Settings","redirection"),value:r.contents.settings||0}),e}return"apache"===r.format?[{label:(e=r,t=r.rules||0,e.ruleTypes?.includes("rewrite")&&1===e.ruleTypes.length?(0,a._n)("Rewrite rule","Rewrite rules",t,"redirection"):e.ruleTypes?.includes("redirect")&&1===e.ruleTypes.length?(0,a._n)("Redirect rule","Redirect rules",t,"redirection"):e.ruleTypes?.includes("redirectmatch")&&1===e.ruleTypes.length?(0,a._n)("RedirectMatch rule","RedirectMatch rules",t,"redirection"):(0,a._n)("Apache rule","Apache rules",t,"redirection")),value:r.rules||0}]:"redirects-file"===r.format?[{label:d(r.rules||0),value:r.rules||0}]:"csv"===r.format?[{label:(i=r,o=r.rows||0,"groups"===i.type?(0,a._n)("Group","Groups",o,"redirection"):"logs"===i.type?(0,a._n)("Log","Logs",o,"redirection"):"errors_404"===i.type?(0,a._n)("404 log","404 logs",o,"redirection"):(0,a._n)("Redirect","Redirects",o,"redirection")),value:r.rows||0}]:[];var e,t,i,o})(),className:m("import-source-card","import-source-card--paste",{"import-source-card--active":l}),actions:n.trim().length>0?(0,u.jsx)("button",{type:"button",className:"button-secondary",onClick:i,disabled:t,children:(0,a.__)("Clear pasted content","redirection")}):void 0,children:[(0,u.jsx)("div",{className:"import-source-card__textarea-wrap",children:(0,u.jsx)("textarea",{className:"import-source-card__textarea",value:n,onChange:e=>o(e.currentTarget.value),onFocus:s,placeholder:(0,a.__)("Paste redirects or a Redirection export here","redirection"),rows:8,disabled:t})}),n.trim().length>0&&null!==r&&!r.valid&&(0,u.jsx)("div",{className:"inline-notice inline-error",children:(0,u.jsx)("p",{children:"not-redirection-json"===r?.error?(0,a.__)("Not a Redirection JSON export","redirection"):"invalid-json"===r?.error?(0,a.__)("Invalid JSON","redirection"):"empty-csv"===r?.error?(0,a.__)("Empty CSV content","redirection"):"separator-not-detected"===r?.error?(0,a.__)("Unable to detect a CSV separator","redirection"):"unknown-csv-layout"===r?.error?(0,a.__)("Unknown CSV layout","redirection"):"unknown-apache-layout"===r?.error?(0,a.__)("Unknown Apache .htaccess layout","redirection"):"unknown-redirects-file-layout"===r?.error?(0,a.__)("This doesn't look like a valid _redirects file — check the from/to/status syntax on each line.","redirection"):(0,a.__)("Unsupported pasted content","redirection")})})]})},Db=function(){const{state:e,fileInputRef:t,importingStatus:r,onAddFileClick:n,onCancel:i,onClearFile:s,onClearPaste:l,onDragEnter:c,onDragLeave:d,onDragOver:p,onDrop:h,onFileInputChange:f,onImport:g,onOptionsChange:_,onSelectFileImporter:y,onSelectPasteImporter:v,onPasteTextChange:b,onSelectPlugin:x}=function(){const[e,t]=(0,o().useState)(null),[r,n]=(0,o().useState)(null),[i,s]=(0,o().useState)(0),[l,c]=(0,o().useState)(!1),[u,d]=(0,o().useState)(!1),[p,h]=(0,o().useState)(!1),[f,m]=(0,o().useState)(""),[g,_]=(0,o().useState)("import"),[y,v]=(0,o().useState)(!1),[b,x]=(0,o().useState)([]),[w,j]=(0,o().useState)(null),[S,k]=(0,o().useState)(null),[C,T]=(0,o().useState)(!1),[E,R]=(0,o().useState)(!1),[P,N]=(0,o().useState)(null),O=(0,o().useRef)(null),A=(0,o().useRef)(0),I=(0,o().useRef)(!1),{data:F,isSuccess:L,refetch:D}=dd(),z=F?.items??[],M=z.length>0,{data:$=[],isLoading:U}=on(),B=$,q=sn({onSuccess:(e,t)=>{const r="preview"===t.mode,n=e;R({created:0,updated:0,ignored:0,groups_created:0,groups_updated:0,groups_ignored:0,logs_imported:0,errors_imported:0,settings_imported:0,preview:[],...n,preview:n.preview||[]}),N(r)}}),H=q.isPending,W=q.error||null,G=!1!==E&&!1===P,V=B.find(e=>e.id===r)||null,Z="paste"===e?p:u,K="file"===e||"paste"===e?!1!==Z:null!==V,Q="file"===e||"paste"===e||!0===V?.preview_supported;let J="idle";H?J="loading":q.isSuccess&&(J="success"),(0,o().useEffect)(()=>()=>{d(!1),h(!1),m(""),t(null),n(null),R(!1),N(null)},[]),(0,o().useEffect)(()=>{M?I.current=!1:L&&!I.current&&(I.current=!0,D())},[M,L,D]),(0,o().useEffect)(()=>{let e=!0;return!1===u?(j(null),T(!1),void x([])):(T(!0),j(null),async function(e){const t=await e.text();if("_redirects"===e.name.toLowerCase())return Cb(t);if(wb(e))return Tb(t);if(e.name.toLowerCase().endsWith(".csv"))return Eb(t);if(e.name.toLowerCase().endsWith(".htaccess"))return Sb(t);const r=jb(t);return r.valid?r:{format:"other",valid:!1,error:"unsupported-file-type"}}(u).then(t=>{e&&(j(t),"json"===t.format&&t.valid&&t.contents&&x(Object.keys(t.contents)))}).catch(()=>{e&&j({format:wb(u)?"json":"other",valid:!1,error:"read-failed"})}).finally(()=>{e&&T(!1)}),()=>{e=!1})},[u]),(0,o().useEffect)(()=>{if(0===f.trim().length)return h(!1),k(null),void("paste"===e&&x([]));const t=jb(f);var r,n;k(t),h((r=f,"json"===(n=t.format)?new File([r],"pasted-import.json",{type:"application/json"}):"csv"===n?new File([r],"pasted-import.csv",{type:"text/csv"}):"apache"===n?new File([r],"pasted-import.htaccess",{type:"text/plain"}):"redirects-file"===n?new File([r],"_redirects",{type:"text/plain"}):new File([r],"pasted-import.txt",{type:"text/plain"}))),"json"===t.format&&t.valid&&t.contents?x(Object.keys(t.contents)):x([])},[f,e]);const Y=e=>{q.reset(),R(!1),N(null),d(e),t("file"),n(null),x([]),e&&wb(e)?s(0):z[0]&&s(z[0].id)},X=()=>{q.reset(),c(!1),d(!1),"file"===e&&t(null),R(!1),N(null),O.current&&(O.current.value="")},ee=()=>{q.reset(),h(!1),m(""),k(null),"paste"===e&&t(null),x([]),R(!1),N(null)};return{state:{activeImportType:e,activePluginId:r,group:i,hover:l,file:u,duplicateMode:g,deleteSource:y,fileInfo:w,pasteFile:p,pasteText:f,pasteInfo:S,isSniffing:C,currentError:W,selectedSections:b,lastImport:E,lastImportWasDryRun:P,groupRows:z,hasGroups:M,importers:B,isLoadingImporters:U,isImporting:H,hasCompletedImport:G,hasActiveImport:K,previewSupported:Q},fileInputRef:O,importingStatus:J,onAddFileClick:()=>{O.current?.click()},onCancel:()=>{q.reset(),t(null),n(null),_("import"),v(!1),X(),ee()},onClearFile:X,onClearPaste:ee,onDragEnter:e=>{e.preventDefault(),e.stopPropagation(),"loading"!==J&&e.dataTransfer.types.includes("Files")&&(A.current+=1,c(!0))},onDragLeave:e=>{e.preventDefault(),e.stopPropagation(),A.current>0&&(A.current-=1),0===A.current&&c(!1)},onDragOver:e=>{e.preventDefault(),e.stopPropagation()},onDrop:e=>{e.preventDefault(),e.stopPropagation(),A.current=0,c(!1),"loading"!==J&&e.dataTransfer.files.length>0&&Y(e.dataTransfer.files[0]||!1)},onFileInputChange:e=>{const t=e.target.files;t&&t.length>0&&Y(t[0]||!1)},onImport:(t=!1)=>{const r=(o=t?"preview":"import","file"!==e&&"paste"!==e||!Z?"plugin"===e&&V?{sourceType:"plugin",mode:o,pluginId:V.id,groupId:i,duplicateMode:g,deleteSource:y}:null:{sourceType:"file",mode:o,file:Z,groupId:i,duplicateMode:g,deleteSource:y,importSections:b,format:Ob("paste"===e?S:w)}),n=V?.name||"";var o;if(!r)return;const s=function(e){return"plugin"===e.sourceType&&"import"===e.mode&&!0===e.deleteSource&&("wordpress-old-slugs"===e.pluginId||"safe-redirect-manager"===e.pluginId)}(r)?(0,a.__)("This will import the redirects and delete the original data. Are you sure?","redirection"):(0,a.sprintf)(
// translators: %s is the plugin name
// translators: %s is the plugin name
(0,a.__)("Are you sure you want to import from %s?","redirection"),n);("plugin"!==r.sourceType||"import"!==r.mode||confirm(s))&&(R(!1),N(null),q.reset(),q.mutate(r))},onOptionsChange:e=>{const{name:t,value:r}=e.currentTarget;if("group"===t)q.reset(),s(parseInt(r,10)),R(!1),N(null);else if("duplicate_mode"===t)q.reset(),_(r),R(!1),N(null);else if("delete_source"===t&&e.currentTarget instanceof HTMLInputElement){const{checked:t}=e.currentTarget;q.reset(),v(t),R(!1),N(null)}else if(t.startsWith("import_section_")&&e.currentTarget instanceof HTMLInputElement){const r=t.replace("import_section_",""),{checked:n}=e.currentTarget;q.reset(),x(e=>n?[...e,r]:e.filter(e=>e!==r)),R(!1),N(null)}},onSelectPasteImporter:()=>{f.trim().length>0&&(q.reset(),t("paste"),n(null),R(!1),N(null))},onPasteTextChange:e=>{const r=e.trim().length>0?jb(e):null;q.reset(),R(!1),N(null),m(e),t(e.trim().length>0?"paste":null),n(null),"json"===r?.format&&r.valid?s(0):e.trim().length>0&&z[0]&&s(z[0].id)},onSelectFileImporter:()=>{!1!==u&&(q.reset(),t("file"),n(null),R(!1),N(null))},onSelectPlugin:o=>{if(q.reset(),R(!1),N(null),"plugin"===e&&r===o.id)return t(null),void n(null);t("plugin"),n(o.id),0===i&&z[0]&&s(z[0].id)}}}(),w="paste"===e.activeImportType?e.pasteFile:e.file,j="paste"===e.activeImportType?e.pasteInfo:e.fileInfo,S=("file"===e.activeImportType||"paste"===e.activeImportType)&&"json"===j?.format&&j.valid&&0===e.selectedSections.length,k=("file"===e.activeImportType||"paste"===e.activeImportType)&&"csv"===j?.format&&j.valid&&!1===j.importSupported,C="json"===j?.format&&j.valid&&j.contents?j.contents:null,T=null!==C&&Number(C.redirects||0)>0&&e.selectedSections.includes("redirects")&&0!==e.group,E="plugin"===e.activeImportType||("file"===e.activeImportType||"paste"===e.activeImportType)&&(T||"csv"===j?.format&&j.valid&&!0===j.importSupported||"apache"===j?.format&&j.valid);return(0,u.jsx)("div",{className:m("redirect-io-page",{"redirect-io-page--dragging":e.hover}),onDragEnter:c,onDragLeave:d,onDragOver:p,onDrop:h,children:(0,u.jsxs)("section",{className:"io-section io-section--import",children:[(0,u.jsx)("p",{children:(0,a.__)("Import redirects from a file or another plugin. You can also drag and drop a file anywhere on this page.","redirection")}),(0,u.jsxs)("div",{className:"inline-notice notice-warning",children:[(0,u.jsx)("p",{children:M((0,a.__)("{{strong}}CSV file format{{/strong}}: {{code}}source URL, target URL{{/code}} - and can be optionally followed with {{code}}regex, http code{{/code}} ({{code}}regex{{/code}} - 0 for no, 1 for yes).","redirection"),{code:(0,u.jsx)("code",{}),strong:(0,u.jsx)("strong",{})})}),(0,u.jsx)("p",{children:(0,a.__)("CSV files need a recognised header otherwise they are assumed to be redirects. Use JSON for full data support.","redirection")})]}),(0,u.jsxs)("div",{className:"import-sources",children:[(0,u.jsx)(Ab,{activeImportType:e.activeImportType,file:e.file,fileInfo:e.fileInfo,fileInputRef:t,hover:e.hover,importingStatus:r,isImporting:e.isImporting,isSniffing:e.isSniffing,onAddFileClick:n,onClearFile:s,onClick:y,onFileInputChange:f}),(0,u.jsx)(Lb,{activeImportType:e.activeImportType,isImporting:e.isImporting,pasteInfo:e.pasteInfo,pasteText:e.pasteText,onClearPaste:l,onPasteTextChange:b,onSelect:v}),e.isLoadingImporters&&(0,u.jsx)(vb,{title:"",className:"import-source-card import-source-card--placeholder",children:(0,u.jsx)($l,{})}),e.importers.length>0&&(R=e.importers,(0,u.jsx)(u.Fragment,{children:R.map(t=>(0,u.jsx)(bb,{plugin:t,onSelect:x,isActive:e.activePluginId===t.id&&"plugin"===e.activeImportType,isImporting:e.isImporting},t.id))}))]}),!e.hasCompletedImport&&(0,u.jsx)(Ib,{activeImportType:e.activeImportType,activePluginId:e.activePluginId,file:w,disabled:!e.hasActiveImport||e.isImporting||E&&!e.hasGroups,deleteSource:e.deleteSource,duplicateMode:e.duplicateMode,group:e.group,groupRows:e.groupRows,fileInfo:j,isJsonFile:wb,selectedSections:e.selectedSections,onChange:_}),(0,u.jsx)("div",{className:"import-actions",children:e.hasCompletedImport?(0,u.jsx)("button",{className:"button-secondary",onClick:i,children:(0,a.__)("OK","redirection")}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("button",{className:"button-secondary",onClick:()=>g(!0),disabled:!e.hasActiveImport||E&&!e.hasGroups||!e.previewSupported||S||k||e.isImporting||("file"===e.activeImportType||"paste"===e.activeImportType)&&(!1===w||e.isSniffing||null===j||!1===j.valid),children:(0,a.__)("Preview","redirection")})," ",(0,u.jsx)("button",{className:"button-primary",onClick:()=>g(!1),disabled:!e.hasActiveImport||E&&!e.hasGroups||S||k||e.isImporting||("file"===e.activeImportType||"paste"===e.activeImportType)&&(!1===w||e.isSniffing||null===j||!1===j.valid),children:(0,a.__)("Import","redirection")})]})}),e.currentError&&(0,u.jsx)(yb,{error:e.currentError}),(0,u.jsx)(Fb,{activeImportType:e.activeImportType,lastImport:e.lastImport,lastImportWasDryRun:e.lastImportWasDryRun})]})});var R},zb=function({disabled:e,onView:t,onDownload:r}){return(0,u.jsxs)("div",{className:"import-actions",children:[(0,u.jsx)("button",{type:"button",className:"button-secondary",onClick:t,disabled:e,children:(0,a.__)("View","redirection")})," ",(0,u.jsx)("button",{type:"button",className:"button-primary",onClick:r,disabled:e,children:(0,a.__)("Download","redirection")})]})},Mb=function({format:e,availableFormats:t,disabled:r,onChange:n}){return(0,u.jsxs)("div",{className:"export-options__field",children:[(0,u.jsx)("label",{className:"export-options__label",htmlFor:"export-format",children:(0,a.__)("Format","redirection")}),(0,u.jsx)("select",{id:"export-format",value:e,disabled:r,onChange:e=>n(e.target.value),children:t.map(e=>(0,u.jsx)("option",{value:e,children:Xy(e)},e))})]})},$b=function({selectedTypes:e,format:t,availableFormats:r,disabled:n,onChange:i}){const o=e.length>0;return(0,u.jsxs)("div",{className:"groups export-options",children:[(0,u.jsx)("h3",{children:(0,a.__)("Export options","redirection")}),o&&(0,u.jsx)(Mb,{format:t,availableFormats:r,disabled:n,onChange:e=>i("format",e)}),!o&&(0,u.jsxs)("div",{className:"export-options__field",children:[(0,u.jsx)("span",{className:"export-options__label",children:(0,a.__)("Format","redirection")}),(0,a.__)("Select one or more export types to choose a format.","redirection")]})]})};function Ub(e){const t=window.Redirectioni10n?.locale||void 0;return new Intl.NumberFormat(t).format(e)}const Bb=function({lastResult:e}){if(!1===e)return null;const t=[{label:(0,a.__)("Action","redirection"),value:"view"===e.action?(0,a.__)("Viewed in browser","redirection"):(0,a.__)("Downloaded","redirection")},{label:(0,a.__)("Format","redirection"),value:Yy(e.format)},{label:(0,a.__)("Export","redirection"),value:Qy(e.types)},{label:(0,a.__)("File size","redirection"),value:(n=e.data,r=new Blob([n]).size,r<1024?`${r} B`:r<1048576?`${(r/1024).toFixed(1)} KB`:`${(r/1048576).toFixed(1)} MB`)}];var r,n;const i=[];if(null!==e.total){const t=e.exported??e.total-(e.skipped??0);i.push({label:(0,a.__)("Items exported","redirection"),value:Ub(t)})}return e.skipped&&i.push({label:(0,a.__)("Skipped (unsupported for this format)","redirection"),value:Ub(e.skipped)}),(0,u.jsx)("div",{className:"export-results",children:(0,u.jsx)(vb,{title:"view"===e.action?(0,a.__)("View results","redirection"):(0,a.__)("Download ready","redirection"),badge:(0,a.__)("Success","redirection"),meta:t,stats:i,variant:"success",children:"view"===e.action&&(0,u.jsx)("textarea",{className:"module-export",rows:14,readOnly:!0,value:e.data})})})};function qb(e){const t=window.Redirectioni10n?.locale||void 0;return new Intl.NumberFormat(t).format(e)}const Hb=function({meta:e,isPreviewLoading:t,previewTotal:r,previewEstimatedSize:n}){const i=[];let o=(0,a.__)("Preview","redirection");return t?o=(0,a.__)("Loading","redirection"):null!==r&&(i.push({label:(0,a._n)("Item available","Items available",r,"redirection"),value:qb(r)}),null!==n&&i.push({label:(0,a.__)("Approximate file size","redirection"),value:(s=n,s<1024?`${s} B`:s<1048576?`${(s/1024).toFixed(1)} KB`:`${(s/1048576).toFixed(1)} MB`)})),(0,u.jsx)(vb,{title:(0,a.__)("Export preview","redirection"),badge:o,meta:e,stats:i});var s},Wb=function({exportTypes:e,selectedTypes:t,redirectScopeType:r,redirectModule:n,redirectGroup:i,groupRows:o,isExporting:s,onChange:l,onToggle:c}){return(0,u.jsx)("div",{className:"export-types",children:e.map(e=>{const d=t.includes(e.id);return(0,u.jsx)(vb,{title:e.name,badge:(0,a.__)("Export","redirection"),meta:[{label:(0,a.__)("Export type","redirection"),value:e.description,fullWidth:!0}],stats:[{label:(0,a._n)("Format","Formats",e.formats.length,"redirection"),value:e.formats.length}],actions:(0,u.jsxs)("label",{className:"groups__checkbox",htmlFor:`export-type-${e.id}`,children:[(0,u.jsx)("input",{id:`export-type-${e.id}`,type:"checkbox",checked:d,onChange:()=>c(e.id),disabled:s}),(0,u.jsx)("span",{children:(0,a.__)("Include in export","redirection")})]}),className:m("import-source-card",{"import-source-card--active":d}),children:"redirect"===e.id&&d&&(0,u.jsxs)("div",{className:"import-source-card__options",children:[(0,u.jsxs)("div",{className:"groups__row",children:[(0,u.jsx)("div",{className:"groups__label",children:(0,a.__)("Scope","redirection")}),(0,u.jsx)("div",{className:"groups__control",children:(0,u.jsxs)("select",{value:r,disabled:s,onChange:e=>l("redirectScopeType",e.target.value),children:[(0,u.jsx)("option",{value:"all",children:(0,a.__)("Everything","redirection")}),(0,u.jsx)("option",{value:"module",children:(0,a.__)("Module","redirection")}),(0,u.jsx)("option",{value:"group",children:(0,a.__)("Group","redirection")})]})})]}),"module"===r&&(0,u.jsxs)("div",{className:"groups__row",children:[(0,u.jsx)("div",{className:"groups__label",children:(0,a.__)("Module","redirection")}),(0,u.jsx)("div",{className:"groups__control",children:(0,u.jsxs)("select",{value:n,disabled:s,onChange:e=>l("redirectModule",e.target.value),children:[(0,u.jsx)("option",{value:"1",children:(0,a.__)("WordPress redirects","redirection")}),(0,u.jsx)("option",{value:"2",children:(0,a.__)("Apache redirects","redirection")}),(0,u.jsx)("option",{value:"3",children:(0,a.__)("Nginx redirects","redirection")})]})})]}),"group"===r&&(0,u.jsxs)("div",{className:"groups__row",children:[(0,u.jsx)("div",{className:"groups__label",children:(0,a.__)("Group","redirection")}),(0,u.jsx)("div",{className:"groups__control",children:(0,u.jsx)("select",{value:String(i),disabled:s,onChange:e=>l("redirectGroup",e.target.value),children:o.map(e=>(0,u.jsx)("option",{value:e.id,children:e.moduleName?`${e.name} (${e.moduleName})`:e.name},e.id))})})]})]})},e.id)})})},Gb=[{id:"redirect",name:(0,a.__)("Redirects","redirection"),description:(0,a.__)("Export redirect rules in Redirection.","redirection"),formats:["json","csv","apache","nginx","redirects-file"]},{id:"log",name:(0,a.__)("Redirect logs","redirection"),description:(0,a.__)("Export redirect activity logs.","redirection"),formats:["json","csv"]},{id:"404",name:(0,a.__)("404 logs","redirection"),description:(0,a.__)("Export 404 request logs.","redirection"),formats:["json","csv"]},{id:"group",name:(0,a.__)("Groups","redirection"),description:(0,a.__)("Export redirect groups and their module assignments.","redirection"),formats:["json","csv"]},{id:"setting",name:(0,a.__)("Settings","redirection"),description:(0,a.__)("Export a portable subset of plugin settings and site-level Redirection options.","redirection"),formats:["json"]}],Vb=function(){const{data:e}=dd(),t=(0,o().useMemo)(()=>e?.items??[],[e?.items]),[r,n]=(0,o().useState)([]),[i,s]=(0,o().useState)("all"),[l,c]=(0,o().useState)("all"),[u,d]=(0,o().useState)(0),[p,h]=(0,o().useState)("json"),[f,m]=(0,o().useState)(!1),g=an({onSuccess:(e,t)=>{m({action:t.download?"download":"view",types:t.exportTypes||[t.exportType],format:t.format,data:e.data,total:e.total,skipped:e.skipped??null,exported:e.exported??null})}}),_=r.length>0,y=r.length===Gb.length,v=r[0]||"redirect",b=r.includes("redirect"),x=function(e,t){return dt({queryKey:["export-preview",e],queryFn:async()=>{const t=await jt(function(e){if(rn(e.exportTypes)){const t=e.redirectScopeType||"all",r=e.redirectModule||"all",n=e.redirectGroup||0;return Vt({types:e.exportTypes,scope_type:t,scope_value:nn(t,r,n),format:e.format||"json"})}if("redirect"===e.exportType){const t=e.redirectScopeType||"all",r=e.redirectModule||"all",n=e.redirectGroup||0;return Wt({scope_type:t,scope_value:nn(t,r,n),format:e.format||"json"})}return"log"===e.exportType?Qt({format:e.format||"json"}):Yt({format:e.format||"json"})}(e));return{total:Number(t.total??0),estimatedSize:Number(t.estimated_size??0)}},...t})}({exportType:v,exportTypes:r,format:p,redirectScopeType:i,redirectModule:l,redirectGroup:u},{enabled:!1}),w=(0,o().useMemo)(()=>{if(0===r.length)return[];if(1!==r.length)return["json"];const e=Gb.find(e=>e.id===r[0]);return e?.formats??["json"]},[r]),j=t.find(e=>e.id===u)||null,S=g.isPending,k=x.isLoading||x.isFetching,C=x.refetch,T=g.error||null,E=!_||x.isError||"number"!=typeof x.data?.total?null:x.data.total,R=!_||x.isError||"number"!=typeof x.data?.estimatedSize?null:x.data.estimatedSize,P=[{label:(0,a.__)("Export","redirection"),value:_?Qy(r):(0,a.__)("No export selected","redirection")}];var N,O;b&&(P.push({label:(0,a.__)("Scope","redirection"),value:(N=i,O=j?j.name:(0,a.__)("Group","redirection"),"module"===N?(0,a.__)("Module","redirection"):"group"===N?O:(0,a.__)("Everything","redirection"))}),"module"===i&&P.push({label:(0,a.__)("Module","redirection"),value:Jy(l)})),_&&P.push({label:(0,a.__)("Format","redirection"),value:Yy(p)}),(0,o().useEffect)(()=>{0===u&&t[0]&&d(t[0].id)},[t,u]),(0,o().useEffect)(()=>{"module"===i&&"all"===l&&c("1"),"group"===i&&t[0]&&!t.some(e=>e.id===u)&&d(t[0].id)},[t,u,l,i]),(0,o().useEffect)(()=>{0!==w.length&&(w.includes(p)||h(w[0]||"json"))},[w,p]),(0,o().useEffect)(()=>{_&&C()},[_,p,v,i,l,u,r,C]);const A=e=>{if(0===r.length)return;const t={message:"download"===e?(0,a.__)("Export downloaded","redirection"):(0,a.__)("Export viewed","redirection")},n={exportType:v,exportTypes:r,format:p,redirectScopeType:i,redirectModule:l,redirectGroup:u,download:"download"===e,completionNotice:t};"download"===e&&(n.filename=function(e,t){return 1===e.length&&e[0]?ev(e[0],t):`redirection-export.${t}`}(r,p)),g.mutate(n)};return{exportTypes:Gb,availableFormats:w,groupRows:t,summaryMeta:P,hasAllTypesSelected:y,hasSelectedTypes:_,state:{selectedTypes:r,redirectScopeType:i,redirectModule:l,redirectGroup:u,format:p,isExporting:S,isPreviewLoading:k,previewTotal:E,previewEstimatedSize:R,currentError:T,lastResult:f},onChange:(e,r)=>{if(g.reset(),"redirectScopeType"===e){const e=r;s(e),"module"===e&&"all"===l&&c("1"),"group"===e&&t[0]&&0===u&&d(t[0].id)}else"redirectModule"===e?c(r):"redirectGroup"===e?d(Number(r)):h(r);m(!1)},onToggleType:e=>{g.reset(),n(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),m(!1)},onToggleAllTypes:e=>{g.reset(),n(e?Gb.map(e=>e.id):[]),m(!1)},onDownload:()=>A("download"),onView:()=>A("view")}},Zb=function(){const{exportTypes:e,availableFormats:t,groupRows:r,hasAllTypesSelected:n,hasSelectedTypes:i,summaryMeta:o,state:s,onChange:l,onDownload:c,onToggleAllTypes:d,onToggleType:p,onView:h}=Vb();return(0,u.jsx)("div",{className:"redirect-io-page",children:(0,u.jsxs)("section",{className:"io-section io-section--export",children:[(0,u.jsx)("p",{children:(0,a.__)("Export redirects, redirect logs, 404 logs, groups, or settings. You can combine multiple export cards, and mixed exports are bundled as JSON.","redirection")}),(0,u.jsx)("div",{className:"inline-notice notice-warning",children:(0,u.jsx)("p",{children:(0,a.__)("You can also export directly from the redirects, redirect logs, or 404 logs pages for more control over filtering.","redirection")})}),(0,u.jsx)("div",{className:"export-types-toggle",children:(0,u.jsxs)("label",{className:"groups__checkbox",htmlFor:"export-types-toggle-all",children:[(0,u.jsx)("input",{id:"export-types-toggle-all",type:"checkbox",checked:n,onChange:e=>d(e.target.checked),disabled:s.isExporting}),(0,u.jsx)("span",{children:(0,a.__)("Select all","redirection")})]})}),(0,u.jsx)(Wb,{exportTypes:e,selectedTypes:s.selectedTypes,redirectScopeType:s.redirectScopeType,redirectModule:s.redirectModule,redirectGroup:s.redirectGroup,groupRows:r,isExporting:s.isExporting,onChange:l,onToggle:p}),(0,u.jsx)($b,{selectedTypes:s.selectedTypes,format:s.format,availableFormats:t,disabled:s.isExporting||!i,onChange:(e,t)=>l(e,t)}),s.currentError&&(0,u.jsx)(yb,{error:s.currentError}),(0,u.jsx)("div",{className:"export-summary",children:(0,u.jsx)(Hb,{meta:o,isPreviewLoading:s.isPreviewLoading,previewTotal:s.previewTotal,previewEstimatedSize:s.previewEstimatedSize})}),(0,u.jsx)(zb,{disabled:s.isExporting||!i,onView:h,onDownload:c}),s.isExporting&&(0,u.jsx)("div",{className:"loader-wrapper loader-textarea",children:(0,u.jsx)("div",{className:"wpl-placeholder__loading"})}),!s.isExporting&&(0,u.jsx)(Bb,{lastResult:s.lastResult})]})})},Kb=()=>[{value:"name",label:(0,a.__)("Name","redirection")},{value:"module",label:(0,a.__)("Module","redirection")},{value:"status",label:(0,a.__)("Status","redirection")},{value:"redirects",label:(0,a.__)("Redirects","redirection")}],Qb=e=>[{label:(0,a.__)("Status","redirection"),value:"status",options:[{label:(0,a.__)("Enabled","redirection"),value:"enabled"},{label:(0,a.__)("Disabled","redirection"),value:"disabled"}]},{label:(0,a.__)("Module","redirection"),value:"module",options:e}];function Jb(e){const t=p(),{incrementProgress:r,decrementProgress:n,addNotice:i,addError:o}=tn(),{setGroupsTable:s}=$_();return ft({mutationFn:async({action:e,items:i,params:o={}})=>{r();try{return await t.cancelQueries({queryKey:Xr.groups.lists()}),await jt(or(e,{items:i},o))}catch(e){throw n(),Yr(e)}},onSuccess:(e,r)=>{n();let o=r.action;"enable"===r.action?o="enabled":"disable"===r.action&&(o="disabled"),i(`Groups ${o}`),s({page:0,selected:[],selectAll:!1}),t.invalidateQueries({queryKey:Xr.groups.lists()}),t.invalidateQueries({queryKey:Xr.groups.dropdown()})},onError:e=>{o(e.message||"Failed to perform group action")},...e})}const Yb=[{value:1,label:"WordPress"},{value:2,label:"Apache"},{value:3,label:"Nginx"}];function Xb(){return Yb}const ex=function(e){const{disabled:t}=e,[r,n]=(0,o().useState)(""),[i,s]=(0,o().useState)(1),{mutate:l}=function(){const e=p(),{incrementProgress:t,decrementProgress:r,addNotice:n,addError:i}=tn();return ft({mutationFn:async n=>{t();try{await e.cancelQueries({queryKey:Xr.groups.lists()});const t=await jt(Dt(n));return od.parse(t).items[0]??null}catch(e){throw r(),Yr(e)}},onSuccess:()=>{r(),n("Group created"),e.invalidateQueries({queryKey:Xr.groups.lists()}),e.invalidateQueries({queryKey:Xr.groups.dropdown()})},onError:e=>{i(e.message||"Failed to create group")}})}();return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("h2",{children:(0,a.__)("Add Group","redirection")}),(0,u.jsx)("p",{children:(0,a.__)("Use groups to organise your redirects. Groups are assigned to a module, which affects how the redirects in that group work. If you are unsure then stick to the WordPress module.","redirection")}),(0,u.jsxs)("form",{onSubmit:function(e){e.preventDefault(),l({name:r,moduleId:i,position:0}),n("")},children:[(0,u.jsx)("table",{className:"form-table redirect-groups inline-edit-row",children:(0,u.jsx)("tbody",{children:(0,u.jsxs)("tr",{children:[(0,u.jsx)("th",{children:(0,a.__)("Name","redirection")}),(0,u.jsxs)("td",{children:[(0,u.jsx)("input",{size:30,className:"regular-text",type:"text",name:"name",value:r,onChange:e=>n(e.target.value),disabled:t}),(0,u.jsx)(wn,{name:"group",value:String(i),onChange:e=>s(parseInt(e.target.value,10)),items:Xb().map(e=>({label:e.label,value:String(e.value)})),disabled:t})," ",(0,u.jsx)("span",{className:"table-actions",children:(0,u.jsx)(Ul,{isPrimary:!0,isSecondary:!1,isSubmit:!0,disabled:t||""===r,children:(0,a.__)("Add","redirection")})})]})]})})}),2===i&&(0,u.jsx)("p",{children:(0,a.__)("Note that you will need to set the Apache module path in your Redirection options.","redirection")})]})]})},tx=function(e){const{disabled:t,rowParams:r,row:n}=e,{mutate:i}=Jb(),{setRowMode:o,rowMode:s}=r,{id:l,enabled:c}=n,d=[];return"edit"===s?null:(ky(Ry)&&d.push((0,u.jsx)(Oy,{onClick:()=>o("edit"!==s&&"edit"),children:(0,a.__)("Edit","redirection")},"0")),ky("redirection_cap_group_delete")&&d.push((0,u.jsx)(Oy,{onClick:()=>{window.confirm((0,a.__)("Are you sure you want to delete this item?","redirection"))&&i({action:"delete",items:[l]})},children:(0,a.__)("Delete","redirection")},"1")),ky(Ty)&&d.push((0,u.jsx)(Oy,{href:Redirectioni10n.pluginRoot+"&"+encodeURIComponent("filterby[group]")+"="+l,children:(0,a.__)("View Redirects","redirection")},"2")),ky(Ry)&&(c?d.push((0,u.jsx)(Oy,{onClick:()=>i({action:"disable",items:[l]}),children:(0,a.__)("Disable","redirection")},"3")):d.push((0,u.jsx)(Oy,{onClick:()=>i({action:"enable",items:[l]}),children:(0,a.__)("Enable","redirection")},"3"))),(0,u.jsx)(Ny,{disabled:t,actions:d}))},rx=function({row:e}){const{enabled:t}=e;return t?(0,u.jsx)("div",{className:"redirect-status redirect-status__enabled",children:"✓"}):(0,u.jsx)("div",{className:"redirect-status redirect-status__disabled",children:"×"})},nx=function({row:e,filters:t}){const{enabled:r,name:n}=e;return r?(0,u.jsx)(Vy(),{searchWords:[t.name],textToHighlight:n,autoEscape:!0}):(0,u.jsx)("s",{children:n})},ix=function({row:e}){const{module_id:t}=e,r=function(e){const t=Yb.find(t=>t.value===e);return t?t.label:"WordPress"}(t),{setGroupsTable:n}=$_();return(0,u.jsx)(u.Fragment,{children:(0,u.jsx)(zu,{onClick:()=>n({filterBy:{module:String(t)},page:0}),title:(0,a.sprintf)(
// translators: %(type)s is the module type name
// translators: %(type)s is the module type name
(0,a.__)("Filter on: %(type)s","redirection"),{type:r}),children:r})})},ox=function(e){const{group:t,onCancel:r}=e,[n,i]=(0,o().useState)(t.name),[s,l]=(0,o().useState)(t.module_id),{mutate:c}=function(){const e=p(),{incrementProgress:t,decrementProgress:r,addNotice:n,addError:i}=tn();return ft({mutationFn:async n=>{t();try{await e.cancelQueries({queryKey:Xr.groups.lists()});const{id:t,...r}=n,i=await jt(Lt(t,r));return sd.parse(i).item}catch(e){throw r(),Yr(e)}},onSuccess:t=>{r(),n("Group saved"),e.invalidateQueries({queryKey:Xr.groups.lists()}),e.invalidateQueries({queryKey:Xr.groups.dropdown()}),e.invalidateQueries({queryKey:Xr.groups.detail(t.id)})},onError:e=>{i(e.message||"Failed to update group")}})}();return(0,u.jsx)("form",{onSubmit:function(e){e.preventDefault(),e.stopPropagation(),r(),c({id:t.id,name:n,moduleId:s})},children:(0,u.jsx)("table",{className:"edit-groups inline-edit-row",children:(0,u.jsxs)("tbody",{children:[(0,u.jsxs)("tr",{children:[(0,u.jsx)("th",{children:(0,a.__)("Name","redirection")}),(0,u.jsx)("td",{children:(0,u.jsx)("input",{type:"text",className:"regular-text",name:"name",value:n,onChange:e=>i(e.target.value)})})]}),(0,u.jsxs)("tr",{children:[(0,u.jsx)("th",{children:(0,a.__)("Module","redirection")}),(0,u.jsx)("td",{children:(0,u.jsx)(wn,{name:"module_id",value:String(s),onChange:e=>l(parseInt(e.target.value,10)),items:Xb().map(e=>({label:e.label,value:String(e.value)}))})})]}),(0,u.jsxs)("tr",{children:[(0,u.jsx)("th",{}),(0,u.jsxs)("td",{children:[(0,u.jsxs)("div",{className:"table-actions",children:[(0,u.jsx)(Ul,{isPrimary:!0,isSecondary:!1,isSubmit:!0,children:(0,a.__)("Save","redirection")})," ",(0,u.jsx)(Ul,{onClick:r,children:(0,a.__)("Cancel","redirection")})]}),2===s&&(0,u.jsxs)("p",{children:[(0,u.jsx)("br",{}),(0,a.__)("Note that you will need to set the Apache module path in your Redirection options.","redirection")]})]})]})]})})})};function sx(e){return e.includes("name")?e:e.concat(["name"])}const ax=function(){const e=$_(e=>e.groups),{setGroupsTable:t,setGroupsSelected:r}=$_();V_({table:e,setTable:t,allowedOrder:["name","id"],allowedFilters:["name","status","module"],defaultOrder:"name",pageName:"groups"});const n=Jb(),i=an(),{data:o,isLoading:s}=function(e={},t){const r=ud(e);return dt({queryKey:Xr.groups.list(r),refetchOnMount:"always",refetchOnReconnect:!0,placeholderData:e=>e,queryFn:async()=>{try{const e=await jt(It(r));return od.parse(e)}catch(e){const t=Yr(e);throw tn.getState().addError(t.message||"Failed to fetch groups"),t}},...t})}(e),l=o?.items??[],c=o?.total??0,d=s&&!o?"loading":"complete",p={displayFilters:Kb(),displayGroups:[{value:"standard",label:(0,a.__)("Standard Display","redirection"),grouping:["name","module","redirects"]},{value:"minimal",label:(0,a.__)("Compact Display","redirection"),grouping:["name"]},{value:"all",label:(0,a.__)("Display All","redirection"),grouping:Kb().map(e=>e.value)}],searchOptions:[{name:"name",title:(0,a.__)("Search","redirection")}],groupBy:[],bulk:[{id:"delete",name:(0,a.__)("Delete","redirection")},{id:"enable",name:(0,a.__)("Enable","redirection")},{id:"disable",name:(0,a.__)("Disable","redirection")},{id:"export-csv",name:(0,a.__)("Export as CSV","redirection")},{id:"export-json",name:(0,a.__)("Export as JSON","redirection")}],rowFilters:Qb(Xb().map(e=>({label:e.label,value:`${e.value}`}))),headers:[{name:"status",title:(0,a.__)("Status","redirection"),sortable:!1},{name:"name",title:(0,a.__)("Name","redirection"),primary:!0},{name:"redirects",title:(0,a.__)("Redirects","redirection"),sortable:!1},{name:"module",title:(0,a.__)("Module","redirection"),sortable:!1}].filter(t=>function(e,t){return t.displaySelected?.includes(e)??!1}(t.name,e)),validateDisplay:sx},h={onChangePage:e=>{t({page:e,selected:[],selectAll:!1})},onBulk:t=>{if(0===e.selected.length&&!e.selectAll)return;if("export-csv"===t||"export-json"===t){const r=ud(e.selectAll?{global:!0,filterBy:e.filterBy}:{items:e.selected});return void i.mutate({exportType:"group",format:"export-csv"===t?"csv":"json",download:!0,filename:ev("group","export-csv"===t?"csv":"json"),params:r})}if("delete"===t){const t=e.selectAll?(0,a.__)("Are you sure you want to delete all items?","redirection"):(0,a.__)("Are you sure you want to delete the selected items?","redirection");if(!window.confirm(t))return}const r=e.selected;if(e.selectAll){const r={global:!0,filterBy:e.filterBy};n.mutate({action:t,items:[],params:r})}else n.mutate({action:t,items:r})},onSelect:n=>{const i=e.selected;"boolean"==typeof n?r(n?l.map(e=>e.id):[]):Array.isArray(n)?r(n):i.includes(n)?t({selected:i.filter(e=>e!==n),selectAll:!1}):t({selected:[...i,n],selectAll:!1})},onSetOrder:(e,r)=>{t({orderby:e,direction:r})},onFilter:e=>{t({filterBy:e,page:0,selected:[],selectAll:!1})},onSetDisplay:(e,r)=>{t({displayType:e,displaySelected:r})},onSetAll:e=>{t({selected:e?l.map(e=>e.id):[],selectAll:e})},onGroup:e=>{t({groupBy:e,page:0,selected:[],selectAll:!1})}},f={page:e.page,perPage:e.per_page,orderBy:e.orderby,direction:e.direction,selected:e.selected,selectAll:e.selectAll??!1,filter:"",filterBy:e.filterBy??{},displayType:e.displayType??"standard",displaySelected:e.displaySelected??[],groupBy:e.groupBy??""};return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(Sy,{logOptions:p,logActions:h,table:f,status:d,total:c,rows:l,saving:[],getRow:(e,t)=>function(e,t){const{redirects:r}=e,{rowMode:n,setRowMode:i}=t;return[{name:"status",content:(0,u.jsx)(rx,{row:e})},{name:"name",content:"edit"===n?(0,u.jsx)(ox,{group:e,onCancel:()=>i(!1)}):(0,u.jsx)(nx,{row:e,filters:t.table.filterBy})},{name:"redirects",content:new Intl.NumberFormat(window.Redirectioni10n.locale).format(r)},{name:"module",content:(0,u.jsx)(ix,{row:e})}]}(e,t),getRowActions:(e,t)=>(0,u.jsx)(tx,{disabled:!1,row:e,rowParams:t})}),ky(Ry)&&(0,u.jsx)(ex,{disabled:!1})]})},lx=()=>[{value:"source",label:(0,a.__)("Source","redirection")},{value:"flags",label:(0,a.__)("URL options","redirection")},{value:"query",label:(0,a.__)("Query Parameters","redirection")},{value:"title",label:(0,a.__)("Title","redirection")},{value:"target",label:(0,a.__)("Target","redirection")},{value:"code",label:(0,a.__)("HTTP code","redirection")},{value:"match_type",label:(0,a.__)("Match Type","redirection")},{value:"position",label:(0,a.__)("Position","redirection")},{value:"last_count",label:(0,a.__)("Hits","redirection")},{value:"last_access",label:(0,a.__)("Last Access","redirection")},{value:"status",label:(0,a.__)("Status","redirection")},{value:"action_type",label:(0,a.__)("Action Type","redirection")},{value:"group",label:(0,a.__)("Group","redirection")}],cx=function(e){const{addTop:t}=e,r=m({"add-new":!0,edit:!0,addTop:t});return(0,u.jsxs)(u.Fragment,{children:[!t&&ky(Ey)&&(0,u.jsx)("h2",{children:(0,a.__)("Add redirect","redirection")}),(0,u.jsx)("div",{className:r,children:(0,u.jsx)(pb,{item:gv("",0,e.defaultFlags),saveButton:(0,a.__)("Add redirect","redirection"),autoFocus:!!t})})]})},ux=function(e){const{disabled:t,rowParams:r,row:n}=e,{mutate:i}=ub(),{mutate:o}=db("disable"),{mutate:s}=db("enable"),{setRowMode:l,rowMode:c}=r,{id:d,enabled:p,regex:h,action_type:f,match_type:m}=n,g=[];return"edit"===c?null:(ky(Ey)&&g.push((0,u.jsx)(Oy,{onClick:()=>l("edit"),children:(0,a.__)("Edit","redirection")},"1")),ky("redirection_cap_redirect_delete")&&g.push((0,u.jsx)(Oy,{onClick:()=>{window.confirm((0,a.__)("Are you sure you want to delete this item?","redirection"))&&i({items:[d]})},children:(0,a.__)("Delete","redirection")},"2")),ky(Ey)&&(p?g.push((0,u.jsx)(Oy,{onClick:()=>o({items:[d]}),children:(0,a.__)("Disable","redirection")},"3")):g.push((0,u.jsx)(Oy,{onClick:()=>s({items:[d]}),children:(0,a.__)("Enable","redirection")},"4"))),!p||h||"url"!==f||"url"!==m&&"server"!==m||g.push((0,u.jsx)(Oy,{onClick:()=>l("check"),children:(0,a.__)("Check Redirect","redirection")},"5")),(0,u.jsx)(Ny,{disabled:t,actions:g}))},dx=function({row:e}){const{enabled:t}=e;return t?(0,u.jsx)("div",{className:"redirect-status redirect-status__enabled",children:"✓"}):(0,u.jsx)("div",{className:"redirect-status redirect-status__disabled",children:"×"})},px=(e,t)=>e.includes(t);function hx(e,t,r){return"server"===r?e.server+t:t}function fx(e,t){const{match_type:r,regex:n,action_data:i,url:o}=e;return n?t:(0,u.jsx)(A,{url:hx(i,o,r),children:t})}function mx(e,t){return t?e:(0,u.jsx)("s",{children:e})}const gx=function(e){const{displaySelected:t,row:r,filters:n}=e,{match_type:i,url:o,title:s,action_data:a,enabled:l}=r,c=(0,u.jsx)(Vy(),{searchWords:[n.url||""],textToHighlight:hx(a,o,i),autoEscape:!0}),d=(0,u.jsx)(Vy(),{searchWords:[n.title||""],textToHighlight:s,autoEscape:!0});return px(t,"title")&&!px(t,"source")?(0,u.jsx)("p",{children:fx(r,mx(s?d:c,l))}):(0,u.jsxs)(u.Fragment,{children:[px(t,"title")&&s&&(0,u.jsx)("p",{children:fx(r,mx(d,l))}),px(t,"source")&&c&&(0,u.jsx)("p",{children:fx(r,mx(c,l))})]})},yx=function(e){const{row:t,filters:r}=e,{match_type:n,action_data:i}=t;return"url"===n&&i?(0,u.jsx)("span",{className:"target",children:(0,u.jsx)(Vy(),{searchWords:[r.target??""],textToHighlight:i.url??"",autoEscape:!0})}):null},vx=function({name:e,className:t,strikethrough:r}){return(0,u.jsx)(zu,{className:m("redirect-source__flag",t),children:r?(0,u.jsx)("s",{children:e}):e})},bx=function(e){const{row:t,defaultFlags:r}=e,{match_data:{source:n}}=t;return(0,u.jsx)(u.Fragment,{children:Object.keys(n).filter(e=>r[e]!==n[e]&&"flag_query"!==e).map(e=>{const t=wv().find(t=>t.value===e);return(0,u.jsx)(vx,{name:t?.label||"",className:"redirect-source__"+e,strikethrough:!!r[e]&&!n[e]},e)})})},xx=function(e){const{defaultFlags:t,row:r}=e,{match_data:{source:n}}=r;if(t.flag_query!==n.flag_query){let e;return e="ignore"===n.flag_query?(0,a.__)("Ignore Query","redirection"):"pass"===n.flag_query?(0,a.__)("Ignore & Pass Query","redirection"):(0,a.__)("Exact Query","redirection"),(0,u.jsx)(vx,{name:e})}return null},wx=function(e){const{row:t,table:r,defaultFlags:n}=e,{displaySelected:i}=r;return(0,u.jsxs)("div",{className:"redirect-column-wrap",children:[(0,u.jsxs)("div",{className:"redirect-source__details",children:[(0,u.jsx)(gx,{row:t,displaySelected:i,filters:r.filterBy}),px(i,"target")&&(0,u.jsx)(yx,{row:t,filters:r.filterBy})]}),(0,u.jsxs)("div",{className:"redirect-source__flags",children:[px(i,"flags")&&(0,u.jsx)(bx,{row:t,defaultFlags:n}),px(i,"query")&&(0,u.jsx)(xx,{row:t,defaultFlags:n})]})]})},jx=function(e){const{action_code:t,action_type:r}=e;return"pass"===r?(0,a.__)("pass","redirection"):r===iv?"-":t},Sx=function(e){const{row:t,group:r}=e,n=r.rows.find(e=>e.id===t.group_id);return n?(0,u.jsxs)("div",{className:"redirect-column-wrap",children:[n.name," ",(0,u.jsx)(zu,{children:n.moduleName})]}):null};function kx(e,t){const r=t.find(t=>t.value===e);return r?r.label:"-"}function Cx({url:e,desiredCode:t=0,desiredTarget:r=null}){return(0,u.jsx)(Id,{url:e,desiredCode:t,desiredTarget:r})}function Tx(e){let t=encodeURIComponent(e).replace(/%2F/gi,"/");return t=t.replace(/%3F/gi,"?"),t=t.replace(/%3D/gi,"="),t=t.replace(/%26/gi,"&"),t}function Ex(e){return e.includes("source")?e:e.concat(["source"])}function Rx(e){return e.includes("title")||e.includes("source")?Ex(e):Ex(e.concat(["title"]))}function Px(e){return[{value:"0",label:(0,a.__)("All groups","redirection")}].concat(md(e))}const Nx=function(){const e=$_(e=>e.redirects),t=$_(e=>e.redirectsAddTop),{setRedirectsTable:r,setRedirectsSelected:n}=$_(),i=he(e=>e.values);V_({table:e,setTable:r,allowedOrder:["id","url","last_access","last_count","position"],allowedFilters:["url","url-exact","target","title","group","status","match","action"],defaultOrder:"id",pageName:"redirect"});const{data:o,isSuccess:s}=dd(),l=o?.items??[],c=ub(),d=db("enable"),p=db("disable"),h=db("reset"),f=an(),{data:m,isLoading:g,isSuccess:_}=function(e={},t){const r=ud(e);return dt({queryKey:Xr.redirects.list(r),refetchOnMount:"always",refetchOnReconnect:!0,placeholderData:e=>e,queryFn:async()=>{try{const e=await jt(Pt(r));return nd.parse(e)}catch(e){const t=Yr(e);throw tn.getState().addError(t.message||"Failed to fetch redirects"),t}},...t})}(e),y=m?.items??[],v=m?.total??0;let b="idle";g&&!m?b=Z_:(_||m)&&(b=K_);const x={flag_query:i?.flag_query??"ignore",flag_case:i?.flag_case??!1,flag_trailing:i?.flag_trailing??!1,flag_regex:i?.flag_regex??!1},w=b===K_&&s&&ky(Ey),j=e=>{r({filterBy:e,page:0,selected:[],selectAll:!1})},S={displayFilters:lx(),displayGroups:[{value:"standard",label:(0,a.__)("Standard Display","redirection"),grouping:["last_count","last_access","source","target","code","title"]},{value:"minimal",label:(0,a.__)("Compact Display","redirection"),grouping:["source","last_count","last_access","target"]},{value:"all",label:(0,a.__)("Display All","redirection"),grouping:lx().map(e=>e.value)}],searchOptions:[{name:"url",title:(0,a.__)("Search URL","redirection")},{name:"target",title:(0,a.__)("Search target URL","redirection")},{name:"title",title:(0,a.__)("Search title","redirection")}],groupBy:Px(l),bulk:[{id:"delete",name:(0,a.__)("Delete","redirection")},{id:"enable",name:(0,a.__)("Enable","redirection")},{id:"disable",name:(0,a.__)("Disable","redirection")},{id:"reset",name:(0,a.__)("Reset hits","redirection")},{id:"export-csv",name:(0,a.__)("Export as CSV","redirection")},{id:"export-json",name:(0,a.__)("Export as JSON","redirection")},{id:"copy-csv",name:(0,a.__)("Copy CSV","redirection")},{id:"copy-json",name:(0,a.__)("Copy JSON","redirection")}],rowFilters:[{label:(0,a.__)("Status","redirection"),value:"status",options:[{label:(0,a.__)("Enabled","redirection"),value:"enabled"},{label:(0,a.__)("Disabled","redirection"),value:"disabled"}]},{label:(0,a.__)("URL match","redirection"),value:"url-match",options:[{label:(0,a.__)("Regular Expression","redirection"),value:"regular"},{label:(0,a.__)("Plain","redirection"),value:"plain"}]},{label:(0,a.__)("Match Type","redirection"),value:"match",options:_v()},{label:(0,a.__)("Action Type","redirection"),value:"action",options:yv()},{label:(0,a.__)("HTTP Status Code","redirection"),value:"http",options:xv()},{label:(0,a.__)("Last Accessed","redirection"),value:"access",options:[{label:(0,a.__)("Never accessed","redirection"),value:"never"},{label:(0,a.__)("Not accessed in last month","redirection"),value:"month"},{label:(0,a.__)("Not accessed in last year","redirection"),value:"year"}]}],headers:[{name:"status",title:(0,a.__)("Status","redirection"),sortable:!1},{name:"source",title:(0,a.__)("URL","redirection"),primary:!0},{name:"match_type",title:(0,a.__)("Match Type","redirection"),sortable:!1},{name:"action_type",title:(0,a.__)("Action Type","redirection"),sortable:!1},{name:"code",title:(0,a.__)("Code","redirection"),sortable:!1},{name:"group",title:(0,a.__)("Group","redirection"),sortable:!1},{name:"position",title:(0,a.__)("Pos","redirection")},{name:"last_count",title:(0,a.__)("Hits","redirection"),sortable:!0},{name:"last_access",title:(0,a.__)("Last Access","redirection")}].filter(t=>function(e,t){return t.displaySelected.includes(e)}(t.name,e)),validateDisplay:Rx},k={onChangePage:e=>{r({page:e,selected:[],selectAll:!1})},onBulk:t=>{const r=e.selected;if(0!==r.length||e.selectAll){if("delete"===t){const t=e.selectAll?(0,a.__)("Are you sure you want to delete all items?","redirection"):(0,a.__)("Are you sure you want to delete the selected items?","redirection");if(!window.confirm(t))return}if(["export-csv","export-json","copy-csv","copy-json"].includes(t)){const n=ud(e.selectAll?{global:!0,filterBy:e.filterBy}:{items:r}),i=t.endsWith("csv")?"csv":"json",o=t.startsWith("copy-"),s={exportType:"redirect",format:i,download:!o,copy:o,completionNotice:{message:o?(0,a.__)("Export copied","redirection"):(0,a.__)("Export downloaded","redirection")},params:n};return o||(s.filename=ev("redirect",i)),void f.mutate(s)}if(e.selectAll){const r={global:!0,filterBy:e.filterBy};"delete"===t&&c.mutate({items:[],params:r})}else switch(t){case"delete":c.mutate({items:r});break;case"enable":d.mutate({items:r});break;case"disable":p.mutate({items:r});break;case"reset":h.mutate({items:r})}}},onSelect:t=>{if("boolean"==typeof t)n(t?y.map(e=>e.id):[]);else if("number"==typeof t||"string"==typeof t){const n=e.selected.includes(t)?e.selected.filter(e=>e!==t):[...e.selected,t];r({selected:n,selectAll:!1})}else n(t)},onSetOrder:(e,t)=>{r({orderby:e,direction:t})},onFilter:t=>{j({...t,...e.filterBy?.group?{group:String(e.filterBy.group)}:{}})},onSetDisplay:(e,t)=>{r({displayType:e,displaySelected:t})},onSetAll:e=>{r({selected:e?y.map(e=>e.id):[],selectAll:e})},onGroup:t=>{j(parseInt(t,10)>0?{...e.filterBy||{},group:t}:{})}},C={page:e.page,perPage:e.per_page,orderBy:e.orderby,direction:e.direction,selected:e.selected,selectAll:e.selectAll??!1,filter:"",filterBy:e.filterBy??{},displayType:e.displayType??"standard",displaySelected:e.displaySelected??[],groupBy:String(e.filterBy?.group??"0")};return(0,u.jsxs)("div",{className:"redirects",children:[t&&ky(Ey)&&(0,u.jsx)(cx,{defaultFlags:x,addTop:!0}),(0,u.jsx)(Sy,{logOptions:S,logActions:k,table:C,status:b,total:v,rows:y,saving:[],getRow:(e,t)=>function(e,t,r,n,i){const{last_access:o,hits:s,position:a,match_type:l,action_type:c,action_code:d,action_data:p}=e,{rowMode:h,setRowMode:f}=t;return"edit"===h?(0,u.jsx)(pb,{item:e,onCancel:()=>f(!1)}):[{name:"status",content:(0,u.jsx)(dx,{row:e})},{name:"source",content:(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(wx,{row:e,table:t.table,defaultFlags:n}),"check"===h&&(0,u.jsx)(jd,{onClose:()=>f(null),children:(0,u.jsx)(Cx,{url:hd((m=e,"server"===m.match_type?m.action_data.server??"":document.location.origin),Tx(e.url)),desiredCode:d,desiredTarget:p})})]}),alwaysDisplay:!0},{name:"match_type",content:kx(l,_v())},{name:"action_type",content:kx(c,yv())},{name:"code",content:jx(e)},{name:"group",content:(0,u.jsx)(Sx,{row:e,group:i})},{name:"position",content:new Intl.NumberFormat(window.Redirectioni10n.locale).format(a)},{name:"last_count",content:new Intl.NumberFormat(window.Redirectioni10n.locale).format(s)},{name:"last_access",content:o}];var m}(e,t,0,x,{rows:l}),getRowActions:(e,t)=>(0,u.jsx)(ux,{disabled:!1,row:e,rowParams:t})}),w&&!t&&(0,u.jsx)(cx,{defaultFlags:x,addTop:!1})]})},Ox=function({page:e}){switch(e){case"support":return(0,u.jsx)(Ud,{});case"404s":return(0,u.jsx)(_b,{});case"log":return(0,u.jsx)(rv,{});case"import":return(0,u.jsx)(Db,{});case"export":return(0,u.jsx)(Zb,{});case"groups":return(0,u.jsx)(ax,{});case"options":return(0,u.jsx)(kd,{});case"site":return(0,u.jsx)(R_,{})}return(0,u.jsx)(Nx,{})};function Ax(){window.location.href=function(){const e=new URL(window.location.href);return e.searchParams.set("redirection_cache_bust",Date.now().toString()),e.toString()}()}const Ix=function(){return(0,u.jsxs)(V,{errors:"",details:J().concat(["Buster: 5.10.0 === "+Redirectioni10n.version]),type:"fixed",title:(0,a.__)("Cached Redirection detected","redirection"),links:Q(),locale:"redirection",children:[(0,u.jsx)("p",{children:(0,a.__)("This page was loaded from an old cached copy of the WordPress admin area. This is usually caused by a caching system, such as Cloudflare, LiteSpeed, or your host, rather than by your own browser.","redirection")}),(0,u.jsx)("p",{children:(0,u.jsx)(Ul,{isPrimary:!0,onClick:Ax,children:(0,a.__)("Reload without cache","redirection")})}),(0,u.jsx)("p",{children:M((0,a.__)("If reloading does not fix this, ask your host or caching provider to exclude the WordPress admin area (/wp-admin/) from any page caching. If you are using Cloudflare then please read this: {{link}}clearing your cache.{{/link}}","redirection"),{link:(0,u.jsx)(A,{url:"https://redirection.me/support/problems/cloudflare/"})})})]})},Fx=function(){const{update_notice:e=!1}=window.Redirectioni10n,{mutate:t}=Na();return e&&ky("redirection_cap_option_manage")?(0,u.jsx)(Wu,{className:"update-notice",children:(0,u.jsxs)("p",{children:[M((0,a.sprintf)(
// translators: %s is the version number
// translators: %s is the version number
(0,a.__)("Version %s installed! Please read the {{url}}release notes{{/url}} for details.","redirection"),e),{url:(0,u.jsx)(A,{url:"https://redirection.me/blog/redirection-version-"+e.replace(".","-")+"/"})})," ",(0,u.jsx)(Ul,{onClick:function(){t({update_notice:window.Redirectioni10n.update_notice}),window.Redirectioni10n.update_notice=!1},children:(0,a.__)("OK","redirection")})]})}):null},Lx=Redirectioni10n?.caps?.pages||[];function Dx(){const e=tn(e=>e.errors),t=tn(e=>e.notices),{clearErrors:r,clearNotices:n}=tn(),i=he(e=>e.database.status),s=he(e=>e.showDatabase),l=he(e=>e.database.inProgress),c=he(e=>e.values?.plugin_update??""),{setShowDatabase:d,setApi:p}=he(),{setErrorsTable:h,setLogsTable:f,setRedirectsTable:m,setRedirectsAddTop:g,setGroupsTable:_}=$_(),[y,v]=(0,o().useState)(Il(Lx));(0,o().useEffect)(()=>{if(window.Redirectioni10n?.api?.routes&&p({routes:window.Redirectioni10n.api.routes,current:window.Redirectioni10n.api.current??""}),window.Redirectioni10n?.settings&&!he.getState().values){const{setValues:e,setLoadStatus:t}=he.getState();e(window.Redirectioni10n.settings),t("success")}if(window.Redirectioni10n?.database){const{setDatabase:e}=he.getState();e(window.Redirectioni10n.database)}},[p]);const b=(0,o().useCallback)(e=>{v(e)},[]),x=(0,o().useCallback)(()=>{r()},[r]),w=(0,o().useMemo)(()=>[{name:(0,a.__)("Redirects","redirection"),value:""},{name:(0,a.__)("Groups","redirection"),value:"groups"},{name:(0,a.__)("Site","redirection"),value:"site"},{name:(0,a.__)("Log","redirection"),value:"log"},{name:(0,a.__)("404s","redirection"),value:"404s"},{name:(0,a.__)("Import","redirection"),value:"import"},{name:(0,a.__)("Export","redirection"),value:"export"},{name:(0,a.__)("Options","redirection"),value:"options"},{name:(0,a.__)("Support","redirection"),value:"support"}].filter(e=>Cy(e.value)||""===e.value&&Cy("redirect")),[]),j=(0,o().useMemo)(()=>({redirect:(0,a.__)("Redirections","redirection"),site:(0,a.__)("Site","redirection"),groups:(0,a.__)("Groups","redirection"),import:(0,a.__)("Import redirects","redirection"),export:(0,a.__)("Export redirects","redirection"),log:(0,a.__)("Logs","redirection"),"404s":(0,a.__)("404 errors","redirection"),options:(0,a.__)("Options","redirection"),support:(0,a.__)("Support","redirection")}),[]),S=(0,o().useCallback)(e=>{b(""===e?"redirect":e),"404s"===e?h({orderby:"",direction:"desc",page:0,perPage:25,selected:[],filter:"",filterBy:"",groupBy:""}):"log"===e?f({orderby:"",direction:"desc",page:0,perPage:25,selected:[],filter:"",filterBy:"",groupBy:""}):""===e?m({orderby:"id",direction:"desc",page:0,perPage:25,selected:[],filter:"",filterBy:"",groupBy:""}):"groups"===e&&_({orderby:"name",direction:"asc",page:0,perPage:25,selected:[],filter:"",filterBy:"",groupBy:""})},[b,h,f,m,_]);if("5.10.0"!==Redirectioni10n.version)return(0,u.jsx)(Ix,{});if("need-install"===i||"finish-install"===i)return(0,u.jsx)(K,{renderCrash:Ml,extra:{page:y},children:(0,u.jsx)(gl,{})});const k="prompt"===c&&("need-update"===i||"finish-update"===i);return(0,u.jsx)(K,{renderCrash:Ml,extra:{page:y},children:(0,u.jsxs)("div",{className:"wrap redirection notranslate",translate:"no",children:[k&&(0,u.jsx)(Sl,{onShowUpgrade:()=>d(!0),showDatabase:s}),!l&&"finish-update"!==i&&!s&&(0,u.jsxs)(Fl,{page:y,setPage:b,onPageChange:x,allowedPages:Lx,baseUrl:"?page=redirection.php",defaultPage:"redirect",children:[(0,u.jsx)("h1",{className:"wp-heading-inline",children:j[y]}),"redirect"===y&&ky(Ey)&&(0,u.jsx)("button",{type:"button",onClick:()=>g(!0),className:"page-title-action",children:(0,a.__)("Add redirect","redirection")}),(0,u.jsx)(Fx,{}),(0,u.jsx)(Tl,{onChangePage:S,currentPage:y,menu:w,home:"redirect",urlBase:Redirectioni10n.pluginRoot}),(0,u.jsx)(V,{errors:e,onClear:()=>r(),renderDebug:fe,details:J(),links:Q(),locale:"redirection",children:(0,u.jsx)(Ll,{})}),(0,u.jsx)(Ox,{page:y}),(0,u.jsx)(Pl,{notices:t,onClear:()=>n(),snackBarViewText:(0,a.__)("View notice","redirection")})]})]})})}var zx=class extends We{#H;#W;#G;constructor(e={}){super(),this.config=e,this.#H=new Set,this.#W=new Map,this.#G=0}build(e,t,r){const n=new pt({client:e,mutationCache:this,mutationId:++this.#G,options:e.defaultMutationOptions(t),state:r});return this.add(n),n}add(e){this.#H.add(e);const t=Mx(e);if("string"==typeof t){const r=this.#W.get(t);r?r.push(e):this.#W.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#H.delete(e)){const t=Mx(e);if("string"==typeof t){const r=this.#W.get(t);if(r)if(r.length>1){const t=r.indexOf(e);-1!==t&&r.splice(t,1)}else r[0]===e&&this.#W.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=Mx(e);if("string"==typeof t){const r=this.#W.get(t)?.find(e=>"pending"===e.state.status);return!r||r===e}return!0}runNext(e){const t=Mx(e);return"string"==typeof t?(this.#W.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){qe.batch(()=>{this.#H.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#H.clear(),this.#W.clear()})}getAll(){return Array.from(this.#H)}find(e){const t={exact:!0,...e};return this.getAll().find(e=>Ce(t,e))}findAll(e={}){return this.getAll().filter(t=>Ce(e,t))}notify(e){qe.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(e=>e.state.isPaused);return qe.batch(()=>Promise.all(e.map(e=>e.continue().catch(xe))))}};function Mx(e){return e.options.scope?.id}var $x=class extends We{#V;constructor(e={}){super(),this.config=e,this.#V=new Map}build(e,t,r){const n=t.queryKey,i=t.queryHash??Te(n,t);let o=this.get(i);return o||(o=new rt({client:e,queryKey:n,queryHash:i,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(n)}),this.add(o)),o}add(e){this.#V.has(e.queryHash)||(this.#V.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#V.get(e.queryHash);t&&(e.destroy(),t===e&&this.#V.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){qe.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#V.get(e)}getAll(){return[...this.#V.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(e=>ke(t,e))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(t=>ke(e,t)):t}notify(e){qe.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){qe.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){qe.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}};function Ux(e,t){console.error(`TanStack ${e} error:`,{error:t,userAgent:"undefined"!=typeof navigator?navigator.userAgent:"",timestamp:(new Date).toISOString(),redirectionData:"object"==typeof window.Redirectioni10n&&window.Redirectioni10n?{version:window.Redirectioni10n.version,locale:window.Redirectioni10n.locale,apiRoot:window.Redirectioni10n.api?.WP_API_root}:null})}const Bx=new class{#Z;#M;#h;#K;#Q;#J;#Y;#X;constructor(e={}){this.#Z=e.queryCache||new $x,this.#M=e.mutationCache||new zx,this.#h=e.defaultOptions||{},this.#K=new Map,this.#Q=new Map,this.#J=0}mount(){this.#J++,1===this.#J&&(this.#Y=Ge.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#Z.onFocus())}),this.#X=Ve.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#Z.onOnline())}))}unmount(){this.#J--,0===this.#J&&(this.#Y?.(),this.#Y=void 0,this.#X?.(),this.#X=void 0)}isFetching(e){return this.#Z.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#M.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#Z.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=this.#Z.build(this,t),n=r.state.data;return void 0===n?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(Se(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return this.#Z.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,r){const n=this.defaultQueryOptions({queryKey:e}),i=this.#Z.get(n.queryHash)?.state.data,o=function(e,t){return"function"==typeof e?e(t):e}(t,i);if(void 0!==o)return this.#Z.build(this,n).setData(o,{...r,manual:!0})}setQueriesData(e,t,r){return qe.batch(()=>this.#Z.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,r)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#Z.get(t.queryHash)?.state}removeQueries(e){const t=this.#Z;qe.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){const r=this.#Z;return qe.batch(()=>{const n=r.findAll(e),i=new Set(n);return n.forEach(e=>{e.reset()}),this.refetchQueries({type:"active",predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){const r={revert:!0,...t},n=qe.batch(()=>this.#Z.findAll(e).map(e=>e.cancel(r)));return Promise.all(n).then(xe).catch(xe)}invalidateQueries(e,t={}){return qe.batch(()=>(this.#Z.findAll(e).forEach(e=>{e.invalidate()}),"none"===e?.refetchType?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const r={...t,cancelRefetch:t.cancelRefetch??!0},n=qe.batch(()=>this.#Z.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,r);return r.throwOnError||(t=t.catch(xe)),"paused"===e.state.fetchStatus?Promise.resolve():t}));return Promise.all(n).then(xe)}async query(e){const t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);const r=this.#Z.build(this,t),n=r.isStaleByTime(Se(t.staleTime,r))?await r.fetch(t):r.state.data,i=t.select;return i?i(n):n}fetchQuery(e){const t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);const r=this.#Z.build(this,t);return r.isStaleByTime(Se(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(xe).catch(xe)}infiniteQuery(e){return e._type="infinite",this.query(e)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(xe).catch(xe)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return Ve.isOnline()?this.#M.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#Z}getMutationCache(){return this.#M}getDefaultOptions(){return this.#h}setDefaultOptions(e){this.#h=e}setQueryDefaults(e,t){this.#K.set(Ee(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#K.values()],r={};return t.forEach(t=>{Re(e,t.queryKey)&&Object.assign(r,t.defaultOptions)}),r}setMutationDefaults(e,t){this.#Q.set(Ee(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#Q.values()],r={};return t.forEach(t=>{Re(e,t.mutationKey)&&Object.assign(r,t.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#h.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Te(t.queryKey,t)),void 0===t.refetchOnReconnect&&(t.refetchOnReconnect="always"!==t.networkMode),void 0===t.throwOnError&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Me&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#h.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#Z.clear(),this.#M.clear()}}({queryCache:new $x({onError:e=>{Ux("Query",e)}}),mutationCache:new zx({onError:e=>{Ux("Mutation",e)}}),defaultOptions:{queries:{staleTime:0,retry:!1,refetchOnWindowFocus:!1},mutations:{retry:!1}}});let qx=!1;function Hx(e,t){const r=e?.stack||"",n="object"==typeof window.Redirectioni10n&&!!window.Redirectioni10n&&!!window.Redirectioni10n.api&&"object"==typeof window.Redirectioni10n.api&&"string"==typeof window.Redirectioni10n.versions;return console.error("Redirection app crashed:",{error:e,errorInfo:t,redirectionData:"object"==typeof window.Redirectioni10n&&window.Redirectioni10n?{version:window.Redirectioni10n.version,locale:window.Redirectioni10n.locale,apiRoot:window.Redirectioni10n.api?.WP_API_root}:null}),(0,u.jsxs)(V,{errors:"",type:"fixed",links:n?Q():void 0,details:(n?J():[]).concat([r,t?.componentStack||""]),locale:"redirection",title:(0,a.__)("Redirection plugin error","redirection"),children:[(0,u.jsx)("p",{children:(0,a.__)("The Redirection plugin encountered an error and could not load properly.","redirection")}),(0,u.jsx)("p",{children:(0,u.jsx)("strong",{children:(0,a.__)("Possible solutions:","redirection")})}),(0,u.jsxs)("ul",{children:[(0,u.jsx)("li",{children:(0,a.__)("Refresh the page","redirection")}),(0,u.jsx)("li",{children:(0,a.__)("Clear browser cache","redirection")}),(0,u.jsx)("li",{children:(0,a.__)("Disable conflicting plugins","redirection")}),(0,u.jsx)("li",{children:(0,a.__)("Check for JavaScript errors in browser console","redirection")})]})]})}function Wx(){return(0,u.jsx)(K,{renderCrash:Hx,children:(0,u.jsx)(Gx,{})})}function Gx(){const[e,t]=(0,o().useState)(qx),r=function(){if("object"!=typeof window.Redirectioni10n||!window.Redirectioni10n)throw new Error("Redirectioni10n global data is missing. This may indicate a plugin conflict or caching issue.");if(!window.Redirectioni10n.api)throw new Error("Redirectioni10n.api is missing. The WordPress REST API configuration was not loaded.");const e=window.Redirectioni10n.api.WP_API_root;if(!e)throw new Error("WP_API_root is missing from Redirectioni10n.api");const t=window.Redirectioni10n.api.WP_API_nonce??"";let r=window.Redirectioni10n.locale,n=!1;try{new Intl.NumberFormat(r)}catch(e){r="en-US",n=!0}return{apiRoot:e,apiNonce:t,locale:r,localeWasInvalid:n}}();return(0,o().useEffect)(()=>{qx||(r.localeWasInvalid&&(console.warn("Invalid locale:",window.Redirectioni10n.locale,"falling back to en-US"),window.Redirectioni10n.locale=r.locale),r.apiNonce||console.warn("WP_API_nonce is missing from Redirectioni10n.api"),jt.resetMiddlewares(),jt.use(jt.createRootURLMiddleware(r.apiRoot)),jt.use(jt.createNonceMiddleware(r.apiNonce)),qx=!0),t(!0)},[r.apiNonce,r.apiRoot,r.locale,r.localeWasInvalid]),e?(0,u.jsxs)(h,{client:Bx,children:[(0,u.jsx)(Dx,{}),!1]}):(0,u.jsx)(u.Fragment,{})}document.querySelector("#react-ui")&&window.Redirectioni10n&&(function(){const e=document.getElementById("react-ui");e&&(0,s.createRoot)(e).render((0,u.jsx)(Wx,{}))}(),window.redirection=window.Redirectioni10n.version)},465(e,t,r){e.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={exports:{},id:n,loaded:!1};return e[n].call(i.exports,i,i.exports,r),i.loaded=!0,i.exports}return r.m=e,r.c=t,r.p="",r(0)}([function(e,t,r){e.exports=r(1)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,i=(n=r(2))&&n.__esModule?n:{default:n};t.default=i.default,e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};t.default=function(e){var t=e.activeClassName,r=void 0===t?"":t,i=e.activeIndex,l=void 0===i?-1:i,c=e.activeStyle,u=e.autoEscape,d=e.caseSensitive,p=void 0!==d&&d,h=e.className,f=e.findChunks,m=e.highlightClassName,g=void 0===m?"":m,_=e.highlightStyle,y=void 0===_?{}:_,v=e.highlightTag,b=void 0===v?"mark":v,x=e.sanitize,w=e.searchWords,j=e.textToHighlight,S=e.unhighlightTag,k=void 0===S?"span":S,C=e.unhighlightClassName,T=void 0===C?"":C,E=e.unhighlightStyle,R=function(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}(e,["activeClassName","activeIndex","activeStyle","autoEscape","caseSensitive","className","findChunks","highlightClassName","highlightStyle","highlightTag","sanitize","searchWords","textToHighlight","unhighlightTag","unhighlightClassName","unhighlightStyle"]),P=(0,o.findAll)({autoEscape:u,caseSensitive:p,findChunks:f,sanitize:x,searchWords:w,textToHighlight:j}),N=b,O=-1,A="",I=void 0,F=(0,a.default)(function(e){var t={};for(var r in e)t[r.toLowerCase()]=e[r];return t});return(0,s.createElement)("span",n({className:h},R,{children:P.map(function(e,t){var n=j.substr(e.start,e.end-e.start);if(e.highlight){O++;var i;i="object"==typeof g?p?g[n]:(g=F(g))[n.toLowerCase()]:g;var o=O===+l;A=i+" "+(o?r:""),I=!0===o&&null!=c?Object.assign({},y,c):y;var a={children:n,className:A,key:t,style:I};return"string"!=typeof N&&(a.highlightIndex=O),(0,s.createElement)(N,a)}return(0,s.createElement)(k,{children:n,className:T,key:t,style:E})})}))};var i,o=r(3),s=r(4),a=(i=r(5))&&i.__esModule?i:{default:i};e.exports=t.default},function(e,t){e.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={exports:{},id:n,loaded:!1};return e[n].call(i.exports,i,i.exports,r),i.loaded=!0,i.exports}return r.m=e,r.c=t,r.p="",r(0)}([function(e,t,r){e.exports=r(1)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(2);Object.defineProperty(t,"combineChunks",{enumerable:!0,get:function(){return n.combineChunks}}),Object.defineProperty(t,"fillInChunks",{enumerable:!0,get:function(){return n.fillInChunks}}),Object.defineProperty(t,"findAll",{enumerable:!0,get:function(){return n.findAll}}),Object.defineProperty(t,"findChunks",{enumerable:!0,get:function(){return n.findChunks}})},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.findAll=function(e){var t=e.autoEscape,o=e.caseSensitive,s=void 0!==o&&o,a=e.findChunks,l=void 0===a?n:a,c=e.sanitize,u=e.searchWords,d=e.textToHighlight;return i({chunksToHighlight:r({chunks:l({autoEscape:t,caseSensitive:s,sanitize:c,searchWords:u,textToHighlight:d})}),totalLength:d?d.length:0})};var r=t.combineChunks=function(e){var t=e.chunks;return t.sort(function(e,t){return e.start-t.start}).reduce(function(e,t){if(0===e.length)return[t];var r=e.pop();if(t.start<=r.end){var n=Math.max(r.end,t.end);e.push({start:r.start,end:n})}else e.push(r,t);return e},[])},n=function(e){var t=e.autoEscape,r=e.caseSensitive,n=e.sanitize,i=void 0===n?o:n,s=e.searchWords,a=e.textToHighlight;return a=i(a),s.filter(function(e){return e}).reduce(function(e,n){n=i(n),t&&(n=n.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"));for(var o=new RegExp(n,r?"g":"gi"),s=void 0;s=o.exec(a);){var l=s.index,c=o.lastIndex;c>l&&e.push({start:l,end:c}),s.index==o.lastIndex&&o.lastIndex++}return e},[])};t.findChunks=n;var i=t.fillInChunks=function(e){var t=e.chunksToHighlight,r=e.totalLength,n=[],i=function(e,t,r){t-e>0&&n.push({start:e,end:t,highlight:r})};if(0===t.length)i(0,r,!1);else{var o=0;t.forEach(function(e){i(o,e.start,!1),i(e.start,e.end,!0),o=e.end}),i(o,r,!1)}return n};function o(e){return e}}])},function(e,t){e.exports=r(609)},function(e,t){"use strict";var r=function(e,t){return e===t};e.exports=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r,n=void 0,i=[],o=void 0,s=!1,a=function(e,r){return t(e,i[r])};return function(){for(var t=arguments.length,r=Array(t),l=0;l<t;l++)r[l]=arguments[l];return s&&n===this&&r.length===i.length&&r.every(a)?o:(s=!0,n=this,i=r,o=e.apply(this,r))}}}])},609(e){"use strict";e.exports=window.React},500(e,t){var r;!function(){"use strict";var n={}.hasOwnProperty;function i(){for(var e="",t=0;t<arguments.length;t++){var r=arguments[t];r&&(e=s(e,o(r)))}return e}function o(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return i.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var t="";for(var r in e)n.call(e,r)&&e[r]&&(t=s(t,r));return t}function s(e,t){return t?e?e+" "+t:e+t:e}e.exports?(i.default=i,e.exports=i):void 0===(r=function(){return i}.apply(t,[]))||(e.exports=r)}()}};const t={};function r(n){const i=t[n];if(void 0!==i)return i.exports;const o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}r.m=e,(()=>{const e=[];r.O=(t,n,i,o)=>{if(n){o||=0;for(var s=e.length;s>0&&e[s-1][2]>o;s--)e[s]=e[s-1];return void(e[s]=[n,i,o])}let a=1/0;for(s=0;s<e.length;s++){let[n,i,o]=e[s],c=!0;for(var l=0;l<n.length;l++)1&o&&!(a>=o)||!Object.keys(r.O).every(e=>r.O[e](n[l]))?(c=!1,o<a&&(a=o)):n.splice(l--,1);if(c){e.splice(s--,1);const r=i();void 0!==r&&(t=r)}}return t}})(),r.n=e=>{const t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.cw=e=>{var t;return()=>{if(e){var r=e;e=0,t={exports:{}},r.call(t.exports,t,t.exports)}return t.exports}},(()=>{const e=Object.getPrototypeOf;let t;r.t=function(n,i){if(1&i&&(n=this(n)),8&i)return n;if("object"==typeof n&&n){if(4&i&&n.__esModule)return n;if(16&i&&"function"==typeof n.then)return n}const o=Object.create(null);r.r(o);const s={};t||=[null,e({}),e([]),e(e)];for(var a=2&i&&n;("object"==typeof a||"function"==typeof a)&&!~t.indexOf(a);a=e(a))Object.getOwnPropertyNames(a).forEach(e=>s[e]=()=>n[e]);return s.default=()=>n,r.d(o,s),o}})(),r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.hasOwn(e,t),r.r=e=>{Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.dn=e=>{var t=Object.getOwnPropertyDescriptor(e,"name");(!t||!t.writable&&t.configurable)&&Object.defineProperty(e,"name",{value:"default",configurable:!0})},(()=>{const e={57:0,350:0};r.O.j=t=>0===e[t];const t=(t,n)=>{let[i,o,s]=n;var a,l,c=0;if(i.some(t=>0!==e[t])){for(a in o)r.o(o,a)&&(r.m[a]=o[a]);if(s)var u=s(r)}for(t&&t(n);c<i.length;c++)l=i[c],r.o(e,l)&&e[l]&&e[l][0](),e[l]=0;return r.O(u)},n=globalThis.webpackChunkredirection||=[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();let n=r.O(void 0,[350],()=>r(405));n=r.O(n)})();