Your IP : 216.73.216.78
/*! Redirection v5.10.1 - please refer to license.txt for license information */
(()=>{var e={295(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 y(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 _=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),_(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"],P=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=y(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),_=o().useRef(0),b=o().useRef(),P=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];_.current!==o&&(_.current=o,e.style.setProperty("height",o+"px","important"),d(o,{rowHeight:a}))}};return o().useLayoutEffect(P),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&&P()})}}),T(window,"resize",P),r=P,T(document.fonts,"loadingdone",r),o().createElement("textarea",g({},p,{onChange:function(e){h||P(),l(e)},ref:m}))},R=o().forwardRef(P);const O=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)(R,{readOnly:!0,cols:120,value:c.concat(f).join("\n"),maxRows:40,spellCheck:!1})})]})},N=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)(O,{...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 D(e){return"rest_api_redirected"===e?.code}function L(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 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{request:t,code:r}=e??{};return!!(t&&t.status&&r)&&(-1!==[400,401,403,405].indexOf(t.status)||"rest_no_route"===r)&&0===parseInt(String(r),10)}(e))return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("p",{children:L(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(D(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:L(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:L(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:L(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:L(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:L(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:L(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:L(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)&&!D(e)&&!F(e)}(n),a=function(e){return!!I(e)||!!D(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)(O,{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)(O,{...e})]})},W=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)(O,{...e})]})},H=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)(O,{...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 Z=function(e){const{onClear:t,mini:r=!1,type:n=""}=e,i=(0,o().useMemo)(()=>(Array.isArray(e.errors)?e.errors:[e.errors]).filter(e=>null!=e),[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=Math.min(s,i.length-1),d=function(e,t){const r=e;return"rest_cookie_invalid_nonce"===r?.code?N:400===r?.jsonData?.status?H:"error"===t?q:"fixed"===t?W:B}(i[c],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:c,change:a,total:i.length}),(0,u.jsx)(d,{error:i[c],...e})]})};class K 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 V=K;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(ga){}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 ye=o().createContext(function(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}()),_e={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},ve=new class{#e=_e;#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(!Pe(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(!Pe(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 Pe(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)){if(t.length>e.length)return!1;for(let r=0;r<t.length;r++)if(!Pe(e[r],t[r]))return!1;return!0}const r=Object.keys(t);for(const n of r)if(!Pe(e[n],t[n]))return!1;return!0}return!1}const Re=Object.prototype.hasOwnProperty;function Oe(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:Re.call(e,s))&&l++;continue}if(null===u||null===d||"object"!=typeof u||"object"!=typeof d){a[s]=d;continue}const p=Oe(u,d,r+1);a[s]=p,p===u&&l++}return i===s&&l===i?e:a}function Ne(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=Object.getPrototypeOf(e),r=t?.constructor;if(void 0===r)return!0;if("function"!=typeof r)return!1;const n=r.prototype;return!!Fe(n)&&!!n.hasOwnProperty("isPrototypeOf")&&t===Object.prototype}function Fe(e){return"[object Object]"===Object.prototype.toString.call(e)}function De(e,t,r){return"function"==typeof r.structuralSharing?r.structuralSharing(e,t):!1!==r.structuralSharing?Oe(e,t):t}function Le(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 We=()=>be;var He=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 He{#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}},Ze=new class extends He{#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 Ke(e){return Math.min(1e3*2**e,3e4)}function Ve(e){return"online"!==(e??"online")||Ze.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||Ze.isOnline())&&e.canRun(),u=()=>Ve(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??(We()?0:3),n=e.retryDelay??Ke,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??(We()?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:Le;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=De(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:Ve(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 He{#d;#g=void 0;#y=void 0;#_=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.#P():this.updateResult(),this.#R())}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.#O(),this.#N(),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&&!Ne(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.#P(),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.#D(i)}getOptimisticResult(e){const t=this.#d.getQueryCache().build(this.#d,e),r=this.createResult(t,e);return Ne(this.getCurrentResult(),r)||(this.#_=r,this.#b=this.options,this.#v=this.#g.state),r}getCurrentResult(){return this.#_}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.#P({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#_))}#P(e){this.#A();let t=this.#g.fetch(this.options,e);return e?.throwOnError||(t=t.catch(xe)),t}#L(e){return!We()&&!1!==Se(this.options.enabled,this.#g)&&we(e)}#I(){this.#O();const e=Se(this.options.staleTime,this.#g);if(this.#_.isStale||!this.#L(e))return;const t=je(this.#_.dataUpdatedAt,e)+1;this.#k=ve.setTimeout(()=>{this.#_.isStale||this.updateResult()},t)}#F(){return Se(this.options.refetchInterval,this.#g)??!1}#D(e){this.#N(),this.#T=e,0!==this.#T&&this.#L(this.#T)&&(this.#C=ve.setInterval(()=>{(this.options.refetchIntervalInBackground||Ge.isFocused())&&this.#P()},this.#T))}#R(){this.#I(),this.#D(this.#F())}#O(){void 0!==this.#k&&(ve.clearTimeout(this.#k),this.#k=void 0)}#N(){void 0!==this.#C&&(ve.clearInterval(this.#C),this.#C=void 0)}createResult(e,t){const r=this.#g,n=this.options,i=this.#_,o=this.#v,s=this.#b,a=e!==r?e.state:this.#y,{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=De(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=De(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,y="pending"===f,_="error"===f,v=y&&g,b=void 0!==c;return{status:f,fetchStatus:u.fetchStatus,isPending:y,isSuccess:"success"===f,isError:_,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&&!y,isLoadingError:_&&!b,isPaused:"paused"===u.fetchStatus,isPlaceholderData:d,isRefetchError:_&&b,isStale:ut(e,t),refetch:this.refetch,isEnabled:!1!==Se(t.enabled,e)}}updateResult(){const e=this.#_,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),Ne(t,e))return;this.#_=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.#_).some(t=>{const r=t;return this.#_[r]!==e[r]&&n.has(r)})})();qe.batch(()=>{r&&this.listeners.forEach(e=>{e(this.#_)}),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.#y=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#R()}};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=Se(r,e);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(ye),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 He{#d;#_=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),Ne(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.#_}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.#_={...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.#_.variables,r=this.#_.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.#_)})})}};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 yt=[];function _t(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=[...yt,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 _t("json-zero","Failed to get data",t);return r}catch(e){throw _t(e,e?.message,t)}})(t,e)).then(t=>((e,t)=>{if(e?.error||e?.error_code)throw _t(e,e.message,t);if(t.apiFetch){const{status:r,statusText:n}=t.apiFetch;if(e?.code&&e?.message)throw _t(e,e,t);if(void 0!==r&&(r<200||r>=300))throw _t(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(_t("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 _t("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){yt.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=()=>{yt=[]},wt.replaceRootURLMiddleware=e=>{for(let t=0;t<yt.length;t++)yt[t]===wt.rootURLMiddleware&&(yt[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"),Pt=e=>Ct("redirection/v1/setting",e),Rt=e=>kt("redirection/v1/redirect",e),Ot=(e,t)=>Ct("redirection/v1/redirect/"+e,t),Nt=(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"),Dt=(e,t)=>Ct("redirection/v1/group/"+e,t),Lt=(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),Wt=e=>kt("redirection/v1/export/redirect",e),Ht=e=>kt("redirection/v1/export/redirect/preview",e),Gt=e=>kt("redirection/v1/export/bundle",e),Zt=e=>kt("redirection/v1/export/bundle/preview",e),Kt=(e,t={})=>kt("redirection/v1/export/group/"+e,t),Vt=(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"}function pr(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 hr(e,t="|"){return e.map(e=>Fr(e)).join(t)}function fr(e,t){return"bigint"==typeof t?t.toString():t}class mr{constructor(e){this._getter=e,this._value=void 0}get value(){const e=this._getter;return void 0!==e&&(this._value=e(),this._getter=void 0),this._value}}function gr(e){return new mr(e)}function yr(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function _r(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function vr(e){const t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function br(e){return vr(e._zod.def)??e._zod.def.shape}function xr(e,t,r){Object.defineProperty(e,t,{get(){const e=r();return _r(this,t,e),e},enumerable:!0,configurable:!0})}function wr(e,t,r){t in e?_r(e,t,r):e[t]=r}function jr(e,t,r,n){const i=br(t);for(const o of r){const r=Object.getOwnPropertyDescriptor(i,o);r.enumerable&&(r.get?xr(e,o,()=>{const e=t._zod.def.shape[o];return n?n(e,o):e}):wr(e,o,n?n(r.value,o):r.value))}}function Sr(...e){const t={};for(const r of e){const e=Object.getOwnPropertyDescriptors(r);Object.assign(t,e)}return Object.defineProperties({},t)}function kr(e){return JSON.stringify(e)}const Cr="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Tr(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const Er=gr(()=>{if(hn.jitless)return!1;if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function Pr(e){if(!1===Tr(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!==Tr(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}function Rr(e){return Pr(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const Or=new Set(["string","number","symbol"]);function Nr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ar(e,t,r){const n=new e._zod.constr(t??e._zod.def);return t&&!r?.parent||(n._zod.parent=e),n}function Ir(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}function Fr(e){return"bigint"==typeof e?e.toString()+"n":"string"==typeof e?`"${e}"`:`${e}`}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]}))(),Lr={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function zr(e,t){const r=br(e),n=[];for(const e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,e)?.enumerable)throw new Error(`Unrecognized key: "${String(e)}"`);t[e]&&n.push(e)}return n}function Mr(e,t){const r={};return jr(r,e,Reflect.ownKeys(br(e))),function(e,t){for(const r of Reflect.ownKeys(t)){const n=Object.getOwnPropertyDescriptor(t,r);n.enumerable&&(n.get?xr(e,r,()=>t[r]):wr(e,r,n.value))}}(r,t),r}function $r(e,t,r,n="partial"){const i=t._zod.def.checks;if(i&&i.length>0)throw new Error(`.${n}() cannot be used on object schemas containing refinements`);const o=r?new Set(zr(t,r)):void 0,s={};return jr(s,t,Reflect.ownKeys(br(t)),e&&((t,r)=>o&&!o.has(r)?t:new e({type:"optional",innerType:t}))),Ar(t,Sr(t._zod.def,{shape:s,checks:[]}))}function Ur(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 Br(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 qr(e,t){return t.map(t=>{var r;return(r=t).path??(r.path=[]),t.path.unshift(e),t})}function Wr(e){return"string"==typeof e?e:e?.message}function Hr(e,t,r){var n;for(let i=t;i<e.length;i++)(n=e[i]).schema??(n.schema=r)}function Gr(e,t,r){var n;const i=e.inst?._zod?.traits;i?.has("$ZodType")&&(i.has("$ZodCheck")?(n=e).schema??(n.schema=e.inst):e.schema=e.inst);const o=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,s=e.message?e.message:Wr(e.inst?._zod.def?.error?.(e))??Wr(o?.(e))??Wr(t?.error?.(e))??Wr(r.customError?.(e))??Wr(r.localeError?.(e))??"Invalid input",a={};for(const t of Object.keys(e))"inst"!==t&&"schema"!==t&&"continue"!==t&&"input"!==t&&"__proto__"!==t&&(a[t]=e[t]);return a.path??(a.path=[]),a.message=s,t?.reportInput&&(a.input=e.input),a}const Zr=/[\uD800-\uDBFF]/;function Kr(e){const t=e.length;if(!Zr.test(e))return t;let r=t;for(let n=0;n<t-1;n++)55296==(64512&e.charCodeAt(n))&&56320==(64512&e.charCodeAt(n+1))&&(r--,n++);return r}function Vr(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function Qr(...e){const[t,r,n]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:n}:{...t}}function Jr(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function Yr(e,t,r){return Jr(e,t,r,!1)}function Xr(e,t){for(const r in e){const n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return Jr(this,r,n(this))},set(e){Jr(this,r,e)}})}return t}function en(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return null==this?r:Jr(this,t,r.bind(this))},set(e){Jr(this,t,e)}})}let tn,rn=!1;const nn={configurable:!0,get(){rn=!0}};function on(e,t,r){const n=Object.getPrototypeOf(e._zod);t in n&&tn!==e._zod?tn=void 0:(tn=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,nn);const e=rn;rn=!1;try{const n=r(this);return rn?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:n}),rn=rn||e,n}catch(r){throw delete this[t],rn=rn||e,r}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}}))}function sn(e){const t=()=>e;return t["~constantCatch"]=!0,t}var an;const ln={value:void 0,enumerable:!1};let cn="captureStackTrace"in Error?Error:null;function un(e,t,r,n){function i(e){this.def=e,this.constr=u,this.traits=new Set}i.prototype={};const o=r,s=o&&new WeakSet;function a(r,n){if(r._zod){if(r._zod.traits.has(e))return}else{ln.value=new i(n);try{Object.defineProperty(r,"_zod",ln)}finally{ln.value=void 0}}if(r._zod.traits.add(e),t(r,n),s){const e=Object.getPrototypeOf(r),t=r._zod.constr.prototype;let n=e;for(;n&&n!==t;)n=Object.getPrototypeOf(n);const i=n??e;s.has(i)||(s.add(i),function(e,t){for(const r in t){const n=Object.getOwnPropertyDescriptor(t,r);n.get?Object.defineProperty(e,r,{...n,enumerable:!1}):en(e,r,n.value)}}(i,o))}const a=u.prototype;for(const e in a)Object.prototype.hasOwnProperty.call(a,e)&&(e in r||(r[e]=a[e].bind(r)))}const l=n?.Parent??Object;class c extends l{}function u(e){const t=n?.Parent?function(e){const t=cn;if(t){const r=t.stackTraceLimit;if("number"==typeof r){try{t.stackTraceLimit=0}catch{return cn=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}(c):this;a(t,e);const r=t._zod.deferred;if(r){for(const e of r)e();t._zod.deferred=void 0}const i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(c,"name",{value:e}),Object.defineProperty(u,"init",{value:a}),Object.defineProperty(u,Symbol.hasInstance,{value:t=>!!(n?.Parent&&t instanceof n.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(u,"name",{value:e}),u}class dn extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class pn extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}(an=globalThis).__zod_globalConfig??(an.__zod_globalConfig={});const hn=globalThis.__zod_globalConfig;function fn(e){return e&&Object.assign(hn,e),hn}const mn={get:function(){const e=this._zod;return e.message??(e.message=JSON.stringify(e.def,fr,2)),e.message},set:function(e){this._zod.message=e},enumerable:!0,configurable:!0},gn={value:void 0,enumerable:!1},yn=new WeakSet([Object.prototype,Error.prototype]),vn=(e,t)=>{e.name="$ZodError",gn.value=t,Object.defineProperty(e,"issues",gn),gn.value=void 0,Object.defineProperty(e,"message",mn);const r=Object.getPrototypeOf(e);yn.has(r)||(yn.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){const e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},bn=un("$ZodError",vn);function xn(e,t,r){return Object.prototype.hasOwnProperty.call(e,t)||("__proto__"===t?Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0}):e[t]=r()),e[t]}un("$ZodError",vn,void 0,{Parent:Error});const wn=new WeakSet([Object.prototype,Error.prototype]);function jn(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){const e=r(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}const Sn=(e,t)=>{bn.init(e,t),e.name="ZodError";const r=Object.getPrototypeOf(e);wn.has(r)||(wn.add(r),jn(r,"format",e=>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],s=i===e.length-1;if("_errors"===r){s&&n._errors.push(t(o)),i++;continue}Object.prototype.hasOwnProperty.call(n,r)||Object.defineProperty(n,r,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});const a=n[r];s&&a._errors.push(t(o)),n=a,i++}}}};return n(e),r}(e,t)),jn(r,"flatten",e=>t=>function(e,t=e=>e.message){const r={},n=[];for(const i of e.issues)i.path.length>0?xn(r,i.path[0],()=>[]).push(t(i)):n.push(t(i));return{formErrors:n,fieldErrors:r}}(e,t)),jn(r,"addIssue",e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,fr,2)}),jn(r,"addIssues",e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,fr,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return 0===this.issues.length}}))},kn=un("ZodError",Sn),Cn=un("ZodError",Sn,void 0,{Parent:Error});class Tn 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 En(e){if(e instanceof kn)return console.error("API Validation Error:",e.format()),new Tn(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 Pn={redirects:{all:["redirects"],lists:()=>[...Pn.redirects.all,"list"],list:e=>[...Pn.redirects.lists(),e],detail:e=>[...Pn.redirects.all,"detail",e]},groups:{all:["groups"],lists:()=>[...Pn.groups.all,"list"],list:e=>[...Pn.groups.lists(),e],detail:e=>[...Pn.groups.all,"detail",e],dropdown:()=>[...Pn.groups.all,"dropdown"]},logs:{all:["logs"],lists:()=>[...Pn.logs.all,"list"],list:e=>[...Pn.logs.lists(),e]},errors:{all:["errors"],lists:()=>[...Pn.errors.all,"list"],list:e=>[...Pn.errors.lists(),e]},settings:{all:["settings"],get:()=>[...Pn.settings.all,"get"],status:()=>[...Pn.settings.all,"status"]},pluginInfo:{all:["pluginInfo"],get:()=>[...Pn.pluginInfo.all,"get"]},io:{all:["io"],importers:()=>[...Pn.io.all,"importers"]},info:{all:["info"],ip:e=>[...Pn.info.all,"ip",e],agent:e=>[...Pn.info.all,"agent",e],http:e=>[...Pn.info.all,"http",e]}},Rn={errors:[],notices:[],inProgress:0},On=te()(le(e=>({...Rn,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(Rn)}),{name:"MessageStore"}));function Nn(e){return!(!e||0===e.length)&&(e.length>1||"group"===e[0]||"setting"===e[0])}function An(e,t,r){return"group"===e?r:"module"===e?t:"all"}function In(e){return dt({queryKey:Pn.io.importers(),queryFn:async()=>{const e=await jt(Ut());return e?.importers||[]},...e})}function Fn(e){const t=p(),{addNotice:r,incrementProgress:n,decrementProgress:i}=On();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 En(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:Pn.redirects.lists()}),t.invalidateQueries({queryKey:Pn.groups.all}),t.invalidateQueries({queryKey:Pn.logs.all}),t.invalidateQueries({queryKey:Pn.errors.all}),t.invalidateQueries({queryKey:Pn.settings.all}))},onError:(e,t)=>{"file"===t.sourceType&&i()},...e})}function Dn(e){const{addNotice:t,incrementProgress:r,decrementProgress:n}=On();return ft({mutationFn:async e=>{r();try{const t=await jt(function(e){if(Nn(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:An(t,r,n),format:e.format})}if("redirect"===e.exportType){if(e.params)return Wt({...e.params,format:e.format});const t=e.redirectScopeType||"all",r=e.redirectModule||"all",n=e.redirectGroup||0;return Wt({scope_type:t,scope_value:An(t,r,n),format:e.format})}return"group"===e.exportType?Kt(e.format,e.params||{}):"log"===e.exportType?Vt(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 En(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=[]}=In(),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 zn=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},Mn=(e,t)=>{const r=e.data?.status;return"number"==typeof r&&r>0?`${t} ${r}`:`${t} ${"rest_api_cors_mismatch"===e.code?"blocked":"failed"}`},$n=({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:Mn(e,t)},r)),r&&(0,u.jsxs)("strong",{children:[r,": "]}),e.message]}),(0,u.jsx)($,{error:e,links:Q(),locale:"redirection"}),(0,u.jsx)(zn,{error:e})]})]},t.join(""))},Un=({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("")),Bn=e=>e.code?e.code:0,qn=({result:e})=>{const t=[],{GET:r,POST:n}=e;return r.status===n.status&&Bn(r)===Bn(n)?("fail"===r.status&&r.error?t.push((0,u.jsx)($n,{error:r.error,methods:["GET","POST"]},"get-post")):t.push((0,u.jsx)(Un,{methods:["GET","POST"]},"get-post")),t):("fail"===r.status&&r.error?t.push((0,u.jsx)($n,{error:r.error,methods:["GET"]},"get")):t.push((0,u.jsx)(Un,{methods:["GET"]},"get")),"fail"===n.status&&n.error?t.push((0,u.jsx)($n,{error:n.error,methods:["POST"]},"post")):t.push((0,u.jsx)(Un,{methods:["POST"]},"post")),t)},Wn=({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)(qn,{result:t})]}),Hn=({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"})})},Gn=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})]})},Zn=e=>(0,u.jsx)("table",{className:"form-table",children:(0,u.jsx)("tbody",{children:e.children})}),Kn=({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)(Kn,{label:e.label,value:e.value,disabled:e.disabled||!1},t))}):(0,u.jsx)("option",{value:e,disabled:r,children:t}),Vn=Kn,Qn=({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)(Vn,{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")}],Yn=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)(Gn,{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)(Gn,{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)(Gn,{title:(0,a.__)("REST API","redirection"),url:n("options","restapi"),children:[(0,u.jsx)(Qn,{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)(Gn,{title:(0,a.__)("Data Upgrade","redirection"),children:[(0,u.jsx)(Qn,{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")})]})]})};class Xn extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}}const ei="~memo",ti=[];function ri(e){return null!==e&&"object"==typeof e}function ni(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}const ii=new WeakMap;function oi(e,t,r){const n=ii.get(e);if(void 0!==n)return n?2:0;if(t.has(e))return 2;t.add(e);let i=0;const o=e=>{if(2!==i&&e?._zod){const n=oi(e,t,r);n>i&&(i=n)}},s=e=>{e>i&&(i=e)},a=e._zod.def;switch(a.type){case"object":{const e=vr(a);s(e?(e=>{let n=0;for(const i of Reflect.ownKeys(e)){const o=Object.getOwnPropertyDescriptor(e,i);if(!o.enumerable)continue;const s=o.get?1:o.value?._zod?oi(o.value,t,r):0;s>n&&(n=s)}return n})(e):1),o(a.catchall);break}case"array":o(a.element);break;case"tuple":for(const e of a.items)o(e);o(a.rest);break;case"record":case"map":o(a.keyType),o(a.valueType);break;case"set":o(a.valueType);break;case"union":for(const e of a.options)o(e);break;case"intersection":o(a.left),o(a.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":o(a.innerType);break;case"pipe":o(a.in),o(a.out);break;case"function":o(a.input),o(a.output);break;case"lazy":{const n=a._cachedInner??(r?e._zod.innerType:void 0);s(n?oi(n,t,!1):1);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(const e in a){const t=Object.getOwnPropertyDescriptor(a,e);if(!t||t.get)continue;const r=t.value;if(r&&"object"==typeof r)if(r._zod)o(r);else if(Array.isArray(r))for(const e of r)o(e)}}return t.delete(e),function(e,t){return 1!==t&&ii.set(e,2===t),t}(e,i)}let si;const ai=[],li={alloc(e,t,r){const n=si;if(!n)return r;si=void 0;const i={value:r,issues:null};return n.set(t.value,i),ai.push(i),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{const t=e._zod.parse,r=(e,r)=>{if("backward"!==r.direction&&function(e,t){const r=e[ei]?.backEdges;return void 0!==r&&ri(t)&&r.has(t)}(r,e.value))throw new Xn;return t(e,r)};e._zod.parse=r,e._zod.run===t&&(e._zod.run=r)})},attach(e){var t;let r,n,i,o=!1;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{const t=e._zod.parse,s=(a,l)=>{if(void 0===r){const n=oi(e,new Set,!1);if(0===n)return e._zod.parse=t,e._zod.run===s&&(e._zod.run=t),t(a,l);2===n||o?r=!0:o=!0}const c=a.value;if(!ri(c))return t(a,l);let u,d=l[ei];d||(d={buckets:new WeakMap,backEdges:void 0},l[ei]=d),n===l?u=i:(u=function(e,t){let r=e.buckets.get(t);return r||(r=new WeakMap,e.buckets.set(t,r)),r}(d,e),n=l,i=u);const p=u.get(c);if(p)return a.value=p.value,p.issues?p.issues.length&&a.issues.push(...ni(p.issues)):(a.memo=!0,d.backEdges??(d.backEdges=new WeakSet),d.backEdges.add(p.value)),a;si=u;const h=ai.length,f=t(a,l);si=void 0;const m=ai.length>h?ai.pop():void 0;return f instanceof Promise?f.then(e=>(m&&(m.issues=e.issues.length?ni(e.issues):ti),e)):(m&&(m.issues=f.issues.length?ni(f.issues):ti),f)};e._zod.parse=s,e._zod.run===t&&(e._zod.run=s)})}},ci=/^[cC][0-9a-z]{6,}$/,ui=/^[0-9a-z]+$/,di=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,pi=/^[0-9a-vA-V]{20}$/,hi=/^[A-Za-z0-9]{27}$/,fi=/^[a-zA-Z0-9_-]{21}$/,mi=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,gi=/^([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})$/,yi=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)$/,_i=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,vi=/^(?:(?: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])$/,bi=/^(([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}|:))$/,xi=/^((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])$/,wi=/^(([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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ji=/^https?$/,Si=/^\+[1-9]\d{6,14}$/,ki="(?:(?:\\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])))";function Ci(e){return new RegExp(`^${e}$`)}const Ti=Ci(ki);function Ei(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}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}const Pi=/^[\s\S]{0,}$/,Ri=/^-?\d+$/,Oi=/^-?\d+(?:\.\d+)?$/,Ni=/^(?:true|false)$/i,Ai=/^[^A-Z]*$/,Ii=/^[^a-z]*$/,Fi=un("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Di=e=>{const t=e.value;return!(null==t||void 0===t.length)},Li={number:"number",bigint:"bigint",object:"date"},zi=un("$ZodCheckLessThan",(e,t)=>{Fi.init(e,t);const r=Li[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:Li[typeof n.value]??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})}}),Mi=un("$ZodCheckGreaterThan",(e,t)=>{Fi.init(e,t);const r=Li[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:Li[typeof n.value]??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})}}),$i=un("$ZodCheckMultipleOf",(e,t)=>{Fi.init(e,t),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?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):0===function(e,t){const r=e/t,n=Math.round(r),i=4*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})}}),Ui=un("$ZodCheckNumberFormat",(e,t)=>{Fi.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.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})}}),Bi=un("$ZodCheckMaxLength",(e,t)=>{var r;Fi.init(e,t),(r=e._zod.def).when??(r.when=Di),e._zod.check=r=>{const n=r.value,i=n.length;if(("string"==typeof n&&i>t.maximum?Kr(n):i)<=t.maximum)return;const o=Vr(n);r.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),qi=un("$ZodCheckMinLength",(e,t)=>{var r;Fi.init(e,t),(r=e._zod.def).when??(r.when=Di),e._zod.check=r=>{const n=r.value,i=n.length;if(("string"==typeof n&&i>=t.minimum&&i<2*t.minimum?Kr(n):i)>=t.minimum)return;const o=Vr(n);r.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Wi=un("$ZodCheckLengthEquals",(e,t)=>{var r;Fi.init(e,t),(r=e._zod.def).when??(r.when=Di),e._zod.check=r=>{const n=r.value,i=n.length,o="string"==typeof n&&i>=t.length&&i<=2*t.length?Kr(n):i;if(o===t.length)return;const s=Vr(n),a=o>t.length;r.issues.push({origin:s,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Hi=un("$ZodCheckStringFormat",(e,t)=>{var r,n;Fi.init(e,t),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=()=>{})}),Gi=un("$ZodCheckRegex",(e,t)=>{Hi.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})}}),Zi=un("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Ai),Hi.init(e,t)}),Ki=un("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Ii),Hi.init(e,t)}),Vi=un("$ZodCheckIncludes",(e,t)=>{Fi.init(e,t);const r=Nr(t.includes),n=new RegExp("number"==typeof t.position?`^.{${t.position},}${r}`:r);t.pattern=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})}}),Qi=un("$ZodCheckStartsWith",(e,t)=>{Fi.init(e,t);const r=new RegExp(`^${Nr(t.prefix)}.*`);t.pattern??(t.pattern=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})}}),Ji=un("$ZodCheckEndsWith",(e,t)=>{Fi.init(e,t);const r=new RegExp(`.*${Nr(t.suffix)}$`);t.pattern??(t.pattern=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})}}),Yi=un("$ZodCheckOverwrite",(e,t)=>{Fi.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class Xi{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{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?.content??[""];return new e(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {\n${t.join("\n")}\n};`)(...Object.values(this.closed))}}const eo={major:4,minor:6,patch:5},to=un("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=eo;const n=e._zod.def.checks,i=e._zod.traits.has("$ZodCheck")?[e,...n??[]]:n?.length?[...n]:[];for(const t of i)for(const r of t._zod.onattach)r(e);if(0===i.length)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const t=(t,r,n)=>{if(t.memo)return t;let i,o=Ur(t);for(const s of r){if(s._zod.def.when){if(Br(t))continue;if(!s._zod.def.when(t))continue}else if(o)continue;const r=t.issues.length,a=s._zod.check(t);if(a instanceof Promise&&!1===n?.async)throw new dn;if(i||a instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await a,t.issues.length!==r&&(Hr(t.issues,r,e),o||(o=Ur(t,r)))});else{if(t.issues.length===r)continue;Hr(t.issues,r,e),o||(o=Ur(t,r))}}return i?i.then(()=>t):t},r=(r,n,o)=>{if(Ur(r))return r.aborted=!0,r;const s=t(n,i,o);if(s instanceof Promise){if(!1===o.async)throw new dn;return s.then(t=>e._zod.parse(t,o))}return e._zod.parse(s,o)};e._zod.run=(n,o)=>{if(o.skipChecks)return e._zod.parse(n,o);if("backward"===o.direction){const t=e._zod.parse({value:n.value,issues:[]},{...o,skipChecks:!0});return t instanceof Promise?t.then(e=>r(e,n,o)):r(t,n,o)}const s=e._zod.parse(n,o);if(s instanceof Promise){if(!1===o.async)throw new dn;return s.then(e=>t(e,i,o))}return t(s,i,o)}}},{get"~standard"(){return Yr(this,"~standard",no(this))},set"~standard"(e){Jr(this,"~standard",e)}}),ro=(e,t)=>e.issues.length?{issues:e.issues.map(e=>Gr(e,t,fn()))}:{value:e.value};function no(e){return{validate:t=>{const r={async:!1};try{const n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return ro(n,r)}catch(e){}return async function(e,t){const r={async:!0};return ro(await e._zod.run({value:t,issues:[]},r),r)}(e,t)},vendor:"zod",version:1}}const io=un("$ZodString",(e,t)=>{to.init(e,t),e._zod.pattern=t.pattern??Pi,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}}),oo=un("$ZodStringFormat",(e,t)=>{Hi.init(e,t),io.init(e,t)}),so=un("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=gi),oo.init(e,t)}),ao=un("$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=yi(e))}else t.pattern??(t.pattern=yi());oo.init(e,t)}),lo=un("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=_i),oo.init(e,t)});function co(e){try{return"undefined"!=typeof URL&&"function"==typeof URL.canParse?URL.canParse(e):(new URL(e),!0)}catch{return!1}}const uo=/[\t\n\r]/g;function po(e){return e.replace(uo,"")}const ho=un("$ZodURL",(e,t)=>{oo.init(e,t),e._zod.check=r=>{try{const n=r.value.trim(),i=function(e,t){return"normalize"in t||"hostname"in t||"protocol"in t?function(e,t){if(!t.normalize&&t.protocol?.source===ji.source&&!/^https?:\/\//i.test(e))return 1;try{if("undefined"!=typeof URL){const t=URL;if("function"==typeof t.parse)return t.parse(e)??2}return new URL(e)}catch{return 2}}(e,t):co(e)||2}(n,t);return 1===i?void r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort}):2===i?void r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort}):!0===i?void(r.value=po(n)):(t.hostname&&!function(e,t){return t.lastIndex=0,t.test(e.hostname)}(i,t.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&&!function(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}(i,t.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(r.value=t.normalize?i.href:po(n)))}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),fo=un("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$","u")),oo.init(e,t)}),mo=un("$ZodNanoID",(e,t)=>{if(void 0!==t.length&&(!Number.isInteger(t.length)||t.length<1))throw new Error(`Invalid nanoid length: ${t.length}`);var r;t.pattern??(t.pattern=void 0===t.length?fi:(r=t.length,new RegExp(`^[a-zA-Z0-9_-]{${r}}$`))),oo.init(e,t)}),go=un("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=ci),oo.init(e,t)}),yo=un("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=ui),oo.init(e,t)}),_o=un("$ZodULID",(e,t)=>{t.pattern??(t.pattern=di),oo.init(e,t)}),vo=un("$ZodXID",(e,t)=>{t.pattern??(t.pattern=pi),oo.init(e,t)}),bo=un("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=hi),oo.init(e,t)}),xo=un("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${Ei({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${Ei({precision:e.precision})}`:r;return new RegExp(`^${ki}T(?:${n})$`)}(t)),oo.init(e,t)}),wo=un("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Ti),oo.init(e,t)}),jo=un("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${Ei(t)}$`)),oo.init(e,t)}),So=un("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=mi),oo.init(e,t)}),ko=un("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=vi),oo.init(e,t)}),Co=/^[0-9a-fA-F:.]+$/;function To(e){return!!Co.test(e)&&co(`http://[${e}]`)}const Eo=un("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=bi),oo.init(e,t),e._zod.check=r=>{To(r.value)||r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}),Po=un("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=xi),oo.init(e,t)}),Ro=un("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=wi),oo.init(e,t),e._zod.check=r=>{(function(e){const t=e.split("/");if(2!==t.length)return!1;const[r,n]=t;if(!n)return!1;const i=Number(n);return`${i}`===n&&!(i<0||i>128)&&To(r)})(r.value)||r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function Oo(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 No=/^[0-9a-zA-Z+/]*={0,2}$/,Ao=un("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=No),oo.init(e,t),e._zod.check=r=>{Oo(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),Io=/^[A-Za-z0-9_-]*$/,Fo=un("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Io),oo.init(e,t),e._zod.check=r=>{(function(e){if(!Io.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return Oo(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})}}),Do=un("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Si),oo.init(e,t)}),Lo=un("$ZodJWT",(e,t)=>{oo.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})}}),zo=un("$ZodNumber",(e,t)=>{to.init(e,t),e._zod.pattern=Oi,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:String(i):void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...o?{received:o}:{}}),r}}),Mo=un("$ZodNumberFormat",(e,t)=>{Ui.init(e,t),zo.init(e,t)}),$o=un("$ZodBoolean",(e,t)=>{to.init(e,t),e._zod.pattern=Ni,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}}),Uo=un("$ZodUnknown",(e,t)=>{to.init(e,t),e._zod.parse=e=>e}),Bo=un("$ZodNever",(e,t)=>{to.init(e,t),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function qo(e,t,r){e.issues.length&&t.issues.push(...qr(r,e.issues)),t.value[r]=e.value}const Wo=un("$ZodArray",(e,t)=>{to.init(e,t);const r=hn.memoizer;r?.attach(e),e._zod.parse=(n,i)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=r?r.alloc(e,n,Array(o.length),i):Array(o.length);const s=[],a=i?.abortEarly;for(let e=0;e<o.length;e++){const r=o[e],l=t.element._zod.run({value:r,issues:[]},i);if(l instanceof Promise)s.push(l.then(t=>qo(t,n,e)));else if(qo(l,n,e),a&&0!==l.issues.length&&Ur(l))break}return s.length?Promise.all(s).then(()=>n):n}});function Ho(e,t,r,n,i,o){const s=r in n,a="optional"===o;if(s||!a||"optional"!==i){if(e.issues.length){if(void 0!==i&&a&&!s)return;t.issues.push(...qr(r,e.issues))}s||void 0!==i?void 0===e.value?(s||"defaulted"===i&&!a)&&(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]})}}const Go=[];function Zo(e){const t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:Go,i=n.length?[...t,...n]:t;for(const t of i)if(!e.shape?.[t]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(t)}": expected a Zod schema`);const o=(s=e.shape,Object.keys(s).filter(e=>void 0!==s[e]._zod.optin&&"optional"===s[e]._zod.optout));var s;return{...e,allKeys:i,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(o)}}function Ko(e,t,r,n,i,o,s){const a=[],l=i.keySet,c=i.catchall._zod,u=c.def.type,d=c.optin,p=c.optout;let h=0;for(const i in t){if(s&&r.issues.length!==h){if(Ur(r,h))break;h=r.issues.length}if(l.has(i))continue;if("__proto__"===i){"never"===u&&a.push(i);continue}if("never"===u){a.push(i);continue}const o=c.run({value:t[i],issues:[]},n);o instanceof Promise?e.push(o.then(e=>Ho(e,r,i,t,d,p))):Ho(o,r,i,t,d,p)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:o,continue:!0}),e.length?Promise.all(e).then(()=>r):r}const Vo=un("$ZodObject",(e,t)=>{to.init(e,t);const r=Object.getOwnPropertyDescriptor(t,"shape"),n=r?.get?r.get.raw:t.shape??{};if(n){const e=()=>{const r={...n};return Object.defineProperty(t,"shape",{value:r}),e.raw=r,r};e.raw=n,Object.defineProperty(t,"shape",{get:e})}const i=gr(()=>Zo(t));on(e,"propValues",e=>{const t=e.def.shape,r={};for(const e in t){const n=t[e]._zod;if(n.values){Object.prototype.hasOwnProperty.call(r,e)||_r(r,e,new Set);for(const t of n.values)r[e].add(t);void 0!==n.optin&&r[e].add(void 0)}}return r});const o=Tr,s=t.catchall;let a;const l=hn.memoizer;l?.attach(e),e._zod.parse=(t,r)=>{a??(a=i.value);const n=t.value;if(!o(n))return t.issues.push({expected:"object",code:"invalid_type",input:n,inst:e}),t;t.value=l?l.alloc(e,t,{},r):{};const c=[],u=a.shape,d=r?.abortEarly;let p=t.issues.length;for(const e of a.allKeys){if(d&&t.issues.length!==p){if(Ur(t,p))break;p=t.issues.length}if("__proto__"===e)continue;const i=u[e],o=i._zod.optin,s=i._zod.optout,a=i._zod.run({value:n[e],issues:[]},r);a instanceof Promise?c.push(a.then(r=>Ho(r,t,e,n,o,s))):Ho(a,t,e,n,o,s)}return s?Ko(c,n,t,r,i.value,e,!0===d):c.length?Promise.all(c).then(()=>t):t}}),Qo=un("$ZodObjectJIT",(e,t)=>{Vo.init(e,t);const r=e._zod.parse,n=gr(()=>Zo(t)),i=hn.memoizer;let o;const s=Tr,a=!hn.jitless,l=a&&Er.value,c=t.catchall;let u;e._zod.parse=(d,p)=>{u??(u=n.value);const h=d.value;return s(h)?a&&l&&!1===p?.async&&!0!==p.jitless?(o||(o=(t=>{const r=n.value,o=r.symbolKeys,s=new Xi(["payload","ctx"],{shape:t,inst:e,memo:i,syms:o}),a=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,l=(e,t)=>`\n let ${e}_ab = false;\n for (let i = 0; i < ${e}.issues.length; i++) {\n const iss = ${e}.issues[i];\n iss.path = iss.path ? [${t}, ...iss.path] : [${t}];\n payload.issues.push(iss);\n if (iss.continue !== true) ${e}_ab = true;\n }\n if (${e}_ab && ctx && ctx.abortEarly) {\n payload.value = newResult;\n return payload;\n }`;s.write("const input = payload.value;");const c=Object.create(null);let u=0;for(const e of r.allKeys)c[e]="key_"+u++;s.write(i?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(const e of r.allKeys){if("__proto__"===e)continue;const r=c[e],n="symbol"==typeof e?`syms[${o.indexOf(e)}]`:kr(e),i=`${n} in input`,u=t[e],d=u?._zod?.optin,p=void 0!==d,h="optional"===u?._zod?.optout;if(s.write(`const ${r} = ${a(n)};`),p&&h){const e="optional"===d?`${r}_present`:`${r}.value !== undefined || ${r}_present`;s.write(`\n const ${r}_present = ${i};\n if (!${r}.issues.length || ${r}_present) {\n if (${r}.issues.length) {${l(r,n)}\n }\n\n if (${e}) {\n newResult[${n}] = ${r}.value;\n }\n }\n\n `)}else p?(s.write(`\n if (${r}.issues.length) {${l(r,n)}\n }\n `),"defaulted"===d?s.write(`newResult[${n}] = ${r}.value;`):s.write(`\n if (${r}.value !== undefined || ${i}) {\n newResult[${n}] = ${r}.value;\n }\n `)):s.write(`\n const ${r}_present = ${i};\n if (${r}.issues.length) {${l(r,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: [${n}]\n });\n if (ctx && ctx.abortEarly) {\n payload.value = newResult;\n return payload;\n }\n }\n\n if (${r}_present) {\n newResult[${n}] = ${r}.value;\n }\n\n `)}return s.write("payload.value = newResult;"),s.write("return payload;"),s.compile()})(t.shape)),d=o(d,p),c?Ko([],h,d,p,u,e,!0===p?.abortEarly):d):r(d,p):(d.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),d)}});function Jo(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=>!Ur(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=>Gr(e,n,fn())))}),t)}const Yo=un("$ZodUnion",(e,t)=>{to.init(e,t),on(e,"optin",e=>e.def.options.some(e=>"defaulted"===e._zod.optin)?"defaulted":e.def.options.some(e=>void 0!==e._zod.optin)?"optional":void 0),on(e,"optout",e=>e.def.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),on(e,"values",e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),on(e,"pattern",e=>{if(e.def.options.every(e=>e._zod.pattern)){const t=e.def.options.map(e=>e._zod.pattern);return new RegExp(`^(${t.map(e=>yr(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=>Jo(t,n,e,i)):Jo(s,n,e,i)}}),Xo=un("$ZodIntersection",(e,t)=>{to.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])=>ts(e,t,r)):ts(e,i,o)}});function es(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(Pr(e)&&Pr(t)){const r=Object.keys(t),n=Object.keys(e).filter(e=>-1!==r.indexOf(e)),i={...e,...t};Object.prototype.hasOwnProperty.call(i,"__proto__")&&delete i.__proto__;for(const r of n){if("__proto__"===r)continue;const n=es(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=es(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 ts(e,t,r){const n=new Map;let i;const o=new Map,s=(e,t)=>{let r;if("unrecognized_keys"!==e.code||e.path?.length){if("invalid_key"!==e.code||"record"!==e.origin||1!==e.path?.length)return!1;{const t=String(e.path[0]);o.has(t)||o.set(t,e),r=[t]}}else i??(i=e),r=e.keys;for(const e of r)n.has(e)||n.set(e,{}),n.get(e)[t]=!0;return!0};for(const r of t.issues)s(r,"l")||e.issues.push(r);for(const t of r.issues)s(t,"r")||e.issues.push(t);const a=[...n].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length){const t=i?a.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(const r of a)!t.includes(r)&&o.has(r)&&e.issues.push(o.get(r))}const l=es(t.value,r.value);if(!l.valid){if(Ur(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(l.mergeErrorPath)}`)}return e.value=l.data,e}const rs=un("$ZodRecord",(e,t)=>{to.init(e,t);const r=hn.memoizer;r?.attach(e),e._zod.parse=(n,i)=>{const o=n.value;if(!Pr(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const s=[],a=t.keyType._zod.values;if(a&&!t.partial){n.value=r?r.alloc(e,n,{},i):{};const l=new Set;for(const r of a)if("string"==typeof r||"number"==typeof r||"symbol"==typeof r){if(l.add("number"==typeof r?r.toString():r),"__proto__"===r)continue;const a=t.keyType._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(a.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:a.issues.map(e=>Gr(e,i,fn())),input:r,path:[r],inst:e});continue}const c=a.value;if("__proto__"===c)continue;const u=t.valueType._zod.run({value:o[r],issues:[]},i);u instanceof Promise?s.push(u.then(e=>{e.issues.length&&n.issues.push(...qr(r,e.issues)),n.value[c]=e.value})):(u.issues.length&&n.issues.push(...qr(r,u.issues)),n.value[c]=u.value)}let c;for(const e in o)if(!l.has(e))if("loose"===t.mode){if("__proto__"===e)continue;n.value[e]=o[e]}else c=c??[],c.push(e);c&&c.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:c,continue:!0})}else{let l;n.value=r?r.alloc(e,n,{},i):{};for(const r of Reflect.ownKeys(o)){if("__proto__"===r)continue;if(!Object.prototype.propertyIsEnumerable.call(o,r))continue;let c=t.keyType._zod.run({value:r,issues:[]},i);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if("string"==typeof r&&Oi.test(r)&&c.issues.length){const e=t.keyType._zod.run({value:Number(r),issues:[]},i);if(e instanceof Promise)throw new Error("Async schemas not supported in object keys currently");0===e.issues.length&&(c=e)}if(c.issues.length){"loose"===t.mode?n.value[r]=o[r]:a?(l=l??[],l.push(r)):n.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(e=>Gr(e,i,fn())),input:r,path:[r],inst:e});continue}const u=c.value;if("__proto__"===u)continue;const d=t.valueType._zod.run({value:o[r],issues:[]},i);d instanceof Promise?s.push(d.then(e=>{e.issues.length&&n.issues.push(...qr(r,e.issues)),n.value[u]=e.value})):(d.issues.length&&n.issues.push(...qr(r,d.issues)),n.value[u]=d.value)}l&&l.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:l,continue:!0})}return s.length?Promise.all(s).then(()=>n):n}}),ns=un("$ZodEnum",(e,t)=>{to.init(e,t);const r=pr(t.entries),n=new Set(r);e._zod.values=n,on(e,"pattern",e=>{const t=pr(e.def.entries).filter(e=>Or.has(typeof e));return new RegExp(t.length?`^(${t.map(e=>Nr(e.toString())).join("|")})$`:"^[^\\s\\S]$")}),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}}),is=un("$ZodTransform",(e,t)=>{to.init(e,t),e._zod.optin="optional",hn.memoizer?.guard(e),e._zod.parse=(r,n)=>{if("backward"===n.direction)throw new pn(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));if(i instanceof Promise)throw new dn;return r.value=i,r}});function os(e,t){return e.value=t.issues.length?void 0:t.value,e}const ss=un("$ZodOptional",(e,t)=>{to.init(e,t),on(e,"optin",e=>"defaulted"===e.def.innerType._zod.optin?"defaulted":"optional"),e._zod.optout="optional",on(e,"values",e=>{const t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),on(e,"pattern",e=>{const t=e.def.innerType._zod.pattern;return t?new RegExp(`^(${yr(t.source)})?$`):void 0}),e._zod.parse=(e,r)=>{if(void 0===e.value){if("defaulted"!==t.innerType._zod.optin)return e;const n=t.innerType._zod.run({value:e.value,issues:[]},r);return n instanceof Promise?n.then(t=>os(e,t)):os(e,n)}return t.innerType._zod.run(e,r)}}),as=un("$ZodExactOptional",(e,t)=>{ss.init(e,t),on(e,"values",e=>e.def.innerType._zod.values),on(e,"pattern",e=>e.def.innerType._zod.pattern),e._zod.parse=(e,r)=>t.innerType._zod.run(e,r)}),ls=un("$ZodNullable",(e,t)=>{to.init(e,t),on(e,"optin",e=>e.def.innerType._zod.optin),on(e,"optout",e=>e.def.innerType._zod.optout),on(e,"pattern",e=>{const t=e.def.innerType._zod.pattern;return t?new RegExp(`^(${yr(t.source)}|null)$`):void 0}),on(e,"values",e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,r)=>null===e.value?e:t.innerType._zod.run(e,r)}),cs=un("$ZodDefault",(e,t)=>{to.init(e,t),e._zod.optin="defaulted",on(e,"values",e=>e.def.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=>us(e,t)):us(n,t)}});function us(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const ds=un("$ZodPrefault",(e,t)=>{to.init(e,t),e._zod.optin="defaulted",on(e,"values",e=>e.def.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))}),ps=un("$ZodNonOptional",(e,t)=>{to.init(e,t),on(e,"values",e=>{const t=e.def.innerType._zod.values;return t?new Set([...t].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=>hs(t,e)):hs(i,e)}});function hs(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}function fs(e,t,r,n){return t.issues.length?(e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>Gr(e,n,fn()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}const ms=un("$ZodCatch",(e,t)=>{to.init(e,t),on(e,"optin",e=>"defaulted"===e.def.innerType._zod.optin?"defaulted":"optional"),on(e,"optout",e=>e.def.innerType._zod.optout),on(e,"values",e=>e.def.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({value:e.value,issues:[]},r);return n instanceof Promise?n.then(n=>fs(e,n,t,r)):fs(e,n,t,r)}}),gs=un("$ZodPipe",(e,t)=>{to.init(e,t),on(e,"values",e=>e.def.in._zod.values),on(e,"optin",e=>e.def.in._zod.optin),on(e,"optout",e=>e.def.out._zod.optout),on(e,"propValues",e=>e.def.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=>ys(e,t.in,r)):ys(n,t.in,r)}const n=t.in._zod.run(e,r);return n instanceof Promise?n.then(e=>ys(e,t.out,r)):ys(n,t.out,r)}});function ys(e,t,r){return e.issues.some(e=>"unrecognized_keys"!==e.code)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const _s=un("$ZodReadonly",(e,t)=>{to.init(e,t),on(e,"propValues",e=>e.def.innerType._zod.propValues),on(e,"values",e=>e.def.innerType._zod.values),on(e,"optin",e=>e.def.innerType?._zod?.optin),on(e,"optout",e=>e.def.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(vs):vs(n)}});function vs(e){return e.memo||(e.value=Object.freeze(e.value)),e}const bs=un("$ZodCustom",(e,t)=>{Fi.init(e,t),to.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=>xs(t,r,n,e));xs(i,r,n,e)}});function xs(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(Qr(e))}}var ws;(ws=globalThis).__zod_globalRegistry??(ws.__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 js=globalThis.__zod_globalRegistry;function Ss(e){return e.checks&&(e.checks=[...e.checks]),e}function ks(e,t){return new zi({check:"less_than",...Ir(t),value:e,inclusive:!1})}function Cs(e,t){return new zi({check:"less_than",...Ir(t),value:e,inclusive:!0})}function Ts(e,t){return new Mi({check:"greater_than",...Ir(t),value:e,inclusive:!1})}function Es(e,t){return new Mi({check:"greater_than",...Ir(t),value:e,inclusive:!0})}function Ps(e,t){return new $i({check:"multiple_of",...Ir(t),value:e})}function Rs(e,t){return new Bi({check:"max_length",...Ir(t),maximum:e})}function Os(e,t){return new qi({check:"min_length",...Ir(t),minimum:e})}function Ns(e,t){return new Wi({check:"length_equals",...Ir(t),length:e})}function As(e){return new Yi({check:"overwrite",tx:e})}function Is(e,...t){for(const r of t)for(const t of Reflect.ownKeys(r))Object.prototype.propertyIsEnumerable.call(r,t)&&_r(e,t,r[t]);return e}function Fs(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??js,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function Ds(e,t,r,n,i){const o="function"==typeof t.unrepresentable?t.unrepresentable({zodSchema:e,path:n.path,message:i}):t.unrepresentable;if("any"===o)return!1;if(void 0===o||"throw"===o)throw new Error(i);return Object.assign(r,o),!0}function Ls(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),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;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),Ls(o,t,n),t.seen.get(o).isParent=!0)}const l=t.metadataRegistry.get(e);return l&&Is(s.schema,l),"input"===t.io&&Zs(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 zs(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Ms(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;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}/${zs(o)}`}}const i=`#/${n}/`;if(t[1]===r&&!t[1].schema.id)return{ref:"#"};const o=t[1].schema.id??"__schema"+e.counter++;return{defId:o,ref:i+zs(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)}e.external&&(e.sharedDefsExtractedFor=e.external)}function $s(e){const t=e.anyOf;if(!Array.isArray(t)||0===t.length||void 0!==e.type)return;const r=[];for(const e of t){if(!e||"object"!=typeof e)return;$s(e);const t=Object.keys(e);if(1!==t.length||"type"!==t[0])return;const n=e.type;for(const e of Array.isArray(n)?n:[n]){if("string"!=typeof e)return;r.includes(e)||r.push(e)}}delete e.anyOf,e.type=1===r.length?r[0]:r}const Us=new Set(["type","properties","required","additionalProperties"]),Bs=["oneOf","anyOf"];function qs(e){const t=e.additionalProperties;return void 0===t||!1===t||"object"!=typeof t||null===t?null:Object.keys(t).length?t:null}function Ws(e){const t=[];for(const r of e){if("object"!=typeof r||"object"!==r.type)return null;for(const e in r)if(!Us.has(e))return null;t.push(r)}const r={},n=new Set;for(const e of t){for(const n in e.properties){if(Object.prototype.hasOwnProperty.call(r,n))continue;const e=[];for(const r of t){const t=r.properties?.[n]??qs(r);null!=t&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}_r(r,n,1===e.length?e[0]:Ws(e)??{allOf:e})}for(const t of e.required??[])n.add(t)}const i={type:"object",properties:r};if(n.size&&(i.required=[...n]),t.every(e=>!1===e.additionalProperties))i.additionalProperties=!1;else{const e=[];for(const r of t){const t=qs(r);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}1===e.length?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function Hs(e){const t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(const t of Us)if(t in e)return;const r=t.filter(e=>Bs.some(t=>Array.isArray(e[t])));let n=null;if(r.length){const e=r[0],i=Bs.find(t=>Array.isArray(e[t]));if(1!==Object.keys(e).length)return;const o=t.filter(t=>t!==e),s=e[i].map(e=>Ws([...o,e]));if(s.some(e=>!e))return;n={[i]:s}}else n=Ws(t);n&&(delete e.allOf,Is(e,n))}function Gs(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?Is(i,a):(i.allOf=i.allOf??[],i.allOf.push(a)),Is(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??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(const t of[...e.seen.entries()].reverse())n(t[0]);if("openapi-3.0"!==e.target)for(const t of e.seen.entries())$s(t[1].def??t[1].schema);for(const t of e.deferred)t();if(e.intersections.length){const t=new Map;for(const r of e.seen.values())for(const e of[r.schema,r.def]){const r=e?.allOf;if(!Array.isArray(r))continue;const n=t.get(r);n?n.push(e):t.set(r,[e])}for(const r of e.intersections)for(const e of t.get(r)??[])Hs(e)}}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)}Is(i,r.defId?r.schema: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??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(const t of e.seen.entries()){const e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,_r(s,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),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:Ks(t,"input",e.processors),output:Ks(t,"output",e.processors)}},enumerable:!1,writable:!1}),r}catch(e){throw new Error("Error converting schema to JSON.")}}function Zs(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 Zs(n.element,r);if("set"===n.type)return Zs(n.valueType,r);if("lazy"===n.type)return Zs(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||"catch"===n.type)return Zs(n.innerType,r);if("intersection"===n.type)return Zs(n.left,r)||Zs(n.right,r);if("record"===n.type||"map"===n.type)return Zs(n.keyType,r)||Zs(n.valueType,r);if("pipe"===n.type)return!!e._zod.traits.has("$ZodCodec")||Zs(n.in,r)||Zs(n.out,r);if("object"===n.type){for(const e in n.shape)if(Zs(n.shape[e],r))return!0;return!1}if("union"===n.type){for(const e of n.options)if(Zs(e,r))return!0;return!1}if("tuple"===n.type){for(const e of n.items)if(Zs(e,r))return!0;return!(!n.rest||!Zs(n.rest,r))}return!1}const Ks=(e,t,r={})=>n=>{const{libraryOptions:i,target:o}=n??{},s=Fs({...i??{},target:o,io:t,processors:r});return Ls(e,s),Ms(s,e),Gs(s,e)},Vs=(e,t,r)=>{(void 0===e[t]||r>e[t])&&(e[t]=r)},Qs=(e,t,r)=>{(void 0===e[t]||r<e[t])&&(e[t]=r)},Js=(e,t)=>{Vs(e,"minimum",t),Qs(e,"maximum",t)},Ys=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},Xs=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},ea=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},ta=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},ra=(e,t)=>Vs(e,"minimum",t.minimum),na=(e,t)=>Qs(e,"maximum",t.maximum),ia=e=>(t,r)=>{ta(t,r.format);const[n,i]=e[r.format];Vs(t,"minimum",n),Qs(t,"maximum",i)},oa={greater_than:(e,t)=>Vs(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>Qs(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>Ys(e,t.value),number_format:ia(Dr),bigint_format:ia(Lr),min_length:ra,max_length:na,length_equals:(e,t)=>Js(e,t.length),min_size:ra,max_size:na,size_equals:(e,t)=>Js(e,t.size),string_format:(e,t)=>{ta(e,t.format),t.pattern&&Xs(e,t.pattern),"base64"!==t.format&&"base64url"!==t.format||(e.contentEncoding=t.format),(t.local||-1===t.precision)&&(e.laxFormat=!0)},mime_type:(e,t)=>ea(e,t.mime)};function sa(e){const t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(const e of n)oa[e._zod.def.check]?.(t,e._zod.def);const i=e._zod.bag;void 0!==i.minimum&&Vs(t,"minimum",i.minimum),void 0!==i.exclusiveMinimum&&Vs(t,"exclusiveMinimum",i.exclusiveMinimum),void 0!==i.maximum&&Qs(t,"maximum",i.maximum),void 0!==i.exclusiveMaximum&&Qs(t,"exclusiveMaximum",i.exclusiveMaximum),void 0!==i.multipleOf&&Ys(t,i.multipleOf),void 0!==i.format&&(t.format??(t.format=i.format),i.format.includes("int")&&(t.isInt=!0)),i.mime&&ea(t,i.mime);for(const e of i.patterns??[])Xs(t,e);return t}const aa={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},la=new Map([[No,/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/],[Io,/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/]]),ca=e=>la.get(e)??e;function ua(e){const t=e._zod.def;return"pipe"===t.type&&t.in._zod.traits.has("$ZodTransform")?ua(t.out):"catch"===t.type?ua(t.innerType):e._zod.optin}function da(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);const n=e.get(t)?.def;if(!n)return t;const i=da(e,n,r);return i===n?t:i}for(const n of["anyOf","oneOf"]){const i=t[n];if(!Array.isArray(i))continue;const o=i.map(t=>da(e,t,r));o.some((e,t)=>e!==i[t])&&(t={...t,[n]:o})}const n=Array.isArray(t.type)?t.type:[t.type],i=!n.includes("string")&&n.some(e=>"number"===e||"integer"===e),o=t.enum??(void 0!==t.const?[t.const]:void 0);if(!i&&!o?.some(e=>"number"==typeof e))return t;const{minimum:s,maximum:a,exclusiveMinimum:l,exclusiveMaximum:c,multipleOf:u,format:d,id:p,...h}=t;return h.enum?h.enum=h.enum.map(e=>"number"==typeof e?String(e):e):"number"==typeof h.const&&(h.const=String(h.const)),i?(h.type="string",o||(h.pattern=(n.includes("number")?Oi:Ri).source),h):h}const pa=new WeakMap,ha=Symbol();function fa(e,t,r,n,i){let o=!1;const s=JSON.stringify(e,(e,t)=>"bigint"!=typeof t?t:(o=!0,null));return o?(Ds(t,r,n,i,"BigInt defaults cannot be represented in JSON Schema"),ha):JSON.parse(s)}const ma=(e,t,r,n)=>{const i=e._zod.def;Ls(i.innerType,t,n),t.seen.get(e).ref=i.innerType};r.dn(ya);const ga=()=>{const e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(t){return e[t]??null}const r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};function i(e,t){return"number"!==e||"number"!=typeof t||Number.isFinite(t)?n[e]??e:String(t)}return e=>{switch(e.code){case"invalid_type":{const t=i(e.expected),r=function(e){const t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(null===e)return"null";if(Array.isArray(e))return"array";const t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&"constructor"in t&&t.constructor)return t.constructor.name}}return t}(e.input);return`Invalid input: expected ${t}, received ${i(r,e.input)}`}case"invalid_value":return 1===e.values.length?`Invalid input: expected ${Fr(e.values[0])}`:`Invalid option: expected one of ${hr(e.values,"|")}`;case"too_big":{const r=e.exact?"exactly ":e.inclusive?"<=":"<",n=t(e.origin);return n?`Too big: expected ${e.origin??"value"} to have ${r}${e.maximum.toString()} ${n.unit??"elements"}`:`Too big: expected ${e.origin??"value"} to be ${r}${e.maximum.toString()}`}case"too_small":{const r=e.exact?"exactly ":e.inclusive?">=":">",n=t(e.origin);return n?`Too small: expected ${e.origin} to have ${r}${e.minimum.toString()} ${n.unit}`:`Too small: expected ${e.origin} to be ${r}${e.minimum.toString()}`}case"invalid_format":{const t=e;return"starts_with"===t.format?`Invalid string: must start with "${t.prefix}"`:"ends_with"===t.format?`Invalid string: must end with "${t.suffix}"`:"includes"===t.format?`Invalid string: must include "${t.includes}"`:"regex"===t.format?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${r[t.format]??e.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${e.divisor}`;case"unrecognized_keys":return`Unrecognized key${e.keys.length>1?"s":""}: ${hr(e.keys,", ")}`;case"invalid_key":return`Invalid key in ${e.origin}`;case"invalid_union":if(e.options&&Array.isArray(e.options)&&e.options.length>0){return`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(" | ")}`}return!1===e.inclusive?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${e.origin}`;default:return"Invalid input"}}};function ya(){return{localeError:ga()}}function _a(e,t){return{callee:t?.callee??e,Err:t?.Err}}const va=e=>{const t=(r,n,i,o)=>{const s=i?{...i,async:!1}:{async:!1},a=r._zod.run({value:n,issues:[]},s);if(a instanceof Promise)throw new dn;if(a.issues.length){const r=new(o?.Err??e)(a.issues.map(e=>Gr(e,s,fn())));throw Cr(r,o?.callee??t),r}return a.value};return t},ba=e=>{const t=async(r,n,i,o)=>{const s=i?{...i,async:!0}:{async:!0};let a=r._zod.run({value:n,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){const r=new(o?.Err??e)(a.issues.map(e=>Gr(e,s,fn())));throw Cr(r,o?.callee??t),r}return a.value};return t},xa=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 dn;return o.issues.length?wa(e,o.issues,i):{success:!0,data:o.value}};function wa(e,t,r){let n;return{success:!1,get error(){return n||(n=new e(t.map(e=>Gr(e,r,fn()))),t=void 0,r=void 0),n},set error(e){n=e,t=void 0,r=void 0}}}const ja=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?wa(e,o.issues,i):{success:!0,data:o.value}},Sa=Symbol.for("zod.compile.invalid"),ka=Symbol.for("zod.compile.fallback"),Ca=e=>{const t=va(e),r=(e,n,i,o)=>{const s=i?{...i,direction:"backward"}:{direction:"backward"};return t(e,n,s,_a(r,o))};return r},Ta=e=>{const t=va(e),r=(e,n,i,o)=>t(e,n,i,_a(r,o));return r},Ea=e=>{const t=ba(e),r=async(e,n,i,o)=>{const s=i?{...i,direction:"backward"}:{direction:"backward"};return await t(e,n,s,_a(r,o))};return r},Pa=e=>{const t=ba(e),r=async(e,n,i,o)=>await t(e,n,i,_a(r,o));return r},Ra=e=>(t,r,n)=>{const i=n?{...n,direction:"backward"}:{direction:"backward"};return xa(e)(t,r,i)},Oa=e=>(t,r,n)=>xa(e)(t,r,n),Na=e=>async(t,r,n)=>{const i=n?{...n,direction:"backward"}:{direction:"backward"};return ja(e)(t,r,i)},Aa=e=>async(t,r,n)=>ja(e)(t,r,n),Ia=va(Cn),Fa=ba(Cn),Da=xa(Cn),La=ja(Cn),za=Ca(Cn),Ma=Ta(Cn),$a=Ea(Cn),Ua=Pa(Cn),Ba=Ra(Cn),qa=Oa(Cn),Wa=Na(Cn),Ha=Aa(Cn);function Ga(){hn.memoizer||fn({memoizer:li})}const Za=un("ZodType",(e,t)=>(hn.localeError||fn(ya()),to.init(e,t),e.def=t,e.type=t.type,e),{check(...e){const t=this.def;return this.clone(Sr(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 Ar(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,...Ir(r)})}(ec,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 Fi({check:"custom",...Ir(t)});return r._zod.check=e,r}(t=>(t.addIssue=e=>{if("string"==typeof e)t.issues.push(Qr(e,t.value,r._zod.def));else{const n=e;n.fatal&&(n.continue=!1),n.code??(n.code="custom"),"input"in n||(n.input=t.value),n.inst??(n.inst=r),n.continue??(n.continue=!r._zod.def.abort),t.issues.push(Qr(n))}},e(t.value,t)),t);return r}(e,t)}(e,t))},overwrite(e){return this.check(As(e))},optional(){return ql(this)},exactOptional(){return new Wl({type:"optional",innerType:this})},nullable(){return Gl(this)},nullish(){return ql(Gl(this))},nonoptional(e){return function(e,t){return new Vl({type:"nonoptional",innerType:e,...Ir(t)})}(this,e)},array(){return Ol(this)},or(e){return Fl([this,e])},and(e){return new Dl({type:"intersection",left:this,right:e})},transform(e){return Yl(this,new Ul({type:"transform",transform:e}))},default(e){return t=e,new Zl({type:"default",innerType:this,get defaultValue(){return"function"==typeof t?t():Rr(t)}});var t},prefault(e){return t=e,new Kl({type:"prefault",innerType:this,get defaultValue(){return"function"==typeof t?t():Rr(t)}});var t},catch(e){return new Ql({type:"catch",innerType:this,catchValue:"function"==typeof(t=e)?t:sn(t)});var t},pipe(e){return Yl(this,e)},readonly(){return new Xl({type:"readonly",innerType:this})},describe(e){const t=this.clone();return js.add(t,{description:e}),t},meta(...e){if(0===e.length)return js.get(this);const t=this.clone();return js.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return 0===t.length?e(this):e(this,...t)},get"~standard"(){return Yr(this,"~standard",{...no(this),jsonSchema:{input:Ks(this,"input"),output:Ks(this,"output")}})},set"~standard"(e){Jr(this,"~standard",e)},parse:function e(t,r){return Ia(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await Fa(this,t,r,{callee:e})},safeParse(e,t){return Da(this,e,t)},async safeParseAsync(e,t){return La(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Jr(this,"spa",e)},validate(e,t){return((e,t,r)=>{const n=e._zod.bag.validator;if(void 0!==n){if(n(t)!==Sa)return!0;if(!0===n.definite&&void 0===r)return!1}return function(e,t,r){const n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun;let o;if(i?(n[ka]=!0,o=i({value:t,issues:[]},n)):o=e._zod.run({value:t,issues:[]},n),o instanceof Promise)throw new dn;return 0===o.issues.length}(e,t,r)})(this,e,t)},validateAsync(e,t){return(async(e,t,r)=>{const n=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0};let i=e._zod.run({value:t,issues:[]},n);return i instanceof Promise&&(i=await i),0===i.issues.length})(this,e,t)},encode:function e(t,r){return za(this,t,r,{callee:e})},decode:function e(t,r){return Ma(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await $a(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await Ua(this,t,r,{callee:e})},safeEncode(e,t){return Ba(this,e,t)},safeDecode(e,t){return qa(this,e,t)},async safeEncodeAsync(e,t){return Wa(this,e,t)},async safeDecodeAsync(e,t){return Ha(this,e,t)},toJSONSchema(e){return((e,t={})=>r=>{const n=Fs({...r,processors:t});return Ls(e,n),Ms(n,e),Gs(n,e)})(this,{})(e)},get description(){return js.get(this)?.description},get _def(){return this._zod.def}}),Ka=un("_ZodString",(e,t)=>{io.init(e,t),Za.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,laxFormat:c}=sa(e);if("number"==typeof i&&(n.minLength=i),"number"==typeof o&&(n.maxLength=o),s&&(n.format=aa[s]??s,""===n.format&&delete n.format,("time"===s||c)&&delete n.format),l&&(n.contentEncoding=l),a&&a.size>0){const e=[...a].map(ca);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)},Xr({format:e=>sa(e).format??null,minLength:e=>sa(e).minimum??null,maxLength:e=>sa(e).maximum??null},{regex(...e){return this.check(function(e,t){return new Gi({check:"string_format",format:"regex",...Ir(t),pattern:e})}(...e))},includes(...e){return this.check(function(e,t){return new Vi({check:"string_format",format:"includes",...Ir(t),includes:e})}(...e))},startsWith(...e){return this.check(function(e,t){return new Qi({check:"string_format",format:"starts_with",...Ir(t),prefix:e})}(...e))},endsWith(...e){return this.check(function(e,t){return new Ji({check:"string_format",format:"ends_with",...Ir(t),suffix:e})}(...e))},min(...e){return this.check(Os(...e))},max(...e){return this.check(Rs(...e))},length(...e){return this.check(Ns(...e))},nonempty(...e){return this.check(Os(1,...e))},lowercase(e){return this.check(function(e){return new Zi({check:"string_format",format:"lowercase",...Ir(e)})}(e))},uppercase(e){return this.check(function(e){return new Ki({check:"string_format",format:"uppercase",...Ir(e)})}(e))},trim(){return this.check(As(e=>e.trim()))},normalize(...e){return this.check(function(e){return As(t=>t.normalize(e))}(...e))},toLowerCase(){return this.check(As(e=>e.toLowerCase()))},toUpperCase(){return this.check(As(e=>e.toUpperCase()))},slugify(){return this.check(As(e=>function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(e)))}})),Va=un("ZodString",(e,t)=>{io.init(e,t),Ka.init(e,t)},{email(e){return this.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Ir(t)})}(rl,e))},url(e){return this.check(function(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Ir(t)})}(ol,e))},jwt(e){return this.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Ir(t)})}(bl,e))},emoji(e){return this.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Ir(t)})}(sl,e))},guid(e){return this.check(function(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Ir(t)})}(nl,e))},uuid(e){return this.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Ir(t)})}(il,e))},uuidv4(e){return this.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Ir(t)})}(il,e))},uuidv6(e){return this.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Ir(t)})}(il,e))},uuidv7(e){return this.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Ir(t)})}(il,e))},nanoid(e){return this.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Ir(t)})}(al,e))},cuid(e){return this.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Ir(t)})}(ll,e))},cuid2(e){return this.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Ir(t)})}(cl,e))},ulid(e){return this.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Ir(t)})}(ul,e))},base64(e){return this.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Ir(t)})}(yl,e))},base64url(e){return this.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Ir(t)})}(_l,e))},xid(e){return this.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Ir(t)})}(dl,e))},ksuid(e){return this.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Ir(t)})}(pl,e))},ipv4(e){return this.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Ir(t)})}(hl,e))},ipv6(e){return this.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Ir(t)})}(fl,e))},cidrv4(e){return this.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Ir(t)})}(ml,e))},cidrv6(e){return this.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Ir(t)})}(gl,e))},e164(e){return this.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Ir(t)})}(vl,e))},datetime(e){return this.check(function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Ir(t)})}(Ya,e))},date(e){return this.check(function(e,t){return new e({type:"string",format:"date",check:"string_format",...Ir(t)})}(Xa,e))},time(e){return this.check(function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Ir(t)})}(el,e))},duration(e){return this.check(function(e,t){return new e({type:"string",format:"duration",check:"string_format",...Ir(t)})}(tl,e))}});function Qa(e){return function(e,t){return new e(Ss({type:"string",...Ir(t)}))}(Va,e)}const Ja=un("ZodStringFormat",(e,t)=>{oo.init(e,t),Ka.init(e,t)}),Ya=un("ZodISODateTime",(e,t)=>{xo.init(e,t),Ja.init(e,t)}),Xa=un("ZodISODate",(e,t)=>{wo.init(e,t),Ja.init(e,t)}),el=un("ZodISOTime",(e,t)=>{jo.init(e,t),Ja.init(e,t)}),tl=un("ZodISODuration",(e,t)=>{So.init(e,t),Ja.init(e,t)}),rl=un("ZodEmail",(e,t)=>{lo.init(e,t),Ja.init(e,t)}),nl=un("ZodGUID",(e,t)=>{so.init(e,t),Ja.init(e,t)}),il=un("ZodUUID",(e,t)=>{ao.init(e,t),Ja.init(e,t)}),ol=un("ZodURL",(e,t)=>{ho.init(e,t),Ja.init(e,t)}),sl=un("ZodEmoji",(e,t)=>{fo.init(e,t),Ja.init(e,t)}),al=un("ZodNanoID",(e,t)=>{mo.init(e,t),Ja.init(e,t)}),ll=un("ZodCUID",(e,t)=>{go.init(e,t),Ja.init(e,t)}),cl=un("ZodCUID2",(e,t)=>{yo.init(e,t),Ja.init(e,t)}),ul=un("ZodULID",(e,t)=>{_o.init(e,t),Ja.init(e,t)}),dl=un("ZodXID",(e,t)=>{vo.init(e,t),Ja.init(e,t)}),pl=un("ZodKSUID",(e,t)=>{bo.init(e,t),Ja.init(e,t)}),hl=un("ZodIPv4",(e,t)=>{ko.init(e,t),Ja.init(e,t)}),fl=un("ZodIPv6",(e,t)=>{Eo.init(e,t),Ja.init(e,t)}),ml=un("ZodCIDRv4",(e,t)=>{Po.init(e,t),Ja.init(e,t)}),gl=un("ZodCIDRv6",(e,t)=>{Ro.init(e,t),Ja.init(e,t)}),yl=un("ZodBase64",(e,t)=>{Ao.init(e,t),Ja.init(e,t)}),_l=un("ZodBase64URL",(e,t)=>{Fo.init(e,t),Ja.init(e,t)}),vl=un("ZodE164",(e,t)=>{Do.init(e,t),Ja.init(e,t)}),bl=un("ZodJWT",(e,t)=>{Lo.init(e,t),Ja.init(e,t)}),xl=un("ZodNumber",(e,t)=>{zo.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const i=r,{minimum:o,maximum:s,multipleOf:a,exclusiveMaximum:l,exclusiveMinimum:c,isInt:u}=sa(e);i.type=u?"integer":"number";const d="number"==typeof c&&c>=(o??Number.NEGATIVE_INFINITY),p="number"==typeof l&&l<=(s??Number.POSITIVE_INFINITY),h="draft-04"===t.target||"openapi-3.0"===t.target;if(d?h?(i.minimum=c,i.exclusiveMinimum=!0):i.exclusiveMinimum=c:"number"==typeof o&&(i.minimum=o),p?h?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:"number"==typeof s&&(i.maximum=s),a){const r=new Set;for(const o of a)Number.isFinite(o)&&0!==o?r.add(Math.abs(o)):Ds(e,t,i,n,`A multipleOf divisor of ${o} cannot be represented in JSON Schema`);const[o,...s]=r;void 0!==o&&(i.multipleOf=o),s.length&&(i.allOf=[...i.allOf??[],...s.map(e=>({multipleOf:e}))])}})(e,t,r,n),e.isFinite=!0},Xr({minValue:e=>{const{minimum:t,exclusiveMinimum:r}=sa(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:e=>{const{maximum:t,exclusiveMaximum:r}=sa(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:e=>{const{isInt:t,multipleOf:r}=sa(e);return!!t||!!r?.some(Number.isSafeInteger)},format:e=>sa(e).format??null},{gt(e,t){return this.check(Ts(e,t))},gte(e,t){return this.check(Es(e,t))},min(e,t){return this.check(Es(e,t))},lt(e,t){return this.check(ks(e,t))},lte(e,t){return this.check(Cs(e,t))},max(e,t){return this.check(Cs(e,t))},int(e){return this.check(Sl(e))},safe(e){return this.check(Sl(e))},positive(e){return this.check(Ts(0,e))},nonnegative(e){return this.check(Es(0,e))},negative(e){return this.check(ks(0,e))},nonpositive(e){return this.check(Cs(0,e))},multipleOf(e,t){return this.check(Ps(e,t))},step(e,t){return this.check(Ps(e,t))},finite(){return this}}));function wl(e){return function(e,t){return new e(Ss({type:"number",checks:[],...Ir(t)}))}(xl,e)}const jl=un("ZodNumberFormat",(e,t)=>{Mo.init(e,t),xl.init(e,t)});function Sl(e){return function(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Ir(t)})}(jl,e)}const kl=un("ZodBoolean",(e,t)=>{$o.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t,r)=>{r.type="boolean"})(0,0,t)});function Cl(e){return function(e,t){return new e({type:"boolean",...Ir(t)})}(kl,e)}const Tl=un("ZodUnknown",(e,t)=>{Uo.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(e,t,r)=>{}});function El(){return new Tl({type:"unknown"})}const Pl=un("ZodNever",(e,t)=>{Bo.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t,r)=>{r.not={}})(0,0,t)});const Rl=un("ZodArray",(e,t)=>{Ga(),Wo.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const i=r,o=e._zod.def,{minimum:s,maximum:a}=sa(e);"number"==typeof s&&(i.minItems=s),"number"==typeof a&&(i.maxItems=a),i.type="array",i.items=Ls(o.element,t,{...n,path:[...n.path,"items"]})})(e,t,r,n),e.element=t.element},{min(e,t){return this.check(Os(e,t))},nonempty(e){return this.check(Os(1,e))},max(e,t){return this.check(Rs(e,t))},length(e,t){return this.check(Ns(e,t))},unwrap(){return this.element}});function Ol(e,t){return function(e,t,r){return new e({type:"array",element:t,...Ir(r)})}(Rl,e,t)}const Nl=un("ZodObject",(e,t)=>{Ga(),Qo.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const i=r,o=e._zod.def,s=o.shape;if(Object.getOwnPropertySymbols(s).length&&Ds(e,t,i,n,"Symbol keys cannot be represented in JSON Schema"))return;i.type="object",i.properties={};for(const e in s)_r(i.properties,e,Ls(s[e],t,{...n,path:[...n.path,"properties",e]}));const a=[];for(const e of Object.keys(s)){const r=o.shape[e];("input"===t.io?void 0===ua(r):void 0===r._zod.optout)&&a.push(e)}a.length>0&&(i.required=a),"never"===o.catchall?._zod.def.type?i.additionalProperties=!1:o.catchall?o.catchall&&(i.additionalProperties=Ls(o.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):"output"===t.io&&(i.additionalProperties=!1)})(e,t,r,n),function(e,t,r,n){const i=function(e,t){const r=Object.getPrototypeOf(e);return t in r?void 0:r}(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){const e={configurable:!0,writable:!0,enumerable:n,value:void 0};return Object.defineProperty(this,t,e),e.value=r(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:n,value:e})}})}(e,"shape",e=>e._zod.def.shape,!1)},{keyof(){return $l(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(Sr(this._zod.def,{catchall:e}))},passthrough(){return this.clone(Sr(this._zod.def,{catchall:El()}))},loose(){return this.clone(Sr(this._zod.def,{catchall:El()}))},strict(){return this.clone(Sr(this._zod.def,{catchall:function(e,t){return new e({type:"never",...Ir(t)})}(Pl,e)}));var e},strip(){return this.clone(Sr(this._zod.def,{catchall:void 0}))},extend(e){return function(e,t){if(!Pr(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=br(e);for(const e of Reflect.ownKeys(t))if(void 0!==Object.getOwnPropertyDescriptor(r,e))throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Ar(e,Sr(e._zod.def,{shape:Mr(e,t)}))}(this,e)},safeExtend(e){return function(e,t){if(!Pr(t))throw new Error("Invalid input to safeExtend: expected a plain object");return Ar(e,Sr(e._zod.def,{shape:Mr(e,t)}))}(this,e)},merge(e){return function(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const r={};return jr(r,e,Reflect.ownKeys(br(e))),jr(r,t,Reflect.ownKeys(br(t))),Ar(e,Sr(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}(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");const i={};return jr(i,e,zr(e,t)),Ar(e,Sr(r,{shape:i,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=new Set(zr(e,t)),o={};return jr(o,e,Reflect.ownKeys(br(e)).filter(e=>!i.has(e))),Ar(e,Sr(r,{shape:o,checks:[]}))}(this,e)},partial(...e){return $r(Bl,this,e[0])},exactPartial(...e){return $r(Wl,this,e[0],"exactPartial")},required(...e){return function(e,t,r){const n=r?new Set(zr(t,r)):void 0,i={};return jr(i,t,Reflect.ownKeys(br(t)),(t,r)=>n&&!n.has(r)?t:new e({type:"nonoptional",innerType:t})),Ar(t,Sr(t._zod.def,{shape:i}))}(Vl,this,e[0])}});function Al(e,t){const r={type:"object",shape:e??{},...Ir(t)};return new Nl(r)}const Il=un("ZodUnion",(e,t)=>{Yo.init(e,t),Za.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)=>Ls(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 Fl(e,t){return new Il({type:"union",options:e,...Ir(t)})}const Dl=un("ZodIntersection",(e,t)=>{Xo.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const i=e._zod.def,o=Ls(i.left,t,{...n,path:[...n.path,"allOf",0]}),s=Ls(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,t.intersections.push(l)})(e,t,r,n)}),Ll=un("ZodRecord",(e,t)=>{Ga(),rs.init(e,t),Za.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=sa(s).patterns;if("loose"===o.mode&&a&&a.size>0){const e=Ls(o.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});i.patternProperties={};for(const t of a)_r(i.patternProperties,ca(t).source,e)}else{if("draft-07"===t.target||"draft-2020-12"===t.target){i.propertyNames=Ls(o.keyType,t,{...n,path:[...n.path,"propertyNames"]});let r=pa.get(t);r||(r=[],pa.set(t,r),t.deferred.push(()=>function(e){const t=new Map;for(const r of e.seen.values())r.def&&!t.has(r.schema)&&t.set(r.schema,r);const r=new Map;for(const n of pa.get(e)??[]){const i=e.seen.get(n),o=(i?.def??i?.schema)?.propertyNames;if(!o||!0===o||r.has(o))continue;const s=da(t,o,new Set);s!==o&&r.set(o,s)}if(r.size)for(const t of e.seen.values())for(const e of[t.schema,t.def]){const t=e&&r.get(e.propertyNames);t&&(e.propertyNames=t)}}(t))),r.push(e)}i.additionalProperties=Ls(o.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}const l=s._zod.values,c="input"===t.io&&void 0!==ua(o.valueType);if(l&&!o.partial&&!c){const e=[...l].filter(e=>"string"==typeof e||"number"==typeof e);e.length>0&&(i.required=e.map(String))}})(e,t,r,n),e.keyType=t.keyType,e.valueType=t.valueType});function zl(e,t,r){return t&&t._zod?new Ll({type:"record",keyType:e,valueType:t,...Ir(r)}):new Ll({type:"record",keyType:Qa(),valueType:e,...Ir(t)})}const Ml=un("ZodEnum",(e,t)=>{ns.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r)=>{const n=pr(e._zod.def.entries);0!==n.length?(n.every(e=>"number"==typeof e)&&(r.type="number"),n.every(e=>"string"==typeof e)&&(r.type="string"),r.enum=n):r.not={}})(e,0,r),e.enum=t.entries,e.options=[...e._zod.values];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 Ml({...t,checks:[],...Ir(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 Ml({...t,checks:[],...Ir(n),entries:i})}});function $l(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new Ml({type:"enum",entries:r,...Ir(t)})}const Ul=un("ZodTransform",(e,t)=>{Ga(),is.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{Ds(e,t,r,n,"Transforms cannot be represented in JSON Schema")})(e,t,r,n),e._zod.parse=(r,n)=>{if("backward"===n.direction)throw new pn(e.constructor.name);r.addIssue=n=>{if("string"==typeof n)r.issues.push(Qr(n,r.value,t));else{const t=n;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),"input"in t||(t.input=r.value),t.inst??(t.inst=e),r.issues.push(Qr(t))}};const i=t.transform(r.value,r);return i instanceof Promise?i.then(e=>(r.value=e,r)):(r.value=i,r)}});const Bl=un("ZodOptional",(e,t)=>{ss.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,r,n)=>ma(e,t,0,n),e.unwrap=()=>e._zod.def.innerType});function ql(e){return new Bl({type:"optional",innerType:e})}const Wl=un("ZodExactOptional",(e,t)=>{as.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,r,n)=>ma(e,t,0,n),e.unwrap=()=>e._zod.def.innerType}),Hl=un("ZodNullable",(e,t)=>{ls.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const i=e._zod.def,o=Ls(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 Gl(e){return new Hl({type:"nullable",innerType:e})}const Zl=un("ZodDefault",(e,t)=>{cs.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const i=e._zod.def;Ls(i.innerType,t,n),t.seen.get(e).ref=i.innerType;const o=fa(i.defaultValue,e,t,r,n);o!==ha&&(r.default=o)})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}),Kl=un("ZodPrefault",(e,t)=>{ds.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const i=e._zod.def;if(Ls(i.innerType,t,n),t.seen.get(e).ref=i.innerType,"input"!==t.io)return;const o=fa(i.defaultValue,e,t,r,n);o!==ha&&(r._prefault=o)})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType}),Vl=un("ZodNonOptional",(e,t)=>{ps.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const i=e._zod.def;Ls(i.innerType,t,n),t.seen.get(e).ref=i.innerType})(e,t,0,n),e.unwrap=()=>e._zod.def.innerType}),Ql=un("ZodCatch",(e,t)=>{ms.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const i=e._zod.def;let o;Ls(i.innerType,t,n),t.seen.get(e).ref=i.innerType;try{o=i.catchValue(void 0)}catch{return void Ds(e,t,r,n,"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}),Jl=un("ZodPipe",(e,t)=>{gs.init(e,t),Za.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;Ls(s,t,n),t.seen.get(e).ref=s})(e,t,0,n),e.in=t.in,e.out=t.out});function Yl(e,t){return new Jl({type:"pipe",in:e,out:t})}const Xl=un("ZodReadonly",(e,t)=>{_s.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const i=e._zod.def;Ls(i.innerType,t,n),t.seen.get(e).ref=i.innerType,r.readOnly=!0})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType}),ec=un("ZodCustom",(e,t)=>{bs.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{Ds(e,t,r,n,"Custom types cannot be represented in JSON Schema")})(e,t,r,n)}),tc=Al({support:Cl().optional(),token:Qa().optional(),ip_logging:wl().int().optional(),expire_redirect:wl().int().optional(),expire_404:wl().int().optional(),auto_target:Qa().optional(),location:Qa().optional(),monitor_post:wl().int().optional(),monitor_types:Ol(Qa()).optional(),associated_redirect:Qa().optional(),redirect_cache:wl().int().optional(),rest_api:wl().int().optional(),https:Cl().optional(),headers:Ol(El()).optional(),flag_regex:Cl().optional(),flag_query:Qa().optional(),flag_trailing:Cl().optional(),flag_case:Cl().optional(),postTypes:zl(Qa(),Qa()).optional(),installed:Qa().optional(),warning:Qa().optional(),plugin_update:Qa().optional()}).passthrough(),rc=Al({status:$l(["ok","need-update","error"]),version:Qa().optional(),required:Qa().optional(),reason:Qa().optional()});function nc(e){return dt({queryKey:Pn.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=tc.parse(r);return he.getState().setValues(e),he.getState().setLoadStatus("success"),e}catch(e){if(e instanceof kn)return he.getState().setValues(r),he.getState().setLoadStatus("success"),On.getState().addError("Settings validation failed, using unvalidated data."),r;throw e}}catch(e){const t=En(e);throw he.getState().setLoadStatus("error"),he.getState().setError(t.message||"Failed to load settings"),On.getState().addError(t.message||"Failed to load settings"),t}},...e})}function ic(e){const t=p(),{updateValues:r,setSaveStatus:n}=he(),{incrementProgress:i,decrementProgress:o,addNotice:s,addError:a}=On();return ft({mutationFn:async e=>{i(),n(!0);try{const t=await jt(Pt(e)),r=t?.settings||t;return tc.parse(r)}catch(e){throw o(),n(!1),En(e)}},onSuccess:e=>{o(),n(!1),r(e),s("Settings saved"),t.invalidateQueries({queryKey:Pn.settings.all})},onError:e=>{a(e.message||"Failed to save settings")},...e})}function oc(e){const{setDatabase:t}=he(),{incrementProgress:r,decrementProgress:n,addError:i}=On();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"}),En(e)}},onSuccess:e=>{n(),t({inProgress:!1,...e})},onError:e=>{i(e.message||"Database upgrade failed")},...e})}function sc(e){const t=p(),{setShowDatabase:r}=he(),{addError:n}=On();return ft({mutationFn:async()=>{try{return await jt(rr())}catch(e){throw En(e)}},onSuccess:()=>{r(!1),t.invalidateQueries({queryKey:Pn.settings.all}),window.location.href=window.Redirectioni10n.pluginRoot},onError:e=>{n(e.message||"Failed to finish setup")},...e})}function ac(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:Pn.settings.all}),n?.(...e)},...i})}Al({version:Qa(),database:rc,groups:Ol(El()).optional(),postTypes:Ol(Qa()).optional(),canDelete:Cl().optional(),autoTarget:Qa().optional()});const lc="ok",cc="fail",uc="loading",dc="warning-current",pc="warning-not-selected";function hc(e){return e===lc?(0,a.__)("Good","redirection"):e===pc||e===dc?(0,a.__)("Working but some issues","redirection"):(0,a.__)("Unavailable","redirection")}function fc({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===cc,g=Jn().map(e=>({text:e.label,value:String(e.value)})),y=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!==uc&&n++,r&&e[r]&&e[r].POST&&e[r].POST.status!==uc&&n++}return Math.round(n/r*100)}(n,g),_=function(e,t,r){const n=Object.keys(e).filter(t=>{return!(!(r=e[t])||!r.GET||!r.POST||r.GET.status!==cc&&r.POST.status!==cc);var r}).length;return 0===n?"ok":n<t.length?(i=e[r])&&i.GET&&i.POST&&i.GET.status===lc&&i.POST.status===lc?dc:pc:"fail";var i}(n,g,p),v=y>=100&&f(_)||t,b=m({"api-result-status":!0,"api-result-status_good":_===lc&&y>=100,"api-result-status_problem":_===dc&&pc&&y>=100,"api-result-status_failed":_===cc&&y>=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:[y<100&&(0,a.sprintf)(
// translators: %s is the percentage complete
// translators: %s is the percentage complete
(0,a.__)("Testing - %s%%","redirection"),String(y)),y>=100&&hc(_)]}),y<100&&(0,u.jsx)(Hn,{})]}),y>=100&&_!==lc&&(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")})]}),y>=100&&_!==lc&&(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===cc&&(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")})})]})})(_),v&&g.map((t,r)=>{return(0,u.jsx)(Wn,{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 mc(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 gc(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 yc({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=mc(c);return(0,o().useEffect)(()=>()=>{const e=gc(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)(fc,{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 _c(e){return _c="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},_c(e)}function vc(e,t,r){return(t=function(e){var t=function(e){if("object"!=_c(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=_c(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==_c(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function bc(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 xc(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?bc(Object(r),!0).forEach(function(t){vc(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):bc(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var wc=r(500),jc=r.n(wc),Sc={percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,trailColor:"#D9D9D9",trailWidth:1,gapPosition:"bottom"},kc=["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"];const Cc=function(e){var t=xc(xc({},Sc),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=y(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,kc);delete h.gapPosition;var f,m,_=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:jc()("".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"}),_.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 Tc,Ec=0,Pc=!("undefined"==typeof window||!window.document||!window.document.createElement);r.dn(function(e){var t=(void 0)(Tc.useState(),2),r=t[0],n=t[1];return Tc.useEffect(function(){var e;n("rc_progress_".concat((Pc?(e=Ec,Ec+=1):e="TEST_OR_SSR",e)))},[]),e||r});const Rc=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 Oc({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 Nc({onRetry:e,error:t}){const{current:r,next:n,debug:i,reason:o}=he(e=>e.database),{mutate:s}=oc(),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)(R,{readOnly:!0,value:l,rows:15})]})}function Ac(e){return"need-update"===e?(0,a.__)("Upgrading Redirection","redirection"):(0,a.__)("Setting up Redirection","redirection")}function Ic(e,t){return"error"!==t&&"failed"!==t&&("need-install"===e||"need-update"===e)}function Fc(e){return"finish-install"===e||"finish-update"===e}function Dc({children:e}){const t=he(e=>e.database),{status:r,reason:n,result:i,complete:s}=t,l="ok"===i&&!Fc(r),{mutate:c,mutateAsync:d}=oc(),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(!Ic(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(Ic(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)(Rc,{message:(0,a.__)("Leaving before the process has completed may cause problems.","redirection"),prevent:"error"!==i&&"failed"!==i&&!Fc(r)}),(0,u.jsx)("h1",{children:Ac(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)(Cc,{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)(Hn,{})}),"error"===i&&(0,u.jsx)(Nc,{error:n||"",onRetry:m}),"failed"===i&&(0,u.jsx)(Oc,{error:n||"",onRetry:m}),Fc(r)&&e]})]})}function Lc({onCancel:e,onComplete:t}){const r=he(e=>e.loadStatus),{mutate:n}=ac({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)(R,{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 zc({step:e,setStep:t,options:r,setOptions:n}){const{manual:i}=r;return i?(0,u.jsx)(Lc,{onCancel:function(){t(0),n({manual:!1})},onComplete:function(){t(e+1)}}):(0,u.jsx)(Dc,{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 Mc="wordpress-old-slugs";function $c({setOptions:e,options:t,setStep:r,step:n}){const{importers:i=[Mc]}=t,{data:o=[]}=In(),s=o.find(e=>e.id===Mc),l=o.filter(e=>e.id!==Mc);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:Mc,onChange:c,checked:i.includes(Mc)}),(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 Uc({step:e,setStep:t,options:r}){const n=Fn(),{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:"ignore"}):t(e+1)},[i,r.importers,t,e]),c=(0,o().useRef)(!1);return(0,o().useEffect)(()=>{c.current||(c.current=!0,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 Bc({options:e}){const t=he(e=>e.apiTest),{addError:r}=On(),{mutate:n}=ic(),{mutate:i}=sc(),o=mc(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=gc(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 qc=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?$c:4===e?zc:3===e?yc:1===e?Ln:5===e?Uc:6===e?Bc:me}(e);return(0,u.jsxs)(u.Fragment,{children:["error"===i&&(0,u.jsx)(Z,{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 Wc(e){return"finish-install"===e||"finish-update"===e}function Hc(){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 Gc(){const{mutate:e}=ac();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)(R,{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 Zc({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 Kc(){const e=he(e=>e.database.reason),t=he(e=>e.database.status),r=he(e=>e.database.result),{mutate:n}=sc();return(0,u.jsxs)(u.Fragment,{children:["error"===r&&(0,u.jsx)(Z,{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)(Dc,{}),Wc(t)&&(0,u.jsx)("button",{className:"button button-primary",onClick:function(){n()},children:(0,a.__)("Finished! 🎉","redirection")})]})})]})}function Vc({children:e}){const t=Dn();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 Qc({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")}),Hc(),(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)(Vc,{}),import:(0,u.jsx)(A,{url:"https://redirection.me/support/import-export-redirects/"})})}),t?(0,u.jsx)(Gc,{}):(0,u.jsx)(Zc,{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 Jc({showDatabase:e,onShowUpgrade:t}){return e?(0,u.jsx)(Kc,{}):(0,u.jsx)(Qc,{onShowUpgrade:t})}const Yc=({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&&"|"," "]})},Xc=(e,t,r)=>e===t.value||e===r&&""===t.value,eu=({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)(Yc,{item:o,isCurrent:Xc(i,o,r),isLast:s===t.length-1,onClick:e,urlBase:n},s))})});let tu=!1;function ru({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 nu=function({notices:e,onClear:t,snackBarViewText:r}){const[n,i]=(0,o().useState)(!1);if((0,o().useEffect)(()=>(e.length>0&&(i(!1),tu&&clearTimeout(tu),tu=setTimeout(()=>i(!0),5e3)),()=>{tu&&clearTimeout(tu)}),[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)(ru,{notices:e})})]})};function iu(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(!iu(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(!iu(e[n],t[n]))return!1}return!0}return!1}function ou(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 su(e,t,r){const n=ou(r);for(const r in e){const i=iu(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 au(e,t){const r=ou(t);return r.sub&&-1!==e.indexOf(r.sub)?r.sub:e[0]}const lu=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=au(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({},"",su({sub:t},{sub:s},a)),c.current=t},[a,s,i,t]),(0,u.jsx)(u.Fragment,{children:n})},cu=function(){return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(fc,{}),(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 uu(){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 du(){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 pu=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)(Z,{errors:"",renderDebug:fe,type:"fixed",links:Q(),details:J().concat([n,t?.componentStack||""]),locale:"redirection",children:i?(0,u.jsx)(uu,{}):(0,u.jsx)(du,{})})},hu=()=>(0,u.jsx)("div",{className:"wpl-placeholder__container",children:(0,u.jsx)("div",{className:"wpl-placeholder__loading"})}),fu=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 mu="data-focus-lock",gu="data-focus-lock-disabled";function yu(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var _u="undefined"!=typeof window?o().useLayoutEffect:o().useEffect,vu=new WeakMap;var bu={width:"1px",height:"0px",padding:0,overflow:"hidden",position:"fixed",top:"1px",left:"1px"},xu=function(){return xu=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},xu.apply(this,arguments)};function wu(e){return e}function ju(e,t){void 0===t&&(t=wu);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 Su(e,t){return void 0===t&&(t=wu),ju(e,t)}Object.create,Object.create;var ku=Su({},function(e){return{target:e.target,currentTarget:e.currentTarget}}),Cu=Su(),Tu=Su(),Eu=function(e){void 0===e&&(e={});var t=ju(null);return t.options=xu({async:!0,ssr:!1},e),t}({async:!0,ssr:"undefined"!=typeof document}),Pu=(0,o().createContext)(void 0),Ru=[],Ou=(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),y=(0,o().useRef)(null),_=(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,P=void 0===E||E,R=(e.allowTextSelection,e.group),O=e.className,N=e.whiteList,A=e.hasPositiveIndices,I=e.shards,F=void 0===I?Ru:I,D=e.as,L=void 0===D?"div":D,z=e.lockProps,M=void 0===z?{}:z,$=e.sideCar,U=e.returnFocus,B=void 0!==U&&U,q=e.focusOptions,W=e.onActivation,H=e.onDeactivation,G=(0,o().useState)({})[0],Z=(0,o().useCallback)(function(e){var t=e.captureFocusRestore;if(!y.current){var r,n=null==(r=document)?void 0:r.activeElement;y.current=n,n!==document.body&&(y.current=t(n))}f.current&&W&&W(f.current),m.current=!0,_()},[W]),K=(0,o().useCallback)(function(){m.current=!1,H&&H(f.current),_()},[H]),V=(0,o().useCallback)(function(e){var t=y.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;y.current=null,e?Promise.resolve().then(function(){return r.focus(i)}):r.focus(i)}}},[B]),Q=(0,o().useCallback)(function(e){m.current&&ku.useMedium(e)},[]),J=Cu.useMedium,Y=(0,o().useCallback)(function(e){f.current!==e&&(f.current=e,h(e))},[]),X=g(((r={})[gu]=x&&"disabled",r[mu]=R,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 yu(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,_u(function(){var e=vu.get(u);if(e){var t=new Set(e),r=new Set(n),i=u.current;t.forEach(function(e){r.has(e)||yu(e,null)}),r.forEach(function(e){t.has(e)||yu(e,i)})}vu.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:bu}),A?c()().createElement("div",{key:"guard-nearest","data-focus-guard":!0,tabIndex:x?-1:1,style:bu}):null],!x&&c()().createElement($,{id:G,sideCar:Eu,observed:p,disabled:x,persistentFocus:k,crossFrame:T,autoFocus:P,whiteList:N,shards:F,onActivation:Z,onDeactivation:K,returnFocus:V,focusOptions:q,noFocusGuards:j}),c()().createElement(L,g({ref:re},X,{className:O,onBlur:J,onFocus:Q}),c()().createElement(Pu.Provider,{value:ne},v)),te&&c()().createElement("div",{"data-focus-guard":!0,tabIndex:x?-1:0,style:bu}))});Ou.propTypes={};const Nu=Ou;function Au(e,t){return Au=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Au(e,t)}var Iu=function(e){for(var t=Array(e.length),r=0;r<e.length;++r)t[r]=e[r];return t},Fu=function(e){return Array.isArray(e)?e:[e]},Du=function(e){return Array.isArray(e)?e[0]:e},Lu=function(e){return e.parentNode&&e.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE?e.parentNode.host:e.parentNode},zu=function(e){return e===document||e&&e.nodeType===Node.DOCUMENT_NODE},Mu=function(e,t){var r=e.get(t);if(void 0!==r)return r;var n=function(e,t){return!e||zu(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(Lu(e))}(t,Mu.bind(void 0,e));return e.set(t,n),n},$u=function(e,t){var r=e.get(t);if(void 0!==r)return r;var n=function(e,t){return!(e&&!zu(e))||!!Wu(e)&&t(Lu(e))}(t,$u.bind(void 0,e));return e.set(t,n),n},Uu=function(e){return e.dataset},Bu=function(e){return"INPUT"===e.tagName},qu=function(e){return Bu(e)&&"radio"===e.type},Wu=function(e){var t=e.getAttribute("data-no-autofocus");return![!0,"true",""].includes(t)},Hu=function(e){var t;return Boolean(e&&(null===(t=Uu(e))||void 0===t?void 0:t.focusGuard))},Gu=function(e){return!Hu(e)},Zu=function(e){return Boolean(e)},Ku=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},Vu=function(e,t,r){return Iu(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(Ku)},Qu=["button:enabled","select:enabled","textarea:enabled","input:enabled","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[tabindex]","[contenteditable]","[autofocus]"].join(","),Ju="".concat(Qu,", [data-focus-guard]"),Yu=function(e,t){return Iu((e.shadowRoot||e).children).reduce(function(e,r){return e.concat(r.matches(t?Ju:Qu)?[r]:[],Yu(r))},[])},Xu=function(e,t){return e.reduce(function(e,r){var n,i=Yu(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)?Xu([e.contentDocument.body],t):[e]}(e,t)}));return e.concat(o,r.parentNode?Iu(r.parentNode.querySelectorAll(Qu)).filter(function(e){return e===r}):[])},[])},ed=function(e,t){return Iu(e).filter(function(e){return Mu(t,e)}).filter(function(e){return function(e){return!((Bu(e)||function(e){return"BUTTON"===e.tagName}(e))&&("hidden"===e.type||e.disabled))}(e)})},td=function(e,t){return void 0===t&&(t=new Map),Iu(e).filter(function(e){return $u(t,e)})},rd=function(e,t,r){return Vu(ed(Xu(e,r),t),!0,r)},nd=function(e,t){return Vu(ed(Xu(e),t),!1)},id=function(e,t){return e.shadowRoot?id(e.shadowRoot,t):!(void 0===Object.getPrototypeOf(e).contains||!Object.getPrototypeOf(e).contains.call(e,t))||Iu(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&&id(n,t)}return id(e,t)})},od=function(e){if(void 0===e&&(e=document),e&&e.activeElement){var t=e.activeElement;return t.shadowRoot?od(t.shadowRoot):t instanceof HTMLIFrameElement&&function(){try{return t.contentWindow.document}catch(e){return}}()?od(t.contentWindow.document):t}},sd=function(e){return e.parentNode?sd(e.parentNode):e},ad=function(e){return Fu(e).filter(Boolean).reduce(function(e,t){var r=t.getAttribute(mu);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)})}(Iu(sd(t).querySelectorAll("[".concat(mu,'="').concat(r,'"]:not([').concat(gu,'="disabled"])')))):[t]),e},[])},ld=function(e,t){return void 0===t&&(t=od(Du(e).ownerDocument)),!(!t||t.dataset&&t.dataset.focusGuard)&&ad(e).some(function(e){return id(e,t)||function(e,t){return Boolean(Iu(e.querySelectorAll("iframe")).some(function(e){return function(e,t){return e===t}(e,t)}))}(e,t)})},cd=function(e,t){e&&("focus"in e&&e.focus(t),"contentWindow"in e&&e.contentWindow&&e.contentWindow.focus())},ud=function(e,t){return qu(e)&&e.name?function(e,t){return t.filter(qu).filter(function(t){return t.name===e.name}).filter(function(e){return e.checked})[0]||e}(e,t):e},dd=function(e){return e[0]&&e.length>1?ud(e[0],e):e[0]},pd=function(e,t){return e.indexOf(ud(t,e))},hd="NEW_FOCUS",fd=function(e,t,r){var n,i=e.map(function(e){return e.node}),o=td(i.filter((n=r,function(e){var t,r=null===(t=Uu(e))||void 0===t?void 0:t.autofocus;return e.autofocus||void 0!==r&&"false"!==r||n.indexOf(e)>=0})));return o&&o.length?dd(o):dd(td(t))},md=function(e,t){return void 0===t&&(t=[]),t.push(e),e.parentNode&&md(e.parentNode.host||e.parentNode,t),t},gd=function(e,t){for(var r=md(e),n=md(t),i=0;i<r.length;i+=1){var o=r[i];if(n.indexOf(o)>=0)return o}return!1},yd=function(e,t,r){var n=Fu(e),i=Fu(t),o=n[0],s=!1;return i.filter(Boolean).forEach(function(e){s=gd(s||e,e)||s,r.filter(Boolean).forEach(function(e){var t=gd(o,e);t&&(s=!s||id(t,s)?t:gd(t,s))})}),s},_d=function(e,t){return e.reduce(function(e,r){return e.concat(function(e,t){return ed((r=e.querySelectorAll("[".concat("data-autofocus-inside","]")),Iu(r).map(function(e){return Xu([e])}).reduce(function(e,t){return e.concat(t)},[])),t);var r}(r,t))},[])},vd=function(e,t){var r=od(Fu(e).length>0?document:Du(e).ownerDocument),n=ad(e).filter(Gu),i=yd(r||e,e,n),o=new Map,s=nd(n,o),a=s.filter(function(e){var t=e.node;return Gu(t)});if(a[0]){var l,c,u,d=nd([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(Zu)),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=Hu(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:hd;if(-1===d)return hd;var p,h,f=c-u,m=r.indexOf(s),g=r.indexOf(a),y=(p=r,h=new Set,p.forEach(function(e){return h.add(ud(e,p))}),p.filter(function(e){return h.has(e)})),_=void 0!==n?y.indexOf(n):-1,v=i?y.indexOf(i):_,b=y.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-_;if(!f&&d>=0)return d;if(0===t.length)return d;var S=pd(e,t[0]),k=pd(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===hd){var g=fd(s,f,_d(n,o))||fd(s,h,_d(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]}},bd=0,xd=!1,wd=function(e,t,r){void 0===r&&(r={});var n=vd(e,t);if(!xd&&n){if(bd>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"),xd=!0,void setTimeout(function(){xd=!1},1);bd++,cd(n.node,r.focusOptions),bd--}};function jd(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 Sd=function(e){var t=function(e){if(!e)return null;for(var t=[],r=e;r&&r!==document.body;)t.push({current:jd(r),parent:jd(r.parentElement),left:jd(r.previousElementSibling),right:jd(r.nextElementSibling)}),r=r.parentElement;return{element:jd(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),y=rd([p],l),_=null!==(o=null!==(i=null!=m?m:null==h?void 0:h.nextElementSibling)&&void 0!==i?i:g)&&void 0!==o?o:h;_;){for(var v=0,b=y;v<b.length;v++){var x=b[v];if(null==_?void 0:_.contains(x.node))return x.node}_=_.nextElementSibling}if(y.length)return y[0].node}}}(t)}},kd=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=Fu(t);if(n.every(function(t){return!id(t,e)}))return console.error("Active element is not contained in the scope"),{};var i=r?rd(n,new Map):nd(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&&cd(o.node,n.focusOptions)}},Cd=function(e,t,r){var n,i,o,s,a=(i=e,o=null===(n=t.onlyTabbable)||void 0===n||n,{first:(s=o?rd(Fu(i),new Map):nd(Fu(i),new Map))[0],last:s[s.length-1]})[r];a&&cd(a.node,t.focusOptions)};function Td(e){setTimeout(e,1)}var Ed=function(e){return e&&"current"in e?e.current:e},Pd=function(){return document&&document.activeElement===document.body},Rd=null,Od=null,Nd=function(){return null},Ad=null,Id=!1,Fd=!1,Dd=function(){return!0};function Ld(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 zd=function e(t,r,n){return r&&(r.host===t&&(!r.activeElement||n.contains(r.activeElement))||r.parentNode&&e(t,r.parentNode,n))},Md=function(e){return nd(e,new Map)},$d=function(){var e,t,r,n,i,o,s=!1;if(Rd){var a=Rd,l=a.observed,c=a.persistentFocus,u=a.autoFocus,d=a.shards,p=a.crossFrame,h=a.focusOptions,f=a.noFocusGuards,m=l||Ad&&Ad.portaledElement;if(Pd()&&Od&&Od!==document.body&&(!document.body.contains(Od)||function(e){return!Md([e.parentNode]).some(function(t){return t.node===e})}(Od))){var g=Nd();g&&g.focus()}var y=document&&document.activeElement;if(m){var _=[m].concat(d.map(Ed).filter(Boolean));if(y&&!function(e){return(Rd.whiteList||Dd)(e)}(y)||(c||function(){if(!(p?Boolean(Id):"meanwhile"===Id)||!f||!Od||Fd)return!1;var e=Md(_),t=e.findIndex(function(e){return e.node===Od});return 0===t||t===e.length-1}()||!(Pd()||function(e){void 0===e&&(e=document);var t=od(e);return!!t&&Iu(e.querySelectorAll("[".concat("data-no-focus-lock","]"))).some(function(e){return id(e,t)})}())||!Od&&u)&&(m&&!(ld(_)||y&&function(e,t){return t.some(function(t){return zd(e,t,t)})}(y,_)||(o=y,Ad&&Ad.portaledElement===o))&&(document&&!Od&&y&&!u?(y.blur&&y.blur(),document.body.focus()):(s=wd(_,Od,{focusOptions:h}),Ad={})),(Od=document&&document.activeElement)!==document.body&&(Nd=Sd(Od)),Id=!1),document&&y!==document.activeElement&&document.querySelector("[data-focus-auto-guard]")){var v=document&&document.activeElement,b=(t=ad(e=_).filter(Gu),r=yd(e,e,t),n=Vu(Xu([r],!0),!0,!0),i=Xu(t,!1),n.map(function(e){var t=e.node;return{node:t,index:e.index,lockItem:i.indexOf(t)>=0,guard:Hu(t)}})),x=b.map(function(e){return e.node}).indexOf(v);x>-1&&(b.filter(function(e){var t=e.guard,r=e.node;return t&&r.dataset.focusAutoGuard}).forEach(function(e){return e.node.removeAttribute("tabIndex")}),Ld(x,b.length,1,b),Ld(x,-1,-1,b))}}}return s},Ud=function(e){$d()&&e&&(e.stopPropagation(),e.preventDefault())},Bd=function(){return Td($d)},qd=function(){Fd=!0},Wd=function(){Fd=!1,Id="just",Td(function(){Id="meanwhile"})},Hd={moveFocusInside:wd,focusInside:ld,focusNextElement:function(e,t){void 0===t&&(t={}),kd(e,t,function(e,t){var r=e.next,n=e.first;return r||t&&n})},focusPrevElement:function(e,t){void 0===t&&(t={}),kd(e,t,function(e,t){var r=e.prev,n=e.last;return r||t&&n})},focusFirstElement:function(e,t){void 0===t&&(t={}),Cd(e,t,"first")},focusLastElement:function(e,t){void 0===t&&(t={}),Cd(e,t,"last")},captureFocusRestore:Sd};ku.assignSyncMedium(function(e){var t=e.target,r=e.currentTarget;r.contains(t)||(Ad={observerNode:r,portaledElement:t})}),Cu.assignMedium(Bd),Tu.assignMedium(function(e){return e(Hd)});const Gd=(Zd=function(e){return e.filter(function(e){return!e.disabled})},Kd=function(e){var t=e.slice(-1)[0];t&&!Rd&&(document.addEventListener("focusin",Ud),document.addEventListener("focusout",Bd),window.addEventListener("focus",qd),window.addEventListener("blur",Wd));var r=Rd,n=r&&t&&t.id===r.id;Rd=t,r&&!n&&(r.onDeactivation(),e.filter(function(e){return e.id===r.id}).length||r.returnFocus(!t)),t?(Od=null,n&&r.observed===t.observed||t.onActivation(Hd),$d(),Td($d)):(document.removeEventListener("focusin",Ud),document.removeEventListener("focusout",Bd),window.removeEventListener("focus",qd),window.removeEventListener("blur",Wd),Od=null)},function(e){var t,r=[];function n(){t=Zd(r.map(function(e){return e.props})),Kd(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,Au(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 vc(i,"displayName","SideEffect("+function(e){return e.displayName||e.name||"Component"}(e)+")"),i})(function(){return null});var Zd,Kd,Vd=(0,o().forwardRef)(function(e,t){return c()().createElement(Nu,g({sideCar:Gd,ref:t},e))}),Qd=Nu.propTypes||{};Qd.sideCar,y(Qd,["sideCar"]),Vd.propTypes={};const Jd=Vd;function Yd(e){if(null===e)return null;const{left:t,top:r,height:n}=e;return{left:t,top:r+n}}function Xd(e,t){return t?{...e,width:t.getBoundingClientRect().width}:e}function ep({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 tp=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:Xd(r,e)})}},[t,n,i,s,a]);return(0,u.jsxs)(u.Fragment,{children:[a&&(0,u.jsx)(ep,{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 rp(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 np(e){const t=(0,o().useRef)(null),{children:r,onOutside:n,className:i}=e,s=(0,o().useCallback)(e=>{(rp(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 ip(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 op(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 sp=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)(np,{className:m("wpl-popover",r),onOutside:e=>{c&&!1===rp(e,c.ref)&&"Escape"!==e.key||a()},children:(0,u.jsx)(Jd,{returnFocus:!0,disabled:!p,children:(0,u.jsx)(tp,{position:Yd(c),popoverPosition:c,align:n,hasArrow:l,valign:i,style:d,children:t})})}),ip("wpl-dropdown-portal")||document.body)},ap=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),y=(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:y,children:n(p,e=>{if(!y.current)return;const t=op(y.current,s);e?.stopPropagation(),c||(g(t),h(!p))})}),p&&f&&(0,u.jsx)(sp,{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 lp({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 cp=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)(lp,{option:e,isSelected:i,onChange:n,name:a||e.value,optionsType:r},t))]})},up=function(e){const{option:t,isSelected:r,onChange:n}=e;if(t.options){const{optionsType:e="checkbox"}=t;return(0,u.jsx)(cp,{option:t,optionsType:e,isSelected:r,onChange:n})}const i=t.value||"";return(0,u.jsx)(lp,{option:{label:t.label,value:i,disabled:t.disabled??!1,default:t.default??!1},isSelected:r,onChange:n,optionsType:"checkbox",name:i})},dp=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 pp(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=pp(n.options,t);if(e)return e}}}return null}function hp(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 fp(e){const t=pp(e,""),r=hp(t,t);return r?[r]:[]}function mp({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?fp(r):Array.isArray(e)?function(e,t){return-1!==e.indexOf("")?fp(t):e.map(e=>{const r=pp(t,e);return hp(r,r)}).filter(e=>null!==e)}(e,r):function(e,t){return Object.keys(e).map(r=>{const n=pp(t,r);return"string"==typeof e[r]?hp(pp(t,e[r]),n):e[r]?hp(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)(dp,{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 gp=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"})})},yp=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)(ap,{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)(mp,{selected:r,title:i,showBadges:o,options:t,disabled:a,onChange:h}),(0,u.jsx)(gp,{})]}),disabled:a,align:"right",matchMinimum:!0,renderContent:()=>(0,u.jsx)("div",{className:m("wpl-multioption",d),children:t.map((e,t)=>(0,u.jsx)(up,{option:e,isSelected:p,onChange:h},t))})})},_p=function({level:e="notice",children:t,className:r}){return(0,u.jsx)("div",{className:m(`inline-notice inline-${e}`,r),children:t})},vp=()=>[{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")}],bp=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)(Gn,{title:(0,a.__)("Redirect Logs","redirection")+":",url:n("logs"),children:[(0,u.jsx)(Qn,{items:vp(),name:"expire_redirect",value:String(i),onChange:r})," ",(0,a.__)("(time to keep logs for)","redirection")]}),(0,u.jsxs)(Gn,{title:(0,a.__)("404 Logs","redirection")+":",url:n("tracking-404-errors"),children:[(0,u.jsx)(Qn,{items:vp(),name:"expire_404",value:String(o),onChange:r})," ",(0,a.__)("(time to keep logs for)","redirection")]}),(0,u.jsxs)(Gn,{title:(0,a.__)("IP Logging","redirection")+":",url:n("options","iplogging"),children:[(0,u.jsx)(Qn,{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)(Gn,{title:(0,a.__)("IP Address","redirection")+":",url:n("options","ipaddress"),children:[(0,u.jsx)(yp,{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)(_p,{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)(Gn,{title:(0,a.__)("Proxy Address","redirection")+":",url:n("options","proxy"),children:[(0,u.jsx)(R,{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)(Gn,{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 xp(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 wp(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 jp=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)(Gn,{title:(0,a.__)("URL Monitor","redirection")+":",url:i("options","monitor"),children:xp(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?wp(l,n):0,associated_redirect:i.length>0?s:""})})}),d&&(0,u.jsxs)(Gn,{title:(0,a.__)("URL Monitor Changes","redirection")+":",url:i("options","monitor"),children:[(0,u.jsx)(Qn,{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")]})]})]})},Sp=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)(jp,{settings:t,onChange:r,groups:i,getLink:n,postTypes:o}),(0,u.jsxs)(Gn,{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)(Gn,{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)(Qn,{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)(Gn,{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)(Gn,{title:(0,a.__)("HTTP Cache Header","redirection"),url:n("options","cache"),children:[(0,u.jsx)(Qn,{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)(Gn,{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")})})]})]})},kp=Al({source:Al({flag_regex:Cl(),flag_trailing:Cl(),flag_case:Cl(),flag_query:Qa()}).optional(),options:zl(Qa(),El()).optional()}),Cp=Al({id:wl().int(),url:Qa(),match_url:Qa().optional(),match_type:Qa(),action_type:Qa(),action_code:wl().int(),action_data:El(),match_data:kp.nullish(),group_id:wl().int(),title:Qa(),position:wl().int().nonnegative(),regex:Cl().optional(),last_access:Qa().optional(),enabled:Cl().optional(),hits:wl().int().nonnegative().optional()}),Tp=(Al({url:Qa().min(1,"Source URL is required"),title:Qa().optional(),match_type:Qa(),action_type:Qa(),action_code:wl().int().min(100).max(599).optional(),action_data:El().optional(),match_data:kp.optional(),group_id:wl().int().positive(),position:wl().int().nonnegative().default(0),enabled:Cl().optional()}).partial().extend({id:wl().int()}),Al({items:Ol(wl().int()),action:$l(["delete","enable","disable","reset"])}),Al({id:wl().int(),name:Qa(),redirects:wl().int().nonnegative(),module_id:wl().int(),moduleName:Qa().optional(),enabled:Cl()})),Ep=(Al({name:Qa().min(1,"Group name is required"),moduleId:wl().int().positive(),position:wl().int().nonnegative().default(0),enabled:Cl().optional()}).partial().extend({id:wl().int()}),Al({page:wl().int().nonnegative(),per_page:wl().int().positive().max(100),orderby:Qa(),direction:$l(["asc","desc"]),selected:Ol(Fl([wl(),Qa()])),selectAll:Cl().optional(),displayType:Qa().optional(),displaySelected:Ol(Qa()).optional(),filterBy:zl(Qa(),Qa()).optional(),groupBy:Qa().optional()})),Pp=e=>Al({items:Ol(e),total:wl().int().nonnegative(),table:Ep.optional()}),Rp=(Al({item:El(),items:Ol(El()).optional(),total:wl().int().nonnegative().optional()}),Al({code:Fl([Qa(),wl()]).optional(),message:Qa().optional(),data:El().optional(),jsonData:El().optional(),request:Al({url:Qa(),method:Qa()}).optional()}),Pp(Cp)),Op=Al({item:Cp}),Np=Pp(Tp),Ap=Al({item:Tp});function Ip(e){return{...!0===e?.global?{page:0}:{},selected:[],selectAll:!1}}function Fp(e,t){return"ip"===e?{ip:t}:"agent"===e?{agent:t}:{"url-exact":t}}Al({deleted:wl().int().nonnegative().optional(),updated:wl().int().nonnegative().optional(),items:Ol(El()).optional(),total:wl().int().nonnegative().optional()});const Dp=["selected","selectAll","displayType","displaySelected"];function Lp(e){const t={};for(const r in e){const n=e[r];Dp.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 zp(e){return dt({queryKey:Pn.groups.dropdown(),refetchOnMount:"always",refetchOnReconnect:!0,placeholderData:e=>e,queryFn:async()=>{try{const e=await jt(Ft());return Np.parse(e)}catch(e){const t=En(e);throw On.getState().addError(t.message||"Failed to fetch groups"),t}},...e})}function Mp(e){return window.Redirectioni10n.pluginRoot+"&sub=rss&module=1&token="+encodeURIComponent(e)}function $p(e,t){return e.replace(/\/$/,"")+"/"+t.replace(/^\//,"")}function Up(e){return e?/^https?:\/\//i.test(e)?e:"https://"+e:document.location.origin}function Bp(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 qp(e,t){return"https://redirection.me/support/"+e+(t?"/#"+t:"")}const Wp={},Hp={},Gp=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}=zp(),l=s?.items?Bp(s.items):[],{mutate:c}=ic(),[d,p]=(0,o().useState)(e??Hp),h=i??Wp;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)(Zn,{children:[(0,u.jsx)(bp,{settings:d,onChange:f,getLink:qp}),(0,u.jsx)(Sp,{settings:d,onChange:f,getLink:qp,groups:l,postTypes:h}),(0,u.jsx)(Yn,{settings:d,onChange:f,getLink:qp,installed:r,warning:n})]}),(0,u.jsx)(fu,{isPrimary:!0,isSubmit:!0,disabled:t,children:(0,a.__)("Update","redirection")})]})},Zp=function({onClose:e,children:t,className:r}){return(0,u.jsx)(np,{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]})})},Kp="wpl-modal_shown",Vp=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(Kp),document.addEventListener("keydown",n),()=>{document.body.classList.remove(Kp),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)(Zp,{onClose:t,...r})})]})},Qp=e=>(0,s.createPortal)((0,u.jsx)(Vp,{...e}),ip("wpl-modal")||document.body),Jp=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)(Qp,{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")})]})]})})]})},Yp=function(){const e=he(e=>e.loadStatus),t=he(e=>e.values);nc();const r=function(){const{incrementProgress:e,decrementProgress:t,addNotice:r,addError:n}=On();return ft({mutationFn:async()=>{e();try{return await jt(er())}catch(e){throw t(),En(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)(Gp,{}),(0,u.jsx)("hr",{}),n&&(0,u.jsx)(Jp,{onDelete:()=>{r.mutate()}})]}):(0,u.jsx)(hu,{})},Xp=()=>(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 eh(e,t){return"http"===e.slice(0,4)?e:$p(t||document.location.origin,e)}function th(e){return"object"==typeof e&&void 0!==e.url_from?e.url_from:e}function rh({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 nh({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)(rh,{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 ih(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&&eh(o.value)===th(r);if("object"==typeof r)return"redirection"===i.value.toLowerCase()&&n===t&&eh(o.value,r.server)===th(r)}return!1}const oh=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)(nh,{step:r,isFirst:0===n,isLast:n===i.length-1,isMatch:ih(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 sh({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 ah({url:e,desiredCode:t=0,desiredTarget:r=null}){const{data:n,isLoading:i,isError:o,error:s}=function(e,t){return dt({queryKey:Pn.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)(Hn,{}),o&&l&&(0,u.jsx)(sh,{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)(oh,{http:n,url:e,desiredCode:t,desiredTarget:r})]})]})}const lh=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)(ah,{url:r})})]})},ch=()=>(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")})})]}),uh=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]})]})},dh=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)(uh,{item:e},t))})}),r.length>0&&(0,u.jsx)(ch,{})]})},ph=function(e){const{debug:t}=e,[r,n]=(0,o().useState)(t.database.current),{mutate:i}=ac({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)(Qn,{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))})]})]})})},hh=function(){const e=he(e=>e.pluginStatus.status),t=he(e=>e.pluginStatus.debug);return dt({queryKey:Pn.settings.status(),queryFn:async()=>{try{const e=await jt(Xt());return he.getState().setPluginStatus(e),e}catch(e){throw En(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)(fc,{}),(0,u.jsx)("h2",{children:(0,a.__)("Plugin Status","redirection")}),e.length>0&&(0,u.jsx)(dh,{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)(ph,{debug:t}),!t&&(0,u.jsx)("div",{className:"placeholder-inline",children:(0,u.jsx)("div",{className:"wpl-placeholder__loading"})})]})},fh=function(){return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(hh,{}),(0,u.jsx)(lh,{}),(0,u.jsx)(Xp,{})]})};function mh(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 gh(e){return mh(e,e=>e.protocol+"//"+(e.host||"")+(e.pathname||""))}function yh(e){return mh(e,e=>e.protocol+"//"+(e.host||""))}const _h=({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"})})})]}),vh=({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)(_h,{domain:n,asDomain:(yh(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")})})]}),bh=({relocate:e,siteDomain:t,onChange:r})=>{const n=((e,t)=>{if(t){const r=gh(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 xh(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 wh=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:xh(r,e,t)}),{code:(0,u.jsx)("code",{})})})})]});var s},jh=e=>{return"object"==typeof(t=e)&&null!=t&&"window"in t&&t.window===t?e.document:function(e){return kh(e)&&9===e.nodeType}(e)?e:e?.ownerDocument??("undefined"!=typeof document?document:void 0);var t},Sh=e=>{let t=jh(e);return t?.defaultView??("undefined"!=typeof window?window:void 0)};function kh(e){return null!==e&&"object"==typeof e&&"nodeType"in e&&"number"==typeof e.nodeType}function Ch(e,t){return!(!t||!e)&&e.contains(t)}const Th=(e=document)=>e.activeElement;function Eh(e){return e.target}const Ph="undefined"!=typeof document?o().useLayoutEffect:()=>{};function Rh(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function Oh(e){let t=(0,o().useRef)({isFocused:!1,observer:null});return Ph(()=>{const e=t.current;return()=>{e.observer&&(e.observer.disconnect(),e.observer=null)}},[]),(0,o().useCallback)(r=>{let n=Eh(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=Rh(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===Th()?null:Th();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 Nh(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 Ah(e){return"undefined"!=typeof window&&null!=window.navigator&&e.test(window.navigator.userAgentData?.platform||window.navigator.platform)}function Ih(e){let t=null;return()=>(null==t&&(t=e()),t)}const Fh=Ih(function(){return Ah(/^Mac/i)}),Dh=Ih(function(){return Ah(/^iPhone/i)}),Lh=Ih(function(){return Ah(/^iPad/i)||Fh()&&navigator.maxTouchPoints>1}),zh=Ih(function(){return Dh()||Lh()}),Mh=(Ih(function(){return Fh()||zh()}),Ih(function(){return Nh(/AppleWebKit/i)&&(zh()||!$h())})),$h=(Ih(function(){return Mh()&&!$h()&&!Bh()}),Ih(function(){return Nh(/Chrome|CriOS|CrMo/i)})),Uh=Ih(function(){return Nh(/Android/i)}),Bh=Ih(function(){return Nh(/(Firefox|FxiOS)/i)});let qh=null;function Wh(e,t,r=!0){let{metaKey:n,ctrlKey:i,altKey:o,shiftKey:s}=t;!Mh()&&Bh()&&window.event?.type?.startsWith("key")&&"_blank"===e.target&&(Fh()?n=!0:i=!0);let a=Mh()&&Fh()&&!Lh()?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});Wh.isOpening=r,function(e){if(function(){if(null==qh){qh=!1;try{document.createElement("div").focus({get preventScroll(){return qh=!0,!0}})}catch{}}return qh}())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),Wh.isOpening=!1}Wh.isOpening=!1;let Hh=null,Gh="keyboard";const Zh=new Set;let Kh=new Map,Vh=!1,Qh=!1;const Jh={Tab:!0,Escape:!0};function Yh(e,t){for(let r of Zh)r(e,t)}function Xh(e){Vh=!0,!Wh.isOpening&&function(e){return!(e.metaKey||!Fh()&&e.altKey||e.ctrlKey||"Control"===e.key||"Shift"===e.key||"Meta"===e.key)}(e)&&(Hh="keyboard",Gh="keyboard",Yh("keyboard",e))}function ef(e){Hh="pointer",Gh="pointerType"in e?e.pointerType:"mouse","mousedown"!==e.type&&"pointerdown"!==e.type||(Vh=!0,Yh("pointer",e))}function tf(e){var t;!Wh.isOpening&&(""===(t=e).pointerType&&t.isTrusted||(Uh()&&t.pointerType?"click"===t.type&&1===t.buttons:0===t.detail&&!t.pointerType))&&(Vh=!0,Hh="virtual",Gh="virtual")}function rf(e){let t=Eh(e),r=Sh(t),n=jh(t);t!==r?t!==n&&e.isTrusted&&(Vh||Qh||(Hh="virtual",Gh="virtual",Yh("virtual",e)),Vh=!1,Qh=!1):Qh=!0}function nf(){Vh=!1,Qh=!0}function of(e){if("undefined"==typeof window||"undefined"==typeof document)return;const t=Sh(e),r=jh(e);if(Kh.get(t))return;let n=t.HTMLElement.prototype.focus;Reflect.defineProperty(t.HTMLElement.prototype,"focus",{configurable:!0,writable:!0,value:function(){Vh=!0,n.apply(this,arguments)}}),r.addEventListener("keydown",Xh,!0),r.addEventListener("keyup",Xh,!0),r.addEventListener("click",tf,!0),t.addEventListener("focus",rf,!0),t.addEventListener("blur",nf,!1),"undefined"!=typeof PointerEvent&&(r.addEventListener("pointerdown",ef,!0),r.addEventListener("pointermove",ef,!0),r.addEventListener("pointerup",ef,!0)),t.addEventListener("beforeunload",()=>{sf(e)},{once:!0}),Kh.set(t,{focus:n})}const sf=(e,t)=>{const r=Sh(e),n=jh(e);t&&n.removeEventListener("DOMContentLoaded",t),Kh.has(r)&&(Reflect.defineProperty(r.HTMLElement.prototype,"focus",{configurable:!0,writable:!0,value:Kh.get(r).focus}),n.removeEventListener("keydown",Xh,!0),n.removeEventListener("keyup",Xh,!0),n.removeEventListener("click",tf,!0),r.removeEventListener("focus",rf,!0),r.removeEventListener("blur",nf,!1),"undefined"!=typeof PointerEvent&&(n.removeEventListener("pointerdown",ef,!0),n.removeEventListener("pointermove",ef,!0),n.removeEventListener("pointerup",ef,!0)),Kh.delete(r))};function af(){return"pointer"!==Hh}"undefined"!=typeof document&&function(e){const t=jh(e);let r;"loading"!==t.readyState?of(e):(r=()=>{of(e)},t.addEventListener("DOMContentLoaded",r))}();const lf=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function cf(){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 uf(e){let{isDisabled:t,onBlurWithin:r,onFocusWithin:n,onFocusWithinChange:i}=e,s=(0,o().useRef)({isFocusWithin:!1}),{addGlobalListener:a,removeAllGlobalListeners:l}=cf(),c=(0,o().useCallback)(e=>{Ch(e.currentTarget,Eh(e))&&s.current.isFocusWithin&&!Ch(e.currentTarget,e.relatedTarget)&&(s.current.isFocusWithin=!1,l(),r&&r(e),i&&i(!1))},[r,i,s,l]),u=Oh(c),d=(0,o().useCallback)(e=>{if(!Ch(e.currentTarget,Eh(e)))return;let t=Eh(e);const r=jh(t),o=Th(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=Eh(e);if(s.current.isFocusWithin&&!Ch(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=Rh(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 df(e={}){let{autoFocus:t=!1,isTextInput:r,within:n}=e,i=(0,o().useRef)({isFocused:!1,isFocusVisible:t||af()}),[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=af(),a(e),u()},[u]);var p,h,f;p=e=>{i.current.isFocusVisible=e,u()},h=[r,s],f={enabled:s,isTextInput:r},of(),(0,o().useEffect)(()=>{if(!1===f?.enabled)return;let e=(e,t)=>{(function(e,t,r){let n=r?Eh(r):void 0,i=jh(n),o=Sh(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=Th(i);return!((e=e||u instanceof s&&!lf.has(u.type)||u instanceof a||u instanceof l&&u.isContentEditable)&&"keyboard"===t&&r instanceof c&&!Jh[r.key])})(!!f?.isTextInput,e,t)&&p(af())};return Zh.add(e),()=>{Zh.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(Eh(e)===e.currentTarget)return n&&n(e),i&&i(!1),!0},[n,i]),a=Oh(s),l=(0,o().useCallback)(e=>{let t=Eh(e);const n=jh(t),o=n?Th(n):Th();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}=uf({isDisabled:!n,onFocusWithinChange:d});return{isFocused:s,isFocusVisible:l,focusProps:n?g:m}}let pf=!1,hf=0;function ff(e){"touch"===e.pointerType&&(pf=!0,setTimeout(()=>{pf=!1},500))}function mf(){let e=jh(null);if(void 0!==e)return 0===hf&&"undefined"!=typeof PointerEvent&&e.addEventListener("pointerup",ff),hf++,()=>{hf--,hf>0||"undefined"!=typeof PointerEvent&&e.removeEventListener("pointerup",ff)}}function gf(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)(mf,[]);let{addGlobalListener:c,removeAllGlobalListeners:u}=cf(),{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=>{pf&&"mouse"===n.pointerType||((n,o)=>{if(l.pointerType=o,i||"touch"===o||l.isHovered||!Ch(n.currentTarget,Eh(n)))return;l.isHovered=!0;let s=n.currentTarget;l.target=s,c(jh(Eh(n)),"pointerover",t=>{l.isHovered&&l.target&&!Ch(l.target,Eh(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&&Ch(t.currentTarget,Eh(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 yf=Object.defineProperty,_f=(e,t,r)=>(((e,t,r)=>{t in e?yf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r})(e,"symbol"!=typeof t?t+"":t,r),r);let vf=new class{constructor(){_f(this,"current",this.detect()),_f(this,"handoffState","pending"),_f(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 bf(e){var t;return vf.isServer?null:null==e?document:null!=(t=null==e?void 0:e.ownerDocument)?t:document}function xf(e){var t,r;return vf.isServer?null:null==e?document:null!=(r=null==(t=null==e?void 0:e.getRootNode)?void 0:t.call(e))?r:document}function wf(e){var t,r;return null!=(r=null==(t=xf(e))?void 0:t.activeElement)?r:null}function jf(e){"function"==typeof queueMicrotask?queueMicrotask(e):Promise.resolve().then(e).catch(e=>setTimeout(()=>{throw e}))}function Sf(){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 jf(()=>{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=Sf();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 kf(){let[e]=(0,o().useState)(Sf);return(0,o().useEffect)(()=>()=>e.dispose(),[e]),e}let Cf=(e,t)=>{vf.isServer?(0,o().useEffect)(e,t):(0,o().useLayoutEffect)(e,t)};function Tf(e){let t=(0,o().useRef)(e);return Cf(()=>{t.current=e},[e]),t}let Ef=function(e){let t=Tf(e);return o().useCallback((...e)=>t.current(...e),[t])};function Pf({disabled:e=!1}={}){let t=(0,o().useRef)(null),[r,n]=(0,o().useState)(!1),i=kf(),s=Ef(()=>{t.current=null,n(!1),i.dispose()}),a=Ef(e=>{if(i.dispose(),null===t.current){t.current=e.currentTarget,n(!0);{let r=bf(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 Rf(e){if(null===e)return{width:0,height:0};let{width:t,height:r}=e.getBoundingClientRect();return{width:t,height:r}}function Of(e,t,r=!1){let[n,i]=(0,o().useState)(()=>Rf(t));return Cf(()=>{if(!t||!e)return;let r=Sf();return r.requestAnimationFrame(function e(){r.requestAnimationFrame(e),i(e=>{let r=Rf(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 Nf(e){return function(e){return"object"==typeof e&&null!==e&&"nodeType"in e}(e)&&"tagName"in e}function Af(e){return Nf(e)&&"accessKey"in e}function If(e){return Nf(e)&&"tabIndex"in e}function Ff(e){return Af(e)&&"FIELDSET"===e.nodeName}function Df(e){return Af(e)&&"LEGEND"===e.nodeName}function Lf(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,Lf),n}let zf=["[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(","),Mf=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var $f,Uf=(($f=Uf||{})[$f.First=1]="First",$f[$f.Previous=2]="Previous",$f[$f.Next=4]="Next",$f[$f.Last=8]="Last",$f[$f.WrapAround=16]="WrapAround",$f[$f.NoScroll=32]="NoScroll",$f[$f.AutoFocus=64]="AutoFocus",$f),Bf=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(Bf||{}),qf=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(qf||{});function Wf(e=document.body){return null==e?[]:Array.from(e.querySelectorAll(zf)).sort((e,t)=>Math.sign((e.tabIndex||Number.MAX_SAFE_INTEGER)-(t.tabIndex||Number.MAX_SAFE_INTEGER)))}var Hf=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(Hf||{});function Gf(e,t=0){var r;return e!==(null==(r=bf(e))?void 0:r.body)&&Lf(t,{0:()=>e.matches(zf),1(){let t=e;for(;null!==t;){if(t.matches(zf))return!0;t=t.parentElement}return!1}})}var Zf=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(Zf||{});"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 Kf=["textarea","input"].join(",");function Vf(e,t,{sorted:r=!0,relativeTo:n=null,skipElements:i=[]}={}){let o=Array.isArray(e)?e.length>0?xf(e[0]):document:xf(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(Mf)).sort((e,t)=>Math.sign((e.tabIndex||Number.MAX_SAFE_INTEGER)-(t.tabIndex||Number.MAX_SAFE_INTEGER)))}(e):Wf(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!==wf(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,Kf))&&r}(a)&&a.select(),2}function Qf(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function Jf(){return Qf()||/Android/gi.test(window.navigator.userAgent)}function Yf(e,t,r,n){let i=Tf(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 Xf(e,t,r,n){let i=Tf(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 em(e,t,r){let n=Tf(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!Gf(i,Hf.Loose)&&-1!==i.tabIndex&&e.preventDefault(),n.current(e,i)},[n,t]),s=(0,o().useRef)(null);Yf(e,"pointerdown",e=>{var t,r;Jf()||(s.current=(null==(r=null==(t=e.composedPath)?void 0:t.call(e))?void 0:r[0])||e.target)},!0),Yf(e,"pointerup",e=>{if(Jf()||!s.current)return;let t=s.current;return s.current=null,i(e,()=>t)},!0);let a=(0,o().useRef)({x:0,y:0});Yf(e,"touchstart",e=>{a.current.x=e.touches[0].clientX,a.current.y=e.touches[0].clientY},!0),Yf(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,()=>If(e.target)?e.target:null)},!0),Xf(e,"blur",e=>i(e,()=>{return Af(e=window.document.activeElement)&&"IFRAME"===e.nodeName?window.document.activeElement:null;var e}),!0)}function tm(...e){return(0,o().useMemo)(()=>bf(...e),[...e])}function rm(...e){return Array.from(new Set(e.flatMap(e=>"string"==typeof e?e.split(" "):[]))).filter(Boolean).join(" ")}var nm=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(nm||{}),im=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(im||{});function om(){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:am;let l=lm(t,e);if(o)return sm(l,r,n,s,a);let c=null!=i?i:0;if(2&c){let{static:e=!1,...t}=l;if(e)return sm(t,r,n,s,a)}if(1&c){let{unmount:e=!0,...t}=l;return Lf(e?0:1,{0:()=>null,1:()=>sm({...t,hidden:!0,style:{display:"none"}},r,n,s,a)})}return sm(l,r,n,s,a)}({mergeRefs:e,...t}),[e])}function sm(e,t={},r,n,i){let{as:s=r,children:a,refName:l="ref",...c}=pm(e,["unmount","static"]),u=void 0!==e.ref?{[l]:e.ref}:{},d="function"==typeof a?a(t):a;d=fm(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(mm(s)&&(Object.keys(dm(c)).length>0||Object.keys(dm(p)).length>0)){if(!(!(0,o().isValidElement)(d)||Array.isArray(d)&&d.length>1||function(e){return mm(e.type)}(d))){let e=d.props,t=null==e?void 0:e.className,r="function"==typeof t?(...e)=>rm(t(...e),c.className):rm(t,c.className),n=r?{className:r}:{},s=lm(d.props,dm(pm(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(hm(d),u.ref)},n))}if(Object.keys(dm(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(dm(c)).concat(Object.keys(dm(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({},pm(c,["ref"]),!mm(s)&&u,!mm(s)&&p),d)}function am(...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 lm(...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 cm(...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 um(e){var t;return Object.assign((0,o().forwardRef)(e),{displayName:null!=(t=e.displayName)?t:e.name})}function dm(e){let t=Object.assign({},e);for(let e in t)void 0===t[e]&&delete t[e];return t}function pm(e,t=[]){let r=Object.assign({},e);for(let e of t)e in r&&delete r[e];return r}function hm(e){return o().version.split(".")[0]>="19"?e.props.ref:e.ref}function fm(e){if(null!=e&&e.$$typeof===Symbol.for("react.lazy")){let t=e._payload;if(null!=t&&"fulfilled"===t.status)return fm(t.value)}return e}function mm(e){return e===o().Fragment||e===Symbol.for("react.fragment")}var gm,ym=((gm=ym||{})[gm.None=1]="None",gm[gm.Focusable=2]="Focusable",gm[gm.Hidden=4]="Hidden",gm);let _m=um(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 om()({ourProps:o,theirProps:i,slot:{},defaultTag:"span",name:"Hidden"})}),vm=(0,o().createContext)(null);function bm({children:e,node:t}){let[r,n]=(0,o().useState)(null),i=xm(null!=t?t:r);return o().createElement(vm.Provider,{value:i},e,null===i&&o().createElement(_m,{features:ym.Hidden,ref:e=>{var t,r;if(e)for(let i of null!=(r=null==(t=bf(e))?void 0:t.querySelectorAll("html > *, body > *"))?r:[])if(i!==document.body&&i!==document.head&&Nf(i)&&null!=i&&i.contains(e)){n(i);break}}}))}function xm(e=null){var t;return null!=(t=(0,o().useContext)(vm))?t:e}function wm(){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 jm(){return Qf()?{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=Sf();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(If(t.target))try{let r=t.target.closest("a");if(!r)return;let{hash:i}=new URL(r.href),s=e.querySelector(i);If(s)&&!n(s)&&(o=s)}catch{}},!0),t.group(r=>{t.addEventListener(e,"touchstart",e=>{if(r.dispose(),If(e.target)&&function(e){return Nf(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(If(e.target)){if(function(e){return Af(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 Sm(e){let t={};for(let r of e)Object.assign(t,r(t));return t}let km=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:Sf(),meta:new Set,computedMeta:{}};return n.count++,n.meta.add(t),n.computedMeta=Sm(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=Sm(r.meta)),this},SCROLL_PREVENT(e){let t={doc:e.doc,d:e.d,meta:()=>e.computedMeta},r=[jm(),wm(),{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)}});km.subscribe(()=>{let e=km.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)&&km.dispatch(r.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",r),0===r.count&&km.dispatch("TEARDOWN",r)}});class Cm 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 Tm,Em,Pm,Rm=Object.defineProperty,Om=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},Nm=(e,t,r)=>(Om(e,t,"read from private field"),r?r.call(e):t.get(e)),Am=(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)},Im=(e,t,r,n)=>(Om(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class Fm{constructor(e){Am(this,Tm,{}),Am(this,Em,new Cm(()=>new Set)),Am(this,Pm,new Set),((e,t,r)=>{((e,t,r)=>{t in e?Rm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r})(e,"symbol"!=typeof t?t+"":t,r)})(this,"disposables",Sf()),Im(this,Tm,e),vf.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return Nm(this,Tm)}subscribe(e,t){if(vf.isServer)return()=>{};let r={selector:e,callback:t,current:e(Nm(this,Tm))};return Nm(this,Pm).add(r),this.disposables.add(()=>{Nm(this,Pm).delete(r)})}on(e,t){return vf.isServer?()=>{}:(Nm(this,Em).get(e).add(t),this.disposables.add(()=>{Nm(this,Em).get(e).delete(t)}))}send(e){let t=this.reduce(Nm(this,Tm),e);if(t!==Nm(this,Tm)){Im(this,Tm,t);for(let e of Nm(this,Pm)){let t=e.selector(Nm(this,Tm));Dm(e.current,t)||(e.current=t,e.callback(t))}for(let t of Nm(this,Em).get(e.type))t(Nm(this,Tm),e)}}}function Dm(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&&Lm(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size===t.size&&Lm(e.entries(),t.entries()):!(!zm(e)||!zm(t))&&Lm(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()))}function Lm(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 zm(e){if("[object Object]"!==Object.prototype.toString.call(e))return!1;let t=Object.getPrototypeOf(e);return null===t||null===Object.getPrototypeOf(t)}Tm=new WeakMap,Em=new WeakMap,Pm=new WeakMap;var Mm=Object.defineProperty,$m=(e,t,r)=>(((e,t,r)=>{t in e?Mm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r})(e,"symbol"!=typeof t?t+"":t,r),r),Um=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(Um||{});let Bm={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 qm extends Fm{constructor(){super(...arguments),$m(this,"actions",{push:e=>this.send({type:0,id:e}),pop:e=>this.send({type:1,id:e})}),$m(this,"selectors",{isTop:(e,t)=>e.stack[e.stack.length-1]===t,inStack:(e,t)=>e.stack.includes(t)})}static new(){return new qm({stack:[]})}reduce(e,t){return Lf(t.type,Bm,e,t)}}const Wm=new Cm(()=>qm.new());function Hm(e,t,r=Dm){return(0,n().useSyncExternalStoreWithSelector)(Ef(t=>e.subscribe(Gm,t)),Ef(()=>e.state),Ef(()=>e.state),Ef(t),r)}function Gm(e){return e}function Zm(e,t,r=()=>[document.body]){let n=function(e){let t=(0,o().useId)(),r=Wm.get("scroll-lock"),[n,i]=Hm(r,(0,o().useCallback)(e=>[r.selectors.isTop(e,t),r.selectors.inStack(e,t)],[r,t]));return Cf(()=>{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)}(km),i=t?n.get(t):void 0,s=!!i&&i.count>0;Cf(()=>{if(t&&e)return km.dispatch("PUSH",t,r),()=>km.dispatch("POP",t,r)},[e,t])}(n,t,e=>{var t;return{containers:[...null!=(t=e.containers)?t:[],r]}})}function Km(e){return(0,o().useMemo)(()=>e,Object.values(e))}i();let Vm=Symbol();function Qm(e,t=!0){return Object.assign(e,{[Vm]:t})}function Jm(...e){let t=(0,o().useRef)(e);(0,o().useEffect)(()=>{t.current=e},[e]);let r=Ef(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[Vm]))?void 0:r}var Ym,Xm,eg=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(eg||{});function tg(){let e=(0,o().useRef)(0);return Xf(!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==(Ym=null==process?void 0:{NODE_ENV:"production"})?void 0:Ym.NODE_ENV)&&void 0===(null==(Xm=null==Element?void 0:Element.prototype)?void 0:Xm.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 rg=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(rg||{});function ng(e){let t={};for(let r in e)!0===e[r]&&(t[`data-${r}`]="");return t}function ig(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=kf();return Cf(()=>{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=Sf();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=Sf();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 og=(0,o().createContext)(()=>{});function sg({value:e,children:t}){return o().createElement(og.Provider,{value:e},t)}const ag=Math.min,lg=Math.max,cg=Math.round,ug=Math.floor,dg=e=>({x:e,y:e}),pg={left:"right",right:"left",bottom:"top",top:"bottom"};function hg(e,t){return"function"==typeof e?e(t):e}function fg(e){return e.split("-")[0]}function mg(e){return e.split("-")[1]}function gg(e){return"x"===e?"y":"x"}function yg(e){return"y"===e?"height":"width"}function _g(e){const t=e[0];return"t"===t||"b"===t?"y":"x"}function vg(e){return gg(_g(e))}function bg(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const xg=["left","right"],wg=["right","left"],jg=["top","bottom"],Sg=["bottom","top"];function kg(e){const t=fg(e);return pg[t]+e.slice(t.length)}function Cg(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 Tg(){return"undefined"!=typeof window}function Eg(e){return Og(e)?(e.nodeName||"").toLowerCase():"#document"}function Pg(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Rg(e){var t;return null==(t=(Og(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function Og(e){return!!Tg()&&(e instanceof Node||e instanceof Pg(e).Node)}function Ng(e){return!!Tg()&&(e instanceof Element||e instanceof Pg(e).Element)}function Ag(e){return!!Tg()&&(e instanceof HTMLElement||e instanceof Pg(e).HTMLElement)}function Ig(e){return!(!Tg()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof Pg(e).ShadowRoot)}function Fg(e){const{overflow:t,overflowX:r,overflowY:n,display:i}=Hg(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&"inline"!==i&&"contents"!==i}function Dg(e){return/^(table|td|th)$/.test(Eg(e))}function Lg(e){try{if(e.matches(":popover-open"))return!0}catch(e){}try{return e.matches(":modal")}catch(e){return!1}}const zg=/transform|translate|scale|rotate|perspective|filter/,Mg=/paint|layout|strict|content/,$g=e=>!!e&&"none"!==e;let Ug;function Bg(e){const t=Ng(e)?Hg(e):e;return $g(t.transform)||$g(t.translate)||$g(t.scale)||$g(t.rotate)||$g(t.perspective)||!qg()&&($g(t.backdropFilter)||$g(t.filter))||zg.test(t.willChange||"")||Mg.test(t.contain||"")}function qg(){return null==Ug&&(Ug="undefined"!=typeof CSS&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Ug}function Wg(e){return/^(html|body|#document)$/.test(Eg(e))}function Hg(e){return Pg(e).getComputedStyle(e)}function Gg(e){return Ng(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Zg(e){if("html"===Eg(e))return e;const t=e.assignedSlot||e.parentNode||Ig(e)&&e.host||Rg(e);return Ig(t)?t.host:t}function Kg(e){const t=Zg(e);return Wg(t)?(e.ownerDocument||e).body:Ag(t)&&Fg(t)?t:Kg(t)}function Vg(e,t,r){var n;void 0===t&&(t=[]),void 0===r&&(r=!0);const i=Kg(e),o=i===(null==(n=e.ownerDocument)?void 0:n.body),s=Pg(i);if(o){const e=Qg(s);return t.concat(s,s.visualViewport||[],Fg(i)?i:[],e&&r?Vg(e):[])}return t.concat(i,Vg(i,[],r))}function Qg(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Jg(e,t,r){let{reference:n,floating:i}=e;const o=_g(t),s=vg(t),a=yg(s),l=fg(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=mg(t);return f&&(h[s]+=p*("end"===f?1:-1)*(r&&c?-1:1)),h}async function Yg(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}=hg(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=Cg(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})),y="floating"===d?{x:n,y:i,width:s.floating.width,height:s.floating.height}:s.reference,_=await(null==o.getOffsetParent?void 0:o.getOffsetParent(a.floating)),v=await(null==o.isElement?void 0:o.isElement(_))&&await(null==o.getScale?void 0:o.getScale(_))||{x:1,y:1},b=Cg(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:y,offsetParent:_,strategy:l}):y);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 Xg=new Set(["left","top"]);function ey(e){const t=Hg(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const i=Ag(e),o=i?e.offsetWidth:r,s=i?e.offsetHeight:n,a=cg(r)!==o||cg(n)!==s;return a&&(r=o,n=s),{width:r,height:n,$:a}}function ty(e){return Ng(e)?e:e.contextElement}function ry(e){const t=ty(e);if(!Ag(t))return dg(1);const r=t.getBoundingClientRect(),{width:n,height:i,$:o}=ey(t);let s=(o?cg(r.width):r.width)/n,a=(o?cg(r.height):r.height)/i;return s&&Number.isFinite(s)||(s=1),a&&Number.isFinite(a)||(a=1),{x:s,y:a}}const ny=dg(0);function iy(e){const t=Pg(e);return qg()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:ny}function oy(e,t,r,n){void 0===t&&(t=!1),void 0===r&&(r=!1);const i=e.getBoundingClientRect(),o=ty(e);let s=dg(1);t&&(n?Ng(n)&&(s=ry(n)):s=ry(e));const a=function(e,t,r){return void 0===t&&(t=!1),!!r&&t&&r===Pg(e)}(o,r,n)?iy(o):dg(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=Pg(o),t=Ng(n)?Pg(n):n;let r=e,i=Qg(r);for(;i&&t!==r;){const e=ry(i),t=i.getBoundingClientRect(),n=Hg(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=Pg(i),i=Qg(r)}}return Cg({width:u,height:d,x:l,y:c})}function sy(e,t){const r=Gg(e).scrollLeft;return t?t.left+r:oy(Rg(e)).left+r}function ay(e,t){const r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-sy(e,r),y:r.top+t.scrollTop}}function ly(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=Pg(e),o=Rg(e),s=i.visualViewport;let a=o.clientWidth,l=o.clientHeight,c=0,u=0;if(s){const e=!qg()||"fixed"===t;n?e||(c=-s.offsetLeft,u=-s.offsetTop):(a=s.width,l=s.height,e&&(c=s.offsetLeft,u=s.offsetTop))}if(sy(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=Gg(e),r=e.ownerDocument.body,n=lg(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),i=lg(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-t.scrollLeft+sy(e);const s=-t.scrollTop;return"rtl"===Hg(r).direction&&(o+=lg(e.clientWidth,r.clientWidth)-n),{width:n,height:i,x:o,y:s}}(Rg(e));else if(Ng(t))n=function(e,t){const r=oy(e,!0,"fixed"===t),n=r.top+e.clientTop,i=r.left+e.clientLeft,o=ry(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=iy(e);n={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return Cg(n)}function cy(e,t,r){const n=Ag(t),i=Rg(t),o="fixed"===r,s=oy(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const l=dg(0);if((n||!o)&&(("body"!==Eg(t)||Fg(i))&&(a=Gg(t)),n)){const e=oy(t,!0,o,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}!n&&i&&(l.x=sy(i));const c=!i||n||o?dg(0):ay(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 uy(e){return"static"===Hg(e).position}function dy(e,t){if(!Ag(e)||"fixed"===Hg(e).position)return null;if(t)return t(e);let r=e.offsetParent;return Rg(e)===r&&(r=r.ownerDocument.body),r}function py(e,t){const r=Pg(e);if(Lg(e))return r;if(!Ag(e)){let t=Zg(e);for(;t&&!Wg(t);){if(Ng(t)&&!uy(t))return t;t=Zg(t)}return r}let n=dy(e,t);for(;n&&Dg(n)&&uy(n);)n=dy(n,t);return n&&Wg(n)&&uy(n)&&!Bg(n)?r:n||function(e){let t=Zg(e);for(;Ag(t)&&!Wg(t);){if(Bg(t))return t;if(Lg(t))return null;t=Zg(t)}return null}(e)||r}const hy={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:r,offsetParent:n,strategy:i}=e;const o="fixed"===i,s=Rg(n),a=!!t&&Lg(t.floating);if(n===s||a&&o)return r;let l={scrollLeft:0,scrollTop:0},c=dg(1);const u=dg(0),d=Ag(n);if((d||!o)&&(("body"!==Eg(n)||Fg(s))&&(l=Gg(n)),d)){const e=oy(n);c=ry(n),u.x=e.x+n.clientLeft,u.y=e.y+n.clientTop}const p=!s||d||o?dg(0):ay(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:Rg,getClippingRect:function(e){let{element:t,boundary:r,rootBoundary:n,strategy:i}=e;const o=[..."clippingAncestors"===r?Lg(t)?[]:function(e,t){const r=t.get(e);if(r)return r;let n=Vg(e,[],!1).filter(e=>Ng(e)&&"body"!==Eg(e)),i=null;const o="fixed"===Hg(e).position;let s=o?Zg(e):e;for(;Ng(s)&&!Wg(s);){const e=Hg(s),t=Bg(s),r=i?i.position:o?"fixed":"";t||"fixed"!==r&&("absolute"!==r||"static"!==e.position)?i=e:n=n.filter(e=>e!==s),s=Zg(s)}return t.set(e,n),n}(t,this._c):[].concat(r),n],s=ly(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=ly(t,o[e],i);a=lg(r.top,a),l=ag(r.right,l),c=ag(r.bottom,c),u=lg(r.left,u)}return{width:l-u,height:c-a,x:u,y:a}},getOffsetParent:py,getElementRects:async function(e){const t=this.getOffsetParent||py,r=this.getDimensions,n=await r(e.floating);return{reference:cy(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}=ey(e);return{width:t,height:r}},getScale:ry,isElement:Ng,isRTL:function(e){return"rtl"===Hg(e).direction}};function fy(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function my(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=ty(e),u=i||o?[...c?Vg(c):[],...t?Vg(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=Rg(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:-ug(d)+"px "+-ug(o.clientWidth-(u+p))+"px "+-ug(o.clientHeight-(d+h))+"px "+-ug(u)+"px",threshold:lg(0,ag(1,l))||1};let m=!0;function g(t){const r=t[0].intersectionRatio;if(!fy(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=Pg(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?oy(e):null;return l&&function t(){const n=oy(e);m&&!fy(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 gy=Yg,yy=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}=hg(e,t);if(null!=(r=o.arrow)&&r.alignmentOffset)return{};const y=fg(i),_=_g(a),v=fg(a)===a,b=await(null==l.isRTL?void 0:l.isRTL(c.floating)),x=p||(v||!m?[kg(a)]:function(e){const t=kg(e);return[bg(e),t,bg(t)]}(a)),w="none"!==f;!p&&w&&x.push(...function(e,t,r,n){const i=mg(e);let o=function(e,t,r){switch(e){case"top":case"bottom":return r?t?wg:xg:t?xg:wg;case"left":case"right":return t?jg:Sg;default:return[]}}(fg(e),"start"===r,n);return i&&(o=o.map(e=>e+"-"+i),t&&(o=o.concat(o.map(bg)))),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[y]),d){const e=function(e,t,r){void 0===r&&(r=!1);const n=mg(e),i=vg(e),o=yg(i);let s="x"===i?n===(r?"end":"start")?"right":"left":"start"===n?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=kg(s)),[s,kg(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||_===_g(t)||C.every(e=>_g(e.placement)!==_||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 P;const e=null==(P=C.filter(e=>{if(w){const t=_g(e.placement);return t===_||"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:P[0];e&&(r=e);break}case"initialPlacement":r=a}if(i!==r)return{reset:{placement:r}}}return{}}}},_y=(e,t,r)=>{const n=new Map,i=null!=r?r:{},o={...hy,...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:Yg},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}=Jg(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:y}=m,{x:_,y:v,data:b,reset:x}=await y({x:u,y:d,initialPlacement:n,placement:p,strategy:i,middlewareData:f,rects:c,platform:a,elements:{reference:e,floating:t}});u=null!=_?_: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}=Jg(c,p,l))),r=-1)}return{x:u,y:d,placement:p,strategy:i,middlewareData:f}})(e,t,{...i,platform:o})};var vy="undefined"!=typeof document?o().useLayoutEffect:function(){};function by(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(!by(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||by(e[r],t[r])))return!1}return!0}return e!=e&&t!=t}function xy(e){return"undefined"==typeof window?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function wy(e,t){const r=xy(e);return Math.round(t*r)/r}function jy(e){const t=o().useRef(e);return vy(()=>{t.current=e}),t}const Sy=(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=fg(r),a=mg(r),l="y"===_g(r),c=Xg.has(s)?-1:1,u=o&&l?-1:1,d=hg(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]}},ky=(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}=hg(e,t),u={x:r,y:n},d=await o.detectOverflow(t,c),p=_g(i),h=gg(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"],lg(r,ag(n,i));var r,n,i};s&&(f=g(h,f)),a&&(m=g(p,m));const y=l.fn({...t,[h]:f,[p]:m});return{...y,data:{x:y.x-r,y:y.y-n,enabled:{[h]:s,[p]:a}}}}}}(e);return{name:r.name,fn:r.fn,options:[e,t]}},Cy=(e,t)=>{const r=yy(e);return{name:r.name,fn:r.fn,options:[e,t]}},Ty=(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}=hg(e,t),l=await i.detectOverflow(t,a),c=fg(r),u=mg(r),d="y"===_g(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,y=p-l.left-l.right,_=ag(h-l[f],g),v=ag(p-l[m],y),b=t.middlewareData.shift,x=!b;let w=_,j=v;null!=b&&b.enabled.x&&(j=y),null!=b&&b.enabled.y&&(w=g),x&&!u&&(d?j=p-2*lg(l.left,l.right):w=h-2*lg(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]}},Ey={...l()},Py=Ey.useInsertionEffect||(e=>e());function Ry(e){const t=o().useRef(()=>{});return Py(()=>{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 Oy="undefined"!=typeof document?o().useLayoutEffect:o().useEffect;let Ny=!1,Ay=0;const Iy=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Ay++,Fy=Ey.useId||function(){const[e,t]=o().useState(()=>Ny?Iy():void 0);return Oy(()=>{null==e&&t(Iy())},[]),o().useEffect(()=>{Ny=!0},[]),e};const Dy=o().createContext(null),Ly=o().createContext(null),zy="data-floating-ui-focusable";function My(e){void 0===e&&(e={});const{nodeId:t}=e,r=function(e){const{open:t=!1,onOpenChange:r,elements:n}=e,i=Fy(),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(Dy))?void 0:f.id)||null),[c,u]=o().useState(n.reference),d=Ry((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(Ly);Oy(()=>{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);by(f,n)||m(n);const[g,y]=o().useState(null),[_,v]=o().useState(null),b=o().useCallback(e=>{e!==S.current&&(S.current=e,y(e))},[]),x=o().useCallback(e=>{e!==k.current&&(k.current=e,v(e))},[]),w=a||g,j=l||_,S=o().useRef(null),k=o().useRef(null),C=o().useRef(p),T=null!=u,E=jy(u),P=jy(i),R=jy(d),O=o().useCallback(()=>{if(!S.current||!k.current)return;const e={placement:t,strategy:r,middleware:f};P.current&&(e.platform=P.current),_y(S.current,k.current,e).then(e=>{const t={...e,isPositioned:!1!==R.current};N.current&&!by(C.current,t)&&(C.current=t,s.flushSync(()=>{h(t)}))})},[f,t,r,P,R]);vy(()=>{!1===d&&C.current.isPositioned&&(C.current.isPositioned=!1,h(e=>({...e,isPositioned:!1})))},[d]);const N=o().useRef(!1);vy(()=>(N.current=!0,()=>{N.current=!1}),[]),vy(()=>{if(w&&(S.current=w),j&&(k.current=j),w&&j){if(E.current)return E.current(w,j,O);O()}},[w,j,O,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=wy(I.floating,p.x),n=wy(I.floating,p.y);return c?{...e,transform:"translate("+t+"px, "+n+"px)",...xy(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:O,refs:A,elements:I,floatingStyles:F}),[p,O,A,I,F])}({...e,elements:{...i,...c&&{reference:c}}}),m=o().useCallback(e=>{const t=Ng(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;u(t),f.refs.setReference(t)},[f.refs]),g=o().useCallback(e=>{(Ng(e)||null===e)&&(p.current=e,l(e)),(Ng(f.refs.reference.current)||null===f.refs.reference.current||null!==e&&!Ng(e))&&f.refs.setReference(e)},[f.refs]),y=o().useMemo(()=>({...f.refs,setReference:g,setPositionReference:m,domReference:p}),[f.refs,g,m]),_=o().useMemo(()=>({...f.elements,domReference:d}),[f.elements,d]),v=o().useMemo(()=>({...f,...n,refs:y,elements:_,nodeId:t}),[f,y,_,t,n]);return Oy(()=>{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:y,elements:_}),[f,y,_,v])}const $y="active",Uy="selected";function By(e,t,r){const n=new Map,i="item"===r;let o=e;if(i&&e){const{[$y]:t,[Uy]:__,...r}=e;o=r}return{..."floating"===r&&{tabIndex:-1,[zy]:""},...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&&[$y,Uy].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 qy(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}let Wy=(0,o().createContext)({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});Wy.displayName="FloatingContext";let Hy=(0,o().createContext)(null);function Gy(e=null){!1===e&&(e=null),"string"==typeof e&&(e={to:e});let t=(0,o().useContext)(Hy),r=(0,o().useMemo)(()=>e,[JSON.stringify(e,(e,t)=>{var r;return null!=(r=null==t?void 0:t.outerHTML)?r:t})]);Cf(()=>{null==t||t(null!=r?r:null)},[t,r]);let n=(0,o().useContext)(Wy);return(0,o().useMemo)(()=>[n.setFloating,e?n.styles:{}],[n.setFloating,e,n.styles])}function Zy({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){Cf(()=>{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=Ky(null!=(r=null==e?void 0:e.gap)?r:"var(--anchor-gap, 0)",t),s=Ky(null!=(n=null==e?void 0:e.offset)?n:"var(--anchor-offset, 0)",t),a=Ky(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(" ");Cf(()=>{d&&a(0)},[d]);let{refs:v,floatingStyles:b,context:x}=My({open:d,placement:"selection"===y?"center"===_?"bottom":`bottom-${_}`:"center"===_?`${y}`:`${y}-${_}`,strategy:"absolute",transform:!1,middleware:[Sy({mainAxis:"selection"===y?0:h,crossAxis:f}),ky({padding:m}),"selection"!==y&&Cy({padding:m}),"selection"===y&&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(Af(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}=hg(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,y=0!==f.clientTop,_=p===f;if(!h)return{};const v={...e,...await Sy(-h.offsetTop-p.clientTop-d.reference.height/2-h.offsetHeight/2-i).fn(e)},b=await gy(qy(v,f.scrollHeight+m+p.clientTop),u),x=await gy(v,{...u,elementContext:"reference"}),w=lg(0,b.top),j=v.y+w,k=f.scrollHeight>f.clientHeight?e=>e:cg,C=k(lg(0,f.scrollHeight+(g&&_||y?2*m:0)-w-lg(0,b.bottom)));if(f.style.maxHeight=C+"px",f.scrollTop=w,n){const e=f.offsetHeight<h.offsetHeight*ag(a,t.current.length)-1||x.top>=-l||x.bottom>=-l;s.flushSync(()=>n(e))}return r&&(r.current=await gy(qy({...v,y:j},f.offsetHeight+m+p.clientTop),u)),{y:j}}}):null,Ty({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:my}),[w=y,j=_]=x.placement.split("-");var S;"selection"===y&&(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=Ry(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=>By(t,e,"reference"),t),s=o().useCallback(t=>By(t,e,"floating"),r),a=o().useCallback(t=>By(t,e,"item"),n);return o().useMemo(()=>({getReferenceProps:i,getFloatingProps:s,getItemProps:a}),[i,s,a])}([C]),P=Ef(e=>{u(e),v.setFloating(e)});return o().createElement(Hy.Provider,{value:n},o().createElement(Wy.Provider,{value:{setFloating:P,setReference:v.setReference,styles:b,getReferenceProps:T,getFloatingProps:E,slot:k}},e))}function Ky(e,t,r=void 0){let n=kf(),i=Ef((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=Qy(e,t);return[i,r=>{let o=Vy(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=Qy(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 Cf(()=>{let[r,n]=i(e,t);if(l(r),n)return n(l)},[e,t]),a}function Vy(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,...Vy(n)]:[r]}return[]}function Qy(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}Hy.displayName="PlacementContext";let Jy=(0,o().createContext)(null);Jy.displayName="OpenClosedContext";var Yy=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(Yy||{});function Xy(){return(0,o().useContext)(Jy)}function e_({value:e,children:t}){return o().createElement(Jy.Provider,{value:e},t)}function t_({children:e}){return o().createElement(Jy.Provider,{value:null},e)}function r_(e){let t=e.parentElement,r=null;for(;t&&!Ff(t);)Df(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(Df(t))return!1;t=t.previousElementSibling}return!0}(r))&&n}var n_=(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))(n_||{});function i_(e){let t=Ef(e),r=(0,o().useRef)(!1);(0,o().useEffect)(()=>(r.current=!1,()=>{r.current=!0,jf(()=>{r.current&&t()})}),[t])}let o_=(0,o().createContext)(!1);let s_=o().Fragment,a_=um(function(e,t){let{ownerDocument:r=null,...n}=e,i=(0,o().useRef)(null),a=Jm(Qm(e=>{i.current=e}),t),c=tm(i.current),u=function(e){let t=(0,o().useContext)(o_),r=(0,o().useContext)(c_),[n,i]=(0,o().useState)(()=>{var n;if(!t&&null!==r)return null!=(n=r.current)?n:null;if(vf.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)(u_),p=kf(),h=function(){let e=function(){let e="undefined"==typeof document;return"useSyncExternalStore"in l()&&(e=>e.useSyncExternalStore)(l())(()=>()=>{},()=>!1,()=>!e)}(),[t,r]=o().useState(vf.isHandoffComplete);return t&&!1===vf.isHandoffComplete&&r(!1),o().useEffect(()=>{!0!==t&&r(!0)},[t]),o().useEffect(()=>vf.handoff(),[]),!e&&t}(),f=om();return i_(()=>{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:s_,name:"Portal"})),u):null}),l_=o().Fragment,c_=(0,o().createContext)(null),u_=(0,o().createContext)(null),d_=um(function(e,t){let r=Jm(t),{enabled:n=!0,ownerDocument:i,...s}=e,a=om();return n?o().createElement(a_,{...s,ownerDocument:i,ref:r}):a({ourProps:{ref:r},theirProps:s,slot:{},defaultTag:s_,name:"Portal"})}),p_=um(function(e,t){let{target:r,...n}=e,i={ref:Jm(t)},s=om();return o().createElement(c_.Provider,{value:r},s({ourProps:i,theirProps:n,defaultTag:l_,name:"Popover.Group"}))}),h_=Object.assign(d_,{Group:p_});var f_=Object.defineProperty,m_=(e,t,r)=>(((e,t,r)=>{t in e?f_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r})(e,"symbol"!=typeof t?t+"":t,r),r),g_=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(g_||{}),y_=(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))(y_||{});let v_={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 b_ extends Fm{constructor(e){super(e),m_(this,"actions",{close:()=>this.send({type:1}),refocusableClose:e=>{this.actions.close();let t=(()=>e?Af(e)?e:"current"in e&&Af(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})}),m_(this,"selectors",{isPortalled:e=>{var t;if(!e.button||!e.panel)return!1;let r=null!=(t=bf(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=Wf(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=Wm.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 b_({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 Lf(t.type,v_,e,t)}}const x_=(0,o().createContext)(null);function w_(e){let t=(0,o().useContext)(x_);if(null===t){let t=new Error(`<${e} /> is missing a parent <Popover /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,w_),t}return t}let j_=(0,o().createContext)(null);function S_(){return(0,o().useContext)(j_)}j_.displayName="PopoverGroupContext";let k_=(0,o().createContext)(null);k_.displayName="PopoverPanelContext";let C_=nm.RenderStrategy|nm.Static;function T_(e,t){let r=(0,o().useId)(),{id:n=`headlessui-popover-backdrop-${r}`,transition:i=!1,...s}=e,a=w_("Popover.Backdrop"),l=Hm(a,(0,o().useCallback)(e=>e.popoverState,[])),[c,u]=(0,o().useState)(null),d=Jm(t,u),p=Xy(),[h,f]=ig(i,c,null!==p?(p&Yy.Open)===Yy.Open:l===g_.Open),m=Ef(e=>{if(r_(e.currentTarget))return e.preventDefault();a.actions.close()}),g=Km({open:l===g_.Open}),y={ref:d,id:n,"aria-hidden":!0,onClick:m,...ng(f)};return om()({ourProps:y,theirProps:s,slot:g,defaultTag:"div",features:C_,visible:h,name:"Popover.Backdrop"})}let E_=nm.RenderStrategy|nm.Static,P_=um(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)(()=>b_.new({id:e,__demoMode:t}),[]);return i_(()=>r.dispose()),r}({id:n,__demoMode:i}),l=(0,o().useRef)(null),c=Jm(t,Qm(e=>{l.current=e})),[u,d,p,h,f]=Hm(a,(0,o().useCallback)(e=>[e.popoverState,e.button,e.panel,e.buttonId,e.panelId],[])),m=function(...e){return(0,o().useMemo)(()=>xf(...e),[...e])}(null!=(r=l.current)?r:d),g=Tf(h),y=Tf(f),_=(0,o().useMemo)(()=>({buttonId:g,panelId:y,close:a.actions.close}),[g,y,a]),v=S_(),b=null==v?void 0:v.registerPopover,x=Ef(()=>{var e,t;let r=wf(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(_),[b,_]);let[w,j]=function(){let e=(0,o().useContext)(u_),t=(0,o().useRef)([]),r=Ef(r=>(t.current.push(r),e&&e.register(r),()=>n(r))),n=Ef(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(u_.Provider,{value:i},e)},[i])]}(),S=xm(d),k=function({defaultContainers:e=[],portals:t,mainTreeNode:r}={}){let n=Ef(()=>{var n,i;let o=bf(r),s=[];for(let t of e)null!==t&&(Nf(t)?s.push(t):"current"in t&&Nf(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&&Nf(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:Ef(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=Tf(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&&If(e.target)&&a.state.popoverState===g_.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),em(u===g_.Open,k.resolveContainers,(e,t)=>{a.actions.close(),Gf(t,Hf.Loose)||(e.preventDefault(),null==d||d.focus())});let C=Km({open:u===g_.Open,close:a.actions.refocusableClose}),T=Hm(a,(0,o().useCallback)(e=>Lf(e.popoverState,{[g_.Open]:Yy.Open,[g_.Closed]:Yy.Closed}),[])),E={ref:c},P=om();return o().createElement(bm,{node:S},o().createElement(Zy,null,o().createElement(k_.Provider,{value:null},o().createElement(x_.Provider,{value:a},o().createElement(sg,{value:a.actions.refocusableClose},o().createElement(e_,{value:T},o().createElement(j,null,P({ourProps:E,theirProps:s,slot:C,defaultTag:"div",name:"Popover"}))))))))}),R_=um(function(e,t){let r=(0,o().useId)(),{id:n=`headlessui-popover-button-${r}`,disabled:i=!1,autoFocus:s=!1,...a}=e,l=w_("Popover.Button"),[c,u,d,p,h,f,m]=Hm(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),y=`headlessui-focus-sentinel-${(0,o().useId)()}`,_=S_(),v=null==_?void 0:_.closeOthers,b=null!==(0,o().useContext)(k_);(0,o().useEffect)(()=>{if(!b)return l.actions.setButtonId(n),()=>l.actions.setButtonId(null)},[b,n,l]);let[x]=(0,o().useState)(()=>Symbol()),w=Jm(g,t,(0,o().useContext)(Wy).setReference,Ef(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=Jm(g,t),S=Ef(e=>{var t,r,n;if(b){if(l.state.popoverState===g_.Closed)return;switch(e.key){case n_.Space:case n_.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 n_.Space:case n_.Enter:e.preventDefault(),e.stopPropagation(),l.state.popoverState===g_.Closed?(null==v||v(l.state.buttonId),l.actions.open()):l.actions.close();break;case n_.Escape:if(l.state.popoverState!==g_.Open)return null==v?void 0:v(l.state.buttonId);if(!g.current)return;let t=wf(g.current);if(t&&!g.current.contains(t))return;e.preventDefault(),e.stopPropagation(),l.actions.close()}}),k=Ef(e=>{b||e.key===n_.Space&&e.preventDefault()}),C=Ef(e=>{var t,r;r_(e.currentTarget)||i||(b?(l.actions.close(),null==(t=l.state.button)||t.focus()):(e.preventDefault(),e.stopPropagation(),l.state.popoverState===g_.Closed?(null==v||v(l.state.buttonId),l.actions.open()):l.actions.close(),null==(r=l.state.button)||r.focus()))}),T=Ef(e=>{e.preventDefault(),e.stopPropagation()}),{isFocusVisible:E,focusProps:P}=df({autoFocus:s}),{isHovered:R,hoverProps:O}=gf({isDisabled:i}),{pressed:N,pressProps:A}=Pf({disabled:i}),I=c===g_.Open,F=Km({open:I,active:N||I,disabled:i,hover:R,focus:E,autofocus:s}),D=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),L=cm(b?{ref:j,type:D,onKeyDown:S,onClick:C,disabled:i||void 0,autoFocus:s}:{ref:w,id:p,type:D,"aria-expanded":c===g_.Open,"aria-controls":h?f:void 0,disabled:i||void 0,autoFocus:s,onKeyDown:S,onKeyUp:k,onClick:C,onMouseDown:T},P,O,A),z=tg(),M=Ef(()=>{if(!Af(l.state.panel))return;let e=l.state.panel;Lf(z.current,{[eg.Forwards]:()=>Vf(e,Uf.First),[eg.Backwards]:()=>Vf(e,Uf.Last)})===Bf.Error&&Vf(Wf(xf(l.state.button)).filter(e=>"true"!==e.dataset.headlessuiFocusGuard),Lf(z.current,{[eg.Forwards]:Uf.Next,[eg.Backwards]:Uf.Previous}),{relativeTo:l.state.button})}),$=om();return o().createElement(o().Fragment,null,$({ourProps:L,theirProps:a,slot:F,defaultTag:"button",name:"Popover.Button"}),I&&!b&&u&&o().createElement(_m,{id:y,ref:m,features:ym.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:M}))}),O_=um(T_),N_=um(T_),A_=um(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=w_("Popover.Panel"),p=Hm(d,d.selectors.isPortalled),[h,f,m,g,y]=Hm(d,(0,o().useCallback)(e=>[e.popoverState,e.button,e.__demoMode,e.beforePanelSentinel,e.afterPanelSentinel],[])),_=`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]=Gy(x),S=function(){let{getFloatingProps:e,slot:t}=(0,o().useContext)(Wy);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=Jm(b,t,x?w:null,d.actions.setPanel,C),E=tm(f),P=tm(b.current);Cf(()=>(d.actions.setPanelId(n),()=>d.actions.setPanelId(null)),[n,d]);let R=Xy(),[O,N]=ig(c,k,null!==R?(R&Yy.Open)===Yy.Open:h===g_.Open);(function(e,t,r){let n=Tf(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:Af(t)?t:t.current;if(!r)return;let i=Sf();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])})(O,f,d.actions.close),Zm(!m&&l&&O,P);let A=Ef(e=>{var t;if(e.key===n_.Escape){if(d.state.popoverState!==g_.Open||!b.current)return;let r=wf(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===g_.Closed&&(null==(t=e.unmount)||t)&&d.actions.setPanel(null)},[h,e.unmount,e.static,d]),(0,o().useEffect)(()=>{if(m||!i||h!==g_.Open||!b.current)return;let e=wf(b.current);b.current.contains(e)||Vf(b.current,Uf.First)},[m,i,b.current,h]);let I=Km({open:h===g_.Open,close:d.actions.refocusableClose}),F=cm(x?S():{},{ref:T,id:n,onKeyDown:A,onBlur:i&&h===g_.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=y.current)?void 0:i.contains)&&o.call(i,s))&&s.focus({preventScroll:!0})))}:void 0,tabIndex:-1,style:{...u.style,...j,"--button-width":Of(O,f,!0).width},...ng(N)}),D=tg(),L=Ef(()=>{let e=b.current;e&&Lf(D.current,{[eg.Forwards]:()=>{var t;Vf(e,Uf.First)===Bf.Error&&(null==(t=d.state.afterPanelSentinel.current)||t.focus())},[eg.Backwards]:()=>{var e;null==(e=d.state.button)||e.focus({preventScroll:!0})}})}),z=Ef(()=>{let e=b.current;e&&Lf(D.current,{[eg.Forwards]:()=>{var e;if(!d.state.button)return;let t=Wf(null!=(e=xf(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)}Vf(i,Uf.First,{sorted:!1})},[eg.Backwards]:()=>{var t;Vf(e,Uf.Previous)===Bf.Error&&(null==(t=d.state.button)||t.focus())}})}),M=om();return o().createElement(t_,null,o().createElement(k_.Provider,{value:n},o().createElement(sg,{value:d.actions.refocusableClose},o().createElement(h_,{enabled:!!a&&(e.static||O),ownerDocument:E},O&&p&&o().createElement(_m,{id:_,ref:g,features:ym.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:L}),M({ourProps:F,theirProps:u,slot:I,defaultTag:"div",features:E_,visible:O,name:"Popover.Panel"}),O&&p&&o().createElement(_m,{id:v,ref:y,features:ym.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:z})))))}),I_=um(function(e,t){let r=(0,o().useRef)(null),n=Jm(r,t),[i,s]=(0,o().useState)([]),a=Ef(e=>{s(t=>{let r=t.indexOf(e);if(-1!==r){let e=t.slice();return e.splice(r,1),e}return t})}),l=Ef(e=>(s(t=>[...t,e]),()=>a(e))),c=Ef(()=>{var e;let t=xf(r.current);if(!t)return!1;let n=wf(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=Ef(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=Km({}),h=e,f={ref:n},m=om();return o().createElement(bm,null,o().createElement(j_.Provider,{value:d},m({ourProps:f,theirProps:h,slot:p,defaultTag:"div",name:"Popover.Group"})))}),F_=Object.assign(P_,{Button:R_,Backdrop:N_,Overlay:O_,Panel:A_,Group:I_}),D_=(0,o().createContext)(void 0),L_=um(function(e,t){var r;let n=(0,o().useContext)(D_),{disabled:i=n||!1,autoFocus:s=!1,...a}=e,{isFocusVisible:l,focusProps:c}=df({autoFocus:s}),{isHovered:u,hoverProps:d}=gf({isDisabled:i}),{pressed:p,pressProps:h}=Pf({disabled:i}),f=cm({ref:t,type:null!=(r=a.type)?r:"button",disabled:i||void 0,autoFocus:s},c,d,h),m=Km({disabled:i,hover:u,focus:l,active:p,autofocus:s});return om()({ourProps:f,theirProps:a,slot:m,defaultTag:"button",name:"Button"})}),z_=um(function(e,t){let r=(0,o().useContext)(og);return o().createElement(L_,{ref:t,...cm({onClick:r},e)})});function M_(e){const{options:t,disabled:r=!1,title:n,selected:i}=e;return(0,u.jsxs)(F_,{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)(gp,{})}),(0,u.jsx)(A_,{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)(z_,{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 $_=({headerValue:e,options:t,onChange:r})=>(0,u.jsx)(Qn,{items:t,name:"headerValue",value:e,onChange:e=>r({[e.target.name]:e.target.value})}),U_=e=>"<"+e+">",B_=(e,t)=>e.includes(U_(t));function q_(e,t){return"uri"===t?e.replace(/[^A-Za-z0-9-._~:/?#\[\]@!$&'()*+,;=]/g,""):"integer"===t?parseInt(e,10):e}const W_=({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)(Qn,{items:i,name:"headerValue",value:a,onChange:e=>{n({headerValue:e.target.value,headerSettings:{selected:e.target.value,replaceValue:""}})}}),B_(a,o)&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("label",{htmlFor:`header-replace-${o}`,children:U_(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(U_(o),e.target.value),headerSettings:{selected:a,replaceValue:q_(e.target.value,s)}})}})]})]})},H_=({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})})]}),G_=({headerValue:e,options:t,onChange:r})=>{const{choices:n,implode:i,wildCard:o}=t,s=e.split(i);return(0,u.jsx)(yp,{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})},Z_=e=>e.map(e=>({label:e,value:e})),K_={"X-UA-Compatible":{component:$_,info:"https://frankcode.net/2013/10/17/a-guide-to-ie-compatibility-view-and-x-ua-compatible/",default:"Chrome=1",options:Z_(["IE=EmulateIE7","IE=edge","Chrome=1"])},"X-Frame-Options":{component:W_,info:"",default:"deny",options:{choices:Z_(["deny","sameorigin","allow-from <URI>"]),replace:"URI",replaceType:"uri"}},"Strict-Transport-Security":{component:W_,default:"max-age=<expire-time>",info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security",options:{choices:Z_(["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:W_,default:"1; mode=block",info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-XSS-Protection",options:{choices:Z_(["0","1","1; mode=block","1; report=<URI>"]),replace:"URI",replaceType:"uri"}},"X-Content-Type-Options":{component:$_,default:"nosniff",info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options",options:Z_(["nosniff"])},"Feature-Policy":{component:H_,info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Feature-Policy"},"Permissions-Policy":{component:H_,info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Permissions-Policy",default:"camera=(), display-capture=(), geolocation=(), microphone=()"},"Clear-Site-Data":{component:G_,info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Clear-Site-Data",default:"cache",options:{choices:Z_(["cache","cookies","storage","executionContexts"]),implode:",",wildCard:"*"}},"Referrer-Policy":{component:$_,default:"no-referrer-when-downgrade",info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy",options:Z_(["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:H_,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:G_,info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Methods",default:"GET",options:{choices:Z_(["GET","POST","PUT","HEAD","DELETE","OPTIONS"]),implode:",",wildCard:"*"}},"Access-Control-Allow-Credentials":{component:$_,default:"true",info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Credentials",options:Z_(["true"])},"Access-Control-Allow-Origin":{component:W_,default:"<origin>",info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin",options:{choices:Z_(["<origin>","*"]),replace:"origin",replaceType:"uri"}},"X-Robots-Tag":{component:G_,default:"noindex",info:"https://developers.google.com/search/reference/robots_meta_tag#xrobotstag",options:{choices:Z_(["noindex","nofollow","none","noarchive","nosnippet","notranslate","noimageindex"]),implode:",",wildCard:"all"}},"Access-Control-Allow-Headers":{component:H_,info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Headers"},"Access-Control-Max-Age":{component:H_,info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Max-Age"},"Access-Control-Expose-Headers":{component:H_,info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Expose-Headers"}},V_=e=>{const t=K_[e];return t&&t.options?t.options:null},Q_=e=>{const t=K_[e];return t&&t.default?t.default:""},J_=({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?Q_(n):e.headerValue,headerSettings:"type"===r?V_(o):e.headerSettings,headerName:o,[r]:n})},p=((e,t,r,n,i)=>{const o=K_[s=e]?K_[s].component:H_;var s;return(0,u.jsx)(o,{headerName:t,headerValue:""===r?Q_(e):r,headerSettings:n,options:V_(e),onChange:i})})(l,i,o,s,c),h=(e=>{const t=K_[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)(Qn,{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)(Qn,{items:[{label:(0,a.__)("General","redirection"),value:Z_(["X-UA-Compatible","X-Robots-Tag"])},{label:"CORS",value:Z_(["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:Z_(["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"})})})]})},Y_=(e="X-Robots-Tag",t="nofollow",r={})=>({location:"site",type:e,headerName:e,headerValue:t,headerSettings:r}),X_=({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)(J_,{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)(M_,{options:i,selected:r,title:s?s.label:i[0]?.label||"",onSelect:r=>{n(r),((e,t,r)=>{"header"===e?r({headers:t.concat([Y_()])}):"security"===e?r({headers:t.concat([Y_("X-Frame-Options","deny"),Y_("X-XSS-Protection","1; mode=block"),Y_("X-Content-Type-Options","nosniff"),Y_("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?Y_("Strict-Transport-Security","max-age: 31536000; includeSubDomains"):null,Y_("Referrer-Policy","no-referrer-when-downgrade")].filter(e=>e))}):"cors"===e&&r({headers:t.concat([Y_("Access-Control-Allow-Origin","*"),Y_("Access-Control-Allow-Credentials","true"),Y_("Access-Control-Allow-Methods","POST,GET,OPTIONS"),Y_("Access-Control-Allow-Headers","origin"),Y_("Referrer-Policy","no-referrer-when-downgrade"),Y_("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")})]})},ev=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"})})})]})},tv=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)(ev,{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 rv(){const e=yh(Redirectioni10n.pluginRoot),t=he(e=>e.loadStatus),r=he(e=>e.values),n=he(e=>e.saveStatus);nc();const{mutate:i}=ic(),[s,l]=(0,o().useState)(!1),[c,d]=(0,o().useState)(""),[p,h]=(0,o().useState)([]),[f,m]=(0,o().useState)(""),[g,y]=(0,o().useState)([]),[_,v]=(0,o().useState)([]);(0,o().useEffect)(()=>{r&&(l(r.https||!1),d(r.preferred_domain||""),h(r.headers||[]),m(r.relocate||""),y(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&&y(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(yh),relocate:gh(f),permalinks:_})},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)(bh,{relocate:f,siteDomain:e,onChange:b}),0===f.length&&(0,u.jsx)(vh,{aliases:g,siteDomain:e,onChange:b}),0===f.length&&(0,u.jsx)(wh,{https:s,siteDomain:e,preferredDomain:c,onChange:b}),0===f.length&&(0,u.jsx)(tv,{permalinks:_,onChange:b}),(0,u.jsx)(X_,{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)(hu,{})}const nv=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}],iv=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:ov(e).map(e=>e.value)}],ov=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")}],sv=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},av=window.Redirectioni10n?.per_page?parseInt(window.Redirectioni10n.per_page,10):25,lv={page:0,per_page:av,orderby:"id",direction:"desc",selected:[],filterBy:{},displayType:"standard",displaySelected:["last_count","last_access","source","target","code","title"],groupBy:""},cv={page:0,per_page:av,orderby:"name",direction:"desc",selected:[],filterBy:{},displayType:"standard",displaySelected:["name","module","redirects"],groupBy:""},uv={page:0,per_page:av,orderby:"",direction:"desc",selected:[],filterBy:{},displayType:"standard",displaySelected:["date","url","target","agent","ip"],groupBy:""},dv={page:0,per_page:av,orderby:"",direction:"desc",selected:[],filterBy:{},displayType:"standard",displaySelected:["date","url","agent","ip"],groupBy:""},pv={redirects:lv,groups:cv,logs:uv,errors:dv,redirectsAddTop:!1},hv=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=>({...pv,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:lv,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:cv}),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:uv}),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:dv}),reset:()=>e(pv)}),{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 fv(e){return function(e,t){return new e(Ss({type:"number",coerce:!0,checks:[],...Ir(t)}))}(xl,e)}const mv=Al({id:Fl([wl().int(),Qa()]),created:Qa().optional(),created_time:Qa().optional(),url:Qa().optional(),sent_to:Qa().optional().nullable(),agent:Qa().optional().nullable(),referrer:Qa().optional().nullable(),ip:Qa().optional().nullable(),domain:Qa().optional().nullable(),redirect_id:wl().int().optional(),redirection_id:wl().int().optional(),request_method:Qa().optional().nullable(),http_code:wl().int().optional(),request_data:El().optional().nullable(),redirect_by:Qa().optional().nullable(),count:fv().int().optional()}),gv=Al({id:Fl([wl().int(),Qa()]),created:Qa().optional(),created_time:Qa().optional(),url:Qa().optional(),agent:Qa().optional().nullable(),referrer:Qa().optional().nullable(),domain:Qa().optional().nullable(),ip:Qa().optional().nullable(),http_code:wl().int().optional(),request_method:Qa().optional().nullable(),request_data:El().optional().nullable(),count:fv().int().optional()}),yv=Pp(mv),_v=Pp(gv);function vv(e){const t=p(),{incrementProgress:r,decrementProgress:n,addNotice:i,addError:o}=On(),{setErrorsTable:s}=hv();return ft({mutationFn:async({action:e,items:t,params:i={}})=>{r();try{return await jt(ar(e,{items:t},i))}catch(e){throw n(),En(e)}},onSuccess:(e,r)=>{n();const o="delete"===r.action?"deleted":r.action;i(`404 errors ${o}`),s(Ip(r.params)),t.invalidateQueries({queryKey:Pn.errors.all})},onError:e=>{o(e.message||"Failed to perform 404 error action")},...e})}function bv(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 xv="loading",wv="complete",jv=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})]})})},Sv=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})})},kv=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)})]})},Cv=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)(kv,{onSelect:r,disabled:t||l,selected:a}),i.map(e=>{const{primary:t=!1,sortable:r=!0}=e;return r?(0,u.jsx)(jv,{table:o,name:e.name,title:e.title,onSetOrderBy:n,primary:t},e.name):(0,u.jsx)(Sv,{name:e.name,title:e.title,primary:t},e.name)})]})},Tv=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"})})]})},Ev=e=>{const{headers:t,rows:r}=e;return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(Tv,{columns:t}),r.slice(0,-1).map((e,r)=>(0,u.jsx)(Tv,{columns:t},r))]})},Pv=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")})})},Rv=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")})})})},Ov=(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)(Hn,{size:"small"}):(0,u.jsx)("input",{type:"checkbox",name:"item[]",value:n,disabled:r,checked:l,onChange:d,onClick:c})})});function Nv(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 Av=(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,y=function(e,t,r){return{isLoading:e===xv,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===xv||"saving"===n,saving:o||s}),children:[!!p&&(0,u.jsx)(Ov,{id:t.id,rowIndex:r,onSelect:p,...h?{onShiftSelect:h}:{},disabled:n===xv,isSelected:i,isSaving:o||s}),(0,u.jsx)(Nv,{row:t,rowData:y,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),Iv=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]),y=(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===xv&&0===t.length?(0,u.jsx)(Ev,{headers:r,rows:t}):n===wv&&0===t.length?(0,u.jsx)(Pv,{headers:r}):"error"===n?(0,u.jsx)(Rv,{headers:r}):(0,u.jsx)(u.Fragment,{children:t.map((e,t)=>(0,u.jsx)(Av,{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:y}:{},primary:h,headersLength:r.length},e.id))})},Fv=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)(Cv,{table:o,disabled:s!==wv||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)(Iv,{rows:i,table:o,headers:t,status:s,getRow:r,getRowActions:n,...l?{onSelect:l}:{},saving:a})}),(0,u.jsx)("tfoot",{children:d})]})})},Dv=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})]})},Lv=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)(Dv,{title:(0,a.__)("First page","redirection"),button:"«",className:"first-page",disabled:t<=0,onClick:()=>i(0)}),(0,u.jsx)(Dv,{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)(Dv,{title:(0,a.__)("Next page","redirection"),button:"›",className:"next-page",disabled:t>=d-1,onClick:()=>i(t+1)}),(0,u.jsx)(Dv,{title:(0,a.__)("Last page","redirection"),button:"»",className:"last-page",disabled:t>=d-1,onClick:()=>i(d-1)})]})},zv=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)(Lv,{onChangePage:o,total:t,perPage:r,page:n},n)})]})},Mv=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)(zv,{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})]})},$v=({children:e})=>(0,u.jsx)("div",{className:"alignleft actions",children:e}),Uv=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)(Qn,{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 Bv(e,t){return e.options.find(e=>e.value===t)}function qv(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 Wv=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)(Uv,{selected:t.groupBy?t.groupBy:"",options:n,isEnabled:!r,onGroup:o},t.groupBy),i.length>0&&(0,u.jsx)($v,{children:(0,u.jsx)(yp,{options:i,selected:qv(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=>Bv(e,n));e&&(t[e.value]=n)}}s(t)}},title:(0,a.__)("Filters","redirection"),disabled:r,multiple:!0,badges:!0})})]})},Hv=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 Gv(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 Zv=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)(yp,{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:Gv(l,d),disabled:t})};function Kv(e,t){if(e){const r=e.find(e=>t[e.name]);return r&&t[r.name]||""}return""}const Vv=function({table:e,onSearch:t,searchTypes:r,selected:n,disabled:i=!1,name:s=""}){const a=r?.find(e=>n[e.name]),l=Kv(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=Kv(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 y=i||""===d&&""===e.filter,_=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)(M_,{options:_,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:y})]})},Qv=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)(Zv,{disabled:t,customOptions:r,predefinedGroups:i,table:o,setDisplay:s,...l?{validation:l}:{}}),(0,u.jsx)(Vv,{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})]})},Jv=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:y,headers:_,validateDisplay:v}=t,{onChangePage:b,onFilter:x,onSetDisplay:w,onBulk:j,onGroup:S,onSetOrder:k,onSetAll:C,onSelect:T}=r,E=c===xv;return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(Qv,{filterOptions:p,predefinedGroups:h,searchOptions:f,disabled:E,table:n,onFilter:x,onSetDisplay:w,...v?{validateDisplay:v}:{}}),(0,u.jsxs)(Mv,{total:i,rowCount:o.length,table:n,disabled:E,onChangePage:b,className:"top",onSelectAll:C,children:[(0,u.jsx)(Hv,{bulk:y,disabled:E||0===n.selected.length,onBulk:j}),(0,u.jsx)(Wv,{disabled:E,table:n,groupOptions:m,filterOptions:g,onGroup:S,onFilter:x})]}),(0,u.jsx)(Fv,{headers:_,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)(Mv,{total:i,rowCount:o.length,table:n,disabled:E,onChangePage:b,className:"bottom",onSelectAll:C,children:[(0,u.jsx)(Hv,{bulk:y,disabled:E||0===n.selected.length,onBulk:j}),l&&l()]})]})};function Yv(e){return Redirectioni10n?.caps?.capabilities.includes(e)}function Xv(e){return Redirectioni10n?.caps?.pages.includes(e)}const eb="redirection_cap_redirect_manage",tb="redirection_cap_redirect_add",rb="redirection_cap_group_add",nb="redirection_cap_404_delete";function ib(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 ob(e){const{onClick:t,children:r,href:n="",capability:i=""}=e;return i&&!Yv(i)?null:(0,u.jsx)("a",{href:n||"#",onClick:function(e){t&&(e.preventDefault(),t())},children:r})}const sb=()=>(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 ab(e){return!!(e&&e.name&&e.version)&&e.name+" "+e.version}function lb({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 cb({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 ub({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=ab(t.os),o=ab(t.browser),s=ab(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)(sb,{})]})}function db({agent:e}){const{data:t,isLoading:r,isError:n,error:i}=function(e,t){return dt({queryKey:Pn.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)(Hn,{}),n&&a&&(0,u.jsx)(lb,{error:a}),!r&&!n&&!s&&(0,u.jsx)(cb,{agent:e}),!r&&!n&&s&&(0,u.jsx)(ub,{agent:e,detail:s})]})}const pb=function(e){const{agent:t}=e,[r,n]=(0,o().useState)(!1);return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(ob,{href:"https://redirect.li/agent/?agent="+encodeURIComponent(t),onClick:()=>n(!0),children:(0,a.__)("Agent Info","redirection")}),r&&(0,u.jsx)(Qp,{onClose:()=>n(!1),children:(0,u.jsx)(db,{agent:t})})]})},hb=({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,fb=({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,mb=({data:e})=>{const{headers:t,source:r}=e;return(0,u.jsxs)("div",{className:"redirect-requestdata",children:[t&&(0,u.jsx)(hb,{headers:t}),r&&(0,u.jsx)(fb,{source:r})]})},gb=function(e){const{data:t}=e,[r,n]=(0,o().useState)(!1);return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(ob,{onClick:()=>n(!0),children:(0,a.__)("View Data","redirection")}),r&&(0,u.jsx)(Qp,{onClose:()=>n(!1),children:(0,u.jsx)(mb,{data:t})})]})},yb=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}=hv(),p=[];return p.push((0,u.jsx)(ob,{onClick:()=>r(s),capability:"redirection_cap_log_delete",children:(0,a.__)("Delete","redirection")},"0")),o&&p.unshift((0,u.jsx)(pb,{agent:o},"3")),l&&p.push((0,u.jsx)(gb,{data:l},"4")),c&&c>0&&p.push((0,u.jsx)(ob,{href:Redirectioni10n.pluginRoot+"&"+encodeURIComponent("filterby[id]")+"="+c,children:(0,a.__)("View Redirect","redirection")},"5")),i&&p.push((0,u.jsx)(ob,{onClick:()=>d({filterBy:Fp(i,String(s)),page:0,groupBy:"",selected:[],selectAll:!1}),capability:eb,children:(0,a.__)("Show All","redirection")},"6")),(0,u.jsx)(ib,{disabled:n,actions:p})},_b=e=>{const{enabled:t=!0,children:r}=e;return t?(0,u.jsx)("div",{className:"table-buttons",children:r}):null};var vb=r(465),bb=r.n(vb);function xb(e){return e.url?$p(Up(e.domain),e.url):""}function wb(e,t){if(!e.sent_to)return"";const r=t.target||"",n=/^https?:\/\//i.test(e.sent_to)?e.sent_to:$p(Up(e.domain),e.sent_to);return(0,u.jsx)(A,{url:n,children:(0,u.jsx)(bb(),{searchWords:[r],textToHighlight:e.sent_to,autoEscape:!0})})}function jb(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 Sb(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 kb(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 Cb(e){return"json"===e?(0,a.__)("JSON (complete data)","redirection"):kb(e)}function Tb(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 Eb(e){return e.includes("url")?e:e.concat(["url"])}const Pb=function(){const e=hv(e=>e.logs),{setLogsTable:t,setLogsSelected:r}=hv(),n=he(e=>e.values),i=n?.token||"";bv({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}=On(),{setLogsTable:o}=hv();return ft({mutationFn:async({action:e,items:n,params:i={}})=>{t();try{return await jt(sr(e,{items:n},i))}catch(e){throw r(),En(e)}},onSuccess:(t,i)=>{r();const s="delete"===i.action?"deleted":i.action;n(`Logs ${s}`),o(Ip(i.params)),e.invalidateQueries({queryKey:Pn.logs.all})},onError:e=>{i(e.message||"Failed to perform log action")}})}(),s=Dn(),{data:l,isLoading:c,isSuccess:d}=function(e={},t){const r=Lp(e);return dt({queryKey:Pn.logs.list(r),placeholderData:e=>e,queryFn:async()=>{try{const e=await jt(zt(r));return yv.parse(e)}catch(e){const t=En(e);throw On.getState().addError(t.message||"Failed to fetch logs"),t}},...t})}(e),h=l?.items??[],f=l?.total??0;let m="idle";c&&!l?m=xv:(d||l)&&(m=wv);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})},y=e=>{t({filterBy:e,page:0,selected:[],selectAll:!1})},_={...e,...(v=e.groupBy,v?{displayOptions:ov(v),displaySelected:iv(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:_.displaySelected??[],groupBy:e.groupBy??""},x={displayFilters:ov(_.groupBy),displayGroups:iv(_.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:sv(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:_.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:nv(_.groupBy).filter(e=>function(e,t){return t.displaySelected.includes(e)}(e.name,_)),validateDisplay:Eb},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={...Lp({...e.groupBy?{groupBy:e.groupBy}:{},...e.selectAll?{global:!0,filterBy:e.filterBy}:{items:e.selected}}),displaySelected:_.displaySelected??[]};return void s.mutate({exportType:"log",format:"export-csv"===t?"csv":"json",download:!0,filename:Tb("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:Lp({...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: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.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)(Jv,{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:xb(e),children:(0,u.jsx)(bb(),{searchWords:[g],textToHighlight:i,autoEscape:!0})}):""},{name:"target",content:wb(e,m)},{name:"redirect_by",content:h||""},{name:"code",content:d??""},{name:"referrer",content:s?(0,u.jsx)(bb(),{searchWords:[m.referrer||""],textToHighlight:s,autoEscape:!0}):""},{name:"agent",content:o?(0,u.jsx)(bb(),{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)(bb(),{searchWords:[m.ip||""],textToHighlight:l,autoEscape:!0})}),""===t?.table?.groupBy&&t?.onFilter&&(0,u.jsx)(ib,{actions:[(0,u.jsx)(ob,{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:y}),getRowActions:t=>(0,u.jsx)(yb,{disabled:!1,row:t,onDelete:g,groupBy:e.groupBy}),renderTableActions:()=>(0,u.jsx)(u.Fragment,{children:(0,u.jsx)(_b,{enabled:h.length>0,children:i&&(0,u.jsx)("div",{className:"table-button-item",children:(0,u.jsx)("a",{href:Mp(i),className:"button-secondary",children:(0,a.__)("RSS","redirection")})})})})})},Rb="pass",Ob="nothing",Nb="login",Ab="referrer",Ib="agent",Fb="cookie",Db="header",Lb="custom",zb="role",Mb="server",$b="language";function Ub(e){return"url"===e||e===Rb}function Bb(e,t){if(e===Nb)return{logged_in:t?.logged_in||"",logged_out:t?.logged_out||""};if(e===Ab)return{referrer:t?.referrer||"",regex:t?.regex||!1,url_from:t?.url_from||"",url_notfrom:t?.url_notfrom||""};if(e===Ib)return{agent:t?.agent||"",regex:t?.regex||!1,url_from:t?.url_from||"",url_notfrom:t?.url_notfrom||""};if(e===Fb)return{name:t?.name||"",value:t?.value||"",regex:t?.regex||!1,url_from:t?.url_from||"",url_notfrom:t?.url_notfrom||""};if(e===Db)return{name:t?.name||"",value:t?.value||"",regex:t?.regex||!1,url_from:t?.url_from||"",url_notfrom:t?.url_notfrom||""};if(e===Lb)return{filter:t?.filter||"",url_from:t?.url_from||"",url_notfrom:t?.url_notfrom||""};if(e===zb)return{role:t?.role||"",url_from:t?.url_from||"",url_notfrom:t?.url_notfrom||""};if(e===Mb)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===$b?{language:t?.language||"",url_from:t?.url_from||"",url_notfrom:t?.url_notfrom||""}:t||{}}function qb(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 Wb=()=>[{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:Ab,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:$b,label:(0,a.__)("URL and language","redirection")}],Hb=()=>[{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:Ob,label:(0,a.__)("Do nothing (ignore)","redirection")}],Gb=()=>[{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")}],Zb=()=>[{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")}],Kb=()=>Gb().concat(Zb()),Vb=()=>[{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")}],Qb=()=>[{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")}],Jb=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")}],Yb=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}])},Xb=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 ex(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:tx(e).map(e=>e.value)}]}function tx(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 rx="^/.*$";function nx(e){return{url:rx,match_type:"ip",action_data:{ip:e},match_data:{source:{flag_regex:!0}}}}function ix(e,t){return"redirect-ip"===e||"ip"===e?{...nx(t),action_type:"url"}:"block"===e?{...nx(t),action_type:"error",action_code:403}:"agent"===e?{url:rx,match_type:"agent",action_data:{agent:t},match_data:{source:{flag_regex:!0}}}:{url:t,match_type:"url",action_type:"ignore"===e?Ob:"url"}}const ox=({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})]}),sx=({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),ax=({url:e,flags:t,onFlagChange:r,onChange:n,autoFocus:i=!1})=>{const o=Vb();return Array.isArray(e)?(0,u.jsx)(ox,{title:(0,a.__)("Source URL","redirection"),className:"top",children:(0,u.jsx)("textarea",{value:e.join("\n"),readOnly:!0})}):(0,u.jsxs)(ox,{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)(yp,{options:o,selected:sx(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})]})},lx=({query:e,regex:t,onChange:r,url:n})=>{if(t)return null;const i=!1===(Array.isArray(n)?n.join(""):n).includes("?")?Qb().filter(e=>"exactorder"!==e.value):Qb();return(0,u.jsx)(ox,{title:(0,a.__)("Query Parameters","redirection"),className:"redirect-edit__sourcequery",children:(0,u.jsx)(Qn,{name:"flag_query",items:i,value:e,onChange:r})})},cx=({groups:e,currentGroup:t,onChange:r})=>(0,u.jsx)(Qn,{name:"group",value:String(t),items:Bp(e),onChange:r}),ux=({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})]}),dx=function({title:e,onChange:t}){return(0,u.jsx)(ox,{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")})})},px=({actionType:e,actionCode:t,onChange:r})=>{const n=function(e){return"error"===e?Zb():"url"===e||"random"===e?Gb():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)(Qn,{name:"action_code",value:String(t),items:n,onChange:r})]}):null},hx=({actionType:e,matchType:t,onChange:r})=>(0,u.jsx)(Qn,{name:"action_type",value:e,items:Hb().filter(e=>!("login"===t&&!Ub(e.value))),onChange:r}),fx=({matchType:e,onChange:t})=>(0,u.jsx)(ox,{title:(0,a.__)("Match","redirection"),children:(0,u.jsx)(Qn,{name:"match_type",value:e,items:Wb(),onChange:t})}),mx=function({onChange:e,data:t}){const[r,n]=(0,o().useState)(""),{agent:i,regex:s}=t;return(0,u.jsxs)(ox,{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:"?"})})]})]})},gx=({data:e,onChange:t})=>{const{referrer:r,regex:n}=e;return(0,u.jsxs)(ox,{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:"?"})})]})]})},yx=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)(ox,{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)(ox,{children:(0,a.__)("Note it is your responsibility to pass HTTP headers to PHP. Please contact your hosting provider for support about this.","redirection")})]})},vx=({data:e,onChange:t})=>{const{filter:r}=e;return(0,u.jsx)(ox,{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")})})},bx=({data:e,onChange:t})=>{const{name:r,value:n,regex:i}=e;return(0,u.jsxs)(ox,{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:"?"})})]})]})},xx=({data:e,onChange:t})=>{const{role:r}=e;return(0,u.jsx)(ox,{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})})},wx=({data:e,onChange:t})=>{const{server:r}=e;return(0,u.jsx)(ox,{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})})},jx=({data:e,onChange:t})=>{const{ip:r=[]}=e;return(0,u.jsx)(ox,{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")}})}})})},Sx=()=>(0,u.jsx)(ox,{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")]})}),kx=({data:e,onChange:t})=>{const{language:r}=e;return(0,u.jsx)(ox,{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")})})},Cx=({matchType:e,actionData:t,onChange:r})=>{const n={[Ab]:gx,agent:mx,cookie:bx,header:yx,custom:vx,role:xx,server:wx,ip:jx,page:Sx,[$b]:kx};if(n[e]){const i=n[e];return(0,u.jsx)(i,{data:null===t?{}:t,onChange:r})}return null},Tx=({onChange:e,data:t})=>{const{logged_in:r,logged_out:n}=t;return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(ox,{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)(ox,{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 Ex=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"})})]})},Px=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)(bb(),{searchWords:[t],textToHighlight:e.title,autoEscape:!0})})},i))})},Rx=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:y=!1,onlyChoices:_=!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 y="undefined"!=typeof window,_=!t&&0!==t&&y;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){_&&cancelAnimationFrame(c.current),c.current=_?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(y||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&&(_?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 P(e){if(f)return O(e).map(t=>f(t,e))}function R(e){if(c>0){if(!O(n).find(t=>t===`${e.value}`)){const t=[`${e.value}`].concat(O(n).filter(t=>t!==`${e.value}`)).slice(0,c);r(1!==c||_?t:t[0],[e.title].concat(P(t)?.slice(1)||[])),g(e.value,e.title)}S("")}else S(e.value),r(e.value,P(n));w([])}function O(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&&O(n).map(e=>(0,u.jsx)(dp,{title:e,onCancel:()=>function(e){const t=O(n).filter(t=>t!==e);g(e,null),Array.isArray(n)?r(1===c?t[0]:t,P(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&&O(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);y&&!e&&E("")},onBlur:function(e){if(e.relatedTarget&&e.relatedTarget.closest(".wpl-dropdowntext__suggestions"))return;const t=`${(h?h(j):j)??""}`;0===x.length?_?S(""):c>0&&i?R({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)(Ex,{})}),x.length>0&&k.current&&(0,u.jsx)(sp,{align:"left",onClose:()=>w([]),popoverPosition:op(k.current),className:"wpl-dropdowntext__suggestions",focusLock:!1,children:(0,u.jsx)(Px,{options:x,value:j,onSelect:R,onClose:()=>w([])})})]})},Ox=function(e){const{onChange:t,url:r}=e;return(0,u.jsx)(Rx,{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||""})},Nx=({onChange:e,data:t})=>{const{url:r}=t;return(0,u.jsx)(ox,{title:(0,a.__)("Target URL","redirection"),className:"redirect-edit__target",children:(0,u.jsx)(Ox,{...void 0!==r?{url:r}:{},onChange:t=>e({target:{name:"url",value:t,type:"input"}})})})},Ax=({onChange:e,data:t})=>{const{url_from:r,url_notfrom:n}=t;return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(ox,{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)(ox,{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")})})]})},Ix=({actionType:e,matchType:t,actionData:r,onChange:n})=>{if(Ub(e)){const e="login"===(i=t)?Tx:"url"===i||"page"===i?Nx:Ax,o=Bb(t,r);return(0,u.jsx)(e,{data:null===o?{}:o,onChange:n})}var i;return null},Fx=(e,t)=>t.startsWith(e)||e.slice(0,t.length)===t,Dx=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||Fx(o,"https://")||Fx(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},Lx=({warnings:e})=>0===e.length?null:(0,u.jsx)(ox,{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 zx(e){const t=p(),{incrementProgress:r,decrementProgress:n,addNotice:i,addError:o}=On(),{setRedirectsTable:s}=hv();return ft({mutationFn:async({items:e,params:i={}})=>{r();try{return await t.cancelQueries({queryKey:Pn.redirects.lists()}),await jt(ir("delete",{items:e},i))}catch(e){throw n(),En(e)}},onSuccess:(e,r)=>{n(),i("Redirects deleted"),s(Ip(r.params)),t.invalidateQueries({queryKey:Pn.redirects.lists()})},onError:e=>{o(e.message||"Failed to delete redirects")},...e})}function Mx(e,t){const r=p(),{incrementProgress:n,decrementProgress:i,addNotice:o,addError:s}=On(),{setRedirectsSelected:a}=hv();return ft({mutationFn:async({items:t})=>{n();try{return await r.cancelQueries({queryKey:Pn.redirects.lists()}),await jt(ir(e,{items:t},{}))}catch(e){throw i(),En(e)}},onSuccess:()=>{i(),o(`Redirects ${e}d`),a([]),r.invalidateQueries({queryKey:Pn.redirects.lists()})},onError:t=>{s(t.message||`Failed to ${e} redirects`)},...t})}const $x=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}=zp(),g=(0,o().useMemo)(()=>h?.items??[],[h]),y=hv(e=>e.redirectsAddTop),_=hv(e=>e.redirects),{setRedirectsAddTop:v}=hv(),b=he(e=>e.values),x=On(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}=On();return ft({mutationFn:async n=>{t();try{await e.cancelQueries({queryKey:Pn.redirects.lists()});const{id:t,...r}=n,i=await jt(Ot(t,r));return Op.parse(i).item}catch(e){throw r(),En(e)}},onSuccess:t=>{r(),n("Redirect saved"),e.invalidateQueries({queryKey:Pn.redirects.lists()}),e.invalidateQueries({queryKey:Pn.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}=On();return ft({mutationFn:async n=>{t();try{await e.cancelQueries({queryKey:Pn.redirects.lists()});const t=await jt(Nt(n));return Rp.parse(t).items[0]??null}catch(e){throw r(),En(e)}},onSuccess:()=>{r(),n("Redirect created"),e.invalidateQueries({queryKey:Pn.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(_.filterBy&&"object"==typeof _.filterBy&&"group"in _.filterBy&&_.filterBy.group&&parseInt(String(_.filterBy.group),10)>0)return parseInt(String(_.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,_.filterBy]),P=g.length>0,R=f&&!P;(0,o().useEffect)(()=>{P?T.current=!1:f&&!T.current&&(T.current=!0,m())},[P,f,m]);const{url:O,match_data:N,match_type:A,action_type:I,action_data:F,group_id:D=0,title:L,action_code:z,position:M=0}=t,{flag_regex:$=!1,flag_trailing:U=!1,flag_case:B=!1,flag_query:q="exact"}=N?.source??{},W={url:O,title:L,flag_regex:$,flag_trailing:U,flag_case:B,flag_query:q,match_type:A,action_type:I,action_code:z,action_data:Bb(A,F),options:N?.options??{},group_id:E(D),position:M,warning:[],advanced:!1},[H,G]=(0,o().useState)(W),Z=(0,o().useCallback)(()=>{const{match_type:e,action_type:t,title:r,action_code:n}=H;return"url"===e&&"url"===t&&""===r&&301===n},[H]);(0,o().useEffect)(()=>{G(e=>({...e,advanced:!Z()}))},[]),(0,o().useEffect)(()=>{G(e=>({...e,warning:Dx(e)}))},[H.url,H.action_type,H.match_type,H.action_data]),(0,o().useEffect)(()=>{s&&C.current&&s(C.current.clientHeight)},[H,s]);const K=(0,o().useCallback)(()=>{const e=qb("",H.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:[]}))},[H.group_id,j]),V=(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:y,action_data:_,options:v}=H,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!==y?{position:y}:{},...void 0!==b?{group_id:b}:{},action_code:"number"==typeof m?m:parseInt(String(m),10),action_data:Bb(p,_)};l&&!l(Array.isArray(n))||(w.id?S({id:w.id,...w}):k(w),r?r(e):K(),i&&i())},[H,g,t.id,l,S,k,r,K,i,x]),Q=(0,o().useCallback)(e=>{G(t=>({...t,...e,warning:Dx({...t,...e})}))},[]),J=(0,o().useCallback)(e=>{e.preventDefault(),Q({advanced:!H.advanced})},[H.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=Bb(t.match_type,H.action_data),"login"===t.match_type&&(t.action_type="url"),Q(t)},[H.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===Rb?200:301),action_data:Bb(H.match_type,H.action_data||{})})},[H.match_type,H.action_data,ee,Q]),oe=(0,o().useCallback)(e=>{const t={action_data:{...H.action_data,...ee(e)}};Q(t)},[H.action_data,ee,Q]),se=(0,o().useCallback)(()=>{const{match_type:e,action_type:t,action_data:r,url:n,group_id:i}=H;return!(!P&&i<=0||0===n.length&&!w||Ub(t)&&(o=e,(!(s=r)||"url"!==o&&"page"!==o&&!(o===Nb?s.logged_in||s.logged_out:o===Ab?s.referrer:o===Ib?s.agent:o===Fb||o===Db?s.name&&s.value:o===Lb?s.filter:o===zb?s.role:o===Mb?s.server:"ip"===o?s.ip:o===$b&&s.language))&&""===w));var o,s},[H,w,P]),{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:ye,action_code:_e,options:ve,warning:be}=H,xe=R?[(0,a.__)("No groups are available. Reload the page before creating a redirect.","redirection"),...be]:be;return(0,u.jsx)("form",{onSubmit:V,ref:C,children:(0,u.jsx)("table",{className:"redirect-edit inline-edit-row",children:(0,u.jsxs)("tbody",{children:[(0,u.jsx)(ax,{url:ae,flags:H,defaultFlags:j,autoFocus:c??!1,onFlagChange:X,onChange:re}),(0,u.jsx)(lx,{query:fe,regex:ce,onChange:re,url:ae}),le&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(dx,{title:ye,onChange:e=>Q(e)}),(0,u.jsx)(fx,{matchType:de,onChange:te}),(0,u.jsx)(Cx,{matchType:de,actionData:pe,onChange:oe}),(0,u.jsxs)(ox,{title:(0,a.__)("When matched","redirection"),className:"redirect-edit__action",children:[(0,u.jsx)(hx,{actionType:ue,matchType:de,onChange:ie}),(0,u.jsx)(px,{actionType:ue,actionCode:_e,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)(Ix,{actionType:ue,matchType:de,actionData:pe,onChange:oe}),(0,u.jsxs)(ox,{title:(0,a.__)("Group","redirection"),className:"redirect-edit__group",children:[(0,u.jsx)(cx,{groups:g,currentGroup:me,onChange:Y}),le&&(0,u.jsx)(ux,{position:ge,onChange:re})]}),d&&d,(0,u.jsx)(ox,{children:(0,u.jsxs)("div",{className:"table-actions",children:[(0,u.jsx)(fu,{isPrimary:!0,isSecondary:!1,isSubmit:!0,disabled:!se(),children:n})," "," ",r&&(0,u.jsx)(fu,{onClick:r,children:(0,a.__)("Cancel","redirection")}),y&&!r&&(0,u.jsx)(fu,{onClick:e=>{e.preventDefault(),v(!1)},children:(0,a.__)("Close","redirection")})," ",Z()&&(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)(Lx,{warnings:xe})]})})})};const Ux=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}=vv(),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={...qb(Array.isArray(c)?c[0]??"":c,0,s),...r,url:c};return(0,u.jsx)(Qp,{onClose:t,padding:!0,children:(0,u.jsx)("div",{className:"add-new",children:(0,u.jsx)($x,{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:Yv(nb)&&(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")})]})]})})})})},Bx=function(e){const{row:t,onDelete:r,onCreate:n,table:i,disabled:o}=e,{setErrorsTable:s}=hv(),{url:l,ip:c,agent:d,id:p}=t,{groupBy:h}=i,f=[];return f.push((0,u.jsx)(ob,{onClick:()=>r(p),capability:nb,children:(0,a.__)("Delete","redirection")},"0")),f.push((0,u.jsx)(ob,{onClick:()=>n(ix(h,"ip"===h?[p]:""===h?l:p)),capability:tb,children:(0,a.__)("Add Redirect","redirection")},"1")),d&&f.unshift((0,u.jsx)(pb,{agent:d},"3")),f.push((0,u.jsx)(ob,{onClick:()=>{return e=Fp(h,""===h?t.url:String(t.id)),void s({filterBy:e,page:0,groupBy:"",selected:[],selectAll:!1});var e},capability:eb,children:(0,a.__)("Show All","redirection")},"4")),"ip"===h?f.push((0,u.jsx)(ob,{onClick:()=>n(ix("block",[c])),capability:tb,children:(0,a.__)("Block IP","redirection")},"5")):"agent"!==h&&f.push((0,u.jsx)(ob,{onClick:()=>n(ix("ignore",l)),capability:tb,children:(0,a.__)("Ignore URL","redirection")},"6")),(0,u.jsx)(ib,{disabled:o,actions:f})};function qx(e){return e.url?$p(Up(e.domain),e.url):""}function Wx(e){return e.includes("url")?e:e.concat(["url"])}const Hx=function(){const e=hv(e=>e.errors),{setErrorsTable:t,setErrorsSelected:r}=hv(),n=he(e=>e.values),[i,s]=(0,o().useState)(null);bv({table:e,setTable:t,allowedGroup:["url","ip","agent"],allowedFilters:["url","url-exact","referrer","agent","ip","domain","method"],pageName:"404s"});const l=vv(),c=Dn(),{data:d,isFetching:p}=function(e={},t){const r=Lp(e);return dt({queryKey:Pn.errors.list(r),placeholderData:e=>e,queryFn:async()=>{try{const e=await jt(Mt(r));return _v.parse(e)}catch(e){const t=En(e);throw On.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 y(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=xv:d&&(m=wv);const _=e=>{t({filterBy:e,page:0,selected:[],selectAll:!1})},v={...e,...(b=e.groupBy,b?{displayOptions:tx(b),displaySelected:ex(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:tx(v.groupBy),displayGroups:ex(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:Xb(n?.ip_logging||0),bulk:Yb(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:Kb().filter(e=>parseInt(e.value,10)>=400&&parseInt(e.value,10)<500)}],headers:Jb(v.groupBy).filter(e=>function(e,t){return t.displaySelected.includes(e)}(e.name,v)),validateDisplay:Wx},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={...Lp({...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:Tb("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:Lp({...r,global:!0,filterBy:e.filterBy})}):l.mutate({action:"delete",items:e.selected,params:r}):s(ix(t,e.selected))},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.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)(Ux,{onClose:()=>s(null),redirect:i,rows:h}),(0,u.jsx)(Jv,{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:qx(e),children:(0,u.jsx)(bb(),{searchWords:[m],textToHighlight:i,autoEscape:!0})}):""},{name:"code",content:p??""},{name:"referrer",content:s?(0,u.jsx)(bb(),{searchWords:[f.referrer||""],textToHighlight:s,autoEscape:!0}):""},{name:"agent",content:o?(0,u.jsx)(bb(),{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)(bb(),{searchWords:[f.ip||""],textToHighlight:l,autoEscape:!0})}),""===t?.table?.groupBy&&t?.onFilter&&(0,u.jsx)(ib,{actions:[(0,u.jsx)(ob,{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:_}),getRowActions:(e,t)=>(0,u.jsx)(Bx,{disabled:!1,row:e,onCreate:g,onDelete:y,table:t.table}),renderTableActions:()=>Yv(nb)&&function(e){const{filterBy:t,groupBy:r}=e;return void 0!==t.url||!r&&0===Object.keys(t).length}(v)?(0,u.jsx)(_b,{enabled:h.length>0,children:null}):(0,u.jsx)(u.Fragment,{})})]})},Gx=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)(zn,{error:t})]})},Zx=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},Kx=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)(Zx,{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})})},Vx=[",",";","|","\t"];function Qx(e){return e.name.toLowerCase().endsWith(".json")}function Jx(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 tw(e);const r=Yx(e);if(r.valid)return r;const n=ew(e);return n.valid?n:rw(e)}function Yx(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 Xx=["301","302","303","307","308"];function ew(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(!Xx.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 tw(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 rw(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 Vx){const n=e.map(e=>nw(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 ow(e,["source","target"])||ow(e,["source url","target url"])?"redirects":ow(e,["id","name","module_id","status"])?"groups":ow(e,["date","source","target","ip","referrer","agent"])?"logs":ow(e,["date","source","ip","referrer","useragent"])?"errors_404":null}(nw(r[0]||"",n.separator).map(iw));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}(nw(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 nw(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 iw(e){return e.trim().toLowerCase().replace(/\s+/g," ")}function ow(e,t){return!(e.length<t.length)&&t.every((t,r)=>e[r]===t)}function sw(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 aw=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}),y="file"!==e&&!1!==t;return(0,u.jsxs)("div",{className:g,onClick:y?p:void 0,onKeyDown:y?e=>{y&&("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),p()))}:void 0,role:y?"button":void 0,tabIndex:y?0:void 0,children:[(0,u.jsx)("input",{ref:n,type:"file",style:{display:"none"},onChange:h}),!1===t?(0,u.jsx)(Zx,{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)(Zx,{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")})})]})]})},lw=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=Bp(l),m="plugin"===e&&("wordpress-old-slugs"===t||"safe-redirect-manager"===t),g="file"===e||"paste"===e,y=g&&r&&d(r)?[{value:"0",label:(0,a.__)("Use groups in file","redirection")},...f]:f,_=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=_?Number(_.redirects||0)>0&&p.includes("redirects"):"plugin"===e||v||b||x,j=null!==_||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")}),_&&(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(_).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)(Qn,{items:y,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)(Qn,{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")})]})})]})]})},cw=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)(Zx,{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}`))})]})})})})},uw=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)(Zx,{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")})})]})},dw=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:y,onSelectFileImporter:_,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,y]=(0,o().useState)("import"),[_,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,P]=(0,o().useState)(!1),[R,O]=(0,o().useState)(null),N=(0,o().useRef)(null),A=(0,o().useRef)(0),I=(0,o().useRef)(!1),{data:F,isSuccess:D,refetch:L}=zp(),z=F?.items??[],M=z.length>0,{data:$=[],isLoading:U}=In(),B=$,q=Fn({onSuccess:(e,t)=>{const r="preview"===t.mode,n=e;P({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||[]}),O(r)}}),W=q.isPending,H=q.error||null,G=!1!==E&&!1===R,Z=B.find(e=>e.id===r)||null,K="paste"===e?p:u,V="file"===e||"paste"===e?!1!==K:null!==Z,Q="file"===e||"paste"===e||!0===Z?.preview_supported;let J="idle";W?J="loading":q.isSuccess&&(J="success"),(0,o().useEffect)(()=>()=>{d(!1),h(!1),m(""),t(null),n(null),P(!1),O(null)},[]),(0,o().useEffect)(()=>{M?I.current=!1:D&&!I.current&&(I.current=!0,L())},[M,D,L]),(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 ew(t);if(Qx(e))return tw(t);if(e.name.toLowerCase().endsWith(".csv"))return rw(t);if(e.name.toLowerCase().endsWith(".htaccess"))return Yx(t);const r=Jx(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:Qx(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=Jx(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(),P(!1),O(null),d(e),t("file"),n(null),x([]),e&&Qx(e)?s(0):z[0]&&s(z[0].id)},X=()=>{q.reset(),c(!1),d(!1),"file"===e&&t(null),P(!1),O(null),N.current&&(N.current.value="")},ee=()=>{q.reset(),h(!1),m(""),k(null),"paste"===e&&t(null),x([]),P(!1),O(null)};return{state:{activeImportType:e,activePluginId:r,group:i,hover:l,file:u,duplicateMode:g,deleteSource:_,fileInfo:w,pasteFile:p,pasteText:f,pasteInfo:S,isSniffing:C,currentError:H,selectedSections:b,lastImport:E,lastImportWasDryRun:R,groupRows:z,hasGroups:M,importers:B,isLoadingImporters:U,isImporting:W,hasCompletedImport:G,hasActiveImport:V,previewSupported:Q},fileInputRef:N,importingStatus:J,onAddFileClick:()=>{N.current?.click()},onCancel:()=>{q.reset(),t(null),n(null),y("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||!K?"plugin"===e&&Z?{sourceType:"plugin",mode:o,pluginId:Z.id,groupId:i,duplicateMode:g,deleteSource:_}:null:{sourceType:"file",mode:o,file:K,groupId:i,duplicateMode:g,deleteSource:_,importSections:b,format:sw("paste"===e?S:w)}),n=Z?.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))&&(P(!1),O(null),q.reset(),q.mutate(r))},onOptionsChange:e=>{const{name:t,value:r}=e.currentTarget;if("group"===t)q.reset(),s(parseInt(r,10)),P(!1),O(null);else if("duplicate_mode"===t)q.reset(),y(r),P(!1),O(null);else if("delete_source"===t&&e.currentTarget instanceof HTMLInputElement){const{checked:t}=e.currentTarget;q.reset(),v(t),P(!1),O(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)),P(!1),O(null)}},onSelectPasteImporter:()=>{f.trim().length>0&&(q.reset(),t("paste"),n(null),P(!1),O(null))},onPasteTextChange:e=>{const r=e.trim().length>0?Jx(e):null;q.reset(),P(!1),O(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),P(!1),O(null))},onSelectPlugin:o=>{if(q.reset(),P(!1),O(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)(aw,{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:_,onFileInputChange:f}),(0,u.jsx)(uw,{activeImportType:e.activeImportType,isImporting:e.isImporting,pasteInfo:e.pasteInfo,pasteText:e.pasteText,onClearPaste:l,onPasteTextChange:b,onSelect:v}),e.isLoadingImporters&&(0,u.jsx)(Zx,{title:"",className:"import-source-card import-source-card--placeholder",children:(0,u.jsx)(hu,{})}),e.importers.length>0&&(P=e.importers,(0,u.jsx)(u.Fragment,{children:P.map(t=>(0,u.jsx)(Kx,{plugin:t,onSelect:x,isActive:e.activePluginId===t.id&&"plugin"===e.activeImportType,isImporting:e.isImporting},t.id))}))]}),!e.hasCompletedImport&&(0,u.jsx)(lw,{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:Qx,selectedSections:e.selectedSections,onChange:y}),(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)(Gx,{error:e.currentError}),(0,u.jsx)(cw,{activeImportType:e.activeImportType,lastImport:e.lastImport,lastImportWasDryRun:e.lastImportWasDryRun})]})});var P},pw=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")})]})},hw=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:Cb(e)},e))})]})},fw=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)(hw,{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 mw(e){const t=window.Redirectioni10n?.locale||void 0;return new Intl.NumberFormat(t).format(e)}const gw=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:kb(e.format)},{label:(0,a.__)("Export","redirection"),value:jb(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:mw(t)})}return e.skipped&&i.push({label:(0,a.__)("Skipped (unsupported for this format)","redirection"),value:mw(e.skipped)}),(0,u.jsx)("div",{className:"export-results",children:(0,u.jsx)(Zx,{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 yw(e){const t=window.Redirectioni10n?.locale||void 0;return new Intl.NumberFormat(t).format(e)}const _w=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:yw(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)(Zx,{title:(0,a.__)("Export preview","redirection"),badge:o,meta:e,stats:i});var s},vw=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)(Zx,{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)})})},bw=[{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"]}],xw=function(){const{data:e}=zp(),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=Dn({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})}}),y=r.length>0,_=r.length===bw.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(Nn(e.exportTypes)){const t=e.redirectScopeType||"all",r=e.redirectModule||"all",n=e.redirectGroup||0;return Zt({types:e.exportTypes,scope_type:t,scope_value:An(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 Ht({scope_type:t,scope_value:An(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=bw.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=!y||x.isError||"number"!=typeof x.data?.total?null:x.data.total,P=!y||x.isError||"number"!=typeof x.data?.estimatedSize?null:x.data.estimatedSize,R=[{label:(0,a.__)("Export","redirection"),value:y?jb(r):(0,a.__)("No export selected","redirection")}];var O,N;b&&(R.push({label:(0,a.__)("Scope","redirection"),value:(O=i,N=j?j.name:(0,a.__)("Group","redirection"),"module"===O?(0,a.__)("Module","redirection"):"group"===O?N:(0,a.__)("Everything","redirection"))}),"module"===i&&R.push({label:(0,a.__)("Module","redirection"),value:Sb(l)})),y&&R.push({label:(0,a.__)("Format","redirection"),value:kb(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)(()=>{y&&C()},[y,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]?Tb(e[0],t):`redirection-export.${t}`}(r,p)),g.mutate(n)};return{exportTypes:bw,availableFormats:w,groupRows:t,summaryMeta:R,hasAllTypesSelected:_,hasSelectedTypes:y,state:{selectedTypes:r,redirectScopeType:i,redirectModule:l,redirectGroup:u,format:p,isExporting:S,isPreviewLoading:k,previewTotal:E,previewEstimatedSize:P,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?bw.map(e=>e.id):[]),m(!1)},onDownload:()=>A("download"),onView:()=>A("view")}},ww=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}=xw();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)(vw,{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)(fw,{selectedTypes:s.selectedTypes,format:s.format,availableFormats:t,disabled:s.isExporting||!i,onChange:(e,t)=>l(e,t)}),s.currentError&&(0,u.jsx)(Gx,{error:s.currentError}),(0,u.jsx)("div",{className:"export-summary",children:(0,u.jsx)(_w,{meta:o,isPreviewLoading:s.isPreviewLoading,previewTotal:s.previewTotal,previewEstimatedSize:s.previewEstimatedSize})}),(0,u.jsx)(pw,{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)(gw,{lastResult:s.lastResult})]})})},jw=()=>[{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")}],Sw=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 kw(e){const t=p(),{incrementProgress:r,decrementProgress:n,addNotice:i,addError:o}=On(),{setGroupsTable:s}=hv();return ft({mutationFn:async({action:e,items:i,params:o={}})=>{r();try{return await t.cancelQueries({queryKey:Pn.groups.lists()}),await jt(or(e,{items:i},o))}catch(e){throw n(),En(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:Pn.groups.lists()}),t.invalidateQueries({queryKey:Pn.groups.dropdown()})},onError:e=>{o(e.message||"Failed to perform group action")},...e})}const Cw=[{value:1,label:"WordPress"},{value:2,label:"Apache"},{value:3,label:"Nginx"}];function Tw(){return Cw}const Ew=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}=On();return ft({mutationFn:async n=>{t();try{await e.cancelQueries({queryKey:Pn.groups.lists()});const t=await jt(Lt(n));return Np.parse(t).items[0]??null}catch(e){throw r(),En(e)}},onSuccess:()=>{r(),n("Group created"),e.invalidateQueries({queryKey:Pn.groups.lists()}),e.invalidateQueries({queryKey:Pn.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)(Qn,{name:"group",value:String(i),onChange:e=>s(parseInt(e.target.value,10)),items:Tw().map(e=>({label:e.label,value:String(e.value)})),disabled:t})," ",(0,u.jsx)("span",{className:"table-actions",children:(0,u.jsx)(fu,{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")})]})]})},Pw=function(e){const{disabled:t,rowParams:r,row:n}=e,{mutate:i}=kw(),{setRowMode:o,rowMode:s}=r,{id:l,enabled:c}=n,d=[];return"edit"===s?null:(Yv(rb)&&d.push((0,u.jsx)(ob,{onClick:()=>o("edit"!==s&&"edit"),children:(0,a.__)("Edit","redirection")},"0")),Yv("redirection_cap_group_delete")&&d.push((0,u.jsx)(ob,{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")),Yv(eb)&&d.push((0,u.jsx)(ob,{href:Redirectioni10n.pluginRoot+"&"+encodeURIComponent("filterby[group]")+"="+l,children:(0,a.__)("View Redirects","redirection")},"2")),Yv(rb)&&(c?d.push((0,u.jsx)(ob,{onClick:()=>i({action:"disable",items:[l]}),children:(0,a.__)("Disable","redirection")},"3")):d.push((0,u.jsx)(ob,{onClick:()=>i({action:"enable",items:[l]}),children:(0,a.__)("Enable","redirection")},"3"))),(0,u.jsx)(ib,{disabled:t,actions:d}))},Rw=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:"×"})},Ow=function({row:e,filters:t}){const{enabled:r,name:n}=e;return r?(0,u.jsx)(bb(),{searchWords:[t.name],textToHighlight:n,autoEscape:!0}):(0,u.jsx)("s",{children:n})},Nw=function({row:e}){const{module_id:t}=e,r=function(e){const t=Cw.find(t=>t.value===e);return t?t.label:"WordPress"}(t),{setGroupsTable:n}=hv();return(0,u.jsx)(u.Fragment,{children:(0,u.jsx)(dp,{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})})},Aw=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}=On();return ft({mutationFn:async n=>{t();try{await e.cancelQueries({queryKey:Pn.groups.lists()});const{id:t,...r}=n,i=await jt(Dt(t,r));return Ap.parse(i).item}catch(e){throw r(),En(e)}},onSuccess:t=>{r(),n("Group saved"),e.invalidateQueries({queryKey:Pn.groups.lists()}),e.invalidateQueries({queryKey:Pn.groups.dropdown()}),e.invalidateQueries({queryKey:Pn.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)(Qn,{name:"module_id",value:String(s),onChange:e=>l(parseInt(e.target.value,10)),items:Tw().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)(fu,{isPrimary:!0,isSecondary:!1,isSubmit:!0,children:(0,a.__)("Save","redirection")})," ",(0,u.jsx)(fu,{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 Iw(e){return e.includes("name")?e:e.concat(["name"])}const Fw=function(){const e=hv(e=>e.groups),{setGroupsTable:t,setGroupsSelected:r}=hv();bv({table:e,setTable:t,allowedOrder:["name","id"],allowedFilters:["name","status","module"],defaultOrder:"name",pageName:"groups"});const n=kw(),i=Dn(),{data:o,isLoading:s}=function(e={},t){const r=Lp(e);return dt({queryKey:Pn.groups.list(r),refetchOnMount:"always",refetchOnReconnect:!0,placeholderData:e=>e,queryFn:async()=>{try{const e=await jt(It(r));return Np.parse(e)}catch(e){const t=En(e);throw On.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:jw(),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:jw().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:Sw(Tw().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:Iw},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=Lp(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:Tb("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)(Jv,{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)(Rw,{row:e})},{name:"name",content:"edit"===n?(0,u.jsx)(Aw,{group:e,onCancel:()=>i(!1)}):(0,u.jsx)(Ow,{row:e,filters:t.table.filterBy})},{name:"redirects",content:new Intl.NumberFormat(window.Redirectioni10n.locale).format(r)},{name:"module",content:(0,u.jsx)(Nw,{row:e})}]}(e,t),getRowActions:(e,t)=>(0,u.jsx)(Pw,{disabled:!1,row:e,rowParams:t})}),Yv(rb)&&(0,u.jsx)(Ew,{disabled:!1})]})},Dw=()=>[{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")}],Lw=function(e){const{addTop:t}=e,r=m({"add-new":!0,edit:!0,addTop:t});return(0,u.jsxs)(u.Fragment,{children:[!t&&Yv(tb)&&(0,u.jsx)("h2",{children:(0,a.__)("Add redirect","redirection")}),(0,u.jsx)("div",{className:r,children:(0,u.jsx)($x,{item:qb("",0,e.defaultFlags),saveButton:(0,a.__)("Add redirect","redirection"),autoFocus:!!t})})]})},zw=function(e){const{disabled:t,rowParams:r,row:n}=e,{mutate:i}=zx(),{mutate:o}=Mx("disable"),{mutate:s}=Mx("enable"),{setRowMode:l,rowMode:c}=r,{id:d,enabled:p,regex:h,action_type:f,match_type:m}=n,g=[];return"edit"===c?null:(Yv(tb)&&g.push((0,u.jsx)(ob,{onClick:()=>l("edit"),children:(0,a.__)("Edit","redirection")},"1")),Yv("redirection_cap_redirect_delete")&&g.push((0,u.jsx)(ob,{onClick:()=>{window.confirm((0,a.__)("Are you sure you want to delete this item?","redirection"))&&i({items:[d]})},children:(0,a.__)("Delete","redirection")},"2")),Yv(tb)&&(p?g.push((0,u.jsx)(ob,{onClick:()=>o({items:[d]}),children:(0,a.__)("Disable","redirection")},"3")):g.push((0,u.jsx)(ob,{onClick:()=>s({items:[d]}),children:(0,a.__)("Enable","redirection")},"4"))),!p||h||"url"!==f||"url"!==m&&"server"!==m||g.push((0,u.jsx)(ob,{onClick:()=>l("check"),children:(0,a.__)("Check Redirect","redirection")},"5")),(0,u.jsx)(ib,{disabled:t,actions:g}))},Mw=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:"×"})},$w=(e,t)=>e.includes(t);function Uw(e,t,r){return"server"===r?e.server+t:t}function Bw(e,t){const{match_type:r,regex:n,action_data:i,url:o}=e;return n?t:(0,u.jsx)(A,{url:Uw(i,o,r),children:t})}function qw(e,t){return t?e:(0,u.jsx)("s",{children:e})}const Ww=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)(bb(),{searchWords:[n.url||""],textToHighlight:Uw(a,o,i),autoEscape:!0}),d=(0,u.jsx)(bb(),{searchWords:[n.title||""],textToHighlight:s,autoEscape:!0});return $w(t,"title")&&!$w(t,"source")?(0,u.jsx)("p",{children:Bw(r,qw(s?d:c,l))}):(0,u.jsxs)(u.Fragment,{children:[$w(t,"title")&&s&&(0,u.jsx)("p",{children:Bw(r,qw(d,l))}),$w(t,"source")&&c&&(0,u.jsx)("p",{children:Bw(r,qw(c,l))})]})},Hw=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)(bb(),{searchWords:[r.target??""],textToHighlight:i.url??"",autoEscape:!0})}):null},Gw=function({name:e,className:t,strikethrough:r}){return(0,u.jsx)(dp,{className:m("redirect-source__flag",t),children:r?(0,u.jsx)("s",{children:e}):e})},Zw=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=Vb().find(t=>t.value===e);return(0,u.jsx)(Gw,{name:t?.label||"",className:"redirect-source__"+e,strikethrough:!!r[e]&&!n[e]},e)})})},Kw=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)(Gw,{name:e})}return null},Vw=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)(Ww,{row:t,displaySelected:i,filters:r.filterBy}),$w(i,"target")&&(0,u.jsx)(Hw,{row:t,filters:r.filterBy})]}),(0,u.jsxs)("div",{className:"redirect-source__flags",children:[$w(i,"flags")&&(0,u.jsx)(Zw,{row:t,defaultFlags:n}),$w(i,"query")&&(0,u.jsx)(Kw,{row:t,defaultFlags:n})]})]})},Qw=function(e){const{action_code:t,action_type:r}=e;return"pass"===r?(0,a.__)("pass","redirection"):r===Ob?"-":t},Jw=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)(dp,{children:n.moduleName})]}):null};function Yw(e,t){const r=t.find(t=>t.value===e);return r?r.label:"-"}function Xw({url:e,desiredCode:t=0,desiredTarget:r=null}){return(0,u.jsx)(ah,{url:e,desiredCode:t,desiredTarget:r})}function ej(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 tj(e){return e.includes("source")?e:e.concat(["source"])}function rj(e){return e.includes("title")||e.includes("source")?tj(e):tj(e.concat(["title"]))}function nj(e){return[{value:"0",label:(0,a.__)("All groups","redirection")}].concat(Bp(e))}const ij=function(){const e=hv(e=>e.redirects),t=hv(e=>e.redirectsAddTop),{setRedirectsTable:r,setRedirectsSelected:n}=hv(),i=he(e=>e.values);bv({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}=zp(),l=o?.items??[],c=zx(),d=Mx("enable"),p=Mx("disable"),h=Mx("reset"),f=Dn(),{data:m,isLoading:g,isSuccess:y}=function(e={},t){const r=Lp(e);return dt({queryKey:Pn.redirects.list(r),refetchOnMount:"always",refetchOnReconnect:!0,placeholderData:e=>e,queryFn:async()=>{try{const e=await jt(Rt(r));return Rp.parse(e)}catch(e){const t=En(e);throw On.getState().addError(t.message||"Failed to fetch redirects"),t}},...t})}(e),_=m?.items??[],v=m?.total??0;let b="idle";g&&!m?b=xv:(y||m)&&(b=wv);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===wv&&s&&Yv(tb),j=e=>{r({filterBy:e,page:0,selected:[],selectAll:!1})},S={displayFilters:Dw(),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:Dw().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:nj(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:Wb()},{label:(0,a.__)("Action Type","redirection"),value:"action",options:Hb()},{label:(0,a.__)("HTTP Status Code","redirection"),value:"http",options:Kb()},{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:rj},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=Lp(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=Tb("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?_.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?_.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&&Yv(tb)&&(0,u.jsx)(Lw,{defaultFlags:x,addTop:!0}),(0,u.jsx)(Jv,{logOptions:S,logActions:k,table:C,status:b,total:v,rows:_,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)($x,{item:e,onCancel:()=>f(!1)}):[{name:"status",content:(0,u.jsx)(Mw,{row:e})},{name:"source",content:(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(Vw,{row:e,table:t.table,defaultFlags:n}),"check"===h&&(0,u.jsx)(Qp,{onClose:()=>f(null),children:(0,u.jsx)(Xw,{url:$p((m=e,"server"===m.match_type?m.action_data.server??"":document.location.origin),ej(e.url)),desiredCode:d,desiredTarget:p})})]}),alwaysDisplay:!0},{name:"match_type",content:Yw(l,Wb())},{name:"action_type",content:Yw(c,Hb())},{name:"code",content:Qw(e)},{name:"group",content:(0,u.jsx)(Jw,{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)(zw,{disabled:!1,row:e,rowParams:t})}),w&&!t&&(0,u.jsx)(Lw,{defaultFlags:x,addTop:!1})]})},oj=function({page:e}){switch(e){case"support":return(0,u.jsx)(fh,{});case"404s":return(0,u.jsx)(Hx,{});case"log":return(0,u.jsx)(Pb,{});case"import":return(0,u.jsx)(dw,{});case"export":return(0,u.jsx)(ww,{});case"groups":return(0,u.jsx)(Fw,{});case"options":return(0,u.jsx)(Yp,{});case"site":return(0,u.jsx)(rv,{})}return(0,u.jsx)(ij,{})};function sj(){window.location.href=function(){const e=new URL(window.location.href);return e.searchParams.set("redirection_cache_bust",Date.now().toString()),e.toString()}()}const aj=function(){return(0,u.jsxs)(Z,{errors:"",details:J().concat(["Buster: 5.10.1 === "+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)(fu,{isPrimary:!0,onClick:sj,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/"})})})]})},lj=function(){const{update_notice:e=!1}=window.Redirectioni10n,{mutate:t}=ic();return e&&Yv("redirection_cap_option_manage")?(0,u.jsx)(_p,{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)(fu,{onClick:function(){t({update_notice:window.Redirectioni10n.update_notice}),window.Redirectioni10n.update_notice=!1},children:(0,a.__)("OK","redirection")})]})}):null},cj=Redirectioni10n?.caps?.pages||[];function uj(){const e=On(e=>e.errors),t=On(e=>e.notices),{clearErrors:r,clearNotices:n}=On(),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}=hv(),[_,v]=(0,o().useState)(au(cj));(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=>Xv(e.value)||""===e.value&&Xv("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&&y({orderby:"name",direction:"asc",page:0,perPage:25,selected:[],filter:"",filterBy:"",groupBy:""})},[b,h,f,m,y]);if("5.10.1"!==Redirectioni10n.version)return(0,u.jsx)(aj,{});if("need-install"===i||"finish-install"===i)return(0,u.jsx)(V,{renderCrash:pu,extra:{page:_},children:(0,u.jsx)(qc,{})});const k="prompt"===c&&("need-update"===i||"finish-update"===i);return(0,u.jsx)(V,{renderCrash:pu,extra:{page:_},children:(0,u.jsxs)("div",{className:"wrap redirection notranslate",translate:"no",children:[k&&(0,u.jsx)(Jc,{onShowUpgrade:()=>d(!0),showDatabase:s}),!l&&"finish-update"!==i&&!s&&(0,u.jsxs)(lu,{page:_,setPage:b,onPageChange:x,allowedPages:cj,baseUrl:"?page=redirection.php",defaultPage:"redirect",children:[(0,u.jsx)("h1",{className:"wp-heading-inline",children:j[_]}),"redirect"===_&&Yv(tb)&&(0,u.jsx)("button",{type:"button",onClick:()=>g(!0),className:"page-title-action",children:(0,a.__)("Add redirect","redirection")}),(0,u.jsx)(lj,{}),(0,u.jsx)(eu,{onChangePage:S,currentPage:_,menu:w,home:"redirect",urlBase:Redirectioni10n.pluginRoot}),(0,u.jsx)(Z,{errors:e,onClear:()=>r(),renderDebug:fe,details:J(),links:Q(),locale:"redirection",children:(0,u.jsx)(cu,{})}),(0,u.jsx)(oj,{page:_}),(0,u.jsx)(nu,{notices:t,onClear:()=>n(),snackBarViewText:(0,a.__)("View notice","redirection")})]})]})})}var dj=class extends He{#W;#H;#G;constructor(e={}){super(),this.config=e,this.#W=new Set,this.#H=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.#W.add(e);const t=pj(e);if("string"==typeof t){const r=this.#H.get(t);r?r.push(e):this.#H.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#W.delete(e)){const t=pj(e);if("string"==typeof t){const r=this.#H.get(t);if(r)if(r.length>1){const t=r.indexOf(e);-1!==t&&r.splice(t,1)}else r[0]===e&&this.#H.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=pj(e);if("string"==typeof t){const r=this.#H.get(t)?.find(e=>"pending"===e.state.status);return!r||r===e}return!0}runNext(e){const t=pj(e);return"string"==typeof t?(this.#H.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){qe.batch(()=>{this.#W.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#W.clear(),this.#H.clear()})}getAll(){return Array.from(this.#W)}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 pj(e){return e.options.scope?.id}var hj=class extends He{#Z;constructor(e={}){super(),this.config=e,this.#Z=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.#Z.has(e.queryHash)||(this.#Z.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#Z.get(e.queryHash);t&&(e.destroy(),t===e&&this.#Z.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){qe.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#Z.get(e)}getAll(){return[...this.#Z.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 fj(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 mj=new class{#K;#M;#h;#V;#Q;#J;#Y;#X;constructor(e={}){this.#K=e.queryCache||new hj,this.#M=e.mutationCache||new dj,this.#h=e.defaultOptions||{},this.#V=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.#K.onFocus())}),this.#X=Ze.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#K.onOnline())}))}unmount(){this.#J--,0===this.#J&&(this.#Y?.(),this.#Y=void 0,this.#X?.(),this.#X=void 0)}isFetching(e){return this.#K.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.#K.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=this.#K.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.#K.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,r){const n=this.defaultQueryOptions({queryKey:e}),i=this.#K.get(n.queryHash)?.state.data,o=function(e,t){return"function"==typeof e?e(t):e}(t,i);if(void 0!==o)return this.#K.build(this,n).setData(o,{...r,manual:!0})}setQueriesData(e,t,r){return qe.batch(()=>this.#K.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,r)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#K.get(t.queryHash)?.state}removeQueries(e){const t=this.#K;qe.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){const r=this.#K;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.#K.findAll(e).map(e=>e.cancel(r)));return Promise.all(n).then(xe).catch(xe)}invalidateQueries(e,t={}){return qe.batch(()=>(this.#K.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.#K.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.#K.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.#K.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 Ze.isOnline()?this.#M.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#K}getMutationCache(){return this.#M}getDefaultOptions(){return this.#h}setDefaultOptions(e){this.#h=e}setQueryDefaults(e,t){this.#V.set(Ee(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#V.values()],r={};return t.forEach(t=>{Pe(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=>{Pe(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.#K.clear(),this.#M.clear()}}({queryCache:new hj({onError:e=>{fj("Query",e)}}),mutationCache:new dj({onError:e=>{fj("Mutation",e)}}),defaultOptions:{queries:{staleTime:0,retry:!1,refetchOnWindowFocus:!1},mutations:{retry:!1}}});let gj=!1;function yj(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)(Z,{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 _j(){return(0,u.jsx)(V,{renderCrash:yj,children:(0,u.jsx)(vj,{})})}function vj(){const[e,t]=(0,o().useState)(gj),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)(()=>{gj||(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)),gj=!0),t(!0)},[r.apiNonce,r.apiRoot,r.locale,r.localeWasInvalid]),e?(0,u.jsxs)(h,{client:mj,children:[(0,u.jsx)(uj,{}),!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)(_j,{}))}(),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,y=e.highlightStyle,_=void 0===y?{}:y,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,P=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"]),R=(0,o.findAll)({autoEscape:u,caseSensitive:p,findChunks:f,sanitize:x,searchWords:w,textToHighlight:j}),O=b,N=-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},P,{children:R.map(function(e,t){var n=j.substr(e.start,e.end-e.start);if(e.highlight){N++;var i;i="object"==typeof g?p?g[n]:(g=F(g))[n.toLowerCase()]:g;var o=N===+l;A=i+" "+(o?r:""),I=!0===o&&null!=c?Object.assign({},_,c):_;var a={children:n,className:A,key:t,style:I};return"string"!=typeof O&&(a.highlightIndex=N),(0,s.createElement)(O,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)=>{if(!n){for(var o=0;o<e.length;o++){let[n,i]=e[o],a=!0;for(var s=0;s<n.length;s++)r.O.j(n[s])?n.splice(s--,1):a=!1;if(a){e.splice(o--,1);const r=i();void 0!==r&&(t=r)}}return t}e.push([n,i])}})(),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(295));n=r.O(n)})();