@attabot/complaint-app 1.0.8 → 1.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,12 @@
1
- (function(g,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("react/jsx-runtime"),require("react"),require("react-dom"),require("react-redux"),require("@reduxjs/toolkit")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","react-dom","react-redux","@reduxjs/toolkit"],i):(g=typeof globalThis<"u"?globalThis:g||self,i(g.ComplaintApp={},g["react/jsx-runtime"],g.React,g.ReactDOM,g.ReactRedux,g.RTK))})(this,(function(g,i,L,jd,kr,ht){"use strict";var jt=typeof document<"u"?document.currentScript:null;function po(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const w=po(L);function qe(){return qe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},qe.apply(null,arguments)}var de;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(de||(de={}));const Dr="popstate";function ho(e){e===void 0&&(e={});function t(n,a){let{pathname:o,search:s,hash:l}=n.location;return Vt("",{pathname:o,search:s,hash:l},a.state&&a.state.usr||null,a.state&&a.state.key||"default")}function r(n,a){return typeof a=="string"?a:ze(a)}return go(t,r,null,e)}function T(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function q(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function mo(){return Math.random().toString(36).substr(2,8)}function Br(e,t){return{usr:e.state,key:e.key,idx:t}}function Vt(e,t,r,n){return r===void 0&&(r=null),qe({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Fe(t):t,{state:r,key:t&&t.key||n||mo()})}function ze(e){let{pathname:t="/",search:r="",hash:n=""}=e;return r&&r!=="?"&&(t+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(t+=n.charAt(0)==="#"?n:"#"+n),t}function Fe(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substr(n),e=e.substr(0,n)),e&&(t.pathname=e)}return t}function go(e,t,r,n){n===void 0&&(n={});let{window:a=document.defaultView,v5Compat:o=!1}=n,s=a.history,l=de.Pop,c=null,d=u();d==null&&(d=0,s.replaceState(qe({},s.state,{idx:d}),""));function u(){return(s.state||{idx:null}).idx}function f(){l=de.Pop;let b=u(),m=b==null?null:b-d;d=b,c&&c({action:l,location:S.location,delta:m})}function h(b,m){l=de.Push;let y=Vt(S.location,b,m);d=u()+1;let C=Br(y,d),N=S.createHref(y);try{s.pushState(C,"",N)}catch(A){if(A instanceof DOMException&&A.name==="DataCloneError")throw A;a.location.assign(N)}o&&c&&c({action:l,location:S.location,delta:1})}function v(b,m){l=de.Replace;let y=Vt(S.location,b,m);d=u();let C=Br(y,d),N=S.createHref(y);s.replaceState(C,"",N),o&&c&&c({action:l,location:S.location,delta:0})}function _(b){let m=a.location.origin!=="null"?a.location.origin:a.location.href,y=typeof b=="string"?b:ze(b);return y=y.replace(/ $/,"%20"),T(m,"No window.location.(origin|href) available to create URL for href: "+y),new URL(y,m)}let S={get action(){return l},get location(){return e(a,s)},listen(b){if(c)throw new Error("A history only accepts one active listener");return a.addEventListener(Dr,f),c=b,()=>{a.removeEventListener(Dr,f),c=null}},createHref(b){return t(a,b)},createURL:_,encodeLocation(b){let m=_(b);return{pathname:m.pathname,search:m.search,hash:m.hash}},push:h,replace:v,go(b){return s.go(b)}};return S}var Ir;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Ir||(Ir={}));function yo(e,t,r){return r===void 0&&(r="/"),bo(e,t,r)}function bo(e,t,r,n){let a=typeof t=="string"?Fe(t):t,o=ue(a.pathname||"/",r);if(o==null)return null;let s=Mr(e);vo(s);let l=null,c=Fo(o);for(let d=0;l==null&&d<s.length;++d)l=To(s[d],c);return l}function Mr(e,t,r,n){t===void 0&&(t=[]),r===void 0&&(r=[]),n===void 0&&(n="");let a=(o,s,l)=>{let c={relativePath:l===void 0?o.path||"":l,caseSensitive:o.caseSensitive===!0,childrenIndex:s,route:o};c.relativePath.startsWith("/")&&(T(c.relativePath.startsWith(n),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(n.length));let d=ne([n,c.relativePath]),u=r.concat(c);o.children&&o.children.length>0&&(T(o.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+d+'".')),Mr(o.children,t,u,d)),!(o.path==null&&!o.index)&&t.push({path:d,score:Lo(d,o.index),routesMeta:u})};return e.forEach((o,s)=>{var l;if(o.path===""||!((l=o.path)!=null&&l.includes("?")))a(o,s);else for(let c of Ur(o.path))a(o,s,c)}),t}function Ur(e){let t=e.split("/");if(t.length===0)return[];let[r,...n]=t,a=r.endsWith("?"),o=r.replace(/\?$/,"");if(n.length===0)return a?[o,""]:[o];let s=Ur(n.join("/")),l=[];return l.push(...s.map(c=>c===""?o:[o,c].join("/"))),a&&l.push(...s),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function vo(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:Oo(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const wo=/^:[\w-]+$/,Co=3,_o=2,So=1,Eo=10,No=-2,$r=e=>e==="*";function Lo(e,t){let r=e.split("/"),n=r.length;return r.some($r)&&(n+=No),t&&(n+=_o),r.filter(a=>!$r(a)).reduce((a,o)=>a+(wo.test(o)?Co:o===""?So:Eo),n)}function Oo(e,t){return e.length===t.length&&e.slice(0,-1).every((n,a)=>n===t[a])?e[e.length-1]-t[t.length-1]:0}function To(e,t,r){let{routesMeta:n}=e,a={},o="/",s=[];for(let l=0;l<n.length;++l){let c=n[l],d=l===n.length-1,u=o==="/"?t:t.slice(o.length)||"/",f=Ht({path:c.relativePath,caseSensitive:c.caseSensitive,end:d},u),h=c.route;if(!f)return null;Object.assign(a,f.params),s.push({params:a,pathname:ne([o,f.pathname]),pathnameBase:Bo(ne([o,f.pathnameBase])),route:h}),f.pathnameBase!=="/"&&(o=ne([o,f.pathnameBase]))}return s}function Ht(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,n]=Ao(e.path,e.caseSensitive,e.end),a=t.match(r);if(!a)return null;let o=a[0],s=o.replace(/(.)\/+$/,"$1"),l=a.slice(1);return{params:n.reduce((d,u,f)=>{let{paramName:h,isOptional:v}=u;if(h==="*"){let S=l[f]||"";s=o.slice(0,o.length-S.length).replace(/(.)\/+$/,"$1")}const _=l[f];return v&&!_?d[h]=void 0:d[h]=(_||"").replace(/%2F/g,"/"),d},{}),pathname:o,pathnameBase:s,pattern:e}}function Ao(e,t,r){t===void 0&&(t=!1),r===void 0&&(r=!0),q(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let n=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(s,l,c)=>(n.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(n.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),n]}function Fo(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return q(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function ue(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&n!=="/"?null:e.slice(r)||"/"}const xo=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Po=e=>xo.test(e);function ko(e,t){t===void 0&&(t="/");let{pathname:r,search:n="",hash:a=""}=typeof e=="string"?Fe(e):e,o;if(r)if(Po(r))o=r;else{if(r.includes("//")){let s=r;r=Wr(r),q(!1,"Pathnames cannot have embedded double slashes - normalizing "+(s+" -> "+r))}r.startsWith("/")?o=jr(r.substring(1),"/"):o=jr(r,t)}else o=t;return{pathname:o,search:Io(n),hash:Mo(a)}}function jr(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?r.length>1&&r.pop():a!=="."&&r.push(a)}),r.length>1?r.join("/"):"/"}function Wt(e,t,r,n){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function Do(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function Vr(e,t){let r=Do(e);return t?r.map((n,a)=>a===r.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function Hr(e,t,r,n){n===void 0&&(n=!1);let a;typeof e=="string"?a=Fe(e):(a=qe({},e),T(!a.pathname||!a.pathname.includes("?"),Wt("?","pathname","search",a)),T(!a.pathname||!a.pathname.includes("#"),Wt("#","pathname","hash",a)),T(!a.search||!a.search.includes("#"),Wt("#","search","hash",a)));let o=e===""||a.pathname==="",s=o?"/":a.pathname,l;if(s==null)l=r;else{let f=t.length-1;if(!n&&s.startsWith("..")){let h=s.split("/");for(;h[0]==="..";)h.shift(),f-=1;a.pathname=h.join("/")}l=f>=0?t[f]:"/"}let c=ko(a,l),d=s&&s!=="/"&&s.endsWith("/"),u=(o||s===".")&&r.endsWith("/");return!c.pathname.endsWith("/")&&(d||u)&&(c.pathname+="/"),c}const Wr=e=>e.replace(/\/\/+/g,"/"),ne=e=>Wr(e.join("/")),Bo=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Io=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Mo=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function Uo(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const qr=["post","put","patch","delete"];new Set(qr);const $o=["get",...qr];new Set($o);function Re(){return Re=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Re.apply(null,arguments)}const Ke=w.createContext(null);process.env.NODE_ENV!=="production"&&(Ke.displayName="DataRouter");const qt=w.createContext(null);process.env.NODE_ENV!=="production"&&(qt.displayName="DataRouterState");const jo=w.createContext(null);process.env.NODE_ENV!=="production"&&(jo.displayName="Await");const X=w.createContext(null);process.env.NODE_ENV!=="production"&&(X.displayName="Navigation");const Je=w.createContext(null);process.env.NODE_ENV!=="production"&&(Je.displayName="Location");const Y=w.createContext({outlet:null,matches:[],isDataRoute:!1});process.env.NODE_ENV!=="production"&&(Y.displayName="Route");const zt=w.createContext(null);process.env.NODE_ENV!=="production"&&(zt.displayName="RouteError");function Vo(e,t){let{relative:r}=t===void 0?{}:t;xe()||(process.env.NODE_ENV!=="production"?T(!1,"useHref() may be used only in the context of a <Router> component."):T(!1));let{basename:n,navigator:a}=w.useContext(X),{hash:o,pathname:s,search:l}=Ge(e,{relative:r}),c=s;return n!=="/"&&(c=s==="/"?n:ne([n,s])),a.createHref({pathname:c,search:l,hash:o})}function xe(){return w.useContext(Je)!=null}function me(){return xe()||(process.env.NODE_ENV!=="production"?T(!1,"useLocation() may be used only in the context of a <Router> component."):T(!1)),w.useContext(Je).location}const zr="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Rr(e){w.useContext(X).static||w.useLayoutEffect(e)}function Ze(){let{isDataRoute:e}=w.useContext(Y);return e?rs():Ho()}function Ho(){xe()||(process.env.NODE_ENV!=="production"?T(!1,"useNavigate() may be used only in the context of a <Router> component."):T(!1));let e=w.useContext(Ke),{basename:t,future:r,navigator:n}=w.useContext(X),{matches:a}=w.useContext(Y),{pathname:o}=me(),s=JSON.stringify(Vr(a,r.v7_relativeSplatPath)),l=w.useRef(!1);return Rr(()=>{l.current=!0}),w.useCallback(function(d,u){if(u===void 0&&(u={}),process.env.NODE_ENV!=="production"&&q(l.current,zr),!l.current)return;if(typeof d=="number"){n.go(d);return}let f=Hr(d,JSON.parse(s),o,u.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:ne([t,f.pathname])),(u.replace?n.replace:n.push)(f,u.state,u)},[t,n,s,o,e])}function Wo(){let{matches:e}=w.useContext(Y),t=e[e.length-1];return t?t.params:{}}function Ge(e,t){let{relative:r}=t===void 0?{}:t,{future:n}=w.useContext(X),{matches:a}=w.useContext(Y),{pathname:o}=me(),s=JSON.stringify(Vr(a,n.v7_relativeSplatPath));return w.useMemo(()=>Hr(e,JSON.parse(s),o,r==="path"),[e,s,o,r])}function qo(e,t){return zo(e,t)}function zo(e,t,r,n){xe()||(process.env.NODE_ENV!=="production"?T(!1,"useRoutes() may be used only in the context of a <Router> component."):T(!1));let{navigator:a}=w.useContext(X),{matches:o}=w.useContext(Y),s=o[o.length-1],l=s?s.params:{},c=s?s.pathname:"/",d=s?s.pathnameBase:"/",u=s&&s.route;if(process.env.NODE_ENV!=="production"){let y=u&&u.path||"";Zr(c,!u||y.endsWith("*"),"You rendered descendant <Routes> (or called `useRoutes()`) at "+('"'+c+'" (under <Route path="'+y+'">) but the ')+`parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
1
+ (function(C,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("react/jsx-runtime"),require("react"),require("react-dom"),require("react-redux"),require("@reduxjs/toolkit")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","react-dom","react-redux","@reduxjs/toolkit"],s):(C=typeof globalThis<"u"?globalThis:C||self,s(C.ComplaintApp={},C["react/jsx-runtime"],C.React,C.ReactDOM,C.ReactRedux,C.RTK))})(this,(function(C,s,N,Rf,B,W){"use strict";var br=typeof document<"u"?document.currentScript:null;function Ds(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const _=Ds(N);function ct(){return ct=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ct.apply(null,arguments)}var we;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(we||(we={}));const Ln="popstate";function xs(e){e===void 0&&(e={});function t(n,a){let{pathname:o,search:i,hash:l}=n.location;return vr("",{pathname:o,search:i,hash:l},a.state&&a.state.usr||null,a.state&&a.state.key||"default")}function r(n,a){return typeof a=="string"?a:dt(a)}return Is(t,r,null,e)}function x(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function te(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Ps(){return Math.random().toString(36).substr(2,8)}function An(e,t){return{usr:e.state,key:e.key,idx:t}}function vr(e,t,r,n){return r===void 0&&(r=null),ct({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?qe(t):t,{state:r,key:t&&t.key||n||Ps()})}function dt(e){let{pathname:t="/",search:r="",hash:n=""}=e;return r&&r!=="?"&&(t+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(t+=n.charAt(0)==="#"?n:"#"+n),t}function qe(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substr(n),e=e.substr(0,n)),e&&(t.pathname=e)}return t}function Is(e,t,r,n){n===void 0&&(n={});let{window:a=document.defaultView,v5Compat:o=!1}=n,i=a.history,l=we.Pop,c=null,d=u();d==null&&(d=0,i.replaceState(ct({},i.state,{idx:d}),""));function u(){return(i.state||{idx:null}).idx}function p(){l=we.Pop;let h=u(),m=h==null?null:h-d;d=h,c&&c({action:l,location:w.location,delta:m})}function y(h,m){l=we.Push;let f=vr(w.location,h,m);d=u()+1;let b=An(f,d),E=w.createHref(f);try{i.pushState(b,"",E)}catch(O){if(O instanceof DOMException&&O.name==="DataCloneError")throw O;a.location.assign(E)}o&&c&&c({action:l,location:w.location,delta:1})}function S(h,m){l=we.Replace;let f=vr(w.location,h,m);d=u();let b=An(f,d),E=w.createHref(f);i.replaceState(b,"",E),o&&c&&c({action:l,location:w.location,delta:0})}function v(h){let m=a.location.origin!=="null"?a.location.origin:a.location.href,f=typeof h=="string"?h:dt(h);return f=f.replace(/ $/,"%20"),x(m,"No window.location.(origin|href) available to create URL for href: "+f),new URL(f,m)}let w={get action(){return l},get location(){return e(a,i)},listen(h){if(c)throw new Error("A history only accepts one active listener");return a.addEventListener(Ln,p),c=h,()=>{a.removeEventListener(Ln,p),c=null}},createHref(h){return t(a,h)},createURL:v,encodeLocation(h){let m=v(h);return{pathname:m.pathname,search:m.search,hash:m.hash}},push:y,replace:S,go(h){return i.go(h)}};return w}var Fn;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Fn||(Fn={}));function Ms(e,t,r){return r===void 0&&(r="/"),Bs(e,t,r)}function Bs(e,t,r,n){let a=typeof t=="string"?qe(t):t,o=be(a.pathname||"/",r);if(o==null)return null;let i=On(e);$s(i);let l=null,c=Zs(o);for(let d=0;l==null&&d<i.length;++d)l=Js(i[d],c);return l}function On(e,t,r,n){t===void 0&&(t=[]),r===void 0&&(r=[]),n===void 0&&(n="");let a=(o,i,l)=>{let c={relativePath:l===void 0?o.path||"":l,caseSensitive:o.caseSensitive===!0,childrenIndex:i,route:o};c.relativePath.startsWith("/")&&(x(c.relativePath.startsWith(n),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(n.length));let d=he([n,c.relativePath]),u=r.concat(c);o.children&&o.children.length>0&&(x(o.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+d+'".')),On(o.children,t,u,d)),!(o.path==null&&!o.index)&&t.push({path:d,score:zs(d,o.index),routesMeta:u})};return e.forEach((o,i)=>{var l;if(o.path===""||!((l=o.path)!=null&&l.includes("?")))a(o,i);else for(let c of kn(o.path))a(o,i,c)}),t}function kn(e){let t=e.split("/");if(t.length===0)return[];let[r,...n]=t,a=r.endsWith("?"),o=r.replace(/\?$/,"");if(n.length===0)return a?[o,""]:[o];let i=kn(n.join("/")),l=[];return l.push(...i.map(c=>c===""?o:[o,c].join("/"))),a&&l.push(...i),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function $s(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:Ks(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const Us=/^:[\w-]+$/,js=3,qs=2,Vs=1,Ws=10,Hs=-2,Dn=e=>e==="*";function zs(e,t){let r=e.split("/"),n=r.length;return r.some(Dn)&&(n+=Hs),t&&(n+=qs),r.filter(a=>!Dn(a)).reduce((a,o)=>a+(Us.test(o)?js:o===""?Vs:Ws),n)}function Ks(e,t){return e.length===t.length&&e.slice(0,-1).every((n,a)=>n===t[a])?e[e.length-1]-t[t.length-1]:0}function Js(e,t,r){let{routesMeta:n}=e,a={},o="/",i=[];for(let l=0;l<n.length;++l){let c=n[l],d=l===n.length-1,u=o==="/"?t:t.slice(o.length)||"/",p=Cr({path:c.relativePath,caseSensitive:c.caseSensitive,end:d},u),y=c.route;if(!p)return null;Object.assign(a,p.params),i.push({params:a,pathname:he([o,p.pathname]),pathnameBase:ei(he([o,p.pathnameBase])),route:y}),p.pathnameBase!=="/"&&(o=he([o,p.pathnameBase]))}return i}function Cr(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,n]=Rs(e.path,e.caseSensitive,e.end),a=t.match(r);if(!a)return null;let o=a[0],i=o.replace(/(.)\/+$/,"$1"),l=a.slice(1);return{params:n.reduce((d,u,p)=>{let{paramName:y,isOptional:S}=u;if(y==="*"){let w=l[p]||"";i=o.slice(0,o.length-w.length).replace(/(.)\/+$/,"$1")}const v=l[p];return S&&!v?d[y]=void 0:d[y]=(v||"").replace(/%2F/g,"/"),d},{}),pathname:o,pathnameBase:i,pattern:e}}function Rs(e,t,r){t===void 0&&(t=!1),r===void 0&&(r=!0),te(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let n=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,l,c)=>(n.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(n.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),n]}function Zs(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return te(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function be(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&n!=="/"?null:e.slice(r)||"/"}const Xs=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Qs=e=>Xs.test(e);function Gs(e,t){t===void 0&&(t="/");let{pathname:r,search:n="",hash:a=""}=typeof e=="string"?qe(e):e,o;if(r)if(Qs(r))o=r;else{if(r.includes("//")){let i=r;r=Mn(r),te(!1,"Pathnames cannot have embedded double slashes - normalizing "+(i+" -> "+r))}r.startsWith("/")?o=xn(r.substring(1),"/"):o=xn(r,t)}else o=t;return{pathname:o,search:ti(n),hash:ri(a)}}function xn(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?r.length>1&&r.pop():a!=="."&&r.push(a)}),r.length>1?r.join("/"):"/"}function Sr(e,t,r,n){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function Ys(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function Pn(e,t){let r=Ys(e);return t?r.map((n,a)=>a===r.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function In(e,t,r,n){n===void 0&&(n=!1);let a;typeof e=="string"?a=qe(e):(a=ct({},e),x(!a.pathname||!a.pathname.includes("?"),Sr("?","pathname","search",a)),x(!a.pathname||!a.pathname.includes("#"),Sr("#","pathname","hash",a)),x(!a.search||!a.search.includes("#"),Sr("#","search","hash",a)));let o=e===""||a.pathname==="",i=o?"/":a.pathname,l;if(i==null)l=r;else{let p=t.length-1;if(!n&&i.startsWith("..")){let y=i.split("/");for(;y[0]==="..";)y.shift(),p-=1;a.pathname=y.join("/")}l=p>=0?t[p]:"/"}let c=Gs(a,l),d=i&&i!=="/"&&i.endsWith("/"),u=(o||i===".")&&r.endsWith("/");return!c.pathname.endsWith("/")&&(d||u)&&(c.pathname+="/"),c}const Mn=e=>e.replace(/\/\/+/g,"/"),he=e=>Mn(e.join("/")),ei=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),ti=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,ri=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function ni(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const Bn=["post","put","patch","delete"];new Set(Bn);const ai=["get",...Bn];new Set(ai);function ut(){return ut=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ut.apply(null,arguments)}const ft=_.createContext(null);process.env.NODE_ENV!=="production"&&(ft.displayName="DataRouter");const Er=_.createContext(null);process.env.NODE_ENV!=="production"&&(Er.displayName="DataRouterState");const oi=_.createContext(null);process.env.NODE_ENV!=="production"&&(oi.displayName="Await");const oe=_.createContext(null);process.env.NODE_ENV!=="production"&&(oe.displayName="Navigation");const pt=_.createContext(null);process.env.NODE_ENV!=="production"&&(pt.displayName="Location");const le=_.createContext({outlet:null,matches:[],isDataRoute:!1});process.env.NODE_ENV!=="production"&&(le.displayName="Route");const _r=_.createContext(null);process.env.NODE_ENV!=="production"&&(_r.displayName="RouteError");function si(e,t){let{relative:r}=t===void 0?{}:t;Ve()||(process.env.NODE_ENV!=="production"?x(!1,"useHref() may be used only in the context of a <Router> component."):x(!1));let{basename:n,navigator:a}=_.useContext(oe),{hash:o,pathname:i,search:l}=ht(e,{relative:r}),c=i;return n!=="/"&&(c=i==="/"?n:he([n,i])),a.createHref({pathname:c,search:l,hash:o})}function Ve(){return _.useContext(pt)!=null}function Te(){return Ve()||(process.env.NODE_ENV!=="production"?x(!1,"useLocation() may be used only in the context of a <Router> component."):x(!1)),_.useContext(pt).location}const $n="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Un(e){_.useContext(oe).static||_.useLayoutEffect(e)}function Le(){let{isDataRoute:e}=_.useContext(le);return e?vi():ii()}function ii(){Ve()||(process.env.NODE_ENV!=="production"?x(!1,"useNavigate() may be used only in the context of a <Router> component."):x(!1));let e=_.useContext(ft),{basename:t,future:r,navigator:n}=_.useContext(oe),{matches:a}=_.useContext(le),{pathname:o}=Te(),i=JSON.stringify(Pn(a,r.v7_relativeSplatPath)),l=_.useRef(!1);return Un(()=>{l.current=!0}),_.useCallback(function(d,u){if(u===void 0&&(u={}),process.env.NODE_ENV!=="production"&&te(l.current,$n),!l.current)return;if(typeof d=="number"){n.go(d);return}let p=In(d,JSON.parse(i),o,u.relative==="path");e==null&&t!=="/"&&(p.pathname=p.pathname==="/"?t:he([t,p.pathname])),(u.replace?n.replace:n.push)(p,u.state,u)},[t,n,i,o,e])}function jn(){let{matches:e}=_.useContext(le),t=e[e.length-1];return t?t.params:{}}function ht(e,t){let{relative:r}=t===void 0?{}:t,{future:n}=_.useContext(oe),{matches:a}=_.useContext(le),{pathname:o}=Te(),i=JSON.stringify(Pn(a,n.v7_relativeSplatPath));return _.useMemo(()=>In(e,JSON.parse(i),o,r==="path"),[e,i,o,r])}function li(e,t){return ci(e,t)}function ci(e,t,r,n){Ve()||(process.env.NODE_ENV!=="production"?x(!1,"useRoutes() may be used only in the context of a <Router> component."):x(!1));let{navigator:a}=_.useContext(oe),{matches:o}=_.useContext(le),i=o[o.length-1],l=i?i.params:{},c=i?i.pathname:"/",d=i?i.pathnameBase:"/",u=i&&i.route;if(process.env.NODE_ENV!=="production"){let f=u&&u.path||"";Wn(c,!u||f.endsWith("*"),"You rendered descendant <Routes> (or called `useRoutes()`) at "+('"'+c+'" (under <Route path="'+f+'">) but the ')+`parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
2
2
 
3
- `+('Please change the parent <Route path="'+y+'"> to <Route ')+('path="'+(y==="/"?"*":y+"/*")+'">.'))}let f=me(),h;if(t){var v;let y=typeof t=="string"?Fe(t):t;d==="/"||(v=y.pathname)!=null&&v.startsWith(d)||(process.env.NODE_ENV!=="production"?T(!1,"When overriding the location using `<Routes location>` or `useRoutes(routes, location)`, the location pathname must begin with the portion of the URL pathname that was "+('matched by all parent routes. The current pathname base is "'+d+'" ')+('but pathname "'+y.pathname+'" was given in the `location` prop.')):T(!1)),h=y}else h=f;let _=h.pathname||"/",S=_;if(d!=="/"){let y=d.replace(/^\//,"").split("/");S="/"+_.replace(/^\//,"").split("/").slice(y.length).join("/")}let b=yo(e,{pathname:S});process.env.NODE_ENV!=="production"&&(process.env.NODE_ENV!=="production"&&q(u||b!=null,'No routes matched location "'+h.pathname+h.search+h.hash+'" '),process.env.NODE_ENV!=="production"&&q(b==null||b[b.length-1].route.element!==void 0||b[b.length-1].route.Component!==void 0||b[b.length-1].route.lazy!==void 0,'Matched leaf route at location "'+h.pathname+h.search+h.hash+'" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.'));let m=Go(b&&b.map(y=>Object.assign({},y,{params:Object.assign({},l,y.params),pathname:ne([d,a.encodeLocation?a.encodeLocation(y.pathname).pathname:y.pathname]),pathnameBase:y.pathnameBase==="/"?d:ne([d,a.encodeLocation?a.encodeLocation(y.pathnameBase).pathname:y.pathnameBase])})),o,r,n);return t&&m?w.createElement(Je.Provider,{value:{location:Re({pathname:"/",search:"",hash:"",state:null,key:"default"},h),navigationType:de.Pop}},m):m}function Ro(){let e=ts(),t=Uo(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,n="rgba(200,200,200, 0.5)",a={padding:"0.5rem",backgroundColor:n},o={padding:"2px 4px",backgroundColor:n},s=null;return process.env.NODE_ENV!=="production"&&(console.error("Error handled by React Router default ErrorBoundary:",e),s=w.createElement(w.Fragment,null,w.createElement("p",null,"💿 Hey developer 👋"),w.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",w.createElement("code",{style:o},"ErrorBoundary")," or"," ",w.createElement("code",{style:o},"errorElement")," prop on your route."))),w.createElement(w.Fragment,null,w.createElement("h2",null,"Unexpected Application Error!"),w.createElement("h3",{style:{fontStyle:"italic"}},t),r?w.createElement("pre",{style:a},r):null,s)}const Ko=w.createElement(Ro,null);class Jo extends w.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,r){return r.location!==t.location||r.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:r.error,location:r.location,revalidation:t.revalidation||r.revalidation}}componentDidCatch(t,r){console.error("React Router caught the following error during render",t,r)}render(){return this.state.error!==void 0?w.createElement(Y.Provider,{value:this.props.routeContext},w.createElement(zt.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Zo(e){let{routeContext:t,match:r,children:n}=e,a=w.useContext(Ke);return a&&a.static&&a.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=r.route.id),w.createElement(Y.Provider,{value:t},n)}function Go(e,t,r,n){var a;if(t===void 0&&(t=[]),r===void 0&&(r=null),n===void 0&&(n=null),e==null){var o;if(!r)return null;if(r.errors)e=r.matches;else if((o=n)!=null&&o.v7_partialHydration&&t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let s=e,l=(a=r)==null?void 0:a.errors;if(l!=null){let u=s.findIndex(f=>f.route.id&&l?.[f.route.id]!==void 0);u>=0||(process.env.NODE_ENV!=="production"?T(!1,"Could not find a matching route for errors on route IDs: "+Object.keys(l).join(",")):T(!1)),s=s.slice(0,Math.min(s.length,u+1))}let c=!1,d=-1;if(r&&n&&n.v7_partialHydration)for(let u=0;u<s.length;u++){let f=s[u];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(d=u),f.route.id){let{loaderData:h,errors:v}=r,_=f.route.loader&&h[f.route.id]===void 0&&(!v||v[f.route.id]===void 0);if(f.route.lazy||_){c=!0,d>=0?s=s.slice(0,d+1):s=[s[0]];break}}}return s.reduceRight((u,f,h)=>{let v,_=!1,S=null,b=null;r&&(v=l&&f.route.id?l[f.route.id]:void 0,S=f.route.errorElement||Ko,c&&(d<0&&h===0?(Zr("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),_=!0,b=null):d===h&&(_=!0,b=f.route.hydrateFallbackElement||null)));let m=t.concat(s.slice(0,h+1)),y=()=>{let C;return v?C=S:_?C=b:f.route.Component?C=w.createElement(f.route.Component,null):f.route.element?C=f.route.element:C=u,w.createElement(Zo,{match:f,routeContext:{outlet:u,matches:m,isDataRoute:r!=null},children:C})};return r&&(f.route.ErrorBoundary||f.route.errorElement||h===0)?w.createElement(Jo,{location:r.location,revalidation:r.revalidation,component:S,error:v,children:y(),routeContext:{outlet:null,matches:m,isDataRoute:!0}}):y()},null)}var Kr=(function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e})(Kr||{}),Xe=(function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e})(Xe||{});function Rt(e){return e+" must be used within a data router. See https://reactrouter.com/v6/routers/picking-a-router."}function Xo(e){let t=w.useContext(Ke);return t||(process.env.NODE_ENV!=="production"?T(!1,Rt(e)):T(!1)),t}function Qo(e){let t=w.useContext(qt);return t||(process.env.NODE_ENV!=="production"?T(!1,Rt(e)):T(!1)),t}function Yo(e){let t=w.useContext(Y);return t||(process.env.NODE_ENV!=="production"?T(!1,Rt(e)):T(!1)),t}function Kt(e){let t=Yo(e),r=t.matches[t.matches.length-1];return r.route.id||(process.env.NODE_ENV!=="production"?T(!1,e+' can only be used on routes that contain a unique "id"'):T(!1)),r.route.id}function es(){return Kt(Xe.UseRouteId)}function ts(){var e;let t=w.useContext(zt),r=Qo(Xe.UseRouteError),n=Kt(Xe.UseRouteError);return t!==void 0?t:(e=r.errors)==null?void 0:e[n]}function rs(){let{router:e}=Xo(Kr.UseNavigateStable),t=Kt(Xe.UseNavigateStable),r=w.useRef(!1);return Rr(()=>{r.current=!0}),w.useCallback(function(a,o){o===void 0&&(o={}),process.env.NODE_ENV!=="production"&&q(r.current,zr),r.current&&(typeof a=="number"?e.navigate(a):e.navigate(a,Re({fromRouteId:t},o)))},[e,t])}const Jr={};function Zr(e,t,r){!t&&!Jr[e]&&(Jr[e]=!0,process.env.NODE_ENV!=="production"&&q(!1,r))}const Gr={};function ns(e,t){process.env.NODE_ENV!=="production"&&!Gr[t]&&(Gr[t]=!0,console.warn(t))}const Xr=(e,t,r)=>ns(e,"⚠️ React Router Future Flag Warning: "+t+". "+("You can use the `"+e+"` future flag to opt-in early. ")+("For more information, see "+r+"."));function as(e,t){e?.v7_startTransition===void 0&&Xr("v7_startTransition","React Router will begin wrapping state updates in `React.startTransition` in v7","https://reactrouter.com/v6/upgrading/future#v7_starttransition"),e?.v7_relativeSplatPath===void 0&&Xr("v7_relativeSplatPath","Relative route resolution within Splat routes is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_relativesplatpath")}function Qe(e){process.env.NODE_ENV!=="production"?T(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>."):T(!1)}function os(e){let{basename:t="/",children:r=null,location:n,navigationType:a=de.Pop,navigator:o,static:s=!1,future:l}=e;xe()&&(process.env.NODE_ENV!=="production"?T(!1,"You cannot render a <Router> inside another <Router>. You should never have more than one in your app."):T(!1));let c=t.replace(/^\/*/,"/"),d=w.useMemo(()=>({basename:c,navigator:o,static:s,future:Re({v7_relativeSplatPath:!1},l)}),[c,l,o,s]);typeof n=="string"&&(n=Fe(n));let{pathname:u="/",search:f="",hash:h="",state:v=null,key:_="default"}=n,S=w.useMemo(()=>{let b=ue(u,c);return b==null?null:{location:{pathname:b,search:f,hash:h,state:v,key:_},navigationType:a}},[c,u,f,h,v,_,a]);return process.env.NODE_ENV!=="production"&&q(S!=null,'<Router basename="'+c+'"> is not able to match the URL '+('"'+u+f+h+'" because it does not start with the ')+"basename, so the <Router> won't render anything."),S==null?null:w.createElement(X.Provider,{value:d},w.createElement(Je.Provider,{children:r,value:S}))}function ss(e){let{children:t,location:r}=e;return qo(Jt(t),r)}new Promise(()=>{});function Jt(e,t){t===void 0&&(t=[]);let r=[];return w.Children.forEach(e,(n,a)=>{if(!w.isValidElement(n))return;let o=[...t,a];if(n.type===w.Fragment){r.push.apply(r,Jt(n.props.children,o));return}n.type!==Qe&&(process.env.NODE_ENV!=="production"?T(!1,"["+(typeof n.type=="string"?n.type:n.type.name)+"] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>"):T(!1)),!n.props.index||!n.props.children||(process.env.NODE_ENV!=="production"?T(!1,"An index route cannot have child routes."):T(!1));let s={id:n.props.id||o.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(s.children=Jt(n.props.children,o)),r.push(s)}),r}function Pe(){return Pe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Pe.apply(null,arguments)}function Zt(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}const mt="get",gt="application/x-www-form-urlencoded";function yt(e){return e!=null&&typeof e.tagName=="string"}function is(e){return yt(e)&&e.tagName.toLowerCase()==="button"}function ls(e){return yt(e)&&e.tagName.toLowerCase()==="form"}function cs(e){return yt(e)&&e.tagName.toLowerCase()==="input"}function ds(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function us(e,t){return e.button===0&&(!t||t==="_self")&&!ds(e)}function Gt(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map(a=>[r,a]):[[r,n]])},[]))}function fs(e,t){let r=Gt(e);return t&&t.forEach((n,a)=>{r.has(a)||t.getAll(a).forEach(o=>{r.append(a,o)})}),r}let bt=null;function ps(){if(bt===null)try{new FormData(document.createElement("form"),0),bt=!1}catch{bt=!0}return bt}const hs=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Xt(e){return e!=null&&!hs.has(e)?(process.env.NODE_ENV!=="production"&&q(!1,'"'+e+'" is not a valid `encType` for `<Form>`/`<fetcher.Form>` '+('and will default to "'+gt+'"')),null):e}function ms(e,t){let r,n,a,o,s;if(ls(e)){let l=e.getAttribute("action");n=l?ue(l,t):null,r=e.getAttribute("method")||mt,a=Xt(e.getAttribute("enctype"))||gt,o=new FormData(e)}else if(is(e)||cs(e)&&(e.type==="submit"||e.type==="image")){let l=e.form;if(l==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let c=e.getAttribute("formaction")||l.getAttribute("action");if(n=c?ue(c,t):null,r=e.getAttribute("formmethod")||l.getAttribute("method")||mt,a=Xt(e.getAttribute("formenctype"))||Xt(l.getAttribute("enctype"))||gt,o=new FormData(l,e),!ps()){let{name:d,type:u,value:f}=e;if(u==="image"){let h=d?d+".":"";o.append(h+"x","0"),o.append(h+"y","0")}else d&&o.append(d,f)}}else{if(yt(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=mt,n=null,a=gt,s=e}return o&&a==="text/plain"&&(s=o,o=void 0),{action:n,method:r.toLowerCase(),encType:a,formData:o,body:s}}const gs=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],ys=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],bs=["fetcherKey","navigate","reloadDocument","replace","state","method","action","onSubmit","relative","preventScrollReset","viewTransition"],vs="6";try{window.__reactRouterVersion=vs}catch{}const Qr=w.createContext({isTransitioning:!1});process.env.NODE_ENV!=="production"&&(Qr.displayName="ViewTransition");const ws=w.createContext(new Map);process.env.NODE_ENV!=="production"&&(ws.displayName="Fetchers");const Yr=w["startTransition"];function Cs(e){let{basename:t,children:r,future:n,window:a}=e,o=w.useRef();o.current==null&&(o.current=ho({window:a,v5Compat:!0}));let s=o.current,[l,c]=w.useState({action:s.action,location:s.location}),{v7_startTransition:d}=n||{},u=w.useCallback(f=>{d&&Yr?Yr(()=>c(f)):c(f)},[c,d]);return w.useLayoutEffect(()=>s.listen(u),[s,u]),w.useEffect(()=>as(n),[n]),w.createElement(os,{basename:t,children:r,location:l.location,navigationType:l.action,navigator:s,future:n})}process.env.NODE_ENV;const _s=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Ss=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,en=w.forwardRef(function(t,r){let{onClick:n,relative:a,reloadDocument:o,replace:s,state:l,target:c,to:d,preventScrollReset:u,viewTransition:f}=t,h=Zt(t,gs),{basename:v}=w.useContext(X),_,S=!1;if(typeof d=="string"&&Ss.test(d)&&(_=d,_s))try{let C=new URL(window.location.href),N=d.startsWith("//")?new URL(C.protocol+d):new URL(d),A=ue(N.pathname,v);N.origin===C.origin&&A!=null?d=A+N.search+N.hash:S=!0}catch{process.env.NODE_ENV!=="production"&&q(!1,'<Link to="'+d+'"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.')}let b=Vo(d,{relative:a}),m=Os(d,{replace:s,state:l,target:c,preventScrollReset:u,relative:a,viewTransition:f});function y(C){n&&n(C),C.defaultPrevented||m(C)}return w.createElement("a",Pe({},h,{href:_||b,onClick:S||o?n:y,ref:r,target:c}))});process.env.NODE_ENV!=="production"&&(en.displayName="Link");const Es=w.forwardRef(function(t,r){let{"aria-current":n="page",caseSensitive:a=!1,className:o="",end:s=!1,style:l,to:c,viewTransition:d,children:u}=t,f=Zt(t,ys),h=Ge(c,{relative:f.relative}),v=me(),_=w.useContext(qt),{navigator:S,basename:b}=w.useContext(X),m=_!=null&&Ds(h)&&d===!0,y=S.encodeLocation?S.encodeLocation(h).pathname:h.pathname,C=v.pathname,N=_&&_.navigation&&_.navigation.location?_.navigation.location.pathname:null;a||(C=C.toLowerCase(),N=N?N.toLowerCase():null,y=y.toLowerCase()),N&&b&&(N=ue(N,b)||N);const A=y!=="/"&&y.endsWith("/")?y.length-1:y.length;let F=C===y||!s&&C.startsWith(y)&&C.charAt(A)==="/",$=N!=null&&(N===y||!s&&N.startsWith(y)&&N.charAt(y.length)==="/"),Q={isActive:F,isPending:$,isTransitioning:m},Oe=F?n:void 0,H;typeof o=="function"?H=o(Q):H=[o,F?"active":null,$?"pending":null,m?"transitioning":null].filter(Boolean).join(" ");let k=typeof l=="function"?l(Q):l;return w.createElement(en,Pe({},f,{"aria-current":Oe,className:H,ref:r,style:k,to:c,viewTransition:d}),typeof u=="function"?u(Q):u)});process.env.NODE_ENV!=="production"&&(Es.displayName="NavLink");const Ns=w.forwardRef((e,t)=>{let{fetcherKey:r,navigate:n,reloadDocument:a,replace:o,state:s,method:l=mt,action:c,onSubmit:d,relative:u,preventScrollReset:f,viewTransition:h}=e,v=Zt(e,bs),_=Ps(),S=ks(c,{relative:u}),b=l.toLowerCase()==="get"?"get":"post",m=y=>{if(d&&d(y),y.defaultPrevented)return;y.preventDefault();let C=y.nativeEvent.submitter,N=C?.getAttribute("formmethod")||l;_(C||y.currentTarget,{fetcherKey:r,method:N,navigate:n,replace:o,state:s,relative:u,preventScrollReset:f,viewTransition:h})};return w.createElement("form",Pe({ref:t,method:b,action:S,onSubmit:a?d:m},v))});process.env.NODE_ENV!=="production"&&(Ns.displayName="Form"),process.env.NODE_ENV;var vt;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(vt||(vt={}));var tn;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(tn||(tn={}));function Ls(e){return e+" must be used within a data router. See https://reactrouter.com/v6/routers/picking-a-router."}function rn(e){let t=w.useContext(Ke);return t||(process.env.NODE_ENV!=="production"?T(!1,Ls(e)):T(!1)),t}function Os(e,t){let{target:r,replace:n,state:a,preventScrollReset:o,relative:s,viewTransition:l}=t===void 0?{}:t,c=Ze(),d=me(),u=Ge(e,{relative:s});return w.useCallback(f=>{if(us(f,r)){f.preventDefault();let h=n!==void 0?n:ze(d)===ze(u);c(e,{replace:h,state:a,preventScrollReset:o,relative:s,viewTransition:l})}},[d,c,u,n,a,r,e,o,s,l])}function Ts(e){process.env.NODE_ENV!=="production"&&q(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=w.useRef(Gt(e)),r=w.useRef(!1),n=me(),a=w.useMemo(()=>fs(n.search,r.current?null:t.current),[n.search]),o=Ze(),s=w.useCallback((l,c)=>{const d=Gt(typeof l=="function"?l(a):l);r.current=!0,o("?"+d,c)},[o,a]);return[a,s]}function As(){if(typeof document>"u")throw new Error("You are calling submit during the server render. Try calling submit within a `useEffect` or callback instead.")}let Fs=0,xs=()=>"__"+String(++Fs)+"__";function Ps(){let{router:e}=rn(vt.UseSubmit),{basename:t}=w.useContext(X),r=es();return w.useCallback(function(n,a){a===void 0&&(a={}),As();let{action:o,method:s,encType:l,formData:c,body:d}=ms(n,t);if(a.navigate===!1){let u=a.fetcherKey||xs();e.fetch(u,r,a.action||o,{preventScrollReset:a.preventScrollReset,formData:c,body:d,formMethod:a.method||s,formEncType:a.encType||l,flushSync:a.flushSync})}else e.navigate(a.action||o,{preventScrollReset:a.preventScrollReset,formData:c,body:d,formMethod:a.method||s,formEncType:a.encType||l,replace:a.replace,state:a.state,fromRouteId:r,flushSync:a.flushSync,viewTransition:a.viewTransition})},[e,t,r])}function ks(e,t){let{relative:r}=t===void 0?{}:t,{basename:n}=w.useContext(X),a=w.useContext(Y);a||(process.env.NODE_ENV!=="production"?T(!1,"useFormAction must be used inside a RouteContext"):T(!1));let[o]=a.matches.slice(-1),s=Pe({},Ge(e||".",{relative:r})),l=me();if(e==null){s.search=l.search;let c=new URLSearchParams(s.search),d=c.getAll("index");if(d.some(f=>f==="")){c.delete("index"),d.filter(h=>h).forEach(h=>c.append("index",h));let f=c.toString();s.search=f?"?"+f:""}}return(!e||e===".")&&o.route.index&&(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(s.pathname=s.pathname==="/"?n:ne([n,s.pathname])),ze(s)}function Ds(e,t){t===void 0&&(t={});let r=w.useContext(Qr);r==null&&(process.env.NODE_ENV!=="production"?T(!1,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"):T(!1));let{basename:n}=rn(vt.useViewTransitionState),a=Ge(e,{relative:t.relative});if(!r.isTransitioning)return!1;let o=ue(r.currentLocation.pathname,n)||r.currentLocation.pathname,s=ue(r.nextLocation.pathname,n)||r.nextLocation.pathname;return Ht(a.pathname,s)!=null||Ht(a.pathname,o)!=null}function nn(e,t){return function(){return e.apply(t,arguments)}}const{toString:Bs}=Object.prototype,{getPrototypeOf:ke}=Object,{iterator:Ye,toStringTag:an}=Symbol,wt=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),et=(e,t)=>{let r=e;const n=[];for(;r!=null&&r!==Object.prototype;){if(n.indexOf(r)!==-1)return!1;if(n.push(r),wt(r,t))return!0;r=ke(r)}return!1},Is=(e,t)=>e!=null&&et(e,t)?e[t]:void 0,Qt=(e=>t=>{const r=Bs.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),z=e=>(e=e.toLowerCase(),t=>Qt(t)===e),Ct=e=>t=>typeof t===e,{isArray:ge}=Array,ye=Ct("undefined");function De(e){return e!==null&&!ye(e)&&e.constructor!==null&&!ye(e.constructor)&&V(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const on=z("ArrayBuffer");function Ms(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&on(e.buffer),t}const Us=Ct("string"),V=Ct("function"),sn=Ct("number"),Be=e=>e!==null&&typeof e=="object",$s=e=>e===!0||e===!1,_t=e=>{if(!Be(e))return!1;const t=ke(e);return(t===null||t===Object.prototype||ke(t)===null)&&!et(e,an)&&!et(e,Ye)},js=e=>{if(!Be(e)||De(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Vs=z("Date"),Hs=z("File"),Ws=e=>!!(e&&typeof e.uri<"u"),qs=e=>e&&typeof e.getParts<"u",zs=z("Blob"),Rs=z("FileList"),Ks=z("Set"),Js=e=>Be(e)&&V(e.pipe);function Zs(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const ln=Zs(),cn=typeof ln.FormData<"u"?ln.FormData:void 0,Gs=e=>{if(!e)return!1;if(cn&&e instanceof cn)return!0;const t=ke(e);if(!t||t===Object.prototype||!V(e.append))return!1;const r=Qt(e);return r==="formdata"||r==="object"&&V(e.toString)&&e.toString()==="[object FormData]"},Xs=z("URLSearchParams"),[Qs,Ys,ei,ti]=["ReadableStream","Request","Response","Headers"].map(z),ri=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function tt(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,a;if(typeof e!="object"&&(e=[e]),ge(e))for(n=0,a=e.length;n<a;n++)t.call(null,e[n],n,e);else{if(De(e))return;const o=r?Object.getOwnPropertyNames(e):Object.keys(e),s=o.length;let l;for(n=0;n<s;n++)l=o[n],t.call(null,e[l],l,e)}}function dn(e,t){if(De(e))return null;t=t.toLowerCase();const r=Object.keys(e);let n=r.length,a;for(;n-- >0;)if(a=r[n],t===a.toLowerCase())return a;return null}const be=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,un=e=>!ye(e)&&e!==be;function Yt(...e){const{caseless:t,skipUndefined:r}=un(this)&&this||{},n={},a=(o,s)=>{if(s==="__proto__"||s==="constructor"||s==="prototype")return;const l=t&&typeof s=="string"&&dn(n,s)||s,c=wt(n,l)?n[l]:void 0;_t(c)&&_t(o)?n[l]=Yt(c,o):_t(o)?n[l]=Yt({},o):ge(o)?n[l]=o.slice():(!r||!ye(o))&&(n[l]=o)};for(let o=0,s=e.length;o<s;o++){const l=e[o];if(!l||De(l)||(tt(l,a),typeof l!="object"||ge(l)))continue;const c=Object.getOwnPropertySymbols(l);for(let d=0;d<c.length;d++){const u=c[d];hi.call(l,u)&&a(l[u],u)}}return n}const ni=(e,t,r,{allOwnKeys:n}={})=>(tt(t,(a,o)=>{r&&V(a)?Object.defineProperty(e,o,{__proto__:null,value:nn(a,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,o,{__proto__:null,value:a,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:n}),e),ai=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),oi=(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),Object.defineProperty(e.prototype,"constructor",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{__proto__:null,value:t.prototype}),r&&Object.assign(e.prototype,r)},si=(e,t,r,n)=>{let a,o,s;const l={};if(t=t||{},e==null)return t;do{for(a=Object.getOwnPropertyNames(e),o=a.length;o-- >0;)s=a[o],(!n||n(s,e,t))&&!l[s]&&(t[s]=e[s],l[s]=!0);e=r!==!1&&ke(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},ii=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return n!==-1&&n===r},li=e=>{if(!e)return null;if(ge(e))return e;let t=e.length;if(!sn(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},ci=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&ke(Uint8Array)),di=(e,t)=>{const n=(e&&e[Ye]).call(e);let a;for(;(a=n.next())&&!a.done;){const o=a.value;t.call(e,o[0],o[1])}},ui=(e,t)=>{let r;const n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},fi=z("HTMLFormElement"),pi=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,a){return n.toUpperCase()+a}),{propertyIsEnumerable:hi}=Object.prototype,mi=z("RegExp"),fn=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};tt(r,(a,o)=>{let s;(s=t(a,o,e))!==!1&&(n[o]=s||a)}),Object.defineProperties(e,n)},gi=e=>{fn(e,(t,r)=>{if(V(e)&&["arguments","caller","callee"].includes(r))return!1;const n=e[r];if(V(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},yi=(e,t)=>{const r={},n=a=>{a.forEach(o=>{r[o]=!0})};return ge(e)?n(e):n(String(e).split(t)),r},bi=()=>{},vi=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function wi(e){return!!(e&&V(e.append)&&e[an]==="FormData"&&e[Ye])}const Ci=e=>{const t=new WeakSet,r=n=>{if(Be(n)){if(t.has(n))return;if(De(n))return n;if(!("toJSON"in n)){t.add(n);let a;if(Ks(n)){a=[];for(const o of n){const s=r(o);!ye(s)&&a.push(s)}}else a=ge(n)?[]:{},tt(n,(o,s)=>{const l=r(o);!ye(l)&&(a[s]=l)});return t.delete(n),a}}return n};return r(e)},_i=z("AsyncFunction"),Si=e=>e&&(Be(e)||V(e))&&V(e.then)&&V(e.catch),pn=((e,t)=>e?setImmediate:t?((r,n)=>(be.addEventListener("message",({source:a,data:o})=>{a===be&&o===r&&n.length&&n.shift()()},!1),a=>{n.push(a),be.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",V(be.postMessage)),Ei=typeof queueMicrotask<"u"?queueMicrotask.bind(be):typeof process<"u"&&process.nextTick||pn,hn=e=>e!=null&&V(e[Ye]),p={isArray:ge,isArrayBuffer:on,isBuffer:De,isFormData:Gs,isArrayBufferView:Ms,isString:Us,isNumber:sn,isBoolean:$s,isObject:Be,isPlainObject:_t,isEmptyObject:js,isReadableStream:Qs,isRequest:Ys,isResponse:ei,isHeaders:ti,isUndefined:ye,isDate:Vs,isFile:Hs,isReactNativeBlob:Ws,isReactNative:qs,isBlob:zs,isRegExp:mi,isFunction:V,isStream:Js,isURLSearchParams:Xs,isTypedArray:ci,isFileList:Rs,forEach:tt,merge:Yt,extend:ni,trim:ri,stripBOM:ai,inherits:oi,toFlatObject:si,kindOf:Qt,kindOfTest:z,endsWith:ii,toArray:li,forEachEntry:di,matchAll:ui,isHTMLForm:fi,hasOwnProperty:wt,hasOwnProp:wt,hasOwnInPrototypeChain:et,getSafeProp:Is,reduceDescriptors:fn,freezeMethods:gi,toObjectSet:yi,toCamelCase:pi,noop:bi,toFiniteNumber:vi,findKey:dn,global:be,isContextDefined:un,isSpecCompliantForm:wi,toJSONObject:Ci,isAsyncFn:_i,isThenable:Si,setImmediate:pn,asap:Ei,isIterable:hn,isSafeIterable:e=>e!=null&&et(e,Ye)&&hn(e)},Ni=p.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Li=e=>{const t={};let r,n,a;return e&&e.split(`
4
- `).forEach(function(s){a=s.indexOf(":"),r=s.substring(0,a).trim().toLowerCase(),n=s.substring(a+1).trim();const l=p.hasOwnProp(t,r);!r||l&&p.hasOwnProp(Ni,r)||(r==="set-cookie"?l?t[r].push(n):t[r]=[n]:t[r]=l?t[r]+", "+n:n)}),t};function Oi(e){let t=0,r=e.length;for(;t<r;){const n=e.charCodeAt(t);if(n!==9&&n!==32)break;t+=1}for(;r>t;){const n=e.charCodeAt(r-1);if(n!==9&&n!==32)break;r-=1}return t===0&&r===e.length?e:e.slice(t,r)}const Ti=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),Ai=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function er(e,t){return p.isArray(e)?e.map(r=>er(r,t)):Oi(String(e).replace(t,""))}const Fi=e=>er(e,Ti),xi=e=>er(e,Ai);function mn(e){const t=Object.create(null);return p.forEach(e.toJSON(),(r,n)=>{t[n]=xi(r)}),t}const gn=Symbol("internals");function rt(e){return e&&String(e).trim().toLowerCase()}function St(e){return e===!1||e==null?e:p.isArray(e)?e.map(St):Fi(String(e))}function Pi(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}const ki=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;function tr(e){let t=0,r=e.length;for(;t<r;){const n=e.charCodeAt(t);if(n!==9&&n!==32)break;t+=1}for(;r>t;){const n=e.charCodeAt(r-1);if(n!==9&&n!==32)break;r-=1}return t===0&&r===e.length?e:e.slice(t,r)}function Di(e){const t=e.length-1;if(t<1||e.charCodeAt(0)!==34||e.charCodeAt(t)!==34)return e;let r="";for(let n=1;n<t;n++){const a=e.charCodeAt(n);if(a===34||a===92&&(n+=1,n>=t))return e;r+=e[n]}return r}function Bi(e){const t=Object.create(null),r=String(e);let n=0,a=!1,o=!1;function s(l){const c=tr(r.slice(n,l)),d=c.indexOf("=");if(d<1)return;const u=tr(c.slice(0,d));if(!ki.test(u))return;const f=u.toLowerCase();if(f==="__proto__"||f==="constructor"||f==="prototype")return;const h=tr(c.slice(d+1));t[f]=Di(h)}for(let l=0;l<r.length;l++){const c=r.charCodeAt(l);a?o?o=!1:c===92?o=!0:c===34&&(a=!1):c===34?a=!0:(c===44||c===59)&&(s(l),n=l+1)}return s(r.length),t}const Ii=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function rr(e,t,r,n,a){if(p.isFunction(n))return n.call(this,t,r);if(a&&(t=r),!!p.isString(t)){if(p.isString(n))return t.indexOf(n)!==-1;if(p.isRegExp(n))return n.test(t)}}function Mi(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function Ui(e,t){const r=p.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{__proto__:null,value:function(a,o,s){return this[n].call(this,t,a,o,s)},configurable:!0})})}let I=class{constructor(t){t&&this.set(t)}set(t,r,n){const a=this;function o(l,c,d){const u=rt(c);if(!u)return;const f=p.findKey(a,u);(!f||a[f]===void 0||d===!0||d===void 0&&a[f]!==!1)&&(a[f||c]=St(l))}const s=(l,c)=>p.forEach(l,(d,u)=>o(d,u,c));if(p.isPlainObject(t)||t instanceof this.constructor)s(t,r);else if(p.isString(t)&&(t=t.trim())&&!Ii(t))s(Li(t),r);else if(p.isObject(t)&&p.isSafeIterable(t)){let l=Object.create(null),c,d;for(const u of t){if(!p.isArray(u))throw new TypeError("Object iterator must return a key-value pair");d=u[0],p.hasOwnProp(l,d)?(c=l[d],l[d]=p.isArray(c)?[...c,u[1]]:[c,u[1]]):l[d]=u[1]}s(l,r)}else t!=null&&o(r,t,n);return this}get(t,r){if(t=rt(t),t){const n=p.findKey(this,t);if(n){const a=this[n];if(!r)return a;if(r===!0)return Pi(a);if(p.isFunction(r))return r.call(this,a,n);if(p.isRegExp(r))return r.exec(a);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=rt(t),t){const n=p.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||rr(this,this[n],n,r)))}return!1}delete(t,r){const n=this;let a=!1;function o(s){if(s=rt(s),s){const l=p.findKey(n,s);l&&(!r||rr(n,n[l],l,r))&&(delete n[l],a=!0)}}return p.isArray(t)?t.forEach(o):o(t),a}clear(t){const r=Object.keys(this);let n=r.length,a=!1;for(;n--;){const o=r[n];(!t||rr(this,this[o],o,t,!0))&&(delete this[o],a=!0)}return a}normalize(t){const r=this,n={};return p.forEach(this,(a,o)=>{const s=p.findKey(n,o);if(s){r[s]=St(a),delete r[o];return}const l=t?Mi(o):String(o).trim();l!==o&&delete r[o],r[l]=St(a),n[l]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const r=Object.create(null);return p.forEach(this,(n,a)=>{n!=null&&n!==!1&&(r[a]=t&&p.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(`
5
- `)}getSetCookie(){const t=this.get("set-cookie");return p.isArray(t)?t:t==null||t===!1?[]:[t]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static parseParameters(t){return Bi(t)}static concat(t,...r){const n=new this(t);return r.forEach(a=>n.set(a)),n}static accessor(t){const n=(this[gn]=this[gn]={accessors:{}}).accessors,a=this.prototype;function o(s){const l=rt(s);n[l]||(Ui(a,s),n[l]=!0)}return p.isArray(t)?t.forEach(o):o(t),this}};I.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),p.reduceDescriptors(I.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}}),p.freezeMethods(I);const Et="[REDACTED ****]";function $i(e){if(p.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(p.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}function ji(e,t){const r=new Set(t.map(o=>String(o).toLowerCase())),n=[],a=o=>{if(o===null||typeof o!="object"||p.isBuffer(o))return o;if(n.indexOf(o)!==-1)return;o instanceof I&&(o=o.toJSON()),n.push(o);let s;if(p.isArray(o))s=[],o.forEach((l,c)=>{const d=a(l);p.isUndefined(d)||(s[c]=d)});else{if(!p.isPlainObject(o)&&$i(o))return n.pop(),o;s=Object.create(null);for(const[l,c]of Object.entries(o)){const d=r.has(l.toLowerCase())?Et:a(c);p.isUndefined(d)||(s[l]=d)}}return n.pop(),s};return a(e)}function yn(e){try{return String(e)}catch{return""}}function Vi(e){return e.errors.map(r=>{try{return r&&r.message?yn(r.message):yn(r)}catch{return""}}).filter(Boolean).join("; ")||e.name||"AggregateError"}let E=class uo extends Error{static from(t,r,n,a,o,s){let l=t.message;!l&&p.isArray(t.errors)&&t.errors.length&&(l=Vi(t));const c=new uo(l,r||t.code,n,a,o);return Object.defineProperty(c,"cause",{__proto__:null,value:t,writable:!0,enumerable:!1,configurable:!0}),c.name=t.name,t.status!=null&&c.status==null&&(c.status=t.status),s&&Object.assign(c,s),c}constructor(t,r,n,a,o){super(t),Object.defineProperty(this,"message",{__proto__:null,value:t,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,r&&(this.code=r),n&&(this.config=n),a&&(this.request=a),o&&(this.response=o,this.status=o.status)}toJSON(){const t=this.config,r=t&&p.hasOwnProp(t,"redact")?t.redact:void 0,n=p.isArray(r)&&r.length>0?ji(t,r):p.toJSONObject(t);return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:n,code:this.code,status:this.status}}};E.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",E.ERR_BAD_OPTION="ERR_BAD_OPTION",E.ECONNABORTED="ECONNABORTED",E.ETIMEDOUT="ETIMEDOUT",E.ECONNREFUSED="ECONNREFUSED",E.ERR_NETWORK="ERR_NETWORK",E.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",E.ERR_DEPRECATED="ERR_DEPRECATED",E.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",E.ERR_BAD_REQUEST="ERR_BAD_REQUEST",E.ERR_CANCELED="ERR_CANCELED",E.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",E.ERR_INVALID_URL="ERR_INVALID_URL",E.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const Hi=null,bn=100;function nr(e){return p.isPlainObject(e)||p.isArray(e)}function vn(e){return p.endsWith(e,"[]")?e.slice(0,-2):e}function ar(e,t,r){return e?e.concat(t).map(function(a,o){return a=vn(a),!r&&o?"["+a+"]":a}).join(r?".":""):t}function Wi(e){return p.isArray(e)&&!e.some(nr)}const qi=p.toFlatObject(p,{},null,function(t){return/^is[A-Z]/.test(t)});function Nt(e,t,r){if(!p.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,r=p.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,C){return!p.isUndefined(C[y])});const n=r.metaTokens,a=r.visitor||_,o=r.dots,s=r.indexes,l=r.Blob||typeof Blob<"u"&&Blob,c=r.maxDepth===void 0?bn:r.maxDepth,d=l&&p.isSpecCompliantForm(t),u=[];if(!p.isFunction(a))throw new TypeError("visitor must be a function");function f(m){if(m===null)return"";if(p.isDate(m))return m.toISOString();if(p.isBoolean(m))return m.toString();if(!d&&p.isBlob(m))throw new E("Blob is not supported. Use a Buffer instead.");if(p.isArrayBuffer(m)||p.isTypedArray(m)){if(d&&typeof l=="function")return new l([m]);throw new E("Blob is not supported. Use a Buffer instead.",E.ERR_NOT_SUPPORT)}return m}function h(m){if(m>c)throw new E("Object is too deeply nested ("+m+" levels). Max depth: "+c,E.ERR_FORM_DATA_DEPTH_EXCEEDED)}function v(m,y){if(c===1/0)return JSON.stringify(m);const C=[];return JSON.stringify(m,function(A,F){if(!p.isObject(F))return F;for(;C.length&&C[C.length-1]!==this;)C.pop();return C.push(F),h(y+C.length-1),F})}function _(m,y,C){let N=m;if(p.isReactNative(t)&&p.isReactNativeBlob(m))return t.append(ar(C,y,o),f(m)),!1;if(m&&!C&&typeof m=="object"){if(p.endsWith(y,"{}"))y=n?y:y.slice(0,-2),m=v(m,1);else if(p.isArray(m)&&Wi(m)||(p.isFileList(m)||p.endsWith(y,"[]"))&&(N=p.toArray(m)))return y=vn(y),N.forEach(function(F,$){!(p.isUndefined(F)||F===null)&&t.append(s===!0?ar([y],$,o):s===null?y:y+"[]",f(F))}),!1}return nr(m)?!0:(t.append(ar(C,y,o),f(m)),!1)}const S=Object.assign(qi,{defaultVisitor:_,convertValue:f,isVisitable:nr});function b(m,y,C=0){if(!p.isUndefined(m)){if(h(C),u.indexOf(m)!==-1)throw new Error("Circular reference detected in "+y.join("."));u.push(m),p.forEach(m,function(A,F){(!(p.isUndefined(A)||A===null)&&a.call(t,A,p.isString(F)?F.trim():F,y,S))===!0&&b(A,y?y.concat(F):[F],C+1)}),u.pop()}}if(!p.isObject(e))throw new TypeError("data must be an object");return b(e),t}function wn(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(n){return t[n]})}function or(e,t){this._pairs=[],e&&Nt(e,this,t)}const Cn=or.prototype;Cn.append=function(t,r){this._pairs.push([t,r])},Cn.toString=function(t){const r=t?n=>t.call(this,n,wn):wn;return this._pairs.map(function(a){return r(a[0])+"="+r(a[1])},"").join("&")};function zi(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function _n(e,t,r){if(!t)return e;e=e||"";const n=p.isFunction(r)?{serialize:r}:r,a=p.getSafeProp(n,"encode")||zi,o=p.getSafeProp(n,"serialize");let s;if(o?s=o(t,n):s=p.isURLSearchParams(t)?t.toString():new or(t,n).toString(a),s){const l=e.indexOf("#");l!==-1&&(e=e.slice(0,l)),e+=(e.indexOf("?")===-1?"?":"&")+s}return e}class Sn{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){p.forEach(this.handlers,function(n){n!==null&&t(n)})}}const sr={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},Ri={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:or,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},ir=typeof window<"u"&&typeof document<"u",lr=typeof navigator=="object"&&navigator||void 0,Ki=ir&&(!lr||["ReactNative","NativeScript","NS"].indexOf(lr.product)<0),Ji=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Zi=ir&&window.location.href||"http://localhost",D={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:ir,hasStandardBrowserEnv:Ki,hasStandardBrowserWebWorkerEnv:Ji,navigator:lr,origin:Zi},Symbol.toStringTag,{value:"Module"})),...Ri};function Gi(e,t){return Nt(e,new D.classes.URLSearchParams,{visitor:function(r,n,a,o){return D.isNode&&p.isBuffer(r)?(this.append(n,r.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...t})}const En=bn;function Nn(e){if(e>En)throw new E("FormData field is too deeply nested ("+e+" levels). Max depth: "+En,E.ERR_FORM_DATA_DEPTH_EXCEEDED)}function Xi(e){const t=[],r=/[^.[\]]+|\[([^.[\]]*)]/g;let n;for(;(n=r.exec(e))!==null;)Nn(t.length),t.push(n[0]==="[]"?"":n[1]||n[0]);return t}function Qi(e){const t={},r=Object.keys(e);let n;const a=r.length;let o;for(n=0;n<a;n++)o=r[n],t[o]=e[o];return t}function Ln(e){function t(r,n,a,o){Nn(o);let s=r[o++];if(s==="__proto__")return!0;const l=Number.isFinite(+s),c=o>=r.length;return s=!s&&p.isArray(a)?a.length:s,c?(p.hasOwnProp(a,s)?a[s]=p.isArray(a[s])?a[s].concat(n):[a[s],n]:a[s]=n,!l):((!p.hasOwnProp(a,s)||!p.isObject(a[s]))&&(a[s]=[]),t(r,n,a[s],o)&&p.isArray(a[s])&&(a[s]=Qi(a[s])),!l)}if(p.isFormData(e)&&p.isFunction(e.entries)){const r={};return p.forEachEntry(e,(n,a)=>{t(Xi(n),a,r,0)}),r}return null}const Ie=(e,t)=>e!=null&&p.hasOwnProp(e,t)?e[t]:void 0;function Yi(e,t,r){if(p.isString(e))try{return(t||JSON.parse)(e),p.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}const nt={transitional:sr,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){const n=r.getContentType()||"",a=n.indexOf("application/json")>-1,o=p.isObject(t);if(o&&p.isHTMLForm(t)&&(t=new FormData(t)),p.isFormData(t))return a?JSON.stringify(Ln(t)):t;if(p.isArrayBuffer(t)||p.isBuffer(t)||p.isStream(t)||p.isFile(t)||p.isBlob(t)||p.isReadableStream(t))return t;if(p.isArrayBufferView(t))return t.buffer;if(p.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let l;if(o){const c=Ie(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return Gi(t,c).toString();if((l=p.isFileList(t))||n.indexOf("multipart/form-data")>-1){const d=Ie(this,"env"),u=d&&d.FormData;return Nt(l?{"files[]":t}:t,u&&new u,c)}}return o||a?(r.setContentType("application/json",!1),Yi(t)):t}],transformResponse:[function(t){const r=Ie(this,"transitional")||nt.transitional,n=r&&r.forcedJSONParsing,a=Ie(this,"responseType"),o=a==="json";if(p.isResponse(t)||p.isReadableStream(t))return t;if(t&&p.isString(t)&&(n&&!a||o)){const l=!(r&&r.silentJSONParsing)&&o;try{return JSON.parse(t,Ie(this,"parseReviver"))}catch(c){if(l)throw c.name==="SyntaxError"?E.from(c,E.ERR_BAD_RESPONSE,this,null,Ie(this,"response")):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:D.classes.FormData,Blob:D.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};p.forEach(["delete","get","head","post","put","patch","query"],e=>{nt.headers[e]={}});function cr(e,t){const r=this||nt,n=t||r,a=I.from(n.headers);let o=n.data;return p.forEach(e,function(l){o=l.call(r,o,a.normalize(),t?t.status:void 0)}),a.normalize(),o}function On(e){return!!(e&&e.__CANCEL__)}let at=class extends E{constructor(t,r,n){super(t??"canceled",E.ERR_CANCELED,r,n),this.name="CanceledError",this.__CANCEL__=!0}};function Tn(e,t,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new E("Request failed with status code "+r.status,r.status>=400&&r.status<500?E.ERR_BAD_REQUEST:E.ERR_BAD_RESPONSE,r.config,r.request,r))}function el(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}function tl(e,t){e=e||10;const r=new Array(e),n=new Array(e);let a=0,o=0,s;return t=t!==void 0?t:1e3,function(c){const d=Date.now(),u=n[o];s||(s=d),r[a]=c,n[a]=d;let f=o,h=0;for(;f!==a;)h+=r[f++],f=f%e;if(a=(a+1)%e,a===o&&(o=(o+1)%e),d-s<t)return;const v=u&&d-u;return v?Math.round(h*1e3/v):void 0}}function rl(e,t){let r=0,n=1e3/t,a,o;const s=(d,u=Date.now())=>{r=u,a=null,o&&(clearTimeout(o),o=null),e(...d)};return[(...d)=>{const u=Date.now(),f=u-r;f>=n?s(d,u):(a=d,o||(o=setTimeout(()=>{o=null,s(a)},n-f)))},()=>a&&s(a)]}const Lt=(e,t,r=3)=>{let n=0;const a=tl(50,250);return rl(o=>{if(!o||typeof o.loaded!="number")return;const s=o.loaded,l=o.lengthComputable?o.total:void 0,c=Math.max(0,l!=null?Math.min(s,l):s),d=Math.max(0,c-n),u=a(d);n=Math.max(n,c);const f={loaded:c,total:l,progress:l?c/l:void 0,bytes:d,rate:u||void 0,estimated:u&&l?(l-c)/u:void 0,event:o,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(f)},r)},An=(e,t)=>{const r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},Fn=(e,t=p.asap)=>(...r)=>t(()=>e(...r)),nl=D.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,D.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(D.origin),D.navigator&&/(msie|trident)/i.test(D.navigator.userAgent)):()=>!0,al=D.hasStandardBrowserEnv?{write(e,t,r,n,a,o,s){if(typeof document>"u")return;const l=[`${e}=${encodeURIComponent(t)}`];p.isNumber(r)&&l.push(`expires=${new Date(r).toUTCString()}`),p.isString(n)&&l.push(`path=${n}`),p.isString(a)&&l.push(`domain=${a}`),o===!0&&l.push("secure"),p.isString(s)&&l.push(`SameSite=${s}`),document.cookie=l.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.split(";");for(let r=0;r<t.length;r++){const n=t[r].replace(/^\s+/,""),a=n.indexOf("=");if(a!==-1&&n.slice(0,a)===e)try{return decodeURIComponent(n.slice(a+1))}catch{return n.slice(a+1)}}return null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function ol(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function sl(e,t){if(!t)return e;let r=e.length;for(;r>0&&e.charCodeAt(r-1)===47;)r--;return e.slice(0,r)+"/"+t.replace(/^\/+/,"")}const il=/^https?:(?!\/\/)/i,ll=/[\t\n\r]/g;function cl(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}function dl(e){return cl(e).replace(ll,"")}function ul(e){return e&&e.replace(/(^|&)([^=&]*=)?[^&]+/g,(t,r,n="")=>`${r}${n}${Et}`)}function fl(e){const t=e.replace(/^(https?:\/{0,2})[^/?#]*@/i,`$1${Et}@`),r=t.indexOf("#"),a=(r===-1?t:t.slice(0,r)).replace(/([?&][^=&#]*=)[^&#]*/g,`$1${Et}`);return r===-1?a:`${a}#${ul(t.slice(r+1))}`}function xn(e,t){if(typeof e=="string"){const r=dl(e);if(il.test(r))throw new E(`Invalid URL ${JSON.stringify(fl(r))}: missing "//" after protocol`,E.ERR_INVALID_URL,t)}}function Pn(e,t,r,n){xn(t,n);let a=!ol(t);return e&&(a||r===!1)?(xn(e,n),sl(e,t)):t}const kn=e=>e instanceof I?{...e}:e,pl=e=>Object.getOwnPropertySymbols&&Object.getOwnPropertyDescriptor?Object.keys(e).concat(Object.getOwnPropertySymbols(e).filter(t=>Object.getOwnPropertyDescriptor(e,t).enumerable)):Object.keys(e);function ve(e,t){e=e||{},t=t||{};const r=Object.create(null);Object.defineProperty(r,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function n(u,f,h,v){return p.isPlainObject(u)&&p.isPlainObject(f)?p.merge.call({caseless:v},u,f):p.isPlainObject(f)?p.merge({},f):p.isArray(f)?f.slice():f}function a(u,f,h,v){if(p.isUndefined(f)){if(!p.isUndefined(u))return n(void 0,u,h,v)}else return n(u,f,h,v)}function o(u,f){if(!p.isUndefined(f))return n(void 0,f)}function s(u,f){if(p.isUndefined(f)){if(!p.isUndefined(u))return n(void 0,u)}else return n(void 0,f)}function l(u){const f=p.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!p.isUndefined(f))if(p.isPlainObject(f)){if(p.hasOwnProp(f,u))return f[u]}else return;const h=p.hasOwnProp(e,"transitional")?e.transitional:void 0;if(p.isPlainObject(h)&&p.hasOwnProp(h,u))return h[u]}function c(u,f,h){if(p.hasOwnProp(t,h))return n(u,f);if(p.hasOwnProp(e,h))return n(void 0,u)}const d={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,allowedSocketPaths:s,responseEncoding:s,validateStatus:c,headers:(u,f,h)=>a(kn(u),kn(f),h,!0)};return p.forEach(pl({...e,...t}),function(f){if(f==="__proto__"||f==="constructor"||f==="prototype")return;const h=p.hasOwnProp(d,f)?d[f]:a,v=p.hasOwnProp(e,f)?e[f]:void 0,_=p.hasOwnProp(t,f)?t[f]:void 0,S=h(v,_,f);p.isUndefined(S)&&h!==c||(r[f]=S)}),p.hasOwnProp(t,"validateStatus")&&p.isUndefined(t.validateStatus)&&l("validateStatusUndefinedResolves")===!1&&(p.hasOwnProp(e,"validateStatus")?r.validateStatus=n(void 0,e.validateStatus):delete r.validateStatus),r}const hl=["content-type","content-length"];function ml(e,t,r){if(r!=="content-only"){e.set(t);return}Object.entries(t||{}).forEach(([n,a])=>{hl.includes(n.toLowerCase())&&e.set(n,a)})}const gl=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,r)=>String.fromCharCode(parseInt(r,16)));function Dn(e){const t=ve({},e),r=h=>p.hasOwnProp(t,h)?t[h]:void 0,n=r("data");let a=r("withXSRFToken");const o=r("xsrfHeaderName"),s=r("xsrfCookieName");let l=r("headers");const c=r("auth"),d=r("baseURL"),u=r("allowAbsoluteUrls"),f=r("url");if(t.headers=l=I.from(l),t.url=_n(Pn(d,f,u,t),r("params"),r("paramsSerializer")),c){const h=p.getSafeProp(c,"username")||"",v=p.getSafeProp(c,"password")||"";try{l.set("Authorization","Basic "+btoa(h+":"+(v?gl(v):"")))}catch(_){throw E.from(_,E.ERR_BAD_OPTION_VALUE,e)}}if(p.isFormData(n)&&(D.hasStandardBrowserEnv||D.hasStandardBrowserWebWorkerEnv||p.isReactNative(n)?l.setContentType(void 0):p.isFunction(n.getHeaders)&&ml(l,n.getHeaders(),r("formDataHeaderPolicy"))),D.hasStandardBrowserEnv&&(p.isFunction(a)&&(a=a(t)),a===!0||a==null&&nl(t.url))){const v=o&&s&&al.read(s);v&&l.set(o,v)}return t}const yl=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(r,n){const a=Dn(e);let o=a.data;const s=I.from(a.headers).normalize();let{responseType:l,onUploadProgress:c,onDownloadProgress:d}=a,u,f,h,v,_;function S(){v&&v(),_&&_(),a.cancelToken&&a.cancelToken.unsubscribe(u),a.signal&&a.signal.removeEventListener("abort",u)}let b=new XMLHttpRequest;b.open(a.method.toUpperCase(),a.url,!0),b.timeout=a.timeout;function m(){if(!b)return;const C=I.from("getAllResponseHeaders"in b&&b.getAllResponseHeaders()),A={data:!l||l==="text"||l==="json"?b.responseText:b.response,status:b.status,statusText:b.statusText,headers:C,config:e,request:b};Tn(function($){r($),S()},function($){n($),S()},A),b=null}"onloadend"in b?b.onloadend=m:b.onreadystatechange=function(){!b||b.readyState!==4||b.status===0&&!(b.responseURL&&b.responseURL.startsWith("file:"))||setTimeout(m)},b.onabort=function(){b&&(n(new E("Request aborted",E.ECONNABORTED,e,b)),S(),b=null)},b.onerror=function(N){const A=N&&N.message?N.message:"Network Error",F=new E(A,E.ERR_NETWORK,e,b);F.event=N||null,n(F),S(),b=null},b.ontimeout=function(){let N=a.timeout?"timeout of "+a.timeout+"ms exceeded":"timeout exceeded";const A=a.transitional||sr;a.timeoutErrorMessage&&(N=a.timeoutErrorMessage),n(new E(N,A.clarifyTimeoutError?E.ETIMEDOUT:E.ECONNABORTED,e,b)),S(),b=null},o===void 0&&s.setContentType(null),"setRequestHeader"in b&&p.forEach(mn(s),function(N,A){b.setRequestHeader(A,N)}),p.isUndefined(a.withCredentials)||(b.withCredentials=!!a.withCredentials),l&&l!=="json"&&(b.responseType=a.responseType),d&&([h,_]=Lt(d,!0),b.addEventListener("progress",h)),c&&b.upload&&([f,v]=Lt(c),b.upload.addEventListener("progress",f),b.upload.addEventListener("loadend",v)),(a.cancelToken||a.signal)&&(u=C=>{b&&(n(!C||C.type?new at(null,e,b):C),b.abort(),S(),b=null)},a.cancelToken&&a.cancelToken.subscribe(u),a.signal&&(a.signal.aborted?u():a.signal.addEventListener("abort",u)));const y=el(a.url);if(y&&!D.protocols.includes(y)){n(new E("Unsupported protocol "+y+":",E.ERR_BAD_REQUEST,e)),S();return}b.send(o||null)})},bl=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const r=new AbortController;let n=!1;const a=function(c){if(!n){n=!0,s();const d=c instanceof Error?c:this.reason;r.abort(d instanceof E?d:new at(d instanceof Error?d.message:d))}};let o=t&&setTimeout(()=>{o=null,a(new E(`timeout of ${t}ms exceeded`,E.ETIMEDOUT))},t);const s=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(c=>{c.unsubscribe?c.unsubscribe(a):c.removeEventListener("abort",a)}),e=null)};e.forEach(c=>{if(!n){if(c.aborted){a.call(c);return}c.addEventListener("abort",a,{once:!0})}});const{signal:l}=r;return l.unsubscribe=()=>p.asap(s),l},vl=function*(e,t){let r=e.byteLength;if(r<t){yield e;return}let n=0,a;for(;n<r;)a=n+t,yield e.slice(n,a),n=a},wl=async function*(e,t){for await(const r of Cl(e))yield*vl(r,t)},Cl=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:r,value:n}=await t.read();if(r)break;yield n}}finally{await t.cancel()}},Bn=(e,t,r,n)=>{const a=wl(e,t);let o=0,s,l=c=>{s||(s=!0,n&&n(c))};return new ReadableStream({async pull(c){try{const{done:d,value:u}=await a.next();if(d){l(),c.close();return}let f=u.byteLength;if(r){let h=o+=f;r(h)}c.enqueue(new Uint8Array(u))}catch(d){throw l(d),d}},cancel(c){return l(c),a.return()}},{highWaterMark:2})},In=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,Mn=(e,t,r)=>t+2<r&&In(e.charCodeAt(t+1))&&In(e.charCodeAt(t+2)),Un=e=>e<=57?e-48:(e&223)-55,_l=e=>e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===43||e===47||e===45||e===95,Sl=e=>e===9||e===10||e===12||e===13||e===32,El=e=>{const t=Math.floor(e/4),r=e%4;return t*3+(r===2?1:r===3?2:0)},Nl=e=>{const t=e.length;let r=0;return t>0&&e.charCodeAt(t-1)===61&&(r++,t>1&&e.charCodeAt(t-2)===61&&r++),Math.floor((t-r)*3/4)},Ll=e=>{const t=e.length;let r=0,n=0,a=!1;for(let o=0;o<t;o++){let s=e.charCodeAt(o);if(s===37&&Mn(e,o,t)&&(s=Un(e.charCodeAt(o+1))*16+Un(e.charCodeAt(o+2)),o+=2),!Sl(s)){if(s===61){n++;continue}if(!_l(s)||n>0){a=!0;continue}r++}}return a||n>2||n>0&&(r+n)%4!==0||r%4===1?Nl(e):El(r)},Ol=(e,t)=>{if(!e||typeof e!="string"||!e.startsWith("data:"))return 0;const r=e.indexOf(",");if(r<0)return 0;const n=e.slice(5,r),a=e.slice(r+1);if(/;base64/i.test(n))return t(a);let s=0;for(let l=0,c=a.length;l<c;l++){const d=a.charCodeAt(l);if(d===37&&Mn(a,l,c))s+=1,l+=2;else if(d<128)s+=1;else if(d<2048)s+=2;else if(d>=55296&&d<=56319&&l+1<c){const u=a.charCodeAt(l+1);u>=56320&&u<=57343?(s+=4,l++):s+=3}else s+=3}return s};function Tl(e){const t=typeof e=="string"?e.indexOf("#"):-1;return Ol(t===-1?e:e.slice(0,t),Ll)}const dr="1.19.0",$n=64*1024,{isFunction:Ot}=p,Al=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,r)=>String.fromCharCode(parseInt(r,16))),jn=e=>{if(!p.isString(e))return e;try{return decodeURIComponent(e)}catch{return e}},Vn=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Fl=e=>{const t=e.indexOf("://");let r=e;return t!==-1&&(r=r.slice(t+3)),r.includes("@")||r.includes(":")},xl=e=>{const t=p.global!==void 0&&p.global!==null?p.global:globalThis,{ReadableStream:r,TextEncoder:n}=t;e=p.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:a,Request:o,Response:s}=e,l=a?Ot(a):typeof fetch=="function",c=Ot(o),d=Ot(s);if(!l)return!1;const u=l&&Ot(r),f=l&&(typeof n=="function"?(m=>y=>m.encode(y))(new n):async m=>new Uint8Array(await new o(m).arrayBuffer())),h=c&&u&&Vn(()=>{let m=!1;const y=new o(D.origin,{body:new r,method:"POST",get duplex(){return m=!0,"half"}}),C=y.headers.has("Content-Type");return y.body!=null&&y.body.cancel(),m&&!C}),v=d&&u&&Vn(()=>p.isReadableStream(new s("").body)),_={stream:v&&(m=>m.body)};l&&["text","arrayBuffer","blob","formData","stream"].forEach(m=>{!_[m]&&(_[m]=(y,C)=>{let N=y&&y[m];if(N)return N.call(y);throw new E(`Response type '${m}' is not supported`,E.ERR_NOT_SUPPORT,C)})});const S=async m=>{if(m==null)return 0;if(p.isBlob(m))return m.size;if(p.isSpecCompliantForm(m))return(await new o(D.origin,{method:"POST",body:m}).arrayBuffer()).byteLength;if(p.isArrayBufferView(m)||p.isArrayBuffer(m))return m.byteLength;if(p.isURLSearchParams(m)&&(m=m+""),p.isString(m))return(await f(m)).byteLength},b=async(m,y)=>{const C=p.toFiniteNumber(m.getContentLength());return C??S(y)};return async m=>{let{url:y,method:C,data:N,signal:A,cancelToken:F,timeout:$,onDownloadProgress:Q,onUploadProgress:Oe,responseType:H,headers:k,withCredentials:j="same-origin",fetchOptions:ie,maxContentLength:Z,maxBodyLength:Ut}=Dn(m);const ut=p.isNumber(Z)&&Z>-1,xr=p.isNumber(Ut)&&Ut>-1,Md=x=>p.hasOwnProp(m,x)?m[x]:void 0;let ao=a||fetch;H=H?(H+"").toLowerCase():"text";let pe=bl([A,F&&F.toAbortSignal()],$),B=null;const Te=pe&&pe.unsubscribe&&(()=>{pe.unsubscribe()});let We,ft=null;const oo=()=>new E("Request body larger than maxBodyLength limit",E.ERR_BAD_REQUEST,m,B);try{let x;const G=Md("auth");if(G){const O=p.getSafeProp(G,"username")||"",W=p.getSafeProp(G,"password")||"";x={username:O,password:W}}if(Fl(y)){const O=new URL(y,D.origin);if(!x&&(O.username||O.password)){const W=jn(O.username),he=jn(O.password);x={username:W,password:he}}(O.username||O.password)&&(O.username="",O.password="",y=O.href)}if(x&&(k.delete("authorization"),k.set("Authorization","Basic "+btoa(Al((x.username||"")+":"+(x.password||""))))),ut&&typeof y=="string"&&y.startsWith("data:")&&Tl(y)>Z)throw new E("maxContentLength size of "+Z+" exceeded",E.ERR_BAD_RESPONSE,m,B);if(xr&&C!=="get"&&C!=="head"){const O=await S(N);if(typeof O=="number"&&isFinite(O)&&(We=O,O>Ut))throw oo()}const $t=xr&&(p.isReadableStream(N)||p.isStream(N)),so=(O,W,he)=>Bn(O,$n,Ae=>{if(xr&&Ae>Ut)throw ft=oo();W&&W(Ae)},he);if(h&&C!=="get"&&C!=="head"&&(Oe||$t)){if(We=We??await b(k,N),We!==0||$t){let O=new o(y,{method:"POST",body:N,duplex:"half"}),W;if(p.isFormData(N)&&(W=O.headers.get("content-type"))&&k.setContentType(W),O.body){const[he,Ae]=Oe&&An(We,Lt(Fn(Oe)))||[];N=so(O.body,he,Ae)}}}else if($t&&!c&&u&&C!=="get"&&C!=="head")N=so(N);else if($t&&c&&!h&&C!=="get"&&C!=="head")throw new E("Stream request bodies are not supported by the current fetch implementation",E.ERR_NOT_SUPPORT,m,B);p.isString(j)||(j=j?"include":"omit");const Ud=c&&"credentials"in o.prototype;if(p.isFormData(N)){const O=k.getContentType();O&&/^multipart\/form-data/i.test(O)&&!/boundary=/i.test(O)&&k.delete("content-type")}k.set("User-Agent","axios/"+dr,!1);const io={...ie,signal:pe,method:C.toUpperCase(),headers:mn(k.normalize()),body:N,duplex:"half",credentials:Ud?j:void 0};B=c&&new o(y,io);let le=await(c?ao(B,ie):ao(y,io));const lo=I.from(le.headers);if(ut){const O=p.toFiniteNumber(lo.getContentLength());if(O!=null&&O>Z)throw new E("maxContentLength size of "+Z+" exceeded",E.ERR_BAD_RESPONSE,m,B)}const Pr=v&&(H==="stream"||H==="response");if(v&&le.body&&(Q||ut||Pr&&Te)){const O={};["status","statusText","headers"].forEach(pt=>{O[pt]=le[pt]});const W=p.toFiniteNumber(lo.getContentLength()),[he,Ae]=Q&&An(W,Lt(Fn(Q),!0))||[];let co=0;const $d=pt=>{if(ut&&(co=pt,co>Z))throw new E("maxContentLength size of "+Z+" exceeded",E.ERR_BAD_RESPONSE,m,B);he&&he(pt)};le=new s(Bn(le.body,$n,$d,()=>{Ae&&Ae(),Te&&Te()}),O)}H=H||"text";let ce=await _[p.findKey(_,H)||"text"](le,m);if(ut&&!v&&!Pr){let O;if(ce!=null&&(typeof ce.byteLength=="number"?O=ce.byteLength:typeof ce.size=="number"?O=ce.size:typeof ce=="string"&&(O=typeof n=="function"?new n().encode(ce).byteLength:ce.length)),typeof O=="number"&&O>Z)throw new E("maxContentLength size of "+Z+" exceeded",E.ERR_BAD_RESPONSE,m,B)}return!Pr&&Te&&Te(),await new Promise((O,W)=>{Tn(O,W,{data:ce,headers:I.from(le.headers),status:le.status,statusText:le.statusText,config:m,request:B})})}catch(x){if(Te&&Te(),pe&&pe.aborted&&pe.reason instanceof E){const G=pe.reason;throw G.config=m,B&&(G.request=B),x!==G&&Object.defineProperty(G,"cause",{__proto__:null,value:x,writable:!0,enumerable:!1,configurable:!0}),G}if(ft)throw B&&!ft.request&&(ft.request=B),ft;if(x instanceof E)throw B&&!x.request&&(x.request=B),x;if(x&&x.name==="TypeError"&&/Load failed|fetch/i.test(x.message)){const G=new E("Network Error",E.ERR_NETWORK,m,B,x&&x.response);throw Object.defineProperty(G,"cause",{__proto__:null,value:x.cause||x,writable:!0,enumerable:!1,configurable:!0}),G}throw E.from(x,x&&x.code,m,B,x&&x.response)}}},Pl=new Map,Hn=e=>{let t=e&&e.env||{};const{fetch:r,Request:n,Response:a}=t,o=[n,a,r];let s=o.length,l=s,c,d,u=Pl;for(;l--;)c=o[l],d=u.get(c),d===void 0&&u.set(c,d=l?new Map:xl(t)),u=d;return d};Hn();const ur={http:Hi,xhr:yl,fetch:{get:Hn}};p.forEach(ur,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const Wn=e=>`- ${e}`,kl=e=>p.isFunction(e)||e===null||e===!1;function Dl(e,t){e=p.isArray(e)?e:[e];const{length:r}=e;let n,a;const o={};for(let s=0;s<r;s++){n=e[s];let l;if(a=n,!kl(n)&&(a=ur[(l=String(n)).toLowerCase()],a===void 0))throw new E(`Unknown adapter '${l}'`);if(a&&(p.isFunction(a)||(a=a.get(t))))break;o[l||"#"+s]=a}if(!a){const s=Object.entries(o).map(([c,d])=>`adapter ${c} `+(d===!1?"is not supported by the environment":"is not available in the build"));let l=r?s.length>1?`since :
6
- `+s.map(Wn).join(`
7
- `):" "+Wn(s[0]):"as no adapter specified";throw new E("There is no suitable adapter to dispatch the request "+l,E.ERR_NOT_SUPPORT)}return a}const qn={getAdapter:Dl,adapters:ur};function fr(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new at(null,e)}function pr(e){return fr(e),e.headers=I.from(e.headers),e.data=cr.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),qn.getAdapter(e.adapter||nt.adapter,e)(e).then(function(n){fr(e),e.response=n;try{n.data=cr.call(e,e.transformResponse,n)}finally{delete e.response}return n.headers=I.from(n.headers),n},function(n){if(!On(n)&&(fr(e),n&&n.response)){e.response=n.response;try{n.response.data=cr.call(e,e.transformResponse,n.response)}finally{delete e.response}n.response.headers=I.from(n.response.headers)}return Promise.reject(n)})}const Tt={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Tt[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const zn={};Tt.transitional=function(t,r,n){function a(o,s){return"[Axios v"+dr+"] Transitional option '"+o+"'"+s+(n?". "+n:"")}return(o,s,l)=>{if(t===!1)throw new E(a(s," has been removed"+(r?" in "+r:"")),E.ERR_DEPRECATED);return r&&!zn[s]&&(zn[s]=!0,console.warn(a(s," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(o,s,l):!0}},Tt.spelling=function(t){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};function Bl(e,t,r){if(typeof e!="object"||e===null)throw new E("options must be an object",E.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let a=n.length;for(;a-- >0;){const o=n[a],s=Object.prototype.hasOwnProperty.call(t,o)?t[o]:void 0;if(s){const l=e[o],c=l===void 0||s(l,o,e);if(c!==!0)throw new E("option "+o+" must be "+c,E.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new E("Unknown option "+o,E.ERR_BAD_OPTION)}}const At={assertOptions:Bl,validators:Tt},M=At.validators;let we=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Sn,response:new Sn}}async request(t,r){try{return await this._request(t,r)}catch(n){if(n instanceof Error){let a={};Error.captureStackTrace?Error.captureStackTrace(a):a=new Error;const o=(()=>{if(!a.stack)return"";const s=a.stack.indexOf(`
8
- `);return s===-1?"":a.stack.slice(s+1)})();try{if(!n.stack)n.stack=o;else if(o){const s=o.indexOf(`
9
- `),l=s===-1?-1:o.indexOf(`
10
- `,s+1),c=l===-1?"":o.slice(l+1);String(n.stack).endsWith(c)||(n.stack+=`
11
- `+o)}}catch{}}throw n}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=ve(this.defaults,r);const{transitional:n,paramsSerializer:a,headers:o}=r;n!==void 0&&At.assertOptions(n,{silentJSONParsing:M.transitional(M.boolean),forcedJSONParsing:M.transitional(M.boolean),clarifyTimeoutError:M.transitional(M.boolean),legacyInterceptorReqResOrdering:M.transitional(M.boolean),advertiseZstdAcceptEncoding:M.transitional(M.boolean),validateStatusUndefinedResolves:M.transitional(M.boolean)},!1),a!=null&&(p.isFunction(a)?r.paramsSerializer={serialize:a}:At.assertOptions(a,{encode:M.function,serialize:M.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),At.assertOptions(r,{baseUrl:M.spelling("baseURL"),withXsrfToken:M.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let s=o&&p.merge(o.common,o[r.method]);o&&p.forEach(["delete","get","head","post","put","patch","query","common"],_=>{delete o[_]}),r.headers=I.concat(s,o);const l=[];let c=!0;this.interceptors.request.forEach(function(S){if(typeof S.runWhen=="function"&&S.runWhen(r)===!1)return;c=c&&S.synchronous;const b=r.transitional||sr;b&&b.legacyInterceptorReqResOrdering?l.unshift(S.fulfilled,S.rejected):l.push(S.fulfilled,S.rejected)});const d=[];this.interceptors.response.forEach(function(S){d.push(S.fulfilled,S.rejected)});let u,f=0,h;if(!c){const _=[pr.bind(this),void 0];for(_.unshift(...l),_.push(...d),h=_.length,u=Promise.resolve(r);f<h;)u=u.then(_[f++],_[f++]);return u}h=l.length;let v=r;for(;f<h;){const _=l[f++],S=l[f++];try{v=_?_(v):v}catch(b){if(!S){u=Promise.reject(b);break}try{const m=S.call(this,b);p.isThenable(m)&&(u=Promise.resolve(m).then(()=>pr.call(this,v)))}catch(m){u=Promise.reject(m)}break}}if(!u)try{u=pr.call(this,v)}catch(_){u=Promise.reject(_)}for(f=0,h=d.length;f<h;)u=u.then(d[f++],d[f++]);return u}getUri(t){t=ve(this.defaults,t);const r=Pn(t.baseURL,t.url,t.allowAbsoluteUrls,t);return _n(r,t.params,t.paramsSerializer)}};p.forEach(["delete","get","head","options"],function(t){we.prototype[t]=function(r,n){return this.request(ve(n||{},{method:t,url:r,data:n&&p.hasOwnProp(n,"data")?n.data:void 0}))}}),p.forEach(["post","put","patch","query"],function(t){function r(n){return function(o,s,l){return this.request(ve(l||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:o,data:s}))}}we.prototype[t]=r(),t!=="query"&&(we.prototype[t+"Form"]=r(!0))});let Il=class fo{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(o){r=o});const n=this;this.promise.then(a=>{if(!n._listeners)return;let o=n._listeners.length;for(;o-- >0;)n._listeners[o](a);n._listeners=null}),this.promise.then=a=>{let o;const s=new Promise(l=>{n.subscribe(l),o=l}).then(a);return s.cancel=function(){n.unsubscribe(o)},s},t(function(o,s,l){n.reason||(n.reason=new at(o,s,l),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const t=new AbortController,r=n=>{t.abort(n)};return this.subscribe(r),t.signal.unsubscribe=()=>this.unsubscribe(r),t.signal}static source(){let t;return{token:new fo(function(a){t=a}),cancel:t}}};function Ml(e){return function(r){return e.apply(null,r)}}function Ul(e){return p.isObject(e)&&e.isAxiosError===!0}const hr={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerReturnsAnUnknownError:520,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(hr).forEach(([e,t])=>{hr[t]=e});function Rn(e){const t=new we(e),r=nn(we.prototype.request,t);return p.extend(r,we.prototype,t,{allOwnKeys:!0}),p.extend(r,t,null,{allOwnKeys:!0}),r.create=function(a){return Rn(ve(e,a))},r}const P=Rn(nt);P.Axios=we,P.CanceledError=at,P.CancelToken=Il,P.isCancel=On,P.VERSION=dr,P.toFormData=Nt,P.AxiosError=E,P.Cancel=P.CanceledError,P.all=function(t){return Promise.all(t)},P.spread=Ml,P.isAxiosError=Ul,P.mergeConfig=ve,P.AxiosHeaders=I,P.formToJSON=e=>Ln(p.isHTMLForm(e)?new FormData(e):e),P.getAdapter=qn.getAdapter,P.HttpStatusCode=hr,P.default=P;const{Axios:Jd,AxiosError:Zd,CanceledError:Gd,isCancel:Xd,CancelToken:Qd,VERSION:Yd,all:eu,Cancel:tu,isAxiosError:ru,spread:nu,toFormData:au,AxiosHeaders:ou,HttpStatusCode:su,formToJSON:iu,getAdapter:lu,mergeConfig:cu,create:du}=P;function Ft(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)n!=="__proto__"&&(e[n]=r[n])}return e}var $l={read:function(e){return e[0]==='"'&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function mr(e,t){function r(a,o,s){if(!(typeof document>"u")){s=Ft({},t,s),typeof s.expires=="number"&&(s.expires=new Date(Date.now()+s.expires*864e5)),s.expires&&(s.expires=s.expires.toUTCString()),a=encodeURIComponent(a).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var l="";for(var c in s)s[c]&&(l+="; "+c,s[c]!==!0&&(l+="="+s[c].split(";")[0]));return document.cookie=a+"="+e.write(o,a)+l}}function n(a){if(!(typeof document>"u"||arguments.length&&!a)){for(var o=document.cookie?document.cookie.split("; "):[],s={},l=0;l<o.length;l++){var c=o[l].split("="),d=c.slice(1).join("=");try{var u=decodeURIComponent(c[0]);if(u in s||(s[u]=e.read(d,u)),a===u)break}catch{}}return a?s[a]:s}}return Object.create({set:r,get:n,remove:function(a,o){r(a,"",Ft({},o,{expires:-1}))},withAttributes:function(a){return mr(this.converter,Ft({},this.attributes,a))},withConverter:function(a){return mr(Ft({},this.converter,a),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(e)}})}var ot=mr($l,{path:"/"});const jl={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};let Me="https://api-grievance.airaops.com",Kn=null;try{if(typeof{url:typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:jt&&jt.tagName.toUpperCase()==="SCRIPT"&&jt.src||new URL("complaint-app.umd.js",document.baseURI).href}<"u"&&jl?.VITE_API_URL)Me=void 0;else{const e=typeof process<"u"?process:null;e?.env?.VITE_API_URL&&(Me=e.env.VITE_API_URL)}}catch{}const Jn=e=>{Me=e||"",U.defaults.baseURL=Me},gr=e=>{Kn=e||null},Vl=()=>Kn||ot.get("token")||null,U=P.create({baseURL:Me,headers:{Accept:"application/json","Content-Type":"application/json"}});U.interceptors.request.use(e=>{const t=Vl();return e.headers=e.headers||{},t?e.headers.Authorization=`Bearer ${t}`:delete e.headers.Authorization,e});let yr=!1,br=null;U.interceptors.response.use(e=>e,async e=>{const t=e.config,r=e.response;if(r&&(r.status===401||r.status===402)){const n=ot.get("refreshToken");if(n)try{yr||(yr=!0,br=P.post(`${Me}/api/v1/auth/refresh`,{},{headers:{Authorization:`Bearer ${n}`}}));const a=await br,{token:o,refreshToken:s}=a.data;return gr(o),s&&ot.set("refreshToken",s),t.headers.Authorization=`Bearer ${o}`,U(t)}catch{ot.remove("token"),ot.remove("refreshToken")}finally{yr=!1,br=null}}return Promise.reject(e)});const Hl=L.createContext(null),Zn=({children:e,apiUrl:t,authToken:r})=>(t&&Jn(t),gr(r||null),i.jsx(Hl.Provider,{value:{apiUrl:t,authToken:r},children:e})),ae={mode:"light",colors:{primary:"#2D64B8",primaryHover:"#2557A3",text:"#111827",textSecondary:"#6B7280",textMuted:"#9CA3AF",border:"#E5E7EB",borderLight:"#F3F4F6",background:"#F5F5F5",surface:"#FFFFFF",white:"#FFFFFF",onPrimary:"#FFFFFF",activeBg:"#ECFDF5",activeBorder:"#A7F3D0",activeText:"#059669",inactiveBg:"#F3F4F6",inactiveBorder:"#D1D5DB",inactiveText:"#6B7280",link:"#2D64B8",divider:"#E5E7EB",accentBorder:"#C5D7F0",accentBg:"#EEF4FB",stepDone:"#D6E4F7",success:"#22C55E",danger:"#EF4444",secondaryBtn:"#D1D5DB",secondaryBtnHover:"#C4C9D1",inputBg:"#FFFFFF",tableHeadBg:"#EEF4FB",sidebarBg:"#FAFBFD",overlay:"rgba(16, 24, 40, 0.06)"},radii:{sm:"6px",md:"8px",lg:"12px",xl:"16px",pill:"999px"},spacing:{xs:"4px",sm:"8px",md:"12px",lg:"16px",xl:"24px",xxl:"32px"},typography:{fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',h1Size:"28px",h2Size:"16px",bodySize:"14px",labelSize:"13px",valueSize:"22px",smallSize:"13px"},shadow:{card:"0 1px 2px rgba(16, 24, 40, 0.04)",settings:"0 1px 3px rgba(16, 24, 40, 0.06)"}},st={mode:"dark",colors:{primary:"#5B8DEF",primaryHover:"#7BA3F3",text:"#F3F4F6",textSecondary:"#A1A1AA",textMuted:"#71717A",border:"#3F3F46",borderLight:"#27272A",background:"#0F1115",surface:"#18181B",white:"#FFFFFF",onPrimary:"#FFFFFF",activeBg:"#052E1C",activeBorder:"#166534",activeText:"#4ADE80",inactiveBg:"#27272A",inactiveBorder:"#3F3F46",inactiveText:"#A1A1AA",link:"#7BA3F3",divider:"#3F3F46",accentBorder:"#2A3A55",accentBg:"#1A2333",stepDone:"#1E3A5F",success:"#22C55E",danger:"#F87171",secondaryBtn:"#3F3F46",secondaryBtnHover:"#52525B",inputBg:"#18181B",tableHeadBg:"#1A2333",sidebarBg:"#12141A",overlay:"rgba(0, 0, 0, 0.35)"},radii:{sm:"6px",md:"8px",lg:"12px",xl:"16px",pill:"999px"},spacing:{xs:"4px",sm:"8px",md:"12px",lg:"16px",xl:"24px",xxl:"32px"},typography:{fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',h1Size:"28px",h2Size:"16px",bodySize:"14px",labelSize:"13px",valueSize:"22px",smallSize:"13px"},shadow:{card:"0 1px 2px rgba(0, 0, 0, 0.35)",settings:"0 1px 3px rgba(0, 0, 0, 0.4)"}},Gn={light:ae,dark:st};function Ue(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)}function $e(e,t){if(!Ue(t))return e;const r={...e};return Object.keys(t).forEach(n=>{const a=t[n];Ue(a)&&Ue(e[n])?r[n]=$e(e[n],a):a!==void 0&&(r[n]=a)}),r}function Xn(e){return!e||!Ue(e)?{light:ae,dark:st}:Ue(e.light)||Ue(e.dark)?{light:$e(ae,e.light||{}),dark:$e(st,e.dark||{})}:{light:$e(ae,e),dark:$e(st,e)}}function Qn(e,t=!1){const r=Xn(e);return{...t?r.dark:r.light,mode:t?"dark":"light",__pack:r}}const Wl={primary:"--ca-primary",primaryHover:"--ca-primary-hover",text:"--ca-text",textSecondary:"--ca-text-secondary",textMuted:"--ca-text-muted",border:"--ca-border",borderLight:"--ca-border-light",background:"--ca-bg",surface:"--ca-surface",white:"--ca-white",onPrimary:"--ca-on-primary",activeBg:"--ca-active-bg",activeBorder:"--ca-active-border",activeText:"--ca-active-text",inactiveBg:"--ca-inactive-bg",inactiveBorder:"--ca-inactive-border",inactiveText:"--ca-inactive-text",link:"--ca-link",divider:"--ca-divider",accentBorder:"--ca-accent-border",accentBg:"--ca-accent-bg",stepDone:"--ca-step-done",success:"--ca-success",danger:"--ca-danger",secondaryBtn:"--ca-secondary-btn",secondaryBtnHover:"--ca-secondary-btn-hover",inputBg:"--ca-input-bg",tableHeadBg:"--ca-table-head-bg",sidebarBg:"--ca-sidebar-bg",overlay:"--ca-overlay"},ql={sm:"--ca-radius-sm",md:"--ca-radius-md",lg:"--ca-radius-lg",xl:"--ca-radius-xl",pill:"--ca-radius-pill"},zl={fontFamily:"--ca-font",h1Size:"--ca-h1-size",h2Size:"--ca-h2-size",bodySize:"--ca-body-size",labelSize:"--ca-label-size",valueSize:"--ca-value-size",smallSize:"--ca-small-size"},Rl={card:"--ca-shadow-card",settings:"--ca-shadow-settings"};function Yn(e){const t={};return e?.colors&&Object.entries(Wl).forEach(([r,n])=>{e.colors[r]!=null&&(t[n]=e.colors[r])}),e?.radii&&Object.entries(ql).forEach(([r,n])=>{e.radii[r]!=null&&(t[n]=e.radii[r])}),e?.typography&&Object.entries(zl).forEach(([r,n])=>{e.typography[r]!=null&&(t[n]=e.typography[r])}),e?.shadow&&Object.entries(Rl).forEach(([r,n])=>{e.shadow[r]!=null&&(t[n]=e.shadow[r])}),t["--ca-on-primary"]&&!t["--ca-white"]&&(t["--ca-white"]=t["--ca-on-primary"]),t}const ea=L.createContext({darkMode:!1,theme:null,themeFile:Gn,cssVars:{}});function ta({theme:e,darkMode:t=!1,children:r}){const n=L.useMemo(()=>{const a=Qn(e,!!t),o=Yn(a);return{darkMode:!!t,theme:a,themeFile:a.__pack,cssVars:o,mode:a.mode}},[e,t]);return i.jsx(ea.Provider,{value:n,children:r})}function ra(){return L.useContext(ea)}const ee=Object.freeze({types:"/api/v1/complaints/types",departments:"/api/v1/complaints/departments",departmentTree:"/api/v1/complaints/departments/tree",priorities:"/api/v1/complaints/priorities",workflows:"/api/v1/complaints/workflows",workflowSteps:"/api/v1/complaints/workflows/steps",statuses:"/api/v1/complaints/statuses"}),Kl=(e,t)=>t.rejectWithValue({status:e?.response?.status??e?.status,message:e?.response?.data?.message??e?.response?.data?.error??e?.message??"Something went wrong"}),oe=(e,t)=>ht.createAsyncThunk(e,async(r,n)=>{try{return(await t(r,n)).data}catch(a){return Kl(a,n)}}),it=(e,t)=>({list:oe(`complaint/${e}/list`,(r,{signal:n})=>U.get(t,{params:r,signal:n})),getById:oe(`complaint/${e}/getById`,(r,{signal:n})=>U.get(`${t}/${r}`,{signal:n})),create:oe(`complaint/${e}/create`,r=>U.post(t,r)),update:oe(`complaint/${e}/update`,({id:r,data:n})=>U.patch(`${t}/${r}`,n)),remove:oe(`complaint/${e}/remove`,r=>U.delete(`${t}/${r}`))}),Ce=it("types",ee.types),_e=it("departments",ee.departments),Se=it("priorities",ee.priorities),Ee=it("workflows",ee.workflows),Ne=it("statuses",ee.statuses),xt=oe("complaint/departments/getTree",(e,{signal:t})=>U.get(ee.departmentTree,{signal:t})),Pt=oe("complaint/workflows/getSteps",(e,{signal:t})=>U.get(`${ee.workflowSteps}/${e}`,{signal:t})),kt=oe("complaint/workflows/saveSteps",e=>U.post(ee.workflowSteps,e)),na=oe("complaint/workflows/deleteSteps",e=>U.delete(`${ee.workflowSteps}/${e}`)),Jl=Ce.list,Zl=Ce.getById,Gl=Ce.create,Xl=Ce.update,Ql=Ce.remove,Yl=_e.list,ec=_e.getById,tc=_e.create,rc=_e.update,nc=_e.remove,ac=Se.list,oc=Se.getById,sc=Se.create,ic=Se.update,lc=Se.remove,cc=Ee.list,dc=Ee.getById,uc=Ee.create,fc=Ee.update,pc=Ee.remove,hc=Ne.list,mc=Ne.getById,gc=Ne.create,yc=Ne.update,bc=Ne.remove,lt=()=>({data:[],selected:null,pagination:null,isLoading:!1,isMutating:!1,error:null}),aa={types:lt(),departments:lt(),priorities:lt(),workflows:lt(),statuses:lt(),departmentTree:[],workflowSteps:{},isLoadingDepartmentTree:!1,isLoadingWorkflowSteps:!1,error:null},vc=e=>{if(Array.isArray(e))return{data:e,pagination:null};const t=e?.data??e;return Array.isArray(t)?{data:t,pagination:e?.pagination??null}:{data:t?.results??t?.items??[],pagination:t?.pagination??e?.pagination??null}},ct=e=>e?.data??e,Dt=e=>e?.id??e?._id,wc=(e,t)=>{if(!t||typeof t!="object")return e;const r=Dt(t);if(r==null)return e;const n=e.findIndex(o=>Dt(o)===r);if(n<0)return[t,...e];const a=[...e];return a[n]=t,a},Le=e=>e.payload?.message??e.error?.message??"Something went wrong",dt=(e,t,r)=>{e.addCase(r.list.pending,n=>{n[t].isLoading=!0,n[t].error=null}).addCase(r.list.fulfilled,(n,a)=>{const o=vc(a.payload);n[t].isLoading=!1,n[t].data=o.data,n[t].pagination=o.pagination}).addCase(r.list.rejected,(n,a)=>{n[t].isLoading=!1,n[t].error=Le(a)}).addCase(r.getById.pending,n=>{n[t].isLoading=!0,n[t].error=null}).addCase(r.getById.fulfilled,(n,a)=>{n[t].isLoading=!1,n[t].selected=ct(a.payload)}).addCase(r.getById.rejected,(n,a)=>{n[t].isLoading=!1,n[t].error=Le(a)}),[r.create,r.update].forEach(n=>{e.addCase(n.pending,a=>{a[t].isMutating=!0,a[t].error=null}).addCase(n.fulfilled,(a,o)=>{const s=ct(o.payload);a[t].isMutating=!1,a[t].selected=s,a[t].data=wc(a[t].data,s)}).addCase(n.rejected,(a,o)=>{a[t].isMutating=!1,a[t].error=Le(o)})}),e.addCase(r.remove.pending,n=>{n[t].isMutating=!0,n[t].error=null}).addCase(r.remove.fulfilled,(n,a)=>{const o=a.meta.arg;n[t].isMutating=!1,n[t].data=n[t].data.filter(s=>Dt(s)!==o),Dt(n[t].selected)===o&&(n[t].selected=null)}).addCase(r.remove.rejected,(n,a)=>{n[t].isMutating=!1,n[t].error=Le(a)})},oa=ht.createSlice({name:"complaintAppComplaint",initialState:aa,reducers:{clearComplaintError(e,t){const r=t.payload;r&&e[r]?.error!==void 0?e[r].error=null:e.error=null},clearSelectedComplaintResource(e,t){const r=t.payload;r&&e[r]?.selected!==void 0&&(e[r].selected=null)},resetComplaintState(){return aa}},extraReducers:e=>{dt(e,"types",Ce),dt(e,"departments",_e),dt(e,"priorities",Se),dt(e,"workflows",Ee),dt(e,"statuses",Ne),e.addCase(xt.pending,t=>{t.isLoadingDepartmentTree=!0,t.error=null}).addCase(xt.fulfilled,(t,r)=>{t.isLoadingDepartmentTree=!1;const n=ct(r.payload);t.departmentTree=Array.isArray(n)?n:n?.tree??n?.items??[]}).addCase(xt.rejected,(t,r)=>{t.isLoadingDepartmentTree=!1,t.error=Le(r)}).addCase(Pt.pending,t=>{t.isLoadingWorkflowSteps=!0,t.error=null}).addCase(Pt.fulfilled,(t,r)=>{t.isLoadingWorkflowSteps=!1,t.workflowSteps[r.meta.arg]=ct(r.payload)}).addCase(Pt.rejected,(t,r)=>{t.isLoadingWorkflowSteps=!1,t.error=Le(r)}).addCase(kt.pending,t=>{t.isLoadingWorkflowSteps=!0,t.error=null}).addCase(kt.fulfilled,(t,r)=>{t.isLoadingWorkflowSteps=!1;const n=ct(r.payload),a=r.meta.arg?.workflowId??n?.workflowId??n?.id;a!==void 0&&(t.workflowSteps[a]=n)}).addCase(kt.rejected,(t,r)=>{t.isLoadingWorkflowSteps=!1,t.error=Le(r)}).addCase(na.fulfilled,(t,r)=>{delete t.workflowSteps[r.meta.arg]})}}),{clearComplaintError:Cc,clearSelectedComplaintResource:_c,resetComplaintState:Sc}=oa.actions,sa=oa.reducer,Ec=ht.combineReducers({complaintAppComplaint:sa}),ia=e=>ht.configureStore({reducer:Ec,preloadedState:e,middleware:t=>t({immutableCheck:!1,serializableCheck:!1})}),la=ia();function R({children:e,variant:t="primary",size:r="md",startIcon:n,endIcon:a,className:o="",type:s="button",disabled:l=!1,onClick:c,...d}){const u=["ca-btn",`ca-btn--${t}`,r==="sm"?"ca-btn--sm":"",r==="lg"?"ca-btn--lg":"",o].filter(Boolean).join(" ");return i.jsxs("button",{type:s,className:u,disabled:l,onClick:c,...d,children:[n?i.jsx("span",{className:"ca-btn__icon",children:n}):null,e,a?i.jsx("span",{className:"ca-btn__icon",children:a}):null]})}function ca({size:e=16,color:t="currentColor",...r}){return i.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",...r,children:i.jsx("path",{d:"M12 5v14M5 12h14",stroke:t,strokeWidth:"2",strokeLinecap:"round"})})}const da={h1:"ca-h1",h2:"ca-h2",body:"ca-body",label:"ca-label",value:"ca-value",small:"ca-small",link:"ca-link"},Nc={h1:"h1",h2:"h2",body:"p",label:"span",value:"span",small:"span",link:"button"};function fe({variant:e="body",as:t,className:r="",children:n,...a}){const o=t||Nc[e]||"p",s=da[e]||da.body;return i.jsx(o,{className:`${s} ${r}`.trim(),...a,children:n})}function vr(e){return i.jsx(fe,{variant:"h1",...e})}function Bt(e){return i.jsx(fe,{variant:"h2",...e})}function It(e){return i.jsx(fe,{variant:"body",...e})}function ua(e){return i.jsx(fe,{variant:"label",...e})}function fa(e){return i.jsx(fe,{variant:"value",...e})}function Lc(e){return i.jsx(fe,{variant:"link",type:"button",...e})}function pa({title:e="Complaint Management",description:t,actionLabel:r="Create New Form",onAction:n,className:a=""}){return i.jsxs("header",{className:`ca-page-header ${a}`.trim(),children:[i.jsxs("div",{className:"ca-page-header__text",children:[i.jsx(vr,{children:e}),t?i.jsx(It,{children:t}):null]}),i.jsx("div",{className:"ca-page-header__actions",children:i.jsx(R,{startIcon:i.jsx(ca,{}),onClick:n,children:r})})]})}function ha({status:e="inactive",label:t,className:r=""}){const a=String(e).toLowerCase()==="active",o=t??(a?"Active":"Inactive");return i.jsx("span",{className:`ca-badge rounded ca-badge--${a?"active":"inactive"} ${r}`.trim(),children:o})}const ma=(...e)=>e.filter((t,r,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===r).join(" ").trim();const Oc=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const Tc=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,n)=>n?n.toUpperCase():r.toLowerCase());const ga=e=>{const t=Tc(e);return t.charAt(0).toUpperCase()+t.slice(1)};var wr={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const Ac=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},Fc=L.createContext({}),xc=()=>L.useContext(Fc),Pc=L.forwardRef(({color:e,size:t,strokeWidth:r,absoluteStrokeWidth:n,className:a="",children:o,iconNode:s,...l},c)=>{const{size:d=24,strokeWidth:u=2,absoluteStrokeWidth:f=!1,color:h="currentColor",className:v=""}=xc()??{},_=n??f?Number(r??u)*24/Number(t??d):r??u;return L.createElement("svg",{ref:c,...wr,width:t??d??wr.width,height:t??d??wr.height,stroke:e??h,strokeWidth:_,className:ma("lucide",v,a),...!o&&!Ac(l)&&{"aria-hidden":"true"},...l},[...s.map(([S,b])=>L.createElement(S,b)),...Array.isArray(o)?o:[o]])});const se=(e,t)=>{const r=L.forwardRef(({className:n,...a},o)=>L.createElement(Pc,{ref:o,iconNode:t,className:ma(`lucide-${Oc(ga(e))}`,`lucide-${e}`,n),...a}));return r.displayName=ga(e),r};const kc=se("building-2",[["path",{d:"M10 12h4",key:"a56b0p"}],["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M14 21v-3a2 2 0 0 0-4 0v3",key:"1rgiei"}],["path",{d:"M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2",key:"secmi2"}],["path",{d:"M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16",key:"16ra0t"}]]);const Dc=se("circle-dot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);const Bc=se("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);const Ic=se("ellipsis-vertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);const Mc=se("flag",[["path",{d:"M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528",key:"1jaruq"}]]);const Uc=se("funnel",[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]]);const ya=se("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const $c=se("store",[["path",{d:"M15 21v-5a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v5",key:"slp6dd"}],["path",{d:"M17.774 10.31a1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.451 0 1.12 1.12 0 0 0-1.548 0 2.5 2.5 0 0 1-3.452 0 1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.77-3.248l2.889-4.184A2 2 0 0 1 7 2h10a2 2 0 0 1 1.653.873l2.895 4.192a2.5 2.5 0 0 1-3.774 3.244",key:"o0xfot"}],["path",{d:"M4 10.95V19a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8.05",key:"wn3emo"}]]);const jc=se("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);function Vc({options:e=[],className:t=""}){const[r,n]=L.useState(!1),a=L.useRef(null);L.useEffect(()=>{const s=l=>{a.current&&!a.current.contains(l.target)&&n(!1)};return document.addEventListener("mousedown",s),()=>{document.removeEventListener("mousedown",s)}},[]);const o=s=>{s.onClick?.(),n(!1)};return i.jsxs("div",{ref:a,className:`ca-more-functions ${t}`.trim(),children:[i.jsx("button",{type:"button",className:"ca-more-functions__button",onClick:()=>n(s=>!s),"aria-label":"More options","aria-expanded":r,children:i.jsx(Ic,{size:16})}),r&&e.length>0&&i.jsx("div",{className:"ca-more-functions__menu",children:e.map((s,l)=>i.jsxs("button",{type:"button",className:`ca-more-functions__item ${s.danger?"ca-more-functions__item--danger":""}`,onClick:()=>o(s),children:[s.icon&&i.jsx("span",{className:"ca-more-functions__icon",children:s.icon}),i.jsx("span",{children:s.label})]},s.key||l))})]})}function ba({title:e,status:t,statusLabel:r,titleAsLink:n=!1,onTitleClick:a,menuOptions:o=[],className:s=""}){return i.jsxs("div",{className:`ca-system-card__header ${s}`.trim(),children:[i.jsx("div",{className:"ca-system-card__title-wrap",children:n?i.jsx("button",{type:"button",className:"ca-h2 ca-h2--link",onClick:a,children:e}):i.jsx(Bt,{children:e})}),i.jsxs("div",{className:"ca-system-card__header-actions",children:[i.jsx(ha,{status:t,label:r}),i.jsx(Vc,{options:o})]})]})}function Cr({size:e=16,color:t="currentColor",...r}){return i.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",...r,children:i.jsx("path",{d:"M9 6l6 6-6 6",stroke:t,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function va({updatedOn:e,openLabel:t="Open",configureLabel:r="Configure",onOpen:n,onConfigure:a,className:o="",id:s,title:l}){const c=Ze(),d=()=>{c("/querymanagement")};return i.jsxs("div",{className:`ca-system-card__footer ${o}`.trim(),children:[i.jsx(fe,{variant:"small",as:"span",children:e?`Updated on ${e}`:""}),i.jsxs("div",{className:"ca-system-card__footer-actions",children:[i.jsx(R,{size:"sm",onClick:d,children:t}),i.jsx(R,{variant:"outline",size:"sm",onClick:a,endIcon:i.jsx(Cr,{size:14,color:"currentColor"}),children:r})]})]})}function wa({label:e,value:t,icon:r,className:n=""}){const a=t==null?"—":typeof t=="number"?String(t).padStart(2,"0"):t;return i.jsxs("div",{className:`ca-data-point ${n}`.trim(),children:[r?i.jsx("span",{className:"ca-data-point__icon","aria-hidden":"true",children:r}):null,i.jsx(fa,{children:a}),i.jsx("span",{className:"ca-data-point__label",children:e})]})}function Ca({className:e=""}){return i.jsx("div",{className:`ca-divider ${e}`.trim(),role:"separator","aria-orientation":"vertical"})}const Hc="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_617_15259)'%3e%3cpath%20d='M9.99992%2011.9997H6.66658M11.9999%209.33301H6.66658M2.66659%2014.6663H13.3333C13.6869%2014.6663%2014.026%2014.5259%2014.2761%2014.2758C14.5261%2014.0258%2014.6666%2013.6866%2014.6666%2013.333V2.66634C14.6666%202.31272%2014.5261%201.97358%2014.2761%201.72353C14.026%201.47348%2013.6869%201.33301%2013.3333%201.33301H5.33325C4.97963%201.33301%204.64049%201.47348%204.39044%201.72353C4.14039%201.97358%203.99992%202.31272%203.99992%202.66634V5.99967M2.66659%2014.6663C3.02021%2014.6663%203.35935%2014.5259%203.60939%2014.2758C3.85944%2014.0258%203.99992%2013.6866%203.99992%2013.333V5.99967M2.66659%2014.6663C2.31296%2014.6663%201.97382%2014.5259%201.72378%2014.2758C1.47373%2014.0258%201.33325%2013.6866%201.33325%2013.333V7.33301C1.33325%206.97939%201.47373%206.64025%201.72378%206.3902C1.97382%206.14015%202.31296%205.99967%202.66659%205.99967H3.99992M7.33325%203.99967H11.3333C11.7014%203.99967%2011.9999%204.29815%2011.9999%204.66634V5.99967C11.9999%206.36786%2011.7014%206.66634%2011.3333%206.66634H7.33325C6.96506%206.66634%206.66658%206.36786%206.66658%205.99967V4.66634C6.66658%204.29815%206.96506%203.99967%207.33325%203.99967Z'%20stroke='%232D64B8'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_617_15259'%3e%3crect%20width='16'%20height='16'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",Wc="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M6.44729%202.75711C6.48402%202.37067%206.66351%202.01181%206.95069%201.75063C7.23787%201.48945%207.61211%201.34473%208.00029%201.34473C8.38847%201.34473%208.76271%201.48945%209.04989%201.75063C9.33707%202.01181%209.51656%202.37067%209.55329%202.75711C9.57537%203.00675%209.65727%203.24739%209.79205%203.45867C9.92683%203.66995%2010.1105%203.84565%2010.3276%203.97089C10.5447%204.09614%2010.7887%204.16724%2011.0391%204.17819C11.2895%204.18913%2011.5388%204.1396%2011.766%204.03378C12.1187%203.87363%2012.5184%203.85045%2012.8873%203.96877C13.2562%204.08708%2013.5678%204.33841%2013.7616%204.67385C13.9554%205.00928%2014.0175%205.40482%2013.9357%205.78349C13.854%206.16215%2013.6342%206.49685%2013.3193%206.72244C13.1142%206.86634%2012.9468%207.05751%2012.8312%207.27979C12.7157%207.50207%2012.6553%207.74891%2012.6553%207.99944C12.6553%208.24997%2012.7157%208.49681%2012.8312%208.71909C12.9468%208.94137%2013.1142%209.13254%2013.3193%209.27644C13.6342%209.50203%2013.854%209.83673%2013.9357%2010.2154C14.0175%2010.5941%2013.9554%2010.9896%2013.7616%2011.325C13.5678%2011.6605%2013.2562%2011.9118%2012.8873%2012.0301C12.5184%2012.1484%2012.1187%2012.1253%2011.766%2011.9651C11.5388%2011.8593%2011.2895%2011.8097%2011.0391%2011.8207C10.7887%2011.8316%2010.5447%2011.9027%2010.3276%2012.028C10.1105%2012.1532%209.92683%2012.3289%209.79205%2012.5402C9.65727%2012.7515%209.57537%2012.9921%209.55329%2013.2418C9.51656%2013.6282%209.33707%2013.9871%209.04989%2014.2483C8.76271%2014.5094%208.38847%2014.6542%208.00029%2014.6542C7.61211%2014.6542%207.23787%2014.5094%206.95069%2014.2483C6.66351%2013.9871%206.48402%2013.6282%206.44729%2013.2418C6.42525%2012.992%206.34336%2012.7513%206.20854%2012.54C6.07371%2012.3286%205.88994%2012.1528%205.67278%2012.0276C5.45562%2011.9023%205.21147%2011.8313%204.96101%2011.8204C4.71055%2011.8095%204.46116%2011.8591%204.23396%2011.9651C3.88122%2012.1253%203.48151%2012.1484%203.11263%2012.0301C2.74374%2011.9118%202.43207%2011.6605%202.23828%2011.325C2.04449%2010.9896%201.98244%2010.5941%202.0642%2010.2154C2.14596%209.83673%202.36569%209.50203%202.68063%209.27644C2.88571%209.13254%203.05311%208.94137%203.16868%208.71909C3.28426%208.49681%203.34459%208.24997%203.34459%207.99944C3.34459%207.74891%203.28426%207.50207%203.16868%207.27979C3.05311%207.05751%202.88571%206.86634%202.68063%206.72244C2.36614%206.49674%202.14679%206.16217%202.06523%205.78376C1.98366%205.40535%202.0457%205.01014%202.23928%204.67492C2.43287%204.3397%202.74417%204.08843%203.11269%203.96994C3.4812%203.85144%203.88061%203.8742%204.23329%204.03378C4.46046%204.1396%204.70979%204.18913%204.96016%204.17819C5.21053%204.16724%205.45458%204.09614%205.67165%203.97089C5.88872%203.84565%206.07242%203.66995%206.2072%203.45867C6.34198%203.24739%206.42388%203.00675%206.44596%202.75711M9.99996%207.99978C9.99996%209.10434%209.10453%209.99978%207.99996%209.99978C6.89539%209.99978%205.99996%209.10434%205.99996%207.99978C5.99996%206.89521%206.89539%205.99978%207.99996%205.99978C9.10453%205.99978%209.99996%206.89521%209.99996%207.99978Z'%20stroke='%23745EBF'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",qc="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M9.99992%208H6.66659M9.99992%205.33333H6.66659M12.6666%2011.3333V3.33333C12.6666%202.97971%2012.5261%202.64057%2012.2761%202.39052C12.026%202.14048%2011.6869%202%2011.3333%202H2.66659M2.66659%202C3.02021%202%203.35935%202.14048%203.60939%202.39052C3.85944%202.64057%203.99992%202.97971%203.99992%203.33333V5.33333M2.66659%202C2.31296%202%201.97382%202.14048%201.72378%202.39052C1.47373%202.64057%201.33325%202.97971%201.33325%203.33333V4.66667C1.33325%204.84348%201.40349%205.01305%201.52851%205.13807C1.65354%205.2631%201.82311%205.33333%201.99992%205.33333H3.99992M5.33325%2014H13.3333C13.6869%2014%2014.026%2013.8595%2014.2761%2013.6095C14.5261%2013.3594%2014.6666%2013.0203%2014.6666%2012.6667V12C14.6666%2011.8232%2014.5963%2011.6536%2014.4713%2011.5286C14.3463%2011.4036%2014.1767%2011.3333%2013.9999%2011.3333H7.33325C7.15644%2011.3333%206.98687%2011.4036%206.86185%2011.5286C6.73682%2011.6536%206.66659%2011.8232%206.66659%2012V12.6667C6.66659%2013.0203%206.52611%2013.3594%206.27606%2013.6095C6.02601%2013.8595%205.68687%2014%205.33325%2014ZM5.33325%2014C4.97963%2014%204.64049%2013.8595%204.39044%2013.6095C4.14039%2013.3594%203.99992%2013.0203%203.99992%2012.6667V5.33333'%20stroke='%2300B692'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",zc="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M2.66675%209.33301H6.66675M2.66675%201.33301H9.33341M3.33341%2011.9997H12.6667C13.0349%2011.9997%2013.3334%2012.2982%2013.3334%2012.6663V13.9997C13.3334%2014.3679%2013.0349%2014.6663%2012.6667%2014.6663H3.33341C2.96522%2014.6663%202.66675%2014.3679%202.66675%2013.9997V12.6663C2.66675%2012.2982%202.96522%2011.9997%203.33341%2011.9997ZM3.33341%203.99967H12.6667C13.0349%203.99967%2013.3334%204.29815%2013.3334%204.66634V5.99967C13.3334%206.36786%2013.0349%206.66634%2012.6667%206.66634H3.33341C2.96522%206.66634%202.66675%206.36786%202.66675%205.99967V4.66634C2.66675%204.29815%202.96522%203.99967%203.33341%203.99967Z'%20stroke='%23FF6F00'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e";function _a({id:e,title:t,status:r="inactive",statusLabel:n,description:a,descriptionHref:o,departments:s,workflows:l,fields:c,formsFilled:d,updatedOn:u,titleAsLink:f=!1,onTitleClick:h,onDescriptionClick:v,onConfigure:_,onOpen:S,menuOptions:b=[],className:m=""}){const y=()=>{_?.({id:e,title:t,status:r,departments:s,workflows:l,fields:c,formsFilled:d,updatedOn:u})},C=()=>{if(v){v({id:e,title:t,descriptionHref:o});return}o&&typeof window<"u"&&window.open(o,"_blank","noopener,noreferrer")},N=[{label:"Departments",value:s,icon:i.jsx("img",{src:Hc,alt:""})},{label:"Workflows",value:l,icon:i.jsx("img",{src:Wc,alt:""})},{label:"Fields",value:c,icon:i.jsx("img",{src:qc,alt:""})},{label:"Forms Filled",value:d,icon:i.jsx("img",{src:zc,alt:""})}];return i.jsxs("article",{className:`ca-system-card ${m}`.trim(),children:[i.jsx(ba,{title:t,status:r,statusLabel:n,titleAsLink:f,onTitleClick:()=>h?.({id:e,title:t}),menuOptions:b}),a?i.jsx("p",{className:"ca-system-card__description",onClick:C,children:a}):null,i.jsx("div",{className:"ca-system-card__stats",children:N.map((A,F)=>i.jsxs(L.Fragment,{children:[F>0?i.jsx(Ca,{}):i.jsx("div",{className:"ca-system-card__stats-spacer"}),i.jsx(wa,{label:A.label,value:A.value,icon:A.icon})]},A.label))}),i.jsx(va,{updatedOn:u,onOpen:()=>S?.({id:e,title:t}),id:e,title:t,onConfigure:y})]})}function Sa({systems:e=[],onConfigure:t,onOpen:r,onTitleClick:n,onDescriptionClick:a,emptyMessage:o="No systems found.",className:s=""}){return e.length?i.jsx("div",{className:`ca-system-grid ${s}`.trim(),children:e.map(l=>i.jsx(_a,{...l,onConfigure:t,onOpen:r,onTitleClick:n,onDescriptionClick:a},l.id??l.title))}):i.jsx("div",{className:`ca-system-grid ${s}`.trim(),children:i.jsx("div",{className:"ca-empty",children:i.jsx(It,{children:o})})})}function te({value:e,onChange:t,placeholder:r,type:n="text",icon:a,className:o="",inputClassName:s="",...l}){return i.jsxs("div",{className:`ca-input-wrap ${o}`.trim(),children:[a?i.jsx("span",{className:"ca-input-wrap__icon",children:a}):null,i.jsx("input",{type:n,className:`ca-input ${a?"ca-input--with-icon":""} ${s}`.trim(),value:e,onChange:t,placeholder:r,...l})]})}function Ea({size:e=18,color:t="currentColor",...r}){return i.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",...r,children:[i.jsx("path",{d:"M10.5 18a7.5 7.5 0 1 1 0-15 7.5 7.5 0 0 1 0 15Z",stroke:t,strokeWidth:"1.75"}),i.jsx("path",{d:"M16.5 16.5 21 21",stroke:t,strokeWidth:"1.75",strokeLinecap:"round"})]})}function Na({value:e,onChange:t,onSearch:r,placeholder:n="Search",className:a=""}){const o=s=>{s.key==="Enter"&&r&&r(e)};return i.jsx("div",{className:`ca-search ${a}`.trim(),children:i.jsx(te,{value:e,onChange:t,onKeyDown:o,placeholder:n,icon:i.jsx(Ea,{}),"aria-label":n})})}function La({text:e="Loading",fullScreen:t=!1}){return i.jsxs("div",{className:"ca-loading",style:t?{minHeight:"calc(100vh - 80px)"}:void 0,role:"status","aria-live":"polite",children:[i.jsx("span",{className:"ca-loading__spinner"}),i.jsxs("span",{children:[e,"…"]})]})}const Oa=[{id:"qms",title:"QMS - Query Management System",status:"active",description:"Description of the template",departments:3,workflows:12,fields:55,formsFilled:234,updatedOn:"12 Mar 2024",titleAsLink:!1},{id:"cms",title:"CX- Pulse-360 ",status:"active",description:"Description of the template",departments:5,workflows:8,fields:42,formsFilled:189,updatedOn:"08 Mar 2024"},{id:"fms",title:"ENE - TRACKER",status:"inactive",description:"Description of the template",departments:2,workflows:4,fields:28,formsFilled:56,updatedOn:"01 Feb 2024"},{id:"rms",title:"RTV - Return to Vendor ",status:"active",description:"Description of the template",departments:4,workflows:10,fields:61,formsFilled:312,updatedOn:"20 Mar 2024"}],Ta="Create, manage and track complaint forms, workflows and responses across departments.";function Aa(e=[]){return e.map((t,r)=>({id:t.id??t._id??`system-${r}`,title:t.title??t.name??"Untitled",status:t.status??"inactive",statusLabel:t.statusLabel,description:t.description??t.templateDescription,descriptionHref:t.descriptionHref??t.url,departments:t.departments??t.departmentCount??0,workflows:t.workflows??t.workflowCount??0,fields:t.fields??t.fieldCount??0,formsFilled:t.formsFilled??t.formFilledCount??t.forms_filled??0,updatedOn:t.updatedOn??t.updatedAt??t.updated_on,titleAsLink:!!(t.titleAsLink??t.isLink)}))}function Fa({title:e="Complaint Management",description:t=Ta,systems:r,systemsEndpoint:n,useDemoData:a=!0,createLabel:o="Create New Form",onCreateForm:s,onConfigure:l,onOpen:c,onTitleClick:d,onDescriptionClick:u,onSearch:f}){const h=Ze(),[v,_]=L.useState(""),[S,b]=L.useState(null),[m,y]=L.useState(null),[C,N]=L.useState(n&&!r?"loading":"idle");L.useEffect(()=>{if(!n||r)return;const k=new AbortController;return U.get(n,{signal:k.signal}).then(j=>{const ie=j?.data,Z=Array.isArray(ie)?ie:ie?.data??ie?.systems??ie?.results??[];b(Aa(Z)),y(null),N("success")}).catch(j=>{k.signal.aborted||(y(j?.message||"Failed to load systems"),b([]),N("error"))}),()=>k.abort()},[n,r]);const A=L.useMemo(()=>r?Aa(r):S||(a?Oa:[]),[r,S,a]),F=L.useMemo(()=>{const k=v.trim().toLowerCase();return k?A.filter(j=>`${j.title} ${j.description??""} ${j.status??""}`.toLowerCase().includes(k)):A},[A,v]),$=k=>{const j=k.target.value;_(j),f?.(j)},Q=k=>{l?.(k),h(`/settings/${k.id??"new"}?step=1`)},Oe=()=>{s?.(),h("/settings/new?step=1")},H=C==="loading";return i.jsxs("div",{className:"ca-complaint-management-page","data-testid":"complaint-management-page",children:[i.jsx(pa,{title:e,description:t,actionLabel:o,onAction:Oe}),i.jsx("div",{className:"ca-search-container",children:i.jsx(Na,{value:v,onChange:$,placeholder:"Search"})}),H?i.jsx(La,{text:"Loading systems"}):m?i.jsx("div",{className:"ca-empty",children:i.jsx("p",{className:"ca-body",children:m})}):i.jsx(Sa,{systems:F,onConfigure:Q,onOpen:c,onTitleClick:d,onDescriptionClick:u,emptyMessage:v?"No systems match your search.":"No systems found."})]})}const xa=L.createContext(null),Pa=()=>({categoryName:"",categoryType:"",tatMinutes:"",template:"",visibilityType:"",urlLink:"",active:!1,description:"",roles:[],departmentRows:[{id:"1",department:"",subDepartment:"",roles:""}],priorityDraft:"",priorities:[],defaultPriorityId:null,selectedDeptNode:null,workflow:{name:"",tatMinutes:"",description:"",statuses:[],steps:[]},fieldDraft:{name:"",type:""},formFields:[]});function ka({children:e,initialValues:t}){const[r,n]=L.useState(()=>({...Pa(),...t,workflow:{...Pa().workflow,...t?.workflow}})),a=L.useCallback(l=>{n(c=>({...c,...l}))},[]),o=L.useCallback(l=>{n(c=>({...c,workflow:{...c.workflow,...l}}))},[]),s=L.useMemo(()=>({state:r,setState:n,update:a,updateWorkflow:o}),[r,a,o]);return i.jsx(xa.Provider,{value:s,children:e})}function je(){const e=L.useContext(xa);if(!e)throw new Error("useSettingsWizard must be used within SettingsWizardProvider");return e}const K=[{id:1,key:"category",label:"Category Type",title:"Category Type",description:"Define the type and basic details for this category type."},{id:2,key:"workflow",label:"Workflow",title:"Workflow",description:"L1 > L2 > L3"},{id:3,key:"formFields",label:"Form Fields",title:"Form Fields",description:"----"},{id:4,key:"review",label:"Review & Publish",title:"Review & Publish",description:"Review your configuration and publish."}],Rc=[{id:1,label:"Create Workflow"},{id:2,label:"Statuses"},{id:3,label:"Workflow Steps"}],Kc=["Urgent","High","Medium","Low"],Jc=["Store Staff","HR Executive","HR Manager","Store Manager","Admin"],Da=[{value:"qms",label:"QMS - Query Management System"},{value:"cms",label:"CMS - Complaint Management System"},{value:"fms",label:"FMS - Feedback Management System"},{value:"rms",label:"RMS - Request Management System"}],Zc=[{value:"#EF4444",label:"Red"},{value:"#F59E0B",label:"Orange"},{value:"#EAB308",label:"Yellow"},{value:"#22C55E",label:"Green"},{value:"#3B82F6",label:"Blue"},{value:"#8B5CF6",label:"Purple"}];function Ba({size:e=28,color:t="currentColor",...r}){return i.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",style:{color:"var(--ca-primary)"},...r,children:[i.jsx("path",{d:"M12 3 3 8l9 5 9-5-9-5Z",stroke:t,strokeWidth:"1.6",strokeLinejoin:"round"}),i.jsx("path",{d:"M3 12.5 12 17.5l9-5",stroke:t,strokeWidth:"1.6",strokeLinejoin:"round",strokeLinecap:"round"}),i.jsx("path",{d:"M3 16.5 12 21.5l9-5",stroke:t,strokeWidth:"1.6",strokeLinejoin:"round",strokeLinecap:"round"})]})}function Ia({title:e,description:t,nextLabel:r="Next",onNext:n,showNext:a=!0,nextDisabled:o=!1,nextVariant:s="primary",className:l=""}){return i.jsxs("div",{className:`ca-settings-card__header ${l}`.trim(),children:[i.jsxs("div",{className:"ca-settings-card__heading",children:[i.jsx(Ba,{}),i.jsxs("div",{children:[i.jsx(Bt,{children:e}),t?i.jsx(It,{className:"ca-settings-card__desc",children:t}):null]})]}),a?i.jsx(R,{variant:s,disabled:o,onClick:n,endIcon:i.jsx(Cr,{size:14,color:"currentColor"}),children:r}):null]})}function Ve({title:e,description:t,onNext:r,nextLabel:n,showNext:a=!0,nextDisabled:o,nextVariant:s,children:l,footer:c,className:d=""}){return i.jsxs("section",{className:`ca-settings-card ${d}`.trim(),children:[i.jsx(Ia,{title:e,description:t,onNext:r,nextLabel:n,showNext:a,nextDisabled:o,nextVariant:s}),i.jsx("div",{className:"ca-settings-card__divider"}),i.jsx("div",{className:"ca-settings-card__body",children:l}),c?i.jsx("div",{className:"ca-settings-card__footer",children:c}):null]})}function Mt({children:e,hint:t,htmlFor:r,className:n=""}){return i.jsxs("div",{className:`ca-field-label ${n}`.trim(),children:[i.jsx("label",{className:"ca-label",htmlFor:r,children:e}),t!=null?i.jsx("span",{className:"ca-field-label__hint",children:t}):null]})}function Ma({size:e=16,color:t="currentColor",...r}){return i.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",...r,children:i.jsx("path",{d:"M6 9l6 6 6-6",stroke:t,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function J({value:e,onChange:t,options:r=[],placeholder:n="Select",className:a="",disabled:o=!1,...s}){return i.jsxs("div",{className:`ca-select ${a}`.trim(),children:[i.jsxs("select",{className:"ca-select__control",value:e??"",onChange:t,disabled:o,...s,children:[i.jsx("option",{value:"",disabled:!0,children:n}),r.map(l=>{const c=typeof l=="string"?l:l.value,d=typeof l=="string"?l:l.label;return i.jsx("option",{value:c,children:d},c)})]}),i.jsx("span",{className:"ca-select__chevron",children:i.jsx(Ma,{size:16})})]})}function Ua({value:e,onChange:t,placeholder:r,maxLength:n,rows:a=4,className:o="",...s}){return i.jsx("textarea",{className:`ca-textarea ${o}`.trim(),value:e,onChange:t,placeholder:r,maxLength:n,rows:a,...s})}function re({label:e,hint:t,children:r,className:n="",htmlFor:a}){return i.jsxs("div",{className:`ca-form-field ${n}`.trim(),children:[e!=null?i.jsx(Mt,{htmlFor:a,hint:t,children:e}):null,r]})}function _r({label:e,hint:t,...r}){return i.jsx(re,{label:e,hint:t,htmlFor:r.id,children:i.jsx(te,{...r})})}function Gc({label:e,hint:t,suffix:r,...n}){return i.jsx(re,{label:e,hint:t,htmlFor:n.id,children:i.jsxs("div",{className:"input-with-suffix",children:[i.jsx(te,{...n}),r&&i.jsx("div",{className:"input-suffix",children:r})]})})}function Sr({label:e,hint:t,...r}){return i.jsx(re,{label:e,hint:t,htmlFor:r.id,children:i.jsx(J,{...r})})}function $a({label:e,hint:t,maxLength:r,value:n="",...a}){const o=t??(r!=null?`${String(n).length}/${r}`:void 0);return i.jsx(re,{label:e,hint:o,htmlFor:a.id,children:i.jsx(Ua,{value:n,maxLength:r,...a})})}function Er({checked:e=!1,onChange:t,disabled:r=!1,"aria-label":n="Toggle",className:a=""}){return i.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":n,disabled:r,className:`ca-toggle ${e?"ca-toggle--on":""} ${a}`.trim(),onClick:()=>t?.(!e),children:i.jsx("span",{className:"ca-toggle__thumb"})})}function ja({label:e="Active",checked:t,onChange:r,className:n=""}){return i.jsxs("div",{className:`ca-toggle-field ${n}`.trim(),children:[i.jsx(ua,{children:e}),i.jsx(Er,{checked:t,onChange:r,"aria-label":e})]})}function Va({size:e=12,color:t="currentColor",...r}){return i.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",...r,children:i.jsx("path",{d:"M6 6l12 12M18 6L6 18",stroke:t,strokeWidth:"2",strokeLinecap:"round"})})}function Ha({label:e,onRemove:t,className:r=""}){return i.jsxs("span",{className:`ca-tag ${r}`.trim(),children:[e,t?i.jsx("button",{type:"button",className:"ca-tag__remove",onClick:t,"aria-label":`Remove ${e}`,children:i.jsx(Va,{size:10})}):null]})}function Wa({label:e="Select Roles",options:t=[],value:r=[],onChange:n,placeholder:a="Select roles",className:o=""}){const[s,l]=L.useState(""),c=t.filter(f=>{const h=typeof f=="string"?f:f.value;return!r.includes(h)}),d=f=>{const h=f.target.value;h&&(n?.([...r,h]),l(""))},u=f=>{n?.(r.filter(h=>h!==f))};return i.jsxs("div",{className:`ca-role-select ${o}`.trim(),children:[i.jsx(Mt,{children:e}),i.jsx(J,{value:s,onChange:d,options:c,placeholder:a}),r.length>0?i.jsx("div",{className:"ca-tag-list",children:r.map(f=>i.jsx(Ha,{label:f,onRemove:()=>u(f)},f))}):null]})}function He({steps:e=[],currentStep:t=1,onStepClick:r,className:n="",size:a="md",showSaveButton:o=!1,showNextButton:s=!1,onSaveDraft:l,onNext:c,saveLabel:d="Save Draft",nextLabel:u="Next >"}){return i.jsxs("div",{className:`ca-stepper-wrap ca-stepper-wrap--${a} ${n}`.trim(),children:[i.jsx("nav",{className:`ca-stepper ca-stepper--${a}`,"aria-label":"Progress",children:e.map((f,h)=>{const v=f.id??h+1,_=v===t,S=v<t,b=!!r&&(S||_);return i.jsxs(L.Fragment,{children:[h>0?i.jsx("div",{className:"ca-stepper__line"}):null,i.jsxs("button",{type:"button",className:["ca-stepper__item",_?"ca-stepper__item--active":"",S?"ca-stepper__item--done":""].filter(Boolean).join(" "),onClick:()=>b&&r?.(v),disabled:!b,"aria-current":_?"step":void 0,children:[i.jsxs("span",{className:"ca-stepper__circle",children:[v,"."]}),i.jsx("span",{className:"ca-stepper__label",children:f.label})]})]},v)})}),o||s?i.jsxs("div",{className:"ca-stepper__actions",children:[o?i.jsx(R,{variant:"outline",onClick:l,children:d}):null,s?i.jsx(R,{onClick:c,children:u}):null]}):null]})}function Xc({stepMeta:e,stepperProps:t}){const{state:r,update:n}=je();return i.jsxs(i.Fragment,{children:[i.jsx(He,{...t,steps:K}),i.jsxs(Ve,{title:e.title,description:e.description,showNext:!1,children:[i.jsx("div",{className:"ca-category-type__status",children:i.jsx(ja,{checked:r.active,onChange:a=>n({active:a})})}),i.jsxs("div",{className:"ca-step-section",children:[i.jsxs("div",{className:"ca-step-row ca-step-row--category-fields",children:[i.jsx(_r,{label:"Category Name",className:"ca-step-row__grow",value:r.categoryName,onChange:a=>n({categoryName:a.target.value}),placeholder:"Enter category name"}),i.jsx(Gc,{label:"TAT Minutes",suffix:"minutes",type:"number",min:"0",value:r.tatMinutes,onChange:a=>n({tatMinutes:a.target.value}),placeholder:"Enter here"})]}),i.jsx("div",{className:"ca-step-row",children:i.jsx(Sr,{label:"Select Template",className:"ca-step-row__grow",value:r.template||r.categoryType,onChange:a=>n({template:a.target.value,categoryType:a.target.value}),options:Da,placeholder:"Select template"})}),i.jsx("div",{className:"ca-step-section",children:i.jsx($a,{label:"Description",placeholder:"Enter description",maxLength:500,value:r.description,onChange:a=>n({description:a.target.value}),rows:5})}),i.jsxs("div",{className:"ca-step-row",children:[i.jsx(Sr,{label:"Select Visibility Type",className:"ca-step-row__grow",value:r.visibilityType,onChange:a=>n({visibilityType:a.target.value}),options:[{value:"public",label:"Public"},{value:"private",label:"Private"},{value:"restricted",label:"Restricted"}],placeholder:"Select visibility type"}),i.jsx(_r,{label:null,className:"ca-step-row__grow ca-category-type__url-link",value:r.urlLink,onChange:a=>n({urlLink:a.target.value}),placeholder:"urllink"})]})]}),i.jsx("div",{className:"ca-step-section ca-step-section--last",children:i.jsx(Wa,{label:"Select Roles for Complaint Filling",options:Jc,value:r.roles,onChange:a=>n({roles:a})})})]})]})}function qa({children:e,onClick:t,className:r="",active:n=!1}){return i.jsx("button",{type:"button",className:`ca-chip ${n?"ca-chip--active":""} ${r}`.trim(),onClick:t,children:e})}function za({checked:e=!1,onChange:t,name:r,value:n,"aria-label":a,className:o=""}){return i.jsxs("label",{className:`ca-radio ${o}`.trim(),children:[i.jsx("input",{type:"radio",className:"ca-radio__input",name:r,value:n,checked:e,onChange:t,"aria-label":a}),i.jsx("span",{className:"ca-radio__mark"})]})}function Nr({size:e=16,color:t="#9CA3AF",...r}){return i.jsxs("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...r,children:[i.jsx("circle",{cx:"5",cy:"4",r:"1.2",fill:t}),i.jsx("circle",{cx:"11",cy:"4",r:"1.2",fill:t}),i.jsx("circle",{cx:"5",cy:"8",r:"1.2",fill:t}),i.jsx("circle",{cx:"11",cy:"8",r:"1.2",fill:t}),i.jsx("circle",{cx:"5",cy:"12",r:"1.2",fill:t}),i.jsx("circle",{cx:"11",cy:"12",r:"1.2",fill:t})]})}function Ra(e){return{id:`${Date.now()}-${Math.random().toString(36).slice(2,7)}`,name:e,color:""}}function Qc({stepMeta:e,stepperProps:t}){const{state:r,update:n}=je(),{priorityDraft:a,priorities:o,defaultPriorityId:s}=r,l=u=>{const f=(u??a).trim();if(!f)return;if(o.some(v=>v.name.toLowerCase()===f.toLowerCase())){n({priorityDraft:""});return}const h=[...o,Ra(f)];n({priorities:h,priorityDraft:"",defaultPriorityId:s??h[0].id})},c=(u,f)=>{n({priorities:o.map(h=>h.id===u?{...h,...f}:h)})},d=Zc.map(u=>({value:u.value,label:u.label}));return i.jsxs(i.Fragment,{children:[i.jsx(He,{...t,steps:K}),i.jsxs(Ve,{title:e.title,description:e.description,showNext:!1,children:[i.jsxs("div",{className:"ca-priority-add",children:[i.jsx(Mt,{children:"Priorities"}),i.jsxs("div",{className:"ca-priority-add__row",children:[i.jsx(te,{value:a,onChange:u=>n({priorityDraft:u.target.value}),placeholder:"Add priority",onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),l())}}),i.jsx(R,{variant:"outline",onClick:()=>l(),children:"+ Add"})]}),i.jsx("div",{className:"ca-chip-row",children:Kc.map(u=>i.jsxs(qa,{onClick:()=>l(u),children:["+ ",u]},u))})]}),i.jsxs("div",{className:"ca-priority-table",children:[i.jsxs("div",{className:"ca-priority-table__head",children:[i.jsx("div",{children:"Priority"}),i.jsx("div",{children:"Color"}),i.jsx("div",{children:"Default"})]}),(o.length?o:[Ra("")]).map((u,f)=>{const h=!o.length;return i.jsxs("div",{className:"ca-priority-table__row",children:[i.jsxs("div",{className:"ca-priority-table__name",children:[i.jsx(Nr,{}),i.jsx(te,{value:h?a:u.name,onChange:v=>{h?n({priorityDraft:v.target.value}):c(u.id,{name:v.target.value})},placeholder:"Add priority"})]}),i.jsx(J,{value:u.color,onChange:v=>{h||c(u.id,{color:v.target.value})},options:d,placeholder:"Select color"}),i.jsx(za,{name:"default-priority",value:u.id,checked:!h&&s===u.id,onChange:()=>!h&&n({defaultPriorityId:u.id}),"aria-label":"Default priority"})]},u.id||f)})]})]})]})}function Ka({level:e,onAdd:t}){const[r,n]=L.useState(""),a=o=>{o.preventDefault();const s=r.trim();s&&(t?.(s),n(""))};return i.jsxs("form",{className:"ca-add-table-card",onSubmit:a,children:[i.jsxs("span",{className:"ca-add-table-card__level",children:["L",e]}),i.jsxs("label",{className:"ca-add-table-card__label",htmlFor:`add-workflow-level-${e}`,children:["Name Level ",e]}),i.jsx(te,{id:`add-workflow-level-${e}`,value:r,placeholder:`Enter name for L${e}`,onChange:o=>n(o.target.value)}),i.jsxs(R,{type:"submit",className:"ca-add-table-card__button",disabled:!r.trim(),children:["+ Add L",e]})]})}const Yc=["Store Staff","Manager","Supervisor","Admin"],Lr=["Yes","No"];function Ja({name:e,level:t,value:r,onChange:n}){const a=r??{},o=(c,d)=>n?.({...a,[c]:d}),s=t===1?"green":t===2?"orange":"blue",l=c=>`workflow-level-${t}-${c}`;return i.jsxs("article",{className:`ca-table-card ca-table-card--${s}`,children:[i.jsxs("header",{className:"ca-table-card__header",children:[i.jsxs("span",{className:"ca-table-card__level",children:["L",t]}),i.jsxs("div",{children:[i.jsx("h3",{className:"ca-table-card__title",children:e}),i.jsx("p",{className:"ca-table-card__subtitle",children:"Initial Handler"})]})]}),i.jsx("div",{className:"ca-table-card__divider"}),i.jsxs("div",{className:"ca-table-card__fields",children:[i.jsx(re,{label:"Select Role",htmlFor:l("role"),children:i.jsx(J,{id:l("role"),value:a.role,options:Yc,placeholder:"Select role",onChange:c=>o("role",c.target.value)})}),i.jsx(re,{label:"Can Resolve",htmlFor:l("canResolve"),children:i.jsx(J,{id:l("canResolve"),value:a.canResolve,options:Lr,onChange:c=>o("canResolve",c.target.value)})}),i.jsx(re,{label:"Can Reassign",htmlFor:l("canReassign"),children:i.jsx(J,{id:l("canReassign"),value:a.canReassign,options:Lr,onChange:c=>o("canReassign",c.target.value)})}),i.jsx(re,{label:"Final Level",htmlFor:l("finalLevel"),children:i.jsx(J,{id:l("finalLevel"),value:a.finalLevel,options:Lr,onChange:c=>o("finalLevel",c.target.value)})}),i.jsx(re,{label:"Escalation time",htmlFor:l("escalationTime"),children:i.jsxs("div",{className:"ca-table-card__time-input",children:[i.jsx(te,{id:l("escalationTime"),type:"number",min:"0",value:a.escalationTime??"",placeholder:"--",onChange:c=>o("escalationTime",c.target.value)}),i.jsx("span",{children:"minutes"})]})})]})]})}const ed="data:image/svg+xml,%3csvg%20width='31'%20height='57'%20viewBox='0%200%2031%2057'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M0.50001%200.000227733C0.223869%200.000226605%209.85899e-06%200.224084%208.79418e-06%200.500226C7.72665e-06%200.776369%200.223865%201.00023%200.500009%201.00023L0.50001%200.500227L0.50001%200.000227733ZM15%200.500275L15%201.00028L15%200.500275ZM27%2012.5003L27.5%2012.5003L27%2012.5003ZM26.6464%2056.8527C26.8417%2057.048%2027.1582%2057.048%2027.3535%2056.8527L30.5355%2053.6707C30.7307%2053.4755%2030.7307%2053.1589%2030.5355%2052.9636C30.3402%2052.7683%2030.0236%2052.7683%2029.8284%2052.9636L26.9999%2055.792L24.1715%2052.9636C23.9763%2052.7683%2023.6597%2052.7683%2023.4644%2052.9636C23.2692%2053.1589%2023.2692%2053.4754%2023.4644%2053.6707L26.6464%2056.8527ZM0.50001%200.500227L0.500009%201.00023L15%201.00028L15%200.500275L15%200.000275583L0.50001%200.000227733L0.50001%200.500227ZM27%2012.5003L26.5%2012.5003L26.4999%2056.4991L26.9999%2056.4991L27.4999%2056.4991L27.5%2012.5003L27%2012.5003ZM15%200.500275L15%201.00028C21.3513%201.0003%2026.5%206.14903%2026.5%2012.5003L27%2012.5003L27.5%2012.5003C27.5%205.59674%2021.9036%200.000298399%2015%200.000275583L15%200.500275Z'%20fill='%2300BF87'/%3e%3c/svg%3e",td="data:image/svg+xml,%3csvg%20width='28'%20height='61'%20viewBox='0%200%2028%2061'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M27.0053%2057.2042C27.2006%2057.009%2027.2006%2056.6924%2027.0053%2056.4971L23.8233%2053.3152C23.6281%2053.1199%2023.3115%2053.1199%2023.1162%2053.3152C22.921%2053.5104%2022.921%2053.827%2023.1162%2054.0223L25.9447%2056.8507L23.1163%2059.6791C22.921%2059.8744%2022.921%2060.191%2023.1163%2060.3862C23.3115%2060.5815%2023.6281%2060.5815%2023.8234%2060.3862L27.0053%2057.2042ZM12.5001%2056.8508L12.5001%2057.3508V57.3508L12.5001%2056.8508ZM0.500014%2044.8508L1.33317e-05%2044.8508V44.8508L0.500014%2044.8508ZM26.6518%2056.8507L26.6518%2056.3507L12.5001%2056.3508L12.5001%2056.8508L12.5001%2057.3508L26.6518%2057.3507L26.6518%2056.8507ZM0.500014%2044.8508L1.00001%2044.8508L1.00001%20-0.000388027L0.50001%20-0.000388722L9.54624e-06%20-0.000389416L1.33317e-05%2044.8508L0.500014%2044.8508ZM12.5001%2056.8508L12.5001%2056.3508C6.14877%2056.3508%201.00001%2051.2021%201.00001%2044.8508L0.500014%2044.8508L1.33317e-05%2044.8508C1.43871e-05%2051.7544%205.59649%2057.3508%2012.5001%2057.3508L12.5001%2056.8508Z'%20fill='%23FF9E32'/%3e%3c/svg%3e",rd="data:image/svg+xml,%3csvg%20width='57'%20height='31'%20viewBox='0%200%2057%2031'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M56.9989%200.500133C56.9989%200.223991%2056.7751%200.000131942%2056.4989%200.00013087C56.2228%200.000129795%2055.9989%200.223987%2055.9989%200.500131L56.4989%200.500132L56.9989%200.500133ZM56.4989%2015.0002L55.9989%2015.0002L56.4989%2015.0002ZM44.4989%2027.0001L44.4988%2027.5001L44.4989%2027.0001ZM0.146456%2026.6465C-0.0488074%2026.8418%20-0.0488086%2027.1584%200.146455%2027.3536L3.32843%2030.5356C3.52369%2030.7309%203.84027%2030.7309%204.03554%2030.5356C4.2308%2030.3403%204.2308%2030.0238%204.03554%2029.8285L1.20712%2027.0001L4.03555%2024.1716C4.23081%2023.9764%204.23081%2023.6598%204.03555%2023.4645C3.84029%2023.2693%203.5237%2023.2693%203.32844%2023.4645L0.146456%2026.6465ZM56.4989%200.500132L55.9989%200.500131L55.9989%2015.0002L56.4989%2015.0002L56.9989%2015.0002L56.9989%200.500133L56.4989%200.500132ZM44.4989%2027.0001L44.4989%2026.5001L0.500009%2026.5001L0.500008%2027.0001L0.500007%2027.5001L44.4988%2027.5001L44.4989%2027.0001ZM56.4989%2015.0002L55.9989%2015.0002C55.9988%2021.3514%2050.8501%2026.5001%2044.4989%2026.5001L44.4989%2027.0001L44.4988%2027.5001C51.4024%2027.5001%2056.9988%2021.9037%2056.9989%2015.0002L56.4989%2015.0002Z'%20fill='%2300BF87'/%3e%3c/svg%3e",nd="data:image/svg+xml,%3csvg%20width='61'%20height='28'%20viewBox='0%200%2061%2028'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M3.32848%2027.0049C3.52374%2027.2002%203.84032%2027.2002%204.03559%2027.0049L7.21755%2023.8229C7.41281%2023.6277%207.4128%2023.3111%207.21754%2023.1158C7.02228%2022.9206%206.70569%2022.9206%206.51043%2023.1158L3.68203%2025.9443L0.85358%2023.1159C0.658316%2022.9206%200.341733%2022.9206%200.146472%2023.1159C-0.0487878%2023.3111%20-0.0487864%2023.6277%200.146478%2023.823L3.32848%2027.0049ZM3.68194%2012.4997L3.18194%2012.4997V12.4997L3.68194%2012.4997ZM15.6819%200.499617L15.6819%20-0.000382774V-0.000382774L15.6819%200.499617ZM3.68203%2026.6514L4.18203%2026.6514L4.18194%2012.4997L3.68194%2012.4997L3.18194%2012.4997L3.18203%2026.6514L3.68203%2026.6514ZM15.6819%200.499617L15.6819%200.999618L60.5331%200.999616L60.5331%200.499615L60.5331%20-0.000385315L15.6819%20-0.000382774L15.6819%200.499617ZM3.68194%2012.4997L4.18194%2012.4997C4.1819%206.14838%209.33063%200.999618%2015.6819%200.999618L15.6819%200.499617L15.6819%20-0.000382774C8.77834%20-0.00038191%203.18189%205.5961%203.18194%2012.4997L3.68194%2012.4997Z'%20fill='%23FF9E32'/%3e%3c/svg%3e",Or=(e,t)=>({id:e,name:t,role:"",canResolve:"",canReassign:"",finalLevel:"",escalationTime:""});function ad({accent:e}){return i.jsxs("div",{className:`ca-escalation-connector ca-escalation-connector--desktop ca-escalation-connector--${e}`,"aria-hidden":"true",children:[i.jsx("img",{src:ed,alt:"",className:"ca-escalation-connector__arrow ca-escalation-connector__arrow--first"}),i.jsx("span",{children:"Escalates to"}),i.jsx("img",{src:td,alt:"",className:"ca-escalation-connector__arrow ca-escalation-connector__arrow--second"})]})}function od({accent:e}){return i.jsxs("div",{className:`ca-escalation-connector ca-escalation-connector--mobile ca-escalation-connector--${e}`,"aria-hidden":"true",children:[i.jsx("img",{src:rd,alt:"",className:"ca-escalation-connector__arrow ca-escalation-connector__arrow--first"}),i.jsx("span",{children:"Escalates to"}),i.jsx("img",{src:nd,alt:"",className:"ca-escalation-connector__arrow ca-escalation-connector__arrow--second"})]})}function Za({initialTables:e,onChange:t}){const[r,n]=L.useState(()=>e?.length?e:[Or(1,"Level 1 - First Response"),Or(2,"Level 2 - Secondary")]),a=l=>{n(l),t?.(l)},o=(l,c)=>a(r.map(d=>d.id===l?{...d,...c}:d)),s=l=>{const c=r.reduce((d,u)=>Math.max(d,Number(u.id)||0),0)+1;a([...r,Or(c,l)])};return i.jsx("div",{className:"ca-table-card-grid","aria-label":"Escalation levels",children:i.jsxs("div",{className:"ca-table-card-grid__track",children:[r.map((l,c)=>i.jsxs(L.Fragment,{children:[i.jsx(Ja,{name:l.name,level:c+1,value:l,onChange:d=>o(l.id,d)}),c<r.length-0?i.jsxs(i.Fragment,{children:[i.jsx(ad,{accent:c===0?"green":c===1?"orange":"purple"}),i.jsx(od,{accent:c===0?"green":c===1?"orange":"purple"})]}):null]},l.id)),i.jsx(Ka,{level:r.length+1,onAdd:s})]})})}function Ga({onNext:e,stepMeta:t,stepperProps:r}){const{state:n,update:a,updateWorkflow:o}=je(),{selectedDeptNode:s,workflow:l}=n;return i.jsxs(i.Fragment,{children:[i.jsx(He,{...r,steps:K}),i.jsx(Ve,{title:t.title,description:t.description,showNext:!1,children:i.jsx("div",{className:"ca-workflow__main",children:i.jsx(Za,{initialTables:l.steps,onChange:c=>o({steps:c})})})})]})}function Xa({onAdd:e}){return i.jsx("button",{type:"button",className:"ca-add-form-button",onClick:e,children:"+ Add Form Fields"})}function Qa({size:e=16,color:t="#9CA3AF",...r}){return i.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",...r,children:i.jsx("path",{d:"M4 7h16M9 7V5a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2m2 0v12a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2V7h12Z",stroke:t,strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}const sd=["Custom","Text","Number","Date","Dropdown","Checkbox","Radio"],Tr=["All","Admin","Manager","Staff"],id=["Level 1","Level 2","Level 3"];function Ya({field:e,fieldOptions:t=[],onChange:r,onDelete:n}){const[a,o]=L.useState(""),s=d=>r?.({...e,...d}),l=()=>{const d=a.trim();!d||e.options?.includes(d)||(s({options:[...e.options||[],d]}),o(""))},c=d=>s({options:e.options.filter(u=>u!==d)});return i.jsxs("article",{className:"ca-form-card",children:[i.jsxs("div",{className:"ca-form-card__row ca-form-card__row--order",children:[i.jsx(Nr,{size:15,color:"#111827"}),i.jsx("button",{type:"button",className:"ca-icon-btn ca-form-card__delete","aria-label":"Delete form field",onClick:()=>n?.(e.id),children:i.jsx(Qa,{size:15})})]}),i.jsx("div",{className:"ca-form-card__row",children:i.jsx(te,{value:e.fieldLabel,placeholder:"Enter field label",onChange:d=>s({fieldLabel:d.target.value})})}),i.jsx("div",{className:"ca-form-card__row",children:i.jsx(J,{value:e.fieldType,options:sd,placeholder:"Select type",onChange:d=>s({fieldType:d.target.value})})}),i.jsx("div",{className:"ca-form-card__row ca-form-card__row--toggle",children:i.jsx(Er,{checked:!!e.required,onChange:d=>s({required:d}),"aria-label":"Required"})}),i.jsx("div",{className:"ca-form-card__row",children:i.jsx(J,{value:e.fieldAccess,options:e.fieldAccess&&!Tr.includes(e.fieldAccess)?[e.fieldAccess,...Tr]:Tr,placeholder:"Select access",onChange:d=>s({fieldAccess:d.target.value})})}),i.jsxs("div",{className:"ca-form-card__row",children:[i.jsx(J,{value:"",options:id.filter(d=>!e.hideFor?.includes(d)),placeholder:"Select level",onChange:d=>s({hideFor:[...e.hideFor||[],d.target.value]})}),e.hideFor?.length?i.jsx("div",{className:"ca-form-card__chips",children:e.hideFor.map(d=>i.jsxs("span",{className:"ca-form-card__chip",children:[d,i.jsx("button",{type:"button","aria-label":`Remove ${d}`,onClick:()=>s({hideFor:e.hideFor.filter(u=>u!==d)}),children:"×"})]},d))}):null]}),i.jsx("div",{className:"ca-form-card__row",children:i.jsx(J,{value:e.dependsOn,options:t,placeholder:"Select field label",onChange:d=>s({dependsOn:d.target.value})})}),i.jsxs("div",{className:"ca-form-card__row ca-form-card__row--options",children:[i.jsxs("div",{className:"ca-form-card__option-entry",children:[i.jsx(te,{value:a,placeholder:"Enter option",onChange:d=>o(d.target.value),onKeyDown:d=>{d.key==="Enter"&&(d.preventDefault(),l())}}),i.jsx("button",{type:"button",className:"ca-form-card__add-option","aria-label":"Add option",onClick:l,children:"+"})]}),i.jsx("div",{className:"ca-form-card__chips",children:(e.options||[]).map(d=>i.jsxs("span",{className:"ca-form-card__chip",children:[d,i.jsx("button",{type:"button","aria-label":`Remove ${d}`,onClick:()=>c(d),children:"×"})]},d))})]})]})}function ld({formFields:e=[],onChange:t}){const r=e.find(u=>u.fieldLabel==="Sub-department"),n=e.find(u=>u.fieldLabel==="Department"),a=r?.options||["payrool ","recruitment"],o=n?.options||["hr","finance"],[s,l]=L.useState({});L.useEffect(()=>{const u=new Set(a);l(f=>Object.fromEntries(Object.entries(f).filter(([h])=>u.has(h))))},[a]);const c=(u,f)=>{l(h=>({...h,[u]:f}))},d=u=>{if(!r)return;const f=e.map(h=>h!==r?h:{...h,options:h.options.filter(v=>v!==u)});l(h=>{const v={...h};return delete v[u],v}),t?.(f)};return i.jsxs("aside",{className:"subdepartment-parent","aria-labelledby":"subdepartment-parent-title",children:[i.jsxs("h2",{id:"subdepartment-parent-title",className:"subdepartment-parent__title",children:["Options for: ",r?.fieldLabel||"Sub-department"]}),i.jsx("p",{className:"subdepartment-parent__description",children:"Define options and set parent."}),a.length?i.jsx("div",{className:"subdepartment-parent__table-wrap",children:i.jsxs("table",{className:"subdepartment-parent__table",children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{scope:"col",children:"Option label"}),i.jsx("th",{scope:"col",children:"Parent"}),i.jsx("th",{scope:"col","aria-label":"Delete"})]})}),i.jsx("tbody",{children:a.map(u=>i.jsxs("tr",{children:[i.jsx("td",{children:u}),i.jsx("td",{children:i.jsxs("select",{"aria-label":`Parent for ${u}`,value:s[u]||"",disabled:!o.length,onChange:f=>c(u,f.target.value),children:[i.jsx("option",{value:"",children:o.length?"Select parent":"No department options"}),o.map(f=>i.jsx("option",{value:f,children:f},f))]})}),i.jsx("td",{children:i.jsx("button",{className:"subdepartment-parent__delete",type:"button","aria-label":`Delete ${u}`,title:`Delete ${u}`,onClick:()=>d(u),children:i.jsx(jc,{size:14,strokeWidth:1.5,"aria-hidden":"true"})})})]},u))})]})}):i.jsx("p",{className:"subdepartment-parent__empty",children:"No sub-department options added."})]})}const cd=["Order","Field Label","Field Type","Required","Field Access","Hide for","DependsOn","Options"],dd=[{id:1,order:1,fieldLabel:"Department",fieldType:"Custom",required:!1,fieldAccess:"",hideFor:["Level 1","Level 2"],dependsOn:"",options:["Low","High"]},{id:2,order:2,fieldLabel:"Sub-department",fieldType:"Custom",required:!1,fieldAccess:"",hideFor:[],dependsOn:"Department",options:["Payroll","Recruitment"]}];function Ar(e,t){return{id:e.id??`${Date.now()}-${t}`,order:t+1,fieldLabel:e.fieldLabel??e.name??"",fieldType:e.fieldType??e.typeLabel??"Custom",required:!!e.required,fieldAccess:e.fieldAccess??"",hideFor:e.hideFor??[],dependsOn:e.dependsOn??"",options:e.options??[]}}function eo({initialFields:e,onChange:t,fieldToAdd:r}){const[n,a]=L.useState(()=>(e?.length?e:dd).map(Ar)),o=u=>{a(u),t?.(u)};L.useEffect(()=>{r&&a(u=>{const f=[...u,Ar({...r,id:`${r.id}-${Date.now()}`},u.length)];return t?.(f),f})},[r,t]);const s=u=>o(n.map(f=>f.id===u.id?u:f)),l=u=>o(n.filter(f=>f.id!==u).map((f,h)=>({...f,order:h+1}))),c=()=>o([...n,Ar({id:`${Date.now()}-${n.length}`,fieldLabel:"",fieldType:"Custom",options:[]},n.length)]),d=n.map(u=>u.fieldLabel).filter(Boolean);return i.jsxs("div",{className:"ca-form-card-grid__container ",children:[i.jsxs("div",{className:"ca-form-card-grid",children:[i.jsx("div",{className:"ca-form-card-grid__labels",children:cd.map(u=>i.jsx("div",{className:"ca-form-card-grid__label",children:u},u))}),i.jsxs("div",{className:"ca-form-card-grid__cards",children:[n.map(u=>i.jsx(Ya,{field:u,fieldOptions:d.filter(f=>f!==u.fieldLabel),onChange:s,onDelete:l},u.id)),i.jsx(Xa,{onAdd:c})]})]}),i.jsx(ld,{formFields:n})]})}const ud=[{id:"department",label:"Department",fieldLabel:"Department - Finance",fieldType:"Custom",required:!1,fieldAccess:"Select access",hideFor:[],dependsOn:"",options:["Payroll","Recruitment","Hardware"]},{id:"priorities",label:"Priorities",fieldLabel:"Priorities",fieldType:"Custom",required:!1,fieldAccess:"Select access",hideFor:[],dependsOn:"",options:["Low","Medium","High"]},{id:"statuses",label:"Statuses",fieldLabel:"Statuses",fieldType:"Custom",required:!1,fieldAccess:"Select access",hideFor:[],dependsOn:"",options:["Open","In Progress","Closed"]},{id:"storeId",label:"Store ID",fieldLabel:"Store ID",fieldType:"Custom",required:!1,fieldAccess:"Select access",hideFor:[],dependsOn:"",options:["Store 101","Store 102","Store 103"]}],fd={department:kc,priorities:Mc,statuses:Dc,storeId:$c};function pd({onAddField:e}){return i.jsxs("aside",{className:"custom-field-table","aria-labelledby":"custom-field-table-title",children:[i.jsx("h2",{id:"custom-field-table-title",className:"custom-field-table__title",children:"Custom Fields"}),i.jsx("p",{className:"custom-field-table__description",children:"Use these fields to show options from database table."}),i.jsx("div",{className:"custom-field-table__list",children:ud.map(t=>{const r=fd[t.id];return i.jsxs("div",{className:"custom-field-table__row",children:[i.jsx(r,{className:"custom-field-table__field-icon",size:14,strokeWidth:1.5,"aria-hidden":"true"}),i.jsx("span",{className:"custom-field-table__label",children:t.label}),i.jsx("button",{className:"custom-field-table__add",type:"button","aria-label":`Add ${t.label}`,title:`Add ${t.label}`,onClick:()=>e?.(t),children:i.jsx(ya,{size:14,strokeWidth:2,"aria-hidden":"true"})})]},t.id)})})]})}function hd({stepMeta:e,stepperProps:t}){const{state:r,update:n}=je(),{formFields:a}=r,[o,s]=L.useState(null),l=L.useCallback(c=>n({formFields:c}),[n]);return i.jsxs(i.Fragment,{children:[i.jsx(He,{...t,steps:K}),i.jsx(Ve,{title:e.title,description:e.description,showNext:!1,children:i.jsxs("div",{className:"ca-form-fields",children:[i.jsx(pd,{onAddField:c=>s({...c})}),i.jsx(eo,{initialFields:a,fieldToAdd:o,onChange:l})]})})]})}const md=[{order:4,fieldLabel:"Email",fieldType:"string",required:!1,fieldAccess:"editable",hideFor:[],dependsOn:"",options:[]},{order:1,fieldLabel:"Name",fieldType:"string",required:!0,fieldAccess:"editable",hideFor:[],dependsOn:"",options:[]},{order:6,fieldLabel:"Checkbox Selector",fieldType:"checkbox",required:!1,fieldAccess:"editable",hideFor:[],dependsOn:"",options:["Checkbox1","Checkbox2","Checkbox3"]},{order:2,fieldLabel:"Date of Birth",fieldType:"date",required:!0,fieldAccess:"editable",hideFor:[],dependsOn:"",options:[]},{order:7,fieldLabel:"Enter Complaint",fieldType:"string",required:!0,fieldAccess:"editable",hideFor:[],dependsOn:"",options:[]},{order:3,fieldLabel:"Gender",fieldType:"radio",required:!1,fieldAccess:"editable",hideFor:[],dependsOn:"",options:["Male","Female","Other"]},{order:5,fieldLabel:"Select Complaint Type",fieldType:"select",required:!1,fieldAccess:"editable",hideFor:[],dependsOn:"",options:["Complaint","Feedback","Suggestion"]}];function Fr(e){return`review-${e.order}-${e.fieldLabel.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,"")}`}function to(e){return e.fieldLabel.toLowerCase().includes("complaint")}function gd(){const[e,t]=L.useState({}),r=[...md].sort((o,s)=>o.order-s.order),n=(o,s)=>{t(l=>({...l,[o.fieldLabel]:s}))},a=o=>{const s=Fr(o),l=e[o.fieldLabel]||"",c={id:s,name:o.fieldLabel,required:o.required,disabled:o.fieldAccess==="read-only"};switch(o.fieldType){case"date":return i.jsx("input",{...c,className:"review-control",type:"date",value:l,onChange:d=>n(o,d.target.value)});case"select":case"dropdown":return i.jsxs("select",{...c,className:"review-control",value:l,onChange:d=>n(o,d.target.value),children:[i.jsxs("option",{value:"",children:["Select ",o.fieldLabel.toLowerCase()]}),o.options.map(d=>i.jsx("option",{value:d,children:d},d))]});case"radio":return i.jsx("div",{className:"review-options review-options--inline",children:o.options.map((d,u)=>{const f=u===0?s:`${s}-${d.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;return i.jsxs("label",{className:"review-option",htmlFor:f,children:[i.jsx("input",{...c,id:f,type:"radio",value:d,checked:l===d,onChange:h=>n(o,h.target.value)}),i.jsx("span",{children:d})]},d)})});case"checkbox":return i.jsx("div",{className:"review-options review-options--inline",children:o.options.map((d,u)=>{const f=u===0?s:`${s}-${d.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`,h=e[o.fieldLabel]||[];return i.jsxs("label",{className:"review-option",htmlFor:f,children:[i.jsx("input",{...c,id:f,name:`${o.fieldLabel}[]`,type:"checkbox",value:d,checked:h.includes(d),onChange:v=>{const _=v.target.checked?[...h,d]:h.filter(S=>S!==d);n(o,_)}}),i.jsx("span",{children:d})]},d)})});default:return to(o)?i.jsx("textarea",{...c,className:"review-control review-control--textarea",value:l,placeholder:"Enter your complaint here...",onChange:d=>n(o,d.target.value)}):i.jsx("input",{...c,className:"review-control",type:"text",value:l,placeholder:`Enter ${o.fieldLabel.toLowerCase()}`,onChange:d=>n(o,d.target.value)})}};return i.jsx("div",{className:"review-form","aria-label":"Complaint review form",children:i.jsx("div",{className:"review-form-grid",children:r.map(o=>i.jsxs("div",{className:`review-question${to(o)?" review-question--wide":""}`,children:[i.jsxs("label",{className:"review-label",htmlFor:Fr(o),children:[o.fieldLabel,o.required?i.jsx("span",{className:"review-required",children:"*"}):null]}),a(o)]},Fr(o)))})})}function yd({onPublish:e,stepMeta:t,stepperProps:r}){const{state:n}=je();return Da.find(a=>a.value===n.categoryType)?.label||n.categoryType,i.jsxs(i.Fragment,{children:[i.jsx(He,{...r,steps:K}),i.jsx(Ve,{title:t.title,description:t.description,showNext:!1,children:i.jsxs("div",{className:"ca-review",children:[i.jsxs("section",{className:"ca-review__block ca-review__block--last",children:[i.jsx(Bt,{children:"Form Fields"}),i.jsx(gd,{})]}),i.jsx("div",{className:"ca-workflow__actions",children:i.jsx(R,{onClick:e,children:"Publish"})})]})})]})}function bd(e){const t=Number(e);return!Number.isFinite(t)||t<1?1:t>K.length?K.length:Math.floor(t)}function vd(e){const t=Number(e);return!Number.isFinite(t)||t<1?1:t>3?3:Math.floor(t)}function ro({title:e="Complaint Management Settings",onPublish:t,onStepChange:r,onSaveDraft:n,showSaveButton:a=!0,showNextButton:o=!0}){const s=Ze(),{systemId:l}=Wo(),[c,d]=Ts(),u=bd(c.get("step")||1),f=vd(c.get("substep")||1);L.useEffect(()=>{if(!c.get("step")){const y=new URLSearchParams(c);y.set("step","1"),d(y,{replace:!0})}},[c,d]);const h=L.useMemo(()=>K.find(y=>y.id===u)||K[0],[u]),v=L.useCallback((y,C)=>{const N=new URLSearchParams(c);N.set("step",String(y)),y===4?N.set("substep",String(C??(y===u?f:1))):N.delete("substep"),d(N,{replace:!1}),r?.({systemId:l,step:y,substep:C})},[c,d,r,l,u,f]),_=()=>{u<K.length&&v(u+1,1)},S=y=>{v(4,y)},b=()=>{t?.({systemId:l,step:u})},m={currentStep:u,onStepClick:y=>v(y,y===4?1:void 0),showSaveButton:a,showNextButton:o&&u<K.length,onSaveDraft:()=>n?.({systemId:l,step:u}),onNext:_,className:"ca-settings-page__stepper"};return i.jsx(ka,{children:i.jsxs("div",{className:"ca-settings-page",children:[i.jsx(vr,{children:e}),u===1?i.jsx(Xc,{stepMeta:h,stepperProps:m}):null,u===2?i.jsx(Ga,{onNext:_,stepMeta:h,substep:f,onSubstepChange:S,stepperProps:m}):null,u===5?i.jsx(Qc,{stepMeta:h,stepperProps:m}):null,u===7?i.jsx(Ga,{onNext:_,stepMeta:h,substep:f,onSubstepChange:S,stepperProps:m}):null,u===3?i.jsx(hd,{stepMeta:h,stepperProps:m}):null,u===4?i.jsx(yd,{onPublish:b,stepMeta:h,stepperProps:m}):null,i.jsx("button",{type:"button",className:"ca-back-link",onClick:()=>s("/"),children:"← Back to Complaint Management"})]})},l||"new")}const wd=12,Cd="18 July 2026, 12:09";function _d({totalCount:e=88}){return i.jsxs("section",{className:"ca-query-details","aria-labelledby":"query-management-title",children:[i.jsxs("div",{className:"ca-query-details__heading",children:[i.jsx("h1",{id:"query-management-title",className:"ca-query-details__title",children:"Query Management"}),i.jsxs("span",{className:"ca-query-details__count",children:["Total Count: ",e]})]}),i.jsxs("div",{className:"ca-query-details__summary",children:[i.jsxs("div",{className:"ca-query-details__card",children:[i.jsx("span",{className:"ca-query-details__label",children:"Total Queries"}),i.jsx("strong",{className:"ca-query-details__value",children:wd})]}),i.jsxs("div",{className:"ca-query-details__card",children:[i.jsx("span",{className:"ca-query-details__label",children:"Last Query Submitted Date"}),i.jsx("strong",{className:"ca-query-details__value",children:Cd})]})]})]})}const Sd=[{id:1,label:"Name",key:"name"},{id:2,label:"Email",key:"email"},{id:3,label:"Query Type",key:"queryType"},{id:4,label:"Description",key:"description"},{id:5,label:"Employee",key:"employee"},{id:6,label:"Status",key:"status"},{id:7,label:"Escalation To",key:"escalationTo"}],Ed=[{id:1,name:"Rajesh Kumar",email:"rajesh@gmail.com",queryType:"shift_timing",description:"Need to upload hono hr app in new phone Emp id- 90998989",employee:"Employee",status:"Status",escalationTo:"Level 1"},{id:2,name:"Deepanshu",email:"deepanshu@gmail.com",queryType:"shift_timing",description:"Need to upload hono hr app in new phone Emp id- 90998989",employee:"Employee",status:"Status",escalationTo:"Level 1"},{id:3,name:"Ritik Kumar",email:"ritik@gmail.com",queryType:"shift_timing",description:"Need to upload hono hr app in new phone Emp id- 90998989",employee:"Employee",status:"Status",escalationTo:"Level 1"},{id:4,name:"Raj Kumar",email:"raj@gmail.com",queryType:"shift_timing",description:"Need to upload hono hr app in new phone Emp id- 90998989",employee:"Employee",status:"Status",escalationTo:"Level 1"}],Nd=44;function Ld({id:e=Nd,labelFields:t=Sd,tableData:r=Ed}){return i.jsxs("section",{className:"ca-query-table","aria-label":"Query records",children:[i.jsxs("div",{className:"ca-query-table__toolbar",children:[i.jsxs("label",{className:"ca-query-table__filter",children:[i.jsx(Uc,{size:14,"aria-hidden":"true"}),i.jsx("span",{className:"ca-query-table__sr-only",children:"Filter by status"}),i.jsxs("select",{defaultValue:"all","aria-label":"Filter by status",children:[i.jsx("option",{value:"all",children:"Select Status"}),i.jsx("option",{value:"open",children:"Open"}),i.jsx("option",{value:"closed",children:"Closed"})]})]}),i.jsxs("div",{className:"ca-query-table__actions",children:[i.jsx(R,{variant:"outline",size:"sm",startIcon:i.jsx(ya,{size:14}),children:"New Query"}),i.jsx(R,{variant:"outline",size:"sm",startIcon:i.jsx(Bc,{size:14}),children:"Download Report"})]})]}),i.jsx("div",{className:"ca-query-table__scroll","data-label-field-id":e,children:i.jsxs("table",{children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{scope:"col",children:"#"}),t.map(n=>i.jsx("th",{scope:"col",children:n.label},n.id))]})}),i.jsx("tbody",{children:r.map((n,a)=>i.jsxs("tr",{children:[i.jsx("td",{children:a+1}),t.map(o=>i.jsx("td",{children:n[o.key]??"-"},`${n.id??a}-${o.id}`))]},n.id??a))})]})})]})}const Od=()=>i.jsxs("main",{className:"ca-query-management-page",children:[i.jsx(_d,{}),i.jsx(Ld,{})]});function Td({pageProps:e,onPublish:t,onStepChange:r,children:n}){const a=n??i.jsx(Fa,{...e});return i.jsxs(ss,{children:[i.jsx(Qe,{path:"/",element:a}),i.jsx(Qe,{path:"/settings/:systemId",element:i.jsx(ro,{onPublish:t,onStepChange:r})}),i.jsx(Qe,{path:"querymanagement",element:i.jsx(Od,{})}),i.jsx(Qe,{path:"*",element:a})]})}function Ad({pageProps:e,onPublish:t,onStepChange:r,children:n}){return i.jsx(Td,{pageProps:e,onPublish:t,onStepChange:r,children:n})}function Fd({children:e}){const{cssVars:t,darkMode:r,mode:n}=ra();return i.jsx("div",{className:`ca-root ${r?"ca-root--dark":"ca-root--light"}`,"data-ca-theme":n,style:t,children:e})}function xd({basePath:e,children:t}){return xe()?t:i.jsx(Cs,{basename:e,children:t})}function Pd({store:e,children:t}){const r=L.useContext(kr.ReactReduxContext);return!e&&r?.store?t:i.jsx(kr.Provider,{store:e||la,children:t})}const no=({apiUrl:e,authToken:t,store:r,basePath:n="/",theme:a,darkMode:o=!1,title:s,description:l,systems:c,systemsEndpoint:d,useDemoData:u=!0,createLabel:f,onCreateForm:h,onConfigure:v,onOpen:_,onTitleClick:S,onDescriptionClick:b,onSearch:m,onPublish:y,onSaveDraft:C,showSaveButton:N,showNextButton:A,onStepChange:F,children:$})=>{const Q={title:s,description:l,systems:c,systemsEndpoint:d,useDemoData:u,createLabel:f,onCreateForm:h,onConfigure:v,onOpen:_,onTitleClick:S,onDescriptionClick:b,onSearch:m,onSaveDraft:C,showSaveButton:N,showNextButton:A};return i.jsx(ta,{theme:a,darkMode:o,children:i.jsx(Pd,{store:r,children:i.jsx(Fd,{children:i.jsx(Zn,{apiUrl:e,authToken:t,children:i.jsx(xd,{basePath:n,children:i.jsx(Ad,{pageProps:Q,onPublish:y,onStepChange:F,children:$})})})})})})},kd=ae.colors,Dd=ae.radii,Bd=ae.spacing,Id=ae.typography;g.AddFormButton=Xa,g.AddTableCard=Ka,g.ApiProvider=Zn,g.BodyText=It,g.Button=R,g.COMPLAINT_ENDPOINTS=ee,g.CardFooter=va,g.CardHeader=ba,g.ChevronDownIcon=Ma,g.ChevronRightIcon=Cr,g.Chip=qa,g.CloseIcon=Va,g.ComplaintApp=no,g.ComplaintManagementPage=Fa,g.ComplaintSettingsPage=ro,g.DEFAULT_PAGE_DESCRIPTION=Ta,g.DEMO_SYSTEMS=Oa,g.DataPoint=wa,g.Divider=Ca,g.DragHandleIcon=Nr,g.FieldLabel=Mt,g.FormCard=Ya,g.FormCardGrid=eo,g.FormField=re,g.FormInput=_r,g.FormSelect=Sr,g.FormTextarea=$a,g.Heading1=vr,g.Heading2=Bt,g.Input=te,g.LabelText=ua,g.LayersIcon=Ba,g.LinkText=Lc,g.Loading=La,g.PageHeader=pa,g.PlusIcon=ca,g.Radio=za,g.RoleMultiSelect=Wa,g.SETTINGS_STEPS=K,g.SearchBar=Na,g.SearchIcon=Ea,g.Select=J,g.SettingsCard=Ve,g.SettingsCardHeader=Ia,g.SettingsWizardProvider=ka,g.StatusBadge=ha,g.Stepper=He,g.SystemCard=_a,g.SystemCardGrid=Sa,g.TableCard=Ja,g.TableCardGrid=Za,g.Tag=Ha,g.Textarea=Ua,g.ThemeProvider=ta,g.Toggle=Er,g.ToggleField=ja,g.TrashIcon=Qa,g.Typography=fe,g.ValueText=fa,g.WORKFLOW_SUBSTEPS=Rc,g.api=U,g.clearComplaintError=Cc,g.clearSelectedComplaintResource=_c,g.colors=kd,g.complaintDepartmentActions=_e,g.complaintPriorityActions=Se,g.complaintReducer=sa,g.complaintStatusActions=Ne,g.complaintTypeActions=Ce,g.complaintWorkflowActions=Ee,g.createComplaintDepartment=tc,g.createComplaintPriority=sc,g.createComplaintStatus=gc,g.createComplaintStore=ia,g.createComplaintType=Gl,g.createComplaintWorkflow=uc,g.darkTheme=st,g.deepMerge=$e,g.default=no,g.defaultThemeFile=Gn,g.deleteComplaintDepartment=nc,g.deleteComplaintPriority=lc,g.deleteComplaintStatus=bc,g.deleteComplaintType=Ql,g.deleteComplaintWorkflow=pc,g.deleteWorkflowSteps=na,g.getComplaintDepartmentById=ec,g.getComplaintDepartments=Yl,g.getComplaintPriorities=ac,g.getComplaintPriorityById=oc,g.getComplaintStatusById=mc,g.getComplaintStatuses=hc,g.getComplaintTypeById=Zl,g.getComplaintTypes=Jl,g.getComplaintWorkflowById=dc,g.getComplaintWorkflows=cc,g.getDepartmentTree=xt,g.getWorkflowSteps=Pt,g.lightTheme=ae,g.normalizeThemeFile=Xn,g.radii=Dd,g.resetComplaintState=Sc,g.resolveActiveTheme=Qn,g.saveWorkflowSteps=kt,g.setAuthToken=gr,g.setBaseUrl=Jn,g.spacing=Bd,g.store=la,g.themeToCssVars=Yn,g.typography=Id,g.updateComplaintDepartment=rc,g.updateComplaintPriority=ic,g.updateComplaintStatus=yc,g.updateComplaintType=Xl,g.updateComplaintWorkflow=fc,g.useSettingsWizard=je,g.useTheme=ra,Object.defineProperties(g,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
3
+ `+('Please change the parent <Route path="'+f+'"> to <Route ')+('path="'+(f==="/"?"*":f+"/*")+'">.'))}let p=Te(),y;if(t){var S;let f=typeof t=="string"?qe(t):t;d==="/"||(S=f.pathname)!=null&&S.startsWith(d)||(process.env.NODE_ENV!=="production"?x(!1,"When overriding the location using `<Routes location>` or `useRoutes(routes, location)`, the location pathname must begin with the portion of the URL pathname that was "+('matched by all parent routes. The current pathname base is "'+d+'" ')+('but pathname "'+f.pathname+'" was given in the `location` prop.')):x(!1)),y=f}else y=p;let v=y.pathname||"/",w=v;if(d!=="/"){let f=d.replace(/^\//,"").split("/");w="/"+v.replace(/^\//,"").split("/").slice(f.length).join("/")}let h=Ms(e,{pathname:w});process.env.NODE_ENV!=="production"&&(process.env.NODE_ENV!=="production"&&te(u||h!=null,'No routes matched location "'+y.pathname+y.search+y.hash+'" '),process.env.NODE_ENV!=="production"&&te(h==null||h[h.length-1].route.element!==void 0||h[h.length-1].route.Component!==void 0||h[h.length-1].route.lazy!==void 0,'Matched leaf route at location "'+y.pathname+y.search+y.hash+'" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.'));let m=hi(h&&h.map(f=>Object.assign({},f,{params:Object.assign({},l,f.params),pathname:he([d,a.encodeLocation?a.encodeLocation(f.pathname).pathname:f.pathname]),pathnameBase:f.pathnameBase==="/"?d:he([d,a.encodeLocation?a.encodeLocation(f.pathnameBase).pathname:f.pathnameBase])})),o,r,n);return t&&m?_.createElement(pt.Provider,{value:{location:ut({pathname:"/",search:"",hash:"",state:null,key:"default"},y),navigationType:we.Pop}},m):m}function di(){let e=bi(),t=ni(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,n="rgba(200,200,200, 0.5)",a={padding:"0.5rem",backgroundColor:n},o={padding:"2px 4px",backgroundColor:n},i=null;return process.env.NODE_ENV!=="production"&&(console.error("Error handled by React Router default ErrorBoundary:",e),i=_.createElement(_.Fragment,null,_.createElement("p",null,"💿 Hey developer 👋"),_.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",_.createElement("code",{style:o},"ErrorBoundary")," or"," ",_.createElement("code",{style:o},"errorElement")," prop on your route."))),_.createElement(_.Fragment,null,_.createElement("h2",null,"Unexpected Application Error!"),_.createElement("h3",{style:{fontStyle:"italic"}},t),r?_.createElement("pre",{style:a},r):null,i)}const ui=_.createElement(di,null);class fi extends _.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,r){return r.location!==t.location||r.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:r.error,location:r.location,revalidation:t.revalidation||r.revalidation}}componentDidCatch(t,r){console.error("React Router caught the following error during render",t,r)}render(){return this.state.error!==void 0?_.createElement(le.Provider,{value:this.props.routeContext},_.createElement(_r.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function pi(e){let{routeContext:t,match:r,children:n}=e,a=_.useContext(ft);return a&&a.static&&a.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=r.route.id),_.createElement(le.Provider,{value:t},n)}function hi(e,t,r,n){var a;if(t===void 0&&(t=[]),r===void 0&&(r=null),n===void 0&&(n=null),e==null){var o;if(!r)return null;if(r.errors)e=r.matches;else if((o=n)!=null&&o.v7_partialHydration&&t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,l=(a=r)==null?void 0:a.errors;if(l!=null){let u=i.findIndex(p=>p.route.id&&l?.[p.route.id]!==void 0);u>=0||(process.env.NODE_ENV!=="production"?x(!1,"Could not find a matching route for errors on route IDs: "+Object.keys(l).join(",")):x(!1)),i=i.slice(0,Math.min(i.length,u+1))}let c=!1,d=-1;if(r&&n&&n.v7_partialHydration)for(let u=0;u<i.length;u++){let p=i[u];if((p.route.HydrateFallback||p.route.hydrateFallbackElement)&&(d=u),p.route.id){let{loaderData:y,errors:S}=r,v=p.route.loader&&y[p.route.id]===void 0&&(!S||S[p.route.id]===void 0);if(p.route.lazy||v){c=!0,d>=0?i=i.slice(0,d+1):i=[i[0]];break}}}return i.reduceRight((u,p,y)=>{let S,v=!1,w=null,h=null;r&&(S=l&&p.route.id?l[p.route.id]:void 0,w=p.route.errorElement||ui,c&&(d<0&&y===0?(Wn("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),v=!0,h=null):d===y&&(v=!0,h=p.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,y+1)),f=()=>{let b;return S?b=w:v?b=h:p.route.Component?b=_.createElement(p.route.Component,null):p.route.element?b=p.route.element:b=u,_.createElement(pi,{match:p,routeContext:{outlet:u,matches:m,isDataRoute:r!=null},children:b})};return r&&(p.route.ErrorBoundary||p.route.errorElement||y===0)?_.createElement(fi,{location:r.location,revalidation:r.revalidation,component:w,error:S,children:f(),routeContext:{outlet:null,matches:m,isDataRoute:!0}}):f()},null)}var qn=(function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e})(qn||{}),mt=(function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e})(mt||{});function Nr(e){return e+" must be used within a data router. See https://reactrouter.com/v6/routers/picking-a-router."}function mi(e){let t=_.useContext(ft);return t||(process.env.NODE_ENV!=="production"?x(!1,Nr(e)):x(!1)),t}function gi(e){let t=_.useContext(Er);return t||(process.env.NODE_ENV!=="production"?x(!1,Nr(e)):x(!1)),t}function yi(e){let t=_.useContext(le);return t||(process.env.NODE_ENV!=="production"?x(!1,Nr(e)):x(!1)),t}function Tr(e){let t=yi(e),r=t.matches[t.matches.length-1];return r.route.id||(process.env.NODE_ENV!=="production"?x(!1,e+' can only be used on routes that contain a unique "id"'):x(!1)),r.route.id}function wi(){return Tr(mt.UseRouteId)}function bi(){var e;let t=_.useContext(_r),r=gi(mt.UseRouteError),n=Tr(mt.UseRouteError);return t!==void 0?t:(e=r.errors)==null?void 0:e[n]}function vi(){let{router:e}=mi(qn.UseNavigateStable),t=Tr(mt.UseNavigateStable),r=_.useRef(!1);return Un(()=>{r.current=!0}),_.useCallback(function(a,o){o===void 0&&(o={}),process.env.NODE_ENV!=="production"&&te(r.current,$n),r.current&&(typeof a=="number"?e.navigate(a):e.navigate(a,ut({fromRouteId:t},o)))},[e,t])}const Vn={};function Wn(e,t,r){!t&&!Vn[e]&&(Vn[e]=!0,process.env.NODE_ENV!=="production"&&te(!1,r))}const Hn={};function Ci(e,t){process.env.NODE_ENV!=="production"&&!Hn[t]&&(Hn[t]=!0,console.warn(t))}const zn=(e,t,r)=>Ci(e,"⚠️ React Router Future Flag Warning: "+t+". "+("You can use the `"+e+"` future flag to opt-in early. ")+("For more information, see "+r+"."));function Si(e,t){e?.v7_startTransition===void 0&&zn("v7_startTransition","React Router will begin wrapping state updates in `React.startTransition` in v7","https://reactrouter.com/v6/upgrading/future#v7_starttransition"),e?.v7_relativeSplatPath===void 0&&zn("v7_relativeSplatPath","Relative route resolution within Splat routes is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_relativesplatpath")}function We(e){process.env.NODE_ENV!=="production"?x(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>."):x(!1)}function Ei(e){let{basename:t="/",children:r=null,location:n,navigationType:a=we.Pop,navigator:o,static:i=!1,future:l}=e;Ve()&&(process.env.NODE_ENV!=="production"?x(!1,"You cannot render a <Router> inside another <Router>. You should never have more than one in your app."):x(!1));let c=t.replace(/^\/*/,"/"),d=_.useMemo(()=>({basename:c,navigator:o,static:i,future:ut({v7_relativeSplatPath:!1},l)}),[c,l,o,i]);typeof n=="string"&&(n=qe(n));let{pathname:u="/",search:p="",hash:y="",state:S=null,key:v="default"}=n,w=_.useMemo(()=>{let h=be(u,c);return h==null?null:{location:{pathname:h,search:p,hash:y,state:S,key:v},navigationType:a}},[c,u,p,y,S,v,a]);return process.env.NODE_ENV!=="production"&&te(w!=null,'<Router basename="'+c+'"> is not able to match the URL '+('"'+u+p+y+'" because it does not start with the ')+"basename, so the <Router> won't render anything."),w==null?null:_.createElement(oe.Provider,{value:d},_.createElement(pt.Provider,{children:r,value:w}))}function _i(e){let{children:t,location:r}=e;return li(Lr(t),r)}new Promise(()=>{});function Lr(e,t){t===void 0&&(t=[]);let r=[];return _.Children.forEach(e,(n,a)=>{if(!_.isValidElement(n))return;let o=[...t,a];if(n.type===_.Fragment){r.push.apply(r,Lr(n.props.children,o));return}n.type!==We&&(process.env.NODE_ENV!=="production"?x(!1,"["+(typeof n.type=="string"?n.type:n.type.name)+"] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>"):x(!1)),!n.props.index||!n.props.children||(process.env.NODE_ENV!=="production"?x(!1,"An index route cannot have child routes."):x(!1));let i={id:n.props.id||o.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(i.children=Lr(n.props.children,o)),r.push(i)}),r}function He(){return He=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},He.apply(null,arguments)}function Ar(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}const jt="get",qt="application/x-www-form-urlencoded";function Vt(e){return e!=null&&typeof e.tagName=="string"}function Ni(e){return Vt(e)&&e.tagName.toLowerCase()==="button"}function Ti(e){return Vt(e)&&e.tagName.toLowerCase()==="form"}function Li(e){return Vt(e)&&e.tagName.toLowerCase()==="input"}function Ai(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Fi(e,t){return e.button===0&&(!t||t==="_self")&&!Ai(e)}function Fr(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map(a=>[r,a]):[[r,n]])},[]))}function Oi(e,t){let r=Fr(e);return t&&t.forEach((n,a)=>{r.has(a)||t.getAll(a).forEach(o=>{r.append(a,o)})}),r}let Wt=null;function ki(){if(Wt===null)try{new FormData(document.createElement("form"),0),Wt=!1}catch{Wt=!0}return Wt}const Di=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Or(e){return e!=null&&!Di.has(e)?(process.env.NODE_ENV!=="production"&&te(!1,'"'+e+'" is not a valid `encType` for `<Form>`/`<fetcher.Form>` '+('and will default to "'+qt+'"')),null):e}function xi(e,t){let r,n,a,o,i;if(Ti(e)){let l=e.getAttribute("action");n=l?be(l,t):null,r=e.getAttribute("method")||jt,a=Or(e.getAttribute("enctype"))||qt,o=new FormData(e)}else if(Ni(e)||Li(e)&&(e.type==="submit"||e.type==="image")){let l=e.form;if(l==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let c=e.getAttribute("formaction")||l.getAttribute("action");if(n=c?be(c,t):null,r=e.getAttribute("formmethod")||l.getAttribute("method")||jt,a=Or(e.getAttribute("formenctype"))||Or(l.getAttribute("enctype"))||qt,o=new FormData(l,e),!ki()){let{name:d,type:u,value:p}=e;if(u==="image"){let y=d?d+".":"";o.append(y+"x","0"),o.append(y+"y","0")}else d&&o.append(d,p)}}else{if(Vt(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=jt,n=null,a=qt,i=e}return o&&a==="text/plain"&&(i=o,o=void 0),{action:n,method:r.toLowerCase(),encType:a,formData:o,body:i}}const Pi=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],Ii=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],Mi=["fetcherKey","navigate","reloadDocument","replace","state","method","action","onSubmit","relative","preventScrollReset","viewTransition"],Bi="6";try{window.__reactRouterVersion=Bi}catch{}const Kn=_.createContext({isTransitioning:!1});process.env.NODE_ENV!=="production"&&(Kn.displayName="ViewTransition");const $i=_.createContext(new Map);process.env.NODE_ENV!=="production"&&($i.displayName="Fetchers");const Jn=_["startTransition"];function Ui(e){let{basename:t,children:r,future:n,window:a}=e,o=_.useRef();o.current==null&&(o.current=xs({window:a,v5Compat:!0}));let i=o.current,[l,c]=_.useState({action:i.action,location:i.location}),{v7_startTransition:d}=n||{},u=_.useCallback(p=>{d&&Jn?Jn(()=>c(p)):c(p)},[c,d]);return _.useLayoutEffect(()=>i.listen(u),[i,u]),_.useEffect(()=>Si(n),[n]),_.createElement(Ei,{basename:t,children:r,location:l.location,navigationType:l.action,navigator:i,future:n})}process.env.NODE_ENV;const ji=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",qi=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Rn=_.forwardRef(function(t,r){let{onClick:n,relative:a,reloadDocument:o,replace:i,state:l,target:c,to:d,preventScrollReset:u,viewTransition:p}=t,y=Ar(t,Pi),{basename:S}=_.useContext(oe),v,w=!1;if(typeof d=="string"&&qi.test(d)&&(v=d,ji))try{let b=new URL(window.location.href),E=d.startsWith("//")?new URL(b.protocol+d):new URL(d),O=be(E.pathname,S);E.origin===b.origin&&O!=null?d=O+E.search+E.hash:w=!0}catch{process.env.NODE_ENV!=="production"&&te(!1,'<Link to="'+d+'"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.')}let h=si(d,{relative:a}),m=zi(d,{replace:i,state:l,target:c,preventScrollReset:u,relative:a,viewTransition:p});function f(b){n&&n(b),b.defaultPrevented||m(b)}return _.createElement("a",He({},y,{href:v||h,onClick:w||o?n:f,ref:r,target:c}))});process.env.NODE_ENV!=="production"&&(Rn.displayName="Link");const Vi=_.forwardRef(function(t,r){let{"aria-current":n="page",caseSensitive:a=!1,className:o="",end:i=!1,style:l,to:c,viewTransition:d,children:u}=t,p=Ar(t,Ii),y=ht(c,{relative:p.relative}),S=Te(),v=_.useContext(Er),{navigator:w,basename:h}=_.useContext(oe),m=v!=null&&Gi(y)&&d===!0,f=w.encodeLocation?w.encodeLocation(y).pathname:y.pathname,b=S.pathname,E=v&&v.navigation&&v.navigation.location?v.navigation.location.pathname:null;a||(b=b.toLowerCase(),E=E?E.toLowerCase():null,f=f.toLowerCase()),E&&h&&(E=be(E,h)||E);const O=f!=="/"&&f.endsWith("/")?f.length-1:f.length;let L=b===f||!i&&b.startsWith(f)&&b.charAt(O)==="/",P=E!=null&&(E===f||!i&&E.startsWith(f)&&E.charAt(f.length)==="/"),q={isActive:L,isPending:P,isTransitioning:m},k=L?n:void 0,A;typeof o=="function"?A=o(q):A=[o,L?"active":null,P?"pending":null,m?"transitioning":null].filter(Boolean).join(" ");let M=typeof l=="function"?l(q):l;return _.createElement(Rn,He({},p,{"aria-current":k,className:A,ref:r,style:M,to:c,viewTransition:d}),typeof u=="function"?u(q):u)});process.env.NODE_ENV!=="production"&&(Vi.displayName="NavLink");const Wi=_.forwardRef((e,t)=>{let{fetcherKey:r,navigate:n,reloadDocument:a,replace:o,state:i,method:l=jt,action:c,onSubmit:d,relative:u,preventScrollReset:p,viewTransition:y}=e,S=Ar(e,Mi),v=Xi(),w=Qi(c,{relative:u}),h=l.toLowerCase()==="get"?"get":"post",m=f=>{if(d&&d(f),f.defaultPrevented)return;f.preventDefault();let b=f.nativeEvent.submitter,E=b?.getAttribute("formmethod")||l;v(b||f.currentTarget,{fetcherKey:r,method:E,navigate:n,replace:o,state:i,relative:u,preventScrollReset:p,viewTransition:y})};return _.createElement("form",He({ref:t,method:h,action:w,onSubmit:a?d:m},S))});process.env.NODE_ENV!=="production"&&(Wi.displayName="Form"),process.env.NODE_ENV;var Ht;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Ht||(Ht={}));var Zn;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Zn||(Zn={}));function Hi(e){return e+" must be used within a data router. See https://reactrouter.com/v6/routers/picking-a-router."}function Xn(e){let t=_.useContext(ft);return t||(process.env.NODE_ENV!=="production"?x(!1,Hi(e)):x(!1)),t}function zi(e,t){let{target:r,replace:n,state:a,preventScrollReset:o,relative:i,viewTransition:l}=t===void 0?{}:t,c=Le(),d=Te(),u=ht(e,{relative:i});return _.useCallback(p=>{if(Fi(p,r)){p.preventDefault();let y=n!==void 0?n:dt(d)===dt(u);c(e,{replace:y,state:a,preventScrollReset:o,relative:i,viewTransition:l})}},[d,c,u,n,a,r,e,o,i,l])}function Ki(e){process.env.NODE_ENV!=="production"&&te(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=_.useRef(Fr(e)),r=_.useRef(!1),n=Te(),a=_.useMemo(()=>Oi(n.search,r.current?null:t.current),[n.search]),o=Le(),i=_.useCallback((l,c)=>{const d=Fr(typeof l=="function"?l(a):l);r.current=!0,o("?"+d,c)},[o,a]);return[a,i]}function Ji(){if(typeof document>"u")throw new Error("You are calling submit during the server render. Try calling submit within a `useEffect` or callback instead.")}let Ri=0,Zi=()=>"__"+String(++Ri)+"__";function Xi(){let{router:e}=Xn(Ht.UseSubmit),{basename:t}=_.useContext(oe),r=wi();return _.useCallback(function(n,a){a===void 0&&(a={}),Ji();let{action:o,method:i,encType:l,formData:c,body:d}=xi(n,t);if(a.navigate===!1){let u=a.fetcherKey||Zi();e.fetch(u,r,a.action||o,{preventScrollReset:a.preventScrollReset,formData:c,body:d,formMethod:a.method||i,formEncType:a.encType||l,flushSync:a.flushSync})}else e.navigate(a.action||o,{preventScrollReset:a.preventScrollReset,formData:c,body:d,formMethod:a.method||i,formEncType:a.encType||l,replace:a.replace,state:a.state,fromRouteId:r,flushSync:a.flushSync,viewTransition:a.viewTransition})},[e,t,r])}function Qi(e,t){let{relative:r}=t===void 0?{}:t,{basename:n}=_.useContext(oe),a=_.useContext(le);a||(process.env.NODE_ENV!=="production"?x(!1,"useFormAction must be used inside a RouteContext"):x(!1));let[o]=a.matches.slice(-1),i=He({},ht(e||".",{relative:r})),l=Te();if(e==null){i.search=l.search;let c=new URLSearchParams(i.search),d=c.getAll("index");if(d.some(p=>p==="")){c.delete("index"),d.filter(y=>y).forEach(y=>c.append("index",y));let p=c.toString();i.search=p?"?"+p:""}}return(!e||e===".")&&o.route.index&&(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(i.pathname=i.pathname==="/"?n:he([n,i.pathname])),dt(i)}function Gi(e,t){t===void 0&&(t={});let r=_.useContext(Kn);r==null&&(process.env.NODE_ENV!=="production"?x(!1,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"):x(!1));let{basename:n}=Xn(Ht.useViewTransitionState),a=ht(e,{relative:t.relative});if(!r.isTransitioning)return!1;let o=be(r.currentLocation.pathname,n)||r.currentLocation.pathname,i=be(r.nextLocation.pathname,n)||r.nextLocation.pathname;return Cr(a.pathname,i)!=null||Cr(a.pathname,o)!=null}function Qn(e,t){return function(){return e.apply(t,arguments)}}const{toString:Yi}=Object.prototype,{getPrototypeOf:ze}=Object,{iterator:gt,toStringTag:Gn}=Symbol,zt=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),yt=(e,t)=>{let r=e;const n=[];for(;r!=null&&r!==Object.prototype;){if(n.indexOf(r)!==-1)return!1;if(n.push(r),zt(r,t))return!0;r=ze(r)}return!1},el=(e,t)=>e!=null&&yt(e,t)?e[t]:void 0,kr=(e=>t=>{const r=Yi.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),re=e=>(e=e.toLowerCase(),t=>kr(t)===e),Kt=e=>t=>typeof t===e,{isArray:Ae}=Array,Fe=Kt("undefined");function Ke(e){return e!==null&&!Fe(e)&&e.constructor!==null&&!Fe(e.constructor)&&Q(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Yn=re("ArrayBuffer");function tl(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Yn(e.buffer),t}const rl=Kt("string"),Q=Kt("function"),ea=Kt("number"),Je=e=>e!==null&&typeof e=="object",nl=e=>e===!0||e===!1,Jt=e=>{if(!Je(e))return!1;const t=ze(e);return(t===null||t===Object.prototype||ze(t)===null)&&!yt(e,Gn)&&!yt(e,gt)},al=e=>{if(!Je(e)||Ke(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},ol=re("Date"),sl=re("File"),il=e=>!!(e&&typeof e.uri<"u"),ll=e=>e&&typeof e.getParts<"u",cl=re("Blob"),dl=re("FileList"),ul=re("Set"),fl=e=>Je(e)&&Q(e.pipe);function pl(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const ta=pl(),ra=typeof ta.FormData<"u"?ta.FormData:void 0,hl=e=>{if(!e)return!1;if(ra&&e instanceof ra)return!0;const t=ze(e);if(!t||t===Object.prototype||!Q(e.append))return!1;const r=kr(e);return r==="formdata"||r==="object"&&Q(e.toString)&&e.toString()==="[object FormData]"},ml=re("URLSearchParams"),[gl,yl,wl,bl]=["ReadableStream","Request","Response","Headers"].map(re),vl=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function wt(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,a;if(typeof e!="object"&&(e=[e]),Ae(e))for(n=0,a=e.length;n<a;n++)t.call(null,e[n],n,e);else{if(Ke(e))return;const o=r?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let l;for(n=0;n<i;n++)l=o[n],t.call(null,e[l],l,e)}}function na(e,t){if(Ke(e))return null;t=t.toLowerCase();const r=Object.keys(e);let n=r.length,a;for(;n-- >0;)if(a=r[n],t===a.toLowerCase())return a;return null}const Oe=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,aa=e=>!Fe(e)&&e!==Oe;function Dr(...e){const{caseless:t,skipUndefined:r}=aa(this)&&this||{},n={},a=(o,i)=>{if(i==="__proto__"||i==="constructor"||i==="prototype")return;const l=t&&typeof i=="string"&&na(n,i)||i,c=zt(n,l)?n[l]:void 0;Jt(c)&&Jt(o)?n[l]=Dr(c,o):Jt(o)?n[l]=Dr({},o):Ae(o)?n[l]=o.slice():(!r||!Fe(o))&&(n[l]=o)};for(let o=0,i=e.length;o<i;o++){const l=e[o];if(!l||Ke(l)||(wt(l,a),typeof l!="object"||Ae(l)))continue;const c=Object.getOwnPropertySymbols(l);for(let d=0;d<c.length;d++){const u=c[d];Dl.call(l,u)&&a(l[u],u)}}return n}const Cl=(e,t,r,{allOwnKeys:n}={})=>(wt(t,(a,o)=>{r&&Q(a)?Object.defineProperty(e,o,{__proto__:null,value:Qn(a,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,o,{__proto__:null,value:a,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:n}),e),Sl=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),El=(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),Object.defineProperty(e.prototype,"constructor",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{__proto__:null,value:t.prototype}),r&&Object.assign(e.prototype,r)},_l=(e,t,r,n)=>{let a,o,i;const l={};if(t=t||{},e==null)return t;do{for(a=Object.getOwnPropertyNames(e),o=a.length;o-- >0;)i=a[o],(!n||n(i,e,t))&&!l[i]&&(t[i]=e[i],l[i]=!0);e=r!==!1&&ze(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},Nl=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return n!==-1&&n===r},Tl=e=>{if(!e)return null;if(Ae(e))return e;let t=e.length;if(!ea(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},Ll=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&ze(Uint8Array)),Al=(e,t)=>{const n=(e&&e[gt]).call(e);let a;for(;(a=n.next())&&!a.done;){const o=a.value;t.call(e,o[0],o[1])}},Fl=(e,t)=>{let r;const n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},Ol=re("HTMLFormElement"),kl=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,a){return n.toUpperCase()+a}),{propertyIsEnumerable:Dl}=Object.prototype,xl=re("RegExp"),oa=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};wt(r,(a,o)=>{let i;(i=t(a,o,e))!==!1&&(n[o]=i||a)}),Object.defineProperties(e,n)},Pl=e=>{oa(e,(t,r)=>{if(Q(e)&&["arguments","caller","callee"].includes(r))return!1;const n=e[r];if(Q(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},Il=(e,t)=>{const r={},n=a=>{a.forEach(o=>{r[o]=!0})};return Ae(e)?n(e):n(String(e).split(t)),r},Ml=()=>{},Bl=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function $l(e){return!!(e&&Q(e.append)&&e[Gn]==="FormData"&&e[gt])}const Ul=e=>{const t=new WeakSet,r=n=>{if(Je(n)){if(t.has(n))return;if(Ke(n))return n;if(!("toJSON"in n)){t.add(n);let a;if(ul(n)){a=[];for(const o of n){const i=r(o);!Fe(i)&&a.push(i)}}else a=Ae(n)?[]:{},wt(n,(o,i)=>{const l=r(o);!Fe(l)&&(a[i]=l)});return t.delete(n),a}}return n};return r(e)},jl=re("AsyncFunction"),ql=e=>e&&(Je(e)||Q(e))&&Q(e.then)&&Q(e.catch),sa=((e,t)=>e?setImmediate:t?((r,n)=>(Oe.addEventListener("message",({source:a,data:o})=>{a===Oe&&o===r&&n.length&&n.shift()()},!1),a=>{n.push(a),Oe.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Q(Oe.postMessage)),Vl=typeof queueMicrotask<"u"?queueMicrotask.bind(Oe):typeof process<"u"&&process.nextTick||sa,ia=e=>e!=null&&Q(e[gt]),g={isArray:Ae,isArrayBuffer:Yn,isBuffer:Ke,isFormData:hl,isArrayBufferView:tl,isString:rl,isNumber:ea,isBoolean:nl,isObject:Je,isPlainObject:Jt,isEmptyObject:al,isReadableStream:gl,isRequest:yl,isResponse:wl,isHeaders:bl,isUndefined:Fe,isDate:ol,isFile:sl,isReactNativeBlob:il,isReactNative:ll,isBlob:cl,isRegExp:xl,isFunction:Q,isStream:fl,isURLSearchParams:ml,isTypedArray:Ll,isFileList:dl,forEach:wt,merge:Dr,extend:Cl,trim:vl,stripBOM:Sl,inherits:El,toFlatObject:_l,kindOf:kr,kindOfTest:re,endsWith:Nl,toArray:Tl,forEachEntry:Al,matchAll:Fl,isHTMLForm:Ol,hasOwnProperty:zt,hasOwnProp:zt,hasOwnInPrototypeChain:yt,getSafeProp:el,reduceDescriptors:oa,freezeMethods:Pl,toObjectSet:Il,toCamelCase:kl,noop:Ml,toFiniteNumber:Bl,findKey:na,global:Oe,isContextDefined:aa,isSpecCompliantForm:$l,toJSONObject:Ul,isAsyncFn:jl,isThenable:ql,setImmediate:sa,asap:Vl,isIterable:ia,isSafeIterable:e=>e!=null&&yt(e,gt)&&ia(e)},Wl=g.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Hl=e=>{const t={};let r,n,a;return e&&e.split(`
4
+ `).forEach(function(i){a=i.indexOf(":"),r=i.substring(0,a).trim().toLowerCase(),n=i.substring(a+1).trim();const l=g.hasOwnProp(t,r);!r||l&&g.hasOwnProp(Wl,r)||(r==="set-cookie"?l?t[r].push(n):t[r]=[n]:t[r]=l?t[r]+", "+n:n)}),t};function zl(e){let t=0,r=e.length;for(;t<r;){const n=e.charCodeAt(t);if(n!==9&&n!==32)break;t+=1}for(;r>t;){const n=e.charCodeAt(r-1);if(n!==9&&n!==32)break;r-=1}return t===0&&r===e.length?e:e.slice(t,r)}const Kl=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),Jl=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function xr(e,t){return g.isArray(e)?e.map(r=>xr(r,t)):zl(String(e).replace(t,""))}const Rl=e=>xr(e,Kl),Zl=e=>xr(e,Jl);function la(e){const t=Object.create(null);return g.forEach(e.toJSON(),(r,n)=>{t[n]=Zl(r)}),t}const ca=Symbol("internals");function bt(e){return e&&String(e).trim().toLowerCase()}function Rt(e){return e===!1||e==null?e:g.isArray(e)?e.map(Rt):Rl(String(e))}function Xl(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}const Ql=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;function Pr(e){let t=0,r=e.length;for(;t<r;){const n=e.charCodeAt(t);if(n!==9&&n!==32)break;t+=1}for(;r>t;){const n=e.charCodeAt(r-1);if(n!==9&&n!==32)break;r-=1}return t===0&&r===e.length?e:e.slice(t,r)}function Gl(e){const t=e.length-1;if(t<1||e.charCodeAt(0)!==34||e.charCodeAt(t)!==34)return e;let r="";for(let n=1;n<t;n++){const a=e.charCodeAt(n);if(a===34||a===92&&(n+=1,n>=t))return e;r+=e[n]}return r}function Yl(e){const t=Object.create(null),r=String(e);let n=0,a=!1,o=!1;function i(l){const c=Pr(r.slice(n,l)),d=c.indexOf("=");if(d<1)return;const u=Pr(c.slice(0,d));if(!Ql.test(u))return;const p=u.toLowerCase();if(p==="__proto__"||p==="constructor"||p==="prototype")return;const y=Pr(c.slice(d+1));t[p]=Gl(y)}for(let l=0;l<r.length;l++){const c=r.charCodeAt(l);a?o?o=!1:c===92?o=!0:c===34&&(a=!1):c===34?a=!0:(c===44||c===59)&&(i(l),n=l+1)}return i(r.length),t}const ec=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Ir(e,t,r,n,a){if(g.isFunction(n))return n.call(this,t,r);if(a&&(t=r),!!g.isString(t)){if(g.isString(n))return t.indexOf(n)!==-1;if(g.isRegExp(n))return n.test(t)}}function tc(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function rc(e,t){const r=g.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{__proto__:null,value:function(a,o,i){return this[n].call(this,t,a,o,i)},configurable:!0})})}let R=class{constructor(t){t&&this.set(t)}set(t,r,n){const a=this;function o(l,c,d){const u=bt(c);if(!u)return;const p=g.findKey(a,u);(!p||a[p]===void 0||d===!0||d===void 0&&a[p]!==!1)&&(a[p||c]=Rt(l))}const i=(l,c)=>g.forEach(l,(d,u)=>o(d,u,c));if(g.isPlainObject(t)||t instanceof this.constructor)i(t,r);else if(g.isString(t)&&(t=t.trim())&&!ec(t))i(Hl(t),r);else if(g.isObject(t)&&g.isSafeIterable(t)){let l=Object.create(null),c,d;for(const u of t){if(!g.isArray(u))throw new TypeError("Object iterator must return a key-value pair");d=u[0],g.hasOwnProp(l,d)?(c=l[d],l[d]=g.isArray(c)?[...c,u[1]]:[c,u[1]]):l[d]=u[1]}i(l,r)}else t!=null&&o(r,t,n);return this}get(t,r){if(t=bt(t),t){const n=g.findKey(this,t);if(n){const a=this[n];if(!r)return a;if(r===!0)return Xl(a);if(g.isFunction(r))return r.call(this,a,n);if(g.isRegExp(r))return r.exec(a);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=bt(t),t){const n=g.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||Ir(this,this[n],n,r)))}return!1}delete(t,r){const n=this;let a=!1;function o(i){if(i=bt(i),i){const l=g.findKey(n,i);l&&(!r||Ir(n,n[l],l,r))&&(delete n[l],a=!0)}}return g.isArray(t)?t.forEach(o):o(t),a}clear(t){const r=Object.keys(this);let n=r.length,a=!1;for(;n--;){const o=r[n];(!t||Ir(this,this[o],o,t,!0))&&(delete this[o],a=!0)}return a}normalize(t){const r=this,n={};return g.forEach(this,(a,o)=>{const i=g.findKey(n,o);if(i){r[i]=Rt(a),delete r[o];return}const l=t?tc(o):String(o).trim();l!==o&&delete r[o],r[l]=Rt(a),n[l]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const r=Object.create(null);return g.forEach(this,(n,a)=>{n!=null&&n!==!1&&(r[a]=t&&g.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(`
5
+ `)}getSetCookie(){const t=this.get("set-cookie");return g.isArray(t)?t:t==null||t===!1?[]:[t]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static parseParameters(t){return Yl(t)}static concat(t,...r){const n=new this(t);return r.forEach(a=>n.set(a)),n}static accessor(t){const n=(this[ca]=this[ca]={accessors:{}}).accessors,a=this.prototype;function o(i){const l=bt(i);n[l]||(rc(a,i),n[l]=!0)}return g.isArray(t)?t.forEach(o):o(t),this}};R.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),g.reduceDescriptors(R.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}}),g.freezeMethods(R);const Zt="[REDACTED ****]";function nc(e){if(g.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(g.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}function ac(e,t){const r=new Set(t.map(o=>String(o).toLowerCase())),n=[],a=o=>{if(o===null||typeof o!="object"||g.isBuffer(o))return o;if(n.indexOf(o)!==-1)return;o instanceof R&&(o=o.toJSON()),n.push(o);let i;if(g.isArray(o))i=[],o.forEach((l,c)=>{const d=a(l);g.isUndefined(d)||(i[c]=d)});else{if(!g.isPlainObject(o)&&nc(o))return n.pop(),o;i=Object.create(null);for(const[l,c]of Object.entries(o)){const d=r.has(l.toLowerCase())?Zt:a(c);g.isUndefined(d)||(i[l]=d)}}return n.pop(),i};return a(e)}function da(e){try{return String(e)}catch{return""}}function oc(e){return e.errors.map(r=>{try{return r&&r.message?da(r.message):da(r)}catch{return""}}).filter(Boolean).join("; ")||e.name||"AggregateError"}let T=class Os extends Error{static from(t,r,n,a,o,i){let l=t.message;!l&&g.isArray(t.errors)&&t.errors.length&&(l=oc(t));const c=new Os(l,r||t.code,n,a,o);return Object.defineProperty(c,"cause",{__proto__:null,value:t,writable:!0,enumerable:!1,configurable:!0}),c.name=t.name,t.status!=null&&c.status==null&&(c.status=t.status),i&&Object.assign(c,i),c}constructor(t,r,n,a,o){super(t),Object.defineProperty(this,"message",{__proto__:null,value:t,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,r&&(this.code=r),n&&(this.config=n),a&&(this.request=a),o&&(this.response=o,this.status=o.status)}toJSON(){const t=this.config,r=t&&g.hasOwnProp(t,"redact")?t.redact:void 0,n=g.isArray(r)&&r.length>0?ac(t,r):g.toJSONObject(t);return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:n,code:this.code,status:this.status}}};T.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",T.ERR_BAD_OPTION="ERR_BAD_OPTION",T.ECONNABORTED="ECONNABORTED",T.ETIMEDOUT="ETIMEDOUT",T.ECONNREFUSED="ECONNREFUSED",T.ERR_NETWORK="ERR_NETWORK",T.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",T.ERR_DEPRECATED="ERR_DEPRECATED",T.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",T.ERR_BAD_REQUEST="ERR_BAD_REQUEST",T.ERR_CANCELED="ERR_CANCELED",T.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",T.ERR_INVALID_URL="ERR_INVALID_URL",T.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const sc=null,ua=100;function Mr(e){return g.isPlainObject(e)||g.isArray(e)}function fa(e){return g.endsWith(e,"[]")?e.slice(0,-2):e}function Br(e,t,r){return e?e.concat(t).map(function(a,o){return a=fa(a),!r&&o?"["+a+"]":a}).join(r?".":""):t}function ic(e){return g.isArray(e)&&!e.some(Mr)}const lc=g.toFlatObject(g,{},null,function(t){return/^is[A-Z]/.test(t)});function Xt(e,t,r){if(!g.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,r=g.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(f,b){return!g.isUndefined(b[f])});const n=r.metaTokens,a=r.visitor||v,o=r.dots,i=r.indexes,l=r.Blob||typeof Blob<"u"&&Blob,c=r.maxDepth===void 0?ua:r.maxDepth,d=l&&g.isSpecCompliantForm(t),u=[];if(!g.isFunction(a))throw new TypeError("visitor must be a function");function p(m){if(m===null)return"";if(g.isDate(m))return m.toISOString();if(g.isBoolean(m))return m.toString();if(!d&&g.isBlob(m))throw new T("Blob is not supported. Use a Buffer instead.");if(g.isArrayBuffer(m)||g.isTypedArray(m)){if(d&&typeof l=="function")return new l([m]);throw new T("Blob is not supported. Use a Buffer instead.",T.ERR_NOT_SUPPORT)}return m}function y(m){if(m>c)throw new T("Object is too deeply nested ("+m+" levels). Max depth: "+c,T.ERR_FORM_DATA_DEPTH_EXCEEDED)}function S(m,f){if(c===1/0)return JSON.stringify(m);const b=[];return JSON.stringify(m,function(O,L){if(!g.isObject(L))return L;for(;b.length&&b[b.length-1]!==this;)b.pop();return b.push(L),y(f+b.length-1),L})}function v(m,f,b){let E=m;if(g.isReactNative(t)&&g.isReactNativeBlob(m))return t.append(Br(b,f,o),p(m)),!1;if(m&&!b&&typeof m=="object"){if(g.endsWith(f,"{}"))f=n?f:f.slice(0,-2),m=S(m,1);else if(g.isArray(m)&&ic(m)||(g.isFileList(m)||g.endsWith(f,"[]"))&&(E=g.toArray(m)))return f=fa(f),E.forEach(function(L,P){!(g.isUndefined(L)||L===null)&&t.append(i===!0?Br([f],P,o):i===null?f:f+"[]",p(L))}),!1}return Mr(m)?!0:(t.append(Br(b,f,o),p(m)),!1)}const w=Object.assign(lc,{defaultVisitor:v,convertValue:p,isVisitable:Mr});function h(m,f,b=0){if(!g.isUndefined(m)){if(y(b),u.indexOf(m)!==-1)throw new Error("Circular reference detected in "+f.join("."));u.push(m),g.forEach(m,function(O,L){(!(g.isUndefined(O)||O===null)&&a.call(t,O,g.isString(L)?L.trim():L,f,w))===!0&&h(O,f?f.concat(L):[L],b+1)}),u.pop()}}if(!g.isObject(e))throw new TypeError("data must be an object");return h(e),t}function pa(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(n){return t[n]})}function $r(e,t){this._pairs=[],e&&Xt(e,this,t)}const ha=$r.prototype;ha.append=function(t,r){this._pairs.push([t,r])},ha.toString=function(t){const r=t?n=>t.call(this,n,pa):pa;return this._pairs.map(function(a){return r(a[0])+"="+r(a[1])},"").join("&")};function cc(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function ma(e,t,r){if(!t)return e;e=e||"";const n=g.isFunction(r)?{serialize:r}:r,a=g.getSafeProp(n,"encode")||cc,o=g.getSafeProp(n,"serialize");let i;if(o?i=o(t,n):i=g.isURLSearchParams(t)?t.toString():new $r(t,n).toString(a),i){const l=e.indexOf("#");l!==-1&&(e=e.slice(0,l)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class ga{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){g.forEach(this.handlers,function(n){n!==null&&t(n)})}}const Ur={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},dc={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:$r,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},jr=typeof window<"u"&&typeof document<"u",qr=typeof navigator=="object"&&navigator||void 0,uc=jr&&(!qr||["ReactNative","NativeScript","NS"].indexOf(qr.product)<0),fc=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",pc=jr&&window.location.href||"http://localhost",z={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:jr,hasStandardBrowserEnv:uc,hasStandardBrowserWebWorkerEnv:fc,navigator:qr,origin:pc},Symbol.toStringTag,{value:"Module"})),...dc};function hc(e,t){return Xt(e,new z.classes.URLSearchParams,{visitor:function(r,n,a,o){return z.isNode&&g.isBuffer(r)?(this.append(n,r.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...t})}const ya=ua;function wa(e){if(e>ya)throw new T("FormData field is too deeply nested ("+e+" levels). Max depth: "+ya,T.ERR_FORM_DATA_DEPTH_EXCEEDED)}function mc(e){const t=[],r=/[^.[\]]+|\[([^.[\]]*)]/g;let n;for(;(n=r.exec(e))!==null;)wa(t.length),t.push(n[0]==="[]"?"":n[1]||n[0]);return t}function gc(e){const t={},r=Object.keys(e);let n;const a=r.length;let o;for(n=0;n<a;n++)o=r[n],t[o]=e[o];return t}function ba(e){function t(r,n,a,o){wa(o);let i=r[o++];if(i==="__proto__")return!0;const l=Number.isFinite(+i),c=o>=r.length;return i=!i&&g.isArray(a)?a.length:i,c?(g.hasOwnProp(a,i)?a[i]=g.isArray(a[i])?a[i].concat(n):[a[i],n]:a[i]=n,!l):((!g.hasOwnProp(a,i)||!g.isObject(a[i]))&&(a[i]=[]),t(r,n,a[i],o)&&g.isArray(a[i])&&(a[i]=gc(a[i])),!l)}if(g.isFormData(e)&&g.isFunction(e.entries)){const r={};return g.forEachEntry(e,(n,a)=>{t(mc(n),a,r,0)}),r}return null}const Re=(e,t)=>e!=null&&g.hasOwnProp(e,t)?e[t]:void 0;function yc(e,t,r){if(g.isString(e))try{return(t||JSON.parse)(e),g.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}const vt={transitional:Ur,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){const n=r.getContentType()||"",a=n.indexOf("application/json")>-1,o=g.isObject(t);if(o&&g.isHTMLForm(t)&&(t=new FormData(t)),g.isFormData(t))return a?JSON.stringify(ba(t)):t;if(g.isArrayBuffer(t)||g.isBuffer(t)||g.isStream(t)||g.isFile(t)||g.isBlob(t)||g.isReadableStream(t))return t;if(g.isArrayBufferView(t))return t.buffer;if(g.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let l;if(o){const c=Re(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return hc(t,c).toString();if((l=g.isFileList(t))||n.indexOf("multipart/form-data")>-1){const d=Re(this,"env"),u=d&&d.FormData;return Xt(l?{"files[]":t}:t,u&&new u,c)}}return o||a?(r.setContentType("application/json",!1),yc(t)):t}],transformResponse:[function(t){const r=Re(this,"transitional")||vt.transitional,n=r&&r.forcedJSONParsing,a=Re(this,"responseType"),o=a==="json";if(g.isResponse(t)||g.isReadableStream(t))return t;if(t&&g.isString(t)&&(n&&!a||o)){const l=!(r&&r.silentJSONParsing)&&o;try{return JSON.parse(t,Re(this,"parseReviver"))}catch(c){if(l)throw c.name==="SyntaxError"?T.from(c,T.ERR_BAD_RESPONSE,this,null,Re(this,"response")):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:z.classes.FormData,Blob:z.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};g.forEach(["delete","get","head","post","put","patch","query"],e=>{vt.headers[e]={}});function Vr(e,t){const r=this||vt,n=t||r,a=R.from(n.headers);let o=n.data;return g.forEach(e,function(l){o=l.call(r,o,a.normalize(),t?t.status:void 0)}),a.normalize(),o}function va(e){return!!(e&&e.__CANCEL__)}let Ct=class extends T{constructor(t,r,n){super(t??"canceled",T.ERR_CANCELED,r,n),this.name="CanceledError",this.__CANCEL__=!0}};function Ca(e,t,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new T("Request failed with status code "+r.status,r.status>=400&&r.status<500?T.ERR_BAD_REQUEST:T.ERR_BAD_RESPONSE,r.config,r.request,r))}function wc(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}function bc(e,t){e=e||10;const r=new Array(e),n=new Array(e);let a=0,o=0,i;return t=t!==void 0?t:1e3,function(c){const d=Date.now(),u=n[o];i||(i=d),r[a]=c,n[a]=d;let p=o,y=0;for(;p!==a;)y+=r[p++],p=p%e;if(a=(a+1)%e,a===o&&(o=(o+1)%e),d-i<t)return;const S=u&&d-u;return S?Math.round(y*1e3/S):void 0}}function vc(e,t){let r=0,n=1e3/t,a,o;const i=(d,u=Date.now())=>{r=u,a=null,o&&(clearTimeout(o),o=null),e(...d)};return[(...d)=>{const u=Date.now(),p=u-r;p>=n?i(d,u):(a=d,o||(o=setTimeout(()=>{o=null,i(a)},n-p)))},()=>a&&i(a)]}const Qt=(e,t,r=3)=>{let n=0;const a=bc(50,250);return vc(o=>{if(!o||typeof o.loaded!="number")return;const i=o.loaded,l=o.lengthComputable?o.total:void 0,c=Math.max(0,l!=null?Math.min(i,l):i),d=Math.max(0,c-n),u=a(d);n=Math.max(n,c);const p={loaded:c,total:l,progress:l?c/l:void 0,bytes:d,rate:u||void 0,estimated:u&&l?(l-c)/u:void 0,event:o,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(p)},r)},Sa=(e,t)=>{const r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},Ea=(e,t=g.asap)=>(...r)=>t(()=>e(...r)),Cc=z.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,z.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(z.origin),z.navigator&&/(msie|trident)/i.test(z.navigator.userAgent)):()=>!0,Sc=z.hasStandardBrowserEnv?{write(e,t,r,n,a,o,i){if(typeof document>"u")return;const l=[`${e}=${encodeURIComponent(t)}`];g.isNumber(r)&&l.push(`expires=${new Date(r).toUTCString()}`),g.isString(n)&&l.push(`path=${n}`),g.isString(a)&&l.push(`domain=${a}`),o===!0&&l.push("secure"),g.isString(i)&&l.push(`SameSite=${i}`),document.cookie=l.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.split(";");for(let r=0;r<t.length;r++){const n=t[r].replace(/^\s+/,""),a=n.indexOf("=");if(a!==-1&&n.slice(0,a)===e)try{return decodeURIComponent(n.slice(a+1))}catch{return n.slice(a+1)}}return null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Ec(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function _c(e,t){if(!t)return e;let r=e.length;for(;r>0&&e.charCodeAt(r-1)===47;)r--;return e.slice(0,r)+"/"+t.replace(/^\/+/,"")}const Nc=/^https?:(?!\/\/)/i,Tc=/[\t\n\r]/g;function Lc(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}function Ac(e){return Lc(e).replace(Tc,"")}function Fc(e){return e&&e.replace(/(^|&)([^=&]*=)?[^&]+/g,(t,r,n="")=>`${r}${n}${Zt}`)}function Oc(e){const t=e.replace(/^(https?:\/{0,2})[^/?#]*@/i,`$1${Zt}@`),r=t.indexOf("#"),a=(r===-1?t:t.slice(0,r)).replace(/([?&][^=&#]*=)[^&#]*/g,`$1${Zt}`);return r===-1?a:`${a}#${Fc(t.slice(r+1))}`}function _a(e,t){if(typeof e=="string"){const r=Ac(e);if(Nc.test(r))throw new T(`Invalid URL ${JSON.stringify(Oc(r))}: missing "//" after protocol`,T.ERR_INVALID_URL,t)}}function Na(e,t,r,n){_a(t,n);let a=!Ec(t);return e&&(a||r===!1)?(_a(e,n),_c(e,t)):t}const Ta=e=>e instanceof R?{...e}:e,kc=e=>Object.getOwnPropertySymbols&&Object.getOwnPropertyDescriptor?Object.keys(e).concat(Object.getOwnPropertySymbols(e).filter(t=>Object.getOwnPropertyDescriptor(e,t).enumerable)):Object.keys(e);function ke(e,t){e=e||{},t=t||{};const r=Object.create(null);Object.defineProperty(r,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function n(u,p,y,S){return g.isPlainObject(u)&&g.isPlainObject(p)?g.merge.call({caseless:S},u,p):g.isPlainObject(p)?g.merge({},p):g.isArray(p)?p.slice():p}function a(u,p,y,S){if(g.isUndefined(p)){if(!g.isUndefined(u))return n(void 0,u,y,S)}else return n(u,p,y,S)}function o(u,p){if(!g.isUndefined(p))return n(void 0,p)}function i(u,p){if(g.isUndefined(p)){if(!g.isUndefined(u))return n(void 0,u)}else return n(void 0,p)}function l(u){const p=g.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!g.isUndefined(p))if(g.isPlainObject(p)){if(g.hasOwnProp(p,u))return p[u]}else return;const y=g.hasOwnProp(e,"transitional")?e.transitional:void 0;if(g.isPlainObject(y)&&g.hasOwnProp(y,u))return y[u]}function c(u,p,y){if(g.hasOwnProp(t,y))return n(u,p);if(g.hasOwnProp(e,y))return n(void 0,u)}const d={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,allowedSocketPaths:i,responseEncoding:i,validateStatus:c,headers:(u,p,y)=>a(Ta(u),Ta(p),y,!0)};return g.forEach(kc({...e,...t}),function(p){if(p==="__proto__"||p==="constructor"||p==="prototype")return;const y=g.hasOwnProp(d,p)?d[p]:a,S=g.hasOwnProp(e,p)?e[p]:void 0,v=g.hasOwnProp(t,p)?t[p]:void 0,w=y(S,v,p);g.isUndefined(w)&&y!==c||(r[p]=w)}),g.hasOwnProp(t,"validateStatus")&&g.isUndefined(t.validateStatus)&&l("validateStatusUndefinedResolves")===!1&&(g.hasOwnProp(e,"validateStatus")?r.validateStatus=n(void 0,e.validateStatus):delete r.validateStatus),r}const Dc=["content-type","content-length"];function xc(e,t,r){if(r!=="content-only"){e.set(t);return}Object.entries(t||{}).forEach(([n,a])=>{Dc.includes(n.toLowerCase())&&e.set(n,a)})}const Pc=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,r)=>String.fromCharCode(parseInt(r,16)));function La(e){const t=ke({},e),r=y=>g.hasOwnProp(t,y)?t[y]:void 0,n=r("data");let a=r("withXSRFToken");const o=r("xsrfHeaderName"),i=r("xsrfCookieName");let l=r("headers");const c=r("auth"),d=r("baseURL"),u=r("allowAbsoluteUrls"),p=r("url");if(t.headers=l=R.from(l),t.url=ma(Na(d,p,u,t),r("params"),r("paramsSerializer")),c){const y=g.getSafeProp(c,"username")||"",S=g.getSafeProp(c,"password")||"";try{l.set("Authorization","Basic "+btoa(y+":"+(S?Pc(S):"")))}catch(v){throw T.from(v,T.ERR_BAD_OPTION_VALUE,e)}}if(g.isFormData(n)&&(z.hasStandardBrowserEnv||z.hasStandardBrowserWebWorkerEnv||g.isReactNative(n)?l.setContentType(void 0):g.isFunction(n.getHeaders)&&xc(l,n.getHeaders(),r("formDataHeaderPolicy"))),z.hasStandardBrowserEnv&&(g.isFunction(a)&&(a=a(t)),a===!0||a==null&&Cc(t.url))){const S=o&&i&&Sc.read(i);S&&l.set(o,S)}return t}const Ic=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(r,n){const a=La(e);let o=a.data;const i=R.from(a.headers).normalize();let{responseType:l,onUploadProgress:c,onDownloadProgress:d}=a,u,p,y,S,v;function w(){S&&S(),v&&v(),a.cancelToken&&a.cancelToken.unsubscribe(u),a.signal&&a.signal.removeEventListener("abort",u)}let h=new XMLHttpRequest;h.open(a.method.toUpperCase(),a.url,!0),h.timeout=a.timeout;function m(){if(!h)return;const b=R.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),O={data:!l||l==="text"||l==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:b,config:e,request:h};Ca(function(P){r(P),w()},function(P){n(P),w()},O),h=null}"onloadend"in h?h.onloadend=m:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.startsWith("file:"))||setTimeout(m)},h.onabort=function(){h&&(n(new T("Request aborted",T.ECONNABORTED,e,h)),w(),h=null)},h.onerror=function(E){const O=E&&E.message?E.message:"Network Error",L=new T(O,T.ERR_NETWORK,e,h);L.event=E||null,n(L),w(),h=null},h.ontimeout=function(){let E=a.timeout?"timeout of "+a.timeout+"ms exceeded":"timeout exceeded";const O=a.transitional||Ur;a.timeoutErrorMessage&&(E=a.timeoutErrorMessage),n(new T(E,O.clarifyTimeoutError?T.ETIMEDOUT:T.ECONNABORTED,e,h)),w(),h=null},o===void 0&&i.setContentType(null),"setRequestHeader"in h&&g.forEach(la(i),function(E,O){h.setRequestHeader(O,E)}),g.isUndefined(a.withCredentials)||(h.withCredentials=!!a.withCredentials),l&&l!=="json"&&(h.responseType=a.responseType),d&&([y,v]=Qt(d,!0),h.addEventListener("progress",y)),c&&h.upload&&([p,S]=Qt(c),h.upload.addEventListener("progress",p),h.upload.addEventListener("loadend",S)),(a.cancelToken||a.signal)&&(u=b=>{h&&(n(!b||b.type?new Ct(null,e,h):b),h.abort(),w(),h=null)},a.cancelToken&&a.cancelToken.subscribe(u),a.signal&&(a.signal.aborted?u():a.signal.addEventListener("abort",u)));const f=wc(a.url);if(f&&!z.protocols.includes(f)){n(new T("Unsupported protocol "+f+":",T.ERR_BAD_REQUEST,e)),w();return}h.send(o||null)})},Mc=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const r=new AbortController;let n=!1;const a=function(c){if(!n){n=!0,i();const d=c instanceof Error?c:this.reason;r.abort(d instanceof T?d:new Ct(d instanceof Error?d.message:d))}};let o=t&&setTimeout(()=>{o=null,a(new T(`timeout of ${t}ms exceeded`,T.ETIMEDOUT))},t);const i=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(c=>{c.unsubscribe?c.unsubscribe(a):c.removeEventListener("abort",a)}),e=null)};e.forEach(c=>{if(!n){if(c.aborted){a.call(c);return}c.addEventListener("abort",a,{once:!0})}});const{signal:l}=r;return l.unsubscribe=()=>g.asap(i),l},Bc=function*(e,t){let r=e.byteLength;if(r<t){yield e;return}let n=0,a;for(;n<r;)a=n+t,yield e.slice(n,a),n=a},$c=async function*(e,t){for await(const r of Uc(e))yield*Bc(r,t)},Uc=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:r,value:n}=await t.read();if(r)break;yield n}}finally{await t.cancel()}},Aa=(e,t,r,n)=>{const a=$c(e,t);let o=0,i,l=c=>{i||(i=!0,n&&n(c))};return new ReadableStream({async pull(c){try{const{done:d,value:u}=await a.next();if(d){l(),c.close();return}let p=u.byteLength;if(r){let y=o+=p;r(y)}c.enqueue(new Uint8Array(u))}catch(d){throw l(d),d}},cancel(c){return l(c),a.return()}},{highWaterMark:2})},Fa=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,Oa=(e,t,r)=>t+2<r&&Fa(e.charCodeAt(t+1))&&Fa(e.charCodeAt(t+2)),ka=e=>e<=57?e-48:(e&223)-55,jc=e=>e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===43||e===47||e===45||e===95,qc=e=>e===9||e===10||e===12||e===13||e===32,Vc=e=>{const t=Math.floor(e/4),r=e%4;return t*3+(r===2?1:r===3?2:0)},Wc=e=>{const t=e.length;let r=0;return t>0&&e.charCodeAt(t-1)===61&&(r++,t>1&&e.charCodeAt(t-2)===61&&r++),Math.floor((t-r)*3/4)},Hc=e=>{const t=e.length;let r=0,n=0,a=!1;for(let o=0;o<t;o++){let i=e.charCodeAt(o);if(i===37&&Oa(e,o,t)&&(i=ka(e.charCodeAt(o+1))*16+ka(e.charCodeAt(o+2)),o+=2),!qc(i)){if(i===61){n++;continue}if(!jc(i)||n>0){a=!0;continue}r++}}return a||n>2||n>0&&(r+n)%4!==0||r%4===1?Wc(e):Vc(r)},zc=(e,t)=>{if(!e||typeof e!="string"||!e.startsWith("data:"))return 0;const r=e.indexOf(",");if(r<0)return 0;const n=e.slice(5,r),a=e.slice(r+1);if(/;base64/i.test(n))return t(a);let i=0;for(let l=0,c=a.length;l<c;l++){const d=a.charCodeAt(l);if(d===37&&Oa(a,l,c))i+=1,l+=2;else if(d<128)i+=1;else if(d<2048)i+=2;else if(d>=55296&&d<=56319&&l+1<c){const u=a.charCodeAt(l+1);u>=56320&&u<=57343?(i+=4,l++):i+=3}else i+=3}return i};function Kc(e){const t=typeof e=="string"?e.indexOf("#"):-1;return zc(t===-1?e:e.slice(0,t),Hc)}const Wr="1.19.0",Da=64*1024,{isFunction:Gt}=g,Jc=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,r)=>String.fromCharCode(parseInt(r,16))),xa=e=>{if(!g.isString(e))return e;try{return decodeURIComponent(e)}catch{return e}},Pa=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Rc=e=>{const t=e.indexOf("://");let r=e;return t!==-1&&(r=r.slice(t+3)),r.includes("@")||r.includes(":")},Zc=e=>{const t=g.global!==void 0&&g.global!==null?g.global:globalThis,{ReadableStream:r,TextEncoder:n}=t;e=g.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:a,Request:o,Response:i}=e,l=a?Gt(a):typeof fetch=="function",c=Gt(o),d=Gt(i);if(!l)return!1;const u=l&&Gt(r),p=l&&(typeof n=="function"?(m=>f=>m.encode(f))(new n):async m=>new Uint8Array(await new o(m).arrayBuffer())),y=c&&u&&Pa(()=>{let m=!1;const f=new o(z.origin,{body:new r,method:"POST",get duplex(){return m=!0,"half"}}),b=f.headers.has("Content-Type");return f.body!=null&&f.body.cancel(),m&&!b}),S=d&&u&&Pa(()=>g.isReadableStream(new i("").body)),v={stream:S&&(m=>m.body)};l&&["text","arrayBuffer","blob","formData","stream"].forEach(m=>{!v[m]&&(v[m]=(f,b)=>{let E=f&&f[m];if(E)return E.call(f);throw new T(`Response type '${m}' is not supported`,T.ERR_NOT_SUPPORT,b)})});const w=async m=>{if(m==null)return 0;if(g.isBlob(m))return m.size;if(g.isSpecCompliantForm(m))return(await new o(z.origin,{method:"POST",body:m}).arrayBuffer()).byteLength;if(g.isArrayBufferView(m)||g.isArrayBuffer(m))return m.byteLength;if(g.isURLSearchParams(m)&&(m=m+""),g.isString(m))return(await p(m)).byteLength},h=async(m,f)=>{const b=g.toFiniteNumber(m.getContentLength());return b??w(f)};return async m=>{let{url:f,method:b,data:E,signal:O,cancelToken:L,timeout:P,onDownloadProgress:q,onUploadProgress:k,responseType:A,headers:M,withCredentials:V="same-origin",fetchOptions:$,maxContentLength:K,maxBodyLength:X}=La(m);const F=g.isNumber(K)&&K>-1,U=g.isNumber(X)&&X>-1,Ee=j=>g.hasOwnProp(m,j)?m[j]:void 0;let _s=a||fetch;A=A?(A+"").toLowerCase():"text";let _e=Mc([O,L&&L.toAbortSignal()],P),J=null;const Ue=_e&&_e.unsubscribe&&(()=>{_e.unsubscribe()});let lt,$t=null;const Ns=()=>new T("Request body larger than maxBodyLength limit",T.ERR_BAD_REQUEST,m,J);try{let j;const ae=Ee("auth");if(ae){const D=g.getSafeProp(ae,"username")||"",ee=g.getSafeProp(ae,"password")||"";j={username:D,password:ee}}if(Rc(f)){const D=new URL(f,z.origin);if(!j&&(D.username||D.password)){const ee=xa(D.username),Ne=xa(D.password);j={username:ee,password:Ne}}(D.username||D.password)&&(D.username="",D.password="",f=D.href)}if(j&&(M.delete("authorization"),M.set("Authorization","Basic "+btoa(Jc((j.username||"")+":"+(j.password||""))))),F&&typeof f=="string"&&f.startsWith("data:")&&Kc(f)>K)throw new T("maxContentLength size of "+K+" exceeded",T.ERR_BAD_RESPONSE,m,J);if(U&&b!=="get"&&b!=="head"){const D=await w(E);if(typeof D=="number"&&isFinite(D)&&(lt=D,D>X))throw Ns()}const wr=U&&(g.isReadableStream(E)||g.isStream(E)),Ts=(D,ee,Ne)=>Aa(D,Da,je=>{if(U&&je>X)throw $t=Ns();ee&&ee(je)},Ne);if(y&&b!=="get"&&b!=="head"&&(k||wr)){if(lt=lt??await h(M,E),lt!==0||wr){let D=new o(f,{method:"POST",body:E,duplex:"half"}),ee;if(g.isFormData(E)&&(ee=D.headers.get("content-type"))&&M.setContentType(ee),D.body){const[Ne,je]=k&&Sa(lt,Qt(Ea(k)))||[];E=Ts(D.body,Ne,je)}}}else if(wr&&!c&&u&&b!=="get"&&b!=="head")E=Ts(E);else if(wr&&c&&!y&&b!=="get"&&b!=="head")throw new T("Stream request bodies are not supported by the current fetch implementation",T.ERR_NOT_SUPPORT,m,J);g.isString(V)||(V=V?"include":"omit");const Kf=c&&"credentials"in o.prototype;if(g.isFormData(E)){const D=M.getContentType();D&&/^multipart\/form-data/i.test(D)&&!/boundary=/i.test(D)&&M.delete("content-type")}M.set("User-Agent","axios/"+Wr,!1);const Ls={...$,signal:_e,method:b.toUpperCase(),headers:la(M.normalize()),body:E,duplex:"half",credentials:Kf?V:void 0};J=c&&new o(f,Ls);let ge=await(c?_s(J,$):_s(f,Ls));const As=R.from(ge.headers);if(F){const D=g.toFiniteNumber(As.getContentLength());if(D!=null&&D>K)throw new T("maxContentLength size of "+K+" exceeded",T.ERR_BAD_RESPONSE,m,J)}const Tn=S&&(A==="stream"||A==="response");if(S&&ge.body&&(q||F||Tn&&Ue)){const D={};["status","statusText","headers"].forEach(Ut=>{D[Ut]=ge[Ut]});const ee=g.toFiniteNumber(As.getContentLength()),[Ne,je]=q&&Sa(ee,Qt(Ea(q),!0))||[];let Fs=0;const Jf=Ut=>{if(F&&(Fs=Ut,Fs>K))throw new T("maxContentLength size of "+K+" exceeded",T.ERR_BAD_RESPONSE,m,J);Ne&&Ne(Ut)};ge=new i(Aa(ge.body,Da,Jf,()=>{je&&je(),Ue&&Ue()}),D)}A=A||"text";let ye=await v[g.findKey(v,A)||"text"](ge,m);if(F&&!S&&!Tn){let D;if(ye!=null&&(typeof ye.byteLength=="number"?D=ye.byteLength:typeof ye.size=="number"?D=ye.size:typeof ye=="string"&&(D=typeof n=="function"?new n().encode(ye).byteLength:ye.length)),typeof D=="number"&&D>K)throw new T("maxContentLength size of "+K+" exceeded",T.ERR_BAD_RESPONSE,m,J)}return!Tn&&Ue&&Ue(),await new Promise((D,ee)=>{Ca(D,ee,{data:ye,headers:R.from(ge.headers),status:ge.status,statusText:ge.statusText,config:m,request:J})})}catch(j){if(Ue&&Ue(),_e&&_e.aborted&&_e.reason instanceof T){const ae=_e.reason;throw ae.config=m,J&&(ae.request=J),j!==ae&&Object.defineProperty(ae,"cause",{__proto__:null,value:j,writable:!0,enumerable:!1,configurable:!0}),ae}if($t)throw J&&!$t.request&&($t.request=J),$t;if(j instanceof T)throw J&&!j.request&&(j.request=J),j;if(j&&j.name==="TypeError"&&/Load failed|fetch/i.test(j.message)){const ae=new T("Network Error",T.ERR_NETWORK,m,J,j&&j.response);throw Object.defineProperty(ae,"cause",{__proto__:null,value:j.cause||j,writable:!0,enumerable:!1,configurable:!0}),ae}throw T.from(j,j&&j.code,m,J,j&&j.response)}}},Xc=new Map,Ia=e=>{let t=e&&e.env||{};const{fetch:r,Request:n,Response:a}=t,o=[n,a,r];let i=o.length,l=i,c,d,u=Xc;for(;l--;)c=o[l],d=u.get(c),d===void 0&&u.set(c,d=l?new Map:Zc(t)),u=d;return d};Ia();const Hr={http:sc,xhr:Ic,fetch:{get:Ia}};g.forEach(Hr,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const Ma=e=>`- ${e}`,Qc=e=>g.isFunction(e)||e===null||e===!1;function Gc(e,t){e=g.isArray(e)?e:[e];const{length:r}=e;let n,a;const o={};for(let i=0;i<r;i++){n=e[i];let l;if(a=n,!Qc(n)&&(a=Hr[(l=String(n)).toLowerCase()],a===void 0))throw new T(`Unknown adapter '${l}'`);if(a&&(g.isFunction(a)||(a=a.get(t))))break;o[l||"#"+i]=a}if(!a){const i=Object.entries(o).map(([c,d])=>`adapter ${c} `+(d===!1?"is not supported by the environment":"is not available in the build"));let l=r?i.length>1?`since :
6
+ `+i.map(Ma).join(`
7
+ `):" "+Ma(i[0]):"as no adapter specified";throw new T("There is no suitable adapter to dispatch the request "+l,T.ERR_NOT_SUPPORT)}return a}const Ba={getAdapter:Gc,adapters:Hr};function zr(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Ct(null,e)}function Kr(e){return zr(e),e.headers=R.from(e.headers),e.data=Vr.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Ba.getAdapter(e.adapter||vt.adapter,e)(e).then(function(n){zr(e),e.response=n;try{n.data=Vr.call(e,e.transformResponse,n)}finally{delete e.response}return n.headers=R.from(n.headers),n},function(n){if(!va(n)&&(zr(e),n&&n.response)){e.response=n.response;try{n.response.data=Vr.call(e,e.transformResponse,n.response)}finally{delete e.response}n.response.headers=R.from(n.response.headers)}return Promise.reject(n)})}const Yt={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Yt[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const $a={};Yt.transitional=function(t,r,n){function a(o,i){return"[Axios v"+Wr+"] Transitional option '"+o+"'"+i+(n?". "+n:"")}return(o,i,l)=>{if(t===!1)throw new T(a(i," has been removed"+(r?" in "+r:"")),T.ERR_DEPRECATED);return r&&!$a[i]&&($a[i]=!0,console.warn(a(i," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(o,i,l):!0}},Yt.spelling=function(t){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};function Yc(e,t,r){if(typeof e!="object"||e===null)throw new T("options must be an object",T.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let a=n.length;for(;a-- >0;){const o=n[a],i=Object.prototype.hasOwnProperty.call(t,o)?t[o]:void 0;if(i){const l=e[o],c=l===void 0||i(l,o,e);if(c!==!0)throw new T("option "+o+" must be "+c,T.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new T("Unknown option "+o,T.ERR_BAD_OPTION)}}const er={assertOptions:Yc,validators:Yt},Z=er.validators;let De=class{constructor(t){this.defaults=t||{},this.interceptors={request:new ga,response:new ga}}async request(t,r){try{return await this._request(t,r)}catch(n){if(n instanceof Error){let a={};Error.captureStackTrace?Error.captureStackTrace(a):a=new Error;const o=(()=>{if(!a.stack)return"";const i=a.stack.indexOf(`
8
+ `);return i===-1?"":a.stack.slice(i+1)})();try{if(!n.stack)n.stack=o;else if(o){const i=o.indexOf(`
9
+ `),l=i===-1?-1:o.indexOf(`
10
+ `,i+1),c=l===-1?"":o.slice(l+1);String(n.stack).endsWith(c)||(n.stack+=`
11
+ `+o)}}catch{}}throw n}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=ke(this.defaults,r);const{transitional:n,paramsSerializer:a,headers:o}=r;n!==void 0&&er.assertOptions(n,{silentJSONParsing:Z.transitional(Z.boolean),forcedJSONParsing:Z.transitional(Z.boolean),clarifyTimeoutError:Z.transitional(Z.boolean),legacyInterceptorReqResOrdering:Z.transitional(Z.boolean),advertiseZstdAcceptEncoding:Z.transitional(Z.boolean),validateStatusUndefinedResolves:Z.transitional(Z.boolean)},!1),a!=null&&(g.isFunction(a)?r.paramsSerializer={serialize:a}:er.assertOptions(a,{encode:Z.function,serialize:Z.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),er.assertOptions(r,{baseUrl:Z.spelling("baseURL"),withXsrfToken:Z.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let i=o&&g.merge(o.common,o[r.method]);o&&g.forEach(["delete","get","head","post","put","patch","query","common"],v=>{delete o[v]}),r.headers=R.concat(i,o);const l=[];let c=!0;this.interceptors.request.forEach(function(w){if(typeof w.runWhen=="function"&&w.runWhen(r)===!1)return;c=c&&w.synchronous;const h=r.transitional||Ur;h&&h.legacyInterceptorReqResOrdering?l.unshift(w.fulfilled,w.rejected):l.push(w.fulfilled,w.rejected)});const d=[];this.interceptors.response.forEach(function(w){d.push(w.fulfilled,w.rejected)});let u,p=0,y;if(!c){const v=[Kr.bind(this),void 0];for(v.unshift(...l),v.push(...d),y=v.length,u=Promise.resolve(r);p<y;)u=u.then(v[p++],v[p++]);return u}y=l.length;let S=r;for(;p<y;){const v=l[p++],w=l[p++];try{S=v?v(S):S}catch(h){if(!w){u=Promise.reject(h);break}try{const m=w.call(this,h);g.isThenable(m)&&(u=Promise.resolve(m).then(()=>Kr.call(this,S)))}catch(m){u=Promise.reject(m)}break}}if(!u)try{u=Kr.call(this,S)}catch(v){u=Promise.reject(v)}for(p=0,y=d.length;p<y;)u=u.then(d[p++],d[p++]);return u}getUri(t){t=ke(this.defaults,t);const r=Na(t.baseURL,t.url,t.allowAbsoluteUrls,t);return ma(r,t.params,t.paramsSerializer)}};g.forEach(["delete","get","head","options"],function(t){De.prototype[t]=function(r,n){return this.request(ke(n||{},{method:t,url:r,data:n&&g.hasOwnProp(n,"data")?n.data:void 0}))}}),g.forEach(["post","put","patch","query"],function(t){function r(n){return function(o,i,l){return this.request(ke(l||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}De.prototype[t]=r(),t!=="query"&&(De.prototype[t+"Form"]=r(!0))});let ed=class ks{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(o){r=o});const n=this;this.promise.then(a=>{if(!n._listeners)return;let o=n._listeners.length;for(;o-- >0;)n._listeners[o](a);n._listeners=null}),this.promise.then=a=>{let o;const i=new Promise(l=>{n.subscribe(l),o=l}).then(a);return i.cancel=function(){n.unsubscribe(o)},i},t(function(o,i,l){n.reason||(n.reason=new Ct(o,i,l),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const t=new AbortController,r=n=>{t.abort(n)};return this.subscribe(r),t.signal.unsubscribe=()=>this.unsubscribe(r),t.signal}static source(){let t;return{token:new ks(function(a){t=a}),cancel:t}}};function td(e){return function(r){return e.apply(null,r)}}function rd(e){return g.isObject(e)&&e.isAxiosError===!0}const Jr={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerReturnsAnUnknownError:520,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Jr).forEach(([e,t])=>{Jr[t]=e});function Ua(e){const t=new De(e),r=Qn(De.prototype.request,t);return g.extend(r,De.prototype,t,{allOwnKeys:!0}),g.extend(r,t,null,{allOwnKeys:!0}),r.create=function(a){return Ua(ke(e,a))},r}const H=Ua(vt);H.Axios=De,H.CanceledError=Ct,H.CancelToken=ed,H.isCancel=va,H.VERSION=Wr,H.toFormData=Xt,H.AxiosError=T,H.Cancel=H.CanceledError,H.all=function(t){return Promise.all(t)},H.spread=td,H.isAxiosError=rd,H.mergeConfig=ke,H.AxiosHeaders=R,H.formToJSON=e=>ba(g.isHTMLForm(e)?new FormData(e):e),H.getAdapter=Ba.getAdapter,H.HttpStatusCode=Jr,H.default=H;const{Axios:rp,AxiosError:np,CanceledError:ap,isCancel:op,CancelToken:sp,VERSION:ip,all:lp,Cancel:cp,isAxiosError:dp,spread:up,toFormData:fp,AxiosHeaders:pp,HttpStatusCode:hp,formToJSON:mp,getAdapter:gp,mergeConfig:yp,create:wp}=H;function tr(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)n!=="__proto__"&&(e[n]=r[n])}return e}var nd={read:function(e){return e[0]==='"'&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function Rr(e,t){function r(a,o,i){if(!(typeof document>"u")){i=tr({},t,i),typeof i.expires=="number"&&(i.expires=new Date(Date.now()+i.expires*864e5)),i.expires&&(i.expires=i.expires.toUTCString()),a=encodeURIComponent(a).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var l="";for(var c in i)i[c]&&(l+="; "+c,i[c]!==!0&&(l+="="+i[c].split(";")[0]));return document.cookie=a+"="+e.write(o,a)+l}}function n(a){if(!(typeof document>"u"||arguments.length&&!a)){for(var o=document.cookie?document.cookie.split("; "):[],i={},l=0;l<o.length;l++){var c=o[l].split("="),d=c.slice(1).join("=");try{var u=decodeURIComponent(c[0]);if(u in i||(i[u]=e.read(d,u)),a===u)break}catch{}}return a?i[a]:i}}return Object.create({set:r,get:n,remove:function(a,o){r(a,"",tr({},o,{expires:-1}))},withAttributes:function(a){return Rr(this.converter,tr({},this.attributes,a))},withConverter:function(a){return Rr(tr({},this.converter,a),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(e)}})}var St=Rr(nd,{path:"/"});const ad={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};let Ze="https://api-grievance.airaops.com",ja=null;try{if(typeof{url:typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:br&&br.tagName.toUpperCase()==="SCRIPT"&&br.src||new URL("complaint-app.umd.js",document.baseURI).href}<"u"&&ad?.VITE_API_URL)Ze=void 0;else{const e=typeof process<"u"?process:null;e?.env?.VITE_API_URL&&(Ze=e.env.VITE_API_URL)}}catch{}const qa=e=>{Ze=e||"",I.defaults.baseURL=Ze},Zr=e=>{ja=e||null},od=()=>ja||St.get("token")||null,I=H.create({baseURL:Ze,headers:{Accept:"application/json","Content-Type":"application/json"}});I.interceptors.request.use(e=>{const t=od();return e.headers=e.headers||{},t?e.headers.Authorization=`Bearer ${t}`:delete e.headers.Authorization,e});let Xr=!1,Qr=null;I.interceptors.response.use(e=>e,async e=>{const t=e.config,r=e.response;if(r&&(r.status===401||r.status===402)){const n=St.get("refreshToken");if(n)try{Xr||(Xr=!0,Qr=H.post(`${Ze}/api/v1/auth/refresh`,{},{headers:{Authorization:`Bearer ${n}`}}));const a=await Qr,{token:o,refreshToken:i}=a.data;return Zr(o),i&&St.set("refreshToken",i),t.headers.Authorization=`Bearer ${o}`,I(t)}catch{St.remove("token"),St.remove("refreshToken")}finally{Xr=!1,Qr=null}}return Promise.reject(e)});const sd=N.createContext(null),Va=({children:e,apiUrl:t,authToken:r})=>(t&&qa(t),Zr(r||null),s.jsx(sd.Provider,{value:{apiUrl:t,authToken:r},children:e})),me={mode:"light",colors:{primary:"#2D64B8",primaryHover:"#2557A3",text:"#111827",textSecondary:"#6B7280",textMuted:"#9CA3AF",border:"#E5E7EB",borderLight:"#F3F4F6",background:"#FFFFFF",surface:"#FFFFFF",white:"#FFFFFF",onPrimary:"#FFFFFF",activeBg:"#ECFDF5",activeBorder:"#A7F3D0",activeText:"#059669",inactiveBg:"#F3F4F6",inactiveBorder:"#D1D5DB",inactiveText:"#6B7280",link:"#2D64B8",divider:"#E5E7EB",accentBorder:"#C5D7F0",accentBg:"#EEF4FB",stepDone:"#D6E4F7",success:"#22C55E",danger:"#EF4444",secondaryBtn:"#D1D5DB",secondaryBtnHover:"#C4C9D1",inputBg:"#FFFFFF",tableHeadBg:"#EEF4FB",sidebarBg:"#FAFBFD",overlay:"rgba(16, 24, 40, 0.06)"},radii:{sm:"6px",md:"8px",lg:"12px",xl:"16px",pill:"999px"},spacing:{xs:"4px",sm:"8px",md:"12px",lg:"16px",xl:"24px",xxl:"32px"},typography:{fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',h1Size:"28px",h2Size:"16px",bodySize:"14px",labelSize:"13px",valueSize:"22px",smallSize:"13px"},shadow:{card:"0 1px 2px rgba(16, 24, 40, 0.04)",settings:"0 1px 3px rgba(16, 24, 40, 0.06)"}},Et={mode:"dark",colors:{primary:"#5B8DEF",primaryHover:"#7BA3F3",text:"#F3F4F6",textSecondary:"#A1A1AA",textMuted:"#71717A",border:"#3F3F46",borderLight:"#27272A",background:"#0F1115",surface:"#18181B",white:"#FFFFFF",onPrimary:"#FFFFFF",activeBg:"#052E1C",activeBorder:"#166534",activeText:"#4ADE80",inactiveBg:"#27272A",inactiveBorder:"#3F3F46",inactiveText:"#A1A1AA",link:"#7BA3F3",divider:"#3F3F46",accentBorder:"#2A3A55",accentBg:"#1A2333",stepDone:"#1E3A5F",success:"#22C55E",danger:"#F87171",secondaryBtn:"#3F3F46",secondaryBtnHover:"#52525B",inputBg:"#18181B",tableHeadBg:"#1A2333",sidebarBg:"#12141A",overlay:"rgba(0, 0, 0, 0.35)"},radii:{sm:"6px",md:"8px",lg:"12px",xl:"16px",pill:"999px"},spacing:{xs:"4px",sm:"8px",md:"12px",lg:"16px",xl:"24px",xxl:"32px"},typography:{fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',h1Size:"28px",h2Size:"16px",bodySize:"14px",labelSize:"13px",valueSize:"22px",smallSize:"13px"},shadow:{card:"0 1px 2px rgba(0, 0, 0, 0.35)",settings:"0 1px 3px rgba(0, 0, 0, 0.4)"}},Wa={light:me,dark:Et};function Xe(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)}function Qe(e,t){if(!Xe(t))return e;const r={...e};return Object.keys(t).forEach(n=>{const a=t[n];Xe(a)&&Xe(e[n])?r[n]=Qe(e[n],a):a!==void 0&&(r[n]=a)}),r}function Ha(e){return!e||!Xe(e)?{light:me,dark:Et}:Xe(e.light)||Xe(e.dark)?{light:Qe(me,e.light||{}),dark:Qe(Et,e.dark||{})}:{light:Qe(me,e),dark:Qe(Et,e)}}function za(e,t=!1){const r=Ha(e);return{...t?r.dark:r.light,mode:t?"dark":"light",__pack:r}}const id={primary:"--ca-primary",primaryHover:"--ca-primary-hover",text:"--ca-text",textSecondary:"--ca-text-secondary",textMuted:"--ca-text-muted",border:"--ca-border",borderLight:"--ca-border-light",background:"--ca-bg",surface:"--ca-surface",white:"--ca-white",onPrimary:"--ca-on-primary",activeBg:"--ca-active-bg",activeBorder:"--ca-active-border",activeText:"--ca-active-text",inactiveBg:"--ca-inactive-bg",inactiveBorder:"--ca-inactive-border",inactiveText:"--ca-inactive-text",link:"--ca-link",divider:"--ca-divider",accentBorder:"--ca-accent-border",accentBg:"--ca-accent-bg",stepDone:"--ca-step-done",success:"--ca-success",danger:"--ca-danger",secondaryBtn:"--ca-secondary-btn",secondaryBtnHover:"--ca-secondary-btn-hover",inputBg:"--ca-input-bg",tableHeadBg:"--ca-table-head-bg",sidebarBg:"--ca-sidebar-bg",overlay:"--ca-overlay"},ld={sm:"--ca-radius-sm",md:"--ca-radius-md",lg:"--ca-radius-lg",xl:"--ca-radius-xl",pill:"--ca-radius-pill"},cd={fontFamily:"--ca-font",h1Size:"--ca-h1-size",h2Size:"--ca-h2-size",bodySize:"--ca-body-size",labelSize:"--ca-label-size",valueSize:"--ca-value-size",smallSize:"--ca-small-size"},dd={card:"--ca-shadow-card",settings:"--ca-shadow-settings"};function Ka(e){const t={};return e?.colors&&Object.entries(id).forEach(([r,n])=>{e.colors[r]!=null&&(t[n]=e.colors[r])}),e?.radii&&Object.entries(ld).forEach(([r,n])=>{e.radii[r]!=null&&(t[n]=e.radii[r])}),e?.typography&&Object.entries(cd).forEach(([r,n])=>{e.typography[r]!=null&&(t[n]=e.typography[r])}),e?.shadow&&Object.entries(dd).forEach(([r,n])=>{e.shadow[r]!=null&&(t[n]=e.shadow[r])}),t["--ca-on-primary"]&&!t["--ca-white"]&&(t["--ca-white"]=t["--ca-on-primary"]),t}const Ja=N.createContext({darkMode:!1,theme:null,themeFile:Wa,cssVars:{}});function Ra({theme:e,darkMode:t=!1,children:r}){const n=N.useMemo(()=>{const a=za(e,!!t),o=Ka(a);return{darkMode:!!t,theme:a,themeFile:a.__pack,cssVars:o,mode:a.mode}},[e,t]);return s.jsx(Ja.Provider,{value:n,children:r})}function Za(){return N.useContext(Ja)}const ud=32,G=Object.freeze({types:"/api/v1/complaints/types",departments:"/api/v1/complaints/departments",departmentTree:"/api/v1/complaints/departments/tree",priorities:"/api/v1/complaints/priorities",workflows:"/api/v1/complaints/workflows",workflowSteps:"/api/v1/complaints/workflows/steps",statuses:"/api/v1/complaints/statuses",formFields:e=>`/api/v1/complaint-types/${e}/form-fields`}),fd=e=>{const t=e?.response?.data,r=t?.message??t?.error??e?.message;return Array.isArray(r)?r.filter(Boolean).join(", "):r&&typeof r=="object"?r.message??JSON.stringify(r):r||"Something went wrong"},pd=(e,t)=>t.rejectWithValue({status:e?.response?.status??e?.status,message:fd(e)}),ne=(e,t)=>W.createAsyncThunk(e,async(r,n)=>{try{return(await t(r,n)).data}catch(a){return pd(a,n)}}),_t=(e,t)=>({list:ne(`complaint/${e}/list`,(r,{signal:n})=>I.get(t,{params:r,signal:n})),getById:ne(`complaint/${e}/getById`,(r,{signal:n})=>I.get(`${t}/${r}`,{signal:n})),create:ne(`complaint/${e}/create`,r=>I.post(t,r)),update:ne(`complaint/${e}/update`,({id:r,data:n})=>I.patch(`${t}/${r}`,n)),remove:ne(`complaint/${e}/remove`,r=>I.delete(`${t}/${r}`))}),xe=_t("types",G.types),Pe=_t("departments",G.departments),Ie=_t("priorities",G.priorities),Me=_t("workflows",G.workflows),Be=_t("statuses",G.statuses),rr=ne("complaint/departments/getTree",(e,{signal:t})=>I.get(G.departmentTree,{signal:t})),nr=ne("complaint/workflows/getSteps",(e,{signal:t})=>I.get(`${G.workflowSteps}/${e}`,{signal:t})),ve=ne("complaint/types/getFormFields",(e,{signal:t})=>I.get(G.formFields(e),{signal:t})),Nt=ne("complaint/types/saveFormFields",({complaintTypeId:e,data:t})=>I.put(G.formFields(e),t)),Ge=ne("complaint/types/deleteFormField",({complaintTypeId:e,fieldId:t})=>I.delete(`${G.formFields(e)}/${t}`)),ar=ne("complaint/workflows/saveSteps",e=>I.post(G.workflowSteps,e)),Xa=ne("complaint/workflows/deleteSteps",e=>I.delete(`${G.workflowSteps}/${e}`)),hd=xe.list,md=xe.getById,gd=xe.create,yd=xe.update,wd=xe.remove,bd=Pe.list,vd=Pe.getById,Cd=Pe.create,Sd=Pe.update,Ed=Pe.remove,_d=Ie.list,Nd=Ie.getById,Td=Ie.create,Ld=Ie.update,Ad=Ie.remove,Fd=Me.list,Od=Me.getById,kd=Me.create,Dd=Me.update,xd=Me.remove,Pd=Be.list,Id=Be.getById,Md=Be.create,Bd=Be.update,$d=Be.remove,Ye=()=>({data:[],selected:null,pagination:null,isLoading:!1,isMutating:!1,error:null}),Qa={types:Ye(),departments:Ye(),priorities:Ye(),workflows:Ye(),statuses:Ye(),formFields:Ye(),departmentTree:[],workflowSteps:{},isLoadingDepartmentTree:!1,isLoadingWorkflowSteps:!1,error:null},Ga=e=>{if(Array.isArray(e))return{data:e,pagination:null};const t=e?.data??e;return Array.isArray(t)?{data:t,pagination:e?.pagination??null}:{data:t?.results??t?.items??[],pagination:t?.pagination??e?.pagination??null}},Tt=e=>e?.data??e,or=e=>e?.id??e?._id,Ud=(e,t)=>{if(!t||typeof t!="object")return e;const r=or(t);if(r==null)return e;const n=e.findIndex(o=>or(o)===r);if(n<0)return[t,...e];const a=[...e];return a[n]=t,a},ce=e=>e.payload?.message??e.error?.message??"Something went wrong",Lt=(e,t,r)=>{e.addCase(r.list.pending,n=>{n[t].isLoading=!0,n[t].error=null}).addCase(r.list.fulfilled,(n,a)=>{const o=Ga(a.payload);n[t].isLoading=!1,n[t].data=o.data,n[t].pagination=o.pagination}).addCase(r.list.rejected,(n,a)=>{n[t].isLoading=!1,n[t].error=ce(a)}).addCase(r.getById.pending,n=>{n[t].isLoading=!0,n[t].error=null}).addCase(r.getById.fulfilled,(n,a)=>{n[t].isLoading=!1,n[t].selected=Tt(a.payload)}).addCase(r.getById.rejected,(n,a)=>{n[t].isLoading=!1,n[t].error=ce(a)}),[r.create,r.update].forEach(n=>{e.addCase(n.pending,a=>{a[t].isMutating=!0,a[t].error=null}).addCase(n.fulfilled,(a,o)=>{const i=Tt(o.payload);a[t].isMutating=!1,a[t].selected=i,a[t].data=Ud(a[t].data,i)}).addCase(n.rejected,(a,o)=>{a[t].isMutating=!1,a[t].error=ce(o)})}),e.addCase(r.remove.pending,n=>{n[t].isMutating=!0,n[t].error=null}).addCase(r.remove.fulfilled,(n,a)=>{const o=a.meta.arg;n[t].isMutating=!1,n[t].data=n[t].data.filter(i=>or(i)!==o),or(n[t].selected)===o&&(n[t].selected=null)}).addCase(r.remove.rejected,(n,a)=>{n[t].isMutating=!1,n[t].error=ce(a)})},Ya=W.createSlice({name:"complaintAppComplaint",initialState:Qa,reducers:{clearComplaintError(e,t){const r=t.payload;r&&e[r]?.error!==void 0?e[r].error=null:e.error=null},clearSelectedComplaintResource(e,t){const r=t.payload;r&&e[r]?.selected!==void 0&&(e[r].selected=null)},resetComplaintState(){return Qa}},extraReducers:e=>{Lt(e,"types",xe),Lt(e,"departments",Pe),Lt(e,"priorities",Ie),Lt(e,"workflows",Me),Lt(e,"statuses",Be),e.addCase(rr.pending,t=>{t.isLoadingDepartmentTree=!0,t.error=null}).addCase(rr.fulfilled,(t,r)=>{t.isLoadingDepartmentTree=!1;const n=Tt(r.payload);t.departmentTree=Array.isArray(n)?n:n?.tree??n?.items??[]}).addCase(rr.rejected,(t,r)=>{t.isLoadingDepartmentTree=!1,t.error=ce(r)}).addCase(nr.pending,t=>{t.isLoadingWorkflowSteps=!0,t.error=null}).addCase(nr.fulfilled,(t,r)=>{t.isLoadingWorkflowSteps=!1,t.workflowSteps[r.meta.arg]=Tt(r.payload)}).addCase(nr.rejected,(t,r)=>{t.isLoadingWorkflowSteps=!1,t.error=ce(r)}).addCase(ar.pending,t=>{t.isLoadingWorkflowSteps=!0,t.error=null}).addCase(ar.fulfilled,(t,r)=>{t.isLoadingWorkflowSteps=!1;const n=Tt(r.payload),a=r.meta.arg?.workflowId??n?.workflowId??n?.id;a!==void 0&&(t.workflowSteps[a]=n)}).addCase(ar.rejected,(t,r)=>{t.isLoadingWorkflowSteps=!1,t.error=ce(r)}).addCase(Xa.fulfilled,(t,r)=>{delete t.workflowSteps[r.meta.arg]}).addCase(ve.pending,t=>{t.formFields.isLoading=!0,t.formFields.error=null}).addCase(ve.fulfilled,(t,r)=>{const n=Ga(r.payload);t.formFields.isLoading=!1,t.formFields.data=n.data}).addCase(ve.rejected,(t,r)=>{t.formFields.isLoading=!1,t.formFields.error=ce(r)}).addCase(Nt.pending,t=>{t.formFields.isMutating=!0,t.formFields.error=null}).addCase(Nt.fulfilled,t=>{t.formFields.isMutating=!1}).addCase(Nt.rejected,(t,r)=>{t.formFields.isMutating=!1,t.formFields.error=ce(r)}).addCase(Ge.pending,t=>{t.formFields.isMutating=!0,t.formFields.error=null}).addCase(Ge.fulfilled,(t,r)=>{const n=r.meta.arg?.fieldId;t.formFields.isMutating=!1,t.formFields.data=t.formFields.data.filter(a=>a.id!==n)}).addCase(Ge.rejected,(t,r)=>{t.formFields.isMutating=!1,t.formFields.error=ce(r)})}}),{clearComplaintError:jd,clearSelectedComplaintResource:qd,resetComplaintState:Vd}=Ya.actions,eo=Ya.reducer,At="/api/v1/complaint-types",Ft=(e,t)=>t.rejectWithValue({status:e?.response?.status??e?.status,message:e?.response?.data?.message??e?.response?.data?.error??e?.message??"Something went wrong"}),sr=W.createAsyncThunk("complaintType/fetchAll",async(e,t)=>{try{const r=await I.get(At);return console.log("[fetchComplaintTypes] API response:",r.data),r.data}catch(r){return console.error("[fetchComplaintTypes] API request failed:",r),Ft(r,t)}}),ir=W.createAsyncThunk("complaintType/fetchById",async(e,t)=>{try{return(await I.get(`${At}/${e}`)).data}catch(r){return Ft(r,t)}}),Ot=W.createAsyncThunk("complaintType/create",async({payload:e,onSuccess:t,onFail:r},n)=>{try{const a={code:e.categoryName,name:e.categoryName,description:e.description,tatMinutes:e.tatMinutes,isActive:e.active,accessType:e.visibilityType,roleIds:e.roles.map(i=>parseInt(i,10))},o=await I.post(At,a);return t&&typeof t=="function"&&t(o.data),o.data}catch(a){return console.log("createComplaintType error:",a),r&&typeof r=="function"&&r(a),Ft(a,n)}}),kt=W.createAsyncThunk("complaintType/update",async({id:e,data:t,onSuccess:r,onFail:n},a)=>{try{const o=await I.patch(`${At}/${e}`,t);return r&&typeof r=="function"&&r(o.data),o.data}catch(o){return console.log("updateComplaintType error:",o),n&&typeof n=="function"&&n(o),Ft(o,a)}}),Gr=W.createAsyncThunk("complaintType/delete",async(e,t)=>{try{const r=await I.delete(`${At}/${e}`);return{id:e,data:r.data}}catch(r){return Ft(r,t)}}),to={complaintList:[],selected:null,loading:!1,saving:!1,error:null},Wd=["data","items","results","content","records","list","payload","response","result"],ro=e=>{if(Array.isArray(e))return e;if(!e||typeof e!="object")return[];for(const t of Wd)if(e[t]!==void 0){const r=ro(e[t]);if(r.length||Array.isArray(e[t]))return r}return[]},no=W.createSlice({name:"complaintType",initialState:to,reducers:{clearComplaintTypeError(e){e.error=null},clearSelectedComplaintType(e){e.selected=null},resetComplaintTypeState(){return to}},extraReducers:e=>{e.addCase(sr.pending,t=>{console.log("fetchComplaintTypes.pending"),t.loading=!0,t.error=null}).addCase(sr.fulfilled,(t,r)=>{t.loading=!1,t.complaintList=ro(r.payload),console.log(t.complaintList,"state.complaintList")}).addCase(sr.rejected,(t,r)=>{t.loading=!1,t.error=r.payload?.message??r.error?.message??"Failed to fetch complaint types"}).addCase(ir.pending,t=>{t.loading=!0,t.error=null}).addCase(ir.fulfilled,(t,r)=>{t.loading=!1,t.selected=r.payload?.data??r.payload}).addCase(ir.rejected,(t,r)=>{t.loading=!1,t.error=r.payload?.message??r.error?.message??"Failed to fetch complaint type"}).addCase(Ot.pending,t=>{t.saving=!0,t.error=null}).addCase(Ot.fulfilled,(t,r)=>{t.saving=!1;const n=r.payload?.data??r.payload;t.complaintList=[n,...t.complaintList.filter(a=>a?.id!==n?.id)],t.selected=n}).addCase(Ot.rejected,(t,r)=>{t.saving=!1,t.error=r.payload?.message??r.error?.message??"Failed to create complaint type"}).addCase(kt.pending,t=>{t.saving=!0,t.error=null}).addCase(kt.fulfilled,(t,r)=>{t.saving=!1;const n=r.payload?.data??r.payload;t.complaintList=t.complaintList.map(a=>a?.id===n?.id?n:a),t.selected=n}).addCase(kt.rejected,(t,r)=>{t.saving=!1,t.error=r.payload?.message??r.error?.message??"Failed to update complaint type"}).addCase(Gr.pending,t=>{t.saving=!0,t.error=null}).addCase(Gr.fulfilled,(t,r)=>{t.saving=!1;const n=r.payload?.id??r.meta?.arg;t.complaintList=t.complaintList.filter(a=>a?.id!==n),t.selected?.id===n&&(t.selected=null)}).addCase(Gr.rejected,(t,r)=>{t.saving=!1,t.error=r.payload?.message??r.error?.message??"Failed to delete complaint type"})}}),{clearComplaintTypeError:bp,clearSelectedComplaintType:vp,resetComplaintTypeState:Cp}=no.actions,Hd=no.reducer,zd={details:{},id:null,isEdit:!1},ao=W.createSlice({name:"appDetails",initialState:zd,reducers:{setAppDetails(e,t){e.details=t.payload??{}},clearAppDetails(e){e.details={}},setId(e,t){e.id=t.payload},setIsEdit(e,t){console.log("setIsEdit called with payload:",t.payload),e.isEdit=t.payload.data,console.log("isEdit state updated to:",e.isEdit)},clearId(e){e.id=null}}}),{setAppDetails:oo,clearAppDetails:Kd,id:Sp,setId:et,setIsEdit:Dt,isEdit:Ep,clearId:Jd}=ao.actions,so=ao.reducer,Rd="https://api.airaops.com/api/v1/roles",Yr=W.createAsyncThunk("roles/fetchHallRoles",async(e,{rejectWithValue:t,signal:r})=>{try{const n=await I.get(Rd,{params:{page:1,limit:50},signal:r});return console.log(n.data,"response.data##########"),n.data}catch(n){return n?.name==="CanceledError"||r?.aborted?t("Request cancelled"):t(n?.response?.data?.message??n?.response?.data?.error??n?.message??"Failed to fetch hall roles")}}),io={list:[],pagination:null,isLoading:!1,error:null},en=W.createSlice({name:"roles",initialState:io,reducers:{clearRolesError:e=>{e.error=null},resetRolesState:()=>io},extraReducers:e=>{e.addCase(Yr.pending,t=>{t.isLoading=!0,t.error=null}).addCase(Yr.fulfilled,(t,r)=>{t.isLoading=!1;const n=r.payload,a=n?.data??n?.results??n?.items??n??[];t.list=Array.isArray(a)?a:[],t.pagination=n?.pagination??n?.meta??null}).addCase(Yr.rejected,(t,r)=>{t.isLoading=!1,t.error=r.payload||r.error?.message||"Failed to fetch hall roles"})}}),{clearRolesError:_p,resetRolesState:Np}=en.actions;en.reducer;const xt="/api/v1/complaint-types/30/workflow-steps",lo=e=>`/api/v1/complaint-types/${e}/workflow-steps`,$e=(e,t)=>t.rejectWithValue({status:e?.response?.status??e?.status,message:e?.response?.data?.message??e?.response?.data?.error??e?.message??"Something went wrong"}),tn=W.createAsyncThunk("workflow/fetchAll",async(e,t)=>{try{return(await I.get(xt)).data}catch(r){return $e(r,t)}}),rn=W.createAsyncThunk("workflow/fetchById",async(e,t)=>{try{return(await I.get(`${xt}/${e}`)).data}catch(r){return $e(r,t)}}),lr=W.createAsyncThunk("workflow/fetchSteps",async(e,t)=>{try{return(await I.get(lo(e))).data}catch(r){return $e(r,t)}}),cr=W.createAsyncThunk("workflow/updateSteps",async({id:e,tables:t,onSuccess:r,onFail:n},a)=>{console.log("tables:",t),console.log("is array:",Array.isArray(t.tables));try{if(!Array.isArray(t.tables))throw new Error("tables must be an array");const o=t.tables.map((l,c)=>({levelNo:c+1,roleIds:Array.isArray(l.role)?l.role.map(d=>Number(d)):[],escalateAfterMinutes:l.escalateAfterMinutes,canResolve:l.canResolve,canReassign:l.canReassign,isFinalLevel:l.finalLevel,isActive:!0}));console.log("steps:",o);const i=await I.put(lo(e),{steps:o});return typeof r=="function"&&r(i.data),i.data}catch(o){return typeof n=="function"&&n(o),$e(o,a)}}),nn=W.createAsyncThunk("workflow/create",async({payload:e,onSuccess:t,onFail:r},n)=>{try{const a={code:e.categoryName,name:e.categoryName,description:e.description,tatMinutes:e.tatMinutes,isActive:e.active,accessType:"INTERNAL_LOGIN",roleIds:[]},o=await I.post(xt,a);return t&&typeof t=="function"&&t(o.data),o.data}catch(a){return console.log("createWorkflow error:",a),r&&typeof r=="function"&&r(a),$e(a,n)}}),an=W.createAsyncThunk("workflow/update",async({id:e,data:t,onSuccess:r,onFail:n},a)=>{try{const o=await I.patch(`${xt}/${e}`,t);return r&&typeof r=="function"&&r(o.data),o.data}catch(o){return console.log("updateWorkflow error:",o),n&&typeof n=="function"&&n(o),$e(o,a)}}),on=W.createAsyncThunk("workflow/delete",async(e,t)=>{try{const r=await I.delete(`${xt}/${e}`);return{id:e,data:r.data}}catch(r){return $e(r,t)}}),co={items:[],selected:null,loading:!1,saving:!1,workflowSteps:null,workflowStepsLoading:!1,workflowStepsSaving:!1,error:null},uo=W.createSlice({name:"workflow",initialState:co,reducers:{clearWorkflowError(e){e.error=null},clearSelectedWorkflow(e){e.selected=null},resetWorkflowState(){return co}},extraReducers:e=>{e.addCase(tn.pending,t=>{t.loading=!0,t.error=null}).addCase(tn.fulfilled,(t,r)=>{t.loading=!1,t.items=Array.isArray(r.payload)?r.payload:r.payload?.data??r.payload?.items??[]}).addCase(tn.rejected,(t,r)=>{t.loading=!1,t.error=r.payload?.message??r.error?.message??"Failed to fetch workflows"}).addCase(rn.pending,t=>{t.loading=!0,t.error=null}).addCase(rn.fulfilled,(t,r)=>{t.loading=!1,t.selected=r.payload?.data??r.payload}).addCase(rn.rejected,(t,r)=>{t.loading=!1,t.error=r.payload?.message??r.error?.message??"Failed to fetch workflow by ID"}).addCase(lr.pending,t=>{t.workflowStepsLoading=!0,t.error=null}).addCase(lr.fulfilled,(t,r)=>{t.workflowStepsLoading=!1,t.workflowSteps=r.payload?.data??r.payload}).addCase(lr.rejected,(t,r)=>{t.workflowStepsLoading=!1,t.error=r.payload?.message??r.error?.message??"Failed to fetch workflow steps"}).addCase(cr.pending,t=>{t.workflowStepsSaving=!0,t.error=null}).addCase(cr.fulfilled,(t,r)=>{t.workflowStepsSaving=!1,t.workflowSteps=r.payload?.data??r.payload}).addCase(cr.rejected,(t,r)=>{t.workflowStepsSaving=!1,t.error=r.payload?.message??r.error?.message??"Failed to update workflow steps"}).addCase(nn.pending,t=>{t.saving=!0,t.error=null}).addCase(nn.fulfilled,(t,r)=>{t.saving=!1;const n=r.payload?.data??r.payload;t.items=[n,...t.items.filter(a=>a?.id!==n?.id)],t.selected=n}).addCase(nn.rejected,(t,r)=>{t.saving=!1,t.error=r.payload?.message??r.error?.message??"Failed to create workflow"}).addCase(an.pending,t=>{t.saving=!0,t.error=null}).addCase(an.fulfilled,(t,r)=>{t.saving=!1;const n=r.payload?.data??r.payload;t.items=t.items.map(a=>a?.id===n?.id?n:a),t.selected=n}).addCase(an.rejected,(t,r)=>{t.saving=!1,t.error=r.payload?.message??r.error?.message??"Failed to update workflow"}).addCase(on.pending,t=>{t.saving=!0,t.error=null}).addCase(on.fulfilled,(t,r)=>{t.saving=!1;const n=r.payload?.id??r.meta?.arg;t.items=t.items.filter(a=>a?.id!==n),t.selected?.id===n&&(t.selected=null)}).addCase(on.rejected,(t,r)=>{t.saving=!1,t.error=r.payload?.message??r.error?.message??"Failed to delete workflow"})}}),{clearWorkflowError:Tp,clearSelectedWorkflow:Lp,resetWorkflowState:Ap}=uo.actions,Zd=uo.reducer,Xd="/api/v1/complaints",Qd=(e,t)=>t.rejectWithValue({status:e?.response?.status??e?.status,message:e?.response?.data?.message??e?.response?.data?.error??e?.message??"Something went wrong"}),dr=W.createAsyncThunk("queryManagement/fetchQueries",async(e,t)=>{try{const{complaintTypeId:r,page:n=1,limit:a=10}=e||{};return(await I.get(Xd,{params:{page:n,limit:a,complaintTypeId:r},signal:t.signal})).data}catch(r){return Qd(r,t)}}),fo={list:[],meta:null,isLoading:!1,error:null,hasLoaded:!1},Gd=e=>{const t=e?.data??e;if(Array.isArray(t))return{list:t,meta:e?.meta??e?.pagination??null};const r=t?.data??t?.results??t?.items??[];return{list:Array.isArray(r)?r:[],meta:t?.meta??t?.pagination??e?.meta??e?.pagination??null}},Yd=e=>e.payload?.message??e.error?.message??"Failed to fetch queries",po=W.createSlice({name:"queryManagement",initialState:fo,reducers:{clearQueryManagementError:e=>{e.error=null},resetQueryManagementState:()=>fo},extraReducers:e=>{e.addCase(dr.pending,t=>{t.isLoading=!0,t.error=null}).addCase(dr.fulfilled,(t,r)=>{const n=Gd(r.payload);t.isLoading=!1,t.hasLoaded=!0,t.list=n.list,t.meta=n.meta}).addCase(dr.rejected,(t,r)=>{t.isLoading=!1,t.hasLoaded=!0,t.error=Yd(r)})}}),{clearQueryManagementError:Fp,resetQueryManagementState:Op}=po.actions,eu=po.reducer,tu=W.combineReducers({complaintAppComplaint:eo,complaintType:Hd,appDetails:so,workflow:Zd,roles:en.reducer,queryManagement:eu}),ho=e=>W.configureStore({reducer:tu,preloadedState:e,middleware:t=>t({immutableCheck:!1,serializableCheck:!1})}),mo=ho();function Y({children:e,variant:t="primary",size:r="md",startIcon:n,endIcon:a,className:o="",type:i="button",disabled:l=!1,onClick:c,...d}){const u=["ca-btn",`ca-btn--${t}`,r==="sm"?"ca-btn--sm":"",r==="lg"?"ca-btn--lg":"",o].filter(Boolean).join(" ");return s.jsxs("button",{type:i,className:u,disabled:l,onClick:c,...d,children:[n?s.jsx("span",{className:"ca-btn__icon",children:n}):null,e,a?s.jsx("span",{className:"ca-btn__icon",children:a}):null]})}function go({size:e=16,color:t="currentColor",...r}){return s.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",...r,children:s.jsx("path",{d:"M12 5v14M5 12h14",stroke:t,strokeWidth:"2",strokeLinecap:"round"})})}const yo={h1:"ca-h1",h2:"ca-h2",body:"ca-body",label:"ca-label",value:"ca-value",small:"ca-small",link:"ca-link"},ru={h1:"h1",h2:"h2",body:"p",label:"span",value:"span",small:"span",link:"button"};function Ce({variant:e="body",as:t,className:r="",children:n,...a}){const o=t||ru[e]||"p",i=yo[e]||yo.body;return s.jsx(o,{className:`${i} ${r}`.trim(),...a,children:n})}function sn(e){return s.jsx(Ce,{variant:"h1",...e})}function ln(e){return s.jsx(Ce,{variant:"h2",...e})}function ur(e){return s.jsx(Ce,{variant:"body",...e})}function wo(e){return s.jsx(Ce,{variant:"label",...e})}function bo(e){return s.jsx(Ce,{variant:"value",...e})}function nu(e){return s.jsx(Ce,{variant:"link",type:"button",...e})}function vo({title:e="Complaint Management",description:t,actionLabel:r="Create New Form",onAction:n,className:a=""}){return s.jsxs("header",{className:`ca-page-header ${a}`.trim(),children:[s.jsxs("div",{className:"ca-page-header__text",children:[s.jsx(sn,{children:e}),t?s.jsx(ur,{children:t}):null]}),s.jsx("div",{className:"ca-page-header__actions",children:s.jsx(Y,{startIcon:s.jsx(go,{}),onClick:n,children:r})})]})}function Co({status:e="inactive",label:t,className:r=""}){const a=String(e).toLowerCase()==="active",o=t??(a?"Active":"Inactive");return s.jsx("span",{className:`ca-badge rounded ca-badge--${a?"active":"inactive"} ${r}`.trim(),children:o})}const So=(...e)=>e.filter((t,r,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===r).join(" ").trim();const au=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const ou=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,n)=>n?n.toUpperCase():r.toLowerCase());const Eo=e=>{const t=ou(e);return t.charAt(0).toUpperCase()+t.slice(1)};var cn={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const su=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},iu=N.createContext({}),lu=()=>N.useContext(iu),cu=N.forwardRef(({color:e,size:t,strokeWidth:r,absoluteStrokeWidth:n,className:a="",children:o,iconNode:i,...l},c)=>{const{size:d=24,strokeWidth:u=2,absoluteStrokeWidth:p=!1,color:y="currentColor",className:S=""}=lu()??{},v=n??p?Number(r??u)*24/Number(t??d):r??u;return N.createElement("svg",{ref:c,...cn,width:t??d??cn.width,height:t??d??cn.height,stroke:e??y,strokeWidth:v,className:So("lucide",S,a),...!o&&!su(l)&&{"aria-hidden":"true"},...l},[...i.map(([w,h])=>N.createElement(w,h)),...Array.isArray(o)?o:[o]])});const de=(e,t)=>{const r=N.forwardRef(({className:n,...a},o)=>N.createElement(cu,{ref:o,iconNode:t,className:So(`lucide-${au(Eo(e))}`,`lucide-${e}`,n),...a}));return r.displayName=Eo(e),r};const _o=de("building-2",[["path",{d:"M10 12h4",key:"a56b0p"}],["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M14 21v-3a2 2 0 0 0-4 0v3",key:"1rgiei"}],["path",{d:"M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2",key:"secmi2"}],["path",{d:"M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16",key:"16ra0t"}]]);const No=de("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const du=de("circle-dot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);const uu=de("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);const fu=de("ellipsis-vertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);const pu=de("flag",[["path",{d:"M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528",key:"1jaruq"}]]);const hu=de("funnel",[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]]);const To=de("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const mu=de("store",[["path",{d:"M15 21v-5a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v5",key:"slp6dd"}],["path",{d:"M17.774 10.31a1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.451 0 1.12 1.12 0 0 0-1.548 0 2.5 2.5 0 0 1-3.452 0 1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.77-3.248l2.889-4.184A2 2 0 0 1 7 2h10a2 2 0 0 1 1.653.873l2.895 4.192a2.5 2.5 0 0 1-3.774 3.244",key:"o0xfot"}],["path",{d:"M4 10.95V19a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8.05",key:"wn3emo"}]]);const Lo=de("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);function gu({options:e=[],className:t=""}){const[r,n]=N.useState(!1),a=N.useRef(null);N.useEffect(()=>{const i=l=>{a.current&&!a.current.contains(l.target)&&n(!1)};return document.addEventListener("mousedown",i),()=>{document.removeEventListener("mousedown",i)}},[]);const o=i=>{i.onClick?.(),n(!1)};return s.jsxs("div",{ref:a,className:`ca-more-functions ${t}`.trim(),children:[s.jsx("button",{type:"button",className:"ca-more-functions__button",onClick:()=>n(i=>!i),"aria-label":"More options","aria-expanded":r,children:s.jsx(fu,{size:16})}),r&&e.length>0&&s.jsx("div",{className:"ca-more-functions__menu",children:e.map((i,l)=>s.jsxs("button",{type:"button",className:`ca-more-functions__item ${i.danger?"ca-more-functions__item--danger":""}`,onClick:()=>o(i),children:[i.icon&&s.jsx("span",{className:"ca-more-functions__icon",children:i.icon}),s.jsx("span",{children:i.label})]},i.key||l))})]})}function Ao({title:e,status:t,statusLabel:r,titleAsLink:n=!1,onTitleClick:a,menuOptions:o=[],className:i=""}){return s.jsxs("div",{className:`ca-system-card__header ${i}`.trim(),children:[s.jsx("div",{className:"ca-system-card__title-wrap",children:n?s.jsx("button",{type:"button",className:"ca-h2 ca-h2--link",onClick:a,children:e}):s.jsx(ln,{children:e})}),s.jsxs("div",{className:"ca-system-card__header-actions",children:[s.jsx(Co,{status:t,label:r}),s.jsx(gu,{options:o})]})]})}function dn({size:e=16,color:t="currentColor",...r}){return s.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",...r,children:s.jsx("path",{d:"M9 6l6 6-6 6",stroke:t,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Fo({updatedOn:e,openLabel:t="Open",configureLabel:r="Configure",onOpen:n,className:a="",id:o,title:i}){const l=Le(),c=B.useDispatch(),d=()=>{o!=null&&o!==""&&c(et(o)),l("/querymanagement")};return s.jsxs("div",{className:`ca-system-card__footer ${a}`.trim(),children:[s.jsx(Ce,{variant:"small",as:"span",children:e?`Updated on ${e}`:""}),s.jsxs("div",{className:"ca-system-card__footer-actions",children:[s.jsx(Y,{size:"sm",onClick:d,children:t}),s.jsx(Y,{variant:"outline",size:"sm",onClick:()=>{c(Dt({data:!0})),c(et({data:o})),console.log("Configure button clicked"),console.log("ID:",o),l(`/settings/${o??"new"}?step=1`)},endIcon:s.jsx(dn,{size:14,color:"currentColor"}),children:r})]})]})}function Oo({label:e,value:t,icon:r,className:n=""}){const a=t==null?"—":typeof t=="number"?String(t).padStart(2,"0"):t;return s.jsxs("div",{className:`ca-data-point ${n}`.trim(),children:[r?s.jsx("span",{className:"ca-data-point__icon","aria-hidden":"true",children:r}):null,s.jsx(bo,{children:a}),s.jsx("span",{className:"ca-data-point__label",children:e})]})}function ko({className:e=""}){return s.jsx("div",{className:`ca-divider ${e}`.trim(),role:"separator","aria-orientation":"vertical"})}const yu="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_617_15259)'%3e%3cpath%20d='M9.99992%2011.9997H6.66658M11.9999%209.33301H6.66658M2.66659%2014.6663H13.3333C13.6869%2014.6663%2014.026%2014.5259%2014.2761%2014.2758C14.5261%2014.0258%2014.6666%2013.6866%2014.6666%2013.333V2.66634C14.6666%202.31272%2014.5261%201.97358%2014.2761%201.72353C14.026%201.47348%2013.6869%201.33301%2013.3333%201.33301H5.33325C4.97963%201.33301%204.64049%201.47348%204.39044%201.72353C4.14039%201.97358%203.99992%202.31272%203.99992%202.66634V5.99967M2.66659%2014.6663C3.02021%2014.6663%203.35935%2014.5259%203.60939%2014.2758C3.85944%2014.0258%203.99992%2013.6866%203.99992%2013.333V5.99967M2.66659%2014.6663C2.31296%2014.6663%201.97382%2014.5259%201.72378%2014.2758C1.47373%2014.0258%201.33325%2013.6866%201.33325%2013.333V7.33301C1.33325%206.97939%201.47373%206.64025%201.72378%206.3902C1.97382%206.14015%202.31296%205.99967%202.66659%205.99967H3.99992M7.33325%203.99967H11.3333C11.7014%203.99967%2011.9999%204.29815%2011.9999%204.66634V5.99967C11.9999%206.36786%2011.7014%206.66634%2011.3333%206.66634H7.33325C6.96506%206.66634%206.66658%206.36786%206.66658%205.99967V4.66634C6.66658%204.29815%206.96506%203.99967%207.33325%203.99967Z'%20stroke='%232D64B8'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_617_15259'%3e%3crect%20width='16'%20height='16'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",wu="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M6.44729%202.75711C6.48402%202.37067%206.66351%202.01181%206.95069%201.75063C7.23787%201.48945%207.61211%201.34473%208.00029%201.34473C8.38847%201.34473%208.76271%201.48945%209.04989%201.75063C9.33707%202.01181%209.51656%202.37067%209.55329%202.75711C9.57537%203.00675%209.65727%203.24739%209.79205%203.45867C9.92683%203.66995%2010.1105%203.84565%2010.3276%203.97089C10.5447%204.09614%2010.7887%204.16724%2011.0391%204.17819C11.2895%204.18913%2011.5388%204.1396%2011.766%204.03378C12.1187%203.87363%2012.5184%203.85045%2012.8873%203.96877C13.2562%204.08708%2013.5678%204.33841%2013.7616%204.67385C13.9554%205.00928%2014.0175%205.40482%2013.9357%205.78349C13.854%206.16215%2013.6342%206.49685%2013.3193%206.72244C13.1142%206.86634%2012.9468%207.05751%2012.8312%207.27979C12.7157%207.50207%2012.6553%207.74891%2012.6553%207.99944C12.6553%208.24997%2012.7157%208.49681%2012.8312%208.71909C12.9468%208.94137%2013.1142%209.13254%2013.3193%209.27644C13.6342%209.50203%2013.854%209.83673%2013.9357%2010.2154C14.0175%2010.5941%2013.9554%2010.9896%2013.7616%2011.325C13.5678%2011.6605%2013.2562%2011.9118%2012.8873%2012.0301C12.5184%2012.1484%2012.1187%2012.1253%2011.766%2011.9651C11.5388%2011.8593%2011.2895%2011.8097%2011.0391%2011.8207C10.7887%2011.8316%2010.5447%2011.9027%2010.3276%2012.028C10.1105%2012.1532%209.92683%2012.3289%209.79205%2012.5402C9.65727%2012.7515%209.57537%2012.9921%209.55329%2013.2418C9.51656%2013.6282%209.33707%2013.9871%209.04989%2014.2483C8.76271%2014.5094%208.38847%2014.6542%208.00029%2014.6542C7.61211%2014.6542%207.23787%2014.5094%206.95069%2014.2483C6.66351%2013.9871%206.48402%2013.6282%206.44729%2013.2418C6.42525%2012.992%206.34336%2012.7513%206.20854%2012.54C6.07371%2012.3286%205.88994%2012.1528%205.67278%2012.0276C5.45562%2011.9023%205.21147%2011.8313%204.96101%2011.8204C4.71055%2011.8095%204.46116%2011.8591%204.23396%2011.9651C3.88122%2012.1253%203.48151%2012.1484%203.11263%2012.0301C2.74374%2011.9118%202.43207%2011.6605%202.23828%2011.325C2.04449%2010.9896%201.98244%2010.5941%202.0642%2010.2154C2.14596%209.83673%202.36569%209.50203%202.68063%209.27644C2.88571%209.13254%203.05311%208.94137%203.16868%208.71909C3.28426%208.49681%203.34459%208.24997%203.34459%207.99944C3.34459%207.74891%203.28426%207.50207%203.16868%207.27979C3.05311%207.05751%202.88571%206.86634%202.68063%206.72244C2.36614%206.49674%202.14679%206.16217%202.06523%205.78376C1.98366%205.40535%202.0457%205.01014%202.23928%204.67492C2.43287%204.3397%202.74417%204.08843%203.11269%203.96994C3.4812%203.85144%203.88061%203.8742%204.23329%204.03378C4.46046%204.1396%204.70979%204.18913%204.96016%204.17819C5.21053%204.16724%205.45458%204.09614%205.67165%203.97089C5.88872%203.84565%206.07242%203.66995%206.2072%203.45867C6.34198%203.24739%206.42388%203.00675%206.44596%202.75711M9.99996%207.99978C9.99996%209.10434%209.10453%209.99978%207.99996%209.99978C6.89539%209.99978%205.99996%209.10434%205.99996%207.99978C5.99996%206.89521%206.89539%205.99978%207.99996%205.99978C9.10453%205.99978%209.99996%206.89521%209.99996%207.99978Z'%20stroke='%23745EBF'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",bu="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M9.99992%208H6.66659M9.99992%205.33333H6.66659M12.6666%2011.3333V3.33333C12.6666%202.97971%2012.5261%202.64057%2012.2761%202.39052C12.026%202.14048%2011.6869%202%2011.3333%202H2.66659M2.66659%202C3.02021%202%203.35935%202.14048%203.60939%202.39052C3.85944%202.64057%203.99992%202.97971%203.99992%203.33333V5.33333M2.66659%202C2.31296%202%201.97382%202.14048%201.72378%202.39052C1.47373%202.64057%201.33325%202.97971%201.33325%203.33333V4.66667C1.33325%204.84348%201.40349%205.01305%201.52851%205.13807C1.65354%205.2631%201.82311%205.33333%201.99992%205.33333H3.99992M5.33325%2014H13.3333C13.6869%2014%2014.026%2013.8595%2014.2761%2013.6095C14.5261%2013.3594%2014.6666%2013.0203%2014.6666%2012.6667V12C14.6666%2011.8232%2014.5963%2011.6536%2014.4713%2011.5286C14.3463%2011.4036%2014.1767%2011.3333%2013.9999%2011.3333H7.33325C7.15644%2011.3333%206.98687%2011.4036%206.86185%2011.5286C6.73682%2011.6536%206.66659%2011.8232%206.66659%2012V12.6667C6.66659%2013.0203%206.52611%2013.3594%206.27606%2013.6095C6.02601%2013.8595%205.68687%2014%205.33325%2014ZM5.33325%2014C4.97963%2014%204.64049%2013.8595%204.39044%2013.6095C4.14039%2013.3594%203.99992%2013.0203%203.99992%2012.6667V5.33333'%20stroke='%2300B692'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",vu="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M2.66675%209.33301H6.66675M2.66675%201.33301H9.33341M3.33341%2011.9997H12.6667C13.0349%2011.9997%2013.3334%2012.2982%2013.3334%2012.6663V13.9997C13.3334%2014.3679%2013.0349%2014.6663%2012.6667%2014.6663H3.33341C2.96522%2014.6663%202.66675%2014.3679%202.66675%2013.9997V12.6663C2.66675%2012.2982%202.96522%2011.9997%203.33341%2011.9997ZM3.33341%203.99967H12.6667C13.0349%203.99967%2013.3334%204.29815%2013.3334%204.66634V5.99967C13.3334%206.36786%2013.0349%206.66634%2012.6667%206.66634H3.33341C2.96522%206.66634%202.66675%206.36786%202.66675%205.99967V4.66634C2.66675%204.29815%202.96522%203.99967%203.33341%203.99967Z'%20stroke='%23FF6F00'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e";function Do({id:e,title:t,item:r,status:n="inactive",statusLabel:a,description:o,descriptionHref:i,departments:l,workflows:c,fields:d,formsFilled:u,updatedOn:p,titleAsLink:y=!1,onTitleClick:S,onDescriptionClick:v,onConfigure:w,onOpen:h,menuOptions:m=[],className:f=""}){const b=()=>{w?.({id:e,title:t,status:n,departments:l,workflows:c,fields:d,formsFilled:u,updatedOn:p})},E=()=>{if(v){v({id:e,title:t,descriptionHref:i});return}i&&typeof window<"u"&&window.open(i,"_blank","noopener,noreferrer")},O=[{label:"Total entries",value:r?.totalEntries,icon:s.jsx("img",{src:yu,alt:""})},{label:"Open entries",value:r?.openEntries,icon:s.jsx("img",{src:wu,alt:""})},{label:"Closed entries",value:r?.closedEntries,icon:s.jsx("img",{src:bu,alt:""})},{label:"Escalated entries",value:r?.escalatedEntries,icon:s.jsx("img",{src:vu,alt:""})}];return s.jsxs("article",{className:`ca-system-card ${f}`.trim(),children:[s.jsx(Ao,{title:r?.name,status:r?.isActive?"active":"inactive",statusLabel:a,titleAsLink:y,onTitleClick:()=>S?.({id:e,title:t}),menuOptions:m}),o?s.jsx("p",{className:"ca-system-card__description",onClick:E,children:o}):null,s.jsx("div",{className:"ca-system-card__stats",children:O.map((L,P)=>s.jsxs(N.Fragment,{children:[P>0?s.jsx(ko,{}):s.jsx("div",{className:"ca-system-card__stats-spacer"}),s.jsx(Oo,{label:L.label,value:L.value,icon:L.icon})]},L.label))}),s.jsx(Fo,{updatedOn:p,onOpen:()=>h?.({id:e,title:t}),id:e,title:t,onConfigure:b})]})}function xo({systems:e=[],onConfigure:t,onOpen:r,onTitleClick:n,onDescriptionClick:a,emptyMessage:o="No systems found.",className:i=""}){return e.length?s.jsx("div",{className:`ca-system-grid ${i}`.trim(),children:e.map(l=>s.jsx(Do,{item:l,...l,onConfigure:t,onOpen:r,onTitleClick:n,onDescriptionClick:a},l.id??l.title))}):s.jsx("div",{className:`ca-system-grid ${i}`.trim(),children:s.jsx("div",{className:"ca-empty",children:s.jsx(ur,{children:o})})})}function ue({value:e,onChange:t,placeholder:r,type:n="text",icon:a,className:o="",inputClassName:i="",...l}){return s.jsxs("div",{className:`ca-input-wrap ${o}`.trim(),children:[a?s.jsx("span",{className:"ca-input-wrap__icon",children:a}):null,s.jsx("input",{type:n,className:`ca-input ${a?"ca-input--with-icon":""} ${i}`.trim(),value:e,onChange:t,placeholder:r,...l})]})}function Po({size:e=18,color:t="currentColor",...r}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",...r,children:[s.jsx("path",{d:"M10.5 18a7.5 7.5 0 1 1 0-15 7.5 7.5 0 0 1 0 15Z",stroke:t,strokeWidth:"1.75"}),s.jsx("path",{d:"M16.5 16.5 21 21",stroke:t,strokeWidth:"1.75",strokeLinecap:"round"})]})}function Io({value:e,onChange:t,onSearch:r,placeholder:n="Search",className:a=""}){const o=i=>{i.key==="Enter"&&r&&r(e)};return s.jsx("div",{className:`ca-search ${a}`.trim(),children:s.jsx(ue,{value:e,onChange:t,onKeyDown:o,placeholder:n,icon:s.jsx(Po,{}),"aria-label":n})})}function tt({text:e="Loading",fullScreen:t=!1}){return s.jsxs("div",{className:"ca-loading",style:t?{minHeight:"calc(100vh - 80px)"}:void 0,role:"status","aria-live":"polite",children:[s.jsx("span",{className:"ca-loading__spinner"}),s.jsxs("span",{children:[e,"…"]})]})}const Cu=[{id:"qms",title:"QMS - Query Management System",status:"active",description:"Description of the template",departments:3,workflows:12,fields:55,formsFilled:234,updatedOn:"12 Mar 2024",titleAsLink:!1},{id:"cms",title:"CX- Pulse-360 ",status:"active",description:"Description of the template",departments:5,workflows:8,fields:42,formsFilled:189,updatedOn:"08 Mar 2024"},{id:"fms",title:"ENE - TRACKER",status:"inactive",description:"Description of the template",departments:2,workflows:4,fields:28,formsFilled:56,updatedOn:"01 Feb 2024"},{id:"rms",title:"RTV - Return to Vendor ",status:"active",description:"Description of the template",departments:4,workflows:10,fields:61,formsFilled:312,updatedOn:"20 Mar 2024"}],Mo="Create, manage and track complaint forms, workflows and responses across departments.";function Bo({title:e="Complaint Management",description:t=Mo,systems:r,createLabel:n="Create New Form",onCreateForm:a,onConfigure:o,onOpen:i,onTitleClick:l,onDescriptionClick:c,onSearch:d}){const u=Le(),p=B.useDispatch(),[y,S]=N.useState(""),{complaintList:v=[],loading:w=!1,error:h=null}=B.useSelector(L=>L.complaintType??{});N.useEffect(()=>{r==null&&(p(Dt({data:!1})),p(sr()))},[p,r]);const m=r??v,f=N.useMemo(()=>{const L=y.trim().toLowerCase();return L?m.filter(P=>[P.title,P.name,P.description,P.status].filter(Boolean).join(" ").toLowerCase().includes(L)):m},[m,y]);N.useEffect(()=>{d&&d(y)},[y,d]);const b=L=>{S(L.target.value)},E=L=>{o?.(L),u(`/settings/${L.id??"new"}?step=1`)},O=()=>{p(Dt({data:!1})),a?.(),u("/settings/new?step=1")};return s.jsxs("div",{className:"ca-complaint-management-page","data-testid":"complaint-management-page",children:[s.jsx(vo,{title:e,description:t,actionLabel:n,onAction:O}),s.jsx("div",{className:"ca-search-container",children:s.jsx(Io,{value:y,onChange:b,placeholder:"Search"})}),w?s.jsx(tt,{text:"Loading systems"}):h?s.jsx("div",{className:"ca-empty",children:s.jsx("p",{className:"ca-body",children:typeof h=="string"?h:"Failed to load complaint types."})}):s.jsx(xo,{systems:f,onConfigure:E,onOpen:i,onTitleClick:l,onDescriptionClick:c,emptyMessage:y?"No systems match your search.":"No systems found."})]})}const $o=N.createContext(null),Uo=()=>({categoryName:"",categoryType:"",tatMinutes:"",template:"",visibilityType:"",urlLink:"",active:!1,description:"",roles:[...new Set],departmentRows:[{id:"1",department:"",subDepartment:"",roles:""}],priorityDraft:"",priorities:[],defaultPriorityId:null,selectedDeptNode:null,workflow:{name:"",tatMinutes:"",description:"",statuses:[],steps:[],selectedTableCard:null},fieldDraft:{name:"",type:""},formFields:[]});function jo({children:e,initialValues:t}){const[r,n]=N.useState(()=>({...Uo(),...t,workflow:{...Uo().workflow,...t?.workflow}})),a=N.useCallback(l=>{n(c=>({...c,...l}))},[]),o=N.useCallback(l=>{n(c=>({...c,workflow:{...c.workflow,...l}}))},[]),i=N.useMemo(()=>({state:r,setState:n,update:a,updateWorkflow:o}),[r,a,o]);return s.jsx($o.Provider,{value:i,children:e})}function fr(){const e=N.useContext($o);if(!e)throw new Error("useSettingsWizard must be used within SettingsWizardProvider");return e}const se=[{id:1,key:"category",label:"Category Type",title:"Category Type",description:"Define the type and basic details for this category type."},{id:2,key:"workflow",label:"Workflow",title:"Workflow",description:"L1 > L2 > L3"},{id:3,key:"formFields",label:"Form Fields",title:"Form Fields",description:"----"},{id:4,key:"review",label:"Review & Publish",title:"Review & Publish",description:"Review your configuration and publish."}],Su=[{id:1,label:"Create Workflow"},{id:2,label:"Statuses"},{id:3,label:"Workflow Steps"}],Eu=["Urgent","High","Medium","Low"],_u=[{value:"qms",label:"QMS - Query Management System"},{value:"cms",label:"CMS - Complaint Management System"},{value:"fms",label:"FMS - Feedback Management System"},{value:"rms",label:"RMS - Request Management System"}],Nu=[{value:"#EF4444",label:"Red"},{value:"#F59E0B",label:"Orange"},{value:"#EAB308",label:"Yellow"},{value:"#22C55E",label:"Green"},{value:"#3B82F6",label:"Blue"},{value:"#8B5CF6",label:"Purple"}];function qo({size:e=28,color:t="currentColor",...r}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",style:{color:"var(--ca-primary)"},...r,children:[s.jsx("path",{d:"M12 3 3 8l9 5 9-5-9-5Z",stroke:t,strokeWidth:"1.6",strokeLinejoin:"round"}),s.jsx("path",{d:"M3 12.5 12 17.5l9-5",stroke:t,strokeWidth:"1.6",strokeLinejoin:"round",strokeLinecap:"round"}),s.jsx("path",{d:"M3 16.5 12 21.5l9-5",stroke:t,strokeWidth:"1.6",strokeLinejoin:"round",strokeLinecap:"round"})]})}function Vo({title:e,description:t,nextLabel:r="Next",onNext:n,showNext:a=!0,nextDisabled:o=!1,nextVariant:i="primary",className:l=""}){return s.jsxs("div",{className:`ca-settings-card__header ${l}`.trim(),children:[s.jsxs("div",{className:"ca-settings-card__heading",children:[s.jsx(qo,{}),s.jsxs("div",{children:[s.jsx(ln,{children:e}),t?s.jsx(ur,{className:"ca-settings-card__desc",children:t}):null]})]}),a?s.jsx(Y,{variant:i,disabled:o,onClick:n,endIcon:s.jsx(dn,{size:14,color:"currentColor"}),children:r}):null]})}function rt({title:e,description:t,onNext:r,nextLabel:n,showNext:a=!0,nextDisabled:o,nextVariant:i,children:l,footer:c,className:d=""}){return s.jsxs("section",{className:`ca-settings-card ${d}`.trim(),children:[s.jsx(Vo,{title:e,description:t,onNext:r,nextLabel:n,showNext:a,nextDisabled:o,nextVariant:i}),s.jsx("div",{className:"ca-settings-card__divider"}),s.jsx("div",{className:"ca-settings-card__body",children:l}),c?s.jsx("div",{className:"ca-settings-card__footer",children:c}):null]})}function pr({children:e,hint:t,htmlFor:r,className:n=""}){return s.jsxs("div",{className:`ca-field-label ${n}`.trim(),children:[s.jsx("label",{className:"ca-label",htmlFor:r,children:e}),t!=null?s.jsx("span",{className:"ca-field-label__hint",children:t}):null]})}function Wo({size:e=16,color:t="currentColor",...r}){return s.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",...r,children:s.jsx("path",{d:"M6 9l6 6 6-6",stroke:t,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function ie({value:e,onChange:t,options:r=[],placeholder:n="Select",className:a="",disabled:o=!1,...i}){return s.jsxs("div",{className:`ca-select ${a}`.trim(),children:[s.jsxs("select",{className:"ca-select__control",value:e??"",onChange:t,disabled:o,...i,children:[s.jsx("option",{value:"",disabled:!0,children:n}),r.map(l=>{const c=typeof l=="string"?l:l.value,d=typeof l=="string"?l:l.label;return s.jsx("option",{value:c,children:d},c)})]}),s.jsx("span",{className:"ca-select__chevron",children:s.jsx(Wo,{size:16})})]})}function Ho({value:e,onChange:t,placeholder:r,maxLength:n,rows:a=4,className:o="",...i}){return s.jsx("textarea",{className:`ca-textarea ${o}`.trim(),value:e,onChange:t,placeholder:r,maxLength:n,rows:a,...i})}function fe({label:e,hint:t,children:r,className:n="",htmlFor:a}){return s.jsxs("div",{className:`ca-form-field ${n}`.trim(),children:[e!=null?s.jsx(pr,{htmlFor:a,hint:t,children:e}):null,r]})}function un({label:e,hint:t,...r}){return s.jsx(fe,{label:e,hint:t,htmlFor:r.id,children:s.jsx(ue,{...r})})}function Tu({label:e,hint:t,suffix:r,...n}){return s.jsx(fe,{label:e,hint:t,htmlFor:n.id,children:s.jsxs("div",{className:"input-with-suffix",children:[s.jsx(ue,{...n}),r&&s.jsx("div",{className:"input-suffix",children:r})]})})}function fn({label:e,hint:t,...r}){return s.jsx(fe,{label:e,hint:t,htmlFor:r.id,children:s.jsx(ie,{...r})})}function zo({label:e,hint:t,maxLength:r,value:n="",...a}){const o=t??(r!=null?`${String(n).length}/${r}`:void 0);return s.jsx(fe,{label:e,hint:o,htmlFor:a.id,children:s.jsx(Ho,{value:n,maxLength:r,...a})})}function pn({checked:e=!1,onChange:t,disabled:r=!1,"aria-label":n="Toggle",className:a=""}){return s.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":n,disabled:r,className:`ca-toggle ${e?"ca-toggle--on":""} ${a}`.trim(),onClick:()=>t?.(!e),children:s.jsx("span",{className:"ca-toggle__thumb"})})}function Ko({label:e="Active",checked:t,onChange:r,className:n=""}){return s.jsxs("div",{className:`ca-toggle-field ${n}`.trim(),children:[s.jsx(wo,{children:e}),s.jsx(pn,{checked:t,onChange:r,"aria-label":e})]})}function Jo({size:e=12,color:t="currentColor",...r}){return s.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",...r,children:s.jsx("path",{d:"M6 6l12 12M18 6L6 18",stroke:t,strokeWidth:"2",strokeLinecap:"round"})})}function Ro({label:e,onRemove:t,className:r=""}){return s.jsxs("span",{className:`ca-tag ${r}`.trim(),children:[e,t?s.jsx("button",{type:"button",className:"ca-tag__remove",onClick:t,"aria-label":`Remove ${e}`,children:s.jsx(Jo,{size:10})}):null]})}function hn({label:e="",options:t=[],value:r=[],onChange:n,placeholder:a="Select roles",className:o=""}){const[i,l]=N.useState(""),c=new Map(t.map(y=>{const S=typeof y=="string"?y:y.value,v=typeof y=="string"?y:y.label;return[String(S),v]})),d=t.filter(y=>{const S=typeof y=="string"?y:y.value;return!r.some(v=>String(v)===String(S))}),u=y=>{const S=y.target.value;S&&(n?.([...r,S]),l(""))},p=y=>{n?.(r.filter(S=>String(S)!==String(y)))};return s.jsxs("div",{className:`ca-role-select ${o}`.trim(),children:[s.jsx(pr,{children:e}),s.jsx(ie,{value:i,onChange:u,options:d,placeholder:a}),r.length>0?s.jsx("div",{className:"ca-tag-list",children:[...new Set(r)].map(y=>s.jsx(Ro,{label:c.get(String(y))||String(y),onRemove:()=>p(y)},String(y)))}):null]})}function nt({steps:e=[],currentStep:t=1,onStepClick:r,className:n="",size:a="md",showSaveButton:o=!1,showNextButton:i=!1,onSaveDraft:l,onNext:c,saveLabel:d="Save Draft",nextLabel:u="Next >"}){const p=N.useRef({}),y=B.useDispatch(),{isEdit:S}=B.useSelector(v=>v.appDetails||{});return N.useEffect(()=>{const v=p.current[t];if(!v)return;const w=requestAnimationFrame(()=>{let h=v.parentElement;for(;h&&h!==document.body;){const{overflowX:L}=getComputedStyle(h);if(h.scrollWidth>h.clientWidth+1&&(L==="auto"||L==="scroll"))break;h=h.parentElement}if(!h||h===document.body)return;const m=h.getBoundingClientRect(),f=v.getBoundingClientRect(),b=12;if(f.left>=m.left+b&&f.right<=m.right-b)return;const O=f.left-m.left-(m.width-f.width)/2;h.scrollTo({left:h.scrollLeft+O,behavior:"smooth"})});return()=>cancelAnimationFrame(w)},[t]),s.jsxs("div",{className:`ca-stepper-wrap ca-stepper-wrap--${a} ${n}`.trim(),children:[s.jsx("nav",{className:`ca-stepper ca-stepper--${a}`,"aria-label":"Progress",children:e.map((v,w)=>{const h=v.id??w+1,m=h===t,f=h<t,b=!!r&&(f||m);return s.jsxs("button",{type:"button",ref:E=>{p.current[h]=E},className:["ca-stepper__item",m?"ca-stepper__item--active":"",f?"ca-stepper__item--done":""].filter(Boolean).join(" "),style:{zIndex:e.length-w},onClick:()=>{console.log("setting is edit is true"),y(Dt({data:!0})),console.log(S),b&&r?.(h)},disabled:!b,"aria-current":m?"step":void 0,children:[s.jsxs("span",{className:"ca-stepper__circle",children:[h,"."]}),s.jsx("span",{className:"ca-stepper__label",children:v.label})]},h)})}),o||i?s.jsxs("div",{className:"ca-stepper__actions",children:[o?s.jsx(Y,{variant:"outline",onClick:l,children:d}):null,i?s.jsx(Y,{onClick:c,children:u}):null]}):null]})}const Lu={categoryName:"",tatMinutes:"",template:"",categoryType:"",description:"",visibilityType:"",urlLink:"",active:!0,roles:[]},Au=[{value:"INTERNAL_LOGIN",label:"Internal Login"},{value:"PRIVATE_LINK",label:"Private Link"},{value:"PUBLIC_LINK",label:"Public Link"}];function Fu({stepMeta:e,stepperProps:t,pageProps:r}){const[n,a]=N.useState(Lu),o=B.useDispatch(),{id:i}=B.useSelector(w=>w.appDetails||{}),{isEdit:l}=B.useSelector(w=>w.appDetails||{}),c=B.useSelector(w=>w.complaintType||{}),{saving:d,loading:u,error:p}=c;N.useEffect(()=>{if(console.log("🔥 useEffect:",{id:i,isEdit:l}),!l||i===null||i===void 0){console.log("❌ Not fetching");return}console.log("🚀 Fetching complaint type:",i),o(ir(i)).unwrap().then(w=>{console.log("✅ API response for ID",i,":",w);const h=w?.data??w;console.log("📦 Data:",h),h&&a({categoryName:h.name??h.code??"",tatMinutes:h.tatMinutes??"",template:h.categoryType??"",categoryType:h.categoryType??"",description:h.description??"",visibilityType:h.visibilityType??h.accessType??"",urlLink:h.urlLink??"",active:h.isActive??h.active??!0,roles:h?.accesses?.map(m=>m?.role?.id)??h.roleIds??[]})}).catch(w=>{console.log("❌ Fetch error:",w)})},[o,i,l]);const y=(r?.rolelist||[]).map(w=>({value:w.id,label:w.name})),S=(w,h)=>{a(m=>({...m,[w]:h}))},v=async()=>{const w={categoryName:n.categoryName,categoryType:n.categoryType||n.template,tatMinutes:n.tatMinutes?Number(n.tatMinutes):0,description:n.description,visibilityType:n.visibilityType,urlLink:n.urlLink,active:n.active,roles:n.roles};console.log("CategoryTypeStep payload:",w),console.log("isedit ",l,"id",i);const h=l?kt({id:i,data:{code:w.categoryName,name:w.categoryName,description:w.description,tatMinutes:w.tatMinutes,isActive:w.active,accessType:w.visibilityType,roleIds:w.roles.map(f=>parseInt(f,10))},onSuccess:f=>{console.log("updateComplaintType onSuccess:",f),t.onNext?.()},onFail:f=>{console.log("updateComplaintType onFail:",f)}}):Ot({payload:w,onSuccess:f=>{console.log("createComplaintType onSuccess........................:",f),console.log("data response on creationg ",f),o(et(f?.data?.id??f?.id??null)),console.log(i,"system id set up successfully ..........",f?.data?.id??f?.id??null),t.onNext?.()},onFail:f=>{console.log("createComplaintType onFail:",f)}}),m=o(h);if(l&&kt.fulfilled.match(m)||!l&&Ot.fulfilled.match(m)){if(!l){const f=m.payload?.data?.id??m.payload?.id;f!=null&&(console.log("setting up system id ..........",f),o(et(f)),console.log("system id set up successfully ..........",f))}t.onNext?.()}};return s.jsxs(s.Fragment,{children:[s.jsx(nt,{...t,steps:se,showNextButton:!!t.showNextButton,onNext:v}),s.jsxs(rt,{title:e.title,description:e.description,showNext:!1,children:[s.jsx("div",{className:"ca-category-type__status",children:s.jsx(Ko,{checked:n.active,onChange:w=>S("active",w)})}),s.jsxs("div",{className:"ca-step-section",children:[s.jsxs("div",{className:"ca-step-row ca-step-row--category-fields",children:[s.jsx(un,{label:"Category Name",className:"ca-step-row__grow",value:n.categoryName,onChange:w=>S("categoryName",w.target.value),placeholder:"Enter category name"}),s.jsx(Tu,{label:"TAT Minutes",suffix:"minutes",type:"number",min:"0",value:n.tatMinutes,onChange:w=>S("tatMinutes",w.target.value),placeholder:"Enter here"})]}),s.jsx("div",{className:"ca-step-row",children:s.jsx(fn,{label:"Select Template",className:"ca-step-row__grow",value:n.template||n.categoryType,onChange:w=>{const h=w.target.value;S("template",h),S("categoryType",h)},options:_u,placeholder:"Select template"})}),s.jsx("div",{className:"ca-step-section",children:s.jsx(zo,{label:"Description",placeholder:"Enter description",maxLength:500,value:n.description,onChange:w=>S("description",w.target.value),rows:5})}),s.jsxs("div",{className:"ca-step-row",children:[s.jsx(fn,{label:"Select Visibility Type",className:"ca-step-row__grow",value:n.visibilityType,onChange:w=>S("visibilityType",w.target.value),options:Au,placeholder:"Select visibility type"}),s.jsx(un,{label:null,className:"ca-step-row__grow ca-category-type__url-link",value:n.urlLink,onChange:w=>S("urlLink",w.target.value),placeholder:"urllink"})]})]}),s.jsx("div",{className:"ca-step-section ca-step-section--last",children:s.jsx(hn,{label:"Select Roles for Complaint Filling",options:y,value:n.roles,onChange:w=>S("roles",w)})}),p?s.jsx("div",{className:"ca-form-error",children:p}):null,u?s.jsx("div",{className:"ca-form-loading",children:"Loading category..."}):null,d?s.jsx("div",{className:"ca-form-loading",children:"Saving category..."}):null]})]})}function Zo({children:e,onClick:t,className:r="",active:n=!1}){return s.jsx("button",{type:"button",className:`ca-chip ${n?"ca-chip--active":""} ${r}`.trim(),onClick:t,children:e})}function Xo({checked:e=!1,onChange:t,name:r,value:n,"aria-label":a,className:o=""}){return s.jsxs("label",{className:`ca-radio ${o}`.trim(),children:[s.jsx("input",{type:"radio",className:"ca-radio__input",name:r,value:n,checked:e,onChange:t,"aria-label":a}),s.jsx("span",{className:"ca-radio__mark"})]})}function mn({size:e=16,color:t="#9CA3AF",...r}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...r,children:[s.jsx("circle",{cx:"5",cy:"4",r:"1.2",fill:t}),s.jsx("circle",{cx:"11",cy:"4",r:"1.2",fill:t}),s.jsx("circle",{cx:"5",cy:"8",r:"1.2",fill:t}),s.jsx("circle",{cx:"11",cy:"8",r:"1.2",fill:t}),s.jsx("circle",{cx:"5",cy:"12",r:"1.2",fill:t}),s.jsx("circle",{cx:"11",cy:"12",r:"1.2",fill:t})]})}function Qo(e){return{id:`${Date.now()}-${Math.random().toString(36).slice(2,7)}`,name:e,color:""}}function Ou({stepMeta:e,stepperProps:t}){const{state:r,update:n}=fr(),{priorityDraft:a,priorities:o,defaultPriorityId:i}=r,l=u=>{const p=(u??a).trim();if(!p)return;if(o.some(S=>S.name.toLowerCase()===p.toLowerCase())){n({priorityDraft:""});return}const y=[...o,Qo(p)];n({priorities:y,priorityDraft:"",defaultPriorityId:i??y[0].id})},c=(u,p)=>{n({priorities:o.map(y=>y.id===u?{...y,...p}:y)})},d=Nu.map(u=>({value:u.value,label:u.label}));return s.jsxs(s.Fragment,{children:[s.jsx(nt,{...t,steps:se}),s.jsxs(rt,{title:e.title,description:e.description,showNext:!1,children:[s.jsxs("div",{className:"ca-priority-add",children:[s.jsx(pr,{children:"Priorities"}),s.jsxs("div",{className:"ca-priority-add__row",children:[s.jsx(ue,{value:a,onChange:u=>n({priorityDraft:u.target.value}),placeholder:"Add priority",onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),l())}}),s.jsx(Y,{variant:"outline",onClick:()=>l(),children:"+ Add"})]}),s.jsx("div",{className:"ca-chip-row",children:Eu.map(u=>s.jsxs(Zo,{onClick:()=>l(u),children:["+ ",u]},u))})]}),s.jsxs("div",{className:"ca-priority-table",children:[s.jsxs("div",{className:"ca-priority-table__head",children:[s.jsx("div",{children:"Priority"}),s.jsx("div",{children:"Color"}),s.jsx("div",{children:"Default"})]}),(o.length?o:[Qo("")]).map((u,p)=>{const y=!o.length;return s.jsxs("div",{className:"ca-priority-table__row",children:[s.jsxs("div",{className:"ca-priority-table__name",children:[s.jsx(mn,{}),s.jsx(ue,{value:y?a:u.name,onChange:S=>{y?n({priorityDraft:S.target.value}):c(u.id,{name:S.target.value})},placeholder:"Add priority"})]}),s.jsx(ie,{value:u.color,onChange:S=>{y||c(u.id,{color:S.target.value})},options:d,placeholder:"Select color"}),s.jsx(Xo,{name:"default-priority",value:u.id,checked:!y&&i===u.id,onChange:()=>!y&&n({defaultPriorityId:u.id}),"aria-label":"Default priority"})]},u.id||p)})]})]})]})}function Go({level:e,onAdd:t}){const[r,n]=N.useState(""),a=o=>{o.preventDefault();const i=r.trim();i&&(t?.(i),n(""))};return s.jsxs("form",{className:"ca-add-table-card",onSubmit:a,children:[s.jsxs("span",{className:"ca-add-table-card__level",children:["L",e]}),s.jsxs("label",{className:"ca-add-table-card__label",htmlFor:`add-workflow-level-${e}`,children:["Name Level ",e]}),s.jsx(ue,{id:`add-workflow-level-${e}`,value:r,placeholder:`Enter name for L${e}`,onChange:o=>n(o.target.value)}),s.jsxs(Y,{type:"submit",className:"ca-add-table-card__button",disabled:!r.trim(),children:["+ Add L",e]})]})}function gn({size:e=16,color:t="#9CA3AF",...r}){return s.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",...r,children:s.jsx("path",{d:"M4 7h16M9 7V5a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2m2 0v12a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2V7h12Z",stroke:t,strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}const yn=["Yes","No"];function Yo({name:e,level:t,value:r,initialFormValues:n,setFormValues:a,onChange:o,selected:i=!1,onSelect:l,onDelete:c,subtitle:d,pageProps:u}){const p=r??n??{},y=Array.isArray(p.role)?p.role:[],S=(u?.rolelist??[]).map(f=>({value:f.id,label:f.name??f.label})),v=(f,b)=>{const E={...p,[f]:b};a?a(E):o?.(E)},w=t===1?"green":t===2?"orange":"blue",h=f=>`workflow-level-${t}-${f}`,m=d||(t===1?"Initial Handler":t===2?"Escalation if L1 TAT exceeded":"Escalation workflow");return s.jsxs("article",{className:`ca-table-card ca-table-card--${w}${i?" ca-table-card--selected":""}`,onClick:l,children:[s.jsxs("header",{className:"ca-table-card__header",children:[s.jsxs("span",{className:"ca-table-card__level",children:["L",t]}),s.jsxs("div",{className:"ca-table-card__header-text",children:[s.jsx("h3",{className:"ca-table-card__title",children:e}),s.jsx("p",{className:"ca-table-card__subtitle",children:m})]}),s.jsx("button",{type:"button",className:"ca-table-card__delete","aria-label":`Delete ${e}`,title:`Delete ${e}`,onClick:f=>{f.stopPropagation(),c?.()},children:s.jsx(gn,{size:16})})]}),s.jsx("div",{className:"ca-table-card__divider"}),s.jsxs("div",{className:"ca-table-card__fields",children:[s.jsx(fe,{label:"Select Roles",htmlFor:h("roleIds"),children:s.jsx(hn,{id:h("role"),value:y,options:S,placeholder:"Select role",onChange:f=>v("role",f)})}),s.jsx("div",{className:"ca-table-card__divider"}),s.jsx(fe,{label:"Can Resolve",htmlFor:h("canResolve"),children:s.jsx(ie,{id:h("canResolve"),value:p.canResolve,options:yn,onChange:f=>v("canResolve",f.target.value)})}),s.jsx(fe,{label:"Can Reassign",htmlFor:h("canReassign"),children:s.jsx(ie,{id:h("canReassign"),value:p.canReassign,options:yn,onChange:f=>v("canReassign",f.target.value)})}),s.jsx(fe,{label:"Final Level",htmlFor:h("finalLevel"),children:s.jsx(ie,{id:h("finalLevel"),value:p.finalLevel,options:yn,onChange:f=>v("finalLevel",f.target.value)})}),s.jsx(fe,{label:"Escalation time",htmlFor:h("escalationTime"),children:s.jsxs("div",{className:"ca-table-card__time-input",children:[s.jsx(ue,{id:h("escalationTime"),type:"number",min:"0",value:p.escalateAfterMinutes??"",placeholder:"--",onChange:f=>v("escalateAfterMinutes",f.target.value)}),s.jsx("span",{children:"minutes"})]})})]})]})}const ku="data:image/svg+xml,%3csvg%20width='31'%20height='57'%20viewBox='0%200%2031%2057'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M0.50001%200.000227733C0.223869%200.000226605%209.85899e-06%200.224084%208.79418e-06%200.500226C7.72665e-06%200.776369%200.223865%201.00023%200.500009%201.00023L0.50001%200.500227L0.50001%200.000227733ZM15%200.500275L15%201.00028L15%200.500275ZM27%2012.5003L27.5%2012.5003L27%2012.5003ZM26.6464%2056.8527C26.8417%2057.048%2027.1582%2057.048%2027.3535%2056.8527L30.5355%2053.6707C30.7307%2053.4755%2030.7307%2053.1589%2030.5355%2052.9636C30.3402%2052.7683%2030.0236%2052.7683%2029.8284%2052.9636L26.9999%2055.792L24.1715%2052.9636C23.9763%2052.7683%2023.6597%2052.7683%2023.4644%2052.9636C23.2692%2053.1589%2023.2692%2053.4754%2023.4644%2053.6707L26.6464%2056.8527ZM0.50001%200.500227L0.500009%201.00023L15%201.00028L15%200.500275L15%200.000275583L0.50001%200.000227733L0.50001%200.500227ZM27%2012.5003L26.5%2012.5003L26.4999%2056.4991L26.9999%2056.4991L27.4999%2056.4991L27.5%2012.5003L27%2012.5003ZM15%200.500275L15%201.00028C21.3513%201.0003%2026.5%206.14903%2026.5%2012.5003L27%2012.5003L27.5%2012.5003C27.5%205.59674%2021.9036%200.000298399%2015%200.000275583L15%200.500275Z'%20fill='%2300BF87'/%3e%3c/svg%3e",Du="data:image/svg+xml,%3csvg%20width='28'%20height='61'%20viewBox='0%200%2028%2061'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M27.0053%2057.2042C27.2006%2057.009%2027.2006%2056.6924%2027.0053%2056.4971L23.8233%2053.3152C23.6281%2053.1199%2023.3115%2053.1199%2023.1162%2053.3152C22.921%2053.5104%2022.921%2053.827%2023.1162%2054.0223L25.9447%2056.8507L23.1163%2059.6791C22.921%2059.8744%2022.921%2060.191%2023.1163%2060.3862C23.3115%2060.5815%2023.6281%2060.5815%2023.8234%2060.3862L27.0053%2057.2042ZM12.5001%2056.8508L12.5001%2057.3508V57.3508L12.5001%2056.8508ZM0.500014%2044.8508L1.33317e-05%2044.8508V44.8508L0.500014%2044.8508ZM26.6518%2056.8507L26.6518%2056.3507L12.5001%2056.3508L12.5001%2056.8508L12.5001%2057.3508L26.6518%2057.3507L26.6518%2056.8507ZM0.500014%2044.8508L1.00001%2044.8508L1.00001%20-0.000388027L0.50001%20-0.000388722L9.54624e-06%20-0.000389416L1.33317e-05%2044.8508L0.500014%2044.8508ZM12.5001%2056.8508L12.5001%2056.3508C6.14877%2056.3508%201.00001%2051.2021%201.00001%2044.8508L0.500014%2044.8508L1.33317e-05%2044.8508C1.43871e-05%2051.7544%205.59649%2057.3508%2012.5001%2057.3508L12.5001%2056.8508Z'%20fill='%23FF9E32'/%3e%3c/svg%3e",xu="data:image/svg+xml,%3csvg%20width='57'%20height='31'%20viewBox='0%200%2057%2031'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M56.9989%200.500133C56.9989%200.223991%2056.7751%200.000131942%2056.4989%200.00013087C56.2228%200.000129795%2055.9989%200.223987%2055.9989%200.500131L56.4989%200.500132L56.9989%200.500133ZM56.4989%2015.0002L55.9989%2015.0002L56.4989%2015.0002ZM44.4989%2027.0001L44.4988%2027.5001L44.4989%2027.0001ZM0.146456%2026.6465C-0.0488074%2026.8418%20-0.0488086%2027.1584%200.146455%2027.3536L3.32843%2030.5356C3.52369%2030.7309%203.84027%2030.7309%204.03554%2030.5356C4.2308%2030.3403%204.2308%2030.0238%204.03554%2029.8285L1.20712%2027.0001L4.03555%2024.1716C4.23081%2023.9764%204.23081%2023.6598%204.03555%2023.4645C3.84029%2023.2693%203.5237%2023.2693%203.32844%2023.4645L0.146456%2026.6465ZM56.4989%200.500132L55.9989%200.500131L55.9989%2015.0002L56.4989%2015.0002L56.9989%2015.0002L56.9989%200.500133L56.4989%200.500132ZM44.4989%2027.0001L44.4989%2026.5001L0.500009%2026.5001L0.500008%2027.0001L0.500007%2027.5001L44.4988%2027.5001L44.4989%2027.0001ZM56.4989%2015.0002L55.9989%2015.0002C55.9988%2021.3514%2050.8501%2026.5001%2044.4989%2026.5001L44.4989%2027.0001L44.4988%2027.5001C51.4024%2027.5001%2056.9988%2021.9037%2056.9989%2015.0002L56.4989%2015.0002Z'%20fill='%2300BF87'/%3e%3c/svg%3e",Pu="data:image/svg+xml,%3csvg%20width='61'%20height='28'%20viewBox='0%200%2061%2028'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M3.32848%2027.0049C3.52374%2027.2002%203.84032%2027.2002%204.03559%2027.0049L7.21755%2023.8229C7.41281%2023.6277%207.4128%2023.3111%207.21754%2023.1158C7.02228%2022.9206%206.70569%2022.9206%206.51043%2023.1158L3.68203%2025.9443L0.85358%2023.1159C0.658316%2022.9206%200.341733%2022.9206%200.146472%2023.1159C-0.0487878%2023.3111%20-0.0487864%2023.6277%200.146478%2023.823L3.32848%2027.0049ZM3.68194%2012.4997L3.18194%2012.4997V12.4997L3.68194%2012.4997ZM15.6819%200.499617L15.6819%20-0.000382774V-0.000382774L15.6819%200.499617ZM3.68203%2026.6514L4.18203%2026.6514L4.18194%2012.4997L3.68194%2012.4997L3.18194%2012.4997L3.18203%2026.6514L3.68203%2026.6514ZM15.6819%200.499617L15.6819%200.999618L60.5331%200.999616L60.5331%200.499615L60.5331%20-0.000385315L15.6819%20-0.000382774L15.6819%200.499617ZM3.68194%2012.4997L4.18194%2012.4997C4.1819%206.14838%209.33063%200.999618%2015.6819%200.999618L15.6819%200.499617L15.6819%20-0.000382774C8.77834%20-0.00038191%203.18189%205.5961%203.18194%2012.4997L3.68194%2012.4997Z'%20fill='%23FF9E32'/%3e%3c/svg%3e",wn=(e,t,r={})=>({id:e,name:t,role:Array.isArray(r.role)?r.role:r.roleId!==void 0&&r.roleId!==null?[r.roleId]:[],canResolve:r.canResolve??"",canReassign:r.canReassign??"",finalLevel:r.finalLevel??"",escalateAfterMinutes:r.escalateAfterMinutes??""}),Se=[wn(1,"Level 1 - First Response"),wn(2,"Level 2 - Secondary")];function Iu({accent:e}){return s.jsxs("div",{className:`ca-escalation-connector ca-escalation-connector--desktop ca-escalation-connector--${e}`,"aria-hidden":"true",children:[s.jsx("img",{src:ku,alt:"",className:"ca-escalation-connector__arrow ca-escalation-connector__arrow--first"}),s.jsx("span",{children:"Escalates to"}),s.jsx("img",{src:Du,alt:"",className:"ca-escalation-connector__arrow ca-escalation-connector__arrow--second"})]})}function Mu({accent:e}){return s.jsxs("div",{className:`ca-escalation-connector ca-escalation-connector--mobile ca-escalation-connector--${e}`,"aria-hidden":"true",children:[s.jsx("img",{src:xu,alt:"",className:"ca-escalation-connector__arrow ca-escalation-connector__arrow--first"}),s.jsx("span",{children:"Escalates to"}),s.jsx("img",{src:Pu,alt:"",className:"ca-escalation-connector__arrow ca-escalation-connector__arrow--second"})]})}function es({id:e,selectedTableId:t,onSelect:r,setUpdatePayload:n,pageProps:a}){const o=e!=null,[i,l]=N.useState(()=>o?null:Se),[c,d]=N.useState(()=>o?[]:Se),[u,p]=N.useState(o),y=B.useDispatch();N.useEffect(()=>{let f=!1;if(e==null){n({id:e,tables:Se}),console.log("[TableCardGrid] no workflow id; using default form values:",Se);return}const b=async()=>{p(!0),l(null),d([]);try{const E=await y(lr(e)).unwrap(),L=(Array.isArray(E?.data)?E.data:Array.isArray(E)?E:Se).map((P,q)=>({...P,id:P.id??P.levelNo??q+1,name:P.name??`Level ${P.levelNo??q+1}`,role:Array.isArray(P.role)?P.role:P.roleId!==void 0&&P.roleId!==null?[P.roleId]:[]}));console.log("[TableCardGrid] GET response:",E),console.log("[TableCardGrid] initial form values:",L),f||(l(L),d(L),n({id:e,tables:L}))}catch(E){f||(console.log("[TableCardGrid] using default form values after GET error:",Se),console.error("Failed to load workflow steps:",E))}finally{f||p(!1)}};return e!=null?b():(n({id:e,tables:Se}),console.log("[TableCardGrid] no workflow id; using default form values:",Se)),()=>{f=!0}},[y,e,n]);const S=f=>{const b={id:e,tables:f};d(f),console.log("[TableCardGrid] updated form values:",f),console.log("[TableCardGrid] PUT payload:",b),n?.(b)},v=(f,b)=>{S(c.map(E=>E.id===f?{...E,...b}:E))},w=(f,b)=>{console.log(i,c,f,b),S(c.map(E=>E.id!==f?E:typeof b=="function"?b(E):b))},h=f=>{const b=c.reduce((E,O)=>Math.max(E,Number(O.id)||0),0)+1;S([...c,wn(b,f)])},m=f=>{S(c.filter(b=>b.id!==f))};return u||!i?null:s.jsx("div",{className:"ca-table-card-grid","aria-label":"Escalation levels",children:s.jsxs("div",{className:"ca-table-card-grid__track",children:[c.map((f,b)=>s.jsxs(N.Fragment,{children:[s.jsx(Yo,{name:f.name,pageProps:a,level:b+1,value:f,initialFormValues:f,setFormValues:E=>w(f.id,E),selected:f.id===t,onSelect:()=>r?.(f),onDelete:()=>m(f.id),onChange:E=>v(f.id,E)}),b<c.length-0?s.jsxs(s.Fragment,{children:[s.jsx(Iu,{accent:b===0?"green":b===1?"orange":"purple"}),s.jsx(Mu,{accent:b===0?"green":b===1?"orange":"purple"})]}):null]},f.id)),s.jsx(Go,{level:c.length+1,onAdd:h})]})})}function Bu({onNext:e,stepMeta:t,stepperProps:r,selectedTableCard:n,pageProps:a}){const{state:o,updateWorkflow:i}=fr(),{workflow:l}=o,[c,d]=N.useState(null),u=N.useCallback(w=>{d(w)},[]),p=B.useDispatch();let{id:y}=B.useSelector(w=>w.appDetails||{});const S=n??l.selectedTableCard??null,v=async()=>{if(!c){console.warn("WorkflowStep: workflow steps are not ready to save.");return}console.log("WorkflowStep update payload:",c),p(cr({id:c.id,tables:c,onSuccess:w=>{console.log("updateWorkflowSteps onSuccess:",w),r.onNext?.()},onFail:w=>console.log("updateWorkflowSteps onFail:",w)}))};return s.jsxs(s.Fragment,{children:[s.jsx(nt,{...r,steps:se,onNext:v,showNextButton:!0}),s.jsx(rt,{title:t.title,description:t.description,showNext:!1,children:s.jsx("div",{className:"ca-workflow__main",children:s.jsx(es,{id:y,selectedTableId:S?.id,onSelect:w=>i({selectedTableCard:w}),setUpdatePayload:u,pageProps:a})})})]})}function ts({onAdd:e}){return s.jsx("button",{type:"button",className:"ca-add-form-button",onClick:e,children:"+ Add Form Fields"})}const $u=["Text","Select","Radio","Number","Custom","Email","Date","Date Time","MultiSelect","Text Area","Checkbox"],Uu=["Both","User"],at={id:"default-statuses",fieldKey:"statuses",fieldLabel:"Statuses",originalFieldName:"Statuses",fieldType:"Dropdown",required:!0,fieldAccess:"",hideFor:[],dependsOn:"",options:["Open","Closed","Resolved","Under Verification"],optionColors:{...{Open:"#FF0000","Under Verification":"#FF6F00",Resolved:"#00D82F",Closed:"#006FFF"}},parentMappings:{},lockMode:"options",isNew:!1},ot={id:"custom-priorities",fieldKey:"priorities",fieldLabel:"Priorities",originalFieldName:"Priorities",fieldType:"Dropdown",required:!1,fieldAccess:"",hideFor:[],dependsOn:"",options:["Urgent","High","Medium","Low"],parentMappings:{},lockMode:"options",isNew:!1},Pt={id:"custom-store-id",fieldKey:"storeId",fieldLabel:"Store ID",originalFieldName:"Store ID",fieldType:"TextField",required:!1,fieldAccess:"",hideFor:[],dependsOn:"",options:[],optionColors:{},parentMappings:{},lockMode:"all",isNew:!1},ju=[{...ot,label:ot.fieldLabel},{...Pt,label:Pt.fieldLabel}];function st(e){const t=String(e?.fieldKey||"").toLowerCase(),r=String(e?.fieldLabel||e?.label||"").trim().toLowerCase();return t==="statuses"||r==="statuses"}function bn(e){const t=String(e?.fieldKey||"").toLowerCase(),r=String(e?.fieldLabel||e?.label||"").trim().toLowerCase();return t==="priorities"||r==="priorities"}function qu(e){const t=String(e?.fieldKey||"").toLowerCase(),r=String(e?.fieldLabel||e?.label||"").trim().toLowerCase();return t==="storeid"||r==="store id"}function It(e){return st(e)}function vn(e){return st(e)?{...at,...e,fieldKey:e.fieldKey||at.fieldKey,fieldType:at.fieldType,required:!0,options:e.options?.length?e.options:at.options,optionColors:{...at.optionColors,...e.optionColors},lockMode:"options"}:bn(e)?{...ot,...e,fieldKey:e.fieldKey||ot.fieldKey,fieldType:ot.fieldType,options:e.options?.length?e.options:ot.options,lockMode:"options"}:qu(e)?{...Pt,...e,fieldKey:e.fieldKey||Pt.fieldKey,fieldType:Pt.fieldType,lockMode:"all"}:e}function hr(e=[]){const t=e.map(vn);return t.some(st)?t:[vn({...at}),...t]}const Vu=new Set(["Select","Dropdown","MultiSelect","Checkbox","Radio"]);function Cn(e,t){return!t||e.includes(t)?e:[t,...e]}function rs(e){return JSON.stringify({fieldLabel:String(e.fieldLabel||"").trim(),fieldType:e.fieldType??"",required:!!e.required,fieldAccess:e.fieldAccess??"",hideFor:[...e.hideFor||[]].sort(),dependsOn:e.dependsOn||"",options:e.options||[],parentMappings:e.parentMappings||{},optionColors:e.optionColors||{},order:Number(e.order)||1})}const Wu="#9CA3AF";function ns({field:e,fieldOptions:t=[],fieldTypeOptions:r=[],fieldAccessOptions:n=[],hideForOptions:a=[],isSaving:o=!1,isDeleting:i=!1,selected:l=!1,isDragging:c=!1,onSelect:d,onDragStartField:u,onDragEndField:p,onReorder:y,onChange:S,onDelete:v,onSave:w}){const[h,m]=N.useState(""),f=rs(e),[b,E]=N.useState(()=>({id:e.id,signature:e.isNew?null:f}));b.id!==e.id&&E({id:e.id,signature:e.isNew?null:f});const O=e.lockMode==="all",L=O||e.lockMode==="options",P=Vu.has(e.fieldType),q=O||!P,k=!!(String(e.fieldLabel||"").trim()&&String(e.fieldType||"").trim()),A=b.signature!==f,M=!O&&A,V=!!o||!k,$=F=>S?.({...e,...F}),K=()=>{if(q)return;const F=h.trim();if(!F||e.options?.includes(F))return;const U=It(e)?{...e.optionColors||{},[F]:e.optionColors?.[F]||Wu}:e.optionColors;$({options:[...e.options||[],F],...It(e)?{optionColors:U}:{}}),m("")},X=F=>{if(q)return;const U={...e.optionColors||{}};delete U[F],$({options:e.options.filter(Ee=>Ee!==F),...It(e)?{optionColors:U}:{}})};return s.jsxs("article",{className:`ca-form-card${l?" ca-form-card--selected":""}${c?" ca-form-card--dragging":""}`,onClick:()=>d?.(e),onDragOver:F=>{F.preventDefault(),F.dataTransfer.dropEffect="move"},onDrop:F=>{F.preventDefault();const U=F.dataTransfer.getData("text/plain");y?.(U,e.id),p?.()},children:[s.jsxs("div",{className:"ca-form-card__row ca-form-card__row--order",children:[s.jsx("span",{className:"ca-form-card__drag",draggable:!0,"aria-label":"Reorder field",onClick:F=>F.stopPropagation(),onDragStart:F=>{F.dataTransfer.setData("text/plain",String(e.id)),F.dataTransfer.effectAllowed="move",u?.()},onDragEnd:()=>p?.(),children:s.jsx(mn,{size:15,color:"currentColor"})}),s.jsxs("div",{className:"ca-form-card__actions",children:[M?s.jsx("button",{type:"button",className:"ca-form-card__save","aria-label":"Save form field",disabled:V,onClick:async F=>{if(F.stopPropagation(),V)return;const U=await w?.(e);U&&E({id:e.id,signature:rs(U)})},children:"Save"}):null,s.jsx("button",{type:"button",className:"ca-icon-btn ca-form-card__delete","aria-label":"Delete form field",disabled:!!i,onClick:F=>{F.stopPropagation(),v?.(e.id)},children:s.jsx(gn,{size:15,color:"currentColor"})})]})]}),s.jsx("div",{className:"ca-form-card__row",children:s.jsx(ue,{value:e.fieldLabel,placeholder:"Enter field label",disabled:L,onChange:F=>$({fieldLabel:F.target.value})})}),s.jsx("div",{className:"ca-form-card__row",children:s.jsx(ie,{value:e.fieldType,options:Cn(r,e.fieldType),placeholder:"Select type",disabled:L,onChange:F=>$({fieldType:F.target.value})})}),s.jsx("div",{className:"ca-form-card__row ca-form-card__row--toggle",children:s.jsx(pn,{checked:!!e.required,disabled:L,onChange:F=>$({required:F}),"aria-label":"Required"})}),s.jsx("div",{className:"ca-form-card__row",children:s.jsx(ie,{value:e.fieldAccess,options:Cn(n,e.fieldAccess),placeholder:"Select access",disabled:L,onChange:F=>$({fieldAccess:F.target.value})})}),s.jsxs("div",{className:"ca-form-card__row",children:[s.jsx(ie,{value:"",options:a.filter(F=>!e.hideFor?.includes(F)),placeholder:"Select level",disabled:L,onChange:F=>$({hideFor:[...e.hideFor||[],F.target.value]})}),e.hideFor?.length?s.jsx("div",{className:"ca-form-card__chips",children:e.hideFor.map(F=>s.jsxs("span",{className:"ca-form-card__chip",children:[F,s.jsx("button",{type:"button","aria-label":`Remove ${F}`,disabled:L,onClick:()=>$({hideFor:e.hideFor.filter(U=>U!==F)}),children:"×"})]},F))}):null]}),s.jsx("div",{className:"ca-form-card__row",children:s.jsx(ie,{value:e.dependsOn,options:Cn(t,e.dependsOn),placeholder:"Select field label",disabled:L,onChange:F=>$({dependsOn:F.target.value})})}),s.jsxs("div",{className:"ca-form-card__row ca-form-card__row--options",children:[s.jsxs("div",{className:"ca-form-card__option-entry",children:[s.jsx(ue,{value:h,placeholder:"Enter option",disabled:q,onChange:F=>m(F.target.value),onKeyDown:F=>{F.key==="Enter"&&(F.preventDefault(),K())}}),s.jsx("button",{type:"button",className:"ca-form-card__add-option","aria-label":"Add option",disabled:q,onClick:K,children:"+"})]}),s.jsx("div",{className:"ca-form-card__chips",children:(e.options||[]).map(F=>s.jsxs("span",{className:"ca-form-card__chip",children:[F,s.jsx("button",{type:"button","aria-label":`Remove ${F}`,disabled:q,onClick:()=>X(F),children:"×"})]},F))})]})]})}function Hu(e){const t=String(e||"").trim();return/^#[0-9A-Fa-f]{6}$/.test(t)?t.toUpperCase():/^#[0-9A-Fa-f]{3}$/.test(t)?`#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`.toUpperCase():"#000000"}function zu({formFields:e=[],selectedField:t=null,onChange:r}){const n=t,a=It(n)?n:null,[o,i]=N.useState(!1),l=(v,w)=>{if(!a)return;const h=/^#[0-9A-Fa-f]{6}$/.test(w)?w.toUpperCase():w;r?.(e.map(m=>m.id===a.id?{...m,optionColors:{...m.optionColors,[v]:h}}:m))},c=v=>{if(!n)return;const w={...n.optionColors||{}};delete w[v],r?.(e.map(h=>h.id===n.id?{...h,options:(h.options||[]).filter(m=>m!==v),...It(h)?{optionColors:w}:{}}:h))},d=n?.fieldLabel||"Select field",u=st(n)?"Manage the statuses":bn(n)||n?"Manage your fields.":"Select a field to edit.",p=n?.options||[],y=(v,w)=>s.jsx("div",{className:"field-options-panel__table-wrap",children:s.jsxs("table",{className:"field-options-panel__table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[v.map(h=>s.jsx("th",{scope:"col",children:h},h)),s.jsx("th",{scope:"col","aria-label":"Delete"})]})}),s.jsx("tbody",{children:w})]})});let S=s.jsx("p",{className:"field-options-panel__empty",children:n?"No options added.":"Select a field to edit."});return a?S=p.length?y([st(a)?"Statuses":"Option","Colors"],p.map(v=>{const w=Hu(a.optionColors?.[v]);return s.jsxs("tr",{children:[s.jsx("td",{children:v}),s.jsx("td",{children:s.jsxs("div",{className:"field-options-panel__color",children:[s.jsx("input",{className:"field-options-panel__hex","aria-label":`Color for ${v}`,value:a.optionColors?.[v]||w,onChange:h=>l(v,h.target.value)}),s.jsx("label",{className:"field-options-panel__swatch",style:{background:w},title:w,children:s.jsx("input",{type:"color","aria-label":`Pick color for ${v}`,value:w,onChange:h=>l(v,h.target.value)})})]})}),s.jsx("td",{children:s.jsx("button",{className:"field-options-panel__delete",type:"button","aria-label":`Delete ${v}`,title:`Delete ${v}`,onClick:()=>c(v),children:s.jsx(Lo,{size:14,strokeWidth:1.5,color:"currentColor","aria-hidden":"true"})})})]},v)})):s.jsx("p",{className:"field-options-panel__empty",children:"No options added."}):p.length&&(S=y([bn(n)?"Priorities":"Option"],p.map(v=>s.jsxs("tr",{children:[s.jsx("td",{children:v}),s.jsx("td",{children:s.jsx("button",{className:"field-options-panel__delete",type:"button","aria-label":`Delete ${v}`,title:`Delete ${v}`,onClick:()=>c(v),children:s.jsx(Lo,{size:14,strokeWidth:1.5,color:"currentColor","aria-hidden":"true"})})})]},v)))),s.jsxs("aside",{className:`field-options-panel${o?" is-open":""}`,"aria-label":`Options for: ${d}`,children:[s.jsxs("button",{type:"button",className:"field-options-panel__summary","aria-expanded":o,"aria-controls":"field-options-panel-body",onClick:()=>i(v=>!v),children:[s.jsxs("span",{className:"field-options-panel__summary-text",children:[s.jsxs("span",{className:"field-options-panel__title",children:["Options for: ",d]}),s.jsx("span",{className:"field-options-panel__description",children:u})]}),s.jsx(No,{className:"field-options-panel__chevron",size:16,strokeWidth:1.8,"aria-hidden":"true"})]}),s.jsx("div",{id:"field-options-panel-body",className:"field-options-panel__body",children:S})]})}const Ku=["Order","Field Label","Field Type","Required","Field Access","Hide for","DependsOn","Options"];function Mt(e,t){return vn({...e,id:e.id??`${Date.now()}-${t}`,order:t+1,fieldLabel:e.fieldLabel??e.name??"",fieldType:e.fieldType??e.typeLabel??"Custom",required:!!e.required,fieldAccess:e.fieldAccess??"",hideFor:e.hideFor??[],dependsOn:e.dependsOn??"",options:e.options??[],parentMappings:e.parentMappings??{},optionColors:e.optionColors??{},lockMode:e.lockMode,isNew:!!e.isNew})}function as({initialFields:e,onChange:t,addExternalFieldRef:r,fieldTypeOptions:n=[],fieldAccessOptions:a=[],hideForOptions:o=[],savingFieldId:i=null,onSave:l,onDelete:c}){const[d,u]=N.useState(()=>(e??[]).map(Mt)),[p,y]=N.useState(null),[S,v]=N.useState(null),w=N.useRef(""),h=k=>{u(k),t?.(k)},m=(e??[]).map(k=>k.id).join(",");N.useEffect(()=>{!m||m===w.current||(w.current=m,u(e.map(Mt)))},[m,e]),N.useEffect(()=>{if(r)return r.current=k=>{k&&u(A=>{if(A.some($=>k.fieldKey&&$.fieldKey===k.fieldKey||$.fieldLabel===k.fieldLabel))return A;const V=[...A,Mt({...k,id:`${k.id}-${Date.now()}`},A.length)];return t?.(V),V})},()=>{r.current=null}},[r,t]);const f=(k,A)=>{if(k==null||A==null||String(k)===String(A))return;const M=d.findIndex(X=>String(X.id)===String(k)),V=d.findIndex(X=>String(X.id)===String(A));if(M<0||V<0)return;const $=[...d],[K]=$.splice(M,1);$.splice(V,0,K),h($.map((X,F)=>({...X,order:F+1})))},b=k=>h(d.map(A=>A.id===k.id?k:A)),E=async k=>{const A=d.find(M=>M.id===k);if(A)try{if(await c?.(A)===!1)return;h(d.filter(V=>V.id!==k).map((V,$)=>({...V,order:$+1})))}catch{}},O=()=>h([...d,Mt({id:`${Date.now()}-${d.length}`,fieldLabel:"",fieldType:n[0]??"",options:[],isNew:!0},d.length)]),L=async k=>{try{const A=await l?.(k);return A?(u(M=>{const V=M.map($=>$.id===k.id?Mt({...A,isNew:!1},($.order||1)-1):$);return t?.(V),V}),A):null}catch{return null}},P=d.map(k=>k.fieldLabel).filter(Boolean),q=d.find(k=>k.id===p)||d.find(st)||null;return s.jsxs("div",{className:"ca-form-card-grid__container ",children:[s.jsxs("div",{className:"ca-form-card-grid",children:[s.jsx("div",{className:"ca-form-card-grid__labels",children:Ku.map(k=>s.jsx("div",{className:"ca-form-card-grid__label",children:k},k))}),s.jsxs("div",{className:"ca-form-card-grid__cards",children:[d.map(k=>s.jsx(ns,{field:k,fieldOptions:P.filter(A=>A!==k.fieldLabel),fieldTypeOptions:n,fieldAccessOptions:a,hideForOptions:o,isSaving:i===k.id,selected:q?.id===k.id,isDragging:String(S)===String(k.id),onSelect:()=>y(k.id),onDragStartField:()=>v(k.id),onDragEndField:()=>v(null),onReorder:f,onChange:b,onDelete:E,onSave:L},k.id)),s.jsx(ts,{onAdd:O})]})]}),s.jsx(zu,{formFields:d,selectedField:q,onChange:h})]})}const os={department:_o,priorities:pu,statuses:du,storeId:mu};function Ju({fields:e=[],onAddField:t}){const[r,n]=N.useState(!1);return s.jsxs("aside",{className:`custom-field-table${r?" is-open":""}`,"aria-labelledby":"custom-field-table-title",children:[s.jsxs("button",{type:"button",className:"custom-field-table__summary","aria-expanded":r,"aria-controls":"custom-field-table-list",onClick:()=>n(a=>!a),children:[s.jsxs("span",{className:"custom-field-table__summary-text",children:[s.jsx("span",{id:"custom-field-table-title",className:"custom-field-table__title",children:"Custom Fields"}),s.jsx("span",{className:"custom-field-table__description",children:"Use these fields to show options from database table."})]}),s.jsx(No,{className:"custom-field-table__chevron",size:16,strokeWidth:1.8,"aria-hidden":"true"})]}),s.jsx("div",{id:"custom-field-table-list",className:"custom-field-table__list",children:e.map(a=>{const o=a.label??a.fieldLabel,i=os[a.fieldKey]||os[a.id]||_o;return s.jsxs("div",{className:"custom-field-table__row",children:[s.jsx(i,{className:"custom-field-table__field-icon",size:14,strokeWidth:1.5,"aria-hidden":"true"}),s.jsx("span",{className:"custom-field-table__label",children:o}),s.jsx("button",{className:"custom-field-table__add",type:"button","aria-label":`Add ${o}`,title:`Add ${o}`,onClick:()=>t?.(a),children:s.jsx(To,{size:14,strokeWidth:2,"aria-hidden":"true"})})]},a.fieldKey??a.id)})})]})}const ss={CUSTOM:"Custom",TEXT:"Text",TEXTAREA:"Text Area",SELECT:"Select",DROPDOWN:"Select",NUMBER:"Number",DATE:"Date",DATETIME:"Date Time",EMAIL:"Email",MULTISELECT:"MultiSelect",CHECKBOX:"Checkbox",RADIO:"Radio",FILE:"File"},is={BOTH:"Both",USER:"User",ADMIN:"Admin"},Ru={...Object.fromEntries(Object.entries(ss).map(([e,t])=>[t,e])),Select:"SELECT",Dropdown:"SELECT",Textarea:"TEXTAREA","Text Area":"TEXTAREA",TextField:"TEXT","Date Time":"DATETIME"},Zu={...Object.fromEntries(Object.entries(is).map(([e,t])=>[t,e])),All:"BOTH",Staff:"USER",Both:"BOTH",User:"USER"};function mr(e){const t=String(e||"").trim().split(/[^A-Za-z0-9]+/).filter(Boolean);return t.length?t[0].toLowerCase()+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1).toLowerCase()).join(""):""}function Sn(e){return e?typeof e.id=="number"||/^\d+$/.test(String(e.id)):!1}function Xu(e){const t=e.options||[],r=e.parentMappings||{},n=e.optionColors||{},a=t.some(i=>r[i]),o=t.some(i=>n[i]);return a||o?{values:t.map(i=>{const l={label:i};return r[i]&&(l.parent=r[i]),n[i]&&(l.color=n[i]),l})}:{values:t}}function Qu(e,t=[]){const r=String(e.fieldLabel||"").trim(),n=e.originalFieldName!=null&&r===String(e.originalFieldName).trim(),a=t.find(c=>String(c.fieldLabel||"").trim()===e.dependsOn&&e.dependsOn),o=n&&e.fieldKey||mr(r),i=a?a.fieldKey||mr(a.fieldLabel):"",l={fieldName:r,fieldKey:o,fieldType:Ru[e.fieldType]??String(e.fieldType||"CUSTOM").toUpperCase(),required:!!e.required,displayOrder:Number(e.order)||1,fieldAccess:Zu[e.fieldAccess]??(e.fieldAccess?String(e.fieldAccess).toUpperCase():"BOTH"),hideForWorkflowStepId:e.hideForWorkflowStepId??null,options:Xu(e),isActive:e.isActive!==!1};return i&&i!==o&&(l.dependsOnFieldKey=i),l}function ls(e){return JSON.stringify({fieldLabel:String(e.fieldLabel||"").trim(),fieldType:e.fieldType??"",required:!!e.required,fieldAccess:e.fieldAccess??"",hideFor:[...e.hideFor||[]].sort(),dependsOn:e.dependsOn||"",options:e.options||[],parentMappings:e.parentMappings||{},optionColors:e.optionColors||{},order:Number(e.order)||1})}function Gu(e,t){return ls(e)!==ls(t)}function Yu(e=[],t=e){return{fields:e.filter(n=>!n.isNew&&String(n.fieldLabel||"").trim()).map((n,a)=>Qu({...n,order:n.order||a+1},t))}}function ef(...e){const t=[],r=new Set;return e.flat().forEach(n=>{if(!Sn(n))return;const a=Number(n.id);r.has(a)||(r.add(a),t.push(a))}),t}function tf(e){return e?typeof e=="string"?e:e.name??e.label??e.title??null:null}function cs(e){return[...new Set(e.filter(Boolean))]}function ds(e){return typeof e=="string"?e:e?.label??""}function rf(e){return e&&typeof e=="object"&&e.color?e.color:""}function gr(e=[]){const t=[...e].sort((r,n)=>(r.displayOrder??0)-(n.displayOrder??0));return hr(t.map(r=>{const n=r?.options?.values??[],a=t.find(o=>o.id===r.dependsOnFieldId);return{id:r.id,order:r.displayOrder,fieldLabel:r.fieldName??r.fieldLabel??"",fieldType:ss[r.fieldType]??r.fieldType??"Custom",required:!!r.required,fieldAccess:is[r.fieldAccess]??r.fieldAccess??"",hideFor:cs([...Array.isArray(r.hideFor)?r.hideFor:[],tf(r.hideForWorkflowStep)]),dependsOn:r.dependsOnField?.fieldName??a?.fieldName??r.dependsOn??"",options:n.map(ds).filter(Boolean),parentMappings:Object.fromEntries(n.filter(o=>o&&typeof o=="object"&&o.label).map(o=>[o.label,o.parent??""])),optionColors:Object.fromEntries(n.map(o=>[ds(o),rf(o)]).filter(([o,i])=>o&&i)),fieldKey:r.fieldKey,originalFieldName:r.fieldName??r.fieldLabel??"",dependsOnFieldId:r.dependsOnFieldId??null,hideForWorkflowStepId:r.hideForWorkflowStepId??null,isActive:r.isActive!==!1,label:r.fieldName??r.fieldLabel??""}}))}function nf({stepMeta:e,stepperProps:t}){const r=B.useDispatch(),n=B.useSelector(A=>A.appDetails?.id),{state:a,update:o}=fr(),{formFields:i}=a,l=N.useRef(null),[c]=N.useState(null),[d,u]=N.useState(null),p=N.useCallback(A=>o({formFields:A}),[o]),y=N.useCallback(async A=>{const M=String(A.fieldLabel||"").trim();return M?{...A,fieldLabel:M,fieldKey:mr(M),originalFieldName:M,isNew:!1}:null},[]),S=N.useCallback(async A=>{if(!Sn(A))return!0;u(A.id);try{return await r(Ge({complaintTypeId:n,fieldId:A.id})).unwrap(),!0}finally{u(null)}},[n,r]),v=B.useSelector(A=>A.complaintAppComplaint?.formFields?.data),w=B.useSelector(A=>A.complaintAppComplaint?.formFields?.isLoading),h=B.useSelector(A=>A.complaintAppComplaint?.formFields?.error),[m,f]=N.useState(!1);N.useEffect(()=>{let A=!1;return r(ve(n)).unwrap().then(M=>{if(A)return;const V=Array.isArray(M)?M:M?.data,$=hr(gr(Array.isArray(V)?V:[]));o({formFields:$}),f(!0)}).catch(()=>{A||f(!0)}),()=>{A=!0}},[n,r,o]);const b=N.useMemo(()=>hr(gr(v)),[v]),E=ju,O=$u,L=Uu,P=N.useMemo(()=>cs(b.flatMap(A=>A.hideFor)),[b]),q=i.length?i:b,k=N.useCallback(async()=>{try{const A=q.filter(U=>!U.isNew&&String(U.fieldLabel||"").trim()),M=new Map(gr(v).map(U=>[Number(U.id),U]));if(!A.some(U=>{if(!Sn(U))return!0;const Ee=M.get(Number(U.id));return!Ee||Gu(U,Ee)})){t.onNext?.();return}const $=[...A].sort((U,Ee)=>+!!U.dependsOn-+!!Ee.dependsOn),K=ef(v,A);for(const U of K)try{await r(Ge({complaintTypeId:n,fieldId:U})).unwrap()}catch{}await r(Nt({complaintTypeId:n,data:Yu($,$)})).unwrap();const X=await r(ve(n)).unwrap(),F=Array.isArray(X)?X:X?.data;o({formFields:hr(gr(Array.isArray(F)?F:[]))}),t.onNext?.()}catch{}},[v,n,r,q,t,o]);return s.jsxs(s.Fragment,{children:[s.jsx(nt,{...t,steps:se,onNext:k}),s.jsx(rt,{className:"ca-settings-card--plain",title:e.title,description:e.description,showNext:!1,children:!m||w?s.jsx(tt,{text:"Loading form fields"}):h&&!q.length?s.jsx("p",{className:"ca-body",children:h}):s.jsxs("div",{className:"ca-form-fields",children:[h?s.jsx("p",{className:"ca-body",children:h}):null,s.jsx(Ju,{fields:E,onAddField:A=>l.current?.({...A})}),s.jsx(as,{initialFields:q,addExternalFieldRef:l,onChange:p,fieldTypeOptions:O,fieldAccessOptions:L,hideForOptions:P,savingFieldId:c,deletingFieldId:d,onSave:y,onDelete:S})]})})]})}const af=new Set(["select","dropdown","radio","checkbox"]);function us(e){return String(e||"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,"")}function it(e){return String(e.label||e.fieldLabel||e.fieldName||e.name||"").trim()}function fs(e){return`review-${e.id??e.fieldKey??(us(it(e))||"field")}`}function ps(e,t,r){return r===0?e:`${e}-${us(t)||r}`}function hs(e){const t=String(e.fieldType||"").toLowerCase(),r=String(e.fieldKey||it(e)||"").toLowerCase();return t==="email"||r.includes("email")?"email":t==="tel"||t==="phone"||r.includes("phone")?"tel":t==="textarea"||t==="text area"?"textarea":t==="date"?"date":t==="date time"||t==="datetime"||t==="datetime-local"?"datetime-local":t==="time"?"time":t==="number"?"number":t==="radio"?"radio":t==="checkbox"?"checkbox":(t==="multiselect"||t==="dropdown"||t==="select"||t==="custom")&&e.options?.length?"select":"text"}function of(e){return af.has(e)||e==="select"}function sf(e){return e==="textarea"||e==="radio"||e==="checkbox"}function lf(e){const t=String(e.fieldType||"").toLowerCase();return t==="text"||t==="textfield"}function ms(e){return String(e||"").replace(/\d/g,"")}function gs(e){return String(e||"").replace(/[^\d]/g,"")}function Bt(e,t){const r=String(it(e)||"value").toLowerCase();return t==="date"?"mm/dd/yyyy":t==="select"?`Select ${r}`:t==="textarea"?`Enter ${r}`:t==="email"?"Enter email":`Enter ${r}`}function cf({question:e}){const t=fs(e),r=hs(e),n=of(r)?e.options||[]:[],a={id:t,name:String(e.fieldKey||it(e)||t),required:!!e.required};return r==="radio"?s.jsx("div",{className:"review-options review-options--inline",children:n.map((o,i)=>{const l=ps(t,o,i);return s.jsxs("label",{className:"review-option",htmlFor:l,children:[s.jsx("input",{...a,id:l,type:"radio",value:o}),s.jsx("span",{children:o})]},o)})}):r==="checkbox"?s.jsx("div",{className:"review-options review-options--inline",children:n.map((o,i)=>{const l=ps(t,o,i);return s.jsxs("label",{className:"review-option",htmlFor:l,children:[s.jsx("input",{id:l,name:`${a.name}[]`,type:"checkbox",value:o,required:!1}),s.jsx("span",{children:o})]},o)})}):r==="textarea"?s.jsx("textarea",{...a,className:"review-control review-control--textarea",placeholder:Bt(e,r)}):r==="select"?s.jsxs("select",{...a,className:"review-control",defaultValue:"",children:[s.jsx("option",{value:"",children:Bt(e,r)}),n.map(o=>s.jsx("option",{value:o,children:o},o))]}):r==="number"?s.jsx("input",{...a,className:"review-control",type:"number",inputMode:"numeric",placeholder:Bt(e,r),onKeyDown:o=>{(o.key==="e"||o.key==="E"||o.key==="+"||o.key==="-"||o.key===".")&&o.preventDefault(),o.key.length===1&&!/\d/.test(o.key)&&!o.ctrlKey&&!o.metaKey&&o.preventDefault()},onInput:o=>{const i=gs(o.target.value);i!==o.target.value&&(o.target.value=i)},onPaste:o=>{const i=o.clipboardData.getData("text");if(/^\d*$/.test(i))return;o.preventDefault();const l=o.target,c=gs(i),d=l.selectionStart??l.value.length,u=l.selectionEnd??l.value.length;l.value=`${String(l.value).slice(0,d)}${c}${String(l.value).slice(u)}`}}):lf(e)?s.jsx("input",{...a,className:"review-control",type:"text",inputMode:"text",placeholder:Bt(e,r),onKeyDown:o=>{/^\d$/.test(o.key)&&o.preventDefault()},onInput:o=>{const i=ms(o.target.value);i!==o.target.value&&(o.target.value=i)},onPaste:o=>{const i=o.clipboardData.getData("text");if(!/\d/.test(i))return;o.preventDefault();const l=o.target,c=ms(i),d=l.selectionStart??l.value.length,u=l.selectionEnd??l.value.length;l.value=`${l.value.slice(0,d)}${c}${l.value.slice(u)}`}}):s.jsx("input",{...a,className:"review-control",type:r,placeholder:Bt(e,r)})}function df({fields:e=[]}){return e.length?s.jsx("div",{className:"review-form-card",children:s.jsx("form",{className:"review-form","aria-label":"Form fields preview",onSubmit:t=>t.preventDefault(),children:s.jsx("div",{className:"review-form-grid",children:e.map(t=>{const r=hs(t),n=fs(t);return s.jsxs("div",{className:`review-question${sf(r)?" review-question--wide":""}`,children:[s.jsxs("label",{className:"review-label",htmlFor:n,children:[it(t)||"Untitled field",t.required?s.jsx("span",{className:"review-required",children:"*"}):null]}),s.jsx(cf,{question:t})]},t.id??t.fieldKey??it(t))})})})}):s.jsx("p",{className:"review-empty",children:"No form fields added"})}const uf={CUSTOM:"Custom",TEXT:"Text",TEXTAREA:"Text Area",SELECT:"Select",DROPDOWN:"Dropdown",NUMBER:"Number",DATE:"Date",DATETIME:"Date Time",EMAIL:"Email",MULTISELECT:"MultiSelect",CHECKBOX:"Checkbox",RADIO:"Radio",FILE:"File"},ff={BOTH:"Both",USER:"User",ADMIN:"Admin"};function pf(e){return e?typeof e=="string"?e:e.name??e.label??e.title??null:null}function hf(e){return[...new Set(e.filter(Boolean))]}function mf(e){return typeof e=="string"?e:e?.label??""}function gf(e=[]){const t=[...e].sort((r,n)=>(r.displayOrder??0)-(n.displayOrder??0));return t.map(r=>{const n=r?.options?.values??[],a=t.find(o=>o.id===r.dependsOnFieldId);return{id:r.id,label:r.fieldName??r.fieldLabel??r.label??"",fieldLabel:r.fieldName??r.fieldLabel??r.label??"",fieldKey:r.fieldKey,fieldType:uf[r.fieldType]??r.fieldType??"Custom",required:!!r.required,fieldAccess:ff[r.fieldAccess]??r.fieldAccess??"",hideFor:hf([...Array.isArray(r.hideFor)?r.hideFor:[],pf(r.hideForWorkflowStep)]),dependsOn:r.dependsOnField?.fieldName??a?.fieldName??r.dependsOn??"",options:n.map(mf).filter(Boolean),parentMappings:Object.fromEntries(n.filter(o=>o&&typeof o=="object"&&o.label).map(o=>[o.label,o.parent??""]))}})}function yf({onPublish:e,stepMeta:t,stepperProps:r}){const n=B.useDispatch(),a=B.useSelector(d=>d.appDetails?.id),o=B.useSelector(d=>d.complaintAppComplaint.formFields.data),i=B.useSelector(d=>d.complaintAppComplaint.formFields.isLoading),l=B.useSelector(d=>d.complaintAppComplaint.formFields.error),c=N.useMemo(()=>gf(o),[o]);return N.useEffect(()=>{a&&n(ve(a))},[a,n]),s.jsxs(s.Fragment,{children:[s.jsx(nt,{...r,steps:se}),s.jsx(rt,{className:"ca-settings-card--plain",title:t.title,description:t.description,showNext:!1,children:s.jsx("div",{className:"ca-review",children:s.jsx("section",{className:"ca-review__block ca-review__block--last",children:i?s.jsx(tt,{text:"Loading form fields"}):l&&!c.length?s.jsx("p",{className:"ca-body",children:l}):s.jsx(df,{fields:c})})})})]})}function wf(e){const t=Number(e);return!Number.isFinite(t)||t<1?1:t>se.length?se.length:Math.floor(t)}function bf(e){const t=Number(e);return!Number.isFinite(t)||t<1?1:t>3?3:Math.floor(t)}function ys({title:e="Complaint Management Settings",onPublish:t,onStepChange:r,onSaveDraft:n,pageProps:a,showSaveButton:o=!0,showNextButton:i=!0}){const l=Le(),c=B.useDispatch(),{systemId:d}=jn(),[u,p]=Ki(),y=wf(u.get("step")||1),S=bf(u.get("substep")||1);console.log("setting rolelist:",a?.rolelist),N.useEffect(()=>{d&&c(et(d))},[c,d]),N.useEffect(()=>{if(!u.get("step")){const E=new URLSearchParams(u);E.set("step","1"),p(E,{replace:!0})}},[u,p]);const v=N.useMemo(()=>se.find(E=>E.id===y)||se[0],[y]),w=N.useCallback((E,O)=>{const L=new URLSearchParams(u);L.set("step",String(E)),E===4?L.set("substep",String(O??(E===y?S:1))):L.delete("substep"),p(L,{replace:!1}),r?.({systemId:d,step:E,substep:O})},[u,p,r,d,y,S]),h=()=>{if(y<se.length){w(y+1,1);return}l("/")},m=E=>{w(4,E)},f=()=>{t?.({systemId:d,step:y})},b={currentStep:y,onStepClick:E=>w(E,E===4?1:void 0),showSaveButton:o,showNextButton:i,onSaveDraft:()=>n?.({systemId:d,step:y}),onNext:h,className:"ca-settings-page__stepper"};return s.jsx(jo,{children:s.jsxs("div",{className:"ca-settings-page",children:[s.jsxs("div",{className:"ca-settings-page__header",children:[s.jsx("button",{type:"button",className:"ca-settings-page__back",onClick:()=>l("/"),"aria-label":"Back to Complaint Management",children:s.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:s.jsx("path",{d:"M15 6l-6 6 6 6",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round"})})}),s.jsx(sn,{children:e})]}),y===1?s.jsx(Fu,{stepMeta:v,stepperProps:b,pageProps:a}):null,y===2?s.jsx(Bu,{onNext:h,stepMeta:v,pageProps:a,substep:S,onSubstepChange:m,stepperProps:b}):null,y===5?s.jsx(Ou,{stepMeta:v,stepperProps:b}):null,y===3?s.jsx(nf,{stepMeta:v,stepperProps:b}):null,y===4?s.jsx(yf,{onPublish:f,stepMeta:v,stepperProps:b}):null]})},d||"new")}const vf=12,Cf="18 July 2026, 12:09";function Sf({totalCount:e=88}){return s.jsxs("section",{className:"ca-query-details","aria-labelledby":"query-management-title",children:[s.jsxs("div",{className:"ca-query-details__heading",children:[s.jsx("h1",{id:"query-management-title",className:"ca-query-details__title",children:"Query Management"}),s.jsxs("span",{className:"ca-query-details__count",children:["Total Count: ",e]})]}),s.jsxs("div",{className:"ca-query-details__summary",children:[s.jsxs("div",{className:"ca-query-details__card",children:[s.jsx("span",{className:"ca-query-details__label",children:"Total Queries"}),s.jsx("strong",{className:"ca-query-details__value",children:vf})]}),s.jsxs("div",{className:"ca-query-details__card",children:[s.jsx("span",{className:"ca-query-details__label",children:"Last Query Submitted Date"}),s.jsx("strong",{className:"ca-query-details__value",children:Cf})]})]})]})}const Ef=[{id:1,label:"Name",key:"name"},{id:2,label:"Email",key:"email"},{id:3,label:"Query Type",key:"queryType"},{id:4,label:"Description",key:"description"},{id:5,label:"Employee",key:"employee"},{id:6,label:"Status",key:"status"},{id:7,label:"Escalation To",key:"escalationTo"}],_f=[{id:1,name:"Rajesh Kumar",email:"rajesh@gmail.com",queryType:"shift_timing",description:"Need to upload hono hr app in new phone Emp id- 90998989",employee:"Employee",status:"Open",escalationTo:"Level 1"},{id:2,name:"Deepanshu",email:"deepanshu@gmail.com",queryType:"shift_timing",description:"Need to upload hono hr app in new phone Emp id- 90998989",employee:"Employee",status:"Open",escalationTo:"Level 1"},{id:3,name:"Ritik Kumar",email:"ritik@gmail.com",queryType:"shift_timing",description:"Need to upload hono hr app in new phone Emp id- 90998989",employee:"Employee",status:"Closed",escalationTo:"Level 2"},{id:4,name:"Raj Kumar",email:"raj@gmail.com",queryType:"shift_timing",description:"Need to upload hono hr app in new phone Emp id- 90998989",employee:"Employee",status:"Open",escalationTo:"Level 1"}],Nf=44,En=["Open","Closed"],_n=["Level 1","Level 2","Level 3"],ws={id:"status",label:"Status",key:"status"},bs={id:"escalationTo",label:"Escalation To",key:"escalationTo"};function Tf(e){return e==null||e===""?null:typeof e=="object"?e.data??e.id??null:e}function Lf(e){const t={id:e?.complaintId,status:e?.status??"",escalationTo:e?.level!=null&&e?.level!==""?`Level ${e.level}`:""};return(e?.formField||[]).forEach(r=>{const n=r.fieldKey||r.fieldName;n&&(t[n]=r.value)}),t}function yr(e,t=!1){const r=[];return!t&&e==="description"&&r.push("ca-query-table__desc"),e==="status"&&r.push("ca-query-table__sticky","ca-query-table__sticky--status"),e==="escalationTo"&&r.push("ca-query-table__sticky","ca-query-table__sticky--escalation"),r.length?r.join(" "):void 0}function vs(e,t){const r=t[e.key]??"-";if(e.key==="status"){const n=En.includes(r)?En:[r,...En];return s.jsx("select",{className:"ca-query-table__select",defaultValue:r,"aria-label":"Status",children:n.map(a=>s.jsx("option",{value:a,children:a},a))})}if(e.key==="escalationTo"){const n=_n.includes(r)?_n:[r,..._n];return s.jsx("select",{className:"ca-query-table__select",defaultValue:r,"aria-label":"Escalation to",children:n.map(a=>s.jsx("option",{value:a,children:a},a))})}return r}function Af({id:e=Nf,labelFields:t=Ef,tableData:r=_f}){const n=B.useDispatch(),a=Tf(B.useSelector(m=>m.appDetails?.id)),{list:o=[],isLoading:i=!1,error:l=null,hasLoaded:c=!1}=B.useSelector(m=>m.queryManagement??{});N.useEffect(()=>{a&&n(dr({complaintTypeId:a,page:1,limit:10}))},[a,n]);const d=N.useMemo(()=>o.map(m=>({...Lf(m),_fields:m?.formField||[]})),[o]),u=N.useMemo(()=>{const m=new Set,f=[];return d.forEach(b=>{(b._fields||[]).forEach(E=>{const O=E.fieldKey||E.fieldName;!O||O==="status"||O==="escalationTo"||m.has(O)||(m.add(O),f.push({id:O,label:E.fieldName||O,key:O}))})}),f},[d]),p=c||a?[...u,ws,bs]:t,y=c?d.map(({_fields:m,...f})=>f):a?[]:r,S=p.filter(m=>m.key!=="status"&&m.key!=="escalationTo"),v=[ws,bs],w=Le(),h=()=>{console.log("New Query button clicked"),w("/querymanagement/new/33")};return s.jsxs("section",{className:"ca-query-table","aria-label":"Query records",children:[s.jsxs("div",{className:"ca-query-table__toolbar",children:[s.jsxs("label",{className:"ca-query-table__filter",children:[s.jsx(hu,{size:14,"aria-hidden":"true"}),s.jsx("span",{className:"ca-query-table__sr-only",children:"Filter by status"}),s.jsxs("select",{defaultValue:"all","aria-label":"Filter by status",children:[s.jsx("option",{value:"all",children:"Select Status"}),s.jsx("option",{value:"open",children:"Open"}),s.jsx("option",{value:"closed",children:"Closed"})]})]}),s.jsxs("div",{className:"ca-query-table__actions",children:[s.jsx(Y,{variant:"outline",onClick:()=>h(),size:"sm",startIcon:s.jsx(To,{size:14}),children:"New Query"}),s.jsx(Y,{variant:"outline",size:"sm",startIcon:s.jsx(uu,{size:14}),children:"Download Report"})]})]}),l?s.jsx("p",{className:"ca-body",children:l}):null,i&&!y.length?s.jsx(tt,{text:"Loading queries"}):s.jsx("div",{className:"ca-query-table__scroll","data-label-field-id":e,children:s.jsxs("table",{children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{scope:"col",children:"#"}),S.map(m=>s.jsx("th",{scope:"col",className:yr(m.key,!0),children:m.label},m.id)),s.jsx("th",{className:"ca-query-table__spacer","aria-hidden":"true"}),v.map(m=>s.jsx("th",{scope:"col",className:yr(m.key,!0),children:m.label},m.id))]})}),s.jsx("tbody",{children:y.map((m,f)=>s.jsxs("tr",{children:[s.jsx("td",{children:f+1}),S.map(b=>s.jsx("td",{className:yr(b.key),children:vs(b,m)},`${m.id??f}-${b.id}`)),s.jsx("td",{className:"ca-query-table__spacer","aria-hidden":"true"}),v.map(b=>s.jsx("td",{className:yr(b.key),children:vs(b,m)},`${m.id??f}-${b.id}`))]},m.id??f))})]})})]})}const Ff=()=>s.jsxs("main",{className:"ca-query-management-page",children:[s.jsx(Sf,{}),s.jsx(Af,{})]}),Of=37,kf={CUSTOM:"Custom",TEXT:"Text",TEXTAREA:"Text Area",SELECT:"Select",DROPDOWN:"Dropdown",NUMBER:"Number",DATE:"Date",DATETIME:"Date Time",EMAIL:"Email",MULTISELECT:"MultiSelect",CHECKBOX:"Checkbox",RADIO:"Radio",FILE:"File"};function Df(e){return typeof e=="string"?e:e?.label??""}function xf(e=[]){return[...e].sort((r,n)=>(r.displayOrder??0)-(n.displayOrder??0)).map(r=>({id:r.id,label:r.fieldName??r.fieldLabel??r.label??"",fieldKey:r.fieldKey??String(r.id),fieldType:kf[r.fieldType]??r.fieldType??"Custom",required:!!r.required,options:(r?.options?.values??[]).map(Df).filter(Boolean)}))}function pe(e){return String(e.fieldKey||e.id||e.label)}function Nn(e){const t=String(e.fieldType||"").toLowerCase();return t==="textarea"||t==="text area"?"textarea":t==="date"?"date":t==="date time"||t==="datetime"||t==="datetime-local"?"datetime-local":t==="email"?"email":t==="number"?"number":t==="radio"?"radio":t==="checkbox"?"checkbox":(t==="multiselect"||t==="dropdown"||t==="select"||t==="custom")&&e.options.length?"select":"text"}function Cs(e){return`new-query-${e.id??pe(e)}`}function Ss(e){return Nn(e)==="checkbox"?[]:""}function Pf({field:e,value:t,onChange:r}){const n=Nn(e),a=Cs(e);if(n==="radio")return s.jsx("div",{className:"review-options review-options--inline",children:e.options.map(o=>s.jsxs("label",{className:"review-option",htmlFor:`${a}-${o}`,children:[s.jsx("input",{id:`${a}-${o}`,name:pe(e),type:"radio",value:o,checked:t===o,onChange:i=>r(i.target.value),required:e.required}),s.jsx("span",{children:o})]},o))});if(n==="checkbox"){const o=Array.isArray(t)?t:[];return s.jsx("div",{className:"review-options review-options--inline",children:e.options.map(i=>s.jsxs("label",{className:"review-option",htmlFor:`${a}-${i}`,children:[s.jsx("input",{id:`${a}-${i}`,name:`${pe(e)}[]`,type:"checkbox",value:i,checked:o.includes(i),onChange:l=>r(l.target.checked?[...o,i]:o.filter(c=>c!==i))}),s.jsx("span",{children:i})]},i))})}return n==="textarea"?s.jsx("textarea",{id:a,name:pe(e),className:"review-control review-control--textarea",value:t,onChange:o=>r(o.target.value),required:e.required}):n==="select"?s.jsxs("select",{id:a,name:pe(e),className:"review-control",value:t,onChange:o=>r(o.target.value),required:e.required,children:[s.jsxs("option",{value:"",children:["Select ",e.label.toLowerCase()]}),e.options.map(o=>s.jsx("option",{value:o,children:o},o))]}):s.jsx("input",{id:a,name:pe(e),className:"review-control",type:n,value:t,onChange:o=>r(o.target.value),required:e.required})}function If(){const e=B.useDispatch(),t=Le(),{complaintTypeId:r}=jn(),n=Number(r)||Of,[a,o]=N.useState([]),[i,l]=N.useState({}),[c,d]=N.useState(!0),[u,p]=N.useState(!1),[y,S]=N.useState(""),[v,w]=N.useState("");N.useEffect(()=>{let f=!1;return e(ve(n)).unwrap().then(b=>{if(f)return;const E=xf(Array.isArray(b?.data)?b.data:b);o(E),l(Object.fromEntries(E.map(O=>[pe(O),Ss(O)])))}).catch(b=>{f||S(b?.message||"Failed to load form fields.")}).finally(()=>{f||d(!1)}),()=>{f=!0}},[n,e]);const h=N.useMemo(()=>a.length>0,[a]),m=async f=>{f.preventDefault(),S(""),w(""),p(!0),console.log("Submitting query with values:",i);try{await I.post("/api/v1/complaints",{complaintTypeId:n,title:i.title||"Untitled Query",fieldValues:i}),w("Query submitted successfully."),t("/querymanagement")}catch(b){S(b?.response?.data?.message||b?.message||"Failed to submit query.")}finally{p(!1)}};return s.jsx("main",{className:"ca-query-management-page",children:s.jsxs("section",{className:"ca-query-details","aria-labelledby":"new-query-title",children:[s.jsxs("div",{className:"ca-query-details__heading",children:[s.jsx("h1",{id:"new-query-title",className:"ca-query-details__title",children:"New Query"}),s.jsx(Y,{variant:"outline",size:"sm",onClick:()=>t("/querymanagement"),children:"Back"})]}),c?s.jsx(tt,{text:"Loading form fields"}):null,!c&&y&&!h?s.jsx("p",{className:"ca-body",children:y}):null,!c&&h?s.jsxs("form",{className:"review-form-card",onSubmit:m,children:[s.jsx("div",{className:"review-form-grid",children:a.map(f=>s.jsxs("div",{className:`review-question${["textarea","radio","checkbox"].includes(Nn(f))?" review-question--wide":""}`,children:[s.jsxs("label",{className:"review-label",htmlFor:Cs(f),children:[f.label||"Untitled field",f.required?s.jsx("span",{className:"review-required",children:"*"}):null]}),s.jsx(Pf,{field:f,value:i[pe(f)]??Ss(f),onChange:b=>l(E=>({...E,[pe(f)]:b}))})]},f.id??pe(f)))}),s.jsx("div",{className:"ca-query-table__actions",children:s.jsx(Y,{type:"submit",disabled:u,children:u?"Submitting...":"Submit Query"})}),v?s.jsx("p",{className:"ca-body",children:v}):null,y?s.jsx("p",{className:"ca-form-error",children:y}):null]}):null]})})}function Mf({pageProps:e,onPublish:t,onStepChange:r,children:n}){const a=n??s.jsx(Bo,{...e});return console.log("ComplaintRouter pageProps:",e.rolelist),s.jsxs(_i,{children:[s.jsx(We,{path:"/",element:a}),s.jsx(We,{path:"/settings/:systemId",element:s.jsx(ys,{onPublish:t,onStepChange:r,pageProps:e})}),s.jsx(We,{path:"querymanagement",element:s.jsx(Ff,{})}),s.jsx(We,{path:"querymanagement/new/:complaintTypeId",element:s.jsx(If,{})}),s.jsx(We,{path:"*",element:a})]})}function Bf({pageProps:e,onPublish:t=a=>console.log(a),onStepChange:r=a=>console.log(a),children:n}){return console.log("App rolelist:",e?.rolelist),s.jsx(Mf,{pageProps:e,onPublish:t,onStepChange:r,children:n})}function $f({children:e}){const{cssVars:t,darkMode:r,mode:n}=Za();return s.jsx("div",{className:`ca-root ${r?"ca-root--dark":"ca-root--light"}`,"data-ca-theme":n,style:t,children:e})}function Uf({basePath:e,children:t}){return Ve()?t:s.jsx(Ui,{basename:e,children:t})}function jf({store:e,children:t}){const r=N.useContext(B.ReactReduxContext);return!e&&r?.store?t:s.jsx(B.Provider,{store:e||mo,children:t})}function qf({details:e,children:t}){const r=B.useDispatch();return N.useEffect(()=>{r(oo(e))},[r,e]),t}const Es=({apiUrl:e,authToken:t,store:r,basePath:n="/",theme:a,darkMode:o=!1,title:i,description:l,rolelist:c,systems:d,systemsEndpoint:u,useDemoData:p=!0,createLabel:y,onCreateForm:S,onConfigure:v,onOpen:w,onTitleClick:h,onDescriptionClick:m,onSearch:f,onPublish:b,onSaveDraft:E,showSaveButton:O,showNextButton:L,onStepChange:P,children:q})=>{const k={title:i,description:l,systems:d,systemsEndpoint:u,useDemoData:p,createLabel:y,onCreateForm:S,onConfigure:v,onOpen:w,rolelist:c,onTitleClick:h,onDescriptionClick:m,onSearch:f,onSaveDraft:E,showSaveButton:O,showNextButton:L},A=N.useMemo(()=>({apiUrl:e,authToken:t,basePath:n,theme:a,darkMode:o,title:i,description:l,rolelist:c,systems:d,systemsEndpoint:u,useDemoData:p,createLabel:y,onCreateForm:S,onConfigure:v,onOpen:w,onTitleClick:h,onDescriptionClick:m,onSearch:f,onPublish:b,onSaveDraft:E,showSaveButton:O,showNextButton:L,onStepChange:P}),[e,t,n,a,o,i,l,c,d,u,p,y,S,v,w,h,m,f,b,E,O,L,P]);return s.jsx(Ra,{theme:a,darkMode:o,children:s.jsx(jf,{store:r,children:s.jsx(qf,{details:A,children:s.jsx($f,{children:s.jsx(Va,{apiUrl:e,authToken:t,children:s.jsx(Uf,{basePath:n,children:s.jsx(Bf,{pageProps:k,onPublish:b,onStepChange:P,children:q})})})})})})})},Vf=me.colors,Wf=me.radii,Hf=me.spacing,zf=me.typography;C.AddFormButton=ts,C.AddTableCard=Go,C.ApiProvider=Va,C.BodyText=ur,C.Button=Y,C.COMPLAINT_ENDPOINTS=G,C.CardFooter=Fo,C.CardHeader=Ao,C.ChevronDownIcon=Wo,C.ChevronRightIcon=dn,C.Chip=Zo,C.CloseIcon=Jo,C.ComplaintApp=Es,C.ComplaintManagementPage=Bo,C.ComplaintSettingsPage=ys,C.DEFAULT_COMPLAINT_TYPE_ID=ud,C.DEFAULT_PAGE_DESCRIPTION=Mo,C.DEMO_SYSTEMS=Cu,C.DataPoint=Oo,C.Divider=ko,C.DragHandleIcon=mn,C.FieldLabel=pr,C.FormCard=ns,C.FormCardGrid=as,C.FormField=fe,C.FormInput=un,C.FormSelect=fn,C.FormTextarea=zo,C.Heading1=sn,C.Heading2=ln,C.Input=ue,C.LabelText=wo,C.LayersIcon=qo,C.LinkText=nu,C.Loading=tt,C.PageHeader=vo,C.PlusIcon=go,C.Radio=Xo,C.RoleMultiSelect=hn,C.SETTINGS_STEPS=se,C.SearchBar=Io,C.SearchIcon=Po,C.Select=ie,C.SettingsCard=rt,C.SettingsCardHeader=Vo,C.SettingsWizardProvider=jo,C.StatusBadge=Co,C.Stepper=nt,C.SystemCard=Do,C.SystemCardGrid=xo,C.TableCard=Yo,C.TableCardGrid=es,C.Tag=Ro,C.Textarea=Ho,C.ThemeProvider=Ra,C.Toggle=pn,C.ToggleField=Ko,C.TrashIcon=gn,C.Typography=Ce,C.ValueText=bo,C.WORKFLOW_SUBSTEPS=Su,C.api=I,C.appDetailsReducer=so,C.clearAppDetails=Kd,C.clearComplaintError=jd,C.clearId=Jd,C.clearSelectedComplaintResource=qd,C.colors=Vf,C.complaintDepartmentActions=Pe,C.complaintPriorityActions=Ie,C.complaintReducer=eo,C.complaintStatusActions=Be,C.complaintTypeActions=xe,C.complaintWorkflowActions=Me,C.createComplaintDepartment=Cd,C.createComplaintPriority=Td,C.createComplaintStatus=Md,C.createComplaintStore=ho,C.createComplaintType=gd,C.createComplaintWorkflow=kd,C.darkTheme=Et,C.deepMerge=Qe,C.default=Es,C.defaultThemeFile=Wa,C.deleteComplaintDepartment=Ed,C.deleteComplaintPriority=Ad,C.deleteComplaintStatus=$d,C.deleteComplaintType=wd,C.deleteComplaintWorkflow=xd,C.deleteFormField=Ge,C.deleteWorkflowSteps=Xa,C.getComplaintDepartmentById=vd,C.getComplaintDepartments=bd,C.getComplaintPriorities=_d,C.getComplaintPriorityById=Nd,C.getComplaintStatusById=Id,C.getComplaintStatuses=Pd,C.getComplaintTypeById=md,C.getComplaintTypes=hd,C.getComplaintWorkflowById=Od,C.getComplaintWorkflows=Fd,C.getDepartmentTree=rr,C.getFormFields=ve,C.getWorkflowSteps=nr,C.lightTheme=me,C.normalizeThemeFile=Ha,C.radii=Wf,C.resetComplaintState=Vd,C.resolveActiveTheme=za,C.saveFormFields=Nt,C.saveWorkflowSteps=ar,C.setAppDetails=oo,C.setAuthToken=Zr,C.setBaseUrl=qa,C.setId=et,C.setIsEdit=Dt,C.spacing=Hf,C.store=mo,C.themeToCssVars=Ka,C.typography=zf,C.updateComplaintDepartment=Sd,C.updateComplaintPriority=Ld,C.updateComplaintStatus=Bd,C.updateComplaintType=yd,C.updateComplaintWorkflow=Dd,C.useSettingsWizard=fr,C.useTheme=Za,Object.defineProperties(C,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
12
12
  //# sourceMappingURL=complaint-app.umd.js.map