HEX
Server: Apache
System: Linux sg2plmcpnl507963.prod.sin2.secureserver.net 4.18.0-553.52.1.lve.el8.x86_64 #1 SMP Wed May 21 15:31:29 UTC 2025 x86_64
User: lsqdoer4f1j9 (9817645)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: /home/lsqdoer4f1j9/public_html/vbetind.com/wp-content/plugins/redirection/build/redirection.js
/*! Redirection v5.7.5 - please refer to license.txt for license information */
(()=>{var e,t,n,r={794(e,t,n){"use strict";var r={};n.r(r),n.d(r,{base64:()=>Pr,base64url:()=>Or,bigint:()=>$r,boolean:()=>Zr,browserEmail:()=>wr,cidrv4:()=>Tr,cidrv6:()=>Er,cuid:()=>ir,cuid2:()=>or,date:()=>zr,datetime:()=>Lr,domain:()=>Nr,duration:()=>ur,e164:()=>Ar,email:()=>yr,emoji:()=>jr,extendedDuration:()=>dr,guid:()=>pr,hex:()=>Vr,hostname:()=>Rr,html5Email:()=>vr,idnEmail:()=>xr,integer:()=>Ur,ipv4:()=>Sr,ipv6:()=>kr,ksuid:()=>lr,lowercase:()=>Wr,mac:()=>Cr,md5_base64:()=>Yr,md5_base64url:()=>Xr,md5_hex:()=>Jr,nanoid:()=>cr,null:()=>qr,number:()=>Br,rfc5322Email:()=>_r,sha1_base64:()=>ti,sha1_base64url:()=>ni,sha1_hex:()=>ei,sha256_base64:()=>ii,sha256_base64url:()=>oi,sha256_hex:()=>ri,sha384_base64:()=>ai,sha384_base64url:()=>li,sha384_hex:()=>si,sha512_base64:()=>ui,sha512_base64url:()=>di,sha512_hex:()=>ci,string:()=>Mr,time:()=>Dr,ulid:()=>sr,undefined:()=>Hr,unicodeEmail:()=>br,uppercase:()=>Gr,uuid:()=>hr,uuid4:()=>fr,uuid6:()=>mr,uuid7:()=>gr,xid:()=>ar});var i={};n.r(i),n.d(i,{endsWith:()=>fa,gt:()=>Ks,gte:()=>Js,includes:()=>pa,length:()=>la,lowercase:()=>ua,lt:()=>Vs,lte:()=>Qs,maxLength:()=>sa,maxSize:()=>ra,mime:()=>ga,minLength:()=>aa,minSize:()=>ia,multipleOf:()=>na,negative:()=>Xs,nonnegative:()=>ta,nonpositive:()=>ea,normalize:()=>va,overwrite:()=>ya,positive:()=>Ys,property:()=>ma,regex:()=>ca,size:()=>oa,slugify:()=>wa,startsWith:()=>ha,toLowerCase:()=>ba,toUpperCase:()=>xa,trim:()=>_a,uppercase:()=>da});var o={};n.r(o),n.d(o,{ZodISODate:()=>za,ZodISODateTime:()=>Aa,ZodISODuration:()=>Ma,ZodISOTime:()=>Da,date:()=>Fa,datetime:()=>Ia,duration:()=>$a,time:()=>La});var s={};n.r(s),n.d(s,{ZodAny:()=>jc,ZodArray:()=>Ac,ZodBase64:()=>Zl,ZodBase64URL:()=>Hl,ZodBigInt:()=>pc,ZodBigIntFormat:()=>fc,ZodBoolean:()=>uc,ZodCIDRv4:()=>Ml,ZodCIDRv6:()=>Ul,ZodCUID:()=>jl,ZodCUID2:()=>kl,ZodCatch:()=>Eu,ZodCodec:()=>Iu,ZodCustom:()=>Wu,ZodCustomStringFormat:()=>Jl,ZodDate:()=>Rc,ZodDefault:()=>bu,ZodDiscriminatedUnion:()=>qc,ZodE164:()=>Gl,ZodEmail:()=>al,ZodEmoji:()=>_l,ZodEnum:()=>iu,ZodExactOptional:()=>mu,ZodFile:()=>cu,ZodFunction:()=>qu,ZodGUID:()=>cl,ZodIPv4:()=>Al,ZodIPv6:()=>Dl,ZodIntersection:()=>Wc,ZodJWT:()=>Ql,ZodKSUID:()=>Rl,ZodLazy:()=>$u,ZodLiteral:()=>au,ZodMAC:()=>zl,ZodMap:()=>eu,ZodNaN:()=>Ou,ZodNanoID:()=>xl,ZodNever:()=>Tc,ZodNonOptional:()=>Su,ZodNull:()=>xc,ZodNullable:()=>yu,ZodNumber:()=>nc,ZodNumberFormat:()=>ic,ZodObject:()=>Fc,ZodOptional:()=>hu,ZodPipe:()=>Nu,ZodPrefault:()=>wu,ZodPromise:()=>Bu,ZodReadonly:()=>Fu,ZodRecord:()=>Kc,ZodSet:()=>nu,ZodString:()=>il,ZodStringFormat:()=>sl,ZodSuccess:()=>Cu,ZodSymbol:()=>yc,ZodTemplateLiteral:()=>Lu,ZodTransform:()=>du,ZodTuple:()=>Vc,ZodType:()=>nl,ZodULID:()=>Tl,ZodURL:()=>gl,ZodUUID:()=>dl,ZodUndefined:()=>_c,ZodUnion:()=>$c,ZodUnknown:()=>kc,ZodVoid:()=>Pc,ZodXID:()=>Pl,ZodXor:()=>Bc,_ZodString:()=>rl,_default:()=>xu,_function:()=>Hu,any:()=>Sc,array:()=>Ic,base64:()=>ql,base64url:()=>Wl,bigint:()=>hc,boolean:()=>dc,catch:()=>Pu,check:()=>Gu,cidrv4:()=>$l,cidrv6:()=>Bl,codec:()=>zu,cuid:()=>Sl,cuid2:()=>Cl,custom:()=>Vu,date:()=>Nc,describe:()=>Ju,discriminatedUnion:()=>Hc,e164:()=>Vl,email:()=>ll,emoji:()=>bl,enum:()=>ou,exactOptional:()=>gu,file:()=>uu,float32:()=>sc,float64:()=>ac,function:()=>Hu,guid:()=>ul,hash:()=>tc,hex:()=>ec,hostname:()=>Xl,httpUrl:()=>vl,instanceof:()=>Xu,int:()=>oc,int32:()=>lc,int64:()=>mc,intersection:()=>Gc,ipv4:()=>Il,ipv6:()=>Ll,json:()=>td,jwt:()=>Kl,keyof:()=>zc,ksuid:()=>Nl,lazy:()=>Uu,literal:()=>lu,looseObject:()=>Mc,looseRecord:()=>Xc,mac:()=>Fl,map:()=>tu,meta:()=>Yu,nan:()=>Ru,nanoid:()=>wl,nativeEnum:()=>su,never:()=>Ec,nonoptional:()=>ku,null:()=>wc,nullable:()=>vu,nullish:()=>_u,number:()=>rc,object:()=>Dc,optional:()=>fu,partialRecord:()=>Yc,pipe:()=>Au,prefault:()=>ju,preprocess:()=>nd,promise:()=>Zu,readonly:()=>Du,record:()=>Jc,refine:()=>Qu,set:()=>ru,strictObject:()=>Lc,string:()=>ol,stringFormat:()=>Yl,stringbool:()=>ed,success:()=>Tu,superRefine:()=>Ku,symbol:()=>vc,templateLiteral:()=>Mu,transform:()=>pu,tuple:()=>Qc,uint32:()=>cc,uint64:()=>gc,ulid:()=>El,undefined:()=>bc,union:()=>Uc,unknown:()=>Cc,url:()=>yl,uuid:()=>pl,uuidv4:()=>hl,uuidv6:()=>fl,uuidv7:()=>ml,void:()=>Oc,xid:()=>Ol,xor:()=>Zc});var a=n(576),l=n(609),c=n.t(l,2),u=n.n(l);const d=window.ReactJSXRuntime;var p=l.createContext(void 0),h=e=>{const t=l.useContext(p);if(e)return e;if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},f=({client:e,children:t})=>(l.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,d.jsx)(p.Provider,{value:e,children:t}));const m=window.wp.i18n;function g(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=g(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}const y=function(){for(var e,t,n=0,r="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=g(e))&&(r&&(r+=" "),r+=t);return r};function v(){return v=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},v.apply(null,arguments)}function _(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}var b=l.useLayoutEffect,x=function(e,t){"function"!=typeof e?e.current=t:e(t)},w={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0",display:"block"},j=function(e){Object.keys(w).forEach(function(t){e.style.setProperty(t,w[t],"important")})},S=null,k=function(e,t){var n=e.scrollHeight;return"border-box"===t.sizingStyle.boxSizing?n+t.borderSize:n-t.paddingSize},C=function(){},T=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width","wordBreak","wordSpacing","scrollbarGutter"],E=!!document.documentElement.currentStyle;function P(e,t,n){var r,i,o=(r=n,i=u().useRef(r),b(function(){i.current=r}),i);l.useLayoutEffect(function(){var n=function(e){return o.current(e)};if(e)return e.addEventListener(t,n),function(){return e.removeEventListener(t,n)}},[])}var O=["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"],R=function(e,t){var n,r=e.cacheMeasurements,i=e.maxRows,o=e.minRows,s=e.onChange,a=void 0===s?C:s,c=e.onHeightChange,d=void 0===c?C:c,p=_(e,O),h=void 0!==p.value,f=l.useRef(null),m=function(e,t){var n=u().useRef();return u().useCallback(function(r){e.current=r,n.current&&x(n.current,null),n.current=t,t&&x(t,r)},[t])}(f,t),g=l.useRef(0),y=l.useRef(),b=function(){var e=f.current,t=r&&y.current?y.current:function(e){var t=window.getComputedStyle(e);if(null===t)return null;var n,r=(n=t,T.reduce(function(e,t){return e[t]=n[t],e},{})),i=r.boxSizing;return""===i?null:(E&&"border-box"===i&&(r.width=parseFloat(r.width)+parseFloat(r.borderRightWidth)+parseFloat(r.borderLeftWidth)+parseFloat(r.paddingRight)+parseFloat(r.paddingLeft)+"px"),{sizingStyle:r,paddingSize:parseFloat(r.paddingBottom)+parseFloat(r.paddingTop),borderSize:parseFloat(r.borderBottomWidth)+parseFloat(r.borderTopWidth)})}(e);if(t){y.current=t;var n=function(e,t,n,r){void 0===n&&(n=1),void 0===r&&(r=1/0),S||((S=document.createElement("textarea")).setAttribute("tabindex","-1"),S.setAttribute("aria-hidden","true"),j(S)),null===S.parentNode&&document.body.appendChild(S);var i=e.paddingSize,o=e.borderSize,s=e.sizingStyle,a=s.boxSizing;Object.keys(s).forEach(function(e){var t=e;S.style[t]=s[t]}),j(S),S.value=t;var l=k(S,e);S.value=t,l=k(S,e),S.value="x";var c=S.scrollHeight-i,u=c*n;"border-box"===a&&(u=u+i+o),l=Math.max(u,l);var d=c*r;return"border-box"===a&&(d=d+i+o),[l=Math.min(d,l),c]}(t,e.value||e.placeholder||"x",o,i),s=n[0],a=n[1];g.current!==s&&(g.current=s,e.style.setProperty("height",s+"px","important"),d(s,{rowHeight:a}))}};return l.useLayoutEffect(b),function(e,t){P(document.body,"reset",function(n){e.current.form===n.target&&t()})}(f,function(){if(!h){var e=f.current.value;requestAnimationFrame(function(){var t=f.current;t&&e!==t.value&&b()})}}),P(window,"resize",b),n=b,P(document.fonts,"loadingdone",n),l.createElement("textarea",v({},p,{onChange:function(e){h||b(),a(e)},ref:m}))},N=l.forwardRef(R);const A=function(e){const{error:t,mini:n,context:r,renderDebug:i,versions:o,noParse:s=!1,details:a=[],locale:c}=e,[u,p]=(0,l.useState)(!n);if(!u)return(0,d.jsx)("p",{children:(0,d.jsx)("button",{className:"button button-secondary",type:"button",onClick:()=>p(!0),children:(0,m.__)("Show debug",c)})});const h=s?[t]:function(e,t,n){const r=t?[t]:[],{request:i=!1,data:o}=e;r.push("");const{apiFetch:s}=i||{};s&&s.status&&s.statusText&&(r.push("Action: "+s.action),s.body&&"{}"!==s.body&&r.push("Params: "+s.body),r.push("Code: "+s.status+" "+s.statusText),r.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&&r.push("Error: "+a),o&&r.push("Raw: "+o),n&&(r.push(""),r.push("Context:"),r.push(n)),r}(t,o,r);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("h3",{children:(0,m.__)("Debug Information",c)}),i&&i(a.concat(h).join("\n")),(0,d.jsx)("p",{children:(0,d.jsx)(N,{readOnly:!0,cols:120,value:a.concat(h).join("\n"),maxRows:40,spellCheck:!1})})]})},I=function(e){const{locale:t}=e;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("h2",{children:(0,m.__)("You are using an old or cached session",t)}),(0,d.jsx)("p",{children:(0,m.__)("This is usually fixed by doing one of the following:",t)}),(0,d.jsxs)("ul",{children:[(0,d.jsx)("li",{children:(0,m.__)("Reload the page - your current session is old.",t)}),(0,d.jsx)("li",{children:(0,m.__)("Log out, clear your browser cache, and log in again - your browser has cached an old session.",t)}),(0,d.jsx)("li",{children:(0,m.__)("Your admin pages are being cached. Clear this cache and try again. There may be multiple caches involved.",t)})]}),(0,d.jsx)(A,{...e,error:e.error||{},mini:!0})]})},z=({url:e,children:t,title:n,className:r})=>(0,d.jsx)("a",{href:e,target:"_blank",rel:"noopener noreferrer",title:n,className:r,children:t});function F(e){return 404===e?.request?.apiFetch?.status}function D(e){const t=e.code;return"disabled"===t||"rest_disabled"===t}function L(e){return"rest_api_redirected"===e?.code}function M(e){const t=e;return 0===t.code?t.message:t.data&&t.data.wpdb?(0,d.jsxs)("span",{children:[`${t.message} (${t.code})`,": ",(0,d.jsx)("code",{children:t.data.wpdb})]}):t.code?(0,d.jsxs)(d.Fragment,{children:[t.message," (",(0,d.jsx)("code",{children:t.code}),")"]}):t.message}const $=window.wp.element;function U(e,t){try{return(0,$.createInterpolateElement)(e.replace(/\{\{/g,"<").replace(/\}\}/g,">"),t)}catch(t){return e}}const B=({error:e,links:t,locale:n})=>{if("string"==typeof e)return(0,d.jsx)("p",{children:e});if(function(e){return void 0!==e.code&&0===e.code}(e))return(0,d.jsx)("p",{children:(0,m.__)("WordPress did not return a response. This could mean an error occurred or that the request was blocked. Please check your server error_log.",n)});if(function(e){const t=e,{request:n,code:r}=t;return!!(n&&n.status&&r)&&(-1!==[400,401,403,405].indexOf(n.status)||"rest_no_route"===r)&&0===parseInt(String(r),10)}(e))return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("p",{children:M(e)}),(0,d.jsx)("p",{children:(0,m.__)("Your REST API is probably being blocked by a security plugin. Please disable this, or configure it to allow REST API requests.",n)}),(0,d.jsx)("p",{children:(0,d.jsx)(z,{url:t.api,children:(0,m.__)("Read this REST API guide for more information.",n)})})]});if(F(e))return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("p",{children:(0,m.__)("Your WordPress REST API is returning a 404 page. This is almost certainly an external plugin or server configuration issue.",n)}),(0,d.jsx)("p",{className:"wpl-error__highlight",children:(0,d.jsx)("strong",{children:(0,m.__)("You will will need to fix this on your site. Redirection is not causing the error.",n)})}),(0,d.jsxs)("ul",{children:[(0,d.jsx)("li",{children:U((0,m.__)("Can you access your {{api}}REST API{{/api}} without it redirecting?",n),{api:(0,d.jsx)(z,{url:t.rootUrl,children:t.rootUrl})})}),(0,d.jsx)("li",{children:U((0,m.__)("Check your {{link}}Site Health{{/link}} and fix any issues.",n),{link:(0,d.jsx)(z,{url:t.siteHealth,children:t.siteHealth})})}),(0,d.jsx)("li",{children:(0,m.__)("Your server configuration is blocking access to the REST API.",n)}),(0,d.jsx)("li",{children:(0,m.__)("A security plugin or firewall is blocking access. You will need to whitelist the REST API.",n)})]}),(0,d.jsx)("p",{children:(0,d.jsx)(z,{url:t.api,children:(0,m.__)("Read this REST API guide for more information.",n)})})]});if(L(e))return(0,d.jsx)("p",{children:(0,m.__)("Your REST API is being redirected. Please remove the redirection for the API.",n)});if(function(e){return 413===e?.request?.apiFetch?.status}(e))return(0,d.jsx)("p",{children:(0,m.__)("Your server has rejected the request for being too big. You will need to reconfigure it to continue.",n)});if(function(e){return void 0===e.message}(e))return(0,d.jsx)("p",{children:(0,m.__)("An unknown error occurred.",n)});if(function(e){const t=e.data;return"string"==typeof t&&-1!==t.indexOf("<b>Deprecated</b>:  Directive")}(e))return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("p",{children:M(e)}),(0,d.jsx)("p",{children:(0,m.__)("Your REST API is showing a deprecated PHP error. Please fix this error.",n)})]});if(function(e){return-1!==[500,502,503].indexOf(e?.request?.apiFetch?.status??0)}(e))return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("p",{children:M(e)}),(0,d.jsx)("p",{children:(0,m.__)("This could be a security plugin, or your server is out of memory or has an external error. Please check your server error log",n)}),(0,d.jsx)("p",{children:(0,d.jsx)(z,{url:t.http,children:(0,m.__)("Read this REST API guide for more information.",n)})})]});if(D(e))return(0,d.jsx)("p",{children:(0,m.__)("Your WordPress REST API has been disabled. You will need to enable it to continue.",n)});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 n=e.split("<br />").filter(e=>e);return n.slice(0,n.length-1).join(" ").trim()}(e?.request?.apiFetch?.body||"");return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("p",{children:M(e)}),(0,d.jsx)("p",{children:(0,m.__)("WordPress returned an unexpected message. This could be a PHP error from another plugin, or data inserted by your theme.",n)}),t.length>1&&(0,d.jsxs)("p",{children:[(0,d.jsxs)("strong",{children:[(0,m.__)("Possible cause",n),":"]})," ",(0,d.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,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("p",{children:M(e)}),(0,d.jsx)("p",{children:(0,m.__)("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.",n)}),(0,d.jsx)("p",{children:(0,d.jsx)(z,{url:t.url,children:(0,m.__)("Read this REST API guide for more information.",n)})})]}):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,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("p",{children:M(e)}),(0,d.jsx)("p",{children:(0,m.__)("Your REST API appears to be cached and this will cause problems. Please exclude your REST API from your caching system.",n)})]}):(0,d.jsx)("p",{children:M(e)})};function Z(e,t,n){return F(e)?(0,m.__)("REST API 404"):t||(0,m.__)("Something went wrong 🙁",n)}const q=function(e){const{title:t,children:n,error:r,links:i,locale:o}=e,s=function(e){return!F(e)&&!L(e)&&!D(e)}(r),a=function(e){return!!F(e)||!!L(e)||!!D(e)}(r),l=!F(r);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("h2",{children:Z(r,t,o)}),(0,d.jsx)("div",{className:"wpl-error__title",children:(0,d.jsx)(B,{error:r,links:i,locale:o})}),s&&n,(0,d.jsx)(A,{error:r,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}:{}})]})},H=function(e){const{title:t,children:n,error:r,links:i,locale:o}=e;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("h2",{children:t||(0,m.__)("Something went wrong 🙁",o)}),(0,d.jsx)("div",{className:"wpl-error__detail",children:(0,d.jsx)(B,{error:r,links:i,locale:o})}),n,(0,d.jsx)(A,{...e})]})},W=function(e){const{title:t,children:n,error:r,links:i,locale:o}=e;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("h2",{children:t||(0,m.__)("Something went wrong 🙁",o)}),(0,d.jsx)("div",{className:"wpl-error__detail",children:(0,d.jsx)(B,{error:r,links:i,locale:o})}),n,(0,d.jsx)(A,{...e})]})},G=function(e){const{locale:t}=e;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("h2",{children:(0,m.__)("Bad data",t)}),(0,d.jsx)("p",{children:(0,m.__)("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,d.jsx)("p",{children:(0,m.__)("Please review your data and try again.",t)}),(0,d.jsx)(A,{...e,error:e.error||{},mini:!0})]})};function V({current:e,change:t,total:n}){return(0,d.jsxs)("div",{className:"wpl-error__page",children:[e>0&&(0,d.jsx)("span",{onClick:()=>t(e-1),onKeyDown:n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t(e-1))},role:"button",tabIndex:0,children:"←"}),`${e+1}/${n}`,e+1<n&&(0,d.jsx)("span",{onClick:()=>t(e+1),onKeyDown:n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t(e+1))},role:"button",tabIndex:0,children:"→"})]})}const Q=function(e){const{onClear:t,mini:n=!1,type:r=""}=e,i=(0,l.useMemo)(()=>Array.isArray(e.errors)?e.errors:[e.errors],[e.errors]),[o,s]=(0,l.useState)(0);(0,l.useEffect)(()=>{!n&&i.length>0&&window.scrollTo(0,0)},[i,n]);const a=e=>{"click"!==e.type&&("keydown"!==e.type||"Enter"!==e.key&&" "!==e.key)||("keydown"===e.type&&e.preventDefault(),t&&t())};if(0===i.length)return null;const c=function(e,t){const n=e[0];return"rest_cookie_invalid_nonce"===n?.code?I:400===n?.jsonData?.status?G:"error"===t?H:"fixed"===t?W:q}(i,r);return(0,d.jsxs)("div",{className:y("wpl-error",{"wpl-error__mini":n}),children:[t&&(0,d.jsx)("div",{className:"closer",onClick:a,onKeyDown:a,role:"button",tabIndex:0,children:(0,d.jsx)("span",{className:"dashicons dashicons-no-alt"})}),i.length>1&&(0,d.jsx)(V,{current:o,change:s,total:i.length}),(0,d.jsx)(c,{error:i[o],...e})]})};function K(){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 n=new Set,r=(e,r)=>{const i="function"==typeof e?e(t):e;if(!Object.is(i,t)){const e=t;t=(null!=r?r:"object"!=typeof i||null===i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,o={setState:r,getState:i,getInitialState:()=>s,subscribe:e=>(n.add(e),()=>n.delete(e))},s=t=e(r,i,o);return o},X=e=>e,ee=e=>{const t=(e=>e?Y(e):Y)(e),n=e=>function(e,t=X){const n=l.useSyncExternalStore(e.subscribe,l.useCallback(()=>t(e.getState()),[e,t]),l.useCallback(()=>t(e.getInitialState()),[e,t]));return l.useDebugValue(n),n}(t,e);return Object.assign(n,t),n},te=e=>e?ee(e):ee,ne=e=>!!e.dispatchFromDevtools&&"function"==typeof e.dispatch,re=new Map,ie=e=>{const t=re.get(e);return t?Object.fromEntries(Object.entries(t.stores).map(([e,t])=>[e,t.getState()])):{}},oe=e=>{var t,n;if(!e)return;const r=e.split("\n"),i=r.findIndex(e=>e.includes("api.setState"));if(i<0)return;const o=(null==(t=r[i+1])?void 0:t.trim())||"";return null==(n=/.+ (.+) .+/.exec(o))?void 0:n[1]},se=(e,t={})=>(n,r,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(n,r,i);const{connection:u,...d}=((e,t,n)=>{if(void 0===e)return{type:"untracked",connection:t.connect(n)};const r=re.get(n.name);if(r)return{type:"tracked",store:e,...r};const i={connection:t.connect(n),stores:{}};return re.set(n.name,i),{type:"tracked",store:e,...i}})(a,c,l);let p=!0;i.setState=(e,t,o)=>{const c=n(e,t);if(!p)return c;const d=void 0===o?{type:s||oe((new Error).stack)||"anonymous"}:"string"==typeof o?{type:o}:o;return void 0===a?(null==u||u.send(d,r()),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 n=re.get(e);n&&(delete n.stores[t],0===Object.keys(n.stores).length&&re.delete(e))})(l.name,a)}};const h=(...e)=>{const t=p;p=!1,n(...e),p=t},f=e(i.setState,r,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()])))),ne(i)){let e=!1;const t=i.dispatch;i.dispatch=(...n)=>{"__setState"!==n[0].type||e||(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),e=!0),t(...n)}}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"):ae(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))}ne(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 ae(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 ae(e.state,e=>{void 0!==a?JSON.stringify(i.getState())!==JSON.stringify(e[a])&&h(e[a]):h(e)});case"IMPORT_STATE":{const{nextLiftedState:n}=e.payload,r=null==(t=n.computedStates.slice(-1)[0])?void 0:t.state;if(!r)return;return h(void 0===a?r:r[a]),void(null==u||u.send(null,n))}case"PAUSE_RECORDING":return p=!p}return}}),f},ae=(e,t)=>{let n;try{n=JSON.parse(e)}catch(e){console.error("[zustand devtools middleware] Could not parse the received json",e)}void 0!==n&&t(n)};function le(e,t){let n;try{n=e()}catch(e){return}const r={getItem:e=>{var r;const i=e=>null===e?null:JSON.parse(e,null==t?void 0:t.reviver),o=null!=(r=n.getItem(e))?r:null;return o instanceof Promise?o.then(i):i(o)},setItem:(e,r)=>n.setItem(e,JSON.stringify(r,null==t?void 0:t.replacer)),removeItem:e=>n.removeItem(e)};return r}const ce=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then:e=>ce(e)(n),catch(e){return this}}}catch(e){return{then(e){return this},catch:t=>ce(t)(e)}}},ue=(e,t)=>(n,r,i)=>{let o={storage:le(()=>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.`),n(...e)},r,i);const d=()=>{const e=o.partialize({...r()});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)=>(n(...e),d()),r,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=r())?t:h)});const p=(null==(t=o.onRehydrateStorage)?void 0:t.call(o,null!=(e=r())?e:h))||void 0;return ce(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=r())?t:h),n(f,!0),s?d():void 0}).then(()=>{i===a&&(null==p||p(f,void 0),f=r(),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:()=>{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},de={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}},pe=te()(se(ue(e=>({...de,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 n={...e.apiTest};return Object.keys(t).forEach(e=>{t[e]&&(n[e]=t[e])}),{apiTest:n}}),setPluginStatus:t=>e(e=>({pluginStatus:{...e.pluginStatus,...t}})),reset:()=>e(de)}),{name:"redirection-settings",partialize:e=>({values:e.values})}),{name:"SettingsStore"})),he=function(e){const t="mailto:john@redirection.me?subject=Redirection%20Error&body="+encodeURIComponent(e),n="https://github.com/johngodley/redirection/issues/new?title=Redirection%20Error&body="+encodeURIComponent("```\n"+e.trim()+"\n```\n\n");return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("p",{className:"wpl-error__highlight",children:U((0,m.__)("Please check the {{link}}support site{{/link}} before proceeding further.","redirection"),{link:(0,d.jsx)(z,{url:"https://redirection.me/support/"})})}),(0,d.jsx)("p",{children:U((0,m.__)("If that did not help then {{strong}}create an issue{{/strong}} or send it in an {{strong}}email{{/strong}}.","redirection"),{strong:(0,d.jsx)("strong",{})})}),(0,d.jsxs)("p",{children:[(0,d.jsx)("a",{href:n,className:"button-primary",children:(0,m.__)("Create An Issue","redirection")})," ",(0,d.jsx)("a",{href:t,className:"button-secondary",children:(0,m.__)("Email","redirection")})]}),(0,d.jsx)("p",{children:(0,m.__)("Include these details in your report along with a description of what you were doing and a screenshot.","redirection")})]})};function fe({setStep:e,setOptions:t}){return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("h2",{children:(0,m.__)("Welcome to Redirection 🚀🎉","redirection")}),(0,d.jsx)("p",{children:(0,m.sprintf)(
// translators: %(version)s is the plugin version number
// translators: %(version)s is the plugin version number
(0,m.__)("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,d.jsx)("p",{children:(0,m.__)("Redirection is designed to be used on sites with a few redirects to sites with thousands of redirects.","redirection")}),(0,d.jsx)("h3",{children:(0,m.__)("How do I use this plugin?","redirection")}),(0,d.jsx)("p",{children:U((0,m.__)("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,d.jsx)("strong",{})})}),(0,d.jsx)("table",{className:"redirect-edit",children:(0,d.jsxs)("tbody",{children:[(0,d.jsxs)("tr",{children:[(0,d.jsxs)("th",{children:[(0,m.__)("Source URL","redirection"),":"]}),(0,d.jsx)("td",{children:(0,d.jsx)("input",{type:"text",className:"regular-text",readOnly:!0,value:(0,m.__)("(Example) The source URL is your old or original URL","redirection")})})]}),(0,d.jsxs)("tr",{children:[(0,d.jsxs)("th",{children:[(0,m.__)("Target URL","redirection"),":"]}),(0,d.jsx)("td",{children:(0,d.jsx)("input",{type:"text",className:"regular-text",readOnly:!0,value:(0,m.__)("(Example) The target URL is the new URL","redirection")})})]})]})}),(0,d.jsx)("p",{children:(0,m.__)("That's all there is to it - you are now redirecting! Note that the above is just an example.","redirection")}),(0,d.jsx)("p",{children:U((0,m.__)("Full documentation can be found on the {{link}}Redirection website.{{/link}}","redirection"),{link:(0,d.jsx)(z,{url:"https://redirection.me/support/"})})}),(0,d.jsxs)("h3",{children:[(0,m.__)("Some features you may find useful are","redirection"),":"]}),(0,d.jsxs)("ul",{children:[(0,d.jsx)("li",{children:U((0,m.__)("{{link}}Monitor 404 errors{{/link}}, get detailed information about the visitor, and fix any problems","redirection"),{link:(0,d.jsx)(z,{url:"https://redirection.me/support/tracking-404-errors/"})})}),(0,d.jsx)("li",{children:U((0,m.__)("{{link}}Import{{/link}} from .htaccess, CSV, and a variety of other plugins","redirection"),{link:(0,d.jsx)(z,{url:"https://redirection.me/support/import-export-redirects/"})})}),(0,d.jsx)("li",{children:U((0,m.__)("More powerful URL matching, including {{regular}}regular expressions{{/regular}}, and {{other}}other conditions{{/other}}","redirection"),{regular:(0,d.jsx)(z,{url:"https://redirection.me/support/redirect-regular-expressions/"}),other:(0,d.jsx)(z,{url:"https://redirection.me/support/matching-redirects/"})})}),(0,d.jsx)("li",{children:(0,m.__)("Check a URL is being redirected","redirection")})]}),(0,d.jsx)("h3",{children:(0,m.__)("What's next?","redirection")}),(0,d.jsx)("p",{children:(0,m.__)("First you will be asked a few questions, and then Redirection will set up your database.","redirection")}),(0,d.jsxs)("div",{className:"wizard-buttons",children:[(0,d.jsx)("button",{className:"button-primary button",onClick:function(){t({manual:!1}),e(1)},children:(0,m.__)("Start Setup","redirection")})," ",(0,d.jsx)("button",{className:"button-secondary button",onClick:function(){t({manual:!0}),e(4)},children:(0,m.__)("Manual Setup","redirection")})]})]})}var me=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(){}},ge={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},ye=new class{#e=ge;#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)}},ve="undefined"==typeof window||"Deno"in globalThis;function _e(){}function be(e){return"number"==typeof e&&e>=0&&e!==1/0}function xe(e,t){return Math.max(e+(t||0)-Date.now(),0)}function we(e,t){return"function"==typeof e?e(t):e}function je(e,t){return"function"==typeof e?e(t):e}function Se(e,t){const{type:n="all",exact:r,fetchStatus:i,predicate:o,queryKey:s,stale:a}=e;if(s)if(r){if(t.queryHash!==Ce(s,t.options))return!1}else if(!Ee(t.queryKey,s))return!1;if("all"!==n){const e=t.isActive();if("active"===n&&!e)return!1;if("inactive"===n&&e)return!1}return!("boolean"==typeof a&&t.isStale()!==a||i&&i!==t.state.fetchStatus||o&&!o(t))}function ke(e,t){const{exact:n,status:r,predicate:i,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(n){if(Te(t.options.mutationKey)!==Te(o))return!1}else if(!Ee(t.options.mutationKey,o))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function Ce(e,t){return(t?.queryKeyHashFn||Te)(e)}function Te(e){return JSON.stringify(e,(e,t)=>Ae(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function Ee(e,t){return e===t||typeof e==typeof t&&!(!e||!t||"object"!=typeof e||"object"!=typeof t)&&Object.keys(t).every(n=>Ee(e[n],t[n]))}var Pe=Object.prototype.hasOwnProperty;function Oe(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=Ne(e)&&Ne(t);if(!(r||Ae(e)&&Ae(t)))return t;const i=(r?e:Object.keys(e)).length,o=r?t:Object.keys(t),s=o.length,a=r?new Array(s):{};let l=0;for(let c=0;c<s;c++){const s=r?c:o[c],u=e[s],d=t[s];if(u===d){a[s]=u,(r?c<i:Pe.call(e,s))&&l++;continue}if(null===u||null===d||"object"!=typeof u||"object"!=typeof d){a[s]=d;continue}const p=Oe(u,d,n+1);a[s]=p,p===u&&l++}return i===s&&l===i?e:a}function Re(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function Ne(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Ae(e){if(!Ie(e))return!1;const t=e.constructor;if(void 0===t)return!0;const n=t.prototype;return!!Ie(n)&&!!n.hasOwnProperty("isPrototypeOf")&&Object.getPrototypeOf(e)===Object.prototype}function Ie(e){return"[object Object]"===Object.prototype.toString.call(e)}function ze(e,t,n){return"function"==typeof n.structuralSharing?n.structuralSharing(e,t):!1!==n.structuralSharing?Oe(e,t):t}function Fe(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function De(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Le=Symbol();function Me(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:e.queryFn&&e.queryFn!==Le?e.queryFn:()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`))}function $e(e,t){return"function"==typeof e?e(...t):!!e}var Ue=new class extends me{#n;#r;#i;constructor(){super(),this.#i=e=>{if(!ve&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#r||this.setEventListener(this.#i)}onUnsubscribe(){this.hasListeners()||(this.#r?.(),this.#r=void 0)}setEventListener(e){this.#i=e,this.#r?.(),this.#r=e(e=>{"boolean"==typeof e?this.setFocused(e):this.onFocus()})}setFocused(e){this.#n!==e&&(this.#n=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return"boolean"==typeof this.#n?this.#n:"hidden"!==globalThis.document?.visibilityState}},Be=function(e){setTimeout(e,0)},Ze=function(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Be;const o=r=>{t?e.push(r):i(()=>{n(r)})};return{batch:o=>{let s;t++;try{s=o()}finally{t--,t||(()=>{const t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})})()}return s},batchCalls:e=>(...t)=>{o(()=>{e(...t)})},schedule:o,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}(),qe=new class extends me{#o=!0;#r;#i;constructor(){super(),this.#i=e=>{if(!ve&&window.addEventListener){const t=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}}}onSubscribe(){this.#r||this.setEventListener(this.#i)}onUnsubscribe(){this.hasListeners()||(this.#r?.(),this.#r=void 0)}setEventListener(e){this.#i=e,this.#r?.(),this.#r=e(this.setOnline.bind(this))}setOnline(e){this.#o!==e&&(this.#o=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#o}};function He(){let e,t;const n=new Promise((n,r)=>{e=n,t=r});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.status="pending",n.catch(()=>{}),n.resolve=t=>{r({status:"fulfilled",value:t}),e(t)},n.reject=e=>{r({status:"rejected",reason:e}),t(e)},n}function We(e){return Math.min(1e3*2**e,3e4)}function Ge(e){return"online"!==(e??"online")||qe.isOnline()}var Ve=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function Qe(e){let t,n=!1,r=0;const i=He(),o=()=>"pending"!==i.status,s=()=>Ue.isFocused()&&("always"===e.networkMode||qe.isOnline())&&e.canRun(),a=()=>Ge(e.networkMode)&&e.canRun(),l=e=>{o()||(t?.(),i.resolve(e))},c=e=>{o()||(t?.(),i.reject(e))},u=()=>new Promise(n=>{t=e=>{(o()||s())&&n(e)},e.onPause?.()}).then(()=>{t=void 0,o()||e.onContinue?.()}),d=()=>{if(o())return;let t;const i=0===r?e.initialPromise:void 0;try{t=i??e.fn()}catch(e){t=Promise.reject(e)}Promise.resolve(t).then(l).catch(t=>{if(o())return;const i=e.retry??(ve?0:3),a=e.retryDelay??We,l="function"==typeof a?a(r,t):a,p=!0===i||"number"==typeof i&&r<i||"function"==typeof i&&i(r,t);var h;!n&&p?(r++,e.onFail?.(r,t),(h=l,new Promise(e=>{ye.setTimeout(e,h)})).then(()=>s()?void 0:u()).then(()=>{n?c(t):d()})):c(t)})};return{promise:i,status:()=>i.status,cancel:t=>{if(!o()){const n=new Ve(t);c(n),e.onCancel?.(n)}},continue:()=>(t?.(),i),cancelRetry:()=>{n=!0},continueRetry:()=>{n=!1},canStart:a,start:()=>(a()?d():u().then(d),i)}}var Ke=class{#s;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),be(this.gcTime)&&(this.#s=ye.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(ve?1/0:3e5))}clearGcTimeout(){this.#s&&(ye.clearTimeout(this.#s),this.#s=void 0)}},Je=class extends Ke{#a;#l;#c;#u;#d;#p;#h;constructor(e){super(),this.#h=!1,this.#p=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#u=e.client,this.#c=this.#u.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#a=et(this.options),this.state=e.state??this.#a,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#d?.promise}setOptions(e){if(this.options={...this.#p,...e},this.updateGcTime(this.options.gcTime),this.state&&void 0===this.state.data){const e=et(this.options);void 0!==e.data&&(this.setState(Xe(e.data,e.dataUpdatedAt)),this.#a=e)}}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||this.#c.remove(this)}setData(e,t){const n=ze(this.state.data,e,this.options);return this.#f({data:n,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#f({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#d?.promise;return this.#d?.cancel(e),t?t.then(_e).catch(_e):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#a)}isActive(){return this.observers.some(e=>!1!==je(e.options.enabled,this))}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Le||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>"static"===we(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||!xe(this.state.dataUpdatedAt,e))}onFocus(){const e=this.observers.find(e=>e.shouldFetchOnWindowFocus());e?.refetch({cancelRefetch:!1}),this.#d?.continue()}onOnline(){const e=this.observers.find(e=>e.shouldFetchOnReconnect());e?.refetch({cancelRefetch:!1}),this.#d?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#c.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#d&&(this.#h?this.#d.cancel({revert:!0}):this.#d.cancelRetry()),this.scheduleGc()),this.#c.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#f({type:"invalidate"})}async fetch(e,t){if("idle"!==this.state.fetchStatus&&"rejected"!==this.#d?.status())if(void 0!==this.state.data&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#d)return this.#d.continueRetry(),this.#d.promise;if(e&&this.setOptions(e),!this.options.queryFn){const e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}const n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#h=!0,n.signal)})},i=()=>{const e=Me(this.options,t),n=(()=>{const e={client:this.#u,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#h=!1,this.options.persister?this.options.persister(e,n,this):e(n)},o=(()=>{const e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#u,state:this.state,fetchFn:i};return r(e),e})();this.options.behavior?.onFetch(o,this),this.#l=this.state,"idle"!==this.state.fetchStatus&&this.state.fetchMeta===o.fetchOptions?.meta||this.#f({type:"fetch",meta:o.fetchOptions?.meta}),this.#d=Qe({initialPromise:t?.initialPromise,fn:o.fetchFn,onCancel:e=>{e instanceof Ve&&e.revert&&this.setState({...this.#l,fetchStatus:"idle"}),n.abort()},onFail:(e,t)=>{this.#f({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#f({type:"pause"})},onContinue:()=>{this.#f({type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0});try{const e=await this.#d.start();if(void 0===e)throw new Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#c.config.onSuccess?.(e,this),this.#c.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Ve){if(e.silent)return this.#d.promise;if(e.revert){if(void 0===this.state.data)throw e;return this.state.data}}throw this.#f({type:"error",error:e}),this.#c.config.onError?.(e,this),this.#c.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#f(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,...Ye(t.data,this.options),fetchMeta:e.meta??null};case"success":const n={...t,...Xe(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#l=e.manual?n:void 0,n;case"error":const r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...t,isInvalidated:!0};case"setState":return{...t,...e.state}}})(this.state),Ze.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#c.notify({query:this,type:"updated",action:e})})}};function Ye(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ge(t.networkMode)?"fetching":"paused",...void 0===e&&{error:null,status:"pending"}}}function Xe(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function et(e){const t="function"==typeof e.initialData?e.initialData():e.initialData,n=void 0!==t,r=n?"function"==typeof e.initialDataUpdatedAt?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var tt=class extends me{constructor(e,t){super(),this.options=t,this.#u=e,this.#m=null,this.#g=He(),this.bindMethods(),this.setOptions(t)}#u;#y=void 0;#v=void 0;#_=void 0;#b;#x;#g;#m;#w;#j;#S;#k;#C;#T;#E=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#y.addObserver(this),nt(this.#y,this.options)?this.#P():this.updateResult(),this.#O())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return rt(this.#y,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return rt(this.#y,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#R(),this.#N(),this.#y.removeObserver(this)}setOptions(e){const t=this.options,n=this.#y;if(this.options=this.#u.defaultQueryOptions(e),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof je(this.options.enabled,this.#y))throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#A(),this.#y.setOptions(this.options),t._defaulted&&!Re(this.options,t)&&this.#u.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#y,observer:this});const r=this.hasListeners();r&&it(this.#y,n,this.options,t)&&this.#P(),this.updateResult(),!r||this.#y===n&&je(this.options.enabled,this.#y)===je(t.enabled,this.#y)&&we(this.options.staleTime,this.#y)===we(t.staleTime,this.#y)||this.#I();const i=this.#z();!r||this.#y===n&&je(this.options.enabled,this.#y)===je(t.enabled,this.#y)&&i===this.#T||this.#F(i)}getOptimisticResult(e){const t=this.#u.getQueryCache().build(this.#u,e),n=this.createResult(t,e);return r=n,!Re(this.getCurrentResult(),r)&&(this.#_=n,this.#x=this.options,this.#b=this.#y.state),n;var r}getCurrentResult(){return this.#_}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),"promise"===n&&(this.trackProp("data"),this.options.experimental_prefetchInRender||"pending"!==this.#g.status||this.#g.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(e,n))})}trackProp(e){this.#E.add(e)}getCurrentQuery(){return this.#y}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#u.defaultQueryOptions(e),n=this.#u.getQueryCache().build(this.#u,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#P({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#_))}#P(e){this.#A();let t=this.#y.fetch(this.options,e);return e?.throwOnError||(t=t.catch(_e)),t}#I(){this.#R();const e=we(this.options.staleTime,this.#y);if(ve||this.#_.isStale||!be(e))return;const t=xe(this.#_.dataUpdatedAt,e)+1;this.#k=ye.setTimeout(()=>{this.#_.isStale||this.updateResult()},t)}#z(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#y):this.options.refetchInterval)??!1}#F(e){this.#N(),this.#T=e,!ve&&!1!==je(this.options.enabled,this.#y)&&be(this.#T)&&0!==this.#T&&(this.#C=ye.setInterval(()=>{(this.options.refetchIntervalInBackground||Ue.isFocused())&&this.#P()},this.#T))}#O(){this.#I(),this.#F(this.#z())}#R(){this.#k&&(ye.clearTimeout(this.#k),this.#k=void 0)}#N(){this.#C&&(ye.clearInterval(this.#C),this.#C=void 0)}createResult(e,t){const n=this.#y,r=this.options,i=this.#_,o=this.#b,s=this.#x,a=e!==n?e.state:this.#v,{state:l}=e;let c,u={...l},d=!1;if(t._optimisticResults){const i=this.hasListeners(),o=!i&&nt(e,t),s=i&&it(e,n,t,r);(o||s)&&(u={...u,...Ye(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=ze(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=ze(i?.data,c,t),this.#j=c,this.#m=null}catch(e){this.#m=e}this.#m&&(p=this.#m,c=this.#j,h=Date.now(),f="error");const g="fetching"===u.fetchStatus,y="pending"===f,v="error"===f,_=y&&g,b=void 0!==c,x={status:f,fetchStatus:u.fetchStatus,isPending:y,isSuccess:"success"===f,isError:v,isInitialLoading:_,isLoading:_,data:c,dataUpdatedAt:u.dataUpdatedAt,error:p,errorUpdatedAt:h,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:u.dataUpdateCount>0||u.errorUpdateCount>0,isFetchedAfterMount:u.dataUpdateCount>a.dataUpdateCount||u.errorUpdateCount>a.errorUpdateCount,isFetching:g,isRefetching:g&&!y,isLoadingError:v&&!b,isPaused:"paused"===u.fetchStatus,isPlaceholderData:d,isRefetchError:v&&b,isStale:ot(e,t),refetch:this.refetch,promise:this.#g,isEnabled:!1!==je(t.enabled,e)};if(this.options.experimental_prefetchInRender){const t=void 0!==x.data,r="error"===x.status&&!t,i=e=>{r?e.reject(x.error):t&&e.resolve(x.data)},o=()=>{const e=this.#g=x.promise=He();i(e)},s=this.#g;switch(s.status){case"pending":e.queryHash===n.queryHash&&i(s);break;case"fulfilled":(r||x.data!==s.value)&&o();break;case"rejected":r&&x.error===s.reason||o()}}return x}updateResult(){const e=this.#_,t=this.createResult(this.#y,this.options);this.#b=this.#y.state,this.#x=this.options,void 0!==this.#b.data&&(this.#S=this.#y),Re(t,e)||(this.#_=t,this.#D({listeners:(()=>{if(!e)return!0;const{notifyOnChangeProps:t}=this.options,n="function"==typeof t?t():t;if("all"===n||!n&&!this.#E.size)return!0;const r=new Set(n??this.#E);return this.options.throwOnError&&r.add("error"),Object.keys(this.#_).some(t=>{const n=t;return this.#_[n]!==e[n]&&r.has(n)})})()}))}#A(){const e=this.#u.getQueryCache().build(this.#u,this.options);if(e===this.#y)return;const t=this.#y;this.#y=e,this.#v=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#O()}#D(e){Ze.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#_)}),this.#u.getQueryCache().notify({query:this.#y,type:"observerResultsUpdated"})})}};function nt(e,t){return function(e,t){return!1!==je(t.enabled,e)&&void 0===e.state.data&&!("error"===e.state.status&&!1===t.retryOnMount)}(e,t)||void 0!==e.state.data&&rt(e,t,t.refetchOnMount)}function rt(e,t,n){if(!1!==je(t.enabled,e)&&"static"!==we(t.staleTime,e)){const r="function"==typeof n?n(e):n;return"always"===r||!1!==r&&ot(e,t)}return!1}function it(e,t,n,r){return(e!==t||!1===je(r.enabled,e))&&(!n.suspense||"error"!==e.state.status)&&ot(e,n)}function ot(e,t){return!1!==je(t.enabled,e)&&e.isStaleByTime(we(t.staleTime,e))}var st=l.createContext(function(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}()),at=l.createContext(!1),lt=(at.Provider,(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()}));function ct(e,t){return function(e,t,n){const r=l.useContext(at),i=l.useContext(st),o=h(n),s=o.defaultQueryOptions(e);o.getDefaultOptions().queries?._experimental_beforeQuery?.(s);const a=o.getQueryCache().get(s.queryHash);s._optimisticResults=r?"isRestoring":"optimistic",(e=>{if(e.suspense){const t=1e3,n=e=>"static"===e?e:Math.max(e??t,t),r=e.staleTime;e.staleTime="function"==typeof r?(...e)=>n(r(...e)):n(r),"number"==typeof e.gcTime&&(e.gcTime=Math.max(e.gcTime,t))}})(s),((e,t,n)=>{const r=n?.state.error&&"function"==typeof e.throwOnError?$e(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))})(s,i,a),(e=>{l.useEffect(()=>{e.clearReset()},[e])})(i);const c=!o.getQueryCache().get(s.queryHash),[u]=l.useState(()=>new t(o,s)),d=u.getOptimisticResult(s),p=!r&&!1!==e.subscribed;if(l.useSyncExternalStore(l.useCallback(e=>{const t=p?u.subscribe(Ze.batchCalls(e)):_e;return u.updateResult(),t},[u,p]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),l.useEffect(()=>{u.setOptions(s)},[s,u]),((e,t)=>e?.suspense&&t.isPending)(s,d))throw lt(s,u,i);if((({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&void 0===e.data||$e(n,[e.error,r])))({result:d,errorResetBoundary:i,throwOnError:s.throwOnError,query:a,suspense:s.suspense}))throw d.error;if(o.getDefaultOptions().queries?._experimental_afterQuery?.(s,d),s.experimental_prefetchInRender&&!ve&&((e,t)=>e.isLoading&&e.isFetching&&!t)(d,r)){const e=c?lt(s,u,i):a?.promise;e?.catch(_e).finally(()=>{u.updateResult()})}return s.notifyOnChangeProps?d:u.trackResult(d)}(e,tt,t)}var ut=class extends Ke{#u;#L;#M;#d;constructor(e){super(),this.#u=e.client,this.mutationId=e.mutationId,this.#M=e.mutationCache,this.#L=[],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.#L.includes(e)||(this.#L.push(e),this.clearGcTimeout(),this.#M.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#L=this.#L.filter(t=>t!==e),this.scheduleGc(),this.#M.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#L.length||("pending"===this.state.status?this.scheduleGc():this.#M.remove(this))}continue(){return this.#d?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#f({type:"continue"})},n={client:this.#u,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#d=Qe({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(new Error("No mutationFn found")),onFail:(e,t)=>{this.#f({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#f({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#M.canRun(this)});const r="pending"===this.state.status,i=!this.#d.canStart();try{if(r)t();else{this.#f({type:"pending",variables:e,isPaused:i}),this.#M.config.onMutate&&await this.#M.config.onMutate(e,this,n);const t=await(this.options.onMutate?.(e,n));t!==this.state.context&&this.#f({type:"pending",context:t,variables:e,isPaused:i})}const o=await this.#d.start();return await(this.#M.config.onSuccess?.(o,e,this.state.context,this,n)),await(this.options.onSuccess?.(o,e,this.state.context,n)),await(this.#M.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n)),await(this.options.onSettled?.(o,null,e,this.state.context,n)),this.#f({type:"success",data:o}),o}catch(t){try{await(this.#M.config.onError?.(t,e,this.state.context,this,n))}catch(e){Promise.reject(e)}try{await(this.options.onError?.(t,e,this.state.context,n))}catch(e){Promise.reject(e)}try{await(this.#M.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n))}catch(e){Promise.reject(e)}try{await(this.options.onSettled?.(void 0,t,e,this.state.context,n))}catch(e){Promise.reject(e)}throw this.#f({type:"error",error:t}),t}finally{this.#M.runNext(this)}}#f(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),Ze.batch(()=>{this.#L.forEach(t=>{t.onMutationUpdate(e)}),this.#M.notify({mutation:this,type:"updated",action:e})})}},dt=class extends me{#u;#_=void 0;#$;#U;constructor(e,t){super(),this.#u=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.#u.defaultMutationOptions(e),Re(this.options,t)||this.#u.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#$,observer:this}),t?.mutationKey&&this.options.mutationKey&&Te(t.mutationKey)!==Te(this.options.mutationKey)?this.reset():"pending"===this.#$?.state.status&&this.#$.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#$?.removeObserver(this)}onMutationUpdate(e){this.#B(),this.#D(e)}getCurrentResult(){return this.#_}reset(){this.#$?.removeObserver(this),this.#$=void 0,this.#B(),this.#D()}mutate(e,t){return this.#U=t,this.#$?.removeObserver(this),this.#$=this.#u.getMutationCache().build(this.#u,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}}#D(e){Ze.batch(()=>{if(this.#U&&this.hasListeners()){const t=this.#_.variables,n=this.#_.context,r={client:this.#u,meta:this.options.meta,mutationKey:this.options.mutationKey};if("success"===e?.type){try{this.#U.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#U.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if("error"===e?.type){try{this.#U.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#U.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#_)})})}};function pt(e,t){const n=h(t),[r]=l.useState(()=>new dt(n,e));l.useEffect(()=>{r.setOptions(e)},[r,e]);const i=l.useSyncExternalStore(l.useCallback(e=>r.subscribe(Ze.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),o=l.useCallback((e,t)=>{r.mutate(e,t).catch(_e)},[r]);if(i.error&&$e(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:o,mutateAsync:i.mutate}}const ht=e=>"object"==typeof e&&null!==e,ft=e=>0===e?"Admin AJAX returned 0":"string"==typeof e?e:ht(e)&&e.message?e.message:(console.error(e),"Unknown error "+(ht(e)?Object.keys(e):e)),mt=e=>"number"==typeof e?`${e}`:ht(e)&&e.error_code?e.error_code:ht(e)&&e.code?e.code:ht(e)&&e.name?e.name:ht(e)&&e.data?.error_code?e.data.error_code:String(e);function gt(e,t){return function(e){return e.replace("wp-json/wp-json","wp-json").replace("=/wp-json","=")}((n=function(e){return e.replace(/\/$/,"")}(e),r=function(e,t){return-1!==e.indexOf("?")?t.replace("?","&"):t}(e,function(e){return e.replace(/^\//,"")}(t)),n+"/"+r));var n,r}let yt=[];function vt(e,t,n){return{code:mt(e),message:ft(t),request:n,data:n.apiFetch?.data?n.apiFetch?.data:null,jsonData:e&&e.data?e.data:null}}const _t=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 n=t.apiFetch?.status;if(""===e&&void 0!==n&&(n<200||n>300))return e;try{const n=JSON.parse(e.replace(/\ufeff/,""));if(0===n)throw vt("json-zero","Failed to get data",t);return n}catch(e){throw vt(e,e?.message,t)}})(t,e)).then(t=>((e,t)=>{if(e?.error||e?.error_code)throw vt(e,e.message,t);if(t.apiFetch){const{status:n,statusText:r}=t.apiFetch;if(e?.code&&e?.message)throw vt(e,e,t);if(void 0!==n&&(n<200||n>=300))throw vt(n,r,t)}return e})(t,e)))(e)],n=e=>r=>{const i=t[e];return i?i(r,e===t.length-1?()=>Promise.resolve():n(e+1)):Promise.reject(new Error("Middleware step is undefined"))};return new Promise((t,r)=>{n(0)(e).then(e=>t(e)).catch(n=>{if("rest_cookie_invalid_nonce"!==n.code)return r(n);window.fetch("admin-ajax.php?action=rest-nonce").then(_t).then(xt).then(n=>{wt.nonceMiddleware.nonce=n,wt(e).then(t).catch(r)}).catch(r)})})};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,n)=>{const{headers:r={}}=e;for(const i in r)if("x-wp-nonce"===i.toLowerCase()&&r[i]===t.nonce)return n(e);return n({...e,headers:{...r,"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,n)=>t.url.startsWith("http")?n(t):n({...t,url:gt(e,t.url)});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 n=e+"/";if(Object.keys(t).length>0){const e=function(e){const t=new URLSearchParams;function n(e,r){for(const i in r){const o=r[i];if(null!=o)if(Array.isArray(o))for(const n of o)null!=n&&t.append(`${e}[${i}][]`,String(n));else"object"==typeof o?n(`${e}[${i}]`,o):t.append(`${e}[${i}]`,String(o))}}for(const r in e){const i=e[r];if(null!=i)if(Array.isArray(i))for(const e of i)null!=e&&t.append(`${r}[]`,String(e));else"object"==typeof i?n(r,i):t.append(r,String(i))}return t.toString()}(t);if(e.length>0)return n+(-1===n.indexOf("?")?"?":"&")+e}return n},kt=(e,t={})=>({headers:{Accept:"application/json, */*;q=0.1"},url:St(e,t),credentials:"include",method:"get",redirect:"error"}),Ct=(e,t={},n={})=>{const r={headers:{"Content-Type":"application/json; charset=utf-8",Accept:"application/json, */*;q=0.1"},url:St(e,n),credentials:"include",method:"post",body:"{}"};return Object.keys(t).length>0&&(r.body=JSON.stringify(t)),r},Tt=(e,t={},n={})=>Ct(e,t,n),Et=()=>kt("redirection/v1/setting"),Pt=e=>Ct("redirection/v1/setting",e),Ot=e=>kt("redirection/v1/redirect",e),Rt=(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),zt=(e,t)=>Ct("redirection/v1/group/"+e,t),Ft=(e,t)=>Ct("redirection/v1/group",e,t),Dt=e=>kt("redirection/v1/log",e),Lt=e=>kt("redirection/v1/404",e),Mt=(e,t)=>((e,t,n)=>{const r=Ct(e,{});delete r.headers["Content-Type"];const i=new FormData;return i.append("file",n),r.body=i,r})("redirection/v1/import/file/"+e,0,t),$t=()=>kt("redirection/v1/import/plugin"),Ut=e=>Ct("redirection/v1/import/plugin",{plugin:e}),Bt=(e,t)=>kt("redirection/v1/export/"+e+"/"+t),Zt=()=>kt("redirection/v1/plugin"),qt=()=>Tt("redirection/v1/plugin/delete"),Ht=e=>Ct("redirection/v1/plugin/data",e?{upgrade:e}:{}),Wt=()=>Ct("redirection/v1/plugin/finish",{}),Gt=(e,t)=>Ct("redirection/v1/plugin/fix",{reason:e,current:t}),Vt=(e,t,n)=>Ct("redirection/v1/bulk/redirect/"+e,t,n),Qt=(e,t,n)=>Ct("redirection/v1/bulk/group/"+e,t,n),Kt=(e,t,n)=>Ct("redirection/v1/bulk/log/"+e,t,n),Jt=(e,t,n)=>Ct("redirection/v1/bulk/404/"+e,t,n),Yt=(e,t=1)=>`https://api.redirect.li/v${t}/`+e,Xt=e=>({url:Yt("useragent/"+encodeURIComponent(e)),method:"get"}),en=e=>({url:Yt("http?url="+encodeURIComponent(e),2),method:"get"});function tn(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:s,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);const i=s.prototype,o=Object.keys(i);for(let e=0;e<o.length;e++){const t=o[e];t in n||(n[t]=i[t].bind(n))}}const i=n?.Parent??Object;class o extends i{}function s(e){var t;const i=n?.Parent?new o:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(const e of i._zod.deferred)e();return i}return Object.defineProperty(o,"name",{value:e}),Object.defineProperty(s,"init",{value:r}),Object.defineProperty(s,Symbol.hasInstance,{value:t=>!!(n?.Parent&&t instanceof n.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}Object.freeze({status:"aborted"}),Symbol("zod_brand");class nn extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class rn extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const on={};function sn(e){return e&&Object.assign(on,e),on}function an(e){const t=Object.values(e).filter(e=>"number"==typeof e),n=Object.entries(e).filter(([e,n])=>-1===t.indexOf(+e)).map(([e,t])=>t);return n}function ln(e,t="|"){return e.map(e=>Pn(e)).join(t)}function cn(e,t){return"bigint"==typeof t?t.toString():t}function un(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function dn(e){return null==e}function pn(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}const hn=Symbol("evaluating");function fn(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==hn)return void 0===r&&(r=hn,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function mn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function gn(...e){const t={};for(const n of e){const e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function yn(e){return JSON.stringify(e)}const vn="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function bn(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const xn=un(()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function wn(e){if(!1===bn(e))return!1;const t=e.constructor;if(void 0===t)return!0;if("function"!=typeof t)return!0;const n=t.prototype;return!1!==bn(n)&&!1!==Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")}function jn(e){return wn(e)?{...e}:Array.isArray(e)?[...e]:e}const Sn=new Set(["string","number","symbol"]),kn=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Cn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Tn(e,t,n){const r=new e._zod.constr(t??e._zod.def);return t&&!n?.parent||(r._zod.parent=e),r}function En(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 Pn(e){return"bigint"==typeof e?e.toString()+"n":"string"==typeof e?`"${e}"`:`${e}`}const On={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]},Rn={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Nn(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!0!==e.issues[n]?.continue)return!0;return!1}function An(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function In(e){return"string"==typeof e?e:e?.message}function zn(e,t,n){const r={...e,path:e.path??[]};if(!e.message){const i=In(e.inst?._zod.def?.error?.(e))??In(t?.error?.(e))??In(n.customError?.(e))??In(n.localeError?.(e))??"Invalid input";r.message=i}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function Fn(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Dn(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function Ln(...e){const[t,n,r]=e;return"string"==typeof t?{message:t,code:"custom",input:n,inst:r}:{...t}}const Mn=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,cn,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},$n=tn("$ZodError",Mn),Un=tn("$ZodError",Mn,{Parent:Error}),Bn=e=>(t,n,r,i)=>{const o=r?Object.assign(r,{async:!1}):{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new nn;if(s.issues.length){const t=new(i?.Err??e)(s.issues.map(e=>zn(e,o,sn())));throw vn(t,i?.callee),t}return s.value},Zn=Bn(Un),qn=e=>async(t,n,r,i)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){const t=new(i?.Err??e)(s.issues.map(e=>zn(e,o,sn())));throw vn(t,i?.callee),t}return s.value},Hn=qn(Un),Wn=e=>(t,n,r)=>{const i=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},i);if(o instanceof Promise)throw new nn;return o.issues.length?{success:!1,error:new(e??$n)(o.issues.map(e=>zn(e,i,sn())))}:{success:!0,data:o.value}},Gn=Wn(Un),Vn=e=>async(t,n,r)=>{const i=r?Object.assign(r,{async:!0}):{async:!0};let o=t._zod.run({value:n,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(e=>zn(e,i,sn())))}:{success:!0,data:o.value}},Qn=Vn(Un),Kn=e=>(t,n,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Bn(e)(t,n,i)},Jn=e=>(t,n,r)=>Bn(e)(t,n,r),Yn=e=>async(t,n,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return qn(e)(t,n,i)},Xn=e=>async(t,n,r)=>qn(e)(t,n,r),er=e=>(t,n,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Wn(e)(t,n,i)},tr=e=>(t,n,r)=>Wn(e)(t,n,r),nr=e=>async(t,n,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Vn(e)(t,n,i)},rr=e=>async(t,n,r)=>Vn(e)(t,n,r),ir=/^[cC][^\s-]{8,}$/,or=/^[0-9a-z]+$/,sr=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,ar=/^[0-9a-vA-V]{20}$/,lr=/^[A-Za-z0-9]{27}$/,cr=/^[a-zA-Z0-9_-]{21}$/,ur=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,dr=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,pr=/^([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})$/,hr=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)$/,fr=hr(4),mr=hr(6),gr=hr(7),yr=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,vr=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,_r=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,br=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,xr=br,wr=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;function jr(){return new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}const Sr=/^(?:(?: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])$/,kr=/^(([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}|:))$/,Cr=e=>{const t=Cn(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},Tr=/^((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])$/,Er=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Pr=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Or=/^[A-Za-z0-9_-]*$/,Rr=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,Nr=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,Ar=/^\+[1-9]\d{6,14}$/,Ir="(?:(?:\\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])))",zr=new RegExp(`^${Ir}$`);function Fr(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Dr(e){return new RegExp(`^${Fr(e)}$`)}function Lr(e){const t=Fr({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${Ir}T(?:${r})$`)}const Mr=e=>new RegExp(`^${e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*"}$`),$r=/^-?\d+n?$/,Ur=/^-?\d+$/,Br=/^-?\d+(?:\.\d+)?$/,Zr=/^(?:true|false)$/i,qr=/^null$/i,Hr=/^undefined$/i,Wr=/^[^A-Z]*$/,Gr=/^[^a-z]*$/,Vr=/^[0-9a-fA-F]*$/;function Qr(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function Kr(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}const Jr=/^[0-9a-fA-F]{32}$/,Yr=Qr(22,"=="),Xr=Kr(22),ei=/^[0-9a-fA-F]{40}$/,ti=Qr(27,"="),ni=Kr(27),ri=/^[0-9a-fA-F]{64}$/,ii=Qr(43,"="),oi=Kr(43),si=/^[0-9a-fA-F]{96}$/,ai=Qr(64,""),li=Kr(64),ci=/^[0-9a-fA-F]{128}$/,ui=Qr(86,"=="),di=Kr(86),pi=tn("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),hi={number:"number",bigint:"bigint",object:"date"},fi=tn("$ZodCheckLessThan",(e,t)=>{pi.init(e,t);const n=hi[typeof t.value];e._zod.onattach.push(e=>{const n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:"object"==typeof t.value?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),mi=tn("$ZodCheckGreaterThan",(e,t)=>{pi.init(e,t);const n=hi[typeof t.value];e._zod.onattach.push(e=>{const n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:"object"==typeof t.value?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),gi=tn("$ZodCheckMultipleOf",(e,t)=>{pi.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");const r="bigint"==typeof n.value?n.value%t.value===BigInt(0):0===function(e,t){const n=(e.toString().split(".")[1]||"").length,r=t.toString();let i=(r.split(".")[1]||"").length;if(0===i&&/\d?e-\d?/.test(r)){const e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}const o=n>i?n:i;return Number.parseInt(e.toFixed(o).replace(".",""))%Number.parseInt(t.toFixed(o).replace(".",""))/10**o}(n.value,t.value);r||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),yi=tn("$ZodCheckNumberFormat",(e,t)=>{pi.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[i,o]=On[t.format];e._zod.onattach.push(e=>{const r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=o,n&&(r.pattern=Ur)}),e._zod.check=s=>{const a=s.value;if(n){if(!Number.isInteger(a))return void s.issues.push({expected:r,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:r,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:r,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})}}),vi=tn("$ZodCheckBigIntFormat",(e,t)=>{pi.init(e,t);const[n,r]=Rn[t.format];e._zod.onattach.push(e=>{const i=e._zod.bag;i.format=t.format,i.minimum=n,i.maximum=r}),e._zod.check=i=>{const o=i.value;o<n&&i.issues.push({origin:"bigint",input:o,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),o>r&&i.issues.push({origin:"bigint",input:o,code:"too_big",maximum:r,inclusive:!0,inst:e,continue:!t.abort})}}),_i=tn("$ZodCheckMaxSize",(e,t)=>{var n;pi.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!dn(t)&&void 0!==t.size}),e._zod.onattach.push(e=>{const n=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const r=n.value;r.size<=t.maximum||n.issues.push({origin:Fn(r),code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),bi=tn("$ZodCheckMinSize",(e,t)=>{var n;pi.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!dn(t)&&void 0!==t.size}),e._zod.onattach.push(e=>{const n=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const r=n.value;r.size>=t.minimum||n.issues.push({origin:Fn(r),code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),xi=tn("$ZodCheckSizeEquals",(e,t)=>{var n;pi.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!dn(t)&&void 0!==t.size}),e._zod.onattach.push(e=>{const n=e._zod.bag;n.minimum=t.size,n.maximum=t.size,n.size=t.size}),e._zod.check=n=>{const r=n.value,i=r.size;if(i===t.size)return;const o=i>t.size;n.issues.push({origin:Fn(r),...o?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),wi=tn("$ZodCheckMaxLength",(e,t)=>{var n;pi.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!dn(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const r=n.value;if(r.length<=t.maximum)return;const i=Dn(r);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),ji=tn("$ZodCheckMinLength",(e,t)=>{var n;pi.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!dn(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const r=n.value;if(r.length>=t.minimum)return;const i=Dn(r);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Si=tn("$ZodCheckLengthEquals",(e,t)=>{var n;pi.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!dn(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{const r=n.value,i=r.length;if(i===t.length)return;const o=Dn(r),s=i>t.length;n.issues.push({origin:o,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),ki=tn("$ZodCheckStringFormat",(e,t)=>{var n,r;pi.init(e,t),e._zod.onattach.push(e=>{const n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??(n.patterns=new Set),n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Ci=tn("$ZodCheckRegex",(e,t)=>{ki.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Ti=tn("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Wr),ki.init(e,t)}),Ei=tn("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Gr),ki.init(e,t)}),Pi=tn("$ZodCheckIncludes",(e,t)=>{pi.init(e,t);const n=Cn(t.includes),r=new RegExp("number"==typeof t.position?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Oi=tn("$ZodCheckStartsWith",(e,t)=>{pi.init(e,t);const n=new RegExp(`^${Cn(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Ri=tn("$ZodCheckEndsWith",(e,t)=>{pi.init(e,t);const n=new RegExp(`.*${Cn(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});function Ni(e,t,n){e.issues.length&&t.issues.push(...An(n,e.issues))}const Ai=tn("$ZodCheckProperty",(e,t)=>{pi.init(e,t),e._zod.check=e=>{const n=t.schema._zod.run({value:e.value[t.property],issues:[]},{});if(n instanceof Promise)return n.then(n=>Ni(n,e,t.property));Ni(n,e,t.property)}}),Ii=tn("$ZodCheckMimeType",(e,t)=>{pi.init(e,t);const n=new Set(t.mime);e._zod.onattach.push(e=>{e._zod.bag.mime=t.mime}),e._zod.check=r=>{n.has(r.value.type)||r.issues.push({code:"invalid_value",values:t.mime,input:r.value.type,inst:e,continue:!t.abort})}}),zi=tn("$ZodCheckOverwrite",(e,t)=>{pi.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class Fi{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>" ".repeat(2*this.indent)+e);for(const e of r)this.content.push(e)}compile(){const e=Function,t=this?.args,n=[...(this?.content??[""]).map(e=>`  ${e}`)];return new e(...t,n.join("\n"))}}const Di={major:4,minor:3,patch:6},Li=tn("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Di;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const t of r)for(const n of t._zod.onattach)n(e);if(0===r.length)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const t=(e,t,n)=>{let r,i=Nn(e);for(const o of t){if(o._zod.def.when){if(!o._zod.def.when(e))continue}else if(i)continue;const t=e.issues.length,s=o._zod.check(e);if(s instanceof Promise&&!1===n?.async)throw new nn;if(r||s instanceof Promise)r=(r??Promise.resolve()).then(async()=>{await s,e.issues.length!==t&&(i||(i=Nn(e,t)))});else{if(e.issues.length===t)continue;i||(i=Nn(e,t))}}return r?r.then(()=>e):e},n=(n,i,o)=>{if(Nn(n))return n.aborted=!0,n;const s=t(i,r,o);if(s instanceof Promise){if(!1===o.async)throw new nn;return s.then(t=>e._zod.parse(t,o))}return e._zod.parse(s,o)};e._zod.run=(i,o)=>{if(o.skipChecks)return e._zod.parse(i,o);if("backward"===o.direction){const t=e._zod.parse({value:i.value,issues:[]},{...o,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,o)):n(t,i,o)}const s=e._zod.parse(i,o);if(s instanceof Promise){if(!1===o.async)throw new nn;return s.then(e=>t(e,r,o))}return t(s,r,o)}}fn(e,"~standard",()=>({validate:t=>{try{const n=Gn(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(n){return Qn(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),Mi=tn("$ZodString",(e,t)=>{Li.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Mr(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch(r){}return"string"==typeof n.value||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),$i=tn("$ZodStringFormat",(e,t)=>{ki.init(e,t),Mi.init(e,t)}),Ui=tn("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=pr),$i.init(e,t)}),Bi=tn("$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=hr(e))}else t.pattern??(t.pattern=hr());$i.init(e,t)}),Zi=tn("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=yr),$i.init(e,t)}),qi=tn("$ZodURL",(e,t)=>{$i.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),i=new URL(r);return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),void(t.normalize?n.value=i.href:n.value=r)}catch(r){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Hi=tn("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=jr()),$i.init(e,t)}),Wi=tn("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=cr),$i.init(e,t)}),Gi=tn("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=ir),$i.init(e,t)}),Vi=tn("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=or),$i.init(e,t)}),Qi=tn("$ZodULID",(e,t)=>{t.pattern??(t.pattern=sr),$i.init(e,t)}),Ki=tn("$ZodXID",(e,t)=>{t.pattern??(t.pattern=ar),$i.init(e,t)}),Ji=tn("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=lr),$i.init(e,t)}),Yi=tn("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Lr(t)),$i.init(e,t)}),Xi=tn("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=zr),$i.init(e,t)}),eo=tn("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Dr(t)),$i.init(e,t)}),to=tn("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=ur),$i.init(e,t)}),no=tn("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Sr),$i.init(e,t),e._zod.bag.format="ipv4"}),ro=tn("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=kr),$i.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),io=tn("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=Cr(t.delimiter)),$i.init(e,t),e._zod.bag.format="mac"}),oo=tn("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Tr),$i.init(e,t)}),so=tn("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Er),$i.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(2!==r.length)throw new Error;const[e,t]=r;if(!t)throw new Error;const n=Number(t);if(`${n}`!==t)throw new Error;if(n<0||n>128)throw new Error;new URL(`http://[${e}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function ao(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const lo=tn("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Pr),$i.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{ao(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}),co=tn("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Or),$i.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{(function(e){if(!Or.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return ao(t.padEnd(4*Math.ceil(t.length/4),"="))})(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),uo=tn("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Ar),$i.init(e,t)}),po=tn("$ZodJWT",(e,t)=>{$i.init(e,t),e._zod.check=n=>{(function(e,t=null){try{const n=e.split(".");if(3!==n.length)return!1;const[r]=n;if(!r)return!1;const i=JSON.parse(atob(r));return!("typ"in i&&"JWT"!==i?.typ||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}})(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),ho=tn("$ZodCustomStringFormat",(e,t)=>{$i.init(e,t),e._zod.check=n=>{t.fn(n.value)||n.issues.push({code:"invalid_format",format:t.format,input:n.value,inst:e,continue:!t.abort})}}),fo=tn("$ZodNumber",(e,t)=>{Li.init(e,t),e._zod.pattern=e._zod.bag.pattern??Br,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch(e){}const i=n.value;if("number"==typeof i&&!Number.isNaN(i)&&Number.isFinite(i))return n;const o="number"==typeof i?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...o?{received:o}:{}}),n}}),mo=tn("$ZodNumberFormat",(e,t)=>{yi.init(e,t),fo.init(e,t)}),go=tn("$ZodBoolean",(e,t)=>{Li.init(e,t),e._zod.pattern=Zr,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(e){}const i=n.value;return"boolean"==typeof i||n.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),n}}),yo=tn("$ZodBigInt",(e,t)=>{Li.init(e,t),e._zod.pattern=$r,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch(e){}return"bigint"==typeof n.value||n.issues.push({expected:"bigint",code:"invalid_type",input:n.value,inst:e}),n}}),vo=tn("$ZodBigIntFormat",(e,t)=>{vi.init(e,t),yo.init(e,t)}),_o=tn("$ZodSymbol",(e,t)=>{Li.init(e,t),e._zod.parse=(t,n)=>{const r=t.value;return"symbol"==typeof r||t.issues.push({expected:"symbol",code:"invalid_type",input:r,inst:e}),t}}),bo=tn("$ZodUndefined",(e,t)=>{Li.init(e,t),e._zod.pattern=Hr,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(t,n)=>{const r=t.value;return void 0===r||t.issues.push({expected:"undefined",code:"invalid_type",input:r,inst:e}),t}}),xo=tn("$ZodNull",(e,t)=>{Li.init(e,t),e._zod.pattern=qr,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{const r=t.value;return null===r||t.issues.push({expected:"null",code:"invalid_type",input:r,inst:e}),t}}),wo=tn("$ZodAny",(e,t)=>{Li.init(e,t),e._zod.parse=e=>e}),jo=tn("$ZodUnknown",(e,t)=>{Li.init(e,t),e._zod.parse=e=>e}),So=tn("$ZodNever",(e,t)=>{Li.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)}),ko=tn("$ZodVoid",(e,t)=>{Li.init(e,t),e._zod.parse=(t,n)=>{const r=t.value;return void 0===r||t.issues.push({expected:"void",code:"invalid_type",input:r,inst:e}),t}}),Co=tn("$ZodDate",(e,t)=>{Li.init(e,t),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=new Date(n.value)}catch(e){}const i=n.value,o=i instanceof Date;return o&&!Number.isNaN(i.getTime())||n.issues.push({expected:"date",code:"invalid_type",input:i,...o?{received:"Invalid Date"}:{},inst:e}),n}});function To(e,t,n){e.issues.length&&t.issues.push(...An(n,e.issues)),t.value[n]=e.value}const Eo=tn("$ZodArray",(e,t)=>{Li.init(e,t),e._zod.parse=(n,r)=>{const i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=Array(i.length);const o=[];for(let e=0;e<i.length;e++){const s=i[e],a=t.element._zod.run({value:s,issues:[]},r);a instanceof Promise?o.push(a.then(t=>To(t,n,e))):To(a,n,e)}return o.length?Promise.all(o).then(()=>n):n}});function Po(e,t,n,r,i){if(e.issues.length){if(i&&!(n in r))return;t.issues.push(...An(n,e.issues))}void 0===e.value?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function Oo(e){const t=Object.keys(e.shape);for(const n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);const n=(r=e.shape,Object.keys(r).filter(e=>"optional"===r[e]._zod.optin&&"optional"===r[e]._zod.optout));var r;return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Ro(e,t,n,r,i,o){const s=[],a=i.keySet,l=i.catchall._zod,c=l.def.type,u="optional"===l.optout;for(const i in t){if(a.has(i))continue;if("never"===c){s.push(i);continue}const o=l.run({value:t[i],issues:[]},r);o instanceof Promise?e.push(o.then(e=>Po(e,n,i,t,u))):Po(o,n,i,t,u)}return s.length&&n.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:o}),e.length?Promise.all(e).then(()=>n):n}const No=tn("$ZodObject",(e,t)=>{Li.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!n?.get){const e=t.shape;Object.defineProperty(t,"shape",{get:()=>{const n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}const r=un(()=>Oo(t));fn(e._zod,"propValues",()=>{const e=t.shape,n={};for(const t in e){const r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(const e of r.values)n[t].add(e)}}return n});const i=bn,o=t.catchall;let s;e._zod.parse=(t,n)=>{s??(s=r.value);const a=t.value;if(!i(a))return t.issues.push({expected:"object",code:"invalid_type",input:a,inst:e}),t;t.value={};const l=[],c=s.shape;for(const e of s.keys){const r=c[e],i="optional"===r._zod.optout,o=r._zod.run({value:a[e],issues:[]},n);o instanceof Promise?l.push(o.then(n=>Po(n,t,e,a,i))):Po(o,t,e,a,i)}return o?Ro(l,a,t,n,r.value,e):l.length?Promise.all(l).then(()=>t):t}}),Ao=tn("$ZodObjectJIT",(e,t)=>{No.init(e,t);const n=e._zod.parse,r=un(()=>Oo(t));let i;const o=bn,s=!on.jitless,a=s&&xn.value,l=t.catchall;let c;e._zod.parse=(u,d)=>{c??(c=r.value);const p=u.value;return o(p)?s&&a&&!1===d?.async&&!0!==d.jitless?(i||(i=(e=>{const t=new Fi(["shape","payload","ctx"]),n=r.value,i=e=>{const t=yn(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const o=Object.create(null);let s=0;for(const e of n.keys)o[e]="key_"+s++;t.write("const newResult = {};");for(const r of n.keys){const n=o[r],s=yn(r),a=e[r],l="optional"===a?._zod?.optout;t.write(`const ${n} = ${i(r)};`),l?t.write(`\n        if (${n}.issues.length) {\n          if (${s} in input) {\n            payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n              ...iss,\n              path: iss.path ? [${s}, ...iss.path] : [${s}]\n            })));\n          }\n        }\n        \n        if (${n}.value === undefined) {\n          if (${s} in input) {\n            newResult[${s}] = undefined;\n          }\n        } else {\n          newResult[${s}] = ${n}.value;\n        }\n        \n      `):t.write(`\n        if (${n}.issues.length) {\n          payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n            ...iss,\n            path: iss.path ? [${s}, ...iss.path] : [${s}]\n          })));\n        }\n        \n        if (${n}.value === undefined) {\n          if (${s} in input) {\n            newResult[${s}] = undefined;\n          }\n        } else {\n          newResult[${s}] = ${n}.value;\n        }\n        \n      `)}t.write("payload.value = newResult;"),t.write("return payload;");const a=t.compile();return(t,n)=>a(e,t,n)})(t.shape)),u=i(u,d),l?Ro([],p,u,d,c,e):u):n(u,d):(u.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),u)}});function Io(e,t,n,r){for(const n of e)if(0===n.issues.length)return t.value=n.value,t;const i=e.filter(e=>!Nn(e));return 1===i.length?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>zn(e,r,sn())))}),t)}const zo=tn("$ZodUnion",(e,t)=>{Li.init(e,t),fn(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),fn(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),fn(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),fn(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){const e=t.options.map(e=>e._zod.pattern);return new RegExp(`^(${e.map(e=>pn(e.source)).join("|")})$`)}});const n=1===t.options.length,r=t.options[0]._zod.run;e._zod.parse=(i,o)=>{if(n)return r(i,o);let s=!1;const a=[];for(const e of t.options){const t=e._zod.run({value:i.value,issues:[]},o);if(t instanceof Promise)a.push(t),s=!0;else{if(0===t.issues.length)return t;a.push(t)}}return s?Promise.all(a).then(t=>Io(t,i,e,o)):Io(a,i,e,o)}});function Fo(e,t,n,r){const i=e.filter(e=>0===e.issues.length);return 1===i.length?(t.value=i[0].value,t):(0===i.length?t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>zn(e,r,sn())))}):t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:[],inclusive:!1}),t)}const Do=tn("$ZodXor",(e,t)=>{zo.init(e,t),t.inclusive=!1;const n=1===t.options.length,r=t.options[0]._zod.run;e._zod.parse=(i,o)=>{if(n)return r(i,o);let s=!1;const a=[];for(const e of t.options){const t=e._zod.run({value:i.value,issues:[]},o);t instanceof Promise?(a.push(t),s=!0):a.push(t)}return s?Promise.all(a).then(t=>Fo(t,i,e,o)):Fo(a,i,e,o)}}),Lo=tn("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,zo.init(e,t);const n=e._zod.parse;fn(e._zod,"propValues",()=>{const e={};for(const n of t.options){const r=n._zod.propValues;if(!r||0===Object.keys(r).length)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(const[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(const r of n)e[t].add(r)}}return e});const r=un(()=>{const e=t.options,n=new Map;for(const r of e){const e=r._zod.propValues?.[t.discriminator];if(!e||0===e.size)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(const t of e){if(n.has(t))throw new Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,o)=>{const s=i.value;if(!bn(s))return i.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),i;const a=r.value.get(s?.[t.discriminator]);return a?a._zod.run(i,o):t.unionFallback?n(i,o):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:s,path:[t.discriminator],inst:e}),i)}}),Mo=tn("$ZodIntersection",(e,t)=>{Li.init(e,t),e._zod.parse=(e,n)=>{const r=e.value,i=t.left._zod.run({value:r,issues:[]},n),o=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||o instanceof Promise?Promise.all([i,o]).then(([t,n])=>Uo(e,t,n)):Uo(e,i,o)}});function $o(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(wn(e)&&wn(t)){const n=Object.keys(t),r=Object.keys(e).filter(e=>-1!==n.indexOf(e)),i={...e,...t};for(const n of r){const r=$o(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const i=$o(e[r],t[r]);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Uo(e,t,n){const r=new Map;let i;for(const n of t.issues)if("unrecognized_keys"===n.code){i??(i=n);for(const e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(const t of n.issues)if("unrecognized_keys"===t.code)for(const e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);const o=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(o.length&&i&&e.issues.push({...i,keys:o}),Nn(e))return e;const s=$o(t.value,n.value);if(!s.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return e.value=s.data,e}const Bo=tn("$ZodTuple",(e,t)=>{Li.init(e,t);const n=t.items;e._zod.parse=(r,i)=>{const o=r.value;if(!Array.isArray(o))return r.issues.push({input:o,inst:e,expected:"tuple",code:"invalid_type"}),r;r.value=[];const s=[],a=[...n].reverse().findIndex(e=>"optional"!==e._zod.optin),l=-1===a?0:n.length-a;if(!t.rest){const t=o.length>n.length,i=o.length<l-1;if(t||i)return r.issues.push({...t?{code:"too_big",maximum:n.length,inclusive:!0}:{code:"too_small",minimum:n.length},input:o,inst:e,origin:"array"}),r}let c=-1;for(const e of n){if(c++,c>=o.length&&c>=l)continue;const t=e._zod.run({value:o[c],issues:[]},i);t instanceof Promise?s.push(t.then(e=>Zo(e,r,c))):Zo(t,r,c)}if(t.rest){const e=o.slice(n.length);for(const n of e){c++;const e=t.rest._zod.run({value:n,issues:[]},i);e instanceof Promise?s.push(e.then(e=>Zo(e,r,c))):Zo(e,r,c)}}return s.length?Promise.all(s).then(()=>r):r}});function Zo(e,t,n){e.issues.length&&t.issues.push(...An(n,e.issues)),t.value[n]=e.value}const qo=tn("$ZodRecord",(e,t)=>{Li.init(e,t),e._zod.parse=(n,r)=>{const i=n.value;if(!wn(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),n;const o=[],s=t.keyType._zod.values;if(s){n.value={};const a=new Set;for(const e of s)if("string"==typeof e||"number"==typeof e||"symbol"==typeof e){a.add("number"==typeof e?e.toString():e);const s=t.valueType._zod.run({value:i[e],issues:[]},r);s instanceof Promise?o.push(s.then(t=>{t.issues.length&&n.issues.push(...An(e,t.issues)),n.value[e]=t.value})):(s.issues.length&&n.issues.push(...An(e,s.issues)),n.value[e]=s.value)}let l;for(const e in i)a.has(e)||(l=l??[],l.push(e));l&&l.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:l})}else{n.value={};for(const s of Reflect.ownKeys(i)){if("__proto__"===s)continue;let a=t.keyType._zod.run({value:s,issues:[]},r);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if("string"==typeof s&&Br.test(s)&&a.issues.length){const e=t.keyType._zod.run({value:Number(s),issues:[]},r);if(e instanceof Promise)throw new Error("Async schemas not supported in object keys currently");0===e.issues.length&&(a=e)}if(a.issues.length){"loose"===t.mode?n.value[s]=i[s]:n.issues.push({code:"invalid_key",origin:"record",issues:a.issues.map(e=>zn(e,r,sn())),input:s,path:[s],inst:e});continue}const l=t.valueType._zod.run({value:i[s],issues:[]},r);l instanceof Promise?o.push(l.then(e=>{e.issues.length&&n.issues.push(...An(s,e.issues)),n.value[a.value]=e.value})):(l.issues.length&&n.issues.push(...An(s,l.issues)),n.value[a.value]=l.value)}}return o.length?Promise.all(o).then(()=>n):n}}),Ho=tn("$ZodMap",(e,t)=>{Li.init(e,t),e._zod.parse=(n,r)=>{const i=n.value;if(!(i instanceof Map))return n.issues.push({expected:"map",code:"invalid_type",input:i,inst:e}),n;const o=[];n.value=new Map;for(const[s,a]of i){const l=t.keyType._zod.run({value:s,issues:[]},r),c=t.valueType._zod.run({value:a,issues:[]},r);l instanceof Promise||c instanceof Promise?o.push(Promise.all([l,c]).then(([t,o])=>{Wo(t,o,n,s,i,e,r)})):Wo(l,c,n,s,i,e,r)}return o.length?Promise.all(o).then(()=>n):n}});function Wo(e,t,n,r,i,o,s){e.issues.length&&(Sn.has(typeof r)?n.issues.push(...An(r,e.issues)):n.issues.push({code:"invalid_key",origin:"map",input:i,inst:o,issues:e.issues.map(e=>zn(e,s,sn()))})),t.issues.length&&(Sn.has(typeof r)?n.issues.push(...An(r,t.issues)):n.issues.push({origin:"map",code:"invalid_element",input:i,inst:o,key:r,issues:t.issues.map(e=>zn(e,s,sn()))})),n.value.set(e.value,t.value)}const Go=tn("$ZodSet",(e,t)=>{Li.init(e,t),e._zod.parse=(n,r)=>{const i=n.value;if(!(i instanceof Set))return n.issues.push({input:i,inst:e,expected:"set",code:"invalid_type"}),n;const o=[];n.value=new Set;for(const e of i){const i=t.valueType._zod.run({value:e,issues:[]},r);i instanceof Promise?o.push(i.then(e=>Vo(e,n))):Vo(i,n)}return o.length?Promise.all(o).then(()=>n):n}});function Vo(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}const Qo=tn("$ZodEnum",(e,t)=>{Li.init(e,t);const n=an(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(e=>Sn.has(typeof e)).map(e=>"string"==typeof e?Cn(e):e.toString()).join("|")})$`),e._zod.parse=(t,i)=>{const o=t.value;return r.has(o)||t.issues.push({code:"invalid_value",values:n,input:o,inst:e}),t}}),Ko=tn("$ZodLiteral",(e,t)=>{if(Li.init(e,t),0===t.values.length)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(e=>"string"==typeof e?Cn(e):e?Cn(e.toString()):String(e)).join("|")})$`),e._zod.parse=(r,i)=>{const o=r.value;return n.has(o)||r.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),r}}),Jo=tn("$ZodFile",(e,t)=>{Li.init(e,t),e._zod.parse=(t,n)=>{const r=t.value;return r instanceof File||t.issues.push({expected:"file",code:"invalid_type",input:r,inst:e}),t}}),Yo=tn("$ZodTransform",(e,t)=>{Li.init(e,t),e._zod.parse=(n,r)=>{if("backward"===r.direction)throw new rn(e.constructor.name);const i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new nn;return n.value=i,n}});function Xo(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}const es=tn("$ZodOptional",(e,t)=>{Li.init(e,t),e._zod.optin="optional",e._zod.optout="optional",fn(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),fn(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${pn(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if("optional"===t.innerType._zod.optin){const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>Xo(t,e.value)):Xo(r,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,n)}}),ts=tn("$ZodExactOptional",(e,t)=>{es.init(e,t),fn(e._zod,"values",()=>t.innerType._zod.values),fn(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),ns=tn("$ZodNullable",(e,t)=>{Li.init(e,t),fn(e._zod,"optin",()=>t.innerType._zod.optin),fn(e._zod,"optout",()=>t.innerType._zod.optout),fn(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${pn(e.source)}|null)$`):void 0}),fn(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>null===e.value?e:t.innerType._zod.run(e,n)}),rs=tn("$ZodDefault",(e,t)=>{Li.init(e,t),e._zod.optin="optional",fn(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);if(void 0===e.value)return e.value=t.defaultValue,e;const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>is(e,t)):is(r,t)}});function is(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const os=tn("$ZodPrefault",(e,t)=>{Li.init(e,t),e._zod.optin="optional",fn(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>("backward"===n.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),ss=tn("$ZodNonOptional",(e,t)=>{Li.init(e,t),fn(e._zod,"values",()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(n,r)=>{const i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>as(t,e)):as(i,e)}});function as(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const ls=tn("$ZodSuccess",(e,t)=>{Li.init(e,t),e._zod.parse=(e,n)=>{if("backward"===n.direction)throw new rn("ZodSuccess");const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>(e.value=0===t.issues.length,e)):(e.value=0===r.issues.length,e)}}),cs=tn("$ZodCatch",(e,t)=>{Li.init(e,t),fn(e._zod,"optin",()=>t.innerType._zod.optin),fn(e._zod,"optout",()=>t.innerType._zod.optout),fn(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>zn(e,n,sn()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>zn(e,n,sn()))},input:e.value}),e.issues=[]),e)}}),us=tn("$ZodNaN",(e,t)=>{Li.init(e,t),e._zod.parse=(t,n)=>("number"==typeof t.value&&Number.isNaN(t.value)||t.issues.push({input:t.value,inst:e,expected:"nan",code:"invalid_type"}),t)}),ds=tn("$ZodPipe",(e,t)=>{Li.init(e,t),fn(e._zod,"values",()=>t.in._zod.values),fn(e._zod,"optin",()=>t.in._zod.optin),fn(e._zod,"optout",()=>t.out._zod.optout),fn(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if("backward"===n.direction){const r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>ps(e,t.in,n)):ps(r,t.in,n)}const r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>ps(e,t.out,n)):ps(r,t.out,n)}});function ps(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const hs=tn("$ZodCodec",(e,t)=>{Li.init(e,t),fn(e._zod,"values",()=>t.in._zod.values),fn(e._zod,"optin",()=>t.in._zod.optin),fn(e._zod,"optout",()=>t.out._zod.optout),fn(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if("forward"===(n.direction||"forward")){const r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>fs(e,t,n)):fs(r,t,n)}{const r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>fs(e,t,n)):fs(r,t,n)}}});function fs(e,t,n){if(e.issues.length)return e.aborted=!0,e;if("forward"===(n.direction||"forward")){const r=t.transform(e.value,e);return r instanceof Promise?r.then(r=>ms(e,r,t.out,n)):ms(e,r,t.out,n)}{const r=t.reverseTransform(e.value,e);return r instanceof Promise?r.then(r=>ms(e,r,t.in,n)):ms(e,r,t.in,n)}}function ms(e,t,n,r){return e.issues.length?(e.aborted=!0,e):n._zod.run({value:t,issues:e.issues},r)}const gs=tn("$ZodReadonly",(e,t)=>{Li.init(e,t),fn(e._zod,"propValues",()=>t.innerType._zod.propValues),fn(e._zod,"values",()=>t.innerType._zod.values),fn(e._zod,"optin",()=>t.innerType?._zod?.optin),fn(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(ys):ys(r)}});function ys(e){return e.value=Object.freeze(e.value),e}const vs=tn("$ZodTemplateLiteral",(e,t)=>{Li.init(e,t);const n=[];for(const e of t.parts)if("object"==typeof e&&null!==e){if(!e._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...e._zod.traits].shift()}`);const t=e._zod.pattern instanceof RegExp?e._zod.pattern.source:e._zod.pattern;if(!t)throw new Error(`Invalid template literal part: ${e._zod.traits}`);const r=t.startsWith("^")?1:0,i=t.endsWith("$")?t.length-1:t.length;n.push(t.slice(r,i))}else{if(null!==e&&!kn.has(typeof e))throw new Error(`Invalid template literal part: ${e}`);n.push(Cn(`${e}`))}e._zod.pattern=new RegExp(`^${n.join("")}$`),e._zod.parse=(n,r)=>"string"!=typeof n.value?(n.issues.push({input:n.value,inst:e,expected:"string",code:"invalid_type"}),n):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),n)}),_s=tn("$ZodFunction",(e,t)=>(Li.init(e,t),e._def=t,e._zod.def=t,e.implement=t=>{if("function"!=typeof t)throw new Error("implement() must be called with a function");return function(...n){const r=e._def.input?Zn(e._def.input,n):n,i=Reflect.apply(t,this,r);return e._def.output?Zn(e._def.output,i):i}},e.implementAsync=t=>{if("function"!=typeof t)throw new Error("implementAsync() must be called with a function");return async function(...n){const r=e._def.input?await Hn(e._def.input,n):n,i=await Reflect.apply(t,this,r);return e._def.output?await Hn(e._def.output,i):i}},e._zod.parse=(t,n)=>{if("function"!=typeof t.value)return t.issues.push({code:"invalid_type",expected:"function",input:t.value,inst:e}),t;const r=e._def.output&&"promise"===e._def.output._zod.def.type;return t.value=r?e.implementAsync(t.value):e.implement(t.value),t},e.input=(...t)=>{const n=e.constructor;return Array.isArray(t[0])?new n({type:"function",input:new Bo({type:"tuple",items:t[0],rest:t[1]}),output:e._def.output}):new n({type:"function",input:t[0],output:e._def.output})},e.output=t=>new(0,e.constructor)({type:"function",input:e._def.input,output:t}),e)),bs=tn("$ZodPromise",(e,t)=>{Li.init(e,t),e._zod.parse=(e,n)=>Promise.resolve(e.value).then(e=>t.innerType._zod.run({value:e,issues:[]},n))}),xs=tn("$ZodLazy",(e,t)=>{Li.init(e,t),fn(e._zod,"innerType",()=>t.getter()),fn(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),fn(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),fn(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),fn(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),ws=tn("$ZodCustom",(e,t)=>{pi.init(e,t),Li.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{const r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>js(t,n,r,e));js(i,n,r,e)}});function js(e,t,n,r){if(!e){const e={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Ln(e))}}var Ss;Symbol("ZodOutput"),Symbol("ZodInput");(Ss=globalThis).__zod_globalRegistry??(Ss.__zod_globalRegistry=new class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const n=t[0];return this._map.set(e,n),n&&"object"==typeof n&&"id"in n&&this._idmap.set(n.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 n={...this.get(t)??{}};delete n.id;const r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}});const ks=globalThis.__zod_globalRegistry;function Cs(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...En(t)})}function Ts(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...En(t)})}function Es(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...En(t)})}function Ps(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...En(t)})}function Os(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...En(t)})}function Rs(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...En(t)})}function Ns(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...En(t)})}function As(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...En(t)})}function Is(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...En(t)})}function zs(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...En(t)})}function Fs(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...En(t)})}function Ds(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...En(t)})}function Ls(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...En(t)})}function Ms(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...En(t)})}function $s(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...En(t)})}function Us(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...En(t)})}function Bs(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...En(t)})}function Zs(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...En(t)})}function qs(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...En(t)})}function Hs(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...En(t)})}function Ws(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...En(t)})}function Gs(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...En(t)})}function Vs(e,t){return new fi({check:"less_than",...En(t),value:e,inclusive:!1})}function Qs(e,t){return new fi({check:"less_than",...En(t),value:e,inclusive:!0})}function Ks(e,t){return new mi({check:"greater_than",...En(t),value:e,inclusive:!1})}function Js(e,t){return new mi({check:"greater_than",...En(t),value:e,inclusive:!0})}function Ys(e){return Ks(0,e)}function Xs(e){return Vs(0,e)}function ea(e){return Qs(0,e)}function ta(e){return Js(0,e)}function na(e,t){return new gi({check:"multiple_of",...En(t),value:e})}function ra(e,t){return new _i({check:"max_size",...En(t),maximum:e})}function ia(e,t){return new bi({check:"min_size",...En(t),minimum:e})}function oa(e,t){return new xi({check:"size_equals",...En(t),size:e})}function sa(e,t){return new wi({check:"max_length",...En(t),maximum:e})}function aa(e,t){return new ji({check:"min_length",...En(t),minimum:e})}function la(e,t){return new Si({check:"length_equals",...En(t),length:e})}function ca(e,t){return new Ci({check:"string_format",format:"regex",...En(t),pattern:e})}function ua(e){return new Ti({check:"string_format",format:"lowercase",...En(e)})}function da(e){return new Ei({check:"string_format",format:"uppercase",...En(e)})}function pa(e,t){return new Pi({check:"string_format",format:"includes",...En(t),includes:e})}function ha(e,t){return new Oi({check:"string_format",format:"starts_with",...En(t),prefix:e})}function fa(e,t){return new Ri({check:"string_format",format:"ends_with",...En(t),suffix:e})}function ma(e,t,n){return new Ai({check:"property",property:e,schema:t,...En(n)})}function ga(e,t){return new Ii({check:"mime_type",mime:e,...En(t)})}function ya(e){return new zi({check:"overwrite",tx:e})}function va(e){return ya(t=>t.normalize(e))}function _a(){return ya(e=>e.trim())}function ba(){return ya(e=>e.toLowerCase())}function xa(){return ya(e=>e.toUpperCase())}function wa(){return ya(e=>function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(e))}function ja(e,t,n,r={}){const i=En(r),o={...En(r),check:"string_format",type:"string",format:t,fn:"function"==typeof n?n:e=>n.test(e),...i};return n instanceof RegExp&&(o.pattern=n),new e(o)}function Sa(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??ks,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function ka(e,t,n={path:[],schemaPath:[]}){var r;const i=e._zod.def,o=t.seen.get(e);if(o)return o.count++,n.schemaPath.includes(e)&&(o.cycle=n.path),o.schema;const s={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,s);const a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{const r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,r);else{const n=s.schema,o=t.processors[i.type];if(!o)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);o(e,t,n,r)}const o=e._zod.parent;o&&(s.ref||(s.ref=o),ka(o,t,r),t.seen.get(o).isParent=!0)}const l=t.metadataRegistry.get(e);return l&&Object.assign(s.schema,l),"input"===t.io&&Ea(e)&&(delete s.schema.examples,delete s.schema.default),"input"===t.io&&s.schema._prefault&&((r=s.schema).default??(r.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function Ca(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const t of e.seen.entries()){const n=e.metadataRegistry.get(t[0])?.id;if(n){const e=r.get(n);if(e&&e!==t[0])throw new Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}const i=t=>{if(t[1].schema.$ref)return;const r=t[1],{ref:i,defId:o}=(t=>{const r="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){const n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};const o=t[1].defId??t[1].schema.id??"schema"+e.counter++;return t[1].defId=o,{defId:o,ref:`${i("__shared")}#/${r}/${o}`}}if(t[1]===n)return{ref:"#"};const i=`#/${r}/`,o=t[1].schema.id??"__schema"+e.counter++;return{defId:o,ref:i+o}})(t);r.def={...r.schema},o&&(r.defId=o);const s=r.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 n of e.seen.entries()){const r=n[1];if(t===n[0]){i(n);continue}if(e.external){const r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){i(n);continue}}const o=e.metadataRegistry.get(n[0])?.id;(o||r.cycle||r.count>1&&"ref"===e.reused)&&i(n)}}function Ta(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=t=>{const n=e.seen.get(t);if(null===n.ref)return;const i=n.def??n.schema,o={...i},s=n.ref;if(n.ref=null,s){r(s);const n=e.seen.get(s),a=n.schema;if(!a.$ref||"draft-07"!==e.target&&"draft-04"!==e.target&&"openapi-3.0"!==e.target?Object.assign(i,a):(i.allOf=i.allOf??[],i.allOf.push(a)),Object.assign(i,o),t._zod.parent===s)for(const e in i)"$ref"!==e&&"allOf"!==e&&(e in o||delete i[e]);if(a.$ref&&n.def)for(const e in i)"$ref"!==e&&"allOf"!==e&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}const a=t._zod.parent;if(a&&a!==s){r(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:n.path??[]})};for(const t of[...e.seen.entries()].reverse())r(t[0]);const i={};if("draft-2020-12"===e.target?i.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?i.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const n=e.external.registry.get(t)?.id;if(!n)throw new Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);const o=e.external?.defs??{};for(const t of e.seen.entries()){const e=t[1];e.def&&e.defId&&(o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&("draft-2020-12"===e.target?i.$defs=o:i.definitions=o);try{const n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t["~standard"],jsonSchema:{input:Pa(t,"input",e.processors),output:Pa(t,"output",e.processors)}},enumerable:!1,writable:!1}),n}catch(e){throw new Error("Error converting schema to JSON.")}}function Ea(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if("transform"===r.type)return!0;if("array"===r.type)return Ea(r.element,n);if("set"===r.type)return Ea(r.valueType,n);if("lazy"===r.type)return Ea(r.getter(),n);if("promise"===r.type||"optional"===r.type||"nonoptional"===r.type||"nullable"===r.type||"readonly"===r.type||"default"===r.type||"prefault"===r.type)return Ea(r.innerType,n);if("intersection"===r.type)return Ea(r.left,n)||Ea(r.right,n);if("record"===r.type||"map"===r.type)return Ea(r.keyType,n)||Ea(r.valueType,n);if("pipe"===r.type)return Ea(r.in,n)||Ea(r.out,n);if("object"===r.type){for(const e in r.shape)if(Ea(r.shape[e],n))return!0;return!1}if("union"===r.type){for(const e of r.options)if(Ea(e,n))return!0;return!1}if("tuple"===r.type){for(const e of r.items)if(Ea(e,n))return!0;return!(!r.rest||!Ea(r.rest,n))}return!1}const Pa=(e,t,n={})=>r=>{const{libraryOptions:i,target:o}=r??{},s=Sa({...i??{},target:o,io:t,processors:n});return ka(e,s),Ca(s,e),Ta(s,e)},Oa={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Ra=(e,t,n,r)=>{const i=e._zod.def,o=!1===i.inclusive,s=i.options.map((e,n)=>ka(e,t,{...r,path:[...r.path,o?"oneOf":"anyOf",n]}));o?n.oneOf=s:n.anyOf=s},Na=(e,t,n,r)=>{const i=e._zod.def;ka(i.innerType,t,r),t.seen.get(e).ref=i.innerType},Aa=tn("ZodISODateTime",(e,t)=>{Yi.init(e,t),sl.init(e,t)});function Ia(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...En(t)})}(Aa,e)}const za=tn("ZodISODate",(e,t)=>{Xi.init(e,t),sl.init(e,t)});function Fa(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...En(t)})}(za,e)}const Da=tn("ZodISOTime",(e,t)=>{eo.init(e,t),sl.init(e,t)});function La(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...En(t)})}(Da,e)}const Ma=tn("ZodISODuration",(e,t)=>{to.init(e,t),sl.init(e,t)});function $a(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...En(t)})}(Ma,e)}const Ua=(e,t)=>{$n.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t=e=>e.message){const n={_errors:[]},r=e=>{for(const i of e.issues)if("invalid_union"===i.code&&i.errors.length)i.errors.map(e=>r({issues:e}));else if("invalid_key"===i.code)r({issues:i.issues});else if("invalid_element"===i.code)r({issues:i.issues});else if(0===i.path.length)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){const n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}(e,t)},flatten:{value:t=>function(e,t=e=>e.message){const n={},r=[];for(const i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,cn,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,cn,2)}},isEmpty:{get:()=>0===e.issues.length}})},Ba=tn("ZodError",Ua),Za=tn("ZodError",Ua,{Parent:Error}),qa=Bn(Za),Ha=qn(Za),Wa=Wn(Za),Ga=Vn(Za),Va=Kn(Za),Qa=Jn(Za),Ka=Yn(Za),Ja=Xn(Za),Ya=er(Za),Xa=tr(Za),el=nr(Za),tl=rr(Za),nl=tn("ZodType",(e,t)=>(Li.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Pa(e,"input"),output:Pa(e,"output")}}),e.toJSONSchema=((e,t={})=>n=>{const r=Sa({...n,processors:t});return ka(e,r),Ca(r,e),Ta(r,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(gn(t,{checks:[...t.checks??[],...n.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>Tn(e,t,n),e.brand=()=>e,e.register=(t,n)=>(t.add(e,n),e),e.parse=(t,n)=>qa(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Wa(e,t,n),e.parseAsync=async(t,n)=>Ha(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Ga(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Va(e,t,n),e.decode=(t,n)=>Qa(e,t,n),e.encodeAsync=async(t,n)=>Ka(e,t,n),e.decodeAsync=async(t,n)=>Ja(e,t,n),e.safeEncode=(t,n)=>Ya(e,t,n),e.safeDecode=(t,n)=>Xa(e,t,n),e.safeEncodeAsync=async(t,n)=>el(e,t,n),e.safeDecodeAsync=async(t,n)=>tl(e,t,n),e.refine=(t,n)=>e.check(Qu(t,n)),e.superRefine=t=>e.check(Ku(t)),e.overwrite=t=>e.check(ya(t)),e.optional=()=>fu(e),e.exactOptional=()=>gu(e),e.nullable=()=>vu(e),e.nullish=()=>fu(vu(e)),e.nonoptional=t=>ku(e,t),e.array=()=>Ic(e),e.or=t=>Uc([e,t]),e.and=t=>Gc(e,t),e.transform=t=>Au(e,pu(t)),e.default=t=>xu(e,t),e.prefault=t=>ju(e,t),e.catch=t=>Pu(e,t),e.pipe=t=>Au(e,t),e.readonly=()=>Du(e),e.describe=t=>{const n=e.clone();return ks.add(n,{description:t}),n},Object.defineProperty(e,"description",{get:()=>ks.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return ks.get(e);const n=e.clone();return ks.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),rl=tn("_ZodString",(e,t)=>{Mi.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=n;r.type="string";const{minimum:i,maximum:o,format:s,patterns:a,contentEncoding:l}=e._zod.bag;if("number"==typeof i&&(r.minLength=i),"number"==typeof o&&(r.maxLength=o),s&&(r.format=Oa[s]??s,""===r.format&&delete r.format,"time"===s&&delete r.format),l&&(r.contentEncoding=l),a&&a.size>0){const e=[...a];1===e.length?r.pattern=e[0].source:e.length>1&&(r.allOf=[...e.map(e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source}))])}})(e,t,n);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(ca(...t)),e.includes=(...t)=>e.check(pa(...t)),e.startsWith=(...t)=>e.check(ha(...t)),e.endsWith=(...t)=>e.check(fa(...t)),e.min=(...t)=>e.check(aa(...t)),e.max=(...t)=>e.check(sa(...t)),e.length=(...t)=>e.check(la(...t)),e.nonempty=(...t)=>e.check(aa(1,...t)),e.lowercase=t=>e.check(ua(t)),e.uppercase=t=>e.check(da(t)),e.trim=()=>e.check(_a()),e.normalize=(...t)=>e.check(va(...t)),e.toLowerCase=()=>e.check(ba()),e.toUpperCase=()=>e.check(xa()),e.slugify=()=>e.check(wa())}),il=tn("ZodString",(e,t)=>{Mi.init(e,t),rl.init(e,t),e.email=t=>e.check(Cs(al,t)),e.url=t=>e.check(Ns(gl,t)),e.jwt=t=>e.check(Gs(Ql,t)),e.emoji=t=>e.check(As(_l,t)),e.guid=t=>e.check(Ts(cl,t)),e.uuid=t=>e.check(Es(dl,t)),e.uuidv4=t=>e.check(Ps(dl,t)),e.uuidv6=t=>e.check(Os(dl,t)),e.uuidv7=t=>e.check(Rs(dl,t)),e.nanoid=t=>e.check(Is(xl,t)),e.guid=t=>e.check(Ts(cl,t)),e.cuid=t=>e.check(zs(jl,t)),e.cuid2=t=>e.check(Fs(kl,t)),e.ulid=t=>e.check(Ds(Tl,t)),e.base64=t=>e.check(qs(Zl,t)),e.base64url=t=>e.check(Hs(Hl,t)),e.xid=t=>e.check(Ls(Pl,t)),e.ksuid=t=>e.check(Ms(Rl,t)),e.ipv4=t=>e.check($s(Al,t)),e.ipv6=t=>e.check(Us(Dl,t)),e.cidrv4=t=>e.check(Bs(Ml,t)),e.cidrv6=t=>e.check(Zs(Ul,t)),e.e164=t=>e.check(Ws(Gl,t)),e.datetime=t=>e.check(Ia(t)),e.date=t=>e.check(Fa(t)),e.time=t=>e.check(La(t)),e.duration=t=>e.check($a(t))});function ol(e){return function(e,t){return new e({type:"string",...En(t)})}(il,e)}const sl=tn("ZodStringFormat",(e,t)=>{$i.init(e,t),rl.init(e,t)}),al=tn("ZodEmail",(e,t)=>{Zi.init(e,t),sl.init(e,t)});function ll(e){return Cs(al,e)}const cl=tn("ZodGUID",(e,t)=>{Ui.init(e,t),sl.init(e,t)});function ul(e){return Ts(cl,e)}const dl=tn("ZodUUID",(e,t)=>{Bi.init(e,t),sl.init(e,t)});function pl(e){return Es(dl,e)}function hl(e){return Ps(dl,e)}function fl(e){return Os(dl,e)}function ml(e){return Rs(dl,e)}const gl=tn("ZodURL",(e,t)=>{qi.init(e,t),sl.init(e,t)});function yl(e){return Ns(gl,e)}function vl(e){return Ns(gl,{protocol:/^https?$/,hostname:Nr,...En(e)})}const _l=tn("ZodEmoji",(e,t)=>{Hi.init(e,t),sl.init(e,t)});function bl(e){return As(_l,e)}const xl=tn("ZodNanoID",(e,t)=>{Wi.init(e,t),sl.init(e,t)});function wl(e){return Is(xl,e)}const jl=tn("ZodCUID",(e,t)=>{Gi.init(e,t),sl.init(e,t)});function Sl(e){return zs(jl,e)}const kl=tn("ZodCUID2",(e,t)=>{Vi.init(e,t),sl.init(e,t)});function Cl(e){return Fs(kl,e)}const Tl=tn("ZodULID",(e,t)=>{Qi.init(e,t),sl.init(e,t)});function El(e){return Ds(Tl,e)}const Pl=tn("ZodXID",(e,t)=>{Ki.init(e,t),sl.init(e,t)});function Ol(e){return Ls(Pl,e)}const Rl=tn("ZodKSUID",(e,t)=>{Ji.init(e,t),sl.init(e,t)});function Nl(e){return Ms(Rl,e)}const Al=tn("ZodIPv4",(e,t)=>{no.init(e,t),sl.init(e,t)});function Il(e){return $s(Al,e)}const zl=tn("ZodMAC",(e,t)=>{io.init(e,t),sl.init(e,t)});function Fl(e){return function(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...En(t)})}(zl,e)}const Dl=tn("ZodIPv6",(e,t)=>{ro.init(e,t),sl.init(e,t)});function Ll(e){return Us(Dl,e)}const Ml=tn("ZodCIDRv4",(e,t)=>{oo.init(e,t),sl.init(e,t)});function $l(e){return Bs(Ml,e)}const Ul=tn("ZodCIDRv6",(e,t)=>{so.init(e,t),sl.init(e,t)});function Bl(e){return Zs(Ul,e)}const Zl=tn("ZodBase64",(e,t)=>{lo.init(e,t),sl.init(e,t)});function ql(e){return qs(Zl,e)}const Hl=tn("ZodBase64URL",(e,t)=>{co.init(e,t),sl.init(e,t)});function Wl(e){return Hs(Hl,e)}const Gl=tn("ZodE164",(e,t)=>{uo.init(e,t),sl.init(e,t)});function Vl(e){return Ws(Gl,e)}const Ql=tn("ZodJWT",(e,t)=>{po.init(e,t),sl.init(e,t)});function Kl(e){return Gs(Ql,e)}const Jl=tn("ZodCustomStringFormat",(e,t)=>{ho.init(e,t),sl.init(e,t)});function Yl(e,t,n={}){return ja(Jl,e,t,n)}function Xl(e){return ja(Jl,"hostname",Rr,e)}function ec(e){return ja(Jl,"hex",Vr,e)}function tc(e,t){const n=`${e}_${t?.enc??"hex"}`,i=r[n];if(!i)throw new Error(`Unrecognized hash format: ${n}`);return ja(Jl,n,i,t)}const nc=tn("ZodNumber",(e,t)=>{fo.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=n,{minimum:i,maximum:o,format:s,multipleOf:a,exclusiveMaximum:l,exclusiveMinimum:c}=e._zod.bag;"string"==typeof s&&s.includes("int")?r.type="integer":r.type="number","number"==typeof c&&("draft-04"===t.target||"openapi-3.0"===t.target?(r.minimum=c,r.exclusiveMinimum=!0):r.exclusiveMinimum=c),"number"==typeof i&&(r.minimum=i,"number"==typeof c&&"draft-04"!==t.target&&(c>=i?delete r.minimum:delete r.exclusiveMinimum)),"number"==typeof l&&("draft-04"===t.target||"openapi-3.0"===t.target?(r.maximum=l,r.exclusiveMaximum=!0):r.exclusiveMaximum=l),"number"==typeof o&&(r.maximum=o,"number"==typeof l&&"draft-04"!==t.target&&(l<=o?delete r.maximum:delete r.exclusiveMaximum)),"number"==typeof a&&(r.multipleOf=a)})(e,t,n),e.gt=(t,n)=>e.check(Ks(t,n)),e.gte=(t,n)=>e.check(Js(t,n)),e.min=(t,n)=>e.check(Js(t,n)),e.lt=(t,n)=>e.check(Vs(t,n)),e.lte=(t,n)=>e.check(Qs(t,n)),e.max=(t,n)=>e.check(Qs(t,n)),e.int=t=>e.check(oc(t)),e.safe=t=>e.check(oc(t)),e.positive=t=>e.check(Ks(0,t)),e.nonnegative=t=>e.check(Js(0,t)),e.negative=t=>e.check(Vs(0,t)),e.nonpositive=t=>e.check(Qs(0,t)),e.multipleOf=(t,n)=>e.check(na(t,n)),e.step=(t,n)=>e.check(na(t,n)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function rc(e){return function(e,t){return new e({type:"number",checks:[],...En(t)})}(nc,e)}const ic=tn("ZodNumberFormat",(e,t)=>{mo.init(e,t),nc.init(e,t)});function oc(e){return function(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...En(t)})}(ic,e)}function sc(e){return function(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...En(t)})}(ic,e)}function ac(e){return function(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...En(t)})}(ic,e)}function lc(e){return function(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...En(t)})}(ic,e)}function cc(e){return function(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...En(t)})}(ic,e)}const uc=tn("ZodBoolean",(e,t)=>{go.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n)=>{n.type="boolean"})(0,0,t)});function dc(e){return function(e,t){return new e({type:"boolean",...En(t)})}(uc,e)}const pc=tn("ZodBigInt",(e,t)=>{yo.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("BigInt cannot be represented in JSON Schema")})(0,e),e.gte=(t,n)=>e.check(Js(t,n)),e.min=(t,n)=>e.check(Js(t,n)),e.gt=(t,n)=>e.check(Ks(t,n)),e.gte=(t,n)=>e.check(Js(t,n)),e.min=(t,n)=>e.check(Js(t,n)),e.lt=(t,n)=>e.check(Vs(t,n)),e.lte=(t,n)=>e.check(Qs(t,n)),e.max=(t,n)=>e.check(Qs(t,n)),e.positive=t=>e.check(Ks(BigInt(0),t)),e.negative=t=>e.check(Vs(BigInt(0),t)),e.nonpositive=t=>e.check(Qs(BigInt(0),t)),e.nonnegative=t=>e.check(Js(BigInt(0),t)),e.multipleOf=(t,n)=>e.check(na(t,n));const n=e._zod.bag;e.minValue=n.minimum??null,e.maxValue=n.maximum??null,e.format=n.format??null});function hc(e){return function(e,t){return new e({type:"bigint",...En(t)})}(pc,e)}const fc=tn("ZodBigIntFormat",(e,t)=>{vo.init(e,t),pc.init(e,t)});function mc(e){return function(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...En(t)})}(fc,e)}function gc(e){return function(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...En(t)})}(fc,e)}const yc=tn("ZodSymbol",(e,t)=>{_o.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Symbols cannot be represented in JSON Schema")})(0,e)});function vc(e){return function(e,t){return new e({type:"symbol",...En(t)})}(yc,e)}const _c=tn("ZodUndefined",(e,t)=>{bo.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Undefined cannot be represented in JSON Schema")})(0,e)});function bc(e){return function(e,t){return new e({type:"undefined",...En(t)})}(_c,e)}const xc=tn("ZodNull",(e,t)=>{xo.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n)=>{"openapi-3.0"===t.target?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"})(0,e,t)});function wc(e){return function(e,t){return new e({type:"null",...En(t)})}(xc,e)}const jc=tn("ZodAny",(e,t)=>{wo.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{}});function Sc(){return new jc({type:"any"})}const kc=tn("ZodUnknown",(e,t)=>{jo.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{}});function Cc(){return new kc({type:"unknown"})}const Tc=tn("ZodNever",(e,t)=>{So.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n)=>{n.not={}})(0,0,t)});function Ec(e){return function(e,t){return new e({type:"never",...En(t)})}(Tc,e)}const Pc=tn("ZodVoid",(e,t)=>{ko.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Void cannot be represented in JSON Schema")})(0,e)});function Oc(e){return function(e,t){return new e({type:"void",...En(t)})}(Pc,e)}const Rc=tn("ZodDate",(e,t)=>{Co.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Date cannot be represented in JSON Schema")})(0,e),e.min=(t,n)=>e.check(Js(t,n)),e.max=(t,n)=>e.check(Qs(t,n));const n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null});function Nc(e){return function(e,t){return new e({type:"date",...En(t)})}(Rc,e)}const Ac=tn("ZodArray",(e,t)=>{Eo.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=n,o=e._zod.def,{minimum:s,maximum:a}=e._zod.bag;"number"==typeof s&&(i.minItems=s),"number"==typeof a&&(i.maxItems=a),i.type="array",i.items=ka(o.element,t,{...r,path:[...r.path,"items"]})})(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(aa(t,n)),e.nonempty=t=>e.check(aa(1,t)),e.max=(t,n)=>e.check(sa(t,n)),e.length=(t,n)=>e.check(la(t,n)),e.unwrap=()=>e.element});function Ic(e,t){return function(e,t,n){return new e({type:"array",element:t,...En(n)})}(Ac,e,t)}function zc(e){const t=e._zod.def.shape;return ou(Object.keys(t))}const Fc=tn("ZodObject",(e,t)=>{Ao.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=n,o=e._zod.def;i.type="object",i.properties={};const s=o.shape;for(const e in s)i.properties[e]=ka(s[e],t,{...r,path:[...r.path,"properties",e]});const a=new Set(Object.keys(s)),l=new Set([...a].filter(e=>{const n=o.shape[e]._zod;return"input"===t.io?void 0===n.optin:void 0===n.optout}));l.size>0&&(i.required=Array.from(l)),"never"===o.catchall?._zod.def.type?i.additionalProperties=!1:o.catchall?o.catchall&&(i.additionalProperties=ka(o.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):"output"===t.io&&(i.additionalProperties=!1)})(e,t,n,r),fn(e,"shape",()=>t.shape),e.keyof=()=>ou(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Cc()}),e.loose=()=>e.clone({...e._zod.def,catchall:Cc()}),e.strict=()=>e.clone({...e._zod.def,catchall:Ec()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>function(e,t){if(!wn(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const n=e._zod.def.shape;for(const e in t)if(void 0!==Object.getOwnPropertyDescriptor(n,e))throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const r=gn(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return mn(this,"shape",n),n}});return Tn(e,r)}(e,t),e.safeExtend=t=>function(e,t){if(!wn(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=gn(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return mn(this,"shape",n),n}});return Tn(e,n)}(e,t),e.merge=t=>function(e,t){const n=gn(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return mn(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return Tn(e,n)}(e,t),e.pick=t=>function(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");return Tn(e,gn(e._zod.def,{get shape(){const e={};for(const r in t){if(!(r in n.shape))throw new Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return mn(this,"shape",e),e},checks:[]}))}(e,t),e.omit=t=>function(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=gn(e._zod.def,{get shape(){const r={...e._zod.def.shape};for(const e in t){if(!(e in n.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return mn(this,"shape",r),r},checks:[]});return Tn(e,i)}(e,t),e.partial=(...t)=>function(e,t,n){const r=t._zod.def.checks;if(r&&r.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const i=gn(t._zod.def,{get shape(){const r=t._zod.def.shape,i={...r};if(n)for(const t in n){if(!(t in r))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:"optional",innerType:r[t]}):r[t])}else for(const t in r)i[t]=e?new e({type:"optional",innerType:r[t]}):r[t];return mn(this,"shape",i),i},checks:[]});return Tn(t,i)}(hu,e,t[0]),e.required=(...t)=>function(e,t,n){const r=gn(t._zod.def,{get shape(){const r=t._zod.def.shape,i={...r};if(n)for(const t in n){if(!(t in i))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:"nonoptional",innerType:r[t]}))}else for(const t in r)i[t]=new e({type:"nonoptional",innerType:r[t]});return mn(this,"shape",i),i}});return Tn(t,r)}(Su,e,t[0])});function Dc(e,t){const n={type:"object",shape:e??{},...En(t)};return new Fc(n)}function Lc(e,t){return new Fc({type:"object",shape:e,catchall:Ec(),...En(t)})}function Mc(e,t){return new Fc({type:"object",shape:e,catchall:Cc(),...En(t)})}const $c=tn("ZodUnion",(e,t)=>{zo.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ra(e,t,n,r),e.options=t.options});function Uc(e,t){return new $c({type:"union",options:e,...En(t)})}const Bc=tn("ZodXor",(e,t)=>{$c.init(e,t),Do.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ra(e,t,n,r),e.options=t.options});function Zc(e,t){return new Bc({type:"union",options:e,inclusive:!1,...En(t)})}const qc=tn("ZodDiscriminatedUnion",(e,t)=>{$c.init(e,t),Lo.init(e,t)});function Hc(e,t,n){return new qc({type:"union",options:t,discriminator:e,...En(n)})}const Wc=tn("ZodIntersection",(e,t)=>{Mo.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,o=ka(i.left,t,{...r,path:[...r.path,"allOf",0]}),s=ka(i.right,t,{...r,path:[...r.path,"allOf",1]}),a=e=>"allOf"in e&&1===Object.keys(e).length,l=[...a(o)?o.allOf:[o],...a(s)?s.allOf:[s]];n.allOf=l})(e,t,n,r)});function Gc(e,t){return new Wc({type:"intersection",left:e,right:t})}const Vc=tn("ZodTuple",(e,t)=>{Bo.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=n,o=e._zod.def;i.type="array";const s="draft-2020-12"===t.target?"prefixItems":"items",a="draft-2020-12"===t.target||"openapi-3.0"===t.target?"items":"additionalItems",l=o.items.map((e,n)=>ka(e,t,{...r,path:[...r.path,s,n]})),c=o.rest?ka(o.rest,t,{...r,path:[...r.path,a,..."openapi-3.0"===t.target?[o.items.length]:[]]}):null;"draft-2020-12"===t.target?(i.prefixItems=l,c&&(i.items=c)):"openapi-3.0"===t.target?(i.items={anyOf:l},c&&i.items.anyOf.push(c),i.minItems=l.length,c||(i.maxItems=l.length)):(i.items=l,c&&(i.additionalItems=c));const{minimum:u,maximum:d}=e._zod.bag;"number"==typeof u&&(i.minItems=u),"number"==typeof d&&(i.maxItems=d)})(e,t,n,r),e.rest=t=>e.clone({...e._zod.def,rest:t})});function Qc(e,t,n){const r=t instanceof Li;return new Vc({type:"tuple",items:e,rest:r?t:null,...En(r?n:t)})}const Kc=tn("ZodRecord",(e,t)=>{qo.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=n,o=e._zod.def;i.type="object";const s=o.keyType,a=s._zod.bag,l=a?.patterns;if("loose"===o.mode&&l&&l.size>0){const e=ka(o.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});i.patternProperties={};for(const t of l)i.patternProperties[t.source]=e}else"draft-07"!==t.target&&"draft-2020-12"!==t.target||(i.propertyNames=ka(o.keyType,t,{...r,path:[...r.path,"propertyNames"]})),i.additionalProperties=ka(o.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const c=s._zod.values;if(c){const e=[...c].filter(e=>"string"==typeof e||"number"==typeof e);e.length>0&&(i.required=e)}})(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function Jc(e,t,n){return new Kc({type:"record",keyType:e,valueType:t,...En(n)})}function Yc(e,t,n){const r=Tn(e);return r._zod.values=void 0,new Kc({type:"record",keyType:r,valueType:t,...En(n)})}function Xc(e,t,n){return new Kc({type:"record",keyType:e,valueType:t,mode:"loose",...En(n)})}const eu=tn("ZodMap",(e,t)=>{Ho.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Map cannot be represented in JSON Schema")})(0,e),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...t)=>e.check(ia(...t)),e.nonempty=t=>e.check(ia(1,t)),e.max=(...t)=>e.check(ra(...t)),e.size=(...t)=>e.check(oa(...t))});function tu(e,t,n){return new eu({type:"map",keyType:e,valueType:t,...En(n)})}const nu=tn("ZodSet",(e,t)=>{Go.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Set cannot be represented in JSON Schema")})(0,e),e.min=(...t)=>e.check(ia(...t)),e.nonempty=t=>e.check(ia(1,t)),e.max=(...t)=>e.check(ra(...t)),e.size=(...t)=>e.check(oa(...t))});function ru(e,t){return new nu({type:"set",valueType:e,...En(t)})}const iu=tn("ZodEnum",(e,t)=>{Qo.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=an(e._zod.def.entries);r.every(e=>"number"==typeof e)&&(n.type="number"),r.every(e=>"string"==typeof e)&&(n.type="string"),n.enum=r})(e,0,n),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{const i={};for(const r of e){if(!n.has(r))throw new Error(`Key ${r} not found in enum`);i[r]=t.entries[r]}return new iu({...t,checks:[],...En(r),entries:i})},e.exclude=(e,r)=>{const i={...t.entries};for(const t of e){if(!n.has(t))throw new Error(`Key ${t} not found in enum`);delete i[t]}return new iu({...t,checks:[],...En(r),entries:i})}});function ou(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new iu({type:"enum",entries:n,...En(t)})}function su(e,t){return new iu({type:"enum",entries:e,...En(t)})}const au=tn("ZodLiteral",(e,t)=>{Ko.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=e._zod.def,i=[];for(const e of r.values)if(void 0===e){if("throw"===t.unrepresentable)throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if("bigint"==typeof e){if("throw"===t.unrepresentable)throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(e))}else i.push(e);if(0===i.length);else if(1===i.length){const e=i[0];n.type=null===e?"null":typeof e,"draft-04"===t.target||"openapi-3.0"===t.target?n.enum=[e]:n.const=e}else i.every(e=>"number"==typeof e)&&(n.type="number"),i.every(e=>"string"==typeof e)&&(n.type="string"),i.every(e=>"boolean"==typeof e)&&(n.type="boolean"),i.every(e=>null===e)&&(n.type="null"),n.enum=i})(e,t,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function lu(e,t){return new au({type:"literal",values:Array.isArray(e)?e:[e],...En(t)})}const cu=tn("ZodFile",(e,t)=>{Jo.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=n,i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:o,maximum:s,mime:a}=e._zod.bag;void 0!==o&&(i.minLength=o),void 0!==s&&(i.maxLength=s),a?1===a.length?(i.contentMediaType=a[0],Object.assign(r,i)):(Object.assign(r,i),r.anyOf=a.map(e=>({contentMediaType:e}))):Object.assign(r,i)})(e,0,n),e.min=(t,n)=>e.check(ia(t,n)),e.max=(t,n)=>e.check(ra(t,n)),e.mime=(t,n)=>e.check(ga(Array.isArray(t)?t:[t],n))});function uu(e){return function(e,t){return new e({type:"file",...En(t)})}(cu,e)}const du=tn("ZodTransform",(e,t)=>{Yo.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Transforms cannot be represented in JSON Schema")})(0,e),e._zod.parse=(n,r)=>{if("backward"===r.direction)throw new rn(e.constructor.name);n.addIssue=r=>{if("string"==typeof r)n.issues.push(Ln(r,n.value,t));else{const t=r;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=n.value),t.inst??(t.inst=e),n.issues.push(Ln(t))}};const i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function pu(e){return new du({type:"transform",transform:e})}const hu=tn("ZodOptional",(e,t)=>{es.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Na(e,t,0,r),e.unwrap=()=>e._zod.def.innerType});function fu(e){return new hu({type:"optional",innerType:e})}const mu=tn("ZodExactOptional",(e,t)=>{ts.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Na(e,t,0,r),e.unwrap=()=>e._zod.def.innerType});function gu(e){return new mu({type:"optional",innerType:e})}const yu=tn("ZodNullable",(e,t)=>{ns.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,o=ka(i.innerType,t,r),s=t.seen.get(e);"openapi-3.0"===t.target?(s.ref=i.innerType,n.nullable=!0):n.anyOf=[o,{type:"null"}]})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function vu(e){return new yu({type:"nullable",innerType:e})}function _u(e){return fu(vu(e))}const bu=tn("ZodDefault",(e,t)=>{rs.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;ka(i.innerType,t,r),t.seen.get(e).ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function xu(e,t){return new bu({type:"default",innerType:e,get defaultValue(){return"function"==typeof t?t():jn(t)}})}const wu=tn("ZodPrefault",(e,t)=>{os.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;ka(i.innerType,t,r),t.seen.get(e).ref=i.innerType,"input"===t.io&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ju(e,t){return new wu({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof t?t():jn(t)}})}const Su=tn("ZodNonOptional",(e,t)=>{ss.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;ka(i.innerType,t,r),t.seen.get(e).ref=i.innerType})(e,t,0,r),e.unwrap=()=>e._zod.def.innerType});function ku(e,t){return new Su({type:"nonoptional",innerType:e,...En(t)})}const Cu=tn("ZodSuccess",(e,t)=>{ls.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n)=>{n.type="boolean"})(0,0,t),e.unwrap=()=>e._zod.def.innerType});function Tu(e){return new Cu({type:"success",innerType:e})}const Eu=tn("ZodCatch",(e,t)=>{cs.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;let o;ka(i.innerType,t,r),t.seen.get(e).ref=i.innerType;try{o=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=o})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Pu(e,t){return new Eu({type:"catch",innerType:e,catchValue:"function"==typeof t?t:()=>t})}const Ou=tn("ZodNaN",(e,t)=>{us.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("NaN cannot be represented in JSON Schema")})(0,e)});function Ru(e){return function(e,t){return new e({type:"nan",...En(t)})}(Ou,e)}const Nu=tn("ZodPipe",(e,t)=>{ds.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,o="input"===t.io?"transform"===i.in._zod.def.type?i.out:i.in:i.out;ka(o,t,r),t.seen.get(e).ref=o})(e,t,0,r),e.in=t.in,e.out=t.out});function Au(e,t){return new Nu({type:"pipe",in:e,out:t})}const Iu=tn("ZodCodec",(e,t)=>{Nu.init(e,t),hs.init(e,t)});function zu(e,t,n){return new Iu({type:"pipe",in:e,out:t,transform:n.decode,reverseTransform:n.encode})}const Fu=tn("ZodReadonly",(e,t)=>{gs.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;ka(i.innerType,t,r),t.seen.get(e).ref=i.innerType,n.readOnly=!0})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Du(e){return new Fu({type:"readonly",innerType:e})}const Lu=tn("ZodTemplateLiteral",(e,t)=>{vs.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=n,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");r.type="string",r.pattern=i.source})(e,0,n)});function Mu(e,t){return new Lu({type:"template_literal",parts:e,...En(t)})}const $u=tn("ZodLazy",(e,t)=>{xs.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.innerType;ka(i,t,r),t.seen.get(e).ref=i})(e,t,0,r),e.unwrap=()=>e._zod.def.getter()});function Uu(e){return new $u({type:"lazy",getter:e})}const Bu=tn("ZodPromise",(e,t)=>{bs.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;ka(i.innerType,t,r),t.seen.get(e).ref=i.innerType})(e,t,0,r),e.unwrap=()=>e._zod.def.innerType});function Zu(e){return new Bu({type:"promise",innerType:e})}const qu=tn("ZodFunction",(e,t)=>{_s.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Function types cannot be represented in JSON Schema")})(0,e)});function Hu(e){return new qu({type:"function",input:Array.isArray(e?.input)?Qc(e?.input):e?.input??Ic(Cc()),output:e?.output??Cc()})}const Wu=tn("ZodCustom",(e,t)=>{ws.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Custom types cannot be represented in JSON Schema")})(0,e)});function Gu(e){const t=new pi({check:"custom"});return t._zod.check=e,t}function Vu(e,t){return function(e,t,n){const r=En(n);return r.abort??(r.abort=!0),new e({type:"custom",check:"custom",fn:t,...r})}(Wu,e??(()=>!0),t)}function Qu(e,t={}){return function(e,t,n){return new e({type:"custom",check:"custom",fn:t,...En(n)})}(Wu,e,t)}function Ku(e){return function(e){const t=function(e){const t=new pi({check:"custom",...En(void 0)});return t._zod.check=e,t}(n=>(n.addIssue=e=>{if("string"==typeof e)n.issues.push(Ln(e,n.value,t._zod.def));else{const r=e;r.fatal&&(r.continue=!1),r.code??(r.code="custom"),r.input??(r.input=n.value),r.inst??(r.inst=t),r.continue??(r.continue=!t._zod.def.abort),n.issues.push(Ln(r))}},e(n.value,n)));return t}(e)}const Ju=function(e){const t=new pi({check:"describe"});return t._zod.onattach=[t=>{const n=ks.get(t)??{};ks.add(t,{...n,description:e})}],t._zod.check=()=>{},t},Yu=function(e){const t=new pi({check:"meta"});return t._zod.onattach=[t=>{const n=ks.get(t)??{};ks.add(t,{...n,...e})}],t._zod.check=()=>{},t};function Xu(e,t={}){const n=new Wu({type:"custom",check:"custom",fn:t=>t instanceof e,abort:!0,...En(t)});return n._zod.bag.Class=e,n._zod.check=t=>{t.value instanceof e||t.issues.push({code:"invalid_type",expected:e.name,input:t.value,inst:n,path:[...n._zod.def.path??[]]})},n}const ed=(...e)=>function(e,t){const n=En(t);let r=n.truthy??["true","1","yes","on","y","enabled"],i=n.falsy??["false","0","no","off","n","disabled"];"sensitive"!==n.case&&(r=r.map(e=>"string"==typeof e?e.toLowerCase():e),i=i.map(e=>"string"==typeof e?e.toLowerCase():e));const o=new Set(r),s=new Set(i),a=e.Codec??hs,l=e.Boolean??go,c=new a({type:"pipe",in:new(e.String??Mi)({type:"string",error:n.error}),out:new l({type:"boolean",error:n.error}),transform:(e,t)=>{let r=e;return"sensitive"!==n.case&&(r=r.toLowerCase()),!!o.has(r)||!s.has(r)&&(t.issues.push({code:"invalid_value",expected:"stringbool",values:[...o,...s],input:t.value,inst:c,continue:!1}),{})},reverseTransform:(e,t)=>!0===e?r[0]||"true":i[0]||"false",error:n.error});return c}({Codec:Iu,Boolean:uc,String:il},...e);function td(e){const t=Uu(()=>Uc([ol(e),rc(),dc(),wc(),Ic(t),Jc(ol(),t)]));return t}function nd(e,t){return Au(pu(e),t)}var rd;function id(e){return function(e,t){return new e({type:"number",coerce:!0,checks:[],...En(t)})}(nc,e)}rd||(rd={}),new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]),sn({localeError:(()=>{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 n={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",jwt:"JWT",template_literal:"input"},r={nan:"NaN"};return e=>{switch(e.code){case"invalid_type":{const t=r[e.expected]??e.expected,n=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 ${r[n]??n}`}case"invalid_value":return 1===e.values.length?`Invalid input: expected ${Pn(e.values[0])}`:`Invalid option: expected one of ${ln(e.values,"|")}`;case"too_big":{const n=e.inclusive?"<=":"<",r=t(e.origin);return r?`Too big: expected ${e.origin??"value"} to have ${n}${e.maximum.toString()} ${r.unit??"elements"}`:`Too big: expected ${e.origin??"value"} to be ${n}${e.maximum.toString()}`}case"too_small":{const n=e.inclusive?">=":">",r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${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 ${n[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":""}: ${ln(e.keys,", ")}`;case"invalid_key":return`Invalid key in ${e.origin}`;case"invalid_union":default:return"Invalid input";case"invalid_element":return`Invalid value in ${e.origin}`}}})()});class od extends Error{constructor(e,t){const n=e.issues,r=n.map(e=>{const t=e.path.join(".");return`${t?`${t}: `:""}${e.message}`}).join("\n");super(n.length>0?`API response validation failed:\n${r}`:"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 sd(e){return e instanceof Ba?(console.error("API Validation Error:",e.format()),new od(e)):e instanceof Error?e:"object"==typeof e&&null!==e&&"message"in e?new Error(e.message||"Unknown error"):new Error("Unknown error occurred")}const ad={redirects:{all:["redirects"],lists:()=>[...ad.redirects.all,"list"],list:e=>[...ad.redirects.lists(),e],detail:e=>[...ad.redirects.all,"detail",e]},groups:{all:["groups"],lists:()=>[...ad.groups.all,"list"],list:e=>[...ad.groups.lists(),e],detail:e=>[...ad.groups.all,"detail",e]},logs:{all:["logs"],lists:()=>[...ad.logs.all,"list"],list:e=>[...ad.logs.lists(),e]},errors:{all:["errors"],lists:()=>[...ad.errors.all,"list"],list:e=>[...ad.errors.lists(),e]},settings:{all:["settings"],get:()=>[...ad.settings.all,"get"],status:()=>[...ad.settings.all,"status"]},pluginInfo:{all:["pluginInfo"],get:()=>[...ad.pluginInfo.all,"get"]},io:{all:["io"],importers:()=>[...ad.io.all,"importers"]},info:{all:["info"],ip:e=>[...ad.info.all,"ip",e],agent:e=>[...ad.info.all,"agent",e],http:e=>[...ad.info.all,"http",e]}},ld={errors:[],notices:[],inProgress:0},cd=te()(se(e=>({...ld,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(ld)}),{name:"MessageStore"}));function ud(e){return ct({queryKey:ad.io.importers(),queryFn:async()=>{const e=await jt($t());return e?.importers||[]},...e})}function dd(e){const t=h(),{addNotice:n,addError:r}=cd();return pt({mutationFn:async e=>await jt(Ut(e)),onSuccess:()=>{n("Import completed"),t.invalidateQueries({queryKey:ad.redirects.lists()})},onError:e=>{r(e.message||"Import failed")},...e})}function pd({setStep:e,step:t,options:n,setOptions:r}){const{log:i=!1,ip:o=!1,monitor:s=!1}=n?.settings??{},{data:a=[]}=ud(),l=0===a.length?t+2:t+1;function c(e){r({settings:{...n.settings,[e.target.name]:e.target.checked}})}return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("h2",{children:(0,m.__)("Basic Setup","redirection")}),(0,d.jsx)("p",{children:(0,m.__)("These are some options you may want to enable now. They can be changed at any time.","redirection")}),(0,d.jsxs)("div",{className:"wizard-option",children:[(0,d.jsxs)("p",{children:[(0,d.jsx)("input",{id:"wizard-monitor",name:"monitor",type:"checkbox",checked:s,onChange:c}),(0,d.jsxs)("label",{htmlFor:"wizard-monitor",children:[(0,m.__)("Monitor permalink changes in WordPress posts and pages","redirection"),"."]})]}),(0,d.jsxs)("p",{children:[(0,m.__)("If you change the permalink in a post or page then Redirection can automatically create a redirect for you.","redirection")," ",U((0,m.__)("{{link}}Read more about this.{{/link}}","redirection"),{link:(0,d.jsx)(z,{url:"https://redirection.me/support/options/#monitor"})})]})]}),(0,d.jsxs)("div",{className:"wizard-option",children:[(0,d.jsxs)("p",{children:[(0,d.jsx)("input",{id:"wizard-log",name:"log",type:"checkbox",checked:i,onChange:function(e){r({settings:{...n.settings,[e.target.name]:e.target.checked,ip:!!e.target.checked&&o}})}}),(0,d.jsx)("label",{htmlFor:"wizard-log",children:(0,m.__)("Keep a log of all redirects and 404 errors.","redirection")})]}),(0,d.jsxs)("p",{children:[(0,m.__)("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")," ",U((0,m.__)("{{link}}Read more about this.{{/link}}","redirection"),{link:(0,d.jsx)(z,{url:"https://redirection.me/support/logs/"})})]})]}),(0,d.jsxs)("div",{className:i?"wizard-option":"wizard-option wizard-option_disabled",children:[(0,d.jsxs)("p",{children:[(0,d.jsx)("input",{id:"wizard-ip",name:"ip",type:"checkbox",disabled:!i,checked:o,onChange:c}),(0,d.jsx)("label",{htmlFor:"wizard-ip",children:(0,m.__)("Store IP information for redirects and 404 errors.","redirection")})]}),(0,d.jsxs)("p",{children:[(0,m.__)("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")," ",U((0,m.__)("{{link}}Read more about this.{{/link}}","redirection"),{link:(0,d.jsx)(z,{url:"https://redirection.me/support/privacy-gdpr/"})})]})]}),(0,d.jsxs)("div",{className:"wizard-buttons",children:[(0,d.jsx)("button",{className:"button-primary button",onClick:()=>e(l),children:(0,m.__)("Continue","redirection")})," ",(0,d.jsx)("button",{className:"button",onClick:()=>e(t-1),children:(0,m.__)("Go back","redirection")})]})]})}const hd=function({error:e}){const{request:t}=e,n=function(e){return!!(e&&e.raw&&e.raw.length>500)}(t),[r,i]=(0,l.useState)(n);return t&&t.raw?(0,d.jsxs)(d.Fragment,{children:[n&&r&&(0,d.jsx)("button",{className:"api-result-hide",type:"button",onClick:e=>{e.preventDefault(),i(!1)},children:(0,m.__)("Show Full","redirection")}),n&&!r&&(0,d.jsx)("button",{className:"api-result-hide",type:"button",onClick:e=>{e.preventDefault(),i(!0)},children:(0,m.__)("Hide","redirection")}),(0,d.jsx)("pre",{children:r?t.raw.substring(0,500)+" ...":t.raw})]}):null},fd=({error:e,methods:t})=>{const n=(e=>e.code?e.code:e.name?e.name:null)(e);return(0,d.jsxs)("div",{className:"api-result-log_details",children:[(0,d.jsx)("p",{children:(0,d.jsx)("span",{className:"dashicons dashicons-no"})}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("p",{children:[t.map((t,n)=>(0,d.jsxs)("span",{className:"api-result-method_fail",children:[t," ",e.data&&e.data.status]},n)),n&&(0,d.jsxs)("strong",{children:[n,": "]}),e.message]}),(0,d.jsx)(B,{error:e,links:K(),locale:"redirection"}),(0,d.jsx)(hd,{error:e})]})]},t.join(""))},md=({methods:e})=>(0,d.jsxs)("p",{children:[(0,d.jsx)("span",{className:"dashicons dashicons-yes"}),e.map((e,t)=>(0,d.jsx)("span",{className:"api-result-method_pass",children:e},t)),(0,m.__)("Working!","redirection")]},e.join("")),gd=e=>e.code?e.code:0,yd=({result:e})=>{const t=[],{GET:n,POST:r}=e;return n.status===r.status&&gd(n)===gd(r)?("fail"===n.status&&n.error?t.push((0,d.jsx)(fd,{error:n.error,methods:["GET","POST"]},"get-post")):t.push((0,d.jsx)(md,{methods:["GET","POST"]},"get-post")),t):("fail"===n.status&&n.error?t.push((0,d.jsx)(fd,{error:n.error,methods:["GET"]},"get")):t.push((0,d.jsx)(md,{methods:["GET"]},"get")),"fail"===r.status&&r.error?t.push((0,d.jsx)(fd,{error:r.error,methods:["POST"]},"post")):t.push((0,d.jsx)(md,{methods:["POST"]},"post")),t)},vd=({item:e,result:t,routes:n,isCurrent:r,allowChange:i})=>(e=>0===Object.keys(e).length||"loading"===e.GET.status||"loading"===e.POST.status)(t)?null:(0,d.jsxs)("div",{className:"api-result-log",children:[(0,d.jsxs)("form",{className:"api-result-select",action:window.Redirectioni10n.pluginRoot+"&sub=support",method:"POST",children:[i&&!r&&(0,d.jsx)("input",{type:"submit",className:"button button-secondary",value:(0,m.__)("Switch to this API","redirection")}),i&&r&&(0,d.jsx)("span",{children:(0,m.__)("Current API","redirection")}),(0,d.jsx)("input",{type:"hidden",name:"rest_api",value:e.value}),(0,d.jsx)("input",{type:"hidden",name:"_wpnonce",value:jt.nonceMiddleware.nonce}),(0,d.jsx)("input",{type:"hidden",name:"action",value:"rest_api"})]}),(0,d.jsx)("h4",{children:e.text}),(0,d.jsxs)("p",{children:["URL:"," ",(0,d.jsx)("code",{children:(0,d.jsx)(z,{url:n[e.value]||"",children:n[e.value]||""})})]}),(0,d.jsx)(yd,{result:t})]}),_d=({size:e=""})=>{const t=y("wpl-spinner__container",e&&" spinner-"+e);return(0,d.jsx)("div",{className:t,children:(0,d.jsx)("span",{className:"wpl-spinner__item"})})},bd=e=>{const{title:t,url:n=!1,children:r}=e;return(0,d.jsxs)("tr",{children:[(0,d.jsxs)("th",{children:[!n&&t,n&&(0,d.jsx)("a",{href:n,target:"_blank",rel:"noreferrer",children:t})]}),(0,d.jsx)("td",{children:r})]})},xd=e=>(0,d.jsx)("table",{className:"form-table",children:(0,d.jsx)("tbody",{children:e.children})}),wd=({value:e,label:t,disabled:n=!1})=>Array.isArray(e)?(0,d.jsx)("optgroup",{label:String(t),disabled:n,children:e.map((e,t)=>(0,d.jsx)(wd,{label:e.label,value:e.value,disabled:e.disabled||!1},t))}):(0,d.jsx)("option",{value:e,disabled:n,children:t}),jd=wd,Sd=({items:e,value:t,name:n,onChange:r,disabled:i=!1,className:o})=>(0,d.jsx)("select",{name:n,value:t,onChange:r,disabled:i,className:o,children:e.map((e,t)=>(0,d.jsx)(jd,{value:e.value,label:e.label,disabled:e.disabled||!1},t))}),kd=()=>[{value:0,label:(0,m.__)("Default REST API","redirection")},{value:1,label:(0,m.__)("Raw REST API","redirection")},{value:3,label:(0,m.__)("Relative REST API","redirection")}],Cd=function(e){const{settings:t,onChange:n,getLink:r,installed:i,warning:o}=e,{location:s,token:a,rest_api:l,plugin_update:c}=t;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("tr",{className:"redirect-option__row",children:(0,d.jsx)("th",{colSpan:2,children:(0,d.jsx)("h2",{className:"title",children:(0,m.__)("Advanced","redirection")})})}),(0,d.jsxs)(bd,{title:(0,m.__)("RSS Token","redirection")+":",url:r("options","rsstoken"),children:[(0,d.jsx)("input",{className:"regular-text",type:"text",value:a,name:"token",onChange:n}),(0,d.jsx)("br",{}),(0,d.jsx)("span",{className:"sub",children:(0,m.__)("A unique token allowing feed readers access to Redirection log RSS (leave blank to auto-generate)","redirection")})]}),(0,d.jsxs)(bd,{title:(0,m.__)("Apache .htaccess","redirection"),url:r("options","apache"),children:[(0,d.jsxs)("p",{children:[(0,d.jsx)("label",{className:"screen-reader-text",htmlFor:"apache-htaccess-location",children:(0,m.__)("Apache .htaccess location","redirection")}),(0,d.jsx)("input",{id:"apache-htaccess-location",type:"text",className:"regular-text",name:"location",value:s,onChange:n})]}),(0,d.jsx)("p",{className:"sub",children:U((0,m.sprintf)(
// translators: %(installed)s is the path where WordPress is installed
// translators: %(installed)s is the path where WordPress is installed
(0,m.__)("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,d.jsx)("code",{})})}),o&&(0,d.jsxs)("p",{className:"inline-notice",children:[(0,m.__)("Unable to save .htaccess file","redirection")," ",(0,d.jsx)("code",{children:o})]})]}),(0,d.jsxs)(bd,{title:(0,m.__)("REST API","redirection"),url:r("options","restapi"),children:[(0,d.jsx)(Sd,{items:kd(),name:"rest_api",value:String(l),onChange:n})," "," ",(0,d.jsx)("span",{className:"sub",children:(0,m.__)("How Redirection uses the REST API - don't change unless necessary","redirection")})]}),(0,d.jsxs)(bd,{title:(0,m.__)("Data Upgrade","redirection"),children:[(0,d.jsx)(Sd,{items:[{value:"prompt",
// translators: Upgrade manually when prompted
label:(0,m.__)("Upgrade manually when prompted","redirection")},{value:"admin",
// translators: Automatically upgrade on admin pages
label:(0,m.__)("Automatically upgrade on admin pages","redirection")}],name:"plugin_update",value:c,onChange:n})," "," ",(0,d.jsx)("span",{className:"sub",children:(0,m.__)("Decide how Redirection updates itself, if needed.","redirection")})]})]})},Td=Dc({support:dc().optional(),token:ol().optional(),ip_logging:rc().int().optional(),expire_redirect:rc().int().optional(),expire_404:rc().int().optional(),auto_target:ol().optional(),location:ol().optional(),monitor_post:rc().int().optional(),monitor_types:Ic(ol()).optional(),associated_redirect:ol().optional(),redirect_cache:rc().int().optional(),rest_api:rc().int().optional(),https:dc().optional(),headers:Ic(Cc()).optional(),flag_regex:dc().optional(),flag_query:ol().optional(),flag_trailing:dc().optional(),flag_case:dc().optional(),postTypes:Jc(ol(),ol()).optional(),installed:ol().optional(),warning:ol().optional(),plugin_update:ol().optional()}).passthrough(),Ed=Dc({status:ou(["ok","need-update","error"]),version:ol().optional(),required:ol().optional(),reason:ol().optional()});function Pd(e){const{setValues:t,setLoadStatus:n,setError:r}=pe(),{addError:i}=cd();return ct({queryKey:ad.settings.get(),queryFn:async()=>{n("loading"),r(!1);try{const e=await jt(Et()),r=e?.settings||e,o={...r,postTypes:e?.post_types||r.postTypes,installed:e?.installed||r.installed,warning:e?.warning||r.warning};try{const e=Td.parse(o);return t(e),n("success"),e}catch(e){if(e instanceof Ba)return t(o),n("success"),i("Settings validation failed, using unvalidated data."),o;throw e}}catch(e){throw n("error"),r(e.message||"Failed to load settings"),i(e.message||"Failed to load settings"),sd(e)}},...e})}function Od(e){const t=h(),{updateValues:n,setSaveStatus:r}=pe(),{incrementProgress:i,decrementProgress:o,addNotice:s,addError:a}=cd();return pt({mutationFn:async e=>{i(),r(!0);try{const t=await jt(Pt(e)),n=t?.settings||t;return Td.parse(n)}catch(e){throw o(),r(!1),sd(e)}},onSuccess:e=>{o(),r(!1),n(e),s("Settings saved"),t.invalidateQueries({queryKey:ad.settings.all})},onError:e=>{a(e.message||"Failed to save settings")},...e})}function Rd(e){const{setDatabase:t}=pe(),{incrementProgress:n,decrementProgress:r,addError:i}=cd();return pt({mutationFn:async e=>{n(),t({inProgress:!0});try{return await jt(Ht("skip"===e||"stop"===e?{upgrade:e}:void 0))}catch(e){throw r(),t({inProgress:!1,result:"failed"}),sd(e)}},onSuccess:e=>{r(),t({inProgress:!1,...e})},onError:e=>{i(e.message||"Database upgrade failed")},...e})}function Nd(e){const t=h(),{setShowDatabase:n}=pe(),{addError:r}=cd();return pt({mutationFn:async()=>{try{return await jt(Wt())}catch(e){throw sd(e)}},onSuccess:()=>{n(!1),t.invalidateQueries({queryKey:ad.settings.all}),window.location.href=window.Redirectioni10n.pluginRoot},onError:e=>{r(e.message||"Failed to finish setup")},...e})}function Ad(e){const t=h(),{setDatabase:n}=pe(),{onSuccess:r,...i}=e||{};return pt({mutationFn:async({reason:e,current:t})=>await jt(Gt(e,t)),onSuccess:(...e)=>{const[i]=e;n(i.database||{}),t.invalidateQueries({queryKey:ad.settings.all}),r?.(...e)},...i})}Dc({version:ol(),database:Ed,groups:Ic(Cc()).optional(),postTypes:Ic(ol()).optional(),canDelete:dc().optional(),autoTarget:ol().optional()});const Id="ok",zd="fail",Fd="loading",Dd="warning-current",Ld="warning-not-selected";function Md(e){return e===Id?(0,m.__)("Good","redirection"):e===Ld||e===Dd?(0,m.__)("Working but some issues","redirection"):(0,m.__)("Unavailable","redirection")}function $d({allowChange:e=!0}){const[t,n]=u().useState(!1),[r,i]=u().useState(!1),o=pe(e=>e.apiTest),s=pe(e=>e.api),{mutate:a}=function(){const{setApiTest:e}=pe();return pt({mutationFn:async t=>{const n={};for(const e of t){const{id:t}=e;n[t]={GET:{status:"loading"},POST:{status:"loading"}}}e(n);for(const r of t){const{id:t,url:i}=r,o=i.endsWith("/")?`${i}redirection/v1/plugin/test`:`${i}/redirection/v1/plugin/test`;try{await jt({url:o,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:o,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:c,current:p}=s;(0,l.useEffect)(()=>{const e=Object.keys(c).map(e=>({id:e,url:c[e]}));e.length>0&&!r&&(a(e.filter(e=>!!e&&!!e.url)),i(!0))},[c,a,r]);const h=()=>{n(!0)},f=e=>t||e===zd,g=kd().map(e=>({text:e.label,value:String(e.value)})),v=function(e,t){if(0===Object.keys(e).length)return 0;const n=2*t.length;let r=0;for(let t=0;t<Object.keys(e).length;t++){const n=Object.keys(e)[t];n&&e[n]&&e[n].GET&&e[n].GET.status!==Fd&&r++,n&&e[n]&&e[n].POST&&e[n].POST.status!==Fd&&r++}return Math.round(r/n*100)}(o,g),_=function(e,t,n){const r=Object.keys(e).filter(t=>{return!(!(n=e[t])||!n.GET||!n.POST||n.GET.status!==zd&&n.POST.status!==zd);var n}).length;return 0===r?"ok":r<t.length?(i=e[n])&&i.GET&&i.POST&&i.GET.status===Id&&i.POST.status===Id?Dd:Ld:"fail";var i}(o,g,p),b=v>=100&&f(_)||t,x=y({"api-result-status":!0,"api-result-status_good":_===Id&&v>=100,"api-result-status_problem":_===Dd&&Ld&&v>=100,"api-result-status_failed":_===zd&&v>=100});return(0,d.jsxs)("div",{className:"api-result-wrapper",children:[(0,d.jsxs)("div",{className:"api-result-header",children:[(0,d.jsx)("strong",{children:"REST API:"}),(0,d.jsxs)("div",{className:"api-result-progress",children:[(0,d.jsxs)("span",{className:x,children:[v<100&&(0,m.sprintf)(
// translators: %s is the percentage complete
// translators: %s is the percentage complete
(0,m.__)("Testing - %s%%","redirection"),String(v)),v>=100&&Md(_)]}),v<100&&(0,d.jsx)(_d,{})]}),v>=100&&_!==Id&&(0,d.jsx)("button",{className:"button button-secondary api-result-retry",onClick:e=>{e.preventDefault(),n(!1),i(!1);const t=Object.keys(c).map(e=>({id:e,url:c[e]}));a(t.filter(e=>!!e&&!!e.url))},children:(0,m.__)("Check Again","redirection")})]}),v>=100&&_!==Id&&(e=>{const t=f(e);let n=(0,m.__)("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===zd&&(n=(0,m.__)("Your REST API is not working and the plugin will not be able to continue until this is fixed.","redirection")),(0,d.jsxs)("div",{className:"api-result-log",children:[(0,d.jsxs)("p",{children:[(0,d.jsx)("strong",{children:(0,m.__)("Summary","redirection")}),": ",n]}),!t&&(0,d.jsx)("p",{children:(0,d.jsx)("button",{className:"button-secondary",onClick:h,children:(0,m.__)("Show Problems","redirection")})})]})})(_),b&&g.map((t,n)=>{return(0,d.jsx)(vd,{item:t,result:(r=o,i=t.value,r&&r[i]?r[i]:{}),routes:c,isCurrent:p===t.value,allowChange:e||!1},n);var r,i})]})}function Ud(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n];if(r&&e[r]&&"ok"===e[r].GET.status&&"ok"===e[r].POST.status)return r}return 0}function Bd({setStep:e,step:t}){let n=null,r=null;try{n=new URL(window.Redirectioni10n.api.WP_API_root),r=new URL(window.Redirectioni10n.pluginBaseUrl)}catch(e){}const i=n&&r&&(n.protocol!==r.protocol||n.host!==r.host),o=pe(e=>e.apiTest);return(0,l.useEffect)(()=>()=>{const e=Ud(o);window.Redirectioni10n.api.routes[e]&&jt.replaceRootURLMiddleware(window.Redirectioni10n.api.routes[e])},[o]),(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("h2",{children:(0,m.__)("REST API","redirection")}),(0,d.jsx)("p",{children:U((0,m.__)("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,d.jsx)(z,{url:"https://developer.wordpress.org/rest-api/"})})}),(0,d.jsxs)("ul",{children:[(0,d.jsx)("li",{children:(0,m.__)("A security plugin (e.g Wordfence)","redirection")}),(0,d.jsx)("li",{children:(0,m.__)("A server firewall or other server configuration (e.g OVH)","redirection")}),(0,d.jsx)("li",{children:(0,m.__)("Caching software (e.g Cloudflare)","redirection")}),(0,d.jsx)("li",{children:(0,m.__)("Some other plugin that blocks the REST API","redirection")})]}),(0,d.jsx)("p",{children:U((0,m.__)("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,d.jsx)(z,{url:"https://redirection.me/support/problems/rest-api/"})})}),i&&(0,d.jsxs)("div",{className:"wpl-error",children:[(0,m.__)("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,d.jsx)("p",{children:(0,d.jsx)("code",{children:n?n.protocol+"//"+n.host:"unknown url"})}),(0,d.jsx)("p",{children:(0,d.jsx)("code",{children:r?r.protocol+"//"+r.host:"unknown url"})})]}),(0,d.jsx)($d,{allowChange:!1}),(0,d.jsx)("p",{children:(0,m.__)("You will need at least one working REST API to continue.","redirection")}),(0,d.jsx)("div",{className:"wizard-buttons",children:(0,d.jsx)("button",{className:"button-primary button",onClick:()=>e(t+1),children:(0,m.__)("Finish Setup","redirection")})})]})}function Zd(e){return Zd="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},Zd(e)}function qd(e,t,n){return(t=function(e){var t=function(e){if("object"!=Zd(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Zd(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Zd(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Hd(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Wd(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Hd(Object(n),!0).forEach(function(t){qd(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Hd(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Gd=n(500),Vd=n.n(Gd),Qd={percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,trailColor:"#D9D9D9",trailWidth:1,gapPosition:"bottom"},Kd=["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"];const Jd=function(e){var t=Wd(Wd({},Qd),e),n=t.className,r=t.percent,i=t.prefixCls,o=t.strokeColor,s=t.strokeLinecap,a=t.strokeWidth,c=t.style,u=t.trailColor,d=t.trailWidth,p=t.transition,h=function(e,t){if(null==e)return{};var n,r,i=_(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(t,Kd);delete h.gapPosition;var f,m,g=Array.isArray(r)?r:[r],y=Array.isArray(o)?o:[o],b=(f=(0,l.useRef)([]),m=(0,l.useRef)(null),(0,l.useEffect)(function(){var e=Date.now(),t=!1;f.current.forEach(function(n){if(n){t=!0;var r=n.style;r.transitionDuration=".3s, .3s, .3s, .06s",m.current&&e-m.current<100&&(r.transitionDuration="0s, 0s")}}),t&&(m.current=Date.now())}),f.current),x=a/2,w=100-a/2,j="M ".concat("round"===s?x:0,",").concat(x,"\n         L ").concat("round"===s?w:100,",").concat(x),S="0 0 100 ".concat(a),k=0;return l.createElement("svg",v({className:Vd()("".concat(i,"-line"),n),viewBox:S,preserveAspectRatio:"none",style:c},h),l.createElement("path",{className:"".concat(i,"-line-trail"),d:j,strokeLinecap:s,stroke:u,strokeWidth:d||a,fillOpacity:"0"}),g.map(function(e,t){var n=1;switch(s){case"round":n=1-a/100;break;case"square":n=1-a/2/100;break;default:n=1}var r={strokeDasharray:"".concat(e*n,"px, 100px"),strokeDashoffset:"-".concat(k,"px"),transition:p||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},o=y[t]||y[y.length-1];return k+=e,l.createElement("path",{key:t,className:"".concat(i,"-line-path"),d:j,strokeLinecap:s,stroke:o,strokeWidth:a,fillOpacity:"0",ref:function(e){b[t]=e},style:r})}))};"undefined"==typeof window||!window.document||window.document.createElement;const Yd=function({message:e,prevent:t=!0}){const n=(0,l.useRef)();return(0,l.useEffect)(()=>{n.current=t=>(t.returnValue=e,t.returnValue)},[e]),(0,l.useEffect)(()=>{if(!t||!n.current)return;const e=e=>{if(n.current)return n.current(e)};return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}},[t]),null};function Xd({onRetry:e}){return(0,d.jsxs)("div",{className:"redirection-database_error wpl-error",children:[(0,d.jsx)("h3",{children:(0,m.__)("Database problem","redirection")}),(0,d.jsx)("p",{children:(0,d.jsx)("button",{className:"button button-primary",onClick:e,children:(0,m.__)("Try again","redirection")})})]})}function ep({onRetry:e,error:t}){const{current:n,next:r,debug:i,reason:o}=pe(e=>e.database),{mutate:s}=Rd(),a=function(e,t,n,r){return[e?"Message: "+e:null,"Installed: "+t,"Next: "+n,r.length>0?"Debug: "+r.join("\n"):null].filter(e=>e).join("\n")}(o,n,r,i),l="mailto:john@redirection.me?subject=Redirection%20Database&body="+encodeURIComponent("Redirection: "+window.Redirectioni10n.versions);return(0,d.jsxs)("div",{className:"redirection-database_error wpl-error",children:[(0,d.jsx)("h3",{children:(0,m.__)("Database problem","redirection")}),(0,d.jsx)("p",{children:t}),(0,d.jsxs)("p",{children:[(0,d.jsx)("button",{className:"button button-primary",onClick:e,children:(0,m.__)("Try again","redirection")})," ","-"!==n&&(0,d.jsx)("button",{className:"button button-secondary",onClick:function(){s("skip")},children:(0,m.__)("Skip this stage","redirection")})," ","-"!==n&&(0,d.jsx)("button",{className:"button button-secondary",onClick:function(){s("stop")},children:(0,m.__)("Stop upgrade","redirection")})]}),(0,d.jsx)("p",{children:U((0,m.__)("If you want to {{support}}ask for support{{/support}} please include these details:","redirection"),{support:(0,d.jsx)("button",{type:"button",onClick:function(){window.location.href=l}})})}),(0,d.jsx)(N,{readOnly:!0,value:a,rows:15})]})}function tp(e){return"need-update"===e?(0,m.__)("Upgrading Redirection","redirection"):(0,m.__)("Setting up Redirection","redirection")}function np(e){return"finish-install"===e||"finish-update"===e}function rp({children:e}){const t=pe(e=>e.database),{status:n,reason:r,result:i,complete:o}=t,s="ok"===i&&!np(n),{mutate:a}=Rd(),c=(0,l.useCallback)(()=>{a("retry")},[a]),u=(0,l.useCallback)(()=>{a("")},[a]);return(0,l.useEffect)(()=>{(function(e,t){return"error"!==t&&"failed"!==t&&("need-install"===e||"need-update"===e)})(n,i)&&setTimeout(()=>{u()},1e3)},[o,n,i,u]),(0,d.jsxs)("div",{className:"redirection-database",children:[(0,d.jsx)(Yd,{message:(0,m.__)("Leaving before the process has completed may cause problems.","redirection"),prevent:"error"!==i&&"failed"!==i&&!np(n)}),(0,d.jsx)("h1",{children:tp(n)}),(0,d.jsx)("p",{children:(0,m.__)("Please remain on this page until complete.","redirection")}),(0,d.jsxs)("div",{className:"redirection-database_progress",children:[(0,d.jsx)("h3",{children:
// translators: %(complete)d is percentage complete as a number
// translators: %(complete)d is percentage complete as a number
(0,m.sprintf)((0,m.__)("Progress: %(complete)d%%","redirection"),{complete:o})}),(0,d.jsx)(Jd,{percent:o,strokeWidth:4,trailWidth:4,strokeLinecap:"square"}),r&&"ok"===i&&(0,d.jsx)("p",{children:r}),s&&(0,d.jsx)("div",{className:"redirection-database_spinner",children:(0,d.jsx)(_d,{})}),"error"===i&&(0,d.jsx)(ep,{error:r||"",onRetry:c}),"failed"===i&&(0,d.jsx)(Xd,{error:r||"",onRetry:c}),np(n)&&e]})]})}function ip({onCancel:e,onComplete:t}){const n=pe(e=>e.loadStatus),{mutate:r}=Ad({onSuccess:()=>{t&&t()}});return(0,d.jsxs)("div",{className:"redirection-database",children:[(0,d.jsx)("h1",{children:(0,m.__)("Manual Install","redirection")}),(0,d.jsxs)("p",{children:[(0,m.__)("If your site needs special database permissions, or you would rather do it yourself, you can manually run the following SQL.","redirection")," ",(0,m.__)('Click "Finished! 🎉" when finished.',"redirection")]}),(0,d.jsx)("p",{children:(0,d.jsx)(N,{readOnly:!0,cols:120,value:Redirectioni10n.database.manual.join(";\n\n")+";",spellCheck:!1})}),"error"===n&&(0,d.jsxs)("div",{className:"redirection-database_error wpl-error",children:[(0,d.jsx)("h3",{children:(0,m.__)("Database problem","redirection")}),(0,d.jsx)("p",{children:(0,m.__)("The Redirection database does not appear to exist. Have you run the above SQL?","redirection")})]}),(0,d.jsx)("button",{className:"button button-primary",onClick:function(){r({reason:"database",current:Redirectioni10n.database.next})},type:"button",children:(0,m.__)("Finished! 🎉","redirection")})," ",(0,d.jsx)("button",{className:"button button-secondary",onClick:e,type:"button",children:(0,m.__)("Go back","redirection")}),(0,d.jsx)("p",{children:(0,m.__)("If you do not complete the manual install you will be returned here.","redirection")})]})}function op({step:e,setStep:t,options:n,setOptions:r}){const{manual:i}=n;return i?(0,d.jsx)(ip,{onCancel:function(){t(0),r({manual:!1})},onComplete:function(){t(e+1)}}):(0,d.jsx)(rp,{children:(0,d.jsx)("div",{className:"wizard-buttons",children:(0,d.jsx)("button",{className:"button-primary button",onClick:()=>t(e+1),children:(0,m.__)("Continue","redirection")})})})}const sp="wordpress-old-slugs";function ap({setOptions:e,options:t,setStep:n,step:r}){const{importers:i=[sp]}=t,{data:o=[]}=ud(),s=o.find(e=>e.id===sp),a=o.filter(e=>e.id!==sp);function l(t){const n=i.filter(e=>e!==t.target.name);t.target.checked?e({importers:n.concat(t.target.name)}):e({importers:n})}return(0,d.jsxs)("div",{children:[(0,d.jsx)("h2",{children:(0,m.__)("Import Existing Redirects","redirection")}),(0,d.jsx)("p",{children:(0,m.__)("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,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("p",{children:(0,m.__)("WordPress automatically creates redirects when you change a post URL. Importing these into Redirection will allow you to manage and monitor them.","redirection")}),(0,d.jsx)("ul",{children:(0,d.jsxs)("li",{children:[(0,d.jsx)("input",{id:"wizard-importer-wordpress-old-slugs",type:"checkbox",name:sp,onChange:l,checked:i.includes(sp)}),(0,d.jsxs)("label",{htmlFor:"wizard-importer-wordpress-old-slugs",children:[s.name," (",s.total,")"]})]})})]}),a.length>0&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("p",{children:(0,m.__)("The following plugins have been detected.","redirection")}),(0,d.jsx)("ul",{children:a.map(e=>{const t=`wizard-importer-${e.id}`;return(0,d.jsxs)("li",{children:[(0,d.jsx)("input",{id:t,type:"checkbox",name:e.id,onChange:l,checked:i.includes(e.id)}),(0,d.jsxs)("label",{htmlFor:t,children:[e.name," (",e.total,")"]})]},e.id)})})]}),(0,d.jsxs)("div",{className:"wizard-buttons",children:[(0,d.jsx)("button",{className:"button-primary button",onClick:()=>n(r+1),children:(0,m.__)("Continue","redirection")})," ",(0,d.jsx)("button",{className:"button",onClick:()=>n(r-1),children:(0,m.__)("Go back","redirection")})]})]})}function lp({step:e,setStep:t,options:n}){const r=dd(),{mutate:i}=r;let o="idle";r.isPending?o="loading":r.isSuccess?o="success":r.isError&&(o="error");const s=(0,l.useCallback)(()=>{i(n.importers)},[i,n.importers]);return(0,l.useEffect)(()=>{s()},[s]),(0,d.jsxs)("div",{children:[(0,d.jsx)("h2",{children:(0,m.__)("Import Existing Redirects","redirection")}),"loading"===o&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("p",{children:(0,m.__)("Please wait, importing.","redirection")}),(0,d.jsx)("div",{className:"loader-wrapper loader-textarea",children:(0,d.jsx)("div",{className:"wpl-placeholder__loading"})})]}),("success"===o||"error"===o)&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("p",{children:"success"===o?(0,m.__)("Import finished.","redirection"):(0,m.__)("Importing failed.","redirection")}),(0,d.jsxs)("div",{className:"wizard-buttons",children:["error"===o&&(0,d.jsx)("button",{className:"button-secondary button",onClick:s,children:(0,m.__)("Retry","redirection")}),(0,d.jsx)("button",{className:"button-primary button",onClick:()=>t(e+1),children:(0,m.__)("Continue","redirection")})]})]})]})}function cp({options:e}){const t=pe(e=>e.apiTest),{mutate:n}=Od(),{mutate:r}=Nd();return(0,d.jsxs)("div",{children:[(0,d.jsx)("h2",{children:(0,m.__)("Installation Complete","redirection")}),(0,d.jsx)("p",{children:(0,m.__)("Redirection is now installed!","redirection")}),(0,d.jsx)("p",{children:U((0,m.__)("Please take a moment to consult the {{support}}support site{{/support}} for information about how to use Redirection.","redirection"),{support:(0,d.jsx)(z,{url:"https://redirection.me"})})}),(0,d.jsx)("button",{className:"button button-primary",onClick:function(){const{ip:i,log:o,monitor:s}=e.settings,a=Ud(t);n({expire_redirect:o?7:-1,expire_404:o?7:-1,ip_logging:i?1:0,rest_api:"number"==typeof a?a:void 0,monitor_types:s?["post","page"]:void 0,monitor_post:s?1:0},{onSuccess:()=>r()})},type:"button",children:(0,m.__)("Ready to begin! 🎉","redirection")})]})}const up=function(){const[e,t]=(0,l.useState)(0),[n,r]=(0,l.useState)({settings:{log:!1,ip:!1,monitor:!1},importers:[]}),i=pe(e=>e.database.status),o=pe(e=>e.database.reason),s=function(e){return 2===e?ap:4===e?op:3===e?Bd:1===e?pd:5===e?lp:6===e?cp:fe}(e);return(0,d.jsxs)(d.Fragment,{children:["error"===i&&(0,d.jsx)(Q,{details:J(),errors:o,renderDebug:he,links:K(),locale:"redirection",children:(0,m.__)("Something went wrong when installing Redirection.","redirection")}),(0,d.jsxs)("div",{className:"wizard-wrapper",children:[0!==e&&3!==e&&(0,d.jsx)("h1",{children:(0,m.__)("Redirection","redirection")}),(0,d.jsx)("div",{className:"wizard",children:(0,d.jsx)(s,{options:n,step:e,setStep:function(e){let r=e;5===e&&0===n.importers.length&&(r=e+1),t(r)},setOptions:e=>r({...n,...e})})})]}),(0,d.jsx)("div",{className:"wizard-support",children:(0,d.jsx)(z,{url:"https://redirection.me/contact/",children:(0,m.__)("I need support!","redirection")})})]})};function dp(e){return window.Redirectioni10n.pluginRoot+"&sub=rss&module=1&token="+encodeURIComponent(e)}function pp(e,t){return e.replace(/\/$/,"")+"/"+t.replace(/^\//,"")}function hp(e){return e?/^https?:\/\//i.test(e)?e:"https://"+e:document.location.origin}function fp(e){const t={};for(const n of e)n&&(t[n.moduleName]||(t[n.moduleName]=[]),t[n.moduleName].push({value:n.id,label:n.name}));return Object.keys(t).map(e=>({label:e,value:t[e]}))}function mp(e,t){const n=window.Redirectioni10n.api.WP_API_nonce;return window.Redirectioni10n.pluginRoot+"&sub=io&export="+encodeURIComponent(e)+"&exporter="+encodeURIComponent(t)+"&_wpnonce="+encodeURIComponent(n)}function gp(e){return"finish-install"===e||"finish-update"===e}function yp(){const{current:e,next:t}=window.Redirectioni10n.database;return e===t?(0,d.jsx)("p",{children:(0,m.__)("A database upgrade is in progress. Please continue to finish.","redirection")}):(0,d.jsx)(d.Fragment,{children:(0,d.jsx)("p",{children:U((0,m.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,m.__)("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,d.jsx)("strong",{})})})})}function vp(){const{mutate:e}=Ad();function t(){e({reason:"database",current:window.Redirectioni10n.database.next})}return 0===window.Redirectioni10n.database.manual.length?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("p",{children:(0,m.__)("Your site already has the latest SQL.","redirection")+" "+(0,m.__)('Click "Complete Upgrade" when finished.',"redirection")}),(0,d.jsx)("p",{children:(0,d.jsx)("button",{className:"button-primary",onClick:t,children:(0,m.__)("Complete Upgrade","redirection")})})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("p",{children:[(0,m.__)("If your site needs special database permissions, or you would rather do it yourself, you can manually run the following SQL.")," ",(0,m.__)('Click "Complete Upgrade" when finished.',"redirection")]}),(0,d.jsx)("p",{children:(0,d.jsx)(N,{readOnly:!0,cols:120,value:window.Redirectioni10n.database.manual.join(";\n")+";",spellCheck:!1})}),(0,d.jsx)("p",{children:(0,d.jsx)("button",{className:"button-primary",onClick:t,children:(0,m.__)("Complete Upgrade","redirection")})})]})}function _p({onShowUpgrade:e}){return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("p",{children:(0,m.__)('Click the "Upgrade Database" button to automatically upgrade the database.',"redirection")}),(0,d.jsx)("p",{children:(0,d.jsx)("input",{className:"button-primary",type:"submit",value:(0,m.__)("Upgrade Database","redirection"),onClick:e})})]})}function bp(){const e=pe(e=>e.database.reason),t=pe(e=>e.database.status),n=pe(e=>e.database.result),{mutate:r}=Nd();return(0,d.jsxs)(d.Fragment,{children:["error"===n&&(0,d.jsx)(Q,{details:J(),errors:e,renderDebug:he,links:K(),locale:"redirection",children:(0,m.__)("Something went wrong when upgrading Redirection.","redirection")}),(0,d.jsx)("div",{className:"wizard-wrapper",children:(0,d.jsxs)("div",{className:"wizard",children:[(0,d.jsx)(rp,{}),gp(t)&&(0,d.jsx)("button",{className:"button button-primary",onClick:function(){r()},children:(0,m.__)("Finished! 🎉","redirection")})]})})]})}function xp({onShowUpgrade:e}){const[t,n]=(0,l.useState)(!1);function r(e){e.preventDefault(),n(!t)}return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("h1",{className:"wp-heading-inline",children:(0,m.__)("Upgrade Required","redirection")}),(0,d.jsxs)("div",{className:"wpl-error",children:[(0,d.jsx)("h3",{children:(0,m.__)("Redirection database needs upgrading","redirection")}),yp(),(0,d.jsx)("p",{children:U((0,m.__)("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,d.jsx)(z,{url:mp("all","json")}),import:(0,d.jsx)(z,{url:"https://redirection.me/support/import-export-redirects/"})})}),t?(0,d.jsx)(vp,{}):(0,d.jsx)(_p,{onShowUpgrade:e})]}),(0,d.jsxs)("div",{className:"database-switch",children:[!t&&(0,d.jsx)("button",{type:"button",onClick:r,children:(0,m.__)("Manual Upgrade","redirection")}),t&&(0,d.jsx)("button",{type:"button",onClick:r,children:(0,m.__)("Automatic Upgrade","redirection")})]})]})}function wp({showDatabase:e,onShowUpgrade:t}){return e?(0,d.jsx)(bp,{}):(0,d.jsx)(xp,{onShowUpgrade:t})}class jp extends l.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:n}=this.state,{renderCrash:r,children:i,extra:o}=this.props;return e?r(t,n,o):i}}const Sp=jp,kp=({item:e,isCurrent:t,onClick:n,isLast:r,urlBase:i})=>{const o=i+(""===e.value?"":"&sub="+e.value);return(0,d.jsxs)("li",{children:[(0,d.jsx)("a",{className:t?"current":"",href:o,onClick:t=>{t.preventDefault(),n(e.value,o)},children:e.name})," ",!r&&"|"," "]})},Cp=(e,t,n)=>e===t.value||e===n&&""===t.value,Tp=({onChangePage:e,menu:t,home:n,urlBase:r,currentPage:i})=>t.length<2?null:(0,d.jsx)("div",{className:"subsubsub-container",children:(0,d.jsx)("ul",{className:"subsubsub",children:t.map((o,s)=>(0,d.jsx)(kp,{item:o,isCurrent:Cp(i,o,n),isLast:s===t.length-1,onClick:e,urlBase:r},s))})});let Ep=!1;function Pp({notices:e}){const t=e[e.length-1],n=t?.message??"";return(0,d.jsx)(d.Fragment,{children:n+(e.length>1?" ("+e.length+")":"")})}const Op=function({notices:e,onClear:t,snackBarViewText:n}){const[r,i]=(0,l.useState)(!1);if((0,l.useEffect)(()=>(e.length>0&&(i(!1),Ep&&clearTimeout(Ep),Ep=setTimeout(()=>i(!0),5e3)),()=>{Ep&&clearTimeout(Ep)}),[e]),0===e.length)return null;function o(){r?i(!1):t()}const s=y("notice","notice-info","wpl-notice",r&&"wpl-notice_shrunk");return(0,d.jsxs)("div",{className:s,onClick:o,onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o())},role:"button",tabIndex:0,children:[(0,d.jsx)("div",{className:"closer",children:(0,d.jsx)("span",{className:"dashicons dashicons-yes"})}),(0,d.jsx)("p",{children:r?(0,d.jsx)("span",{className:"dashicons dashicons-warning",title:n}):(0,d.jsx)(Pp,{notices:e})})]})};function Rp(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 n=0;n<e.length;n++)if(!Rp(e[n],t[n]))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n){if(!Object.prototype.hasOwnProperty.call(t,r))return!1;if(!Rp(e[r],t[r]))return!1}return!0}return!1}function Np(e){return function(e){const t=new URLSearchParams(e),n={},r=new Map;t.forEach((e,t)=>{const n=t.replace(/\[\d*\]$/,"");r.has(n)||r.set(n,[]),r.get(n).push({key:t,value:e})});for(const[e,t]of r){const r=t.map(e=>e.value);r.length>1?n[e]=r:1===r.length&&(n[e]=r[0])}return n}(e?e.slice(1):document.location.search.slice(1))}function Ap(e,t,n){const r=Np(n);for(const n in e){const i=Rp(t[n],e[n]);e[n]&&!i||"page"===n?r[n.toLowerCase()]=e[n]:i&&delete r[n.toLowerCase()]}return"?"+function(e){const t=new URLSearchParams;for(const n in e){const r=e[n];if(null!=r)if(Array.isArray(r))if(r.some(e=>"object"==typeof e&&null!==e))t.append(n,JSON.stringify(r));else for(const e of r)null!=e&&t.append(`${n}[]`,String(e));else"object"==typeof r?t.append(n,JSON.stringify(r)):t.append(n,String(r))}return t.toString()}(r)}function Ip(e,t){const n=Np(t);return n.sub&&-1!==e.indexOf(n.sub)?n.sub:e[0]}const zp=function(e){const{page:t,setPage:n,children:r,onPageChange:i,defaultPage:o,baseUrl:s,allowedPages:a}=e,c=(0,l.useRef)(void 0),u=(0,l.useCallback)(()=>{const e=Ip(window.Redirectioni10n?.caps?.pages||a);n(e)},[a,n]);return(0,l.useEffect)(()=>(window.addEventListener("popstate",u),()=>{window.removeEventListener("popstate",u)}),[u]),(0,l.useEffect)(()=>{i(),c.current&&c.current!==t&&history.pushState({},"",Ap({sub:t},{sub:o},s)),c.current=t},[s,o,i,t]),(0,d.jsx)(d.Fragment,{children:r})},Fp=function(){return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)($d,{}),(0,d.jsx)("h3",{children:(0,m.__)("What do I do next?","redirection")}),(0,d.jsxs)("ol",{children:[(0,d.jsx)("li",{children:U((0,m.__)('Take a look at the {{link}}plugin status{{/link}}. It may be able to identify and "magic fix" the problem.',"redirection"),{link:(0,d.jsx)("a",{href:"?page=redirection.php&sub=support"})})}),(0,d.jsx)("li",{children:U((0,m.__)("{{link}}Caching software{{/link}}, in particular Cloudflare, can cache the wrong thing. Try clearing all your caches.","redirection"),{link:(0,d.jsx)(z,{url:"https://redirection.me/support/problems/cloudflare/"})})}),(0,d.jsx)("li",{children:U((0,m.__)("{{link}}Please temporarily disable other plugins!{{/link}} This fixes so many problems.","redirection"),{link:(0,d.jsx)(z,{url:"https://redirection.me/support/problems/plugins/"})})}),(0,d.jsx)("li",{children:U((0,m.__)("Look at your {{link}}Site Health{{/link}} and resolve any issues.","redirection"),{link:(0,d.jsx)(z,{url:K().siteHealth})})})]})]})};function Dp(){return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("p",{children:(0,m.__)("This error may be caused by a browser extension modifying the page. Please try disabling browser extensions for this page.","redirection")}),(0,d.jsx)("p",{children:(0,m.__)("You can also try using a different browser, or using private/incognito mode.","redirection")})]})}function Lp(){return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("p",{children:[(0,m.__)("Redirection is not working. Try clearing your browser cache and reloading this page.","redirection")," ",(0,m.__)("If you are using a page caching plugin or service (CloudFlare, OVH, etc) then you can also try clearing that cache.","redirection")]}),(0,d.jsx)("p",{children:U((0,m.__)("If that doesn't help, open your browser's error console and create a {{link}}new issue{{/link}} with the details.","redirection"),{link:(0,d.jsx)(z,{url:"https://github.com/johngodley/redirection/issues"})})})]})}const Mp=function(e,t,n){const r=e?.stack||"",i=function(e,t){if(e&&(e.includes("chrome-extension://")||e.includes("moz-extension://")))return!0;const n=["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 n)if(t.includes(e))return!0;return!1}(r,e?.message||"");return(0,d.jsx)(Q,{errors:"",renderDebug:he,type:"fixed",links:K(),details:J().concat([r,t?.componentStack||""]),locale:"redirection",children:i?(0,d.jsx)(Dp,{}):(0,d.jsx)(Lp,{})})},$p=()=>(0,d.jsx)("div",{className:"wpl-placeholder__container",children:(0,d.jsx)("div",{className:"wpl-placeholder__loading"})}),Up=function(e){const{isPrimary:t=!1,isSecondary:n=!0,isSubmit:r=!1,isSaving:i=!1,className:o,children:s,disabled:a=!1,isDestructive:l=!1,...c}=e,u=y("button",o,{"button-primary":t,"button-secondary":n,"button-delete":l,"wpl-spinner":i});return(0,d.jsxs)("button",{className:u,disabled:a,type:r?"submit":"button",...c,children:[i&&(0,d.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",children:(0,d.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 Bp=n(795),Zp="data-focus-lock",qp="data-focus-lock-disabled";function Hp(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var Wp="undefined"!=typeof window?l.useLayoutEffect:l.useEffect,Gp=new WeakMap;var Vp={width:"1px",height:"0px",padding:0,overflow:"hidden",position:"fixed",top:"1px",left:"1px"},Qp=function(){return Qp=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Qp.apply(this,arguments)};function Kp(e){return e}function Jp(e,t){void 0===t&&(t=Kp);var n=[],r=!1,i={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var o=function(){var n=t;t=[],n.forEach(e)},s=function(){return Promise.resolve().then(o)};s(),n={push:function(e){t.push(e),s()},filter:function(e){return t=t.filter(e),n}}}};return i}function Yp(e,t){return void 0===t&&(t=Kp),Jp(e,t)}Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;var Xp=Yp({},function(e){return{target:e.target,currentTarget:e.currentTarget}}),eh=Yp(),th=Yp(),nh=function(e){void 0===e&&(e={});var t=Jp(null);return t.options=Qp({async:!0,ssr:!1},e),t}({async:!0,ssr:"undefined"!=typeof document}),rh=(0,l.createContext)(void 0),ih=[],oh=(0,l.forwardRef)(function(e,t){var n,r,i,o,s,a,c,d=(0,l.useState)(),p=d[0],h=d[1],f=(0,l.useRef)(),m=(0,l.useRef)(!1),g=(0,l.useRef)(null),y=(0,l.useState)({})[1],_=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,O=(e.allowTextSelection,e.group),R=e.className,N=e.whiteList,A=e.hasPositiveIndices,I=e.shards,z=void 0===I?ih:I,F=e.as,D=void 0===F?"div":F,L=e.lockProps,M=void 0===L?{}:L,$=e.sideCar,U=e.returnFocus,B=void 0!==U&&U,Z=e.focusOptions,q=e.onActivation,H=e.onDeactivation,W=(0,l.useState)({})[0],G=(0,l.useCallback)(function(e){var t=e.captureFocusRestore;if(!g.current){var n,r=null==(n=document)?void 0:n.activeElement;g.current=r,r!==document.body&&(g.current=t(r))}f.current&&q&&q(f.current),m.current=!0,y()},[q]),V=(0,l.useCallback)(function(){m.current=!1,H&&H(f.current),y()},[H]),Q=(0,l.useCallback)(function(e){var t=g.current;if(t){var n=("function"==typeof t?t():t)||document.body,r="function"==typeof B?B(n):B;if(r){var i="object"==typeof r?r:void 0;g.current=null,e?Promise.resolve().then(function(){return n.focus(i)}):n.focus(i)}}},[B]),K=(0,l.useCallback)(function(e){m.current&&Xp.useMedium(e)},[]),J=eh.useMedium,Y=(0,l.useCallback)(function(e){f.current!==e&&(f.current=e,h(e))},[]),X=v(((n={})[qp]=x&&"disabled",n[Zp]=O,n),M),ee=!0!==j,te=ee&&"tail"!==j,ne=(r=[t,Y],o=i||null,s=function(e){return r.forEach(function(t){return Hp(t,e)})},(a=(0,l.useState)(function(){return{value:o,callback:s,facade:{get current(){return a.value},set current(e){var t=a.value;t!==e&&(a.value=e,a.callback(e,t))}}}})[0]).callback=s,c=a.facade,Wp(function(){var e=Gp.get(c);if(e){var t=new Set(e),n=new Set(r),i=c.current;t.forEach(function(e){n.has(e)||Hp(e,null)}),n.forEach(function(e){t.has(e)||Hp(e,i)})}Gp.set(c,r)},[r]),c),re=(0,l.useMemo)(function(){return{observed:f,shards:z,enabled:!x,get active(){return m.current}}},[x,m,z,f]);return u().createElement(l.Fragment,null,ee&&[u().createElement("div",{key:"guard-first","data-focus-guard":!0,tabIndex:x?-1:0,style:Vp}),A?u().createElement("div",{key:"guard-nearest","data-focus-guard":!0,tabIndex:x?-1:1,style:Vp}):null],!x&&u().createElement($,{id:W,sideCar:nh,observed:p,disabled:x,persistentFocus:k,crossFrame:T,autoFocus:P,whiteList:N,shards:z,onActivation:G,onDeactivation:V,returnFocus:Q,focusOptions:Z,noFocusGuards:j}),u().createElement(D,v({ref:ne},X,{className:R,onBlur:J,onFocus:K}),u().createElement(rh.Provider,{value:re},_)),te&&u().createElement("div",{"data-focus-guard":!0,tabIndex:x?-1:0,style:Vp}))});oh.propTypes={};const sh=oh;function ah(e,t){return ah=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ah(e,t)}var lh=function(e){for(var t=Array(e.length),n=0;n<e.length;++n)t[n]=e[n];return t},ch=function(e){return Array.isArray(e)?e:[e]},uh=function(e){return Array.isArray(e)?e[0]:e},dh=function(e){return e.parentNode&&e.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE?e.parentNode.host:e.parentNode},ph=function(e){return e===document||e&&e.nodeType===Node.DOCUMENT_NODE},hh=function(e,t){var n=e.get(t);if(void 0!==n)return n;var r=function(e,t){return!e||ph(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(dh(e))}(t,hh.bind(void 0,e));return e.set(t,r),r},fh=function(e,t){var n=e.get(t);if(void 0!==n)return n;var r=function(e,t){return!(e&&!ph(e))||!!vh(e)&&t(dh(e))}(t,fh.bind(void 0,e));return e.set(t,r),r},mh=function(e){return e.dataset},gh=function(e){return"INPUT"===e.tagName},yh=function(e){return gh(e)&&"radio"===e.type},vh=function(e){var t=e.getAttribute("data-no-autofocus");return![!0,"true",""].includes(t)},_h=function(e){var t;return Boolean(e&&(null===(t=mh(e))||void 0===t?void 0:t.focusGuard))},bh=function(e){return!_h(e)},xh=function(e){return Boolean(e)},wh=function(e,t){var n=Math.max(0,e.tabIndex),r=Math.max(0,t.tabIndex),i=n-r,o=e.index-t.index;if(i){if(!n)return 1;if(!r)return-1}return i||o},jh=function(e,t,n){return lh(e).map(function(e,t){var r=function(e){return e.tabIndex<0&&!e.hasAttribute("tabindex")?0:e.tabIndex}(e);return{node:e,index:t,tabIndex:n&&-1===r?(e.dataset||{}).focusGuard?0:-1:r}}).filter(function(e){return!t||e.tabIndex>=0}).sort(wh)},Sh=["button:enabled","select:enabled","textarea:enabled","input:enabled","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[tabindex]","[contenteditable]","[autofocus]"].join(","),kh="".concat(Sh,", [data-focus-guard]"),Ch=function(e,t){return lh((e.shadowRoot||e).children).reduce(function(e,n){return e.concat(n.matches(t?kh:Sh)?[n]:[],Ch(n))},[])},Th=function(e,t){return e.reduce(function(e,n){var r,i=Ch(n,t),o=(r=[]).concat.apply(r,i.map(function(e){return function(e,t){var n;return e instanceof HTMLIFrameElement&&(null===(n=e.contentDocument)||void 0===n?void 0:n.body)?Th([e.contentDocument.body],t):[e]}(e,t)}));return e.concat(o,n.parentNode?lh(n.parentNode.querySelectorAll(Sh)).filter(function(e){return e===n}):[])},[])},Eh=function(e,t){return lh(e).filter(function(e){return hh(t,e)}).filter(function(e){return function(e){return!((gh(e)||function(e){return"BUTTON"===e.tagName}(e))&&("hidden"===e.type||e.disabled))}(e)})},Ph=function(e,t){return void 0===t&&(t=new Map),lh(e).filter(function(e){return fh(t,e)})},Oh=function(e,t,n){return jh(Eh(Th(e,n),t),!0,n)},Rh=function(e,t){return jh(Eh(Th(e),t),!1)},Nh=function(e,t){return e.shadowRoot?Nh(e.shadowRoot,t):!(void 0===Object.getPrototypeOf(e).contains||!Object.getPrototypeOf(e).contains.call(e,t))||lh(e.children).some(function(e){var n;if(e instanceof HTMLIFrameElement){var r=null===(n=e.contentDocument)||void 0===n?void 0:n.body;return!!r&&Nh(r,t)}return Nh(e,t)})},Ah=function(e){if(void 0===e&&(e=document),e&&e.activeElement){var t=e.activeElement;return t.shadowRoot?Ah(t.shadowRoot):t instanceof HTMLIFrameElement&&function(){try{return t.contentWindow.document}catch(e){return}}()?Ah(t.contentWindow.document):t}},Ih=function(e){return e.parentNode?Ih(e.parentNode):e},zh=function(e){return ch(e).filter(Boolean).reduce(function(e,t){var n=t.getAttribute(Zp);return e.push.apply(e,n?function(e){for(var t=new Set,n=e.length,r=0;r<n;r+=1)for(var i=r+1;i<n;i+=1){var o=e[r].compareDocumentPosition(e[i]);(o&Node.DOCUMENT_POSITION_CONTAINED_BY)>0&&t.add(i),(o&Node.DOCUMENT_POSITION_CONTAINS)>0&&t.add(r)}return e.filter(function(e,n){return!t.has(n)})}(lh(Ih(t).querySelectorAll("[".concat(Zp,'="').concat(n,'"]:not([').concat(qp,'="disabled"])')))):[t]),e},[])},Fh=function(e,t){return void 0===t&&(t=Ah(uh(e).ownerDocument)),!(!t||t.dataset&&t.dataset.focusGuard)&&zh(e).some(function(e){return Nh(e,t)||function(e,t){return Boolean(lh(e.querySelectorAll("iframe")).some(function(e){return function(e,t){return e===t}(e,t)}))}(e,t)})},Dh=function(e,t){e&&("focus"in e&&e.focus(t),"contentWindow"in e&&e.contentWindow&&e.contentWindow.focus())},Lh=function(e,t){return yh(e)&&e.name?function(e,t){return t.filter(yh).filter(function(t){return t.name===e.name}).filter(function(e){return e.checked})[0]||e}(e,t):e},Mh=function(e){return e[0]&&e.length>1?Lh(e[0],e):e[0]},$h=function(e,t){return e.indexOf(Lh(t,e))},Uh="NEW_FOCUS",Bh=function(e,t,n){var r,i=e.map(function(e){return e.node}),o=Ph(i.filter((r=n,function(e){var t,n=null===(t=mh(e))||void 0===t?void 0:t.autofocus;return e.autofocus||void 0!==n&&"false"!==n||r.indexOf(e)>=0})));return o&&o.length?Mh(o):Mh(Ph(t))},Zh=function(e,t){return void 0===t&&(t=[]),t.push(e),e.parentNode&&Zh(e.parentNode.host||e.parentNode,t),t},qh=function(e,t){for(var n=Zh(e),r=Zh(t),i=0;i<n.length;i+=1){var o=n[i];if(r.indexOf(o)>=0)return o}return!1},Hh=function(e,t,n){var r=ch(e),i=ch(t),o=r[0],s=!1;return i.filter(Boolean).forEach(function(e){s=qh(s||e,e)||s,n.filter(Boolean).forEach(function(e){var t=qh(o,e);t&&(s=!s||Nh(t,s)?t:qh(t,s))})}),s},Wh=function(e,t){return e.reduce(function(e,n){return e.concat(function(e,t){return Eh((n=e.querySelectorAll("[".concat("data-autofocus-inside","]")),lh(n).map(function(e){return Th([e])}).reduce(function(e,t){return e.concat(t)},[])),t);var n}(n,t))},[])},Gh=function(e,t){var n=Ah(ch(e).length>0?document:uh(e).ownerDocument),r=zh(e).filter(bh),i=Hh(n||e,e,r),o=new Map,s=Rh(r,o),a=s.filter(function(e){var t=e.node;return bh(t)});if(a[0]){var l,c,u,d=Rh([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(xh)),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,n,r,i){var o=e.length,s=e[0],a=e[o-1],l=_h(r);if(!(r&&e.indexOf(r)>=0)){var c=void 0!==r?n.indexOf(r):-1,u=i?n.indexOf(i):c,d=i?e.indexOf(i):-1;if(-1===c)return-1!==d?d:Uh;if(-1===d)return Uh;var p,h,f=c-u,m=n.indexOf(s),g=n.indexOf(a),y=(p=n,h=new Set,p.forEach(function(e){return h.add(Lh(e,p))}),p.filter(function(e){return h.has(e)})),v=void 0!==r?y.indexOf(r):-1,_=i?y.indexOf(i):v,b=y.filter(function(e){return e.tabIndex>=0}),x=void 0!==r?b.indexOf(r):-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=$h(e,t[0]),k=$h(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,n,t);if(m===Uh){var g=Bh(s,f,Wh(r,o))||Bh(s,h,Wh(r,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]}},Vh=0,Qh=!1,Kh=function(e,t,n){void 0===n&&(n={});var r=Gh(e,t);if(!Qh&&r){if(Vh>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"),Qh=!0,void setTimeout(function(){Qh=!1},1);Vh++,Dh(r.node,n.focusOptions),Vh--}};function Jh(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 Yh=function(e){var t=function(e){if(!e)return null;for(var t=[],n=e;n&&n!==document.body;)t.push({current:Jh(n),parent:Jh(n.parentElement),left:Jh(n.previousElementSibling),right:Jh(n.nextElementSibling)}),n=n.parentElement;return{element:Jh(e),stack:t,ownerDocument:e.ownerDocument}}(e);return function(){return function(e){var t,n,r,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===(n=d.left)||void 0===n?void 0:n.call(d),f=d.current(),m=p.contains(f)?f:void 0,g=null===(r=d.right)||void 0===r?void 0:r.call(d),y=Oh([p],l),v=null!==(o=null!==(i=null!=m?m:null==h?void 0:h.nextElementSibling)&&void 0!==i?i:g)&&void 0!==o?o:h;v;){for(var _=0,b=y;_<b.length;_++){var x=b[_];if(null==v?void 0:v.contains(x.node))return x.node}v=v.nextElementSibling}if(y.length)return y[0].node}}}(t)}},Xh=function(e,t,n){void 0===t&&(t={});var r=function(e){return Object.assign({scope:document.body,cycle:!0,onlyTabbable:!0},e)}(t),i=function(e,t,n){if(!e||!t)return console.error("no element or scope given"),{};var r=ch(t);if(r.every(function(t){return!Nh(t,e)}))return console.error("Active element is not contained in the scope"),{};var i=n?Oh(r,new Map):Rh(r,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,r.scope,r.onlyTabbable);if(i){var o=n(i,r.cycle);o&&Dh(o.node,r.focusOptions)}},ef=function(e,t,n){var r,i=function(e,t){var n=t?Oh(ch(e),new Map):Rh(ch(e),new Map);return{first:n[0],last:n[n.length-1]}}(e,null===(r=t.onlyTabbable)||void 0===r||r),o=i[n];o&&Dh(o.node,t.focusOptions)};function tf(e){setTimeout(e,1)}var nf=function(e){return e&&"current"in e?e.current:e},rf=function(){return document&&document.activeElement===document.body},of=null,sf=null,af=function(){return null},lf=null,cf=!1,uf=!1,df=function(){return!0};function pf(e,t,n,r){var i=null,o=e;do{var s=r[o];if(s.guard)s.node.dataset.focusAutoGuard&&(i=s);else{if(!s.lockItem)break;if(o!==e)return;i=null}}while((o+=n)!==t);i&&(i.node.tabIndex=0)}var hf=function e(t,n,r){return n&&(n.host===t&&(!n.activeElement||r.contains(n.activeElement))||n.parentNode&&e(t,n.parentNode,r))},ff=function(e){return Rh(e,new Map)},mf=function(){var e,t,n,r,i,o,s,a=!1;if(of){var l=of,c=l.observed,u=l.persistentFocus,d=l.autoFocus,p=l.shards,h=l.crossFrame,f=l.focusOptions,m=l.noFocusGuards,g=c||lf&&lf.portaledElement;if(rf()&&sf&&sf!==document.body&&(!document.body.contains(sf)||!ff([(s=sf).parentNode]).some(function(e){return e.node===s}))){var y=af();y&&y.focus()}var v=document&&document.activeElement;if(g){var _=[g].concat(p.map(nf).filter(Boolean));if(v&&!function(e){return(of.whiteList||df)(e)}(v)||(u||function(){if(!(h?Boolean(cf):"meanwhile"===cf)||!m||!sf||uf)return!1;var e=ff(_),t=e.findIndex(function(e){return e.node===sf});return 0===t||t===e.length-1}()||!(rf()||function(e){void 0===e&&(e=document);var t=Ah(e);return!!t&&lh(e.querySelectorAll("[".concat("data-no-focus-lock","]"))).some(function(e){return Nh(e,t)})}())||!sf&&d)&&(g&&!(Fh(_)||v&&function(e,t){return t.some(function(t){return hf(e,t,t)})}(v,_)||(o=v,lf&&lf.portaledElement===o))&&(document&&!sf&&v&&!d?(v.blur&&v.blur(),document.body.focus()):(a=Kh(_,sf,{focusOptions:f}),lf={})),(sf=document&&document.activeElement)!==document.body&&(af=Yh(sf)),cf=!1),document&&v!==document.activeElement&&document.querySelector("[data-focus-auto-guard]")){var b=document&&document.activeElement,x=(t=zh(e=_).filter(bh),n=Hh(e,e,t),r=jh(Th([n],!0),!0,!0),i=Th(t,!1),r.map(function(e){var t=e.node;return{node:t,index:e.index,lockItem:i.indexOf(t)>=0,guard:_h(t)}})),w=x.map(function(e){return e.node}).indexOf(b);w>-1&&(x.filter(function(e){var t=e.guard,n=e.node;return t&&n.dataset.focusAutoGuard}).forEach(function(e){return e.node.removeAttribute("tabIndex")}),pf(w,x.length,1,x),pf(w,-1,-1,x))}}}return a},gf=function(e){mf()&&e&&(e.stopPropagation(),e.preventDefault())},yf=function(){return tf(mf)},vf=function(){uf=!0},_f=function(){uf=!1,cf="just",tf(function(){cf="meanwhile"})},bf={moveFocusInside:Kh,focusInside:Fh,focusNextElement:function(e,t){void 0===t&&(t={}),Xh(e,t,function(e,t){var n=e.next,r=e.first;return n||t&&r})},focusPrevElement:function(e,t){void 0===t&&(t={}),Xh(e,t,function(e,t){var n=e.prev,r=e.last;return n||t&&r})},focusFirstElement:function(e,t){void 0===t&&(t={}),ef(e,t,"first")},focusLastElement:function(e,t){void 0===t&&(t={}),ef(e,t,"last")},captureFocusRestore:Yh};Xp.assignSyncMedium(function(e){var t=e.target,n=e.currentTarget;n.contains(t)||(lf={observerNode:n,portaledElement:t})}),eh.assignMedium(yf),th.assignMedium(function(e){return e(bf)});const xf=(wf=function(e){return e.filter(function(e){return!e.disabled})},jf=function(e){var t=e.slice(-1)[0];t&&!of&&(document.addEventListener("focusin",gf),document.addEventListener("focusout",yf),window.addEventListener("focus",vf),window.addEventListener("blur",_f));var n=of,r=n&&t&&t.id===n.id;of=t,n&&!r&&(n.onDeactivation(),e.filter(function(e){return e.id===n.id}).length||n.returnFocus(!t)),t?(sf=null,r&&n.observed===t.observed||t.onActivation(bf),mf(),tf(mf)):(document.removeEventListener("focusin",gf),document.removeEventListener("focusout",yf),window.removeEventListener("focus",vf),window.removeEventListener("blur",_f),sf=null)},function(e){var t,n=[];function r(){t=wf(n.map(function(e){return e.props})),jf(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,ah(e,t)}(o,i),o.peek=function(){return t};var s=o.prototype;return s.componentDidMount=function(){n.push(this),r()},s.componentDidUpdate=function(){r()},s.componentWillUnmount=function(){var e=n.indexOf(this);n.splice(e,1),r()},s.render=function(){return u().createElement(e,this.props)},o}(l.PureComponent);return qd(i,"displayName","SideEffect("+function(e){return e.displayName||e.name||"Component"}(e)+")"),i})(function(){return null});var wf,jf,Sf=(0,l.forwardRef)(function(e,t){return u().createElement(sh,v({sideCar:xf,ref:t},e))}),kf=sh.propTypes||{};kf.sideCar,_(kf,["sideCar"]),Sf.propTypes={};const Cf=Sf;function Tf(e){if(null===e)return null;const{left:t,top:n,height:r}=e;return{left:t,top:n+r}}function Ef(e,t){return t?{...e,width:t.getBoundingClientRect().width}:e}function Pf({style:e,align:t}){const n=y("wpl-popover__arrows",{"wpl-popover__arrows__left":"left"===t,"wpl-popover__arrows__right":"right"===t,"wpl-popover__arrows__centre":"centre"===t});return(0,d.jsx)("div",{className:n,style:e})}const Of=function(e){const{position:t,children:n,popoverPosition:r,align:i,valign:o,hasArrow:s}=e,[a,c]=(0,l.useState)({arrow:{},content:{visibility:"hidden",...t}}),u=(0,l.useCallback)(e=>{if(e){const n=function(e,t,n,r,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,n,r){return"right"===r?e+t-n:"centre"===r?e-n/2:e}(t.left,t.width,e.width?e.width:s,n);return{...e,left:Math.min(a,l),top:o?e.top+5:e.top}}(t,r,i,0,e,!!s);c({content:n,arrow:Ef(n,e)})}},[t,r,i,o,s]);return(0,d.jsxs)(d.Fragment,{children:[s&&(0,d.jsx)(Pf,{style:a.arrow,align:i}),(0,d.jsx)("div",{className:"wpl-popover__content",style:{...a.content,visibility:t&&t.left?"visible":"hidden",...null!==e.style?e.style:{}},ref:u,children:n})]})};function Rf(e,t){if(!t)return!1;const n=e.target;return!(n&&t.contains(n)||"keydown"===e.type||n&&(n.closest(".wpl-dropdowntext__suggestions")||n.closest(".wpl-multioption")))}function Nf(e){const t=(0,l.useRef)(null),{children:n,onOutside:r,className:i}=e,o=(0,l.useCallback)(e=>{(Rf(e,t.current)||"key"in e&&"Escape"===e.key)&&r(e)},[r]);return(0,l.useEffect)(()=>(addEventListener("mousedown",o),addEventListener("keydown",o),()=>{removeEventListener("mousedown",o),removeEventListener("keydown",o)}),[o]),(0,d.jsx)("div",{className:i,ref:t,children:n})}function Af(e){let t=document.getElementById(e);if(null===t){const n=document.getElementById("wpbody");t=document.createElement("div"),n&&n.parentNode&&(t.setAttribute("id",e),n.parentNode.appendChild(t))}return t}function If(e,t="bottom"){const n=document.getElementById("wpwrap");if(null===e||null===n)return null;const r=n.getBoundingClientRect(),{height:i,width:o,left:s,top:a}=e.getBoundingClientRect();return{left:"bottom"===t?s-r.left:s+o/2-r.left-7,top:a-r.top+1,width:o,height:i,parentWidth:r.width,parentHeight:r.height,ref:e}}const zf=function(e){const{children:t,className:n,align:r="left",valign:i="bottom",onClose:o,hasArrow:s=!1,popoverPosition:a,style:c=null,focusLock:u=!0}=e;return(0,l.useEffect)(()=>(window.addEventListener("resize",o),()=>{window.removeEventListener("resize",o)}),[o]),(0,Bp.createPortal)((0,d.jsx)(Nf,{className:y("wpl-popover",n),onOutside:e=>{a&&!1===Rf(e,a.ref)&&"Escape"!==e.key||o()},children:(0,d.jsx)(Cf,{returnFocus:!0,disabled:!u,children:(0,d.jsx)(Of,{position:Tf(a),popoverPosition:a,align:r,hasArrow:s,valign:i,style:c,children:t})})}),Af("wpl-dropdown-portal")||document.body)},Ff=function(e){const{renderContent:t,className:n,renderToggle:r,align:i="left",valign:o="bottom",hasArrow:s=!1,matchMinimum:a=!1,disabled:c=!1,onClose:u}=e,[p,h]=(0,l.useState)(!1),[f,m]=(0,l.useState)(null),g=(0,l.useRef)(null);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:y("wpl-popover__toggle",n,c&&"wpl-popover__toggle__disabled"),ref:g,children:r(p,e=>{if(!g.current)return;const t=If(g.current,o);e?.stopPropagation(),c||(m(t),h(!p))})}),p&&f&&(0,d.jsx)(zf,{align:i,valign:o,hasArrow:s,...void 0!==n?{className:n}:{},onClose:function(){h(!1),u?.()},popoverPosition:f,...a&&f.width?{style:{minWidth:`${f.width}px`}}:{},children:t(()=>h(!1))})]})};function Df({option:e,onChange:t,isSelected:n,optionsType:r="checkbox",name:i}){const{value:o,disabled:s=!1,label:a}=e,l="radio"===r?`multi_${o}`:`multi_${i}_${o}`;return(0,d.jsxs)("p",{children:[(0,d.jsx)("input",{id:l,type:r,name:i||o,value:o,onChange:e=>t(i,o,"checkbox"!==r||e.target.checked),checked:n(i,o),disabled:s,tabIndex:0}),(0,d.jsx)("label",{"aria-label":e.label,htmlFor:l,children:a})]})}const Lf=function(e){const{option:t,optionsType:n,onChange:r,isSelected:i}=e,{options:o=[],label:s,value:a}=t;return(0,d.jsxs)("div",{className:"wpl-multioption__group",children:[(0,d.jsx)("h5",{children:s}),o.map((e,t)=>(0,d.jsx)(Df,{option:e,isSelected:i,onChange:r,name:a||e.value,optionsType:n},t))]})},Mf=function(e){const{option:t,isSelected:n,onChange:r}=e;if(t.options){const{optionsType:e="checkbox"}=t;return(0,d.jsx)(Lf,{option:t,optionsType:e,isSelected:n,onChange:r})}const i=t.value||"";return(0,d.jsx)(Df,{option:{label:t.label,value:i,disabled:t.disabled??!1,default:t.default??!1},isSelected:n,onChange:r,optionsType:"checkbox",name:i})},$f=e=>{const{children:t,className:n,onClick:r,title:i="",onCancel:o,disabled:s=!1,small:a=!1}=e,l={title:i,onClick:r};return(0,d.jsxs)("div",{className:y("wpl-badge",n,{"wpl-badge__click":r,"wpl-badge__small":a,"wpl-badge__disabled":s}),...l,children:[(0,d.jsx)("div",{className:"wpl-badge__content",children:t}),o&&(0,d.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 Uf(e,t){for(let n=0;n<e.length;n++){const r=e[n];if(r){if(r.value===t)return r;if(r.options){const e=Uf(r.options,t);if(e)return e}}}return null}function Bf(e,t){return e&&t?{title:e.badge||e.label,default:e.default??!1,onRemove:n=>{if(e.value===t.value)return n(e.value||"",e.value||"",!1);const r=(t.options||[]).find(e=>e.default);r?n(t.value||"",r.value,!0):n(t.value||"",e.value||"",!1)}}:null}function Zf(e){const t=Uf(e,""),n=Bf(t,t);return n?[n]:[]}function qf({selected:e,title:t,options:n,showBadges:r,onChange:i,disabled:o}){let s;if(s=function(e){return Array.isArray(e)?-1!==e.indexOf(""):Boolean(e?.[""])}(e)&&n.length>0?Zf(n):Array.isArray(e)?function(e,t){return-1!==e.indexOf("")?Zf(t):e.map(e=>{const n=Uf(t,e);return Bf(n,n)}).filter(e=>null!==e)}(e,n):function(e,t){return Object.keys(e).map(n=>{const r=Uf(t,n);return"string"==typeof e[n]?Bf(Uf(t,e[n]),r):e[n]?Bf(r,r):null}).filter(e=>null!==e).filter(e=>e&&!0!==e.default)}(e,n),s.length>0&&r){const e=s.slice(0,3).map((e,t)=>e?(0,d.jsx)($f,{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,d.jsx)("span",{children:"..."},"end")]):e}return t.length>0&&(!r||0===s.length)?(0,d.jsx)("h5",{children:t}):null}const Hf=function({onClick:e}){return(0,d.jsx)("svg",{height:"20",width:"20",viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",onClick:e,children:(0,d.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"})})},Wf=function(e){const{options:t,selected:n,onChange:r,title:i="",badges:o=!1,disabled:s=!1,className:a,asObject:l=!1}=e;function c(e,t){if(l){const r=n;return e===t?Boolean(r[t]):r[e]===t}return-1!==n.indexOf(t)}function u(e,t,i){if(l)r({...n,[e]:e===t?i:t});else{const o=n,s=e===t?e:t;r(i?[...o,s]:o.filter(e=>e!==s))}}return(0,d.jsx)(Ff,{renderToggle:(e,r)=>(0,d.jsxs)("div",{className:y("action","wpl-multioption__button",s&&"wpl-multioption__disabled",e?"wpl-multioption__button_enabled":null),onClick:r,tabIndex:0,"aria-label":i||"",children:[(0,d.jsx)(qf,{selected:n,title:i,showBadges:o,options:t,disabled:s,onChange:u}),(0,d.jsx)(Hf,{})]}),disabled:s,align:"right",matchMinimum:!0,renderContent:()=>(0,d.jsx)("div",{className:y("wpl-multioption",a),children:t.map((e,t)=>(0,d.jsx)(Mf,{option:e,isSelected:c,onChange:u},t))})})},Gf=function({level:e="notice",children:t,className:n}){return(0,d.jsx)("div",{className:y(`inline-notice inline-${e}`,n),children:t})},Vf=()=>[{value:-1,label:(0,m.__)("No logs","redirection")},{value:1,label:(0,m.__)("A day","redirection")},{value:7,label:(0,m.__)("A week","redirection")},{value:30,label:(0,m.__)("A month","redirection")},{value:60,label:(0,m.__)("Two months","redirection")},{value:0,label:(0,m.__)("Forever","redirection")}],Qf=function(e){const{settings:t,onChange:n,getLink:r}=e,{expire_redirect:i,expire_404:o,ip_logging:s,log_external:a,track_hits:l,log_header:c,ip_proxy:u=[],ip_headers:p=[]}=t;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("tr",{className:"redirect-option__row",children:(0,d.jsx)("th",{colSpan:2,children:(0,d.jsx)("h2",{className:"title",children:(0,m.__)("Logs","redirection")})})}),(0,d.jsxs)(bd,{title:(0,m.__)("Redirect Logs","redirection")+":",url:r("logs"),children:[(0,d.jsx)(Sd,{items:Vf(),name:"expire_redirect",value:String(i),onChange:n})," ",(0,m.__)("(time to keep logs for)","redirection")]}),(0,d.jsxs)(bd,{title:(0,m.__)("404 Logs","redirection")+":",url:r("tracking-404-errors"),children:[(0,d.jsx)(Sd,{items:Vf(),name:"expire_404",value:String(o),onChange:n})," ",(0,m.__)("(time to keep logs for)","redirection")]}),(0,d.jsxs)(bd,{title:(0,m.__)("IP Logging","redirection")+":",url:r("options","iplogging"),children:[(0,d.jsx)(Sd,{items:[{value:0,label:(0,m.__)("No IP logging","redirection")},{value:1,label:(0,m.__)("Full IP logging","redirection")},{value:2,label:(0,m.__)("Anonymize IP (mask last part)","redirection")}],name:"ip_logging",value:String(s),onChange:n})," ",(0,m.__)("(IP logging level)","redirection")]}),(0,d.jsxs)(bd,{title:(0,m.__)("IP Address","redirection")+":",url:r("options","ipaddress"),children:[(0,d.jsx)(Wf,{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:p,multiple:!0,badges:p.length>0,hideTitle:p.length>0,onChange:e=>n({ip_headers:e}),title:0===p.length?(0,m.__)("REMOTE_ADDR","redirection"):""}),(0,d.jsx)("p",{children:U((0,m.__)("Only set custom IP headers if your server does not use <code>REMOTE_ADDR</code> to store the client IP address.","redirection"),{code:(0,d.jsx)("code",{})})}),p.length>0&&(0,d.jsx)(Gf,{level:"warning",children:(0,d.jsx)("p",{children:U((0,m.__)("Please ensure you trust the data in these headers. If using a proxy then set its address below.","redirection"),{code:(0,d.jsx)("code",{})})})})]}),p.length>0&&(0,d.jsxs)(bd,{title:(0,m.__)("Proxy Address","redirection")+":",url:r("options","proxy"),children:[(0,d.jsx)(N,{minRows:3,value:u.join("\n"),onChange:e=>n({ip_proxy:e.target.value.split("\n")}),rows:5}),(0,d.jsx)("p",{children:(0,m.__)("If using a proxy then add any IP addresses here to only trust IP headers from those addresses.","redirection")})]}),(0,d.jsxs)(bd,{title:(0,m.__)("Logging","redirection")+":",url:r("options","iplogging"),children:[(0,d.jsxs)("p",{children:[(0,d.jsx)("input",{id:"log-options-log-external",type:"checkbox",disabled:-1===parseInt(i.toString(),10),name:"log_external",onChange:n,checked:-1!==parseInt(i.toString(),10)&&a}),(0,d.jsx)("label",{htmlFor:"log-options-log-external",children:(0,m.__)('Log "external" redirects - those not from Redirection. This can increase your log size and contains no user information.',"redirection")})]}),(0,d.jsxs)("p",{children:[(0,d.jsx)("input",{id:"log-options-track-hits",type:"checkbox",name:"track_hits",onChange:n,checked:l}),(0,d.jsx)("label",{htmlFor:"log-options-track-hits",children:(0,m.__)("Track redirect hits and date of last access. Contains no user information.","redirection")})]}),(0,d.jsxs)("p",{children:[(0,d.jsx)("input",{id:"log-options-log-header",type:"checkbox",name:"log_header",onChange:n,checked:c}),(0,d.jsx)("label",{htmlFor:"log-options-log-header",children:(0,m.__)("Capture HTTP header information with logs (except cookies). It may include user information, and could increase your log size.","redirection")})]})]}),(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{}),(0,d.jsx)("td",{children:U((0,m.__)("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,d.jsx)(z,{url:r("privacy-gdpr")})})})]})]})};function Kf(e,t,n){const r=[];for(const i in e){const o=e[i],s=!!t.find(e=>e===i);o&&r.push((0,d.jsxs)("p",{children:[(0,d.jsx)("input",{id:"monitor-type-"+i,type:"checkbox",name:"monitor_type_"+i,onChange:n,checked:s}),(0,d.jsx)("label",{htmlFor:"monitor-type-"+i,children:(0,m.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,m.__)("Monitor changes to %(type)s","redirection"),{type:o.toLowerCase()})})]},i))}return r}function Jf(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 Yf=function(e){const{onChange:t,settings:n,groups:r,getLink:i,postTypes:o}=e,{associated_redirect:s,monitor_post:a,monitor_types:l}=n,c=l.length>0;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(bd,{title:(0,m.__)("URL Monitor","redirection")+":",url:i("options","monitor"),children:Kf(o,l,function(e){const n=e.target.name.replace("monitor_type_",""),i=l.filter(e=>e!==n);e.target.checked&&i.push(n),t({monitor_types:i,monitor_post:i.length>0?Jf(a,r):0,associated_redirect:i.length>0?s:""})})}),c&&(0,d.jsxs)(bd,{title:(0,m.__)("URL Monitor Changes","redirection")+":",url:i("options","monitor"),children:[(0,d.jsx)(Sd,{items:r,name:"monitor_post",value:String(a),onChange:t})," ",(0,m.__)("Save changes to this group","redirection"),(0,d.jsxs)("p",{children:[(0,d.jsx)("input",{type:"text",className:"regular-text",name:"associated_redirect",onChange:t,placeholder:(0,m.__)('For example "/amp"',"redirection"),value:s})," ",(0,m.__)("Create associated redirect (added to end of URL)","redirection")]})]})]})},Xf=function(e){const{settings:t,onChange:n,getLink:r,groups:i,postTypes:o}=e,{flag_case:s,flag_trailing:a,flag_query:l,auto_target:c,redirect_cache:u,cache_key:p}=t;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("tr",{className:"redirect-option__row",children:(0,d.jsx)("th",{colSpan:2,children:(0,d.jsx)("h2",{className:"title",children:(0,m.__)("URL","redirection")})})}),(0,d.jsx)(Yf,{settings:t,onChange:n,groups:i,getLink:r,postTypes:o}),(0,d.jsxs)(bd,{title:(0,m.__)("Default URL settings","redirection")+":",url:r("options","urlsettings"),children:[(0,d.jsx)("p",{children:(0,m.__)("Applies to all redirections unless you configure them otherwise.","redirection")}),(0,d.jsxs)("p",{children:[(0,d.jsx)("input",{type:"checkbox",id:"url-options-flag-case",name:"flag_case",onChange:n,checked:s}),(0,d.jsx)("label",{htmlFor:"url-options-flag-case",children:U((0,m.__)("Case insensitive matches (i.e. {{code}}/Exciting-Post{{/code}} will match {{code}}/exciting-post{{/code}})","redirection"),{code:(0,d.jsx)("code",{})})})]}),(0,d.jsxs)("p",{children:[(0,d.jsx)("input",{type:"checkbox",id:"url-options-flag-trailing",name:"flag_trailing",onChange:n,checked:a}),(0,d.jsx)("label",{htmlFor:"url-options-flag-trailing",children:U((0,m.__)("Ignore trailing slashes (i.e. {{code}}/exciting-post/{{/code}} will match {{code}}/exciting-post{{/code}})","redirection"),{code:(0,d.jsx)("code",{})})})]})]}),(0,d.jsxs)(bd,{title:(0,m.__)("Default query matching","redirection")+":",url:r("options","querysettings"),children:[(0,d.jsx)("p",{children:(0,m.__)("Applies to all redirections unless you configure them otherwise.","redirection")}),(0,d.jsx)("p",{children:(0,d.jsx)(Sd,{items:[{value:"exact",label:(0,m.__)("Exact match in any order","redirection")},{value:"ignore",label:(0,m.__)("Ignore all query parameters","redirection")},{value:"pass",label:(0,m.__)("Ignore and pass all query parameters","redirection")}],name:"flag_query",value:l,onChange:n})}),(0,d.jsxs)("ul",{children:[(0,d.jsx)("li",{children:(0,m.__)("Exact - matches the query parameters exactly defined in your source, in any order","redirection")}),(0,d.jsx)("li",{children:(0,m.__)("Ignore - as exact, but ignores any query parameters not in your source","redirection")}),(0,d.jsx)("li",{children:(0,m.__)("Pass - as ignore, but also copies the query parameters to the target","redirection")})]})]}),(0,d.jsxs)(bd,{title:(0,m.__)("Auto-generate URL","redirection")+":",url:r("options","autogenerate"),children:[(0,d.jsx)("input",{className:"regular-text",type:"text",value:c,name:"auto_target",onChange:n}),(0,d.jsx)("br",{}),(0,d.jsx)("span",{className:"sub",children:U((0,m.__)("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,d.jsx)("code",{})})})]}),(0,d.jsxs)(bd,{title:(0,m.__)("HTTP Cache Header","redirection"),url:r("options","cache"),children:[(0,d.jsx)(Sd,{items:[{value:-1,label:(0,m.__)("Never cache","redirection")},{value:1,label:(0,m.__)("An hour","redirection")},{value:24,label:(0,m.__)("A day","redirection")},{value:168,label:(0,m.__)("A week","redirection")},{value:0,label:(0,m.__)("Forever","redirection")}],name:"redirect_cache",value:String(u),onChange:n})," "," ",(0,d.jsx)("span",{className:"sub",children:(0,m.__)('How long to cache redirected 301 URLs (via "Expires" HTTP header)',"redirection")})]}),(0,d.jsxs)(bd,{title:(0,m.__)("Redirect Caching","redirection"),url:r("options","cache"),children:[(0,d.jsx)("input",{id:"url-options-cache-key",type:"checkbox",name:"cache_key",onChange:n,checked:0!==p&&!1!==p})," ",(0,d.jsx)("label",{htmlFor:"url-options-cache-key",children:(0,d.jsx)("span",{className:"sub",children:(0,m.__)("(beta) Enable caching of redirects via WordPress object cache. Can improve performance. Requires an object cache.","redirection")})})]})]})},em=Dc({source:Dc({flag_regex:dc(),flag_trailing:dc(),flag_case:dc(),flag_query:ol()}).optional(),options:Jc(ol(),Cc()).optional()}),tm=Dc({id:rc().int(),url:ol(),match_url:ol().optional(),match_type:ol(),action_type:ol(),action_code:rc().int(),action_data:Cc(),match_data:em.nullish(),group_id:rc().int(),title:ol(),position:rc().int().nonnegative(),regex:dc().optional(),last_access:ol().optional(),enabled:dc().optional(),hits:rc().int().nonnegative().optional()}),nm=(Dc({url:ol().min(1,"Source URL is required"),title:ol().optional(),match_type:ol(),action_type:ol(),action_code:rc().int().min(100).max(599).optional(),action_data:Cc().optional(),match_data:em.optional(),group_id:rc().int().positive(),position:rc().int().nonnegative().default(0),enabled:dc().optional()}).partial().extend({id:rc().int()}),Dc({items:Ic(rc().int()),action:ou(["delete","enable","disable","reset"])}),Dc({id:rc().int(),name:ol(),redirects:rc().int().nonnegative(),module_id:rc().int(),moduleName:ol().optional(),enabled:dc()})),rm=(Dc({name:ol().min(1,"Group name is required"),moduleId:rc().int().positive(),position:rc().int().nonnegative().default(0),enabled:dc().optional()}).partial().extend({id:rc().int()}),Dc({page:rc().int().nonnegative(),per_page:rc().int().positive().max(100),orderby:ol(),direction:ou(["asc","desc"]),selected:Ic(Uc([rc(),ol()])),selectAll:dc().optional(),displayType:ol().optional(),displaySelected:Ic(ol()).optional(),filterBy:Jc(ol(),ol()).optional(),groupBy:ol().optional()})),im=e=>Dc({items:Ic(e),total:rc().int().nonnegative(),table:rm.optional()}),om=(Dc({item:Cc(),items:Ic(Cc()).optional(),total:rc().int().nonnegative().optional()}),Dc({code:Uc([ol(),rc()]).optional(),message:ol().optional(),data:Cc().optional(),jsonData:Cc().optional(),request:Dc({url:ol(),method:ol()}).optional()}),im(tm)),sm=Dc({item:tm}),am=im(nm),lm=Dc({item:nm});function cm(e){return{...!0===e?.global?{page:0}:{},selected:[],selectAll:!1}}function um(e,t){return"ip"===e?{ip:t}:"agent"===e?{agent:t}:{"url-exact":t}}Dc({deleted:rc().int().nonnegative().optional(),updated:rc().int().nonnegative().optional(),items:Ic(Cc()).optional(),total:rc().int().nonnegative().optional()});const dm=["selected","selectAll","displayType","displaySelected"];function pm(e){const t={};for(const n in e){const r=e[n];dm.includes(n)||null!=r&&("object"!=typeof r||Array.isArray(r)||0!==Object.keys(r).length)&&(Array.isArray(r)&&0===r.length||"string"==typeof r&&""===r.trim()||(t[n]=r))}return t}function hm(e={},t){const n=pm(e);return ct({queryKey:ad.groups.list(n),queryFn:async()=>{try{const e=await jt(It(n));return am.parse(e)}catch(e){throw sd(e)}},...t})}function fm(e,t){return"https://redirection.me/support/"+e+(t?"/#"+t:"")}const mm={},gm={},ym=function(){const e=pe(e=>e.values),t=pe(e=>e.saveStatus),n=pe(e=>e.values?.installed??""),r=pe(e=>e.values?.warning??""),i=pe(e=>e.values?.postTypes),{data:o}=hm({}),s=o?.items?fp(o.items):[],{mutate:a}=Od(),[c,u]=(0,l.useState)(e??gm),p=i??mm;function h(e){if("target"in e){const{target:t}=e,n="checkbox"===t.type?t.checked:t.value;u({...c,[t.name]:n})}else u({...c,...e})}return(0,l.useEffect)(()=>{e&&u(e)},[e]),(0,d.jsxs)("form",{onSubmit:function(e){e.preventDefault(),a(c)},children:[(0,d.jsxs)(xd,{children:[(0,d.jsx)(Qf,{settings:c,onChange:h,getLink:fm}),(0,d.jsx)(Xf,{settings:c,onChange:h,getLink:fm,groups:s,postTypes:p}),(0,d.jsx)(Cd,{settings:c,onChange:h,getLink:fm,installed:n,warning:r})]}),(0,d.jsx)(Up,{isPrimary:!0,isSubmit:!0,disabled:t,children:(0,m.__)("Update","redirection")})]})},vm=function({onClose:e,children:t,className:n}){return(0,d.jsx)(Nf,{className:"wpl-click-outside",onOutside:t=>{t.target instanceof HTMLElement&&t.target.classList.contains("wpl-modal_main")&&e()},children:(0,d.jsxs)("div",{className:y("wpl-modal_content",n),children:[(0,d.jsx)("div",{className:"wpl-modal_close",children:(0,d.jsx)("button",{type:"button",onClick:e,children:"✖"})}),t]})})},_m="wpl-modal_shown",bm=function({padding:e=!0,onClose:t,...n}){const r=(0,l.useCallback)(e=>{"Escape"===e.key&&t()},[t]);(0,l.useEffect)(()=>(document.body.classList.add(_m),document.addEventListener("keydown",r),()=>{document.body.classList.remove(_m),document.removeEventListener("keydown",r)}),[r]);const i=y({"wpl-modal_wrapper":!0,"wpl-modal_wrapper-padding":e});return(0,d.jsxs)("div",{className:i,children:[(0,d.jsx)("div",{className:"wpl-modal_backdrop"}),(0,d.jsx)("div",{className:"wpl-modal_main",children:(0,d.jsx)(vm,{onClose:t,...n})})]})},xm=e=>(0,Bp.createPortal)((0,d.jsx)(bm,{...e}),Af("wpl-modal")||document.body),wm=function(e){const[t,n]=(0,l.useState)(!1);function r(){n(!1)}return(0,d.jsxs)("div",{className:"wrap",children:[(0,d.jsxs)("form",{action:"",method:"post",onSubmit:function(e){n(!0),e.preventDefault()},children:[(0,d.jsx)("h2",{children:(0,m.__)("Delete Redirection","redirection")}),(0,d.jsx)("p",{children:(0,m.__)("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,d.jsx)("input",{className:"button-secondary button-delete",type:"submit",name:"delete",value:(0,m.__)("Delete","redirection")})]}),t&&(0,d.jsx)(xm,{onClose:r,children:(0,d.jsxs)("div",{style:{padding:"15px 10px 5px 15px"},children:[(0,d.jsx)("h1",{children:(0,m.__)("Delete the plugin - are you sure?","redirection")}),(0,d.jsx)("p",{children:(0,m.__)("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,d.jsx)("p",{children:(0,m.__)("Once deleted your redirections will stop working. If they appear to continue working then please clear your browser cache.","redirection")}),(0,d.jsxs)("p",{children:[(0,d.jsx)("button",{className:"button-primary button-delete",onClick:function(){e.onDelete(),r()},children:(0,m.__)("Yes! Delete the plugin","redirection")})," ",(0,d.jsx)("button",{className:"button-secondary",onClick:r,children:(0,m.__)("No! Don't delete the plugin")})]})]})})]})},jm=function(){const e=pe(e=>e.loadStatus),t=pe(e=>e.values);Pd();const n=function(){const{incrementProgress:e,decrementProgress:t,addNotice:n,addError:r}=cd();return pt({mutationFn:async()=>{e();try{return await jt(qt())}catch(e){throw t(),sd(e)}},onSuccess:()=>{t(),n("Plugin deleted"),window.location.href="/wp-admin/plugins.php"},onError:e=>{r(e.message||"Failed to delete plugin")}})}(),r="success"===e;return"loading"!==e&&t?(0,d.jsxs)("div",{children:["success"===e&&(0,d.jsx)(ym,{}),(0,d.jsx)("hr",{}),r&&(0,d.jsx)(wm,{onDelete:()=>{n.mutate()}})]}):(0,d.jsx)($p,{})},Sm=()=>(0,d.jsxs)("div",{children:[(0,d.jsx)("h2",{children:(0,m.__)("Need help?","redirection")}),(0,d.jsx)("p",{children:U((0,m.__)("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,d.jsx)(z,{url:"https://redirection.me"}),faq:(0,d.jsx)(z,{url:"https://redirection.me/support/faq/"})})}),(0,d.jsx)("p",{children:(0,d.jsx)("strong",{children:U((0,m.__)("If you want to report a bug please read the {{report}}Reporting Bugs{{/report}} guide.","redirection"),{report:(0,d.jsx)(z,{url:"https://redirection.me/support/reporting-bugs/"})})})}),(0,d.jsx)("div",{className:"inline-notice inline-general",children:(0,d.jsxs)("p",{className:"github",children:[(0,d.jsx)(z,{url:"https://github.com/johngodley/redirection/issues",children:(0,d.jsx)("img",{src:window.Redirectioni10n.pluginBaseUrl+"/images/GitHub-Mark-64px.png",width:"32",height:"32",alt:"GitHub"})}),(0,d.jsx)(z,{url:"https://github.com/johngodley/redirection/issues",children:"https://github.com/johngodley/redirection/"})]})}),(0,d.jsx)("p",{children:(0,m.__)("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,d.jsx)("p",{children:U((0,m.__)("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,d.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,d.jsx)("h2",{children:(0,m.__)("Need to search and replace?","redirection")}),(0,d.jsx)("p",{children:U((0,m.__)("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,d.jsx)(z,{url:"https://searchregex.com/"})})})]});function km(e,t){return"http"===e.slice(0,4)?e:pp(t||document.location.origin,e)}function Cm(e){return"object"==typeof e&&void 0!==e.url_from?e.url_from:e}function Tm({status:e,headers:t,statusMessage:n,isMatch:r}){if(0===e)return n.length>0?(0,d.jsx)(d.Fragment,{children:n}):(0,d.jsx)(d.Fragment,{children:(0,m.__)("An unknown error","redirection")});if(e>=500)return(0,d.jsx)(d.Fragment,{children:(0,m.__)("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,d.jsx)(d.Fragment,{children:U((0,m.__)("An error page was returned. This is unlikely to be a problem with Redirection. {{support}}What does this mean?{{/support}}.","redirection"),{support:(0,d.jsx)(z,{url:"https://redirection.me/support/problems/redirect-returning-404/"})})});if(e>=300&&e<400){if(r)return(0,d.jsxs)(d.Fragment,{children:[(0,m.__)("Redirected by Redirection.","redirection")," ",(0,d.jsxs)("span",{className:"redirection-httpstep__match",children:[(0,m.__)("Matches your redirect","redirection")," ",(0,d.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,d.jsx)(d.Fragment,{children:(0,m.__)("Redirected by Redirection.","redirection")}):(0,d.jsx)(d.Fragment,{children:U((0,m.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,m.__)("Redirected by %1$s. {{support}}What does this mean?{{/support}}.","redirection"),e.value),{support:(0,d.jsx)(z,{url:"https://redirection.me/support/problems/redirected-by-another-agent/"})})}):(0,d.jsx)(d.Fragment,{children:U((0,m.__)("Redirected by an unknown agent. {{support}}What does this mean?{{/support}}.","redirection"),{support:(0,d.jsx)(z,{url:"https://redirection.me/support/problems/redirected-by-another-agent/"})})})}return e>=200&&e<300?(0,d.jsx)(d.Fragment,{children:(0,m.__)("Page was loaded.","redirection")}):null}function Em({step:e,isFirst:t,isLast:n,isMatch:r}){const{request:i,status:o,statusMessage:s,headers:a}=e,l=100*Math.floor(o/100);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"redirection-httpstep",children:[(0,d.jsx)("div",{className:`redirection-httpstep__status redirection-httpstep__${l>0?l:"500"}`,children:parseInt(o.toString(),10)>0?(0,d.jsx)(z,{url:`https://redirect.li/http/status/code/${o}/`,title:s,children:o}):"Fail"}),(0,d.jsxs)("div",{className:"redirection-httpstep__details",children:[(0,d.jsx)("p",{children:(0,d.jsx)("code",{children:i.url})}),(0,d.jsx)("p",{children:(0,d.jsx)(Tm,{status:parseInt(o.toString(),10),statusMessage:s,headers:a,isFirst:t,isMatch:r})})]})]}),!n&&(0,d.jsx)("div",{children:(0,d.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:(0,d.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 Pm(e,t,n,r){if(!Array.isArray(e)||!n||!r)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 n&&void 0===n.url_from)return"redirection"===i.value.toLowerCase()&&r===t&&km(o.value)===Cm(n);if("object"==typeof n)return"redirection"===i.value.toLowerCase()&&r===t&&km(o.value,n.server)===Cm(n)}return!1}const Om=function({desiredTarget:e,desiredCode:t,http:n,url:r}){const{steps:i}=n;return!n||"error"!==n.status&&"fail"!==n.status||0!==i.length?(0,d.jsxs)("div",{children:[i.map((n,r)=>(0,d.jsx)(Em,{step:n,isFirst:0===r,isLast:r===i.length-1,isMatch:Pm(n.headers,n.status,e,t)},r)),(0,d.jsxs)("p",{children:[e&&t&&(0,d.jsxs)(d.Fragment,{children:[U((0,m.__)("If this is not expected then this {{support}}support page{{/support}} may help.","redirection"),{support:(0,d.jsx)(z,{url:"https://redirection.me/support/problems/url-not-redirecting/"})})," "]}),(0,m.__)("If your browser is behaving differently then you should clear your browser cache.","redirection")]}),(0,d.jsx)("p",{children:(0,d.jsx)(z,{url:`https://redirect.li/http/?url=${encodeURIComponent(r)}`,className:"button",children:(0,m.__)("View full redirect.li results.","redirection")})})]}):(0,d.jsx)("div",{children:(0,m.__)("Unable to check that URL. It may not be valid or accessible.","redirection")})};function Rm({error:e}){return(0,d.jsxs)("div",{className:"wpl-modal_error",children:[(0,d.jsx)("h2",{children:(0,m.__)("Error","redirection")}),(0,d.jsx)("p",{children:(0,m.__)("Something went wrong obtaining this information. It may work in the future.","redirection")}),(0,d.jsx)("p",{children:(0,d.jsx)("code",{children:e})})]})}function Nm({url:e,desiredCode:t=0,desiredTarget:n=null}){const{data:r,isLoading:i,isError:o,error:s}=function(e,t){return ct({queryKey:ad.info.http(e),queryFn:async()=>await jt(en(e)),enabled:!!e,staleTime:0,...t})}(e,{enabled:!!e}),a=o&&s&&s.message||"";if(!i&&!o&&!r)return null;const l=y({"redirection-httpcheck":!0,"wpl-modal_loading":i,"redirection-httpcheck_small":o});return(0,d.jsxs)("div",{className:l,children:[i&&(0,d.jsx)(_d,{}),o&&a&&(0,d.jsx)(Rm,{error:a}),!i&&!o&&r&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("h2",{children:U((0,m.sprintf)(
// translators: %s is the URL being checked
// translators: %s is the URL being checked
(0,m.__)("Check redirect for: {{code}}%s{{/code}}","redirection"),e),{code:(0,d.jsx)("code",{})})}),(0,d.jsx)(Om,{http:r,url:e,desiredCode:t,desiredTarget:n})]})]})}const Am=function(){const[e,t]=(0,l.useState)(""),[n,r]=(0,l.useState)(""),i=n.length>0;return(0,d.jsxs)("form",{className:"http-tester",onSubmit:function(t){t.preventDefault(),e.length>0&&r(e)},children:[(0,d.jsx)("h3",{children:(0,m.__)("Redirect Tester","redirection")}),(0,d.jsx)("p",{children:U((0,m.__)("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,d.jsx)(z,{url:"https://redirect.li"})})}),(0,d.jsxs)("div",{className:"redirection-httptest__input",children:[(0,d.jsxs)("span",{children:[(0,m.__)("URL","redirection"),":"]}),(0,d.jsx)("input",{className:"regular-text",type:"text",value:e,onChange:e=>t(e.target.value),placeholder:(0,m.__)("Enter full URL, including http:// or https://","redirection")}),(0,d.jsx)("input",{type:"submit",className:"button-secondary",disabled:0===e.length,value:(0,m.__)("Check","redirection")})]}),i&&(0,d.jsx)("div",{className:"redirection-httptest",children:(0,d.jsx)(Nm,{url:n})})]})},Im=()=>(0,d.jsxs)("form",{action:Redirectioni10n.pluginRoot+"&sub=support",method:"POST",children:[(0,d.jsx)("input",{type:"hidden",name:"_wpnonce",value:jt.nonceMiddleware.nonce}),(0,d.jsx)("input",{type:"hidden",name:"action",value:"fixit"}),(0,d.jsx)("p",{children:(0,m.__)("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,d.jsx)("p",{children:(0,d.jsx)("input",{type:"submit",className:"button-primary",value:(0,m.__)("⚡️ Magic fix ⚡️","redirection")})})]}),zm=e=>{const{item:t}=e;return(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{children:t.name}),(0,d.jsxs)("td",{children:[(0,d.jsx)("span",{className:"plugin-status-"+t.status,children:"good"===t.status?(0,m.__)("Good","redirection"):(0,m.__)("Problem","redirection")})," ",t.message]})]})},Fm=e=>{const{status:t}=e,n=t.filter(e=>"good"!==e.status);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("table",{className:"plugin-status",children:(0,d.jsx)("tbody",{children:t.map((e,t)=>(0,d.jsx)(zm,{item:e},t))})}),n.length>0&&(0,d.jsx)(Im,{})]})},Dm=function(e){const{debug:t}=e,[n,r]=(0,l.useState)(t.database.current),{mutate:i}=Ad({onSuccess:()=>{window.location.reload()}}),{ip_header:o,database:s}=t;return(0,d.jsx)("table",{className:"plugin-status",children:(0,d.jsxs)("tbody",{children:[(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{children:(0,m.__)("Database version","redirection")}),(0,d.jsxs)("td",{children:[(0,d.jsx)(Sd,{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:n,name:"database_version",onChange:function(e){r(e.target.value)}})," "," ",n!==s.current&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("strong",{children:(0,m.__)("Do not change unless advised to do so!","redirection")})," "," ",(0,d.jsx)("button",{className:"button-secondary button",onClick:function(e){e.preventDefault(),i({reason:"database",current:n})},children:(0,m.__)("Save","redirection")})]})]})]}),(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{children:(0,m.__)("IP Headers","redirection")}),(0,d.jsx)("td",{children:Object.keys(o).filter(e=>o[e]).map((e,t)=>(0,d.jsxs)("code",{children:[e," = ",o[e]?o[e]:"-"," "]},t))})]})]})})},Lm=function(){const e=pe(e=>e.pluginStatus.status),t=pe(e=>e.pluginStatus.debug);return function(){const{setPluginStatus:e}=pe();ct({queryKey:ad.settings.status(),queryFn:async()=>{try{const t=await jt(Zt());return e(t),t}catch(e){throw sd(e)}}})}(),(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("h2",{children:(0,m.__)("WordPress REST API","redirection")}),(0,d.jsx)("p",{children:(0,m.__)("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,d.jsx)($d,{}),(0,d.jsx)("h2",{children:(0,m.__)("Plugin Status","redirection")}),e.length>0&&(0,d.jsx)(Fm,{status:e}),0===e.length&&(0,d.jsx)("div",{className:"placeholder-inline",children:(0,d.jsx)("div",{className:"wpl-placeholder__loading"})}),(0,d.jsx)("h2",{children:(0,m.__)("Plugin Debug","redirection")}),(0,d.jsx)("p",{children:(0,m.__)("This information is provided for debugging purposes. Be careful making any changes.","redirection")}),t&&(0,d.jsx)(Dm,{debug:t}),!t&&(0,d.jsx)("div",{className:"placeholder-inline",children:(0,d.jsx)("div",{className:"wpl-placeholder__loading"})})]})},Mm=function(){return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(Lm,{}),(0,d.jsx)(Am,{}),(0,d.jsx)(Sm,{})]})};function $m(e,t){if(!1===e)return!1;const n=function(e){try{let t=e;"http:"!==e.slice(0,5)&&"https:"!==e.slice(0,6)&&(t=document.location.protocol+"//"+e);const n=new URL(t);return{protocol:n.protocol,host:n.host,pathname:n.pathname}}catch(e){return{}}}(e);return n.host&&n.host.length>0?t(n):""}function Um(e){return $m(e,e=>e.protocol+"//"+(e.host||"")+(e.pathname||""))}function Bm(e){return $m(e,e=>e.protocol+"//"+(e.host||""))}const Zm=({domain:e,asDomain:t,onChange:n,onDelete:r,site:i})=>(0,d.jsxs)("tr",{className:"redirect-alias__item",children:[(0,d.jsx)("td",{children:(0,d.jsx)("input",{className:"regular-text",type:"text",name:"domain",value:e,onChange:n})}),(0,d.jsx)("td",{className:"redirect-alias__item__asdomain",children:e.length>0&&(0,d.jsxs)(l.Fragment,{children:[(0,d.jsx)("code",{children:t})," ⇒ ",(0,d.jsx)("code",{children:i})]})}),(0,d.jsx)("td",{className:"redirect-alias__delete",children:(0,d.jsx)("button",{onClick:e=>{e.preventDefault(),r()},children:(0,d.jsx)("span",{className:"dashicons dashicons-trash"})})})]}),qm=({aliases:e,siteDomain:t,onChange:n})=>(0,d.jsxs)(l.Fragment,{children:[(0,d.jsx)("h3",{children:(0,m.__)("Site Aliases","redirection")}),(0,d.jsx)("p",{children:(0,m.__)("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,d.jsx)("p",{children:(0,m.__)("You will need to configure your system (DNS and server) to pass requests for these domains to this WordPress install.","redirection")}),(0,d.jsxs)("table",{className:"wp-list-table widefat fixed striped items redirect-aliases table-auto",children:[(0,d.jsx)("thead",{children:(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{children:(0,m.__)("Aliased Domain","redirection")}),(0,d.jsx)("th",{className:"redirect-alias__item__asdomain",children:(0,m.__)("Alias","redirection")}),(0,d.jsx)("th",{className:"redirect-alias__delete"})]})}),(0,d.jsxs)("tbody",{children:[e.map((r,i)=>(0,d.jsx)(Zm,{domain:r,asDomain:(Bm(r)||"").replace(/https?:\/\//,""),onChange:t=>((e,t,n,r)=>{const i=t.slice();i[e]=r.target.value,n({aliases:i})})(i,e,n,t),onDelete:()=>((e,t,n)=>{n({aliases:[...t.slice(0,e),...t.slice(e+1)]})})(i,e,n),site:t},i)),0===e.length&&(0,d.jsx)("tr",{children:(0,d.jsx)("td",{colSpan:3,children:(0,m.__)("No aliases","redirection")})})]})]}),(0,d.jsx)("p",{children:(0,d.jsx)("button",{className:"button-secondary",onClick:t=>((e,t,n)=>{n.preventDefault(),t({aliases:e.concat("").slice(0,20)})})(e,n,t),children:(0,m.__)("Add Alias","redirection")})})]}),Hm=({relocate:e,siteDomain:t,onChange:n})=>{const r=((e,t)=>{if(t){const n=Um(t);if(n&&n.length>0)return(0,d.jsxs)("p",{children:[(0,d.jsx)("code",{children:e})," ⇒ ",(0,d.jsx)("code",{children:n})]})}return null})(t,e);return(0,d.jsxs)(l.Fragment,{children:[(0,d.jsx)("h3",{children:(0,m.__)("Relocate Site","redirection")}),(0,d.jsx)("p",{children:(0,m.__)("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,d.jsxs)("p",{children:[(0,d.jsxs)("strong",{children:[(0,m.__)("Relocate to domain","redirection"),":"]})," ",(0,d.jsx)("input",{type:"text",className:"regular-text",name:"relocate",value:e||"",onChange:e=>n({relocate:e.target.value})})]}),r]})};function Wm(e,t,n){return e=e.replace(/https?:\/\//,""),"www"===n?e="www."+e.replace("www.",""):"nowww"===n&&(e=e.replace("www.","")),(t?"https://":"http://")+e}const Gm=function({https:e,preferredDomain:t,siteDomain:n,onChange:r}){const i=function(e,t,n){return!(!t||e.includes("https:"))||"www"===n&&!e.includes("www.")||!("nowww"!==n||!e.includes("www."))}(n,e,t),o=e=>{r({[e.target.name]:e.target.value})};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("h3",{children:(0,m.__)("Canonical Settings","redirection")}),(0,d.jsxs)("p",{children:[(0,d.jsx)("input",{id:"canonical-https",type:"checkbox",name:"https",onChange:e=>{r({[e.target.name]:e.target.checked})},checked:e})," ",(0,d.jsx)("label",{htmlFor:"canonical-https",children:U((0,m.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,m.__)("Force a redirect from HTTP to HTTPS - {{code}}%(site)s{{/code}} ⇒ {{code}}%(siteHTTPS)s{{/code}}","redirection"),{site:n.replace("https","http"),siteHTTPS:n.replace("http:","https:")}),{code:(0,d.jsx)("code",{})})})]}),e&&(0,d.jsx)("div",{className:"inline-notice inline-warning",children:(0,d.jsx)("p",{children:U(
// translators: %(strong)s is the warning title
// translators: %(strong)s is the warning title
(0,m.__)("{{strong}}Warning{{/strong}}: ensure your HTTPS is working before forcing a redirect.","redirection"),{strong:(0,d.jsx)("strong",{})})})}),(0,d.jsxs)("p",{children:[(0,m.__)("Preferred domain","redirection"),":"]}),(s=n,[{
// translators: %(site)s is the site domain
label:U((0,m.sprintf)(
// translators: %(site)s is the site domain
// translators: %(site)s is the site domain
(0,m.__)("Don't set a preferred domain - {{code}}%(site)s{{/code}}","redirection"),{site:s}),{code:(0,d.jsx)("code",{})}),value:""},{
// translators: %(site)s is the site domain without www, %(siteWWW)s is the site domain with www
label:U((0,m.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,m.__)("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,d.jsx)("code",{})}),value:"nowww"},{
// translators: %(site)s is the site domain without www, %(siteWWW)s is the site domain with www
label:U((0,m.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,m.__)("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,d.jsx)("code",{})}),value:"www"}]).map(e=>{const n=`canonical-preferred-${e.value||"none"}`;return(0,d.jsxs)("p",{children:[(0,d.jsx)("input",{id:n,type:"radio",name:"preferred_domain",value:e.value,onChange:o,checked:e.value===t})," ",(0,d.jsx)("label",{htmlFor:n,children:e.label})]},e.value)}),i&&(0,d.jsx)("div",{className:"inline-notice inline-error",children:(0,d.jsx)("p",{children:U((0,m.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,m.__)("You should update your site URL to match your canonical settings: {{code}}%(current)s{{/code}} ⇒ {{code}}%(site)s{{/code}}","redirection"),{current:n,site:Wm(n,e,t)}),{code:(0,d.jsx)("code",{})})})})]});var s},Vm="undefined"!=typeof document?l.useLayoutEffect:()=>{};function Qm(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function Km(e){let t=(0,l.useRef)({isFocused:!1,observer:null});return Vm(()=>{const e=t.current;return()=>{e.observer&&(e.observer.disconnect(),e.observer=null)}},[]),(0,l.useCallback)(n=>{if(n.target instanceof HTMLButtonElement||n.target instanceof HTMLInputElement||n.target instanceof HTMLTextAreaElement||n.target instanceof HTMLSelectElement){t.current.isFocused=!0;let r=n.target,i=n=>{if(t.current.isFocused=!1,r.disabled){let t=Qm(n);null==e||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){var e;null===(e=t.current.observer)||void 0===e||e.disconnect();let n=r===document.activeElement?null:document.activeElement;r.dispatchEvent(new FocusEvent("blur",{relatedTarget:n})),r.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:n}))}}),t.current.observer.observe(r,{attributes:!0,attributeFilter:["disabled"]})}},[e])}function Jm(e){var t;if("undefined"==typeof window||null==window.navigator)return!1;let n=null===(t=window.navigator.userAgentData)||void 0===t?void 0:t.brands;return Array.isArray(n)&&n.some(t=>e.test(t.brand))||e.test(window.navigator.userAgent)}function Ym(e){var t;return"undefined"!=typeof window&&null!=window.navigator&&e.test((null===(t=window.navigator.userAgentData)||void 0===t?void 0:t.platform)||window.navigator.platform)}function Xm(e){let t=null;return()=>(null==t&&(t=e()),t)}const eg=Xm(function(){return Ym(/^Mac/i)}),tg=Xm(function(){return Ym(/^iPhone/i)}),ng=Xm(function(){return Ym(/^iPad/i)||eg()&&navigator.maxTouchPoints>1}),rg=Xm(function(){return tg()||ng()}),ig=(Xm(function(){return eg()||rg()}),Xm(function(){return Jm(/AppleWebKit/i)&&!og()})),og=Xm(function(){return Jm(/Chrome/i)}),sg=Xm(function(){return Jm(/Android/i)}),ag=Xm(function(){return Jm(/Firefox/i)});let lg=null;function cg(e,t,n=!0){var r,i;let{metaKey:o,ctrlKey:s,altKey:a,shiftKey:l}=t;ag()&&(null===(i=window.event)||void 0===i||null===(r=i.type)||void 0===r?void 0:r.startsWith("key"))&&"_blank"===e.target&&(eg()?o=!0:s=!0);let c=ig()&&eg()&&!ng()?new KeyboardEvent("keydown",{keyIdentifier:"Enter",metaKey:o,ctrlKey:s,altKey:a,shiftKey:l}):new MouseEvent("click",{metaKey:o,ctrlKey:s,altKey:a,shiftKey:l,detail:1,bubbles:!0,cancelable:!0});cg.isOpening=n,function(e){if(function(){if(null==lg){lg=!1;try{document.createElement("div").focus({get preventScroll(){return lg=!0,!0}})}catch{}}return lg}())e.focus({preventScroll:!0});else{let t=function(e){let t=e.parentNode,n=[],r=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==r;)(t.offsetHeight<t.scrollHeight||t.offsetWidth<t.scrollWidth)&&n.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t=t.parentNode;return r instanceof HTMLElement&&n.push({element:r,scrollTop:r.scrollTop,scrollLeft:r.scrollLeft}),n}(e);e.focus(),function(e){for(let{element:t,scrollTop:n,scrollLeft:r}of e)t.scrollTop=n,t.scrollLeft=r}(t)}}(e),e.dispatchEvent(c),cg.isOpening=!1}cg.isOpening=!1;const ug=e=>{var t;return null!==(t=null==e?void 0:e.ownerDocument)&&void 0!==t?t:document},dg=e=>e&&"window"in e&&e.window===e?e:ug(e).defaultView||window;let pg=null,hg="keyboard";const fg=new Set;let mg=new Map,gg=!1,yg=!1;const vg={Tab:!0,Escape:!0};function _g(e,t){for(let n of fg)n(e,t)}function bg(e){gg=!0,!cg.isOpening&&function(e){return!(e.metaKey||!eg()&&e.altKey||e.ctrlKey||"Control"===e.key||"Shift"===e.key||"Meta"===e.key)}(e)&&(pg="keyboard",hg="keyboard",_g("keyboard",e))}function xg(e){pg="pointer",hg="pointerType"in e?e.pointerType:"mouse","mousedown"!==e.type&&"pointerdown"!==e.type||(gg=!0,_g("pointer",e))}function wg(e){var t;!cg.isOpening&&(""===(t=e).pointerType&&t.isTrusted||(sg()&&t.pointerType?"click"===t.type&&1===t.buttons:0===t.detail&&!t.pointerType))&&(gg=!0,pg="virtual",hg="virtual")}function jg(e){e.target!==window&&e.target!==document&&e.isTrusted&&(gg||yg||(pg="virtual",hg="virtual",_g("virtual",e)),gg=!1,yg=!1)}function Sg(){gg=!1,yg=!0}function kg(e){if("undefined"==typeof window||"undefined"==typeof document||mg.get(dg(e)))return;const t=dg(e),n=ug(e);let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){gg=!0,r.apply(this,arguments)},n.addEventListener("keydown",bg,!0),n.addEventListener("keyup",bg,!0),n.addEventListener("click",wg,!0),t.addEventListener("focus",jg,!0),t.addEventListener("blur",Sg,!1),"undefined"!=typeof PointerEvent&&(n.addEventListener("pointerdown",xg,!0),n.addEventListener("pointermove",xg,!0),n.addEventListener("pointerup",xg,!0)),t.addEventListener("beforeunload",()=>{Cg(e)},{once:!0}),mg.set(t,{focus:r})}const Cg=(e,t)=>{const n=dg(e),r=ug(e);t&&r.removeEventListener("DOMContentLoaded",t),mg.has(n)&&(n.HTMLElement.prototype.focus=mg.get(n).focus,r.removeEventListener("keydown",bg,!0),r.removeEventListener("keyup",bg,!0),r.removeEventListener("click",wg,!0),n.removeEventListener("focus",jg,!0),n.removeEventListener("blur",Sg,!1),"undefined"!=typeof PointerEvent&&(r.removeEventListener("pointerdown",xg,!0),r.removeEventListener("pointermove",xg,!0),r.removeEventListener("pointerup",xg,!0)),mg.delete(n))};function Tg(){return"pointer"!==pg}"undefined"!=typeof document&&function(e){const t=ug(e);let n;"loading"!==t.readyState?kg(e):(n=()=>{kg(e)},t.addEventListener("DOMContentLoaded",n))}();const Eg=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function Pg(e,t){return!(!t||!e)&&e.contains(t)}const Og=(e=document)=>e.activeElement;function Rg(e){return e.target}function Ng(){let e=(0,l.useRef)(new Map),t=(0,l.useCallback)((t,n,r,i)=>{let o=(null==i?void 0:i.once)?(...t)=>{e.current.delete(r),r(...t)}:r;e.current.set(r,{type:n,eventTarget:t,fn:o,options:i}),t.addEventListener(n,o,i)},[]),n=(0,l.useCallback)((t,n,r,i)=>{var o;let s=(null===(o=e.current.get(r))||void 0===o?void 0:o.fn)||r;t.removeEventListener(n,s,i),e.current.delete(r)},[]),r=(0,l.useCallback)(()=>{e.current.forEach((e,t)=>{n(e.eventTarget,e.type,t,e.options)})},[n]);return(0,l.useEffect)(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function Ag(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:i}=e,o=(0,l.useRef)({isFocusWithin:!1}),{addGlobalListener:s,removeAllGlobalListeners:a}=Ng(),c=(0,l.useCallback)(e=>{Pg(e.currentTarget,e.target)&&o.current.isFocusWithin&&!Pg(e.currentTarget,e.relatedTarget)&&(o.current.isFocusWithin=!1,a(),n&&n(e),i&&i(!1))},[n,i,o,a]),u=Km(c),d=(0,l.useCallback)(e=>{if(!Pg(e.currentTarget,e.target))return;const t=ug(e.target),n=Og(t);if(!o.current.isFocusWithin&&n===Rg(e.nativeEvent)){r&&r(e),i&&i(!0),o.current.isFocusWithin=!0,u(e);let n=e.currentTarget;s(t,"focus",e=>{if(o.current.isFocusWithin&&!Pg(n,e.target)){let r=new t.defaultView.FocusEvent("blur",{relatedTarget:e.target});!function(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}(r,n);let i=Qm(r);c(i)}},{capture:!0})}},[r,i,u,s,c]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:d,onBlur:c}}}function Ig(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,i=(0,l.useRef)({isFocused:!1,isFocusVisible:t||Tg()}),[o,s]=(0,l.useState)(!1),[a,c]=(0,l.useState)(()=>i.current.isFocused&&i.current.isFocusVisible),u=(0,l.useCallback)(()=>c(i.current.isFocused&&i.current.isFocusVisible),[]),d=(0,l.useCallback)(e=>{i.current.isFocused=e,i.current.isFocusVisible=Tg(),s(e),u()},[u]);var p,h,f;p=e=>{i.current.isFocusVisible=e,u()},h=[n,o],f={enabled:o,isTextInput:n},kg(),(0,l.useEffect)(()=>{if(!1===(null==f?void 0:f.enabled))return;let e=(e,t)=>{(function(e,t,n){let r=ug(null==n?void 0:n.target);const i="undefined"!=typeof window?dg(null==n?void 0:n.target).HTMLInputElement:HTMLInputElement,o="undefined"!=typeof window?dg(null==n?void 0:n.target).HTMLTextAreaElement:HTMLTextAreaElement,s="undefined"!=typeof window?dg(null==n?void 0:n.target).HTMLElement:HTMLElement,a="undefined"!=typeof window?dg(null==n?void 0:n.target).KeyboardEvent:KeyboardEvent;return!((e=e||r.activeElement instanceof i&&!Eg.has(r.activeElement.type)||r.activeElement instanceof o||r.activeElement instanceof s&&r.activeElement.isContentEditable)&&"keyboard"===t&&n instanceof a&&!vg[n.key])})(!!(null==f?void 0:f.isTextInput),e,t)&&p(Tg())};return fg.add(e),()=>{fg.delete(e)}},h);let{focusProps:m}=function(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:i}=e;const o=(0,l.useCallback)(e=>{if(e.target===e.currentTarget)return r&&r(e),i&&i(!1),!0},[r,i]),s=Km(o),a=(0,l.useCallback)(e=>{const t=ug(e.target),r=t?Og(t):Og();e.target===e.currentTarget&&r===Rg(e.nativeEvent)&&(n&&n(e),i&&i(!0),s(e))},[i,n,s]);return{focusProps:{onFocus:!t&&(n||i||r)?a:void 0,onBlur:t||!r&&!i?void 0:o}}}({isDisabled:r,onFocusChange:d}),{focusWithinProps:g}=Ag({isDisabled:!r,onFocusWithinChange:d});return{isFocused:o,isFocusVisible:a,focusProps:r?g:m}}let zg=!1,Fg=0;function Dg(e){"touch"===e.pointerType&&(zg=!0,setTimeout(()=>{zg=!1},50))}function Lg(){if("undefined"!=typeof document)return 0===Fg&&"undefined"!=typeof PointerEvent&&document.addEventListener("pointerup",Dg),Fg++,()=>{Fg--,Fg>0||"undefined"!=typeof PointerEvent&&document.removeEventListener("pointerup",Dg)}}function Mg(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:i}=e,[o,s]=(0,l.useState)(!1),a=(0,l.useRef)({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;(0,l.useEffect)(Lg,[]);let{addGlobalListener:c,removeAllGlobalListeners:u}=Ng(),{hoverProps:d,triggerHoverEnd:p}=(0,l.useMemo)(()=>{let e=(e,t)=>{let i=a.target;a.pointerType="",a.target=null,"touch"!==t&&a.isHovered&&i&&(a.isHovered=!1,u(),r&&r({type:"hoverend",target:i,pointerType:t}),n&&n(!1),s(!1))},o={};return"undefined"!=typeof PointerEvent&&(o.onPointerEnter=r=>{zg&&"mouse"===r.pointerType||((r,o)=>{if(a.pointerType=o,i||"touch"===o||a.isHovered||!Pg(r.currentTarget,r.target))return;a.isHovered=!0;let l=r.currentTarget;a.target=l,c(ug(r.target),"pointerover",t=>{a.isHovered&&a.target&&!Pg(a.target,t.target)&&e(0,t.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:l,pointerType:o}),n&&n(!0),s(!0)})(r,r.pointerType)},o.onPointerLeave=t=>{!i&&Pg(t.currentTarget,t.target)&&e(0,t.pointerType)}),{hoverProps:o,triggerHoverEnd:e}},[t,n,r,i,a,c,u]);return(0,l.useEffect)(()=>{i&&p({currentTarget:a.target},a.pointerType)},[i]),{hoverProps:d,isHovered:o}}var $g=Object.defineProperty,Ug=(e,t,n)=>(((e,t,n)=>{t in e?$g(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n);let Bg=new class{constructor(){Ug(this,"current",this.detect()),Ug(this,"handoffState","pending"),Ug(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 Zg(e){var t;return Bg.isServer?null:null==e?document:null!=(t=null==e?void 0:e.ownerDocument)?t:document}function qg(e){var t,n;return Bg.isServer?null:null==e?document:null!=(n=null==(t=null==e?void 0:e.getRootNode)?void 0:t.call(e))?n:document}function Hg(e){var t,n;return null!=(n=null==(t=qg(e))?void 0:t.activeElement)?n:null}function Wg(e){"function"==typeof queueMicrotask?queueMicrotask(e):Promise.resolve().then(e).catch(e=>setTimeout(()=>{throw e}))}function Gg(){let e=[],t={addEventListener:(e,n,r,i)=>(e.addEventListener(n,r,i),t.add(()=>e.removeEventListener(n,r,i))),requestAnimationFrame(...e){let n=requestAnimationFrame(...e);return t.add(()=>cancelAnimationFrame(n))},nextFrame:(...e)=>t.requestAnimationFrame(()=>t.requestAnimationFrame(...e)),setTimeout(...e){let n=setTimeout(...e);return t.add(()=>clearTimeout(n))},microTask(...e){let n={current:!0};return Wg(()=>{n.current&&e[0]()}),t.add(()=>{n.current=!1})},style(e,t,n){let r=e.style.getPropertyValue(t);return Object.assign(e.style,{[t]:n}),this.add(()=>{Object.assign(e.style,{[t]:r})})},group(e){let t=Gg();return e(t),this.add(()=>t.dispose())},add:t=>(e.includes(t)||e.push(t),()=>{let n=e.indexOf(t);if(n>=0)for(let t of e.splice(n,1))t()}),dispose(){for(let t of e.splice(0))t()}};return t}function Vg(){let[e]=(0,l.useState)(Gg);return(0,l.useEffect)(()=>()=>e.dispose(),[e]),e}let Qg=(e,t)=>{Bg.isServer?(0,l.useEffect)(e,t):(0,l.useLayoutEffect)(e,t)};function Kg(e){let t=(0,l.useRef)(e);return Qg(()=>{t.current=e},[e]),t}let Jg=function(e){let t=Kg(e);return l.useCallback((...e)=>t.current(...e),[t])};function Yg({disabled:e=!1}={}){let t=(0,l.useRef)(null),[n,r]=(0,l.useState)(!1),i=Vg(),o=Jg(()=>{t.current=null,r(!1),i.dispose()}),s=Jg(e=>{if(i.dispose(),null===t.current){t.current=e.currentTarget,r(!0);{let n=Zg(e.currentTarget);i.addEventListener(n,"pointerup",o,!1),i.addEventListener(n,"pointermove",e=>{if(t.current){let n=function(e){let t=e.width/2,n=e.height/2;return{top:e.clientY-n,right:e.clientX+t,bottom:e.clientY+n,left:e.clientX-t}}(e);r(function(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}(n,t.current.getBoundingClientRect()))}},!1),i.addEventListener(n,"pointercancel",o,!1)}}});return{pressed:n,pressProps:e?{}:{onPointerDown:s,onPointerUp:o,onClick:o}}}function Xg(e){if(null===e)return{width:0,height:0};let{width:t,height:n}=e.getBoundingClientRect();return{width:t,height:n}}function ey(e,t,n=!1){let[r,i]=(0,l.useState)(()=>Xg(t));return Qg(()=>{if(!t||!e)return;let n=Gg();return n.requestAnimationFrame(function e(){n.requestAnimationFrame(e),i(e=>{let n=Xg(t);return n.width===e.width&&n.height===e.height?e:n})}),()=>{n.dispose()}},[t,e]),n?{width:`${r.width}px`,height:`${r.height}px`}:r}function ty(e){return function(e){return"object"==typeof e&&null!==e&&"nodeType"in e}(e)&&"tagName"in e}function ny(e){return ty(e)&&"accessKey"in e}function ry(e){return ty(e)&&"tabIndex"in e}function iy(e){return ny(e)&&"FIELDSET"===e.nodeName}function oy(e){return ny(e)&&"LEGEND"===e.nodeName}function sy(e,t,...n){if(e in t){let r=t[e];return"function"==typeof r?r(...n):r}let r=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(r,sy),r}let ay=["[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(","),ly=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var cy,uy=((cy=uy||{})[cy.First=1]="First",cy[cy.Previous=2]="Previous",cy[cy.Next=4]="Next",cy[cy.Last=8]="Last",cy[cy.WrapAround=16]="WrapAround",cy[cy.NoScroll=32]="NoScroll",cy[cy.AutoFocus=64]="AutoFocus",cy),dy=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(dy||{}),py=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(py||{});function hy(e=document.body){return null==e?[]:Array.from(e.querySelectorAll(ay)).sort((e,t)=>Math.sign((e.tabIndex||Number.MAX_SAFE_INTEGER)-(t.tabIndex||Number.MAX_SAFE_INTEGER)))}var fy=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(fy||{});function my(e,t=0){var n;return e!==(null==(n=Zg(e))?void 0:n.body)&&sy(t,{0:()=>e.matches(ay),1(){let t=e;for(;null!==t;){if(t.matches(ay))return!0;t=t.parentElement}return!1}})}var gy=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(gy||{});"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 yy=["textarea","input"].join(",");function vy(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:i=[]}={}){let o=Array.isArray(e)?e.length>0?qg(e[0]):document:qg(e),s=Array.isArray(e)?n?function(e,t=e=>e){return e.slice().sort((e,n)=>{let r=t(e),i=t(n);if(null===r||null===i)return 0;let o=r.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(ly)).sort((e,t)=>Math.sign((e.tabIndex||Number.MAX_SAFE_INTEGER)-(t.tabIndex||Number.MAX_SAFE_INTEGER)))}(e):hy(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))),r=null!=r?r: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(r))-1;if(4&t)return Math.max(0,s.indexOf(r))+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!==Hg(a));return 6&t&&function(e){var t,n;return null!=(n=null==(t=null==e?void 0:e.matches)?void 0:t.call(e,yy))&&n}(a)&&a.select(),2}function _y(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function by(){return _y()||/Android/gi.test(window.navigator.userAgent)}function xy(e,t,n,r){let i=Kg(n);(0,l.useEffect)(()=>{if(e)return document.addEventListener(t,n,r),()=>document.removeEventListener(t,n,r);function n(e){i.current(e)}},[e,t,r])}function wy(e,t,n,r){let i=Kg(n);(0,l.useEffect)(()=>{if(e)return window.addEventListener(t,n,r),()=>window.removeEventListener(t,n,r);function n(e){i.current(e)}},[e,t,r])}function jy(e,t,n){let r=Kg(n),i=(0,l.useCallback)(function(e,n){if(e.defaultPrevented)return;let i=n(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!my(i,fy.Loose)&&-1!==i.tabIndex&&e.preventDefault(),r.current(e,i)},[r,t]),o=(0,l.useRef)(null);xy(e,"pointerdown",e=>{var t,n;by()||(o.current=(null==(n=null==(t=e.composedPath)?void 0:t.call(e))?void 0:n[0])||e.target)},!0),xy(e,"pointerup",e=>{if(by()||!o.current)return;let t=o.current;return o.current=null,i(e,()=>t)},!0);let s=(0,l.useRef)({x:0,y:0});xy(e,"touchstart",e=>{s.current.x=e.touches[0].clientX,s.current.y=e.touches[0].clientY},!0),xy(e,"touchend",e=>{let t=e.changedTouches[0].clientX,n=e.changedTouches[0].clientY;if(!(Math.abs(t-s.current.x)>=30||Math.abs(n-s.current.y)>=30))return i(e,()=>ry(e.target)?e.target:null)},!0),wy(e,"blur",e=>i(e,()=>{return ny(e=window.document.activeElement)&&"IFRAME"===e.nodeName?window.document.activeElement:null;var e}),!0)}function Sy(...e){return(0,l.useMemo)(()=>Zg(...e),[...e])}function ky(...e){return Array.from(new Set(e.flatMap(e=>"string"==typeof e?e.split(" "):[]))).filter(Boolean).join(" ")}var Cy,Ty=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(Ty||{}),Ey=((Cy=Ey||{})[Cy.Unmount=0]="Unmount",Cy[Cy.Hidden=1]="Hidden",Cy);function Py(){let e=function(){let e=(0,l.useRef)([]),t=(0,l.useCallback)(t=>{for(let n of e.current)null!=n&&("function"==typeof n?n(t):n.current=t)},[]);return(...n)=>{if(!n.every(e=>null==e))return e.current=n,t}}();return(0,l.useCallback)(t=>function({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:i,visible:o=!0,name:s,mergeRefs:a}){a=null!=a?a:Ry;let l=Ny(t,e);if(o)return Oy(l,n,r,s,a);let c=null!=i?i:0;if(2&c){let{static:e=!1,...t}=l;if(e)return Oy(t,n,r,s,a)}if(1&c){let{unmount:e=!0,...t}=l;return sy(e?0:1,{0:()=>null,1:()=>Oy({...t,hidden:!0,style:{display:"none"}},n,r,s,a)})}return Oy(l,n,r,s,a)}({mergeRefs:e,...t}),[e])}function Oy(e,t={},n,r,i){let{as:o=n,children:s,refName:a="ref",...c}=Fy(e,["unmount","static"]),u=void 0!==e.ref?{[a]:e.ref}:{},d="function"==typeof s?s(t):s;"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,n=[];for(let[r,i]of Object.entries(t))"boolean"==typeof i&&(e=!0),!0===i&&n.push(r.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`));if(e){p["data-headlessui-state"]=n.join(" ");for(let e of n)p[`data-${e}`]=""}}if(Ly(o)&&(Object.keys(zy(c)).length>0||Object.keys(zy(p)).length>0)){if(!(!(0,l.isValidElement)(d)||Array.isArray(d)&&d.length>1||function(e){return Ly(e.type)}(d))){let e=d.props,t=null==e?void 0:e.className,n="function"==typeof t?(...e)=>ky(t(...e),c.className):ky(t,c.className),r=n?{className:n}:{},o=Ny(d.props,zy(Fy(c,["ref"])));for(let e in p)e in o&&delete p[e];return(0,l.cloneElement)(d,Object.assign({},o,p,u,{ref:i(Dy(d),u.ref)},r))}if(Object.keys(zy(c)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${r} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(zy(c)).concat(Object.keys(zy(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,l.createElement)(o,Object.assign({},Fy(c,["ref"]),!Ly(o)&&u,!Ly(o)&&p),d)}function Ry(...e){return e.every(e=>null==e)?void 0:t=>{for(let n of e)null!=n&&("function"==typeof n?n(t):n.current=t)}}function Ny(...e){if(0===e.length)return{};if(1===e.length)return e[0];let t={},n={};for(let r of e)for(let e in r)e.startsWith("on")&&"function"==typeof r[e]?(null!=n[e]||(n[e]=[]),n[e].push(r[e])):t[e]=r[e];if(t.disabled||t["aria-disabled"])for(let e in n)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(e)&&(n[e]=[e=>{var t;return null==(t=null==e?void 0:e.preventDefault)?void 0:t.call(e)}]);for(let e in n)Object.assign(t,{[e](t,...r){let i=n[e];for(let e of i){if((t instanceof Event||(null==t?void 0:t.nativeEvent)instanceof Event)&&t.defaultPrevented)return;e(t,...r)}}});return t}function Ay(...e){if(0===e.length)return{};if(1===e.length)return e[0];let t={},n={};for(let r of e)for(let e in r)e.startsWith("on")&&"function"==typeof r[e]?(null!=n[e]||(n[e]=[]),n[e].push(r[e])):t[e]=r[e];for(let e in n)Object.assign(t,{[e](...t){let r=n[e];for(let e of r)null==e||e(...t)}});return t}function Iy(e){var t;return Object.assign((0,l.forwardRef)(e),{displayName:null!=(t=e.displayName)?t:e.name})}function zy(e){let t=Object.assign({},e);for(let e in t)void 0===t[e]&&delete t[e];return t}function Fy(e,t=[]){let n=Object.assign({},e);for(let e of t)e in n&&delete n[e];return n}function Dy(e){return l.version.split(".")[0]>="19"?e.props.ref:e.ref}function Ly(e){return e===l.Fragment||e===Symbol.for("react.fragment")}var My=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(My||{});let $y=Iy(function(e,t){var n;let{features:r=1,...i}=e,o={ref:t,"aria-hidden":!(2&~r)||(null!=(n=i["aria-hidden"])?n:void 0),hidden:!(4&~r)||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&~r)&&!!(2&~r)&&{display:"none"}}};return Py()({ourProps:o,theirProps:i,slot:{},defaultTag:"span",name:"Hidden"})}),Uy=(0,l.createContext)(null);function By({children:e,node:t}){let[n,r]=(0,l.useState)(null),i=Zy(null!=t?t:n);return l.createElement(Uy.Provider,{value:i},e,null===i&&l.createElement($y,{features:My.Hidden,ref:e=>{var t,n;if(e)for(let i of null!=(n=null==(t=Zg(e))?void 0:t.querySelectorAll("html > *, body > *"))?n:[])if(i!==document.body&&i!==document.head&&ty(i)&&null!=i&&i.contains(e)){r(i);break}}}))}function Zy(e=null){var t;return null!=(t=(0,l.useContext)(Uy))?t:e}function qy(){let e;return{before({doc:t}){var n;let r=t.documentElement,i=null!=(n=t.defaultView)?n:window;e=Math.max(0,i.innerWidth-r.clientWidth)},after({doc:t,d:n}){let r=t.documentElement,i=Math.max(0,r.clientWidth-r.offsetWidth),o=Math.max(0,e-i);n.style(r,"paddingRight",`${o}px`)}}}function Hy(){return _y()?{before({doc:e,d:t,meta:n}){function r(e){for(let t of n().containers)for(let n of t())if(n.contains(e))return!0;return!1}t.microTask(()=>{var n;if("auto"!==window.getComputedStyle(e.documentElement).scrollBehavior){let n=Gg();n.style(e.documentElement,"scrollBehavior","auto"),t.add(()=>t.microTask(()=>n.dispose()))}let i=null!=(n=window.scrollY)?n:window.pageYOffset,o=null;t.addEventListener(e,"click",t=>{if(ry(t.target))try{let n=t.target.closest("a");if(!n)return;let{hash:i}=new URL(n.href),s=e.querySelector(i);ry(s)&&!r(s)&&(o=s)}catch{}},!0),t.group(n=>{t.addEventListener(e,"touchstart",e=>{if(n.dispose(),ry(e.target)&&function(e){return ty(e)&&"style"in e}(e.target))if(r(e.target)){let t=e.target;for(;t.parentElement&&r(t.parentElement);)t=t.parentElement;n.style(t,"overscrollBehavior","contain")}else n.style(e.target,"touchAction","none")})}),t.addEventListener(e,"touchmove",e=>{if(ry(e.target)){if(function(e){return ny(e)&&"INPUT"===e.nodeName}(e.target))return;if(r(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 Wy(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let Gy=function(e,t){let n=new Map,r=new Set;return{getSnapshot:()=>n,subscribe:e=>(r.add(e),()=>r.delete(e)),dispatch(e,...i){let o=t[e].call(n,...i);o&&(n=o,r.forEach(e=>e()))}}}(0,{PUSH(e,t){var n;let r=null!=(n=this.get(e))?n:{doc:e,count:0,d:Gg(),meta:new Set,computedMeta:{}};return r.count++,r.meta.add(t),r.computedMeta=Wy(r.meta),this.set(e,r),this},POP(e,t){let n=this.get(e);return n&&(n.count--,n.meta.delete(t),n.computedMeta=Wy(n.meta)),this},SCROLL_PREVENT(e){let t={doc:e.doc,d:e.d,meta:()=>e.computedMeta},n=[Hy(),qy(),{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}];n.forEach(({before:e})=>null==e?void 0:e(t)),n.forEach(({after:e})=>null==e?void 0:e(t))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});function Vy(e,t,n=()=>({containers:[]})){let r=function(e){return(0,l.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot)}(Gy),i=t?r.get(t):void 0,o=!!i&&i.count>0;return Qg(()=>{if(t&&e)return Gy.dispatch("PUSH",t,n),()=>Gy.dispatch("POP",t,n)},[e,t]),o}Gy.subscribe(()=>{let e=Gy.getSnapshot(),t=new Map;for(let[n]of e)t.set(n,n.documentElement.style.overflow);for(let n of e.values()){let e="hidden"===t.get(n.doc),r=0!==n.count;(r&&!e||!r&&e)&&Gy.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),0===n.count&&Gy.dispatch("TEARDOWN",n)}});class Qy 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 Ky,Jy,Yy,Xy=Object.defineProperty,ev=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},tv=(e,t,n)=>(ev(e,t,"read from private field"),n?n.call(e):t.get(e)),nv=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},rv=(e,t,n,r)=>(ev(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);class iv{constructor(e){nv(this,Ky,{}),nv(this,Jy,new Qy(()=>new Set)),nv(this,Yy,new Set),((e,t,n)=>{((e,t,n)=>{t in e?Xy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n)})(this,"disposables",Gg()),rv(this,Ky,e),Bg.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return tv(this,Ky)}subscribe(e,t){if(Bg.isServer)return()=>{};let n={selector:e,callback:t,current:e(tv(this,Ky))};return tv(this,Yy).add(n),this.disposables.add(()=>{tv(this,Yy).delete(n)})}on(e,t){return Bg.isServer?()=>{}:(tv(this,Jy).get(e).add(t),this.disposables.add(()=>{tv(this,Jy).get(e).delete(t)}))}send(e){let t=this.reduce(tv(this,Ky),e);if(t!==tv(this,Ky)){rv(this,Ky,t);for(let e of tv(this,Yy)){let t=e.selector(tv(this,Ky));ov(e.current,t)||(e.current=t,e.callback(t))}for(let t of tv(this,Jy).get(e.type))t(tv(this,Ky),e)}}}function ov(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&&sv(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size===t.size&&sv(e.entries(),t.entries()):!(!av(e)||!av(t))&&sv(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()))}function sv(e,t){for(;;){let n=e.next(),r=t.next();if(n.done&&r.done)return!0;if(n.done||r.done||!Object.is(n.value,r.value))return!1}}function av(e){if("[object Object]"!==Object.prototype.toString.call(e))return!1;let t=Object.getPrototypeOf(e);return null===t||null===Object.getPrototypeOf(t)}Ky=new WeakMap,Jy=new WeakMap,Yy=new WeakMap;var lv=Object.defineProperty,cv=(e,t,n)=>(((e,t,n)=>{t in e?lv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n),uv=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(uv||{});let dv={0(e,t){let n=t.id,r=e.stack,i=e.stack.indexOf(n);if(-1!==i){let t=e.stack.slice();return t.splice(i,1),t.push(n),r=t,{...e,stack:r}}return{...e,stack:[...e.stack,n]}},1(e,t){let n=t.id,r=e.stack.indexOf(n);if(-1===r)return e;let i=e.stack.slice();return i.splice(r,1),{...e,stack:i}}};class pv extends iv{constructor(){super(...arguments),cv(this,"actions",{push:e=>this.send({type:0,id:e}),pop:e=>this.send({type:1,id:e})}),cv(this,"selectors",{isTop:(e,t)=>e.stack[e.stack.length-1]===t,inStack:(e,t)=>e.stack.includes(t)})}static new(){return new pv({stack:[]})}reduce(e,t){return sy(t.type,dv,e,t)}}const hv=new Qy(()=>pv.new());var fv=n(721);function mv(e,t,n=ov){return(0,fv.useSyncExternalStoreWithSelector)(Jg(t=>e.subscribe(gv,t)),Jg(()=>e.state),Jg(()=>e.state),Jg(t),n)}function gv(e){return e}function yv(e){return(0,l.useMemo)(()=>e,Object.values(e))}let vv=Symbol();function _v(e,t=!0){return Object.assign(e,{[vv]:t})}function bv(...e){let t=(0,l.useRef)(e);(0,l.useEffect)(()=>{t.current=e},[e]);let n=Jg(e=>{for(let n of t.current)null!=n&&("function"==typeof n?n(e):n.current=e)});return e.every(e=>null==e||(null==e?void 0:e[vv]))?void 0:n}var xv,wv,jv=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(jv||{});function Sv(){let e=(0,l.useRef)(0);return wy(!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==(xv=null==process?void 0:{NODE_ENV:"production"})?void 0:xv.NODE_ENV)&&void 0===(null==(wv=null==Element?void 0:Element.prototype)?void 0:wv.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 kv=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(kv||{});function Cv(e){let t={};for(let n in e)!0===e[n]&&(t[`data-${n}`]="");return t}function Tv(e,t,n,r){let[i,o]=(0,l.useState)(n),{hasFlag:s,addFlag:a,removeFlag:c}=function(e=0){let[t,n]=(0,l.useState)(e),r=(0,l.useCallback)(e=>n(e),[]),i=(0,l.useCallback)(e=>n(t=>t|e),[]),o=(0,l.useCallback)(e=>(t&e)===e,[t]),s=(0,l.useCallback)(e=>n(t=>t&~e),[]),a=(0,l.useCallback)(e=>n(t=>t^e),[]);return{flags:t,setFlag:r,addFlag:i,hasFlag:o,removeFlag:s,toggleFlag:a}}(e&&i?3:0),u=(0,l.useRef)(!1),d=(0,l.useRef)(!1),p=Vg();return Qg(()=>{var i;if(e)return n&&o(!0),t?(null==(i=null==r?void 0:r.start)||i.call(r,n),function(e,{prepare:t,run:n,done:r,inFlight:i}){let o=Gg();return function(e,{inFlight:t,prepare:n}){if(null!=t&&t.current)return void n();let r=e.style.transition;e.style.transition="none",n(),e.offsetHeight,e.style.transition=r}(e,{prepare:t,inFlight:i}),o.nextFrame(()=>{n(),o.requestAnimationFrame(()=>{o.add(function(e,t){var n,r;let i=Gg();if(!e)return i.dispose;let o=!1;i.add(()=>{o=!0});let s=null!=(r=null==(n=e.getAnimations)?void 0:n.call(e).filter(e=>e instanceof CSSTransition))?r:[];return 0===s.length?(t(),i.dispose):(Promise.allSettled(s.map(e=>e.finished)).then(()=>{o||t()}),i.dispose)}(e,r))})}),o.dispose}(t,{inFlight:u,prepare(){d.current?d.current=!1:d.current=u.current,u.current=!0,!d.current&&(n?(a(3),c(4)):(a(4),c(2)))},run(){d.current?n?(c(3),a(4)):(c(4),a(3)):n?c(1):a(1)},done(){var e;d.current&&function(e){var t,n;return(null!=(n=null==(t=e.getAnimations)?void 0:t.call(e))?n:[]).some(e=>e instanceof CSSTransition&&"finished"!==e.playState)}(t)||(u.current=!1,c(7),n||o(!1),null==(e=null==r?void 0:r.end)||e.call(r,n))}})):void(n&&a(3))},[e,n,t,p]),e?[i,{closed:s(1),enter:s(2),leave:s(4),transition:s(2)||s(4)}]:[n,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}let Ev=(0,l.createContext)(()=>{});function Pv({value:e,children:t}){return l.createElement(Ev.Provider,{value:e},t)}const Ov=Math.min,Rv=Math.max,Nv=Math.round,Av=Math.floor,Iv=e=>({x:e,y:e}),zv={left:"right",right:"left",bottom:"top",top:"bottom"},Fv={start:"end",end:"start"};function Dv(e,t,n){return Rv(e,Ov(t,n))}function Lv(e,t){return"function"==typeof e?e(t):e}function Mv(e){return e.split("-")[0]}function $v(e){return e.split("-")[1]}function Uv(e){return"x"===e?"y":"x"}function Bv(e){return"y"===e?"height":"width"}const Zv=new Set(["top","bottom"]);function qv(e){return Zv.has(Mv(e))?"y":"x"}function Hv(e){return Uv(qv(e))}function Wv(e){return e.replace(/start|end/g,e=>Fv[e])}const Gv=["left","right"],Vv=["right","left"],Qv=["top","bottom"],Kv=["bottom","top"];function Jv(e){return e.replace(/left|right|bottom|top/g,e=>zv[e])}function Yv(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Xv(){return"undefined"!=typeof window}function e_(e){return r_(e)?(e.nodeName||"").toLowerCase():"#document"}function t_(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function n_(e){var t;return null==(t=(r_(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function r_(e){return!!Xv()&&(e instanceof Node||e instanceof t_(e).Node)}function i_(e){return!!Xv()&&(e instanceof Element||e instanceof t_(e).Element)}function o_(e){return!!Xv()&&(e instanceof HTMLElement||e instanceof t_(e).HTMLElement)}function s_(e){return!(!Xv()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof t_(e).ShadowRoot)}const a_=new Set(["inline","contents"]);function l_(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=x_(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!a_.has(i)}const c_=new Set(["table","td","th"]);function u_(e){return c_.has(e_(e))}const d_=[":popover-open",":modal"];function p_(e){return d_.some(t=>{try{return e.matches(t)}catch(e){return!1}})}const h_=["transform","translate","scale","rotate","perspective"],f_=["transform","translate","scale","rotate","perspective","filter"],m_=["paint","layout","strict","content"];function g_(e){const t=y_(),n=i_(e)?x_(e):e;return h_.some(e=>!!n[e]&&"none"!==n[e])||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||f_.some(e=>(n.willChange||"").includes(e))||m_.some(e=>(n.contain||"").includes(e))}function y_(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const v_=new Set(["html","body","#document"]);function b_(e){return v_.has(e_(e))}function x_(e){return t_(e).getComputedStyle(e)}function w_(e){return i_(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function j_(e){if("html"===e_(e))return e;const t=e.assignedSlot||e.parentNode||s_(e)&&e.host||n_(e);return s_(t)?t.host:t}function S_(e){const t=j_(e);return b_(t)?e.ownerDocument?e.ownerDocument.body:e.body:o_(t)&&l_(t)?t:S_(t)}function k_(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const i=S_(e),o=i===(null==(r=e.ownerDocument)?void 0:r.body),s=t_(i);if(o){const e=C_(s);return t.concat(s,s.visualViewport||[],l_(i)?i:[],e&&n?k_(e):[])}return t.concat(i,k_(i,[],n))}function C_(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function T_(e,t,n){let{reference:r,floating:i}=e;const o=qv(t),s=Hv(t),a=Bv(s),l=Mv(t),c="y"===o,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,p=r[a]/2-i[a]/2;let h;switch(l){case"top":h={x:u,y:r.y-i.height};break;case"bottom":h={x:u,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:d};break;case"left":h={x:r.x-i.width,y:d};break;default:h={x:r.x,y:r.y}}switch($v(t)){case"start":h[s]-=p*(n&&c?-1:1);break;case"end":h[s]+=p*(n&&c?-1:1)}return h}async function E_(e,t){var n;void 0===t&&(t={});const{x:r,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}=Lv(t,e),f=function(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}(h),m=a[p?"floating"===d?"reference":"floating":d],g=Yv(await o.getClippingRect({element:null==(n=await(null==o.isElement?void 0:o.isElement(m)))||n?m:m.contextElement||await(null==o.getDocumentElement?void 0:o.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),y="floating"===d?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,v=await(null==o.getOffsetParent?void 0:o.getOffsetParent(a.floating)),_=await(null==o.isElement?void 0:o.isElement(v))&&await(null==o.getScale?void 0:o.getScale(v))||{x:1,y:1},b=Yv(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:y,offsetParent:v,strategy:l}):y);return{top:(g.top-b.top+f.top)/_.y,bottom:(b.bottom-g.bottom+f.bottom)/_.y,left:(g.left-b.left+f.left)/_.x,right:(b.right-g.right+f.right)/_.x}}const P_=new Set(["left","top"]);function O_(e){const t=x_(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=o_(e),o=i?e.offsetWidth:n,s=i?e.offsetHeight:r,a=Nv(n)!==o||Nv(r)!==s;return a&&(n=o,r=s),{width:n,height:r,$:a}}function R_(e){return i_(e)?e:e.contextElement}function N_(e){const t=R_(e);if(!o_(t))return Iv(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:o}=O_(t);let s=(o?Nv(n.width):n.width)/r,a=(o?Nv(n.height):n.height)/i;return s&&Number.isFinite(s)||(s=1),a&&Number.isFinite(a)||(a=1),{x:s,y:a}}const A_=Iv(0);function I_(e){const t=t_(e);return y_()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:A_}function z_(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const i=e.getBoundingClientRect(),o=R_(e);let s=Iv(1);t&&(r?i_(r)&&(s=N_(r)):s=N_(e));const a=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==t_(e))&&t}(o,n,r)?I_(o):Iv(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){const e=t_(o),t=r&&i_(r)?t_(r):r;let n=e,i=C_(n);for(;i&&r&&t!==n;){const e=N_(i),t=i.getBoundingClientRect(),r=x_(i),o=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,s=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;l*=e.x,c*=e.y,u*=e.x,d*=e.y,l+=o,c+=s,n=t_(i),i=C_(n)}}return Yv({width:u,height:d,x:l,y:c})}function F_(e,t){const n=w_(e).scrollLeft;return t?t.left+n:z_(n_(e)).left+n}function D_(e,t){const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-F_(e,n),y:n.top+t.scrollTop}}const L_=new Set(["absolute","fixed"]);function M_(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=t_(e),r=n_(e),i=n.visualViewport;let o=r.clientWidth,s=r.clientHeight,a=0,l=0;if(i){o=i.width,s=i.height;const e=y_();(!e||e&&"fixed"===t)&&(a=i.offsetLeft,l=i.offsetTop)}const c=F_(r);if(c<=0){const e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i="CSS1Compat"===e.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,s=Math.abs(r.clientWidth-t.clientWidth-i);s<=25&&(o-=s)}else c<=25&&(o+=c);return{width:o,height:s,x:a,y:l}}(e,n);else if("document"===t)r=function(e){const t=n_(e),n=w_(e),r=e.ownerDocument.body,i=Rv(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=Rv(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+F_(e);const a=-n.scrollTop;return"rtl"===x_(r).direction&&(s+=Rv(t.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:a}}(n_(e));else if(i_(t))r=function(e,t){const n=z_(e,!0,"fixed"===t),r=n.top+e.clientTop,i=n.left+e.clientLeft,o=o_(e)?N_(e):Iv(1);return{width:e.clientWidth*o.x,height:e.clientHeight*o.y,x:i*o.x,y:r*o.y}}(t,n);else{const n=I_(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Yv(r)}function $_(e,t){const n=j_(e);return!(n===t||!i_(n)||b_(n))&&("fixed"===x_(n).position||$_(n,t))}function U_(e,t,n){const r=o_(t),i=n_(t),o="fixed"===n,s=z_(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const l=Iv(0);function c(){l.x=F_(i)}if(r||!r&&!o)if(("body"!==e_(t)||l_(i))&&(a=w_(t)),r){const e=z_(t,!0,o,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else i&&c();o&&!r&&i&&c();const u=!i||r||o?Iv(0):D_(i,a);return{x:s.left+a.scrollLeft-l.x-u.x,y:s.top+a.scrollTop-l.y-u.y,width:s.width,height:s.height}}function B_(e){return"static"===x_(e).position}function Z_(e,t){if(!o_(e)||"fixed"===x_(e).position)return null;if(t)return t(e);let n=e.offsetParent;return n_(e)===n&&(n=n.ownerDocument.body),n}function q_(e,t){const n=t_(e);if(p_(e))return n;if(!o_(e)){let t=j_(e);for(;t&&!b_(t);){if(i_(t)&&!B_(t))return t;t=j_(t)}return n}let r=Z_(e,t);for(;r&&u_(r)&&B_(r);)r=Z_(r,t);return r&&b_(r)&&B_(r)&&!g_(r)?n:r||function(e){let t=j_(e);for(;o_(t)&&!b_(t);){if(g_(t))return t;if(p_(t))return null;t=j_(t)}return null}(e)||n}const H_={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const o="fixed"===i,s=n_(r),a=!!t&&p_(t.floating);if(r===s||a&&o)return n;let l={scrollLeft:0,scrollTop:0},c=Iv(1);const u=Iv(0),d=o_(r);if((d||!d&&!o)&&(("body"!==e_(r)||l_(s))&&(l=w_(r)),o_(r))){const e=z_(r);c=N_(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}const p=!s||d||o?Iv(0):D_(s,l);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+p.x,y:n.y*c.y-l.scrollTop*c.y+u.y+p.y}},getDocumentElement:n_,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const o=[..."clippingAncestors"===n?p_(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=k_(e,[],!1).filter(e=>i_(e)&&"body"!==e_(e)),i=null;const o="fixed"===x_(e).position;let s=o?j_(e):e;for(;i_(s)&&!b_(s);){const t=x_(s),n=g_(s);n||"fixed"!==t.position||(i=null),(o?!n&&!i:!n&&"static"===t.position&&i&&L_.has(i.position)||l_(s)&&!n&&$_(e,s))?r=r.filter(e=>e!==s):i=t,s=j_(s)}return t.set(e,r),r}(t,this._c):[].concat(n),r],s=o[0],a=o.reduce((e,n)=>{const r=M_(t,n,i);return e.top=Rv(r.top,e.top),e.right=Ov(r.right,e.right),e.bottom=Ov(r.bottom,e.bottom),e.left=Rv(r.left,e.left),e},M_(t,s,i));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},getOffsetParent:q_,getElementRects:async function(e){const t=this.getOffsetParent||q_,n=this.getDimensions,r=await n(e.floating);return{reference:U_(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=O_(e);return{width:t,height:n}},getScale:N_,isElement:i_,isRTL:function(e){return"rtl"===x_(e).direction}};function W_(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function G_(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:s="function"==typeof ResizeObserver,layoutShift:a="function"==typeof IntersectionObserver,animationFrame:l=!1}=r,c=R_(e),u=i||o?[...c?k_(c):[],...k_(t)]:[];u.forEach(e=>{i&&e.addEventListener("scroll",n,{passive:!0}),o&&e.addEventListener("resize",n)});const d=c&&a?function(e,t){let n,r=null;const i=n_(e);function o(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function s(a,l){void 0===a&&(a=!1),void 0===l&&(l=1),o();const c=e.getBoundingClientRect(),{left:u,top:d,width:p,height:h}=c;if(a||t(),!p||!h)return;const f={rootMargin:-Av(d)+"px "+-Av(i.clientWidth-(u+p))+"px "+-Av(i.clientHeight-(d+h))+"px "+-Av(u)+"px",threshold:Rv(0,Ov(1,l))||1};let m=!0;function g(t){const r=t[0].intersectionRatio;if(r!==l){if(!m)return s();r?s(!1,r):n=setTimeout(()=>{s(!1,1e-7)},1e3)}1!==r||W_(c,e.getBoundingClientRect())||s(),m=!1}try{r=new IntersectionObserver(g,{...f,root:i.ownerDocument})}catch(e){r=new IntersectionObserver(g,f)}r.observe(e)}(!0),o}(c,n):null;let p,h=-1,f=null;s&&(f=new ResizeObserver(e=>{let[r]=e;r&&r.target===c&&f&&(f.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var e;null==(e=f)||e.observe(t)})),n()}),c&&!l&&f.observe(c),f.observe(t));let m=l?z_(e):null;return l&&function t(){const r=z_(e);m&&!W_(m,r)&&n(),m=r,p=requestAnimationFrame(t)}(),n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener("scroll",n),o&&e.removeEventListener("resize",n)}),null==d||d(),null==(e=f)||e.disconnect(),f=null,l&&cancelAnimationFrame(p)}}const V_=E_,Q_=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:o,placement:s,middlewareData:a}=t,l=await async function(e,t){const{placement:n,platform:r,elements:i}=e,o=await(null==r.isRTL?void 0:r.isRTL(i.floating)),s=Mv(n),a=$v(n),l="y"===qv(n),c=P_.has(s)?-1:1,u=o&&l?-1:1,d=Lv(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==(n=a.offset)?void 0:n.placement)&&null!=(r=a.arrow)&&r.alignmentOffset?{}:{x:i+l.x,y:o+l.y,data:{...l,placement:s}}}}},K_=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i,platform:o}=t,{mainAxis:s=!0,crossAxis:a=!1,limiter:l={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...c}=Lv(e,t),u={x:n,y:r},d=await o.detectOverflow(t,c),p=qv(Mv(i)),h=Uv(p);let f=u[h],m=u[p];if(s){const e="y"===h?"bottom":"right";f=Dv(f+d["y"===h?"top":"left"],f,f-d[e])}if(a){const e="y"===p?"bottom":"right";m=Dv(m+d["y"===p?"top":"left"],m,m-d[e])}const g=l.fn({...t,[h]:f,[p]:m});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[h]:s,[p]:a}}}}}},J_=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;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}=Lv(e,t);if(null!=(n=o.arrow)&&n.alignmentOffset)return{};const y=Mv(i),v=qv(a),_=Mv(a)===a,b=await(null==l.isRTL?void 0:l.isRTL(c.floating)),x=p||(_||!m?[Jv(a)]:function(e){const t=Jv(e);return[Wv(e),t,Wv(t)]}(a)),w="none"!==f;!p&&w&&x.push(...function(e,t,n,r){const i=$v(e);let o=function(e,t,n){switch(e){case"top":case"bottom":return n?t?Vv:Gv:t?Gv:Vv;case"left":case"right":return t?Qv:Kv;default:return[]}}(Mv(e),"start"===n,r);return i&&(o=o.map(e=>e+"-"+i),t&&(o=o.concat(o.map(Wv)))),o}(a,m,f,b));const j=[a,...x],S=await l.detectOverflow(t,g),k=[];let C=(null==(r=o.flip)?void 0:r.overflows)||[];if(u&&k.push(S[y]),d){const e=function(e,t,n){void 0===n&&(n=!1);const r=$v(e),i=Hv(e),o=Bv(i);let s="x"===i?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=Jv(s)),[s,Jv(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||v===qv(t)||C.every(e=>qv(e.placement)!==v||e.overflows[0]>0)))return{data:{index:e,overflows:C},reset:{placement:t}};let n=null==(E=C.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:E.placement;if(!n)switch(h){case"bestFit":{var P;const e=null==(P=C.filter(e=>{if(w){const t=qv(e.placement);return t===v||"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&&(n=e);break}case"initialPlacement":n=a}if(i!==n)return{reset:{placement:n}}}return{}}}},Y_=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:i,rects:o,platform:s,elements:a}=t,{apply:l=()=>{},...c}=Lv(e,t),u=await s.detectOverflow(t,c),d=Mv(i),p=$v(i),h="y"===qv(i),{width:f,height:m}=o.floating;let g,y;"top"===d||"bottom"===d?(g=d,y=p===(await(null==s.isRTL?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(y=d,g="end"===p?"top":"bottom");const v=m-u.top-u.bottom,_=f-u.left-u.right,b=Ov(m-u[g],v),x=Ov(f-u[y],_),w=!t.middlewareData.shift;let j=b,S=x;if(null!=(n=t.middlewareData.shift)&&n.enabled.x&&(S=_),null!=(r=t.middlewareData.shift)&&r.enabled.y&&(j=v),w&&!p){const e=Rv(u.left,0),t=Rv(u.right,0),n=Rv(u.top,0),r=Rv(u.bottom,0);h?S=f-2*(0!==e||0!==t?e+t:Rv(u.left,u.right)):j=m-2*(0!==n||0!==r?n+r:Rv(u.top,u.bottom))}await l({...t,availableWidth:S,availableHeight:j});const k=await s.getDimensions(a.floating);return f!==k.width||m!==k.height?{reset:{rects:!0}}:{}}}},X_=(e,t,n)=>{const r=new Map,i={platform:H_,...n},o={...i.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=n,a=o.filter(Boolean),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}=T_(c,r,l),p=r,h={},f=0;for(let n=0;n<a.length;n++){var m;const{name:o,fn:g}=a[n],{x:y,y:v,data:_,reset:b}=await g({x:u,y:d,initialPlacement:r,placement:p,strategy:i,middlewareData:h,rects:c,platform:{...s,detectOverflow:null!=(m=s.detectOverflow)?m:E_},elements:{reference:e,floating:t}});u=null!=y?y:u,d=null!=v?v:d,h={...h,[o]:{...h[o],..._}},b&&f<=50&&(f++,"object"==typeof b&&(b.placement&&(p=b.placement),b.rects&&(c=!0===b.rects?await s.getElementRects({reference:e,floating:t,strategy:i}):b.rects),({x:u,y:d}=T_(c,p,l))),n=-1)}return{x:u,y:d,placement:p,strategy:i,middlewareData:h}})(e,t,{...i,platform:o})};var eb="undefined"!=typeof document?l.useLayoutEffect:function(){};function tb(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 n,r,i;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;0!==r--;)if(!tb(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;0!==r--;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;0!==r--;){const n=i[r];if(!("_owner"===n&&e.$$typeof||tb(e[n],t[n])))return!1}return!0}return e!=e&&t!=t}function nb(e){return"undefined"==typeof window?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function rb(e,t){const n=nb(e);return Math.round(t*n)/n}function ib(e){const t=l.useRef(e);return eb(()=>{t.current=e}),t}const ob=(e,t)=>({...Q_(e),options:[e,t]}),sb=(e,t)=>({...K_(e),options:[e,t]}),ab=(e,t)=>({...J_(e),options:[e,t]}),lb=(e,t)=>({...Y_(e),options:[e,t]}),cb={...c},ub=cb.useInsertionEffect||(e=>e());function db(e){const t=l.useRef(()=>{});return ub(()=>{t.current=e}),l.useCallback(function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return null==t.current?void 0:t.current(...n)},[])}var pb="undefined"!=typeof document?l.useLayoutEffect:l.useEffect;let hb=!1,fb=0;const mb=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+fb++,gb=cb.useId||function(){const[e,t]=l.useState(()=>hb?mb():void 0);return pb(()=>{null==e&&t(mb())},[]),l.useEffect(()=>{hb=!0},[]),e};const yb=l.createContext(null),vb=l.createContext(null),_b="data-floating-ui-focusable";function bb(e){void 0===e&&(e={});const{nodeId:t}=e,n=function(e){const{open:t=!1,onOpenChange:n,elements:r}=e,i=gb(),o=l.useRef({}),[s]=l.useState(()=>function(){const e=new Map;return{emit(t,n){var r;null==(r=e.get(t))||r.forEach(e=>e(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,(null==(r=e.get(t))?void 0:r.filter(e=>e!==n))||[])}}}()),a=null!=((null==(f=l.useContext(yb))?void 0:f.id)||null),[c,u]=l.useState(r.reference),d=db((e,t,r)=>{o.current.openEvent=e?t:void 0,s.emit("openchange",{open:e,event:t,reason:r,nested:a}),null==n||n(e,t,r)}),p=l.useMemo(()=>({setPositionReference:u}),[]),h=l.useMemo(()=>({reference:c||r.reference||null,floating:r.floating||null,domReference:r.reference}),[c,r.reference,r.floating]);var f;return l.useMemo(()=>({dataRef:o,open:t,onOpenChange:d,elements:h,events:s,floatingId:i,refs:p}),[t,d,h,s,i,p])}({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,i=r.elements,[o,s]=l.useState(null),[a,c]=l.useState(null),u=(null==i?void 0:i.domReference)||o,d=l.useRef(null),p=l.useContext(vb);pb(()=>{u&&(d.current=u)},[u]);const h=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:o,floating:s}={},transform:a=!0,whileElementsMounted:c,open:u}=e,[d,p]=l.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,f]=l.useState(r);tb(h,r)||f(r);const[m,g]=l.useState(null),[y,v]=l.useState(null),_=l.useCallback(e=>{e!==j.current&&(j.current=e,g(e))},[]),b=l.useCallback(e=>{e!==S.current&&(S.current=e,v(e))},[]),x=o||m,w=s||y,j=l.useRef(null),S=l.useRef(null),k=l.useRef(d),C=null!=c,T=ib(c),E=ib(i),P=ib(u),O=l.useCallback(()=>{if(!j.current||!S.current)return;const e={placement:t,strategy:n,middleware:h};E.current&&(e.platform=E.current),X_(j.current,S.current,e).then(e=>{const t={...e,isPositioned:!1!==P.current};R.current&&!tb(k.current,t)&&(k.current=t,Bp.flushSync(()=>{p(t)}))})},[h,t,n,E,P]);eb(()=>{!1===u&&k.current.isPositioned&&(k.current.isPositioned=!1,p(e=>({...e,isPositioned:!1})))},[u]);const R=l.useRef(!1);eb(()=>(R.current=!0,()=>{R.current=!1}),[]),eb(()=>{if(x&&(j.current=x),w&&(S.current=w),x&&w){if(T.current)return T.current(x,w,O);O()}},[x,w,O,T,C]);const N=l.useMemo(()=>({reference:j,floating:S,setReference:_,setFloating:b}),[_,b]),A=l.useMemo(()=>({reference:x,floating:w}),[x,w]),I=l.useMemo(()=>{const e={position:n,left:0,top:0};if(!A.floating)return e;const t=rb(A.floating,d.x),r=rb(A.floating,d.y);return a?{...e,transform:"translate("+t+"px, "+r+"px)",...nb(A.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:r}},[n,a,A.floating,d.x,d.y]);return l.useMemo(()=>({...d,update:O,refs:N,elements:A,floatingStyles:I}),[d,O,N,A,I])}({...e,elements:{...i,...a&&{reference:a}}}),f=l.useCallback(e=>{const t=i_(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;c(t),h.refs.setReference(t)},[h.refs]),m=l.useCallback(e=>{(i_(e)||null===e)&&(d.current=e,s(e)),(i_(h.refs.reference.current)||null===h.refs.reference.current||null!==e&&!i_(e))&&h.refs.setReference(e)},[h.refs]),g=l.useMemo(()=>({...h.refs,setReference:m,setPositionReference:f,domReference:d}),[h.refs,m,f]),y=l.useMemo(()=>({...h.elements,domReference:u}),[h.elements,u]),v=l.useMemo(()=>({...h,...r,refs:g,elements:y,nodeId:t}),[h,g,y,t,r]);return pb(()=>{r.dataRef.current.floatingContext=v;const e=null==p?void 0:p.nodesRef.current.find(e=>e.id===t);e&&(e.context=v)}),l.useMemo(()=>({...h,context:v,refs:g,elements:y}),[h,g,y,v])}const xb="active",wb="selected";function jb(e,t,n){const r=new Map,i="item"===n;let o=e;if(i&&e){const{[xb]:t,[wb]:__,...n}=e;o=n}return{..."floating"===n&&{tabIndex:-1,[_b]:""},...o,...t.map(t=>{const r=t?t[n]:null;return"function"==typeof r?e?r(e):null:r}).concat(e).reduce((e,t)=>t?(Object.entries(t).forEach(t=>{let[n,o]=t;var s;i&&[xb,wb].includes(n)||(0===n.indexOf("on")?(r.has(n)||r.set(n,[]),"function"==typeof o&&(null==(s=r.get(n))||s.push(o),e[n]=function(){for(var e,t=arguments.length,i=new Array(t),o=0;o<t;o++)i[o]=arguments[o];return null==(e=r.get(n))?void 0:e.map(e=>e(...i)).find(e=>void 0!==e)})):e[n]=o)}),e):e,{})}}function Sb(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}let kb=(0,l.createContext)({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});kb.displayName="FloatingContext";let Cb=(0,l.createContext)(null);function Tb({children:e,enabled:t=!0}){let[n,r]=(0,l.useState)(null),[i,o]=(0,l.useState)(0),s=(0,l.useRef)(null),[a,c]=(0,l.useState)(null);!function(e){Qg(()=>{if(!e)return;let t=new MutationObserver(()=>{let t=window.getComputedStyle(e).maxHeight,n=parseFloat(t);if(isNaN(n))return;let r=parseInt(t);isNaN(r)||n!==r&&(e.style.maxHeight=`${Math.ceil(n)}px`)});return t.observe(e,{attributes:!0,attributeFilter:["style"]}),()=>{t.disconnect()}},[e])}(a);let u=t&&null!==n&&null!==a,{to:d="bottom",gap:p=0,offset:h=0,padding:f=0,inner:m}=function(e,t){var n,r,i;let o=Eb(null!=(n=null==e?void 0:e.gap)?n:"var(--anchor-gap, 0)",t),s=Eb(null!=(r=null==e?void 0:e.offset)?r:"var(--anchor-offset, 0)",t),a=Eb(null!=(i=null==e?void 0:e.padding)?i:"var(--anchor-padding, 0)",t);return{...e,gap:o,offset:s,padding:a}}(n,a),[g,y="center"]=d.split(" ");Qg(()=>{u&&o(0)},[u]);let{refs:v,floatingStyles:_,context:b}=bb({open:u,placement:"selection"===g?"center"===y?"bottom":`bottom-${y}`:"center"===y?`${g}`:`${g}-${y}`,strategy:"absolute",transform:!1,middleware:[ob({mainAxis:"selection"===g?0:p,crossAxis:h}),sb({padding:f}),"selection"!==g&&ab({padding:f}),"selection"===g&&m?(j={...m,padding:f,overflowRef:s,offset:i,minItemsVisible:4,referenceOverflowThreshold:f,onFallbackChange(e){var t,n;if(!e)return;let r=b.elements.floating;if(!r)return;let i=parseFloat(getComputedStyle(r).scrollPaddingBottom)||0,s=Math.min(4,r.childElementCount),a=0,l=0;for(let e of null!=(n=null==(t=b.elements.floating)?void 0:t.childNodes)?n:[])if(ny(e)){let t=e.offsetTop,n=t+e.clientHeight+i,o=r.scrollTop,c=o+r.clientHeight;if(!(t>=o&&n<=c)){l=Math.max(0,Math.min(n,c)-Math.max(t,o)),a=e.clientHeight;break}s--}s>=1&&o(e=>{let t=a*s-l+i;return e>=t?e:t})}},{name:"inner",options:j,async fn(e){const{listRef:t,overflowRef:n,onFallbackChange:r,offset:i=0,index:o=0,minItemsVisible:s=4,referenceOverflowThreshold:a=0,scrollRef:l,...c}=Lv(j,e),{rects:u,elements:{floating:d}}=e,p=t.current[o],h=(null==l?void 0:l.current)||d,f=d.clientTop||h.clientTop,m=0!==d.clientTop,g=0!==h.clientTop,y=d===h;if(!p)return{};const v={...e,...await ob(-p.offsetTop-d.clientTop-u.reference.height/2-p.offsetHeight/2-i).fn(e)},_=await V_(Sb(v,h.scrollHeight+f+d.clientTop),c),b=await V_(v,{...c,elementContext:"reference"}),x=Rv(0,_.top),w=v.y+x,S=h.scrollHeight>h.clientHeight?e=>e:Nv,k=S(Rv(0,h.scrollHeight+(m&&y||g?2*f:0)-x-Rv(0,_.bottom)));if(h.style.maxHeight=k+"px",h.scrollTop=x,r){const e=h.offsetHeight<p.offsetHeight*Ov(s,t.current.length)-1||b.top>=-a||b.bottom>=-a;Bp.flushSync(()=>r(e))}return n&&(n.current=await V_(Sb({...v,y:w},h.offsetHeight+f+d.clientTop),c)),{y:w}}}):null,lb({padding:f,apply({availableWidth:e,availableHeight:t,elements:n}){Object.assign(n.floating.style,{overflow:"auto",maxWidth:`${e}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${t}px)`})}})].filter(Boolean),whileElementsMounted:G_}),[x=g,w=y]=b.placement.split("-");var j;"selection"===g&&(x="selection");let S=(0,l.useMemo)(()=>({anchor:[x,w].filter(Boolean).join(" ")}),[x,w]),k=function(e,t){const{open:n,elements:r}=e,{enabled:i=!0,overflowRef:o,scrollRef:s,onChange:a}=t,c=db(a),u=l.useRef(!1),d=l.useRef(null),p=l.useRef(null);l.useEffect(()=>{if(!i)return;function e(e){if(e.ctrlKey||!t||null==o.current)return;const n=e.deltaY,r=o.current.top>=-.5,i=o.current.bottom>=-.5,s=t.scrollHeight-t.clientHeight,a=n<0?-1:1,l=n<0?"max":"min";t.scrollHeight<=t.clientHeight||(!r&&n>0||!i&&n<0?(e.preventDefault(),Bp.flushSync(()=>{c(e=>e+Math[l](n,s*a))})):/firefox/i.test(function(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(e=>{let{brand:t,version:n}=e;return t+"/"+n}).join(" "):navigator.userAgent}())&&(t.scrollTop+=n))}const t=(null==s?void 0:s.current)||r.floating;return n&&t?(t.addEventListener("wheel",e),requestAnimationFrame(()=>{d.current=t.scrollTop,null!=o.current&&(p.current={...o.current})}),()=>{d.current=null,p.current=null,t.removeEventListener("wheel",e)}):void 0},[i,n,r.floating,o,s,c]);const h=l.useMemo(()=>({onKeyDown(){u.current=!0},onWheel(){u.current=!1},onPointerMove(){u.current=!1},onScroll(){const e=(null==s?void 0:s.current)||r.floating;if(o.current&&e&&u.current){if(null!==d.current){const t=e.scrollTop-d.current;(o.current.bottom<-.5&&t<-1||o.current.top<-.5&&t>1)&&Bp.flushSync(()=>c(e=>e+t))}requestAnimationFrame(()=>{d.current=e.scrollTop})}}}),[r.floating,c,o,s]);return l.useMemo(()=>i?{floating:h}:{},[i,h])}(b,{overflowRef:s,onChange:o}),{getReferenceProps:C,getFloatingProps:T}=function(e){void 0===e&&(e=[]);const t=e.map(e=>null==e?void 0:e.reference),n=e.map(e=>null==e?void 0:e.floating),r=e.map(e=>null==e?void 0:e.item),i=l.useCallback(t=>jb(t,e,"reference"),t),o=l.useCallback(t=>jb(t,e,"floating"),n),s=l.useCallback(t=>jb(t,e,"item"),r);return l.useMemo(()=>({getReferenceProps:i,getFloatingProps:o,getItemProps:s}),[i,o,s])}([k]),E=Jg(e=>{c(e),v.setFloating(e)});return l.createElement(Cb.Provider,{value:r},l.createElement(kb.Provider,{value:{setFloating:E,setReference:v.setReference,styles:_,getReferenceProps:C,getFloatingProps:T,slot:S}},e))}function Eb(e,t,n=void 0){let r=Vg(),i=Jg((e,t)=>{if(null==e)return[n,null];if("number"==typeof e)return[e,null];if("string"==typeof e){if(!t)return[n,null];let i=Ob(e,t);return[i,n=>{let o=Pb(e);{let s=o.map(e=>window.getComputedStyle(t).getPropertyValue(e));r.requestAnimationFrame(function a(){r.nextFrame(a);let l=!1;for(let[e,n]of o.entries()){let r=window.getComputedStyle(t).getPropertyValue(n);if(s[e]!==r){s[e]=r,l=!0;break}}if(!l)return;let c=Ob(e,t);i!==c&&(n(c),i=c)})}return r.dispose}]}return[n,null]}),o=(0,l.useMemo)(()=>i(e,t)[0],[e,t]),[s=o,a]=(0,l.useState)();return Qg(()=>{let[n,r]=i(e,t);if(a(n),r)return r(a)},[e,t]),s}function Pb(e){let t=/var\((.*)\)/.exec(e);if(t){let e=t[1].indexOf(",");if(-1===e)return[t[1]];let n=t[1].slice(0,e).trim(),r=t[1].slice(e+1).trim();return r?[n,...Pb(r)]:[n]}return[]}function Ob(e,t){let n=document.createElement("div");t.appendChild(n),n.style.setProperty("margin-top","0px","important"),n.style.setProperty("margin-top",e,"important");let r=parseFloat(window.getComputedStyle(n).marginTop)||0;return t.removeChild(n),r}Cb.displayName="PlacementContext";let Rb=(0,l.createContext)(null);Rb.displayName="OpenClosedContext";var Nb=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(Nb||{});function Ab(){return(0,l.useContext)(Rb)}function Ib({value:e,children:t}){return l.createElement(Rb.Provider,{value:e},t)}function zb({children:e}){return l.createElement(Rb.Provider,{value:null},e)}function Fb(e){let t=e.parentElement,n=null;for(;t&&!iy(t);)oy(t)&&(n=t),t=t.parentElement;let r=""===(null==t?void 0:t.getAttribute("disabled"));return(!r||!function(e){if(!e)return!1;let t=e.previousElementSibling;for(;null!==t;){if(oy(t))return!1;t=t.previousElementSibling}return!0}(n))&&r}var Db=(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))(Db||{});function Lb(e){let t=Jg(e),n=(0,l.useRef)(!1);(0,l.useEffect)(()=>(n.current=!1,()=>{n.current=!0,Wg(()=>{n.current&&t()})}),[t])}let Mb=(0,l.createContext)(!1);let $b=l.Fragment,Ub=Iy(function(e,t){let{ownerDocument:n=null,...r}=e,i=(0,l.useRef)(null),o=bv(_v(e=>{i.current=e}),t),s=Sy(i.current),a=function(e){let t=(0,l.useContext)(Mb),n=(0,l.useContext)(Zb),[r,i]=(0,l.useState)(()=>{var r;if(!t&&null!==n)return null!=(r=n.current)?r:null;if(Bg.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,l.useEffect)(()=>{null!==r&&(null!=e&&e.body.contains(r)||null==e||e.body.appendChild(r))},[r,e]),(0,l.useEffect)(()=>{t||null!==n&&i(n.current)},[n,i,t]),r}(null!=n?n:s),c=(0,l.useContext)(qb),u=Vg(),d=Py();return Lb(()=>{var e;a&&a.childNodes.length<=0&&(null==(e=a.parentElement)||e.removeChild(a))}),a?(0,Bp.createPortal)(l.createElement("div",{"data-headlessui-portal":"",ref:e=>{u.dispose(),c&&e&&u.add(c.register(e))}},d({ourProps:{ref:o},theirProps:r,slot:{},defaultTag:$b,name:"Portal"})),a):null}),Bb=l.Fragment,Zb=(0,l.createContext)(null),qb=(0,l.createContext)(null),Hb=Iy(function(e,t){let n=bv(t),{enabled:r=!0,ownerDocument:i,...o}=e,s=Py();return r?l.createElement(Ub,{...o,ownerDocument:i,ref:n}):s({ourProps:{ref:n},theirProps:o,slot:{},defaultTag:$b,name:"Portal"})}),Wb=Iy(function(e,t){let{target:n,...r}=e,i={ref:bv(t)},o=Py();return l.createElement(Zb.Provider,{value:n},o({ourProps:i,theirProps:r,defaultTag:Bb,name:"Popover.Group"}))}),Gb=Object.assign(Hb,{Group:Wb});var Vb=Object.defineProperty,Qb=(e,t,n)=>(((e,t,n)=>{t in e?Vb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n),Kb=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Kb||{}),Jb=(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))(Jb||{});let Yb={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 Xb extends iv{constructor(e){super(e),Qb(this,"actions",{close:()=>this.send({type:1}),refocusableClose:e=>{this.actions.close();let t=(()=>e?ny(e)?e:"current"in e&&ny(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})}),Qb(this,"selectors",{isPortalled:e=>{var t;if(!e.button||!e.panel)return!1;let n=null!=(t=Zg(e.button))?t:document;for(let t of n.querySelectorAll("body > *"))if(Number(null==t?void 0:t.contains(e.button))^Number(null==t?void 0:t.contains(e.panel)))return!0;let r=hy(n),i=r.indexOf(e.button),o=(i+r.length-1)%r.length,s=(i+1)%r.length,a=r[o],l=r[s];return!e.panel.contains(a)&&!e.panel.contains(l)}});{let e=this.state.id,t=hv.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 Xb({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 sy(t.type,Yb,e,t)}}const ex=(0,l.createContext)(null);function tx(e){let t=(0,l.useContext)(ex);if(null===t){let t=new Error(`<${e} /> is missing a parent <Popover /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,tx),t}return t}let nx=(0,l.createContext)(null);function rx(){return(0,l.useContext)(nx)}nx.displayName="PopoverGroupContext";let ix=(0,l.createContext)(null);ix.displayName="PopoverPanelContext";let ox=Ty.RenderStrategy|Ty.Static;function sx(e,t){let n=(0,l.useId)(),{id:r=`headlessui-popover-backdrop-${n}`,transition:i=!1,...o}=e,s=tx("Popover.Backdrop"),a=mv(s,(0,l.useCallback)(e=>e.popoverState,[])),[c,u]=(0,l.useState)(null),d=bv(t,u),p=Ab(),[h,f]=Tv(i,c,null!==p?(p&Nb.Open)===Nb.Open:a===Kb.Open),m=Jg(e=>{if(Fb(e.currentTarget))return e.preventDefault();s.actions.close()}),g=yv({open:a===Kb.Open}),y={ref:d,id:r,"aria-hidden":!0,onClick:m,...Cv(f)};return Py()({ourProps:y,theirProps:o,slot:g,defaultTag:"div",features:ox,visible:h,name:"Popover.Backdrop"})}let ax=Ty.RenderStrategy|Ty.Static,lx=Iy(function(e,t){var n;let r=(0,l.useId)(),{__demoMode:i=!1,...o}=e,s=function({id:e,__demoMode:t=!1}){let n=(0,l.useMemo)(()=>Xb.new({id:e,__demoMode:t}),[]);return Lb(()=>n.dispose()),n}({id:r,__demoMode:i}),a=(0,l.useRef)(null),c=bv(t,_v(e=>{a.current=e})),[u,d,p,h,f]=mv(s,(0,l.useCallback)(e=>[e.popoverState,e.button,e.panel,e.buttonId,e.panelId],[])),m=function(...e){return(0,l.useMemo)(()=>qg(...e),[...e])}(null!=(n=a.current)?n:d),g=Kg(h),y=Kg(f),v=(0,l.useMemo)(()=>({buttonId:g,panelId:y,close:s.actions.close}),[g,y,s]),_=rx(),b=null==_?void 0:_.registerPopover,x=Jg(()=>{var e,t;let n=Hg(null!=(e=a.current)?e:d);return null!=(t=null==_?void 0:_.isFocusWithinPopoverGroup())?t:n&&((null==d?void 0:d.contains(n))||(null==p?void 0:p.contains(n)))});(0,l.useEffect)(()=>null==b?void 0:b(v),[b,v]);let[w,j]=function(){let e=(0,l.useContext)(qb),t=(0,l.useRef)([]),n=Jg(n=>(t.current.push(n),e&&e.register(n),()=>r(n))),r=Jg(n=>{let r=t.current.indexOf(n);-1!==r&&t.current.splice(r,1),e&&e.unregister(n)}),i=(0,l.useMemo)(()=>({register:n,unregister:r,portals:t}),[n,r,t]);return[t,(0,l.useMemo)(()=>function({children:e}){return l.createElement(qb.Provider,{value:i},e)},[i])]}(),S=Zy(d),k=function({defaultContainers:e=[],portals:t,mainTreeNode:n}={}){let r=Jg(()=>{var r,i;let o=Zg(n),s=[];for(let t of e)null!==t&&(ty(t)?s.push(t):"current"in t&&ty(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!=(r=null==o?void 0:o.querySelectorAll("html > *, body > *"))?r:[])e!==document.body&&e!==document.head&&ty(e)&&"headlessui-portal-root"!==e.id&&(n&&(e.contains(n)||e.contains(null==(i=null==n?void 0:n.getRootNode())?void 0:i.host))||s.some(t=>e.contains(t))||s.push(e));return s});return{resolveContainers:r,contains:Jg(e=>r().some(t=>t.contains(e)))}}({mainTreeNode:S,portals:w,defaultContainers:[{get current(){return s.state.button}},{get current(){return s.state.panel}}]});!function(e,t,n,r){let i=Kg(n);(0,l.useEffect)(()=>{function n(e){i.current(e)}return(e=null!=e?e:window).addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)},[e,t,r])}(m,"focus",e=>{var t,n,r,i,o,a;e.target!==window&&ry(e.target)&&s.state.popoverState===Kb.Open&&(x()||s.state.button&&s.state.panel&&(k.contains(e.target)||null!=(n=null==(t=s.state.beforePanelSentinel.current)?void 0:t.contains)&&n.call(t,e.target)||null!=(i=null==(r=s.state.afterPanelSentinel.current)?void 0:r.contains)&&i.call(r,e.target)||null!=(a=null==(o=s.state.afterButtonSentinel.current)?void 0:o.contains)&&a.call(o,e.target)||s.actions.close()))},!0),jy(u===Kb.Open,k.resolveContainers,(e,t)=>{s.actions.close(),my(t,fy.Loose)||(e.preventDefault(),null==d||d.focus())});let C=yv({open:u===Kb.Open,close:s.actions.refocusableClose}),T=mv(s,(0,l.useCallback)(e=>sy(e.popoverState,{[Kb.Open]:Nb.Open,[Kb.Closed]:Nb.Closed}),[])),E={ref:c},P=Py();return l.createElement(By,{node:S},l.createElement(Tb,null,l.createElement(ix.Provider,{value:null},l.createElement(ex.Provider,{value:s},l.createElement(Pv,{value:s.actions.refocusableClose},l.createElement(Ib,{value:T},l.createElement(j,null,P({ourProps:E,theirProps:o,slot:C,defaultTag:"div",name:"Popover"}))))))))}),cx=Iy(function(e,t){let n=(0,l.useId)(),{id:r=`headlessui-popover-button-${n}`,disabled:i=!1,autoFocus:o=!1,...s}=e,a=tx("Popover.Button"),[c,u,d,p,h,f,m]=mv(a,(0,l.useCallback)(e=>[e.popoverState,a.selectors.isPortalled(e),e.button,e.buttonId,e.panel,e.panelId,e.afterButtonSentinel],[])),g=(0,l.useRef)(null),y=`headlessui-focus-sentinel-${(0,l.useId)()}`,v=rx(),_=null==v?void 0:v.closeOthers,b=null!==(0,l.useContext)(ix);(0,l.useEffect)(()=>{if(!b)return a.actions.setButtonId(r),()=>a.actions.setButtonId(null)},[b,r,a]);let[x]=(0,l.useState)(()=>Symbol()),w=bv(g,t,(0,l.useContext)(kb).setReference,Jg(e=>{if(!b){if(e)a.state.buttons.current.push(x);else{let e=a.state.buttons.current.indexOf(x);-1!==e&&a.state.buttons.current.splice(e,1)}a.state.buttons.current.length>1&&console.warn("You are already using a <Popover.Button /> but only 1 <Popover.Button /> is supported."),e&&a.actions.setButton(e)}})),j=bv(g,t),S=Jg(e=>{var t,n,r;if(b){if(a.state.popoverState===Kb.Closed)return;switch(e.key){case Db.Space:case Db.Enter:e.preventDefault(),null==(n=(t=e.target).click)||n.call(t),a.actions.close(),null==(r=a.state.button)||r.focus()}}else switch(e.key){case Db.Space:case Db.Enter:e.preventDefault(),e.stopPropagation(),a.state.popoverState===Kb.Closed?(null==_||_(a.state.buttonId),a.actions.open()):a.actions.close();break;case Db.Escape:if(a.state.popoverState!==Kb.Open)return null==_?void 0:_(a.state.buttonId);if(!g.current)return;let t=Hg(g.current);if(t&&!g.current.contains(t))return;e.preventDefault(),e.stopPropagation(),a.actions.close()}}),k=Jg(e=>{b||e.key===Db.Space&&e.preventDefault()}),C=Jg(e=>{var t,n;Fb(e.currentTarget)||i||(b?(a.actions.close(),null==(t=a.state.button)||t.focus()):(e.preventDefault(),e.stopPropagation(),a.state.popoverState===Kb.Closed?(null==_||_(a.state.buttonId),a.actions.open()):a.actions.close(),null==(n=a.state.button)||n.focus()))}),T=Jg(e=>{e.preventDefault(),e.stopPropagation()}),{isFocusVisible:E,focusProps:P}=Ig({autoFocus:o}),{isHovered:O,hoverProps:R}=Mg({isDisabled:i}),{pressed:N,pressProps:A}=Yg({disabled:i}),I=c===Kb.Open,z=yv({open:I,active:N||I,disabled:i,hover:O,focus:E,autofocus:o}),F=function(e,t){return(0,l.useMemo)(()=>{var n;if(e.type)return e.type;let r=null!=(n=e.as)?n:"button";return"string"==typeof r&&"button"===r.toLowerCase()||"BUTTON"===(null==t?void 0:t.tagName)&&!t.hasAttribute("type")?"button":void 0},[e.type,e.as,t])}(e,d),D=Ay(b?{ref:j,type:F,onKeyDown:S,onClick:C,disabled:i||void 0,autoFocus:o}:{ref:w,id:p,type:F,"aria-expanded":c===Kb.Open,"aria-controls":h?f:void 0,disabled:i||void 0,autoFocus:o,onKeyDown:S,onKeyUp:k,onClick:C,onMouseDown:T},P,R,A),L=Sv(),M=Jg(()=>{if(!ny(a.state.panel))return;let e=a.state.panel;sy(L.current,{[jv.Forwards]:()=>vy(e,uy.First),[jv.Backwards]:()=>vy(e,uy.Last)})===dy.Error&&vy(hy(qg(a.state.button)).filter(e=>"true"!==e.dataset.headlessuiFocusGuard),sy(L.current,{[jv.Forwards]:uy.Next,[jv.Backwards]:uy.Previous}),{relativeTo:a.state.button})}),$=Py();return l.createElement(l.Fragment,null,$({ourProps:D,theirProps:s,slot:z,defaultTag:"button",name:"Popover.Button"}),I&&!b&&u&&l.createElement($y,{id:y,ref:m,features:My.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:M}))}),ux=Iy(sx),dx=Iy(sx),px=Iy(function(e,t){let n=(0,l.useId)(),{id:r=`headlessui-popover-panel-${n}`,focus:i=!1,anchor:o,portal:s=!1,modal:a=!1,transition:c=!1,...u}=e,d=tx("Popover.Panel"),p=mv(d,d.selectors.isPortalled),[h,f,m,g,y]=mv(d,(0,l.useCallback)(e=>[e.popoverState,e.button,e.__demoMode,e.beforePanelSentinel,e.afterPanelSentinel],[])),v=`headlessui-focus-sentinel-before-${n}`,_=`headlessui-focus-sentinel-after-${n}`,b=(0,l.useRef)(null),x=function(e){return(0,l.useMemo)(()=>e?"string"==typeof e?{to:e}:e:null,[e])}(o),[w,j]=function(e=null){!1===e&&(e=null),"string"==typeof e&&(e={to:e});let t=(0,l.useContext)(Cb),n=(0,l.useMemo)(()=>e,[JSON.stringify(e,(e,t)=>{var n;return null!=(n=null==t?void 0:t.outerHTML)?n:t})]);Qg(()=>{null==t||t(null!=n?n:null)},[t,n]);let r=(0,l.useContext)(kb);return(0,l.useMemo)(()=>[r.setFloating,e?r.styles:{}],[r.setFloating,e,r.styles])}(x),S=function(){let{getFloatingProps:e,slot:t}=(0,l.useContext)(kb);return(0,l.useCallback)((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}();x&&(s=!0);let[k,C]=(0,l.useState)(null),T=bv(b,t,x?w:null,d.actions.setPanel,C),E=Sy(f),P=Sy(b.current);Qg(()=>(d.actions.setPanelId(r),()=>d.actions.setPanelId(null)),[r,d]);let O=Ab(),[R,N]=Tv(c,k,null!==O?(O&Nb.Open)===Nb.Open:h===Kb.Open);(function(e,t,n){let r=Kg(e=>{let t=e.getBoundingClientRect();0===t.x&&0===t.y&&0===t.width&&0===t.height&&n()});(0,l.useEffect)(()=>{if(!e)return;let n=null===t?null:ny(t)?t:t.current;if(!n)return;let i=Gg();if("undefined"!=typeof ResizeObserver){let e=new ResizeObserver(()=>r.current(n));e.observe(n),i.add(()=>e.disconnect())}if("undefined"!=typeof IntersectionObserver){let e=new IntersectionObserver(()=>r.current(n));e.observe(n),i.add(()=>e.disconnect())}return()=>i.dispose()},[t,r,e])})(R,f,d.actions.close),function(e,t,n=()=>[document.body]){let r=function(e){let t=(0,l.useId)(),n=hv.get("scroll-lock"),[r,i]=mv(n,(0,l.useCallback)(e=>[n.selectors.isTop(e,t),n.selectors.inStack(e,t)],[n,t]));return Qg(()=>{if(e)return n.actions.push(t),()=>n.actions.pop(t)},[n,e,t]),!!e&&(!i||r)}(e);Vy(r,t,e=>{var t;return{containers:[...null!=(t=e.containers)?t:[],n]}})}(!m&&a&&R,P);let A=Jg(e=>{var t;if(e.key===Db.Escape){if(d.state.popoverState!==Kb.Open||!b.current)return;let n=Hg(b.current);if(n&&!b.current.contains(n))return;e.preventDefault(),e.stopPropagation(),d.actions.close(),null==(t=d.state.button)||t.focus()}});(0,l.useEffect)(()=>{var t;e.static||h===Kb.Closed&&(null==(t=e.unmount)||t)&&d.actions.setPanel(null)},[h,e.unmount,e.static,d]),(0,l.useEffect)(()=>{if(m||!i||h!==Kb.Open||!b.current)return;let e=Hg(b.current);b.current.contains(e)||vy(b.current,uy.First)},[m,i,b.current,h]);let I=yv({open:h===Kb.Open,close:d.actions.refocusableClose}),z=Ay(x?S():{},{ref:T,id:r,onKeyDown:A,onBlur:i&&h===Kb.Open?e=>{var t,n,r,i,o;let s=e.relatedTarget;s&&b.current&&(null!=(t=b.current)&&t.contains(s)||(d.actions.close(),(null!=(r=null==(n=g.current)?void 0:n.contains)&&r.call(n,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":ey(R,f,!0).width},...Cv(N)}),F=Sv(),D=Jg(()=>{let e=b.current;e&&sy(F.current,{[jv.Forwards]:()=>{var t;vy(e,uy.First)===dy.Error&&(null==(t=d.state.afterPanelSentinel.current)||t.focus())},[jv.Backwards]:()=>{var e;null==(e=d.state.button)||e.focus({preventScroll:!0})}})}),L=Jg(()=>{let e=b.current;e&&sy(F.current,{[jv.Forwards]:()=>{var e;if(!d.state.button)return;let t=hy(null!=(e=qg(d.state.button))?e:document.body),n=t.indexOf(d.state.button),r=t.slice(0,n+1),i=[...t.slice(n+1),...r];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)}vy(i,uy.First,{sorted:!1})},[jv.Backwards]:()=>{var t;vy(e,uy.Previous)===dy.Error&&(null==(t=d.state.button)||t.focus())}})}),M=Py();return l.createElement(zb,null,l.createElement(ix.Provider,{value:r},l.createElement(Pv,{value:d.actions.refocusableClose},l.createElement(Gb,{enabled:!!s&&(e.static||R),ownerDocument:E},R&&p&&l.createElement($y,{id:v,ref:g,features:My.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:D}),M({ourProps:z,theirProps:u,slot:I,defaultTag:"div",features:ax,visible:R,name:"Popover.Panel"}),R&&p&&l.createElement($y,{id:_,ref:y,features:My.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:L})))))}),hx=Iy(function(e,t){let n=(0,l.useRef)(null),r=bv(n,t),[i,o]=(0,l.useState)([]),s=Jg(e=>{o(t=>{let n=t.indexOf(e);if(-1!==n){let e=t.slice();return e.splice(n,1),e}return t})}),a=Jg(e=>(o(t=>[...t,e]),()=>s(e))),c=Jg(()=>{var e;let t=qg(n.current);if(!t)return!1;let r=Hg(n.current);return!(null==(e=n.current)||!e.contains(r))||i.some(e=>{var n,i;return(null==(n=t.getElementById(e.buttonId.current))?void 0:n.contains(r))||(null==(i=t.getElementById(e.panelId.current))?void 0:i.contains(r))})}),u=Jg(e=>{for(let t of i)t.buttonId.current!==e&&t.close()}),d=(0,l.useMemo)(()=>({registerPopover:a,unregisterPopover:s,isFocusWithinPopoverGroup:c,closeOthers:u}),[a,s,c,u]),p=yv({}),h=e,f={ref:r},m=Py();return l.createElement(By,null,l.createElement(nx.Provider,{value:d},m({ourProps:f,theirProps:h,slot:p,defaultTag:"div",name:"Popover.Group"})))}),fx=Object.assign(lx,{Button:cx,Backdrop:dx,Overlay:ux,Panel:px,Group:hx}),mx=(0,l.createContext)(void 0),gx=Iy(function(e,t){var n;let r=(0,l.useContext)(mx),{disabled:i=r||!1,autoFocus:o=!1,...s}=e,{isFocusVisible:a,focusProps:c}=Ig({autoFocus:o}),{isHovered:u,hoverProps:d}=Mg({isDisabled:i}),{pressed:p,pressProps:h}=Yg({disabled:i}),f=Ay({ref:t,type:null!=(n=s.type)?n:"button",disabled:i||void 0,autoFocus:o},c,d,h),m=yv({disabled:i,hover:u,focus:a,active:p,autofocus:o});return Py()({ourProps:f,theirProps:s,slot:m,defaultTag:"button",name:"Button"})}),yx=Iy(function(e,t){let n=(0,l.useContext)(Ev);return l.createElement(gx,{ref:t,...Ay({onClick:n},e)})});function vx(e){const{options:t,disabled:n=!1,title:r,selected:i}=e;return(0,d.jsxs)(fx,{className:y("wpl-dropdownbutton",t.length<=1?"wpl-dropdownbutton__single":null),children:[(0,d.jsx)("button",{onClick:function(n){n.preventDefault();const r=i||t[0]?.value;r&&e.onSelect(r)},type:"button",className:y("wpl-dropdownbutton__main",n&&"wpl-dropdownbutton__disabled"),children:(0,d.jsx)("h5",{children:r})}),t.length>1&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(cx,{disabled:n,className:y("wpl-dropdownbutton","wpl-popover__toggle",n&&"wpl-dropdownbutton__disabled"),children:(0,d.jsx)(Hf,{})}),(0,d.jsx)(px,{anchor:"bottom start",className:"wpl-dropdownbutton__popover wpl-popover wpl-popover__content",children:({close:n})=>(0,d.jsx)("ul",{children:t.map(({label:t,value:r,description:o})=>(0,d.jsxs)("li",{className:y({"wpl-dropdownbutton__item":!0,["wpl-dropdownbutton__"+r]:!0,"wpl-dropdownbutton__selected":i===r}),children:[i===r?(0,d.jsx)("span",{className:"wpl-dropdownbutton__selected-icon",children:"✓"}):(0,d.jsx)("span",{className:"wpl-dropdownbutton__selected-icon"}),(0,d.jsxs)(yx,{as:"button",className:"button",onClick:t=>function(t,n,r){t.preventDefault(),t.stopPropagation(),r(),e.onSelect(n)}(t,r,n),children:[t,o&&(0,d.jsx)("span",{children:o})]})]},r))})})]})]})}const bx=({headerValue:e,options:t,onChange:n})=>(0,d.jsx)(Sd,{items:t,name:"headerValue",value:e,onChange:e=>n({[e.target.name]:e.target.value})}),xx=e=>"<"+e+">",wx=(e,t)=>e.includes(xx(t));function jx(e,t){return"uri"===t?e.replace(/[^A-Za-z0-9-._~:/?#\[\]@!$&'()*+,;=]/g,""):"integer"===t?parseInt(e,10):e}const Sx=({headerValue:e,headerSettings:t,options:n,onChange:r})=>{const{choices:i,replace:o,replaceType:s}=n,a=t.selected?t.selected:e,l=t.replaceValue?t.replaceValue:"";return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(Sd,{items:i,name:"headerValue",value:a,onChange:e=>{r({headerValue:e.target.value,headerSettings:{selected:e.target.value,replaceValue:""}})}}),wx(a,o)&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("label",{htmlFor:`header-replace-${o}`,children:xx(o).replace(/</g,"").replace(/>/g,"")}),(0,d.jsx)("input",{id:`header-replace-${o}`,type:"text",className:"regular-text",name:"replaceValue",value:l,onChange:e=>{r({headerValue:a.replace(xx(o),e.target.value),headerSettings:{selected:a,replaceValue:jx(e.target.value,s)}})}})]})]})},kx=({headerValue:e,onChange:t})=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("label",{htmlFor:"header-plain-value",children:[(0,m.__)("Value","redirection"),":"]})," ",(0,d.jsx)("input",{id:"header-plain-value",type:"text",className:"regular-text",name:"headerValue",value:e,onChange:e=>t({[e.target.name]:e.target.value})})]}),Cx=({headerValue:e,options:t,onChange:n})=>{const{choices:r,implode:i,wildCard:o}=t,s=e.split(i);return(0,d.jsx)(Wf,{options:o?r.concat([{value:o,label:(0,m.__)("All","redirection")}]):r,selected:s,onChange:e=>{if(!Array.isArray(e))return;const t=s,r=e.find(e=>!t.includes(e))||t.find(t=>!e.includes(t));if(o&&r===o){const e=1===t.length&&t[0]===o;return void n({headerValue:e?"":o})}n({headerValue:e.filter(e=>e!==o).filter(e=>e).join(i)})},title:(0,m.__)("Values","redirection"),hideTitle:!0,multiple:!0,badges:!0})},Tx=e=>e.map(e=>({label:e,value:e})),Ex={"X-UA-Compatible":{component:bx,info:"https://frankcode.net/2013/10/17/a-guide-to-ie-compatibility-view-and-x-ua-compatible/",default:"Chrome=1",options:Tx(["IE=EmulateIE7","IE=edge","Chrome=1"])},"X-Frame-Options":{component:Sx,info:"",default:"deny",options:{choices:Tx(["deny","sameorigin","allow-from <URI>"]),replace:"URI",replaceType:"uri"}},"Strict-Transport-Security":{component:Sx,default:"max-age=<expire-time>",info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security",options:{choices:Tx(["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:Sx,default:"1; mode=block",info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-XSS-Protection",options:{choices:Tx(["0","1","1; mode=block","1; report=<URI>"]),replace:"URI",replaceType:"uri"}},"X-Content-Type-Options":{component:bx,default:"nosniff",info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options",options:Tx(["nosniff"])},"Feature-Policy":{component:kx,info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Feature-Policy"},"Permissions-Policy":{component:kx,info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Permissions-Policy",default:"camera=(), display-capture=(), geolocation=(), microphone=()"},"Clear-Site-Data":{component:Cx,info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Clear-Site-Data",default:"cache",options:{choices:Tx(["cache","cookies","storage","executionContexts"]),implode:",",wildCard:"*"}},"Referrer-Policy":{component:bx,default:"no-referrer-when-downgrade",info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy",options:Tx(["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:kx,info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only"},Custom:{component:({headerValue:e,headerName:t,onChange:n})=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("input",{type:"text",className:"regular-text",name:"headerName",value:t,onChange:e=>n({[e.target.name]:e.target.value})}),"Value:"," ",(0,d.jsx)("input",{type:"text",className:"regular-text",name:"headerValue",value:e,onChange:e=>n({[e.target.name]:e.target.value})})]})},"Access-Control-Allow-Methods":{component:Cx,info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Methods",default:"GET",options:{choices:Tx(["GET","POST","PUT","HEAD","DELETE","OPTIONS"]),implode:",",wildCard:"*"}},"Access-Control-Allow-Credentials":{component:bx,default:"true",info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Credentials",options:Tx(["true"])},"Access-Control-Allow-Origin":{component:Sx,default:"<origin>",info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin",options:{choices:Tx(["<origin>","*"]),replace:"origin",replaceType:"uri"}},"X-Robots-Tag":{component:Cx,default:"noindex",info:"https://developers.google.com/search/reference/robots_meta_tag#xrobotstag",options:{choices:Tx(["noindex","nofollow","none","noarchive","nosnippet","notranslate","noimageindex"]),implode:",",wildCard:"all"}},"Access-Control-Allow-Headers":{component:kx,info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Headers"},"Access-Control-Max-Age":{component:kx,info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Max-Age"},"Access-Control-Expose-Headers":{component:kx,info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Expose-Headers"}},Px=e=>{const t=Ex[e];return t&&t.options?t.options:null},Ox=e=>{const t=Ex[e];return t&&t.default?t.default:""},Rx=({header:e,onChange:t,onDelete:n})=>{const{location:r,headerName:i,headerValue:o,headerSettings:s,type:a}=e,l=n=>{t({...e,...n})},c=t=>{const{name:n,value:r}=t.target;let o=i;"type"===n&&"Custom"===r?o="":"type"===n&&(o=r),l({headerValue:"type"===n?Ox(r):e.headerValue,headerSettings:"type"===n?Px(o):e.headerSettings,headerName:o,[n]:r})},u=((e,t,n,r,i)=>{const o=Ex[s=e]?Ex[s].component:kx;var s;return(0,d.jsx)(o,{headerName:t,headerValue:""===n?Ox(e):n,headerSettings:r,options:Px(e),onChange:i})})(a,i,o,s,l),p=(e=>{const t=Ex[e];return t&&t.info?t.info:null})(i);return(0,d.jsxs)("tr",{className:"redirect-headers__item",children:[(0,d.jsx)("td",{className:"redirect-headers__type",children:(0,d.jsx)(Sd,{items:[{label:(0,m.__)("Site","redirection"),value:"site"},{label:(0,m.__)("Redirect","redirection"),value:"redirect"}],name:"location",value:r,onChange:c})}),(0,d.jsxs)("td",{className:"redirect-headers__name",children:[(0,d.jsxs)("div",{className:"redirect-headers__name__content",children:[(0,d.jsx)(Sd,{items:[{label:(0,m.__)("General","redirection"),value:Tx(["X-UA-Compatible","X-Robots-Tag"])},{label:"CORS",value:Tx(["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:Tx(["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,m.__)("Custom Header","redirection"),value:"Custom"}],name:"type",value:a,onChange:c}),u]}),p&&(0,d.jsx)(z,{url:p,children:(0,d.jsx)("span",{className:"dashicons dashicons-editor-help"})})]}),(0,d.jsx)("td",{className:"redirect-headers__delete",children:(0,d.jsx)("button",{onClick:t=>{t.preventDefault(),n(e.id)},children:(0,d.jsx)("span",{className:"dashicons dashicons-trash"})})})]})},Nx=(e="X-Robots-Tag",t="nofollow",n={})=>({location:"site",type:e,headerName:e,headerValue:t,headerSettings:n}),Ax=({headers:e,onChange:t})=>{const[n,r]=(0,l.useState)("header"),i=[{label:(0,m.__)("Add Header","redirection"),value:"header"},{label:(0,m.__)("Add Security Presets","redirection"),value:"security"},{label:(0,m.__)("Add CORS Presets","redirection"),value:"cors"}],o=i.find(e=>e.value===n);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("h3",{children:(0,m.__)("HTTP Headers","redirection")}),(0,d.jsx)("p",{children:(0,m.__)("Site headers are added across your site, including redirects. Redirect headers are only added to redirects.","redirection")}),(0,d.jsxs)("table",{className:"wp-list-table widefat fixed striped items redirect-headers table-auto",children:[(0,d.jsx)("thead",{children:(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{children:(0,m.__)("Location","redirection")}),(0,d.jsx)("th",{children:(0,m.__)("Header","redirection")}),(0,d.jsx)("th",{})]})}),(0,d.jsxs)("tbody",{children:[e.map((n,r)=>(0,d.jsx)(Rx,{header:n,onChange:n=>((e,t,n,r)=>{const i=n.slice();i[e]=t,r({headers:i})})(r,n,e,t),onDelete:()=>((e,t,n)=>{n({headers:[...t.slice(0,e),...t.slice(e+1)]})})(r,e,t)},r)),0===e.length&&(0,d.jsx)("tr",{children:(0,d.jsx)("td",{colSpan:3,children:(0,m.__)("No headers","redirection")})})]})]}),(0,d.jsx)(vx,{options:i,selected:n,title:o?o.label:i[0]?.label||"",onSelect:n=>{r(n),((e,t,n)=>{"header"===e?n({headers:t.concat([Nx()])}):"security"===e?n({headers:t.concat([Nx("X-Frame-Options","deny"),Nx("X-XSS-Protection","1; mode=block"),Nx("X-Content-Type-Options","nosniff"),Nx("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?Nx("Strict-Transport-Security","max-age: 31536000; includeSubDomains"):null,Nx("Referrer-Policy","no-referrer-when-downgrade")].filter(e=>e))}):"cors"===e&&n({headers:t.concat([Nx("Access-Control-Allow-Origin","*"),Nx("Access-Control-Allow-Credentials","true"),Nx("Access-Control-Allow-Methods","POST,GET,OPTIONS"),Nx("Access-Control-Allow-Headers","origin"),Nx("Referrer-Policy","no-referrer-when-downgrade"),Nx("P3P",'CP="CAO PSA OUR"')])})})(n,e,t)}}),(0,d.jsx)("p",{children:(0,m.__)("Note that some HTTP headers are set by your server and cannot be changed.","redirection")})]})},Ix=function({link:e,onChange:t,onDelete:n}){return(0,d.jsxs)("tr",{className:"redirect-alias__item",children:[(0,d.jsx)("td",{children:(0,d.jsx)("input",{className:"regular-text",type:"text",name:"link",value:e,onChange:t})}),(0,d.jsx)("td",{className:"redirect-alias__delete",children:(0,d.jsx)("button",{onClick:e=>{e.preventDefault(),n()},children:(0,d.jsx)("span",{className:"dashicons dashicons-trash"})})})]})},zx=function(e){const{permalinks:t,onChange:n}=e;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("h3",{children:(0,m.__)("Permalink Migration","redirection")}),(0,d.jsx)("p",{children:(0,m.__)("Enter old permalinks structures to automatically migrate them to your current one.","redirection")}),(0,d.jsx)("p",{children:(0,m.__)("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,d.jsxs)("table",{className:"wp-list-table widefat fixed striped items redirect-aliases table-auto",children:[(0,d.jsx)("thead",{children:(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{children:(0,m.__)("Permalinks","redirection")}),(0,d.jsx)("th",{className:"redirect-alias__delete"})]})}),(0,d.jsxs)("tbody",{children:[t.map((e,r)=>(0,d.jsx)(Ix,{link:e,onChange:e=>((e,t,n,r)=>{const i=t.slice();i[e]=r.target.value,n({permalinks:i})})(r,t,n,e),onDelete:()=>((e,t,n)=>{n({permalinks:[...t.slice(0,e),...t.slice(e+1)]})})(r,t,n)},r)),0===t.length&&(0,d.jsx)("tr",{children:(0,d.jsx)("td",{colSpan:2,children:(0,m.__)("No migrated permalinks","redirection")})})]})]}),(0,d.jsx)("p",{children:(0,d.jsx)("button",{className:"button-secondary",onClick:e=>((e,t,n)=>{n.preventDefault(),t({permalinks:e.concat("").slice(0,10)})})(t,n,e),children:(0,m.__)("Add Permalink","redirection")})})]})};function Fx(){const e=Bm(Redirectioni10n.pluginRoot),t=pe(e=>e.loadStatus),n=pe(e=>e.values),r=pe(e=>e.saveStatus);Pd();const{mutate:i}=Od(),[o,s]=(0,l.useState)(!1),[a,c]=(0,l.useState)(""),[u,p]=(0,l.useState)([]),[h,f]=(0,l.useState)(""),[g,y]=(0,l.useState)([]),[v,_]=(0,l.useState)([]);(0,l.useEffect)(()=>{n&&(s(n.https||!1),c(n.preferred_domain||""),p(n.headers||[]),f(n.relocate||""),y(n.aliases||[]),_(n.permalinks||[]))},[n]);const b=e=>{void 0!==e.https&&s(e.https),void 0!==e.preferred_domain&&c(e.preferred_domain),void 0!==e.headers&&p(e.headers),void 0!==e.relocate&&f(e.relocate),void 0!==e.aliases&&y(e.aliases),void 0!==e.permalinks&&_(e.permalinks)};return"loading"!==t&&n?(0,d.jsxs)("form",{onSubmit:e=>{e.preventDefault(),i({https:o,headers:u,preferred_domain:a,aliases:g.filter(e=>e).map(Bm),relocate:Um(h),permalinks:v})},children:[(0,d.jsx)("div",{className:"inline-notice inline-warning",children:(0,d.jsx)("p",{children:U((0,m.__)("Options on this page can cause problems if used incorrectly. You can {{link}}temporarily disable them{{/link}} to make changes.","redirection"),{link:(0,d.jsx)(z,{url:"https://redirection.me/support/disable-redirection/"})})})}),(0,d.jsx)(Hm,{relocate:h,siteDomain:e,onChange:b}),0===h.length&&(0,d.jsx)(qm,{aliases:g,siteDomain:e,onChange:b}),0===h.length&&(0,d.jsx)(Gm,{https:o,siteDomain:e,preferredDomain:a,onChange:b}),0===h.length&&(0,d.jsx)(zx,{permalinks:v,onChange:b}),(0,d.jsx)(Ax,{headers:u,onChange:b}),(0,d.jsx)("input",{className:"button-primary",type:"submit",name:"update",value:(0,m.__)("Update","redirection"),disabled:r})]}):(0,d.jsx)($p,{})}const Dx=e=>"url"===e?[{name:"url",title:(0,m.__)("Source URL","redirection"),primary:!0,sortable:!1},{name:"count",title:(0,m.__)("Count","redirection"),sortable:!0}]:"ip"===e?[{name:"ip",title:(0,m.__)("IP","redirection"),primary:!0,sortable:!1},{name:"count",title:(0,m.__)("Count","redirection"),sortable:!0}]:"agent"===e?[{name:"agent",title:(0,m.__)("User Agent","redirection"),primary:!0,sortable:!1},{name:"count",title:(0,m.__)("Count","redirection"),sortable:!0}]:[{name:"date",title:(0,m.__)("Date","redirection")},{name:"method",title:(0,m.__)("Method","redirection"),sortable:!1},{name:"domain",title:(0,m.__)("Domain","redirection"),sortable:!1},{name:"url",title:(0,m.__)("Source URL","redirection"),primary:!0},{name:"target",title:(0,m.__)("Target URL","redirection"),sortable:!1},{name:"redirect_by",title:(0,m.__)("Redirect By","redirection"),sortable:!1},{name:"code",title:(0,m.__)("HTTP code","redirection"),sortable:!1},{name:"referrer",title:(0,m.__)("Referrer","redirection"),sortable:!1},{name:"agent",title:(0,m.__)("User Agent","redirection"),sortable:!1},{name:"ip",title:(0,m.__)("IP","redirection"),sortable:!1}],Lx=e=>e?[{value:"group",label:(0,m.__)("Group","redirection"),grouping:[e,"count"]}]:[{value:"standard",label:(0,m.__)("Standard Display","redirection"),grouping:["date","url","target","agent","ip"]},{value:"minimal",label:(0,m.__)("Compact Display","redirection"),grouping:["date","url"]},{value:"all",label:(0,m.__)("Display All","redirection"),grouping:Mx(e).map(e=>e.value)}],Mx=e=>"url"===e?[{value:"url",label:(0,m.__)("URL","redirection")},{value:"count",label:(0,m.__)("Count","redirection")}]:"agent"===e?[{value:"agent",label:(0,m.__)("User Agent","redirection")},{value:"count",label:(0,m.__)("Count","redirection")}]:"ip"===e?[{value:"ip",label:(0,m.__)("IP","redirection")},{value:"count",label:(0,m.__)("Count","redirection")}]:[{value:"date",label:(0,m.__)("Date","redirection")},{value:"method",label:(0,m.__)("Method","redirection")},{value:"domain",label:(0,m.__)("Domain","redirection")},{value:"url",label:(0,m.__)("URL","redirection")},{value:"redirect_by",label:(0,m.__)("Redirect By","redirection")},{value:"code",label:(0,m.__)("HTTP code","redirection")},{value:"referrer",label:(0,m.__)("Referrer","redirection")},{value:"agent",label:(0,m.__)("User Agent","redirection")},{value:"target",label:(0,m.__)("Target","redirection")},{value:"ip",label:(0,m.__)("IP","redirection")}],$x=e=>{const t=[{value:"",label:(0,m.__)("No grouping","redirection")},{value:"url",label:(0,m.__)("Group by URL","redirection")},{value:"agent",label:(0,m.__)("Group by user agent","redirection")}];return e>0&&t.push({value:"ip",label:(0,m.__)("Group by IP","redirection")}),t},Ux=window.Redirectioni10n?.per_page?parseInt(window.Redirectioni10n.per_page,10):25,Bx={page:0,per_page:Ux,orderby:"id",direction:"desc",selected:[],filterBy:{},displayType:"standard",displaySelected:["last_count","last_access","source","target","code","title"],groupBy:""},Zx={page:0,per_page:Ux,orderby:"name",direction:"desc",selected:[],filterBy:{},displayType:"standard",displaySelected:["name","module","redirects"],groupBy:""},qx={page:0,per_page:Ux,orderby:"",direction:"desc",selected:[],filterBy:{},displayType:"standard",displaySelected:["date","url","target","agent","ip"],groupBy:""},Hx={page:0,per_page:Ux,orderby:"",direction:"desc",selected:[],filterBy:{},displayType:"standard",displaySelected:["date","url","agent","ip"],groupBy:""},Wx={redirects:Bx,groups:Zx,logs:qx,errors:Hx,redirectsAddTop:!1},Gx=te()(se(ue(e=>({...Wx,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:Bx,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:Zx}),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:qx}),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:Hx}),reset:()=>e(Wx)}),{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 n=e??{};return{...t,redirects:{...t.redirects,...n.redirects},groups:{...t.groups,...n.groups},logs:{...t.logs,...n.logs},errors:{...t.errors,...n.errors}}}}),{name:"TableStore"})),Vx=Dc({id:Uc([rc().int(),ol()]),created:ol().optional(),url:ol().optional(),sent_to:ol().optional().nullable(),agent:ol().optional().nullable(),referrer:ol().optional().nullable(),ip:ol().optional().nullable(),domain:ol().optional().nullable(),redirect_id:rc().int().optional(),redirection_id:rc().int().optional(),request_method:ol().optional().nullable(),http_code:rc().int().optional(),request_data:Cc().optional().nullable(),redirect_by:ol().optional().nullable(),count:id().int().optional()}),Qx=Dc({id:Uc([rc().int(),ol()]),created:ol().optional(),created_time:ol().optional(),url:ol().optional(),agent:ol().optional().nullable(),referrer:ol().optional().nullable(),domain:ol().optional().nullable(),ip:ol().optional().nullable(),http_code:rc().int().optional(),request_method:ol().optional().nullable(),request_data:Cc().optional().nullable(),count:id().int().optional()}),Kx=im(Vx),Jx=im(Qx);function Yx(e){const t=h(),{incrementProgress:n,decrementProgress:r,addNotice:i,addError:o}=cd(),{setErrorsTable:s}=Gx();return pt({mutationFn:async({action:e,items:t,params:i={}})=>{n();try{return await jt(Jt(e,{items:t},i))}catch(e){throw r(),sd(e)}},onSuccess:(e,n)=>{r();const o="delete"===n.action?"deleted":n.action;i(`404 errors ${o}`),s(cm(n.params)),t.invalidateQueries({queryKey:ad.errors.all})},onError:e=>{o(e.message||"Failed to perform 404 error action")},...e})}function Xx(e){const{table:t,setTable:n,allowedOrder:r=[],allowedGroup:i=[],allowedFilters:o=[],defaultOrder:s="",pageName:a}=e,c=(0,l.useRef)(!1),u=(0,l.useRef)(null);(0,l.useEffect)(()=>{if(c.current)return;const e=function(e){const t=new URLSearchParams(e?e.slice(1):document.location.search.slice(1)),n={};return t.forEach((e,t)=>{n[t]=e}),n}();if(e.sub!==a&&"redirect"!==a)return void(c.current=!0);const s={};e.orderby&&r.includes(e.orderby)&&(s.orderby=e.orderby),"asc"!==e.direction&&"desc"!==e.direction||(s.direction=e.direction),e.offset&&parseInt(e.offset,10)>0&&(s.page=parseInt(e.offset,10)),e.groupby&&i.includes(e.groupby)&&(s.groupBy=e.groupby);const l={};for(const[t,n]of Object.entries(e)){const e=t.match(/^filterby\[(\w+)\]$/);if(e&&e[1]){const t=e[1];(0===o.length||o.includes(t))&&(l[t]=String(n))}}if(e.filterby&&"object"==typeof e.filterby)for(const t of Object.keys(e.filterby))(0===o.length||o.includes(t))&&(l[t]=e.filterby[t]);Object.keys(l).length>0&&(s.filterBy=l),Object.keys(s).length>0&&n(s),c.current=!0,u.current={...t,...s}},[t,n,r,i,o,a]),(0,l.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 n=new URLSearchParams(document.location.search),r=function(e,t){const n={...e};return"desc"===n.direction&&delete n.direction,n.orderby===t&&delete n.orderby,0===n.page&&delete n.page,n.per_page===parseInt(Redirectioni10n.per_page,10)&&delete n.per_page,"object"==typeof n.filterBy&&0===Object.keys(n.filterBy||{}).length&&(delete n.filterBy,delete n.filter),""===n.groupBy&&(delete n.groupBy,delete n.group),25!==parseInt(Redirectioni10n.per_page,10)&&(n.per_page=parseInt(Redirectioni10n.per_page,10)),delete n.selected,delete n.displaySelected,delete n.displayType,delete n.selectAll,n}(t,s);"redirect"!==a&&n.set("sub",a),r.orderby?n.set("orderby",r.orderby):n.delete("orderby"),r.direction?n.set("direction",r.direction):n.delete("direction"),r.page&&r.page>0?n.set("offset",String(r.page)):n.delete("offset"),r.groupBy?n.set("groupby",r.groupBy):n.delete("groupby");const i=[];if(n.forEach((e,t)=>{t.startsWith("filterby[")&&i.push(t)}),i.forEach(e=>n.delete(e)),t.filterBy&&"object"==typeof t.filterBy)for(const[e,r]of Object.entries(t.filterBy))r&&n.set(`filterby[${e}]`,String(r));const o="?"+n.toString();history.replaceState({},"",o)},[t,s,a])}const ew="idle",tw="loading",nw="complete",rw=e=>{const{name:t,title:n,table:r,primary:i,onSetOrderBy:o}=e,{direction:s,orderBy:a}=r,l=y({"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,u=y("sorting-indicator",{asc:c&&"asc"===s,desc:c&&"desc"===s});return(0,d.jsx)("th",{scope:"col",className:l,children:(0,d.jsxs)("button",{type:"button",className:"button-link",onClick:e=>{e.preventDefault(),o(t,a===t&&"desc"===s?"asc":"desc")},children:[(0,d.jsx)("span",{children:n}),(0,d.jsx)("span",{className:u})]})})},iw=e=>{const{name:t,title:n,primary:r}=e,i=y({"manage-column":!0,"column-primary":r,["column-"+t]:!0});return(0,d.jsx)("th",{scope:"col",className:i,children:(0,d.jsx)("span",{children:n})})},ow=e=>{const{onSelect:t,disabled:n,selected:r}=e;return(0,d.jsxs)("td",{className:"manage-column column-cb check-column-red",children:[(0,d.jsx)("label",{className:"screen-reader-text",htmlFor:"redirection-select-all",children:(0,m.__)("Select All","redirection")}),(0,d.jsx)("input",{id:"redirection-select-all",type:"checkbox",disabled:n,checked:r,onChange:e=>t(e.target.checked)})]})},sw=e=>{const{disabled:t,onSelect:n,onSetOrderBy:r,headers:i,table:o,hasBulk:s,allSelected:a,isSaving:l}=e;return(0,d.jsxs)("tr",{children:[s&&(0,d.jsx)(ow,{onSelect:n,disabled:t||l,selected:a}),i.map(e=>{const{primary:t=!1,sortable:n=!0}=e;return n?(0,d.jsx)(rw,{table:o,name:e.name,title:e.title,onSetOrderBy:r,primary:t},e.name):(0,d.jsx)(iw,{name:e.name,title:e.title,primary:t},e.name)})]})},aw=e=>{const{columns:t}=e;return(0,d.jsxs)("tr",{className:"is-placeholder",children:[t.map((e,t)=>(0,d.jsx)("td",{children:(0,d.jsx)("div",{className:"wpl-placeholder__loading"})},t)),(0,d.jsx)("td",{children:(0,d.jsx)("div",{className:"wpl-placeholder__loading"})})]})},lw=e=>{const{headers:t,rows:n}=e;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(aw,{columns:t}),n.slice(0,-1).map((e,n)=>(0,d.jsx)(aw,{columns:t},n))]})},cw=e=>{const{headers:t}=e;return(0,d.jsx)("tr",{children:(0,d.jsx)("td",{colSpan:t.length+1,children:(0,m.__)("Nothing to display.","redirection")})})},uw=e=>{const{headers:t}=e;return(0,d.jsx)("tr",{children:(0,d.jsx)("td",{colSpan:t.length+1,children:(0,d.jsx)("p",{children:(0,m.__)("Sorry, something went wrong loading the data - please try again","redirection")})})})},dw=(0,l.memo)(function(e){const{isSaving:t,disabled:n,id:r,rowIndex:i,onSelect:o,onShiftSelect:s,isSelected:a}=e,c=(0,l.useCallback)(e=>{e.shiftKey&&s&&(e.preventDefault(),s(i))},[s,i]),u=(0,l.useCallback)(e=>{const t=e.target.value,n=/^\d+$/.test(t)?parseInt(t,10):t;o([n],i)},[o,i]);return(0,d.jsx)("th",{scope:"row",className:"check-column",children:t?(0,d.jsx)(_d,{size:"small"}):(0,d.jsx)("input",{type:"checkbox",name:"item[]",value:r,disabled:n,checked:a,onChange:u,onClick:c})})});function pw(e){const{row:t,rowData:n,displaySelected:r,getRow:i,getRowActions:o,primary:s,total:a}=e,[c,u]=(0,l.useState)(!1),p={...n,rowMode:c,setRowMode:u},h=i(t,p),f=o(t,p);return Array.isArray(h)?(0,d.jsx)(d.Fragment,{children:h.filter(e=>r.includes(e.name)||!0===e.alwaysDisplay).map(e=>(0,d.jsxs)("td",{className:`column-${e.name}`,children:[e.content,e.name===(s?s.name:h[0]?.name)&&f]},e.name))}):(0,d.jsx)("td",{colSpan:a,children:h})}const hw=(0,l.memo)(function(e){const{row:t,rowIndex:n,status:r,isSelected:i,isSaving:o,isAllSaving:s,displaySelected:a,table:l,getRow:c,getRowActions:u,onSelect:p,onShiftSelect:h,primary:f,headersLength:m}=e,g=function(e,t,n){return{isLoading:e===tw,isSelected:!!Array.isArray(n.selected)&&n.selected.some(e=>e===t.id),table:n}}(r,t,l);return(0,d.jsxs)("tr",{className:y({disabled:r===tw||"saving"===r,saving:o||s}),children:[!!p&&(0,d.jsx)(dw,{id:t.id,rowIndex:n,onSelect:p,...h?{onShiftSelect:h}:{},disabled:r===tw,isSelected:i,isSaving:o||s}),(0,d.jsx)(pw,{row:t,rowData:g,displaySelected:a,getRow:c,getRowActions:u,primary:f,total:m})]})},(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),fw=function(e){const{rows:t,headers:n,status:r,table:i,getRow:o,getRowActions:s,onSelect:a,saving:c}=e,{selected:u=[],displaySelected:p}=i,h=n.find(e=>e.primary),f=c.some(e=>-1===e),m=(0,l.useRef)(null),g=(0,l.useCallback)((e,t)=>{void 0!==t&&(m.current=t),a&&a(e)},[a]),y=(0,l.useCallback)(e=>{if(!a)return;if(null===m.current){m.current=e;const n=t[e];return void(n&&a([n.id]))}const n=t.length-1,r=Math.min(m.current,n),i=Math.min(e,n),o=Math.min(r,i),s=Math.max(r,i),l=new Set(u),c=[];for(let e=o;e<=s;e++){const n=t[e];n&&!l.has(n.id)&&c.push(n.id)}c.length>0&&a(c),m.current=e},[a,t,u]);return r===tw&&0===t.length?(0,d.jsx)(lw,{headers:n,rows:t}):r===nw&&0===t.length?(0,d.jsx)(cw,{headers:n}):"error"===r?(0,d.jsx)(uw,{headers:n}):(0,d.jsx)(d.Fragment,{children:t.map((e,t)=>(0,d.jsx)(hw,{row:e,rowIndex:t,status:r,isSelected:u.some(t=>t===e.id),isSaving:c.some(t=>t===e.id),isAllSaving:f,displaySelected:p,table:i,getRow:o,getRowActions:s,...a?{onSelect:g,onShiftSelect:y}:{},primary:h,headersLength:n.length},e.id))})},mw=e=>{const{headers:t,getRow:n,getRowActions:r,rows:i,table:o,status:s,saving:a,onSelect:l,onSetOrderBy:c}=e,u=(0,d.jsx)(sw,{table:o,disabled:s!==nw||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=y("wp-list-table","widefat","fixed","striped","items",{["redirect-log__display__"+o.displayType]:!0,["redirect-log__group__"+o.groupBy]:o.groupBy});return(0,d.jsxs)("table",{className:p,children:[(0,d.jsx)("thead",{children:u}),(0,d.jsx)("tbody",{children:(0,d.jsx)(fw,{rows:i,table:o,headers:t,status:s,getRow:n,getRowActions:r,...l?{onSelect:l}:{},saving:a})}),(0,d.jsx)("tfoot",{children:u})]})},gw=function(e){const{title:t,button:n,className:r,disabled:i,onClick:o}=e;return i?(0,d.jsx)("span",{className:"tablenav-pages-navspan button disabled","aria-hidden":"true",children:n}):(0,d.jsxs)("button",{className:r+" button",type:"button",onClick:function(e){e.preventDefault(),o()},children:[(0,d.jsx)("span",{className:"screen-reader-text",children:t}),(0,d.jsx)("span",{"aria-hidden":"true",children:n})]})},yw=function(e){const{page:t,total:n,perPage:r,onChangePage:i}=e,o=n<=r,[s,a]=(0,l.useState)(t+1);if((0,l.useEffect)(()=>{a(t+1)},[t]),o)return null;const c=function(e,t){return Math.ceil(e/t)}(n,r);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(gw,{title:(0,m.__)("First page","redirection"),button:"«",className:"first-page",disabled:t<=0,onClick:()=>i(0)}),(0,d.jsx)(gw,{title:(0,m.__)("Prev page","redirection"),button:"‹",className:"prev-page",disabled:t<=0,onClick:()=>i(t-1)}),(0,d.jsxs)("span",{className:"paging-input",children:[(0,d.jsx)("label",{htmlFor:"current-page-selector",className:"screen-reader-text",children:(0,m.__)("Current Page","redirection")}),(0,d.jsx)("input",{className:"current-page",type:"number",min:"1",max:c,name:"paged",value:s,size:2,"aria-describedby":"table-paging",onBlur:()=>i(Math.min(c-1,Math.max(0,s-1))),onChange:e=>a(parseInt(e.target.value,10))}),(0,d.jsx)("span",{className:"tablenav-paging-text",children:(0,m.sprintf)(
// translators: %s is the total number of pages
// translators: %s is the total number of pages
(0,m.__)("of %s","redirection"),new Intl.NumberFormat(window.Redirectioni10n.locale).format(c))})]}),(0,d.jsx)(gw,{title:(0,m.__)("Next page","redirection"),button:"›",className:"next-page",disabled:t>=c-1,onClick:()=>i(t+1)}),(0,d.jsx)(gw,{title:(0,m.__)("Last page","redirection"),button:"»",className:"last-page",disabled:t>=c-1,onClick:()=>i(c-1)})]})},vw=function(e){const{total:t,perPage:n,page:r,rowCount:i,onChangePage:o,selected:s,onSelectAll:a,isEverything:l}=e,c=y({"tablenav-pages":!0});return(0,d.jsxs)("div",{className:c,children:[(0,d.jsxs)("span",{className:y("displaying-num",l?"displaying-num-all":null),children:[(0===s||!l&&(s<i||t<=n))&&(0,m.sprintf)(
// translators: %s is the number of items
// translators: %s is the number of items
(0,m._n)("%s item","%s items",t,"redirection"),new Intl.NumberFormat(window.Redirectioni10n.locale).format(t)),s>0&&s>=i&&t>n&&!l&&U((0,m.sprintf)(
// translators: 1: number of selected items, 2: total number of items
// translators: 1: number of selected items, 2: total number of items
(0,m.__)("%1$d of %2$d selected. {{all}}Select All.{{/all}}","redirection"),s,t),{all:(0,d.jsx)("button",{type:"button",onClick:function(){a(!0)}})}),l&&U((0,m.sprintf)(
// translators: 1: number of selected items, 2: total number of items
// translators: 1: number of selected items, 2: total number of items
(0,m.__)("%1$d of %2$d selected. {{all}}Clear All.{{/all}}","redirection"),s,t),{all:(0,d.jsx)("button",{type:"button",onClick:function(){a(!1)}})})]}),(0,d.jsx)("span",{className:"pagination-links",children:(0,d.jsx)(yw,{onChangePage:o,total:t,perPage:n,page:r},r)})]})},_w=function(e){const{total:t,rowCount:n,table:r,children:i=null,onChangePage:o,disabled:s,className:a,onSelectAll:l}=e;return(0,d.jsxs)("div",{className:y("tablenav",a),children:[(0,d.jsx)("div",{className:"redirect-table__actions",children:i}),t>0&&(0,d.jsx)(vw,{perPage:r.perPage,page:r.page,total:t,rowCount:n,onChangePage:o,onSelectAll:l,disabled:s,selected:r.selectAll?t:r.selected.length,isEverything:r.selectAll})]})},bw=({children:e})=>(0,d.jsx)("div",{className:"alignleft actions",children:e}),xw=function({selected:e,options:t,isEnabled:n,onGroup:r}){const[i,o]=(0,l.useState)(e);return(0,d.jsxs)("div",{className:"alignleft actions",children:[(0,d.jsx)(Sd,{items:t,value:i,name:"filter",onChange:e=>{o(e.target.value)},disabled:!n}),(0,d.jsx)("button",{className:"button",onClick:()=>{r(i)},disabled:!n,children:(0,m.__)("Apply","redirection")})]})};function ww(e,t){return e.options.find(e=>e.value===t)}function jw(e,t){const n=[];return Object.keys(e).forEach(r=>{const i=t.find(e=>e.value===r);if(i){const t=e[r];t&&i.options.find(e=>e.value===t)&&n.push(t)}}),n}const Sw=function(e){const{table:t,disabled:n,groupOptions:r,filterOptions:i,onGroup:o,onFilter:s}=e;return(0,d.jsxs)(d.Fragment,{children:[r.length>0&&(0,d.jsx)(xw,{selected:t.groupBy?t.groupBy:"",options:r,isEnabled:!n,onGroup:o},t.groupBy),i.length>0&&(0,d.jsx)(bw,{children:(0,d.jsx)(Wf,{options:i,selected:jw(t.filterBy,i),onChange:function(e){const t={};if(Array.isArray(e)){for(let n=0;n<e.length;n++){const r=e[n];if(r){const e=i.find(e=>ww(e,r));e&&(t[e.value]=r)}}s(t)}},title:(0,m.__)("Filters","redirection"),disabled:n,multiple:!0,badges:!0})})]})},kw=function(e){const{bulk:t,disabled:n,onBulk:r}=e,[i,o]=(0,l.useState)("-1");return(0,d.jsxs)("div",{className:"alignleft actions bulkactions",children:[(0,d.jsxs)("select",{name:"action",value:i,disabled:n,onChange:e=>o(e.target.value),children:[(0,d.jsx)("option",{value:"-1",children:(0,m.__)("Bulk Actions","redirection")}),t.map(e=>(0,d.jsx)("option",{value:e.id,children:e.name},e.id))]}),(0,d.jsx)("button",{type:"button",className:"button action",disabled:n||-1===parseInt(i,10),onClick:function(){-1!==parseInt(i,10)&&(r(i),o("-1"))},children:(0,m.__)("Apply","redirection")})]})};function Cw(e,t){if("custom"===e)return(0,m.__)("Custom Display","redirection");for(let n=0;n<t.length;n++){const r=t[n]?.options.find(t=>t.value===e);if(r)return r.label}return t[0]?.label||""}const Tw=function(e){const{disabled:t,predefinedGroups:n,customOptions:r,table:i,setDisplay:o,validation:s}=e,{displayType:a,displaySelected:l}=i,c=[{label:(0,m.__)("Pre-defined","redirection"),value:"pre",options:n},{label:(0,m.__)("Custom","redirection"),value:"custom",options:r}];return(0,d.jsx)(Wf,{className:"redirect-table-display__filter",options:c,selected:l.concat([a]),onChange:function(e){if(!Array.isArray(e))return;const t=l.concat([a]),n=e.filter(e=>!t.includes(e));if(n.length>0){const e=c[0]?.options?.find(e=>e.value===n[0]);if(e)return void o(e.value,e.grouping)}const i=e.filter(e=>{if(e===a)return!1;const t=c[0]?.options.find(t=>t.value===e);return!t&&r.find(t=>t.value===e)});o("custom",s?s(i):i)},title:Cw(a,c),disabled:t})};function Ew(e,t){if(e){const n=e.find(e=>t[e.name]);return n&&t[n.name]||""}return""}const Pw=function({table:e,onSearch:t,searchTypes:n,selected:r,disabled:i=!1,name:o=""}){const s=n?.find(e=>r[e.name]),a=Ew(n,r),c=s?s.name:n?.[0]?.name||"",[u,p]=(0,l.useState)(a),[h,f]=(0,l.useState)(c),[m,g]=(0,l.useState)(a);(0,l.useEffect)(()=>{const e=Ew(n,r);if(e!==m){const t=n?.find(e=>r[e.name]),i=t?t.name:n?.[0]?.name||"";g(e),p(e),f(i)}},[n,r,m]);const y=i||""===u&&""===e.filter,v=n?n.map(e=>({value:e.name,label:e.title})):[],_=n?.find(e=>e.name===h),b=_?_.title:"";return(0,d.jsxs)("form",{onSubmit:e=>{e?.preventDefault(),t(u,h)},className:"redirect-searchbox",children:[(0,d.jsx)("input",{type:"search",name:"s",value:u,onChange:e=>{p(e.target.value)}}),n&&(0,d.jsx)(vx,{options:v,disabled:i,title:b,onSelect:e=>{f(e),t(u,e)},selected:h}),!n&&(0,d.jsx)("input",{type:"submit",className:"button",value:o,disabled:y})]})},Ow=function(e){const{disabled:t,filterOptions:n,searchOptions:r,predefinedGroups:i,table:o,onSetDisplay:s,onFilter:a,validateDisplay:l}=e;return(0,d.jsxs)("div",{className:"redirect-table-display",children:[(0,d.jsx)(Tw,{disabled:t,customOptions:n,predefinedGroups:i,table:o,setDisplay:s,...l?{validation:l}:{}}),(0,d.jsx)(Pw,{disabled:t,table:o,onSearch:function(e,t){const n={...o.filterBy};r.map(e=>delete n[e.name]),e&&(n[t]=e),a(n)},selected:o.filterBy,searchTypes:r})]})},Rw=function(e){const{logOptions:t,logActions:n,table:r,total:i,rows:o,getRow:s,getRowActions:a,renderTableActions:l,status:c,saving:u}=e,{displayFilters:p,displayGroups:h,searchOptions:f,groupBy:m,rowFilters:g,bulk:y,headers:v,validateDisplay:_}=t,{onChangePage:b,onFilter:x,onSetDisplay:w,onBulk:j,onGroup:S,onSetOrder:k,onSetAll:C,onSelect:T}=n,E=c===tw;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(Ow,{filterOptions:p,predefinedGroups:h,searchOptions:f,disabled:E,table:r,onFilter:x,onSetDisplay:w,..._?{validateDisplay:_}:{}}),(0,d.jsxs)(_w,{total:i,rowCount:o.length,table:r,disabled:E,onChangePage:b,className:"top",onSelectAll:C,children:[(0,d.jsx)(kw,{bulk:y,disabled:E||0===r.selected.length,onBulk:j}),(0,d.jsx)(Sw,{disabled:E,table:r,groupOptions:m,filterOptions:g,onGroup:S,onFilter:x})]}),(0,d.jsx)(mw,{headers:v,rows:o,getRow:s,getRowActions:a,table:r,status:c,onSelect:e=>{0===e.length?T(!1):1===e.length&&void 0!==e[0]?T(e[0]):T(e)},onSetOrderBy:k,saving:u}),(0,d.jsxs)(_w,{total:i,rowCount:o.length,table:r,disabled:E,onChangePage:b,className:"bottom",onSelectAll:C,children:[(0,d.jsx)(kw,{bulk:y,disabled:E||0===r.selected.length,onBulk:j}),l&&l()]})]})};function Nw(e){return Redirectioni10n?.caps?.capabilities.includes(e)}function Aw(e){return Redirectioni10n?.caps?.pages.includes(e)}const Iw="redirection_cap_redirect_manage",zw="redirection_cap_redirect_add",Fw="redirection_cap_group_add",Dw="redirection_cap_404_delete";function Lw(e){const{actions:t,disabled:n=!1}=e;return(0,d.jsx)("div",{className:"row-actions",children:n?(0,d.jsx)("span",{children:" "}):t.length>0&&t.filter(e=>e).reduce((e,t)=>[...e," | ",t],[]).slice(1)})}function Mw(e){const{onClick:t,children:n,href:r="",capability:i=""}=e;return i&&!Nw(i)?null:(0,d.jsx)("a",{href:r||"#",onClick:function(e){t&&(e.preventDefault(),t())},children:n})}const $w=()=>(0,d.jsx)("div",{className:"redirection-poweredby",children:U((0,m.__)("Powered by {{link}}redirect.li{{/link}}","redirection"),{link:(0,d.jsx)(z,{url:"https://redirect.li"})})});function Uw(e){return!!(e&&e.name&&e.version)&&e.name+" "+e.version}function Bw({error:e}){return(0,d.jsxs)("div",{className:"wpl-modal_error",children:[(0,d.jsx)("h2",{children:(0,m.__)("Useragent Error","redirection")}),(0,d.jsx)("p",{children:(0,m.__)("Something went wrong obtaining this information","redirection")}),(0,d.jsx)("p",{children:(0,d.jsx)("code",{children:e})})]})}function Zw({agent:e}){return(0,d.jsxs)("div",{className:"redirection-useragent_unknown",children:[(0,d.jsx)("h2",{children:(0,m.__)("Unknown Useragent","redirection")}),(0,d.jsx)("br",{}),(0,d.jsx)("p",{children:e})]})}function qw({agent:e,detail:t}){const n=function(e,t){if(!e)return null;const n=e.slice(0,1).toUpperCase()+e.slice(1);return t?(0,d.jsx)(z,{url:t,children:n}):n}(t.device.type,t.url),r=function(e){const t=[];return e.vendor&&t.push(e.vendor),e.name&&t.push(e.name),t.join(" ")}(t.device),i=Uw(t.os),o=Uw(t.browser),s=Uw(t.engine),a=[];return r&&a.push([(0,m.__)("Device","redirection"),r]),i&&a.push([(0,m.__)("Operating System","redirection"),i]),o&&a.push([(0,m.__)("Browser","redirection"),o]),s&&a.push([(0,m.__)("Engine","redirection"),s]),(0,d.jsxs)("div",{children:[(0,d.jsxs)("h2",{children:[(0,m.__)("Useragent","redirection"),": ",n]}),(0,d.jsx)("table",{children:(0,d.jsxs)("tbody",{children:[(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{children:(0,m.__)("Agent","redirection")}),(0,d.jsx)("td",{className:"redirection-useragent_agent",children:e})]}),a.map((e,t)=>(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{children:e[0]}),(0,d.jsx)("td",{children:e[1]})]},t))]})}),(0,d.jsx)($w,{})]})}function Hw({agent:e}){const{data:t,isLoading:n,isError:r,error:i}=function(e,t){return ct({queryKey:ad.info.agent(e),queryFn:async()=>await jt(Xt(e)),enabled:!!e,staleTime:864e5,...t})}(e,{enabled:!!e}),o=y({"redirection-useragent":!0,"wpl-modal_loading":n}),s=t,a=r&&i&&i.message||"";return(0,d.jsxs)("div",{className:o,children:[n&&(0,d.jsx)(_d,{}),r&&a&&(0,d.jsx)(Bw,{error:a}),!n&&!r&&!s&&(0,d.jsx)(Zw,{agent:e}),!n&&!r&&s&&(0,d.jsx)(qw,{agent:e,detail:s})]})}const Ww=function(e){const{agent:t}=e,[n,r]=(0,l.useState)(!1);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(Mw,{href:"https://redirect.li/agent/?agent="+encodeURIComponent(t),onClick:()=>r(!0),children:(0,m.__)("Agent Info","redirection")}),n&&(0,d.jsx)(xm,{onClose:()=>r(!1),children:(0,d.jsx)(Hw,{agent:t})})]})},Gw=({headers:e})=>e&&0!==Object.keys(e).length?(0,d.jsxs)(l.Fragment,{children:[(0,d.jsx)("h3",{children:(0,m.__)("Request Headers","redirection")}),(0,d.jsx)("table",{children:(0,d.jsx)("tbody",{children:Object.keys(e).map(t=>(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{children:t}),(0,d.jsx)("td",{children:e[t]})]},t))})})]}):null,Vw=({source:e})=>e&&0!==e.length?(0,d.jsxs)(l.Fragment,{children:[(0,d.jsx)("h3",{children:(0,m.__)("Redirect Source","redirection")}),(0,d.jsx)("ul",{children:e.map((e,t)=>(0,d.jsx)("li",{children:e},t))})]}):null,Qw=({data:e})=>{const{headers:t,source:n}=e;return(0,d.jsxs)("div",{className:"redirect-requestdata",children:[t&&(0,d.jsx)(Gw,{headers:t}),n&&(0,d.jsx)(Vw,{source:n})]})},Kw=function(e){const{data:t}=e,[n,r]=(0,l.useState)(!1);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(Mw,{onClick:()=>r(!0),children:(0,m.__)("View Data","redirection")}),n&&(0,d.jsx)(xm,{onClose:()=>r(!1),children:(0,d.jsx)(Qw,{data:t})})]})},Jw=function(e){const{row:t,onDelete:n,disabled:r,groupBy:i}=e,{agent:o,id:s,request_data:a,redirection_id:l}=t,{setLogsTable:c}=Gx(),u=[];return u.push((0,d.jsx)(Mw,{onClick:()=>n(s),capability:"redirection_cap_log_delete",children:(0,m.__)("Delete","redirection")},"0")),o&&u.unshift((0,d.jsx)(Ww,{agent:o},"3")),a&&u.push((0,d.jsx)(Kw,{data:a},"4")),l&&l>0&&u.push((0,d.jsx)(Mw,{href:Redirectioni10n.pluginRoot+"&"+encodeURIComponent("filterby[id]")+"="+l,children:(0,m.__)("View Redirect","redirection")},"5")),i&&u.push((0,d.jsx)(Mw,{onClick:()=>c({filterBy:um(i,String(s)),page:0,groupBy:"",selected:[],selectAll:!1}),capability:Iw,children:(0,m.__)("Show All","redirection")},"6")),(0,d.jsx)(Lw,{disabled:r,actions:u})},Yw=e=>{const{enabled:t=!0,children:n}=e;return t?(0,d.jsx)("div",{className:"table-buttons",children:n}):null};var Xw=n(465),ej=n.n(Xw);function tj(e){return e.url?pp(hp(e.domain),e.url):""}function nj(e,t){if(!e.sent_to)return"";const n=t.target||"",r=/^https?:\/\//i.test(e.sent_to)?e.sent_to:pp(hp(e.domain),e.sent_to);return(0,d.jsx)(z,{url:r,children:(0,d.jsx)(ej(),{searchWords:[n],textToHighlight:e.sent_to,autoEscape:!0})})}function rj(e){return e.includes("url")?e:e.concat(["url"])}const ij=function(){const e=Gx(e=>e.logs),{setLogsTable:t,setLogsSelected:n}=Gx(),r=pe(e=>e.values),i=r?.token||"";Xx({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=h(),{incrementProgress:t,decrementProgress:n,addNotice:r,addError:i}=cd(),{setLogsTable:o}=Gx();return pt({mutationFn:async({action:e,items:r,params:i={}})=>{t();try{return await jt(Kt(e,{items:r},i))}catch(e){throw n(),sd(e)}},onSuccess:(t,i)=>{n();const s="delete"===i.action?"deleted":i.action;r(`Logs ${s}`),o(cm(i.params)),e.invalidateQueries({queryKey:ad.logs.all})},onError:e=>{i(e.message||"Failed to perform log action")}})}(),{data:s,isLoading:a,isSuccess:l}=function(e={},t){const n=pm(e),{addError:r}=cd();return ct({queryKey:ad.logs.list(n),queryFn:async()=>{try{const e=await jt(Dt(n));return Kx.parse(e)}catch(e){const t=sd(e);throw r(t.message||"Failed to fetch logs"),t}},...t})}(e),c=s?.items??[],u=s?.total??0;let p=ew;a?p=tw:l&&(p=nw);const f=t=>{if(!window.confirm((0,m.__)("Are you sure you want to delete this item?","redirection")))return;const n=e.groupBy?{groupBy:e.groupBy}:{};o.mutate({action:"delete",items:[t],params:n})},g=e=>{t({filterBy:e,page:0,selected:[],selectAll:!1})},y={...e,...(v=e.groupBy,v?{displayOptions:Mx(v),displaySelected:Lx(v)[0]?.grouping||[]}:{})};var v;const _={page:e.page,perPage:e.per_page,orderBy:e.orderby||"date",direction:e.direction,selected:e.selected??[],selectAll:e.selectAll??!1,filter:"",filterBy:e.filterBy??{},displayType:e.displayType??"standard",displaySelected:y.displaySelected??[],groupBy:e.groupBy??""},b={displayFilters:Mx(y.groupBy),displayGroups:Lx(y.groupBy),searchOptions:[{name:"url",title:(0,m.__)("Search URL","redirection")},{name:"url-exact",title:(0,m.__)("Search exact URL","redirection")},{name:"referrer",title:(0,m.__)("Search referrer","redirection")},{name:"agent",title:(0,m.__)("Search user agent","redirection")},{name:"ip",title:(0,m.__)("Search IP","redirection")},{name:"target",title:(0,m.__)("Search target URL","redirection")},{name:"domain",title:(0,m.__)("Search domain","redirection")}],groupBy:$x(r?.ip_logging||0),bulk:[{id:"delete",name:(0,m.__)("Delete","redirection")}],rowFilters:y.groupBy?[]:[{label:(0,m.__)("Method","redirection"),value:"method",options:[{label:"GET",value:"get"},{label:"POST",value:"post"},{label:"HEAD",value:"head"}]},{label:(0,m.__)("Redirect By","redirection"),value:"redirect_by",options:[{label:(0,m.__)("WordPress","redirection"),value:"wordpress"},{label:(0,m.__)("Redirection","redirection"),value:"redirection"}]}],headers:Dx(y.groupBy).filter(e=>function(e,t){return t.displaySelected.includes(e)}(e.name,y)),validateDisplay:rj},x={onChangePage:e=>{t({page:e,selected:[],selectAll:!1})},onBulk:t=>{if(0===e.selected.length&&!e.selectAll)return;if("delete"===t){const t=e.selectAll?(0,m.__)("Are you sure you want to delete all items?","redirection"):(0,m.__)("Are you sure you want to delete the selected items?","redirection");if(!window.confirm(t))return}const n=e.groupBy?{groupBy:e.groupBy}:{};e.selectAll?o.mutate({action:t,items:[],params:pm({...n,global:!0,filterBy:e.filterBy})}):o.mutate({action:t,items:e.selected,params:n})},onGroup:e=>{t({groupBy:e,selected:[],selectAll:!1})},onSetOrder:(e,n)=>{t({orderby:"date"===e?"":e,direction:n})},onFilter:g,onSetDisplay:(e,n)=>{t({displayType:e,displaySelected:n})},onSelect:r=>{if("boolean"==typeof r)n(r?c.map(e=>e.id):[]);else if("number"==typeof r||"string"==typeof r){const n=Array.isArray(e.selected)?e.selected:[],i=n.some(e=>e===r)?n.filter(e=>e!==r):[...n,r];t({selected:i,selectAll:!1})}else n(r)},onSetAll:e=>{t({selected:e?c.map(e=>e.id):[],selectAll:e})}};return(0,d.jsx)(Rw,{logOptions:b,logActions:x,table:_,status:p,total:u,rows:c,saving:[],getRow:(e,t)=>function(e,t){const{created:n,url:r,agent:i,referrer:o,ip:s,request_method:a,http_code:l,domain:c,redirect_by:u,count:p}=e,h=t?.table?.filterBy||{},f=h.url||h["url-exact"]||"";return[{name:"date",content:n??""},{name:"method",content:a?a.toUpperCase():""},{name:"domain",content:c||""},{name:"url",content:r?(0,d.jsx)(z,{url:tj(e),children:(0,d.jsx)(ej(),{searchWords:[f],textToHighlight:r,autoEscape:!0})}):""},{name:"target",content:nj(e,h)},{name:"redirect_by",content:u||""},{name:"code",content:l??""},{name:"referrer",content:o?(0,d.jsx)(ej(),{searchWords:[h.referrer||""],textToHighlight:o,autoEscape:!0}):""},{name:"agent",content:i?(0,d.jsx)(ej(),{searchWords:[h.agent||""],textToHighlight:i,autoEscape:!0}):""},{name:"ip",content:s?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("a",{href:"https://redirect.li/ip/?ip="+encodeURIComponent(s),children:(0,d.jsx)(ej(),{searchWords:[h.ip||""],textToHighlight:s,autoEscape:!0})}),""===t?.table?.groupBy&&t?.onFilter&&(0,d.jsx)(Lw,{actions:[(0,d.jsx)(Mw,{onClick:()=>{t.onFilter?.({ip:s})},children:(0,m.__)("Filter by IP","redirection")},"filter-ip")]})]}):""},{name:"count",content:p?new Intl.NumberFormat(window.Redirectioni10n.locale).format(p):""}]}(e,{...t,onFilter:g}),getRowActions:t=>(0,d.jsx)(Jw,{disabled:!1,row:t,onDelete:f,groupBy:e.groupBy}),renderTableActions:()=>(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(Yw,{enabled:c.length>0,children:i&&(0,d.jsx)("div",{className:"table-button-item",children:(0,d.jsx)("a",{href:dp(i),className:"button-secondary",children:(0,m.__)("RSS","redirection")})})})})})},oj="url",sj="error",aj="random",lj="pass",cj="nothing",uj="url",dj="login",pj="referrer",hj="agent",fj="cookie",mj="header",gj="custom",yj="role",vj="server",_j="ip",bj="page",xj="language";function wj(e){return e===oj||e===aj}function jj(e,t){if(e===dj)return{logged_in:t?.logged_in||"",logged_out:t?.logged_out||""};if(e===pj)return{referrer:t?.referrer||"",regex:t?.regex||!1,url_from:t?.url_from||"",url_notfrom:t?.url_notfrom||""};if(e===hj)return{agent:t?.agent||"",regex:t?.regex||!1,url_from:t?.url_from||"",url_notfrom:t?.url_notfrom||""};if(e===fj)return{name:t?.name||"",value:t?.value||"",regex:t?.regex||!1,url_from:t?.url_from||"",url_notfrom:t?.url_notfrom||""};if(e===mj)return{name:t?.name||"",value:t?.value||"",regex:t?.regex||!1,url_from:t?.url_from||"",url_notfrom:t?.url_notfrom||""};if(e===gj)return{filter:t?.filter||"",url_from:t?.url_from||"",url_notfrom:t?.url_notfrom||""};if(e===yj)return{role:t?.role||"",url_from:t?.url_from||"",url_notfrom:t?.url_notfrom||""};if(e===vj)return{server:t?.server||"",url_from:t?.url_from||"",url_notfrom:t?.url_notfrom||""};if(e===_j){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===xj?{language:t?.language||"",url_from:t?.url_from||"",url_notfrom:t?.url_notfrom||""}:t||{}}function Sj(e,t,n){return{url:e,title:"",match_data:{source:{flag_regex:n.flag_regex||!1,flag_trailing:n.flag_trailing||!1,flag_case:n.flag_case||!1,flag_query:n.flag_query||"exact"},options:{}},match_type:uj,action_type:oj,action_code:301,action_data:{},group_id:t,position:0}}const kj=()=>[{value:uj,label:(0,m.__)("URL only","redirection")},{value:dj,label:(0,m.__)("URL and login status","redirection")},{value:yj,label:(0,m.__)("URL and role/capability","redirection")},{value:pj,label:(0,m.__)("URL and referrer","redirection")},{value:hj,label:(0,m.__)("URL and user agent","redirection")},{value:fj,label:(0,m.__)("URL and cookie","redirection")},{value:_j,label:(0,m.__)("URL and IP","redirection")},{value:vj,label:(0,m.__)("URL and server","redirection")},{value:mj,label:(0,m.__)("URL and HTTP header","redirection")},{value:gj,label:(0,m.__)("URL and custom filter","redirection")},{value:bj,label:(0,m.__)("URL and WordPress page type","redirection")},{value:xj,label:(0,m.__)("URL and language","redirection")}],Cj=()=>[{value:oj,label:(0,m.__)("Redirect to URL","redirection")},{value:aj,label:(0,m.__)("Redirect to random post","redirection")},{value:lj,label:(0,m.__)("Pass-through","redirection")},{value:sj,label:(0,m.__)("Error (404)","redirection")},{value:cj,label:(0,m.__)("Do nothing (ignore)","redirection")}],Tj=()=>[{value:"301",label:(0,m.__)("301 - Moved Permanently","redirection")},{value:"302",label:(0,m.__)("302 - Found","redirection")},{value:"303",label:(0,m.__)("303 - See Other","redirection")},{value:"304",label:(0,m.__)("304 - Not Modified","redirection")},{value:"307",label:(0,m.__)("307 - Temporary Redirect","redirection")},{value:"308",label:(0,m.__)("308 - Permanent Redirect","redirection")}],Ej=()=>[{value:"400",label:(0,m.__)("400 - Bad Request","redirection")},{value:"401",label:(0,m.__)("401 - Unauthorized","redirection")},{value:"403",label:(0,m.__)("403 - Forbidden","redirection")},{value:"404",label:(0,m.__)("404 - Not Found","redirection")},{value:"410",label:(0,m.__)("410 - Gone","redirection")},{value:"418",label:(0,m.__)("418 - I'm a teapot","redirection")},{value:"451",label:(0,m.__)("451 - Unavailable For Legal Reasons","redirection")},{value:"500",label:(0,m.__)("500 - Internal Server Error","redirection")},{value:"501",label:(0,m.__)("501 - Not implemented","redirection")},{value:"502",label:(0,m.__)("502 - Bad Gateway","redirection")},{value:"503",label:(0,m.__)("503 - Service Unavailable","redirection")},{value:"504",label:(0,m.__)("504 - Gateway Timeout","redirection")}],Pj=()=>Tj().concat(Ej()),Oj=()=>[{value:"flag_regex",label:(0,m.__)("Regex","redirection")},{value:"flag_trailing",label:(0,m.__)("Ignore Slash","redirection")},{value:"flag_case",label:(0,m.__)("Ignore Case","redirection")}],Rj=()=>[{value:"exactorder",label:(0,m.__)("Exact match","redirection")},{value:"exact",label:(0,m.__)("Exact match in any order","redirection")},{value:"ignore",label:(0,m.__)("Ignore all parameters","redirection")},{value:"pass",label:(0,m.__)("Ignore & pass parameters to the target","redirection")}],Nj=e=>"url"===e?[{name:"url",title:(0,m.__)("Source URL","redirection"),primary:!0,sortable:!1},{name:"count",title:(0,m.__)("Count","redirection"),sortable:!0}]:"agent"===e?[{name:"agent",title:(0,m.__)("User Agent","redirection"),primary:!0,sortable:!1},{name:"count",title:(0,m.__)("Count","redirection"),sortable:!0}]:"ip"===e?[{name:"ip",title:(0,m.__)("IP","redirection"),primary:!0,sortable:!1},{name:"count",title:(0,m.__)("Count","redirection"),sortable:!0}]:[{name:"date",title:(0,m.__)("Date","redirection")},{name:"method",title:(0,m.__)("Method","redirection"),sortable:!1},{name:"domain",title:(0,m.__)("Domain","redirection"),sortable:!1},{name:"url",title:(0,m.__)("Source URL","redirection"),primary:!0},{name:"code",title:(0,m.__)("HTTP code","redirection"),sortable:!1},{name:"referrer",title:(0,m.__)("Referrer","redirection"),sortable:!1},{name:"agent",title:(0,m.__)("User Agent","redirection"),sortable:!1},{name:"ip",title:(0,m.__)("IP","redirection")}],Aj=e=>{const t=[{id:"delete",name:(0,m.__)("Delete","redirection")}];return"ip"===e?t.concat([{id:"redirect-ip",name:(0,m.__)("Redirect All","redirection")},{id:"block",name:(0,m.__)("Block IP","redirection")}]):"agent"===e?t:t.concat([{id:"redirect-url",name:(0,m.__)("Redirect All","redirection"),isEverything:!1},{id:"ignore",name:(0,m.__)("Ignore URL","redirection"),isEverything:!1}])},Ij=e=>{const t=[{value:"",label:(0,m.__)("No grouping","redirection")},{value:"url",label:(0,m.__)("Group by URL","redirection")},{value:"agent",label:(0,m.__)("Group by user agent","redirection")}];return e>0&&t.push({value:"ip",label:(0,m.__)("Group by IP","redirection")}),t};function zj(e){return e?[{value:"group",label:(0,m.__)("Group","redirection"),grouping:[e,"count"]}]:[{value:"standard",label:(0,m.__)("Standard Display","redirection"),grouping:["date","url","agent","ip"]},{value:"minimal",label:(0,m.__)("Compact Display","redirection"),grouping:["date","url"]},{value:"all",label:(0,m.__)("Display All","redirection"),grouping:Fj(e).map(e=>e.value)}]}function Fj(e){return"url"===e?[{value:"url",label:(0,m.__)("URL","redirection")},{value:"count",label:(0,m.__)("Count","redirection")}]:"agent"===e?[{value:"agent",label:(0,m.__)("User Agent","redirection")},{value:"count",label:(0,m.__)("Count","redirection")}]:"ip"===e?[{value:"ip",label:(0,m.__)("IP","redirection")},{value:"count",label:(0,m.__)("Count","redirection")}]:[{value:"date",label:(0,m.__)("Date","redirection")},{value:"method",label:(0,m.__)("Method","redirection")},{value:"domain",label:(0,m.__)("Domain","redirection")},{value:"url",label:(0,m.__)("URL","redirection")},{value:"code",label:(0,m.__)("HTTP code","redirection")},{value:"referrer",label:(0,m.__)("Referrer","redirection")},{value:"agent",label:(0,m.__)("User Agent","redirection")},{value:"ip",label:(0,m.__)("IP","redirection")}]}const Dj="^/.*$";function Lj(e){return{url:Dj,match_type:_j,action_data:{ip:e},match_data:{source:{flag_regex:!0}}}}function Mj(e,t){return"redirect-ip"===e||"ip"===e?{...Lj(t),action_type:oj}:"block"===e?{...Lj(t),action_type:sj,action_code:403}:"agent"===e?{url:Dj,match_type:hj,action_data:{agent:t},match_data:{source:{flag_regex:!0}}}:{url:t,match_type:uj,action_type:"ignore"===e?cj:oj}}const $j=({title:e=null,children:t,className:n=""})=>(0,d.jsxs)("tr",{className:n,children:[(0,d.jsx)("th",{children:e}),(0,d.jsx)("td",{children:t})]}),Uj=({flag_case:e,flag_regex:t,flag_trailing:n})=>[e?"flag_case":null,t?"flag_regex":null,n?"flag_trailing":null].filter(e=>null!==e),Bj=({url:e,flags:t,onFlagChange:n,onChange:r,autoFocus:i=!1})=>{const o=Oj();return Array.isArray(e)?(0,d.jsx)($j,{title:(0,m.__)("Source URL","redirection"),className:"top",children:(0,d.jsx)("textarea",{value:e.join("\n"),readOnly:!0})}):(0,d.jsxs)($j,{title:(0,m.__)("Source URL","redirection"),className:"redirect-edit__source",children:[(0,d.jsx)("input",{type:"text",name:"url",value:e,onChange:r,autoFocus:i,className:"regular-text",placeholder:(0,m.__)("The relative URL you want to redirect from","redirection")}),(0,d.jsx)(Wf,{options:o,selected:Uj(t),onChange:function(e){const t=Array.isArray(e)?e:[e];n({flag_case:t.includes("flag_case"),flag_trailing:t.includes("flag_trailing"),flag_regex:t.includes("flag_regex")})},title:(0,m.__)("URL options / Regex","redirection"),badges:!0,multiple:!0,hideTitle:!0})]})},Zj=({query:e,regex:t,onChange:n,url:r})=>{if(t)return null;const i=!1===(Array.isArray(r)?r.join(""):r).includes("?")?Rj().filter(e=>"exactorder"!==e.value):Rj();return(0,d.jsx)($j,{title:(0,m.__)("Query Parameters","redirection"),className:"redirect-edit__sourcequery",children:(0,d.jsx)(Sd,{name:"flag_query",items:i,value:e,onChange:n})})},qj=({groups:e,currentGroup:t,onChange:n})=>(0,d.jsx)(Sd,{name:"group",value:String(t),items:fp(e),onChange:n}),Hj=({position:e,onChange:t})=>(0,d.jsxs)("span",{className:"redirect-edit-position",children:[(0,d.jsx)("strong",{children:(0,m.__)("Position","redirection")})," ",(0,d.jsx)("input",{type:"number",value:e,name:"position",min:"0",size:3,onChange:t})]}),Wj=function({title:e,onChange:t}){return(0,d.jsx)($j,{title:(0,m.__)("Title","redirection"),className:"redirect-edit__title",children:(0,d.jsx)("input",{type:"text",name:"title",value:e,onChange:e=>t({title:e.target.value}),placeholder:(0,m.__)("Describe the purpose of this redirect (optional)","redirection")})})},Gj=({actionType:e,actionCode:t,onChange:n})=>{const r=function(e){return e===sj?Ej():e===oj||e===aj?Tj():null}(e);return r?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("strong",{className:"small-flex",children:(0,m.__)("with HTTP code","redirection")}),(0,d.jsx)(Sd,{name:"action_code",value:String(t),items:r,onChange:n})]}):null},Vj=({actionType:e,matchType:t,onChange:n})=>(0,d.jsx)(Sd,{name:"action_type",value:e,items:Cj().filter(e=>!(t===dj&&!wj(e.value))),onChange:n}),Qj=({matchType:e,onChange:t})=>(0,d.jsx)($j,{title:(0,m.__)("Match","redirection"),children:(0,d.jsx)(Sd,{name:"match_type",value:e,items:kj(),onChange:t})}),Kj=function({onChange:e,data:t}){const[n,r]=(0,l.useState)(""),{agent:i,regex:o}=t;return(0,d.jsxs)($j,{title:(0,m.__)("User Agent","redirection"),className:"redirect-edit__match",children:[(0,d.jsx)("input",{type:"text",name:"agent",value:i,onChange:e,className:"regular-text",placeholder:(0,m.__)("Match against this browser user agent","redirection")}),(0,d.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]}}),r("")},value:n,className:"medium",children:[(0,d.jsx)("option",{value:"",children:(0,m.__)("Custom","redirection")}),(0,d.jsx)("option",{value:"mobile",children:(0,m.__)("Mobile","redirection")}),(0,d.jsxs)("option",{value:"feed",children:[(0,m.__)("Feed Readers","redirection")," "]}),(0,d.jsx)("option",{value:"lib",children:(0,m.__)("Libraries","redirection")})]}),(0,d.jsx)("input",{id:"redirect-agent-regex",type:"checkbox",name:"regex",checked:o,onChange:e}),(0,d.jsxs)("label",{className:"redirect-edit-regex",htmlFor:"redirect-agent-regex",children:[(0,m.__)("Regex","redirection")," ",(0,d.jsx)("sup",{children:(0,d.jsx)(z,{url:"https://redirection.me/support/redirect-regular-expressions/",children:"?"})})]})]})},Jj=({data:e,onChange:t})=>{const{referrer:n,regex:r}=e;return(0,d.jsxs)($j,{title:(0,m.__)("Referrer","redirection"),className:"redirect-edit__match",children:[(0,d.jsx)("input",{type:"text",className:"regular-text",name:"referrer",value:n,onChange:t,placeholder:(0,m.__)("Match against this browser referrer text","redirection")}),(0,d.jsx)("input",{id:"redirect-referrer-regex",type:"checkbox",name:"regex",checked:r,onChange:t}),(0,d.jsxs)("label",{className:"redirect-edit-regex",htmlFor:"redirect-referrer-regex",children:[(0,m.__)("Regex","redirection")," ",(0,d.jsx)("sup",{children:(0,d.jsx)(z,{url:"https://redirection.me/support/redirect-regular-expressions/",children:"?"})})]})]})},Yj=function({onChange:e,data:t}){const[n,r]=(0,l.useState)(""),{name:i,value:o,regex:s}=t;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)($j,{title:(0,m.__)("HTTP Header","redirection"),className:"redirect-edit__match",children:[(0,d.jsx)("input",{type:"text",name:"name",value:i,onChange:e,className:"regular-text",placeholder:(0,m.__)("Header name","redirection")}),(0,d.jsx)("input",{type:"text",name:"value",value:o,onChange:e,className:"regular-text",placeholder:(0,m.__)("Header value","redirection")}),(0,d.jsxs)("select",{name:"agent_dropdown",onChange:t=>{""!==t.target.value&&e({target:{name:"name",value:{accept:"Accept-Language"}[t.target.value]}}),r("")},value:n,className:"medium",children:[(0,d.jsx)("option",{value:"",children:(0,m.__)("Custom","redirection")}),(0,d.jsx)("option",{value:"accept",children:(0,m.__)("Accept Language","redirection")})]}),(0,d.jsx)("input",{id:"redirect-header-regex",type:"checkbox",name:"regex",checked:s,onChange:e}),(0,d.jsxs)("label",{className:"redirect-edit-regex",htmlFor:"redirect-header-regex",children:[(0,m.__)("Regex","redirection")," ",(0,d.jsx)("sup",{children:(0,d.jsx)(z,{url:"https://redirection.me/support/redirect-regular-expressions/",children:"?"})})]})]}),(0,d.jsx)($j,{children:(0,m.__)("Note it is your responsibility to pass HTTP headers to PHP. Please contact your hosting provider for support about this.","redirection")})]})},Xj=({data:e,onChange:t})=>{const{filter:n}=e;return(0,d.jsx)($j,{title:(0,m.__)("Filter Name","redirection"),className:"redirect-edit__match",children:(0,d.jsx)("input",{type:"text",name:"filter",value:n,onChange:t,className:"regular-text",placeholder:(0,m.__)("WordPress filter name","redirection")})})},eS=({data:e,onChange:t})=>{const{name:n,value:r,regex:i}=e;return(0,d.jsxs)($j,{title:(0,m.__)("Cookie","redirection"),className:"redirect-edit__match",children:[(0,d.jsx)("input",{type:"text",name:"name",value:n,onChange:t,className:"regular-text",placeholder:(0,m.__)("Cookie name","redirection")}),(0,d.jsx)("input",{type:"text",name:"value",value:r,onChange:t,className:"regular-text",placeholder:(0,m.__)("Cookie value","redirection")}),(0,d.jsx)("input",{id:"redirect-cookie-regex",type:"checkbox",name:"regex",checked:i,onChange:t}),(0,d.jsxs)("label",{className:"redirect-edit-regex",htmlFor:"redirect-cookie-regex",children:[(0,m.__)("Regex","redirection")," ",(0,d.jsx)("sup",{children:(0,d.jsx)(z,{url:"https://redirection.me/support/redirect-regular-expressions/",children:"?"})})]})]})},tS=({data:e,onChange:t})=>{const{role:n}=e;return(0,d.jsx)($j,{title:(0,m.__)("Role","redirection"),className:"redirect-edit__match",children:(0,d.jsx)("input",{type:"text",className:"regular-text",value:n,name:"role",placeholder:(0,m.__)("Enter role or capability value","redirection"),onChange:t})})},nS=({data:e,onChange:t})=>{const{server:n}=e;return(0,d.jsx)($j,{title:(0,m.__)("Server","redirection"),className:"redirect-edit__match",children:(0,d.jsx)("input",{type:"text",className:"regular-text",name:"server",value:n,placeholder:(0,m.__)("Enter server URL to match against","redirection"),onChange:t})})},rS=({data:e,onChange:t})=>{const{ip:n=[]}=e;return(0,d.jsx)($j,{title:(0,m.__)("IP","redirection"),className:"redirect-edit__match",children:(0,d.jsx)("textarea",{value:n.join("\n"),name:"ip",placeholder:(0,m.__)("Enter IP addresses (one per line)","redirection"),onChange:e=>{t({target:{name:e.target.name,value:e.target.value.split("\n")}})}})})},iS=()=>(0,d.jsx)($j,{title:(0,m.__)("Page Type","redirection"),className:"redirect-edit__match",children:(0,d.jsxs)("p",{children:[(0,m.__)("Only the 404 page type is currently supported.","redirection")," ",(0,m.__)("Please do not try and redirect all your 404s - this is not a good thing to do.","redirection")]})}),oS=({data:e,onChange:t})=>{const{language:n}=e;return(0,d.jsx)($j,{title:(0,m.__)("Language","redirection"),className:"redirect-edit__match",children:(0,d.jsx)("input",{type:"text",className:"regular-text",name:"language",value:n,onChange:t,placeholder:(0,m.__)("Comma separated list of languages to match against (i.e. da, en-GB)","redirection")})})},sS=({matchType:e,actionData:t,onChange:n})=>{const r={[pj]:Jj,[hj]:Kj,[fj]:eS,[mj]:Yj,[gj]:Xj,[yj]:tS,[vj]:nS,[_j]:rS,[bj]:iS,[xj]:oS};if(r[e]){const i=r[e];return(0,d.jsx)(i,{data:null===t?{}:t,onChange:n})}return null},aS=({onChange:e,data:t})=>{const{logged_in:n,logged_out:r}=t;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)($j,{title:(0,m.__)("Logged In","redirection"),className:"redirect-edit__target__matched",children:(0,d.jsx)("input",{type:"text",className:"regular-text",name:"logged_in",value:n,onChange:e,placeholder:(0,m.__)("Target URL when matched (empty to ignore)","redirection")})}),(0,d.jsx)($j,{title:(0,m.__)("Logged Out","redirection"),className:"redirect-edit__target__unmatched",children:(0,d.jsx)("input",{type:"text",className:"regular-text",name:"logged_out",value:r,onChange:e,placeholder:(0,m.__)("Target URL when not matched (empty to ignore)","redirection")})})]})};const lS=function(){return(0,d.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:[(0,d.jsx)("circle",{transform:"translate(8 0)",cx:"0",cy:"16",r:"0",children:(0,d.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,d.jsx)("circle",{transform:"translate(16 0)",cx:"0",cy:"16",r:"0",children:(0,d.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,d.jsx)("circle",{transform:"translate(24 0)",cx:"0",cy:"16",r:"0",children:(0,d.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"})})]})},cS=function({options:e,value:t,onSelect:n,onClose:r}){return(0,d.jsx)("ul",{children:e.map((e,i)=>(0,d.jsx)("li",{children:(0,d.jsx)("button",{type:"button",onClick:t=>function(e,t){e.preventDefault(),n(t),r()}(t,e),onKeyDown:t=>function(e,t){"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n(t),r())}(t,e),children:(0,d.jsx)(ej(),{searchWords:[t],textToHighlight:e.title,autoEscape:!0})})},i))})},uS=function(e){const{placeholder:t="",onChange:n,value:r,fetchData:i,name:o="text",disabled:s=!1,className:a,maxChoices:c=-1,maxLength:u=0,canMakeRequest:p=e=>e.length>0,onBlur:h,getLabel:f,setLabel:m=()=>{},loadOnFocus:g=!1,onlyChoices:v=!1}=e,[_,b]=(0,l.useState)(!1),[x,w]=(0,l.useState)([]),[j,S]=(0,l.useState)(Array.isArray(r)?"":r),k=(0,l.useRef)(null),C={"wpl-dropdowntext__suggestion__hide":c>0&&Array.isArray(r)&&r.length>=c,"wpl-dropdowntext__suggestion":c>1},T=function(e,t,n,r){var i=this,o=(0,l.useRef)(null),s=(0,l.useRef)(0),a=(0,l.useRef)(0),c=(0,l.useRef)(null),u=(0,l.useRef)([]),d=(0,l.useRef)(),p=(0,l.useRef)(),h=(0,l.useRef)(e),f=(0,l.useRef)(!0),m=(0,l.useRef)(),g=(0,l.useRef)();h.current=e;var y="undefined"!=typeof window,v=!t&&0!==t&&y;if("function"!=typeof e)throw new TypeError("Expected a function");t=+t||0;var _=!!(n=n||{}).leading,b=!("trailing"in n)||!!n.trailing,x=!!n.flushOnExit&&b,w="maxWait"in n,j="debounceOnServer"in n&&!!n.debounceOnServer,S=w?Math.max(+n.maxWait||0,t):null,k=(0,l.useMemo)(function(){var e=function(e){var t=u.current,n=d.current;return u.current=d.current=null,s.current=e,a.current=a.current||e,p.current=h.current.apply(n,t)},n=function(e,t){v&&cancelAnimationFrame(c.current),c.current=v?requestAnimationFrame(e):setTimeout(e,t)},l=function(e){if(!f.current)return!1;var n=e-o.current;return!o.current||n>=t||n<0||w&&e-s.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 r=Date.now();if(_&&a.current===s.current&&T(),l(r))return k(r);if(f.current){var i=t-(r-o.current),c=w?Math.min(i,S-(r-s.current)):i;n(e,c)}},T=function(){r&&r({})},E=function(){if(y||j){var r,a=Date.now(),h=l(a);if(u.current=[].slice.call(arguments),d.current=i,o.current=a,x&&!m.current&&(m.current=function(){var e;"hidden"===(null==(e=globalThis.document)?void 0:e.visibilityState)&&g.current.flush()},null==(r=globalThis.document)||null==r.addEventListener||r.addEventListener("visibilitychange",m.current)),h){if(!c.current&&f.current)return s.current=o.current,n(C,t),_?e(o.current):p.current;if(w)return n(C,t),e(o.current)}return c.current||n(C,t),p.current}};return E.cancel=function(){var e=c.current;e&&(v?cancelAnimationFrame(c.current):clearTimeout(c.current)),s.current=0,u.current=o.current=d.current=c.current=null,e&&r&&r({})},E.isPending=function(){return!!c.current},E.flush=function(){return c.current?k(Date.now()):p.current},E},[_,w,t,S,b,x,v,y,j,r]);return g.current=k,(0,l.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 R(e).map(t=>f(t,e))}function O(e){if(c>0){if(!R(r).find(t=>t===`${e.value}`)){const t=[`${e.value}`].concat(R(r).filter(t=>t!==`${e.value}`)).slice(0,c);n(1!==c||v?t:t[0],[e.title].concat(P(t)?.slice(1)||[])),m(e.value,e.title)}S("")}else S(e.value),n(e.value,P(r));w([])}function R(e){return Array.isArray(e)?e:e?[e]:[]}return(0,l.useEffect)(()=>{r!==j&&S(Array.isArray(r)?"":r)},[r,j]),(0,d.jsxs)("div",{className:y("wpl-dropdowntext",a,C),children:[c>0&&R(r).map(e=>(0,d.jsx)($f,{title:e,onCancel:()=>function(e){const t=R(r).filter(t=>t!==e);m(e,null),Array.isArray(r)?n(1===c?t[0]:t,P(t)):n(""),k.current?.focus()}(e),disabled:s,children:f?f(e,r):e},e)),(0,d.jsx)("input",{type:"text",className:y("regular-text",{"wpl-dropdowntext__max":c>=0&&R(r).length>=c}),name:o,value:j,disabled:s,onChange:function(e){S(e.target.value),c<1&&n(e.target.value),i&&T&&(p(e.target.value.trim())?T(e.target.value):w([]))},maxLength:u>0?u:void 0,placeholder:t,ref:k,onFocus:function(){const e=(Array.isArray(r),r.length>0);g&&!e&&E("")},onBlur:function(e){if(e.relatedTarget&&e.relatedTarget.closest(".wpl-dropdowntext__suggestions"))return;const t=`${(h?h(j):j)??""}`;0===x.length?v?S(""):c>0&&i?O({value:t,label:t,title:t}):n(t):t!==j&&S(t),b(!1)},onKeyDown:function(e){"Enter"===e.code&&(b(!1),w([]))}}),_&&(0,d.jsx)("div",{className:"wpl-dropdowntext__loading",children:(0,d.jsx)(lS,{})}),x.length>0&&k.current&&(0,d.jsx)(zf,{align:"left",onClose:()=>w([]),popoverPosition:If(k.current),className:"wpl-dropdowntext__suggestions",focusLock:!1,children:(0,d.jsx)(cS,{options:x,value:j,onSelect:O,onClose:()=>w([])})})]})},dS=function(e){const{onChange:t,url:n}=e;return(0,d.jsx)(uS,{placeholder:(0,m.__)("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(n)?n.join(""):n||""})},pS=({onChange:e,data:t})=>{const{url:n}=t;return(0,d.jsx)($j,{title:(0,m.__)("Target URL","redirection"),className:"redirect-edit__target",children:(0,d.jsx)(dS,{...void 0!==n?{url:n}:{},onChange:t=>e({target:{name:"url",value:t,type:"input"}})})})},hS=({onChange:e,data:t})=>{const{url_from:n,url_notfrom:r}=t;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)($j,{title:(0,m.__)("Matched Target","redirection"),className:"redirect-edit__target__matched",children:(0,d.jsx)("input",{type:"text",className:"regular-text",name:"url_from",value:n,onChange:e,placeholder:(0,m.__)("Target URL when matched (empty to ignore)","redirection")})}),(0,d.jsx)($j,{title:(0,m.__)("Unmatched Target","redirection"),className:"redirect-edit__target__unmatched",children:(0,d.jsx)("input",{type:"text",className:"regular-text",name:"url_notfrom",value:r,onChange:e,placeholder:(0,m.__)("Target URL when not matched (empty to ignore)","redirection")})})]})},fS=({actionType:e,matchType:t,actionData:n,onChange:r})=>{if(wj(e)){const e=(i=t)===dj?aS:i===uj||i===bj?pS:hS,o=jj(t,n);return(0,d.jsx)(e,{data:null===o?{}:o,onChange:r})}var i;return null},mS=(e,t)=>t.startsWith(e)||e.slice(0,t.length)===t,gS=e=>{const{url:t,flag_regex:n,action_data:r={}}=e;if(null===r||!t||!e||"string"!=typeof t)return[];const i=[],{url:o="",logged_in:s="",logged_out:a="",url_from:l="",url_notfrom:c=""}=r;if(Array.isArray(t)||0===t.length||void 0===t)return i;if(t.includes("#")&&i.push((0,d.jsx)(z,{url:"https://redirection.me/support/faq/#anchor",children:(0,m.__)("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,d.jsx)(z,{url:"https://redirection.me/support/matching-redirects/#server",children:U((0,m.sprintf)(
// translators: %(server)s is the domain name
// translators: %(server)s is the domain name
(0,m.__)("This will be converted to a server redirect for the domain {{code}}%(server)s{{/code}}.","redirection"),{server:e.hostname}),{code:(0,d.jsx)("code",{})})}))}catch(e){}var u;"http"!==t.slice(0,4)&&"/"!==t.slice(0,1)&&t.length>0&&!1===n&&!t.includes("[source]")&&i.push(U((0,m.__)("The source URL should probably start with a {{code}}/{{/code}}","redirection"),{code:(0,d.jsx)("code",{})})),null===(u=t).match(/[\*\\\(\)\^\$]/)&&!u.includes(".?")||!1!==n||i.push((0,d.jsx)(z,{url:"https://redirection.me/support/redirect-regular-expressions/",children:(0,m.__)('Remember to enable the "regex" option if this is a regular expression.',"redirection")})),t.match(/%\w+%/)&&i.push((0,d.jsx)(z,{url:"tools.php?page=redirection.php&sub=site",children:(0,m.__)('Please add migrated permalinks to the Site page under the "Permalink Migration" section.',"redirection")})),t.includes("^")||t.includes("$")||!n||i.push(
// translators: %(example)s is an example regular expression
U((0,m.sprintf)(
// translators: %(example)s is an example regular expression
// translators: %(example)s is an example regular expression
(0,m.__)("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,d.jsx)("code",{})})),n&&t.includes("^")&&t.indexOf("^")>0&&i.push(
// translators: %(example)s is an example regular expression with corrected caret position
U((0,m.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,m.__)("The caret {{code}}^{{/code}} should be at the start. For example: {{code}}%(example)s{{/code}}","redirection"),{example:"^"+t.replace("^","")}),{code:(0,d.jsx)("code",{})})),n&&t.match(/[a-zA-Z0-9\/]\?/)&&i.push(U((0,m.__)("To match {{code}}?{{/code}} you need to escape it with {{code}}\\?{{/code}}","redirection"),{code:(0,d.jsx)("code",{})})),n&&t.match(/[a-zA-Z0-9 ]\*/)&&i.push(U((0,m.__)("Wildcards are not supported. You need to use a {{link}}regular expression{{/link}}.","redirection"),{link:(0,d.jsx)(z,{url:"https://redirection.me/support/redirect-regular-expressions/"})})),"/(.*)"!==t&&"^/(.*)"!==t||i.push((0,m.__)("If you want to redirect everything please use a site relocation or alias from the Site page.","redirection")),t.length>0&&(l===t||c===t||s===t||a===t||o===t)&&i.push((0,m.__)("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 p=[r.url,r.url_from,r.url_notfrom,r.logged_in,r.logged_out].filter(e=>e);return!o||mS(o,"https://")||mS(o,"http://")||"/"===o.slice(0,1)||i.push(
// translators: %(url)s is the user's target URL
U((0,m.sprintf)(
// translators: %(url)s is the user's target URL
// translators: %(url)s is the user's target URL
(0,m.__)("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:r.url}),{code:(0,d.jsx)("code",{})})),!1===n&&p.forEach(e=>{const t=e.match(/[|\\\$]/g);null!==t&&i.push(
// translators: %(invalid)s is an invalid character in the URL
U((0,m.sprintf)(
// translators: %(invalid)s is an invalid character in the URL
// translators: %(invalid)s is an invalid character in the URL
(0,m.__)("Your target URL contains the invalid character {{code}}%(invalid)s{{/code}}","redirection"),{invalid:t}),{code:(0,d.jsx)("code",{})}))}),[t,...p].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
U((0,m.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,m.__)("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,d.jsx)("code",{})}))}),null!==t.match(/(\.html|\.htm|\.php|\.pdf|\.jpg)$/)&&i.push((0,d.jsx)(z,{url:"https://redirection.me/support/problems/url-not-redirecting/",children:(0,m.__)("Some servers may be configured to serve file resources directly, preventing a redirect occurring.","redirection")})),i},yS=({warnings:e})=>0===e.length?null:(0,d.jsx)($j,{children:(0,d.jsx)("div",{className:"redirect-edit_warning notice notice-warning",children:e.map((e,t)=>(0,d.jsxs)("p",{children:[(0,d.jsx)("span",{className:"dashicons dashicons-info"}),e]},t))})});function vS(e){const t=h(),{incrementProgress:n,decrementProgress:r,addNotice:i,addError:o}=cd(),{setRedirectsTable:s}=Gx();return pt({mutationFn:async({items:e,params:t={}})=>{n();try{return await jt(Vt("delete",{items:e},t))}catch(e){throw r(),sd(e)}},onSuccess:(e,n)=>{r(),i("Redirects deleted"),s(cm(n.params)),t.invalidateQueries({queryKey:ad.redirects.lists()})},onError:e=>{o(e.message||"Failed to delete redirects")},...e})}function _S(e,t){const n=h(),{incrementProgress:r,decrementProgress:i,addNotice:o,addError:s}=cd(),{setRedirectsSelected:a}=Gx();return pt({mutationFn:async({items:t})=>{r();try{return await jt(Vt(e,{items:t},{}))}catch(e){throw i(),sd(e)}},onSuccess:()=>{i(),o(`Redirects ${e}d`),a([]),n.invalidateQueries({queryKey:ad.redirects.lists()})},onError:t=>{s(t.message||`Failed to ${e} redirects`)},...t})}const bS=function(e){const{item:t,onCancel:n,saveButton:r=(0,m.__)("Save","redirection"),childSave:i,callback:o,canSave:s,autoFocus:a,children:c}=e,{data:u}=hm({}),p=(0,l.useMemo)(()=>u?.items??[],[u]),f=Gx(e=>e.redirectsAddTop),g=Gx(e=>e.redirects),{setRedirectsAddTop:y}=Gx(),v=pe(e=>e.values),_=v?.auto_target||"",b=(0,l.useMemo)(()=>v?{flag_case:v.flag_case,flag_trailing:v.flag_trailing,flag_regex:v.flag_regex,flag_query:v.flag_query}:{},[v]),{mutate:x}=function(){const e=h(),{incrementProgress:t,decrementProgress:n,addNotice:r,addError:i}=cd();return pt({mutationFn:async e=>{t();try{const{id:t,...n}=e,r=await jt(Rt(t,n));return sm.parse(r).item}catch(e){throw n(),sd(e)}},onSuccess:t=>{n(),r("Redirect saved"),e.invalidateQueries({queryKey:ad.redirects.lists()}),e.invalidateQueries({queryKey:ad.redirects.detail(t.id)})},onError:e=>{i(e.message||"Failed to update redirect")}})}(),{mutate:w}=function(){const e=h(),{incrementProgress:t,decrementProgress:n,addNotice:r,addError:i}=cd();return pt({mutationFn:async e=>{t();try{const t=await jt(Nt(e));return om.parse(t).items[0]??null}catch(e){throw n(),sd(e)}},onSuccess:()=>{n(),r("Redirect created"),e.invalidateQueries({queryKey:ad.redirects.lists()})},onError:e=>{i(e.message||"Failed to create redirect")}})}(),j=(0,l.useRef)(null),S=(0,l.useCallback)(e=>{if(((e,t)=>e.find(e=>e.id===t))(p,e))return e;if(g.filterBy&&"object"==typeof g.filterBy&&"group"in g.filterBy&&g.filterBy.group&&parseInt(String(g.filterBy.group),10)>0)return parseInt(String(g.filterBy.group),10);if(p&&p.length>0){const e=p.find(e=>e.default);return e?e.id:p[0].id}return 0},[p,g.filterBy]),{url:k,match_data:C,match_type:T,action_type:E,action_data:P,group_id:O=0,title:R,action_code:N,position:A=0}=t,{flag_regex:I=!1,flag_trailing:z=!1,flag_case:F=!1,flag_query:D="exact"}=C?.source??{},L={url:k,title:R,flag_regex:I,flag_trailing:z,flag_case:F,flag_query:D,match_type:T,action_type:E,action_code:N,action_data:jj(T,P),options:C?.options??{},group_id:S(O),position:A,warning:[],advanced:!1},[M,$]=(0,l.useState)(L),U=(0,l.useCallback)(()=>{const{match_type:e,action_type:t,title:n,action_code:r}=M;return e===uj&&t===oj&&""===n&&301===r},[M]);(0,l.useEffect)(()=>{$(e=>({...e,advanced:!U()}))},[]),(0,l.useEffect)(()=>{$(e=>({...e,warning:gS(e)}))},[M.url,M.action_type,M.match_type,M.action_data]),(0,l.useEffect)(()=>{o&&j.current&&o(j.current.clientHeight)},[M,o]);const B=(0,l.useCallback)(()=>{const e=Sj("",M.group_id,b);$(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:[]}))},[M.group_id,b]),Z=(0,l.useCallback)(e=>{e.preventDefault();const{url:r,title:o,flag_regex:a,flag_trailing:l,flag_case:c,flag_query:u,match_type:d,action_type:h,group_id:f,action_code:m,position:g,action_data:y,options:v}=M,_=f>0||!p?f:p[0].id,b={...t.id?{id:parseInt(String(t.id),10)}:{},url:r,title:o,match_data:{source:{flag_regex:a,flag_trailing:l,flag_case:c,flag_query:u},...v?{options:v}:{}},match_type:d,action_type:h,...void 0!==g?{position:g}:{},...void 0!==_?{group_id:_}:{},action_code:"number"==typeof m?m:parseInt(String(m),10),action_data:jj(d,y)};s&&!s(Array.isArray(r))||(b.id?x({id:b.id,...b}):w(b),n?n(e):B(),i&&i())},[M,p,t.id,s,x,w,n,B,i]),q=(0,l.useCallback)(e=>{$(t=>({...t,...e,warning:gS({...t,...e})}))},[]),H=(0,l.useCallback)(e=>{e.preventDefault(),q({advanced:!M.advanced})},[M.advanced,q]),W=(0,l.useCallback)(e=>{$(t=>({...t,group_id:parseInt(e.target.value,10)}))},[]),G=(0,l.useCallback)(e=>{const t={};Object.keys(b).filter(e=>"flag_query"!==e).forEach(e=>{t[e]=!1}),q({...t,...e})},[b,q]),V=(0,l.useCallback)(e=>{const{target:t}=e,n="checkbox"===t.type?t.checked:t.value;return{[t.name]:n}},[]),Q=(0,l.useCallback)(e=>{const t=V(e);t.action_data=jj(t.match_type,M.action_data),t.match_type===dj&&(t.action_type=oj),q(t)},[M.action_data,V,q]),K=(0,l.useCallback)(e=>{q(V(e))},[V,q]),J=(0,l.useCallback)(e=>{$(t=>({...t,options:{...t.options,[e.target.name]:e.target.checked??e.target.value}}))},[]),Y=(0,l.useCallback)(e=>{const t=V(e).action_type;var n;q({action_type:t,action_code:(n=t,n===sj?404:n===lj?200:301),action_data:jj(M.match_type,M.action_data||{})})},[M.match_type,M.action_data,V,q]),X=(0,l.useCallback)(e=>{const t={action_data:{...M.action_data,...V(e)}};q(t)},[M.action_data,V,q]),ee=(0,l.useCallback)(()=>{const{match_type:e,action_type:t,action_data:n,url:r}=M;return!(0===r.length&&!_||wj(t)&&(i=e,(!(o=n)||i!==uj&&i!==bj&&!(i===dj?o.logged_in||o.logged_out:i===pj?o.referrer:i===hj?o.agent:i===fj||i===mj?o.name&&o.value:i===gj?o.filter:i===yj?o.role:i===vj?o.server:i===_j?o.ip:i===xj&&o.language))&&""===_));var i,o},[M,_]),{url:te,advanced:ne,flag_regex:re,action_type:ie,match_type:oe,action_data:se,flag_query:ae,group_id:le,position:ce,title:ue,action_code:de,options:he,warning:fe}=M;return(0,d.jsx)("form",{onSubmit:Z,ref:j,children:(0,d.jsx)("table",{className:"redirect-edit",children:(0,d.jsxs)("tbody",{children:[(0,d.jsx)(Bj,{url:te,flags:M,defaultFlags:b,autoFocus:a??!1,onFlagChange:G,onChange:K}),(0,d.jsx)(Zj,{query:ae,regex:re,onChange:K,url:te}),ne&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(Wj,{title:ue,onChange:e=>q(e)}),(0,d.jsx)(Qj,{matchType:oe,onChange:Q}),(0,d.jsx)(sS,{matchType:oe,actionData:se,onChange:X}),(0,d.jsxs)($j,{title:(0,m.__)("When matched","redirection"),className:"redirect-edit__action",children:[(0,d.jsx)(Vj,{actionType:ie,matchType:oe,onChange:Y}),(0,d.jsx)(Gj,{actionType:ie,actionCode:de,onChange:K}),ne&&["url","random"].includes(ie)?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("input",{id:"redirect-log-exclude",type:"checkbox",name:"log_exclude",checked:Boolean(he.log_exclude),onChange:J}),(0,d.jsx)("label",{htmlFor:"redirect-log-exclude",children:(0,m.__)("Exclude from logs","redirection")})]}):null]})]}),(0,d.jsx)(fS,{actionType:ie,matchType:oe,actionData:se,onChange:X}),(0,d.jsxs)($j,{title:(0,m.__)("Group","redirection"),className:"redirect-edit__group",children:[(0,d.jsx)(qj,{groups:p,currentGroup:le,onChange:W}),ne&&(0,d.jsx)(Hj,{position:ce,onChange:K})]}),c&&c,(0,d.jsx)($j,{children:(0,d.jsxs)("div",{className:"table-actions",children:[(0,d.jsx)("input",{className:"button-primary",type:"submit",name:"save",value:r,disabled:!ee()})," "," ",n&&(0,d.jsx)("button",{type:"button",className:"button-secondary",onClick:n,children:(0,m.__)("Cancel","redirection")}),f&&!n&&(0,d.jsx)("button",{className:"button-secondary",type:"button",onClick:e=>{e.preventDefault(),y(!1)},children:(0,m.__)("Close","redirection")})," ",U()&&(0,d.jsx)("button",{type:"button",onClick:H,className:"redirection-edit_advanced",title:(0,m.__)("Show advanced options","redirection"),children:(0,d.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,d.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,d.jsx)(yS,{warnings:fe})]})})})};const xS=function(e){const{onClose:t,redirect:n,rows:r}=e,i=pe(e=>e.values),o={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:s}=Yx(),a=function(e,t){return e?Array.isArray(e)?[...new Set(e.map(e=>function(e,t){const n=t.find(t=>t.id===e||t.id===parseInt(e,10));return n?n.url:e}(e,t)))]:e:""}(n.url,r),[c,u]=(0,l.useState)(!1),p={...Sj(Array.isArray(a)?a[0]??"":a,0,o),...n,url:a};return(0,d.jsx)(xm,{onClose:t,padding:!0,children:(0,d.jsx)("div",{className:"add-new",children:(0,d.jsx)(bS,{item:p,saveButton:(0,m.__)("Add Redirect","redirection"),onCancel:t,childSave:()=>{return c&&(e=Array.isArray(a)?a:[a],void s({action:"delete",items:e,params:{groupBy:"url",deleteConfirm:!0}}));var e},canSave:e=>c&&confirm(e?(0,m.__)("Are you sure you want to delete the selected items?","redirection"):(0,m.__)("Are you sure you want to delete this item?","redirection"))||!c,autoFocus:!0,children:Nw(Dw)&&(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{children:(0,m.__)("Delete Log Entries","redirection")}),(0,d.jsxs)("td",{className:"edit-left",style:{padding:"7px 0px"},children:[(0,d.jsx)("input",{id:"create-redirect-delete-log",type:"checkbox",checked:c,onChange:e=>u(e.target.checked)}),(0,d.jsx)("label",{htmlFor:"create-redirect-delete-log",children:Array.isArray(a)&&a.length<=1||!Array.isArray(a)?(0,m.__)("Delete logs for this entry","redirection"):(0,m.__)("Delete logs for these entries","redirection")})]})]})})})})},wS=function(e){const{row:t,onDelete:n,onCreate:r,table:i,disabled:o}=e,{setErrorsTable:s}=Gx(),{url:a,ip:l,agent:c,id:u}=t,{groupBy:p}=i,h=[];return h.push((0,d.jsx)(Mw,{onClick:()=>n(u),capability:Dw,children:(0,m.__)("Delete","redirection")},"0")),h.push((0,d.jsx)(Mw,{onClick:()=>r(Mj(p,"ip"===p?[u]:""===p?a:u)),capability:zw,children:(0,m.__)("Add Redirect","redirection")},"1")),c&&h.unshift((0,d.jsx)(Ww,{agent:c},"3")),h.push((0,d.jsx)(Mw,{onClick:()=>{return e=um(p,""===p?t.url:String(t.id)),void s({filterBy:e,page:0,groupBy:"",selected:[],selectAll:!1});var e},capability:Iw,children:(0,m.__)("Show All","redirection")},"4")),"ip"===p?h.push((0,d.jsx)(Mw,{onClick:()=>r(Mj("block",[l])),capability:zw,children:(0,m.__)("Block IP","redirection")},"5")):"agent"!==p&&h.push((0,d.jsx)(Mw,{onClick:()=>r(Mj("ignore",a)),capability:zw,children:(0,m.__)("Ignore URL","redirection")},"6")),(0,d.jsx)(Lw,{disabled:o,actions:h})};function jS(e){return e.url?pp(hp(e.domain),e.url):""}function SS(e){return e.includes("url")?e:e.concat(["url"])}const kS=function(){const e=Gx(e=>e.errors),{setErrorsTable:t,setErrorsSelected:n}=Gx(),r=pe(e=>e.values),[i,o]=(0,l.useState)(null);Xx({table:e,setTable:t,allowedGroup:["url","ip","agent"],allowedFilters:["url","url-exact","referrer","agent","ip","domain","method"],pageName:"404s"});const s=Yx(),{data:a,isFetching:c}=function(e={},t){const n=pm(e),{addError:r}=cd();return ct({queryKey:ad.errors.list(n),queryFn:async()=>{try{const e=await jt(Lt(n));return Jx.parse(e)}catch(e){const t=sd(e);throw r(t.message||"Failed to fetch 404 errors"),t}},...t})}(e),u=a?.items??[],p=a?.total??0;let h=ew;function f(e){n([]),o(e)}function g(t){if(!window.confirm((0,m.__)("Are you sure you want to delete this item?","redirection")))return;const n=e.groupBy?{groupBy:e.groupBy}:{};s.mutate({action:"delete",items:[t],params:n})}c?h=tw:a&&(h=nw);const y=e=>{t({filterBy:e,page:0,selected:[],selectAll:!1})},v={...e,...(_=e.groupBy,_?{displayOptions:Fj(_),displaySelected:zj(_)[0]?.grouping||[]}:{})};var _;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:v.displaySelected??[],groupBy:e.groupBy??""},x={displayFilters:Fj(v.groupBy),displayGroups:zj(v.groupBy),searchOptions:[{name:"url",title:(0,m.__)("Search URL","redirection")},{name:"url-exact",title:(0,m.__)("Search exact URL","redirection")},{name:"referrer",title:(0,m.__)("Search referrer","redirection")},{name:"agent",title:(0,m.__)("Search user agent","redirection")},{name:"ip",title:(0,m.__)("Search IP","redirection")},{name:"domain",title:(0,m.__)("Search domain","redirection")}],groupBy:Ij(r?.ip_logging||0),bulk:Aj(v.groupBy),rowFilters:v.groupBy?[]:[{label:(0,m.__)("Method","redirection"),value:"method",options:[{label:"GET",value:"get"},{label:"POST",value:"post"},{label:"HEAD",value:"head"}]},{label:(0,m.__)("HTTP Status Code","redirection"),value:"http",options:Pj().filter(e=>parseInt(e.value,10)>=400&&parseInt(e.value,10)<500)}],headers:Nj(v.groupBy).filter(e=>function(e,t){return t.displaySelected.includes(e)}(e.name,v)),validateDisplay:SS},w={onChangePage:e=>{t({page:e,selected:[],selectAll:!1})},onBulk:function(t){if(0===e.selected.length&&!e.selectAll)return;if("delete"===t){const t=e.selectAll?(0,m.__)("Are you sure you want to delete all items?","redirection"):(0,m.__)("Are you sure you want to delete the selected items?","redirection");if(!window.confirm(t))return}const n=e.groupBy?{groupBy:e.groupBy}:{};"delete"===t?e.selectAll?s.mutate({action:"delete",items:[],params:pm({...n,global:!0,filterBy:e.filterBy})}):s.mutate({action:"delete",items:e.selected,params:n}):o(Mj(t,e.selected))},onGroup:e=>{t({groupBy:e,selected:[],selectAll:!1})},onSetOrder:(e,n)=>{t({orderby:"date"===e?"":e,direction:n})},onFilter:y,onSetDisplay:(e,n)=>{t({displayType:e,displaySelected:n})},onSelect:r=>{if("boolean"==typeof r)n(r?u.map(e=>e.id):[]);else if("number"==typeof r||"string"==typeof r){const n=Array.isArray(e.selected)?e.selected:[],i=n.includes(r)?n.filter(e=>e!==r):[...n,r];t({selected:i,selectAll:!1})}else n(r)},onSetAll:e=>{t({selected:e?u.map(e=>e.id):[],selectAll:e})}};return(0,d.jsxs)(d.Fragment,{children:[i&&(0,d.jsx)(xS,{onClose:()=>o(null),redirect:i,rows:u}),(0,d.jsx)(Rw,{logOptions:x,logActions:w,table:b,status:h,total:p,rows:u,saving:[],getRow:(e,t)=>function(e,t){const{created:n,url:r,agent:i,referrer:o,ip:s,domain:a,request_method:l,http_code:c,count:u}=e,p=t?.table?.filterBy||{},h=p.url||p["url-exact"]||"";return[{name:"date",content:n??""},{name:"method",content:l?l.toUpperCase():""},{name:"domain",content:a??""},{name:"url",content:r?(0,d.jsx)(z,{url:jS(e),children:(0,d.jsx)(ej(),{searchWords:[h],textToHighlight:r,autoEscape:!0})}):""},{name:"code",content:c??""},{name:"referrer",content:o?(0,d.jsx)(ej(),{searchWords:[p.referrer||""],textToHighlight:o,autoEscape:!0}):""},{name:"agent",content:i?(0,d.jsx)(ej(),{searchWords:[p.agent||""],textToHighlight:i,autoEscape:!0}):""},{name:"ip",content:s?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("a",{href:"https://redirect.li/ip/?ip="+encodeURIComponent(s),children:(0,d.jsx)(ej(),{searchWords:[p.ip||""],textToHighlight:s,autoEscape:!0})}),""===t?.table?.groupBy&&t?.onFilter&&(0,d.jsx)(Lw,{actions:[(0,d.jsx)(Mw,{onClick:()=>{t.onFilter?.({ip:s})},children:(0,m.__)("Filter by IP","redirection")},"filter-ip")]})]}):""},{name:"count",content:u?new Intl.NumberFormat(window.Redirectioni10n.locale).format(u):""}]}(e,{...t,onFilter:y}),getRowActions:(e,t)=>(0,d.jsx)(wS,{disabled:!1,row:e,onCreate:f,onDelete:g,table:t.table}),renderTableActions:()=>Nw(Dw)&&function(e){const{filterBy:t,groupBy:n}=e;return void 0!==t.url||!n&&0===Object.keys(t).length}(v)?(0,d.jsx)(Yw,{enabled:u.length>0,children:null}):(0,d.jsx)(d.Fragment,{})})]})},CS="redirect",TS=({logType:e,title:t})=>{const n=function(e){return e===CS?"log":"404"===e?"404s":e}(e);return(0,d.jsxs)("form",{method:"post",action:Redirectioni10n.pluginRoot+"&sub="+n,children:[(0,d.jsx)("input",{type:"hidden",name:"_wpnonce",value:jt.nonceMiddleware?.nonce}),(0,d.jsx)("input",{type:"hidden",name:"export-csv",value:""}),(0,d.jsx)("input",{className:"button",type:"submit",name:"",value:t})]})},ES=function(e){const{plugin:t,doImport:n}=e,{name:r,total:i}=t;return(0,d.jsxs)("div",{className:"plugin-importer",children:[(0,d.jsxs)("p",{children:[(0,d.jsx)("strong",{children:r})," (",/* translators: %d is the number of redirects that can be imported */ /* translators: %d is the number of redirects that can be imported */
(0,m.sprintf)((0,m.__)("total = %d","redirection"),i),")"]}),(0,d.jsx)("button",{type:"button",onClick:()=>{n(t)},className:"button-secondary",children:(0,m.sprintf)(
// translators: %s is the plugin name
// translators: %s is the plugin name
(0,m.__)("Import from %s","redirection"),r)})]})},PS=function(){const[e,t]=(0,l.useState)(0),[n,r]=(0,l.useState)(!1),[i,o]=(0,l.useState)("all"),[s,a]=(0,l.useState)("json"),[c,u]=(0,l.useState)(!1),[p,f]=(0,l.useState)(!1),[g,v]=(0,l.useState)(!1),_=(0,l.useRef)(null),{data:b}=hm({}),x=b?.items??[],{data:w=[]}=ud(),j=function(e){const t=h(),{addNotice:n,addError:r,incrementProgress:i,decrementProgress:o}=cd();return pt({mutationFn:async({file:e,groupId:t})=>{i();try{return await jt(Mt(String(t),e))}catch(e){throw o(),sd(e)}},onSuccess:e=>{o(),n(`Imported ${e?.imported||0} redirects`),t.invalidateQueries({queryKey:ad.redirects.lists()})},onError:e=>{r(e.message||"Import failed")},...e})}({onSuccess:e=>{f(e?.imported||0),u(!1)}}),S=dd(),k=function(e){const{addError:t,incrementProgress:n,decrementProgress:r}=cd();return pt({mutationFn:async({moduleId:e,format:t})=>{n();try{return(await jt(Bt(e,t))).data}catch(e){throw r(),sd(e)}},onSuccess:()=>{r()},onError:e=>{t(e.message||"Export failed")},...e})}({onSuccess:e=>{v(e)}});let C="idle";k.isPending?C="loading":k.isSuccess&&(C="success");let T="idle";j.isPending||S.isPending?T="loading":(j.isSuccess||S.isSuccess)&&(T="success"),(0,l.useEffect)(()=>()=>{u(!1),f(!1),v(!1)},[]);const E=e=>{e.preventDefault(),e.stopPropagation(),"loading"!==T&&r(!0)},P=e=>{e.preventDefault(),e.stopPropagation(),r(!1)},O=e=>{e.preventDefault(),e.stopPropagation()},R=e=>{if(e.preventDefault(),e.stopPropagation(),r(!1),"loading"===T)return;const n=e.dataTransfer.files;n.length>0&&(u(n[0]||!1),x.length>0&&x[0]&&t(x[0].id))},N=e=>{const n=e.target.files;n&&n.length>0&&(u(n[0]||!1),x[0]&&t(x[0].id))},A=()=>{_.current?.click()},I=()=>{c&&j.mutate({file:c,groupId:e})},z=()=>{r(!1),u(!1),f(!1),v(!1),_.current&&(_.current.value="")},F=e=>{const{target:n}=e,{name:r,value:i}=n;"group"===r?t(parseInt(i,10)):"module"===r?(o(i),"everything"===i&&a("json")):"format"===r&&a(i)},D=e=>{confirm((0,m.sprintf)(
// translators: %s is the plugin name
// translators: %s is the plugin name
(0,m.__)("Are you sure you want to import from %s?","redirection"),e.name))&&S.mutate(e.id)};return(0,d.jsxs)("div",{className:"import",children:[(0,d.jsx)("h2",{children:(0,m.__)("Import","redirection")}),(()=>{const t=y({dropzone:!0,"dropzone-dropped":!1!==c,"dropzone-importing":"loading"===T,"dropzone-hover":n});let r;return r="loading"===T?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("h3",{children:(0,m.__)("Importing","redirection")}),(0,d.jsx)("p",{children:(0,d.jsx)("code",{children:c&&c.name})}),(0,d.jsx)("div",{className:"is-placeholder",children:(0,d.jsx)("div",{className:"wpl-placeholder__loading"})})]}):"success"===T&&!1!==p&&!1===c?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("h3",{children:(0,m.__)("Finished importing","redirection")}),(0,d.jsxs)("p",{children:[(0,m.__)("Total redirects imported:","redirection")," ",p]}),0===p&&(0,d.jsx)("p",{children:(0,m.__)("Double-check the file is the correct format!","redirection")}),(0,d.jsx)("button",{className:"button-secondary",onClick:z,children:(0,m.__)("OK","redirection")})]}):!1===c?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("h3",{children:(0,m.__)("Import a CSV, .htaccess, or JSON file.","redirection")}),(0,d.jsx)("p",{children:(0,m.__)("Click 'Add File' or drag and drop here.","redirection")}),(0,d.jsx)("button",{type:"button",className:"button-secondary",onClick:A,children:(0,m.__)("Add File","redirection")})]}):(()=>{const t=c&&"application/json"===c.type;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("h3",{children:(0,m.__)("File selected","redirection")}),(0,d.jsx)("p",{children:(0,d.jsx)("code",{children:c&&c.name})}),!t&&(0,d.jsxs)("div",{className:"groups",children:[(0,m.__)("Import to group","redirection")," ",(0,d.jsx)(Sd,{items:fp(x),name:"group",value:String(e),onChange:F})]}),(0,d.jsx)("button",{className:"button-primary",onClick:I,children:(0,m.__)("Upload","redirection")})," "," ",(0,d.jsx)("button",{className:"button-secondary",onClick:z,children:(0,m.__)("Cancel","redirection")})]})})(),(0,d.jsxs)("div",{className:t,onDragEnter:E,onDragLeave:P,onDragOver:O,onDrop:R,children:[(0,d.jsx)("input",{ref:_,type:"file",style:{display:"none"},onChange:N,accept:".json,.csv,.htaccess"}),r]})})(),(0,d.jsx)("p",{children:(0,m.__)("All imports will be appended to the current database - nothing is merged.","redirection")}),(0,d.jsxs)("div",{className:"inline-notice notice-warning",children:[(0,d.jsx)("p",{children:U((0,m.__)("{{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,d.jsx)("code",{}),strong:(0,d.jsx)("strong",{})})}),(0,d.jsx)("p",{children:(0,m.__)('CSV does not include all information, and everything is imported/exported as "URL only" matches. Use the JSON format for a full set of data.',"redirection")})]}),(0,d.jsx)("h2",{children:(0,m.__)("Export","redirection")}),(0,d.jsx)("p",{children:(0,m.__)("Export to CSV, Apache .htaccess, Nginx, or Redirection JSON. The JSON format contains full information, and other formats contain partial information appropriate to the format.","redirection")}),(0,d.jsxs)("p",{className:"redirect-export_buttons",children:[(0,d.jsxs)("select",{name:"module",onChange:F,value:i,children:[(0,d.jsx)("option",{value:"0",children:(0,m.__)("Everything","redirection")}),(0,d.jsx)("option",{value:"1",children:(0,m.__)("WordPress redirects","redirection")}),(0,d.jsx)("option",{value:"2",children:(0,m.__)("Apache redirects","redirection")}),(0,d.jsx)("option",{value:"3",children:(0,m.__)("Nginx redirects","redirection")})]}),(0,d.jsxs)("select",{name:"format",onChange:F,value:s,children:[(0,d.jsx)("option",{value:"json",children:(0,m.__)("Complete data (JSON)","redirection")}),(0,d.jsx)("option",{value:"csv",children:(0,m.__)("CSV","redirection")}),(0,d.jsx)("option",{value:"apache",children:(0,m.__)("Apache .htaccess","redirection")}),(0,d.jsx)("option",{value:"nginx",children:(0,m.__)("Nginx rewrite rules","redirection")})]}),(0,d.jsx)("button",{className:"button-primary",onClick:()=>{k.mutate({moduleId:i,format:s})},children:(0,m.__)("View","redirection")}),(0,d.jsx)("button",{className:"button-secondary",onClick:()=>{window.location.href=mp(i,s)},children:(0,m.__)("Download","redirection")})]}),"loading"===C&&(0,d.jsx)("div",{className:"loader-wrapper loader-textarea",children:(0,d.jsx)("div",{className:"wpl-placeholder__loading"})}),g&&"loading"!==C&&(M=g,(0,d.jsxs)("div",{children:[(0,d.jsx)("textarea",{className:"module-export",rows:14,readOnly:!0,value:M}),(0,d.jsx)("input",{className:"button-secondary",type:"submit",value:(0,m.__)("Close","redirection"),onClick:z})]})),(0,d.jsx)("h2",{children:(0,m.__)("Export Logs","redirection")}),(0,d.jsx)(TS,{logType:CS,title:(0,m.__)("Export redirect","redirection")}),(0,d.jsx)("br",{}),(0,d.jsx)(TS,{logType:"404",title:(0,m.__)("Export 404","redirection")}),w.length>0&&(L=w,(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{children:(0,m.__)("Plugin Importers","redirection")}),(0,d.jsx)("p",{children:(0,m.__)("The following redirect plugins were detected on your site and can be imported from.","redirection")}),L.map((e,t)=>(0,d.jsx)(ES,{plugin:e,doImport:D},t))]}))]});var L,M},OS=()=>[{value:"name",label:(0,m.__)("Name","redirection")},{value:"module",label:(0,m.__)("Module","redirection")},{value:"status",label:(0,m.__)("Status","redirection")},{value:"redirects",label:(0,m.__)("Redirects","redirection")}],RS=e=>[{label:(0,m.__)("Status","redirection"),value:"status",options:[{label:(0,m.__)("Enabled","redirection"),value:"enabled"},{label:(0,m.__)("Disabled","redirection"),value:"disabled"}]},{label:(0,m.__)("Module","redirection"),value:"module",options:e}];function NS(e){const t=h(),{incrementProgress:n,decrementProgress:r,addNotice:i,addError:o}=cd(),{setGroupsTable:s}=Gx();return pt({mutationFn:async({action:e,items:t,params:i={}})=>{n();try{return await jt(Qt(e,{items:t},i))}catch(e){throw r(),sd(e)}},onSuccess:(e,n)=>{r();let o=n.action;"enable"===n.action?o="enabled":"disable"===n.action&&(o="disabled"),i(`Groups ${o}`),s({page:0,selected:[],selectAll:!1}),t.invalidateQueries({queryKey:ad.groups.lists()})},onError:e=>{o(e.message||"Failed to perform group action")},...e})}const AS=[{value:1,label:"WordPress"},{value:2,label:"Apache"},{value:3,label:"Nginx"}];function IS(){return AS}const zS=function(e){const{disabled:t}=e,[n,r]=(0,l.useState)(""),[i,o]=(0,l.useState)(1),{mutate:s}=function(){const e=h(),{incrementProgress:t,decrementProgress:n,addNotice:r,addError:i}=cd();return pt({mutationFn:async e=>{t();try{const t=await jt(Ft(e));return am.parse(t).items[0]??null}catch(e){throw n(),sd(e)}},onSuccess:()=>{n(),r("Group created"),e.invalidateQueries({queryKey:ad.groups.lists()})},onError:e=>{i(e.message||"Failed to create group")}})}();return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("h2",{children:(0,m.__)("Add Group","redirection")}),(0,d.jsx)("p",{children:(0,m.__)("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,d.jsxs)("form",{onSubmit:function(e){e.preventDefault(),s({name:n,moduleId:i,position:0}),r("")},children:[(0,d.jsx)("table",{className:"form-table redirect-groups",children:(0,d.jsx)("tbody",{children:(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{children:(0,m.__)("Name","redirection")}),(0,d.jsxs)("td",{children:[(0,d.jsx)("input",{size:30,className:"regular-text",type:"text",name:"name",value:n,onChange:e=>r(e.target.value),disabled:t}),(0,d.jsx)(Sd,{name:"group",value:String(i),onChange:e=>o(parseInt(e.target.value,10)),items:IS().map(e=>({label:e.label,value:String(e.value)})),disabled:t})," ",(0,d.jsx)("input",{className:"button-primary",type:"submit",name:"add",value:"Add",disabled:t||""===n})]})]})})}),2===i&&(0,d.jsx)("p",{children:(0,m.__)("Note that you will need to set the Apache module path in your Redirection options.","redirection")})]})]})},FS=function(e){const{disabled:t,rowParams:n,row:r}=e,{mutate:i}=NS(),{setRowMode:o,rowMode:s}=n,{id:a,enabled:l}=r,c=[];return"edit"===s?null:(Nw(Fw)&&c.push((0,d.jsx)(Mw,{onClick:()=>o("edit"!==s&&"edit"),children:(0,m.__)("Edit","redirection")},"0")),Nw("redirection_cap_group_delete")&&c.push((0,d.jsx)(Mw,{onClick:()=>{window.confirm((0,m.__)("Are you sure you want to delete this item?","redirection"))&&i({action:"delete",items:[a]})},children:(0,m.__)("Delete","redirection")},"1")),Nw(Iw)&&c.push((0,d.jsx)(Mw,{href:Redirectioni10n.pluginRoot+"&"+encodeURIComponent("filterby[group]")+"="+a,children:(0,m.__)("View Redirects","redirection")},"2")),Nw(Fw)&&(l?c.push((0,d.jsx)(Mw,{onClick:()=>i({action:"disable",items:[a]}),children:(0,m.__)("Disable","redirection")},"3")):c.push((0,d.jsx)(Mw,{onClick:()=>i({action:"enable",items:[a]}),children:(0,m.__)("Enable","redirection")},"3"))),(0,d.jsx)(Lw,{disabled:t,actions:c}))},DS=function({row:e}){const{enabled:t}=e;return t?(0,d.jsx)("div",{className:"redirect-status redirect-status__enabled",children:"✓"}):(0,d.jsx)("div",{className:"redirect-status redirect-status__disabled",children:"×"})},LS=function({row:e,filters:t}){const{enabled:n,name:r}=e;return n?(0,d.jsx)(ej(),{searchWords:[t.name],textToHighlight:r,autoEscape:!0}):(0,d.jsx)("s",{children:r})},MS=function({row:e}){const{module_id:t}=e,n=function(e){const t=AS.find(t=>t.value===e);return t?t.label:"WordPress"}(t),{setGroupsTable:r}=Gx();return(0,d.jsx)(d.Fragment,{children:(0,d.jsx)($f,{onClick:()=>r({filterBy:{module:String(t)},page:0}),title:(0,m.sprintf)(
// translators: %(type)s is the module type name
// translators: %(type)s is the module type name
(0,m.__)("Filter on: %(type)s","redirection"),{type:n}),children:n})})},$S=function(e){const{group:t,onCancel:n}=e,[r,i]=(0,l.useState)(t.name),[o,s]=(0,l.useState)(t.module_id),{mutate:a}=function(){const e=h(),{incrementProgress:t,decrementProgress:n,addNotice:r,addError:i}=cd();return pt({mutationFn:async e=>{t();try{const{id:t,...n}=e,r=await jt(zt(t,n));return lm.parse(r).item}catch(e){throw n(),sd(e)}},onSuccess:t=>{n(),r("Group saved"),e.invalidateQueries({queryKey:ad.groups.lists()}),e.invalidateQueries({queryKey:ad.groups.detail(t.id)})},onError:e=>{i(e.message||"Failed to update group")}})}();return(0,d.jsx)("form",{onSubmit:function(e){e.preventDefault(),e.stopPropagation(),n(),a({id:t.id,name:r,moduleId:o})},children:(0,d.jsx)("table",{className:"edit-groups",children:(0,d.jsxs)("tbody",{children:[(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{children:(0,m.__)("Name","redirection")}),(0,d.jsx)("td",{children:(0,d.jsx)("input",{type:"text",className:"regular-text",name:"name",value:r,onChange:e=>i(e.target.value)})})]}),(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{children:(0,m.__)("Module","redirection")}),(0,d.jsx)("td",{children:(0,d.jsx)(Sd,{name:"module_id",value:String(o),onChange:e=>s(parseInt(e.target.value,10)),items:IS().map(e=>({label:e.label,value:String(e.value)}))})})]}),(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{}),(0,d.jsxs)("td",{children:[(0,d.jsxs)("div",{className:"table-actions",children:[(0,d.jsx)("input",{className:"button-primary",type:"submit",name:"save",value:(0,m.__)("Save","redirection")})," ",(0,d.jsx)("input",{className:"button-secondary",type:"button",name:"cancel",value:(0,m.__)("Cancel","redirection"),onClick:n})]}),2===o&&(0,d.jsxs)("p",{children:[(0,d.jsx)("br",{}),(0,m.__)("Note that you will need to set the Apache module path in your Redirection options.","redirection")]})]})]})]})})})};function US(e){return e.includes("name")?e:e.concat(["name"])}const BS=function(){const e=Gx(e=>e.groups),{setGroupsTable:t,setGroupsSelected:n}=Gx();Xx({table:e,setTable:t,allowedOrder:["name","id"],allowedFilters:["name","status","module"],defaultOrder:"name",pageName:"groups"});const r=NS(),{data:i,isLoading:o}=hm(e),s=i?.items??[],a=i?.total??0,l=o?"loading":"complete",c={displayFilters:OS(),displayGroups:[{value:"standard",label:(0,m.__)("Standard Display","redirection"),grouping:["name","module","redirects"]},{value:"minimal",label:(0,m.__)("Compact Display","redirection"),grouping:["name"]},{value:"all",label:(0,m.__)("Display All","redirection"),grouping:OS().map(e=>e.value)}],searchOptions:[{name:"name",title:(0,m.__)("Search","redirection")}],groupBy:[],bulk:[{id:"delete",name:(0,m.__)("Delete","redirection")},{id:"enable",name:(0,m.__)("Enable","redirection")},{id:"disable",name:(0,m.__)("Disable","redirection")}],rowFilters:RS(IS().map(e=>({label:e.label,value:`${e.value}`}))),headers:[{name:"status",title:(0,m.__)("Status","redirection"),sortable:!1},{name:"name",title:(0,m.__)("Name","redirection"),primary:!0},{name:"redirects",title:(0,m.__)("Redirects","redirection"),sortable:!1},{name:"module",title:(0,m.__)("Module","redirection"),sortable:!1}].filter(t=>function(e,t){return t.displaySelected?.includes(e)??!1}(t.name,e)),validateDisplay:US},u={onChangePage:e=>{t({page:e,selected:[],selectAll:!1})},onBulk:t=>{if(0===e.selected.length&&!e.selectAll)return;if("delete"===t){const t=e.selectAll?(0,m.__)("Are you sure you want to delete all items?","redirection"):(0,m.__)("Are you sure you want to delete the selected items?","redirection");if(!window.confirm(t))return}const n=e.selected;if(e.selectAll){const n={global:!0,filterBy:e.filterBy};r.mutate({action:t,items:[],params:n})}else r.mutate({action:t,items:n})},onSelect:r=>{const i=e.selected;"boolean"==typeof r?n(r?s.map(e=>e.id):[]):Array.isArray(r)?n(r):i.includes(r)?t({selected:i.filter(e=>e!==r),selectAll:!1}):t({selected:[...i,r],selectAll:!1})},onSetOrder:(e,n)=>{t({orderby:e,direction:n})},onFilter:e=>{t({filterBy:e,page:0,selected:[],selectAll:!1})},onSetDisplay:(e,n)=>{t({displayType:e,displaySelected:n})},onSetAll:e=>{t({selected:e?s.map(e=>e.id):[],selectAll:e})},onGroup:e=>{t({groupBy:e,page:0,selected:[],selectAll:!1})}},p={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,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(Rw,{logOptions:c,logActions:u,table:p,status:l,total:a,rows:s,saving:[],getRow:(e,t)=>function(e,t){const{redirects:n}=e,{rowMode:r,setRowMode:i}=t;return[{name:"status",content:(0,d.jsx)(DS,{row:e})},{name:"name",content:"edit"===r?(0,d.jsx)($S,{group:e,onCancel:()=>i(!1)}):(0,d.jsx)(LS,{row:e,filters:t.table.filterBy})},{name:"redirects",content:new Intl.NumberFormat(window.Redirectioni10n.locale).format(n)},{name:"module",content:(0,d.jsx)(MS,{row:e})}]}(e,t),getRowActions:(e,t)=>(0,d.jsx)(FS,{disabled:!1,row:e,rowParams:t})}),Nw(Fw)&&(0,d.jsx)(zS,{disabled:!1})]})},ZS=()=>[{value:"source",label:(0,m.__)("Source","redirection")},{value:"flags",label:(0,m.__)("URL options","redirection")},{value:"query",label:(0,m.__)("Query Parameters","redirection")},{value:"title",label:(0,m.__)("Title","redirection")},{value:"target",label:(0,m.__)("Target","redirection")},{value:"code",label:(0,m.__)("HTTP code","redirection")},{value:"match_type",label:(0,m.__)("Match Type","redirection")},{value:"position",label:(0,m.__)("Position","redirection")},{value:"last_count",label:(0,m.__)("Hits","redirection")},{value:"last_access",label:(0,m.__)("Last Access","redirection")},{value:"status",label:(0,m.__)("Status","redirection")},{value:"action_type",label:(0,m.__)("Action Type","redirection")},{value:"group",label:(0,m.__)("Group","redirection")}],qS=function(e){const{addTop:t}=e,n=y({"add-new":!0,edit:!0,addTop:t});return(0,d.jsxs)(d.Fragment,{children:[!t&&Nw(zw)&&(0,d.jsx)("h2",{children:(0,m.__)("Add new redirection","redirection")}),(0,d.jsx)("div",{className:n,children:(0,d.jsx)(bS,{item:Sj("",0,e.defaultFlags),saveButton:(0,m.__)("Add Redirect","redirection"),autoFocus:!!t})})]})},HS=function(e){const{disabled:t,rowParams:n,row:r}=e,{mutate:i}=vS(),{mutate:o}=_S("disable"),{mutate:s}=_S("enable"),{setRowMode:a,rowMode:l}=n,{id:c,enabled:u,regex:p,action_type:h,match_type:f}=r,g=[];return"edit"===l?null:(u&&Nw(zw)&&g.push((0,d.jsx)(Mw,{onClick:()=>a("edit"),children:(0,m.__)("Edit","redirection")},"1")),Nw("redirection_cap_redirect_delete")&&g.push((0,d.jsx)(Mw,{onClick:()=>{window.confirm((0,m.__)("Are you sure you want to delete this item?","redirection"))&&i({items:[c]})},children:(0,m.__)("Delete","redirection")},"2")),Nw(zw)&&(u?g.push((0,d.jsx)(Mw,{onClick:()=>o({items:[c]}),children:(0,m.__)("Disable","redirection")},"3")):g.push((0,d.jsx)(Mw,{onClick:()=>s({items:[c]}),children:(0,m.__)("Enable","redirection")},"4"))),!u||p||"url"!==h||"url"!==f&&"server"!==f||g.push((0,d.jsx)(Mw,{onClick:()=>a("check"),children:(0,m.__)("Check Redirect","redirection")},"5")),(0,d.jsx)(Lw,{disabled:t,actions:g}))},WS=function({row:e}){const{enabled:t}=e;return t?(0,d.jsx)("div",{className:"redirect-status redirect-status__enabled",children:"✓"}):(0,d.jsx)("div",{className:"redirect-status redirect-status__disabled",children:"×"})},GS=(e,t)=>e.includes(t);function VS(e,t,n){return n===vj?e.server+t:t}function QS(e,t){const{match_type:n,regex:r,action_data:i,url:o}=e;return r?t:(0,d.jsx)(z,{url:VS(i,o,n),children:t})}function KS(e,t){return t?e:(0,d.jsx)("s",{children:e})}const JS=function(e){const{displaySelected:t,row:n,filters:r}=e,{match_type:i,url:o,title:s,action_data:a,enabled:l}=n,c=(0,d.jsx)(ej(),{searchWords:[r.url||""],textToHighlight:VS(a,o,i),autoEscape:!0}),u=(0,d.jsx)(ej(),{searchWords:[r.title||""],textToHighlight:s,autoEscape:!0});return GS(t,"title")&&!GS(t,"source")?(0,d.jsx)("p",{children:QS(n,KS(s?u:c,l))}):(0,d.jsxs)(d.Fragment,{children:[GS(t,"title")&&s&&(0,d.jsx)("p",{children:QS(n,KS(u,l))}),GS(t,"source")&&c&&(0,d.jsx)("p",{children:QS(n,KS(c,l))})]})},YS=function(e){const{row:t,filters:n}=e,{match_type:r,action_data:i}=t;return r===uj&&i?(0,d.jsx)("span",{className:"target",children:(0,d.jsx)(ej(),{searchWords:[n.target??""],textToHighlight:i.url??"",autoEscape:!0})}):null},XS=function({name:e,className:t,strikethrough:n}){return(0,d.jsx)($f,{className:y("redirect-source__flag",t),children:n?(0,d.jsx)("s",{children:e}):e})},ek=function(e){const{row:t,defaultFlags:n}=e,{match_data:{source:r}}=t;return(0,d.jsx)(d.Fragment,{children:Object.keys(r).filter(e=>n[e]!==r[e]&&"flag_query"!==e).map(e=>{const t=Oj().find(t=>t.value===e);return(0,d.jsx)(XS,{name:t?.label||"",className:"redirect-source__"+e,strikethrough:!!n[e]&&!r[e]},e)})})},tk=function(e){const{defaultFlags:t,row:n}=e,{match_data:{source:r}}=n;if(t.flag_query!==r.flag_query){let e;return e="ignore"===r.flag_query?(0,m.__)("Ignore Query","redirection"):"pass"===r.flag_query?(0,m.__)("Ignore & Pass Query","redirection"):(0,m.__)("Exact Query","redirection"),(0,d.jsx)(XS,{name:e})}return null},nk=function(e){const{row:t,table:n,defaultFlags:r}=e,{displaySelected:i}=n;return(0,d.jsxs)("div",{className:"redirect-column-wrap",children:[(0,d.jsxs)("div",{className:"redirect-source__details",children:[(0,d.jsx)(JS,{row:t,displaySelected:i,filters:n.filterBy}),GS(i,"target")&&(0,d.jsx)(YS,{row:t,filters:n.filterBy})]}),(0,d.jsxs)("div",{className:"redirect-source__flags",children:[GS(i,"flags")&&(0,d.jsx)(ek,{row:t,defaultFlags:r}),GS(i,"query")&&(0,d.jsx)(tk,{row:t,defaultFlags:r})]})]})},rk=function(e){const{action_code:t,action_type:n}=e;return n===lj?(0,m.__)("pass","redirection"):n===cj?"-":t},ik=function(e){const{row:t,group:n}=e,r=n.rows.find(e=>e.id===t.group_id);return r?(0,d.jsxs)("div",{className:"redirect-column-wrap",children:[r.name," ",(0,d.jsx)($f,{children:r.moduleName})]}):null};function ok(e,t){const n=t.find(t=>t.value===e);return n?n.label:"-"}function sk({url:e,desiredCode:t=0,desiredTarget:n=null}){return(0,d.jsx)(Nm,{url:e,desiredCode:t,desiredTarget:n})}function ak(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 lk(e){return e.includes("source")?e:e.concat(["source"])}function ck(e){return e.includes("title")||e.includes("source")?lk(e):lk(e.concat(["title"]))}function uk(e){return[{value:"0",label:(0,m.__)("All groups","redirection")}].concat(fp(e))}const dk=function(){const e=Gx(e=>e.redirects),t=Gx(e=>e.redirectsAddTop),{setRedirectsTable:n,setRedirectsSelected:r}=Gx(),i=pe(e=>e.values);Xx({table:e,setTable:n,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}=hm({}),a=o?.items??[],l=vS(),c=_S("enable"),u=_S("disable"),p=_S("reset"),{data:h,isLoading:f,isSuccess:g}=function(e={},t){const n=pm(e);return ct({queryKey:ad.redirects.list(n),queryFn:async()=>{try{const e=await jt(Ot(n));return om.parse(e)}catch(e){throw sd(e)}},...t})}(e),y=h?.items??[],v=h?.total??0;let _=ew;f?_=tw:g&&(_=nw);const b={flag_query:i?.flag_query??"ignore",flag_case:i?.flag_case??!1,flag_trailing:i?.flag_trailing??!1,flag_regex:i?.flag_regex??!1},x=_===nw&&s&&Nw(zw),w=e=>{n({filterBy:e,page:0,selected:[],selectAll:!1})},j={displayFilters:ZS(),displayGroups:[{value:"standard",label:(0,m.__)("Standard Display","redirection"),grouping:["last_count","last_access","source","target","code","title"]},{value:"minimal",label:(0,m.__)("Compact Display","redirection"),grouping:["source","last_count","last_access","target"]},{value:"all",label:(0,m.__)("Display All","redirection"),grouping:ZS().map(e=>e.value)}],searchOptions:[{name:"url",title:(0,m.__)("Search URL","redirection")},{name:"target",title:(0,m.__)("Search target URL","redirection")},{name:"title",title:(0,m.__)("Search title","redirection")}],groupBy:uk(a),bulk:[{id:"delete",name:(0,m.__)("Delete","redirection")},{id:"enable",name:(0,m.__)("Enable","redirection")},{id:"disable",name:(0,m.__)("Disable","redirection")},{id:"reset",name:(0,m.__)("Reset hits","redirection")}],rowFilters:[{label:(0,m.__)("Status","redirection"),value:"status",options:[{label:(0,m.__)("Enabled","redirection"),value:"enabled"},{label:(0,m.__)("Disabled","redirection"),value:"disabled"}]},{label:(0,m.__)("URL match","redirection"),value:"url-match",options:[{label:(0,m.__)("Regular Expression","redirection"),value:"regular"},{label:(0,m.__)("Plain","redirection"),value:"plain"}]},{label:(0,m.__)("Match Type","redirection"),value:"match",options:kj()},{label:(0,m.__)("Action Type","redirection"),value:"action",options:Cj()},{label:(0,m.__)("HTTP Status Code","redirection"),value:"http",options:Pj()},{label:(0,m.__)("Last Accessed","redirection"),value:"access",options:[{label:(0,m.__)("Never accessed","redirection"),value:"never"},{label:(0,m.__)("Not accessed in last month","redirection"),value:"month"},{label:(0,m.__)("Not accessed in last year","redirection"),value:"year"}]}],headers:[{name:"status",title:(0,m.__)("Status","redirection"),sortable:!1},{name:"source",title:(0,m.__)("URL","redirection"),primary:!0},{name:"match_type",title:(0,m.__)("Match Type","redirection"),sortable:!1},{name:"action_type",title:(0,m.__)("Action Type","redirection"),sortable:!1},{name:"code",title:(0,m.__)("Code","redirection"),sortable:!1},{name:"group",title:(0,m.__)("Group","redirection"),sortable:!1},{name:"position",title:(0,m.__)("Pos","redirection")},{name:"last_count",title:(0,m.__)("Hits","redirection"),sortable:!0},{name:"last_access",title:(0,m.__)("Last Access","redirection")}].filter(t=>function(e,t){return t.displaySelected.includes(e)}(t.name,e)),validateDisplay:ck},S={onChangePage:e=>{n({page:e,selected:[],selectAll:!1})},onBulk:t=>{const n=e.selected;if(0!==n.length||e.selectAll){if("delete"===t){const t=e.selectAll?(0,m.__)("Are you sure you want to delete all items?","redirection"):(0,m.__)("Are you sure you want to delete the selected items?","redirection");if(!window.confirm(t))return}if(e.selectAll){const n={global:!0,filterBy:e.filterBy};"delete"===t&&l.mutate({items:[],params:n})}else switch(t){case"delete":l.mutate({items:n});break;case"enable":c.mutate({items:n});break;case"disable":u.mutate({items:n});break;case"reset":p.mutate({items:n})}}},onSelect:t=>{if("boolean"==typeof t)r(t?y.map(e=>e.id):[]);else if("number"==typeof t||"string"==typeof t){const r=e.selected.includes(t)?e.selected.filter(e=>e!==t):[...e.selected,t];n({selected:r,selectAll:!1})}else r(t)},onSetOrder:(e,t)=>{n({orderby:e,direction:t})},onFilter:t=>{w({...t,...e.filterBy?.group?{group:String(e.filterBy.group)}:{}})},onSetDisplay:(e,t)=>{n({displayType:e,displaySelected:t})},onSetAll:e=>{n({selected:e?y.map(e=>e.id):[],selectAll:e})},onGroup:t=>{w(parseInt(t,10)>0?{...e.filterBy||{},group:t}:{})}},k={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,d.jsxs)("div",{className:"redirects",children:[t&&Nw(zw)&&(0,d.jsx)(qS,{defaultFlags:b,addTop:!0}),(0,d.jsx)(Rw,{logOptions:j,logActions:S,table:k,status:_,total:v,rows:y,saving:[],getRow:(e,t)=>function(e,t,n,r,i){const{last_access:o,hits:s,position:a,match_type:l,action_type:c,action_code:u,action_data:p}=e,{rowMode:h,setRowMode:f}=t;return"edit"===h?(0,d.jsx)(bS,{item:e,onCancel:()=>f(!1)}):[{name:"status",content:(0,d.jsx)(WS,{row:e})},{name:"source",content:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(nk,{row:e,table:t.table,defaultFlags:r}),"check"===h&&(0,d.jsx)(xm,{onClose:()=>f(null),children:(0,d.jsx)(sk,{url:pp((m=e,"server"===m.match_type?m.action_data.server??"":document.location.origin),ak(e.url)),desiredCode:u,desiredTarget:p})})]}),alwaysDisplay:!0},{name:"match_type",content:ok(l,kj())},{name:"action_type",content:ok(c,Cj())},{name:"code",content:rk(e)},{name:"group",content:(0,d.jsx)(ik,{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,b,{rows:a}),getRowActions:(e,t)=>(0,d.jsx)(HS,{disabled:!1,row:e,rowParams:t})}),x&&!t&&(0,d.jsx)(qS,{defaultFlags:b,addTop:!1})]})},pk=function({page:e}){switch(e){case"support":return(0,d.jsx)(Mm,{});case"404s":return(0,d.jsx)(kS,{});case"log":return(0,d.jsx)(ij,{});case"io":return(0,d.jsx)(PS,{});case"groups":return(0,d.jsx)(BS,{});case"options":return(0,d.jsx)(jm,{});case"site":return(0,d.jsx)(Fx,{})}return(0,d.jsx)(dk,{})},hk=function(){return(0,d.jsxs)(Q,{errors:"",details:J().concat(["Buster: 5.7.5 === "+Redirectioni10n.version]),type:"fixed",title:(0,m.__)("Cached Redirection detected","redirection"),links:K(),locale:"redirection",children:[(0,d.jsx)("p",{children:(0,m.__)("Please clear your browser cache and reload this page.","redirection")}),(0,d.jsxs)("p",{children:[(0,m.__)("If you are using a caching system such as Cloudflare then please read this:","redirection"),(0,d.jsx)(z,{url:"https://redirection.me/support/problems/cloudflare/",children:(0,m.__)("clearing your cache.","redirection")})]})]})},fk=function(){const{update_notice:e=!1}=window.Redirectioni10n,{mutate:t}=Od();return e&&Nw("redirection_cap_option_manage")?(0,d.jsx)(Gf,{children:(0,d.jsxs)("p",{children:[U((0,m.sprintf)(
// translators: %s is the version number
// translators: %s is the version number
(0,m.__)("Version %s installed! Please read the {{url}}release notes{{/url}} for details.","redirection"),e),{url:(0,d.jsx)(z,{url:"https://redirection.me/blog/redirection-version-"+e.replace(".","-")+"/"})})," ",(0,d.jsx)(Up,{onClick:function(){t({update_notice:window.Redirectioni10n.update_notice}),window.Redirectioni10n.update_notice=!1},children:(0,m.__)("OK","redirection")})]})}):null},mk=Redirectioni10n?.caps?.pages||[];function gk(){const e=cd(e=>e.errors),t=cd(e=>e.notices),{clearErrors:n,clearNotices:r}=cd(),i=pe(e=>e.database.status),o=pe(e=>e.showDatabase),s=pe(e=>e.database.inProgress),a=pe(e=>e.values?.plugin_update??""),{setShowDatabase:c,setApi:u}=pe(),{setErrorsTable:p,setLogsTable:h,setRedirectsTable:f,setRedirectsAddTop:g,setGroupsTable:y}=Gx(),[v,_]=(0,l.useState)(Ip(mk));(0,l.useEffect)(()=>{if(window.Redirectioni10n?.api?.routes&&u({routes:window.Redirectioni10n.api.routes,current:window.Redirectioni10n.api.current??""}),window.Redirectioni10n?.settings&&!pe.getState().values){const{setValues:e,setLoadStatus:t}=pe.getState();e(window.Redirectioni10n.settings),t("success")}if(window.Redirectioni10n?.database){const{setDatabase:e}=pe.getState();e(window.Redirectioni10n.database)}},[u]);const b=(0,l.useCallback)(e=>{_(e)},[]),x=(0,l.useCallback)(()=>{n()},[n]),w=(0,l.useMemo)(()=>[{name:(0,m.__)("Redirects","redirection"),value:""},{name:(0,m.__)("Groups","redirection"),value:"groups"},{name:(0,m.__)("Site","redirection"),value:"site"},{name:(0,m.__)("Log","redirection"),value:"log"},{name:(0,m.__)("404s","redirection"),value:"404s"},{name:(0,m.__)("Import/Export","redirection"),value:"io"},{name:(0,m.__)("Options","redirection"),value:"options"},{name:(0,m.__)("Support","redirection"),value:"support"}].filter(e=>Aw(e.value)||""===e.value&&Aw("redirect")),[]),j=(0,l.useMemo)(()=>({redirect:(0,m.__)("Redirections","redirection"),site:(0,m.__)("Site","redirection"),groups:(0,m.__)("Groups","redirection"),io:(0,m.__)("Import/Export","redirection"),log:(0,m.__)("Logs","redirection"),"404s":(0,m.__)("404 errors","redirection"),options:(0,m.__)("Options","redirection"),support:(0,m.__)("Support","redirection")}),[]),S=(0,l.useCallback)(e=>{b(""===e?"redirect":e),"404s"===e?p({orderby:"",direction:"desc",page:0,perPage:25,selected:[],filter:"",filterBy:"",groupBy:""}):"log"===e?h({orderby:"",direction:"desc",page:0,perPage:25,selected:[],filter:"",filterBy:"",groupBy:""}):""===e?f({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,p,h,f,y]);if("5.7.5"!==Redirectioni10n.version)return(0,d.jsx)(hk,{});if("need-install"===i||"finish-install"===i)return(0,d.jsx)(Sp,{renderCrash:Mp,extra:{page:v},children:(0,d.jsx)(up,{})});const k="prompt"===a&&("need-update"===i||"finish-update"===i);return(0,d.jsx)(Sp,{renderCrash:Mp,extra:{page:v},children:(0,d.jsxs)("div",{className:"wrap redirection notranslate",translate:"no",children:[k&&(0,d.jsx)(wp,{onShowUpgrade:()=>c(!0),showDatabase:o}),!s&&"finish-update"!==i&&!o&&(0,d.jsxs)(zp,{page:v,setPage:b,onPageChange:x,allowedPages:mk,baseUrl:"?page=redirection.php",defaultPage:"redirect",children:[(0,d.jsx)("h1",{className:"wp-heading-inline",children:j[v]}),"redirect"===v&&Nw(zw)&&(0,d.jsx)("button",{type:"button",onClick:()=>g(!0),className:"page-title-action",children:(0,m.__)("Add New","redirection")}),(0,d.jsx)(fk,{}),(0,d.jsx)(Tp,{onChangePage:S,currentPage:v,menu:w,home:"redirect",urlBase:Redirectioni10n.pluginRoot}),(0,d.jsx)(Q,{errors:e,onClear:()=>n(),renderDebug:he,details:J(),links:K(),locale:"redirection",children:(0,d.jsx)(Fp,{})}),(0,d.jsx)(pk,{page:v}),(0,d.jsx)(Op,{notices:t,onClear:()=>r(),snackBarViewText:(0,m.__)("View notice","redirection")})]})]})})}var yk=class extends me{constructor(e={}){super(),this.config=e,this.#Z=new Map}#Z;build(e,t,n){const r=t.queryKey,i=t.queryHash??Ce(r,t);let o=this.get(i);return o||(o=new Je({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),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(){Ze.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=>Se(t,e))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Se(e,t)):t}notify(e){Ze.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Ze.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Ze.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},vk=class extends me{constructor(e={}){super(),this.config=e,this.#q=new Set,this.#H=new Map,this.#W=0}#q;#H;#W;build(e,t,n){const r=new ut({client:e,mutationCache:this,mutationId:++this.#W,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#q.add(e);const t=_k(e);if("string"==typeof t){const n=this.#H.get(t);n?n.push(e):this.#H.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#q.delete(e)){const t=_k(e);if("string"==typeof t){const n=this.#H.get(t);if(n)if(n.length>1){const t=n.indexOf(e);-1!==t&&n.splice(t,1)}else n[0]===e&&this.#H.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=_k(e);if("string"==typeof t){const n=this.#H.get(t),r=n?.find(e=>"pending"===e.state.status);return!r||r===e}return!0}runNext(e){const t=_k(e);if("string"==typeof t){const n=this.#H.get(t)?.find(t=>t!==e&&t.state.isPaused);return n?.continue()??Promise.resolve()}return Promise.resolve()}clear(){Ze.batch(()=>{this.#q.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#q.clear(),this.#H.clear()})}getAll(){return Array.from(this.#q)}find(e){const t={exact:!0,...e};return this.getAll().find(e=>ke(t,e))}findAll(e={}){return this.getAll().filter(t=>ke(e,t))}notify(e){Ze.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(e=>e.state.isPaused);return Ze.batch(()=>Promise.all(e.map(e=>e.continue().catch(_e))))}};function _k(e){return e.options.scope?.id}function bk(e){return{onFetch:(t,n)=>{const r=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 n=!1;const c=e=>{!function(e,n,r){let i,o=!1;Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t.signal,o||(o=!0,i.aborted?r():i.addEventListener("abort",r,{once:!0})),i)})}(e,0,()=>n=!0)},u=Me(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject();if(null==r&&e.pages.length)return Promise.resolve(e);const o=(()=>{const e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?"backward":"forward",meta:t.options.meta};return c(e),e})(),s=await u(o),{maxPages:a}=t.options,l=i?De:Fe;return{pages:l(e.pages,s,a),pageParams:l(e.pageParams,r,a)}};if(i&&o.length){const e="backward"===i,t={pages:o,pageParams:s},n=(e?wk:xk)(r,t);a=await d(t,n,e)}else{const t=e??o.length;do{const e=0===l?s[0]??r.initialPageParam:xk(r,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},n):t.fetchFn=c}}}function xk(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function wk(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}const jk=new class{#G;#M;#p;#V;#Q;#K;#J;#Y;constructor(e={}){this.#G=e.queryCache||new yk,this.#M=e.mutationCache||new vk,this.#p=e.defaultOptions||{},this.#V=new Map,this.#Q=new Map,this.#K=0}mount(){this.#K++,1===this.#K&&(this.#J=Ue.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#G.onFocus())}),this.#Y=qe.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#G.onOnline())}))}unmount(){this.#K--,0===this.#K&&(this.#J?.(),this.#J=void 0,this.#Y?.(),this.#Y=void 0)}isFetching(e){return this.#G.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.#G.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=this.#G.build(this,t),r=n.state.data;return void 0===r?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(we(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#G.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),i=this.#G.get(r.queryHash),o=i?.state.data,s=function(e,t){return"function"==typeof e?e(t):e}(t,o);if(void 0!==s)return this.#G.build(this,r).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return Ze.batch(()=>this.#G.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#G.get(t.queryHash)?.state}removeQueries(e){const t=this.#G;Ze.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){const n=this.#G;return Ze.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Ze.batch(()=>this.#G.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(_e).catch(_e)}invalidateQueries(e,t={}){return Ze.batch(()=>(this.#G.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 n={...t,cancelRefetch:t.cancelRefetch??!0},r=Ze.batch(()=>this.#G.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(_e)),"paused"===e.state.fetchStatus?Promise.resolve():t}));return Promise.all(r).then(_e)}fetchQuery(e){const t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);const n=this.#G.build(this,t);return n.isStaleByTime(we(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(_e).catch(_e)}fetchInfiniteQuery(e){return e.behavior=bk(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(_e).catch(_e)}ensureInfiniteQueryData(e){return e.behavior=bk(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return qe.isOnline()?this.#M.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#G}getMutationCache(){return this.#M}getDefaultOptions(){return this.#p}setDefaultOptions(e){this.#p=e}setQueryDefaults(e,t){this.#V.set(Te(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#V.values()],n={};return t.forEach(t=>{Ee(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#Q.set(Te(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#Q.values()],n={};return t.forEach(t=>{Ee(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#p.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Ce(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===Le&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#p.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#G.clear(),this.#M.clear()}}({defaultOptions:{queries:{staleTime:3e5,retry:!1,refetchOnWindowFocus:!1},mutations:{retry:!1}}});try{new Intl.NumberFormat(window.Redirectioni10n.locale)}catch(e){window.Redirectioni10n.locale="en-US"}function Sk(){return(0,d.jsxs)(f,{client:jk,children:[(0,d.jsx)(gk,{}),!1]})}jt.resetMiddlewares(),jt.use(jt.createRootURLMiddleware(window.Redirectioni10n?.api?.WP_API_root??"/wp-json/")),jt.use(jt.createNonceMiddleware(window.Redirectioni10n?.api?.WP_API_nonce??"")),document.querySelector("#react-ui")&&window.Redirectioni10n&&(function(){const e=document.getElementById("react-ui");e&&(0,a.H)(e).render((0,d.jsx)(Sk,{}))}(),window.redirection=window.Redirectioni10n.version)},576(e,t,n){"use strict";var r=n(795);t.H=r.createRoot,r.hydrateRoot},465(e,t,n){e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}return n.m=e,n.c=t,n.p="",n(0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=(r=n(2))&&r.__esModule?r:{default:r};t.default=i.default,e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};t.default=function(e){var t=e.activeClassName,n=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,v=void 0===y?{}:y,_=e.highlightTag,b=void 0===_?"mark":_,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 n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}(e,["activeClassName","activeIndex","activeStyle","autoEscape","caseSensitive","className","findChunks","highlightClassName","highlightStyle","highlightTag","sanitize","searchWords","textToHighlight","unhighlightTag","unhighlightClassName","unhighlightStyle"]),O=(0,o.findAll)({autoEscape:u,caseSensitive:p,findChunks:f,sanitize:x,searchWords:w,textToHighlight:j}),R=b,N=-1,A="",I=void 0,z=(0,a.default)(function(e){var t={};for(var n in e)t[n.toLowerCase()]=e[n];return t});return(0,s.createElement)("span",r({className:h},P,{children:O.map(function(e,t){var r=j.substr(e.start,e.end-e.start);if(e.highlight){N++;var i;i="object"==typeof g?p?g[r]:(g=z(g))[r.toLowerCase()]:g;var o=N===+l;A=i+" "+(o?n:""),I=!0===o&&null!=c?Object.assign({},v,c):v;var a={children:r,className:A,key:t,style:I};return"string"!=typeof R&&(a.highlightIndex=N),(0,s.createElement)(R,a)}return(0,s.createElement)(k,{children:r,className:T,key:t,style:E})})}))};var i,o=n(3),s=n(4),a=(i=n(5))&&i.__esModule?i:{default:i};e.exports=t.default},function(e,t){e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}return n.m=e,n.c=t,n.p="",n(0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2);Object.defineProperty(t,"combineChunks",{enumerable:!0,get:function(){return r.combineChunks}}),Object.defineProperty(t,"fillInChunks",{enumerable:!0,get:function(){return r.fillInChunks}}),Object.defineProperty(t,"findAll",{enumerable:!0,get:function(){return r.findAll}}),Object.defineProperty(t,"findChunks",{enumerable:!0,get:function(){return r.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?r:a,c=e.sanitize,u=e.searchWords,d=e.textToHighlight;return i({chunksToHighlight:n({chunks:l({autoEscape:t,caseSensitive:s,sanitize:c,searchWords:u,textToHighlight:d})}),totalLength:d?d.length:0})};var n=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 n=e.pop();if(t.start<=n.end){var r=Math.max(n.end,t.end);e.push({start:n.start,end:r})}else e.push(n,t);return e},[])},r=function(e){var t=e.autoEscape,n=e.caseSensitive,r=e.sanitize,i=void 0===r?o:r,s=e.searchWords,a=e.textToHighlight;return a=i(a),s.filter(function(e){return e}).reduce(function(e,r){r=i(r),t&&(r=r.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"));for(var o=new RegExp(r,n?"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=r;var i=t.fillInChunks=function(e){var t=e.chunksToHighlight,n=e.totalLength,r=[],i=function(e,t,n){t-e>0&&r.push({start:e,end:t,highlight:n})};if(0===t.length)i(0,n,!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,n,!1)}return r};function o(e){return e}}])},function(e,t){e.exports=n(609)},function(e,t){"use strict";var n=function(e,t){return e===t};e.exports=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n,r=void 0,i=[],o=void 0,s=!1,a=function(e,n){return t(e,i[n])};return function(){for(var t=arguments.length,n=Array(t),l=0;l<t;l++)n[l]=arguments[l];return s&&r===this&&n.length===i.length&&n.every(a)?o:(s=!0,r=this,i=n,o=e.apply(this,n))}}}])},49(e,t,n){"use strict";var r=n(609),i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=r.useSyncExternalStore,s=r.useRef,a=r.useEffect,l=r.useMemo,c=r.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,n,r,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,o=e,e=r(e),void 0!==u&&p.hasValue){var t=p.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return void 0!==u&&u(t,n)?(o=e,t):(o=e,s=n)}var o,s,a=!1,l=void 0===n?null:n;return[function(){return e(t())},null===l?void 0:function(){return e(l())}]},[t,n,r,u]);var h=o(e,d[0],d[1]);return a(function(){p.hasValue=!0,p.value=h},[h]),c(h),h}},721(e,t,n){"use strict";e.exports=n(49)},609(e){"use strict";e.exports=window.React},795(e){"use strict";e.exports=window.ReactDOM},500(e,t){var n;!function(){"use strict";var r={}.hasOwnProperty;function i(){for(var e="",t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=s(e,o(n)))}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 n in e)r.call(e,n)&&e[n]&&(t=s(t,n));return t}function s(e,t){return t?e?e+" "+t:e+t:e}e.exports?(i.default=i,e.exports=i):void 0===(n=function(){return i}.apply(t,[]))||(e.exports=n)}()}},i={};function o(e){var t=i[e];if(void 0!==t)return t.exports;var n=i[e]={exports:{}};return r[e](n,n.exports,o),n.exports}o.m=r,e=[],o.O=(t,n,r,i)=>{if(!n){var s=1/0;for(u=0;u<e.length;u++){for(var[n,r,i]=e[u],a=!0,l=0;l<n.length;l++)(!1&i||s>=i)&&Object.keys(o.O).every(e=>o.O[e](n[l]))?n.splice(l--,1):(a=!1,i<s&&(s=i));if(a){e.splice(u--,1);var c=r();void 0!==c&&(t=c)}}return t}i=i||0;for(var u=e.length;u>0&&e[u-1][2]>i;u--)e[u]=e[u-1];e[u]=[n,r,i]},o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},n=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,o.t=function(e,r){if(1&r&&(e=this(e)),8&r)return e;if("object"==typeof e&&e){if(4&r&&e.__esModule)return e;if(16&r&&"function"==typeof e.then)return e}var i=Object.create(null);o.r(i);var s={};t=t||[null,n({}),n([]),n(n)];for(var a=2&r&&e;("object"==typeof a||"function"==typeof a)&&!~t.indexOf(a);a=n(a))Object.getOwnPropertyNames(a).forEach(t=>s[t]=()=>e[t]);return s.default=()=>e,o.d(i,s),i},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e={57:0,350:0};o.O.j=t=>0===e[t];var t=(t,n)=>{var r,i,[s,a,l]=n,c=0;if(s.some(t=>0!==e[t])){for(r in a)o.o(a,r)&&(o.m[r]=a[r]);if(l)var u=l(o)}for(t&&t(n);c<s.length;c++)i=s[c],o.o(e,i)&&e[i]&&e[i][0](),e[i]=0;return o.O(u)},n=globalThis.webpackChunkredirection=globalThis.webpackChunkredirection||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();var s=o.O(void 0,[350],()=>o(794));s=o.O(s)})();