@campxdev/campx-web-utils 2.0.14 → 2.0.16
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.
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/types/src/components/Exotel/ExotelPhone.d.ts +2 -2
- package/dist/cjs/types/src/services/exotel/api.d.ts +1 -0
- package/dist/esm/index.js +2 -2
- package/dist/esm/types/src/components/Exotel/ExotelPhone.d.ts +2 -2
- package/dist/esm/types/src/services/exotel/api.d.ts +1 -0
- package/dist/index.d.ts +2 -1
- package/package.json +1 -1
- package/src/components/Exotel/CallButton.tsx +35 -1
- package/src/components/Exotel/CallDispositionForm.tsx +1 -1
- package/src/components/Exotel/ExotelPhone.tsx +109 -104
- package/src/providers/ExotelProvider.tsx +10 -2
- package/src/services/exotel/api.ts +131 -159
- package/src/utils/constants.ts +1 -0
package/dist/cjs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("axios"),t=require("js-cookie"),n=require("pullstate"),r=require("react/jsx-runtime"),o=require("@campxdev/react-blueprint"),i=require("react"),s=require("react-query"),a=require("react-router-dom"),c=require("@hookform/resolvers"),l=require("react-hook-form"),u=require("device-detector-js"),d=require("yup"),p=require("react-redux"),f=require("@exotel-npm-dev/exotel-ip-calling-crm-websdk"),h=require("react-dom"),m=require("lucide-react"),v=require("scrypt-js");function b(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,Object.freeze(t)}var y=b(i),g=b(d),x=function(){return x=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},x.apply(this,arguments)};function w(e,t,n,r){return new(n||(n=Promise))(function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}c((r=r.apply(e,t||[])).next())})}function E(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}"function"==typeof SuppressedError&&SuppressedError;var S={isLoginDialogOpen:!1,snackbar:{open:!1,message:"",severity:"success"},confirmDialog:{isOpen:!1,title:"",message:"",onConfirm:function(){},onCancel:function(){},type:"confirm"},user:void 0,institutionInfo:void 0,asset:void 0},N=new n.Store(S),_=window.location.hostname.includes("localhost"),j=window.location.hostname.split(".")[0],k=window.location.pathname.split("/")[1],C=window.location.pathname.split("/")[2],O={"student-workspace":"/student-api","faculty-workspace":"/faculty-api","department-workspace":"/department-api","academic-coordinator-workspace":"/academic-coordinator-api","feedback-coordinator-workspace":"/feedback-coordinator-api","course-coordinator-workspace":"/course-coordinator-api","classroom-coordinator-workspace":"/classroom-coordinator-api","coe-workspace":"/coe-api","academic-admin-workspace":"/academic-admin-api","hostel-admin-workspace":"/hostel-admin-api","transport-coordinator-workspace":"/transport-coordinator-api","employee-workspace":"/employee-api","librarian-workspace":"/librarian-api","fee-terminal":"/fee-terminal-api","accounts-officer-workspace":"accounts-officer-api","finance-officer-workspace":"finance-officer-api","outreach-agent-workspace":"outreach-agent-api","prospect-workspace":"prospect-api","research-coordinator-workspace":"research-coordinator-api","tele-counsellor-workspace":"tele-counsellor-api","team-owner-workspace":"/team-owner-api","admissions-counsellor-workspace":"/admissions-counsellor-api","admissions-officer-workspace":"/admissions-officer-api"},P=e.create({baseURL:process.env.REACT_APP_API_HOST||"",withCredentials:!0,headers:{"x-tenant-id":j,"x-institution-code":k}});P.interceptors.request.use(function(e){var n=function(e){return Object.fromEntries(Object.entries(null!=e?e:{}).map(function(e){var t=e[0],n=e[1];return[t,"__empty__"===n?"":n]}))}(null==e?void 0:e.params);if(!1!==e.workspace&&C&&O[C]&&"common-workspace"!==C){var r=O[C];e.url="".concat(r).concat(e.url)}var o=t.get("campx_session_key"),i=t.get("campx_open_payments_key"),s=t.get("campx_student_key");return _&&o&&e.headers.set("campx_session_key",o),_&&s&&e.headers.set("campx_student_key",s),i&&e.headers.set("campx_open_payments_key",i),e.skipInstitutionCode&&e.headers.delete("x-institution-code"),x(x({},e),{params:n})},function(e){return Promise.reject(e)}),P.interceptors.response.use(function(e){var t;return!(!0===(null===(t=e.data)||void 0===t?void 0:t.hideSnackbar))&&e.config.method&&["put","post","delete","patch"].includes(e.config.method)&&[200,201,202].includes(e.status)&&N.update(function(t){t.snackbar.open=!0,t.snackbar.message=e.data.message||"Operation successful",t.snackbar.severity="success"}),e},function(e){var t,n,r,o,i=!0===(null===(n=null===(t=e.response)||void 0===t?void 0:t.data)||void 0===n?void 0:n.hideSnackbar);return!i&&[400,422,413].includes(null===(r=e.response)||void 0===r?void 0:r.status)&&N.update(function(t){t.snackbar.open=!0,t.snackbar.message=e.response.data.message||"Bad Request",t.snackbar.severity="error"}),!i&&(null===(o=e.response)||void 0===o?void 0:o.config.method)&&["put","post","delete","patch"].includes(e.response.config.method)&&[404].includes(e.response.status)&&N.update(function(t){t.snackbar.open=!0,t.snackbar.message=e.response.data.message||"Not Found",t.snackbar.severity="error"}),Promise.reject(e)});var D=e.create({baseURL:process.env.REACT_APP_API_HOST||"",withCredentials:!0,workspace:!1,headers:{"x-tenant-id":j,"x-institution-code":k}});D.interceptors.request.use(function(e){var n=function(e){return Object.fromEntries(Object.entries(null!=e?e:{}).map(function(e){var t=e[0],n=e[1];return[t,"__empty__"===n?"":n]}))}(null==e?void 0:e.params),r=t.get("campx_session_key"),o=t.get("campx_open_payments_key"),i=t.get("campx_student_key");return _&&r&&e.headers.set("campx_session_key",r),_&&i&&e.headers.set("campx_student_key",i),o&&e.headers.set("campx_open_payments_key",o),e.skipInstitutionCode&&e.headers.delete("x-institution-code"),x(x({},e),{params:n})},function(e){return Promise.reject(e)}),D.interceptors.response.use(function(e){var t;return!(!0===(null===(t=e.data)||void 0===t?void 0:t.hideSnackbar))&&e.config.method&&["put","post","delete","patch"].includes(e.config.method)&&[200,201,202].includes(e.status)&&N.update(function(t){t.snackbar.open=!0,t.snackbar.message=e.data.message||"Operation successful",t.snackbar.severity="success"}),e},function(e){var t,n,r,o,i=!0===(null===(n=null===(t=e.response)||void 0===t?void 0:t.data)||void 0===n?void 0:n.hideSnackbar);return!i&&[400,422].includes(null===(r=e.response)||void 0===r?void 0:r.status)&&N.update(function(t){t.snackbar.open=!0,t.snackbar.message=e.response.data.message||"Bad Request",t.snackbar.severity="error"}),!i&&(null===(o=e.response)||void 0===o?void 0:o.config.method)&&["put","post","delete","patch"].includes(e.response.config.method)&&[404].includes(e.response.status)&&N.update(function(t){t.snackbar.open=!0,t.snackbar.message=e.response.data.message||"Not Found",t.snackbar.severity="error"}),Promise.reject(e)});var I=["admissions-officer-workspace","tele-counsellor-workspace"];function A(e){return I.includes(e)}var T=i.createContext({showConfirmDialog:function(){}}),V=function(e){var t=e.children,n=N.useState(function(e){return e.confirmDialog}),i=function(){N.update(function(e){e.confirmDialog.isOpen=!1})};return r.jsxs(T.Provider,{value:{showConfirmDialog:function(e,t,n,r,o,i,s){void 0===o&&(o="confirm"),N.update(function(a){a.confirmDialog={isOpen:!0,title:e,message:t,onConfirm:n,onCancel:r,type:o,confirmButtonText:i,cancelButtonText:s}})}},children:[t,r.jsx(o.ConfirmDialog,{isOpen:n.isOpen,title:n.title,message:n.message,type:n.type,confirmButtonText:n.confirmButtonText,cancelButtonText:n.cancelButtonText,onConfirm:function(){n.onConfirm(),i()},onCancel:function(){n.onCancel(),i()}})]})};function M(e,t){return M=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},M(e,t)}var L={error:null},R=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(t=e.call.apply(e,[this].concat(r))||this).state=L,t.resetErrorBoundary=function(){for(var e,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];null==t.props.onReset||(e=t.props).onReset.apply(e,r),t.reset()},t}!function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,M(e,t)}(t,e),t.getDerivedStateFromError=function(e){return{error:e}};var n=t.prototype;return n.reset=function(){this.setState(L)},n.componentDidCatch=function(e,t){var n,r;null==(n=(r=this.props).onError)||n.call(r,e,t)},n.componentDidUpdate=function(e,t){var n,r,o,i,s=this.state.error,a=this.props.resetKeys;null!==s&&null!==t.error&&(void 0===(o=e.resetKeys)&&(o=[]),void 0===(i=a)&&(i=[]),o.length!==i.length||o.some(function(e,t){return!Object.is(e,i[t])}))&&(null==(n=(r=this.props).onResetKeysChange)||n.call(r,e.resetKeys,a),this.reset())},n.render=function(){var e=this.state.error,t=this.props,n=t.fallbackRender,r=t.FallbackComponent,o=t.fallback;if(null!==e){var i={error:e,resetErrorBoundary:this.resetErrorBoundary};if(y.isValidElement(o))return o;if("function"==typeof n)return n(i);if(r)return y.createElement(r,i);throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop")}return this.props.children},t}(y.Component),F=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),function(r,o,i){try{return Promise.resolve(function(s,a){try{var l=(t.context&&process.env.NODE_ENV,Promise.resolve(e["sync"===n.mode?"validateSync":"validate"](r,Object.assign({abortEarly:!1},t,{context:o}))).then(function(e){return i.shouldUseNativeValidation&&c.validateFieldsNatively({},i),{values:n.rawValues?r:e,errors:{}}}))}catch(e){return a(e)}return l&&l.then?l.then(void 0,a):l}(0,function(e){if(!e.inner)throw e;return{values:{},errors:c.toNestError((t=e,n=!i.shouldUseNativeValidation&&"all"===i.criteriaMode,(t.inner||[]).reduce(function(e,t){if(e[t.path]||(e[t.path]={message:t.message,type:t.type}),n){var r=e[t.path].types,o=r&&r[t.type];e[t.path]=l.appendErrors(t.path,n,e,t.type,o?[].concat(o,t.message):t.message)}return e},{})),i)};var t,n}))}catch(e){return Promise.reject(e)}}},K=function(e){return w(void 0,void 0,void 0,function(){var t;return E(this,function(n){switch(n.label){case 0:return e.latitude&&e.longitude?[3,3]:[4,fetch("https://www.googleapis.com/geolocation/v1/geolocate?key=AIzaSyB2YCpo1yi107RYj1LdZu2DCcpcO93reFY",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({considerIp:"true"})})];case 1:return[4,n.sent().json()];case 2:t=n.sent(),e.latitude=t.location.lat,e.longitude=t.location.lng,n.label=3;case 3:return[2,P.post("/auth-server/auth-v2/login",e,{workspace:!1}).then(function(e){return e.data})]}})})},q=g.object().shape({username:g.string().required("Username is required"),password:g.string().required("Password is required")}),B=function(e){var n=e.close,c=i.useState({deviceInformation:{deviceType:"browser",clientName:"unknown",os:"unknown",osVersion:"unknown",latitude:null,longitude:null,tokenType:"WEB"},isLocationAllowed:!0}),d=c[0],p=c[1],f=a.useNavigate();i.useEffect(function(){navigator.geolocation.getCurrentPosition(function(e){p(function(t){return x(x({},t),{deviceInformation:x(x({},t.deviceInformation),{latitude:e.coords.latitude,longitude:e.coords.longitude})})})}),navigator.permissions.query({name:"geolocation"}).then(function(e){"denied"===e.state&&p(function(e){return x(x({},e),{isLocationAllowed:!1})})});var e=(new u).parse(navigator.userAgent);p(function(t){var n,r,o;return x(x({},t),{deviceInformation:x(x({},t.deviceInformation),{clientName:(null===(n=e.client)||void 0===n?void 0:n.name)||t.deviceInformation.clientName,os:(null===(r=e.os)||void 0===r?void 0:r.name)||t.deviceInformation.os,osVersion:(null===(o=e.os)||void 0===o?void 0:o.version)||t.deviceInformation.osVersion})})})},[]);var h=l.useForm({resolver:F(q)}),m=h.handleSubmit,v=h.control,b=h.formState.errors,y=s.useMutation(K,{onSuccess:function(e){_&&(t.remove("campx_session_key"),t.set("campx_session_key",e.session.token),n(),f("/".concat(e.session.institutionCode,"/workspace")),window.location.reload())}}),g=y.mutate,S=y.isLoading;return r.jsxs("div",{className:"flex flex-col gap-8 justify-center items-center p-8",children:[r.jsx("div",{className:"flex items-center justify-center h-9 w-48",children:r.jsx(o.Icons.CampxFullLogoIcon,{})}),r.jsxs("div",{className:"flex flex-col gap-4 w-full max-w-[400px]",children:[r.jsx(l.Controller,{control:v,render:function(e){var t=e.field;return r.jsx(o.TextField,{name:"username",placeholder:"Enter Username or Email",onChange:t.onChange,label:"Username or Email",error:!!b.username,required:!0,fullWidth:!0})},name:"username"}),r.jsx(l.Controller,{control:v,render:function(e){var t=e.field;return r.jsx(o.PasswordField,{name:"password",placeholder:"Enter password",onChange:t.onChange,label:"Password",error:!!b.password,required:!0,fullWidth:!0})},name:"password"}),r.jsx(o.Button,{type:"submit",color:"primary",variant:"default",onClick:m(function(e){return w(void 0,void 0,void 0,function(){return E(this,function(t){return g(x(x(x({},e),d.deviceInformation),{loginId:e.username,loginType:"USER"})),[2]})})}),disabled:S,loading:S,fullWidth:!0,children:"Login"})]})]})},z=function(e){var t,n,i,s,a,c,l,u=e.error,d=e.resetErrorBoundary;if(null===(t=null==u?void 0:u.response)||void 0===t?void 0:t.status)switch(null===(n=null==u?void 0:u.response)||void 0===n?void 0:n.status){case 401:return r.jsx(U,{});case 500:return r.jsx(o.InternalServerError,{resetBoundary:d});case 404:return r.jsx(o.ResourceNotFound,{message:null===(s=null===(i=null==u?void 0:u.response)||void 0===i?void 0:i.data)||void 0===s?void 0:s.message})}return"ERR_NETWORK"===(null==u?void 0:u.code)?r.jsx(o.NoInterneConnection,{resetBoundary:d}):r.jsx("div",{className:"mt-4 p-5",children:r.jsxs("div",{className:"relative h-15 border border-red-200 bg-red-50 flex items-center rounded-md px-2",children:[r.jsx("div",{className:"flex-1 text-red-700 bg-transparent",children:null!==(l=null===(c=null===(a=null==u?void 0:u.response)||void 0===a?void 0:a.data)||void 0===c?void 0:c.message)&&void 0!==l?l:null==u?void 0:u.message}),r.jsx(o.Button,{onClick:function(){return d()},size:"sm",variant:"link",className:"hover:no-underline text-destructive",children:"Try Again"})]})})},U=function(){var e=a.useNavigate(),n=i.useState(!1),s=n[0],c=n[1],l=t.get("campx_session_key");return r.jsx(o.UnAuthorized,{component:r.jsxs(r.Fragment,{children:[r.jsx(o.Button,{className:"mt-5",variant:"default",onClick:function(){"localhost"===window.location.hostname.split(".")[1]?c(!0):l||e("prospect-workspace"===C?"".concat(k,"/ats/login"):"/auth/login")},children:"Click Here To Login"}),r.jsx(o.Dialog,{open:s,onClose:function(){return c(!1)},content:function(e){var t=e.close;return r.jsx(B,{close:t})}})]})})};function $(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var W=(()=>"function"==typeof Symbol&&Symbol.observable||"@@observable")(),H=()=>Math.random().toString(36).substring(7).split("").join("."),Y={INIT:`@@redux/INIT${H()}`,REPLACE:`@@redux/REPLACE${H()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${H()}`};function X(e){if("object"!=typeof e||null===e)return!1;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||null===Object.getPrototypeOf(e)}function Q(e){if(void 0===e)return"undefined";if(null===e)return"null";const t=typeof e;switch(t){case"boolean":case"string":case"number":case"symbol":case"function":return t}if(Array.isArray(e))return"array";if(function(e){return e instanceof Date||"function"==typeof e.toDateString&&"function"==typeof e.getDate&&"function"==typeof e.setDate}(e))return"date";if(function(e){return e instanceof Error||"string"==typeof e.message&&e.constructor&&"number"==typeof e.constructor.stackTraceLimit}(e))return"error";const n=function(e){return"function"==typeof e.constructor?e.constructor.name:null}(e);switch(n){case"Symbol":case"Promise":case"WeakMap":case"WeakSet":case"Map":case"Set":return n}return Object.prototype.toString.call(e).slice(8,-1).toLowerCase().replace(/\s/g,"")}function G(e){let t=typeof e;return"production"!==process.env.NODE_ENV&&(t=Q(e)),t}function J(e,t,n){if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?$(2):`Expected the root reducer to be a function. Instead, received: '${G(e)}'`);if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error("production"===process.env.NODE_ENV?$(0):"It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.");if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error("production"===process.env.NODE_ENV?$(1):`Expected the enhancer to be a function. Instead, received: '${G(n)}'`);return n(J)(e,t)}let r=e,o=t,i=new Map,s=i,a=0,c=!1;function l(){s===i&&(s=new Map,i.forEach((e,t)=>{s.set(t,e)}))}function u(){if(c)throw new Error("production"===process.env.NODE_ENV?$(3):"You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return o}function d(e){if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?$(4):`Expected the listener to be a function. Instead, received: '${G(e)}'`);if(c)throw new Error("production"===process.env.NODE_ENV?$(5):"You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api/store#subscribelistener for more details.");let t=!0;l();const n=a++;return s.set(n,e),function(){if(t){if(c)throw new Error("production"===process.env.NODE_ENV?$(6):"You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details.");t=!1,l(),s.delete(n),i=null}}}function p(e){if(!X(e))throw new Error("production"===process.env.NODE_ENV?$(7):`Actions must be plain objects. Instead, the actual type was: '${G(e)}'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.`);if(void 0===e.type)throw new Error("production"===process.env.NODE_ENV?$(8):'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if("string"!=typeof e.type)throw new Error("production"===process.env.NODE_ENV?$(17):`Action "type" property must be a string. Instead, the actual type was: '${G(e.type)}'. Value was: '${e.type}' (stringified)`);if(c)throw new Error("production"===process.env.NODE_ENV?$(9):"Reducers may not dispatch actions.");try{c=!0,o=r(o,e)}finally{c=!1}return(i=s).forEach(e=>{e()}),e}p({type:Y.INIT});return{dispatch:p,subscribe:d,getState:u,replaceReducer:function(e){if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?$(10):`Expected the nextReducer to be a function. Instead, received: '${G(e)}`);r=e,p({type:Y.REPLACE})},[W]:function(){const e=d;return{subscribe(t){if("object"!=typeof t||null===t)throw new Error("production"===process.env.NODE_ENV?$(11):`Expected the observer to be an object. Instead, received: '${G(t)}'`);function n(){const e=t;e.next&&e.next(u())}n();return{unsubscribe:e(n)}},[W](){return this}}}}}function Z(e){"undefined"!=typeof console&&console.error;try{throw new Error(e)}catch(e){}}function ee(e){const t=Object.keys(e),n={};for(let r=0;r<t.length;r++){const o=t[r];"production"!==process.env.NODE_ENV&&void 0===e[o]&&Z(`No reducer provided for key "${o}"`),"function"==typeof e[o]&&(n[o]=e[o])}const r=Object.keys(n);let o,i;"production"!==process.env.NODE_ENV&&(o={});try{!function(e){Object.keys(e).forEach(t=>{const n=e[t];if(void 0===n(void 0,{type:Y.INIT}))throw new Error("production"===process.env.NODE_ENV?$(12):`The slice reducer for key "${t}" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);if(void 0===n(void 0,{type:Y.PROBE_UNKNOWN_ACTION()}))throw new Error("production"===process.env.NODE_ENV?$(13):`The slice reducer for key "${t}" returned undefined when probed with a random type. Don't try to handle '${Y.INIT}' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.`)})}(n)}catch(e){i=e}return function(e={},t){if(i)throw i;if("production"!==process.env.NODE_ENV){const r=function(e,t,n,r){const o=Object.keys(t),i=n&&n.type===Y.INIT?"preloadedState argument passed to createStore":"previous state received by the reducer";if(0===o.length)return"Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";if(!X(e))return`The ${i} has unexpected type of "${G(e)}". Expected argument to be an object with the following keys: "${o.join('", "')}"`;const s=Object.keys(e).filter(e=>!t.hasOwnProperty(e)&&!r[e]);return s.forEach(e=>{r[e]=!0}),n&&n.type===Y.REPLACE?void 0:s.length>0?`Unexpected ${s.length>1?"keys":"key"} "${s.join('", "')}" found in ${i}. Expected to find one of the known reducer keys instead: "${o.join('", "')}". Unexpected keys will be ignored.`:void 0}(e,n,t,o);r&&Z(r)}let s=!1;const a={};for(let o=0;o<r.length;o++){const i=r[o],c=n[i],l=e[i],u=c(l,t);if(void 0===u){const e=t&&t.type;throw new Error("production"===process.env.NODE_ENV?$(14):`When called with an action of type ${e?`"${String(e)}"`:"(unknown type)"}, the slice reducer for key "${i}" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.`)}a[i]=u,s=s||u!==l}return s=s||r.length!==Object.keys(e).length,s?a:e}}function te(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce((e,t)=>(...n)=>e(t(...n)))}var ne=Symbol.for("immer-nothing"),re=Symbol.for("immer-draftable"),oe=Symbol.for("immer-state"),ie="production"!==process.env.NODE_ENV?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function se(e,...t){if("production"!==process.env.NODE_ENV){const n=ie[e],r="function"==typeof n?n.apply(null,t):n;throw new Error(`[Immer] ${r}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var ae=Object.getPrototypeOf;function ce(e){return!!e&&!!e[oe]}function le(e){return!!e&&(pe(e)||Array.isArray(e)||!!e[re]||!!e.constructor?.[re]||be(e)||ye(e))}var ue=Object.prototype.constructor.toString(),de=new WeakMap;function pe(e){if(!e||"object"!=typeof e)return!1;const t=Object.getPrototypeOf(e);if(null===t||t===Object.prototype)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(n===Object)return!0;if("function"!=typeof n)return!1;let r=de.get(n);return void 0===r&&(r=Function.toString.call(n),de.set(n,r)),r===ue}function fe(e,t,n=!0){if(0===he(e)){(n?Reflect.ownKeys(e):Object.keys(e)).forEach(n=>{t(n,e[n],e)})}else e.forEach((n,r)=>t(r,n,e))}function he(e){const t=e[oe];return t?t.type_:Array.isArray(e)?1:be(e)?2:ye(e)?3:0}function me(e,t){return 2===he(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function ve(e,t,n){const r=he(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function be(e){return e instanceof Map}function ye(e){return e instanceof Set}function ge(e){return e.copy_||e.base_}function xe(e,t){if(be(e))return new Map(e);if(ye(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=pe(e);if(!0===t||"class_only"===t&&!n){const t=Object.getOwnPropertyDescriptors(e);delete t[oe];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){const o=n[r],i=t[o];!1===i.writable&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(t[o]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[o]})}return Object.create(ae(e),t)}{const t=ae(e);if(null!==t&&n)return{...e};const r=Object.create(t);return Object.assign(r,e)}}function we(e,t=!1){return Se(e)||ce(e)||!le(e)||(he(e)>1&&Object.defineProperties(e,{set:Ee,add:Ee,clear:Ee,delete:Ee}),Object.freeze(e),t&&Object.values(e).forEach(e=>we(e,!0))),e}var Ee={value:function(){se(2)}};function Se(e){return null===e||"object"!=typeof e||Object.isFrozen(e)}var Ne,_e={};function je(e){const t=_e[e];return t||se(0,e),t}function ke(){return Ne}function Ce(e,t){t&&(je("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Oe(e){Pe(e),e.drafts_.forEach(Ie),e.drafts_=null}function Pe(e){e===Ne&&(Ne=e.parent_)}function De(e){return Ne={drafts_:[],parent_:Ne,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Ie(e){const t=e[oe];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Ae(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[oe].modified_&&(Oe(t),se(4)),le(e)&&(e=Te(t,e),t.parent_||Me(t,e)),t.patches_&&je("Patches").generateReplacementPatches_(n[oe].base_,e,t.patches_,t.inversePatches_)):e=Te(t,n,[]),Oe(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==ne?e:void 0}function Te(e,t,n){if(Se(t))return t;const r=e.immer_.shouldUseStrictIteration(),o=t[oe];if(!o)return fe(t,(r,i)=>Ve(e,o,t,r,i,n),r),t;if(o.scope_!==e)return t;if(!o.modified_)return Me(e,o.base_,!0),o.base_;if(!o.finalized_){o.finalized_=!0,o.scope_.unfinalizedDrafts_--;const t=o.copy_;let i=t,s=!1;3===o.type_&&(i=new Set(t),t.clear(),s=!0),fe(i,(r,i)=>Ve(e,o,t,r,i,n,s),r),Me(e,t,!1),n&&e.patches_&&je("Patches").generatePatches_(o,n,e.patches_,e.inversePatches_)}return o.copy_}function Ve(e,t,n,r,o,i,s){if(null==o)return;if("object"!=typeof o&&!s)return;const a=Se(o);if(!a||s){if("production"!==process.env.NODE_ENV&&o===n&&se(5),ce(o)){const s=Te(e,o,i&&t&&3!==t.type_&&!me(t.assigned_,r)?i.concat(r):void 0);if(ve(n,r,s),!ce(s))return;e.canAutoFreeze_=!1}else s&&n.add(o);if(le(o)&&!a){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;if(t&&t.base_&&t.base_[r]===o&&a)return;Te(e,o),t&&t.scope_.parent_||"symbol"==typeof r||!(be(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))||Me(e,o)}}}function Me(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&we(t,n)}var Le={get(e,t){if(t===oe)return e;const n=ge(e);if(!me(n,t))return function(e,t,n){const r=Ke(t,n);return r?"value"in r?r.value:r.get?.call(e.draft_):void 0}(e,n,t);const r=n[t];return e.finalized_||!le(r)?r:r===Fe(e.base_,t)?(Be(e),e.copy_[t]=ze(r,e)):r},has:(e,t)=>t in ge(e),ownKeys:e=>Reflect.ownKeys(ge(e)),set(e,t,n){const r=Ke(ge(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=Fe(ge(e),t),s=r?.[oe];if(s&&s.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(((o=n)===(i=r)?0!==o||1/o==1/i:o!=o&&i!=i)&&(void 0!==n||me(e.base_,t)))return!0;Be(e),qe(e)}var o,i;return e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty:(e,t)=>(void 0!==Fe(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,Be(e),qe(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=ge(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty(){se(11)},getPrototypeOf:e=>ae(e.base_),setPrototypeOf(){se(12)}},Re={};function Fe(e,t){const n=e[oe];return(n?ge(n):e)[t]}function Ke(e,t){if(!(t in e))return;let n=ae(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=ae(n)}}function qe(e){e.modified_||(e.modified_=!0,e.parent_&&qe(e.parent_))}function Be(e){e.copy_||(e.copy_=xe(e.base_,e.scope_.immer_.useStrictShallowCopy_))}fe(Le,(e,t)=>{Re[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),Re.deleteProperty=function(e,t){return"production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&se(13),Re.set.call(this,e,t,void 0)},Re.set=function(e,t,n){return"production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&se(14),Le.set.call(this,e[0],t,n,e[0])};function ze(e,t){const n=be(e)?je("MapSet").proxyMap_(e,t):ye(e)?je("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:ke(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=Le;n&&(o=[r],i=Re);const{revoke:s,proxy:a}=Proxy.revocable(o,i);return r.draft_=a,r.revoke_=s,a}(e,t);return(t?t.scope_:ke()).drafts_.push(n),n}function Ue(e){if(!le(e)||Se(e))return e;const t=e[oe];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=xe(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=xe(e,!0);return fe(n,(e,t)=>{ve(n,e,Ue(t))},r),t&&(t.finalized_=!1),n}var $e=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(e,t,n)=>{if("function"==typeof e&&"function"!=typeof t){const n=t;t=e;const r=this;return function(e=n,...o){return r.produce(e,e=>t.call(this,e,...o))}}let r;if("function"!=typeof t&&se(6),void 0!==n&&"function"!=typeof n&&se(7),le(e)){const o=De(this),i=ze(e,void 0);let s=!0;try{r=t(i),s=!1}finally{s?Oe(o):Pe(o)}return Ce(o,n),Ae(r,o)}if(!e||"object"!=typeof e){if(r=t(e),void 0===r&&(r=e),r===ne&&(r=void 0),this.autoFreeze_&&we(r,!0),n){const t=[],o=[];je("Patches").generateReplacementPatches_(e,r,t,o),n(t,o)}return r}se(1,e)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),"boolean"==typeof e?.useStrictIteration&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){le(e)||se(8),ce(e)&&(e=function(e){ce(e)||se(10,e);return Ue(e)}(e));const t=De(this),n=ze(e,void 0);return n[oe].isManual_=!0,Pe(t),n}finishDraft(e,t){const n=e&&e[oe];n&&n.isManual_||se(9);const{scope_:r}=n;return Ce(r,t),Ae(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));const r=je("Patches").applyPatches_;return ce(e)?r(e,t):this.produce(e,e=>r(e,t))}};$e.produce;var We=$e.setUseStrictIteration.bind($e);function He(e){return({dispatch:t,getState:n})=>r=>o=>"function"==typeof o?o(t,n,e):r(o)}var Ye=He(),Xe=He,Qe="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?te:te.apply(null,arguments)};function Ge(e){return"function"==typeof e&&"type"in e&&((t=e)&&"function"==typeof t.match);var t}function Je(e,t){let n=0;return{measureTime(e){const t=Date.now();try{return e()}finally{const e=Date.now();n+=e-t}},warnIfExceeded(){}}}var Ze=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return 1===t.length&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function et(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function tt(e,t,n){const r=nt(e,t,n);return{detectMutations:()=>rt(e,t,r,n)}}function nt(e,t=[],n,r="",o=new Set){const i={value:n};if(!e(n)&&!o.has(n)){o.add(n),i.children={};for(const o in n){const s=r?r+"."+o:o;t.length&&-1!==t.indexOf(s)||(i.children[o]=nt(e,t,n[o],s))}}return i}function rt(e,t=[],n,r,o=!1,i=""){const s=n?n.value:void 0,a=s===r;if(o&&!a&&!Number.isNaN(r))return{wasMutated:!0,path:i};if(e(s)||e(r))return{wasMutated:!1};const c={};for(let e in n.children)c[e]=!0;for(let e in r)c[e]=!0;const l=t.length>0;for(let o in c){const s=i?i+"."+o:o;if(l){if(t.some(e=>e instanceof RegExp?e.test(s):s===e))continue}const c=rt(e,t,n.children[o],r[o],a,s);if(c.wasMutated)return c}return{wasMutated:!1}}function ot(e){const t=typeof e;return null==e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||X(e)}function it(e,t="",n=ot,r,o=[],i){let s;if(!n(e))return{keyPath:t||"<root>",value:e};if("object"!=typeof e||null===e)return!1;if(i?.has(e))return!1;const a=null!=r?r(e):Object.entries(e),c=o.length>0;for(const[e,l]of a){const a=t?t+"."+e:e;if(c){if(o.some(e=>e instanceof RegExp?e.test(a):a===e))continue}if(!n(l))return{keyPath:a,value:l};if("object"==typeof l&&(s=it(l,a,n,r,o,i),s))return s}return i&&st(e)&&i.add(e),!1}function st(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if("object"==typeof t&&null!==t&&!st(t))return!1;return!0}function at(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{const{isSerializable:t=ot,getEntries:n,ignoredActions:r=[],ignoredActionPaths:o=["meta.arg","meta.baseQueryMeta"],ignoredPaths:i=[],warnAfter:s=32,ignoreState:a=!1,ignoreActions:c=!1,disableCache:l=!1}=e,u=!l&&WeakSet?new WeakSet:void 0;return e=>s=>l=>{if(!function(e){return X(e)&&"type"in e&&"string"==typeof e.type}(l))return s(l);const d=s(l),p=Je();return c||r.length&&-1!==r.indexOf(l.type)||p.measureTime(()=>{const e=it(l,"",t,n,o,u);if(e){const{keyPath:t,value:n}=e}}),a||(p.measureTime(()=>{const r=it(e.getState(),"",t,n,i,u);if(r){const{keyPath:e,value:t}=r}}),p.warnIfExceeded()),d}}}function ct(e){return"boolean"==typeof e}var lt=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:o=!0}=e??{};let i=new Ze;if(t&&(ct(t)?i.push(Ye):i.push(Xe(t.extraArgument))),"production"!==process.env.NODE_ENV){if(n){let e={};ct(n)||(e=n),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{let t=function(e,t,r,o){return JSON.stringify(e,n(t,o),r)},n=function(e,t){let n=[],r=[];return t||(t=function(e,t){return n[0]===t?"[Circular ~]":"[Circular ~."+r.slice(0,n.indexOf(t)).join(".")+"]"}),function(o,i){if(n.length>0){var s=n.indexOf(this);~s?n.splice(s+1):n.push(this),~s?r.splice(s,1/0,o):r.push(o),~n.indexOf(i)&&(i=t.call(this,o,i))}else n.push(i);return null==e?i:e.call(this,o,i)}},{isImmutable:r=et,ignoredPaths:o,warnAfter:i=32}=e;const s=tt.bind(null,r,o);return({getState:e})=>{let n,r=e(),o=s(r);return i=>a=>{const c=Je();c.measureTime(()=>{if(r=e(),n=o.detectMutations(),o=s(r),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?ft(19):`A state mutation was detected between dispatches, in the path '${n.path||""}'. This may cause incorrect behavior. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`)});const l=i(a);return c.measureTime(()=>{if(r=e(),n=o.detectMutations(),o=s(r),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?ft(20):`A state mutation was detected inside a dispatch, in the path: ${n.path||""}. Take a look at the reducer(s) handling the action ${t(a)}. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`)}),c.warnIfExceeded(),l}}}}(e))}if(r){let e={};ct(r)||(e=r),i.push(at(e))}if(o){let e={};ct(o)||(e=o),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);const{isActionCreator:t=Ge}=e;return()=>e=>n=>(t(n),e(n))}(e))}}return i},ut=e=>t=>{setTimeout(t,e)},dt=e=>function(t){const{autoBatch:n=!0}=t??{};let r=new Ze(e);return n&&r.push(((e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let o=!0,i=!1,s=!1;const a=new Set,c="tick"===e.type?queueMicrotask:"raf"===e.type?"undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:ut(10):"callback"===e.type?e.queueNotification:ut(e.timeout),l=()=>{s=!1,i&&(i=!1,a.forEach(e=>e()))};return Object.assign({},r,{subscribe(e){const t=r.subscribe(()=>o&&e());return a.add(e),()=>{t(),a.delete(e)}},dispatch(e){try{return o=!e?.meta?.RTK_autoBatch,i=!o,i&&(s||(s=!0,c(l))),r.dispatch(e)}finally{o=!0}}})})("object"==typeof n?n:void 0)),r};function pt(e){const t=lt(),{reducer:n,middleware:r,devTools:o=!0,duplicateMiddlewareCheck:i=!0,preloadedState:s,enhancers:a}=e||{};let c,l;if("function"==typeof n)c=n;else{if(!X(n))throw new Error("production"===process.env.NODE_ENV?ft(1):"`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");c=ee(n)}if("production"!==process.env.NODE_ENV&&r&&"function"!=typeof r)throw new Error("production"===process.env.NODE_ENV?ft(2):"`middleware` field must be a callback");if("function"==typeof r){if(l=r(t),"production"!==process.env.NODE_ENV&&!Array.isArray(l))throw new Error("production"===process.env.NODE_ENV?ft(3):"when using a middleware builder function, an array of middleware must be returned")}else l=t();if("production"!==process.env.NODE_ENV&&l.some(e=>"function"!=typeof e))throw new Error("production"===process.env.NODE_ENV?ft(4):"each middleware provided to configureStore must be a function");if("production"!==process.env.NODE_ENV&&i){let e=new Set;l.forEach(t=>{if(e.has(t))throw new Error("production"===process.env.NODE_ENV?ft(42):"Duplicate middleware references found when creating the store. Ensure that each middleware is only included once.");e.add(t)})}let u=te;o&&(u=Qe({trace:"production"!==process.env.NODE_ENV,..."object"==typeof o&&o}));const d=function(...e){return t=>(n,r)=>{const o=t(n,r);let i=()=>{throw new Error("production"===process.env.NODE_ENV?$(15):"Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")};const s={getState:o.getState,dispatch:(e,...t)=>i(e,...t)},a=e.map(e=>e(s));return i=te(...a)(o.dispatch),{...o,dispatch:i}}}(...l),p=dt(d);if("production"!==process.env.NODE_ENV&&a&&"function"!=typeof a)throw new Error("production"===process.env.NODE_ENV?ft(5):"`enhancers` field must be a callback");let f="function"==typeof a?a(p):p();if("production"!==process.env.NODE_ENV&&!Array.isArray(f))throw new Error("production"===process.env.NODE_ENV?ft(6):"`enhancers` callback must return an array");if("production"!==process.env.NODE_ENV&&f.some(e=>"function"!=typeof e))throw new Error("production"===process.env.NODE_ENV?ft(7):"each enhancer provided to configureStore must be a function");"production"!==process.env.NODE_ENV&&l.length&&f.includes(d);return J(c,s,u(...f))}function ft(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}We(!1);var ht=i.createContext(void 0),mt=function(e){var t=e.children,n=N.useState(function(e){return e.snackbar});return r.jsxs(ht.Provider,{value:{showSnackbar:function(e,t){void 0===t&&(t="info"),N.update(function(n){n.snackbar.open=!0,n.snackbar.message=e,n.snackbar.severity=t})}},children:[t,r.jsx(o.Snackbar,{open:n.open,message:n.message,severity:n.severity,autoHideDuration:1500,onClose:function(){N.update(function(e){e.snackbar.open=!1})}})]})},vt={isOpen:!1,title:"",message:"",confirmButtonText:"",cancelButtonText:"",type:"confirm",onConfirm:function(){},onCancel:function(){}},bt=[{label:"All",value:null},{label:"REGULAR",value:"R"},{label:"SUPPLEMENTARY",value:"S"}],yt=[{label:"Tuition Fee",value:"tuition_fee"},{label:"Admission Fee",value:"admission_fee"},{label:"Hostel Fee",value:"hostel_fee"},{label:"Transport Fee",value:"transport_fee"},{label:"Exam Fee",value:"exam_fee"},{label:"Other Fee",value:"other_fee"}],gt=Array.from({length:6},function(e,t){return(new Date).getFullYear()-t});Array.from({length:12},function(e,t){return{label:"".concat((new Date).getFullYear()-t," - ").concat((new Date).getFullYear()-t+1),value:"".concat((new Date).getFullYear()-t," - ").concat((new Date).getFullYear()-t+1)}});var xt=function(){function e(){var e=this;this.exotelSDK=null,this.webPhone=null,this.callListeners=new Set,this.registerListeners=new Set,this.sessionListeners=new Set,this.permissionStatus="unknown",this.handleCallEvent=function(t,n){e.callListeners.forEach(function(e){return e(t,n)})},this.handleRegisterEvent=function(t){e.registerListeners.forEach(function(e){return e(t)})},this.handleSessionEvent=function(t,n){e.sessionListeners.forEach(function(e){return e(t,n)})}}return e.getInstance=function(){return e.instance||(e.instance=new e),e.instance},e.prototype.initialize=function(e,t){return w(this,arguments,void 0,function(e,t,n){var r;return void 0===n&&(n=!0),E(this,function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),[4,this.checkAudioPermissions()];case 1:return o.sent(),this.exotelSDK=new f(e,t,n),[4,this.exotelSDK.Initialize(this.handleCallEvent,this.handleRegisterEvent,this.handleSessionEvent)];case 2:return r=o.sent(),this.webPhone=r||null,[2,!!this.webPhone];case 3:return o.sent(),[2,!1];case 4:return[2]}})})},e.prototype.checkAudioPermissions=function(){return w(this,void 0,void 0,function(){var e,t,n=this;return E(this,function(r){switch(r.label){case 0:return r.trys.push([0,6,,7]),[4,navigator.mediaDevices.enumerateDevices()];case 1:if(e=r.sent(),!e.some(function(e){return"audioinput"===e.kind}))return this.permissionStatus="denied",[2,!1];if(!navigator.permissions||!navigator.permissions.query)return[3,5];r.label=2;case 2:return r.trys.push([2,4,,5]),[4,navigator.permissions.query({name:"microphone"})];case 3:return t=r.sent(),this.permissionStatus=t.state,t.onchange=function(){n.permissionStatus=t.state},[2,"granted"===t.state];case 4:return r.sent(),[3,5];case 5:return[2,!0];case 6:return r.sent(),[2,!1];case 7:return[2]}})})},e.prototype.requestMicrophoneAccess=function(){return w(this,void 0,void 0,function(){return E(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,navigator.mediaDevices.getUserMedia({audio:!0})];case 1:return e.sent().getTracks().forEach(function(e){return e.stop()}),this.permissionStatus="granted",[2,!0];case 2:return e.sent(),this.permissionStatus="denied",[2,!1];case 3:return[2]}})})},e.prototype.makeCall=function(e){var t=this;return new Promise(function(n,r){t.webPhone?t.webPhone.MakeCall(e,function(e,t){"success"===e?n(t):r(t)}):r(new Error("Web phone not initialized"))})},e.prototype.acceptCall=function(){return w(this,void 0,void 0,function(){return E(this,function(e){switch(e.label){case 0:if(!this.webPhone)throw new Error("Web phone not initialized");return"granted"===this.permissionStatus?[3,2]:[4,this.requestMicrophoneAccess()];case 1:if(!e.sent())throw new Error("Microphone access denied");e.label=2;case 2:return this.webPhone.AcceptCall(),[2]}})})},e.prototype.hangupCall=function(){var e;null===(e=this.webPhone)||void 0===e||e.HangupCall()},e.prototype.rejectCall=function(){var e;null===(e=this.webPhone)||void 0===e||e.HangupCall()},e.prototype.toggleHold=function(){var e;null===(e=this.webPhone)||void 0===e||e.ToggleHold()},e.prototype.toggleMute=function(){var e;null===(e=this.webPhone)||void 0===e||e.ToggleMute()},e.prototype.sendDTMF=function(e){var t;null===(t=this.webPhone)||void 0===t||t.SendDTMF(e)},e.prototype.registerDevice=function(){return w(this,void 0,void 0,function(){var e;return E(this,function(t){switch(t.label){case 0:return"granted"===this.permissionStatus?[3,2]:[4,this.requestMicrophoneAccess()];case 1:if(!t.sent())throw new Error("Microphone access denied");t.label=2;case 2:return null===(e=this.webPhone)||void 0===e||e.RegisterDevice(),[2]}})})},e.prototype.unregisterDevice=function(){var e;null===(e=this.webPhone)||void 0===e||e.UnRegisterDevice()},e.prototype.getPermissionStatus=function(){return this.permissionStatus},e.prototype.addCallListener=function(e){this.callListeners.add(e)},e.prototype.removeCallListener=function(e){this.callListeners.delete(e)},e.prototype.addRegisterListener=function(e){this.registerListeners.add(e)},e.prototype.removeRegisterListener=function(e){this.registerListeners.delete(e)},e.prototype.addSessionListener=function(e){this.sessionListeners.add(e)},e.prototype.removeSessionListener=function(e){this.sessionListeners.delete(e)},e}(),wt=function(){return w(void 0,void 0,void 0,function(){var e,t,n,r,o,i;return E(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,P.get("/notifications/notification-configs")];case 1:return e=s.sent().data,(null==(t=null==e?void 0:e.config)?void 0:t.enableVoice)?(n=null===(r=t.voiceConfigs)||void 0===r?void 0:r.find(function(e){return!0===e.isEnabled}))?[2,{enabled:!0,hasValidToken:!!((null===(o=n.EXOTEL)||void 0===o?void 0:o.token)&&(null===(i=n.EXOTEL)||void 0===i?void 0:i.tokenExpiresAt)&&new Date(n.EXOTEL.tokenExpiresAt)>new Date)}]:[2,{enabled:!1,hasValidToken:!1}]:[2,{enabled:!1,hasValidToken:!1}];case 2:return s.sent(),[2,{enabled:!1,hasValidToken:!1}];case 3:return[2]}})})},Et=function(){return w(void 0,void 0,void 0,function(){return E(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,P.get("/notifications/notification-configs/voice-config/active-token")];case 1:return[2,e.sent().data];case 2:return e.sent(),[2,null];case 3:return[2]}})})},St=function(e){return w(void 0,void 0,void 0,function(){var t;return E(this,function(n){switch(n.label){case 0:return t="common-workspace"===C?"/paymentx/call-activities":"/call-activities",[4,P.post("".concat(t,"/initiate"),e)];case 1:return[2,n.sent().data]}})})},Nt=function(e){return w(void 0,void 0,void 0,function(){var t;return E(this,function(n){switch(n.label){case 0:return t="common-workspace"===C?"/paymentx/call-activities":"/call-activities",[4,P.post("".concat(t,"/register-incoming"),e)];case 1:return[2,n.sent().data]}})})},_t=function(e){return w(void 0,void 0,void 0,function(){var t,n;return E(this,function(r){switch(r.label){case 0:return t="common-workspace"===C?"/paymentx/call-activities":"/call-activities",n={callStatusDisposition:e.callStatusDisposition,dispositionCategory:e.dispositionCategory,dispositionNotes:e.dispositionNotes,callbackScheduledAt:e.callbackScheduledAt},[4,P.post("".concat(t,"/").concat(e.callId,"/disposition"),n)];case 1:return[2,r.sent().data]}})})},jt=function(e){return w(void 0,void 0,void 0,function(){var t;return E(this,function(n){switch(n.label){case 0:return t="common-workspace"===C?"/paymentx/call-activities":"/call-activities",[4,P.post("".concat(t,"/cancel"),e)];case 1:return[2,n.sent().data]}})})},kt="__EXOTEL_CONTEXT__",Ct={phase:"idle",callData:null,isOnHold:!1,isMuted:!1,isSpeakerOff:!1,callDirection:null,callStartTime:null,callDuration:0,callerName:null,callerNumber:null,callActivityId:null,exotelCallSid:null,prospectUniqueId:null,wasAccepted:!1},Ot=function(e){if(!e||e.length<4)return"**********";var t="",n=e;e.startsWith("+91")?(t="+91",n=e.substring(3)):e.startsWith("91")&&e.length>10&&(t="91",n=e.substring(2));var r=n.replace(/\D/g,"");return r.length<4?t+"**********":t+r.substring(0,2)+"*".repeat(r.length-4)+r.substring(r.length-2)},Pt=(window[kt]||(window[kt]=i.createContext(void 0)),window[kt]),Dt=function(e){var t=e.children,n=e.accessToken,o=e.agentUserId,s=e.autoConnectVOIP,a=void 0===s||s,c=e.callerName;e.callerNumber;var l=i.useState(!1),u=l[0],d=l[1],p=i.useState(!1),f=p[0],h=p[1],m=i.useState("unknown"),v=m[0],b=m[1],y=i.useState(Ct),g=y[0],S=y[1],N=i.useState(null),_=N[0],j=N[1],k=i.useRef(null),C=i.useRef(g),O=xt.getInstance();i.useEffect(function(){C.current=g},[g]),i.useEffect(function(){return"connected"===g.phase&&g.callStartTime?k.current=setInterval(function(){S(function(e){return x(x({},e),{callDuration:Math.floor((Date.now()-e.callStartTime)/1e3)})})},1e3):k.current&&(clearInterval(k.current),k.current=null),function(){k.current&&clearInterval(k.current)}},[g.phase,g.callStartTime]),i.useEffect(function(){var e=function(){return w(void 0,void 0,void 0,function(){return E(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,navigator.mediaDevices.getUserMedia({audio:!0})];case 1:return e.sent().getTracks().forEach(function(e){return e.stop()}),b("granted"),[3,3];case 2:return e.sent(),b("denied"),[3,3];case 3:return[2]}})})};navigator.permissions&&navigator.permissions.query?navigator.permissions.query({name:"microphone"}).then(function(t){b(t.state),t.onchange=function(){b(t.state)},"prompt"===t.state&&e()}).catch(function(t){e()}):e()},[]),i.useEffect(function(){if(n&&o&&!u){w(void 0,void 0,void 0,function(){var e;return E(this,function(t){switch(t.label){case 0:return[4,O.initialize(n,o,a)];case 1:return e=t.sent(),d(e),[2]}})})}},[n,o,a]),i.useEffect(function(){if(u){var e=function(e,t){switch(e){case"incoming":if("outbound"===C.current.callDirection)S(function(e){return x(x({},e),{callData:t,isOnHold:!1,isMuted:!1})});else{var n=t.callFromNumber||t.remoteId||null;S(function(e){return x(x({},e),{phase:"incoming",callData:t,callDirection:"inbound",callerName:t.remoteDisplayName||null,callerNumber:n?Ot(n):null,isOnHold:!1,isMuted:!1})}),(t.callId||t.sessionId)&&Nt({callSid:t.callId||t.sessionId,fromNumber:t.callFromNumber||t.remoteId||"",toNumber:t.remoteDisplayName||""}).then(function(e){var t,n=null===(t=e.prospect)||void 0===t?void 0:t.mobile;S(function(t){var r,o,i;return x(x({},t),{callActivityId:(null===(r=e.data)||void 0===r?void 0:r.id)||t.callActivityId,callerName:(null===(o=e.prospect)||void 0===o?void 0:o.name)||t.callerName,callerNumber:n?Ot(n):t.callerNumber,prospectUniqueId:(null===(i=e.prospect)||void 0===i?void 0:i.uniqueId)||t.prospectUniqueId})})}).catch(function(e){})}break;case"connected":S(function(e){return x(x({},e),{phase:"connected",callData:t,callStartTime:Date.now(),callDuration:0})});break;case"callEnded":S(function(e){var n,r;if(e.wasAccepted||"connected"===e.phase||e.callDuration>0){var o={callId:e.callActivityId||t.callId||(null===(n=e.callData)||void 0===n?void 0:n.callId)||"",exotelCallId:t.callId||(null===(r=e.callData)||void 0===r?void 0:r.callId)||"",callDirection:e.callDirection||"outbound",callDuration:e.callDuration,callerName:e.callerName,callerNumber:e.callerNumber};j(o)}return x(x({},Ct),{phase:"ended",callData:t})});break;case"holdtoggle":S(function(e){return x(x({},e),{isOnHold:!e.isOnHold,callData:t})});break;case"mutetoggle":S(function(e){return x(x({},e),{isMuted:!e.isMuted,callData:t})})}},t=function(e){h("registered"===e)},n=function(e,t){};return O.addCallListener(e),O.addRegisterListener(t),O.addSessionListener(n),function(){O.removeCallListener(e),O.removeRegisterListener(t),O.removeSessionListener(n)}}},[u]),i.useEffect(function(){u&&b(O.getPermissionStatus())},[u]);var P=i.useCallback(function(e,t,n,r){return w(void 0,void 0,void 0,function(){return E(this,function(o){switch(o.label){case 0:return S(function(o){return x(x({},o),{phase:"ready_to_call",callDirection:"outbound",callerName:t||c||null,callerNumber:r||e,callActivityId:n||null,isOnHold:!1,isMuted:!1,callStartTime:null,callDuration:0})}),[4,O.makeCall(e)];case 1:return[2,o.sent()]}})})},[c]),D=i.useCallback(function(){return w(void 0,void 0,void 0,function(){return E(this,function(e){switch(e.label){case 0:return[4,O.acceptCall()];case 1:return e.sent(),S(function(e){return"outbound"===e.callDirection?x(x({},e),{phase:"calling",wasAccepted:!0}):x(x({},e),{wasAccepted:!0})}),[2]}})})},[]),I=i.useCallback(function(){O.hangupCall()},[]),A=i.useCallback(function(){S(function(e){return x(x({},e),{isSpeakerOff:!e.isSpeakerOff})})},[]),T=i.useCallback(function(){j(null),S(Ct)},[]),V=i.useCallback(function(e){S(function(t){return x(x({},t),{callActivityId:e})})},[]),M=i.useCallback(function(e){S(function(t){return x(x({},t),{exotelCallSid:e})})},[]),L={isInitialized:u,isConnected:f,callState:g,permissionStatus:v,dispositionData:_,makeCall:P,acceptCall:D,hangupCall:I,rejectCall:function(){return O.rejectCall()},toggleHold:function(){return O.toggleHold()},toggleMute:function(){return O.toggleMute()},toggleSpeaker:A,sendDTMF:function(e){return O.sendDTMF(e)},registerDevice:function(){return O.registerDevice()},unregisterDevice:function(){return O.unregisterDevice()},requestMicrophoneAccess:function(){return O.requestMicrophoneAccess()},clearDisposition:T,setCallActivityId:V,setExotelCallSid:M};return r.jsx(Pt.Provider,{value:L,children:t})},It=function(){var e=i.useContext(Pt);if(void 0===e)throw new Error("useExotel must be used within an ExotelProvider");return e},At=function(){var e=i.useContext(Pt);return null!=e?e:null},Tt=999999,Vt=999998,Mt="16px",Lt=2e3,Rt=[{label:"Connected",value:"connected"},{label:"Not Connected",value:"not_connected"}],Ft=[{label:"Interested",value:"interested"},{label:"Not Interested",value:"not_interested"},{label:"Not Sure",value:"not_sure"},{label:"Not Eligible",value:"not_eligible"},{label:"Wrong Number",value:"wrong_number"},{label:"Campus Visit",value:"campus_visit"},{label:"Call Back",value:"call_back"},{label:"After JEE Mains",value:"after_jee_mains"},{label:"After IPE",value:"after_ipe"},{label:"After EAPCET",value:"after_eapcet"}],Kt=[{label:"Not Answering",value:"not_answering"},{label:"Not Connected",value:"not_connected"},{label:"Fail to Call",value:"fail_to_call"}],qt=function(e){var t=e.dispositionData,n=e.prospectId,a=e.onClose,c=e.onSave,l=e.existingData,u=s.useQueryClient(),d=!!(null==l?void 0:l.dispositionCategory),p=i.useState((null==l?void 0:l.callStatusDisposition)||""),f=p[0],h=p[1],m=i.useState((null==l?void 0:l.dispositionCategory)||""),v=m[0],b=m[1],y=i.useState((null==l?void 0:l.dispositionNotes)||""),g=y[0],x=y[1],w=s.useMutation(function(e){return c(e)},{onSuccess:function(){u.invalidateQueries("getOneProspect"),u.invalidateQueries("callHistory"),a()}}),E=w.mutate,S=w.isLoading,N=function(e){h(e),b("")},_=function(e){b(e)},j=function(){if(f&&v){var e={prospectId:n,callId:t.callId,channel:"phone",direction:t.callDirection,duration:t.callDuration,callStatusDisposition:f,dispositionCategory:v,remarks:g||"",callerName:t.callerName||"",callerNumber:t.callerNumber||""};E(e)}},k="connected"===f?Ft:"not_connected"===f?Kt:[];return r.jsx(o.Dialog,{open:!0,onClose:a,title:d?"Edit Disposition":"Call Disposition",maxWidth:"md",content:function(){return r.jsxs("div",{className:"flex flex-col gap-4 p-4",children:[r.jsx(o.Typography,{variant:"muted",children:d?"Update the disposition details":"Add details about your call with ".concat(t.callerName||"Unknown")}),r.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-100 rounded-lg",children:[r.jsx(o.Typography,{variant:"small",className:"text-gray-600",children:"Call Duration"}),r.jsx(o.Typography,{variant:"small",className:"font-semibold",children:(e=t.callDuration,n=Math.floor(e/60),i=e%60,"".concat(n,"m ").concat(i,"s"))})]}),r.jsx(o.RadioGroup,{name:"callStatusDisposition",label:"Call Status",required:!0,options:Rt,direction:"row",value:f,onChange:N}),f&&r.jsx(o.SingleSelect,{name:"dispositionCategory",label:"Call Disposition",required:!0,fullWidth:!0,placeholder:"Search disposition...",options:k,value:v,onChange:_},f),r.jsx(o.Textarea,{name:"remarks",label:"Remarks",placeholder:"Add any additional notes about this call...",rows:3,fullWidth:!0,value:g,onChange:function(e){return x(e.target.value)},className:"break-all"}),r.jsxs("div",{className:"flex justify-start gap-2 pt-4 border-t",children:[r.jsx(o.Button,{onClick:j,disabled:!f||!v,loading:S,children:d?"Update Disposition":"Save Disposition"}),r.jsx(o.Button,{variant:"outline",onClick:a,children:"Cancel"})]})]});var e,n,i}})},Bt=function(e){var t=e.className,n=e.prospectId,s=e.prospectName,a=e.prospectNumber,c=e.onSaveDisposition,l=It(),u=l.callState,d=l.dispositionData,p=l.acceptCall,f=l.hangupCall,v=l.rejectCall,b=l.toggleHold,y=l.toggleMute,g=l.toggleSpeaker,S=l.clearDisposition,N=i.useState(!1),_=N[0],j=N[1],k=i.useState(!1),C=k[0],O=k[1],P=i.useRef(null);i.useEffect(function(){var e="exotel-phone-animations";if(!document.getElementById(e)){var t=document.createElement("style");t.id=e,t.textContent="\n@keyframes pulse-ring {\n 0% {\n transform: scale(1);\n opacity: 1;\n }\n 50% {\n transform: scale(1.15);\n opacity: 0.7;\n }\n 100% {\n transform: scale(1);\n opacity: 1;\n }\n}\n\n@keyframes pulse-dot {\n 0%, 100% {\n box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.7);\n }\n 50% {\n box-shadow: 0 0 0 20px rgba(249, 115, 22, 0);\n }\n}\n\n.animate-pulse-ring {\n animation: pulse-ring 1.5s ease-in-out infinite;\n}\n\n.animate-pulse-dot {\n animation: pulse-dot 1.5s ease-in-out infinite;\n}\n",document.head.appendChild(t)}},[]);var D=u.phase;u.callData;var I=u.isOnHold,A=u.isMuted,T=u.isSpeakerOff,V=u.callDirection,M=u.callDuration,L=u.callerName,R=u.callerNumber,F=u.callActivityId,K=u.exotelCallSid,q=u.prospectUniqueId,B=s||L||"Unknown",z=a||R||"No number",U=function(){return w(void 0,void 0,void 0,function(){var e;return E(this,function(t){switch(t.label){case 0:if(O(!0),"incoming"===D||"ready_to_call"===D?v():f(),!(e=K||F))return[3,4];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,jt({callSid:e,reason:"connected"===D?"ended":"declined"})];case 2:return t.sent(),[3,4];case 3:return t.sent(),[3,4];case 4:return P.current=setTimeout(function(){O(!1)},Lt),[2]}})})};i.useEffect(function(){"idle"!==D&&"ended"!==D||(P.current&&(clearTimeout(P.current),P.current=null),O(!1))},[D]);if(i.useEffect(function(){return function(){P.current&&clearTimeout(P.current)}},[]),d){var $=s||d.callerName||L||"Unknown",W=x(x({},d),{callerName:$,callerNumber:z});return r.jsx(qt,{dispositionData:W,prospectId:n,onClose:S,onSave:function(e){return w(void 0,void 0,void 0,function(){return E(this,function(t){return c?[2,c(e)]:[2,_t({callId:e.callId,prospectId:e.prospectId||n||"",callStatusDisposition:e.callStatusDisposition,dispositionCategory:e.dispositionCategory,dispositionNotes:e.remarks||void 0})]})})}})}if("idle"===D||"ended"===D)return null;var H,Y,X,Q="outbound"===V,G="inbound"===V,J="connected"===D?"bg-green-500":Q?"bg-blue-500":"bg-orange-500",Z=function(){return"calling"===D?"Connecting to ".concat(B,"..."):null},ee=r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"fixed inset-0 bg-black/50",style:{zIndex:Vt},onClick:U}),r.jsx("div",{className:"fixed inset-0 flex items-center justify-center p-4 ".concat(t),style:{zIndex:Tt},children:r.jsxs("div",{className:"bg-white shadow-2xl w-full max-w-md p-6 relative",style:{borderRadius:Mt,border:"1px solid #e5e7eb"},onClick:function(e){return e.stopPropagation()},children:[r.jsx("button",{onClick:U,className:"absolute top-4 right-4 p-1 hover:bg-gray-100 rounded-full transition-colors",children:r.jsx(m.X,{className:"w-5 h-5 text-gray-500"})}),r.jsx("div",{className:"flex justify-center mb-6",children:r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-3 py-1 rounded-full text-sm font-medium border ".concat(Q?"text-blue-600 border-blue-200 bg-blue-50":"text-green-600 border-green-200 bg-green-50"),children:[Q?r.jsx(m.PhoneOutgoing,{className:"w-4 h-4"}):r.jsx(m.PhoneIncoming,{className:"w-4 h-4"}),Q?"Outgoing Call":"Incoming Call"]})}),r.jsx("div",{className:"flex justify-center mb-4",children:r.jsx("div",{className:"w-24 h-24 rounded-full ".concat(J," flex items-center justify-center ").concat("incoming"===D||"ready_to_call"===D?"animate-pulse-ring animate-pulse-dot":""),children:G&&"incoming"===D?r.jsx(m.PhoneIncoming,{className:"w-10 h-10 text-white"}):r.jsx(m.Phone,{className:"w-10 h-10 text-white"})})}),r.jsxs("div",{className:"text-center mb-4",children:[r.jsx(o.Typography,{variant:"h3",className:"text-xl font-semibold text-gray-900",children:B}),q&&r.jsxs(o.Typography,{variant:"small",className:"text-blue-600 font-medium",children:["ID: ",q]}),r.jsx(o.Typography,{variant:"muted",children:z})]}),r.jsx("div",{className:"text-center mb-6",children:"connected"===D?r.jsx(o.Typography,{variant:"p",className:"text-green-500 text-lg font-medium",children:(H=M,Y=Math.floor(H/60),X=H%60,"".concat(Y.toString().padStart(2,"0"),":").concat(X.toString().padStart(2,"0")))}):r.jsx(o.Typography,{variant:"muted",children:function(){switch(D){case"ready_to_call":return"Ready to call...";case"calling":return"Calling...";case"incoming":return"Incoming call...";default:return null}}()})}),"connected"===D&&r.jsxs("div",{className:"flex justify-center gap-6 mb-6",children:[r.jsxs("div",{className:"text-center",children:[r.jsx("button",{onClick:y,className:"w-12 h-12 rounded-full border-2 flex items-center justify-center transition-colors ".concat(A?"bg-gray-200 border-gray-300":"bg-white border-gray-200 hover:bg-gray-50"),children:A?r.jsx(m.MicOff,{className:"w-5 h-5 text-gray-600"}):r.jsx(m.Mic,{className:"w-5 h-5 text-gray-600"})}),r.jsx("p",{className:"text-xs text-gray-500 mt-1",children:A?"Unmute":"Mute"})]}),r.jsxs("div",{className:"text-center",children:[r.jsx("button",{onClick:b,className:"w-12 h-12 rounded-full border-2 flex items-center justify-center transition-colors ".concat(I?"bg-gray-200 border-gray-300":"bg-white border-gray-200 hover:bg-gray-50"),children:I?r.jsx(m.Play,{className:"w-5 h-5 text-gray-600"}):r.jsx(m.Pause,{className:"w-5 h-5 text-gray-600"})}),r.jsx("p",{className:"text-xs text-gray-500 mt-1",children:I?"Resume":"Hold"})]}),r.jsxs("div",{className:"text-center",children:[r.jsx("button",{onClick:g,className:"w-12 h-12 rounded-full border-2 flex items-center justify-center transition-colors ".concat(T?"bg-gray-200 border-gray-300":"bg-white border-gray-200 hover:bg-gray-50"),children:T?r.jsx(m.VolumeX,{className:"w-5 h-5 text-gray-600"}):r.jsx(m.Volume2,{className:"w-5 h-5 text-gray-600"})}),r.jsx("p",{className:"text-xs text-gray-500 mt-1",children:T?"Speaker On":"Speaker Off"})]})]}),r.jsxs("div",{className:"flex justify-center gap-4",children:[("ready_to_call"===D||"incoming"===D)&&r.jsxs(r.Fragment,{children:[r.jsxs(o.Button,{variant:"destructive",onClick:U,disabled:C,className:"gap-2 px-6",children:[r.jsx(m.PhoneOff,{className:"w-4 h-4"}),C?"Declining...":"Decline"]}),r.jsxs(o.Button,{variant:"default",onClick:function(){return w(void 0,void 0,void 0,function(){return E(this,function(e){switch(e.label){case 0:j(!0),e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,p()];case 2:return e.sent(),[3,5];case 3:return e.sent(),[3,5];case 4:return j(!1),[7];case 5:return[2]}})})},disabled:_||C,style:{backgroundColor:"#22c55e"},className:"gap-2 px-6 hover:bg-green-600",children:[r.jsx(m.Phone,{className:"w-4 h-4"}),"Accept"]})]}),"calling"===D&&r.jsxs(o.Button,{variant:"destructive",onClick:U,disabled:C,className:"gap-2 px-6",children:[r.jsx(m.PhoneOff,{className:"w-4 h-4"}),C?"Ending...":"End Call"]}),"connected"===D&&r.jsxs(o.Button,{variant:"destructive",onClick:U,disabled:C,className:"gap-2 px-8",children:[r.jsx(m.PhoneOff,{className:"w-4 h-4"}),C?"Ending...":"End Call"]})]}),Z()&&r.jsx(o.Typography,{variant:"small",className:"text-center text-gray-500 mt-4",children:Z()})]})})]});return h.createPortal(ee,document.body)},zt=function(){function e(){this.algorithm="aes-256-cbc",this.secretKey=null,this.initialized=!1}return e.prototype.ensureInitialized=function(){if(!this.initialized)try{var e="431fef99-47dc-4d2a-9175-2e8f19b20225";if(e){var t=(new TextEncoder).encode(e),n=(new TextEncoder).encode("salt");this.secretKey=v.syncScrypt(t,n,16384,8,1,32)}this.initialized=!0}catch(e){this.initialized=!0}},e.getInstance=function(){return e.instance||(e.instance=new e),e.instance},e.prototype.decryptData=function(e){if(this.ensureInitialized(),!e||!this.secretKey)return"";try{var t=e.split(":"),n=t[0],r=t[1];if(!n||!r)return"";var o=require("crypto"),i=Buffer.from(n,"hex"),s=o.createDecipheriv(this.algorithm,Buffer.from(this.secretKey),i),a=s.update(r,"hex","utf8");return a+=s.final("utf8")}catch(e){return""}},e.prototype.maskMobile=function(e){if(!e||e.length<4)return"**********";var t="",n=e;e.startsWith("+91")?(t="+91",n=e.substring(3)):e.startsWith("91")&&e.length>10&&(t="91",n=e.substring(2));var r=n.replace(/\D/g,"");return r.length<4?t+"**********":t+r.substring(0,2)+"*".repeat(r.length-4)+r.substring(r.length-2)},e}().getInstance();Object.defineProperty(exports,"BrowserRouter",{enumerable:!0,get:function(){return a.BrowserRouter}}),exports.ApplicationStore=N,exports.BatchSelector=function(e){return r.jsx(o.SingleSelect,x({label:"Batch"},e,{externalAxios:D,optionsApiEndPoint:"/dropdowns/batches"}))},exports.CallButton=function(e){var t=e.phoneNumber,n=e.encryptedPhoneNumber,s=e.callerName,a=e.prospectId,c=e.className,l=e.disabled,u=At(),d=i.useState(!1),p=d[0],f=d[1],h=i.useState(null),v=h[0],b=h[1];if(!u)return null;var y=u.makeCall,g=u.isConnected,x=u.callState,S=u.permissionStatus,N=u.requestMicrophoneAccess,_=u.setCallActivityId,j=u.setExotelCallSid,k="idle"!==x.phase&&"ended"!==x.phase,C=t||n,O=l||!C||!g||k||p;return r.jsxs("div",{className:c,children:[r.jsxs(o.Button,{variant:"outline",size:"sm",onClick:function(){return w(void 0,void 0,void 0,function(){var e,r,o,i,c,l,u,d,p;return E(this,function(h){switch(h.label){case 0:if(!g||"idle"!==x.phase&&"ended"!==x.phase)return[2];if(b(null),e=t,n&&!e)try{if(!(e=zt.decryptData(n)))return b("Failed to decrypt phone number"),[2]}catch(e){return b("Failed to decrypt phone number"),[2]}return e?(r=zt.maskMobile(e),[4,xt.getInstance().checkAudioPermissions()]):(b("No phone number available"),[2]);case 1:return h.sent()?[3,3]:[4,N()];case 2:if(!h.sent())return b("Microphone access is required to make calls"),[2];h.label=3;case 3:return h.trys.push([3,9,10,11]),f(!0),[4,y(e,s,void 0,r)];case 4:if(o=h.sent(),(i=null===(d=null==o?void 0:o.Data)||void 0===d?void 0:d.CallSid)&&j(i),!a||!i)return[3,8];h.label=5;case 5:return h.trys.push([5,7,,8]),[4,St({prospectId:a,toNumber:e,callSid:i})];case 6:return c=h.sent(),(l=null===(p=c.data)||void 0===p?void 0:p.id)&&_(l),[3,8];case 7:return h.sent(),[3,8];case 8:return[3,11];case 9:return u=h.sent(),b(u.message||"Failed to make call"),[3,11];case 10:return f(!1),[7];case 11:return[2]}})})},disabled:O,title:g?k?"Call in progress":C?"denied"===S?"Microphone access denied":"Call ".concat(s||"prospect"):"No phone number":"VoIP not connected",className:"gap-1.5",children:["denied"===S?r.jsx(m.MicOff,{className:"w-4 h-4"}):r.jsx(m.Phone,{className:"w-4 h-4"}),p?"Calling...":"Call"]}),v&&r.jsx("p",{className:"text-red-500 text-xs mt-1",children:v})]})},exports.CallDispositionForm=qt,exports.ConfirmDialogProvider=V,exports.CourseSelector=function(e){return r.jsx(o.SingleSelect,x({dbLabelProps:{labelKey:"courseName",subLabelKey:"level"}},e,{externalAxios:D,optionsApiEndPoint:"/dropdowns/courses"}))},exports.DepartmentMongoMultiSelector=function(e){return r.jsx(o.MultiSelect,x({dbLabelProps:{labelKey:"name",subLabelKey:"type",useSubLabelStartCase:!0},dbValueProps:{valueKey:"_id",isObjectId:!0}},e,{externalAxios:D,optionsApiEndPoint:"/dropdowns/departments"}))},exports.DepartmentSelector=function(e){return r.jsx(o.SingleSelect,x({dbLabelProps:{labelKey:"name",subLabelKey:"type",useSubLabelStartCase:!0},dbValueProps:{valueKey:"_id",isObjectId:!0}},e,{externalAxios:D,optionsApiEndPoint:"/dropdowns/departments"}))},exports.DepartmentSqlMultiSelector=function(e){return r.jsx(o.MultiSelect,x({dbLabelProps:{labelKey:"name",subLabelKey:"type",useSubLabelStartCase:!0},dbValueProps:{valueKey:"id",isInt:!0}},e,{externalAxios:D,optionsApiEndPoint:"/dropdowns/departments-sql"}))},exports.EmployeesSelector=function(e){return r.jsx(o.SingleSelect,x({dbValueProps:{valueKey:"_id",isObjectId:!0},dbLabelProps:{labelKey:"fullName",subLabelKey:"employeeId"}},e,{externalAxios:D,optionsApiEndPoint:"/dropdowns/employees"}))},exports.ErrorBoundary=function(e){var t=a.useLocation();return r.jsx(s.QueryErrorResetBoundary,{children:function(n){var o=n.reset;return r.jsx(R,{onReset:o,FallbackComponent:z,children:e.children},null==t?void 0:t.pathname)}})},exports.ExamTypeSelector=function(e){return r.jsx(o.SingleSelect,x({label:"Exam Type",options:bt},e))},exports.ExamsRegulationSelector=function(e){return r.jsx(o.SingleSelect,x({label:"Regulation"},e,{externalAxios:D,optionsApiEndPoint:"/dropdowns/exam-regulations",dbLabelProps:{labelKey:"r.name"},dbValueProps:{valueKey:"r.name"}}))},exports.ExotelPhone=Bt,exports.ExotelProvider=Dt,exports.ExotelWrapper=function(e){var t=e.children,n=e.enabled,o=void 0===n||n,s=e.prospectId,a=e.prospectName,c=e.prospectNumber,l=i.useState(null),u=l[0],d=l[1],p=i.useState(!0);p[0];var f=p[1],h=i.useState(null),m=h[0],v=h[1];return i.useEffect(function(){if(o){w(void 0,void 0,void 0,function(){var e,t;return E(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,3,4]),f(!0),[4,Et()];case 1:return(null==(e=n.sent())?void 0:e.token)?d(e.token):v("Voice calling not configured"),[3,4];case 2:return t=n.sent(),v(t.message||"Failed to initialize calling"),[3,4];case 3:return f(!1),[7];case 4:return[2]}})})}else f(!1)},[o]),o&&!m&&u?r.jsxs(Dt,{accessToken:u,agentUserId:"0047",autoConnectVOIP:!0,children:[t,r.jsx(Bt,{prospectId:s,prospectName:a,prospectNumber:c})]}):r.jsx(r.Fragment,{children:t})},exports.FeeTypeSelector=function(e){return r.jsx(o.SingleSelect,x({label:"Fee Type",options:null==yt?void 0:yt.map(function(e){return{label:e.label,value:e.value}})},e))},exports.HostelBlockSelector=function(e){return r.jsx(o.SingleSelect,x({dbValueProps:{valueKey:"id",isInt:!0},dbLabelProps:{labelKey:"name",subLabelKey:"type",useLabelStartCase:!0,useSubLabelStartCase:!0}},e,{externalAxios:D,optionsApiEndPoint:"/dropdowns/hostel-blocks"}))},exports.HostelFloorSelector=function(e){return r.jsx(o.SingleSelect,x({label:"Hostel Room No.",dbValueProps:{valueKey:"floor"},dbLabelProps:{labelKey:"floor"}},e,{externalAxios:D,optionsApiEndPoint:"dropdowns/floors"}))},exports.HostelRoomSelector=function(e){return r.jsx(o.SingleSelect,x({label:"Hostel Room",dbValueProps:{valueKey:"id"},dbLabelProps:{labelKey:"room_number",useLabelStartCase:!0}},e,{optionsApiEndPoint:"dropdowns/hostel-rooms",externalAxios:D}))},exports.MicrophonePermission=function(e){var t=e.onPermissionGranted,n=e.onPermissionDenied,s=It(),a=s.permissionStatus,c=s.requestMicrophoneAccess,l=i.useState(!1),u=l[0],d=l[1],p=i.useState(null),f=p[0],h=p[1];return"granted"===a?r.jsxs("div",{className:"flex items-center gap-2 text-green-600",children:[r.jsx(m.Mic,{className:"w-4 h-4"}),r.jsx("span",{className:"text-sm",children:"Microphone access granted"})]}):"denied"===a?r.jsxs("div",{className:"p-4 bg-red-50 rounded-lg border border-red-200",children:[r.jsxs("div",{className:"flex items-center gap-2 text-red-600 mb-2",children:[r.jsx(m.MicOff,{className:"w-5 h-5"}),r.jsx("span",{className:"font-medium",children:"Microphone Access Denied"})]}),r.jsx("p",{className:"text-sm text-red-600 mb-3",children:"To use the calling feature, you need to enable microphone access in your browser settings."}),r.jsxs("div",{className:"text-xs text-gray-600",children:[r.jsx("p",{className:"font-medium mb-1",children:"How to enable:"}),r.jsxs("ol",{className:"list-decimal list-inside space-y-1",children:[r.jsx("li",{children:"Click the lock/info icon in your browser's address bar"}),r.jsx("li",{children:'Find "Microphone" in the permissions list'}),r.jsx("li",{children:'Change the setting to "Allow"'}),r.jsx("li",{children:"Refresh the page"})]})]})]}):r.jsxs("div",{className:"p-4 bg-blue-50 rounded-lg border border-blue-200",children:[r.jsxs("div",{className:"flex items-center gap-2 text-blue-600 mb-2",children:[r.jsx(m.AlertCircle,{className:"w-5 h-5"}),r.jsx("span",{className:"font-medium",children:"Microphone Permission Required"})]}),r.jsx("p",{className:"text-sm text-gray-600 mb-3",children:"To make and receive calls, we need access to your microphone. Click the button below to grant permission."}),r.jsxs(o.Button,{variant:"default",size:"sm",onClick:function(){return w(void 0,void 0,void 0,function(){var e;return E(this,function(r){switch(r.label){case 0:d(!0),h(null),r.label=1;case 1:return r.trys.push([1,3,4,5]),[4,c()];case 2:return r.sent()?null==t||t():(h("Microphone access was denied"),null==n||n()),[3,5];case 3:return e=r.sent(),h(e.message||"Failed to request microphone access"),null==n||n(),[3,5];case 4:return d(!1),[7];case 5:return[2]}})})},loading:u,className:"gap-1.5",children:[r.jsx(m.Mic,{className:"w-4 h-4"}),"Allow Microphone Access"]}),f&&r.jsx("p",{className:"text-red-500 text-xs mt-2",children:f})]})},exports.MonthYearSelector=function(e){return r.jsx(o.SingleSelect,x({label:"Month & Year"},e,{externalAxios:D,optionsApiEndPoint:"/dropdowns/month-years"}))},exports.PrintFormatSelector=function(e){return r.jsx(o.SingleSelect,x({dbLabelProps:{labelKey:"name",subLabelKey:"type",useSubLabelStartCase:!0}},e,{externalAxios:D,optionsApiEndPoint:"/dropdowns/print-formats"}))},exports.ProgramSelector=function(e){return r.jsx(o.SingleSelect,x({dbLabelProps:{labelKey:"branchCode",subLabelKey:"branchDisplay"}},e,{externalAxios:D,optionsApiEndPoint:"/dropdowns/programs"}))},exports.Providers=function(e){var t=e.children,n=e.basename,o=e.reducers,c=void 0===o?{}:o,l=new s.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:!1,useErrorBoundary:!0}}}),u=j&&k&&C?"/".concat(k,"/").concat(C):"/";i.useEffect(function(){"/"===window.location.pathname&&k&&C&&j&&window.location.replace(window.location.origin+"/".concat(k,"/").concat(C))},[k,j,C]);var d=pt({reducer:ee(c)});return r.jsx(p.Provider,{store:d,children:r.jsx(a.BrowserRouter,{basename:null!=n?n:u,children:r.jsx(s.QueryClientProvider,{client:l,children:r.jsx(mt,{children:r.jsx(V,{children:t})})})})})},exports.RegulationSelector=function(e){return r.jsx(o.SingleSelect,x({label:"Regulation",dbValueProps:{valueKey:"regulation_id"},dbLabelProps:{labelKey:"r.name"}},e,{optionsApiEndPoint:"dropdowns/regulations",externalAxios:D}))},exports.ResearchExpertDesignationSelector=function(e){return r.jsx(o.SingleSelect,x({dbLabelProps:{labelKey:"name"},dbValueProps:{valueKey:"id",isInt:!0}},e,{externalAxios:D,optionsApiEndPoint:"/dropdowns/research-expert-designations"}))},exports.ResearchExpertSelector=function(e){return r.jsx(o.SingleSelect,x({dbValueProps:{valueKey:"id"},dbLabelProps:{labelKey:"name",subLabelKey:"type"}},e,{optionsApiEndPoint:"dropdowns/research-experts",externalAxios:D}))},exports.ResearchStageSelector=function(e){return r.jsx(o.SingleSelect,x({dbValueProps:{valueKey:"id",isInt:!0},dbLabelProps:{labelKey:"name",subLabelKey:"`order`"}},e,{optionsApiEndPoint:"dropdowns/research-stages",externalAxios:D}))},exports.SemesterSelector=function(e){return r.jsx(o.SingleSelect,x({dbLabelProps:{labelKey:"name",subLabelKey:"year"}},e,{optionsApiEndPoint:"/dropdowns/semesters",externalAxios:D}))},exports.SnackbarProvider=mt,exports.StudentSelector=function(e){return r.jsx(o.SingleSelect,x({dbLabelProps:{labelKey:"slug",useLabelStartCase:!0},dbValueProps:{valueKey:"id"}},e,{externalAxios:D,optionsApiEndPoint:"/dropdowns/students"}))},exports.StudentServicesSelector=function(e){return r.jsx(o.SingleSelect,x({dbLabelProps:{labelKey:"slug",useLabelStartCase:!0},dbValueProps:{valueKey:"id"}},e,{externalAxios:D,optionsApiEndPoint:"/dropdowns/student-services"}))},exports.VOIP_ENABLED_WORKSPACES=I,exports.VoIPProvider=function(e){var t=e.children,n=e.workspace,o=e.agentUserId,s=e.prospectId,a=e.prospectName,c=e.prospectNumber,l=e.onSaveDisposition,u=i.useState(null),d=u[0],p=u[1],f=i.useState(!0),h=f[0],m=f[1],v=i.useState(null),b=v[0],y=v[1],g=A(n),x=!!o,S=i.useCallback(function(e){return w(void 0,void 0,void 0,function(){return E(this,function(t){return l?[2,l(e)]:[2,_t({callId:e.callId,prospectId:e.prospectId,callStatusDisposition:e.callStatusDisposition,dispositionCategory:e.dispositionCategory,dispositionReason:e.dispositionReason||void 0,dispositionNotes:e.remarks||void 0})]})})},[l]);return i.useEffect(function(){if(g&&x){w(void 0,void 0,void 0,function(){var e,t;return E(this,function(n){switch(n.label){case 0:return n.trys.push([0,3,4,5]),m(!0),y(null),[4,wt()];case 1:return n.sent().enabled?[4,Et()]:(y("Voice calling not enabled for this tenant"),m(!1),[2]);case 2:return(null==(e=n.sent())?void 0:e.token)?p(e.token):y("Voice calling token not available"),[3,5];case 3:return t=n.sent(),y(t.message||"Failed to initialize calling"),[3,5];case 4:return m(!1),[7];case 5:return[2]}})})}else m(!1)},[g,x]),g&&x?h||b||!d?r.jsx(r.Fragment,{children:t}):r.jsxs(Dt,{accessToken:d,agentUserId:o,autoConnectVOIP:!0,children:[t,r.jsx(Bt,{prospectId:s,prospectName:a,prospectNumber:c,onSaveDisposition:S})]}):r.jsx(r.Fragment,{children:t})},exports.YearRangeSelector=function(e){var t=e.suffix,n=void 0===t?null:t,i=e.valueKey,s=void 0===i?"yearRange":i,a=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["suffix","valueKey"]);return r.jsx(o.SingleSelect,x({label:"Year Range",options:null==gt?void 0:gt.map(function(e){return{label:n?"".concat(n," ").concat(e," - ").concat(e+1):"".concat(e," - ").concat(e+1),value:"yearRange"===s?"".concat(e," - ").concat(e+1):e}})},a))},exports.axios=P,exports.cancelCall=jt,exports.checkVoIPEnabled=wt,exports.createExotelAppToken=function(){return w(void 0,void 0,void 0,function(){var e;return E(this,function(t){switch(t.label){case 0:return[4,Et()];case 1:if(!(e=t.sent()))throw new Error("No active voice configuration found");return[2,{Data:e.token}]}})})},exports.createRsbuildSharedConfig=function(e,t,n){return n.reduce(function(n,r){var o=e[r];return o&&(n[r]=x({singleton:!0,requiredVersion:o,version:o.replace(/^[\^~]/,"")},t.includes(r)?{eager:!0}:{})),n},{})},exports.fetchCallHistory=function(e){return w(void 0,void 0,void 0,function(){var t;return E(this,function(n){switch(n.label){case 0:return t="common-workspace"===C?"/paymentx/call-activities":"/call-activities",[4,P.get("".concat(t,"/by-prospect"),{params:{prospectId:e}})];case 1:return[2,n.sent().data]}})})},exports.getActiveVoiceToken=Et,exports.getCallActivityByCallSid=function(e){return w(void 0,void 0,void 0,function(){var t;return E(this,function(n){switch(n.label){case 0:return t="common-workspace"===C?"/paymentx/call-activities":"/call-activities",[4,P.get("".concat(t,"/by-call-sid"),{params:{callSid:e}})];case 1:return[2,n.sent().data]}})})},exports.getCallActivityById=function(e){return w(void 0,void 0,void 0,function(){var t;return E(this,function(n){switch(n.label){case 0:return t="common-workspace"===C?"/paymentx/call-activities":"/call-activities",[4,P.get("".concat(t,"/").concat(e))];case 1:return[2,n.sent().data]}})})},exports.getCallCountByProspect=function(e){return w(void 0,void 0,void 0,function(){var t,n;return E(this,function(r){switch(r.label){case 0:return t="common-workspace"===C?"/paymentx/call-activities":"/call-activities",[4,P.get("".concat(t,"/count-by-prospect"),{params:{prospectId:e}})];case 1:return[2,(null==(n=r.sent().data)?void 0:n.count)||0]}})})},exports.initialApplicationState=S,exports.initiateCallActivity=St,exports.institutionCode=k,exports.isDevelopment=_,exports.isVoIPEnabledForWorkspace=A,exports.nonWorkspaceAxios=D,exports.openInNewTab=function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!1);var r=window.location.pathname.split("/"),o=[];!t&&r[1]&&o.push(r[1]),!n&&r[2]&&o.push(r[2]);var i=o.length>0?"/"+o.join("/"):"",s="".concat(window.location.origin).concat(i,"/").concat(e);window.open(s,"_blank")},exports.registerIncomingCall=Nt,exports.saveCallDisposition=_t,exports.tenantCode=j,exports.useConfirm=function(){var e=function(){N.update(function(e){e.confirmDialog=vt})};return function(t){var n=t.title,r=t.message,o=t.confirmButtonText,i=t.cancelButtonText,s=t.type,a=void 0===s?"confirm":s;return new Promise(function(t){N.update(function(s){s.confirmDialog={isOpen:!0,title:n,message:r,confirmButtonText:o,cancelButtonText:i,type:a,onConfirm:function(){t(!0),e()},onCancel:function(){t(!1),e()}}})})}},exports.useExotel=It,exports.useExotelSafe=At,exports.workspace=C,exports.workspaceApiMapping=O;
|
|
1
|
+
"use strict";var e=require("axios"),t=require("js-cookie"),n=require("pullstate"),r=require("react/jsx-runtime"),o=require("@campxdev/react-blueprint"),i=require("react"),s=require("react-query"),a=require("react-router-dom"),c=require("@hookform/resolvers"),l=require("react-hook-form"),u=require("device-detector-js"),d=require("yup"),p=require("react-redux"),f=require("@exotel-npm-dev/exotel-ip-calling-crm-websdk"),h=require("lucide-react"),m=require("react-dom"),v=require("scrypt-js");function b(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,Object.freeze(t)}var y=b(i),g=b(d),x=function(){return x=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},x.apply(this,arguments)};function w(e,t,n,r){return new(n||(n=Promise))(function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}c((r=r.apply(e,t||[])).next())})}function E(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}"function"==typeof SuppressedError&&SuppressedError;var S={isLoginDialogOpen:!1,snackbar:{open:!1,message:"",severity:"success"},confirmDialog:{isOpen:!1,title:"",message:"",onConfirm:function(){},onCancel:function(){},type:"confirm"},user:void 0,institutionInfo:void 0,asset:void 0},N=new n.Store(S),_=window.location.hostname.includes("localhost"),j=window.location.hostname.split(".")[0],k=window.location.pathname.split("/")[1],C=window.location.pathname.split("/")[2],O={"student-workspace":"/student-api","faculty-workspace":"/faculty-api","department-workspace":"/department-api","academic-coordinator-workspace":"/academic-coordinator-api","feedback-coordinator-workspace":"/feedback-coordinator-api","course-coordinator-workspace":"/course-coordinator-api","classroom-coordinator-workspace":"/classroom-coordinator-api","coe-workspace":"/coe-api","academic-admin-workspace":"/academic-admin-api","hostel-admin-workspace":"/hostel-admin-api","transport-coordinator-workspace":"/transport-coordinator-api","employee-workspace":"/employee-api","librarian-workspace":"/librarian-api","fee-terminal":"/fee-terminal-api","accounts-officer-workspace":"accounts-officer-api","finance-officer-workspace":"finance-officer-api","outreach-agent-workspace":"outreach-agent-api","prospect-workspace":"prospect-api","external-expert-workspace":"external-expert-api","research-coordinator-workspace":"research-coordinator-api","tele-counsellor-workspace":"tele-counsellor-api","team-owner-workspace":"/team-owner-api","admissions-counsellor-workspace":"/admissions-counsellor-api","admissions-officer-workspace":"/admissions-officer-api"},P=e.create({baseURL:process.env.REACT_APP_API_HOST||"",withCredentials:!0,headers:{"x-tenant-id":j,"x-institution-code":k}});P.interceptors.request.use(function(e){var n=function(e){return Object.fromEntries(Object.entries(null!=e?e:{}).map(function(e){var t=e[0],n=e[1];return[t,"__empty__"===n?"":n]}))}(null==e?void 0:e.params);if(!1!==e.workspace&&C&&O[C]&&"common-workspace"!==C){var r=O[C];e.url="".concat(r).concat(e.url)}var o=t.get("campx_session_key"),i=t.get("campx_open_payments_key"),s=t.get("campx_student_key");return _&&o&&e.headers.set("campx_session_key",o),_&&s&&e.headers.set("campx_student_key",s),i&&e.headers.set("campx_open_payments_key",i),e.skipInstitutionCode&&e.headers.delete("x-institution-code"),x(x({},e),{params:n})},function(e){return Promise.reject(e)}),P.interceptors.response.use(function(e){var t;return!(!0===(null===(t=e.data)||void 0===t?void 0:t.hideSnackbar))&&e.config.method&&["put","post","delete","patch"].includes(e.config.method)&&[200,201,202].includes(e.status)&&N.update(function(t){t.snackbar.open=!0,t.snackbar.message=e.data.message||"Operation successful",t.snackbar.severity="success"}),e},function(e){var t,n,r,o,i=!0===(null===(n=null===(t=e.response)||void 0===t?void 0:t.data)||void 0===n?void 0:n.hideSnackbar);return!i&&[400,422,413].includes(null===(r=e.response)||void 0===r?void 0:r.status)&&N.update(function(t){t.snackbar.open=!0,t.snackbar.message=e.response.data.message||"Bad Request",t.snackbar.severity="error"}),!i&&(null===(o=e.response)||void 0===o?void 0:o.config.method)&&["put","post","delete","patch"].includes(e.response.config.method)&&[404].includes(e.response.status)&&N.update(function(t){t.snackbar.open=!0,t.snackbar.message=e.response.data.message||"Not Found",t.snackbar.severity="error"}),Promise.reject(e)});var D=e.create({baseURL:process.env.REACT_APP_API_HOST||"",withCredentials:!0,workspace:!1,headers:{"x-tenant-id":j,"x-institution-code":k}});D.interceptors.request.use(function(e){var n=function(e){return Object.fromEntries(Object.entries(null!=e?e:{}).map(function(e){var t=e[0],n=e[1];return[t,"__empty__"===n?"":n]}))}(null==e?void 0:e.params),r=t.get("campx_session_key"),o=t.get("campx_open_payments_key"),i=t.get("campx_student_key");return _&&r&&e.headers.set("campx_session_key",r),_&&i&&e.headers.set("campx_student_key",i),o&&e.headers.set("campx_open_payments_key",o),e.skipInstitutionCode&&e.headers.delete("x-institution-code"),x(x({},e),{params:n})},function(e){return Promise.reject(e)}),D.interceptors.response.use(function(e){var t;return!(!0===(null===(t=e.data)||void 0===t?void 0:t.hideSnackbar))&&e.config.method&&["put","post","delete","patch"].includes(e.config.method)&&[200,201,202].includes(e.status)&&N.update(function(t){t.snackbar.open=!0,t.snackbar.message=e.data.message||"Operation successful",t.snackbar.severity="success"}),e},function(e){var t,n,r,o,i=!0===(null===(n=null===(t=e.response)||void 0===t?void 0:t.data)||void 0===n?void 0:n.hideSnackbar);return!i&&[400,422].includes(null===(r=e.response)||void 0===r?void 0:r.status)&&N.update(function(t){t.snackbar.open=!0,t.snackbar.message=e.response.data.message||"Bad Request",t.snackbar.severity="error"}),!i&&(null===(o=e.response)||void 0===o?void 0:o.config.method)&&["put","post","delete","patch"].includes(e.response.config.method)&&[404].includes(e.response.status)&&N.update(function(t){t.snackbar.open=!0,t.snackbar.message=e.response.data.message||"Not Found",t.snackbar.severity="error"}),Promise.reject(e)});var I=["admissions-officer-workspace","tele-counsellor-workspace"];function A(e){return I.includes(e)}var T=i.createContext({showConfirmDialog:function(){}}),V=function(e){var t=e.children,n=N.useState(function(e){return e.confirmDialog}),i=function(){N.update(function(e){e.confirmDialog.isOpen=!1})};return r.jsxs(T.Provider,{value:{showConfirmDialog:function(e,t,n,r,o,i,s){void 0===o&&(o="confirm"),N.update(function(a){a.confirmDialog={isOpen:!0,title:e,message:t,onConfirm:n,onCancel:r,type:o,confirmButtonText:i,cancelButtonText:s}})}},children:[t,r.jsx(o.ConfirmDialog,{isOpen:n.isOpen,title:n.title,message:n.message,type:n.type,confirmButtonText:n.confirmButtonText,cancelButtonText:n.cancelButtonText,onConfirm:function(){n.onConfirm(),i()},onCancel:function(){n.onCancel(),i()}})]})};function M(e,t){return M=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},M(e,t)}var L={error:null},R=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(t=e.call.apply(e,[this].concat(r))||this).state=L,t.resetErrorBoundary=function(){for(var e,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];null==t.props.onReset||(e=t.props).onReset.apply(e,r),t.reset()},t}!function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,M(e,t)}(t,e),t.getDerivedStateFromError=function(e){return{error:e}};var n=t.prototype;return n.reset=function(){this.setState(L)},n.componentDidCatch=function(e,t){var n,r;null==(n=(r=this.props).onError)||n.call(r,e,t)},n.componentDidUpdate=function(e,t){var n,r,o,i,s=this.state.error,a=this.props.resetKeys;null!==s&&null!==t.error&&(void 0===(o=e.resetKeys)&&(o=[]),void 0===(i=a)&&(i=[]),o.length!==i.length||o.some(function(e,t){return!Object.is(e,i[t])}))&&(null==(n=(r=this.props).onResetKeysChange)||n.call(r,e.resetKeys,a),this.reset())},n.render=function(){var e=this.state.error,t=this.props,n=t.fallbackRender,r=t.FallbackComponent,o=t.fallback;if(null!==e){var i={error:e,resetErrorBoundary:this.resetErrorBoundary};if(y.isValidElement(o))return o;if("function"==typeof n)return n(i);if(r)return y.createElement(r,i);throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop")}return this.props.children},t}(y.Component),F=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),function(r,o,i){try{return Promise.resolve(function(s,a){try{var l=(t.context&&process.env.NODE_ENV,Promise.resolve(e["sync"===n.mode?"validateSync":"validate"](r,Object.assign({abortEarly:!1},t,{context:o}))).then(function(e){return i.shouldUseNativeValidation&&c.validateFieldsNatively({},i),{values:n.rawValues?r:e,errors:{}}}))}catch(e){return a(e)}return l&&l.then?l.then(void 0,a):l}(0,function(e){if(!e.inner)throw e;return{values:{},errors:c.toNestError((t=e,n=!i.shouldUseNativeValidation&&"all"===i.criteriaMode,(t.inner||[]).reduce(function(e,t){if(e[t.path]||(e[t.path]={message:t.message,type:t.type}),n){var r=e[t.path].types,o=r&&r[t.type];e[t.path]=l.appendErrors(t.path,n,e,t.type,o?[].concat(o,t.message):t.message)}return e},{})),i)};var t,n}))}catch(e){return Promise.reject(e)}}},K=function(e){return w(void 0,void 0,void 0,function(){var t;return E(this,function(n){switch(n.label){case 0:return e.latitude&&e.longitude?[3,3]:[4,fetch("https://www.googleapis.com/geolocation/v1/geolocate?key=AIzaSyB2YCpo1yi107RYj1LdZu2DCcpcO93reFY",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({considerIp:"true"})})];case 1:return[4,n.sent().json()];case 2:t=n.sent(),e.latitude=t.location.lat,e.longitude=t.location.lng,n.label=3;case 3:return[2,P.post("/auth-server/auth-v2/login",e,{workspace:!1}).then(function(e){return e.data})]}})})},q=g.object().shape({username:g.string().required("Username is required"),password:g.string().required("Password is required")}),B=function(e){var n=e.close,c=i.useState({deviceInformation:{deviceType:"browser",clientName:"unknown",os:"unknown",osVersion:"unknown",latitude:null,longitude:null,tokenType:"WEB"},isLocationAllowed:!0}),d=c[0],p=c[1],f=a.useNavigate();i.useEffect(function(){navigator.geolocation.getCurrentPosition(function(e){p(function(t){return x(x({},t),{deviceInformation:x(x({},t.deviceInformation),{latitude:e.coords.latitude,longitude:e.coords.longitude})})})}),navigator.permissions.query({name:"geolocation"}).then(function(e){"denied"===e.state&&p(function(e){return x(x({},e),{isLocationAllowed:!1})})});var e=(new u).parse(navigator.userAgent);p(function(t){var n,r,o;return x(x({},t),{deviceInformation:x(x({},t.deviceInformation),{clientName:(null===(n=e.client)||void 0===n?void 0:n.name)||t.deviceInformation.clientName,os:(null===(r=e.os)||void 0===r?void 0:r.name)||t.deviceInformation.os,osVersion:(null===(o=e.os)||void 0===o?void 0:o.version)||t.deviceInformation.osVersion})})})},[]);var h=l.useForm({resolver:F(q)}),m=h.handleSubmit,v=h.control,b=h.formState.errors,y=s.useMutation(K,{onSuccess:function(e){_&&(t.remove("campx_session_key"),t.set("campx_session_key",e.session.token),n(),f("/".concat(e.session.institutionCode,"/workspace")),window.location.reload())}}),g=y.mutate,S=y.isLoading;return r.jsxs("div",{className:"flex flex-col gap-8 justify-center items-center p-8",children:[r.jsx("div",{className:"flex items-center justify-center h-9 w-48",children:r.jsx(o.Icons.CampxFullLogoIcon,{})}),r.jsxs("div",{className:"flex flex-col gap-4 w-full max-w-[400px]",children:[r.jsx(l.Controller,{control:v,render:function(e){var t=e.field;return r.jsx(o.TextField,{name:"username",placeholder:"Enter Username or Email",onChange:t.onChange,label:"Username or Email",error:!!b.username,required:!0,fullWidth:!0})},name:"username"}),r.jsx(l.Controller,{control:v,render:function(e){var t=e.field;return r.jsx(o.PasswordField,{name:"password",placeholder:"Enter password",onChange:t.onChange,label:"Password",error:!!b.password,required:!0,fullWidth:!0})},name:"password"}),r.jsx(o.Button,{type:"submit",color:"primary",variant:"default",onClick:m(function(e){return w(void 0,void 0,void 0,function(){return E(this,function(t){return g(x(x(x({},e),d.deviceInformation),{loginId:e.username,loginType:"USER"})),[2]})})}),disabled:S,loading:S,fullWidth:!0,children:"Login"})]})]})},z=function(e){var t,n,i,s,a,c,l,u=e.error,d=e.resetErrorBoundary;if(null===(t=null==u?void 0:u.response)||void 0===t?void 0:t.status)switch(null===(n=null==u?void 0:u.response)||void 0===n?void 0:n.status){case 401:return r.jsx(U,{});case 500:return r.jsx(o.InternalServerError,{resetBoundary:d});case 404:return r.jsx(o.ResourceNotFound,{message:null===(s=null===(i=null==u?void 0:u.response)||void 0===i?void 0:i.data)||void 0===s?void 0:s.message})}return"ERR_NETWORK"===(null==u?void 0:u.code)?r.jsx(o.NoInterneConnection,{resetBoundary:d}):r.jsx("div",{className:"mt-4 p-5",children:r.jsxs("div",{className:"relative h-15 border border-red-200 bg-red-50 flex items-center rounded-md px-2",children:[r.jsx("div",{className:"flex-1 text-red-700 bg-transparent",children:null!==(l=null===(c=null===(a=null==u?void 0:u.response)||void 0===a?void 0:a.data)||void 0===c?void 0:c.message)&&void 0!==l?l:null==u?void 0:u.message}),r.jsx(o.Button,{onClick:function(){return d()},size:"sm",variant:"link",className:"hover:no-underline text-destructive",children:"Try Again"})]})})},U=function(){var e=a.useNavigate(),n=i.useState(!1),s=n[0],c=n[1],l=t.get("campx_session_key");return r.jsx(o.UnAuthorized,{component:r.jsxs(r.Fragment,{children:[r.jsx(o.Button,{className:"mt-5",variant:"default",onClick:function(){"localhost"===window.location.hostname.split(".")[1]?c(!0):l||e("prospect-workspace"===C?"".concat(k,"/ats/login"):"/auth/login")},children:"Click Here To Login"}),r.jsx(o.Dialog,{open:s,onClose:function(){return c(!1)},content:function(e){var t=e.close;return r.jsx(B,{close:t})}})]})})};function $(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var W=(()=>"function"==typeof Symbol&&Symbol.observable||"@@observable")(),H=()=>Math.random().toString(36).substring(7).split("").join("."),Y={INIT:`@@redux/INIT${H()}`,REPLACE:`@@redux/REPLACE${H()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${H()}`};function X(e){if("object"!=typeof e||null===e)return!1;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||null===Object.getPrototypeOf(e)}function Q(e){if(void 0===e)return"undefined";if(null===e)return"null";const t=typeof e;switch(t){case"boolean":case"string":case"number":case"symbol":case"function":return t}if(Array.isArray(e))return"array";if(function(e){return e instanceof Date||"function"==typeof e.toDateString&&"function"==typeof e.getDate&&"function"==typeof e.setDate}(e))return"date";if(function(e){return e instanceof Error||"string"==typeof e.message&&e.constructor&&"number"==typeof e.constructor.stackTraceLimit}(e))return"error";const n=function(e){return"function"==typeof e.constructor?e.constructor.name:null}(e);switch(n){case"Symbol":case"Promise":case"WeakMap":case"WeakSet":case"Map":case"Set":return n}return Object.prototype.toString.call(e).slice(8,-1).toLowerCase().replace(/\s/g,"")}function G(e){let t=typeof e;return"production"!==process.env.NODE_ENV&&(t=Q(e)),t}function J(e,t,n){if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?$(2):`Expected the root reducer to be a function. Instead, received: '${G(e)}'`);if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error("production"===process.env.NODE_ENV?$(0):"It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.");if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error("production"===process.env.NODE_ENV?$(1):`Expected the enhancer to be a function. Instead, received: '${G(n)}'`);return n(J)(e,t)}let r=e,o=t,i=new Map,s=i,a=0,c=!1;function l(){s===i&&(s=new Map,i.forEach((e,t)=>{s.set(t,e)}))}function u(){if(c)throw new Error("production"===process.env.NODE_ENV?$(3):"You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return o}function d(e){if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?$(4):`Expected the listener to be a function. Instead, received: '${G(e)}'`);if(c)throw new Error("production"===process.env.NODE_ENV?$(5):"You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api/store#subscribelistener for more details.");let t=!0;l();const n=a++;return s.set(n,e),function(){if(t){if(c)throw new Error("production"===process.env.NODE_ENV?$(6):"You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details.");t=!1,l(),s.delete(n),i=null}}}function p(e){if(!X(e))throw new Error("production"===process.env.NODE_ENV?$(7):`Actions must be plain objects. Instead, the actual type was: '${G(e)}'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.`);if(void 0===e.type)throw new Error("production"===process.env.NODE_ENV?$(8):'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if("string"!=typeof e.type)throw new Error("production"===process.env.NODE_ENV?$(17):`Action "type" property must be a string. Instead, the actual type was: '${G(e.type)}'. Value was: '${e.type}' (stringified)`);if(c)throw new Error("production"===process.env.NODE_ENV?$(9):"Reducers may not dispatch actions.");try{c=!0,o=r(o,e)}finally{c=!1}return(i=s).forEach(e=>{e()}),e}p({type:Y.INIT});return{dispatch:p,subscribe:d,getState:u,replaceReducer:function(e){if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?$(10):`Expected the nextReducer to be a function. Instead, received: '${G(e)}`);r=e,p({type:Y.REPLACE})},[W]:function(){const e=d;return{subscribe(t){if("object"!=typeof t||null===t)throw new Error("production"===process.env.NODE_ENV?$(11):`Expected the observer to be an object. Instead, received: '${G(t)}'`);function n(){const e=t;e.next&&e.next(u())}n();return{unsubscribe:e(n)}},[W](){return this}}}}}function Z(e){"undefined"!=typeof console&&console.error;try{throw new Error(e)}catch(e){}}function ee(e){const t=Object.keys(e),n={};for(let r=0;r<t.length;r++){const o=t[r];"production"!==process.env.NODE_ENV&&void 0===e[o]&&Z(`No reducer provided for key "${o}"`),"function"==typeof e[o]&&(n[o]=e[o])}const r=Object.keys(n);let o,i;"production"!==process.env.NODE_ENV&&(o={});try{!function(e){Object.keys(e).forEach(t=>{const n=e[t];if(void 0===n(void 0,{type:Y.INIT}))throw new Error("production"===process.env.NODE_ENV?$(12):`The slice reducer for key "${t}" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);if(void 0===n(void 0,{type:Y.PROBE_UNKNOWN_ACTION()}))throw new Error("production"===process.env.NODE_ENV?$(13):`The slice reducer for key "${t}" returned undefined when probed with a random type. Don't try to handle '${Y.INIT}' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.`)})}(n)}catch(e){i=e}return function(e={},t){if(i)throw i;if("production"!==process.env.NODE_ENV){const r=function(e,t,n,r){const o=Object.keys(t),i=n&&n.type===Y.INIT?"preloadedState argument passed to createStore":"previous state received by the reducer";if(0===o.length)return"Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";if(!X(e))return`The ${i} has unexpected type of "${G(e)}". Expected argument to be an object with the following keys: "${o.join('", "')}"`;const s=Object.keys(e).filter(e=>!t.hasOwnProperty(e)&&!r[e]);return s.forEach(e=>{r[e]=!0}),n&&n.type===Y.REPLACE?void 0:s.length>0?`Unexpected ${s.length>1?"keys":"key"} "${s.join('", "')}" found in ${i}. Expected to find one of the known reducer keys instead: "${o.join('", "')}". Unexpected keys will be ignored.`:void 0}(e,n,t,o);r&&Z(r)}let s=!1;const a={};for(let o=0;o<r.length;o++){const i=r[o],c=n[i],l=e[i],u=c(l,t);if(void 0===u){const e=t&&t.type;throw new Error("production"===process.env.NODE_ENV?$(14):`When called with an action of type ${e?`"${String(e)}"`:"(unknown type)"}, the slice reducer for key "${i}" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.`)}a[i]=u,s=s||u!==l}return s=s||r.length!==Object.keys(e).length,s?a:e}}function te(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce((e,t)=>(...n)=>e(t(...n)))}var ne=Symbol.for("immer-nothing"),re=Symbol.for("immer-draftable"),oe=Symbol.for("immer-state"),ie="production"!==process.env.NODE_ENV?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function se(e,...t){if("production"!==process.env.NODE_ENV){const n=ie[e],r="function"==typeof n?n.apply(null,t):n;throw new Error(`[Immer] ${r}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var ae=Object.getPrototypeOf;function ce(e){return!!e&&!!e[oe]}function le(e){return!!e&&(pe(e)||Array.isArray(e)||!!e[re]||!!e.constructor?.[re]||be(e)||ye(e))}var ue=Object.prototype.constructor.toString(),de=new WeakMap;function pe(e){if(!e||"object"!=typeof e)return!1;const t=Object.getPrototypeOf(e);if(null===t||t===Object.prototype)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(n===Object)return!0;if("function"!=typeof n)return!1;let r=de.get(n);return void 0===r&&(r=Function.toString.call(n),de.set(n,r)),r===ue}function fe(e,t,n=!0){if(0===he(e)){(n?Reflect.ownKeys(e):Object.keys(e)).forEach(n=>{t(n,e[n],e)})}else e.forEach((n,r)=>t(r,n,e))}function he(e){const t=e[oe];return t?t.type_:Array.isArray(e)?1:be(e)?2:ye(e)?3:0}function me(e,t){return 2===he(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function ve(e,t,n){const r=he(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function be(e){return e instanceof Map}function ye(e){return e instanceof Set}function ge(e){return e.copy_||e.base_}function xe(e,t){if(be(e))return new Map(e);if(ye(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=pe(e);if(!0===t||"class_only"===t&&!n){const t=Object.getOwnPropertyDescriptors(e);delete t[oe];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){const o=n[r],i=t[o];!1===i.writable&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(t[o]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[o]})}return Object.create(ae(e),t)}{const t=ae(e);if(null!==t&&n)return{...e};const r=Object.create(t);return Object.assign(r,e)}}function we(e,t=!1){return Se(e)||ce(e)||!le(e)||(he(e)>1&&Object.defineProperties(e,{set:Ee,add:Ee,clear:Ee,delete:Ee}),Object.freeze(e),t&&Object.values(e).forEach(e=>we(e,!0))),e}var Ee={value:function(){se(2)}};function Se(e){return null===e||"object"!=typeof e||Object.isFrozen(e)}var Ne,_e={};function je(e){const t=_e[e];return t||se(0,e),t}function ke(){return Ne}function Ce(e,t){t&&(je("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Oe(e){Pe(e),e.drafts_.forEach(Ie),e.drafts_=null}function Pe(e){e===Ne&&(Ne=e.parent_)}function De(e){return Ne={drafts_:[],parent_:Ne,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Ie(e){const t=e[oe];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Ae(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[oe].modified_&&(Oe(t),se(4)),le(e)&&(e=Te(t,e),t.parent_||Me(t,e)),t.patches_&&je("Patches").generateReplacementPatches_(n[oe].base_,e,t.patches_,t.inversePatches_)):e=Te(t,n,[]),Oe(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==ne?e:void 0}function Te(e,t,n){if(Se(t))return t;const r=e.immer_.shouldUseStrictIteration(),o=t[oe];if(!o)return fe(t,(r,i)=>Ve(e,o,t,r,i,n),r),t;if(o.scope_!==e)return t;if(!o.modified_)return Me(e,o.base_,!0),o.base_;if(!o.finalized_){o.finalized_=!0,o.scope_.unfinalizedDrafts_--;const t=o.copy_;let i=t,s=!1;3===o.type_&&(i=new Set(t),t.clear(),s=!0),fe(i,(r,i)=>Ve(e,o,t,r,i,n,s),r),Me(e,t,!1),n&&e.patches_&&je("Patches").generatePatches_(o,n,e.patches_,e.inversePatches_)}return o.copy_}function Ve(e,t,n,r,o,i,s){if(null==o)return;if("object"!=typeof o&&!s)return;const a=Se(o);if(!a||s){if("production"!==process.env.NODE_ENV&&o===n&&se(5),ce(o)){const s=Te(e,o,i&&t&&3!==t.type_&&!me(t.assigned_,r)?i.concat(r):void 0);if(ve(n,r,s),!ce(s))return;e.canAutoFreeze_=!1}else s&&n.add(o);if(le(o)&&!a){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;if(t&&t.base_&&t.base_[r]===o&&a)return;Te(e,o),t&&t.scope_.parent_||"symbol"==typeof r||!(be(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))||Me(e,o)}}}function Me(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&we(t,n)}var Le={get(e,t){if(t===oe)return e;const n=ge(e);if(!me(n,t))return function(e,t,n){const r=Ke(t,n);return r?"value"in r?r.value:r.get?.call(e.draft_):void 0}(e,n,t);const r=n[t];return e.finalized_||!le(r)?r:r===Fe(e.base_,t)?(Be(e),e.copy_[t]=ze(r,e)):r},has:(e,t)=>t in ge(e),ownKeys:e=>Reflect.ownKeys(ge(e)),set(e,t,n){const r=Ke(ge(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=Fe(ge(e),t),s=r?.[oe];if(s&&s.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(((o=n)===(i=r)?0!==o||1/o==1/i:o!=o&&i!=i)&&(void 0!==n||me(e.base_,t)))return!0;Be(e),qe(e)}var o,i;return e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty:(e,t)=>(void 0!==Fe(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,Be(e),qe(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=ge(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty(){se(11)},getPrototypeOf:e=>ae(e.base_),setPrototypeOf(){se(12)}},Re={};function Fe(e,t){const n=e[oe];return(n?ge(n):e)[t]}function Ke(e,t){if(!(t in e))return;let n=ae(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=ae(n)}}function qe(e){e.modified_||(e.modified_=!0,e.parent_&&qe(e.parent_))}function Be(e){e.copy_||(e.copy_=xe(e.base_,e.scope_.immer_.useStrictShallowCopy_))}fe(Le,(e,t)=>{Re[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),Re.deleteProperty=function(e,t){return"production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&se(13),Re.set.call(this,e,t,void 0)},Re.set=function(e,t,n){return"production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&se(14),Le.set.call(this,e[0],t,n,e[0])};function ze(e,t){const n=be(e)?je("MapSet").proxyMap_(e,t):ye(e)?je("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:ke(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=Le;n&&(o=[r],i=Re);const{revoke:s,proxy:a}=Proxy.revocable(o,i);return r.draft_=a,r.revoke_=s,a}(e,t);return(t?t.scope_:ke()).drafts_.push(n),n}function Ue(e){if(!le(e)||Se(e))return e;const t=e[oe];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=xe(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=xe(e,!0);return fe(n,(e,t)=>{ve(n,e,Ue(t))},r),t&&(t.finalized_=!1),n}var $e=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(e,t,n)=>{if("function"==typeof e&&"function"!=typeof t){const n=t;t=e;const r=this;return function(e=n,...o){return r.produce(e,e=>t.call(this,e,...o))}}let r;if("function"!=typeof t&&se(6),void 0!==n&&"function"!=typeof n&&se(7),le(e)){const o=De(this),i=ze(e,void 0);let s=!0;try{r=t(i),s=!1}finally{s?Oe(o):Pe(o)}return Ce(o,n),Ae(r,o)}if(!e||"object"!=typeof e){if(r=t(e),void 0===r&&(r=e),r===ne&&(r=void 0),this.autoFreeze_&&we(r,!0),n){const t=[],o=[];je("Patches").generateReplacementPatches_(e,r,t,o),n(t,o)}return r}se(1,e)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),"boolean"==typeof e?.useStrictIteration&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){le(e)||se(8),ce(e)&&(e=function(e){ce(e)||se(10,e);return Ue(e)}(e));const t=De(this),n=ze(e,void 0);return n[oe].isManual_=!0,Pe(t),n}finishDraft(e,t){const n=e&&e[oe];n&&n.isManual_||se(9);const{scope_:r}=n;return Ce(r,t),Ae(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));const r=je("Patches").applyPatches_;return ce(e)?r(e,t):this.produce(e,e=>r(e,t))}};$e.produce;var We=$e.setUseStrictIteration.bind($e);function He(e){return({dispatch:t,getState:n})=>r=>o=>"function"==typeof o?o(t,n,e):r(o)}var Ye=He(),Xe=He,Qe="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?te:te.apply(null,arguments)};function Ge(e){return"function"==typeof e&&"type"in e&&((t=e)&&"function"==typeof t.match);var t}function Je(e,t){let n=0;return{measureTime(e){const t=Date.now();try{return e()}finally{const e=Date.now();n+=e-t}},warnIfExceeded(){}}}var Ze=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return 1===t.length&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function et(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function tt(e,t,n){const r=nt(e,t,n);return{detectMutations:()=>rt(e,t,r,n)}}function nt(e,t=[],n,r="",o=new Set){const i={value:n};if(!e(n)&&!o.has(n)){o.add(n),i.children={};for(const o in n){const s=r?r+"."+o:o;t.length&&-1!==t.indexOf(s)||(i.children[o]=nt(e,t,n[o],s))}}return i}function rt(e,t=[],n,r,o=!1,i=""){const s=n?n.value:void 0,a=s===r;if(o&&!a&&!Number.isNaN(r))return{wasMutated:!0,path:i};if(e(s)||e(r))return{wasMutated:!1};const c={};for(let e in n.children)c[e]=!0;for(let e in r)c[e]=!0;const l=t.length>0;for(let o in c){const s=i?i+"."+o:o;if(l){if(t.some(e=>e instanceof RegExp?e.test(s):s===e))continue}const c=rt(e,t,n.children[o],r[o],a,s);if(c.wasMutated)return c}return{wasMutated:!1}}function ot(e){const t=typeof e;return null==e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||X(e)}function it(e,t="",n=ot,r,o=[],i){let s;if(!n(e))return{keyPath:t||"<root>",value:e};if("object"!=typeof e||null===e)return!1;if(i?.has(e))return!1;const a=null!=r?r(e):Object.entries(e),c=o.length>0;for(const[e,l]of a){const a=t?t+"."+e:e;if(c){if(o.some(e=>e instanceof RegExp?e.test(a):a===e))continue}if(!n(l))return{keyPath:a,value:l};if("object"==typeof l&&(s=it(l,a,n,r,o,i),s))return s}return i&&st(e)&&i.add(e),!1}function st(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if("object"==typeof t&&null!==t&&!st(t))return!1;return!0}function at(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{const{isSerializable:t=ot,getEntries:n,ignoredActions:r=[],ignoredActionPaths:o=["meta.arg","meta.baseQueryMeta"],ignoredPaths:i=[],warnAfter:s=32,ignoreState:a=!1,ignoreActions:c=!1,disableCache:l=!1}=e,u=!l&&WeakSet?new WeakSet:void 0;return e=>s=>l=>{if(!function(e){return X(e)&&"type"in e&&"string"==typeof e.type}(l))return s(l);const d=s(l),p=Je();return c||r.length&&-1!==r.indexOf(l.type)||p.measureTime(()=>{const e=it(l,"",t,n,o,u);if(e){const{keyPath:t,value:n}=e}}),a||(p.measureTime(()=>{const r=it(e.getState(),"",t,n,i,u);if(r){const{keyPath:e,value:t}=r}}),p.warnIfExceeded()),d}}}function ct(e){return"boolean"==typeof e}var lt=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:o=!0}=e??{};let i=new Ze;if(t&&(ct(t)?i.push(Ye):i.push(Xe(t.extraArgument))),"production"!==process.env.NODE_ENV){if(n){let e={};ct(n)||(e=n),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{let t=function(e,t,r,o){return JSON.stringify(e,n(t,o),r)},n=function(e,t){let n=[],r=[];return t||(t=function(e,t){return n[0]===t?"[Circular ~]":"[Circular ~."+r.slice(0,n.indexOf(t)).join(".")+"]"}),function(o,i){if(n.length>0){var s=n.indexOf(this);~s?n.splice(s+1):n.push(this),~s?r.splice(s,1/0,o):r.push(o),~n.indexOf(i)&&(i=t.call(this,o,i))}else n.push(i);return null==e?i:e.call(this,o,i)}},{isImmutable:r=et,ignoredPaths:o,warnAfter:i=32}=e;const s=tt.bind(null,r,o);return({getState:e})=>{let n,r=e(),o=s(r);return i=>a=>{const c=Je();c.measureTime(()=>{if(r=e(),n=o.detectMutations(),o=s(r),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?ft(19):`A state mutation was detected between dispatches, in the path '${n.path||""}'. This may cause incorrect behavior. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`)});const l=i(a);return c.measureTime(()=>{if(r=e(),n=o.detectMutations(),o=s(r),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?ft(20):`A state mutation was detected inside a dispatch, in the path: ${n.path||""}. Take a look at the reducer(s) handling the action ${t(a)}. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`)}),c.warnIfExceeded(),l}}}}(e))}if(r){let e={};ct(r)||(e=r),i.push(at(e))}if(o){let e={};ct(o)||(e=o),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);const{isActionCreator:t=Ge}=e;return()=>e=>n=>(t(n),e(n))}(e))}}return i},ut=e=>t=>{setTimeout(t,e)},dt=e=>function(t){const{autoBatch:n=!0}=t??{};let r=new Ze(e);return n&&r.push(((e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let o=!0,i=!1,s=!1;const a=new Set,c="tick"===e.type?queueMicrotask:"raf"===e.type?"undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:ut(10):"callback"===e.type?e.queueNotification:ut(e.timeout),l=()=>{s=!1,i&&(i=!1,a.forEach(e=>e()))};return Object.assign({},r,{subscribe(e){const t=r.subscribe(()=>o&&e());return a.add(e),()=>{t(),a.delete(e)}},dispatch(e){try{return o=!e?.meta?.RTK_autoBatch,i=!o,i&&(s||(s=!0,c(l))),r.dispatch(e)}finally{o=!0}}})})("object"==typeof n?n:void 0)),r};function pt(e){const t=lt(),{reducer:n,middleware:r,devTools:o=!0,duplicateMiddlewareCheck:i=!0,preloadedState:s,enhancers:a}=e||{};let c,l;if("function"==typeof n)c=n;else{if(!X(n))throw new Error("production"===process.env.NODE_ENV?ft(1):"`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");c=ee(n)}if("production"!==process.env.NODE_ENV&&r&&"function"!=typeof r)throw new Error("production"===process.env.NODE_ENV?ft(2):"`middleware` field must be a callback");if("function"==typeof r){if(l=r(t),"production"!==process.env.NODE_ENV&&!Array.isArray(l))throw new Error("production"===process.env.NODE_ENV?ft(3):"when using a middleware builder function, an array of middleware must be returned")}else l=t();if("production"!==process.env.NODE_ENV&&l.some(e=>"function"!=typeof e))throw new Error("production"===process.env.NODE_ENV?ft(4):"each middleware provided to configureStore must be a function");if("production"!==process.env.NODE_ENV&&i){let e=new Set;l.forEach(t=>{if(e.has(t))throw new Error("production"===process.env.NODE_ENV?ft(42):"Duplicate middleware references found when creating the store. Ensure that each middleware is only included once.");e.add(t)})}let u=te;o&&(u=Qe({trace:"production"!==process.env.NODE_ENV,..."object"==typeof o&&o}));const d=function(...e){return t=>(n,r)=>{const o=t(n,r);let i=()=>{throw new Error("production"===process.env.NODE_ENV?$(15):"Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")};const s={getState:o.getState,dispatch:(e,...t)=>i(e,...t)},a=e.map(e=>e(s));return i=te(...a)(o.dispatch),{...o,dispatch:i}}}(...l),p=dt(d);if("production"!==process.env.NODE_ENV&&a&&"function"!=typeof a)throw new Error("production"===process.env.NODE_ENV?ft(5):"`enhancers` field must be a callback");let f="function"==typeof a?a(p):p();if("production"!==process.env.NODE_ENV&&!Array.isArray(f))throw new Error("production"===process.env.NODE_ENV?ft(6):"`enhancers` callback must return an array");if("production"!==process.env.NODE_ENV&&f.some(e=>"function"!=typeof e))throw new Error("production"===process.env.NODE_ENV?ft(7):"each enhancer provided to configureStore must be a function");"production"!==process.env.NODE_ENV&&l.length&&f.includes(d);return J(c,s,u(...f))}function ft(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}We(!1);var ht=i.createContext(void 0),mt=function(e){var t=e.children,n=N.useState(function(e){return e.snackbar});return r.jsxs(ht.Provider,{value:{showSnackbar:function(e,t){void 0===t&&(t="info"),N.update(function(n){n.snackbar.open=!0,n.snackbar.message=e,n.snackbar.severity=t})}},children:[t,r.jsx(o.Snackbar,{open:n.open,message:n.message,severity:n.severity,autoHideDuration:1500,onClose:function(){N.update(function(e){e.snackbar.open=!1})}})]})},vt={isOpen:!1,title:"",message:"",confirmButtonText:"",cancelButtonText:"",type:"confirm",onConfirm:function(){},onCancel:function(){}},bt=[{label:"All",value:null},{label:"REGULAR",value:"R"},{label:"SUPPLEMENTARY",value:"S"}],yt=[{label:"Tuition Fee",value:"tuition_fee"},{label:"Admission Fee",value:"admission_fee"},{label:"Hostel Fee",value:"hostel_fee"},{label:"Transport Fee",value:"transport_fee"},{label:"Exam Fee",value:"exam_fee"},{label:"Other Fee",value:"other_fee"}],gt=Array.from({length:6},function(e,t){return(new Date).getFullYear()-t});Array.from({length:12},function(e,t){return{label:"".concat((new Date).getFullYear()-t," - ").concat((new Date).getFullYear()-t+1),value:"".concat((new Date).getFullYear()-t," - ").concat((new Date).getFullYear()-t+1)}});var xt=function(){function e(){var e=this;this.exotelSDK=null,this.webPhone=null,this.callListeners=new Set,this.registerListeners=new Set,this.sessionListeners=new Set,this.permissionStatus="unknown",this.handleCallEvent=function(t,n){e.callListeners.forEach(function(e){return e(t,n)})},this.handleRegisterEvent=function(t){e.registerListeners.forEach(function(e){return e(t)})},this.handleSessionEvent=function(t,n){e.sessionListeners.forEach(function(e){return e(t,n)})}}return e.getInstance=function(){return e.instance||(e.instance=new e),e.instance},e.prototype.initialize=function(e,t){return w(this,arguments,void 0,function(e,t,n){var r;return void 0===n&&(n=!0),E(this,function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),[4,this.checkAudioPermissions()];case 1:return o.sent(),this.exotelSDK=new f(e,t,n),[4,this.exotelSDK.Initialize(this.handleCallEvent,this.handleRegisterEvent,this.handleSessionEvent)];case 2:return r=o.sent(),this.webPhone=r||null,[2,!!this.webPhone];case 3:return o.sent(),[2,!1];case 4:return[2]}})})},e.prototype.checkAudioPermissions=function(){return w(this,void 0,void 0,function(){var e,t,n=this;return E(this,function(r){switch(r.label){case 0:return r.trys.push([0,6,,7]),[4,navigator.mediaDevices.enumerateDevices()];case 1:if(e=r.sent(),!e.some(function(e){return"audioinput"===e.kind}))return this.permissionStatus="denied",[2,!1];if(!navigator.permissions||!navigator.permissions.query)return[3,5];r.label=2;case 2:return r.trys.push([2,4,,5]),[4,navigator.permissions.query({name:"microphone"})];case 3:return t=r.sent(),this.permissionStatus=t.state,t.onchange=function(){n.permissionStatus=t.state},[2,"granted"===t.state];case 4:return r.sent(),[3,5];case 5:return[2,!0];case 6:return r.sent(),[2,!1];case 7:return[2]}})})},e.prototype.requestMicrophoneAccess=function(){return w(this,void 0,void 0,function(){return E(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,navigator.mediaDevices.getUserMedia({audio:!0})];case 1:return e.sent().getTracks().forEach(function(e){return e.stop()}),this.permissionStatus="granted",[2,!0];case 2:return e.sent(),this.permissionStatus="denied",[2,!1];case 3:return[2]}})})},e.prototype.makeCall=function(e){var t=this;return new Promise(function(n,r){t.webPhone?t.webPhone.MakeCall(e,function(e,t){"success"===e?n(t):r(t)}):r(new Error("Web phone not initialized"))})},e.prototype.acceptCall=function(){return w(this,void 0,void 0,function(){return E(this,function(e){switch(e.label){case 0:if(!this.webPhone)throw new Error("Web phone not initialized");return"granted"===this.permissionStatus?[3,2]:[4,this.requestMicrophoneAccess()];case 1:if(!e.sent())throw new Error("Microphone access denied");e.label=2;case 2:return this.webPhone.AcceptCall(),[2]}})})},e.prototype.hangupCall=function(){var e;null===(e=this.webPhone)||void 0===e||e.HangupCall()},e.prototype.rejectCall=function(){var e;null===(e=this.webPhone)||void 0===e||e.HangupCall()},e.prototype.toggleHold=function(){var e;null===(e=this.webPhone)||void 0===e||e.ToggleHold()},e.prototype.toggleMute=function(){var e;null===(e=this.webPhone)||void 0===e||e.ToggleMute()},e.prototype.sendDTMF=function(e){var t;null===(t=this.webPhone)||void 0===t||t.SendDTMF(e)},e.prototype.registerDevice=function(){return w(this,void 0,void 0,function(){var e;return E(this,function(t){switch(t.label){case 0:return"granted"===this.permissionStatus?[3,2]:[4,this.requestMicrophoneAccess()];case 1:if(!t.sent())throw new Error("Microphone access denied");t.label=2;case 2:return null===(e=this.webPhone)||void 0===e||e.RegisterDevice(),[2]}})})},e.prototype.unregisterDevice=function(){var e;null===(e=this.webPhone)||void 0===e||e.UnRegisterDevice()},e.prototype.getPermissionStatus=function(){return this.permissionStatus},e.prototype.addCallListener=function(e){this.callListeners.add(e)},e.prototype.removeCallListener=function(e){this.callListeners.delete(e)},e.prototype.addRegisterListener=function(e){this.registerListeners.add(e)},e.prototype.removeRegisterListener=function(e){this.registerListeners.delete(e)},e.prototype.addSessionListener=function(e){this.sessionListeners.add(e)},e.prototype.removeSessionListener=function(e){this.sessionListeners.delete(e)},e}(),wt=function(){return w(void 0,void 0,void 0,function(){var e,t,n,r,o,i;return E(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,P.get("/notifications/notification-configs")];case 1:return e=s.sent().data,(null==(t=null==e?void 0:e.config)?void 0:t.enableVoice)?(n=null===(r=t.voiceConfigs)||void 0===r?void 0:r.find(function(e){return!0===e.isEnabled}))?[2,{enabled:!0,hasValidToken:!!((null===(o=n.EXOTEL)||void 0===o?void 0:o.token)&&(null===(i=n.EXOTEL)||void 0===i?void 0:i.tokenExpiresAt)&&new Date(n.EXOTEL.tokenExpiresAt)>new Date)}]:[2,{enabled:!1,hasValidToken:!1}]:[2,{enabled:!1,hasValidToken:!1}];case 2:return s.sent(),[2,{enabled:!1,hasValidToken:!1}];case 3:return[2]}})})},Et=function(){return w(void 0,void 0,void 0,function(){return E(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,P.get("/notifications/notification-configs/voice-config/active-token")];case 1:return[2,e.sent().data];case 2:return e.sent(),[2,null];case 3:return[2]}})})},St=function(e){return w(void 0,void 0,void 0,function(){return E(this,function(t){switch(t.label){case 0:return[4,P.post("/communication-activities/initiate",e)];case 1:return[2,t.sent().data]}})})},Nt=function(e){return w(void 0,void 0,void 0,function(){return E(this,function(t){switch(t.label){case 0:return[4,P.post("/communication-activities/register-incoming",e)];case 1:return[2,t.sent().data]}})})},_t=function(e){return w(void 0,void 0,void 0,function(){var t;return E(this,function(n){switch(n.label){case 0:return t={callStatusDisposition:e.callStatusDisposition,dispositionCategory:e.dispositionCategory,prospectStatus:e.prospectStatus,dispositionNotes:e.dispositionNotes,callbackScheduledAt:e.callbackScheduledAt},[4,P.post("/communication-activities/".concat(e.callId,"/disposition"),t)];case 1:return[2,n.sent().data]}})})},jt=function(e){return w(void 0,void 0,void 0,function(){return E(this,function(t){switch(t.label){case 0:return[4,P.post("/communication-activities/cancel",e)];case 1:return[2,t.sent().data]}})})},kt="__EXOTEL_CONTEXT__",Ct={phase:"idle",callData:null,isOnHold:!1,isMuted:!1,isSpeakerOff:!1,callDirection:null,callStartTime:null,callDuration:0,callerName:null,callerNumber:null,callActivityId:null,exotelCallSid:null,prospectUniqueId:null,wasAccepted:!1},Ot=function(e){if(!e||e.length<4)return"**********";var t="",n=e;e.startsWith("+91")?(t="+91",n=e.substring(3)):e.startsWith("91")&&e.length>10&&(t="91",n=e.substring(2));var r=n.replace(/\D/g,"");return r.length<4?t+"**********":t+r.substring(0,2)+"*".repeat(r.length-4)+r.substring(r.length-2)},Pt=(window[kt]||(window[kt]=i.createContext(void 0)),window[kt]),Dt=function(e){var t=e.children,n=e.accessToken,o=e.agentUserId,s=e.autoConnectVOIP,a=void 0===s||s,c=e.callerName;e.callerNumber;var l=i.useState(!1),u=l[0],d=l[1],p=i.useState(!1),f=p[0],h=p[1],m=i.useState("unknown"),v=m[0],b=m[1],y=i.useState(Ct),g=y[0],S=y[1],N=i.useState(null),_=N[0],j=N[1],k=i.useRef(null),C=i.useRef(g),O=xt.getInstance();i.useEffect(function(){C.current=g},[g]),i.useEffect(function(){return"connected"===g.phase&&g.callStartTime?k.current=setInterval(function(){S(function(e){return x(x({},e),{callDuration:Math.floor((Date.now()-e.callStartTime)/1e3)})})},1e3):k.current&&(clearInterval(k.current),k.current=null),function(){k.current&&clearInterval(k.current)}},[g.phase,g.callStartTime]),i.useEffect(function(){var e=function(){return w(void 0,void 0,void 0,function(){return E(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,navigator.mediaDevices.getUserMedia({audio:!0})];case 1:return e.sent().getTracks().forEach(function(e){return e.stop()}),b("granted"),[3,3];case 2:return e.sent(),b("denied"),[3,3];case 3:return[2]}})})};navigator.permissions&&navigator.permissions.query?navigator.permissions.query({name:"microphone"}).then(function(t){b(t.state),t.onchange=function(){b(t.state)},"prompt"===t.state&&e()}).catch(function(t){e()}):e()},[]),i.useEffect(function(){if(n&&o&&!u){w(void 0,void 0,void 0,function(){var e;return E(this,function(t){switch(t.label){case 0:return[4,O.initialize(n,o,a)];case 1:return e=t.sent(),d(e),[2]}})})}},[n,o,a]),i.useEffect(function(){if(u){var e=function(e,t){switch(e){case"incoming":if("outbound"===C.current.callDirection)S(function(e){return x(x({},e),{callData:t,isOnHold:!1,isMuted:!1})});else{var n=t.callFromNumber||t.remoteId||null;S(function(e){return x(x({},e),{phase:"incoming",callData:t,callDirection:"inbound",callerName:t.remoteDisplayName||null,callerNumber:n?Ot(n):null,isOnHold:!1,isMuted:!1})}),(t.callId||t.sessionId)&&Nt({callSid:t.callId||t.sessionId,fromNumber:t.callFromNumber||t.remoteId||"",toNumber:t.remoteDisplayName||""}).then(function(e){var t,n=null===(t=e.prospect)||void 0===t?void 0:t.mobile;S(function(t){var r,o,i;return x(x({},t),{callActivityId:(null===(r=e.data)||void 0===r?void 0:r.id)||t.callActivityId,callerName:(null===(o=e.prospect)||void 0===o?void 0:o.name)||t.callerName,callerNumber:n?Ot(n):t.callerNumber,prospectUniqueId:(null===(i=e.prospect)||void 0===i?void 0:i.uniqueId)||t.prospectUniqueId})})}).catch(function(e){})}break;case"connected":S(function(e){return x(x({},e),{phase:"connected",callData:t,callStartTime:Date.now(),callDuration:0})});break;case"callEnded":S(function(e){var n,r;if(e.wasAccepted||"connected"===e.phase||e.callDuration>0){var o={callId:e.callActivityId||t.callId||(null===(n=e.callData)||void 0===n?void 0:n.callId)||"",exotelCallId:t.callId||(null===(r=e.callData)||void 0===r?void 0:r.callId)||"",callDirection:e.callDirection||"outbound",callDuration:e.callDuration,callerName:e.callerName,callerNumber:e.callerNumber};j(o)}return x(x({},Ct),{phase:"ended",callData:t})});break;case"holdtoggle":S(function(e){return x(x({},e),{isOnHold:!e.isOnHold,callData:t})});break;case"mutetoggle":S(function(e){return x(x({},e),{isMuted:!e.isMuted,callData:t})})}},t=function(e){h("registered"===e)},n=function(e,t){};return O.addCallListener(e),O.addRegisterListener(t),O.addSessionListener(n),function(){O.removeCallListener(e),O.removeRegisterListener(t),O.removeSessionListener(n)}}},[u]),i.useEffect(function(){u&&b(O.getPermissionStatus())},[u]);var P=i.useCallback(function(e,t,n,r){return w(void 0,void 0,void 0,function(){var o;return E(this,function(i){switch(i.label){case 0:S(function(o){return x(x({},o),{phase:"ready_to_call",callDirection:"outbound",callerName:t||c||null,callerNumber:r||e,callActivityId:n||null,isOnHold:!1,isMuted:!1,callStartTime:null,callDuration:0})}),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,O.makeCall(e)];case 2:return[2,i.sent()];case 3:throw o=i.sent(),S(Ct),o;case 4:return[2]}})})},[c]),D=i.useCallback(function(){return w(void 0,void 0,void 0,function(){return E(this,function(e){switch(e.label){case 0:return[4,O.acceptCall()];case 1:return e.sent(),S(function(e){return"outbound"===e.callDirection?x(x({},e),{phase:"calling",wasAccepted:!0}):x(x({},e),{wasAccepted:!0})}),[2]}})})},[]),I=i.useCallback(function(){O.hangupCall()},[]),A=i.useCallback(function(){S(function(e){return x(x({},e),{isSpeakerOff:!e.isSpeakerOff})})},[]),T=i.useCallback(function(){j(null),S(Ct)},[]),V=i.useCallback(function(e){S(function(t){return x(x({},t),{callActivityId:e})})},[]),M=i.useCallback(function(e){S(function(t){return x(x({},t),{exotelCallSid:e})})},[]),L={isInitialized:u,isConnected:f,callState:g,permissionStatus:v,dispositionData:_,makeCall:P,acceptCall:D,hangupCall:I,rejectCall:function(){return O.rejectCall()},toggleHold:function(){return O.toggleHold()},toggleMute:function(){return O.toggleMute()},toggleSpeaker:A,sendDTMF:function(e){return O.sendDTMF(e)},registerDevice:function(){return O.registerDevice()},unregisterDevice:function(){return O.unregisterDevice()},requestMicrophoneAccess:function(){return O.requestMicrophoneAccess()},clearDisposition:T,setCallActivityId:V,setExotelCallSid:M};return r.jsx(Pt.Provider,{value:L,children:t})},It=function(){var e=i.useContext(Pt);if(void 0===e)throw new Error("useExotel must be used within an ExotelProvider");return e},At=function(){var e=i.useContext(Pt);return null!=e?e:null},Tt=999999,Vt=999998,Mt="16px",Lt=2e3,Rt=[{label:"Connected",value:"connected"},{label:"Not Connected",value:"not_connected"}],Ft=[{label:"Interested",value:"interested"},{label:"Not Interested",value:"not_interested"},{label:"Not Sure",value:"not_sure"},{label:"Not Eligible",value:"not_eligible"},{label:"Wrong Number",value:"wrong_number"},{label:"Campus Visit",value:"campus_visit"},{label:"Call Back",value:"call_back"},{label:"After JEE Mains",value:"after_jee_mains"},{label:"After IPE",value:"after_ipe"},{label:"After EAPCET",value:"after_eapcet"}],Kt=[{label:"Not Answering",value:"not_answering"},{label:"Not Connected",value:"not_connected"},{label:"Fail to Call",value:"fail_to_call"}],qt=function(e){var t=e.dispositionData,n=e.prospectId,a=e.onClose,c=e.onSave,l=e.existingData,u=s.useQueryClient(),d=!!(null==l?void 0:l.dispositionCategory),p=i.useState((null==l?void 0:l.callStatusDisposition)||""),f=p[0],h=p[1],m=i.useState((null==l?void 0:l.dispositionCategory)||""),v=m[0],b=m[1],y=i.useState((null==l?void 0:l.dispositionNotes)||""),g=y[0],x=y[1],w=s.useMutation(function(e){return c(e)},{onSuccess:function(){u.invalidateQueries("getOneProspect"),u.invalidateQueries("callHistory"),a()}}),E=w.mutate,S=w.isLoading,N=function(e){h(e),b("")},_=function(e){b(e)},j=function(){if(f&&v){var e={prospectId:n,callId:t.callId,channel:"phone",direction:t.callDirection,duration:t.callDuration,callStatusDisposition:f,dispositionCategory:v,remarks:g||"",callerName:t.callerName||"",callerNumber:t.callerNumber||""};E(e)}},k="connected"===f?Ft:"not_connected"===f?Kt:[];return r.jsx(o.Dialog,{open:!0,onClose:a,title:d?"Edit Disposition":"Call Disposition",maxWidth:"md",content:function(){return r.jsxs("div",{className:"flex flex-col gap-4 p-4",children:[r.jsx(o.Typography,{variant:"muted",children:d?"Update the disposition details":"Add details about your call with ".concat(t.callerName||"Unknown")}),r.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-100 rounded-lg",children:[r.jsx(o.Typography,{variant:"small",className:"text-gray-600",children:"Call Duration"}),r.jsx(o.Typography,{variant:"small",className:"font-semibold",children:(e=t.callDuration,n=Math.floor(e/60),i=e%60,"".concat(n,"m ").concat(i,"s"))})]}),r.jsx(o.RadioGroup,{name:"callStatusDisposition",label:"Call Status",required:!0,options:Rt,direction:"row",value:f,onChange:N}),f&&r.jsx(o.SingleSelect,{name:"dispositionCategory",label:"Call Disposition",required:!0,fullWidth:!0,placeholder:"Search disposition...",options:k,value:v,onChange:_},f),r.jsx(o.Textarea,{name:"remarks",label:"Remarks",placeholder:"Add any additional notes about this call...",rows:3,fullWidth:!0,value:g,onChange:function(e){return x(e.target.value)},className:"break-all"}),r.jsxs("div",{className:"flex justify-start gap-2 pt-4 border-t",children:[r.jsx(o.Button,{onClick:j,disabled:!f||!v,loading:S,children:d?"Update Disposition":"Save Disposition"}),r.jsx(o.Button,{variant:"outline",onClick:a,children:"Cancel"})]})]});var e,n,i}})},Bt=function(e){var t=e.className,n=e.prospectId,s=e.prospectName,a=e.prospectNumber,c=e.onSaveDisposition,l=It(),u=l.callState,d=l.dispositionData,p=l.acceptCall,f=l.hangupCall,v=l.rejectCall,b=l.toggleHold,y=l.toggleMute,g=l.toggleSpeaker,S=l.clearDisposition,N=i.useState(!1),_=N[0],j=N[1],k=i.useState(!1),C=k[0],O=k[1],P=i.useRef(null);i.useEffect(function(){var e="exotel-phone-animations";if(!document.getElementById(e)){var t=document.createElement("style");t.id=e,t.textContent="\n@keyframes pulse-ring {\n 0% {\n transform: scale(1);\n opacity: 1;\n }\n 50% {\n transform: scale(1.15);\n opacity: 0.7;\n }\n 100% {\n transform: scale(1);\n opacity: 1;\n }\n}\n\n@keyframes pulse-dot {\n 0%, 100% {\n box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.7);\n }\n 50% {\n box-shadow: 0 0 0 20px rgba(249, 115, 22, 0);\n }\n}\n\n.animate-pulse-ring {\n animation: pulse-ring 1.5s ease-in-out infinite;\n}\n\n.animate-pulse-dot {\n animation: pulse-dot 1.5s ease-in-out infinite;\n}\n",document.head.appendChild(t)}},[]);var D=u.phase;u.callData;var I=u.isOnHold,A=u.isMuted,T=u.isSpeakerOff,V=u.callDirection,M=u.callDuration,L=u.callerName,R=u.callerNumber,F=u.callActivityId,K=u.exotelCallSid,q=u.prospectUniqueId,B=s||L||"Unknown",z=a||R||"No number",U=function(){return w(void 0,void 0,void 0,function(){var e;return E(this,function(t){switch(t.label){case 0:if(O(!0),"incoming"===D||"ready_to_call"===D?v():f(),!(e=K||F))return[3,4];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,jt({callSid:e,reason:"connected"===D?"ended":"declined"})];case 2:return t.sent(),[3,4];case 3:return t.sent(),[3,4];case 4:return P.current=setTimeout(function(){O(!1)},Lt),[2]}})})};i.useEffect(function(){"idle"!==D&&"ended"!==D||(P.current&&(clearTimeout(P.current),P.current=null),O(!1))},[D]);if(i.useEffect(function(){return function(){P.current&&clearTimeout(P.current)}},[]),d){var $=s||d.callerName||L||"Unknown",W=x(x({},d),{callerName:$,callerNumber:z});return r.jsx(qt,{dispositionData:W,prospectId:n,onClose:S,onSave:function(e){return w(void 0,void 0,void 0,function(){return E(this,function(t){return c?[2,c(e)]:[2,_t({callId:e.callId,prospectId:e.prospectId||n||"",callStatusDisposition:e.callStatusDisposition,dispositionCategory:e.dispositionCategory,dispositionNotes:e.remarks||void 0})]})})},existingData:void 0})}if("idle"===D||"ended"===D)return null;var H,Y,X,Q="outbound"===V,G="inbound"===V,J="connected"===D?"bg-green-500":Q?"bg-blue-500":"bg-orange-500",Z=function(){return"calling"===D?"Connecting to ".concat(B,"..."):null},ee=r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"fixed inset-0 bg-black/50",style:{zIndex:Vt},onClick:U}),r.jsx("div",{className:"fixed inset-0 flex items-center justify-center p-4 ".concat(t),style:{zIndex:Tt},children:r.jsxs("div",{className:"relative w-full max-w-md p-6 bg-white shadow-2xl",style:{borderRadius:Mt,border:"1px solid #e5e7eb"},onClick:function(e){return e.stopPropagation()},children:[r.jsx("button",{onClick:U,className:"absolute p-1 transition-colors rounded-full top-4 right-4 hover:bg-gray-100",children:r.jsx(h.X,{className:"w-5 h-5 text-gray-500"})}),r.jsx("div",{className:"flex justify-center mb-6",children:r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-3 py-1 rounded-full text-sm font-medium border ".concat(Q?"text-blue-600 border-blue-200 bg-blue-50":"text-green-600 border-green-200 bg-green-50"),children:[Q?r.jsx(h.PhoneOutgoing,{className:"w-4 h-4"}):r.jsx(h.PhoneIncoming,{className:"w-4 h-4"}),Q?"Outgoing Call":"Incoming Call"]})}),r.jsx("div",{className:"flex justify-center mb-4",children:r.jsx("div",{className:"w-24 h-24 rounded-full ".concat(J," flex items-center justify-center ").concat("incoming"===D||"ready_to_call"===D?"animate-pulse-ring animate-pulse-dot":""),children:G&&"incoming"===D?r.jsx(h.PhoneIncoming,{className:"w-10 h-10 text-white"}):r.jsx(h.Phone,{className:"w-10 h-10 text-white"})})}),r.jsxs("div",{className:"mb-4 text-center",children:[r.jsx(o.Typography,{variant:"h3",className:"text-xl font-semibold text-gray-900",children:B}),q&&r.jsxs(o.Typography,{variant:"small",className:"font-medium text-blue-600",children:["ID: ",q]}),r.jsx(o.Typography,{variant:"muted",children:z})]}),r.jsx("div",{className:"mb-6 text-center",children:"connected"===D?r.jsx(o.Typography,{variant:"p",className:"text-lg font-medium text-green-500",children:(H=M,Y=Math.floor(H/60),X=H%60,"".concat(Y.toString().padStart(2,"0"),":").concat(X.toString().padStart(2,"0")))}):r.jsx(o.Typography,{variant:"muted",children:function(){switch(D){case"ready_to_call":return"Ready to call...";case"calling":return"Calling...";case"incoming":return"Incoming call...";default:return null}}()})}),"connected"===D&&r.jsxs("div",{className:"flex justify-center gap-6 mb-6",children:[r.jsxs("div",{className:"text-center",children:[r.jsx("button",{onClick:y,className:"w-12 h-12 rounded-full border-2 flex items-center justify-center transition-colors ".concat(A?"bg-gray-200 border-gray-300":"bg-white border-gray-200 hover:bg-gray-50"),children:A?r.jsx(h.MicOff,{className:"w-5 h-5 text-gray-600"}):r.jsx(h.Mic,{className:"w-5 h-5 text-gray-600"})}),r.jsx("p",{className:"mt-1 text-xs text-gray-500",children:A?"Unmute":"Mute"})]}),r.jsxs("div",{className:"text-center",children:[r.jsx("button",{onClick:b,className:"w-12 h-12 rounded-full border-2 flex items-center justify-center transition-colors ".concat(I?"bg-gray-200 border-gray-300":"bg-white border-gray-200 hover:bg-gray-50"),children:I?r.jsx(h.Play,{className:"w-5 h-5 text-gray-600"}):r.jsx(h.Pause,{className:"w-5 h-5 text-gray-600"})}),r.jsx("p",{className:"mt-1 text-xs text-gray-500",children:I?"Resume":"Hold"})]}),r.jsxs("div",{className:"text-center",children:[r.jsx("button",{onClick:g,className:"w-12 h-12 rounded-full border-2 flex items-center justify-center transition-colors ".concat(T?"bg-gray-200 border-gray-300":"bg-white border-gray-200 hover:bg-gray-50"),children:T?r.jsx(h.VolumeX,{className:"w-5 h-5 text-gray-600"}):r.jsx(h.Volume2,{className:"w-5 h-5 text-gray-600"})}),r.jsx("p",{className:"mt-1 text-xs text-gray-500",children:T?"Speaker On":"Speaker Off"})]})]}),r.jsxs("div",{className:"flex justify-center gap-4",children:[("ready_to_call"===D||"incoming"===D)&&r.jsxs(r.Fragment,{children:[r.jsxs(o.Button,{variant:"destructive",onClick:U,disabled:C,className:"gap-2 px-6",children:[r.jsx(h.PhoneOff,{className:"w-4 h-4"}),C?"Declining...":"Decline"]}),r.jsxs(o.Button,{variant:"default",onClick:function(){return w(void 0,void 0,void 0,function(){return E(this,function(e){switch(e.label){case 0:j(!0),e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,p()];case 2:return e.sent(),[3,5];case 3:return e.sent(),[3,5];case 4:return j(!1),[7];case 5:return[2]}})})},disabled:_||C,style:{backgroundColor:"#22c55e"},className:"gap-2 px-6 hover:bg-green-600",children:[r.jsx(h.Phone,{className:"w-4 h-4"}),"Accept"]})]}),"calling"===D&&r.jsxs(o.Button,{variant:"destructive",onClick:U,disabled:C,className:"gap-2 px-6",children:[r.jsx(h.PhoneOff,{className:"w-4 h-4"}),C?"Ending...":"End Call"]}),"connected"===D&&r.jsxs(o.Button,{variant:"destructive",onClick:U,disabled:C,className:"gap-2 px-8",children:[r.jsx(h.PhoneOff,{className:"w-4 h-4"}),C?"Ending...":"End Call"]})]}),Z()&&r.jsx(o.Typography,{variant:"small",className:"mt-4 text-center text-gray-500",children:Z()})]})})]});return m.createPortal(ee,document.body)},zt=function(){function e(){this.algorithm="aes-256-cbc",this.secretKey=null,this.initialized=!1}return e.prototype.ensureInitialized=function(){if(!this.initialized)try{var e="431fef99-47dc-4d2a-9175-2e8f19b20225";if(e){var t=(new TextEncoder).encode(e),n=(new TextEncoder).encode("salt");this.secretKey=v.syncScrypt(t,n,16384,8,1,32)}this.initialized=!0}catch(e){this.initialized=!0}},e.getInstance=function(){return e.instance||(e.instance=new e),e.instance},e.prototype.decryptData=function(e){if(this.ensureInitialized(),!e||!this.secretKey)return"";try{var t=e.split(":"),n=t[0],r=t[1];if(!n||!r)return"";var o=require("crypto"),i=Buffer.from(n,"hex"),s=o.createDecipheriv(this.algorithm,Buffer.from(this.secretKey),i),a=s.update(r,"hex","utf8");return a+=s.final("utf8")}catch(e){return""}},e.prototype.maskMobile=function(e){if(!e||e.length<4)return"**********";var t="",n=e;e.startsWith("+91")?(t="+91",n=e.substring(3)):e.startsWith("91")&&e.length>10&&(t="91",n=e.substring(2));var r=n.replace(/\D/g,"");return r.length<4?t+"**********":t+r.substring(0,2)+"*".repeat(r.length-4)+r.substring(r.length-2)},e}().getInstance();Object.defineProperty(exports,"BrowserRouter",{enumerable:!0,get:function(){return a.BrowserRouter}}),exports.ApplicationStore=N,exports.BatchSelector=function(e){return r.jsx(o.SingleSelect,x({label:"Batch"},e,{externalAxios:D,optionsApiEndPoint:"/dropdowns/batches"}))},exports.CallButton=function(e){var t=e.phoneNumber,n=e.encryptedPhoneNumber,s=e.callerName,a=e.prospectId,c=e.className,l=e.disabled,u=At(),d=i.useState(!1),p=d[0],f=d[1],m=i.useState(null),v=m[0],b=m[1];if(!u)return null;var y=u.makeCall,g=u.isConnected,x=u.callState,S=u.permissionStatus,N=u.requestMicrophoneAccess,_=u.setCallActivityId,j=u.setExotelCallSid,k="idle"!==x.phase&&"ended"!==x.phase,C=t||n,O=l||!C||!g||k||p;return r.jsxs("div",{className:c,children:[r.jsxs(o.Button,{variant:"outline",size:"sm",onClick:function(){return w(void 0,void 0,void 0,function(){var e,r,o,i,c,l,u,d,p,h,m,v,w,S,k;return E(this,function(E){switch(E.label){case 0:if(!g||"idle"!==x.phase&&"ended"!==x.phase)return[2];if(b(null),e=t,n&&!e)try{if(!(e=zt.decryptData(n)))return b("Failed to decrypt phone number"),[2]}catch(e){return b("Failed to decrypt phone number"),[2]}return e?(r=zt.maskMobile(e),[4,xt.getInstance().checkAudioPermissions()]):(b("No phone number available"),[2]);case 1:return E.sent()?[3,3]:[4,N()];case 2:if(!E.sent())return b("Microphone access is required to make calls"),[2];E.label=3;case 3:return E.trys.push([3,9,10,11]),f(!0),[4,y(e,s,void 0,r)];case 4:if(o=E.sent(),(i=null===(v=null==o?void 0:o.Data)||void 0===v?void 0:v.CallSid)&&j(i),!a||!i)return[3,8];E.label=5;case 5:return E.trys.push([5,7,,8]),[4,St({prospectId:a,toNumber:e,callSid:i})];case 6:return c=E.sent(),(l=null===(w=c.data)||void 0===w?void 0:w.id)&&_(l),[3,8];case 7:return E.sent(),[3,8];case 8:return[3,11];case 9:if(u=E.sent(),d="Failed to make call",(null==u?void 0:u.Code)||"Failed"===(null==u?void 0:u.Status)){if(p=u.Code,h=null,u.Error&&"string"==typeof u.Error)try{h=JSON.parse(u.Error)}catch(e){}m=null===(k=null===(S=null==h?void 0:h.response)||void 0===S?void 0:S.error_data)||void 0===k?void 0:k.description,d=404===p?m||"User device is currently busy or unavailable":p>=400&&p<500?m||"Unable to complete call. Please try again.":p>=500?m||"Service temporarily unavailable. Please try again later.":m||"Failed to make call"}else(null==u?void 0:u.message)&&(d=u.message);return b(d),[3,11];case 10:return f(!1),[7];case 11:return[2]}})})},disabled:O,title:g?k?"Call in progress":C?"denied"===S?"Microphone access denied":"Call ".concat(s||"prospect"):"No phone number":"VoIP not connected",className:"gap-1.5",children:["denied"===S?r.jsx(h.MicOff,{className:"w-4 h-4"}):r.jsx(h.Phone,{className:"w-4 h-4"}),p?"Calling...":"Call"]}),v&&r.jsx("p",{className:"text-red-500 text-xs mt-1",children:v})]})},exports.CallDispositionForm=qt,exports.ConfirmDialogProvider=V,exports.CourseSelector=function(e){return r.jsx(o.SingleSelect,x({dbLabelProps:{labelKey:"courseName",subLabelKey:"level"}},e,{externalAxios:D,optionsApiEndPoint:"/dropdowns/courses"}))},exports.DepartmentMongoMultiSelector=function(e){return r.jsx(o.MultiSelect,x({dbLabelProps:{labelKey:"name",subLabelKey:"type",useSubLabelStartCase:!0},dbValueProps:{valueKey:"_id",isObjectId:!0}},e,{externalAxios:D,optionsApiEndPoint:"/dropdowns/departments"}))},exports.DepartmentSelector=function(e){return r.jsx(o.SingleSelect,x({dbLabelProps:{labelKey:"name",subLabelKey:"type",useSubLabelStartCase:!0},dbValueProps:{valueKey:"_id",isObjectId:!0}},e,{externalAxios:D,optionsApiEndPoint:"/dropdowns/departments"}))},exports.DepartmentSqlMultiSelector=function(e){return r.jsx(o.MultiSelect,x({dbLabelProps:{labelKey:"name",subLabelKey:"type",useSubLabelStartCase:!0},dbValueProps:{valueKey:"id",isInt:!0}},e,{externalAxios:D,optionsApiEndPoint:"/dropdowns/departments-sql"}))},exports.EmployeesSelector=function(e){return r.jsx(o.SingleSelect,x({dbValueProps:{valueKey:"_id",isObjectId:!0},dbLabelProps:{labelKey:"fullName",subLabelKey:"employeeId"}},e,{externalAxios:D,optionsApiEndPoint:"/dropdowns/employees"}))},exports.ErrorBoundary=function(e){var t=a.useLocation();return r.jsx(s.QueryErrorResetBoundary,{children:function(n){var o=n.reset;return r.jsx(R,{onReset:o,FallbackComponent:z,children:e.children},null==t?void 0:t.pathname)}})},exports.ExamTypeSelector=function(e){return r.jsx(o.SingleSelect,x({label:"Exam Type",options:bt},e))},exports.ExamsRegulationSelector=function(e){return r.jsx(o.SingleSelect,x({label:"Regulation"},e,{externalAxios:D,optionsApiEndPoint:"/dropdowns/exam-regulations",dbLabelProps:{labelKey:"r.name"},dbValueProps:{valueKey:"r.name"}}))},exports.ExotelPhone=Bt,exports.ExotelProvider=Dt,exports.ExotelWrapper=function(e){var t=e.children,n=e.enabled,o=void 0===n||n,s=e.prospectId,a=e.prospectName,c=e.prospectNumber,l=i.useState(null),u=l[0],d=l[1],p=i.useState(!0);p[0];var f=p[1],h=i.useState(null),m=h[0],v=h[1];return i.useEffect(function(){if(o){w(void 0,void 0,void 0,function(){var e,t;return E(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,3,4]),f(!0),[4,Et()];case 1:return(null==(e=n.sent())?void 0:e.token)?d(e.token):v("Voice calling not configured"),[3,4];case 2:return t=n.sent(),v(t.message||"Failed to initialize calling"),[3,4];case 3:return f(!1),[7];case 4:return[2]}})})}else f(!1)},[o]),o&&!m&&u?r.jsxs(Dt,{accessToken:u,agentUserId:"0047",autoConnectVOIP:!0,children:[t,r.jsx(Bt,{prospectId:s,prospectName:a,prospectNumber:c})]}):r.jsx(r.Fragment,{children:t})},exports.FeeTypeSelector=function(e){return r.jsx(o.SingleSelect,x({label:"Fee Type",options:null==yt?void 0:yt.map(function(e){return{label:e.label,value:e.value}})},e))},exports.HostelBlockSelector=function(e){return r.jsx(o.SingleSelect,x({dbValueProps:{valueKey:"id",isInt:!0},dbLabelProps:{labelKey:"name",subLabelKey:"type",useLabelStartCase:!0,useSubLabelStartCase:!0}},e,{externalAxios:D,optionsApiEndPoint:"/dropdowns/hostel-blocks"}))},exports.HostelFloorSelector=function(e){return r.jsx(o.SingleSelect,x({label:"Hostel Room No.",dbValueProps:{valueKey:"floor"},dbLabelProps:{labelKey:"floor"}},e,{externalAxios:D,optionsApiEndPoint:"dropdowns/floors"}))},exports.HostelRoomSelector=function(e){return r.jsx(o.SingleSelect,x({label:"Hostel Room",dbValueProps:{valueKey:"id"},dbLabelProps:{labelKey:"room_number",useLabelStartCase:!0}},e,{optionsApiEndPoint:"dropdowns/hostel-rooms",externalAxios:D}))},exports.MicrophonePermission=function(e){var t=e.onPermissionGranted,n=e.onPermissionDenied,s=It(),a=s.permissionStatus,c=s.requestMicrophoneAccess,l=i.useState(!1),u=l[0],d=l[1],p=i.useState(null),f=p[0],m=p[1];return"granted"===a?r.jsxs("div",{className:"flex items-center gap-2 text-green-600",children:[r.jsx(h.Mic,{className:"w-4 h-4"}),r.jsx("span",{className:"text-sm",children:"Microphone access granted"})]}):"denied"===a?r.jsxs("div",{className:"p-4 bg-red-50 rounded-lg border border-red-200",children:[r.jsxs("div",{className:"flex items-center gap-2 text-red-600 mb-2",children:[r.jsx(h.MicOff,{className:"w-5 h-5"}),r.jsx("span",{className:"font-medium",children:"Microphone Access Denied"})]}),r.jsx("p",{className:"text-sm text-red-600 mb-3",children:"To use the calling feature, you need to enable microphone access in your browser settings."}),r.jsxs("div",{className:"text-xs text-gray-600",children:[r.jsx("p",{className:"font-medium mb-1",children:"How to enable:"}),r.jsxs("ol",{className:"list-decimal list-inside space-y-1",children:[r.jsx("li",{children:"Click the lock/info icon in your browser's address bar"}),r.jsx("li",{children:'Find "Microphone" in the permissions list'}),r.jsx("li",{children:'Change the setting to "Allow"'}),r.jsx("li",{children:"Refresh the page"})]})]})]}):r.jsxs("div",{className:"p-4 bg-blue-50 rounded-lg border border-blue-200",children:[r.jsxs("div",{className:"flex items-center gap-2 text-blue-600 mb-2",children:[r.jsx(h.AlertCircle,{className:"w-5 h-5"}),r.jsx("span",{className:"font-medium",children:"Microphone Permission Required"})]}),r.jsx("p",{className:"text-sm text-gray-600 mb-3",children:"To make and receive calls, we need access to your microphone. Click the button below to grant permission."}),r.jsxs(o.Button,{variant:"default",size:"sm",onClick:function(){return w(void 0,void 0,void 0,function(){var e;return E(this,function(r){switch(r.label){case 0:d(!0),m(null),r.label=1;case 1:return r.trys.push([1,3,4,5]),[4,c()];case 2:return r.sent()?null==t||t():(m("Microphone access was denied"),null==n||n()),[3,5];case 3:return e=r.sent(),m(e.message||"Failed to request microphone access"),null==n||n(),[3,5];case 4:return d(!1),[7];case 5:return[2]}})})},loading:u,className:"gap-1.5",children:[r.jsx(h.Mic,{className:"w-4 h-4"}),"Allow Microphone Access"]}),f&&r.jsx("p",{className:"text-red-500 text-xs mt-2",children:f})]})},exports.MonthYearSelector=function(e){return r.jsx(o.SingleSelect,x({label:"Month & Year"},e,{externalAxios:D,optionsApiEndPoint:"/dropdowns/month-years"}))},exports.PrintFormatSelector=function(e){return r.jsx(o.SingleSelect,x({dbLabelProps:{labelKey:"name",subLabelKey:"type",useSubLabelStartCase:!0}},e,{externalAxios:D,optionsApiEndPoint:"/dropdowns/print-formats"}))},exports.ProgramSelector=function(e){return r.jsx(o.SingleSelect,x({dbLabelProps:{labelKey:"branchCode",subLabelKey:"branchDisplay"}},e,{externalAxios:D,optionsApiEndPoint:"/dropdowns/programs"}))},exports.Providers=function(e){var t=e.children,n=e.basename,o=e.reducers,c=void 0===o?{}:o,l=new s.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:!1,useErrorBoundary:!0}}}),u=j&&k&&C?"/".concat(k,"/").concat(C):"/";i.useEffect(function(){"/"===window.location.pathname&&k&&C&&j&&window.location.replace(window.location.origin+"/".concat(k,"/").concat(C))},[k,j,C]);var d=pt({reducer:ee(c)});return r.jsx(p.Provider,{store:d,children:r.jsx(a.BrowserRouter,{basename:null!=n?n:u,children:r.jsx(s.QueryClientProvider,{client:l,children:r.jsx(mt,{children:r.jsx(V,{children:t})})})})})},exports.RegulationSelector=function(e){return r.jsx(o.SingleSelect,x({label:"Regulation",dbValueProps:{valueKey:"regulation_id"},dbLabelProps:{labelKey:"r.name"}},e,{optionsApiEndPoint:"dropdowns/regulations",externalAxios:D}))},exports.ResearchExpertDesignationSelector=function(e){return r.jsx(o.SingleSelect,x({dbLabelProps:{labelKey:"name"},dbValueProps:{valueKey:"id",isInt:!0}},e,{externalAxios:D,optionsApiEndPoint:"/dropdowns/research-expert-designations"}))},exports.ResearchExpertSelector=function(e){return r.jsx(o.SingleSelect,x({dbValueProps:{valueKey:"id"},dbLabelProps:{labelKey:"name",subLabelKey:"type"}},e,{optionsApiEndPoint:"dropdowns/research-experts",externalAxios:D}))},exports.ResearchStageSelector=function(e){return r.jsx(o.SingleSelect,x({dbValueProps:{valueKey:"id",isInt:!0},dbLabelProps:{labelKey:"name",subLabelKey:"`order`"}},e,{optionsApiEndPoint:"dropdowns/research-stages",externalAxios:D}))},exports.SemesterSelector=function(e){return r.jsx(o.SingleSelect,x({dbLabelProps:{labelKey:"name",subLabelKey:"year"}},e,{optionsApiEndPoint:"/dropdowns/semesters",externalAxios:D}))},exports.SnackbarProvider=mt,exports.StudentSelector=function(e){return r.jsx(o.SingleSelect,x({dbLabelProps:{labelKey:"slug",useLabelStartCase:!0},dbValueProps:{valueKey:"id"}},e,{externalAxios:D,optionsApiEndPoint:"/dropdowns/students"}))},exports.StudentServicesSelector=function(e){return r.jsx(o.SingleSelect,x({dbLabelProps:{labelKey:"slug",useLabelStartCase:!0},dbValueProps:{valueKey:"id"}},e,{externalAxios:D,optionsApiEndPoint:"/dropdowns/student-services"}))},exports.VOIP_ENABLED_WORKSPACES=I,exports.VoIPProvider=function(e){var t=e.children,n=e.workspace,o=e.agentUserId,s=e.prospectId,a=e.prospectName,c=e.prospectNumber,l=e.onSaveDisposition,u=i.useState(null),d=u[0],p=u[1],f=i.useState(!0),h=f[0],m=f[1],v=i.useState(null),b=v[0],y=v[1],g=A(n),x=!!o,S=i.useCallback(function(e){return w(void 0,void 0,void 0,function(){return E(this,function(t){return l?[2,l(e)]:[2,_t({callId:e.callId,prospectId:e.prospectId,callStatusDisposition:e.callStatusDisposition,dispositionCategory:e.dispositionCategory,dispositionReason:e.dispositionReason||void 0,dispositionNotes:e.remarks||void 0})]})})},[l]);return i.useEffect(function(){if(g&&x){w(void 0,void 0,void 0,function(){var e,t;return E(this,function(n){switch(n.label){case 0:return n.trys.push([0,3,4,5]),m(!0),y(null),[4,wt()];case 1:return n.sent().enabled?[4,Et()]:(y("Voice calling not enabled for this tenant"),m(!1),[2]);case 2:return(null==(e=n.sent())?void 0:e.token)?p(e.token):y("Voice calling token not available"),[3,5];case 3:return t=n.sent(),y(t.message||"Failed to initialize calling"),[3,5];case 4:return m(!1),[7];case 5:return[2]}})})}else m(!1)},[g,x]),g&&x?h||b||!d?r.jsx(r.Fragment,{children:t}):r.jsxs(Dt,{accessToken:d,agentUserId:o,autoConnectVOIP:!0,children:[t,r.jsx(Bt,{prospectId:s,prospectName:a,prospectNumber:c,onSaveDisposition:S})]}):r.jsx(r.Fragment,{children:t})},exports.YearRangeSelector=function(e){var t=e.suffix,n=void 0===t?null:t,i=e.valueKey,s=void 0===i?"yearRange":i,a=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["suffix","valueKey"]);return r.jsx(o.SingleSelect,x({label:"Year Range",options:null==gt?void 0:gt.map(function(e){return{label:n?"".concat(n," ").concat(e," - ").concat(e+1):"".concat(e," - ").concat(e+1),value:"yearRange"===s?"".concat(e," - ").concat(e+1):e}})},a))},exports.axios=P,exports.cancelCall=jt,exports.checkVoIPEnabled=wt,exports.createExotelAppToken=function(){return w(void 0,void 0,void 0,function(){var e;return E(this,function(t){switch(t.label){case 0:return[4,Et()];case 1:if(!(e=t.sent()))throw new Error("No active voice configuration found");return[2,{Data:e.token}]}})})},exports.createRsbuildSharedConfig=function(e,t,n){return n.reduce(function(n,r){var o=e[r];return o&&(n[r]=x({singleton:!0,requiredVersion:o,version:o.replace(/^[\^~]/,"")},t.includes(r)?{eager:!0}:{})),n},{})},exports.fetchCallHistory=function(e){return w(void 0,void 0,void 0,function(){return E(this,function(t){switch(t.label){case 0:return[4,P.get("/communication-activities/by-prospect",{params:{prospectId:e}})];case 1:return[2,t.sent().data]}})})},exports.getActiveVoiceToken=Et,exports.getCallActivityByCallSid=function(e){return w(void 0,void 0,void 0,function(){return E(this,function(t){switch(t.label){case 0:return[4,P.get("/communication-activities/by-call-sid",{params:{callSid:e}})];case 1:return[2,t.sent().data]}})})},exports.getCallActivityById=function(e){return w(void 0,void 0,void 0,function(){return E(this,function(t){switch(t.label){case 0:return[4,P.get("/communication-activities/".concat(e))];case 1:return[2,t.sent().data]}})})},exports.getCallCountByProspect=function(e){return w(void 0,void 0,void 0,function(){var t;return E(this,function(n){switch(n.label){case 0:return[4,P.get("/communication-activities/count-by-prospect",{params:{prospectId:e}})];case 1:return[2,(null==(t=n.sent().data)?void 0:t.count)||0]}})})},exports.initialApplicationState=S,exports.initiateCallActivity=St,exports.institutionCode=k,exports.isDevelopment=_,exports.isVoIPEnabledForWorkspace=A,exports.nonWorkspaceAxios=D,exports.openInNewTab=function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!1);var r=window.location.pathname.split("/"),o=[];!t&&r[1]&&o.push(r[1]),!n&&r[2]&&o.push(r[2]);var i=o.length>0?"/"+o.join("/"):"",s="".concat(window.location.origin).concat(i,"/").concat(e);window.open(s,"_blank")},exports.registerIncomingCall=Nt,exports.saveCallDisposition=_t,exports.tenantCode=j,exports.useConfirm=function(){var e=function(){N.update(function(e){e.confirmDialog=vt})};return function(t){var n=t.title,r=t.message,o=t.confirmButtonText,i=t.cancelButtonText,s=t.type,a=void 0===s?"confirm":s;return new Promise(function(t){N.update(function(s){s.confirmDialog={isOpen:!0,title:n,message:r,confirmButtonText:o,cancelButtonText:i,type:a,onConfirm:function(){t(!0),e()},onCancel:function(){t(!1),e()}}})})}},exports.useExotel=It,exports.useExotelSafe=At,exports.workspace=C,exports.workspaceApiMapping=O;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DispositionFormData } from './CallDispositionForm';
|
|
2
2
|
interface ExotelPhoneProps {
|
|
3
3
|
className?: string;
|
|
4
4
|
prospectId?: string;
|
|
@@ -6,5 +6,5 @@ interface ExotelPhoneProps {
|
|
|
6
6
|
prospectNumber?: string;
|
|
7
7
|
onSaveDisposition?: (data: DispositionFormData) => Promise<any>;
|
|
8
8
|
}
|
|
9
|
-
declare const ExotelPhone: ({ className, prospectId, prospectName, prospectNumber, onSaveDisposition }: ExotelPhoneProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
declare const ExotelPhone: ({ className, prospectId, prospectName, prospectNumber, onSaveDisposition, }: ExotelPhoneProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
export default ExotelPhone;
|
|
@@ -84,6 +84,7 @@ export interface SaveDispositionInput {
|
|
|
84
84
|
prospectId?: string;
|
|
85
85
|
callStatusDisposition?: 'connected' | 'not_connected';
|
|
86
86
|
dispositionCategory: string;
|
|
87
|
+
prospectStatus?: string;
|
|
87
88
|
dispositionReason?: string;
|
|
88
89
|
dispositionNotes?: string;
|
|
89
90
|
callbackScheduledAt?: string;
|