/*! For license information please see main.ec4030c8.js.LICENSE.txt */ (()=>{"use strict";var e={400:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.version=void 0,t.version="0.0.0-automated"},579:(e,t,n)=>{e.exports=n(2799)},1210:function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const a=r(n(8829)),o=r(n(5736)),i=n(5745);class s{constructor(e){let{headers:t={},schema:n,fetch:r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.url=e,this.headers=Object.assign(Object.assign({},i.DEFAULT_HEADERS),t),this.schemaName=n,this.fetch=r}from(e){const t=new URL(`${this.url}/${e}`);return new a.default(t,{headers:Object.assign({},this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new s(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{head:r=!1,get:a=!1,count:i}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const s=new URL(`${this.url}/rpc/${e}`);let l;r||a?(t=r?"HEAD":"GET",Object.entries(n).filter((e=>{let[t,n]=e;return void 0!==n})).map((e=>{let[t,n]=e;return[t,Array.isArray(n)?`{${n.join(",")}}`:`${n}`]})).forEach((e=>{let[t,n]=e;s.searchParams.append(t,n)}))):(t="POST",l=n);const u=Object.assign({},this.headers);return i&&(u.Prefer=`count=${i}`),new o.default({method:t,url:s,headers:u,schema:this.schemaName,body:l,fetch:this.fetch,allowEmpty:!1})}}t.default=s},1323:(e,t,n)=>{n.d(t,{I:()=>p,f:()=>m});var r=n(5043);class a extends Error{}function o(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return function(e){return decodeURIComponent(atob(e).replace(/(.)/g,((e,t)=>{let n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n})))}(t)}catch(n){return atob(t)}}function i(e,t){if("string"!==typeof e)throw new a("Invalid token specified: must be a string");t||(t={});const n=!0===t.header?0:1,r=e.split(".")[n];if("string"!==typeof r)throw new a(`Invalid token specified: missing part #${n+1}`);let i;try{i=o(r)}catch(s){throw new a(`Invalid token specified: invalid base64 for part #${n+1} (${s.message})`)}try{return JSON.parse(i)}catch(s){throw new a(`Invalid token specified: invalid json for part #${n+1} (${s.message})`)}}a.prototype.name="InvalidTokenError";var s=n(579);const l="https://us-central1-apex-replicant.cloudfunctions.net/rule-service",u=(0,r.createContext)(),c={SET_LOADING:"SET_LOADING",SET_ERROR:"SET_ERROR",SET_RULES:"SET_RULES",ADD_RULE:"ADD_RULE",UPDATE_RULE:"UPDATE_RULE",DELETE_RULE:"DELETE_RULE",SET_ANALYTICS:"SET_ANALYTICS",SET_TEST_RESULTS:"SET_TEST_RESULTS",SET_TEMPLATES:"SET_TEMPLATES",CLEAR_ERROR:"CLEAR_ERROR"},d={rules:[],templates:[],analytics:null,testResults:null,loading:!1,error:null};function h(e,t){switch(t.type){case c.SET_LOADING:return{...e,loading:t.payload,error:t.payload?null:e.error};case c.SET_ERROR:return{...e,error:t.payload,loading:!1};case c.CLEAR_ERROR:return{...e,error:null};case c.SET_RULES:return{...e,rules:t.payload,loading:!1,error:null};case c.ADD_RULE:return{...e,rules:[...e.rules,t.payload],loading:!1,error:null};case c.UPDATE_RULE:return{...e,rules:e.rules.map((e=>e.id===t.payload.id?t.payload:e)),loading:!1,error:null};case c.DELETE_RULE:return{...e,rules:e.rules.filter((e=>e.id!==t.payload)),loading:!1,error:null};case c.SET_ANALYTICS:return{...e,analytics:t.payload,loading:!1,error:null};case c.SET_TEST_RESULTS:return{...e,testResults:t.payload,loading:!1,error:null};case c.SET_TEMPLATES:return{...e,templates:t.payload,loading:!1,error:null};default:return e}}const f=[{id:"client_frustration_alert",name:"\ud83d\udd25 Client Frustration Alert",description:"Get notified when clients express frustration or request human help",category:"escalation",service_type:"session",rule_category:"escalation",conditions:{operator:"OR",rules:[{field:"sentiment_score",operator:"less_than",value:.3},{field:"call_summary",operator:"contains_any",value:["frustrated","speak to human","real person","not satisfied"]}]},actions:[{type:"immediate_escalation",config:{priority:"high",notification_type:"client_frustration"}}]},{id:"session_summary_email",name:"\ud83d\udce7 Session Summary Email",description:"Automatically send session summaries after each completed call",category:"notification",service_type:"session",rule_category:"business_intelligence",conditions:{operator:"AND",rules:[{field:"session_status",operator:"equals",value:"completed"},{field:"session_duration",operator:"greater_than",value:300}]},actions:[{type:"notify_expert",config:{notification_type:"session_complete",template:"session_summary"}}]},{id:"quality_lead_followup",name:"\ud83c\udfaf Quality Lead Follow-up",description:"Send personalized follow-up emails to A and B level prospects",category:"follow_up",service_type:"session",rule_category:"business_intelligence",conditions:{operator:"AND",rules:[{field:"lead_score",operator:"in",value:["A","B"]},{field:"session_status",operator:"equals",value:"completed"}]},actions:[{type:"client_followup",config:{template:"quality_lead_followup",delay_hours:24}}]}];function p(e){let{children:t}=e;const[n,a]=(0,r.useReducer)(h,d),o=(0,r.useCallback)((()=>{const e=localStorage.getItem("accessToken");if(!e)return null;try{return i(e).api_key||"default-key"}catch(t){return console.error("Error decoding token:",t),"default-key"}}),[]),p=(0,r.useCallback)((()=>{const e=localStorage.getItem("accessToken");if(!e)return null;try{const t=i(e);return t.sub||t.user_id}catch(t){return console.error("Error decoding token:",t),null}}),[]),m=(0,r.useCallback)((async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=o();if(!n)throw new Error("No API key available");const r=await fetch(`${l}${e}`,{headers:{"Content-Type":"application/json","x-api-key":n,...t.headers},...t});if(!r.ok)throw new Error(`API call failed: ${r.status} ${r.statusText}`);return await r.json()}),[o]),g=(0,r.useCallback)((async()=>{const e=p();if(e){a({type:c.SET_LOADING,payload:!0});try{const t=await m(`/rules?expert_id=${e}&service_type=session`);a({type:c.SET_RULES,payload:t.rules||[]})}catch(t){console.error("Error loading rules:",t),a({type:c.SET_ERROR,payload:t.message})}}else a({type:c.SET_ERROR,payload:"No expert ID available"})}),[m,p]),v=(0,r.useCallback)((async e=>{const t=p();if(!t)throw new Error("No expert ID available");a({type:c.SET_LOADING,payload:!0});try{const n=await m("/rules",{method:"POST",body:JSON.stringify({...e,expert_id:t,rule_scope:"expert"})});return a({type:c.ADD_RULE,payload:n}),n}catch(n){throw console.error("Error creating rule:",n),a({type:c.SET_ERROR,payload:n.message}),n}}),[m,p]),y=(0,r.useCallback)((async(e,t)=>{a({type:c.SET_LOADING,payload:!0});try{const n=await m(`/rules/${e}`,{method:"PUT",body:JSON.stringify(t)});return a({type:c.UPDATE_RULE,payload:n}),n}catch(n){throw console.error("Error updating rule:",n),a({type:c.SET_ERROR,payload:n.message}),n}}),[m]),b=(0,r.useCallback)((async e=>{a({type:c.SET_LOADING,payload:!0});try{await m(`/rules/${e}`,{method:"DELETE"}),a({type:c.DELETE_RULE,payload:e})}catch(t){throw console.error("Error deleting rule:",t),a({type:c.SET_ERROR,payload:t.message}),t}}),[m]),w=(0,r.useCallback)((async(e,t)=>{a({type:c.SET_LOADING,payload:!0});try{const n=await m(`/rules/${e}/toggle`,{method:"POST",body:JSON.stringify({is_active:t})});a({type:c.UPDATE_RULE,payload:n.rule})}catch(n){console.error("Error toggling rule:",n),a({type:c.SET_ERROR,payload:n.message})}}),[m]),k=(0,r.useCallback)((async(e,t)=>{a({type:c.SET_LOADING,payload:!0});try{const n=await m(`/rules/${e}/test`,{method:"POST",body:JSON.stringify(t)});return a({type:c.SET_TEST_RESULTS,payload:n}),n}catch(n){throw console.error("Error testing rule:",n),a({type:c.SET_ERROR,payload:n.message}),n}}),[m]),_=(0,r.useCallback)((async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"24h";const t=p();if(t){a({type:c.SET_LOADING,payload:!0});try{const n=await m(`/analytics?service_type=session&time_range=${e}&expert_id=${t}`);a({type:c.SET_ANALYTICS,payload:n})}catch(n){console.error("Error loading analytics:",n),a({type:c.SET_ERROR,payload:n.message})}}}),[m,p]),S=(0,r.useCallback)((async()=>{try{a({type:c.SET_TEMPLATES,payload:f})}catch(e){console.error("Error loading templates:",e),a({type:c.SET_ERROR,payload:e.message})}}),[]),x=(0,r.useCallback)((()=>{a({type:c.CLEAR_ERROR})}),[]),E=(0,r.useCallback)((e=>n.templates.find((t=>t.id===e))),[n.templates]);(0,r.useEffect)((()=>{S()}),[S]);const T={rules:n.rules,templates:n.templates,analytics:n.analytics,testResults:n.testResults,loading:n.loading,error:n.error,loadRules:g,createRule:v,updateRule:y,deleteRule:b,toggleRule:w,testRule:k,loadAnalytics:_,loadTemplates:S,clearError:x,getTemplate:E};return(0,s.jsx)(u.Provider,{value:T,children:t})}function m(){const e=(0,r.useContext)(u);if(void 0===e)throw new Error("useRules must be used within a RuleProvider");return e}},1832:(e,t,n)=>{n.d(t,{A:()=>o});const r={backendProxy:"https://proxy-service-gateway-au4uagnd.uc.gateway.dev\r\r",webhookService:{NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0,REACT_APP_BACKEND_URL:"https://proxy-service-gateway-au4uagnd.uc.gateway.dev\r\r",REACT_APP_DEEPER_ONBOARDING_VAPI_ASSISTANT_ID:"4e5b0f3e-3322-468c-b185-4ef8ee8e1866",REACT_APP_ENVIRONMENT:"test",REACT_APP_SITE_URL:"http://localhost:3000",REACT_APP_STRIPE_PUBLISHABLE_KEY:"pk_live_51RsqLlQlQWc4RelR90DIbICaVuL54pY1MINimpUB6cNk5ic8OzUMq0nYQDQkYtrwvYO9JwrRuX45vjB7DmVzCcrU00tDVCiytg\r\r",REACT_APP_SUPABASE_ANON_KEY:"sb_publishable_bsBi_9kdOMYnN374Wg8TWQ_-Pltqp4G\r\r",REACT_APP_SUPABASE_URL:"https://jzohkzrrroxrjjomkjbg.supabase.co\r\r",REACT_APP_VAPI_PUBLIC_KEY:"0cc61bed-52da-4674-b316-6ada9ecd7157\r\r"}.REACT_APP_WEBHOOK_SERVICE_URL,expertService:{NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0,REACT_APP_BACKEND_URL:"https://proxy-service-gateway-au4uagnd.uc.gateway.dev\r\r",REACT_APP_DEEPER_ONBOARDING_VAPI_ASSISTANT_ID:"4e5b0f3e-3322-468c-b185-4ef8ee8e1866",REACT_APP_ENVIRONMENT:"test",REACT_APP_SITE_URL:"http://localhost:3000",REACT_APP_STRIPE_PUBLISHABLE_KEY:"pk_live_51RsqLlQlQWc4RelR90DIbICaVuL54pY1MINimpUB6cNk5ic8OzUMq0nYQDQkYtrwvYO9JwrRuX45vjB7DmVzCcrU00tDVCiytg\r\r",REACT_APP_SUPABASE_ANON_KEY:"sb_publishable_bsBi_9kdOMYnN374Wg8TWQ_-Pltqp4G\r\r",REACT_APP_SUPABASE_URL:"https://jzohkzrrroxrjjomkjbg.supabase.co\r\r",REACT_APP_VAPI_PUBLIC_KEY:"0cc61bed-52da-4674-b316-6ada9ecd7157\r\r"}.REACT_APP_EXPERT_SERVICE_URL,ruleService:{NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0,REACT_APP_BACKEND_URL:"https://proxy-service-gateway-au4uagnd.uc.gateway.dev\r\r",REACT_APP_DEEPER_ONBOARDING_VAPI_ASSISTANT_ID:"4e5b0f3e-3322-468c-b185-4ef8ee8e1866",REACT_APP_ENVIRONMENT:"test",REACT_APP_SITE_URL:"http://localhost:3000",REACT_APP_STRIPE_PUBLISHABLE_KEY:"pk_live_51RsqLlQlQWc4RelR90DIbICaVuL54pY1MINimpUB6cNk5ic8OzUMq0nYQDQkYtrwvYO9JwrRuX45vjB7DmVzCcrU00tDVCiytg\r\r",REACT_APP_SUPABASE_ANON_KEY:"sb_publishable_bsBi_9kdOMYnN374Wg8TWQ_-Pltqp4G\r\r",REACT_APP_SUPABASE_URL:"https://jzohkzrrroxrjjomkjbg.supabase.co\r\r",REACT_APP_VAPI_PUBLIC_KEY:"0cc61bed-52da-4674-b316-6ada9ecd7157\r\r"}.REACT_APP_RULE_SERVICE_URL,baseUrl:"http://localhost:3000",supabaseUrl:"https://jzohkzrrroxrjjomkjbg.supabase.co\r\r",supabaseAnonKey:"sb_publishable_bsBi_9kdOMYnN374Wg8TWQ_-Pltqp4G\r\r"},a=["backendProxy","supabaseUrl","supabaseAnonKey"].filter((e=>!r[e]));a.length>0&&(console.error("\u274c Missing required environment variables for:",a),console.error("Please check your .env file configuration"));const o=r},2611:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});class n extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}}t.default=n},2799:(e,t)=>{var n=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function a(e,t,r){var a=null;if(void 0!==r&&(a=""+r),void 0!==t.key&&(a=""+t.key),"key"in t)for(var o in r={},t)"key"!==o&&(r[o]=t[o]);else r=t;return t=r.ref,{$$typeof:n,type:e,key:a,ref:void 0!==t?t:null,props:r}}t.Fragment=r,t.jsx=a,t.jsxs=a},3314:()=>{},4288:(e,t)=>{var n=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),l=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),f=Symbol.iterator;var p={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},m=Object.assign,g={};function v(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||p}function y(){}function b(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||p}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if("object"!==typeof e&&"function"!==typeof e&&null!=e)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},y.prototype=v.prototype;var w=b.prototype=new y;w.constructor=b,m(w,v.prototype),w.isPureReactComponent=!0;var k=Array.isArray,_={H:null,A:null,T:null,S:null,V:null},S=Object.prototype.hasOwnProperty;function x(e,t,r,a,o,i){return r=i.ref,{$$typeof:n,type:e,key:t,ref:void 0!==r?r:null,props:i}}function E(e){return"object"===typeof e&&null!==e&&e.$$typeof===n}var T=/\/+/g;function C(e,t){return"object"===typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,(function(e){return t[e]}))}(""+e.key):t.toString(36)}function P(){}function j(e,t,a,o,i){var s=typeof e;"undefined"!==s&&"boolean"!==s||(e=null);var l,u,c=!1;if(null===e)c=!0;else switch(s){case"bigint":case"string":case"number":c=!0;break;case"object":switch(e.$$typeof){case n:case r:c=!0;break;case h:return j((c=e._init)(e._payload),t,a,o,i)}}if(c)return i=i(e),c=""===o?"."+C(e,0):o,k(i)?(a="",null!=c&&(a=c.replace(T,"$&/")+"/"),j(i,t,a,"",(function(e){return e}))):null!=i&&(E(i)&&(l=i,u=a+(null==i.key||e&&e.key===i.key?"":(""+i.key).replace(T,"$&/")+"/")+c,i=x(l.type,u,void 0,0,0,l.props)),t.push(i)),1;c=0;var d,p=""===o?".":o+":";if(k(e))for(var m=0;m{const n=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,r=/^[\u0021-\u003A\u003C-\u007E]*$/,a=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,o=/^[\u0020-\u003A\u003D-\u007E]*$/,i=Object.prototype.toString,s=(()=>{const e=function(){};return e.prototype=Object.create(null),e})();function l(e,t,n){do{const n=e.charCodeAt(t);if(32!==n&&9!==n)return t}while(++tn;){const n=e.charCodeAt(--t);if(32!==n&&9!==n)return t+1}return n}function c(e){if(-1===e.indexOf("%"))return e;try{return decodeURIComponent(e)}catch(t){return e}}},4391:(e,t,n)=>{!function e(){if("undefined"!==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"===typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}(),e.exports=n(7004)},4630:(e,t,n)=>{n.r(t),n.d(t,{Headers:()=>i,Request:()=>s,Response:()=>l,default:()=>o,fetch:()=>a});var r=function(){if("undefined"!==typeof self)return self;if("undefined"!==typeof window)return window;if("undefined"!==typeof n.g)return n.g;throw new Error("unable to locate global object")}();const a=r.fetch,o=r.fetch.bind(r),i=r.Headers,s=r.Request,l=r.Response},5043:(e,t,n)=>{e.exports=n(4288)},5180:(e,t,n)=>{n.d(t,{BV:()=>we,C5:()=>ve,Kd:()=>nt,N_:()=>at,Zp:()=>te,g:()=>ne,ok:()=>lt,qh:()=>ye,zy:()=>X});var r=n(5043),a=(n(4358),"popstate");function o(){return h((function(e,t){let{pathname:n,search:r,hash:a}=e.location;return u("",{pathname:n,search:r,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||"default")}),(function(e,t){return"string"===typeof t?t:c(t)}),null,arguments.length>0&&void 0!==arguments[0]?arguments[0]:{})}function i(e,t){if(!1===e||null===e||"undefined"===typeof e)throw new Error(t)}function s(e,t){if(!e){"undefined"!==typeof console&&console.warn(t);try{throw new Error(t)}catch(n){}}}function l(e,t){return{usr:e.state,key:e.key,idx:t}}function u(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3?arguments[3]:void 0;return{pathname:"string"===typeof e?e:e.pathname,search:"",hash:"",..."string"===typeof t?d(t):t,state:n,key:t&&t.key||r||Math.random().toString(36).substring(2,10)}}function c(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&"?"!==n&&(t+="?"===n.charAt(0)?n:"?"+n),r&&"#"!==r&&(t+="#"===r.charAt(0)?r:"#"+r),t}function d(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function h(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},{window:o=document.defaultView,v5Compat:s=!1}=r,d=o.history,h="POP",f=null,p=m();function m(){return(d.state||{idx:null}).idx}function g(){h="POP";let e=m(),t=null==e?null:e-p;p=e,f&&f({action:h,location:y.location,delta:t})}function v(e){let t="null"!==o.location.origin?o.location.origin:o.location.href,n="string"===typeof e?e:c(e);return n=n.replace(/ $/,"%20"),i(t,`No window.location.(origin|href) available to create URL for href: ${n}`),new URL(n,t)}null==p&&(p=0,d.replaceState({...d.state,idx:p},""));let y={get action(){return h},get location(){return e(o,d)},listen(e){if(f)throw new Error("A history only accepts one active listener");return o.addEventListener(a,g),f=e,()=>{o.removeEventListener(a,g),f=null}},createHref:e=>t(o,e),createURL:v,encodeLocation(e){let t=v(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:function(e,t){h="PUSH";let r=u(y.location,e,t);n&&n(r,e),p=m()+1;let a=l(r,p),i=y.createHref(r);try{d.pushState(a,"",i)}catch(c){if(c instanceof DOMException&&"DataCloneError"===c.name)throw c;o.location.assign(i)}s&&f&&f({action:h,location:y.location,delta:1})},replace:function(e,t){h="REPLACE";let r=u(y.location,e,t);n&&n(r,e),p=m();let a=l(r,p),o=y.createHref(r);d.replaceState(a,"",o),s&&f&&f({action:h,location:y.location,delta:0})},go:e=>d.go(e)};return y}new WeakMap;function f(e,t){return p(e,t,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"/",!1)}function p(e,t,n,r){let a=j(("string"===typeof t?d(t):t).pathname||"/",n);if(null==a)return null;let o=m(e);!function(e){e.sort(((e,t)=>e.score!==t.score?t.score-e.score:function(e,t){let n=e.length===t.length&&e.slice(0,-1).every(((e,n)=>e===t[n]));return n?e[e.length-1]-t[t.length-1]:0}(e.routesMeta.map((e=>e.childrenIndex)),t.routesMeta.map((e=>e.childrenIndex)))))}(o);let i=null;for(let s=0;null==i&&s1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",a=(e,a,o)=>{let s={relativePath:void 0===o?e.path||"":o,caseSensitive:!0===e.caseSensitive,childrenIndex:a,route:e};s.relativePath.startsWith("/")&&(i(s.relativePath.startsWith(r),`Absolute route path "${s.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),s.relativePath=s.relativePath.slice(r.length));let l=L([r,s.relativePath]),u=n.concat(s);e.children&&e.children.length>0&&(i(!0!==e.index,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),m(e.children,t,u,l)),(null!=e.path||e.index)&&t.push({path:l,score:x(l,e.index),routesMeta:u})};return e.forEach(((e,t)=>{if(""!==e.path&&e.path?.includes("?"))for(let n of g(e.path))a(e,t,n);else a(e,t)})),t}function g(e){let t=e.split("/");if(0===t.length)return[];let[n,...r]=t,a=n.endsWith("?"),o=n.replace(/\?$/,"");if(0===r.length)return a?[o,""]:[o];let i=g(r.join("/")),s=[];return s.push(...i.map((e=>""===e?o:[o,e].join("/")))),a&&s.push(...i),s.map((t=>e.startsWith("/")&&""===t?"/":t))}var v=/^:[\w-]+$/,y=3,b=2,w=1,k=10,_=-2,S=e=>"*"===e;function x(e,t){let n=e.split("/"),r=n.length;return n.some(S)&&(r+=_),t&&(r+=b),n.filter((e=>!S(e))).reduce(((e,t)=>e+(v.test(t)?y:""===t?w:k)),r)}function E(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],{routesMeta:r}=e,a={},o="/",i=[];for(let s=0;s{let{paramName:r,isOptional:a}=t;if("*"===r){let e=s[n]||"";i=o.slice(0,o.length-e.length).replace(/(.)\/+$/,"$1")}const l=s[n];return e[r]=a&&!l?void 0:(l||"").replace(/%2F/g,"/"),e}),{}),pathname:o,pathnameBase:i,pattern:e}}function C(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];s("*"===e||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,((e,t,n)=>(r.push({paramName:t,isOptional:null!=n}),n?"/?([^\\/]+)?":"/([^\\/]+)")));return e.endsWith("*")?(r.push({paramName:"*"}),a+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":""!==e&&"/"!==e&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),r]}function P(e){try{return e.split("/").map((e=>decodeURIComponent(e).replace(/\//g,"%2F"))).join("/")}catch(t){return s(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function j(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&"/"!==r?null:e.slice(n)||"/"}function R(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in and the router will parse it for you.`}function A(e){return e.filter(((e,t)=>0===t||e.route.path&&e.route.path.length>0))}function N(e){let t=A(e);return t.map(((e,n)=>n===t.length-1?e.pathname:e.pathnameBase))}function O(e,t,n){let r,a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];"string"===typeof e?r=d(e):(r={...e},i(!r.pathname||!r.pathname.includes("?"),R("?","pathname","search",r)),i(!r.pathname||!r.pathname.includes("#"),R("#","pathname","hash",r)),i(!r.search||!r.search.includes("#"),R("#","search","hash",r)));let o,s=""===e||""===r.pathname,l=s?"/":r.pathname;if(null==l)o=n;else{let e=t.length-1;if(!a&&l.startsWith("..")){let t=l.split("/");for(;".."===t[0];)t.shift(),e-=1;r.pathname=t.join("/")}o=e>=0?t[e]:"/"}let u=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/",{pathname:n,search:r="",hash:a=""}="string"===typeof e?d(e):e,o=n?n.startsWith("/")?n:function(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach((e=>{".."===e?n.length>1&&n.pop():"."!==e&&n.push(e)})),n.length>1?n.join("/"):"/"}(n,t):t;return{pathname:o,search:$(r),hash:z(a)}}(r,o),c=l&&"/"!==l&&l.endsWith("/"),h=(s||"."===l)&&n.endsWith("/");return u.pathname.endsWith("/")||!c&&!h||(u.pathname+="/"),u}var L=e=>e.join("/").replace(/\/\/+/g,"/"),I=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),$=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",z=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"";function D(e){return null!=e&&"number"===typeof e.status&&"string"===typeof e.statusText&&"boolean"===typeof e.internal&&"data"in e}var U=["POST","PUT","PATCH","DELETE"],M=(new Set(U),["GET",...U]);new Set(M),Symbol("ResetLoaderData");var F=r.createContext(null);F.displayName="DataRouter";var B=r.createContext(null);B.displayName="DataRouterState";var q=r.createContext({isTransitioning:!1});q.displayName="ViewTransition";var H=r.createContext(new Map);H.displayName="Fetchers";var W=r.createContext(null);W.displayName="Await";var V=r.createContext(null);V.displayName="Navigation";var K=r.createContext(null);K.displayName="Location";var G=r.createContext({outlet:null,matches:[],isDataRoute:!1});G.displayName="Route";var J=r.createContext(null);J.displayName="RouteError";var Q=!0;function Y(){return null!=r.useContext(K)}function X(){return i(Y(),"useLocation() may be used only in the context of a component."),r.useContext(K).location}var Z="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function ee(e){r.useContext(V).static||r.useLayoutEffect(e)}function te(){let{isDataRoute:e}=r.useContext(G);return e?function(){let{router:e}=de("useNavigate"),t=fe("useNavigate"),n=r.useRef(!1);ee((()=>{n.current=!0}));let a=r.useCallback((async function(r){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};s(n.current,Z),n.current&&("number"===typeof r?e.navigate(r):await e.navigate(r,{fromRouteId:t,...a}))}),[e,t]);return a}():function(){i(Y(),"useNavigate() may be used only in the context of a component.");let e=r.useContext(F),{basename:t,navigator:n}=r.useContext(V),{matches:a}=r.useContext(G),{pathname:o}=X(),l=JSON.stringify(N(a)),u=r.useRef(!1);ee((()=>{u.current=!0}));let c=r.useCallback((function(r){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(s(u.current,Z),!u.current)return;if("number"===typeof r)return void n.go(r);let i=O(r,JSON.parse(l),o,"path"===a.relative);null==e&&"/"!==t&&(i.pathname="/"===i.pathname?t:L([t,i.pathname])),(a.replace?n.replace:n.push)(i,a.state,a)}),[t,n,l,o,e]);return c}()}r.createContext(null);function ne(){let{matches:e}=r.useContext(G),t=e[e.length-1];return t?t.params:{}}function re(e){let{relative:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{matches:n}=r.useContext(G),{pathname:a}=X(),o=JSON.stringify(N(n));return r.useMemo((()=>O(e,JSON.parse(o),a,"path"===t)),[e,o,a,t])}function ae(e,t,n,a){i(Y(),"useRoutes() may be used only in the context of a component.");let{navigator:o,static:l}=r.useContext(V),{matches:u}=r.useContext(G),c=u[u.length-1],h=c?c.params:{},p=c?c.pathname:"/",m=c?c.pathnameBase:"/",g=c&&c.route;if(Q){let e=g&&g.path||"";ge(p,!g||e.endsWith("*")||e.endsWith("*?"),`You rendered descendant (or called \`useRoutes()\`) at "${p}" (under ) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.\n\nPlease change the parent to .`)}let v,y=X();if(t){let e="string"===typeof t?d(t):t;i("/"===m||e.pathname?.startsWith(m),`When overriding the location using \`\` 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 "${m}" but pathname "${e.pathname}" was given in the \`location\` prop.`),v=e}else v=y;let b=v.pathname||"/",w=b;if("/"!==m){let e=m.replace(/^\//,"").split("/");w="/"+b.replace(/^\//,"").split("/").slice(e.length).join("/")}let k=!l&&n&&n.matches&&n.matches.length>0?n.matches:f(e,{pathname:w});Q&&(s(g||null!=k,`No routes matched location "${v.pathname}${v.search}${v.hash}" `),s(null==k||void 0!==k[k.length-1].route.element||void 0!==k[k.length-1].route.Component||void 0!==k[k.length-1].route.lazy,`Matched leaf route at location "${v.pathname}${v.search}${v.hash}" does not have an element or Component. This means it will render an with a null value by default resulting in an "empty" page.`));let _=ue(k&&k.map((e=>Object.assign({},e,{params:Object.assign({},h,e.params),pathname:L([m,o.encodeLocation?o.encodeLocation(e.pathname).pathname:e.pathname]),pathnameBase:"/"===e.pathnameBase?m:L([m,o.encodeLocation?o.encodeLocation(e.pathnameBase).pathname:e.pathnameBase])}))),u,n,a);return t&&_?r.createElement(K.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...v},navigationType:"POP"}},_):_}function oe(){let e=pe(),t=D(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,a="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:a},i={padding:"2px 4px",backgroundColor:a},s=null;return Q&&(console.error("Error handled by React Router default ErrorBoundary:",e),s=r.createElement(r.Fragment,null,r.createElement("p",null,"\ud83d\udcbf Hey developer \ud83d\udc4b"),r.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",r.createElement("code",{style:i},"ErrorBoundary")," or"," ",r.createElement("code",{style:i},"errorElement")," prop on your route."))),r.createElement(r.Fragment,null,r.createElement("h2",null,"Unexpected Application Error!"),r.createElement("h3",{style:{fontStyle:"italic"}},t),n?r.createElement("pre",{style:o},n):null,s)}var ie=r.createElement(oe,null),se=class extends r.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||"idle"!==t.revalidation&&"idle"===e.revalidation?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:void 0!==e.error?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){console.error("React Router caught the following error during render",e,t)}render(){return void 0!==this.state.error?r.createElement(G.Provider,{value:this.props.routeContext},r.createElement(J.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function le(e){let{routeContext:t,match:n,children:a}=e,o=r.useContext(F);return o&&o.static&&o.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=n.route.id),r.createElement(G.Provider,{value:t},a)}function ue(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(null==e){if(!n)return null;if(n.errors)e=n.matches;else{if(0!==t.length||n.initialized||!(n.matches.length>0))return null;e=n.matches}}let a=e,o=n?.errors;if(null!=o){let e=a.findIndex((e=>e.route.id&&void 0!==o?.[e.route.id]));i(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),a=a.slice(0,Math.min(a.length,e+1))}let s=!1,l=-1;if(n)for(let r=0;r=0?a.slice(0,l+1):[a[0]];break}}}return a.reduceRight(((e,i,u)=>{let c,d=!1,h=null,f=null;n&&(c=o&&i.route.id?o[i.route.id]:void 0,h=i.route.errorElement||ie,s&&(l<0&&0===u?(ge("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,f=null):l===u&&(d=!0,f=i.route.hydrateFallbackElement||null)));let p=t.concat(a.slice(0,u+1)),m=()=>{let t;return t=c?h:d?f:i.route.Component?r.createElement(i.route.Component,null):i.route.element?i.route.element:e,r.createElement(le,{match:i,routeContext:{outlet:e,matches:p,isDataRoute:null!=n},children:t})};return n&&(i.route.ErrorBoundary||i.route.errorElement||0===u)?r.createElement(se,{location:n.location,revalidation:n.revalidation,component:h,error:c,children:m(),routeContext:{outlet:null,matches:p,isDataRoute:!0}}):m()}),null)}function ce(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function de(e){let t=r.useContext(F);return i(t,ce(e)),t}function he(e){let t=r.useContext(B);return i(t,ce(e)),t}function fe(e){let t=function(e){let t=r.useContext(G);return i(t,ce(e)),t}(e),n=t.matches[t.matches.length-1];return i(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function pe(){let e=r.useContext(J),t=he("useRouteError"),n=fe("useRouteError");return void 0!==e?e:t.errors?.[n]}var me={};function ge(e,t,n){t||me[e]||(me[e]=!0,s(!1,n))}r.memo((function(e){let{routes:t,future:n,state:r}=e;return ae(t,void 0,r,n)}));function ve(e){let{to:t,replace:n,state:a,relative:o}=e;i(Y()," may be used only in the context of a component.");let{static:l}=r.useContext(V);s(!l," must not be used on the initial render in a . This is a no-op, but you should modify your code so the is only ever rendered in response to some user interaction or state change.");let{matches:u}=r.useContext(G),{pathname:c}=X(),d=te(),h=O(t,N(u),c,"path"===o),f=JSON.stringify(h);return r.useEffect((()=>{d(JSON.parse(f),{replace:n,state:a,relative:o})}),[d,f,o,n,a]),null}function ye(e){i(!1,"A is only ever to be used as the child of element, never rendered directly. Please wrap your in a .")}function be(e){let{basename:t="/",children:n=null,location:a,navigationType:o="POP",navigator:l,static:u=!1}=e;i(!Y(),"You cannot render a inside another . You should never have more than one in your app.");let c=t.replace(/^\/*/,"/"),h=r.useMemo((()=>({basename:c,navigator:l,static:u,future:{}})),[c,l,u]);"string"===typeof a&&(a=d(a));let{pathname:f="/",search:p="",hash:m="",state:g=null,key:v="default"}=a,y=r.useMemo((()=>{let e=j(f,c);return null==e?null:{location:{pathname:e,search:p,hash:m,state:g,key:v},navigationType:o}}),[c,f,p,m,g,v,o]);return s(null!=y,` is not able to match the URL "${f}${p}${m}" because it does not start with the basename, so the won't render anything.`),null==y?null:r.createElement(V.Provider,{value:h},r.createElement(K.Provider,{children:n,value:y}))}function we(e){let{children:t,location:n}=e;return ae(ke(t),n)}r.Component;function ke(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=[];return r.Children.forEach(e,((e,a)=>{if(!r.isValidElement(e))return;let o=[...t,a];if(e.type===r.Fragment)return void n.push.apply(n,ke(e.props.children,o));i(e.type===ye,`[${"string"===typeof e.type?e.type:e.type.name}] is not a component. All component children of must be a or `),i(!e.props.index||!e.props.children,"An index route cannot have child routes.");let s={id:e.props.id||o.join("-"),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:!0===e.props.hasErrorBoundary||null!=e.props.ErrorBoundary||null!=e.props.errorElement,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(s.children=ke(e.props.children,o)),n.push(s)})),n}var _e="get",Se="application/x-www-form-urlencoded";function xe(e){return null!=e&&"string"===typeof e.tagName}function Ee(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return new URLSearchParams("string"===typeof e||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce(((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map((e=>[n,e])):[[n,r]])}),[]))}var Te=null;var Ce=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Pe(e){return null==e||Ce.has(e)?e:(s(!1,`"${e}" is not a valid \`encType\` for \`
\`/\`\` and will default to "${Se}"`),null)}function je(e,t){let n,r,a,o,i;if(xe(s=e)&&"form"===s.tagName.toLowerCase()){let i=e.getAttribute("action");r=i?j(i,t):null,n=e.getAttribute("method")||_e,a=Pe(e.getAttribute("enctype"))||Se,o=new FormData(e)}else if(function(e){return xe(e)&&"button"===e.tagName.toLowerCase()}(e)||function(e){return xe(e)&&"input"===e.tagName.toLowerCase()}(e)&&("submit"===e.type||"image"===e.type)){let i=e.form;if(null==i)throw new Error('Cannot submit a