@chatwoot/agent-react-components 4.2.1-1750146809.1b31b8b93c → 4.2.1-1750241647.1b31b8b93c
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/index.cjs +2 -2
- package/index.js +4 -4
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -183,13 +183,13 @@ Here are the main features of the integration:
|
|
|
183
183
|
**Associate an agent profile:** If the person who replied on Slack has an agent profile in Chatwoot under the same email, the replies will be associated with that agent profile automatically. This means you can easily track who said what and when. On the other hand, when the replier doesn't have an associated agent profile, the replies will appear from the bot profile to the customer.`,SELECTED:"selected"},SELECT_CHANNEL:{OPTION_LABEL:"Select a channel",UPDATE:"Update",BUTTON_TEXT:"Connect channel",DESCRIPTION:`Your Slack workspace is now linked with Chatwoot. However, the integration is currently inactive. To activate the integration and connect a channel to Chatwoot, please click the button below.
|
|
184
184
|
|
|
185
185
|
**Note:** If you are attempting to connect a private channel, add the Chatwoot app to the Slack channel before proceeding with this step.`,ATTENTION_REQUIRED:"Attention required",EXPIRED:"Your Slack integration has expired. To continue receiving messages on Slack, please delete the integration and connect your workspace again."},UPDATE_ERROR:"There was an error updating the integration, please try again",UPDATE_SUCCESS:"The channel is connected successfully",FAILED_TO_FETCH_CHANNELS:"There was an error fetching the channels from Slack, please try again"},DYTE:{CLICK_HERE_TO_JOIN:"Click here to join",LEAVE_THE_ROOM:"Leave the room",START_VIDEO_CALL_HELP_TEXT:"Start a new video call with the customer",JOIN_ERROR:"There was an error joining the call, please try again",CREATE_ERROR:"There was an error creating a meeting link, please try again"},OPEN_AI:{AI_ASSIST:"AI Assist",WITH_AI:" {option} with AI ",OPTIONS:{REPLY_SUGGESTION:"Reply Suggestion",SUMMARIZE:"Summarize",REPHRASE:"Improve Writing",FIX_SPELLING_GRAMMAR:"Fix Spelling and Grammar",SHORTEN:"Shorten",EXPAND:"Expand",MAKE_FRIENDLY:"Change message tone to friendly",MAKE_FORMAL:"Use formal tone",SIMPLIFY:"Simplify"},ASSISTANCE_MODAL:{DRAFT_TITLE:"Draft content",GENERATED_TITLE:"Generated content",AI_WRITING:"AI is writing",BUTTONS:{APPLY:"Use this suggestion",CANCEL:"Cancel"}},CTA_MODAL:{TITLE:"Integrate with OpenAI",DESC:"Bring advanced AI features to your dashboard with OpenAI's GPT models. To begin, enter the API key from your OpenAI account.",KEY_PLACEHOLDER:"Enter your OpenAI API key",BUTTONS:{NEED_HELP:"Need help?",DISMISS:"Dismiss",FINISH:"Finish Setup"},DISMISS_MESSAGE:"You can setup OpenAI integration later Whenever you want.",SUCCESS_MESSAGE:"OpenAI integration setup successfully"},TITLE:"Improve With AI",SUMMARY_TITLE:"Summary with AI",REPLY_TITLE:"Reply suggestion with AI",SUBTITLE:"An improved reply will be generated using AI, based on your current draft.",TONE:{TITLE:"Tone",OPTIONS:{PROFESSIONAL:"Professional",FRIENDLY:"Friendly"}},BUTTONS:{GENERATE:"Generate",GENERATING:"Generating...",CANCEL:"Cancel"},GENERATE_ERROR:"There was an error processing the content, please verify your OpenAI API key and try again"},DELETE:{BUTTON_TEXT:"Delete",API:{SUCCESS_MESSAGE:"Integration deleted successfully"}},CONNECT:{BUTTON_TEXT:"Connect"},DASHBOARD_APPS:{TITLE:"Dashboard Apps",HEADER_BTN_TXT:"Add a new dashboard app",SIDEBAR_TXT:"<p><b>Dashboard Apps</b></p><p>Dashboard Apps allow organizations to embed an application inside the Chatwoot dashboard to provide the context for customer support agents. This feature allows you to create an application independently and embed that inside the dashboard to provide user information, their orders, or their previous payment history.</p><p>When you embed your application using the dashboard in Chatwoot, your application will get the context of the conversation and contact as a window event. Implement a listener for the message event on your page to receive the context.</p><p>To add a new dashboard app, click on the button 'Add a new dashboard app'.</p>",DESCRIPTION:"Dashboard Apps allow organizations to embed an application inside the dashboard to provide the context for customer support agents. This feature allows you to create an application independently and embed that to provide user information, their orders, or their previous payment history.",LEARN_MORE:"Learn more about Dashboard Apps",LIST:{404:"There are no dashboard apps configured on this account yet",LOADING:"Fetching dashboard apps...",TABLE_HEADER:{NAME:"Name",ENDPOINT:"Endpoint"},EDIT_TOOLTIP:"Edit app",DELETE_TOOLTIP:"Delete app"},FORM:{TITLE_LABEL:"Name",TITLE_PLACEHOLDER:"Enter a name for your dashboard app",TITLE_ERROR:"A name for the dashboard app is required",URL_LABEL:"Endpoint",URL_PLACEHOLDER:"Enter the endpoint URL where your app is hosted",URL_ERROR:"A valid URL is required"},CREATE:{HEADER:"Add a new dashboard app",FORM_SUBMIT:"Submit",FORM_CANCEL:"Cancel",API_SUCCESS:"Dashboard app configured successfully",API_ERROR:"We couldn't create an app. Please try again later"},UPDATE:{HEADER:"Edit dashboard app",FORM_SUBMIT:"Update",FORM_CANCEL:"Cancel",API_SUCCESS:"Dashboard app updated successfully",API_ERROR:"We couldn't update the app. Please try again later"},DELETE:{CONFIRM_YES:"Yes, delete it",CONFIRM_NO:"No, keep it",TITLE:"Confirm deletion",MESSAGE:"Are you sure to delete the app - {appName}?",API_SUCCESS:"Dashboard app deleted successfully",API_ERROR:"We couldn't delete the app. Please try again later"}},LINEAR:{ADD_OR_LINK_BUTTON:"Create/Link Linear Issue",LOADING:"Fetching linear issues...",LOADING_ERROR:"There was an error fetching the linear issues, please try again",CREATE:"Create",LINK:{SEARCH:"Search issues",SELECT:"Select issue",TITLE:"Link",EMPTY_LIST:"No linear issues found",LOADING:"Loading",ERROR:"There was an error fetching the linear issues, please try again",LINK_SUCCESS:"Issue linked successfully",LINK_ERROR:"There was an error linking the issue, please try again",LINK_TITLE:"Conversation (#{conversationId}) with {name}"},ADD_OR_LINK:{TITLE:"Create/link linear issue",DESCRIPTION:"Create Linear issues from conversations, or link existing ones for seamless tracking.",FORM:{TITLE:{LABEL:"Title",PLACEHOLDER:"Enter title",REQUIRED_ERROR:"Title is required"},DESCRIPTION:{LABEL:"Description",PLACEHOLDER:"Enter description"},TEAM:{LABEL:"Team",PLACEHOLDER:"Select team",SEARCH:"Search team",REQUIRED_ERROR:"Team is required"},ASSIGNEE:{LABEL:"Assignee",PLACEHOLDER:"Select assignee",SEARCH:"Search assignee"},PRIORITY:{LABEL:"Priority",PLACEHOLDER:"Select priority",SEARCH:"Search priority"},LABEL:{LABEL:"Label",PLACEHOLDER:"Select label",SEARCH:"Search label"},STATUS:{LABEL:"Status",PLACEHOLDER:"Select status",SEARCH:"Search status"},PROJECT:{LABEL:"Project",PLACEHOLDER:"Select project",SEARCH:"Search project"}},CREATE:"Create",CANCEL:"Cancel",CREATE_SUCCESS:"Issue created successfully",CREATE_ERROR:"There was an error creating the issue, please try again",LOADING_TEAM_ERROR:"There was an error fetching the teams, please try again",LOADING_TEAM_ENTITIES_ERROR:"There was an error fetching the team entities, please try again"},ISSUE:{STATUS:"Status",PRIORITY:"Priority",ASSIGNEE:"Assignee",LABELS:"Labels",CREATED_AT:"Created at {createdAt}"},UNLINK:{TITLE:"Unlink",SUCCESS:"Issue unlinked successfully",ERROR:"There was an error unlinking the issue, please try again"},DELETE:{TITLE:"Are you sure you want to delete the integration?",MESSAGE:"Are you sure you want to delete the integration?",CONFIRM:"Yes, delete",CANCEL:"Cancel"}}},rFe={NAME:"Captain",HEADER_KNOW_MORE:"Know more",COPILOT:{TITLE:"Copilot",TRY_THESE_PROMPTS:"Try these prompts",PANEL_TITLE:"Get started with Copilot",KICK_OFF_MESSAGE:"Need a quick summary, want to check past conversations, or draft a better reply? Copilot’s here to speed things up.",SEND_MESSAGE:"Send message...",EMPTY_MESSAGE:"There was an error generating the response. Please try again.",LOADER:"Captain is thinking",YOU:"You",USE:"Use this",RESET:"Reset",SHOW_STEPS:"Show steps",SELECT_ASSISTANT:"Select Assistant",PROMPTS:{SUMMARIZE:{LABEL:"Summarize this conversation",CONTENT:"Summarize the key points discussed between the customer and the support agent, including the customer's concerns, questions, and the solutions or responses provided by the support agent"},SUGGEST:{LABEL:"Suggest an answer",CONTENT:"Analyze the customer's inquiry, and draft a response that effectively addresses their concerns or questions. Ensure the reply is clear, concise, and provides helpful information."},RATE:{LABEL:"Rate this conversation",CONTENT:"Review the conversation to see how well it meets the customer's needs. Share a rating out of 5 based on tone, clarity, and effectiveness."},HIGH_PRIORITY:{LABEL:"High priority conversations",CONTENT:"Give me a summary of all high priority open conversations. Include the conversation ID, customer name (if available), last message content, and assigned agent. Group by status if relevant."},LIST_CONTACTS:{LABEL:"List contacts",CONTENT:"Show me the list of top 10 contacts. Include name, email or phone number (if available), last seen time, tags (if any)."}}},PLAYGROUND:{USER:"You",ASSISTANT:"Assistant",MESSAGE_PLACEHOLDER:"Type your message...",HEADER:"Playground",DESCRIPTION:"Use this playground to send messages to your assistant and check if it responds accurately, quickly, and in the tone you expect.",CREDIT_NOTE:"Messages sent here will count toward your Captain credits."},PAYWALL:{TITLE:"Upgrade to use Captain AI",AVAILABLE_ON:"Captain is not available on the free plan.",UPGRADE_PROMPT:"Upgrade your plan to get access to our assistants, copilot and more.",UPGRADE_NOW:"Upgrade now",CANCEL_ANYTIME:"You can change or cancel your plan anytime"},ENTERPRISE_PAYWALL:{UPGRADE_PROMPT:"Upgrade your plan to get access to our assistants, copilot and more.",ASK_ADMIN:"Please reach out to your administrator for the upgrade."},BANNER:{RESPONSES:"You've used over 80% of your response limit. To continue using Captain AI, please upgrade.",DOCUMENTS:"Document limit reached. Upgrade to continue using Captain AI."},FORM:{CANCEL:"Cancel",CREATE:"Create",EDIT:"Update"},ASSISTANTS:{HEADER:"Assistants",NO_ASSISTANTS_AVAILABLE:"There are no assistants available in your account.",ADD_NEW:"Create a new assistant",DELETE:{TITLE:"Are you sure to delete the assistant?",DESCRIPTION:"This action is permanent. Deleting this assistant will remove it from all connected inboxes and permanently erase all generated knowledge.",CONFIRM:"Yes, delete",SUCCESS_MESSAGE:"The assistant has been successfully deleted",ERROR_MESSAGE:"There was an error deleting the assistant, please try again."},FORM_DESCRIPTION:"Fill out the details below to name your assistant, describe its purpose, and specify the product it will support.",CREATE:{TITLE:"Create an assistant",SUCCESS_MESSAGE:"The assistant has been successfully created",ERROR_MESSAGE:"There was an error creating the assistant, please try again."},FORM:{UPDATE:"Update",SECTIONS:{BASIC_INFO:"Basic Information",SYSTEM_MESSAGES:"System Messages",INSTRUCTIONS:"Instructions",FEATURES:"Features",TOOLS:"Tools "},NAME:{LABEL:"Name",PLACEHOLDER:"Enter assistant name",ERROR:"The name is required"},TEMPERATURE:{LABEL:"Response Temperature",DESCRIPTION:"Adjust how creative or restrictive the assistant's responses should be. Lower values produce more focused and deterministic responses, while higher values allow for more creative and varied outputs."},DESCRIPTION:{LABEL:"Description",PLACEHOLDER:"Enter assistant description",ERROR:"The description is required"},PRODUCT_NAME:{LABEL:"Product Name",PLACEHOLDER:"Enter product name",ERROR:"The product name is required"},WELCOME_MESSAGE:{LABEL:"Welcome Message",PLACEHOLDER:"Enter welcome message"},HANDOFF_MESSAGE:{LABEL:"Handoff Message",PLACEHOLDER:"Enter handoff message"},RESOLUTION_MESSAGE:{LABEL:"Resolution Message",PLACEHOLDER:"Enter resolution message"},INSTRUCTIONS:{LABEL:"Instructions",PLACEHOLDER:"Enter instructions for the assistant"},FEATURES:{TITLE:"Features",ALLOW_CONVERSATION_FAQS:"Generate FAQs from resolved conversations",ALLOW_MEMORIES:"Capture key details as memories from customer interactions."}},EDIT:{TITLE:"Update the assistant",SUCCESS_MESSAGE:"The assistant has been successfully updated",ERROR_MESSAGE:"There was an error updating the assistant, please try again.",NOT_FOUND:"Could not find the assistant. Please try again."},OPTIONS:{EDIT_ASSISTANT:"Edit Assistant",DELETE_ASSISTANT:"Delete Assistant",VIEW_CONNECTED_INBOXES:"View connected inboxes"},EMPTY_STATE:{TITLE:"No assistants available",SUBTITLE:"Create an assistant to provide quick and accurate responses to your users. It can learn from your help articles and past conversations.",FEATURE_SPOTLIGHT:{TITLE:"Captain Assistant",NOTE:"Captain Assistant engages directly with customers, learns from your help docs and past conversations, and delivers instant, accurate responses. It handles the initial queries, providing quick resolutions before transferring to an agent when needed."}}},DOCUMENTS:{HEADER:"Documents",ADD_NEW:"Create a new document",RELATED_RESPONSES:{TITLE:"Related FAQs",DESCRIPTION:"These FAQs are generated directly from the document."},FORM_DESCRIPTION:"Enter the URL of the document to add it as a knowledge source and choose the assistant to associate it with.",CREATE:{TITLE:"Add a document",SUCCESS_MESSAGE:"The document has been successfully created",ERROR_MESSAGE:"There was an error creating the document, please try again."},FORM:{URL:{LABEL:"URL",PLACEHOLDER:"Enter the URL of the document",ERROR:"Please provide a valid URL for the document"},ASSISTANT:{LABEL:"Assistant",PLACEHOLDER:"Select the assistant",ERROR:"The assistant field is required"}},DELETE:{TITLE:"Are you sure to delete the document?",DESCRIPTION:"This action is permanent. Deleting this document will permanently erase all generated knowledge.",CONFIRM:"Yes, delete",SUCCESS_MESSAGE:"The document has been successfully deleted",ERROR_MESSAGE:"There was an error deleting the document, please try again."},OPTIONS:{VIEW_RELATED_RESPONSES:"View Related Responses",DELETE_DOCUMENT:"Delete Document"},EMPTY_STATE:{TITLE:"No documents available",SUBTITLE:"Documents are used by your assistant to generate FAQs. You can import documents to provide context for your assistant.",FEATURE_SPOTLIGHT:{TITLE:"Captain Document",NOTE:"A document in Captain serves as a knowledge resource for the assistant. By connecting your help center or guides, Captain can analyze the content and provide accurate responses for customer inquiries."}}},RESPONSES:{HEADER:"FAQs",ADD_NEW:"Create new FAQ",DOCUMENTABLE:{CONVERSATION:"Conversation #{id}"},SELECTED:"{count} selected",BULK_APPROVE_BUTTON:"Approve",BULK_DELETE_BUTTON:"Delete",BULK_APPROVE:{SUCCESS_MESSAGE:"FAQs approved successfully",ERROR_MESSAGE:"There was an error approving the FAQs, please try again."},BULK_DELETE:{TITLE:"Delete FAQs?",DESCRIPTION:"Are you sure you want to delete the selected FAQs? This action cannot be undone.",CONFIRM:"Yes, delete all",SUCCESS_MESSAGE:"FAQs deleted successfully",ERROR_MESSAGE:"There was an error deleting the FAQs, please try again."},DELETE:{TITLE:"Are you sure to delete the FAQ?",DESCRIPTION:"",CONFIRM:"Yes, delete",SUCCESS_MESSAGE:"FAQ deleted successfully",ERROR_MESSAGE:"There was an error deleting the FAQ, please try again."},FILTER:{ASSISTANT:"Assistant: {selected}",STATUS:"Status: {selected}",ALL_ASSISTANTS:"All"},STATUS:{TITLE:"Status",PENDING:"Pending",APPROVED:"Approved",ALL:"All"},FORM_DESCRIPTION:"Add a question and its corresponding answer to the knowledge base and select the assistant it should be associated with.",CREATE:{TITLE:"Add an FAQ",SUCCESS_MESSAGE:"The response has been added successfully.",ERROR_MESSAGE:"An error occurred while adding the response. Please try again."},FORM:{QUESTION:{LABEL:"Question",PLACEHOLDER:"Enter the question here",ERROR:"Please provide a valid question."},ANSWER:{LABEL:"Answer",PLACEHOLDER:"Enter the answer here",ERROR:"Please provide a valid answer."},ASSISTANT:{LABEL:"Assistant",PLACEHOLDER:"Select an assistant",ERROR:"Please select an assistant."}},EDIT:{TITLE:"Update the FAQ",SUCCESS_MESSAGE:"The FAQ has been successfully updated",ERROR_MESSAGE:"There was an error updating the FAQ, please try again",APPROVE_SUCCESS_MESSAGE:"The FAQ was marked as approved"},OPTIONS:{APPROVE:"Mark as approved",EDIT_RESPONSE:"Edit FAQ",DELETE_RESPONSE:"Delete FAQ"},EMPTY_STATE:{TITLE:"No FAQs Found",SUBTITLE:"FAQs help your assistant provide quick and accurate answers to questions from your customers. They can be generated automatically from your content or can be added manually.",FEATURE_SPOTLIGHT:{TITLE:"Captain FAQ",NOTE:"Captain FAQs detects common customer questions—whether missing from your knowledge base or frequently asked—and generates relevant FAQs to improve support. You can review each suggestion and decide whether to approve or reject it."}}},INBOXES:{HEADER:"Connected Inboxes",ADD_NEW:"Connect a new inbox",OPTIONS:{DISCONNECT:"Disconnect"},DELETE:{TITLE:"Are you sure to disconnect the inbox?",DESCRIPTION:"",CONFIRM:"Yes, delete",SUCCESS_MESSAGE:"The inbox was successfully disconnected.",ERROR_MESSAGE:"There was an error disconnecting the inbox, please try again."},FORM_DESCRIPTION:"Choose an inbox to connect with the assistant.",CREATE:{TITLE:"Connect an Inbox",SUCCESS_MESSAGE:"The inbox was successfully connected.",ERROR_MESSAGE:"An error occurred while connecting the inbox. Please try again."},FORM:{INBOX:{LABEL:"Inbox",PLACEHOLDER:"Choose the inbox to deploy the assistant.",ERROR:"An inbox selection is required."}},EMPTY_STATE:{TITLE:"No Connected Inboxes",SUBTITLE:"Connecting an inbox allows the assistant to handle initial questions from your customers before transferring them to you."}}},aFe={INTEGRATION_SETTINGS:tFe,CAPTAIN:rFe},oFe={HEADER:"Labels",HEADER_BTN_TXT:"Add label",LOADING:"Fetching labels",DESCRIPTION:"Labels help you categorize and prioritize conversations and leads. You can assign a label to a conversation or contact using the side panel.",LEARN_MORE:"Learn more about labels",SEARCH_404:"There are no items matching this query",LIST:{404:"There are no labels available in this account.",TITLE:"Manage labels",DESC:"Labels let you group the conversations together.",TABLE_HEADER:{NAME:"Name",DESCRIPTION:"Description",COLOR:"Color"}},FORM:{NAME:{LABEL:"Label Name",PLACEHOLDER:"Label name",REQUIRED_ERROR:"Label name is required",MINIMUM_LENGTH_ERROR:"Minimum length 2 is required",VALID_ERROR:"Only Alphabets, Numbers, Hyphen and Underscore are allowed"},DESCRIPTION:{LABEL:"Description",PLACEHOLDER:"Label Description"},COLOR:{LABEL:"Color"},SHOW_ON_SIDEBAR:{LABEL:"Show label on sidebar"},EDIT:"Edit",CREATE:"Create",DELETE:"Delete",CANCEL:"Cancel"},SUGGESTIONS:{TOOLTIP:{SINGLE_SUGGESTION:"Add label to conversation",MULTIPLE_SUGGESTION:"Select this label",DESELECT:"Deselect label",DISMISS:"Dismiss suggestion"},POWERED_BY:"Chatwoot AI",DISMISS:"Dismiss",ADD_SELECTED_LABELS:"Add selected labels",ADD_SELECTED_LABEL:"Add selected label",ADD_ALL_LABELS:"Add all labels",SUGGESTED_LABELS:"Suggested labels"},ADD:{TITLE:"Add label",DESC:"Labels let you group the conversations together.",API:{SUCCESS_MESSAGE:"Label added successfully",ERROR_MESSAGE:"There was an error, please try again"}},EDIT:{TITLE:"Edit label",API:{SUCCESS_MESSAGE:"Label updated successfully",ERROR_MESSAGE:"There was an error, please try again"}},DELETE:{BUTTON_TEXT:"Delete",API:{SUCCESS_MESSAGE:"Label deleted successfully",ERROR_MESSAGE:"There was an error, please try again"},CONFIRM:{TITLE:"Confirm Deletion",MESSAGE:"Are you sure to delete ",YES:"Yes, Delete ",NO:"No, Keep "}}},iFe={LABEL_MGMT:oFe},nFe={TITLE:"Login to Chatwoot",EMAIL:{LABEL:"Email",PLACEHOLDER:"example{'@'}companyname.com",ERROR:"Please enter a valid email address"},PASSWORD:{LABEL:"Password",PLACEHOLDER:"Password"},API:{SUCCESS_MESSAGE:"Login successful",ERROR_MESSAGE:"Could not connect to Woot server. Please try again.",UNAUTH:"Username or password is incorrect. Please try again."},OAUTH:{GOOGLE_LOGIN:"Login with Google",BUSINESS_ACCOUNTS_ONLY:"Please use your company email address to login",NO_ACCOUNT_FOUND:"We couldn't find an account for your email address."},FORGOT_PASSWORD:"Forgot your password?",CREATE_NEW_ACCOUNT:"Create a new account",SUBMIT:"Login"},sFe={LOGIN:nFe},lFe={HEADER:"Macros",DESCRIPTION:"A macro is a set of saved actions that help customer service agents easily complete tasks. The agents can define a set of actions like tagging a conversation with a label, sending an email transcript, updating a custom attribute, etc., and they can run these actions in a single click.",LEARN_MORE:"Learn more about macros",HEADER_BTN_TXT:"Add a new macro",HEADER_BTN_TXT_SAVE:"Save macro",LOADING:"Fetching macros",ERROR:"Something went wrong. Please try again",ORDER_INFO:"Macros will run in the order you add your actions. You can rearrange them by dragging them by the handle beside each node.",ADD:{FORM:{NAME:{LABEL:"Macro name",PLACEHOLDER:"Enter a name for your macro",ERROR:"Name is required for creating a macro"},ACTIONS:{LABEL:"Actions"}},API:{SUCCESS_MESSAGE:"Macro added successfully",ERROR_MESSAGE:"Unable to create macro, Please try again later"}},LIST:{404:"No macros found",TABLE_HEADER:{NAME:"Name","CREATED BY":"Created by",LAST_UPDATED_BY:"Last updated by",VISIBILITY:"Visibility"}},DELETE:{TOOLTIP:"Delete macro",CONFIRM:{MESSAGE:"Are you sure to delete ",YES:"Yes, Delete",NO:"No"},API:{SUCCESS_MESSAGE:"Macro deleted successfully",ERROR_MESSAGE:"There was an error deleting the macro. Please try again later"}},EDIT:{TOOLTIP:"Edit macro",API:{SUCCESS_MESSAGE:"Macro updated successfully",ERROR_MESSAGE:"Could not update Macro, Please try again later"}},EDITOR:{START_FLOW:"Start Flow",END_FLOW:"End Flow",LOADING:"Fetching macro",ADD_BTN_TOOLTIP:"Add new action",DELETE_BTN_TOOLTIP:"Delete Action",VISIBILITY:{LABEL:"Macro Visibility",GLOBAL:{LABEL:"Public",DESCRIPTION:"This macro is available publicly for all agents in this account."},PERSONAL:{LABEL:"Private",DESCRIPTION:"This macro will be private to you and not be available to others."}}},EXECUTE:{BUTTON_TOOLTIP:"Execute",PREVIEW:"Preview Macro",EXECUTED_SUCCESSFULLY:"Macro executed successfully"},ERRORS:{ATTRIBUTE_KEY_REQUIRED:"Attribute key is required",FILTER_OPERATOR_REQUIRED:"Filter operator is required",VALUE_REQUIRED:"Value is required",VALUE_MUST_BE_BETWEEN_1_AND_998:"Value must be between 1 and 998",ACTION_PARAMETERS_REQUIRED:"Action parameters are required",ATLEAST_ONE_CONDITION_REQUIRED:"At least one condition is required",ATLEAST_ONE_ACTION_REQUIRED:"At least one action is required"},ACTIONS:{ASSIGN_TEAM:"Assign a Team",ASSIGN_AGENT:"Assign an Agent",ADD_LABEL:"Add a Label",REMOVE_LABEL:"Remove a Label",REMOVE_ASSIGNED_TEAM:"Remove Assigned Team",SEND_EMAIL_TRANSCRIPT:"Send an Email Transcript",MUTE_CONVERSATION:"Mute Conversation",SNOOZE_CONVERSATION:"Snooze Conversation",RESOLVE_CONVERSATION:"Resolve Conversation",SEND_ATTACHMENT:"Send Attachment",SEND_MESSAGE:"Send a Message",CHANGE_PRIORITY:"Change Priority",ADD_PRIVATE_NOTE:"Add a Private Note",SEND_WEBHOOK_EVENT:"Send Webhook Event"}},cFe={MACROS:lFe},uFe={HEADER:"Conversations",LOADING_CHART:"Loading chart data...",NO_ENOUGH_DATA:"We've not received enough data points to generate report, Please try again later.",DOWNLOAD_AGENT_REPORTS:"Download agent reports",DATA_FETCHING_FAILED:"Failed to fetch data, please try again later.",SUMMARY_FETCHING_FAILED:"Failed to fetch summary, please try again later.",METRICS:{CONVERSATIONS:{NAME:"Conversations",DESC:"( Total )"},INCOMING_MESSAGES:{NAME:"Messages received",DESC:"( Total )"},OUTGOING_MESSAGES:{NAME:"Messages sent",DESC:"( Total )"},FIRST_RESPONSE_TIME:{NAME:"First Response Time",DESC:"( Avg )",INFO_TEXT:"Total number of conversations used for computation:",TOOLTIP_TEXT:"First Response Time is {metricValue} (based on {conversationCount} conversations)"},RESOLUTION_TIME:{NAME:"Resolution Time",DESC:"( Avg )",INFO_TEXT:"Total number of conversations used for computation:",TOOLTIP_TEXT:"Resolution Time is {metricValue} (based on {conversationCount} conversations)"},RESOLUTION_COUNT:{NAME:"Resolution Count",DESC:"( Total )"},BOT_RESOLUTION_COUNT:{NAME:"Resolution Count",DESC:"( Total )"},BOT_HANDOFF_COUNT:{NAME:"Handoff Count",DESC:"( Total )"},REPLY_TIME:{NAME:"Customer waiting time",TOOLTIP_TEXT:"Waiting time is {metricValue} (based on {conversationCount} replies)",DESC:""}},DATE_RANGE_OPTIONS:{LAST_7_DAYS:"Last 7 days",LAST_30_DAYS:"Last 30 days",LAST_3_MONTHS:"Last 3 months",LAST_6_MONTHS:"Last 6 months",LAST_YEAR:"Last year",CUSTOM_DATE_RANGE:"Custom date range"},CUSTOM_DATE_RANGE:{CONFIRM:"Apply",PLACEHOLDER:"Select date range"},GROUP_BY_FILTER_DROPDOWN_LABEL:"Group By",DURATION_FILTER_LABEL:"Duration",GROUPING_OPTIONS:{DAY:"Day",WEEK:"Week",MONTH:"Month",YEAR:"Year"},GROUP_BY_DAY_OPTIONS:[{id:1,groupBy:"Day"}],GROUP_BY_WEEK_OPTIONS:[{id:1,groupBy:"Day"},{id:2,groupBy:"Week"}],GROUP_BY_MONTH_OPTIONS:[{id:1,groupBy:"Day"},{id:2,groupBy:"Week"},{id:3,groupBy:"Month"}],GROUP_BY_YEAR_OPTIONS:[{id:2,groupBy:"Week"},{id:3,groupBy:"Month"},{id:4,groupBy:"Year"}],BUSINESS_HOURS:"Business Hours",FILTER_ACTIONS:{CLEAR_FILTER:"Clear filter",EMPTY_LIST:"No results found"},PAGINATION:{RESULTS:"Showing {start} to {end} of {total} results",PER_PAGE_TEMPLATE:"{size} / page"}},dFe={HEADER:"Agents Overview",DESCRIPTION:"Easily track agent performance with key metrics such as conversations, response times, resolution times, and resolved cases. Click an agent’s name to learn more.",LOADING_CHART:"Loading chart data...",NO_ENOUGH_DATA:"We've not received enough data points to generate report, Please try again later.",DOWNLOAD_AGENT_REPORTS:"Download agent reports",FILTER_DROPDOWN_LABEL:"Select Agent",METRICS:{CONVERSATIONS:{NAME:"Conversations",DESC:"( Total )"},INCOMING_MESSAGES:{NAME:"Incoming Messages",DESC:"( Total )"},OUTGOING_MESSAGES:{NAME:"Outgoing Messages",DESC:"( Total )"},FIRST_RESPONSE_TIME:{NAME:"First Response Time",DESC:"( Avg )",INFO_TEXT:"Total number of conversations used for computation:",TOOLTIP_TEXT:"First Response Time is {metricValue} (based on {conversationCount} conversations)"},RESOLUTION_TIME:{NAME:"Resolution Time",DESC:"( Avg )",INFO_TEXT:"Total number of conversations used for computation:",TOOLTIP_TEXT:"Resolution Time is {metricValue} (based on {conversationCount} conversations)"},RESOLUTION_COUNT:{NAME:"Resolution Count",DESC:"( Total )"}},DATE_RANGE:[{id:0,name:"Last 7 days"},{id:1,name:"Last 30 days"},{id:2,name:"Last 3 months"},{id:3,name:"Last 6 months"},{id:4,name:"Last year"},{id:5,name:"Custom date range"}],CUSTOM_DATE_RANGE:{CONFIRM:"Apply",PLACEHOLDER:"Select date range"}},gFe={HEADER:"Labels Overview",LOADING_CHART:"Loading chart data...",NO_ENOUGH_DATA:"We've not received enough data points to generate report, Please try again later.",DOWNLOAD_LABEL_REPORTS:"Download label reports",FILTER_DROPDOWN_LABEL:"Select Label",METRICS:{CONVERSATIONS:{NAME:"Conversations",DESC:"( Total )"},INCOMING_MESSAGES:{NAME:"Incoming Messages",DESC:"( Total )"},OUTGOING_MESSAGES:{NAME:"Outgoing Messages",DESC:"( Total )"},FIRST_RESPONSE_TIME:{NAME:"First Response Time",DESC:"( Avg )",INFO_TEXT:"Total number of conversations used for computation:",TOOLTIP_TEXT:"First Response Time is {metricValue} (based on {conversationCount} conversations)"},RESOLUTION_TIME:{NAME:"Resolution Time",DESC:"( Avg )",INFO_TEXT:"Total number of conversations used for computation:",TOOLTIP_TEXT:"Resolution Time is {metricValue} (based on {conversationCount} conversations)"},RESOLUTION_COUNT:{NAME:"Resolution Count",DESC:"( Total )"}},DATE_RANGE:[{id:0,name:"Last 7 days"},{id:1,name:"Last 30 days"},{id:2,name:"Last 3 months"},{id:3,name:"Last 6 months"},{id:4,name:"Last year"},{id:5,name:"Custom date range"}],CUSTOM_DATE_RANGE:{CONFIRM:"Apply",PLACEHOLDER:"Select date range"}},hFe={HEADER:"Inbox Overview",DESCRIPTION:"Quickly view your inbox performance with key metrics like conversations, response times, resolution times, and resolved cases—all in one place. Click an inbox name for more details.",LOADING_CHART:"Loading chart data...",NO_ENOUGH_DATA:"We've not received enough data points to generate report, Please try again later.",DOWNLOAD_INBOX_REPORTS:"Download inbox reports",FILTER_DROPDOWN_LABEL:"Select Inbox",METRICS:{CONVERSATIONS:{NAME:"Conversations",DESC:"( Total )"},INCOMING_MESSAGES:{NAME:"Incoming Messages",DESC:"( Total )"},OUTGOING_MESSAGES:{NAME:"Outgoing Messages",DESC:"( Total )"},FIRST_RESPONSE_TIME:{NAME:"First Response Time",DESC:"( Avg )",INFO_TEXT:"Total number of conversations used for computation:",TOOLTIP_TEXT:"First Response Time is {metricValue} (based on {conversationCount} conversations)"},RESOLUTION_TIME:{NAME:"Resolution Time",DESC:"( Avg )",INFO_TEXT:"Total number of conversations used for computation:",TOOLTIP_TEXT:"Resolution Time is {metricValue} (based on {conversationCount} conversations)"},RESOLUTION_COUNT:{NAME:"Resolution Count",DESC:"( Total )"}},DATE_RANGE:[{id:0,name:"Last 7 days"},{id:1,name:"Last 30 days"},{id:2,name:"Last 3 months"},{id:3,name:"Last 6 months"},{id:4,name:"Last year"},{id:5,name:"Custom date range"}],CUSTOM_DATE_RANGE:{CONFIRM:"Apply",PLACEHOLDER:"Select date range"}},mFe={HEADER:"Team Overview",DESCRIPTION:"Get a snapshot of your team’s performance with essential metrics, including conversations, response times, resolution times, and resolved cases. Click a team name for more details.",LOADING_CHART:"Loading chart data...",NO_ENOUGH_DATA:"We've not received enough data points to generate report, Please try again later.",DOWNLOAD_TEAM_REPORTS:"Download team reports",FILTER_DROPDOWN_LABEL:"Select Team",METRICS:{CONVERSATIONS:{NAME:"Conversations",DESC:"( Total )"},INCOMING_MESSAGES:{NAME:"Incoming Messages",DESC:"( Total )"},OUTGOING_MESSAGES:{NAME:"Outgoing Messages",DESC:"( Total )"},FIRST_RESPONSE_TIME:{NAME:"First Response Time",DESC:"( Avg )",INFO_TEXT:"Total number of conversations used for computation:",TOOLTIP_TEXT:"First Response Time is {metricValue} (based on {conversationCount} conversations)"},RESOLUTION_TIME:{NAME:"Resolution Time",DESC:"( Avg )",INFO_TEXT:"Total number of conversations used for computation:",TOOLTIP_TEXT:"Resolution Time is {metricValue} (based on {conversationCount} conversations)"},RESOLUTION_COUNT:{NAME:"Resolution Count",DESC:"( Total )"}},DATE_RANGE:[{id:0,name:"Last 7 days"},{id:1,name:"Last 30 days"},{id:2,name:"Last 3 months"},{id:3,name:"Last 6 months"},{id:4,name:"Last year"},{id:5,name:"Custom date range"}],CUSTOM_DATE_RANGE:{CONFIRM:"Apply",PLACEHOLDER:"Select date range"}},pFe={HEADER:"CSAT Reports",NO_RECORDS:"There are no CSAT survey responses available.",DOWNLOAD:"Download CSAT Reports",DOWNLOAD_FAILED:"Failed to download CSAT Reports",FILTERS:{AGENTS:{PLACEHOLDER:"Choose Agents"}},TABLE:{HEADER:{CONTACT_NAME:"Contact",AGENT_NAME:"Assigned agent",RATING:"Rating",FEEDBACK_TEXT:"Feedback comment"}},METRIC:{TOTAL_RESPONSES:{LABEL:"Total responses",TOOLTIP:"Total number of responses collected"},SATISFACTION_SCORE:{LABEL:"Satisfaction score",TOOLTIP:"Total number of positive responses / Total number of responses * 100"},RESPONSE_RATE:{LABEL:"Response rate",TOOLTIP:"Total number of responses / Total number of CSAT survey messages sent * 100"}}},fFe={HEADER:"Bot Reports",METRIC:{TOTAL_CONVERSATIONS:{LABEL:"No. of Conversations",TOOLTIP:"Total number of conversations handled by the bot"},TOTAL_RESPONSES:{LABEL:"Total Responses",TOOLTIP:"Total number of responses sent by the bot"},RESOLUTION_RATE:{LABEL:"Resolution Rate",TOOLTIP:"Total number of conversations resolved by the bot / Total number of conversations handled by the bot * 100"},HANDOFF_RATE:{LABEL:"Handoff Rate",TOOLTIP:"Total number of conversations handed off to agents / Total number of conversations handled by the bot * 100"}}},wFe={HEADER:"Overview",LIVE:"Live",ACCOUNT_CONVERSATIONS:{HEADER:"Open Conversations",LOADING_MESSAGE:"Loading conversation metrics...",OPEN:"Open",UNATTENDED:"Unattended",UNASSIGNED:"Unassigned",PENDING:"Pending"},CONVERSATION_HEATMAP:{HEADER:"Conversation Traffic",NO_CONVERSATIONS:"No conversations",CONVERSATION:"{count} conversation",CONVERSATIONS:"{count} conversations",DOWNLOAD_REPORT:"Download report"},AGENT_CONVERSATIONS:{HEADER:"Conversations by agents",LOADING_MESSAGE:"Loading agent metrics...",NO_AGENTS:"There are no conversations by agents",TABLE_HEADER:{AGENT:"Agent",OPEN:"Open",UNATTENDED:"Unattended",STATUS:"Status"}},TEAM_CONVERSATIONS:{ALL_TEAMS:"All Teams",HEADER:"Conversations by teams",LOADING_MESSAGE:"Loading team metrics...",NO_TEAMS:"There is no data available",TABLE_HEADER:{TEAM:"Team",OPEN:"Open",UNATTENDED:"Unattended",STATUS:"Status"}},AGENT_STATUS:{HEADER:"Agent status",ONLINE:"Online",BUSY:"Busy",OFFLINE:"Offline"}},vFe={SUNDAY:"Sunday",MONDAY:"Monday",TUESDAY:"Tuesday",WEDNESDAY:"Wednesday",THURSDAY:"Thursday",FRIDAY:"Friday",SATURDAY:"Saturday"},bFe={HEADER:"SLA Reports",NO_RECORDS:"SLA applied conversations are not available.",LOADING:"Loading SLA data...",DOWNLOAD_SLA_REPORTS:"Download SLA reports",DOWNLOAD_FAILED:"Failed to download SLA Reports",DROPDOWN:{ADD_FIlTER:"Add filter",CLEAR_ALL:"Clear all",CLEAR_FILTER:"Clear filter",EMPTY_LIST:"No results found",NO_FILTER:"No filters available",SEARCH:"Search filter",INPUT_PLACEHOLDER:{SLA:"SLA name",AGENTS:"Agent name",INBOXES:"Inbox name",LABELS:"Label name",TEAMS:"Team name"},SLA:"SLA Policy",INBOXES:"Inbox",AGENTS:"Agent",LABELS:"Label",TEAMS:"Team"},WITH:"with",METRICS:{HIT_RATE:{LABEL:"Hit Rate",TOOLTIP:"Percentage of SLAs created were completed successfully"},NO_OF_MISSES:{LABEL:"Number of Misses",TOOLTIP:"Total SLA misses in a certain period"},NO_OF_CONVERSATIONS:{LABEL:"Number of Conversations",TOOLTIP:"Total number of conversations with SLA"}},TABLE:{HEADER:{POLICY:"Policy",CONVERSATION:"Conversation",AGENT:"Agent"},VIEW_DETAILS:"View Details"}},EFe={INBOX:"Inbox",AGENT:"Agent",TEAM:"Team",AVG_RESOLUTION_TIME:"Avg. Resolution Time",AVG_FIRST_RESPONSE_TIME:"Avg. First Response Time",AVG_REPLY_TIME:"Avg. Customer Waiting Time",RESOLUTION_COUNT:"Resolution Count",CONVERSATIONS:"No. of conversations"},kFe={REPORT:uFe,AGENT_REPORTS:dFe,LABEL_REPORTS:gFe,INBOX_REPORTS:hFe,TEAM_REPORTS:mFe,CSAT_REPORTS:pFe,BOT_REPORTS:fFe,OVERVIEW_REPORTS:wFe,DAYS_OF_WEEK:vFe,SLA_REPORTS:bFe,SUMMARY_REPORTS:EFe},CFe={TITLE:"Reset password",DESCRIPTION:"Enter the email address you use to log in to Chatwoot to get the password reset instructions.",GO_BACK_TO_LOGIN:"If you want to go back to the login page,",EMAIL:{LABEL:"Email",PLACEHOLDER:"Please enter your email.",ERROR:"Please enter a valid email."},API:{SUCCESS_MESSAGE:"Password reset link has been sent to your email.",ERROR_MESSAGE:"Could not connect to Woot server. Please try again."},SUBMIT:"Submit"},AFe={RESET_PASSWORD:CFe},xFe={TABS:{ALL:"All",CONTACTS:"Contacts",CONVERSATIONS:"Conversations",MESSAGES:"Messages",ARTICLES:"Articles"},SECTION:{CONTACTS:"Contacts",CONVERSATIONS:"Conversations",MESSAGES:"Messages",ARTICLES:"Articles"},VIEW_MORE:"View more",LOAD_MORE:"Load more",SEARCHING_DATA:"Searching",LOADING_DATA:"Loading",EMPTY_STATE:"No {item} found for query '{query}'",EMPTY_STATE_FULL:"No results found for query '{query}'",PLACEHOLDER_KEYBINDING:"/ to focus",INPUT_PLACEHOLDER:"Type 3 or more characters to search",EMPTY_STATE_DEFAULT:"Search by conversation id, email, phone number, messages for better search results. ",BOT_LABEL:"Bot",READ_MORE:"Read more",WROTE:"wrote:",FROM:"from",EMAIL:"email",EMAIL_SUBJECT:"subject"},yFe={SEARCH:xFe},TFe={TITLE:"Set new password",PASSWORD:{LABEL:"Password",PLACEHOLDER:"Password",ERROR:"Password is too short."},CONFIRM_PASSWORD:{LABEL:"Confirm password",PLACEHOLDER:"Confirm Password",ERROR:"Passwords do not match."},API:{SUCCESS_MESSAGE:"Successfully changed the password.",ERROR_MESSAGE:"Could not connect to Woot server. Please try again."},CAPTCHA:{ERROR:"Verification expired. Please solve captcha again."},SUBMIT:"Submit"},SFe={SET_NEW_PASSWORD:TFe},IFe={LINK:"Profile Settings",TITLE:"Profile Settings",BTN_TEXT:"Update Profile",DELETE_AVATAR:"Delete Avatar",AVATAR_DELETE_SUCCESS:"Avatar has been deleted successfully",AVATAR_DELETE_FAILED:"There is an error while deleting avatar, please try again",UPDATE_SUCCESS:"Your profile has been updated successfully",PASSWORD_UPDATE_SUCCESS:"Your password has been changed successfully",AFTER_EMAIL_CHANGED:"Your profile has been updated successfully, please login again as your login credentials are changed",FORM:{PICTURE:"Profile Picture",AVATAR:"Profile Image",ERROR:"Please fix form errors",REMOVE_IMAGE:"Remove",UPLOAD_IMAGE:"Upload image",UPDATE_IMAGE:"Update image",PROFILE_SECTION:{TITLE:"Profile",NOTE:"Your email address is your identity and is used to log in."},SEND_MESSAGE:{TITLE:"Hotkey to send messages",NOTE:"You can select a hotkey (either Enter or Cmd/Ctrl+Enter) based on your preference of writing.",UPDATE_SUCCESS:"Your settings have been updated successfully",CARD:{ENTER_KEY:{HEADING:"Enter (↵)",CONTENT:"Send messages by pressing Enter key instead of clicking the send button."},CMD_ENTER_KEY:{HEADING:"Cmd/Ctrl + Enter (⌘ + ↵)",CONTENT:"Send messages by pressing Cmd/Ctrl + enter key instead of clicking the send button."}}},INTERFACE_SECTION:{TITLE:"Interface",NOTE:"Customize the look and feel of your Chatwoot dashboard.",FONT_SIZE:{TITLE:"Font size",NOTE:"Adjust the text size across the dashboard based on your preference.",UPDATE_SUCCESS:"Your font settings have been updated successfully",UPDATE_ERROR:"There is an error while updating the font settings, please try again",OPTIONS:{SMALLER:"Smaller",SMALL:"Small",DEFAULT:"Default",LARGE:"Large",LARGER:"Larger",EXTRA_LARGE:"Extra Large"}}},MESSAGE_SIGNATURE_SECTION:{TITLE:"Personal message signature",NOTE:"Create a unique message signature to appear at the end of every message you send from any inbox. You can also include an inline image, which is supported in live-chat, email, and API inboxes.",BTN_TEXT:"Save message signature",API_ERROR:"Couldn't save signature! Try again",API_SUCCESS:"Signature saved successfully",IMAGE_UPLOAD_ERROR:"Couldn't upload image! Try again",IMAGE_UPLOAD_SUCCESS:"Image added successfully. Please click on save to save the signature",IMAGE_UPLOAD_SIZE_ERROR:"Image size should be less than {size}MB"},MESSAGE_SIGNATURE:{LABEL:"Message Signature",ERROR:"Message Signature cannot be empty",PLACEHOLDER:"Insert your personal message signature here."},PASSWORD_SECTION:{TITLE:"Password",NOTE:"Updating your password would reset your logins in multiple devices.",BTN_TEXT:"Change password"},ACCESS_TOKEN:{TITLE:"Access Token",NOTE:"This token can be used if you are building an API based integration",COPY:"Copy",RESET:"Reset",CONFIRM_RESET:"Are you sure?",CONFIRM_HINT:"Click again to confirm",RESET_SUCCESS:"Access token regenerated successfully",RESET_ERROR:"Unable to regenerate access token. Please try again"},AUDIO_NOTIFICATIONS_SECTION:{TITLE:"Audio Alerts",NOTE:"Enable audio alerts in dashboard for new messages and conversations.",PLAY:"Play sound",ALERT_TYPES:{NONE:"None",MINE:"Assigned",ALL:"All",ASSIGNED:"My assigned conversations",UNASSIGNED:"Unassigned conversations",NOTME:"Open conversations assigned to others"},ALERT_COMBINATIONS:{NONE:"You haven't selected any options, you won't receive any audio alerts.",ASSIGNED:"You'll receive alerts for conversations assigned to you.",UNASSIGNED:"You'll receive alerts for any unassigned conversations.",NOTME:"You'll receive alerts for conversations assigned to others.","ASSIGNED+UNASSIGNED":"You'll receive alerts for your assigned conversations and any unattended ones.","ASSIGNED+NOTME":"You'll receive alerts for conversations assigned to you and to others, but not for unassigned ones.","NOTME+UNASSIGNED":"You'll receive alerts for unattended conversations and those assigned to others.","ASSIGNED+NOTME+UNASSIGNED":"You'll receive alerts for all conversations."},ALERT_TYPE:{TITLE:"Alert events for conversations",NONE:"None",ASSIGNED:"Assigned Conversations",ALL_CONVERSATIONS:"All Conversations"},DEFAULT_TONE:{TITLE:"Alert tone:"},CONDITIONS:{TITLE:"Alert conditions:",CONDITION_ONE:"Send audio alerts only if the browser window is not active",CONDITION_TWO:"Send alerts every 30s until all the assigned conversations are read"},SOUND_PERMISSION_ERROR:"Autoplay is disabled in your browser. To hear alerts automatically, enable sound permission in your browser settings or interact with the page.",READ_MORE:"Read more"},EMAIL_NOTIFICATIONS_SECTION:{TITLE:"Email Notifications",NOTE:"Update your email notification preferences here",CONVERSATION_ASSIGNMENT:"Send email notifications when a conversation is assigned to me",CONVERSATION_CREATION:"Send email notifications when a new conversation is created",CONVERSATION_MENTION:"Send email notifications when you are mentioned in a conversation",ASSIGNED_CONVERSATION_NEW_MESSAGE:"Send email notifications when a new message is created in an assigned conversation",PARTICIPATING_CONVERSATION_NEW_MESSAGE:"Send email notifications when a new message is created in a participating conversation",SLA_MISSED_FIRST_RESPONSE:"Send email notifications when a conversation misses first response SLA",SLA_MISSED_NEXT_RESPONSE:"Send email notifications when a conversation misses next response SLA",SLA_MISSED_RESOLUTION:"Send email notifications when a conversation misses resolution SLA"},NOTIFICATIONS:{TITLE:"Notification preferences",TYPE_TITLE:"Notification type",EMAIL:"Email",PUSH:"Push notification",TYPES:{CONVERSATION_CREATED:"A new conversation is created",CONVERSATION_ASSIGNED:"A conversation is assigned to you",CONVERSATION_MENTION:"You are mentioned in a conversation",ASSIGNED_CONVERSATION_NEW_MESSAGE:"A new message is created in an assigned conversation",PARTICIPATING_CONVERSATION_NEW_MESSAGE:"A new message is created in a participating conversation",SLA_MISSED_FIRST_RESPONSE:"A conversation misses first response SLA",SLA_MISSED_NEXT_RESPONSE:"A conversation misses next response SLA",SLA_MISSED_RESOLUTION:"A conversation misses resolution SLA"},BROWSER_PERMISSION:"Enable push notifications for your browser so you’re able to receive them"},API:{UPDATE_SUCCESS:"Your notification preferences are updated successfully",UPDATE_ERROR:"There is an error while updating the preferences, please try again"},PUSH_NOTIFICATIONS_SECTION:{TITLE:"Push Notifications",NOTE:"Update your push notification preferences here",CONVERSATION_ASSIGNMENT:"Send push notifications when a conversation is assigned to me",CONVERSATION_CREATION:"Send push notifications when a new conversation is created",CONVERSATION_MENTION:"Send push notifications when you are mentioned in a conversation",ASSIGNED_CONVERSATION_NEW_MESSAGE:"Send push notifications when a new message is created in an assigned conversation",PARTICIPATING_CONVERSATION_NEW_MESSAGE:"Send push notifications when a new message is created in a participating conversation",HAS_ENABLED_PUSH:"You have enabled push for this browser.",REQUEST_PUSH:"Enable push notifications",SLA_MISSED_FIRST_RESPONSE:"Send push notifications when a conversation misses first response SLA",SLA_MISSED_NEXT_RESPONSE:"Send push notifications when a conversation misses next response SLA",SLA_MISSED_RESOLUTION:"Send push notifications when a conversation misses resolution SLA"},PROFILE_IMAGE:{LABEL:"Profile Image"},NAME:{LABEL:"Your full name",ERROR:"Please enter a valid full name",PLACEHOLDER:"Please enter your full name"},DISPLAY_NAME:{LABEL:"Display name",ERROR:"Please enter a valid display name",PLACEHOLDER:"Please enter a display name, this would be displayed in conversations"},AVAILABILITY:{LABEL:"Availability",STATUS:{ONLINE:"Online",BUSY:"Busy",OFFLINE:"Offline"},SET_AVAILABILITY_SUCCESS:"Availability has been set successfully",SET_AVAILABILITY_ERROR:"Couldn't set availability, please try again",IMPERSONATING_ERROR:"Cannot change availability while impersonating a user"},EMAIL:{LABEL:"Your email address",ERROR:"Please enter a valid email address",PLACEHOLDER:"Please enter your email address, this would be displayed in conversations"},CURRENT_PASSWORD:{LABEL:"Current password",ERROR:"Please enter the current password",PLACEHOLDER:"Please enter the current password"},PASSWORD:{LABEL:"New password",ERROR:"Please enter a password of length 6 or more",PLACEHOLDER:"Please enter a new password"},PASSWORD_CONFIRMATION:{LABEL:"Confirm new password",ERROR:"Confirm password should match the password",PLACEHOLDER:"Please re-enter your new password"}}},MFe={CHANGE_AVAILABILITY_STATUS:"Change",CHANGE_ACCOUNTS:"Switch account",SWITCH_ACCOUNT:"Switch account",CONTACT_SUPPORT:"Contact support",SELECTOR_SUBTITLE:"Select an account from the following list",PROFILE_SETTINGS:"Profile settings",KEYBOARD_SHORTCUTS:"Keyboard shortcuts",APPEARANCE:"Change appearance",SUPER_ADMIN_CONSOLE:"SuperAdmin console",DOCS:"Read documentation",LOGOUT:"Log out"},OFe={TRIAL_MESSAGE:"days trial remaining.",TRAIL_BUTTON:"Buy Now",DELETED_USER:"Deleted User",EMAIL_VERIFICATION_PENDING:"It seems that you haven't verified your email address yet. Please check your inbox for the verification email.",RESEND_VERIFICATION_MAIL:"Resend verification email",EMAIL_VERIFICATION_SENT:"Verification email has been sent. Please check your inbox.",ACCOUNT_SUSPENDED:{TITLE:"Account Suspended",MESSAGE:"Your account is suspended. Please reach out to the support team for more information."}},LFe={CODE:{BUTTON_TEXT:"Copy",CODEPEN:"Open in CodePen",COPY_SUCCESSFUL:"Copied to clipboard"},SHOW_MORE_BLOCK:{SHOW_MORE:"Show More",SHOW_LESS:"Show Less"},FILE_BUBBLE:{DOWNLOAD:"Download",UPLOADING:"Uploading...",INSTAGRAM_STORY_UNAVAILABLE:"This story is no longer available."},LOCATION_BUBBLE:{SEE_ON_MAP:"See on map"},FORM_BUBBLE:{SUBMIT:"Submit"},MEDIA:{IMAGE_UNAVAILABLE:"This image is no longer available.",LOADING_FAILED:"Loading failed"}},RFe="Verifying...",NFe={INBOXES:{NEW_INBOX:"Add Inbox"}},DFe={NO_ITEMS:"No items",CURRENTLY_VIEWING_ACCOUNT:"Currently viewing:",SWITCH:"Switch",INBOX_VIEW:"Inbox View",CONVERSATIONS:"Conversations",INBOX:"My Inbox",ALL_CONVERSATIONS:"All Conversations",MENTIONED_CONVERSATIONS:"Mentions",PARTICIPATING_CONVERSATIONS:"Participating",UNATTENDED_CONVERSATIONS:"Unattended",REPORTS:"Reports",SETTINGS:"Settings",CONTACTS:"Contacts",ACTIVE:"Active",CAPTAIN:"Captain",CAPTAIN_ASSISTANTS:"Assistants",CAPTAIN_DOCUMENTS:"Documents",CAPTAIN_RESPONSES:"FAQs",HOME:"Home",AGENTS:"Agents",AGENT_BOTS:"Bots",AUDIT_LOGS:"Audit Logs",INBOXES:"Inboxes",NOTIFICATIONS:"Notifications",CANNED_RESPONSES:"Canned Responses",INTEGRATIONS:"Integrations",PROFILE_SETTINGS:"Profile Settings",ACCOUNT_SETTINGS:"Account Settings",APPLICATIONS:"Applications",LABELS:"Labels",CUSTOM_ATTRIBUTES:"Custom Attributes",AUTOMATION:"Automation",MACROS:"Macros",TEAMS:"Teams",BILLING:"Billing",CUSTOM_VIEWS_FOLDER:"Folders",CUSTOM_VIEWS_SEGMENTS:"Segments",ALL_CONTACTS:"All Contacts",TAGGED_WITH:"Tagged with",NEW_LABEL:"New label",NEW_TEAM:"New team",NEW_INBOX:"New inbox",REPORTS_CONVERSATION:"Conversations",CSAT:"CSAT",LIVE_CHAT:"Live Chat",SMS:"SMS",CAMPAIGNS:"Campaigns",ONGOING:"Ongoing",ONE_OFF:"One off",REPORTS_SLA:"SLA",REPORTS_BOT:"Bot",REPORTS_AGENT:"Agents",REPORTS_LABEL:"Labels",REPORTS_INBOX:"Inbox",REPORTS_TEAM:"Team",SET_AVAILABILITY_TITLE:"Set yourself as",SET_YOUR_AVAILABILITY:"Set your availability",SLA:"SLA",CUSTOM_ROLES:"Custom Roles",BETA:"Beta",REPORTS_OVERVIEW:"Overview",REAUTHORIZE:`Your inbox connection has expired, please reconnect
|
|
186
|
-
to continue receiving and sending messages`,HELP_CENTER:{TITLE:"Help Center",ARTICLES:"Articles",CATEGORIES:"Categories",LOCALES:"Locales",SETTINGS:"Settings"},CHANNELS:"Channels",SET_AUTO_OFFLINE:{TEXT:"Mark offline automatically",INFO_TEXT:"Let the system automatically mark you offline when you aren't using the app or dashboard.",INFO_SHORT:"Automatically mark offline when you aren't using the app."},DOCS:"Read docs"},VFe={TITLE:"Billing",DESCRIPTION:"Manage your subscription here, upgrade your plan and get more for your team.",CURRENT_PLAN:{TITLE:"Current Plan",PLAN_NOTE:"You are currently subscribed to the **{plan}** plan with **{quantity}** licenses",SEAT_COUNT:"Number of seats",RENEWS_ON:"Renews on"},VIEW_PRICING:"View Pricing",MANAGE_SUBSCRIPTION:{TITLE:"Manage your subscription",DESCRIPTION:"View your previous invoices, edit your billing details, or cancel your subscription.",BUTTON_TXT:"Go to the billing portal"},CAPTAIN:{TITLE:"Captain",DESCRIPTION:"Manage usage and credits for Captain AI.",BUTTON_TXT:"Buy more credits",DOCUMENTS:"Documents",RESPONSES:"Responses",UPGRADE:"Captain is not available on the free plan, upgrade now to get access to assistants, copilot and more."},CHAT_WITH_US:{TITLE:"Need help?",DESCRIPTION:"Do you face any issues in billing? We are here to help.",BUTTON_TXT:"Chat with us"},NO_BILLING_USER:"Your billing account is being configured. Please refresh the page and try again."},BFe={NO_ACCOUNT_WARNING:"Uh oh! We could not find any Chatwoot accounts. Please create a new account to continue.",NEW_ACCOUNT:"New Account",SELECTOR_SUBTITLE:"Create a new account",API:{SUCCESS_MESSAGE:"Account created successfully",EXIST_MESSAGE:"Account already exists",ERROR_MESSAGE:"Could not connect to Woot Server, Please try again later"},FORM:{NAME:{LABEL:"Company Name",PLACEHOLDER:"Wayne Enterprises"},SUBMIT:"Submit",CANCEL:"Cancel"}},PFe={TOGGLE_MODAL:"View all shortcuts",TITLE:{OPEN_CONVERSATION:"Open conversation",RESOLVE_AND_NEXT:"Resolve and move to next",NAVIGATE_DROPDOWN:"Navigate dropdown items",RESOLVE_CONVERSATION:"Resolve Conversation",GO_TO_CONVERSATION_DASHBOARD:"Go to Conversation Dashboard",ADD_ATTACHMENT:"Add Attachment",GO_TO_CONTACTS_DASHBOARD:"Go to Contacts Dashboard",TOGGLE_SIDEBAR:"Toggle Sidebar",GO_TO_REPORTS_SIDEBAR:"Go to Reports sidebar",MOVE_TO_NEXT_TAB:"Move to next tab in conversation list",GO_TO_SETTINGS:"Go to Settings",SWITCH_TO_PRIVATE_NOTE:"Switch to Private Note",SWITCH_TO_REPLY:"Switch to Reply",TOGGLE_SNOOZE_DROPDOWN:"Toggle snooze dropdown"}},FFe={PROFILE_SETTINGS:IFe,SIDEBAR_ITEMS:MFe,APP_GLOBAL:OFe,COMPONENTS:LFe,CONFIRM_EMAIL:RFe,SETTINGS:NFe,SIDEBAR:DFe,BILLING_SETTINGS:VFe,CREATE_ACCOUNT:BFe,KEYBOARD_SHORTCUTS:PFe},UFe={TRY_WOOT:"Create an account",TITLE:"Register",TESTIMONIAL_HEADER:"All it takes is one step to move forward",TESTIMONIAL_CONTENT:"You're one step away from engaging your customers, retaining them and finding new ones.",TERMS_ACCEPT:'By creating an account, you agree to our <a href="https://www.chatwoot.com/terms">T & C</a> and <a href="https://www.chatwoot.com/privacy-policy">Privacy policy</a>',OAUTH:{GOOGLE_SIGNUP:"Sign up with Google"},COMPANY_NAME:{LABEL:"Company name",PLACEHOLDER:"Enter your company name. E.g., Wayne Enterprises",ERROR:"Company name is too short."},FULL_NAME:{LABEL:"Full name",PLACEHOLDER:"Enter your full name. E.g., Bruce Wayne",ERROR:"Full name is too short."},EMAIL:{LABEL:"Work email",PLACEHOLDER:"Enter your work email address. E.g., bruce{'@'}wayne{'.'}enterprises",ERROR:"Please enter a valid work email address."},PASSWORD:{LABEL:"Password",PLACEHOLDER:"Password",ERROR:"Password is too short.",IS_INVALID_PASSWORD:"Password should contain atleast 1 uppercase letter, 1 lowercase letter, 1 number and 1 special character."},CONFIRM_PASSWORD:{LABEL:"Confirm password",PLACEHOLDER:"Confirm password",ERROR:"Password doesnot match."},API:{SUCCESS_MESSAGE:"Registration Successfull",ERROR_MESSAGE:"Could not connect to Woot server. Please try again."},SUBMIT:"Create account",HAVE_AN_ACCOUNT:"Already have an account?"},jFe={REGISTER:UFe},zFe={HEADER:"Service Level Agreements",ADD_ACTION:"Add SLA",ADD_ACTION_LONG:"Create a new SLA Policy",DESCRIPTION:"Service Level Agreements (SLAs) are contracts that define clear expectations between your team and customers. They establish standards for response and resolution times, creating a framework for accountability and ensures a consistent, high-quality experience.",LEARN_MORE:"Learn more about SLA",LOADING:"Fetching SLAs",PAYWALL:{TITLE:"Upgrade to create SLAs",AVAILABLE_ON:"The SLA feature is only available in the Business and Enterprise plans.",UPGRADE_PROMPT:"Upgrade your plan to get access to advanced features like team management, automations, custom attributes, and more.",UPGRADE_NOW:"Upgrade now",CANCEL_ANYTIME:"You can change or cancel your plan anytime"},ENTERPRISE_PAYWALL:{AVAILABLE_ON:"The SLA feature is only available in the paid plans.",UPGRADE_PROMPT:"Upgrade to a paid plan to access advanced features like audit logs, agent capacity, and more.",ASK_ADMIN:"Please reach out to your administrator for the upgrade."},LIST:{404:"There are no SLAs available in this account.",EMPTY:{TITLE_1:"Enterprise P0",DESC_1:"Issues raised by enterprise customers, that require immediate attention.",TITLE_2:"Enterprise P1",DESC_2:"Issues raised by enterprise customers, that needs to be acknowledged quickly."},BUSINESS_HOURS_ON:"Business hours on",BUSINESS_HOURS_OFF:"Business hours off",RESPONSE_TYPES:{FRT:"First response time threshold",NRT:"Next response time threshold",RT:"Resolution time threshold",SHORT_HAND:{FRT:"FRT",NRT:"NRT",RT:"RT"}}},FORM:{NAME:{LABEL:"SLA Name",PLACEHOLDER:"SLA Name",REQUIRED_ERROR:"SLA name is required",MINIMUM_LENGTH_ERROR:"Minimum length 2 is required",VALID_ERROR:"Only Alphabets, Numbers, Hyphen and Underscore are allowed"},DESCRIPTION:{LABEL:"Description",PLACEHOLDER:"SLA for premium customers"},FIRST_RESPONSE_TIME:{LABEL:"First Response Time",PLACEHOLDER:"5"},NEXT_RESPONSE_TIME:{LABEL:"Next Response Time",PLACEHOLDER:"5"},RESOLUTION_TIME:{LABEL:"Resolution Time",PLACEHOLDER:"60"},BUSINESS_HOURS:{LABEL:"Business Hours",PLACEHOLDER:"Only during business hours"},THRESHOLD_TIME:{INVALID_FORMAT_ERROR:"Threshold should be a number and greater than zero"},EDIT:"Edit",CREATE:"Create",DELETE:"Delete",CANCEL:"Cancel"},ADD:{TITLE:"Add SLA",DESC:"Friendly promises for great service!",API:{SUCCESS_MESSAGE:"SLA added successfully",ERROR_MESSAGE:"There was an error, please try again"}},DELETE:{TITLE:"Delete SLA",API:{SUCCESS_MESSAGE:"SLA deleted successfully",ERROR_MESSAGE:"There was an error, please try again"},CONFIRM:{TITLE:"Confirm Deletion",MESSAGE:"Are you sure you want to delete ",YES:"Yes, Delete ",NO:"No, Keep "}},EVENTS:{TITLE:"SLA Misses",FRT:"First response time",NRT:"Next response time",RT:"Resolution time",SHOW_MORE:"{count} more",HIDE:"Hide {count} rows"}},qFe={SLA:zFe},GFe={NEW_TEAM:"Create new team",HEADER:"Teams",LOADING:"Fetching teams",DESCRIPTION:"Teams allow you to organize agents into groups based on their responsibilities. An agent can belong to multiple teams. When working collaboratively, you can assign conversations to specific teams.",LEARN_MORE:"Learn more about teams",LIST:{404:"There are no teams created on this account.",EDIT_TEAM:"Edit team",NONE:"None"},CREATE_FLOW:{CREATE:{TITLE:"Create a new team",DESC:"Add a title and description to your new team."},AGENTS:{BUTTON_TEXT:"Add agents to team",TITLE:"Add agents to team - {teamName}",DESC:"Add Agents to your newly created team. This lets you collaborate as a team on conversations, get notified on new events in the same conversation."},WIZARD_CREATE:{TITLE:"Create",BODY:"Create a new team of agents."},WIZARD_ADD_AGENTS:{TITLE:"Add Agents",BODY:"Add agents to the team."},WIZARD_FINISH:{TITLE:"Finish",BODY:"You are all set to go!"}},EDIT_FLOW:{CREATE:{TITLE:"Edit your team details",DESC:"Edit title and description to your team.",BUTTON_TEXT:"Update team"},AGENTS:{BUTTON_TEXT:"Update agents in team",TITLE:"Add agents to team - {teamName}",DESC:"Add Agents to your newly created team. All the added agents will be notified when a conversation is assigned to this team."},EDIT_WIZARD_DETAILS:{TITLE:"Team details",ROUTE:"settings_teams_edit",BODY:"Change name, description and other details."},EDIT_WIZARD_AGENTS:{TITLE:"Edit Agents",ROUTE:"settings_teams_edit_members",BODY:"Edit agents in your team."},EDIT_WIZARD_FINISH:{TITLE:"Finish",ROUTE:"settings_teams_edit_finish",BODY:"You are all set to go!"}},TEAM_FORM:{ERROR_MESSAGE:"Couldn't save the team details. Try again."},AGENTS:{AGENT:"AGENT",EMAIL:"EMAIL",BUTTON_TEXT:"Add agents",ADD_AGENTS:"Adding Agents to your Team...",SELECT:"select",SELECT_ALL:"select all agents",SELECTED_COUNT:"{selected} out of {total} agents selected."},ADD:{TITLE:"Add agents to team - {teamName}",DESC:"Add Agents to your newly created team. This lets you collaborate as a team on conversations, get notified on new events in the same conversation.",SELECT:"select",SELECT_ALL:"select all agents",SELECTED_COUNT:"{selected} out of {total} agents selected.",BUTTON_TEXT:"Add agents",AGENT_VALIDATION_ERROR:"Select at least one agent."},FINISH:{TITLE:"Your team is ready!",MESSAGE:"You can now collaborate as a team on conversations. Happy supporting ",BUTTON_TEXT:"Finish"},DELETE:{BUTTON_TEXT:"Delete",API:{SUCCESS_MESSAGE:"Team deleted successfully.",ERROR_MESSAGE:"Couldn't delete the team. Try again."},CONFIRM:{TITLE:"Are you sure you want to delete the team?",PLACE_HOLDER:"Please type {teamName} to confirm",MESSAGE:"Deleting the team will remove the team assignment from the conversations assigned to this team.",YES:"Delete ",NO:"Cancel"}},SETTINGS:"Settings",FORM:{UPDATE:"Update team",CREATE:"Create team",NAME:{LABEL:"Team name",PLACEHOLDER:"Example: Sales, Customer Support"},DESCRIPTION:{LABEL:"Team Description",PLACEHOLDER:"Short description about this team."},AUTO_ASSIGN:{LABEL:"Allow auto assign for this team."},SUBMIT_CREATE:"Create team"}},HFe={TEAMS_SETTINGS:GFe},KFe={MODAL:{TITLE:"Whatsapp Templates",SUBTITLE:"Select the whatsapp template you want to send",TEMPLATE_SELECTED_SUBTITLE:"Process {templateName}"},PICKER:{SEARCH_PLACEHOLDER:"Search Templates",NO_TEMPLATES_FOUND:"No templates found for",LABELS:{LANGUAGE:"Language",TEMPLATE_BODY:"Template Body",CATEGORY:"Category"}},PARSER:{VARIABLES_LABEL:"Variables",VARIABLE_PLACEHOLDER:"Enter {variable} value",GO_BACK_LABEL:"Go Back",SEND_MESSAGE_LABEL:"Send Message",FORM_ERROR_MESSAGE:"Please fill all variables before sending"}},WFe={WHATSAPP_TEMPLATES:KFe},ZFe={...SBe,...MBe,...LBe,...NBe,...VBe,...PBe,...UBe,...zBe,...GBe,...KBe,...aPe,...mPe,...fPe,...IPe,...OPe,...RPe,...DPe,...BPe,...FPe,...WPe,...JPe,...XPe,..._Pe,...eFe,...aFe,...iFe,...sFe,...cFe,...kFe,...AFe,...yFe,...SFe,...FFe,...jFe,...qFe,...HFe,...WFe},ur=(t,e)=>{t.records=e},Ma=(t,e)=>{t.records.push(e)},Kc=(t,e)=>{const r=t.records.findIndex(a=>a.id===e.id);r>-1?t.records[r]=e:Ma(t,e)},ua=(t,e)=>{t.records.forEach((r,a)=>{r.id===e.id&&(t.records[a]=e)})},yp=(t,e)=>{t.records.forEach((r,a)=>{r.id===e.id&&(t.records[a]={...t.records[a],...e})})},JFe=(t,e)=>{t.records.forEach((r,a)=>{const o=e[r.id];t.records[a].availability_status=o||"offline"})},QFe=(t,{id:e,availabilityStatus:r})=>{const[a]=t.filter(o=>o.id===Number(e));a&&(a.availability_status=r)},da=(t,e)=>{t.records=t.records.filter(r=>r.id!==e)},p={AUTHENTICATE:"AUTHENTICATE",CLEAR_USER:"LOGOUT",SET_CURRENT_USER:"SET_CURRENT_USER",SET_CURRENT_USER_AVAILABILITY:"SET_CURRENT_USER_AVAILABILITY",SET_CURRENT_USER_AUTO_OFFLINE:"SET_CURRENT_USER_AUTO_OFFLINE",SET_CURRENT_USER_UI_SETTINGS:"SET_CURRENT_USER_UI_SETTINGS",SET_CURRENT_USER_UI_FLAGS:"SET_CURRENT_USER_UI_FLAGS",RECEIVE_CHAT_LIST:"RECEIVE_CHAT_LIST",SET_ALL_CONVERSATION:"SET_ALL_CONVERSATION",EMPTY_ALL_CONVERSATION:"EMPTY_ALL_CONVERSATION",SET_CONV_TAB_META:"SET_CONV_TAB_META",CLEAR_LIST_LOADING_STATUS:"CLEAR_LIST_LOADING_STATUS",SET_LIST_LOADING_STATUS:"SET_LIST_LOADING_STATUS",SET_ALL_MESSAGES_LOADED:"SET_ALL_MESSAGES_LOADED",CLEAR_ALL_MESSAGES_LOADED:"CLEAR_ALL_MESSAGES_LOADED",CHANGE_CHAT_STATUS_FILTER:"CHANGE_CHAT_STATUS_FILTER",CHANGE_CHAT_SORT_FILTER:"CHANGE_CHAT_SORT_FILTER",UPDATE_ASSIGNEE:"UPDATE_ASSIGNEE",UPDATE_CONVERSATION_CONTACT:"UPDATE_CONVERSATION_CONTACT",CLEAR_CONTACT_CONVERSATIONS:"CLEAR_CONTACT_CONVERSATIONS",SET_CONVERSATION_FILTERS:"SET_CONVERSATION_FILTERS",CLEAR_CONVERSATION_FILTERS:"CLEAR_CONVERSATION_FILTERS",SET_CONVERSATION_LAST_SEEN:"SET_CONVERSATION_LAST_SEEN",SET_LAST_MESSAGE_ID_IN_SYNC_CONVERSATION:"SET_LAST_MESSAGE_ID_FOR_SYNC_CONVERSATION",SET_DRAFT_MESSAGES:"SET_DRAFT_MESSAGES",REMOVE_DRAFT_MESSAGES:"REMOVE_DRAFT_MESSAGES",SET_REPLY_EDITOR_MODE:"SET_REPLY_EDITOR_MODE",SET_CURRENT_CHAT_WINDOW:"SET_CURRENT_CHAT_WINDOW",CLEAR_CURRENT_CHAT_WINDOW:"CLEAR_CURRENT_CHAT_WINDOW",CLEAR_ALL_MESSAGES:"CLEAR_ALL_MESSAGES",CHANGE_CONVERSATION_STATUS:"CHANGE_CONVERSATION_STATUS",ADD_CONVERSATION:"ADD_CONVERSATION",UPDATE_CONVERSATION:"UPDATE_CONVERSATION",MUTE_CONVERSATION:"MUTE_CONVERSATION",UNMUTE_CONVERSATION:"UNMUTE_CONVERSATION",ASSIGN_AGENT:"ASSIGN_AGENT",ASSIGN_TEAM:"ASSIGN_TEAM",ASSIGN_PRIORITY:"ASSIGN_PRIORITY",SET_CHAT_META:"SET_CHAT_META",ADD_MESSAGE:"ADD_MESSAGE",DELETE_MESSAGE:"DELETE_MESSAGE",ADD_PENDING_MESSAGE:"ADD_PENDING_MESSAGE",UPDATE_MESSAGE_UNREAD_COUNT:"UPDATE_MESSAGE_UNREAD_COUNT",SET_PREVIOUS_CONVERSATIONS:"SET_PREVIOUS_CONVERSATIONS",SET_ACTIVE_INBOX:"SET_ACTIVE_INBOX",UPDATE_CONVERSATION_CUSTOM_ATTRIBUTES:"UPDATE_CONVERSATION_CUSTOM_ATTRIBUTES",UPDATE_CONVERSATION_LAST_ACTIVITY:"UPDATE_CONVERSATION_LAST_ACTIVITY",SET_MISSING_MESSAGES:"SET_MISSING_MESSAGES",SET_ALL_ATTACHMENTS:"SET_ALL_ATTACHMENTS",ADD_CONVERSATION_ATTACHMENTS:"ADD_CONVERSATION_ATTACHMENTS",DELETE_CONVERSATION_ATTACHMENTS:"DELETE_CONVERSATION_ATTACHMENTS",DELETE_CONVERSATION:"DELETE_CONVERSATION",SET_CONVERSATION_CAN_REPLY:"SET_CONVERSATION_CAN_REPLY",SET_CONTEXT_MENU_CHAT_ID:"SET_CONTEXT_MENU_CHAT_ID",SET_CHAT_LIST_FILTERS:"SET_CHAT_LIST_FILTERS",UPDATE_CHAT_LIST_FILTERS:"UPDATE_CHAT_LIST_FILTERS",SET_INBOX_CAPTAIN_ASSISTANT:"SET_INBOX_CAPTAIN_ASSISTANT",SET_INBOXES_UI_FLAG:"SET_INBOXES_UI_FLAG",SET_INBOXES:"SET_INBOXES",SET_INBOX_ITEM:"SET_INBOX_ITEM",ADD_INBOXES:"ADD_INBOXES",EDIT_INBOXES:"EDIT_INBOXES",DELETE_INBOXES:"DELETE_INBOXES",SET_ACCOUNT_UI_FLAG:"SET_ACCOUNT_UI_FLAG",SET_ACCOUNT_LIMITS:"SET_ACCOUNT_LIMITS",SET_ACCOUNTS:"SET_ACCOUNTS",ADD_ACCOUNT:"ADD_ACCOUNT",EDIT_ACCOUNT:"EDIT_ACCOUNT",DELETE_ACCOUNT:"DELETE_AGENT",SET_AGENT_FETCHING_STATUS:"SET_AGENT_FETCHING_STATUS",SET_AGENT_CREATING_STATUS:"SET_AGENT_CREATING_STATUS",SET_AGENT_UPDATING_STATUS:"SET_AGENT_UPDATING_STATUS",SET_AGENT_DELETING_STATUS:"SET_AGENT_DELETING_STATUS",SET_AGENTS:"SET_AGENTS",ADD_AGENT:"ADD_AGENT",EDIT_AGENT:"EDIT_AGENT",DELETE_AGENT:"DELETE_AGENT",UPDATE_AGENTS_PRESENCE:"UPDATE_AGENTS_PRESENCE",UPDATE_SINGLE_AGENT_PRESENCE:"UPDATE_SINGLE_AGENT_PRESENCE",SET_CANNED_UI_FLAG:"SET_CANNED_UI_FLAG",SET_CANNED:"SET_CANNED",ADD_CANNED:"ADD_CANNED",EDIT_CANNED:"EDIT_CANNED",DELETE_CANNED:"DELETE_CANNED",SET_CUSTOM_ROLE_UI_FLAG:"SET_CUSTOM_ROLE_UI_FLAG",SET_CUSTOM_ROLE:"SET_CUSTOM_ROLE",ADD_CUSTOM_ROLE:"ADD_CUSTOM_ROLE",EDIT_CUSTOM_ROLE:"EDIT_CUSTOM_ROLE",DELETE_CUSTOM_ROLE:"DELETE_CUSTOM_ROLE",SET_LABEL_UI_FLAG:"SET_LABEL_UI_FLAG",SET_LABELS:"SET_LABELS",ADD_LABEL:"ADD_LABEL",EDIT_LABEL:"EDIT_LABEL",DELETE_LABEL:"DELETE_LABEL",SET_INTEGRATIONS_UI_FLAG:"SET_INTEGRATIONS_UI_FLAG",SET_INTEGRATIONS:"SET_INTEGRATIONS",ADD_INTEGRATION:"ADD_INTEGRATION",DELETE_INTEGRATION:"DELETE_INTEGRATION",ADD_INTEGRATION_HOOKS:"ADD_INTEGRATION_HOOKS",DELETE_INTEGRATION_HOOKS:"DELETE_INTEGRATION_HOOKS",SET_WEBHOOK_UI_FLAG:"SET_WEBHOOK_UI_FLAG",SET_WEBHOOK:"SET_WEBHOOK",ADD_WEBHOOK:"ADD_WEBHOOK",DELETE_WEBHOOK:"DELETE_WEBHOOK",UPDATE_WEBHOOK:"UPDATE_WEBHOOK",SET_CONTACT_META:"SET_CONTACT_META",SET_CONTACT_UI_FLAG:"SET_CONTACT_UI_FLAG",SET_CONTACT_ITEM:"SET_CONTACT_ITEM",SET_CONTACTS:"SET_CONTACTS",CLEAR_CONTACTS:"CLEAR_CONTACTS",EDIT_CONTACT:"EDIT_CONTACT",DELETE_CONTACT:"DELETE_CONTACT",UPDATE_CONTACTS_PRESENCE:"UPDATE_CONTACTS_PRESENCE",SET_CONTACT_FILTERS:"SET_CONTACT_FILTERS",CLEAR_CONTACT_FILTERS:"CLEAR_CONTACT_FILTERS",SET_NOTIFICATIONS_META:"SET_NOTIFICATIONS_META",SET_NOTIFICATIONS_UNREAD_COUNT:"SET_NOTIFICATIONS_UNREAD_COUNT",SET_NOTIFICATIONS_UI_FLAG:"SET_NOTIFICATIONS_UI_FLAG",UPDATE_NOTIFICATION:"UPDATE_NOTIFICATION",READ_NOTIFICATION:"READ_NOTIFICATION",ADD_NOTIFICATION:"ADD_NOTIFICATION",DELETE_NOTIFICATION:"DELETE_NOTIFICATION",UPDATE_ALL_NOTIFICATIONS:"UPDATE_ALL_NOTIFICATIONS",SET_NOTIFICATIONS_ITEM:"SET_NOTIFICATIONS_ITEM",SET_NOTIFICATIONS:"SET_NOTIFICATIONS",CLEAR_NOTIFICATIONS:"CLEAR_NOTIFICATIONS",EDIT_NOTIFICATIONS:"EDIT_NOTIFICATIONS",UPDATE_NOTIFICATIONS_PRESENCE:"UPDATE_NOTIFICATIONS_PRESENCE",SET_ALL_NOTIFICATIONS_LOADED:"SET_ALL_NOTIFICATIONS_LOADED",DELETE_READ_NOTIFICATIONS:"DELETE_READ_NOTIFICATIONS",DELETE_ALL_NOTIFICATIONS:"DELETE_ALL_NOTIFICATIONS",SNOOZE_NOTIFICATION:"SNOOZE_NOTIFICATION",SET_NOTIFICATION_FILTERS:"SET_NOTIFICATION_FILTERS",UPDATE_NOTIFICATION_FILTERS:"UPDATE_NOTIFICATION_FILTERS",SET_CONTACT_CONVERSATIONS_UI_FLAG:"SET_CONTACT_CONVERSATIONS_UI_FLAG",SET_CONTACT_CONVERSATIONS:"SET_CONTACT_CONVERSATIONS",ADD_CONTACT_CONVERSATION:"ADD_CONTACT_CONVERSATION",DELETE_CONTACT_CONVERSATION:"DELETE_CONTACT_CONVERSATION",SET_CONTACT_LABELS_UI_FLAG:"SET_CONTACT_LABELS_UI_FLAG",SET_CONTACT_LABELS:"SET_CONTACT_LABELS",SET_CONVERSATION_LABELS_UI_FLAG:"SET_CONVERSATION_LABELS_UI_FLAG",SET_CONVERSATION_LABELS:"SET_CONVERSATION_LABELS",SET_BULK_CONVERSATION_LABELS:"SET_BULK_CONVERSATION_LABELS",SET_SELECTED_CONVERSATION_IDS:"SET_SELECTED_CONVERSATION_IDS",CLEAR_SELECTED_CONVERSATION_IDS:"CLEAR_SELECTED_CONVERSATION_IDS",REMOVE_SELECTED_CONVERSATION_IDS:"REMOVE_SELECTED_CONVERSATION_IDS",SET_ACCOUNT_REPORTS:"SET_ACCOUNT_REPORTS",SET_HEATMAP_DATA:"SET_HEATMAP_DATA",TOGGLE_HEATMAP_LOADING:"TOGGLE_HEATMAP_LOADING",SET_ACCOUNT_SUMMARY:"SET_ACCOUNT_SUMMARY",SET_BOT_SUMMARY:"SET_BOT_SUMMARY",TOGGLE_ACCOUNT_REPORT_LOADING:"TOGGLE_ACCOUNT_REPORT_LOADING",SET_BOT_SUMMARY_STATUS:"SET_BOT_SUMMARY_STATUS",SET_ACCOUNT_SUMMARY_STATUS:"SET_ACCOUNT_SUMMARY_STATUS",SET_ACCOUNT_CONVERSATION_METRIC:"SET_ACCOUNT_CONVERSATION_METRIC",TOGGLE_ACCOUNT_CONVERSATION_METRIC_LOADING:"TOGGLE_ACCOUNT_CONVERSATION_METRIC_LOADING",SET_AGENT_CONVERSATION_METRIC:"SET_AGENT_CONVERSATION_METRIC",TOGGLE_AGENT_CONVERSATION_METRIC_LOADING:"TOGGLE_AGENT_CONVERSATION_METRIC_LOADING",SET_CONVERSATION_METADATA:"SET_CONVERSATION_METADATA",SET_CURRENT_PAGE:"SET_CURRENT_PAGE",SET_CONVERSATION_END_REACHED:"SET_CONVERSATION_END_REACHED",CLEAR_CONVERSATION_PAGE:"CLEAR_CONVERSATION_PAGE",SET_USER_NOTIFICATION_UI_FLAG:"SET_USER_NOTIFICATION_UI_FLAG",SET_USER_NOTIFICATION:"SET_USER_NOTIFICATION",ADD_USER_TYPING_TO_CONVERSATION:"ADD_USER_TYPING_TO_CONVERSATION",REMOVE_USER_TYPING_FROM_CONVERSATION:"REMOVE_USER_TYPING_FROM_CONVERSATION",SEARCH_CONVERSATIONS_SET:"SEARCH_CONVERSATIONS_SET",SEARCH_CONVERSATIONS_SET_UI_FLAG:"SEARCH_CONVERSATIONS_SET_UI_FLAG",SET_CAMPAIGN_UI_FLAG:"SET_CAMPAIGN_UI_FLAG",SET_CAMPAIGNS:"SET_CAMPAIGNS",ADD_CAMPAIGN:"ADD_CAMPAIGN",EDIT_CAMPAIGN:"EDIT_CAMPAIGN",DELETE_CAMPAIGN:"DELETE_CAMPAIGN",SET_CONTACT_NOTES_UI_FLAG:"SET_CONTACT_NOTES_UI_FLAG",SET_CONTACT_NOTES:"SET_CONTACT_NOTES",ADD_CONTACT_NOTE:"ADD_CONTACT_NOTE",EDIT_CONTACT_NOTE:"EDIT_CONTACT_NOTE",DELETE_CONTACT_NOTE:"DELETE_CONTACT_NOTE",SET_CSAT_RESPONSE_UI_FLAG:"SET_CSAT_RESPONSE_UI_FLAG",SET_CSAT_RESPONSE:"SET_CSAT_RESPONSE",SET_CSAT_RESPONSE_METRICS:"SET_CSAT_RESPONSE_METRICS",SET_CUSTOM_ATTRIBUTE_UI_FLAG:"SET_CUSTOM_ATTRIBUTE_UI_FLAG",SET_CUSTOM_ATTRIBUTE:"SET_CUSTOM_ATTRIBUTE",ADD_CUSTOM_ATTRIBUTE:"ADD_CUSTOM_ATTRIBUTE",EDIT_CUSTOM_ATTRIBUTE:"EDIT_CUSTOM_ATTRIBUTE",DELETE_CUSTOM_ATTRIBUTE:"DELETE_CUSTOM_ATTRIBUTE",SET_AUTOMATION_UI_FLAG:"SET_AUTOMATION_UI_FLAG",SET_AUTOMATIONS:"SET_AUTOMATIONS",ADD_AUTOMATION:"ADD_AUTOMATION",EDIT_AUTOMATION:"EDIT_AUTOMATION",DELETE_AUTOMATION:"DELETE_AUTOMATION",SET_CUSTOM_VIEW_UI_FLAG:"SET_CUSTOM_VIEW_UI_FLAG",SET_CUSTOM_VIEW:"SET_CUSTOM_VIEW",ADD_CUSTOM_VIEW:"ADD_CUSTOM_VIEW",UPDATE_CUSTOM_VIEW:"UPDATE_CUSTOM_VIEW",DELETE_CUSTOM_VIEW:"DELETE_CUSTOM_VIEW",SET_ACTIVE_CONVERSATION_FOLDER:"SET_ACTIVE_CONVERSATION_FOLDER",SET_BULK_ACTIONS_FLAG:"SET_BULK_ACTIONS_FLAG",SET_DASHBOARD_APPS_UI_FLAG:"SET_DASHBOARD_APPS_UI_FLAG",SET_DASHBOARD_APPS:"SET_DASHBOARD_APPS",CREATE_DASHBOARD_APP:"CREATE_DASHBOARD_APP",EDIT_DASHBOARD_APP:"EDIT_DASHBOARD_APP",DELETE_DASHBOARD_APP:"DELETE_DASHBOARD_APP",ADD_ARTICLE:"ADD_ARTICLE",ADD_ARTICLE_ID:"ADD_ARTICLE_ID",ADD_MANY_ARTICLES:"ADD_MANY_ARTICLES",ADD_MANY_ARTICLES_ID:"ADD_MANY_ARTICLES_ID",SET_ARTICLES_META:"SET_ARTICLES_META",UPDATE_ARTICLE_FLAG:"UPDATE_ARTICLE_FLAG",ADD_ARTICLE_FLAG:"ADD_ARTICLE_FLAG",UPDATE_ARTICLE:"UPDATE_ARTICLE",CLEAR_ARTICLES:"CLEAR_ARTICLES",REMOVE_ARTICLE:"REMOVE_ARTICLE",REMOVE_ARTICLE_ID:"REMOVE_ARTICLE_ID",SET_UI_FLAG:"SET_UI_FLAG",ADD_CATEGORY:"ADD_CATEGORY",ADD_CATEGORY_ID:"ADD_CATEGORY_ID",ADD_MANY_CATEGORIES:"ADD_MANY_CATEGORIES",ADD_MANY_CATEGORIES_ID:"ADD_MANY_CATEGORIES_ID",ADD_CATEGORY_FLAG:"ADD_CATEGORY_FLAG",CLEAR_CATEGORIES:"CLEAR_CATEGORIES",UPDATE_CATEGORY:"UPDATE_CATEGORY",REMOVE_CATEGORY:"REMOVE_CATEGORY",REMOVE_CATEGORY_ID:"REMOVE_CATEGORY_ID",SET_AGENT_BOT_UI_FLAG:"SET_AGENT_BOT_UI_FLAG",SET_AGENT_BOTS:"SET_AGENT_BOTS",ADD_AGENT_BOT:"ADD_AGENT_BOT",EDIT_AGENT_BOT:"EDIT_AGENT_BOT",DELETE_AGENT_BOT:"DELETE_AGENT_BOT",SET_AGENT_BOT_INBOX:"SET_AGENT_BOT_INBOX",UPDATE_AGENT_BOT_AVATAR:"UPDATE_AGENT_BOT_AVATAR",SET_MACROS_UI_FLAG:"SET_MACROS_UI_FLAG",SET_MACROS:"SET_MACROS",ADD_MACRO:"ADD_MACRO",EDIT_MACRO:"EDIT_MACRO",DELETE_MACRO:"DELETE_MACRO",FULL_SEARCH_SET:"FULL_SEARCH_SET",CONTACT_SEARCH_SET:"CONTACT_SEARCH_SET",CONTACT_SEARCH_SET_UI_FLAG:"CONTACT_SEARCH_SET_UI_FLAG",CONVERSATION_SEARCH_SET:"CONVERSATION_SEARCH_SET",CONVERSATION_SEARCH_SET_UI_FLAG:"CONVERSATION_SEARCH_SET_UI_FLAG",MESSAGE_SEARCH_SET:"MESSAGE_SEARCH_SET",ARTICLE_SEARCH_SET:"ARTICLE_SEARCH_SET",CLEAR_SEARCH_RESULTS:"CLEAR_SEARCH_RESULTS",MESSAGE_SEARCH_SET_UI_FLAG:"MESSAGE_SEARCH_SET_UI_FLAG",ARTICLE_SEARCH_SET_UI_FLAG:"ARTICLE_SEARCH_SET_UI_FLAG",FULL_SEARCH_SET_UI_FLAG:"FULL_SEARCH_SET_UI_FLAG",SET_CONVERSATION_PARTICIPANTS_UI_FLAG:"SET_CONVERSATION_PARTICIPANTS_UI_FLAG",SET_CONVERSATION_PARTICIPANTS:"SET_CONVERSATION_PARTICIPANTS",SET_AUDIT_LOGS_UI_FLAG:"SET_AUDIT_LOGS_UI_FLAG",SET_AUDIT_LOGS:"SET_AUDIT_LOGS",SET_AUDIT_LOGS_META:"SET_AUDIT_LOGS_META",SET_SLA_UI_FLAG:"SET_SLA_UI_FLAG",SET_SLA:"SET_SLA",ADD_SLA:"ADD_SLA",EDIT_SLA:"EDIT_SLA",DELETE_SLA:"DELETE_SLA",SET_SLA_REPORTS_UI_FLAG:"SET_SLA_REPORTS_UI_FLAG",SET_SLA_REPORTS:"SET_SLA_REPORTS",SET_SLA_REPORTS_METRICS:"SET_SLA_REPORTS_METRICS",SET_SLA_REPORTS_META:"SET_SLA_REPORTS_META",SET_TEAM_CONVERSATION_METRIC:"SET_TEAM_CONVERSATION_METRIC",TOGGLE_TEAM_CONVERSATION_METRIC_LOADING:"TOGGLE_TEAM_CONVERSATION_METRIC_LOADING"};class XFe extends Fe{constructor(){super("",{accountScoped:!0})}createAccount(e){return axios.post(`${this.apiVersion}/accounts`,e)}async getCacheKeys(){return(await axios.get(`/api/v1/accounts/${this.accountIdFromRoute}/cache_keys`)).data.cache_keys}}const e1=new XFe;class YFe extends Fe{constructor(){super("",{accountScoped:!0,enterprise:!0})}checkout(){return axios.post(`${this.url}checkout`)}subscription(){return axios.post(`${this.url}subscription`)}getLimits(){return axios.get(`${this.url}limits`)}toggleDeletion(e){return axios.post(`${this.url}toggle_deletion`,{action_type:e})}}const I2=new YFe;/*! js-cookie v3.0.5 | MIT */function M2(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var a in r)t[a]=r[a]}return t}var _Fe={read:function(t){return t[0]==='"'&&(t=t.slice(1,-1)),t.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(t){return encodeURIComponent(t).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function Tp(t,e){function r(o,i,n){if(!(typeof document>"u")){n=M2({},e,n),typeof n.expires=="number"&&(n.expires=new Date(Date.now()+n.expires*864e5)),n.expires&&(n.expires=n.expires.toUTCString()),o=encodeURIComponent(o).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var s="";for(var l in n)n[l]&&(s+="; "+l,n[l]!==!0&&(s+="="+n[l].split(";")[0]));return document.cookie=o+"="+t.write(i,o)+s}}function a(o){if(!(typeof document>"u"||arguments.length&&!o)){for(var i=document.cookie?document.cookie.split("; "):[],n={},s=0;s<i.length;s++){var l=i[s].split("="),c=l.slice(1).join("=");try{var u=decodeURIComponent(l[0]);if(n[u]=t.read(c,u),o===u)break}catch{}}return o?n[o]:n}}return Object.create({set:r,get:a,remove:function(o,i){r(o,"",M2({},i,{expires:-1}))},withAttributes:function(o){return Tp(this.converter,M2({},this.attributes,o))},withConverter:function(o){return Tp(M2({},this.converter,o),this.attributes)}},{attributes:{value:Object.freeze(e)},converter:{value:Object.freeze(t)}})}var Wl=Tp(_Fe,{path:"/"});const tw={IMPERSONATION_USER:"impersonationUser"},rw={clearAll(){window.sessionStorage.clear()},get(t){try{const e=window.sessionStorage.getItem(t);return e?JSON.parse(e):null}catch{return window.sessionStorage.getItem(t)}},set(t,e){typeof e=="object"?window.sessionStorage.setItem(t,JSON.stringify(e)):window.sessionStorage.setItem(t,e)},remove(t){window.sessionStorage.removeItem(t)}},$Fe="CHATWOOT_SET_USER",eUe="CHATWOOT_RESET",tUe="ANALYTICS_IDENTITY",rUe="ANALYTICS_RESET";Wl.defaults={sameSite:"Lax"};const aUe=t=>{yr.emit($Fe,{user:t}),yr.emit(tUe,{user:t})},oUe=()=>{Wl.remove("cw_d_session_info"),Wl.remove("auth_data"),Wl.remove("user")},iUe=()=>{rc.remove(ac.DRAFT_MESSAGES)},nUe=()=>{rw.remove(tw.IMPERSONATION_USER)},sUe=async()=>{let t=[];try{t=await window.indexedDB.databases(),t=t.map(e=>e.name)}catch{t=JSON.parse(localStorage.getItem("cw-idb-names")||"[]")}t.forEach(e=>{const r=window.indexedDB.deleteDatabase(e);r.onerror=a=>{console.error(`Error deleting database ${e}.`,a)},r.onsuccess=()=>{console.log(`Database ${e} deleted successfully.`)}}),localStorage.removeItem("cw-idb-names")},WI=()=>{yr.emit(eUe),yr.emit(rUe),oUe(),iUe(),nUe();const e=(window.globalConfig||{}).LOGOUT_REDIRECT_LINK||"/";window.location=e},lUe=t=>{var e,r,a,o,i,n,s,l,c,u,d,g;return(r=(e=t==null?void 0:t.response)==null?void 0:e.data)!=null&&r.message?(o=(a=t==null?void 0:t.response)==null?void 0:a.data)==null?void 0:o.message:(n=(i=t==null?void 0:t.response)==null?void 0:i.data)!=null&&n.error?(l=(s=t==null?void 0:t.response)==null?void 0:s.data)==null?void 0:l.error:(u=(c=t==null?void 0:t.response)==null?void 0:c.data)!=null&&u.errors?(g=(d=t==null?void 0:t.response)==null?void 0:d.data)==null?void 0:g.errors[0]:t},Me=t=>{const e=lUe(t);throw new Error(e)},cUe=(t="")=>["ar","as","fa","he","ku","ur"].includes(t),O2=(t,e)=>t.records.find(r=>r.id===Number(e))||{},uUe=15,dUe={records:[],uiFlags:{isFetching:!1,isFetchingItem:!1,isUpdating:!1,isCheckoutInProcess:!1}},gUe={getAccount:t=>e=>O2(t,e),getUIFlags(t){return t.uiFlags},isRTL:(t,e,r)=>{var i,n;const a=(n=(i=r.route)==null?void 0:i.params)==null?void 0:n.accountId;if(!a)return!1;const{locale:o}=O2(t,Number(a));return o?cUe(o):!1},isTrialAccount:t=>e=>{const r=O2(t,e),a=new Date(r.created_at);return az(new Date,a)<=uUe},isFeatureEnabledonAccount:t=>(e,r)=>{const{features:a={}}=O2(t,e);return a[r]||!1}},hUe={get:async({commit:t})=>{t(p.SET_ACCOUNT_UI_FLAG,{isFetchingItem:!0});try{const e=await e1.get();t(p.ADD_ACCOUNT,e.data),t(p.SET_ACCOUNT_UI_FLAG,{isFetchingItem:!1})}catch{t(p.SET_ACCOUNT_UI_FLAG,{isFetchingItem:!1})}},update:async({commit:t},{options:e,...r})=>{(e==null?void 0:e.silent)!==!0&&t(p.SET_ACCOUNT_UI_FLAG,{isUpdating:!0});try{const a=await e1.update("",r);t(p.EDIT_ACCOUNT,a.data),t(p.SET_ACCOUNT_UI_FLAG,{isUpdating:!1})}catch(a){throw t(p.SET_ACCOUNT_UI_FLAG,{isUpdating:!1}),new Error(a)}},delete:async({commit:t},{id:e})=>{t(p.SET_ACCOUNT_UI_FLAG,{isUpdating:!0});try{await e1.delete(e),t(p.SET_ACCOUNT_UI_FLAG,{isUpdating:!1})}catch(r){throw t(p.SET_ACCOUNT_UI_FLAG,{isUpdating:!1}),new Error(r)}},toggleDeletion:async({commit:t},{action_type:e}={action_type:"delete"})=>{t(p.SET_ACCOUNT_UI_FLAG,{isUpdating:!0});try{await I2.toggleDeletion(e),t(p.SET_ACCOUNT_UI_FLAG,{isUpdating:!1})}catch(r){throw t(p.SET_ACCOUNT_UI_FLAG,{isUpdating:!1}),new Error(r)}},create:async({commit:t},e)=>{t(p.SET_ACCOUNT_UI_FLAG,{isCreating:!0});try{const a=(await e1.createAccount(e)).data.data.account_id;return t(p.SET_ACCOUNT_UI_FLAG,{isCreating:!1}),a}catch(r){throw t(p.SET_ACCOUNT_UI_FLAG,{isCreating:!1}),r}},checkout:async({commit:t})=>{t(p.SET_ACCOUNT_UI_FLAG,{isCheckoutInProcess:!0});try{const e=await I2.checkout();window.location=e.data.redirect_url}catch(e){Me(e)}finally{t(p.SET_ACCOUNT_UI_FLAG,{isCheckoutInProcess:!1})}},subscription:async({commit:t})=>{t(p.SET_ACCOUNT_UI_FLAG,{isCheckoutInProcess:!0});try{await I2.subscription()}catch(e){Me(e)}finally{t(p.SET_ACCOUNT_UI_FLAG,{isCheckoutInProcess:!1})}},limits:async({commit:t})=>{try{const e=await I2.getLimits();t(p.SET_ACCOUNT_LIMITS,e.data)}catch{}},getCacheKeys:async()=>e1.getCacheKeys()},mUe={[p.SET_ACCOUNT_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.ADD_ACCOUNT]:Kc,[p.EDIT_ACCOUNT]:ua,[p.SET_ACCOUNT_LIMITS]:yp},pUe={namespaced:!0,state:dUe,getters:gUe,actions:hUe,mutations:mUe};class fUe extends Fe{constructor(){super("agent_bots",{accountScoped:!0})}create(e){return axios.post(this.url,e,{headers:{"Content-Type":"multipart/form-data"}})}update(e,r){return axios.patch(`${this.url}/${e}`,r,{headers:{"Content-Type":"multipart/form-data"}})}deleteAgentBotAvatar(e){return axios.delete(`${this.url}/${e}/avatar`)}resetAccessToken(e){return axios.post(`${this.url}/${e}/reset_access_token`)}}const es=new fUe,Sp=(t,e)=>e.some(r=>t instanceof r);let tk,rk;function wUe(){return tk||(tk=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function vUe(){return rk||(rk=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const Ip=new WeakMap,b3=new WeakMap,qg=new WeakMap;function bUe(t){const e=new Promise((r,a)=>{const o=()=>{t.removeEventListener("success",i),t.removeEventListener("error",n)},i=()=>{r(Os(t.result)),o()},n=()=>{a(t.error),o()};t.addEventListener("success",i),t.addEventListener("error",n)});return qg.set(e,t),e}function EUe(t){if(Ip.has(t))return;const e=new Promise((r,a)=>{const o=()=>{t.removeEventListener("complete",i),t.removeEventListener("error",n),t.removeEventListener("abort",n)},i=()=>{r(),o()},n=()=>{a(t.error||new DOMException("AbortError","AbortError")),o()};t.addEventListener("complete",i),t.addEventListener("error",n),t.addEventListener("abort",n)});Ip.set(t,e)}let Mp={get(t,e,r){if(t instanceof IDBTransaction){if(e==="done")return Ip.get(t);if(e==="store")return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return Os(t[e])},set(t,e,r){return t[e]=r,!0},has(t,e){return t instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in t}};function ZI(t){Mp=t(Mp)}function kUe(t){return vUe().includes(t)?function(...e){return t.apply(Op(this),e),Os(this.request)}:function(...e){return Os(t.apply(Op(this),e))}}function CUe(t){return typeof t=="function"?kUe(t):(t instanceof IDBTransaction&&EUe(t),Sp(t,wUe())?new Proxy(t,Mp):t)}function Os(t){if(t instanceof IDBRequest)return bUe(t);if(b3.has(t))return b3.get(t);const e=CUe(t);return e!==t&&(b3.set(t,e),qg.set(e,t)),e}const Op=t=>qg.get(t);function AUe(t,e,{blocked:r,upgrade:a,blocking:o,terminated:i}={}){const n=indexedDB.open(t,e),s=Os(n);return a&&n.addEventListener("upgradeneeded",l=>{a(Os(n.result),l.oldVersion,l.newVersion,Os(n.transaction),l)}),r&&n.addEventListener("blocked",l=>r(l.oldVersion,l.newVersion,l)),s.then(l=>{i&&l.addEventListener("close",()=>i()),o&&l.addEventListener("versionchange",c=>o(c.oldVersion,c.newVersion,c))}).catch(()=>{}),s}const xUe=["get","getKey","getAll","getAllKeys","count"],yUe=["put","add","delete","clear"],E3=new Map;function ak(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(E3.get(e))return E3.get(e);const r=e.replace(/FromIndex$/,""),a=e!==r,o=yUe.includes(r);if(!(r in(a?IDBIndex:IDBObjectStore).prototype)||!(o||xUe.includes(r)))return;const i=async function(n,...s){const l=this.transaction(n,o?"readwrite":"readonly");let c=l.store;return a&&(c=c.index(s.shift())),(await Promise.all([c[r](...s),o&&l.done]))[0]};return E3.set(e,i),i}ZI(t=>({...t,get:(e,r,a)=>ak(e,r)||t.get(e,r,a),has:(e,r)=>!!ak(e,r)||t.has(e,r)}));const TUe=["continue","continuePrimaryKey","advance"],ok={},Lp=new WeakMap,JI=new WeakMap,SUe={get(t,e){if(!TUe.includes(e))return t[e];let r=ok[e];return r||(r=ok[e]=function(...a){Lp.set(this,JI.get(this)[e](...a))}),r}};async function*IUe(...t){let e=this;if(e instanceof IDBCursor||(e=await e.openCursor(...t)),!e)return;e=e;const r=new Proxy(e,SUe);for(JI.set(r,e),qg.set(r,Op(e));e;)yield r,e=await(Lp.get(r)||e.continue()),Lp.delete(r)}function ik(t,e){return e===Symbol.asyncIterator&&Sp(t,[IDBIndex,IDBObjectStore,IDBCursor])||e==="iterate"&&Sp(t,[IDBIndex,IDBObjectStore])}ZI(t=>({...t,get(e,r,a){return ik(e,r)?IUe:t.get(e,r,a)},has(e,r){return ik(e,r)||t.has(e,r)}}));const MUe="1678706392";class OUe{constructor(e){this.modelsToSync=["inbox","label","team"],this.accountId=e,this.db=null}async initDb(){if(this.db)return this.db;const e=`cw-store-${this.accountId}`;this.db=await AUe(`cw-store-${this.accountId}`,MUe,{upgrade(a){a.createObjectStore("cache-keys"),a.createObjectStore("inbox",{keyPath:"id"}),a.createObjectStore("label",{keyPath:"id"}),a.createObjectStore("team",{keyPath:"id"})}});const r=JSON.parse(localStorage.getItem("cw-idb-names")||"[]");return r.includes(e)||(r.push(e),localStorage.setItem("cw-idb-names",JSON.stringify(r))),this.db}validateModel(e){if(!e)throw new Error("Model name is not defined");if(!this.modelsToSync.includes(e))throw new Error(`Model ${e} is not defined`);return!0}async replace({modelName:e,data:r}){return this.validateModel(e),this.db.clear(e),this.push({modelName:e,data:r})}async push({modelName:e,data:r}){if(this.validateModel(e),Array.isArray(r)){const a=this.db.transaction(e,"readwrite");r.forEach(o=>{a.store.add(o)}),await a.done}else await this.db.add(e,r)}async get({modelName:e}){return this.validateModel(e),this.db.getAll(e)}async setCacheKeys(e){Object.keys(e).forEach(async r=>{this.db.put("cache-keys",e[r],r)})}async getCacheKey(e){return this.validateModel(e),this.db.get("cache-keys",e)}}class aw extends Fe{constructor(e,r={}){super(e,r),this.dataManager=new OUe(this.accountIdFromRoute)}get cacheModelName(){throw new Error("cacheModelName is not defined")}get(e=!1){return e?this.getFromCache():this.getFromNetwork()}getFromNetwork(){return axios.get(this.url)}extractDataFromResponse(e){return e.data.payload}marshallData(e){return{data:{payload:e}}}async getFromCache(){try{await this.dataManager.initDb()}catch{return this.getFromNetwork()}const{data:e}=await axios.get(`/api/v1/accounts/${this.accountIdFromRoute}/cache_keys`),r=e.cache_keys[this.cacheModelName],a=await this.validateCacheKey(r);let o=[];return a&&(o=await this.dataManager.get({modelName:this.cacheModelName})),o.length===0?this.refetchAndCommit(r):this.marshallData(o)}async refetchAndCommit(e=null){const r=await this.getFromNetwork();try{await this.dataManager.initDb(),this.dataManager.replace({modelName:this.cacheModelName,data:this.extractDataFromResponse(r)}),await this.dataManager.setCacheKeys({[this.cacheModelName]:e})}catch{}return r}async validateCacheKey(e){this.dataManager.db||await this.dataManager.initDb();const r=await this.dataManager.getCacheKey(this.cacheModelName);return e===r}}const LUe=window.__WOOT_ISOLATED_SHELL__?Fe:aw;class RUe extends LUe{constructor(){super("inboxes",{accountScoped:!0})}get cacheModelName(){return"inbox"}getCampaigns(e){return axios.get(`${this.url}/${e}/campaigns`)}deleteInboxAvatar(e){return axios.delete(`${this.url}/${e}/avatar`)}getAgentBot(e){return axios.get(`${this.url}/${e}/agent_bot`)}setAgentBot(e,r){return axios.post(`${this.url}/${e}/set_agent_bot`,{agent_bot:r})}}const ho=new RUe,NUe={records:[],uiFlags:{isFetching:!1,isFetchingItem:!1,isCreating:!1,isDeleting:!1,isUpdating:!1,isUpdatingAvatar:!1,isFetchingAgentBot:!1,isSettingAgentBot:!1,isDisconnecting:!1},agentBotInbox:{}},QI={getBots(t){return t.records},getUIFlags(t){return t.uiFlags},getBot:t=>e=>{const[r]=t.records.filter(a=>a.id===Number(e));return r||{}},getActiveAgentBot:t=>e=>{const r=t.agentBotInbox[Number(e)];return QI.getBot(t)(r)}},DUe={get:async({commit:t})=>{t(p.SET_AGENT_BOT_UI_FLAG,{isFetching:!0});try{const e=await es.get();t(p.SET_AGENT_BOTS,e.data)}catch{}finally{t(p.SET_AGENT_BOT_UI_FLAG,{isFetching:!1})}},create:async({commit:t},e)=>{t(p.SET_AGENT_BOT_UI_FLAG,{isCreating:!0});try{const r=new FormData;r.append("name",e.name),r.append("description",e.description),r.append("bot_type",e.bot_type||"webhook"),r.append("outgoing_url",e.outgoing_url),e.avatar&&r.append("avatar",e.avatar);const a=await es.create(r);return t(p.ADD_AGENT_BOT,a.data),a.data}catch(r){Me(r)}finally{t(p.SET_AGENT_BOT_UI_FLAG,{isCreating:!1})}return null},update:async({commit:t},{id:e,data:r})=>{t(p.SET_AGENT_BOT_UI_FLAG,{isUpdating:!0});try{const a=new FormData;a.append("name",r.name),a.append("description",r.description),a.append("bot_type",r.bot_type||"webhook"),a.append("outgoing_url",r.outgoing_url),r.avatar&&a.append("avatar",r.avatar);const o=await es.update(e,a);t(p.EDIT_AGENT_BOT,o.data)}catch(a){Me(a)}finally{t(p.SET_AGENT_BOT_UI_FLAG,{isUpdating:!1})}},delete:async({commit:t},e)=>{t(p.SET_AGENT_BOT_UI_FLAG,{isDeleting:!0});try{await es.delete(e),t(p.DELETE_AGENT_BOT,e)}catch(r){Me(r)}finally{t(p.SET_AGENT_BOT_UI_FLAG,{isDeleting:!1})}},deleteAgentBotAvatar:async({commit:t},e)=>{t(p.SET_AGENT_BOT_UI_FLAG,{isUpdatingAvatar:!0});try{await es.deleteAgentBotAvatar(e),t(p.UPDATE_AGENT_BOT_AVATAR,{id:e,thumbnail:""})}catch(r){Me(r)}finally{t(p.SET_AGENT_BOT_UI_FLAG,{isUpdatingAvatar:!1})}},show:async({commit:t},e)=>{t(p.SET_AGENT_BOT_UI_FLAG,{isFetchingItem:!0});try{const{data:r}=await es.show(e);t(p.ADD_AGENT_BOT,r)}catch(r){Me(r)}finally{t(p.SET_AGENT_BOT_UI_FLAG,{isFetchingItem:!1})}},fetchAgentBotInbox:async({commit:t},e)=>{t(p.SET_AGENT_BOT_UI_FLAG,{isFetchingAgentBot:!0});try{const{data:r}=await ho.getAgentBot(e),{agent_bot:a={}}=r||{};t(p.SET_AGENT_BOT_INBOX,{agentBotId:a.id,inboxId:e})}catch(r){Me(r)}finally{t(p.SET_AGENT_BOT_UI_FLAG,{isFetchingAgentBot:!1})}},setAgentBotInbox:async({commit:t},{inboxId:e,botId:r})=>{t(p.SET_AGENT_BOT_UI_FLAG,{isSettingAgentBot:!0});try{await ho.setAgentBot(e,r),t(p.SET_AGENT_BOT_INBOX,{agentBotId:r,inboxId:e})}catch(a){Me(a)}finally{t(p.SET_AGENT_BOT_UI_FLAG,{isSettingAgentBot:!1})}},disconnectBot:async({commit:t},{inboxId:e})=>{t(p.SET_AGENT_BOT_UI_FLAG,{isDisconnecting:!0});try{await ho.setAgentBot(e,null),t(p.SET_AGENT_BOT_INBOX,{agentBotId:"",inboxId:e})}catch(r){Me(r)}finally{t(p.SET_AGENT_BOT_UI_FLAG,{isDisconnecting:!1})}},resetAccessToken:async({commit:t},e)=>{try{const r=await es.resetAccessToken(e);return t(p.EDIT_AGENT_BOT,r.data),r.data}catch(r){return Me(r),null}}},VUe={[p.SET_AGENT_BOT_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.ADD_AGENT_BOT]:Kc,[p.SET_AGENT_BOTS]:ur,[p.EDIT_AGENT_BOT]:ua,[p.DELETE_AGENT_BOT]:da,[p.SET_AGENT_BOT_INBOX](t,{agentBotId:e,inboxId:r}){t.agentBotInbox={...t.agentBotInbox,[r]:e}},[p.UPDATE_AGENT_BOT_AVATAR](t,{id:e,thumbnail:r}){const a=t.records.findIndex(o=>o.id===e);a!==-1&&(t.records[a].thumbnail=r||"")}},BUe={namespaced:!0,actions:DUe,state:NUe,getters:QI,mutations:VUe};class PUe extends Fe{constructor(){super("agents",{accountScoped:!0})}bulkInvite({emails:e}){return axios.post(`${this.url}/bulk_create`,{emails:e})}}const L2=new PUe,FUe={records:[],uiFlags:{isFetching:!1,isCreating:!1,isUpdating:!1,isDeleting:!1}},UUe={getAgents(t){return t.records},getVerifiedAgents(t){return t.records.filter(e=>e.confirmed)},getUIFlags(t){return t.uiFlags},getAgentById:t=>e=>t.records.find(r=>r.id===Number(e))||{},getAgentStatus(t){return{online:t.records.filter(r=>r.availability_status==="online").length,busy:t.records.filter(r=>r.availability_status==="busy").length,offline:t.records.filter(r=>r.availability_status==="offline").length}}},jUe={get:async({commit:t})=>{t(p.SET_AGENT_FETCHING_STATUS,!0);try{const e=await L2.get();t(p.SET_AGENT_FETCHING_STATUS,!1),t(p.SET_AGENTS,e.data)}catch{t(p.SET_AGENT_FETCHING_STATUS,!1)}},create:async({commit:t},e)=>{t(p.SET_AGENT_CREATING_STATUS,!0);try{const r=await L2.create(e);t(p.ADD_AGENT,r.data),t(p.SET_AGENT_CREATING_STATUS,!1)}catch(r){throw t(p.SET_AGENT_CREATING_STATUS,!1),r}},update:async({commit:t},{id:e,...r})=>{t(p.SET_AGENT_UPDATING_STATUS,!0);try{const a=await L2.update(e,r);t(p.EDIT_AGENT,a.data),t(p.SET_AGENT_UPDATING_STATUS,!1)}catch(a){throw t(p.SET_AGENT_UPDATING_STATUS,!1),new Error(a)}},updateSingleAgentPresence:({commit:t},{id:e,availabilityStatus:r})=>{t(p.UPDATE_SINGLE_AGENT_PRESENCE,{id:e,availabilityStatus:r})},updatePresence:async({commit:t},e)=>{t(p.UPDATE_AGENTS_PRESENCE,e)},delete:async({commit:t},e)=>{t(p.SET_AGENT_DELETING_STATUS,!0);try{await L2.delete(e),t(p.DELETE_AGENT,e),t(p.SET_AGENT_DELETING_STATUS,!1)}catch(r){throw t(p.SET_AGENT_DELETING_STATUS,!1),new Error(r)}}},zUe={[p.SET_AGENT_FETCHING_STATUS](t,e){t.uiFlags.isFetching=e},[p.SET_AGENT_CREATING_STATUS](t,e){t.uiFlags.isCreating=e},[p.SET_AGENT_UPDATING_STATUS](t,e){t.uiFlags.isUpdating=e},[p.SET_AGENT_DELETING_STATUS](t,e){t.uiFlags.isDeleting=e},[p.SET_AGENTS]:ur,[p.ADD_AGENT]:Ma,[p.EDIT_AGENT]:ua,[p.DELETE_AGENT]:da,[p.UPDATE_AGENTS_PRESENCE]:JFe,[p.UPDATE_SINGLE_AGENT_PRESENCE]:(t,{id:e,availabilityStatus:r})=>QFe(t.records,{id:e,availabilityStatus:r})},qUe={namespaced:!0,state:FUe,getters:UUe,actions:jUe,mutations:zUe},GUe={uiFlags:t=>e=>{const r=t.articles.uiFlags.byId[e];return r||{isFetching:!1,isUpdating:!1,isDeleting:!1}},isFetching:t=>t.uiFlags.isFetching,articleById:(...t)=>e=>{const[r]=t,a=r.articles.byId[e];if(a)return a},allArticles:(...t)=>{const[e,r]=t;return e.articles.allIds.map(o=>r.articleById(o)).filter(o=>o!==void 0)},articleStatus:(...t)=>e=>{const[r]=t,a=r.articles.byId[e];if(a)return a.status},getMeta:t=>t.meta};class ow extends Fe{constructor(){super("portals",{accountScoped:!0})}getPortal({portalSlug:e,locale:r}){return axios.get(`${this.url}/${e}?locale=${r}`)}updatePortal({portalSlug:e,portalObj:r}){return axios.patch(`${this.url}/${e}`,r)}deletePortal(e){return axios.delete(`${this.url}/${e}`)}deleteLogo(e){return axios.delete(`${this.url}/${e}/logo`)}}class HUe extends ow{constructor(){super("articles",{accountScoped:!0})}getArticles({pageNumber:e,portalSlug:r,locale:a,status:o,authorId:i,categorySlug:n,sort:s}){const l=z8({pageNumber:e,portalSlug:r,locale:a,status:o,authorId:i,categorySlug:n,sort:s,host:this.url});return axios.get(l)}searchArticles({portalSlug:e,query:r}){const a=z8({portalSlug:e,query:r,host:this.url});return axios.get(a)}getArticle({id:e,portalSlug:r}){return axios.get(`${this.url}/${r}/articles/${e}`)}updateArticle({portalSlug:e,articleId:r,articleObj:a}){return axios.patch(`${this.url}/${e}/articles/${r}`,a)}createArticle({portalSlug:e,articleObj:r}){const{content:a,title:o,authorId:i,categoryId:n,locale:s}=r;return axios.post(`${this.url}/${e}/articles`,{content:a,title:o,author_id:i,category_id:n,locale:s})}deleteArticle({articleId:e,portalSlug:r}){return axios.delete(`${this.url}/${r}/articles/${e}`)}reorderArticles({portalSlug:e,reorderedGroup:r,categorySlug:a}){return axios.post(`${this.url}/${e}/articles/reorder`,{positions_hash:r,category_slug:a})}}const Qi=new HUe,KUe={index:async({commit:t},{pageNumber:e,portalSlug:r,locale:a,status:o,authorId:i,categorySlug:n})=>{try{t(p.SET_UI_FLAG,{isFetching:!0});const{data:s}=await Qi.getArticles({pageNumber:e,portalSlug:r,locale:a,status:o,authorId:i,categorySlug:n}),l=mr(s.payload),c=mr(s.meta),u=l.map(d=>d.id);return t(p.CLEAR_ARTICLES),t(p.ADD_MANY_ARTICLES,l),t(p.SET_ARTICLES_META,c),t(p.ADD_MANY_ARTICLES_ID,u),u}catch(s){return Me(s)}finally{t(p.SET_UI_FLAG,{isFetching:!1})}},create:async({commit:t,dispatch:e},{portalSlug:r,...a})=>{t(p.SET_UI_FLAG,{isCreating:!0});try{const{data:o}=await Qi.createArticle({portalSlug:r,articleObj:a}),i=mr(o.payload),{id:n}=i;return t(p.ADD_ARTICLE,i),t(p.ADD_ARTICLE_ID,n),t(p.ADD_ARTICLE_FLAG,n),e("portals/updatePortal",r,{root:!0}),n}catch(o){return Me(o)}finally{t(p.SET_UI_FLAG,{isCreating:!1})}},show:async({commit:t},{id:e,portalSlug:r})=>{t(p.SET_UI_FLAG,{isFetching:!0});try{const{data:a}=await Qi.getArticle({id:e,portalSlug:r}),o=mr(a.payload),{id:i}=o;t(p.ADD_ARTICLE,o),t(p.ADD_ARTICLE_ID,i),t(p.SET_UI_FLAG,{isFetching:!1})}catch{t(p.SET_UI_FLAG,{isFetching:!1})}},updateAsync:async({commit:t},{portalSlug:e,articleId:r,...a})=>{t(p.UPDATE_ARTICLE_FLAG,{uiFlags:{isUpdating:!0},articleId:r});try{return await Qi.updateArticle({portalSlug:e,articleId:r,articleObj:a}),r}catch(o){return Me(o)}finally{t(p.UPDATE_ARTICLE_FLAG,{uiFlags:{isUpdating:!1},articleId:r})}},update:async({commit:t},{portalSlug:e,articleId:r,...a})=>{t(p.UPDATE_ARTICLE_FLAG,{uiFlags:{isUpdating:!0},articleId:r});try{const{data:o}=await Qi.updateArticle({portalSlug:e,articleId:r,articleObj:a}),i=mr(o.payload);return t(p.UPDATE_ARTICLE,i),r}catch(o){return Me(o)}finally{t(p.UPDATE_ARTICLE_FLAG,{uiFlags:{isUpdating:!1},articleId:r})}},updateArticleMeta:async({commit:t},{portalSlug:e,locale:r})=>{try{const{data:a}=await Qi.getArticles({pageNumber:1,portalSlug:e,locale:r}),o=mr(a.meta),{currentPage:i,...n}=o;t(p.SET_ARTICLES_META,n)}catch(a){Me(a)}},delete:async({commit:t},{portalSlug:e,articleId:r})=>{t(p.UPDATE_ARTICLE_FLAG,{uiFlags:{isDeleting:!0},articleId:r});try{return await Qi.deleteArticle({portalSlug:e,articleId:r}),t(p.REMOVE_ARTICLE,r),t(p.REMOVE_ARTICLE_ID,r),r}catch(a){return Me(a)}finally{t(p.UPDATE_ARTICLE_FLAG,{uiFlags:{isDeleting:!1},articleId:r})}},attachImage:async(t,{file:e})=>{const{fileUrl:r}=await $5(e);return r},uploadExternalImage:async(t,{url:e})=>{const{fileUrl:r}=await aDe(e);return r},reorder:async(t,{portalSlug:e,categorySlug:r,reorderedGroup:a})=>{try{await Qi.reorderArticles({portalSlug:e,reorderedGroup:a,categorySlug:r})}catch(o){Me(o)}return""}},WUe={[p.SET_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.ADD_ARTICLE]:(t,e)=>{e.id&&(t.articles.byId[e.id]=e)},[p.CLEAR_ARTICLES]:t=>{t.articles.allIds=[],t.articles.byId={},t.articles.uiFlags.byId={}},[p.ADD_MANY_ARTICLES](t,e){const r={...t.articles.byId};e.forEach(a=>{r[a.id]=a}),t.articles.byId=r},[p.ADD_MANY_ARTICLES_ID](t,e){t.articles.allIds.push(...e)},[p.SET_ARTICLES_META]:(t,e)=>{t.meta={...t.meta,...e}},[p.ADD_ARTICLE_ID]:(t,e)=>{t.articles.allIds.includes(e)||t.articles.allIds.push(e)},[p.UPDATE_ARTICLE_FLAG]:(t,{articleId:e,uiFlags:r})=>{const a=t.articles.uiFlags.byId[e]||{};t.articles.uiFlags.byId[e]={isFetching:!1,isUpdating:!1,isDeleting:!1,...a,...r}},[p.ADD_ARTICLE_FLAG]:(t,{articleId:e,uiFlags:r})=>{t.articles.uiFlags.byId[e]={isFetching:!1,isUpdating:!1,isDeleting:!1,...r}},[p.UPDATE_ARTICLE]:(t,e)=>{const r=e.id;if(t.articles.byId[r]){const a=t.articles.byId[r].position;t.articles.byId[r]={...e,position:a}}},[p.REMOVE_ARTICLE](t,e){const{[e]:r,...a}=t.articles.byId;t.articles.byId=a},[p.REMOVE_ARTICLE_ID](t,e){t.articles.allIds=t.articles.allIds.filter(r=>r!==e)}},ZUe={meta:{count:0,currentPage:1},articles:{byId:{},allIds:[],uiFlags:{byId:{}}},uiFlags:{allFetched:!1,isFetching:!1}},JUe={namespaced:!0,state:ZUe,getters:GUe,actions:KUe,mutations:WUe};class QUe extends Fe{constructor(){super("custom_attribute_definitions",{accountScoped:!0})}getAttributesByModel(){return axios.get(this.url)}}const R2=new QUe,XUe={records:[],uiFlags:{isFetching:!1,isCreating:!1,isUpdating:!1,isDeleting:!1}},YUe={getUIFlags(t){return t.uiFlags},getAttributes:t=>t.records,getConversationAttributes:t=>t.records.filter(e=>e.attribute_model==="conversation_attribute").map(mr),getContactAttributes:t=>t.records.filter(e=>e.attribute_model==="contact_attribute").map(mr),getAttributesByModel:t=>e=>t.records.filter(r=>r.attribute_model===e)},_Ue={get:async function({commit:e}){e(p.SET_CUSTOM_ATTRIBUTE_UI_FLAG,{isFetching:!0});try{const r=await R2.getAttributesByModel();e(p.SET_CUSTOM_ATTRIBUTE,r.data)}catch{}finally{e(p.SET_CUSTOM_ATTRIBUTE_UI_FLAG,{isFetching:!1})}},create:async function({commit:e},r){var a,o;e(p.SET_CUSTOM_ATTRIBUTE_UI_FLAG,{isCreating:!0});try{const i=await R2.create(r);e(p.ADD_CUSTOM_ATTRIBUTE,i.data)}catch(i){const n=(o=(a=i==null?void 0:i.response)==null?void 0:a.data)==null?void 0:o.message;throw new Error(n)}finally{e(p.SET_CUSTOM_ATTRIBUTE_UI_FLAG,{isCreating:!1})}},update:async({commit:t},{id:e,...r})=>{var a,o;t(p.SET_CUSTOM_ATTRIBUTE_UI_FLAG,{isUpdating:!0});try{const i=await R2.update(e,r);t(p.EDIT_CUSTOM_ATTRIBUTE,i.data)}catch(i){const n=(o=(a=i==null?void 0:i.response)==null?void 0:a.data)==null?void 0:o.message;throw new Error(n)}finally{t(p.SET_CUSTOM_ATTRIBUTE_UI_FLAG,{isUpdating:!1})}},delete:async({commit:t},e)=>{t(p.SET_CUSTOM_ATTRIBUTE_UI_FLAG,{isDeleting:!0});try{await R2.delete(e),t(p.DELETE_CUSTOM_ATTRIBUTE,e)}catch(r){throw new Error(r)}finally{t(p.SET_CUSTOM_ATTRIBUTE_UI_FLAG,{isDeleting:!1})}}},$Ue={[p.SET_CUSTOM_ATTRIBUTE_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.ADD_CUSTOM_ATTRIBUTE]:Ma,[p.SET_CUSTOM_ATTRIBUTE]:ur,[p.EDIT_CUSTOM_ATTRIBUTE]:ua,[p.DELETE_CUSTOM_ATTRIBUTE]:da},eje={namespaced:!0,actions:_Ue,state:XUe,getters:YUe,mutations:$Ue};class tje extends Fe{constructor(){super("audit_logs",{accountScoped:!0})}get({page:e}){const r=e?`${this.url}?page=${e}`:this.url;return axios.get(r)}}const rje=new tje,aje={records:[],meta:{currentPage:1,perPage:15,totalEntries:0},uiFlags:{fetchingList:!1}},oje={getAuditLogs(t){return t.records},getUIFlags(t){return t.uiFlags},getMeta(t){return t.meta}},ije={async fetch({commit:t},{page:e}={}){t(p.SET_AUDIT_LOGS_UI_FLAG,{fetchingList:!0});try{const r=await rje.get({page:e}),{audit_logs:a=[]}=r.data,{total_entries:o,per_page:i,current_page:n}=r.data;return t(p.SET_AUDIT_LOGS,a),t(p.SET_AUDIT_LOGS_META,{totalEntries:o,perPage:i,currentPage:n}),t(p.SET_AUDIT_LOGS_UI_FLAG,{fetchingList:!1}),a}catch(r){return t(p.SET_AUDIT_LOGS_UI_FLAG,{fetchingList:!1}),Me(r)}}},nje={[p.SET_AUDIT_LOGS_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.SET_AUDIT_LOGS]:ur,[p.SET_AUDIT_LOGS_META](t,e){t.meta={...t.meta,...e}}},sje={namespaced:!0,state:aje,getters:oje,actions:ije,mutations:nje},lje={resetPassword:{url:"auth/password"},register:{url:"api/v1/accounts.json"},validityCheck:{url:"/auth/validate_token"},profileUpdate:{url:"/api/v1/profile"},availabilityUpdate:{url:"/api/v1/profile/availability"},autoOffline:{url:"/api/v1/profile/auto_offline"},logout:{url:"auth/sign_out"},me:{url:"api/v1/conversations.json",params:{type:0,page:1}},getInbox:{url:"api/v1/conversations.json",params:{inbox_id:null}},fetchFacebookPages:{url(t){return`api/v1/accounts/${t}/callbacks/facebook_pages.json`},params:{omniauth_token:""}},deleteAvatar:{url:"/api/v1/profile/avatar"},setActiveAccount:{url:"/api/v1/profile/set_active_account"},resendConfirmation:{url:"/api/v1/profile/resend_confirmation"},resetAccessToken:{url:"/api/v1/profile/reset_access_token"}},Ja=t=>lje[t],Qa={async validityCheck(){if(this.hasAuthToken()){const e=Ja("profileUpdate"),r=await axios.get(e.url);return Promise.resolve({data:{payload:r}})}const t=Ja("validityCheck");return axios.get(t.url)},logout(){const t=Ja("logout");return new Promise((r,a)=>{axios.delete(t.url).then(o=>{sUe(),WI(),r(o)}).catch(o=>{a(o)})})},hasAuthCookie(){return!!Wl.get("cw_d_session_info")},hasAuthToken(){return!!window.__WOOT_ACCESS_TOKEN__},getAuthData(){if(this.hasAuthCookie()){const t=Wl.get("cw_d_session_info");return JSON.parse(t||"{}")}return!1},profileUpdate({password:t,password_confirmation:e,displayName:r,avatar:a,...o}){const i=new FormData;return Object.keys(o).forEach(n=>{o[n]===void 0||i.append(`profile[${n}]`,o[n])}),i.append("profile[display_name]",r||""),t&&e&&(i.append("profile[password]",t),i.append("profile[password_confirmation]",e)),a&&i.append("profile[avatar]",a),axios.put(Ja("profileUpdate").url,i)},updateUISettings({uiSettings:t}){return axios.put(Ja("profileUpdate").url,{profile:{ui_settings:t}})},updateAvailability(t){return axios.post(Ja("availabilityUpdate").url,{profile:{...t}})},updateAutoOffline(t,e=!1){return axios.post(Ja("autoOffline").url,{profile:{account_id:t,auto_offline:e}})},deleteAvatar(){return axios.delete(Ja("deleteAvatar").url)},resetPassword({email:t}){const e=Ja("resetPassword");return axios.post(e.url,{email:t})},setActiveAccount({accountId:t}){const e=Ja("setActiveAccount");return axios.put(e.url,{profile:{account_id:t}})},resendConfirmation(){const t=Ja("resendConfirmation");return axios.post(t.url)},resetAccessToken(){const t=Ja("resetAccessToken");return axios.post(t.url)}},XI={currentUser:{id:null,account_id:null,accounts:[],email:null,name:null},uiFlags:{isFetching:!0}},cje={isLoggedIn(t){return!!t.currentUser.id},getCurrentUserID(t){return t.currentUser.id},getUISettings(t){return t.currentUser.ui_settings||{}},getAuthUIFlags(t){return t.uiFlags},getCurrentUserAvailability(t,e){const{accounts:r=[]}=t.currentUser,[a={}]=r.filter(o=>o.id===e.getCurrentAccountId);return a.availability},getCurrentUserAutoOffline(t,e){const{accounts:r=[]}=t.currentUser,[a={}]=r.filter(o=>o.id===e.getCurrentAccountId);return a.auto_offline},getCurrentAccountId(t,e,r){return window.__WOOT_ACCOUNT_ID__?window.__WOOT_ACCOUNT_ID__:r.route.params&&r.route.params.accountId?Number(r.route.params.accountId):null},getCurrentRole(t,e){const{accounts:r=[]}=t.currentUser,[a={}]=r.filter(o=>o.id===e.getCurrentAccountId);return a.role},getCurrentCustomRoleId(t,e){const{accounts:r=[]}=t.currentUser,[a={}]=r.filter(o=>o.id===e.getCurrentAccountId);return a.custom_role_id},getCurrentUser(t){return t.currentUser},getMessageSignature(t){const{message_signature:e}=t.currentUser;return e||""},getCurrentAccount(t,e){const{accounts:r=[]}=t.currentUser,[a={}]=r.filter(o=>o.id===e.getCurrentAccountId);return a||{}},getUserAccounts(t){const{accounts:e=[]}=t.currentUser;return e}},uje={async validityCheck(t){var e;try{const a=(await Qa.validityCheck()).data.payload.data;aUe(a),t.commit(p.SET_CURRENT_USER,a)}catch(r){((e=r==null?void 0:r.response)==null?void 0:e.status)===401&&WI()}},async setUser({commit:t,dispatch:e}){Qa.hasAuthCookie()||Qa.hasAuthToken()?await e("validityCheck"):t(p.CLEAR_USER),t(p.SET_CURRENT_USER_UI_FLAGS,{isFetching:!1})},logout({commit:t}){t(p.CLEAR_USER)},updateProfile:async({commit:t},e)=>{try{const r=await Qa.profileUpdate(e);t(p.SET_CURRENT_USER,r.data)}catch(r){throw r}},deleteAvatar:async({commit:t})=>{try{const e=await Qa.deleteAvatar();t(p.SET_CURRENT_USER,e.data)}catch{}},updateUISettings:async({commit:t},e)=>{try{if(t(p.SET_CURRENT_USER_UI_SETTINGS,e),!rw.get(tw.IMPERSONATION_USER)){const a=await Qa.updateUISettings(e);t(p.SET_CURRENT_USER,a.data)}}catch{}},updateAvailability:async({commit:t,dispatch:e,getters:r},a)=>{const o=r.getCurrentUserAvailability;try{t(p.SET_CURRENT_USER_AVAILABILITY,a.availability);const i=await Qa.updateAvailability(a),n=i.data,{id:s}=n;t(p.SET_CURRENT_USER,i.data),e("agents/updateSingleAgentPresence",{id:s,availabilityStatus:a.availability})}catch{t(p.SET_CURRENT_USER_AVAILABILITY,o)}},updateAutoOffline:async({commit:t,getters:e},{accountId:r,autoOffline:a})=>{const o=e.getCurrentUserAutoOffline;try{t(p.SET_CURRENT_USER_AUTO_OFFLINE,a);const i=await Qa.updateAutoOffline(r,a);t(p.SET_CURRENT_USER,i.data)}catch{t(p.SET_CURRENT_USER_AUTO_OFFLINE,o)}},setCurrentUserAvailability({commit:t,state:e},r){r[e.currentUser.id]&&t(p.SET_CURRENT_USER_AVAILABILITY,r[e.currentUser.id])},setActiveAccount:async(t,{accountId:e})=>{try{await Qa.setActiveAccount({accountId:e})}catch{}},resetAccessToken:async({commit:t})=>{try{const e=await Qa.resetAccessToken();return t(p.SET_CURRENT_USER,e.data),!0}catch{return!1}},resendConfirmation:async()=>{try{await Qa.resendConfirmation()}catch{}}},dje={[p.SET_CURRENT_USER_AVAILABILITY](t,e){const r=t.currentUser.accounts.map(a=>a.id===t.currentUser.account_id?{...a,availability:e,availability_status:e}:a);t.currentUser={...t.currentUser,accounts:r}},[p.SET_CURRENT_USER_AUTO_OFFLINE](t,e){const r=t.currentUser.accounts.map(a=>a.id===t.currentUser.account_id?{...a,autoOffline:e}:a);t.currentUser={...t.currentUser,accounts:r}},[p.CLEAR_USER](t){t.currentUser=XI.currentUser},[p.SET_CURRENT_USER](t,e){t.currentUser=e},[p.SET_CURRENT_USER_UI_SETTINGS](t,{uiSettings:e}){t.currentUser={...t.currentUser,ui_settings:{...t.currentUser.ui_settings,...e}}},[p.SET_CURRENT_USER_UI_FLAGS](t,{isFetching:e}){t.uiFlags={isFetching:e}}},gje={state:XI,getters:cje,actions:uje,mutations:dje};class hje extends Fe{constructor(){super("automation_rules",{accountScoped:!0})}clone(e){return axios.post(`${this.url}/${e}/clone`)}}const t1=new hje,mje={records:[],uiFlags:{isFetching:!1,isCreating:!1,isDeleting:!1,isUpdating:!1}},pje={getAutomations(t){return t.records.sort((e,r)=>e.id-r.id)},getUIFlags(t){return t.uiFlags}},fje={get:async function({commit:e}){e(p.SET_AUTOMATION_UI_FLAG,{isFetching:!0});try{const r=await t1.get();e(p.SET_AUTOMATIONS,r.data.payload)}catch{}finally{e(p.SET_AUTOMATION_UI_FLAG,{isFetching:!1})}},create:async function({commit:e},r){e(p.SET_AUTOMATION_UI_FLAG,{isCreating:!0});try{const a=await t1.create(r);e(p.ADD_AUTOMATION,a.data)}catch(a){throw new Error(a)}finally{e(p.SET_AUTOMATION_UI_FLAG,{isCreating:!1})}},update:async({commit:t},{id:e,...r})=>{t(p.SET_AUTOMATION_UI_FLAG,{isUpdating:!0});try{const a=await t1.update(e,r);t(p.EDIT_AUTOMATION,a.data.payload)}catch(a){throw new Error(a)}finally{t(p.SET_AUTOMATION_UI_FLAG,{isUpdating:!1})}},delete:async({commit:t},e)=>{t(p.SET_AUTOMATION_UI_FLAG,{isDeleting:!0});try{await t1.delete(e),t(p.DELETE_AUTOMATION,e)}catch(r){throw new Error(r)}finally{t(p.SET_AUTOMATION_UI_FLAG,{isDeleting:!1})}},clone:async({commit:t},e)=>{t(p.SET_AUTOMATION_UI_FLAG,{isCloning:!0});try{await t1.clone(e)}catch(r){throw new Error(r)}finally{t(p.SET_AUTOMATION_UI_FLAG,{isCloning:!1})}},uploadAttachment:async(t,e)=>{const{blobId:r}=await $5(e);return r}},wje={[p.SET_AUTOMATION_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.ADD_AUTOMATION]:Ma,[p.SET_AUTOMATIONS]:ur,[p.EDIT_AUTOMATION]:ua,[p.DELETE_AUTOMATION]:da},vje={namespaced:!0,actions:fje,state:mje,getters:pje,mutations:wje};class bje extends Fe{constructor(){super("bulk_actions",{accountScoped:!0})}}const Eje=new bje,kje={selectedConversationIds:[],uiFlags:{isUpdating:!1}},Cje={getUIFlags(t){return t.uiFlags},getSelectedConversationIds(t){return t.selectedConversationIds}},Aje={process:async function({commit:e},r){e(p.SET_BULK_ACTIONS_FLAG,{isUpdating:!0});try{await Eje.create(r)}catch(a){throw new Error(a)}finally{e(p.SET_BULK_ACTIONS_FLAG,{isUpdating:!1})}},setSelectedConversationIds({commit:t},e){t(p.SET_SELECTED_CONVERSATION_IDS,e)},removeSelectedConversationIds({commit:t},e){t(p.REMOVE_SELECTED_CONVERSATION_IDS,e)},clearSelectedConversationIds({commit:t}){t(p.CLEAR_SELECTED_CONVERSATION_IDS)}},xje={[p.SET_BULK_ACTIONS_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.SET_SELECTED_CONVERSATION_IDS](t,e){const r=Array.isArray(e)?e:[e];t.selectedConversationIds=[...new Set([...t.selectedConversationIds,...r])]},[p.REMOVE_SELECTED_CONVERSATION_IDS](t,e){t.selectedConversationIds=t.selectedConversationIds.filter(r=>r!==e)},[p.CLEAR_SELECTED_CONVERSATION_IDS](t){t.selectedConversationIds=[]}},yje={namespaced:!0,actions:Aje,state:kje,getters:Cje,mutations:xje};class Tje extends Fe{constructor(){super("campaigns",{accountScoped:!0})}}const N2=new Tje,Sje={records:[],uiFlags:{isFetching:!1,isCreating:!1}},Ije={getUIFlags(t){return t.uiFlags},getCampaigns:t=>e=>t.records.filter(r=>r.campaign_type===e).sort((r,a)=>r.id-a.id),getAllCampaigns:t=>t.records},Mje={get:async function({commit:e}){e(p.SET_CAMPAIGN_UI_FLAG,{isFetching:!0});try{const r=await N2.get();e(p.SET_CAMPAIGNS,r.data)}catch{}finally{e(p.SET_CAMPAIGN_UI_FLAG,{isFetching:!1})}},create:async function({commit:e},r){e(p.SET_CAMPAIGN_UI_FLAG,{isCreating:!0});try{const a=await N2.create(r);e(p.ADD_CAMPAIGN,a.data)}catch(a){throw new Error(a)}finally{e(p.SET_CAMPAIGN_UI_FLAG,{isCreating:!1})}},update:async({commit:t},{id:e,...r})=>{t(p.SET_CAMPAIGN_UI_FLAG,{isUpdating:!0});try{const a=await N2.update(e,r);Fr.track(W6.UPDATE_CAMPAIGN),t(p.EDIT_CAMPAIGN,a.data)}catch(a){throw new Error(a)}finally{t(p.SET_CAMPAIGN_UI_FLAG,{isUpdating:!1})}},delete:async({commit:t},e)=>{t(p.SET_CAMPAIGN_UI_FLAG,{isDeleting:!0});try{await N2.delete(e),Fr.track(W6.DELETE_CAMPAIGN),t(p.DELETE_CAMPAIGN,e)}catch(r){throw new Error(r)}finally{t(p.SET_CAMPAIGN_UI_FLAG,{isDeleting:!1})}}},Oje={[p.SET_CAMPAIGN_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.ADD_CAMPAIGN]:Ma,[p.SET_CAMPAIGNS]:ur,[p.EDIT_CAMPAIGN]:ua,[p.DELETE_CAMPAIGN]:da},Lje={namespaced:!0,actions:Mje,state:Sje,getters:Ije,mutations:Oje};class Rje extends Fe{constructor(){super("canned_responses",{accountScoped:!0})}get({searchKey:e}){const r=e?`${this.url}?search=${e}`:this.url;return axios.get(r)}}const D2=new Rje,Nje={records:[],uiFlags:{fetchingList:!1,fetchingItem:!1,creatingItem:!1,updatingItem:!1,deletingItem:!1}},Dje={getCannedResponses(t){return t.records},getSortedCannedResponses(t){return e=>[...t.records].sort((r,a)=>e==="asc"?r.short_code.localeCompare(a.short_code):a.short_code.localeCompare(r.short_code))},getUIFlags(t){return t.uiFlags}},Vje={getCannedResponse:async function({commit:e},{searchKey:r}={}){e(p.SET_CANNED_UI_FLAG,{fetchingList:!0});try{const a=await D2.get({searchKey:r});e(p.SET_CANNED,a.data),e(p.SET_CANNED_UI_FLAG,{fetchingList:!1})}catch{e(p.SET_CANNED_UI_FLAG,{fetchingList:!1})}},createCannedResponse:async function({commit:e},r){e(p.SET_CANNED_UI_FLAG,{creatingItem:!0});try{const a=await D2.create(r);return e(p.ADD_CANNED,a.data),e(p.SET_CANNED_UI_FLAG,{creatingItem:!1}),a.data}catch(a){return e(p.SET_CANNED_UI_FLAG,{creatingItem:!1}),Me(a)}},updateCannedResponse:async function({commit:e},{id:r,...a}){e(p.SET_CANNED_UI_FLAG,{updatingItem:!0});try{const o=await D2.update(r,a);return e(p.EDIT_CANNED,o.data),e(p.SET_CANNED_UI_FLAG,{updatingItem:!1}),o.data}catch(o){return e(p.SET_CANNED_UI_FLAG,{updatingItem:!1}),Me(o)}},deleteCannedResponse:async function({commit:e},r){e(p.SET_CANNED_UI_FLAG,{deletingItem:!0});try{return await D2.delete(r),e(p.DELETE_CANNED,r),e(p.SET_CANNED_UI_FLAG,{deletingItem:!0}),r}catch(a){return e(p.SET_CANNED_UI_FLAG,{deletingItem:!0}),Me(a)}}},Bje={[p.SET_CANNED_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.SET_CANNED]:ur,[p.ADD_CANNED]:Ma,[p.EDIT_CANNED]:ua,[p.DELETE_CANNED]:da},Pje={state:Nje,getters:Dje,actions:Vje,mutations:Bje},Fje={uiFlags:t=>e=>{const r=t.categories.uiFlags.byId[e];return r||{isFetching:!1,isUpdating:!1,isDeleting:!1}},isFetching:t=>t.uiFlags.isFetching,isCreating:t=>t.uiFlags.isCreating,categoryById:(...t)=>e=>{const[r]=t,a=r.categories.byId[e];if(a)return a},allCategories:(...t)=>{const[e,r]=t;return e.categories.allIds.map(o=>r.categoryById(o))},categoriesByLocaleCode:(...t)=>e=>{const[r,a]=t;return r.categories.allIds.map(i=>a.categoryById(i)).filter(i=>i.locale===e)},getMeta:t=>t.meta};class Uje extends ow{constructor(){super("categories",{accountScoped:!0})}get({portalSlug:e,locale:r}){return axios.get(`${this.url}/${e}/categories?locale=${r}`)}create({portalSlug:e,categoryObj:r}){return axios.post(`${this.url}/${e}/categories`,r)}update({portalSlug:e,categoryId:r,categoryObj:a}){return axios.patch(`${this.url}/${e}/categories/${r}`,a)}delete({portalSlug:e,categoryId:r}){return axios.delete(`${this.url}/${e}/categories/${r}`)}}const V2=new Uje,jje={index:async({commit:t},{portalSlug:e,locale:r})=>{try{if(t(p.SET_UI_FLAG,{isFetching:!0}),e){const{data:{payload:a}}=await V2.get({portalSlug:e,locale:r});t(p.CLEAR_CATEGORIES);const o=a.map(i=>i.id);return t(p.ADD_MANY_CATEGORIES,a),t(p.ADD_MANY_CATEGORIES_ID,o),o}return""}catch(a){return Me(a)}finally{t(p.SET_UI_FLAG,{isFetching:!1})}},create:async({commit:t},{portalSlug:e,categoryObj:r})=>{t(p.SET_UI_FLAG,{isCreating:!0});try{const{data:{payload:a}}=await V2.create({portalSlug:e,categoryObj:r}),{id:o}=a;return t(p.ADD_CATEGORY,a),t(p.ADD_CATEGORY_ID,o),o}catch(a){return Me(a)}finally{t(p.SET_UI_FLAG,{isCreating:!1})}},update:async({commit:t},{portalSlug:e,categoryId:r,categoryObj:a})=>{t(p.ADD_CATEGORY_FLAG,{uiFlags:{isUpdating:!0},categoryId:r});try{const{data:{payload:o}}=await V2.update({portalSlug:e,categoryId:r,categoryObj:a});return t(p.UPDATE_CATEGORY,o),r}catch(o){return Me(o)}finally{t(p.ADD_CATEGORY_FLAG,{uiFlags:{isUpdating:!1},categoryId:r})}},delete:async({commit:t},{portalSlug:e,categoryId:r})=>{t(p.ADD_CATEGORY_FLAG,{uiFlags:{isDeleting:!0},categoryId:r});try{return await V2.delete({portalSlug:e,categoryId:r}),t(p.REMOVE_CATEGORY,r),t(p.REMOVE_CATEGORY_ID,r),r}catch(a){return Me(a)}finally{t(p.ADD_CATEGORY_FLAG,{uiFlags:{isDeleting:!1},categoryId:r})}}},zje={[p.SET_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.ADD_CATEGORY]:(t,e)=>{e.id&&(t.categories.byId[e.id]={...e})},[p.CLEAR_CATEGORIES]:t=>{t.categories.byId={},t.categories.allIds=[],t.categories.uiFlags.byId={}},[p.ADD_MANY_CATEGORIES](t,e){const r={...t.categories.byId};e.forEach(a=>{r[a.id]=a}),t.categories.byId=r},[p.ADD_MANY_CATEGORIES_ID](t,e){t.categories.allIds.push(...e)},[p.SET_CATEGORIES_META]:(t,e)=>{const{categories_count:r,current_page:a}=e;t.meta={...t.meta,count:r,currentPage:a}},[p.ADD_CATEGORY_ID]:(t,e)=>{t.categories.allIds.push(e)},[p.ADD_CATEGORY_FLAG]:(t,{categoryId:e,uiFlags:r})=>{const a=t.categories.uiFlags.byId[e];t.categories.uiFlags.byId[e]={isFetching:!1,isUpdating:!1,isDeleting:!1,...a,...r}},[p.UPDATE_CATEGORY](t,e){const r=e.id;t.categories.allIds.includes(r)&&(t.categories.byId[r]={...e})},[p.REMOVE_CATEGORY](t,e){const{[e]:r,...a}=t.categories.byId;t.categories.byId=a},[p.REMOVE_CATEGORY_ID](t,e){t.categories.allIds=t.categories.allIds.filter(r=>r!==e)}},qje={categories:{byId:{},byLocale:{},allIds:[],uiFlags:{byId:{}}},uiFlags:{allFetched:!1,isFetching:!1,isCreating:!1}},Gje={namespaced:!0,state:qje,getters:Fje,actions:jje,mutations:zje},B2=(t,e,r,a)=>{let o=`include_contact_inboxes=false&page=${t}&sort=${e}`;return a&&(o=`${o}&q=${a}`),r&&(o=`${o}&labels[]=${r}`),o};class Hje extends Fe{constructor(){super("contacts",{accountScoped:!0})}get(e,r="name",a=""){let o=`${this.url}?${B2(e,r,a,"")}`;return axios.get(o)}show(e){return axios.get(`${this.url}/${e}?include_contact_inboxes=false`)}update(e,r){return axios.patch(`${this.url}/${e}?include_contact_inboxes=false`,r)}getConversations(e){return axios.get(`${this.url}/${e}/conversations`)}getContactableInboxes(e){return axios.get(`${this.url}/${e}/contactable_inboxes`)}getContactLabels(e){return axios.get(`${this.url}/${e}/labels`)}updateContactLabels(e,r){return axios.post(`${this.url}/${e}/labels`,{labels:r})}search(e="",r=1,a="name",o=""){let i=`${this.url}/search?${B2(r,a,o,e)}`;return axios.get(i)}active(e=1,r="name"){let a=`${this.url}/active?${B2(e,r)}`;return axios.get(a)}filter(e=1,r="name",a){let o=`${this.url}/filter?${B2(e,r)}`;return axios.post(o,a)}importContacts(e){const r=new FormData;return r.append("import_file",e),axios.post(`${this.url}/import`,r,{headers:{"Content-Type":"multipart/form-data"}})}destroyCustomAttributes(e,r){return axios.post(`${this.url}/${e}/destroy_custom_attributes`,{custom_attributes:r})}destroyAvatar(e){return axios.delete(`${this.url}/${e}/avatar`)}exportContacts(e){return axios.post(`${this.url}/export`,e)}}const Rr=new Hje;let Kje=class extends Fe{constructor(){super("conversations",{accountScoped:!0})}getLabels(e){return axios.get(`${this.url}/${e}/labels`)}updateLabels(e,r){return axios.post(`${this.url}/${e}/labels`,{labels:r})}};const Rp=new Kje,Wje=(t,e)=>{const{content:r,cc_emails:a,bcc_emails:o}=e;t.append("message[content]",r),a&&t.append("message[cc_emails]",a),o&&t.append("message[bcc_emails]",o)},Zje=({params:t,contactId:e,files:r})=>{const{inboxId:a,message:o,sourceId:i,mailSubject:n,assigneeId:s}=t,l=new FormData;return o&&Wje(l,o),r&&r.length>0&&r.forEach(c=>l.append("message[attachments][]",c)),l.append("inbox_id",a),l.append("contact_id",e),l.append("source_id",i),l.append("additional_attributes[mail_subject]",n),l.append("assignee_id",s),l},Jje=({params:t})=>{const{inboxId:e,message:r,contactId:a,sourceId:o,assigneeId:i}=t;return{inbox_id:e,contact_id:a,source_id:o,message:r,assignee_id:i}},Qje=({isFromWhatsApp:t,params:e,contactId:r,files:a})=>t?Jje({params:e}):Zje({params:e,contactId:r,files:a}),Xje={records:{},uiFlags:{isFetching:!1}},Yje={getUIFlags(t){return t.uiFlags},getContactConversation:t=>e=>t.records[Number(e)]||[],getAllConversationsByContactId:t=>e=>{const r=t.records[Number(e)]||[];return mr(r,{deep:!0})}},_je={create:async({commit:t},{params:e,isFromWhatsApp:r})=>{t(p.SET_CONTACT_CONVERSATIONS_UI_FLAG,{isCreating:!0});const{contactId:a,files:o}=e;try{const i=Qje({isFromWhatsApp:r,params:e,contactId:a,files:o}),{data:n}=await Rp.create(i);return t(p.ADD_CONTACT_CONVERSATION,{id:a,data:n}),n}catch(i){throw new Error(i)}finally{t(p.SET_CONTACT_CONVERSATIONS_UI_FLAG,{isCreating:!1})}},get:async({commit:t},e)=>{t(p.SET_CONTACT_CONVERSATIONS_UI_FLAG,{isFetching:!0});try{const r=await Rr.getConversations(e);t(p.SET_CONTACT_CONVERSATIONS,{id:e,data:r.data.payload}),t(p.SET_CONTACT_CONVERSATIONS_UI_FLAG,{isFetching:!1})}catch{t(p.SET_CONTACT_CONVERSATIONS_UI_FLAG,{isFetching:!1})}}},$je={[p.SET_CONTACT_CONVERSATIONS_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.SET_CONTACT_CONVERSATIONS]:(t,{id:e,data:r})=>{t.records={...t.records,[e]:r}},[p.ADD_CONTACT_CONVERSATION]:(t,{id:e,data:r})=>{const a=t.records[e]||[],o=[...a],i=a.findIndex(n=>n.id===r.id);i!==-1?o[i]={...a[i],...r}:o.push(r),t.records={...t.records,[e]:o}},[p.DELETE_CONTACT_CONVERSATION]:(t,e)=>{const{[e]:r,...a}=t.records;t.records=a}},eze={namespaced:!0,state:Xje,getters:Yje,actions:_je,mutations:$je},tze={records:{},uiFlags:{isFetching:!1,isUpdating:!1,isError:!1}},rze={getUIFlags(t){return t.uiFlags},getContactLabels:t=>e=>t.records[Number(e)]||[]},aze={get:async({commit:t},e)=>{t(p.SET_CONTACT_LABELS_UI_FLAG,{isFetching:!0});try{const r=await Rr.getContactLabels(e);t(p.SET_CONTACT_LABELS,{id:e,data:r.data.payload}),t(p.SET_CONTACT_LABELS_UI_FLAG,{isFetching:!1})}catch{t(p.SET_CONTACT_LABELS_UI_FLAG,{isFetching:!1})}},update:async({commit:t},{contactId:e,labels:r})=>{t(p.SET_CONTACT_LABELS_UI_FLAG,{isUpdating:!0});try{const a=await Rr.updateContactLabels(e,r);t(p.SET_CONTACT_LABELS,{id:e,data:a.data.payload}),t(p.SET_CONTACT_LABELS_UI_FLAG,{isUpdating:!1,isError:!1})}catch(a){throw t(p.SET_CONTACT_LABELS_UI_FLAG,{isUpdating:!1,isError:!0}),new Error(a)}},setContactLabel({commit:t},{id:e,data:r}){t(p.SET_CONTACT_LABELS,{id:e,data:r})}},oze={[p.SET_CONTACT_LABELS_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.SET_CONTACT_LABELS]:(t,{id:e,data:r})=>{t.records={...t.records,[e]:r}}},ize={namespaced:!0,state:tze,getters:rze,actions:aze,mutations:oze};class nze extends Fe{constructor(){super("notes",{accountScoped:!0}),this.contactId=null}get url(){return`${this.baseUrl()}/contacts/${this.contactId}/notes`}get(e){return this.contactId=e,super.get()}create(e,r){return this.contactId=e,super.create({content:r})}delete(e,r){return this.contactId=e,super.delete(r)}}const k3=new nze,sze={records:{},uiFlags:{isFetching:!1,isCreating:!1,isDeleting:!1}},lze={getAllNotesByContact:t=>e=>(t.records[e]||[]).sort((a,o)=>o.id-a.id),getUIFlags(t){return t.uiFlags},getAllNotesByContactId:t=>e=>{const a=(t.records[e]||[]).sort((o,i)=>i.id-o.id);return mr(a)}},cze={async get({commit:t},{contactId:e}){t(p.SET_CONTACT_NOTES_UI_FLAG,{isFetching:!0});try{const{data:r}=await k3.get(e);t(p.SET_CONTACT_NOTES,{contactId:e,data:r})}catch(r){throw new Error(r)}finally{t(p.SET_CONTACT_NOTES_UI_FLAG,{isFetching:!1})}},async create({commit:t},{contactId:e,content:r}){t(p.SET_CONTACT_NOTES_UI_FLAG,{isCreating:!0});try{const{data:a}=await k3.create(e,r);t(p.ADD_CONTACT_NOTE,{contactId:e,data:a})}catch(a){throw new Error(a)}finally{t(p.SET_CONTACT_NOTES_UI_FLAG,{isCreating:!1})}},async delete({commit:t},{noteId:e,contactId:r}){t(p.SET_CONTACT_NOTES_UI_FLAG,{isDeleting:!0});try{await k3.delete(r,e),t(p.DELETE_CONTACT_NOTE,{contactId:r,noteId:e})}catch(a){throw new Error(a)}finally{t(p.SET_CONTACT_NOTES_UI_FLAG,{isDeleting:!1})}}},uze={[p.SET_CONTACT_NOTES_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.SET_CONTACT_NOTES](t,{data:e,contactId:r}){t.records={...t.records,[r]:e}},[p.ADD_CONTACT_NOTE](t,{data:e,contactId:r}){const a=t.records[r]||[];t.records[r]=[...a,e]},[p.DELETE_CONTACT_NOTE](t,{noteId:e,contactId:r}){const o=t.records[r].filter(i=>i.id!==e);t.records[r]=[...o]}},dze={namespaced:!0,state:sze,getters:lze,actions:cze,mutations:uze},gze={getContacts(t){return t.sortOrder.map(e=>t.records[e])},getContactsList(t){const e=t.sortOrder.map(r=>t.records[r]);return mr(e,{deep:!0})},getUIFlags(t){return t.uiFlags},getContact:t=>e=>t.records[e]||{},getContactById:t=>e=>{const r=t.records[e];return mr(r||{},{deep:!0,stopPaths:["custom_attributes"]})},getMeta:t=>t.meta,getAppliedContactFilters:t=>t.appliedFilters,getAppliedContactFiltersV4:t=>t.appliedFilters.map(mr)};class hze extends Fe{constructor(){super("actions",{accountScoped:!0})}merge(e,r){return axios.post(`${this.url}/contact_merge`,{base_contact_id:e,mergee_contact_id:r})}}const mze=new hze,nk=t=>{const e=new FormData,{additional_attributes:r={},...a}=t;Object.keys(a).forEach(n=>{a[n]&&e.append(n,a[n])});const{social_profiles:o,...i}=r;return Object.keys(i).forEach(n=>{e.append(`additional_attributes[${n}]`,i[n])}),Object.keys(o).forEach(n=>{e.append(`additional_attributes[social_profiles][${n}]`,o[n])}),e},sk=t=>{var e,r,a;throw((e=t.response)==null?void 0:e.status)===422?new Zy(t.response.data.attributes):(a=(r=t.response)==null?void 0:r.data)!=null&&a.message?new _u(t.response.data.message):new Error(t)},pze={search:async({commit:t},{search:e,page:r,sortAttr:a,label:o})=>{t(p.SET_CONTACT_UI_FLAG,{isFetching:!0});try{const{data:{payload:i,meta:n}}=await Rr.search(e,r,a,o);t(p.CLEAR_CONTACTS),t(p.SET_CONTACTS,i),t(p.SET_CONTACT_META,n),t(p.SET_CONTACT_UI_FLAG,{isFetching:!1})}catch{t(p.SET_CONTACT_UI_FLAG,{isFetching:!1})}},get:async({commit:t},{page:e=1,sortAttr:r,label:a}={})=>{t(p.SET_CONTACT_UI_FLAG,{isFetching:!0});try{const{data:{payload:o,meta:i}}=await Rr.get(e,r,a);t(p.CLEAR_CONTACTS),t(p.SET_CONTACTS,o),t(p.SET_CONTACT_META,i),t(p.SET_CONTACT_UI_FLAG,{isFetching:!1})}catch{t(p.SET_CONTACT_UI_FLAG,{isFetching:!1})}},active:async({commit:t},{page:e=1,sortAttr:r}={})=>{t(p.SET_CONTACT_UI_FLAG,{isFetching:!0});try{const{data:{payload:a,meta:o}}=await Rr.active(e,r);t(p.CLEAR_CONTACTS),t(p.SET_CONTACTS,a),t(p.SET_CONTACT_META,o),t(p.SET_CONTACT_UI_FLAG,{isFetching:!1})}catch{t(p.SET_CONTACT_UI_FLAG,{isFetching:!1})}},show:async({commit:t},{id:e})=>{t(p.SET_CONTACT_UI_FLAG,{isFetchingItem:!0});try{const r=await Rr.show(e);t(p.SET_CONTACT_ITEM,r.data.payload),t(p.SET_CONTACT_UI_FLAG,{isFetchingItem:!1})}catch{t(p.SET_CONTACT_UI_FLAG,{isFetchingItem:!1})}},update:async({commit:t},{id:e,isFormData:r=!1,...a})=>{const{avatar:o,customAttributes:i,...n}=a,s={...Em(n,{deep:!0}),...i&&{custom_attributes:i},...o&&{avatar:o}};t(p.SET_CONTACT_UI_FLAG,{isUpdating:!0});try{const l=await Rr.update(e,r?nk(s):s);t(p.EDIT_CONTACT,l.data.payload),t(p.SET_CONTACT_UI_FLAG,{isUpdating:!1})}catch(l){t(p.SET_CONTACT_UI_FLAG,{isUpdating:!1}),sk(l)}},create:async({commit:t},{isFormData:e=!1,...r})=>{const a=Em(r,{deep:!0});t(p.SET_CONTACT_UI_FLAG,{isCreating:!0});try{const o=await Rr.create(e?nk(a):a);return Fr.track(Yj.CREATE_CONTACT),t(p.SET_CONTACT_ITEM,o.data.payload.contact),t(p.SET_CONTACT_UI_FLAG,{isCreating:!1}),o.data.payload.contact}catch(o){return t(p.SET_CONTACT_UI_FLAG,{isCreating:!1}),sk(o)}},import:async({commit:t},e)=>{var r,a;t(p.SET_CONTACT_UI_FLAG,{isImporting:!0});try{await Rr.importContacts(e),t(p.SET_CONTACT_UI_FLAG,{isImporting:!1})}catch(o){if(t(p.SET_CONTACT_UI_FLAG,{isImporting:!1}),(a=(r=o.response)==null?void 0:r.data)!=null&&a.message)throw new _u(o.response.data.message)}},export:async({commit:t},{payload:e,label:r})=>{var a,o;t(p.SET_CONTACT_UI_FLAG,{isExporting:!0});try{await Rr.exportContacts({payload:e,label:r}),t(p.SET_CONTACT_UI_FLAG,{isExporting:!1})}catch(i){throw t(p.SET_CONTACT_UI_FLAG,{isExporting:!1}),(o=(a=i.response)==null?void 0:a.data)!=null&&o.message?new Error(i.response.data.message):new Error(i)}},delete:async({commit:t},e)=>{var r,a;t(p.SET_CONTACT_UI_FLAG,{isDeleting:!0});try{await Rr.delete(e),t(p.SET_CONTACT_UI_FLAG,{isDeleting:!1})}catch(o){throw t(p.SET_CONTACT_UI_FLAG,{isDeleting:!1}),(a=(r=o.response)==null?void 0:r.data)!=null&&a.message?new Error(o.response.data.message):new Error(o)}},deleteCustomAttributes:async({commit:t},{id:e,customAttributes:r})=>{try{const a=await Rr.destroyCustomAttributes(e,r);t(p.EDIT_CONTACT,a.data.payload)}catch(a){throw new Error(a)}},deleteAvatar:async({commit:t},e)=>{try{const r=await Rr.destroyAvatar(e);t(p.EDIT_CONTACT,r.data.payload)}catch(r){throw new Error(r)}},fetchContactableInbox:async({commit:t},e)=>{var r,a;t(p.SET_CONTACT_UI_FLAG,{isFetchingInboxes:!0});try{const o=await Rr.getContactableInboxes(e),i={id:Number(e),contact_inboxes:o.data.payload};t(p.SET_CONTACT_ITEM,i)}catch(o){throw(a=(r=o.response)==null?void 0:r.data)!=null&&a.message?new _u(o.response.data.message):new Error(o)}finally{t(p.SET_CONTACT_UI_FLAG,{isFetchingInboxes:!1})}},updatePresence:({commit:t},e)=>{t(p.UPDATE_CONTACTS_PRESENCE,e)},setContact({commit:t},e){t(p.SET_CONTACT_ITEM,e)},merge:async({commit:t},{childId:e,parentId:r})=>{t(p.SET_CONTACT_UI_FLAG,{isMerging:!0});try{const a=await mze.merge(r,e);t(p.SET_CONTACT_ITEM,a.data)}catch(a){throw new Error(a)}finally{t(p.SET_CONTACT_UI_FLAG,{isMerging:!1})}},deleteContactThroughConversations:({commit:t},e)=>{t(p.DELETE_CONTACT,e),t(p.CLEAR_CONTACT_CONVERSATIONS,e,{root:!0}),t(`contactConversations/${p.DELETE_CONTACT_CONVERSATION}`,e,{root:!0})},updateContact:async({commit:t},e)=>{t(p.SET_CONTACT_UI_FLAG,{isUpdating:!0});try{t(p.EDIT_CONTACT,e),t(p.SET_CONTACT_UI_FLAG,{isUpdating:!1})}catch{t(p.SET_CONTACT_UI_FLAG,{isUpdating:!1})}},filter:async({commit:t},{page:e=1,sortAttr:r,queryPayload:a,resetState:o=!0}={})=>{t(p.SET_CONTACT_UI_FLAG,{isFetching:!0});try{const{data:{payload:i,meta:n}}=await Rr.filter(e,r,a);return o&&(t(p.CLEAR_CONTACTS),t(p.SET_CONTACTS,i),t(p.SET_CONTACT_META,n),t(p.SET_CONTACT_UI_FLAG,{isFetching:!1})),i}catch{t(p.SET_CONTACT_UI_FLAG,{isFetching:!1})}return[]},setContactFilters({commit:t},e){t(p.SET_CONTACT_FILTERS,e)},clearContactFilters({commit:t}){t(p.CLEAR_CONTACT_FILTERS)}},fze={[p.SET_CONTACT_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.CLEAR_CONTACTS]:t=>{t.records={},t.sortOrder=[]},[p.SET_CONTACT_META]:(t,e)=>{const{count:r,current_page:a}=e;t.meta.count=r,t.meta.currentPage=a},[p.SET_CONTACTS]:(t,e)=>{const r=e.map(a=>(t.records[a.id]={...t.records[a.id]||{},...a},a.id));t.sortOrder=r},[p.SET_CONTACT_ITEM]:(t,e)=>{t.records[e.id]={...t.records[e.id]||{},...e},t.sortOrder.includes(e.id)||t.sortOrder.push(e.id)},[p.EDIT_CONTACT]:(t,e)=>{t.records[e.id]=e},[p.DELETE_CONTACT]:(t,e)=>{const r=t.sortOrder.findIndex(a=>a===e);t.sortOrder.splice(r,1),delete t.records[e]},[p.UPDATE_CONTACTS_PRESENCE]:(t,e)=>{Object.values(t.records).forEach(r=>{let a;try{a=e[r.id]}catch(o){tg("contact is undefined",{records:t.records,data:e}),Rc(o);return}a?t.records[r.id].availability_status=a:t.records[r.id].availability_status=null})},[p.SET_CONTACT_FILTERS](t,e){t.appliedFilters=e},[p.CLEAR_CONTACT_FILTERS](t){t.appliedFilters=[]}},wze={meta:{count:0,currentPage:1},records:{},uiFlags:{isFetching:!1,isFetchingItem:!1,isFetchingInboxes:!1,isUpdating:!1,isMerging:!1,isDeleting:!1,isExporting:!1,isImporting:!1},sortOrder:[],appliedFilters:[]},vze={namespaced:!0,state:wze,getters:gze,actions:pze,mutations:fze},bze={records:{},uiFlags:{isFetching:!1,isUpdating:!1,isError:!1}},Eze={getUIFlags(t){return t.uiFlags},getConversationLabels:t=>e=>t.records[Number(e)]||[]},kze={get:async({commit:t},e)=>{t(p.SET_CONVERSATION_LABELS_UI_FLAG,{isFetching:!0});try{const r=await Rp.getLabels(e);t(p.SET_CONVERSATION_LABELS,{id:e,data:r.data.payload}),t(p.SET_CONVERSATION_LABELS_UI_FLAG,{isFetching:!1})}catch{t(p.SET_CONVERSATION_LABELS_UI_FLAG,{isFetching:!1})}},update:async({commit:t},{conversationId:e,labels:r})=>{t(p.SET_CONVERSATION_LABELS_UI_FLAG,{isUpdating:!0});try{const a=await Rp.updateLabels(e,r);t(p.SET_CONVERSATION_LABELS,{id:e,data:a.data.payload}),t(p.SET_CONVERSATION_LABELS_UI_FLAG,{isUpdating:!1,isError:!1})}catch{t(p.SET_CONVERSATION_LABELS_UI_FLAG,{isUpdating:!1,isError:!0})}},setBulkConversationLabels({commit:t},e){t(p.SET_BULK_CONVERSATION_LABELS,e)},setConversationLabel({commit:t},{id:e,data:r}){t(p.SET_CONVERSATION_LABELS,{id:e,data:r})}},Cze={[p.SET_CONVERSATION_LABELS_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.SET_CONVERSATION_LABELS]:(t,{id:e,data:r})=>{t.records={...t.records,[e]:r}},[p.SET_BULK_CONVERSATION_LABELS]:(t,e)=>{const r={...t.records};e.forEach(a=>{r[a.id]=a.labels}),t.records=r}},Aze={namespaced:!0,state:bze,getters:Eze,actions:kze,mutations:Cze},xze={records:{}},yze={getConversationMetadata:t=>e=>t.records[Number(e)]||{}},Tze={},Sze={[p.SET_CONVERSATION_METADATA]:(t,{id:e,data:r})=>{t.records={...t.records,[e]:r}}},Ize={namespaced:!0,state:xze,getters:yze,actions:Tze,mutations:Sze},Mze={currentPage:{me:0,unassigned:0,all:0,appliedFilters:0},hasEndReached:{me:!1,unassigned:!1,all:!1}},Oze={getHasEndReached:t=>e=>t.hasEndReached[e],getCurrentPageFilter:t=>e=>t.currentPage[e],getCurrentPage:t=>t.currentPage},Lze={setCurrentPage({commit:t},{filter:e,page:r}){t(p.SET_CURRENT_PAGE,{filter:e,page:r})},setEndReached({commit:t},{filter:e}){t(p.SET_CONVERSATION_END_REACHED,{filter:e})},reset({commit:t}){t(p.CLEAR_CONVERSATION_PAGE)}},Rze={[p.SET_CURRENT_PAGE]:(t,{filter:e,page:r})=>{t.currentPage={...t.currentPage,[e]:r}},[p.SET_CONVERSATION_END_REACHED]:(t,{filter:e})=>{e==="all"&&(t.hasEndReached={...t.hasEndReached,unassigned:!0,me:!0}),t.hasEndReached={...t.hasEndReached,[e]:!0}},[p.CLEAR_CONVERSATION_PAGE]:t=>{t.currentPage={me:0,unassigned:0,all:0,appliedFilters:0},t.hasEndReached={me:!1,unassigned:!1,all:!1,appliedFilters:!1}}},Nze={namespaced:!0,state:Mze,getters:Oze,actions:Lze,mutations:Rze},Dze=(t,e)=>{const{echo_id:r}=e;return t.messages.findIndex(a=>a.id===e.id||a.id===r)},Vze=(t,e)=>e==="all"?!0:t===e,Bze=(t,e,r)=>{const a=Number(e)===r;return e?a&&t:t},Pze=(t,e,r)=>{const a=Number(e)===r;return e?a&&t:t},Fze=(t,e,r)=>{const a=e.every(o=>r.includes(o));return e.length?a&&t:t},Uze=(t,e,r,a)=>e==="unattended"?(!r||!!a)&&t:t,C3=(t,e)=>{const{inboxId:r,status:a,labels:o=[],teamId:i,conversationType:n}=e,{status:s,inbox_id:l,labels:c=[],meta:u={},first_reply_created_at:d,waiting_since:g}=t,h=u.team||{},{id:m}=h;let f=Vze(s,a);return f=Bze(f,r,l),f=Pze(f,i,m),f=Fze(f,o,c),f=Uze(f,n,d,g),f},lk=(t,e,r,a)=>{if(["administrator","agent"].includes(e)||r.includes("conversation_manage"))return!0;const o=t.meta.assignee,i=!o,n=(o==null?void 0:o.id)===a;return r.includes("conversation_unassigned_manage")?i||n:r.includes("conversation_participating_manage")?n:!1},ck={last_activity_at_asc:["sortOnLastActivityAt","asc"],last_activity_at_desc:["sortOnLastActivityAt","desc"],created_at_asc:["sortOnCreatedAt","asc"],created_at_desc:["sortOnCreatedAt","desc"],priority_asc:["sortOnPriority","asc"],priority_desc:["sortOnPriority","desc"],waiting_since_asc:["sortOnWaitingSince","asc"],waiting_since_desc:["sortOnWaitingSince","desc"]},jze=(t,e)=>t-e,zze=(t,e)=>e-t,P2=t=>t==="asc"?jze:zze,qze={sortOnLastActivityAt:(t,e,r)=>P2(r)(t.last_activity_at,e.last_activity_at),sortOnCreatedAt:(t,e,r)=>P2(r)(t.created_at,e.created_at),sortOnPriority:(t,e,r)=>{const a=r==="asc"?5:0,o=Y8[t.priority]||a,i=Y8[e.priority]||a;return P2(r)(o,i)},sortOnWaitingSince:(t,e,r)=>{const a=P2(r);return!t.waiting_since||!e.waiting_since?!t.waiting_since&&!e.waiting_since?a(t.created_at,e.created_at):a(t.waiting_since?0:1,e.waiting_since?0:1):a(t.waiting_since,e.waiting_since)}},uk=(t,e,r)=>{const[a,o]=ck[r]||ck.last_activity_at_desc;return qze[a](t,e,o)},Gze=t=>{var e;return(e=t.values[0])!=null&&e.id?t.values.map(r=>r.id):t.values},Hze=t=>t.attribute_key==="content"?(t.values||"").split(","):Array.isArray(t.values)?Gze(t):typeof t.values=="object"?[t.values.id]:t.values?[t.values]:[],Kze=t=>{let r=JSON.parse(JSON.stringify(t)).map(a=>(a.values=Hze(a),a));return r[r.length-1].query_operator=void 0,{payload:r}};var YI={exports:{}};(function(t,e){(function(r,a){t.exports=a()})(ct,function(){Array.isArray||(Array.isArray=function(i){return Object.prototype.toString.call(i)==="[object Array]"});function r(i){for(var n=[],s=0,l=i.length;s<l;s++)n.indexOf(i[s])===-1&&n.push(i[s]);return n}var a={},o={"==":function(i,n){return i==n},"===":function(i,n){return i===n},"!=":function(i,n){return i!=n},"!==":function(i,n){return i!==n},">":function(i,n){return i>n},">=":function(i,n){return i>=n},"<":function(i,n,s){return s===void 0?i<n:i<n&&n<s},"<=":function(i,n,s){return s===void 0?i<=n:i<=n&&n<=s},"!!":function(i){return a.truthy(i)},"!":function(i){return!a.truthy(i)},"%":function(i,n){return i%n},log:function(i){return console.log(i),i},in:function(i,n){return!n||typeof n.indexOf>"u"?!1:n.indexOf(i)!==-1},cat:function(){return Array.prototype.join.call(arguments,"")},substr:function(i,n,s){if(s<0){var l=String(i).substr(n);return l.substr(0,l.length+s)}return String(i).substr(n,s)},"+":function(){return Array.prototype.reduce.call(arguments,function(i,n){return parseFloat(i,10)+parseFloat(n,10)},0)},"*":function(){return Array.prototype.reduce.call(arguments,function(i,n){return parseFloat(i,10)*parseFloat(n,10)})},"-":function(i,n){return n===void 0?-i:i-n},"/":function(i,n){return i/n},min:function(){return Math.min.apply(this,arguments)},max:function(){return Math.max.apply(this,arguments)},merge:function(){return Array.prototype.reduce.call(arguments,function(i,n){return i.concat(n)},[])},var:function(i,n){var s=n===void 0?null:n,l=this;if(typeof i>"u"||i===""||i===null)return l;for(var c=String(i).split("."),u=0;u<c.length;u++)if(l==null||(l=l[c[u]],l===void 0))return s;return l},missing:function(){for(var i=[],n=Array.isArray(arguments[0])?arguments[0]:arguments,s=0;s<n.length;s++){var l=n[s],c=a.apply({var:l},this);(c===null||c==="")&&i.push(l)}return i},missing_some:function(i,n){var s=a.apply({missing:n},this);return n.length-s.length>=i?[]:s}};return a.is_logic=function(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)&&Object.keys(i).length===1},a.truthy=function(i){return Array.isArray(i)&&i.length===0?!1:!!i},a.get_operator=function(i){return Object.keys(i)[0]},a.get_values=function(i){return i[a.get_operator(i)]},a.apply=function(i,n){if(Array.isArray(i))return i.map(function(b){return a.apply(b,n)});if(!a.is_logic(i))return i;var s=a.get_operator(i),l=i[s],c,u,d,g,h;if(Array.isArray(l)||(l=[l]),s==="if"||s=="?:"){for(c=0;c<l.length-1;c+=2)if(a.truthy(a.apply(l[c],n)))return a.apply(l[c+1],n);return l.length===c+1?a.apply(l[c],n):null}else if(s==="and"){for(c=0;c<l.length;c+=1)if(u=a.apply(l[c],n),!a.truthy(u))return u;return u}else if(s==="or"){for(c=0;c<l.length;c+=1)if(u=a.apply(l[c],n),a.truthy(u))return u;return u}else{if(s==="filter")return g=a.apply(l[0],n),d=l[1],Array.isArray(g)?g.filter(function(b){return a.truthy(a.apply(d,b))}):[];if(s==="map")return g=a.apply(l[0],n),d=l[1],Array.isArray(g)?g.map(function(b){return a.apply(d,b)}):[];if(s==="reduce")return g=a.apply(l[0],n),d=l[1],h=typeof l[2]<"u"?a.apply(l[2],n):null,Array.isArray(g)?g.reduce(function(b,k){return a.apply(d,{current:k,accumulator:b})},h):h;if(s==="all"){if(g=a.apply(l[0],n),d=l[1],!Array.isArray(g)||!g.length)return!1;for(c=0;c<g.length;c+=1)if(!a.truthy(a.apply(d,g[c])))return!1;return!0}else if(s==="none"){if(g=a.apply(l[0],n),d=l[1],!Array.isArray(g)||!g.length)return!0;for(c=0;c<g.length;c+=1)if(a.truthy(a.apply(d,g[c])))return!1;return!0}else if(s==="some"){if(g=a.apply(l[0],n),d=l[1],!Array.isArray(g)||!g.length)return!1;for(c=0;c<g.length;c+=1)if(a.truthy(a.apply(d,g[c])))return!0;return!1}}if(l=l.map(function(b){return a.apply(b,n)}),o.hasOwnProperty(s)&&typeof o[s]=="function")return o[s].apply(n,l);if(s.indexOf(".")>0){var m=String(s).split("."),f=o;for(c=0;c<m.length;c++){if(!f.hasOwnProperty(m[c]))throw new Error("Unrecognized operation "+s+" (failed at "+m.slice(0,c+1).join(".")+")");f=f[m[c]]}return f.apply(n,l)}throw new Error("Unrecognized operation "+s)},a.uses_data=function(i){var n=[];if(a.is_logic(i)){var s=a.get_operator(i),l=i[s];Array.isArray(l)||(l=[l]),s==="var"?n.push(l[0]):l.forEach(function(c){n.push.apply(n,a.uses_data(c))})}return r(n)},a.add_operation=function(i,n){o[i]=n},a.rm_operation=function(i){delete o[i]},a.rule_like=function(i,n){if(n===i||n==="@")return!0;if(n==="number")return typeof i=="number";if(n==="string")return typeof i=="string";if(n==="array")return Array.isArray(i)&&!a.is_logic(i);if(a.is_logic(n)){if(a.is_logic(i)){var s=a.get_operator(n),l=a.get_operator(i);if(s==="@"||s===l)return a.rule_like(a.get_values(i,!1),a.get_values(n,!1))}return!1}if(Array.isArray(n))if(Array.isArray(i)){if(n.length!==i.length)return!1;for(var c=0;c<n.length;c+=1)if(!a.rule_like(i[c],n[c]))return!1;return!0}else return!1;return!1},a})})(YI);var Wze=YI.exports;const Zze=Fn(Wze),_I=(t,e)=>{var r,a,o,i,n;switch(e){case"status":case"priority":case"display_id":case"labels":case"created_at":case"last_activity_at":return t[e];case"assignee_id":return(a=(r=t.meta)==null?void 0:r.assignee)==null?void 0:a.id;case"inbox_id":return t.inbox_id;case"team_id":return(i=(o=t.meta)==null?void 0:o.team)==null?void 0:i.id;case"browser_language":case"country_code":case"referer":return(n=t.additional_attributes)==null?void 0:n[e];default:return t.custom_attributes&&t.custom_attributes[e]?t.custom_attributes[e]:null}},dk=t=>typeof t=="object"&&t!==null&&"id"in t?t.id:t,gk=(t,e)=>{if(Array.isArray(t)){if(t.includes("all")||t==="all")return!0;if(Array.isArray(e))return t.every(r=>e.includes(r));if(!Array.isArray(e))return t.includes(e)}return e===t},hk=(t,e)=>typeof e=="string"?e.toLowerCase().includes(t.toLowerCase()):!1,mk=(t,e,r)=>{const a=j8(t),o=j8(e);return a===null||o===null?!1:r(a,o)},$I=(t,e)=>{const{filter_operator:r,values:a}=e;if(t==null)return r==="is_not_present";const o=Array.isArray(a)?a.map(dk):dk(a);switch(r){case"equal_to":return gk(o,t);case"not_equal_to":return!gk(o,t);case"contains":return hk(o,t);case"does_not_contain":return!hk(o,t);case"is_present":return!0;case"is_not_present":return!1;case"is_greater_than":return mk(t,o,(i,n)=>i>n);case"is_less_than":return mk(t,o,(i,n)=>i<n);case"days_before":{const i=new Date,n=o*24*60*60*1e3,s=new Date(i.getTime()-n);return t<s.getTime()}default:return!1}},Jze=t=>{const e=[];let r=[t[0].result];for(let a=0;a<t.length-1;a+=1)t[a].operator==="and"?r.push(t[a+1].result):(e.push(r.length===1?r[0]:{and:r}),r=[t[a+1].result]);return r.length>0&&e.push(r.length===1?r[0]:{and:r}),e.length>1?{or:e}:e[0]},Qze=(t,e)=>e.map((r,a)=>{const o=_I(t,r.attribute_key),i=$I(o,r),s=a===e.length-1?null:r.query_operator||"and";return{result:i,operator:s}}),Xze=(t,e)=>{if(!e||e.length===0)return!0;if(e.length===1){const a=_I(t,e[0].attribute_key);return $I(a,e[0])}const r=Qze(t,e);return Zze.apply(Jze(r))},eM=({accounts:t}={},e=null)=>t.find(r=>Number(r.id)===Number(e)),Np=(t,e)=>(eM(t,e)||{}).permissions||[],pk=(t,e)=>{const r=eM(t,e)||{};return r.custom_role_id?"custom_role":r.role||"agent"},Ti=({allConversations:t,selectedChatId:e})=>t.filter(r=>r.id===e),tM={getAllConversations:({allConversations:t,chatSortFilter:e})=>t.sort((r,a)=>uk(r,a,e)),getFilteredConversations:({allConversations:t,chatSortFilter:e,appliedFilters:r},a,o,i)=>{const n=i.getCurrentUser,s=i.getCurrentUser.id,l=i.getCurrentAccountId,c=Np(n,l),u=pk(n,l);return t.filter(d=>{const g=Xze(d,r),h=lk(d,u,c,s);return g&&h}).sort((d,g)=>uk(d,g,e))},getSelectedChat:({selectedChatId:t,allConversations:e})=>e.find(a=>a.id===t)||{},getSelectedChatAttachments:({selectedChatId:t,attachments:e})=>e[t]||[],getChatListFilters:({conversationFilters:t})=>t,getLastEmailInSelectedChat:(t,e)=>{const r=e.getSelectedChat,{messages:a=[]}=r;return[...a].reverse().find(i=>{const{message_type:n}=i;return i.private?!1:[nc.OUTGOING,nc.INCOMING].includes(n)})},getMineChats:(t,e,r,a)=>o=>{var n;const i=(n=a.getCurrentUser)==null?void 0:n.id;return t.allConversations.filter(s=>{const{assignee:l}=s.meta,c=l&&l.id===i,u=C3(s,o);return c&&u})},getAppliedConversationFiltersV2:t=>t.appliedFilters.map(mr),getAppliedConversationFilters:t=>t.appliedFilters,getAppliedConversationFiltersQuery:t=>t.appliedFilters.length!==0?Kze(t.appliedFilters):[],getUnAssignedChats:t=>e=>t.allConversations.filter(r=>{const a=!r.meta.assignee,o=C3(r,e);return a&&o}),getAllStatusChats:(t,e,r,a)=>o=>{const i=a.getCurrentUser,n=a.getCurrentUser.id,s=a.getCurrentAccountId,l=Np(i,s),c=pk(i,s);return t.allConversations.filter(u=>{const d=C3(u,o),g=lk(u,c,l,n);return d&&g})},getChatListLoadingStatus:({listLoadingStatus:t})=>t,getAllMessagesLoaded(t){const[e]=Ti(t);return!e||e.allMessagesLoaded===void 0?!1:e.allMessagesLoaded},getUnreadCount(t){const[e]=Ti(t);return e?e.messages.filter(r=>r.created_at*1e3>e.agent_last_seen_at*1e3&&r.message_type===0&&r.private!==!0).length:[]},getChatStatusFilter:({chatStatusFilter:t})=>t,getChatSortFilter:({chatSortFilter:t})=>t,getSelectedInbox:({currentInbox:t})=>t,getConversationById:t=>e=>t.allConversations.find(r=>r.id===Number(e)),getConversationParticipants:t=>t.conversationParticipants,getConversationLastSeen:t=>t.conversationLastSeen,getContextMenuChatId:t=>t.contextMenuChatId,getCopilotAssistant:t=>t.copilotAssistant};class Yze extends Fe{constructor(){super("conversations",{accountScoped:!0})}get({inboxId:e,status:r,assigneeType:a,page:o,labels:i,teamId:n,conversationType:s,sortBy:l,updatedWithin:c}){return axios.get(this.url,{params:{inbox_id:e,team_id:n,status:r,assignee_type:a,page:o,labels:i,conversation_type:s,sort_by:l,updated_within:c}})}filter(e){return axios.post(`${this.url}/filter`,e.queryData,{params:{page:e.page}})}search({q:e}){return axios.get(`${this.url}/search`,{params:{q:e,page:1}})}toggleStatus({conversationId:e,status:r,snoozedUntil:a=null}){return axios.post(`${this.url}/${e}/toggle_status`,{status:r,snoozed_until:a})}togglePriority({conversationId:e,priority:r}){return axios.post(`${this.url}/${e}/toggle_priority`,{priority:r})}assignAgent({conversationId:e,agentId:r}){return axios.post(`${this.url}/${e}/assignments?assignee_id=${r}`,{})}assignTeam({conversationId:e,teamId:r}){const a={team_id:r};return axios.post(`${this.url}/${e}/assignments`,a)}markMessageRead({id:e}){return axios.post(`${this.url}/${e}/update_last_seen`)}markMessagesUnread({id:e}){return axios.post(`${this.url}/${e}/unread`)}toggleTyping({conversationId:e,status:r,isPrivate:a}){return axios.post(`${this.url}/${e}/toggle_typing_status`,{typing_status:r,is_private:a})}mute(e){return axios.post(`${this.url}/${e}/mute`)}unmute(e){return axios.post(`${this.url}/${e}/unmute`)}meta({inboxId:e,status:r,assigneeType:a,labels:o,teamId:i,conversationType:n}){return axios.get(`${this.url}/meta`,{params:{inbox_id:e,status:r,assignee_type:a,labels:o,team_id:i,conversation_type:n}})}sendEmailTranscript({conversationId:e,email:r}){return axios.post(`${this.url}/${e}/transcript`,{email:r})}updateCustomAttributes({conversationId:e,customAttributes:r}){return axios.post(`${this.url}/${e}/custom_attributes`,{custom_attributes:r})}fetchParticipants(e){return axios.get(`${this.url}/${e}/participants`)}updateParticipants({conversationId:e,userIds:r}){return axios.patch(`${this.url}/${e}/participants`,{user_ids:r})}getAllAttachments(e){return axios.get(`${this.url}/${e}/attachments`)}getInboxAssistant(e){return axios.get(`${this.url}/${e}/inbox_assistant`)}delete(e){return axios.delete(`${this.url}/${e}`)}}const ar=new Yze,_ze=({message:t,isPrivate:e,contentAttributes:r,echoId:a,files:o,ccEmails:i="",bccEmails:n="",toEmails:s="",templateParams:l})=>{let c;return o&&o.length!==0?(c=new FormData,t&&c.append("content",t),o.forEach(u=>{c.append("attachments[]",u)}),c.append("private",e),c.append("echo_id",a),c.append("cc_emails",i),c.append("bcc_emails",n),s&&c.append("to_emails",s),r&&c.append("content_attributes",JSON.stringify(r))):c={content:t,private:e,echo_id:a,content_attributes:r,cc_emails:i,bcc_emails:n,to_emails:s,template_params:l},c};class $ze extends Fe{constructor(){super("conversations",{accountScoped:!0})}create({conversationId:e,message:r,private:a,contentAttributes:o,echo_id:i,files:n,ccEmails:s="",bccEmails:l="",toEmails:c="",templateParams:u}){return axios({method:"post",url:`${this.url}/${e}/messages`,data:_ze({message:r,isPrivate:a,contentAttributes:o,echoId:i,files:n,ccEmails:s,bccEmails:l,toEmails:c,templateParams:u})})}delete(e,r){return axios.delete(`${this.url}/${e}/messages/${r}`)}retry(e,r){return axios.post(`${this.url}/${e}/messages/${r}/retry`)}getPreviousMessages({conversationId:e,after:r,before:a}){const o={before:a};return r&&Number(r)!==Number(a)&&(o.after=r),axios.get(`${this.url}/${e}/messages`,{params:o})}translateMessage(e,r,a){return axios.post(`${this.url}/${e}/messages/${r}/translate`,{target_language:a})}}const yl=new $ze,eqe=({dispatch:t,filter:e,page:r,markEndReached:a})=>{t("conversationPage/setCurrentPage",{filter:e,page:r},{root:!0}),a&&t("conversationPage/setEndReached",{filter:e},{root:!0})},tqe=(t,e)=>{t(`contacts/${p.SET_CONTACTS}`,e.map(r=>r.meta.sender))},fk=({route:{name:t}})=>["conversation_mentions","conversation_through_mentions"].includes(t),wk=({route:{name:t}})=>["conversation_unattended","conversation_through_unattended"].includes(t),rqe=({route:{name:t}})=>["folder_conversations","conversations_through_folders"].includes(t),vk=(t,e,r,a)=>{const{payload:o,meta:i}=r;t.commit(p.SET_ALL_CONVERSATION,o),t.dispatch("conversationStats/set",i),t.dispatch("conversationLabels/setBulkConversationLabels",o),t.commit(p.CLEAR_LIST_LOADING_STATUS),tqe(t.commit,o),eqe({dispatch:t.dispatch,filter:a,page:e.page,markEndReached:!o.length})},aqe={markMessagesRead:async({commit:t},e)=>{try{const{data:{id:r,agent_last_seen_at:a}}=await ar.markMessageRead(e);setTimeout(()=>t(p.UPDATE_MESSAGE_UNREAD_COUNT,{id:r,lastSeen:a}),4e3)}catch{}},markMessagesUnread:async({commit:t},{id:e})=>{try{const{data:{agent_last_seen_at:r,unread_count:a}}=await ar.markMessagesUnread({id:e});t(p.UPDATE_MESSAGE_UNREAD_COUNT,{id:e,lastSeen:r,unreadCount:a})}catch(r){Me(r)}}},oqe={async translateMessage(t,{conversationId:e,messageId:r,targetLanguage:a}){try{await yl.translateMessage(e,r,a)}catch{}}},iqe=t=>{const{content_attributes:e,status:r}=t,a=(e==null?void 0:e.external_error)??"";return r===fn.FAILED&&a!==""},nqe={getConversation:async({commit:t},e)=>{try{const r=await ar.show(e);t(p.UPDATE_CONVERSATION,r.data),t(`contacts/${p.SET_CONTACT_ITEM}`,r.data.meta.sender)}catch{}},fetchAllConversations:async({commit:t,state:e,dispatch:r})=>{t(p.SET_LIST_LOADING_STATUS);try{const a=e.conversationFilters,{data:{data:o}}=await ar.get(a);vk({commit:t,dispatch:r},a,o,a.assigneeType)}catch{}},fetchFilteredConversations:async({commit:t,dispatch:e},r)=>{t(p.SET_LIST_LOADING_STATUS);try{const{data:a}=await ar.filter(r);vk({commit:t,dispatch:e},r,a,"appliedFilters")}catch{}},emptyAllConversations({commit:t}){t(p.EMPTY_ALL_CONVERSATION)},clearSelectedState({commit:t}){t(p.CLEAR_CURRENT_CHAT_WINDOW)},fetchPreviousMessages:async({commit:t},e)=>{try{const{data:{meta:r,payload:a}}=await yl.getPreviousMessages(e);t(`conversationMetadata/${p.SET_CONVERSATION_METADATA}`,{id:e.conversationId,data:r}),t(p.SET_PREVIOUS_CONVERSATIONS,{id:e.conversationId,data:a}),a.length||t(p.SET_ALL_MESSAGES_LOADED)}catch{}},fetchAllAttachments:async({commit:t},e)=>{let r=[];try{const{data:a}=await ar.getAllAttachments(e);r=a.payload}catch(a){tg("Conversation",{id:e}),Rc(a)}finally{t(p.SET_ALL_ATTACHMENTS,{id:e,data:r})}},syncActiveConversationMessages:async({commit:t,state:e,dispatch:r},{conversationId:a})=>{const{allConversations:o,syncConversationsMessages:i}=e,n=i[a],s=o.find(l=>l.id===a);if(s)try{const{messages:l}=s,{data:{meta:c,payload:u}}=await yl.getPreviousMessages({conversationId:a,after:n});t(`conversationMetadata/${p.SET_CONVERSATION_METADATA}`,{id:a,data:c});const d=u.filter(h=>!l.find(m=>m.id===h.id));s.messages.push(...d);const g=s.messages.sort((h,m)=>new Date(h.created_at)-new Date(m.created_at));t(p.SET_MISSING_MESSAGES,{id:a,data:g}),t(p.SET_LAST_MESSAGE_ID_IN_SYNC_CONVERSATION,{conversationId:a,messageId:null}),r("markMessagesRead",{id:a},{root:!0})}catch{}},setConversationLastMessageId:async({commit:t,state:e},{conversationId:r})=>{const{allConversations:a}=e,o=a.find(s=>s.id===r);if(!o)return;const{messages:i}=o,n=i.last();n&&t(p.SET_LAST_MESSAGE_ID_IN_SYNC_CONVERSATION,{conversationId:r,messageId:n.id})},async setActiveChat({commit:t,dispatch:e},{data:r,after:a}){if(t(p.SET_CURRENT_CHAT_WINDOW,r),t(p.CLEAR_ALL_MESSAGES_LOADED),r.dataFetched===void 0)try{await e("fetchPreviousMessages",{after:a,before:r.messages[0].id,conversationId:r.id}),r.dataFetched=!0}catch{}},assignAgent:async({dispatch:t},{conversationId:e,agentId:r})=>{try{const a=await ar.assignAgent({conversationId:e,agentId:r});t("setCurrentChatAssignee",a.data)}catch{}},setCurrentChatAssignee({commit:t},e){t(p.ASSIGN_AGENT,e)},assignTeam:async({dispatch:t},{conversationId:e,teamId:r})=>{try{const a=await ar.assignTeam({conversationId:e,teamId:r});t("setCurrentChatTeam",{team:a.data,conversationId:e})}catch{}},setCurrentChatTeam({commit:t},{team:e,conversationId:r}){t(p.ASSIGN_TEAM,{team:e,conversationId:r})},toggleStatus:async({commit:t},{conversationId:e,status:r,snoozedUntil:a=null})=>{try{const{data:{payload:{current_status:o,snoozed_until:i}={}}={}}=await ar.toggleStatus({conversationId:e,status:r,snoozedUntil:a});t(p.CHANGE_CONVERSATION_STATUS,{conversationId:e,status:o,snoozedUntil:i})}catch{}},createPendingMessageAndSend:async({dispatch:t},e)=>{const r=mBe(e);t("sendMessageWithData",r)},sendMessageWithData:async({commit:t},e)=>{const{conversation_id:r,id:a}=e;try{t(p.ADD_MESSAGE,{...e,status:fn.PROGRESS});const o=iqe(e)?await yl.retry(r,a):await yl.create(e);t(p.ADD_MESSAGE,{...o.data,status:fn.SENT}),t(p.ADD_CONVERSATION_ATTACHMENTS,{...o.data,status:fn.SENT})}catch(o){const i=o.response?o.response.data.error:void 0;throw t(p.ADD_MESSAGE,{...e,meta:{error:i},status:fn.FAILED}),o}},addMessage({commit:t},e){t(p.ADD_MESSAGE,e),e.message_type===nc.INCOMING&&(t(p.SET_CONVERSATION_CAN_REPLY,{conversationId:e.conversation_id,canReply:!0}),t(p.ADD_CONVERSATION_ATTACHMENTS,e))},updateMessage({commit:t},e){t(p.ADD_MESSAGE,e)},deleteMessage:async function({commit:e},{conversationId:r,messageId:a}){try{const{data:o}=await yl.delete(r,a);e(p.ADD_MESSAGE,o),e(p.DELETE_CONVERSATION_ATTACHMENTS,o)}catch(o){throw new Error(o)}},deleteConversation:async({commit:t,dispatch:e},r)=>{try{await ar.delete(r),t(p.DELETE_CONVERSATION,r),e("conversationStats/get",{},{root:!0})}catch(a){throw new Error(a)}},addConversation({commit:t,state:e,dispatch:r,rootState:a},o){const{currentInbox:i,appliedFilters:n}=e,{inbox_id:s,meta:{sender:l}}=o,c=!!n.length,u=!i||Number(i)===s;!c&&!rqe(a)&&!fk(a)&&!wk(a)&&u&&(t(p.ADD_CONVERSATION,o),r("contacts/setContact",l))},addMentions({dispatch:t,rootState:e},r){fk(e)&&t("updateConversation",r)},addUnattended({dispatch:t,rootState:e},r){wk(e)&&t("updateConversation",r)},updateConversation({commit:t,dispatch:e},r){const{meta:{sender:a}}=r;t(p.UPDATE_CONVERSATION,r),e("conversationLabels/setConversationLabel",{id:r.id,data:r.labels}),e("contacts/setContact",a)},updateConversationLastActivity({commit:t},{conversationId:e,lastActivityAt:r}){t(p.UPDATE_CONVERSATION_LAST_ACTIVITY,{lastActivityAt:r,conversationId:e})},setChatStatusFilter({commit:t},e){t(p.CHANGE_CHAT_STATUS_FILTER,e)},setChatSortFilter({commit:t},e){t(p.CHANGE_CHAT_SORT_FILTER,e)},updateAssignee({commit:t},e){t(p.UPDATE_ASSIGNEE,e)},updateConversationContact({commit:t},e){e.id&&t(`contacts/${p.SET_CONTACT_ITEM}`,e),t(p.UPDATE_CONVERSATION_CONTACT,e)},setActiveInbox({commit:t},e){t(p.SET_ACTIVE_INBOX,e)},muteConversation:async({commit:t},e)=>{try{await ar.mute(e),t(p.MUTE_CONVERSATION)}catch{}},unmuteConversation:async({commit:t},e)=>{try{await ar.unmute(e),t(p.UNMUTE_CONVERSATION)}catch{}},sendEmailTranscript:async(t,{conversationId:e,email:r})=>{try{await ar.sendEmailTranscript({conversationId:e,email:r})}catch(a){throw new Error(a)}},updateCustomAttributes:async({commit:t},{conversationId:e,customAttributes:r})=>{try{const a=await ar.updateCustomAttributes({conversationId:e,customAttributes:r}),{custom_attributes:o}=a.data;t(p.UPDATE_CONVERSATION_CUSTOM_ATTRIBUTES,o)}catch{}},setConversationFilters({commit:t},e){t(p.SET_CONVERSATION_FILTERS,e)},clearConversationFilters({commit:t}){t(p.CLEAR_CONVERSATION_FILTERS)},setChatListFilters({commit:t},e){t(p.SET_CHAT_LIST_FILTERS,e)},updateChatListFilters({commit:t},e){t(p.UPDATE_CHAT_LIST_FILTERS,e)},assignPriority:async({dispatch:t},{conversationId:e,priority:r})=>{try{await ar.togglePriority({conversationId:e,priority:r}),t("setCurrentChatPriority",{priority:r,conversationId:e})}catch{}},setCurrentChatPriority({commit:t},{priority:e,conversationId:r}){t(p.ASSIGN_PRIORITY,{priority:e,conversationId:r})},setContextMenuChatId({commit:t},e){t(p.SET_CONTEXT_MENU_CHAT_ID,e)},getInboxCaptainAssistantById:async({commit:t},e)=>{try{const r=await ar.getInboxAssistant(e);t(p.SET_INBOX_CAPTAIN_ASSISTANT,r.data)}catch{}},...aqe,...oqe},sqe={allConversations:[],attachments:{},listLoadingStatus:!0,chatStatusFilter:oc.STATUS_TYPE.OPEN,chatSortFilter:oc.SORT_BY_TYPE.LATEST,currentInbox:null,selectedChatId:null,appliedFilters:[],contextMenuChatId:null,conversationParticipants:[],conversationLastSeen:null,syncConversationsMessages:{},conversationFilters:{},copilotAssistant:{}},lqe={[p.SET_ALL_CONVERSATION](t,e){const r=[...t.allConversations];e.forEach(a=>{const o=r.findIndex(i=>i.id===a.id);if(o<0)r.push(a);else if(a.id!==t.selectedChatId)r[o]=a;else{const i=r[o];r[o]={...a,allMessagesLoaded:i.allMessagesLoaded,messages:i.messages,dataFetched:i.dataFetched}}}),t.allConversations=r},[p.EMPTY_ALL_CONVERSATION](t){t.allConversations=[],t.selectedChatId=null},[p.SET_ALL_MESSAGES_LOADED](t){const[e]=Ti(t);e.allMessagesLoaded=!0},[p.CLEAR_ALL_MESSAGES_LOADED](t){const[e]=Ti(t);e.allMessagesLoaded=!1},[p.CLEAR_CURRENT_CHAT_WINDOW](t){t.selectedChatId=null},[p.SET_PREVIOUS_CONVERSATIONS](t,{id:e,data:r}){if(r.length){const[a]=t.allConversations.filter(o=>o.id===e);a.messages.unshift(...r)}},[p.SET_ALL_ATTACHMENTS](t,{id:e,data:r}){t.attachments[e]=[...r]},[p.SET_MISSING_MESSAGES](t,{id:e,data:r}){const[a]=t.allConversations.filter(o=>o.id===e);a&&(a.messages=r)},[p.SET_CURRENT_CHAT_WINDOW](t,e){e&&(t.selectedChatId=e.id)},[p.ASSIGN_AGENT](t,e){const[r]=Ti(t);r.meta.assignee=e},[p.ASSIGN_TEAM](t,{team:e,conversationId:r}){const[a]=t.allConversations.filter(o=>o.id===r);a.meta.team=e},[p.UPDATE_CONVERSATION_LAST_ACTIVITY](t,{lastActivityAt:e,conversationId:r}){const[a]=t.allConversations.filter(o=>o.id===r);a&&(a.last_activity_at=e)},[p.ASSIGN_PRIORITY](t,{priority:e,conversationId:r}){const[a]=t.allConversations.filter(o=>o.id===r);a.priority=e},[p.UPDATE_CONVERSATION_CUSTOM_ATTRIBUTES](t,e){const[r]=Ti(t);r.custom_attributes=e},[p.CHANGE_CONVERSATION_STATUS](t,{conversationId:e,status:r,snoozedUntil:a}){const o=tM.getConversationById(t)(e)||{};o.snoozed_until=a,o.status=r},[p.MUTE_CONVERSATION](t){const[e]=Ti(t);e.muted=!0},[p.UNMUTE_CONVERSATION](t){const[e]=Ti(t);e.muted=!1},[p.ADD_CONVERSATION_ATTACHMENTS](t,e){var i;if(e.status!==fn.SENT||!((i=e.attachments)!=null&&i.length))return;const r=e.conversation_id,a=t.attachments[r]||[],o=e.attachments.filter(n=>!a.some(s=>s.id===n.id));t.attachments[r]=[...a,...o]},[p.DELETE_CONVERSATION_ATTACHMENTS](t,e){if(e.status!==fn.SENT)return;const{conversation_id:r}=e,a=t.attachments[r]||[];a.length&&(t.attachments[r]=a.filter(o=>o.message_id!==e.id))},[p.ADD_MESSAGE]({allConversations:t,selectedChatId:e},r){const{conversation_id:a}=r,[o]=Ti({allConversations:t,selectedChatId:a});if(!o)return;const i=Dze(o,r);if(i!==-1)o.messages[i]=r;else{o.messages.push(r),o.timestamp=r.created_at;const{conversation:{unread_count:n=0}={}}=r;o.unread_count=n,e===a&&(yr.emit(Ri.FETCH_LABEL_SUGGESTIONS),yr.emit(Ri.SCROLL_TO_MESSAGE))}},[p.ADD_CONVERSATION](t,e){t.allConversations.push(e)},[p.DELETE_CONVERSATION](t,e){t.allConversations=t.allConversations.filter(r=>r.id!==e)},[p.UPDATE_CONVERSATION](t,e){const{allConversations:r}=t,a=r.findIndex(o=>o.id===e.id);if(a>-1){const o=r[a];if(e.updated_at<o.updated_at)return;const{messages:i,...n}=e;r[a]={...o,...n},t.selectedChatId===e.id&&(yr.emit(Ri.FETCH_LABEL_SUGGESTIONS),yr.emit(Ri.SCROLL_TO_MESSAGE))}else t.allConversations.push(e)},[p.SET_LIST_LOADING_STATUS](t){t.listLoadingStatus=!0},[p.CLEAR_LIST_LOADING_STATUS](t){t.listLoadingStatus=!1},[p.UPDATE_MESSAGE_UNREAD_COUNT](t,{id:e,lastSeen:r,unreadCount:a=0}){const[o]=t.allConversations.filter(i=>i.id===e);o&&(o.agent_last_seen_at=r,o.unread_count=a)},[p.CHANGE_CHAT_STATUS_FILTER](t,e){t.chatStatusFilter=e},[p.CHANGE_CHAT_SORT_FILTER](t,e){t.chatSortFilter=e},[p.UPDATE_ASSIGNEE](t,e){const[r]=t.allConversations.filter(a=>a.id===e.id);r.meta.assignee=e.assignee},[p.UPDATE_CONVERSATION_CONTACT](t,{conversationId:e,...r}){const[a]=t.allConversations.filter(o=>o.id===e);a&&(a.meta.sender=r)},[p.SET_ACTIVE_INBOX](t,e){t.currentInbox=e?parseInt(e,10):null},[p.SET_CONVERSATION_CAN_REPLY](t,{conversationId:e,canReply:r}){const[a]=t.allConversations.filter(o=>o.id===e);a&&(a.can_reply=r)},[p.CLEAR_CONTACT_CONVERSATIONS](t,e){const r=t.allConversations.filter(a=>a.meta.sender.id!==e);t.allConversations=r},[p.SET_CONVERSATION_FILTERS](t,e){t.appliedFilters=e},[p.CLEAR_CONVERSATION_FILTERS](t){t.appliedFilters=[]},[p.SET_LAST_MESSAGE_ID_IN_SYNC_CONVERSATION](t,{conversationId:e,messageId:r}){t.syncConversationsMessages[e]=r},[p.SET_CONTEXT_MENU_CHAT_ID](t,e){t.contextMenuChatId=e},[p.SET_CHAT_LIST_FILTERS](t,e){t.conversationFilters=e},[p.UPDATE_CHAT_LIST_FILTERS](t,e){t.conversationFilters={...t.conversationFilters,...e}},[p.SET_INBOX_CAPTAIN_ASSISTANT](t,e){t.copilotAssistant=e.assistant}},cqe={state:sqe,getters:tM,actions:nqe,mutations:lqe};class uqe extends Fe{constructor(){super("search",{accountScoped:!0})}get({q:e}){return axios.get(this.url,{params:{q:e}})}contacts({q:e,page:r=1}){return axios.get(`${this.url}/contacts`,{params:{q:e,page:r}})}conversations({q:e,page:r=1}){return axios.get(`${this.url}/conversations`,{params:{q:e,page:r}})}messages({q:e,page:r=1}){return axios.get(`${this.url}/messages`,{params:{q:e,page:r}})}articles({q:e,page:r=1}){return axios.get(`${this.url}/articles`,{params:{q:e,page:r}})}}const r1=new uqe,dqe={records:[],contactRecords:[],conversationRecords:[],messageRecords:[],articleRecords:[],uiFlags:{isFetching:!1,isSearchCompleted:!1,contact:{isFetching:!1},conversation:{isFetching:!1},message:{isFetching:!1},article:{isFetching:!1}}},gqe={getConversations(t){return t.records},getContactRecords(t){return t.contactRecords},getConversationRecords(t){return t.conversationRecords},getMessageRecords(t){return t.messageRecords},getArticleRecords(t){return t.articleRecords},getUIFlags(t){return t.uiFlags}},hqe={async get({commit:t},{q:e}){if(t(p.SEARCH_CONVERSATIONS_SET,[]),!!e){t(p.SEARCH_CONVERSATIONS_SET_UI_FLAG,{isFetching:!0});try{const{data:{payload:r}}=await r1.get({q:e});t(p.SEARCH_CONVERSATIONS_SET,r)}catch{}finally{t(p.SEARCH_CONVERSATIONS_SET_UI_FLAG,{isFetching:!1})}}},async fullSearch({commit:t,dispatch:e},{q:r}){if(r){t(p.FULL_SEARCH_SET_UI_FLAG,{isFetching:!0,isSearchCompleted:!1});try{await Promise.all([e("contactSearch",{q:r}),e("conversationSearch",{q:r}),e("messageSearch",{q:r}),e("articleSearch",{q:r})])}catch{}finally{t(p.FULL_SEARCH_SET_UI_FLAG,{isFetching:!1,isSearchCompleted:!0})}}},async contactSearch({commit:t},{q:e,page:r=1}){t(p.CONTACT_SEARCH_SET_UI_FLAG,{isFetching:!0});try{const{data:a}=await r1.contacts({q:e,page:r});t(p.CONTACT_SEARCH_SET,a.payload.contacts)}catch{}finally{t(p.CONTACT_SEARCH_SET_UI_FLAG,{isFetching:!1})}},async conversationSearch({commit:t},{q:e,page:r=1}){t(p.CONVERSATION_SEARCH_SET_UI_FLAG,{isFetching:!0});try{const{data:a}=await r1.conversations({q:e,page:r});t(p.CONVERSATION_SEARCH_SET,a.payload.conversations)}catch{}finally{t(p.CONVERSATION_SEARCH_SET_UI_FLAG,{isFetching:!1})}},async messageSearch({commit:t},{q:e,page:r=1}){t(p.MESSAGE_SEARCH_SET_UI_FLAG,{isFetching:!0});try{const{data:a}=await r1.messages({q:e,page:r});t(p.MESSAGE_SEARCH_SET,a.payload.messages)}catch{}finally{t(p.MESSAGE_SEARCH_SET_UI_FLAG,{isFetching:!1})}},async articleSearch({commit:t},{q:e,page:r=1}){t(p.ARTICLE_SEARCH_SET_UI_FLAG,{isFetching:!0});try{const{data:a}=await r1.articles({q:e,page:r});t(p.ARTICLE_SEARCH_SET,a.payload.articles)}catch{}finally{t(p.ARTICLE_SEARCH_SET_UI_FLAG,{isFetching:!1})}},async clearSearchResults({commit:t}){t(p.CLEAR_SEARCH_RESULTS)}},mqe={[p.SEARCH_CONVERSATIONS_SET](t,e){t.records=e},[p.CONTACT_SEARCH_SET](t,e){t.contactRecords=[...t.contactRecords,...e]},[p.CONVERSATION_SEARCH_SET](t,e){t.conversationRecords=[...t.conversationRecords,...e]},[p.MESSAGE_SEARCH_SET](t,e){t.messageRecords=[...t.messageRecords,...e]},[p.ARTICLE_SEARCH_SET](t,e){t.articleRecords=[...t.articleRecords,...e]},[p.SEARCH_CONVERSATIONS_SET_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.FULL_SEARCH_SET_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.CONTACT_SEARCH_SET_UI_FLAG](t,e){t.uiFlags.contact={...t.uiFlags.contact,...e}},[p.CONVERSATION_SEARCH_SET_UI_FLAG](t,e){t.uiFlags.conversation={...t.uiFlags.conversation,...e}},[p.MESSAGE_SEARCH_SET_UI_FLAG](t,e){t.uiFlags.message={...t.uiFlags.message,...e}},[p.ARTICLE_SEARCH_SET_UI_FLAG](t,e){t.uiFlags.article={...t.uiFlags.article,...e}},[p.CLEAR_SEARCH_RESULTS](t){t.contactRecords=[],t.conversationRecords=[],t.messageRecords=[],t.articleRecords=[]}},pqe={namespaced:!0,state:dqe,getters:gqe,actions:hqe,mutations:mqe},fqe={mineCount:0,unAssignedCount:0,allCount:0},wqe={getStats:t=>t},rM=async(t,e)=>{try{const r=await ar.meta(e),{data:{meta:a}}=r;t(p.SET_CONV_TAB_META,a)}catch{}},vqe=Yu(rM,500,!1,1e3),bqe=Yu(rM,500,!1,5e3),Eqe={get:async({commit:t,state:e},r)=>{e.allCount>100?bqe(t,r):vqe(t,r)},set({commit:t},e){t(p.SET_CONV_TAB_META,e)}},kqe={[p.SET_CONV_TAB_META](t,{mine_count:e,unassigned_count:r,all_count:a}={}){t.mineCount=e,t.allCount=a,t.unAssignedCount=r,t.updatedOn=new Date}},Cqe={namespaced:!0,state:fqe,getters:wqe,actions:Eqe,mutations:kqe},Aqe={records:{}},xqe={getUserList:t=>e=>t.records[Number(e)]||[]},yqe={toggleTyping:async(t,{status:e,conversationId:r,isPrivate:a})=>{try{await ar.toggleTyping({status:e,conversationId:r,isPrivate:a})}catch{}},create:({commit:t},{conversationId:e,user:r})=>{t(p.ADD_USER_TYPING_TO_CONVERSATION,{conversationId:e,user:r})},destroy:({commit:t},{conversationId:e,user:r})=>{t(p.REMOVE_USER_TYPING_FROM_CONVERSATION,{conversationId:e,user:r})}},Tqe={[p.ADD_USER_TYPING_TO_CONVERSATION]:(t,{conversationId:e,user:r})=>{const a=t.records[e]||[];!!a.filter(i=>i.id===r.id&&i.type===r.type).length||(t.records={...t.records,[e]:[...a,r]})},[p.REMOVE_USER_TYPING_FROM_CONVERSATION]:(t,{conversationId:e,user:r})=>{const o=(t.records[e]||[]).filter(i=>i.id!==r.id||i.type!==r.type);t.records={...t.records,[e]:o}}},Sqe={namespaced:!0,state:Aqe,getters:xqe,actions:yqe,mutations:Tqe},Iqe={records:{},uiFlags:{isFetching:!1,isUpdating:!1}},Mqe={getUIFlags(t){return t.uiFlags},getByConversationId:t=>e=>t.records[e]},Oqe={show:async({commit:t},{conversationId:e})=>{t(p.SET_CONVERSATION_PARTICIPANTS_UI_FLAG,{isFetching:!0});try{const r=await ar.fetchParticipants(e);t(p.SET_CONVERSATION_PARTICIPANTS,{conversationId:e,data:r.data})}catch(r){Me(r)}finally{t(p.SET_CONVERSATION_PARTICIPANTS_UI_FLAG,{isFetching:!1})}},update:async({commit:t},{conversationId:e,userIds:r})=>{t(p.SET_CONVERSATION_PARTICIPANTS_UI_FLAG,{isUpdating:!0});try{const a=await ar.updateParticipants({conversationId:e,userIds:r});t(p.SET_CONVERSATION_PARTICIPANTS,{conversationId:e,data:a.data})}catch(a){Me(a)}finally{t(p.SET_CONVERSATION_PARTICIPANTS_UI_FLAG,{isUpdating:!1})}}},Lqe={[p.SET_CONVERSATION_PARTICIPANTS_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.SET_CONVERSATION_PARTICIPANTS](t,{data:e,conversationId:r}){t.records={...t.records,[r]:e}}},Rqe={namespaced:!0,state:Iqe,getters:Mqe,actions:Oqe,mutations:Lqe};class Nqe extends Fe{constructor(){super("csat_survey_responses",{accountScoped:!0})}get({page:e,from:r,to:a,user_ids:o,inbox_id:i,team_id:n,rating:s}={}){return axios.get(this.url,{params:{page:e,since:r,until:a,sort:"-created_at",user_ids:o,inbox_id:i,team_id:n,rating:s}})}download({from:e,to:r,user_ids:a,inbox_id:o,team_id:i,rating:n}={}){return axios.get(`${this.url}/download`,{params:{since:e,until:r,sort:"-created_at",user_ids:a,inbox_id:o,team_id:i,rating:n}})}getMetrics({from:e,to:r,user_ids:a,inbox_id:o,team_id:i,rating:n}={}){return axios.get(`${this.url}/metrics`,{params:{since:e,until:r,user_ids:a,inbox_id:o,team_id:i,rating:n}})}}const A3=new Nqe,ls=(t,e)=>{const r="data:text/csv;charset=utf-8;",a=new Blob([e],{type:r}),o=URL.createObjectURL(a),i=document.createElement("a");return i.setAttribute("download",t),i.setAttribute("href",o),i.click(),i},Dqe=({type:t,to:e,businessHours:r=!1})=>{let a=`${t}-report-${Gm(ty(e),"dd-MM-yyyy")}`;return r&&(a=`${a}-business-hours`),`${a}.csv`},ts=(t,e)=>(t*100/e).toFixed(2),Vqe={records:[],metrics:{totalResponseCount:0,ratingsCount:{1:0,2:0,3:0,4:0,5:0},totalSentMessagesCount:0},uiFlags:{isFetching:!1,isFetchingMetrics:!1}},Bqe={getCSATResponses(t){return t.records},getMetrics(t){return t.metrics},getUIFlags(t){return t.uiFlags},getSatisfactionScore(t){return t.metrics.totalResponseCount?ts(t.metrics.ratingsCount[4]+t.metrics.ratingsCount[5],t.metrics.totalResponseCount):0},getResponseRate(t){return t.metrics.totalSentMessagesCount?ts(t.metrics.totalResponseCount,t.metrics.totalSentMessagesCount):0},getRatingPercentage(t){return t.metrics.totalResponseCount?{1:ts(t.metrics.ratingsCount[1],t.metrics.totalResponseCount),2:ts(t.metrics.ratingsCount[2],t.metrics.totalResponseCount),3:ts(t.metrics.ratingsCount[3],t.metrics.totalResponseCount),4:ts(t.metrics.ratingsCount[4],t.metrics.totalResponseCount),5:ts(t.metrics.ratingsCount[5],t.metrics.totalResponseCount)}:{1:0,2:0,3:0,4:0,5:0}}},Pqe={get:async function({commit:e},r){e(p.SET_CSAT_RESPONSE_UI_FLAG,{isFetching:!0});try{const a=await A3.get(r);e(p.SET_CSAT_RESPONSE,a.data)}catch{}finally{e(p.SET_CSAT_RESPONSE_UI_FLAG,{isFetching:!1})}},getMetrics:async function({commit:e},r){e(p.SET_CSAT_RESPONSE_UI_FLAG,{isFetchingMetrics:!0});try{const a=await A3.getMetrics(r);e(p.SET_CSAT_RESPONSE_METRICS,a.data)}catch{}finally{e(p.SET_CSAT_RESPONSE_UI_FLAG,{isFetchingMetrics:!1})}},downloadCSATReports(t,e){return A3.download(e).then(r=>{ls(e.fileName,r.data),Fr.track(Cl.DOWNLOAD_REPORT,{reportType:"csat"})})}},Fqe={[p.SET_CSAT_RESPONSE_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.SET_CSAT_RESPONSE]:ur,[p.SET_CSAT_RESPONSE_METRICS](t,{total_count:e,ratings_count:r,total_sent_messages_count:a}){t.metrics.totalResponseCount=e||0,t.metrics.ratingsCount={1:r[1]||0,2:r[2]||0,3:r[3]||0,4:r[4]||0,5:r[5]||0},t.metrics.totalSentMessagesCount=a||0}},Uqe={namespaced:!0,state:Vqe,getters:Bqe,actions:Pqe,mutations:Fqe};class jqe extends Fe{constructor(){super("custom_roles",{accountScoped:!0})}}const F2=new jqe,zqe={records:[],uiFlags:{fetchingList:!1,creatingItem:!1,updatingItem:!1,deletingItem:!1}},qqe={getCustomRoles(t){return t.records},getUIFlags(t){return t.uiFlags}},Gqe={getCustomRole:async function({commit:e}){e(p.SET_CUSTOM_ROLE_UI_FLAG,{fetchingList:!0});try{const r=await F2.get();e(p.SET_CUSTOM_ROLE,r.data),e(p.SET_CUSTOM_ROLE_UI_FLAG,{fetchingList:!1})}catch{e(p.SET_CUSTOM_ROLE_UI_FLAG,{fetchingList:!1})}},createCustomRole:async function({commit:e},r){e(p.SET_CUSTOM_ROLE_UI_FLAG,{creatingItem:!0});try{const a=await F2.create(r);return e(p.ADD_CUSTOM_ROLE,a.data),e(p.SET_CUSTOM_ROLE_UI_FLAG,{creatingItem:!1}),a.data}catch(a){return e(p.SET_CUSTOM_ROLE_UI_FLAG,{creatingItem:!1}),Me(a)}},updateCustomRole:async function({commit:e},{id:r,...a}){e(p.SET_CUSTOM_ROLE_UI_FLAG,{updatingItem:!0});try{const o=await F2.update(r,a);return e(p.EDIT_CUSTOM_ROLE,o.data),e(p.SET_CUSTOM_ROLE_UI_FLAG,{updatingItem:!1}),o.data}catch(o){return e(p.SET_CUSTOM_ROLE_UI_FLAG,{updatingItem:!1}),Me(o)}},deleteCustomRole:async function({commit:e},r){e(p.SET_CUSTOM_ROLE_UI_FLAG,{deletingItem:!0});try{return await F2.delete(r),e(p.DELETE_CUSTOM_ROLE,r),e(p.SET_CUSTOM_ROLE_UI_FLAG,{deletingItem:!0}),r}catch(a){return e(p.SET_CUSTOM_ROLE_UI_FLAG,{deletingItem:!0}),Me(a)}}},Hqe={[p.SET_CUSTOM_ROLE_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.SET_CUSTOM_ROLE]:ur,[p.ADD_CUSTOM_ROLE]:Ma,[p.EDIT_CUSTOM_ROLE]:ua,[p.DELETE_CUSTOM_ROLE]:da},Kqe={namespaced:!0,state:zqe,getters:qqe,actions:Gqe,mutations:Hqe};class Wqe extends Fe{constructor(){super("custom_filters",{accountScoped:!0})}getCustomViewsByFilterType(e){return axios.get(`${this.url}?filter_type=${e}`)}deleteCustomViews(e,r){return axios.delete(`${this.url}/${e}?filter_type=${r}`)}}const U2=new Wqe,Ko={CONVERSATION:"conversation",CONTACT:"contact"},Dp={0:Ko.CONVERSATION,1:Ko.CONTACT,[Ko.CONVERSATION]:Ko.CONVERSATION,[Ko.CONTACT]:Ko.CONTACT},Zqe={[Ko.CONVERSATION]:{records:[]},[Ko.CONTACT]:{records:[]},uiFlags:{isFetching:!1,isCreating:!1,isDeleting:!1},activeConversationFolder:null},Jqe={getUIFlags(t){return t.uiFlags},getCustomViewsByFilterType:t=>e=>{const r=Dp[e];return t[r].records},getConversationCustomViews(t){return t[Ko.CONVERSATION].records},getContactCustomViews(t){return t[Ko.CONTACT].records},getActiveConversationFolder(t){return t.activeConversationFolder}},Qqe={get:async function({commit:e},r){e(p.SET_CUSTOM_VIEW_UI_FLAG,{isFetching:!0});try{const a=await U2.getCustomViewsByFilterType(r);e(p.SET_CUSTOM_VIEW,{data:a.data,filterType:r})}catch{}finally{e(p.SET_CUSTOM_VIEW_UI_FLAG,{isFetching:!1})}},create:async function({commit:e},r){var a,o;e(p.SET_CUSTOM_VIEW_UI_FLAG,{isCreating:!0});try{const i=await U2.create(r);return e(p.ADD_CUSTOM_VIEW,{data:i.data,filterType:Dp[r.filter_type]}),i}catch(i){const n=(o=(a=i==null?void 0:i.response)==null?void 0:a.data)==null?void 0:o.message;throw new Error(n)}finally{e(p.SET_CUSTOM_VIEW_UI_FLAG,{isCreating:!1})}},update:async function({commit:e},r){var a,o;e(p.SET_CUSTOM_VIEW_UI_FLAG,{isCreating:!0});try{const i=await U2.update(r.id,r);e(p.UPDATE_CUSTOM_VIEW,{data:i.data,filterType:Dp[r.filter_type]})}catch(i){const n=(o=(a=i==null?void 0:i.response)==null?void 0:a.data)==null?void 0:o.message;throw new Error(n)}finally{e(p.SET_CUSTOM_VIEW_UI_FLAG,{isCreating:!1})}},delete:async({commit:t},{id:e,filterType:r})=>{t(p.SET_CUSTOM_VIEW_UI_FLAG,{isDeleting:!0});try{await U2.deleteCustomViews(e,r),t(p.DELETE_CUSTOM_VIEW,{data:e,filterType:r})}catch(a){throw new Error(a)}finally{t(p.SET_CUSTOM_VIEW_UI_FLAG,{isDeleting:!1})}},setActiveConversationFolder({commit:t},e){t(p.SET_ACTIVE_CONVERSATION_FOLDER,e)}},Xqe={[p.SET_CUSTOM_VIEW_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.ADD_CUSTOM_VIEW]:(t,{data:e,filterType:r})=>{Ma(t[r],e)},[p.SET_CUSTOM_VIEW]:(t,{data:e,filterType:r})=>{ur(t[r],e)},[p.UPDATE_CUSTOM_VIEW]:(t,{data:e,filterType:r})=>{ua(t[r],e)},[p.DELETE_CUSTOM_VIEW]:(t,{data:e,filterType:r})=>{da(t[r],e)},[p.SET_ACTIVE_CONVERSATION_FOLDER](t,e){t.activeConversationFolder=e}},Yqe={namespaced:!0,actions:Qqe,state:Zqe,getters:Jqe,mutations:Xqe};class _qe extends Fe{constructor(){super("dashboard_apps",{accountScoped:!0})}}const j2=new _qe,$qe={records:[],uiFlags:{isFetching:!1,isCreating:!1,isDeleting:!1}},eGe={getUIFlags(t){return t.uiFlags},getRecords(t){return t.records}},tGe={get:async function({commit:e}){e(p.SET_DASHBOARD_APPS_UI_FLAG,{isFetching:!0});try{const r=await j2.get();e(p.SET_DASHBOARD_APPS,r.data)}catch{}finally{e(p.SET_DASHBOARD_APPS_UI_FLAG,{isFetching:!1})}},create:async function({commit:e},r){var a,o;e(p.SET_DASHBOARD_APPS_UI_FLAG,{isCreating:!0});try{const i=await j2.create(r);e(p.CREATE_DASHBOARD_APP,i.data)}catch(i){const n=(o=(a=i==null?void 0:i.response)==null?void 0:a.data)==null?void 0:o.message;throw new Error(n)}finally{e(p.SET_DASHBOARD_APPS_UI_FLAG,{isCreating:!1})}},update:async function({commit:e},{id:r,...a}){e(p.SET_DASHBOARD_APPS_UI_FLAG,{isUpdating:!0});try{const o=await j2.update(r,a);e(p.EDIT_DASHBOARD_APP,o.data)}catch(o){throw new Error(o)}finally{e(p.SET_DASHBOARD_APPS_UI_FLAG,{isUpdating:!1})}},delete:async function({commit:e},r){e(p.SET_DASHBOARD_APPS_UI_FLAG,{isDeleting:!0});try{await j2.delete(r),e(p.DELETE_DASHBOARD_APP,r)}catch(a){throw new Error(a)}finally{e(p.SET_DASHBOARD_APPS_UI_FLAG,{isDeleting:!1})}}},rGe={[p.SET_DASHBOARD_APPS_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.SET_DASHBOARD_APPS]:ur,[p.CREATE_DASHBOARD_APP]:Ma,[p.EDIT_DASHBOARD_APP]:ua,[p.DELETE_DASHBOARD_APP]:da},aGe={namespaced:!0,actions:tGe,state:$qe,getters:eGe,mutations:rGe},oGe={records:rc.get(ac.DRAFT_MESSAGES)||{},replyEditorMode:Cr.REPLY},iGe={get:t=>e=>t.records[e]||"",getReplyEditorMode:t=>t.replyEditorMode},nGe={set:async({commit:t},{key:e,message:r})=>{t(p.SET_DRAFT_MESSAGES,{key:e,message:r})},delete:({commit:t},{key:e})=>{t(p.SET_DRAFT_MESSAGES,{key:e})},setReplyEditorMode:({commit:t},{mode:e})=>{t(p.SET_REPLY_EDITOR_MODE,{mode:e})}},sGe={[p.SET_DRAFT_MESSAGES](t,{key:e,message:r}){t.records={...t.records,[e]:r},rc.set(ac.DRAFT_MESSAGES,t.records)},[p.REMOVE_DRAFT_MESSAGES](t,{key:e}){const{[e]:r,...a}=t.records;t.records=a,rc.set(ac.DRAFT_MESSAGES,t.records)},[p.SET_REPLY_EDITOR_MODE](t,{mode:e}){t.replyEditorMode=e}},lGe={namespaced:!0,state:oGe,getters:iGe,actions:nGe,mutations:sGe},{API_CHANNEL_NAME:cGe,API_CHANNEL_THUMBNAIL:uGe,APP_VERSION:dGe,AZURE_APP_ID:gGe,BRAND_NAME:hGe,CHATWOOT_INBOX_TOKEN:mGe,CREATE_NEW_ACCOUNT_FROM_DASHBOARD:pGe,DIRECT_UPLOADS_ENABLED:fGe,DISPLAY_MANIFEST:wGe,GIT_SHA:vGe,HCAPTCHA_SITE_KEY:bGe,INSTALLATION_NAME:EGe,LOGO_THUMBNAIL:kGe,LOGO:CGe,LOGO_DARK:AGe,PRIVACY_URL:xGe,TERMS_URL:yGe,WIDGET_BRAND_URL:TGe,DISABLE_USER_PROFILE_UPDATE:SGe,DEPLOYMENT_ENV:IGe}=window.globalConfig||{},MGe={apiChannelName:cGe,apiChannelThumbnail:uGe,appVersion:dGe,azureAppId:gGe,brandName:hGe,chatwootInboxToken:mGe,deploymentEnv:IGe,createNewAccountFromDashboard:pGe,directUploadsEnabled:fGe==="true",disableUserProfileUpdate:SGe==="true",displayManifest:wGe,gitSha:vGe,hCaptchaSiteKey:bGe,installationName:EGe,logo:CGe,logoDark:AGe,logoThumbnail:kGe,privacyURL:xGe,termsURL:yGe,widgetBrandURL:TGe},OGe={get:t=>t,isOnChatwootCloud:t=>t.deploymentEnv==="cloud",isACustomBrandedInstance:t=>t.installationName!=="Chatwoot",isAChatwootInstance:t=>t.installationName==="Chatwoot"},LGe={},RGe={},NGe={namespaced:!0,state:MGe,getters:OGe,actions:LGe,mutations:RGe};class DGe extends Fe{constructor(){super("assignable_agents",{accountScoped:!0})}get(e){return axios.get(this.url,{params:{inbox_ids:e}})}}const VGe=new DGe,BGe={records:{},uiFlags:{isFetching:!1}},V1={SET_INBOX_ASSIGNABLE_AGENTS_UI_FLAG:"SET_INBOX_ASSIGNABLE_AGENTS_UI_FLAG",SET_INBOX_ASSIGNABLE_AGENTS:"SET_INBOX_ASSIGNABLE_AGENTS"},PGe={getAssignableAgents:t=>e=>(t.records[e]||[]).filter(o=>o.confirmed),getUIFlags(t){return t.uiFlags}},FGe={async fetch({commit:t},e){t(V1.SET_INBOX_ASSIGNABLE_AGENTS_UI_FLAG,{isFetching:!0});try{const{data:{payload:r}}=await VGe.get(e);t(V1.SET_INBOX_ASSIGNABLE_AGENTS,{inboxId:e.join(","),members:r})}catch(r){throw new Error(r)}finally{t(V1.SET_INBOX_ASSIGNABLE_AGENTS_UI_FLAG,{isFetching:!1})}}},UGe={[V1.SET_INBOX_ASSIGNABLE_AGENTS_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[V1.SET_INBOX_ASSIGNABLE_AGENTS]:(t,{inboxId:e,members:r})=>{t.records={...t.records,[e]:r}}},jGe={namespaced:!0,state:BGe,getters:PGe,actions:FGe,mutations:UGe};class zGe extends Fe{constructor(){super("inboxes",{accountScoped:!0})}}const bk=new zGe;class qGe extends Fe{constructor(){super("facebook_indicators",{accountScoped:!0})}create(e){return axios.post(`${this.url.replace(this.resource,"")}callbacks/register_facebook_page`,e)}reauthorizeFacebookPage({omniauthToken:e,inboxId:r}){return axios.post(`${this.baseUrl()}/callbacks/reauthorize_page`,{omniauth_token:e,inbox_id:r})}}const Ek=new qGe;class GGe extends Fe{constructor(){super("channels/twilio_channel",{accountScoped:!0})}}const HGe=new GGe,kk=t=>{const e=new FormData,{channel:r={},...a}=t;Object.keys(a).forEach(n=>{e.append(n,a[n])});const{selectedFeatureFlags:o,...i}=r;return o&&(o.length?o.forEach(n=>{e.append("channel[selected_feature_flags][]",n)}):e.append("channel[selected_feature_flags][]","")),Object.keys(i).forEach(n=>{e.append(`channel[${n}]`,r[n])}),e},KGe={records:[],uiFlags:{isFetching:!1,isFetchingItem:!1,isCreating:!1,isUpdating:!1,isDeleting:!1,isUpdatingIMAP:!1,isUpdatingSMTP:!1}},WGe={getInboxes(t){return t.records},getWhatsAppTemplates:t=>e=>{const[r]=t.records.filter(s=>s.id===Number(e)),{message_templates:a,additional_attributes:o}=r||{},{message_templates:i}=o||{},n=a||i;return n instanceof Array?n.filter(s=>!s.components.some(l=>l.format==="IMAGE"||l.format==="VIDEO")):[]},getNewConversationInboxes(t){return t.records.filter(e=>{const{channel_type:r,phone_number:a=""}=e,o=r===Ue.EMAIL,i=r===Ue.TWILIO&&a.startsWith("whatsapp");return o||i})},getInbox:t=>e=>{const[r]=t.records.filter(a=>a.id===Number(e));return r||{}},getInboxById:t=>e=>{const[r]=t.records.filter(a=>a.id===Number(e));return mr(r||{},{deep:!0})},getUIFlags(t){return t.uiFlags},getWebsiteInboxes(t){return t.records.filter(e=>e.channel_type===Ue.WEB)},getTwilioInboxes(t){return t.records.filter(e=>e.channel_type===Ue.TWILIO)},getSMSInboxes(t){return t.records.filter(e=>e.channel_type===Ue.SMS||e.channel_type===Ue.TWILIO&&e.medium==="sms")},dialogFlowEnabledInboxes(t){return t.records.filter(e=>e.channel_type!==Ue.EMAIL)},getFacebookInboxByInstagramId:t=>e=>t.records.find(r=>r.instagram_id===e&&r.channel_type===Ue.FB),getInstagramInboxByInstagramId:t=>e=>t.records.find(r=>r.instagram_id===e&&r.channel_type===Ue.INSTAGRAM)},z2=t=>{Fr.track(s5.ADDED_AN_INBOX,{channelType:t})},ZGe={revalidate:async({commit:t},{newKey:e})=>{try{if(!await ho.validateCacheKey(e)){const a=await ho.refetchAndCommit(e);t(p.SET_INBOXES,a.data.payload)}}catch{}},get:async({commit:t})=>{t(p.SET_INBOXES_UI_FLAG,{isFetching:!0});try{const e=await ho.get(!0);t(p.SET_INBOXES_UI_FLAG,{isFetching:!1}),t(p.SET_INBOXES,e.data.payload)}catch{t(p.SET_INBOXES_UI_FLAG,{isFetching:!1})}},createChannel:async({commit:t},e)=>{var r,a;try{t(p.SET_INBOXES_UI_FLAG,{isCreating:!0});const o=await bk.create(e);t(p.ADD_INBOXES,o.data),t(p.SET_INBOXES_UI_FLAG,{isCreating:!1});const{channel:i={}}=e;return z2(i.type),o.data}catch(o){const i=(a=(r=o==null?void 0:o.response)==null?void 0:r.data)==null?void 0:a.message;throw t(p.SET_INBOXES_UI_FLAG,{isCreating:!1}),new Error(i)}},createWebsiteChannel:async({commit:t},e)=>{try{t(p.SET_INBOXES_UI_FLAG,{isCreating:!0});const r=await bk.create(kk(e));return t(p.ADD_INBOXES,r.data),t(p.SET_INBOXES_UI_FLAG,{isCreating:!1}),z2("website"),r.data}catch(r){return t(p.SET_INBOXES_UI_FLAG,{isCreating:!1}),Me(r)}},createTwilioChannel:async({commit:t},e)=>{try{t(p.SET_INBOXES_UI_FLAG,{isCreating:!0});const r=await HGe.create(e);return t(p.ADD_INBOXES,r.data),t(p.SET_INBOXES_UI_FLAG,{isCreating:!1}),z2("twilio"),r.data}catch(r){throw t(p.SET_INBOXES_UI_FLAG,{isCreating:!1}),r}},createFBChannel:async({commit:t},e)=>{try{t(p.SET_INBOXES_UI_FLAG,{isCreating:!0});const r=await Ek.create(e);return t(p.ADD_INBOXES,r.data),t(p.SET_INBOXES_UI_FLAG,{isCreating:!1}),z2("facebook"),r.data}catch(r){throw t(p.SET_INBOXES_UI_FLAG,{isCreating:!1}),new Error(r)}},updateInbox:async({commit:t},{id:e,formData:r=!0,...a})=>{t(p.SET_INBOXES_UI_FLAG,{isUpdating:!0});try{const o=await ho.update(e,r?kk(a):a);t(p.EDIT_INBOXES,o.data),t(p.SET_INBOXES_UI_FLAG,{isUpdating:!1})}catch(o){t(p.SET_INBOXES_UI_FLAG,{isUpdating:!1}),Me(o)}},updateInboxIMAP:async({commit:t},{id:e,...r})=>{t(p.SET_INBOXES_UI_FLAG,{isUpdatingIMAP:!0});try{const a=await ho.update(e,r);t(p.EDIT_INBOXES,a.data),t(p.SET_INBOXES_UI_FLAG,{isUpdatingIMAP:!1})}catch(a){t(p.SET_INBOXES_UI_FLAG,{isUpdatingIMAP:!1}),Me(a)}},updateInboxSMTP:async({commit:t},{id:e,...r})=>{t(p.SET_INBOXES_UI_FLAG,{isUpdatingSMTP:!0});try{const a=await ho.update(e,r);t(p.EDIT_INBOXES,a.data),t(p.SET_INBOXES_UI_FLAG,{isUpdatingSMTP:!1})}catch(a){t(p.SET_INBOXES_UI_FLAG,{isUpdatingSMTP:!1}),Me(a)}},delete:async({commit:t},e)=>{t(p.SET_INBOXES_UI_FLAG,{isDeleting:!0});try{await ho.delete(e),t(p.DELETE_INBOXES,e),t(p.SET_INBOXES_UI_FLAG,{isDeleting:!1})}catch(r){throw t(p.SET_INBOXES_UI_FLAG,{isDeleting:!1}),new Error(r)}},reauthorizeFacebookPage:async({commit:t},e)=>{try{const r=await Ek.reauthorizeFacebookPage(e);t(p.EDIT_INBOXES,r.data)}catch(r){throw new Error(r.message)}},deleteInboxAvatar:async(t,e)=>{try{await ho.deleteInboxAvatar(e)}catch(r){throw new Error(r)}}},JGe={[p.SET_INBOXES_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.SET_INBOXES]:ur,[p.SET_INBOXES_ITEM]:Kc,[p.ADD_INBOXES]:Ma,[p.EDIT_INBOXES]:ua,[p.DELETE_INBOXES]:da},QGe={namespaced:!0,state:KGe,getters:WGe,actions:ZGe,mutations:JGe};class XGe extends Fe{constructor(){super("inbox_members",{accountScoped:!0})}update({inboxId:e,agentList:r}){return axios.patch(this.url,{inbox_id:e,user_ids:r})}}const Ck=new XGe,YGe={get(t,{inboxId:e}){return Ck.show(e)},create(t,{inboxId:e,agentList:r}){return Ck.update({inboxId:e,agentList:r})}},_Ge={namespaced:!0,actions:YGe};class $Ge extends Fe{constructor(){super("integrations/apps",{accountScoped:!0})}connectSlack(e){return axios.post(`${this.baseUrl()}/integrations/slack`,{code:e})}updateSlack({referenceId:e}){return axios.patch(`${this.baseUrl()}/integrations/slack`,{reference_id:e})}listAllSlackChannels(){return axios.get(`${this.baseUrl()}/integrations/slack/list_all_channels`)}delete(e){return axios.delete(`${this.baseUrl()}/integrations/${e}`)}createHook(e){return axios.post(`${this.baseUrl()}/integrations/hooks`,e)}deleteHook(e){return axios.delete(`${this.baseUrl()}/integrations/hooks/${e}`)}connectShopify({shopDomain:e}){return axios.post(`${this.baseUrl()}/integrations/shopify/auth`,{shop_domain:e})}}const Xi=new $Ge,eHe={records:[],uiFlags:{isCreating:!1,isFetching:!1,isFetchingItem:!1,isUpdating:!1,isCreatingHook:!1,isDeletingHook:!1,isCreatingSlack:!1,isUpdatingSlack:!1,isFetchingSlackChannels:!1}},tHe={getAppIntegrations(t){return t.records},getIntegration:t=>(e,r={})=>{const[a]=t.records.filter(o=>o.id===e);return a||r},getUIFlags(t){return t.uiFlags}},rHe={get:async({commit:t})=>{t(p.SET_INTEGRATIONS_UI_FLAG,{isFetching:!0});try{const e=await Xi.get();t(p.SET_INTEGRATIONS,e.data.payload),t(p.SET_INTEGRATIONS_UI_FLAG,{isFetching:!1})}catch{t(p.SET_INTEGRATIONS_UI_FLAG,{isFetching:!1})}},connectSlack:async({commit:t},e)=>{t(p.SET_INTEGRATIONS_UI_FLAG,{isCreatingSlack:!0});try{const r=await Xi.connectSlack(e);t(p.ADD_INTEGRATION,r.data)}catch(r){Me(r)}finally{t(p.SET_INTEGRATIONS_UI_FLAG,{isCreatingSlack:!1})}},updateSlack:async({commit:t},e)=>{t(p.SET_INTEGRATIONS_UI_FLAG,{isUpdatingSlack:!0});try{const r=await Xi.updateSlack(e);t(p.ADD_INTEGRATION,r.data)}catch(r){Me(r)}finally{t(p.SET_INTEGRATIONS_UI_FLAG,{isUpdatingSlack:!1})}},listAllSlackChannels:async({commit:t})=>{t(p.SET_INTEGRATIONS_UI_FLAG,{isFetchingSlackChannels:!0});try{return(await Xi.listAllSlackChannels()).data}catch{t(p.SET_INTEGRATIONS_UI_FLAG,{isFetchingSlackChannels:!1})}return null},deleteIntegration:async({commit:t},e)=>{t(p.SET_INTEGRATIONS_UI_FLAG,{isDeleting:!0});try{await Xi.delete(e),t(p.DELETE_INTEGRATION,{id:e,enabled:!1}),t(p.SET_INTEGRATIONS_UI_FLAG,{isDeleting:!1})}catch{t(p.SET_INTEGRATIONS_UI_FLAG,{isDeleting:!1})}},showHook:async({commit:t},e)=>{t(p.SET_INTEGRATIONS_UI_FLAG,{isFetchingItem:!0});try{const r=await Xi.showHook(e);t(p.ADD_INTEGRATION_HOOKS,r.data),t(p.SET_INTEGRATIONS_UI_FLAG,{isFetchingItem:!1})}catch(r){throw t(p.SET_INTEGRATIONS_UI_FLAG,{isFetchingItem:!1}),new Error(r)}},createHook:async({commit:t},e)=>{t(p.SET_INTEGRATIONS_UI_FLAG,{isCreatingHook:!0});try{const r=await Xi.createHook(e);t(p.ADD_INTEGRATION_HOOKS,r.data),t(p.SET_INTEGRATIONS_UI_FLAG,{isCreatingHook:!1})}catch(r){throw t(p.SET_INTEGRATIONS_UI_FLAG,{isCreatingHook:!1}),new Error(r)}},deleteHook:async({commit:t},{appId:e,hookId:r})=>{t(p.SET_INTEGRATIONS_UI_FLAG,{isDeletingHook:!0});try{await Xi.deleteHook(r),t(p.DELETE_INTEGRATION_HOOKS,{appId:e,hookId:r}),t(p.SET_INTEGRATIONS_UI_FLAG,{isDeletingHook:!1})}catch(a){throw t(p.SET_INTEGRATIONS_UI_FLAG,{isDeletingHook:!1}),new Error(a)}}},aHe={[p.SET_INTEGRATIONS_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.SET_INTEGRATIONS]:ur,[p.ADD_INTEGRATION]:yp,[p.DELETE_INTEGRATION]:yp,[p.ADD_INTEGRATION_HOOKS]:(t,e)=>{t.records=t.records.map(r=>r.id===e.app_id?{...r,hooks:[...r.hooks,e]}:r)},[p.DELETE_INTEGRATION_HOOKS]:(t,{appId:e,hookId:r})=>{t.records=t.records.map(a=>a.id===e?{...a,hooks:a.hooks.filter(o=>o.id!==r)}:a)}},oHe={namespaced:!0,state:eHe,getters:tHe,actions:rHe,mutations:aHe};class iHe extends aw{constructor(){super("labels",{accountScoped:!0})}get cacheModelName(){return"label"}}const fl=new iHe,nHe={records:[],uiFlags:{isFetching:!1,isFetchingItem:!1,isCreating:!1,isDeleting:!1}},sHe={getLabels(t){return t.records},getUIFlags(t){return t.uiFlags},getLabelsOnSidebar(t){return t.records.filter(e=>e.show_on_sidebar).sort((e,r)=>e.title.localeCompare(r.title))}},lHe={revalidate:async function({commit:e},{newKey:r}){try{if(!await fl.validateCacheKey(r)){const o=await fl.refetchAndCommit(r);e(p.SET_LABELS,o.data.payload)}}catch{}},get:async function({commit:e}){e(p.SET_LABEL_UI_FLAG,{isFetching:!0});try{const a=(await fl.get(!0)).data.payload.sort((o,i)=>o.title.localeCompare(i.title));e(p.SET_LABELS,a)}catch{}finally{e(p.SET_LABEL_UI_FLAG,{isFetching:!1})}},create:async function({commit:e},r){var a,o;e(p.SET_LABEL_UI_FLAG,{isCreating:!0});try{const i=await fl.create(r);Fr.track(Ah.CREATE),e(p.ADD_LABEL,i.data)}catch(i){const n=(o=(a=i==null?void 0:i.response)==null?void 0:a.data)==null?void 0:o.message;throw new Error(n)}finally{e(p.SET_LABEL_UI_FLAG,{isCreating:!1})}},update:async function({commit:e},{id:r,...a}){e(p.SET_LABEL_UI_FLAG,{isUpdating:!0});try{const o=await fl.update(r,a);Fr.track(Ah.UPDATE),e(p.EDIT_LABEL,o.data)}catch(o){throw new Error(o)}finally{e(p.SET_LABEL_UI_FLAG,{isUpdating:!1})}},delete:async function({commit:e},r){e(p.SET_LABEL_UI_FLAG,{isDeleting:!0});try{await fl.delete(r),Fr.track(Ah.DELETED),e(p.DELETE_LABEL,r)}catch(a){throw new Error(a)}finally{e(p.SET_LABEL_UI_FLAG,{isDeleting:!1})}}},cHe={[p.SET_LABEL_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.SET_LABELS]:ur,[p.ADD_LABEL]:Ma,[p.EDIT_LABEL]:ua,[p.DELETE_LABEL]:da},uHe={namespaced:!0,state:nHe,getters:sHe,actions:lHe,mutations:cHe};class dHe extends Fe{constructor(){super("macros",{accountScoped:!0})}executeMacro({macroId:e,conversationIds:r}){return axios.post(`${this.url}/${e}/execute`,{conversation_ids:r})}}const wl=new dHe,gHe={records:[],uiFlags:{isFetchingItem:!1,isFetching:!1,isCreating:!1,isDeleting:!1,isUpdating:!1,isExecuting:!1}},hHe={getMacros(t){return t.records},getMacro:t=>e=>t.records.find(r=>r.id===Number(e)),getUIFlags(t){return t.uiFlags}},mHe={get:async function({commit:e}){e(p.SET_MACROS_UI_FLAG,{isFetching:!0});try{const r=await wl.get();e(p.SET_MACROS,r.data.payload)}catch{}finally{e(p.SET_MACROS_UI_FLAG,{isFetching:!1})}},getSingleMacro:async function({commit:e},r){e(p.SET_MACROS_UI_FLAG,{isFetchingItem:!0});try{const a=await wl.show(r);e(p.ADD_MACRO,a.data.payload)}catch{}finally{e(p.SET_MACROS_UI_FLAG,{isFetchingItem:!1})}},create:async function({commit:e},r){e(p.SET_MACROS_UI_FLAG,{isCreating:!0});try{const a=await wl.create(r);e(p.ADD_MACRO,a.data.payload)}catch(a){Me(a)}finally{e(p.SET_MACROS_UI_FLAG,{isCreating:!1})}},execute:async function({commit:e},r){e(p.SET_MACROS_UI_FLAG,{isExecuting:!0});try{await wl.executeMacro(r)}catch(a){Me(a)}finally{e(p.SET_MACROS_UI_FLAG,{isExecuting:!1})}},update:async({commit:t},{id:e,...r})=>{t(p.SET_MACROS_UI_FLAG,{isUpdating:!0});try{const a=await wl.update(e,r);t(p.EDIT_MACRO,a.data.payload)}catch(a){Me(a)}finally{t(p.SET_MACROS_UI_FLAG,{isUpdating:!1})}},delete:async({commit:t},e)=>{t(p.SET_MACROS_UI_FLAG,{isDeleting:!0});try{await wl.delete(e),t(p.DELETE_MACRO,e)}catch(r){Me(r)}finally{t(p.SET_MACROS_UI_FLAG,{isDeleting:!1})}}},pHe={[p.SET_MACROS_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.ADD_MACRO]:Kc,[p.SET_MACROS]:ur,[p.EDIT_MACRO]:ua,[p.DELETE_MACRO]:da},fHe={namespaced:!0,actions:mHe,state:gHe,getters:hHe,mutations:pHe},wHe={newest:"desc",oldest:"asc"},vHe={newest:(t,e)=>e.created_at-t.created_at,oldest:(t,e)=>t.created_at-e.created_at},Ak=(t,e,r)=>{const a=wHe[r];return r==="newest"||r==="oldest"?vHe[r](t,e,a):0},bHe={getNotifications(t){return Object.values(t.records).sort((e,r)=>r.id-e.id)},getFilteredNotifications:t=>e=>{const r=e.sortOrder==="desc"?"newest":"oldest";return Object.values(t.records).sort((o,i)=>Ak(o,i,r))},getFilteredNotificationsV4:t=>e=>{const r=e.sortOrder==="desc"?"newest":"oldest",a=Object.values(t.records).sort((o,i)=>Ak(o,i,r));return mr(a,{deep:!0})},getNotificationById:t=>e=>t.records[e]||{},getUIFlags(t){return t.uiFlags},getNotification:t=>e=>t.records[e]||{},getMeta:t=>t.meta,getNotificationFilters(t){return t.notificationFilters},getHasUnreadNotifications:t=>t.meta.unreadCount>0};class EHe extends Fe{constructor(){super("notifications",{accountScoped:!0})}get({page:e,status:r,type:a,sortOrder:o}){const i=[r,a].filter(n=>!!n);return axios.get(this.url,{params:{page:e,sort_order:o,includes:i}})}getNotifications(e){return axios.get(`${this.url}/${e}/notifications`)}getUnreadCount(){return axios.get(`${this.url}/unread_count`)}read(e,r){return axios.post(`${this.url}/read_all`,{primary_actor_type:e,primary_actor_id:r})}unRead(e){return axios.post(`${this.url}/${e}/unread`)}readAll(){return axios.post(`${this.url}/read_all`)}delete(e){return axios.delete(`${this.url}/${e}`)}deleteAll({type:e="all"}){return axios.post(`${this.url}/destroy_all`,{type:e})}snooze({id:e,snoozedUntil:r=null}){return axios.post(`${this.url}/${e}/snooze`,{snoozed_until:r})}}const Bo=new EHe,kHe={get:async({commit:t},{page:e=1}={})=>{t(p.SET_NOTIFICATIONS_UI_FLAG,{isFetching:!0});try{const{data:{data:{payload:r,meta:a}}}=await Bo.get({page:e});t(p.CLEAR_NOTIFICATIONS),t(p.SET_NOTIFICATIONS,r),t(p.SET_NOTIFICATIONS_META,a),t(p.SET_NOTIFICATIONS_UI_FLAG,{isFetching:!1})}catch{t(p.SET_NOTIFICATIONS_UI_FLAG,{isFetching:!1})}},index:async({commit:t},{page:e=1,status:r,type:a,sortOrder:o}={})=>{t(p.SET_NOTIFICATIONS_UI_FLAG,{isFetching:!0});try{const{data:{data:{payload:i,meta:n}}}=await Bo.get({page:e,status:r,type:a,sortOrder:o});t(p.SET_NOTIFICATIONS,i),t(p.SET_NOTIFICATIONS_META,n),t(p.SET_NOTIFICATIONS_UI_FLAG,{isFetching:!1}),i.length<15&&t(p.SET_ALL_NOTIFICATIONS_LOADED)}catch{t(p.SET_NOTIFICATIONS_UI_FLAG,{isFetching:!1})}},unReadCount:async({commit:t}={})=>{t(p.SET_NOTIFICATIONS_UI_FLAG,{isUpdatingUnreadCount:!0});try{const{data:e}=await Bo.getUnreadCount();t(p.SET_NOTIFICATIONS_UNREAD_COUNT,e),t(p.SET_NOTIFICATIONS_UI_FLAG,{isUpdatingUnreadCount:!1})}catch{t(p.SET_NOTIFICATIONS_UI_FLAG,{isUpdatingUnreadCount:!1})}},read:async({commit:t},{id:e,primaryActorType:r,primaryActorId:a,unreadCount:o})=>{t(p.SET_NOTIFICATIONS_UI_FLAG,{isUpdating:!0});try{await Bo.read(r,a),t(p.SET_NOTIFICATIONS_UNREAD_COUNT,o-1),t(p.READ_NOTIFICATION,{id:e,read_at:new Date}),t(p.SET_NOTIFICATIONS_UI_FLAG,{isUpdating:!1})}catch{t(p.SET_NOTIFICATIONS_UI_FLAG,{isUpdating:!1})}},unread:async({commit:t},{id:e})=>{t(p.SET_NOTIFICATIONS_UI_FLAG,{isUpdating:!0});try{await Bo.unRead(e),t(p.READ_NOTIFICATION,{id:e,read_at:null}),t(p.SET_NOTIFICATIONS_UI_FLAG,{isUpdating:!1})}catch{t(p.SET_NOTIFICATIONS_UI_FLAG,{isUpdating:!1})}},readAll:async({commit:t})=>{t(p.SET_NOTIFICATIONS_UI_FLAG,{isUpdating:!0});try{await Bo.readAll(),t(p.SET_NOTIFICATIONS_UNREAD_COUNT,0),t(p.UPDATE_ALL_NOTIFICATIONS),t(p.SET_NOTIFICATIONS_UI_FLAG,{isUpdating:!1})}catch(e){throw t(p.SET_NOTIFICATIONS_UI_FLAG,{isUpdating:!1}),new Error(e)}},delete:async({commit:t},{notification:e,count:r,unreadCount:a})=>{t(p.SET_NOTIFICATIONS_UI_FLAG,{isDeleting:!0});try{await Bo.delete(e.id),t(p.SET_NOTIFICATIONS_UNREAD_COUNT,a-1),t(p.DELETE_NOTIFICATION,{notification:e,count:r,unreadCount:a}),t(p.SET_NOTIFICATIONS_UI_FLAG,{isDeleting:!1})}catch{t(p.SET_NOTIFICATIONS_UI_FLAG,{isDeleting:!1})}},deleteAllRead:async({commit:t})=>{t(p.SET_NOTIFICATIONS_UI_FLAG,{isDeleting:!0});try{await Bo.deleteAll({type:"read"}),t(p.DELETE_READ_NOTIFICATIONS),t(p.SET_NOTIFICATIONS_UI_FLAG,{isDeleting:!1})}catch{t(p.SET_NOTIFICATIONS_UI_FLAG,{isDeleting:!1})}},deleteAll:async({commit:t})=>{t(p.SET_NOTIFICATIONS_UI_FLAG,{isDeleting:!0});try{await Bo.deleteAll({type:"all"}),t(p.DELETE_ALL_NOTIFICATIONS),t(p.SET_NOTIFICATIONS_UI_FLAG,{isDeleting:!1})}catch{t(p.SET_NOTIFICATIONS_UI_FLAG,{isDeleting:!1})}},snooze:async({commit:t},{id:e,snoozedUntil:r})=>{t(p.SET_NOTIFICATIONS_UI_FLAG,{isUpdating:!0});try{const a=await Bo.snooze({id:e,snoozedUntil:r}),{data:{snoozed_until:o=null}}=a;t(p.SNOOZE_NOTIFICATION,{id:e,snoozed_until:o}),t(p.SET_NOTIFICATIONS_UI_FLAG,{isUpdating:!1})}catch{t(p.SET_NOTIFICATIONS_UI_FLAG,{isUpdating:!1})}},updateNotification:async({commit:t},e)=>{t(p.UPDATE_NOTIFICATION,e)},addNotification({commit:t},e){t(p.ADD_NOTIFICATION,e)},deleteNotification({commit:t},e){t(p.DELETE_NOTIFICATION,e)},clear({commit:t}){t(p.CLEAR_NOTIFICATIONS)},setNotificationFilters:({commit:t},e)=>{t(p.SET_NOTIFICATION_FILTERS,e)},updateNotificationFilters:({commit:t},e)=>{t(p.UPDATE_NOTIFICATION_FILTERS,e)}},CHe={[p.SET_NOTIFICATIONS_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.CLEAR_NOTIFICATIONS]:t=>{t.records={},t.uiFlags.isAllNotificationsLoaded=!1},[p.SET_NOTIFICATIONS_META]:(t,e)=>{const{count:r,current_page:a,unread_count:o}=e;t.meta={...t.meta,count:r,currentPage:a,unreadCount:o}},[p.SET_NOTIFICATIONS_UNREAD_COUNT]:(t,e)=>{t.meta.unreadCount=e<0?0:e},[p.SET_NOTIFICATIONS]:(t,e)=>{e.forEach(r=>{const a=Object.values(t.records).find(o=>o.primary_actor_id===r.primary_actor_id);a&&delete t.records[a.id],t.records[r.id]={...t.records[r.id]||{},...r}})},[p.READ_NOTIFICATION]:(t,{id:e,read_at:r})=>{t.records[e].read_at=r},[p.UPDATE_ALL_NOTIFICATIONS]:t=>{Object.values(t.records).forEach(e=>{t.records[e.id].read_at=!0})},[p.ADD_NOTIFICATION](t,e){const{notification:r,unread_count:a,count:o}=e;t.records[r.id]={...t.records[r.id]||{},...r},t.meta.unreadCount=a,t.meta.count=o},[p.UPDATE_NOTIFICATION](t,e){const{notification:r,unread_count:a,count:o}=e;t.records[r.id]={...t.records[r.id]||{},...r},t.meta.unreadCount=a,t.meta.count=o},[p.DELETE_NOTIFICATION](t,e){const{notification:r,unread_count:a,count:o}=e;delete t.records[r.id],t.meta.unreadCount=a,t.meta.count=o},[p.SET_ALL_NOTIFICATIONS_LOADED]:t=>{t.uiFlags.isAllNotificationsLoaded=!0},[p.DELETE_READ_NOTIFICATIONS]:t=>{Object.values(t.records).forEach(e=>{e.read_at&&delete t.records[e.id]})},[p.DELETE_ALL_NOTIFICATIONS]:t=>{t.records={}},[p.SNOOZE_NOTIFICATION]:(t,{id:e,snoozed_until:r})=>{t.records[e].snoozed_until=r},[p.SET_NOTIFICATION_FILTERS]:(t,e)=>{t.notificationFilters=e},[p.UPDATE_NOTIFICATION_FILTERS]:(t,e)=>{t.notificationFilters={...t.notificationFilters,...e}}},AHe={meta:{count:0,currentPage:1,unreadCount:0},records:{},uiFlags:{isFetching:!1,isFetchingItem:!1,isUpdating:!1,isDeleting:!1,isUpdatingUnreadCount:!1,isAllNotificationsLoaded:!1},notificationFilters:{}},xHe={namespaced:!0,state:AHe,getters:bHe,actions:kHe,mutations:CHe},yHe={uiFlagsIn:t=>e=>{const r=t.portals.uiFlags.byId[e];return r||{isFetching:!1,isUpdating:!1,isDeleting:!1}},isFetchingPortals:t=>t.uiFlags.isFetching,isCreatingPortal:t=>t.uiFlags.isCreating,isSwitchingPortal:t=>t.uiFlags.isSwitching,portalBySlug:(...t)=>e=>{const[r]=t;return r.portals.byId[e]},allPortals:(...t)=>{const[e,r]=t;return e.portals.allIds.map(o=>r.portalBySlug(o))},count:t=>t.portals.allIds.length||0,getMeta:t=>t.meta,isSwitching:t=>t.isSwitching},et={SET_UI_FLAG:"setUIFlag",ADD_PORTAL_ENTRY:"addPortalEntry",SET_PORTALS_META:"setPortalsMeta",ADD_MANY_PORTALS_ENTRY:"addManyPortalsEntry",ADD_PORTAL_ID:"addPortalId",CLEAR_PORTALS:"clearPortals",ADD_MANY_PORTALS_IDS:"addManyPortalsIds",UPDATE_PORTAL_ENTRY:"updatePortalEntry",REMOVE_PORTAL_ENTRY:"removePortalEntry",REMOVE_PORTAL_ID:"removePortalId",SET_HELP_PORTAL_UI_FLAG:"setHelpCenterUIFlag",SET_PORTAL_SWITCHING_FLAG:"setPortalSwitchingFlag"},THe={[et.SET_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[et.ADD_PORTAL_ENTRY](t,e){t.portals.byId={...t.portals.byId,[e.slug]:{...e}}},[et.ADD_MANY_PORTALS_ENTRY](t,e){const r={...t.portals.byId};e.forEach(a=>{r[a.slug]=a}),t.portals.byId=r},[et.CLEAR_PORTALS]:t=>{t.portals.byId={},t.portals.allIds=[],t.portals.uiFlags.byId={}},[et.SET_PORTALS_META]:(t,e)=>{const{all_articles_count:r=0,mine_articles_count:a=0,draft_articles_count:o=0,archived_articles_count:i=0}=e;t.meta={...t.meta,allArticlesCount:r,archivedArticlesCount:i,mineArticlesCount:a,draftArticlesCount:o}},[et.ADD_PORTAL_ID](t,e){t.portals.allIds.push(e)},[et.ADD_MANY_PORTALS_IDS](t,e){t.portals.allIds.push(...e)},[et.UPDATE_PORTAL_ENTRY](t,e){const r=e.slug;t.portals.allIds.includes(r)&&(t.portals.byId={...t.portals.byId,[r]:{...e}})},[et.REMOVE_PORTAL_ENTRY](t,e){if(!e)return;const{[e]:r,...a}=t.portals.byId;t.portals.byId=a},[et.REMOVE_PORTAL_ID](t,e){t.portals.allIds=t.portals.allIds.filter(r=>r!==e)},[et.SET_HELP_PORTAL_UI_FLAG](t,{portalSlug:e,uiFlags:r}){const a=t.portals.uiFlags.byId[e];t.portals.uiFlags.byId={...t.portals.uiFlags.byId,[e]:{...IHe,...a,...r}}},[et.SET_PORTAL_SWITCHING_FLAG](t,{isSwitching:e}){t.uiFlags.isSwitching=e}},vl=new ow,SHe={index:async({commit:t})=>{try{t(et.SET_UI_FLAG,{isFetching:!0});const{data:{payload:e}}=await vl.get();t(et.CLEAR_PORTALS);const r=e.map(a=>a.slug);t(et.ADD_MANY_PORTALS_ENTRY,e),t(et.ADD_MANY_PORTALS_IDS,r)}catch(e){Me(e)}finally{t(et.SET_UI_FLAG,{isFetching:!1})}},show:async({commit:t},{portalSlug:e,locale:r})=>{t(et.SET_UI_FLAG,{isFetchingItem:!0});try{const a=await vl.getPortal({portalSlug:e,locale:r}),{data:{meta:o}}=a;t(et.SET_PORTALS_META,o)}catch{}finally{t(et.SET_UI_FLAG,{isFetchingItem:!1})}},create:async({commit:t},e)=>{t(et.SET_UI_FLAG,{isCreating:!0});try{const{data:r}=await vl.create(e),{slug:a}=r;t(et.ADD_PORTAL_ENTRY,r),t(et.ADD_PORTAL_ID,a)}catch(r){Me(r)}finally{t(et.SET_UI_FLAG,{isCreating:!1})}},update:async({commit:t},{portalSlug:e,...r})=>{t(et.SET_HELP_PORTAL_UI_FLAG,{uiFlags:{isUpdating:!0},portalSlug:e});try{const{data:a}=await vl.updatePortal({portalSlug:e,portalObj:r});t(et.UPDATE_PORTAL_ENTRY,a)}catch(a){Me(a)}finally{t(et.SET_HELP_PORTAL_UI_FLAG,{uiFlags:{isUpdating:!1},portalSlug:e})}},delete:async({commit:t},{portalSlug:e})=>{t(et.SET_HELP_PORTAL_UI_FLAG,{uiFlags:{isDeleting:!0},portalSlug:e});try{await vl.delete(e),t(et.REMOVE_PORTAL_ENTRY,e),t(et.REMOVE_PORTAL_ID,e)}catch(r){Me(r)}finally{t(et.SET_HELP_PORTAL_UI_FLAG,{uiFlags:{isDeleting:!1},portalSlug:e})}},deleteLogo:async({commit:t},{portalSlug:e})=>{t(et.SET_HELP_PORTAL_UI_FLAG,{uiFlags:{isUpdating:!0},portalSlug:e});try{await vl.deleteLogo(e)}catch(r){Me(r)}finally{t(et.SET_HELP_PORTAL_UI_FLAG,{uiFlags:{isUpdating:!1},portalSlug:e})}},updatePortal:async({commit:t},e)=>{t(et.UPDATE_PORTAL_ENTRY,e)},switchPortal:async({commit:t},e)=>{t(et.SET_PORTAL_SWITCHING_FLAG,{isSwitching:e})}},IHe={isFetching:!1,isUpdating:!1,isDeleting:!1},MHe={meta:{allArticlesCount:0,mineArticlesCount:0,draftArticlesCount:0,archivedArticlesCount:0},portals:{byId:{},allIds:[],uiFlags:{byId:{}},meta:{byId:{}}},uiFlags:{allFetched:!1,isFetching:!1,isSwitching:!1}},OHe={namespaced:!0,state:MHe,getters:yHe,actions:SHe,mutations:THe},dn={FAILED:"failed",FETCHING:"fetching",FINISHED:"finished"},x3=()=>-new Date().getTimezoneOffset()/60;class LHe extends Fe{constructor(){super("reports",{accountScoped:!0,apiVersion:"v2"})}getReports({metric:e,from:r,to:a,type:o="account",id:i,groupBy:n,businessHours:s}){return axios.get(`${this.url}`,{params:{metric:e,since:r,until:a,type:o,id:i,group_by:n,business_hours:s,timezone_offset:x3()}})}getSummary(e,r,a="account",o,i,n){return axios.get(`${this.url}/summary`,{params:{since:e,until:r,type:a,id:o,group_by:i,business_hours:n,timezone_offset:x3()}})}getConversationMetric(e="account",r=1){return axios.get(`${this.url}/conversations`,{params:{type:e,page:r}})}getAgentReports({from:e,to:r,businessHours:a}){return axios.get(`${this.url}/agents`,{params:{since:e,until:r,business_hours:a}})}getConversationTrafficCSV({daysBefore:e=6}={}){return axios.get(`${this.url}/conversation_traffic`,{params:{timezone_offset:x3(),days_before:e}})}getLabelReports({from:e,to:r,businessHours:a}){return axios.get(`${this.url}/labels`,{params:{since:e,until:r,business_hours:a}})}getInboxReports({from:e,to:r,businessHours:a}){return axios.get(`${this.url}/inboxes`,{params:{since:e,until:r,business_hours:a}})}getTeamReports({from:e,to:r,businessHours:a}){return axios.get(`${this.url}/teams`,{params:{since:e,until:r,business_hours:a}})}getBotMetrics({from:e,to:r}={}){return axios.get(`${this.url}/bot_metrics`,{params:{since:e,until:r}})}getBotSummary({from:e,to:r,groupBy:a,businessHours:o}={}){return axios.get(`${this.url}/bot_summary`,{params:{since:e,until:r,type:"account",group_by:a,business_hours:o}})}}const ki=new LHe,xk=(t,e,r)=>e===void 0&&r===void 0?t:t.filter(a=>{const{timestamp:o}=a,i=e===void 0||o-e>=0,n=r===void 0||r-o>0;return i&&n});class RHe extends Fe{constructor(){super("live_reports",{accountScoped:!0,apiVersion:"v2"})}getConversationMetric(e={}){return axios.get(`${this.url}/conversation_metrics`,{params:e})}getGroupedConversations({groupBy:e}={groupBy:"assignee_id"}){return axios.get(`${this.url}/grouped_conversation_metrics`,{params:{group_by:e}})}}const y3=new RHe,NHe={fetchingStatus:!1,accountSummaryFetchingStatus:dn.FINISHED,botSummaryFetchingStatus:dn.FINISHED,accountReport:{isFetching:{conversations_count:!1,incoming_messages_count:!1,outgoing_messages_count:!1,avg_first_response_time:!1,avg_resolution_time:!1,resolutions_count:!1,bot_resolutions_count:!1,bot_handoffs_count:!1,reply_time:!1},data:{conversations_count:[],incoming_messages_count:[],outgoing_messages_count:[],avg_first_response_time:[],avg_resolution_time:[],resolutions_count:[],bot_resolutions_count:[],bot_handoffs_count:[],reply_time:[]}},accountSummary:{avg_first_response_time:0,avg_resolution_time:0,conversations_count:0,incoming_messages_count:0,outgoing_messages_count:0,reply_time:0,resolutions_count:0,bot_resolutions_count:0,bot_handoffs_count:0,previous:{}},botSummary:{bot_resolutions_count:0,bot_handoffs_count:0,previous:{}},overview:{uiFlags:{isFetchingAccountConversationMetric:!1,isFetchingAccountConversationsHeatmap:!1,isFetchingAgentConversationMetric:!1,isFetchingTeamConversationMetric:!1},accountConversationMetric:{},accountConversationHeatmap:[],agentConversationMetric:[],teamConversationMetric:[]}},DHe={getAccountReports(t){return t.accountReport},getAccountSummary(t){return t.accountSummary},getBotSummary(t){return t.botSummary},getAccountSummaryFetchingStatus(t){return t.accountSummaryFetchingStatus},getBotSummaryFetchingStatus(t){return t.botSummaryFetchingStatus},getAccountConversationMetric(t){return t.overview.accountConversationMetric},getAccountConversationHeatmapData(t){return t.overview.accountConversationHeatmap},getAgentConversationMetric(t){return t.overview.agentConversationMetric},getTeamConversationMetric(t){return t.overview.teamConversationMetric},getOverviewUIFlags(t){return t.overview.uiFlags}},VHe={fetchAccountReport({commit:t},e){const{metric:r}=e;t(p.TOGGLE_ACCOUNT_REPORT_LOADING,{metric:r,value:!0}),ki.getReports(e).then(a=>{let{data:o}=a;o=xk(o,e.from,e.to),t(p.SET_ACCOUNT_REPORTS,{metric:r,data:o}),t(p.TOGGLE_ACCOUNT_REPORT_LOADING,{metric:r,value:!1})})},fetchAccountConversationHeatmap({commit:t},e){t(p.TOGGLE_HEATMAP_LOADING,!0),ki.getReports({...e,groupBy:"hour"}).then(r=>{let{data:a}=r;a=xk(a,e.from,e.to),t(p.SET_HEATMAP_DATA,a),t(p.TOGGLE_HEATMAP_LOADING,!1)})},fetchAccountSummary({commit:t},e){t(p.SET_ACCOUNT_SUMMARY_STATUS,dn.FETCHING),ki.getSummary(e.from,e.to,e.type,e.id,e.groupBy,e.businessHours).then(r=>{t(p.SET_ACCOUNT_SUMMARY,r.data),t(p.SET_ACCOUNT_SUMMARY_STATUS,dn.FINISHED)}).catch(()=>{t(p.SET_ACCOUNT_SUMMARY_STATUS,dn.FAILED)})},fetchBotSummary({commit:t},e){t(p.SET_BOT_SUMMARY_STATUS,dn.FETCHING),ki.getBotSummary({from:e.from,to:e.to,groupBy:e.groupBy,businessHours:e.businessHours}).then(r=>{t(p.SET_BOT_SUMMARY,r.data),t(p.SET_BOT_SUMMARY_STATUS,dn.FINISHED)}).catch(()=>{t(p.SET_BOT_SUMMARY_STATUS,dn.FAILED)})},fetchAccountConversationMetric({commit:t},e={}){t(p.TOGGLE_ACCOUNT_CONVERSATION_METRIC_LOADING,!0),y3.getConversationMetric(e).then(r=>{t(p.SET_ACCOUNT_CONVERSATION_METRIC,r.data),t(p.TOGGLE_ACCOUNT_CONVERSATION_METRIC_LOADING,!1)}).catch(()=>{t(p.TOGGLE_ACCOUNT_CONVERSATION_METRIC_LOADING,!1)})},fetchAgentConversationMetric({commit:t}){t(p.TOGGLE_AGENT_CONVERSATION_METRIC_LOADING,!0),y3.getGroupedConversations({groupBy:"assignee_id"}).then(e=>{t(p.SET_AGENT_CONVERSATION_METRIC,e.data),t(p.TOGGLE_AGENT_CONVERSATION_METRIC_LOADING,!1)}).catch(()=>{t(p.TOGGLE_AGENT_CONVERSATION_METRIC_LOADING,!1)})},fetchTeamConversationMetric({commit:t}){t(p.TOGGLE_TEAM_CONVERSATION_METRIC_LOADING,!0),y3.getGroupedConversations({groupBy:"team_id"}).then(e=>{t(p.SET_TEAM_CONVERSATION_METRIC,e.data),t(p.TOGGLE_TEAM_CONVERSATION_METRIC_LOADING,!1)}).catch(()=>{t(p.TOGGLE_TEAM_CONVERSATION_METRIC_LOADING,!1)})},downloadAgentReports(t,e){return ki.getAgentReports(e).then(r=>{ls(e.fileName,r.data),Fr.track(Cl.DOWNLOAD_REPORT,{reportType:"agent",businessHours:e==null?void 0:e.businessHours})}).catch(r=>{console.error(r)})},downloadLabelReports(t,e){return ki.getLabelReports(e).then(r=>{ls(e.fileName,r.data),Fr.track(Cl.DOWNLOAD_REPORT,{reportType:"label",businessHours:e==null?void 0:e.businessHours})}).catch(r=>{console.error(r)})},downloadInboxReports(t,e){return ki.getInboxReports(e).then(r=>{ls(e.fileName,r.data),Fr.track(Cl.DOWNLOAD_REPORT,{reportType:"inbox",businessHours:e==null?void 0:e.businessHours})}).catch(r=>{console.error(r)})},downloadTeamReports(t,e){return ki.getTeamReports(e).then(r=>{ls(e.fileName,r.data),Fr.track(Cl.DOWNLOAD_REPORT,{reportType:"team",businessHours:e==null?void 0:e.businessHours})}).catch(r=>{console.error(r)})},downloadAccountConversationHeatmap(t,e){ki.getConversationTrafficCSV({daysBefore:e.daysBefore}).then(r=>{ls(Dqe({type:"Conversation traffic",to:e.to}),r.data),Fr.track(Cl.DOWNLOAD_REPORT,{reportType:"conversation_heatmap",businessHours:!1})}).catch(r=>{console.error(r)})}},BHe={[p.SET_ACCOUNT_REPORTS](t,{metric:e,data:r}){t.accountReport.data[e]=r},[p.SET_HEATMAP_DATA](t,e){t.overview.accountConversationHeatmap=e},[p.TOGGLE_ACCOUNT_REPORT_LOADING](t,{metric:e,value:r}){t.accountReport.isFetching[e]=r},[p.SET_BOT_SUMMARY_STATUS](t,e){t.botSummaryFetchingStatus=e},[p.SET_ACCOUNT_SUMMARY_STATUS](t,e){t.accountSummaryFetchingStatus=e},[p.TOGGLE_HEATMAP_LOADING](t,e){t.overview.uiFlags.isFetchingAccountConversationsHeatmap=e},[p.SET_ACCOUNT_SUMMARY](t,e){t.accountSummary=e},[p.SET_BOT_SUMMARY](t,e){t.botSummary=e},[p.SET_ACCOUNT_CONVERSATION_METRIC](t,e){t.overview.accountConversationMetric=e},[p.TOGGLE_ACCOUNT_CONVERSATION_METRIC_LOADING](t,e){t.overview.uiFlags.isFetchingAccountConversationMetric=e},[p.SET_AGENT_CONVERSATION_METRIC](t,e){t.overview.agentConversationMetric=e},[p.TOGGLE_AGENT_CONVERSATION_METRIC_LOADING](t,e){t.overview.uiFlags.isFetchingAgentConversationMetric=e},[p.SET_TEAM_CONVERSATION_METRIC](t,e){t.overview.teamConversationMetric=e},[p.TOGGLE_TEAM_CONVERSATION_METRIC_LOADING](t,e){t.overview.uiFlags.isFetchingTeamConversationMetric=e}},PHe={state:NHe,getters:DHe,actions:VHe,mutations:BHe};class FHe extends Fe{constructor(){super("sla_policies",{accountScoped:!0})}}const T3=new FHe,UHe={records:[],uiFlags:{isFetching:!1,isFetchingItem:!1,isCreating:!1,isDeleting:!1}},jHe={getSLA(t){return t.records},getUIFlags(t){return t.uiFlags}},zHe={get:async function({commit:e}){e(p.SET_SLA_UI_FLAG,{isFetching:!0});try{const r=await T3.get();e(p.SET_SLA,r.data.payload)}catch{}finally{e(p.SET_SLA_UI_FLAG,{isFetching:!1})}},create:async function({commit:e},r){e(p.SET_SLA_UI_FLAG,{isCreating:!0});try{const a=await T3.create(r);Fr.track(Z6.CREATE),e(p.ADD_SLA,a.data.payload)}catch(a){Me(a)}finally{e(p.SET_SLA_UI_FLAG,{isCreating:!1})}},delete:async function({commit:e},r){e(p.SET_SLA_UI_FLAG,{isDeleting:!0});try{await T3.delete(r),Fr.track(Z6.DELETED),e(p.DELETE_SLA,r)}catch(a){Me(a)}finally{e(p.SET_SLA_UI_FLAG,{isDeleting:!1})}}},qHe={[p.SET_SLA_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.SET_SLA]:ur,[p.ADD_SLA]:Ma,[p.DELETE_SLA]:da},GHe={namespaced:!0,state:UHe,getters:jHe,actions:zHe,mutations:qHe};class HHe extends Fe{constructor(){super("applied_slas",{accountScoped:!0})}get({from:e,to:r,assigned_agent_id:a,inbox_id:o,team_id:i,sla_policy_id:n,label_list:s,page:l}={}){return axios.get(this.url,{params:{since:e,until:r,assigned_agent_id:a,inbox_id:o,team_id:i,sla_policy_id:n,label_list:s,page:l}})}download({from:e,to:r,assigned_agent_id:a,inbox_id:o,team_id:i,sla_policy_id:n,label_list:s}={}){return axios.get(`${this.url}/download`,{params:{since:e,until:r,assigned_agent_id:a,inbox_id:o,team_id:i,label_list:s,sla_policy_id:n}})}getMetrics({from:e,to:r,assigned_agent_id:a,inbox_id:o,team_id:i,label_list:n,sla_policy_id:s}={}){return axios.get(`${this.url}/metrics`,{params:{since:e,until:r,assigned_agent_id:a,inbox_id:o,label_list:n,team_id:i,sla_policy_id:s}})}}const S3=new HHe,KHe={records:[],metrics:{numberOfConversations:0,numberOfSLAMisses:0,hitRate:"0%"},uiFlags:{isFetching:!1,isFetchingMetrics:!1},meta:{count:0,currentPage:1}},WHe={getAll(t){return t.records},getMeta(t){return t.meta},getMetrics(t){return t.metrics},getUIFlags(t){return t.uiFlags}},ZHe={get:async function({commit:e},r){e(p.SET_SLA_REPORTS_UI_FLAG,{isFetching:!0});try{const a=await S3.get(r),{payload:o,meta:i}=a.data;e(p.SET_SLA_REPORTS,o),e(p.SET_SLA_REPORTS_META,i)}catch(a){throw new Error(a)}finally{e(p.SET_SLA_REPORTS_UI_FLAG,{isFetching:!1})}},getMetrics:async function({commit:e},r){e(p.SET_SLA_REPORTS_UI_FLAG,{isFetchingMetrics:!0});try{const a=await S3.getMetrics(r);e(p.SET_SLA_REPORTS_METRICS,a.data)}catch{}finally{e(p.SET_SLA_REPORTS_UI_FLAG,{isFetchingMetrics:!1})}},download(t,e){return S3.download(e).then(r=>{ls(e.fileName,r.data)})}},JHe={[p.SET_SLA_REPORTS_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.SET_SLA_REPORTS]:ur,[p.SET_SLA_REPORTS_METRICS](t,{number_of_sla_misses:e,hit_rate:r,total_applied_slas:a}){t.metrics={numberOfSLAMisses:e,hitRate:r,numberOfConversations:a}},[p.SET_SLA_REPORTS_META](t,{count:e,current_page:r}){t.meta={count:e,currentPage:r}}},QHe={namespaced:!0,state:KHe,getters:WHe,actions:ZHe,mutations:JHe};class XHe extends Fe{constructor(){super("summary_reports",{accountScoped:!0,apiVersion:"v2"})}getTeamReports({since:e,until:r,businessHours:a}={}){return axios.get(`${this.url}/team`,{params:{since:e,until:r,business_hours:a}})}getAgentReports({since:e,until:r,businessHours:a}={}){return axios.get(`${this.url}/agent`,{params:{since:e,until:r,business_hours:a}})}getInboxReports({since:e,until:r,businessHours:a}={}){return axios.get(`${this.url}/inbox`,{params:{since:e,until:r,business_hours:a}})}}const YHe=new XHe,_He={inbox:{flagKey:"isFetchingInboxSummaryReports",apiMethod:"getInboxReports",mutationKey:"setInboxSummaryReport"},agent:{flagKey:"isFetchingAgentSummaryReports",apiMethod:"getAgentReports",mutationKey:"setAgentSummaryReport"},team:{flagKey:"isFetchingTeamSummaryReports",apiMethod:"getTeamReports",mutationKey:"setTeamSummaryReport"}};async function I3(t,e,{commit:r}){const a=_He[t];if(a)try{r("setUIFlags",{[a.flagKey]:!0});const o=await YHe[a.apiMethod](e);r(a.mutationKey,mr(o.data,{deep:!0}))}catch{}finally{r("setUIFlags",{[a.flagKey]:!1})}}const $He={inboxSummaryReports:[],agentSummaryReports:[],teamSummaryReports:[],uiFlags:{isFetchingInboxSummaryReports:!1,isFetchingAgentSummaryReports:!1,isFetchingTeamSummaryReports:!1}},eKe={getInboxSummaryReports(t){return t.inboxSummaryReports},getAgentSummaryReports(t){return t.agentSummaryReports},getTeamSummaryReports(t){return t.teamSummaryReports},getUIFlags(t){return t.uiFlags}},tKe={fetchInboxSummaryReports({commit:t},e){return I3("inbox",e,{commit:t})},fetchAgentSummaryReports({commit:t},e){return I3("agent",e,{commit:t})},fetchTeamSummaryReports({commit:t},e){return I3("team",e,{commit:t})}},rKe={setInboxSummaryReport(t,e){t.inboxSummaryReports=e},setAgentSummaryReport(t,e){t.agentSummaryReports=e},setTeamSummaryReport(t,e){t.teamSummaryReports=e},setUIFlags(t,e){t.uiFlags={...t.uiFlags,...e}}},aKe={namespaced:!0,state:$He,getters:eKe,actions:tKe,mutations:rKe};class oKe extends aw{constructor(){super("teams",{accountScoped:!0})}get cacheModelName(){return"team"}extractDataFromResponse(e){return e.data}marshallData(e){return{data:e}}getAgents({teamId:e}){return axios.get(`${this.url}/${e}/team_members`)}addAgents({teamId:e,agentsList:r}){return axios.post(`${this.url}/${e}/team_members`,{user_ids:r})}updateAgents({teamId:e,agentsList:r}){return axios.patch(`${this.url}/${e}/team_members`,{user_ids:r})}}const Ho=new oKe,is="SET_TEAM_MEMBERS_UI_FLAG",uu="ADD_AGENTS_TO_TEAM",iKe={records:{},uiFlags:{isFetching:!1,isCreating:!1,isUpdating:!1,isDeleting:!1}},nKe={getUIFlags(t){return t.uiFlags},getTeamMembers:t=>e=>t.records[e]||[]},sKe={get:async({commit:t},{teamId:e})=>{t(is,{isFetching:!0});try{const{data:r}=await Ho.getAgents({teamId:e});t(uu,{data:r,teamId:e})}catch(r){throw new Error(r)}finally{t(is,{isFetching:!1})}},create:async({commit:t},{agentsList:e,teamId:r})=>{t(is,{isCreating:!0});try{const{data:a}=await Ho.addAgents({agentsList:e,teamId:r});t(uu,{teamId:r,data:a})}catch(a){throw new Error(a)}finally{t(is,{isCreating:!1})}},update:async({commit:t},{agentsList:e,teamId:r})=>{t(is,{isUpdating:!0});try{const a=await Ho.updateAgents({agentsList:e,teamId:r});t(uu,a)}catch(a){throw new Error(a)}finally{t(is,{isUpdating:!1})}}},lKe={[is](t,e){t.uiFlags={...t.uiFlags,...e}},[uu](t,{data:e,teamId:r}){t.records={...t.records,[r]:e}}},cKe={namespaced:!0,state:iKe,getters:nKe,actions:sKe,mutations:lKe},uKe={getTeams(t){return Object.values(t.records).sort((e,r)=>e.id-r.id)},getTeamById:t=>e=>Object.values(t.records).find(r=>r.id===Number(e))||{},getMyTeams(t,e){return e.getTeams.filter(r=>{const{is_member:a}=r;return a})},getUIFlags(t){return t.uiFlags},getTeam:t=>e=>t.records[e]||{}},Xa="SET_TEAM_UI_FLAG",aM="CLEAR_TEAMS",Vp="SET_TEAMS",Bp="SET_TEAM_ITEM",oM="EDIT_TEAM",iM="DELETE_TEAM",dKe={create:async({commit:t},e)=>{t(Xa,{isCreating:!0});try{const a=(await Ho.create(e)).data;return t(Bp,a),a}catch(r){throw new Error(r)}finally{t(Xa,{isCreating:!1})}},revalidate:async({commit:t},{newKey:e})=>{try{if(!await Ho.validateCacheKey(e)){const a=await Ho.refetchAndCommit(e);t(Vp,a.data)}}catch{}},get:async({commit:t})=>{t(Xa,{isFetching:!0});try{const{data:e}=await Ho.get(!0);t(aM),t(Vp,e)}catch(e){throw new Error(e)}finally{t(Xa,{isFetching:!1})}},show:async({commit:t},{id:e})=>{t(Xa,{isFetchingItem:!0});try{const r=await Ho.show(e);t(Bp,r.data.payload),t(Xa,{isFetchingItem:!1})}catch(r){throw new Error(r)}finally{t(Xa,{isFetchingItem:!1})}},update:async({commit:t},{id:e,...r})=>{t(Xa,{isUpdating:!0});try{const a=await Ho.update(e,r);t(oM,a.data)}catch(a){throw new Error(a)}finally{t(Xa,{isUpdating:!1})}},delete:async({commit:t},e)=>{t(Xa,{isDeleting:!0});try{await Ho.delete(e),t(iM,e)}catch(r){throw new Error(r)}finally{t(Xa,{isDeleting:!1})}}},gKe={[Xa](t,e){t.uiFlags={...t.uiFlags,...e}},[aM]:t=>{t.records={}},[Vp]:(t,e)=>{const r={...t.records};e.forEach(a=>{r[a.id]={...r[a.id]||{},...a}}),t.records=r},[Bp]:(t,e)=>{t.records={...t.records,[e.id]:{...t.records[e.id]||{},...e}}},[oM]:(t,e)=>{t.records={...t.records,[e.id]:e}},[iM]:(t,e)=>{const{[e]:r,...a}=t.records;t.records=a}},hKe={meta:{},records:{},uiFlags:{isFetching:!1,isCreating:!1,isUpdating:!1,isDeleting:!1}},mKe={namespaced:!0,state:hKe,getters:uKe,actions:dKe,mutations:gKe};class pKe extends Fe{constructor(){super("notification_settings",{accountScoped:!0})}update(e){return axios.patch(`${this.url}`,e)}}const yk=new pKe,fKe={record:{},uiFlags:{isFetching:!1,isUpdating:!1}},wKe={getUIFlags(t){return t.uiFlags},getSelectedEmailFlags:t=>t.record.selected_email_flags,getSelectedPushFlags:t=>t.record.selected_push_flags},vKe={get:async({commit:t})=>{t(p.SET_USER_NOTIFICATION_UI_FLAG,{isFetching:!0});try{const e=await yk.get();t(p.SET_USER_NOTIFICATION,e.data),t(p.SET_USER_NOTIFICATION_UI_FLAG,{isFetching:!1})}catch{t(p.SET_USER_NOTIFICATION_UI_FLAG,{isFetching:!1})}},update:async({commit:t},{selectedEmailFlags:e,selectedPushFlags:r})=>{t(p.SET_USER_NOTIFICATION_UI_FLAG,{isUpdating:!0});try{const a=await yk.update({notification_settings:{selected_email_flags:e,selected_push_flags:r}});t(p.SET_USER_NOTIFICATION,a.data),t(p.SET_USER_NOTIFICATION_UI_FLAG,{isUpdating:!1})}catch(a){throw t(p.SET_USER_NOTIFICATION_UI_FLAG,{isUpdating:!1}),a}}},bKe={[p.SET_USER_NOTIFICATION_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.SET_USER_NOTIFICATION]:(t,e)=>{t.record=e}},EKe={namespaced:!0,state:fKe,getters:wKe,actions:vKe,mutations:bKe};class kKe extends Fe{constructor(){super("webhooks",{accountScoped:!0})}}const q2=new kKe,CKe={records:[],uiFlags:{fetchingList:!1,creatingItem:!1,deletingItem:!1,updatingItem:!1}},AKe={getWebhooks(t){return t.records.sort((e,r)=>e.id-r.id)},getUIFlags(t){return t.uiFlags}},xKe={async get({commit:t}){t(p.SET_WEBHOOK_UI_FLAG,{fetchingList:!0});try{const e=await q2.get();t(p.SET_WEBHOOK,e.data.payload.webhooks),t(p.SET_WEBHOOK_UI_FLAG,{fetchingList:!1})}catch{t(p.SET_WEBHOOK_UI_FLAG,{fetchingList:!1})}},async create({commit:t},e){t(p.SET_WEBHOOK_UI_FLAG,{creatingItem:!0});try{const r=await q2.create(e),{payload:{webhook:a}}=r.data;t(p.ADD_WEBHOOK,a),t(p.SET_WEBHOOK_UI_FLAG,{creatingItem:!1})}catch(r){throw t(p.SET_WEBHOOK_UI_FLAG,{creatingItem:!1}),r}},update:async({commit:t},{id:e,...r})=>{t(p.SET_WEBHOOK_UI_FLAG,{updatingItem:!0});try{const a=await q2.update(e,r);t(p.UPDATE_WEBHOOK,a.data.payload.webhook)}catch(a){throw new Error(a)}finally{t(p.SET_WEBHOOK_UI_FLAG,{updatingItem:!1})}},async delete({commit:t},e){t(p.SET_WEBHOOK_UI_FLAG,{deletingItem:!0});try{await q2.delete(e),t(p.DELETE_WEBHOOK,e),t(p.SET_WEBHOOK_UI_FLAG,{deletingItem:!1})}catch(r){throw t(p.SET_WEBHOOK_UI_FLAG,{deletingItem:!1}),r}}},yKe={[p.SET_WEBHOOK_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.SET_WEBHOOK]:ur,[p.ADD_WEBHOOK]:Ma,[p.DELETE_WEBHOOK]:da,[p.UPDATE_WEBHOOK]:ua},TKe={namespaced:!0,state:CKe,getters:AKe,actions:xKe,mutations:yKe};class SKe extends Fe{constructor(){super("captain/assistants",{accountScoped:!0})}get({page:e=1,searchKey:r}={}){return axios.get(this.url,{params:{page:e,searchKey:r}})}playground({assistantId:e,messageContent:r,messageHistory:a}){return axios.post(`${this.url}/${e}/playground`,{message_content:r,message_history:a})}}const IKe=new SKe,MKe=(t,e)=>async({commit:r},a={})=>{r(t.SET_UI_FLAG,{fetchingList:!0});try{const o=await e.get(a);return r(t.SET,o.data.payload),r(t.SET_META,o.data.meta),o.data.payload}catch(o){return Me(o)}finally{r(t.SET_UI_FLAG,{fetchingList:!1})}},OKe=(t,e)=>async({commit:r},a)=>{r(t.SET_UI_FLAG,{fetchingItem:!0});try{const o=await e.show(a);return r(t.ADD,o.data),o.data}catch(o){return Me(o)}finally{r(t.SET_UI_FLAG,{fetchingItem:!1})}},LKe=(t,e)=>async({commit:r},a)=>{r(t.SET_UI_FLAG,{creatingItem:!0});try{const o=await e.create(a);return r(t.UPSERT,o.data),o.data}catch(o){return Me(o)}finally{r(t.SET_UI_FLAG,{creatingItem:!1})}},RKe=(t,e)=>async({commit:r},{id:a,...o})=>{r(t.SET_UI_FLAG,{updatingItem:!0});try{const i=await e.update(a,o);return r(t.EDIT,i.data),i.data}catch(i){return Me(i)}finally{r(t.SET_UI_FLAG,{updatingItem:!1})}},NKe=(t,e)=>async({commit:r},a)=>{r(t.SET_UI_FLAG,{deletingItem:!0});try{return await e.delete(a),r(t.DELETE,a),a}catch(o){return Me(o)}finally{r(t.SET_UI_FLAG,{deletingItem:!1})}},DKe=t=>{const e=t.toUpperCase();return{SET_UI_FLAG:`SET_${e}_UI_FLAG`,SET:`SET_${e}`,ADD:`ADD_${e}`,EDIT:`EDIT_${e}`,DELETE:`DELETE_${e}`,SET_META:`SET_${e}_META`,UPSERT:`UPSERT_${e}`}},VKe=()=>({records:[],meta:{},uiFlags:{fetchingList:!1,fetchingItem:!1,creatingItem:!1,updatingItem:!1,deletingItem:!1}}),BKe=()=>({getRecords:t=>t.records.sort((e,r)=>r.id-e.id),getRecord:t=>e=>t.records.find(r=>r.id===Number(e))||{},getUIFlags:t=>t.uiFlags,getMeta:t=>t.meta}),PKe=t=>({[t.SET_UI_FLAG](e,r){e.uiFlags={...e.uiFlags,...r}},[t.SET_META](e,r){e.meta={totalCount:Number(r.total_count),page:Number(r.page)}},[t.SET]:ur,[t.ADD]:Ma,[t.EDIT]:ua,[t.DELETE]:da,[t.UPSERT]:Kc}),FKe=(t,e)=>({get:MKe(e,t),show:OKe(e,t),create:LKe(e,t),update:RKe(e,t),delete:NKe(e,t)}),$s=t=>{const{name:e,API:r,actions:a,getters:o}=t,i=DKe(e),n=a?a(i):{};return{namespaced:!0,state:VKe(),getters:{...BKe(),...o||{}},mutations:PKe(i),actions:{...FKe(r,i),...n}}},UKe=$s({name:"CaptainAssistant",API:IKe});class jKe extends Fe{constructor(){super("captain/documents",{accountScoped:!0})}get({page:e=1,searchKey:r,assistantId:a}={}){return axios.get(this.url,{params:{page:e,searchKey:r,assistant_id:a}})}}const zKe=new jKe,qKe=$s({name:"CaptainDocument",API:zKe});class GKe extends Fe{constructor(){super("captain/assistant_responses",{accountScoped:!0})}get({page:e=1,searchKey:r,assistantId:a,documentId:o,status:i}={}){return axios.get(this.url,{params:{page:e,searchKey:r,assistant_id:a,document_id:o,status:i}})}}const HKe=new GKe,KKe=$s({name:"CaptainResponse",API:HKe,actions:t=>({removeBulkResponses:({commit:e,state:r},a)=>{const o=r.records.filter(i=>!a.includes(i.id));e(t.SET,o)},updateBulkResponses:({commit:e,state:r},a)=>{const o=a.reduce((n,s)=>(n[s.id]=s,n),{}),i=r.records.map(n=>o[n.id]?o[n.id]:n);e(t.SET,i)}})});class WKe extends Fe{constructor(){super("captain/assistants",{accountScoped:!0})}get({assistantId:e}={}){return axios.get(`${this.url}/${e}/inboxes`)}create(e={}){const{assistantId:r,inboxId:a}=e;return axios.post(`${this.url}/${r}/inboxes`,{inbox:{inbox_id:a}})}delete(e={}){const{assistantId:r,inboxId:a}=e;return axios.delete(`${this.url}/${r}/inboxes/${a}`)}}const Tk=new WKe,ZKe=$s({name:"CaptainInbox",API:Tk,actions:t=>({delete:async function({commit:r},{inboxId:a,assistantId:o}){r(t.SET_UI_FLAG,{deletingItem:!0});try{return await Tk.delete({inboxId:a,assistantId:o}),r(t.DELETE,a),r(t.SET_UI_FLAG,{deletingItem:!1}),a}catch(i){return r(t.SET_UI_FLAG,{deletingItem:!1}),Me(i)}}})});class JKe extends Fe{constructor(){super("captain/bulk_actions",{accountScoped:!0})}}const Sk=new JKe,QKe=$s({name:"CaptainBulkAction",API:Sk,actions:t=>({processBulkAction:async function({commit:r},{type:a,actionType:o,ids:i}){r(t.SET_UI_FLAG,{isUpdating:!0});try{const n=await Sk.create({type:a,ids:i,fields:{status:o}});return r(t.SET_UI_FLAG,{isUpdating:!1}),n.data}catch(n){return r(t.SET_UI_FLAG,{isUpdating:!1}),Me(n)}},handleBulkDelete:async function({dispatch:r},a){const o=await r("processBulkAction",{type:"AssistantResponse",actionType:"delete",ids:a});return await r("captainResponses/removeBulkResponses",a,{root:!0}),o},handleBulkApprove:async function({dispatch:r},a){const o=await r("processBulkAction",{type:"AssistantResponse",actionType:"approve",ids:a});return await r("captainResponses/updateBulkResponses",o,{root:!0}),o}})});class XKe extends Fe{constructor(){super("captain/copilot_threads",{accountScoped:!0})}}const YKe=new XKe,_Ke=$s({name:"CopilotThreads",API:YKe});class $Ke extends Fe{constructor(){super("captain/copilot_threads",{accountScoped:!0})}get(e){return axios.get(`${this.url}/${e}/copilot_messages`)}create({threadId:e,...r}){return axios.post(`${this.url}/${e}/copilot_messages`,r)}}const eWe=new $Ke,tWe=$s({name:"CopilotMessages",API:eWe,getters:{getMessagesByThreadId:t=>e=>t.records.filter(r=>{var a;return((a=r.copilot_thread)==null?void 0:a.id)===Number(e)}).sort((r,a)=>r.id-a.id)},actions:t=>({upsert({commit:e},r){e(t.UPSERT,r)}})}),rWe=[],bc=gxe({modules:{accounts:pUe,agentBots:BUe,agents:qUe,articles:JUe,attributes:eje,auditlogs:sje,auth:gje,automations:vje,bulkActions:yje,campaigns:Lje,cannedResponse:Pje,categories:Gje,contactConversations:eze,contactLabels:ize,contactNotes:dze,contacts:vze,conversationLabels:Aze,conversationMetadata:Ize,conversationPage:Nze,conversations:cqe,conversationSearch:pqe,conversationStats:Cqe,conversationTypingStatus:Sqe,conversationWatchers:Rqe,csat:Uqe,customRole:Kqe,customViews:Yqe,dashboardApps:aGe,draftMessages:lGe,globalConfig:NGe,inboxAssignableAgents:jGe,inboxes:QGe,inboxMembers:_Ge,integrations:oHe,labels:uHe,macros:fHe,notifications:xHe,portals:OHe,reports:PHe,sla:GHe,slaReports:QHe,summaryReports:aKe,teamMembers:cKe,teams:mKe,userNotificationSettings:EKe,webhooks:TKe,captainAssistants:UKe,captainDocuments:qKe,captainResponses:KKe,captainInboxes:ZKe,captainBulkActions:QKe,copilotThreads:_Ke,copilotMessages:tWe},plugins:rWe});var Pp={exports:{}};(function(t,e){(function(r,a){a(e)})(ct,function(r){var a={logger:self.console,WebSocket:self.WebSocket},o={log:function(){if(this.enabled){for(var N,q=arguments.length,j=Array(q),J=0;J<q;J++)j[J]=arguments[J];j.push(Date.now()),(N=a.logger).log.apply(N,["[ActionCable]"].concat(j))}}},i=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(S){return typeof S}:function(S){return S&&typeof Symbol=="function"&&S.constructor===Symbol&&S!==Symbol.prototype?"symbol":typeof S},n=function(S,N){if(!(S instanceof N))throw new TypeError("Cannot call a class as a function")},s=function(){function S(N,q){for(var j=0;j<q.length;j++){var J=q[j];J.enumerable=J.enumerable||!1,J.configurable=!0,"value"in J&&(J.writable=!0),Object.defineProperty(N,J.key,J)}}return function(N,q,j){return q&&S(N.prototype,q),j&&S(N,j),N}}(),l=function(){return new Date().getTime()},c=function(N){return(l()-N)/1e3},u=function(N,q,j){return Math.max(q,Math.min(j,N))},d=function(){function S(N){n(this,S),this.visibilityDidChange=this.visibilityDidChange.bind(this),this.connection=N,this.reconnectAttempts=0}return S.prototype.start=function(){this.isRunning()||(this.startedAt=l(),delete this.stoppedAt,this.startPolling(),addEventListener("visibilitychange",this.visibilityDidChange),o.log("ConnectionMonitor started. pollInterval = "+this.getPollInterval()+" ms"))},S.prototype.stop=function(){this.isRunning()&&(this.stoppedAt=l(),this.stopPolling(),removeEventListener("visibilitychange",this.visibilityDidChange),o.log("ConnectionMonitor stopped"))},S.prototype.isRunning=function(){return this.startedAt&&!this.stoppedAt},S.prototype.recordPing=function(){this.pingedAt=l()},S.prototype.recordConnect=function(){this.reconnectAttempts=0,this.recordPing(),delete this.disconnectedAt,o.log("ConnectionMonitor recorded connect")},S.prototype.recordDisconnect=function(){this.disconnectedAt=l(),o.log("ConnectionMonitor recorded disconnect")},S.prototype.startPolling=function(){this.stopPolling(),this.poll()},S.prototype.stopPolling=function(){clearTimeout(this.pollTimeout)},S.prototype.poll=function(){var q=this;this.pollTimeout=setTimeout(function(){q.reconnectIfStale(),q.poll()},this.getPollInterval())},S.prototype.getPollInterval=function(){var q=this.constructor.pollInterval,j=q.min,J=q.max,_=q.multiplier,B=_*Math.log(this.reconnectAttempts+1);return Math.round(u(B,j,J)*1e3)},S.prototype.reconnectIfStale=function(){this.connectionIsStale()&&(o.log("ConnectionMonitor detected stale connection. reconnectAttempts = "+this.reconnectAttempts+", pollInterval = "+this.getPollInterval()+" ms, time disconnected = "+c(this.disconnectedAt)+" s, stale threshold = "+this.constructor.staleThreshold+" s"),this.reconnectAttempts++,this.disconnectedRecently()?o.log("ConnectionMonitor skipping reopening recent disconnect"):(o.log("ConnectionMonitor reopening"),this.connection.reopen()))},S.prototype.connectionIsStale=function(){return c(this.pingedAt?this.pingedAt:this.startedAt)>this.constructor.staleThreshold},S.prototype.disconnectedRecently=function(){return this.disconnectedAt&&c(this.disconnectedAt)<this.constructor.staleThreshold},S.prototype.visibilityDidChange=function(){var q=this;document.visibilityState==="visible"&&setTimeout(function(){(q.connectionIsStale()||!q.connection.isOpen())&&(o.log("ConnectionMonitor reopening stale connection on visibilitychange. visibilityState = "+document.visibilityState),q.connection.reopen())},200)},S}();d.pollInterval={min:3,max:30,multiplier:5},d.staleThreshold=6;var g={message_types:{welcome:"welcome",disconnect:"disconnect",ping:"ping",confirmation:"confirm_subscription",rejection:"reject_subscription"},disconnect_reasons:{unauthorized:"unauthorized",invalid_request:"invalid_request",server_restart:"server_restart"},default_mount_path:"/cable",protocols:["actioncable-v1-json","actioncable-unsupported"]},h=g.message_types,m=g.protocols,f=m.slice(0,m.length-1),b=[].indexOf,k=function(){function S(N){n(this,S),this.open=this.open.bind(this),this.consumer=N,this.subscriptions=this.consumer.subscriptions,this.monitor=new d(this),this.disconnected=!0}return S.prototype.send=function(q){return this.isOpen()?(this.webSocket.send(JSON.stringify(q)),!0):!1},S.prototype.open=function(){return this.isActive()?(o.log("Attempted to open WebSocket, but existing socket is "+this.getState()),!1):(o.log("Opening WebSocket, current state is "+this.getState()+", subprotocols: "+m),this.webSocket&&this.uninstallEventHandlers(),this.webSocket=new a.WebSocket(this.consumer.url,m),this.installEventHandlers(),this.monitor.start(),!0)},S.prototype.close=function(){var q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{allowReconnect:!0},j=q.allowReconnect;if(j||this.monitor.stop(),this.isActive())return this.webSocket.close()},S.prototype.reopen=function(){if(o.log("Reopening WebSocket, current state is "+this.getState()),this.isActive())try{return this.close()}catch(q){o.log("Failed to reopen WebSocket",q)}finally{o.log("Reopening WebSocket in "+this.constructor.reopenDelay+"ms"),setTimeout(this.open,this.constructor.reopenDelay)}else return this.open()},S.prototype.getProtocol=function(){if(this.webSocket)return this.webSocket.protocol},S.prototype.isOpen=function(){return this.isState("open")},S.prototype.isActive=function(){return this.isState("open","connecting")},S.prototype.isProtocolSupported=function(){return b.call(f,this.getProtocol())>=0},S.prototype.isState=function(){for(var q=arguments.length,j=Array(q),J=0;J<q;J++)j[J]=arguments[J];return b.call(j,this.getState())>=0},S.prototype.getState=function(){if(this.webSocket){for(var q in a.WebSocket)if(a.WebSocket[q]===this.webSocket.readyState)return q.toLowerCase()}return null},S.prototype.installEventHandlers=function(){for(var q in this.events){var j=this.events[q].bind(this);this.webSocket["on"+q]=j}},S.prototype.uninstallEventHandlers=function(){for(var q in this.events)this.webSocket["on"+q]=function(){}},S}();k.reopenDelay=500,k.prototype.events={message:function(N){if(this.isProtocolSupported()){var q=JSON.parse(N.data),j=q.identifier,J=q.message,_=q.reason,B=q.reconnect,T=q.type;switch(T){case h.welcome:return this.monitor.recordConnect(),this.subscriptions.reload();case h.disconnect:return o.log("Disconnecting. Reason: "+_),this.close({allowReconnect:B});case h.ping:return this.monitor.recordPing();case h.confirmation:return this.subscriptions.notify(j,"connected");case h.rejection:return this.subscriptions.reject(j);default:return this.subscriptions.notify(j,"received",J)}}},open:function(){if(o.log("WebSocket onopen event, using '"+this.getProtocol()+"' subprotocol"),this.disconnected=!1,!this.isProtocolSupported())return o.log("Protocol is unsupported. Stopping monitor and disconnecting."),this.close({allowReconnect:!1})},close:function(N){if(o.log("WebSocket onclose event"),!this.disconnected)return this.disconnected=!0,this.monitor.recordDisconnect(),this.subscriptions.notifyAll("disconnected",{willAttemptReconnect:this.monitor.isRunning()})},error:function(){o.log("WebSocket onerror event")}};var C=function(N,q){if(q!=null)for(var j in q){var J=q[j];N[j]=J}return N},w=function(){function S(N){var q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},j=arguments[2];n(this,S),this.consumer=N,this.identifier=JSON.stringify(q),C(this,j)}return S.prototype.perform=function(q){var j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return j.action=q,this.send(j)},S.prototype.send=function(q){return this.consumer.send({command:"message",identifier:this.identifier,data:JSON.stringify(q)})},S.prototype.unsubscribe=function(){return this.consumer.subscriptions.remove(this)},S}(),v=function(){function S(N){n(this,S),this.consumer=N,this.subscriptions=[]}return S.prototype.create=function(q,j){var J=q,_=(typeof J>"u"?"undefined":i(J))==="object"?J:{channel:J},B=new w(this.consumer,_,j);return this.add(B)},S.prototype.add=function(q){return this.subscriptions.push(q),this.consumer.ensureActiveConnection(),this.notify(q,"initialized"),this.sendCommand(q,"subscribe"),q},S.prototype.remove=function(q){return this.forget(q),this.findAll(q.identifier).length||this.sendCommand(q,"unsubscribe"),q},S.prototype.reject=function(q){var j=this;return this.findAll(q).map(function(J){return j.forget(J),j.notify(J,"rejected"),J})},S.prototype.forget=function(q){return this.subscriptions=this.subscriptions.filter(function(j){return j!==q}),q},S.prototype.findAll=function(q){return this.subscriptions.filter(function(j){return j.identifier===q})},S.prototype.reload=function(){var q=this;return this.subscriptions.map(function(j){return q.sendCommand(j,"subscribe")})},S.prototype.notifyAll=function(q){for(var j=this,J=arguments.length,_=Array(J>1?J-1:0),B=1;B<J;B++)_[B-1]=arguments[B];return this.subscriptions.map(function(T){return j.notify.apply(j,[T,q].concat(_))})},S.prototype.notify=function(q,j){for(var J=arguments.length,_=Array(J>2?J-2:0),B=2;B<J;B++)_[B-2]=arguments[B];var T=void 0;return typeof q=="string"?T=this.findAll(q):T=[q],T.map(function(L){return typeof L[j]=="function"?L[j].apply(L,_):void 0})},S.prototype.sendCommand=function(q,j){var J=q.identifier;return this.consumer.send({command:j,identifier:J})},S}(),A=function(){function S(N){n(this,S),this._url=N,this.subscriptions=new v(this),this.connection=new k(this)}return S.prototype.send=function(q){return this.connection.send(q)},S.prototype.connect=function(){return this.connection.open()},S.prototype.disconnect=function(){return this.connection.close({allowReconnect:!1})},S.prototype.ensureActiveConnection=function(){if(!this.connection.isActive())return this.connection.open()},s(S,[{key:"url",get:function(){return E(this._url)}}]),S}();function E(S){if(typeof S=="function"&&(S=S()),S&&!/^wss?:/i.test(S)){var N=document.createElement("a");return N.href=S,N.href=N.href,N.protocol=N.protocol.replace("http","ws"),N.href}else return S}function M(){var S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:P("url")||g.default_mount_path;return new A(S)}function P(S){var N=document.head.querySelector("meta[name='action-cable-"+S+"']");if(N)return N.getAttribute("content")}r.Connection=k,r.ConnectionMonitor=d,r.Consumer=A,r.INTERNAL=g,r.Subscription=w,r.Subscriptions=v,r.adapters=a,r.createWebSocketURL=E,r.logger=o,r.createConsumer=M,r.getConfig=P,Object.defineProperty(r,"__esModule",{value:!0})})})(Pp,Pp.exports);var aWe=Pp.exports;const oWe=2e4,iWe=1e3,Ml=class Ml{constructor(e,r,a=""){Ve(this,"clearReconnectTimer",()=>{this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null)});Ve(this,"initReconnectTimer",()=>{this.clearReconnectTimer(),this.reconnectTimer=setTimeout(()=>{this.checkConnection()},iWe)});Ve(this,"onReconnect",()=>{});Ve(this,"onDisconnected",()=>{});Ve(this,"onReceived",({event:e,data:r}={})=>{this.isAValidEvent(r)&&this.events[e]&&typeof this.events[e]=="function"&&this.events[e](r)});const o=a?`${a}/cable`:void 0;this.consumer=aWe.createConsumer(o),this.subscription=this.consumer.subscriptions.create({channel:"RoomChannel",pubsub_token:r,account_id:e.$store.getters.getCurrentAccountId,user_id:e.$store.getters.getCurrentUserID},{updatePresence(){this.perform("update_presence")},received:this.onReceived,disconnected:()=>{Ml.isDisconnected=!0,this.onDisconnected(),this.initReconnectTimer()}}),this.app=e,this.events={},this.reconnectTimer=null,this.isAValidEvent=()=>!0,this.triggerPresenceInterval=()=>{setTimeout(()=>{this.subscription.updatePresence(),this.triggerPresenceInterval()},oWe)},this.triggerPresenceInterval()}checkConnection(){const e=this.consumer.connection.isOpen();Ml.isDisconnected&&e?(this.clearReconnectTimer(),this.onReconnect(),Ml.isDisconnected=!1):this.initReconnectTimer()}disconnect(){this.consumer.disconnect()}};Ve(Ml,"isDisconnected",!1);let Fp=Ml;const Ik=()=>{document.querySelectorAll(".favicon").forEach(e=>{const r=`/favicon-badge-${e.sizes[[0]]}.png`;e.href=r})},nWe=()=>{const t=document.querySelectorAll(".favicon");document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&t.forEach(e=>{const r=`/favicon-${e.sizes[[0]]}.png`;e.href=r})})},M3={ASSIGNED:"assigned",NOTME:"notme",UNASSIGNED:"unassigned"},sWe=["agent","administrator"],lWe=["conversation_manage","conversation_unassigned_manage","conversation_participating_manage"];class cWe{constructor(e){Ve(this,"hasUnreadConversation",()=>this.store.getters.getMineChats({assigneeType:"me",status:"open"}).some(r=>r.unread_count>0));Ve(this,"isMessageFromPendingConversation",(e={})=>{const{conversation_id:r}=e||{};if(!r)return!1;const a=this.store.getters.getConversationById(r);return(a==null?void 0:a.status)===oc.STATUS_TYPE.PENDING});Ve(this,"isMessageFromCurrentConversation",e=>{var r;return((r=this.store.getters.getSelectedChat)==null?void 0:r.id)===e.conversation_id});Ve(this,"hasConversationPermission",e=>{const r=this.store.getters.getCurrentAccountId,a=Np(e,r);return[...sWe,...lWe].some(i=>a.includes(i))});this.store=e}}const nM=t=>{var e;return(e=t==null?void 0:t.conversation)==null?void 0:e.assignee_id},uWe=t=>!nM(t),dWe=(t,e)=>nM(t)===e,gWe=(t,e)=>{var r;return((r=t==null?void 0:t.sender)==null?void 0:r.id)===e};class hWe{constructor(){Ve(this,"initializeEvent",()=>{window.addEventListener("blur",()=>{this.isVisible=!1}),window.addEventListener("focus",()=>{this.isVisible=!0})});this.isVisible=!0,this.initializeEvent()}isWindowVisible(){return!document.hidden&&this.isVisible}}const Mk=new hWe,mWe=3e4,pWe=1e4,fWe="/audio/dashboard/",Ok="ding",Lk=["none"];class wWe{constructor(e){Ve(this,"intializeAudio",()=>{const e=`${fWe}${this.audioConfig.tone}.mp3`;return this.audioConfig.audio=new Audio(e),this.audioConfig.audio.load()});Ve(this,"playAudioAlert",async()=>{try{await this.audioConfig.audio.play()}catch(e){e.name==="NotAllowedError"&&!this.hasSentSoundPermissionsRequest&&(this.hasSentSoundPermissionsRequest=!0,It("PROFILE_SETTINGS.FORM.AUDIO_NOTIFICATIONS_SECTION.SOUND_PERMISSION_ERROR",{usei18n:!0,duration:pWe}))}});Ve(this,"set",({currentUser:e,alwaysPlayAudioAlert:r,alertIfUnreadConversationExist:a,audioAlertType:o=Lk,audioAlertTone:i=Ok})=>{this.notificationConfig={...this.notificationConfig,audioAlertType:o.split("+").filter(Boolean),playAlertOnlyWhenHidden:!r,alertIfUnreadConversationExist:a},this.currentUser=e;const n=this.audioConfig.tone;this.audioConfig={...this.audioConfig,tone:i},n!==i&&this.intializeAudio(),nWe(),this.clearRecurringTimer(),this.playAudioEvery30Seconds()});Ve(this,"shouldPlayAlert",()=>this.notificationConfig.playAlertOnlyWhenHidden?!Mk.isWindowVisible():!0);Ve(this,"executeRecurringNotification",()=>{this.store.hasUnreadConversation()&&this.shouldPlayAlert()&&(this.playAudioAlert(),Ik()),this.resetRecurringTimer()});Ve(this,"clearRecurringTimer",()=>{this.recurringNotificationTimer&&clearTimeout(this.recurringNotificationTimer)});Ve(this,"resetRecurringTimer",()=>{this.clearRecurringTimer(),this.recurringNotificationTimer=setTimeout(this.executeRecurringNotification,mWe)});Ve(this,"playAudioEvery30Seconds",()=>{const{audioAlertType:e,alertIfUnreadConversationExist:r}=this.notificationConfig;e.includes("none")||r&&this.resetRecurringTimer()});Ve(this,"shouldNotifyOnMessage",e=>{const{audioAlertType:r}=this.notificationConfig;if(r.includes("none"))return!1;if(r.includes("all"))return!0;const a=dWe(e,this.currentUser.id),o=uWe(e),i=[];return(r.includes(M3.ASSIGNED)||r.includes("mine"))&&i.push(a),r.includes(M3.UNASSIGNED)&&i.push(o),r.includes(M3.NOTME)&&i.push(!o&&!a),i.some(Boolean)});Ve(this,"onNewMessage",e=>{if(!this.store.hasConversationPermission(this.currentUser)||this.store.isMessageFromPendingConversation(e)||gWe(e,this.currentUser.id)||!this.shouldNotifyOnMessage(e))return;const{message_type:r,private:a}=e;r!==nc.INCOMING&&!a||Mk.isWindowVisible()&&(this.store.isMessageFromCurrentConversation(e)||this.notificationConfig.playAlertOnlyWhenHidden)||(this.playAudioAlert(),Ik(),this.playAudioEvery30Seconds())});if(!e)throw new Error("store is required");this.store=new cWe(e),this.notificationConfig={audioAlertType:Lk,playAlertOnlyWhenHidden:!0,alertIfUnreadConversationExist:!1},this.recurringNotificationTimer=null,this.audioConfig={audio:null,tone:Ok,hasSentSoundPermissionsRequest:!1},this.currentUser=null}}const vWe=new wWe(bc);function bWe(){return{isImpersonating:K(()=>rw.get(tw.IMPERSONATION_USER))}}const{isImpersonating:EWe}=bWe();class kWe extends Fp{constructor(r,a){const{websocketURL:o=""}=window.chatwootConfig||{},i=o||window.__WEBSOCKET_URL__||"";super(r,a,i);Ve(this,"onReconnect",()=>{yr.emit(Ri.WEBSOCKET_RECONNECT)});Ve(this,"onDisconnected",()=>{yr.emit(Ri.WEBSOCKET_DISCONNECT)});Ve(this,"isAValidEvent",r=>this.app.$store.getters.getCurrentAccountId===r.account_id);Ve(this,"onMessageUpdated",r=>{this.app.$store.dispatch("updateMessage",r)});Ve(this,"onPresenceUpdate",r=>{EWe.value||(this.app.$store.dispatch("contacts/updatePresence",r.contacts),this.app.$store.dispatch("agents/updatePresence",r.users),this.app.$store.dispatch("setCurrentUserAvailability",r.users))});Ve(this,"onConversationContactChange",r=>{const{meta:a={},id:o}=r,{sender:i}=a||{};o&&this.app.$store.dispatch("updateConversationContact",{conversationId:o,...i})});Ve(this,"onAssigneeChanged",r=>{const{id:a}=r;a&&this.app.$store.dispatch("updateConversation",r),this.fetchConversationStats()});Ve(this,"onConversationCreated",r=>{this.app.$store.dispatch("addConversation",r),this.fetchConversationStats()});Ve(this,"onConversationRead",r=>{this.app.$store.dispatch("updateConversation",r)});Ve(this,"onLogout",()=>Qa.logout());Ve(this,"onMessageCreated",r=>{const{conversation:{last_activity_at:a},conversation_id:o}=r;window.__WOOT_ISOLATED_SHELL__||vWe.onNewMessage(r),this.app.$store.dispatch("addMessage",r),this.app.$store.dispatch("updateConversationLastActivity",{lastActivityAt:a,conversationId:o})});Ve(this,"onReload",()=>window.location.reload());Ve(this,"onStatusChange",r=>{this.app.$store.dispatch("updateConversation",r),this.fetchConversationStats()});Ve(this,"onConversationUpdated",r=>{this.app.$store.dispatch("updateConversation",r),this.fetchConversationStats()});Ve(this,"onTypingOn",({conversation:r,user:a})=>{const o=r.id;this.clearTimer(o),this.app.$store.dispatch("conversationTypingStatus/create",{conversationId:o,user:a}),this.initTimer({conversation:r,user:a})});Ve(this,"onTypingOff",({conversation:r,user:a})=>{const o=r.id;this.clearTimer(o),this.app.$store.dispatch("conversationTypingStatus/destroy",{conversationId:o,user:a})});Ve(this,"onConversationMentioned",r=>{this.app.$store.dispatch("addMentions",r)});Ve(this,"clearTimer",r=>{const a=this.CancelTyping[r];a&&(clearTimeout(a),this.CancelTyping[r]=null)});Ve(this,"initTimer",({conversation:r,user:a})=>{const o=r.id;this.CancelTyping[o]=setTimeout(()=>{this.onTypingOff({conversation:r,user:a})},3e4)});Ve(this,"fetchConversationStats",()=>{yr.emit("fetch_conversation_stats")});Ve(this,"onContactDelete",r=>{this.app.$store.dispatch("contacts/deleteContactThroughConversations",r.id),this.fetchConversationStats()});Ve(this,"onContactUpdate",r=>{this.app.$store.dispatch("contacts/updateContact",r)});Ve(this,"onNotificationCreated",r=>{this.app.$store.dispatch("notifications/addNotification",r)});Ve(this,"onNotificationDeleted",r=>{this.app.$store.dispatch("notifications/deleteNotification",r)});Ve(this,"onNotificationUpdated",r=>{this.app.$store.dispatch("notifications/updateNotification",r)});Ve(this,"onCopilotMessageCreated",r=>{this.app.$store.dispatch("copilotMessages/upsert",r)});Ve(this,"onCacheInvalidate",r=>{const a=r.cache_keys;this.app.$store.dispatch("labels/revalidate",{newKey:a.label}),this.app.$store.dispatch("inboxes/revalidate",{newKey:a.inbox}),this.app.$store.dispatch("teams/revalidate",{newKey:a.team})});this.CancelTyping=[],this.events={"message.created":this.onMessageCreated,"message.updated":this.onMessageUpdated,"conversation.created":this.onConversationCreated,"conversation.status_changed":this.onStatusChange,"user:logout":this.onLogout,"page:reload":this.onReload,"assignee.changed":this.onAssigneeChanged,"conversation.typing_on":this.onTypingOn,"conversation.typing_off":this.onTypingOff,"conversation.contact_changed":this.onConversationContactChange,"presence.update":this.onPresenceUpdate,"contact.deleted":this.onContactDelete,"contact.updated":this.onContactUpdate,"conversation.mentioned":this.onConversationMentioned,"notification.created":this.onNotificationCreated,"notification.deleted":this.onNotificationDeleted,"notification.updated":this.onNotificationUpdated,"conversation.read":this.onConversationRead,"conversation.updated":this.onConversationUpdated,"account.cache_invalidated":this.onCacheInvalidate,"copilot.message.created":this.onCopilotMessageCreated}}}const sM={init(t,e){return new kWe({$store:t},e)}};/*! @license DOMPurify 3.2.4 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.4/LICENSE */const{entries:lM,setPrototypeOf:Rk,isFrozen:CWe,getPrototypeOf:AWe,getOwnPropertyDescriptor:xWe}=Object;let{freeze:la,seal:co,create:cM}=Object,{apply:Up,construct:jp}=typeof Reflect<"u"&&Reflect;la||(la=function(e){return e});co||(co=function(e){return e});Up||(Up=function(e,r,a){return e.apply(r,a)});jp||(jp=function(e,r){return new e(...r)});const G2=ca(Array.prototype.forEach),yWe=ca(Array.prototype.lastIndexOf),Nk=ca(Array.prototype.pop),a1=ca(Array.prototype.push),TWe=ca(Array.prototype.splice),du=ca(String.prototype.toLowerCase),O3=ca(String.prototype.toString),Dk=ca(String.prototype.match),o1=ca(String.prototype.replace),SWe=ca(String.prototype.indexOf),IWe=ca(String.prototype.trim),go=ca(Object.prototype.hasOwnProperty),Xr=ca(RegExp.prototype.test),i1=MWe(TypeError);function ca(t){return function(e){for(var r=arguments.length,a=new Array(r>1?r-1:0),o=1;o<r;o++)a[o-1]=arguments[o];return Up(t,e,a)}}function MWe(t){return function(){for(var e=arguments.length,r=new Array(e),a=0;a<e;a++)r[a]=arguments[a];return jp(t,r)}}function Xe(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:du;Rk&&Rk(t,null);let a=e.length;for(;a--;){let o=e[a];if(typeof o=="string"){const i=r(o);i!==o&&(CWe(e)||(e[a]=i),o=i)}t[o]=!0}return t}function OWe(t){for(let e=0;e<t.length;e++)go(t,e)||(t[e]=null);return t}function ns(t){const e=cM(null);for(const[r,a]of lM(t))go(t,r)&&(Array.isArray(a)?e[r]=OWe(a):a&&typeof a=="object"&&a.constructor===Object?e[r]=ns(a):e[r]=a);return e}function n1(t,e){for(;t!==null;){const a=xWe(t,e);if(a){if(a.get)return ca(a.get);if(typeof a.value=="function")return ca(a.value)}t=AWe(t)}function r(){return null}return r}const Vk=la(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),L3=la(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),R3=la(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),LWe=la(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),N3=la(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),RWe=la(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Bk=la(["#text"]),Pk=la(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),D3=la(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Fk=la(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),H2=la(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),NWe=co(/\{\{[\w\W]*|[\w\W]*\}\}/gm),DWe=co(/<%[\w\W]*|[\w\W]*%>/gm),VWe=co(/\$\{[\w\W]*/gm),BWe=co(/^data-[\-\w.\u00B7-\uFFFF]+$/),PWe=co(/^aria-[\-\w]+$/),uM=co(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),FWe=co(/^(?:\w+script|data):/i),UWe=co(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),dM=co(/^html$/i),jWe=co(/^[a-z][.\w]*(-[.\w]+)+$/i);var Uk=Object.freeze({__proto__:null,ARIA_ATTR:PWe,ATTR_WHITESPACE:UWe,CUSTOM_ELEMENT:jWe,DATA_ATTR:BWe,DOCTYPE_NAME:dM,ERB_EXPR:DWe,IS_ALLOWED_URI:uM,IS_SCRIPT_OR_DATA:FWe,MUSTACHE_EXPR:NWe,TMPLIT_EXPR:VWe});const s1={element:1,text:3,progressingInstruction:7,comment:8,document:9},zWe=function(){return typeof window>"u"?null:window},qWe=function(e,r){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let a=null;const o="data-tt-policy-suffix";r&&r.hasAttribute(o)&&(a=r.getAttribute(o));const i="dompurify"+(a?"#"+a:"");try{return e.createPolicy(i,{createHTML(n){return n},createScriptURL(n){return n}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},jk=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function gM(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:zWe();const e=Oe=>gM(Oe);if(e.version="3.2.4",e.removed=[],!t||!t.document||t.document.nodeType!==s1.document||!t.Element)return e.isSupported=!1,e;let{document:r}=t;const a=r,o=a.currentScript,{DocumentFragment:i,HTMLTemplateElement:n,Node:s,Element:l,NodeFilter:c,NamedNodeMap:u=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:d,DOMParser:g,trustedTypes:h}=t,m=l.prototype,f=n1(m,"cloneNode"),b=n1(m,"remove"),k=n1(m,"nextSibling"),C=n1(m,"childNodes"),w=n1(m,"parentNode");if(typeof n=="function"){const Oe=r.createElement("template");Oe.content&&Oe.content.ownerDocument&&(r=Oe.content.ownerDocument)}let v,A="";const{implementation:E,createNodeIterator:M,createDocumentFragment:P,getElementsByTagName:S}=r,{importNode:N}=a;let q=jk();e.isSupported=typeof lM=="function"&&typeof w=="function"&&E&&E.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:j,ERB_EXPR:J,TMPLIT_EXPR:_,DATA_ATTR:B,ARIA_ATTR:T,IS_SCRIPT_OR_DATA:L,ATTR_WHITESPACE:y,CUSTOM_ELEMENT:I}=Uk;let{IS_ALLOWED_URI:O}=Uk,U=null;const Y=Xe({},[...Vk,...L3,...R3,...N3,...Bk]);let le=null;const me=Xe({},[...Pk,...D3,...Fk,...H2]);let ue=Object.seal(cM(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),xe=null,ve=null,Le=!0,Ye=!0,Ge=!1,st=!0,at=!1,H=!0,V=!1,z=!1,Z=!1,D=!1,R=!1,G=!1,x=!0,F=!1;const X="user-content-";let se=!0,ee=!1,te={},Q=null;const re=Xe({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let ye=null;const Ae=Xe({},["audio","video","img","source","image","track"]);let Et=null;const Ot=Xe({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ft="http://www.w3.org/1998/Math/MathML",tr="http://www.w3.org/2000/svg",Mr="http://www.w3.org/1999/xhtml";let mi=Mr,vr=!1,ga=null;const Jc=Xe({},[Ft,tr,Mr],O3);let Qc=Xe({},["mi","mo","mn","ms","mtext"]),Xc=Xe({},["annotation-xml"]);const vO=Xe({},["title","style","font","a","script"]);let j0=null;const bO=["application/xhtml+xml","text/html"],EO="text/html";let dr=null,el=null;const kO=r.createElement("form"),fw=function($){return $ instanceof RegExp||$ instanceof Function},Yg=function(){let $=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(el&&el===$)){if((!$||typeof $!="object")&&($={}),$=ns($),j0=bO.indexOf($.PARSER_MEDIA_TYPE)===-1?EO:$.PARSER_MEDIA_TYPE,dr=j0==="application/xhtml+xml"?O3:du,U=go($,"ALLOWED_TAGS")?Xe({},$.ALLOWED_TAGS,dr):Y,le=go($,"ALLOWED_ATTR")?Xe({},$.ALLOWED_ATTR,dr):me,ga=go($,"ALLOWED_NAMESPACES")?Xe({},$.ALLOWED_NAMESPACES,O3):Jc,Et=go($,"ADD_URI_SAFE_ATTR")?Xe(ns(Ot),$.ADD_URI_SAFE_ATTR,dr):Ot,ye=go($,"ADD_DATA_URI_TAGS")?Xe(ns(Ae),$.ADD_DATA_URI_TAGS,dr):Ae,Q=go($,"FORBID_CONTENTS")?Xe({},$.FORBID_CONTENTS,dr):re,xe=go($,"FORBID_TAGS")?Xe({},$.FORBID_TAGS,dr):{},ve=go($,"FORBID_ATTR")?Xe({},$.FORBID_ATTR,dr):{},te=go($,"USE_PROFILES")?$.USE_PROFILES:!1,Le=$.ALLOW_ARIA_ATTR!==!1,Ye=$.ALLOW_DATA_ATTR!==!1,Ge=$.ALLOW_UNKNOWN_PROTOCOLS||!1,st=$.ALLOW_SELF_CLOSE_IN_ATTR!==!1,at=$.SAFE_FOR_TEMPLATES||!1,H=$.SAFE_FOR_XML!==!1,V=$.WHOLE_DOCUMENT||!1,D=$.RETURN_DOM||!1,R=$.RETURN_DOM_FRAGMENT||!1,G=$.RETURN_TRUSTED_TYPE||!1,Z=$.FORCE_BODY||!1,x=$.SANITIZE_DOM!==!1,F=$.SANITIZE_NAMED_PROPS||!1,se=$.KEEP_CONTENT!==!1,ee=$.IN_PLACE||!1,O=$.ALLOWED_URI_REGEXP||uM,mi=$.NAMESPACE||Mr,Qc=$.MATHML_TEXT_INTEGRATION_POINTS||Qc,Xc=$.HTML_INTEGRATION_POINTS||Xc,ue=$.CUSTOM_ELEMENT_HANDLING||{},$.CUSTOM_ELEMENT_HANDLING&&fw($.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ue.tagNameCheck=$.CUSTOM_ELEMENT_HANDLING.tagNameCheck),$.CUSTOM_ELEMENT_HANDLING&&fw($.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(ue.attributeNameCheck=$.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),$.CUSTOM_ELEMENT_HANDLING&&typeof $.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(ue.allowCustomizedBuiltInElements=$.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),at&&(Ye=!1),R&&(D=!0),te&&(U=Xe({},Bk),le=[],te.html===!0&&(Xe(U,Vk),Xe(le,Pk)),te.svg===!0&&(Xe(U,L3),Xe(le,D3),Xe(le,H2)),te.svgFilters===!0&&(Xe(U,R3),Xe(le,D3),Xe(le,H2)),te.mathMl===!0&&(Xe(U,N3),Xe(le,Fk),Xe(le,H2))),$.ADD_TAGS&&(U===Y&&(U=ns(U)),Xe(U,$.ADD_TAGS,dr)),$.ADD_ATTR&&(le===me&&(le=ns(le)),Xe(le,$.ADD_ATTR,dr)),$.ADD_URI_SAFE_ATTR&&Xe(Et,$.ADD_URI_SAFE_ATTR,dr),$.FORBID_CONTENTS&&(Q===re&&(Q=ns(Q)),Xe(Q,$.FORBID_CONTENTS,dr)),se&&(U["#text"]=!0),V&&Xe(U,["html","head","body"]),U.table&&(Xe(U,["tbody"]),delete xe.tbody),$.TRUSTED_TYPES_POLICY){if(typeof $.TRUSTED_TYPES_POLICY.createHTML!="function")throw i1('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof $.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw i1('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');v=$.TRUSTED_TYPES_POLICY,A=v.createHTML("")}else v===void 0&&(v=qWe(h,o)),v!==null&&typeof A=="string"&&(A=v.createHTML(""));la&&la($),el=$}},ww=Xe({},[...L3,...R3,...LWe]),vw=Xe({},[...N3,...RWe]),CO=function($){let fe=w($);(!fe||!fe.tagName)&&(fe={namespaceURI:mi,tagName:"template"});const Te=du($.tagName),Lt=du(fe.tagName);return ga[$.namespaceURI]?$.namespaceURI===tr?fe.namespaceURI===Mr?Te==="svg":fe.namespaceURI===Ft?Te==="svg"&&(Lt==="annotation-xml"||Qc[Lt]):!!ww[Te]:$.namespaceURI===Ft?fe.namespaceURI===Mr?Te==="math":fe.namespaceURI===tr?Te==="math"&&Xc[Lt]:!!vw[Te]:$.namespaceURI===Mr?fe.namespaceURI===tr&&!Xc[Lt]||fe.namespaceURI===Ft&&!Qc[Lt]?!1:!vw[Te]&&(vO[Te]||!ww[Te]):!!(j0==="application/xhtml+xml"&&ga[$.namespaceURI]):!1},No=function($){a1(e.removed,{element:$});try{w($).removeChild($)}catch{b($)}},Yc=function($,fe){try{a1(e.removed,{attribute:fe.getAttributeNode($),from:fe})}catch{a1(e.removed,{attribute:null,from:fe})}if(fe.removeAttribute($),$==="is")if(D||R)try{No(fe)}catch{}else try{fe.setAttribute($,"")}catch{}},bw=function($){let fe=null,Te=null;if(Z)$="<remove></remove>"+$;else{const br=Dk($,/^[\r\n\t ]+/);Te=br&&br[0]}j0==="application/xhtml+xml"&&mi===Mr&&($='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+$+"</body></html>");const Lt=v?v.createHTML($):$;if(mi===Mr)try{fe=new g().parseFromString(Lt,j0)}catch{}if(!fe||!fe.documentElement){fe=E.createDocument(mi,"template",null);try{fe.documentElement.innerHTML=vr?A:Lt}catch{}}const Or=fe.body||fe.documentElement;return $&&Te&&Or.insertBefore(r.createTextNode(Te),Or.childNodes[0]||null),mi===Mr?S.call(fe,V?"html":"body")[0]:V?fe.documentElement:Or},Ew=function($){return M.call($.ownerDocument||$,$,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},_g=function($){return $ instanceof d&&(typeof $.nodeName!="string"||typeof $.textContent!="string"||typeof $.removeChild!="function"||!($.attributes instanceof u)||typeof $.removeAttribute!="function"||typeof $.setAttribute!="function"||typeof $.namespaceURI!="string"||typeof $.insertBefore!="function"||typeof $.hasChildNodes!="function")},kw=function($){return typeof s=="function"&&$ instanceof s};function pi(Oe,$,fe){G2(Oe,Te=>{Te.call(e,$,fe,el)})}const Cw=function($){let fe=null;if(pi(q.beforeSanitizeElements,$,null),_g($))return No($),!0;const Te=dr($.nodeName);if(pi(q.uponSanitizeElement,$,{tagName:Te,allowedTags:U}),$.hasChildNodes()&&!kw($.firstElementChild)&&Xr(/<[/\w]/g,$.innerHTML)&&Xr(/<[/\w]/g,$.textContent)||$.nodeType===s1.progressingInstruction||H&&$.nodeType===s1.comment&&Xr(/<[/\w]/g,$.data))return No($),!0;if(!U[Te]||xe[Te]){if(!xe[Te]&&xw(Te)&&(ue.tagNameCheck instanceof RegExp&&Xr(ue.tagNameCheck,Te)||ue.tagNameCheck instanceof Function&&ue.tagNameCheck(Te)))return!1;if(se&&!Q[Te]){const Lt=w($)||$.parentNode,Or=C($)||$.childNodes;if(Or&&Lt){const br=Or.length;for(let ha=br-1;ha>=0;--ha){const Do=f(Or[ha],!0);Do.__removalCount=($.__removalCount||0)+1,Lt.insertBefore(Do,k($))}}}return No($),!0}return $ instanceof l&&!CO($)||(Te==="noscript"||Te==="noembed"||Te==="noframes")&&Xr(/<\/no(script|embed|frames)/i,$.innerHTML)?(No($),!0):(at&&$.nodeType===s1.text&&(fe=$.textContent,G2([j,J,_],Lt=>{fe=o1(fe,Lt," ")}),$.textContent!==fe&&(a1(e.removed,{element:$.cloneNode()}),$.textContent=fe)),pi(q.afterSanitizeElements,$,null),!1)},Aw=function($,fe,Te){if(x&&(fe==="id"||fe==="name")&&(Te in r||Te in kO))return!1;if(!(Ye&&!ve[fe]&&Xr(B,fe))){if(!(Le&&Xr(T,fe))){if(!le[fe]||ve[fe]){if(!(xw($)&&(ue.tagNameCheck instanceof RegExp&&Xr(ue.tagNameCheck,$)||ue.tagNameCheck instanceof Function&&ue.tagNameCheck($))&&(ue.attributeNameCheck instanceof RegExp&&Xr(ue.attributeNameCheck,fe)||ue.attributeNameCheck instanceof Function&&ue.attributeNameCheck(fe))||fe==="is"&&ue.allowCustomizedBuiltInElements&&(ue.tagNameCheck instanceof RegExp&&Xr(ue.tagNameCheck,Te)||ue.tagNameCheck instanceof Function&&ue.tagNameCheck(Te))))return!1}else if(!Et[fe]){if(!Xr(O,o1(Te,y,""))){if(!((fe==="src"||fe==="xlink:href"||fe==="href")&&$!=="script"&&SWe(Te,"data:")===0&&ye[$])){if(!(Ge&&!Xr(L,o1(Te,y,"")))){if(Te)return!1}}}}}}return!0},xw=function($){return $!=="annotation-xml"&&Dk($,I)},yw=function($){pi(q.beforeSanitizeAttributes,$,null);const{attributes:fe}=$;if(!fe||_g($))return;const Te={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:le,forceKeepAttr:void 0};let Lt=fe.length;for(;Lt--;){const Or=fe[Lt],{name:br,namespaceURI:ha,value:Do}=Or,z0=dr(br);let Qr=br==="value"?Do:IWe(Do);if(Te.attrName=z0,Te.attrValue=Qr,Te.keepAttr=!0,Te.forceKeepAttr=void 0,pi(q.uponSanitizeAttribute,$,Te),Qr=Te.attrValue,F&&(z0==="id"||z0==="name")&&(Yc(br,$),Qr=X+Qr),H&&Xr(/((--!?|])>)|<\/(style|title)/i,Qr)){Yc(br,$);continue}if(Te.forceKeepAttr||(Yc(br,$),!Te.keepAttr))continue;if(!st&&Xr(/\/>/i,Qr)){Yc(br,$);continue}at&&G2([j,J,_],Sw=>{Qr=o1(Qr,Sw," ")});const Tw=dr($.nodeName);if(Aw(Tw,z0,Qr)){if(v&&typeof h=="object"&&typeof h.getAttributeType=="function"&&!ha)switch(h.getAttributeType(Tw,z0)){case"TrustedHTML":{Qr=v.createHTML(Qr);break}case"TrustedScriptURL":{Qr=v.createScriptURL(Qr);break}}try{ha?$.setAttributeNS(ha,br,Qr):$.setAttribute(br,Qr),_g($)?No($):Nk(e.removed)}catch{}}}pi(q.afterSanitizeAttributes,$,null)},AO=function Oe($){let fe=null;const Te=Ew($);for(pi(q.beforeSanitizeShadowDOM,$,null);fe=Te.nextNode();)pi(q.uponSanitizeShadowNode,fe,null),Cw(fe),yw(fe),fe.content instanceof i&&Oe(fe.content);pi(q.afterSanitizeShadowDOM,$,null)};return e.sanitize=function(Oe){let $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},fe=null,Te=null,Lt=null,Or=null;if(vr=!Oe,vr&&(Oe="<!-->"),typeof Oe!="string"&&!kw(Oe))if(typeof Oe.toString=="function"){if(Oe=Oe.toString(),typeof Oe!="string")throw i1("dirty is not a string, aborting")}else throw i1("toString is not a function");if(!e.isSupported)return Oe;if(z||Yg($),e.removed=[],typeof Oe=="string"&&(ee=!1),ee){if(Oe.nodeName){const Do=dr(Oe.nodeName);if(!U[Do]||xe[Do])throw i1("root node is forbidden and cannot be sanitized in-place")}}else if(Oe instanceof s)fe=bw("<!---->"),Te=fe.ownerDocument.importNode(Oe,!0),Te.nodeType===s1.element&&Te.nodeName==="BODY"||Te.nodeName==="HTML"?fe=Te:fe.appendChild(Te);else{if(!D&&!at&&!V&&Oe.indexOf("<")===-1)return v&&G?v.createHTML(Oe):Oe;if(fe=bw(Oe),!fe)return D?null:G?A:""}fe&&Z&&No(fe.firstChild);const br=Ew(ee?Oe:fe);for(;Lt=br.nextNode();)Cw(Lt),yw(Lt),Lt.content instanceof i&&AO(Lt.content);if(ee)return Oe;if(D){if(R)for(Or=P.call(fe.ownerDocument);fe.firstChild;)Or.appendChild(fe.firstChild);else Or=fe;return(le.shadowroot||le.shadowrootmode)&&(Or=N.call(a,Or,!0)),Or}let ha=V?fe.outerHTML:fe.innerHTML;return V&&U["!doctype"]&&fe.ownerDocument&&fe.ownerDocument.doctype&&fe.ownerDocument.doctype.name&&Xr(dM,fe.ownerDocument.doctype.name)&&(ha="<!DOCTYPE "+fe.ownerDocument.doctype.name+`>
|
|
186
|
+
to continue receiving and sending messages`,HELP_CENTER:{TITLE:"Help Center",ARTICLES:"Articles",CATEGORIES:"Categories",LOCALES:"Locales",SETTINGS:"Settings"},CHANNELS:"Channels",SET_AUTO_OFFLINE:{TEXT:"Mark offline automatically",INFO_TEXT:"Let the system automatically mark you offline when you aren't using the app or dashboard.",INFO_SHORT:"Automatically mark offline when you aren't using the app."},DOCS:"Read docs"},VFe={TITLE:"Billing",DESCRIPTION:"Manage your subscription here, upgrade your plan and get more for your team.",CURRENT_PLAN:{TITLE:"Current Plan",PLAN_NOTE:"You are currently subscribed to the **{plan}** plan with **{quantity}** licenses",SEAT_COUNT:"Number of seats",RENEWS_ON:"Renews on"},VIEW_PRICING:"View Pricing",MANAGE_SUBSCRIPTION:{TITLE:"Manage your subscription",DESCRIPTION:"View your previous invoices, edit your billing details, or cancel your subscription.",BUTTON_TXT:"Go to the billing portal"},CAPTAIN:{TITLE:"Captain",DESCRIPTION:"Manage usage and credits for Captain AI.",BUTTON_TXT:"Buy more credits",DOCUMENTS:"Documents",RESPONSES:"Responses",UPGRADE:"Captain is not available on the free plan, upgrade now to get access to assistants, copilot and more."},CHAT_WITH_US:{TITLE:"Need help?",DESCRIPTION:"Do you face any issues in billing? We are here to help.",BUTTON_TXT:"Chat with us"},NO_BILLING_USER:"Your billing account is being configured. Please refresh the page and try again."},BFe={NO_ACCOUNT_WARNING:"Uh oh! We could not find any Chatwoot accounts. Please create a new account to continue.",NEW_ACCOUNT:"New Account",SELECTOR_SUBTITLE:"Create a new account",API:{SUCCESS_MESSAGE:"Account created successfully",EXIST_MESSAGE:"Account already exists",ERROR_MESSAGE:"Could not connect to Woot Server, Please try again later"},FORM:{NAME:{LABEL:"Company Name",PLACEHOLDER:"Wayne Enterprises"},SUBMIT:"Submit",CANCEL:"Cancel"}},PFe={TOGGLE_MODAL:"View all shortcuts",TITLE:{OPEN_CONVERSATION:"Open conversation",RESOLVE_AND_NEXT:"Resolve and move to next",NAVIGATE_DROPDOWN:"Navigate dropdown items",RESOLVE_CONVERSATION:"Resolve Conversation",GO_TO_CONVERSATION_DASHBOARD:"Go to Conversation Dashboard",ADD_ATTACHMENT:"Add Attachment",GO_TO_CONTACTS_DASHBOARD:"Go to Contacts Dashboard",TOGGLE_SIDEBAR:"Toggle Sidebar",GO_TO_REPORTS_SIDEBAR:"Go to Reports sidebar",MOVE_TO_NEXT_TAB:"Move to next tab in conversation list",GO_TO_SETTINGS:"Go to Settings",SWITCH_TO_PRIVATE_NOTE:"Switch to Private Note",SWITCH_TO_REPLY:"Switch to Reply",TOGGLE_SNOOZE_DROPDOWN:"Toggle snooze dropdown"}},FFe={PROFILE_SETTINGS:IFe,SIDEBAR_ITEMS:MFe,APP_GLOBAL:OFe,COMPONENTS:LFe,CONFIRM_EMAIL:RFe,SETTINGS:NFe,SIDEBAR:DFe,BILLING_SETTINGS:VFe,CREATE_ACCOUNT:BFe,KEYBOARD_SHORTCUTS:PFe},UFe={TRY_WOOT:"Create an account",TITLE:"Register",TESTIMONIAL_HEADER:"All it takes is one step to move forward",TESTIMONIAL_CONTENT:"You're one step away from engaging your customers, retaining them and finding new ones.",TERMS_ACCEPT:'By creating an account, you agree to our <a href="https://www.chatwoot.com/terms">T & C</a> and <a href="https://www.chatwoot.com/privacy-policy">Privacy policy</a>',OAUTH:{GOOGLE_SIGNUP:"Sign up with Google"},COMPANY_NAME:{LABEL:"Company name",PLACEHOLDER:"Enter your company name. E.g., Wayne Enterprises",ERROR:"Company name is too short."},FULL_NAME:{LABEL:"Full name",PLACEHOLDER:"Enter your full name. E.g., Bruce Wayne",ERROR:"Full name is too short."},EMAIL:{LABEL:"Work email",PLACEHOLDER:"Enter your work email address. E.g., bruce{'@'}wayne{'.'}enterprises",ERROR:"Please enter a valid work email address."},PASSWORD:{LABEL:"Password",PLACEHOLDER:"Password",ERROR:"Password is too short.",IS_INVALID_PASSWORD:"Password should contain atleast 1 uppercase letter, 1 lowercase letter, 1 number and 1 special character."},CONFIRM_PASSWORD:{LABEL:"Confirm password",PLACEHOLDER:"Confirm password",ERROR:"Password doesnot match."},API:{SUCCESS_MESSAGE:"Registration Successfull",ERROR_MESSAGE:"Could not connect to Woot server. Please try again."},SUBMIT:"Create account",HAVE_AN_ACCOUNT:"Already have an account?"},jFe={REGISTER:UFe},zFe={HEADER:"Service Level Agreements",ADD_ACTION:"Add SLA",ADD_ACTION_LONG:"Create a new SLA Policy",DESCRIPTION:"Service Level Agreements (SLAs) are contracts that define clear expectations between your team and customers. They establish standards for response and resolution times, creating a framework for accountability and ensures a consistent, high-quality experience.",LEARN_MORE:"Learn more about SLA",LOADING:"Fetching SLAs",PAYWALL:{TITLE:"Upgrade to create SLAs",AVAILABLE_ON:"The SLA feature is only available in the Business and Enterprise plans.",UPGRADE_PROMPT:"Upgrade your plan to get access to advanced features like team management, automations, custom attributes, and more.",UPGRADE_NOW:"Upgrade now",CANCEL_ANYTIME:"You can change or cancel your plan anytime"},ENTERPRISE_PAYWALL:{AVAILABLE_ON:"The SLA feature is only available in the paid plans.",UPGRADE_PROMPT:"Upgrade to a paid plan to access advanced features like audit logs, agent capacity, and more.",ASK_ADMIN:"Please reach out to your administrator for the upgrade."},LIST:{404:"There are no SLAs available in this account.",EMPTY:{TITLE_1:"Enterprise P0",DESC_1:"Issues raised by enterprise customers, that require immediate attention.",TITLE_2:"Enterprise P1",DESC_2:"Issues raised by enterprise customers, that needs to be acknowledged quickly."},BUSINESS_HOURS_ON:"Business hours on",BUSINESS_HOURS_OFF:"Business hours off",RESPONSE_TYPES:{FRT:"First response time threshold",NRT:"Next response time threshold",RT:"Resolution time threshold",SHORT_HAND:{FRT:"FRT",NRT:"NRT",RT:"RT"}}},FORM:{NAME:{LABEL:"SLA Name",PLACEHOLDER:"SLA Name",REQUIRED_ERROR:"SLA name is required",MINIMUM_LENGTH_ERROR:"Minimum length 2 is required",VALID_ERROR:"Only Alphabets, Numbers, Hyphen and Underscore are allowed"},DESCRIPTION:{LABEL:"Description",PLACEHOLDER:"SLA for premium customers"},FIRST_RESPONSE_TIME:{LABEL:"First Response Time",PLACEHOLDER:"5"},NEXT_RESPONSE_TIME:{LABEL:"Next Response Time",PLACEHOLDER:"5"},RESOLUTION_TIME:{LABEL:"Resolution Time",PLACEHOLDER:"60"},BUSINESS_HOURS:{LABEL:"Business Hours",PLACEHOLDER:"Only during business hours"},THRESHOLD_TIME:{INVALID_FORMAT_ERROR:"Threshold should be a number and greater than zero"},EDIT:"Edit",CREATE:"Create",DELETE:"Delete",CANCEL:"Cancel"},ADD:{TITLE:"Add SLA",DESC:"Friendly promises for great service!",API:{SUCCESS_MESSAGE:"SLA added successfully",ERROR_MESSAGE:"There was an error, please try again"}},DELETE:{TITLE:"Delete SLA",API:{SUCCESS_MESSAGE:"SLA deleted successfully",ERROR_MESSAGE:"There was an error, please try again"},CONFIRM:{TITLE:"Confirm Deletion",MESSAGE:"Are you sure you want to delete ",YES:"Yes, Delete ",NO:"No, Keep "}},EVENTS:{TITLE:"SLA Misses",FRT:"First response time",NRT:"Next response time",RT:"Resolution time",SHOW_MORE:"{count} more",HIDE:"Hide {count} rows"}},qFe={SLA:zFe},GFe={NEW_TEAM:"Create new team",HEADER:"Teams",LOADING:"Fetching teams",DESCRIPTION:"Teams allow you to organize agents into groups based on their responsibilities. An agent can belong to multiple teams. When working collaboratively, you can assign conversations to specific teams.",LEARN_MORE:"Learn more about teams",LIST:{404:"There are no teams created on this account.",EDIT_TEAM:"Edit team",NONE:"None"},CREATE_FLOW:{CREATE:{TITLE:"Create a new team",DESC:"Add a title and description to your new team."},AGENTS:{BUTTON_TEXT:"Add agents to team",TITLE:"Add agents to team - {teamName}",DESC:"Add Agents to your newly created team. This lets you collaborate as a team on conversations, get notified on new events in the same conversation."},WIZARD_CREATE:{TITLE:"Create",BODY:"Create a new team of agents."},WIZARD_ADD_AGENTS:{TITLE:"Add Agents",BODY:"Add agents to the team."},WIZARD_FINISH:{TITLE:"Finish",BODY:"You are all set to go!"}},EDIT_FLOW:{CREATE:{TITLE:"Edit your team details",DESC:"Edit title and description to your team.",BUTTON_TEXT:"Update team"},AGENTS:{BUTTON_TEXT:"Update agents in team",TITLE:"Add agents to team - {teamName}",DESC:"Add Agents to your newly created team. All the added agents will be notified when a conversation is assigned to this team."},EDIT_WIZARD_DETAILS:{TITLE:"Team details",ROUTE:"settings_teams_edit",BODY:"Change name, description and other details."},EDIT_WIZARD_AGENTS:{TITLE:"Edit Agents",ROUTE:"settings_teams_edit_members",BODY:"Edit agents in your team."},EDIT_WIZARD_FINISH:{TITLE:"Finish",ROUTE:"settings_teams_edit_finish",BODY:"You are all set to go!"}},TEAM_FORM:{ERROR_MESSAGE:"Couldn't save the team details. Try again."},AGENTS:{AGENT:"AGENT",EMAIL:"EMAIL",BUTTON_TEXT:"Add agents",ADD_AGENTS:"Adding Agents to your Team...",SELECT:"select",SELECT_ALL:"select all agents",SELECTED_COUNT:"{selected} out of {total} agents selected."},ADD:{TITLE:"Add agents to team - {teamName}",DESC:"Add Agents to your newly created team. This lets you collaborate as a team on conversations, get notified on new events in the same conversation.",SELECT:"select",SELECT_ALL:"select all agents",SELECTED_COUNT:"{selected} out of {total} agents selected.",BUTTON_TEXT:"Add agents",AGENT_VALIDATION_ERROR:"Select at least one agent."},FINISH:{TITLE:"Your team is ready!",MESSAGE:"You can now collaborate as a team on conversations. Happy supporting ",BUTTON_TEXT:"Finish"},DELETE:{BUTTON_TEXT:"Delete",API:{SUCCESS_MESSAGE:"Team deleted successfully.",ERROR_MESSAGE:"Couldn't delete the team. Try again."},CONFIRM:{TITLE:"Are you sure you want to delete the team?",PLACE_HOLDER:"Please type {teamName} to confirm",MESSAGE:"Deleting the team will remove the team assignment from the conversations assigned to this team.",YES:"Delete ",NO:"Cancel"}},SETTINGS:"Settings",FORM:{UPDATE:"Update team",CREATE:"Create team",NAME:{LABEL:"Team name",PLACEHOLDER:"Example: Sales, Customer Support"},DESCRIPTION:{LABEL:"Team Description",PLACEHOLDER:"Short description about this team."},AUTO_ASSIGN:{LABEL:"Allow auto assign for this team."},SUBMIT_CREATE:"Create team"}},HFe={TEAMS_SETTINGS:GFe},KFe={MODAL:{TITLE:"Whatsapp Templates",SUBTITLE:"Select the whatsapp template you want to send",TEMPLATE_SELECTED_SUBTITLE:"Process {templateName}"},PICKER:{SEARCH_PLACEHOLDER:"Search Templates",NO_TEMPLATES_FOUND:"No templates found for",LABELS:{LANGUAGE:"Language",TEMPLATE_BODY:"Template Body",CATEGORY:"Category"}},PARSER:{VARIABLES_LABEL:"Variables",VARIABLE_PLACEHOLDER:"Enter {variable} value",GO_BACK_LABEL:"Go Back",SEND_MESSAGE_LABEL:"Send Message",FORM_ERROR_MESSAGE:"Please fill all variables before sending"}},WFe={WHATSAPP_TEMPLATES:KFe},ZFe={...SBe,...MBe,...LBe,...NBe,...VBe,...PBe,...UBe,...zBe,...GBe,...KBe,...aPe,...mPe,...fPe,...IPe,...OPe,...RPe,...DPe,...BPe,...FPe,...WPe,...JPe,...XPe,..._Pe,...eFe,...aFe,...iFe,...sFe,...cFe,...kFe,...AFe,...yFe,...SFe,...FFe,...jFe,...qFe,...HFe,...WFe},ur=(t,e)=>{t.records=e},Ma=(t,e)=>{t.records.push(e)},Kc=(t,e)=>{const r=t.records.findIndex(a=>a.id===e.id);r>-1?t.records[r]=e:Ma(t,e)},ua=(t,e)=>{t.records.forEach((r,a)=>{r.id===e.id&&(t.records[a]=e)})},yp=(t,e)=>{t.records.forEach((r,a)=>{r.id===e.id&&(t.records[a]={...t.records[a],...e})})},JFe=(t,e)=>{t.records.forEach((r,a)=>{const o=e[r.id];t.records[a].availability_status=o||"offline"})},QFe=(t,{id:e,availabilityStatus:r})=>{const[a]=t.filter(o=>o.id===Number(e));a&&(a.availability_status=r)},da=(t,e)=>{t.records=t.records.filter(r=>r.id!==e)},p={AUTHENTICATE:"AUTHENTICATE",CLEAR_USER:"LOGOUT",SET_CURRENT_USER:"SET_CURRENT_USER",SET_CURRENT_USER_AVAILABILITY:"SET_CURRENT_USER_AVAILABILITY",SET_CURRENT_USER_AUTO_OFFLINE:"SET_CURRENT_USER_AUTO_OFFLINE",SET_CURRENT_USER_UI_SETTINGS:"SET_CURRENT_USER_UI_SETTINGS",SET_CURRENT_USER_UI_FLAGS:"SET_CURRENT_USER_UI_FLAGS",RECEIVE_CHAT_LIST:"RECEIVE_CHAT_LIST",SET_ALL_CONVERSATION:"SET_ALL_CONVERSATION",EMPTY_ALL_CONVERSATION:"EMPTY_ALL_CONVERSATION",SET_CONV_TAB_META:"SET_CONV_TAB_META",CLEAR_LIST_LOADING_STATUS:"CLEAR_LIST_LOADING_STATUS",SET_LIST_LOADING_STATUS:"SET_LIST_LOADING_STATUS",SET_ALL_MESSAGES_LOADED:"SET_ALL_MESSAGES_LOADED",CLEAR_ALL_MESSAGES_LOADED:"CLEAR_ALL_MESSAGES_LOADED",CHANGE_CHAT_STATUS_FILTER:"CHANGE_CHAT_STATUS_FILTER",CHANGE_CHAT_SORT_FILTER:"CHANGE_CHAT_SORT_FILTER",UPDATE_ASSIGNEE:"UPDATE_ASSIGNEE",UPDATE_CONVERSATION_CONTACT:"UPDATE_CONVERSATION_CONTACT",CLEAR_CONTACT_CONVERSATIONS:"CLEAR_CONTACT_CONVERSATIONS",SET_CONVERSATION_FILTERS:"SET_CONVERSATION_FILTERS",CLEAR_CONVERSATION_FILTERS:"CLEAR_CONVERSATION_FILTERS",SET_CONVERSATION_LAST_SEEN:"SET_CONVERSATION_LAST_SEEN",SET_LAST_MESSAGE_ID_IN_SYNC_CONVERSATION:"SET_LAST_MESSAGE_ID_FOR_SYNC_CONVERSATION",SET_DRAFT_MESSAGES:"SET_DRAFT_MESSAGES",REMOVE_DRAFT_MESSAGES:"REMOVE_DRAFT_MESSAGES",SET_REPLY_EDITOR_MODE:"SET_REPLY_EDITOR_MODE",SET_CURRENT_CHAT_WINDOW:"SET_CURRENT_CHAT_WINDOW",CLEAR_CURRENT_CHAT_WINDOW:"CLEAR_CURRENT_CHAT_WINDOW",CLEAR_ALL_MESSAGES:"CLEAR_ALL_MESSAGES",CHANGE_CONVERSATION_STATUS:"CHANGE_CONVERSATION_STATUS",ADD_CONVERSATION:"ADD_CONVERSATION",UPDATE_CONVERSATION:"UPDATE_CONVERSATION",MUTE_CONVERSATION:"MUTE_CONVERSATION",UNMUTE_CONVERSATION:"UNMUTE_CONVERSATION",ASSIGN_AGENT:"ASSIGN_AGENT",ASSIGN_TEAM:"ASSIGN_TEAM",ASSIGN_PRIORITY:"ASSIGN_PRIORITY",SET_CHAT_META:"SET_CHAT_META",ADD_MESSAGE:"ADD_MESSAGE",DELETE_MESSAGE:"DELETE_MESSAGE",ADD_PENDING_MESSAGE:"ADD_PENDING_MESSAGE",UPDATE_MESSAGE_UNREAD_COUNT:"UPDATE_MESSAGE_UNREAD_COUNT",SET_PREVIOUS_CONVERSATIONS:"SET_PREVIOUS_CONVERSATIONS",SET_ACTIVE_INBOX:"SET_ACTIVE_INBOX",UPDATE_CONVERSATION_CUSTOM_ATTRIBUTES:"UPDATE_CONVERSATION_CUSTOM_ATTRIBUTES",UPDATE_CONVERSATION_LAST_ACTIVITY:"UPDATE_CONVERSATION_LAST_ACTIVITY",SET_MISSING_MESSAGES:"SET_MISSING_MESSAGES",SET_ALL_ATTACHMENTS:"SET_ALL_ATTACHMENTS",ADD_CONVERSATION_ATTACHMENTS:"ADD_CONVERSATION_ATTACHMENTS",DELETE_CONVERSATION_ATTACHMENTS:"DELETE_CONVERSATION_ATTACHMENTS",DELETE_CONVERSATION:"DELETE_CONVERSATION",SET_CONVERSATION_CAN_REPLY:"SET_CONVERSATION_CAN_REPLY",SET_CONTEXT_MENU_CHAT_ID:"SET_CONTEXT_MENU_CHAT_ID",SET_CHAT_LIST_FILTERS:"SET_CHAT_LIST_FILTERS",UPDATE_CHAT_LIST_FILTERS:"UPDATE_CHAT_LIST_FILTERS",SET_INBOX_CAPTAIN_ASSISTANT:"SET_INBOX_CAPTAIN_ASSISTANT",SET_INBOXES_UI_FLAG:"SET_INBOXES_UI_FLAG",SET_INBOXES:"SET_INBOXES",SET_INBOX_ITEM:"SET_INBOX_ITEM",ADD_INBOXES:"ADD_INBOXES",EDIT_INBOXES:"EDIT_INBOXES",DELETE_INBOXES:"DELETE_INBOXES",SET_ACCOUNT_UI_FLAG:"SET_ACCOUNT_UI_FLAG",SET_ACCOUNT_LIMITS:"SET_ACCOUNT_LIMITS",SET_ACCOUNTS:"SET_ACCOUNTS",ADD_ACCOUNT:"ADD_ACCOUNT",EDIT_ACCOUNT:"EDIT_ACCOUNT",DELETE_ACCOUNT:"DELETE_AGENT",SET_AGENT_FETCHING_STATUS:"SET_AGENT_FETCHING_STATUS",SET_AGENT_CREATING_STATUS:"SET_AGENT_CREATING_STATUS",SET_AGENT_UPDATING_STATUS:"SET_AGENT_UPDATING_STATUS",SET_AGENT_DELETING_STATUS:"SET_AGENT_DELETING_STATUS",SET_AGENTS:"SET_AGENTS",ADD_AGENT:"ADD_AGENT",EDIT_AGENT:"EDIT_AGENT",DELETE_AGENT:"DELETE_AGENT",UPDATE_AGENTS_PRESENCE:"UPDATE_AGENTS_PRESENCE",UPDATE_SINGLE_AGENT_PRESENCE:"UPDATE_SINGLE_AGENT_PRESENCE",SET_CANNED_UI_FLAG:"SET_CANNED_UI_FLAG",SET_CANNED:"SET_CANNED",ADD_CANNED:"ADD_CANNED",EDIT_CANNED:"EDIT_CANNED",DELETE_CANNED:"DELETE_CANNED",SET_CUSTOM_ROLE_UI_FLAG:"SET_CUSTOM_ROLE_UI_FLAG",SET_CUSTOM_ROLE:"SET_CUSTOM_ROLE",ADD_CUSTOM_ROLE:"ADD_CUSTOM_ROLE",EDIT_CUSTOM_ROLE:"EDIT_CUSTOM_ROLE",DELETE_CUSTOM_ROLE:"DELETE_CUSTOM_ROLE",SET_LABEL_UI_FLAG:"SET_LABEL_UI_FLAG",SET_LABELS:"SET_LABELS",ADD_LABEL:"ADD_LABEL",EDIT_LABEL:"EDIT_LABEL",DELETE_LABEL:"DELETE_LABEL",SET_INTEGRATIONS_UI_FLAG:"SET_INTEGRATIONS_UI_FLAG",SET_INTEGRATIONS:"SET_INTEGRATIONS",ADD_INTEGRATION:"ADD_INTEGRATION",DELETE_INTEGRATION:"DELETE_INTEGRATION",ADD_INTEGRATION_HOOKS:"ADD_INTEGRATION_HOOKS",DELETE_INTEGRATION_HOOKS:"DELETE_INTEGRATION_HOOKS",SET_WEBHOOK_UI_FLAG:"SET_WEBHOOK_UI_FLAG",SET_WEBHOOK:"SET_WEBHOOK",ADD_WEBHOOK:"ADD_WEBHOOK",DELETE_WEBHOOK:"DELETE_WEBHOOK",UPDATE_WEBHOOK:"UPDATE_WEBHOOK",SET_CONTACT_META:"SET_CONTACT_META",SET_CONTACT_UI_FLAG:"SET_CONTACT_UI_FLAG",SET_CONTACT_ITEM:"SET_CONTACT_ITEM",SET_CONTACTS:"SET_CONTACTS",CLEAR_CONTACTS:"CLEAR_CONTACTS",EDIT_CONTACT:"EDIT_CONTACT",DELETE_CONTACT:"DELETE_CONTACT",UPDATE_CONTACTS_PRESENCE:"UPDATE_CONTACTS_PRESENCE",SET_CONTACT_FILTERS:"SET_CONTACT_FILTERS",CLEAR_CONTACT_FILTERS:"CLEAR_CONTACT_FILTERS",SET_NOTIFICATIONS_META:"SET_NOTIFICATIONS_META",SET_NOTIFICATIONS_UNREAD_COUNT:"SET_NOTIFICATIONS_UNREAD_COUNT",SET_NOTIFICATIONS_UI_FLAG:"SET_NOTIFICATIONS_UI_FLAG",UPDATE_NOTIFICATION:"UPDATE_NOTIFICATION",READ_NOTIFICATION:"READ_NOTIFICATION",ADD_NOTIFICATION:"ADD_NOTIFICATION",DELETE_NOTIFICATION:"DELETE_NOTIFICATION",UPDATE_ALL_NOTIFICATIONS:"UPDATE_ALL_NOTIFICATIONS",SET_NOTIFICATIONS_ITEM:"SET_NOTIFICATIONS_ITEM",SET_NOTIFICATIONS:"SET_NOTIFICATIONS",CLEAR_NOTIFICATIONS:"CLEAR_NOTIFICATIONS",EDIT_NOTIFICATIONS:"EDIT_NOTIFICATIONS",UPDATE_NOTIFICATIONS_PRESENCE:"UPDATE_NOTIFICATIONS_PRESENCE",SET_ALL_NOTIFICATIONS_LOADED:"SET_ALL_NOTIFICATIONS_LOADED",DELETE_READ_NOTIFICATIONS:"DELETE_READ_NOTIFICATIONS",DELETE_ALL_NOTIFICATIONS:"DELETE_ALL_NOTIFICATIONS",SNOOZE_NOTIFICATION:"SNOOZE_NOTIFICATION",SET_NOTIFICATION_FILTERS:"SET_NOTIFICATION_FILTERS",UPDATE_NOTIFICATION_FILTERS:"UPDATE_NOTIFICATION_FILTERS",SET_CONTACT_CONVERSATIONS_UI_FLAG:"SET_CONTACT_CONVERSATIONS_UI_FLAG",SET_CONTACT_CONVERSATIONS:"SET_CONTACT_CONVERSATIONS",ADD_CONTACT_CONVERSATION:"ADD_CONTACT_CONVERSATION",DELETE_CONTACT_CONVERSATION:"DELETE_CONTACT_CONVERSATION",SET_CONTACT_LABELS_UI_FLAG:"SET_CONTACT_LABELS_UI_FLAG",SET_CONTACT_LABELS:"SET_CONTACT_LABELS",SET_CONVERSATION_LABELS_UI_FLAG:"SET_CONVERSATION_LABELS_UI_FLAG",SET_CONVERSATION_LABELS:"SET_CONVERSATION_LABELS",SET_BULK_CONVERSATION_LABELS:"SET_BULK_CONVERSATION_LABELS",SET_SELECTED_CONVERSATION_IDS:"SET_SELECTED_CONVERSATION_IDS",CLEAR_SELECTED_CONVERSATION_IDS:"CLEAR_SELECTED_CONVERSATION_IDS",REMOVE_SELECTED_CONVERSATION_IDS:"REMOVE_SELECTED_CONVERSATION_IDS",SET_ACCOUNT_REPORTS:"SET_ACCOUNT_REPORTS",SET_HEATMAP_DATA:"SET_HEATMAP_DATA",TOGGLE_HEATMAP_LOADING:"TOGGLE_HEATMAP_LOADING",SET_ACCOUNT_SUMMARY:"SET_ACCOUNT_SUMMARY",SET_BOT_SUMMARY:"SET_BOT_SUMMARY",TOGGLE_ACCOUNT_REPORT_LOADING:"TOGGLE_ACCOUNT_REPORT_LOADING",SET_BOT_SUMMARY_STATUS:"SET_BOT_SUMMARY_STATUS",SET_ACCOUNT_SUMMARY_STATUS:"SET_ACCOUNT_SUMMARY_STATUS",SET_ACCOUNT_CONVERSATION_METRIC:"SET_ACCOUNT_CONVERSATION_METRIC",TOGGLE_ACCOUNT_CONVERSATION_METRIC_LOADING:"TOGGLE_ACCOUNT_CONVERSATION_METRIC_LOADING",SET_AGENT_CONVERSATION_METRIC:"SET_AGENT_CONVERSATION_METRIC",TOGGLE_AGENT_CONVERSATION_METRIC_LOADING:"TOGGLE_AGENT_CONVERSATION_METRIC_LOADING",SET_CONVERSATION_METADATA:"SET_CONVERSATION_METADATA",SET_CURRENT_PAGE:"SET_CURRENT_PAGE",SET_CONVERSATION_END_REACHED:"SET_CONVERSATION_END_REACHED",CLEAR_CONVERSATION_PAGE:"CLEAR_CONVERSATION_PAGE",SET_USER_NOTIFICATION_UI_FLAG:"SET_USER_NOTIFICATION_UI_FLAG",SET_USER_NOTIFICATION:"SET_USER_NOTIFICATION",ADD_USER_TYPING_TO_CONVERSATION:"ADD_USER_TYPING_TO_CONVERSATION",REMOVE_USER_TYPING_FROM_CONVERSATION:"REMOVE_USER_TYPING_FROM_CONVERSATION",SEARCH_CONVERSATIONS_SET:"SEARCH_CONVERSATIONS_SET",SEARCH_CONVERSATIONS_SET_UI_FLAG:"SEARCH_CONVERSATIONS_SET_UI_FLAG",SET_CAMPAIGN_UI_FLAG:"SET_CAMPAIGN_UI_FLAG",SET_CAMPAIGNS:"SET_CAMPAIGNS",ADD_CAMPAIGN:"ADD_CAMPAIGN",EDIT_CAMPAIGN:"EDIT_CAMPAIGN",DELETE_CAMPAIGN:"DELETE_CAMPAIGN",SET_CONTACT_NOTES_UI_FLAG:"SET_CONTACT_NOTES_UI_FLAG",SET_CONTACT_NOTES:"SET_CONTACT_NOTES",ADD_CONTACT_NOTE:"ADD_CONTACT_NOTE",EDIT_CONTACT_NOTE:"EDIT_CONTACT_NOTE",DELETE_CONTACT_NOTE:"DELETE_CONTACT_NOTE",SET_CSAT_RESPONSE_UI_FLAG:"SET_CSAT_RESPONSE_UI_FLAG",SET_CSAT_RESPONSE:"SET_CSAT_RESPONSE",SET_CSAT_RESPONSE_METRICS:"SET_CSAT_RESPONSE_METRICS",SET_CUSTOM_ATTRIBUTE_UI_FLAG:"SET_CUSTOM_ATTRIBUTE_UI_FLAG",SET_CUSTOM_ATTRIBUTE:"SET_CUSTOM_ATTRIBUTE",ADD_CUSTOM_ATTRIBUTE:"ADD_CUSTOM_ATTRIBUTE",EDIT_CUSTOM_ATTRIBUTE:"EDIT_CUSTOM_ATTRIBUTE",DELETE_CUSTOM_ATTRIBUTE:"DELETE_CUSTOM_ATTRIBUTE",SET_AUTOMATION_UI_FLAG:"SET_AUTOMATION_UI_FLAG",SET_AUTOMATIONS:"SET_AUTOMATIONS",ADD_AUTOMATION:"ADD_AUTOMATION",EDIT_AUTOMATION:"EDIT_AUTOMATION",DELETE_AUTOMATION:"DELETE_AUTOMATION",SET_CUSTOM_VIEW_UI_FLAG:"SET_CUSTOM_VIEW_UI_FLAG",SET_CUSTOM_VIEW:"SET_CUSTOM_VIEW",ADD_CUSTOM_VIEW:"ADD_CUSTOM_VIEW",UPDATE_CUSTOM_VIEW:"UPDATE_CUSTOM_VIEW",DELETE_CUSTOM_VIEW:"DELETE_CUSTOM_VIEW",SET_ACTIVE_CONVERSATION_FOLDER:"SET_ACTIVE_CONVERSATION_FOLDER",SET_BULK_ACTIONS_FLAG:"SET_BULK_ACTIONS_FLAG",SET_DASHBOARD_APPS_UI_FLAG:"SET_DASHBOARD_APPS_UI_FLAG",SET_DASHBOARD_APPS:"SET_DASHBOARD_APPS",CREATE_DASHBOARD_APP:"CREATE_DASHBOARD_APP",EDIT_DASHBOARD_APP:"EDIT_DASHBOARD_APP",DELETE_DASHBOARD_APP:"DELETE_DASHBOARD_APP",ADD_ARTICLE:"ADD_ARTICLE",ADD_ARTICLE_ID:"ADD_ARTICLE_ID",ADD_MANY_ARTICLES:"ADD_MANY_ARTICLES",ADD_MANY_ARTICLES_ID:"ADD_MANY_ARTICLES_ID",SET_ARTICLES_META:"SET_ARTICLES_META",UPDATE_ARTICLE_FLAG:"UPDATE_ARTICLE_FLAG",ADD_ARTICLE_FLAG:"ADD_ARTICLE_FLAG",UPDATE_ARTICLE:"UPDATE_ARTICLE",CLEAR_ARTICLES:"CLEAR_ARTICLES",REMOVE_ARTICLE:"REMOVE_ARTICLE",REMOVE_ARTICLE_ID:"REMOVE_ARTICLE_ID",SET_UI_FLAG:"SET_UI_FLAG",ADD_CATEGORY:"ADD_CATEGORY",ADD_CATEGORY_ID:"ADD_CATEGORY_ID",ADD_MANY_CATEGORIES:"ADD_MANY_CATEGORIES",ADD_MANY_CATEGORIES_ID:"ADD_MANY_CATEGORIES_ID",ADD_CATEGORY_FLAG:"ADD_CATEGORY_FLAG",CLEAR_CATEGORIES:"CLEAR_CATEGORIES",UPDATE_CATEGORY:"UPDATE_CATEGORY",REMOVE_CATEGORY:"REMOVE_CATEGORY",REMOVE_CATEGORY_ID:"REMOVE_CATEGORY_ID",SET_AGENT_BOT_UI_FLAG:"SET_AGENT_BOT_UI_FLAG",SET_AGENT_BOTS:"SET_AGENT_BOTS",ADD_AGENT_BOT:"ADD_AGENT_BOT",EDIT_AGENT_BOT:"EDIT_AGENT_BOT",DELETE_AGENT_BOT:"DELETE_AGENT_BOT",SET_AGENT_BOT_INBOX:"SET_AGENT_BOT_INBOX",UPDATE_AGENT_BOT_AVATAR:"UPDATE_AGENT_BOT_AVATAR",SET_MACROS_UI_FLAG:"SET_MACROS_UI_FLAG",SET_MACROS:"SET_MACROS",ADD_MACRO:"ADD_MACRO",EDIT_MACRO:"EDIT_MACRO",DELETE_MACRO:"DELETE_MACRO",FULL_SEARCH_SET:"FULL_SEARCH_SET",CONTACT_SEARCH_SET:"CONTACT_SEARCH_SET",CONTACT_SEARCH_SET_UI_FLAG:"CONTACT_SEARCH_SET_UI_FLAG",CONVERSATION_SEARCH_SET:"CONVERSATION_SEARCH_SET",CONVERSATION_SEARCH_SET_UI_FLAG:"CONVERSATION_SEARCH_SET_UI_FLAG",MESSAGE_SEARCH_SET:"MESSAGE_SEARCH_SET",ARTICLE_SEARCH_SET:"ARTICLE_SEARCH_SET",CLEAR_SEARCH_RESULTS:"CLEAR_SEARCH_RESULTS",MESSAGE_SEARCH_SET_UI_FLAG:"MESSAGE_SEARCH_SET_UI_FLAG",ARTICLE_SEARCH_SET_UI_FLAG:"ARTICLE_SEARCH_SET_UI_FLAG",FULL_SEARCH_SET_UI_FLAG:"FULL_SEARCH_SET_UI_FLAG",SET_CONVERSATION_PARTICIPANTS_UI_FLAG:"SET_CONVERSATION_PARTICIPANTS_UI_FLAG",SET_CONVERSATION_PARTICIPANTS:"SET_CONVERSATION_PARTICIPANTS",SET_AUDIT_LOGS_UI_FLAG:"SET_AUDIT_LOGS_UI_FLAG",SET_AUDIT_LOGS:"SET_AUDIT_LOGS",SET_AUDIT_LOGS_META:"SET_AUDIT_LOGS_META",SET_SLA_UI_FLAG:"SET_SLA_UI_FLAG",SET_SLA:"SET_SLA",ADD_SLA:"ADD_SLA",EDIT_SLA:"EDIT_SLA",DELETE_SLA:"DELETE_SLA",SET_SLA_REPORTS_UI_FLAG:"SET_SLA_REPORTS_UI_FLAG",SET_SLA_REPORTS:"SET_SLA_REPORTS",SET_SLA_REPORTS_METRICS:"SET_SLA_REPORTS_METRICS",SET_SLA_REPORTS_META:"SET_SLA_REPORTS_META",SET_TEAM_CONVERSATION_METRIC:"SET_TEAM_CONVERSATION_METRIC",TOGGLE_TEAM_CONVERSATION_METRIC_LOADING:"TOGGLE_TEAM_CONVERSATION_METRIC_LOADING"};class XFe extends Fe{constructor(){super("",{accountScoped:!0})}createAccount(e){return axios.post(`${this.apiVersion}/accounts`,e)}async getCacheKeys(){return(await axios.get(`/api/v1/accounts/${this.accountIdFromRoute}/cache_keys`)).data.cache_keys}}const e1=new XFe;class YFe extends Fe{constructor(){super("",{accountScoped:!0,enterprise:!0})}checkout(){return axios.post(`${this.url}checkout`)}subscription(){return axios.post(`${this.url}subscription`)}getLimits(){return axios.get(`${this.url}limits`)}toggleDeletion(e){return axios.post(`${this.url}toggle_deletion`,{action_type:e})}}const I2=new YFe;/*! js-cookie v3.0.5 | MIT */function M2(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var a in r)t[a]=r[a]}return t}var _Fe={read:function(t){return t[0]==='"'&&(t=t.slice(1,-1)),t.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(t){return encodeURIComponent(t).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function Tp(t,e){function r(o,i,n){if(!(typeof document>"u")){n=M2({},e,n),typeof n.expires=="number"&&(n.expires=new Date(Date.now()+n.expires*864e5)),n.expires&&(n.expires=n.expires.toUTCString()),o=encodeURIComponent(o).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var s="";for(var l in n)n[l]&&(s+="; "+l,n[l]!==!0&&(s+="="+n[l].split(";")[0]));return document.cookie=o+"="+t.write(i,o)+s}}function a(o){if(!(typeof document>"u"||arguments.length&&!o)){for(var i=document.cookie?document.cookie.split("; "):[],n={},s=0;s<i.length;s++){var l=i[s].split("="),c=l.slice(1).join("=");try{var u=decodeURIComponent(l[0]);if(n[u]=t.read(c,u),o===u)break}catch{}}return o?n[o]:n}}return Object.create({set:r,get:a,remove:function(o,i){r(o,"",M2({},i,{expires:-1}))},withAttributes:function(o){return Tp(this.converter,M2({},this.attributes,o))},withConverter:function(o){return Tp(M2({},this.converter,o),this.attributes)}},{attributes:{value:Object.freeze(e)},converter:{value:Object.freeze(t)}})}var Wl=Tp(_Fe,{path:"/"});const tw={IMPERSONATION_USER:"impersonationUser"},rw={clearAll(){window.sessionStorage.clear()},get(t){try{const e=window.sessionStorage.getItem(t);return e?JSON.parse(e):null}catch{return window.sessionStorage.getItem(t)}},set(t,e){typeof e=="object"?window.sessionStorage.setItem(t,JSON.stringify(e)):window.sessionStorage.setItem(t,e)},remove(t){window.sessionStorage.removeItem(t)}},$Fe="CHATWOOT_SET_USER",eUe="CHATWOOT_RESET",tUe="ANALYTICS_IDENTITY",rUe="ANALYTICS_RESET";Wl.defaults={sameSite:"Lax"};const aUe=t=>{yr.emit($Fe,{user:t}),yr.emit(tUe,{user:t})},oUe=()=>{Wl.remove("cw_d_session_info"),Wl.remove("auth_data"),Wl.remove("user")},iUe=()=>{rc.remove(ac.DRAFT_MESSAGES)},nUe=()=>{rw.remove(tw.IMPERSONATION_USER)},sUe=async()=>{let t=[];try{t=await window.indexedDB.databases(),t=t.map(e=>e.name)}catch{t=JSON.parse(localStorage.getItem("cw-idb-names")||"[]")}t.forEach(e=>{const r=window.indexedDB.deleteDatabase(e);r.onerror=a=>{console.error(`Error deleting database ${e}.`,a)},r.onsuccess=()=>{console.log(`Database ${e} deleted successfully.`)}}),localStorage.removeItem("cw-idb-names")},WI=()=>{yr.emit(eUe),yr.emit(rUe),oUe(),iUe(),nUe();const e=(window.globalConfig||{}).LOGOUT_REDIRECT_LINK||"/";window.location=e},lUe=t=>{var e,r,a,o,i,n,s,l,c,u,d,g;return(r=(e=t==null?void 0:t.response)==null?void 0:e.data)!=null&&r.message?(o=(a=t==null?void 0:t.response)==null?void 0:a.data)==null?void 0:o.message:(n=(i=t==null?void 0:t.response)==null?void 0:i.data)!=null&&n.error?(l=(s=t==null?void 0:t.response)==null?void 0:s.data)==null?void 0:l.error:(u=(c=t==null?void 0:t.response)==null?void 0:c.data)!=null&&u.errors?(g=(d=t==null?void 0:t.response)==null?void 0:d.data)==null?void 0:g.errors[0]:t},Me=t=>{const e=lUe(t);throw new Error(e)},cUe=(t="")=>["ar","as","fa","he","ku","ur"].includes(t),O2=(t,e)=>t.records.find(r=>r.id===Number(e))||{},uUe=15,dUe={records:[],uiFlags:{isFetching:!1,isFetchingItem:!1,isUpdating:!1,isCheckoutInProcess:!1}},gUe={getAccount:t=>e=>O2(t,e),getUIFlags(t){return t.uiFlags},isRTL:(t,e,r)=>{var i,n;const a=(n=(i=r.route)==null?void 0:i.params)==null?void 0:n.accountId;if(!a)return!1;const{locale:o}=O2(t,Number(a));return o?cUe(o):!1},isTrialAccount:t=>e=>{const r=O2(t,e),a=new Date(r.created_at);return az(new Date,a)<=uUe},isFeatureEnabledonAccount:t=>(e,r)=>{const{features:a={}}=O2(t,e);return a[r]||!1}},hUe={get:async({commit:t})=>{t(p.SET_ACCOUNT_UI_FLAG,{isFetchingItem:!0});try{const e=await e1.get();t(p.ADD_ACCOUNT,e.data),t(p.SET_ACCOUNT_UI_FLAG,{isFetchingItem:!1})}catch{t(p.SET_ACCOUNT_UI_FLAG,{isFetchingItem:!1})}},update:async({commit:t},{options:e,...r})=>{(e==null?void 0:e.silent)!==!0&&t(p.SET_ACCOUNT_UI_FLAG,{isUpdating:!0});try{const a=await e1.update("",r);t(p.EDIT_ACCOUNT,a.data),t(p.SET_ACCOUNT_UI_FLAG,{isUpdating:!1})}catch(a){throw t(p.SET_ACCOUNT_UI_FLAG,{isUpdating:!1}),new Error(a)}},delete:async({commit:t},{id:e})=>{t(p.SET_ACCOUNT_UI_FLAG,{isUpdating:!0});try{await e1.delete(e),t(p.SET_ACCOUNT_UI_FLAG,{isUpdating:!1})}catch(r){throw t(p.SET_ACCOUNT_UI_FLAG,{isUpdating:!1}),new Error(r)}},toggleDeletion:async({commit:t},{action_type:e}={action_type:"delete"})=>{t(p.SET_ACCOUNT_UI_FLAG,{isUpdating:!0});try{await I2.toggleDeletion(e),t(p.SET_ACCOUNT_UI_FLAG,{isUpdating:!1})}catch(r){throw t(p.SET_ACCOUNT_UI_FLAG,{isUpdating:!1}),new Error(r)}},create:async({commit:t},e)=>{t(p.SET_ACCOUNT_UI_FLAG,{isCreating:!0});try{const a=(await e1.createAccount(e)).data.data.account_id;return t(p.SET_ACCOUNT_UI_FLAG,{isCreating:!1}),a}catch(r){throw t(p.SET_ACCOUNT_UI_FLAG,{isCreating:!1}),r}},checkout:async({commit:t})=>{t(p.SET_ACCOUNT_UI_FLAG,{isCheckoutInProcess:!0});try{const e=await I2.checkout();window.location=e.data.redirect_url}catch(e){Me(e)}finally{t(p.SET_ACCOUNT_UI_FLAG,{isCheckoutInProcess:!1})}},subscription:async({commit:t})=>{t(p.SET_ACCOUNT_UI_FLAG,{isCheckoutInProcess:!0});try{await I2.subscription()}catch(e){Me(e)}finally{t(p.SET_ACCOUNT_UI_FLAG,{isCheckoutInProcess:!1})}},limits:async({commit:t})=>{try{const e=await I2.getLimits();t(p.SET_ACCOUNT_LIMITS,e.data)}catch{}},getCacheKeys:async()=>e1.getCacheKeys()},mUe={[p.SET_ACCOUNT_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.ADD_ACCOUNT]:Kc,[p.EDIT_ACCOUNT]:ua,[p.SET_ACCOUNT_LIMITS]:yp},pUe={namespaced:!0,state:dUe,getters:gUe,actions:hUe,mutations:mUe};class fUe extends Fe{constructor(){super("agent_bots",{accountScoped:!0})}create(e){return axios.post(this.url,e,{headers:{"Content-Type":"multipart/form-data"}})}update(e,r){return axios.patch(`${this.url}/${e}`,r,{headers:{"Content-Type":"multipart/form-data"}})}deleteAgentBotAvatar(e){return axios.delete(`${this.url}/${e}/avatar`)}resetAccessToken(e){return axios.post(`${this.url}/${e}/reset_access_token`)}}const es=new fUe,Sp=(t,e)=>e.some(r=>t instanceof r);let tk,rk;function wUe(){return tk||(tk=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function vUe(){return rk||(rk=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const Ip=new WeakMap,b3=new WeakMap,qg=new WeakMap;function bUe(t){const e=new Promise((r,a)=>{const o=()=>{t.removeEventListener("success",i),t.removeEventListener("error",n)},i=()=>{r(Os(t.result)),o()},n=()=>{a(t.error),o()};t.addEventListener("success",i),t.addEventListener("error",n)});return qg.set(e,t),e}function EUe(t){if(Ip.has(t))return;const e=new Promise((r,a)=>{const o=()=>{t.removeEventListener("complete",i),t.removeEventListener("error",n),t.removeEventListener("abort",n)},i=()=>{r(),o()},n=()=>{a(t.error||new DOMException("AbortError","AbortError")),o()};t.addEventListener("complete",i),t.addEventListener("error",n),t.addEventListener("abort",n)});Ip.set(t,e)}let Mp={get(t,e,r){if(t instanceof IDBTransaction){if(e==="done")return Ip.get(t);if(e==="store")return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return Os(t[e])},set(t,e,r){return t[e]=r,!0},has(t,e){return t instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in t}};function ZI(t){Mp=t(Mp)}function kUe(t){return vUe().includes(t)?function(...e){return t.apply(Op(this),e),Os(this.request)}:function(...e){return Os(t.apply(Op(this),e))}}function CUe(t){return typeof t=="function"?kUe(t):(t instanceof IDBTransaction&&EUe(t),Sp(t,wUe())?new Proxy(t,Mp):t)}function Os(t){if(t instanceof IDBRequest)return bUe(t);if(b3.has(t))return b3.get(t);const e=CUe(t);return e!==t&&(b3.set(t,e),qg.set(e,t)),e}const Op=t=>qg.get(t);function AUe(t,e,{blocked:r,upgrade:a,blocking:o,terminated:i}={}){const n=indexedDB.open(t,e),s=Os(n);return a&&n.addEventListener("upgradeneeded",l=>{a(Os(n.result),l.oldVersion,l.newVersion,Os(n.transaction),l)}),r&&n.addEventListener("blocked",l=>r(l.oldVersion,l.newVersion,l)),s.then(l=>{i&&l.addEventListener("close",()=>i()),o&&l.addEventListener("versionchange",c=>o(c.oldVersion,c.newVersion,c))}).catch(()=>{}),s}const xUe=["get","getKey","getAll","getAllKeys","count"],yUe=["put","add","delete","clear"],E3=new Map;function ak(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(E3.get(e))return E3.get(e);const r=e.replace(/FromIndex$/,""),a=e!==r,o=yUe.includes(r);if(!(r in(a?IDBIndex:IDBObjectStore).prototype)||!(o||xUe.includes(r)))return;const i=async function(n,...s){const l=this.transaction(n,o?"readwrite":"readonly");let c=l.store;return a&&(c=c.index(s.shift())),(await Promise.all([c[r](...s),o&&l.done]))[0]};return E3.set(e,i),i}ZI(t=>({...t,get:(e,r,a)=>ak(e,r)||t.get(e,r,a),has:(e,r)=>!!ak(e,r)||t.has(e,r)}));const TUe=["continue","continuePrimaryKey","advance"],ok={},Lp=new WeakMap,JI=new WeakMap,SUe={get(t,e){if(!TUe.includes(e))return t[e];let r=ok[e];return r||(r=ok[e]=function(...a){Lp.set(this,JI.get(this)[e](...a))}),r}};async function*IUe(...t){let e=this;if(e instanceof IDBCursor||(e=await e.openCursor(...t)),!e)return;e=e;const r=new Proxy(e,SUe);for(JI.set(r,e),qg.set(r,Op(e));e;)yield r,e=await(Lp.get(r)||e.continue()),Lp.delete(r)}function ik(t,e){return e===Symbol.asyncIterator&&Sp(t,[IDBIndex,IDBObjectStore,IDBCursor])||e==="iterate"&&Sp(t,[IDBIndex,IDBObjectStore])}ZI(t=>({...t,get(e,r,a){return ik(e,r)?IUe:t.get(e,r,a)},has(e,r){return ik(e,r)||t.has(e,r)}}));const MUe="1678706392";class OUe{constructor(e){this.modelsToSync=["inbox","label","team"],this.accountId=e,this.db=null}async initDb(){if(this.db)return this.db;const e=`cw-store-${this.accountId}`;this.db=await AUe(`cw-store-${this.accountId}`,MUe,{upgrade(a){a.createObjectStore("cache-keys"),a.createObjectStore("inbox",{keyPath:"id"}),a.createObjectStore("label",{keyPath:"id"}),a.createObjectStore("team",{keyPath:"id"})}});const r=JSON.parse(localStorage.getItem("cw-idb-names")||"[]");return r.includes(e)||(r.push(e),localStorage.setItem("cw-idb-names",JSON.stringify(r))),this.db}validateModel(e){if(!e)throw new Error("Model name is not defined");if(!this.modelsToSync.includes(e))throw new Error(`Model ${e} is not defined`);return!0}async replace({modelName:e,data:r}){return this.validateModel(e),this.db.clear(e),this.push({modelName:e,data:r})}async push({modelName:e,data:r}){if(this.validateModel(e),Array.isArray(r)){const a=this.db.transaction(e,"readwrite");r.forEach(o=>{a.store.add(o)}),await a.done}else await this.db.add(e,r)}async get({modelName:e}){return this.validateModel(e),this.db.getAll(e)}async setCacheKeys(e){Object.keys(e).forEach(async r=>{this.db.put("cache-keys",e[r],r)})}async getCacheKey(e){return this.validateModel(e),this.db.get("cache-keys",e)}}class aw extends Fe{constructor(e,r={}){super(e,r),this.dataManager=new OUe(this.accountIdFromRoute)}get cacheModelName(){throw new Error("cacheModelName is not defined")}get(e=!1){return e?this.getFromCache():this.getFromNetwork()}getFromNetwork(){return axios.get(this.url)}extractDataFromResponse(e){return e.data.payload}marshallData(e){return{data:{payload:e}}}async getFromCache(){try{await this.dataManager.initDb()}catch{return this.getFromNetwork()}const{data:e}=await axios.get(`/api/v1/accounts/${this.accountIdFromRoute}/cache_keys`),r=e.cache_keys[this.cacheModelName],a=await this.validateCacheKey(r);let o=[];return a&&(o=await this.dataManager.get({modelName:this.cacheModelName})),o.length===0?this.refetchAndCommit(r):this.marshallData(o)}async refetchAndCommit(e=null){const r=await this.getFromNetwork();try{await this.dataManager.initDb(),this.dataManager.replace({modelName:this.cacheModelName,data:this.extractDataFromResponse(r)}),await this.dataManager.setCacheKeys({[this.cacheModelName]:e})}catch{}return r}async validateCacheKey(e){this.dataManager.db||await this.dataManager.initDb();const r=await this.dataManager.getCacheKey(this.cacheModelName);return e===r}}const LUe=window.__WOOT_ISOLATED_SHELL__?Fe:aw;class RUe extends LUe{constructor(){super("inboxes",{accountScoped:!0})}get cacheModelName(){return"inbox"}getCampaigns(e){return axios.get(`${this.url}/${e}/campaigns`)}deleteInboxAvatar(e){return axios.delete(`${this.url}/${e}/avatar`)}getAgentBot(e){return axios.get(`${this.url}/${e}/agent_bot`)}setAgentBot(e,r){return axios.post(`${this.url}/${e}/set_agent_bot`,{agent_bot:r})}}const ho=new RUe,NUe={records:[],uiFlags:{isFetching:!1,isFetchingItem:!1,isCreating:!1,isDeleting:!1,isUpdating:!1,isUpdatingAvatar:!1,isFetchingAgentBot:!1,isSettingAgentBot:!1,isDisconnecting:!1},agentBotInbox:{}},QI={getBots(t){return t.records},getUIFlags(t){return t.uiFlags},getBot:t=>e=>{const[r]=t.records.filter(a=>a.id===Number(e));return r||{}},getActiveAgentBot:t=>e=>{const r=t.agentBotInbox[Number(e)];return QI.getBot(t)(r)}},DUe={get:async({commit:t})=>{t(p.SET_AGENT_BOT_UI_FLAG,{isFetching:!0});try{const e=await es.get();t(p.SET_AGENT_BOTS,e.data)}catch{}finally{t(p.SET_AGENT_BOT_UI_FLAG,{isFetching:!1})}},create:async({commit:t},e)=>{t(p.SET_AGENT_BOT_UI_FLAG,{isCreating:!0});try{const r=new FormData;r.append("name",e.name),r.append("description",e.description),r.append("bot_type",e.bot_type||"webhook"),r.append("outgoing_url",e.outgoing_url),e.avatar&&r.append("avatar",e.avatar);const a=await es.create(r);return t(p.ADD_AGENT_BOT,a.data),a.data}catch(r){Me(r)}finally{t(p.SET_AGENT_BOT_UI_FLAG,{isCreating:!1})}return null},update:async({commit:t},{id:e,data:r})=>{t(p.SET_AGENT_BOT_UI_FLAG,{isUpdating:!0});try{const a=new FormData;a.append("name",r.name),a.append("description",r.description),a.append("bot_type",r.bot_type||"webhook"),a.append("outgoing_url",r.outgoing_url),r.avatar&&a.append("avatar",r.avatar);const o=await es.update(e,a);t(p.EDIT_AGENT_BOT,o.data)}catch(a){Me(a)}finally{t(p.SET_AGENT_BOT_UI_FLAG,{isUpdating:!1})}},delete:async({commit:t},e)=>{t(p.SET_AGENT_BOT_UI_FLAG,{isDeleting:!0});try{await es.delete(e),t(p.DELETE_AGENT_BOT,e)}catch(r){Me(r)}finally{t(p.SET_AGENT_BOT_UI_FLAG,{isDeleting:!1})}},deleteAgentBotAvatar:async({commit:t},e)=>{t(p.SET_AGENT_BOT_UI_FLAG,{isUpdatingAvatar:!0});try{await es.deleteAgentBotAvatar(e),t(p.UPDATE_AGENT_BOT_AVATAR,{id:e,thumbnail:""})}catch(r){Me(r)}finally{t(p.SET_AGENT_BOT_UI_FLAG,{isUpdatingAvatar:!1})}},show:async({commit:t},e)=>{t(p.SET_AGENT_BOT_UI_FLAG,{isFetchingItem:!0});try{const{data:r}=await es.show(e);t(p.ADD_AGENT_BOT,r)}catch(r){Me(r)}finally{t(p.SET_AGENT_BOT_UI_FLAG,{isFetchingItem:!1})}},fetchAgentBotInbox:async({commit:t},e)=>{t(p.SET_AGENT_BOT_UI_FLAG,{isFetchingAgentBot:!0});try{const{data:r}=await ho.getAgentBot(e),{agent_bot:a={}}=r||{};t(p.SET_AGENT_BOT_INBOX,{agentBotId:a.id,inboxId:e})}catch(r){Me(r)}finally{t(p.SET_AGENT_BOT_UI_FLAG,{isFetchingAgentBot:!1})}},setAgentBotInbox:async({commit:t},{inboxId:e,botId:r})=>{t(p.SET_AGENT_BOT_UI_FLAG,{isSettingAgentBot:!0});try{await ho.setAgentBot(e,r),t(p.SET_AGENT_BOT_INBOX,{agentBotId:r,inboxId:e})}catch(a){Me(a)}finally{t(p.SET_AGENT_BOT_UI_FLAG,{isSettingAgentBot:!1})}},disconnectBot:async({commit:t},{inboxId:e})=>{t(p.SET_AGENT_BOT_UI_FLAG,{isDisconnecting:!0});try{await ho.setAgentBot(e,null),t(p.SET_AGENT_BOT_INBOX,{agentBotId:"",inboxId:e})}catch(r){Me(r)}finally{t(p.SET_AGENT_BOT_UI_FLAG,{isDisconnecting:!1})}},resetAccessToken:async({commit:t},e)=>{try{const r=await es.resetAccessToken(e);return t(p.EDIT_AGENT_BOT,r.data),r.data}catch(r){return Me(r),null}}},VUe={[p.SET_AGENT_BOT_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.ADD_AGENT_BOT]:Kc,[p.SET_AGENT_BOTS]:ur,[p.EDIT_AGENT_BOT]:ua,[p.DELETE_AGENT_BOT]:da,[p.SET_AGENT_BOT_INBOX](t,{agentBotId:e,inboxId:r}){t.agentBotInbox={...t.agentBotInbox,[r]:e}},[p.UPDATE_AGENT_BOT_AVATAR](t,{id:e,thumbnail:r}){const a=t.records.findIndex(o=>o.id===e);a!==-1&&(t.records[a].thumbnail=r||"")}},BUe={namespaced:!0,actions:DUe,state:NUe,getters:QI,mutations:VUe};class PUe extends Fe{constructor(){super("agents",{accountScoped:!0})}bulkInvite({emails:e}){return axios.post(`${this.url}/bulk_create`,{emails:e})}}const L2=new PUe,FUe={records:[],uiFlags:{isFetching:!1,isCreating:!1,isUpdating:!1,isDeleting:!1}},UUe={getAgents(t){return t.records},getVerifiedAgents(t){return t.records.filter(e=>e.confirmed)},getUIFlags(t){return t.uiFlags},getAgentById:t=>e=>t.records.find(r=>r.id===Number(e))||{},getAgentStatus(t){return{online:t.records.filter(r=>r.availability_status==="online").length,busy:t.records.filter(r=>r.availability_status==="busy").length,offline:t.records.filter(r=>r.availability_status==="offline").length}}},jUe={get:async({commit:t})=>{t(p.SET_AGENT_FETCHING_STATUS,!0);try{const e=await L2.get();t(p.SET_AGENT_FETCHING_STATUS,!1),t(p.SET_AGENTS,e.data)}catch{t(p.SET_AGENT_FETCHING_STATUS,!1)}},create:async({commit:t},e)=>{t(p.SET_AGENT_CREATING_STATUS,!0);try{const r=await L2.create(e);t(p.ADD_AGENT,r.data),t(p.SET_AGENT_CREATING_STATUS,!1)}catch(r){throw t(p.SET_AGENT_CREATING_STATUS,!1),r}},update:async({commit:t},{id:e,...r})=>{t(p.SET_AGENT_UPDATING_STATUS,!0);try{const a=await L2.update(e,r);t(p.EDIT_AGENT,a.data),t(p.SET_AGENT_UPDATING_STATUS,!1)}catch(a){throw t(p.SET_AGENT_UPDATING_STATUS,!1),new Error(a)}},updateSingleAgentPresence:({commit:t},{id:e,availabilityStatus:r})=>{t(p.UPDATE_SINGLE_AGENT_PRESENCE,{id:e,availabilityStatus:r})},updatePresence:async({commit:t},e)=>{t(p.UPDATE_AGENTS_PRESENCE,e)},delete:async({commit:t},e)=>{t(p.SET_AGENT_DELETING_STATUS,!0);try{await L2.delete(e),t(p.DELETE_AGENT,e),t(p.SET_AGENT_DELETING_STATUS,!1)}catch(r){throw t(p.SET_AGENT_DELETING_STATUS,!1),new Error(r)}}},zUe={[p.SET_AGENT_FETCHING_STATUS](t,e){t.uiFlags.isFetching=e},[p.SET_AGENT_CREATING_STATUS](t,e){t.uiFlags.isCreating=e},[p.SET_AGENT_UPDATING_STATUS](t,e){t.uiFlags.isUpdating=e},[p.SET_AGENT_DELETING_STATUS](t,e){t.uiFlags.isDeleting=e},[p.SET_AGENTS]:ur,[p.ADD_AGENT]:Ma,[p.EDIT_AGENT]:ua,[p.DELETE_AGENT]:da,[p.UPDATE_AGENTS_PRESENCE]:JFe,[p.UPDATE_SINGLE_AGENT_PRESENCE]:(t,{id:e,availabilityStatus:r})=>QFe(t.records,{id:e,availabilityStatus:r})},qUe={namespaced:!0,state:FUe,getters:UUe,actions:jUe,mutations:zUe},GUe={uiFlags:t=>e=>{const r=t.articles.uiFlags.byId[e];return r||{isFetching:!1,isUpdating:!1,isDeleting:!1}},isFetching:t=>t.uiFlags.isFetching,articleById:(...t)=>e=>{const[r]=t,a=r.articles.byId[e];if(a)return a},allArticles:(...t)=>{const[e,r]=t;return e.articles.allIds.map(o=>r.articleById(o)).filter(o=>o!==void 0)},articleStatus:(...t)=>e=>{const[r]=t,a=r.articles.byId[e];if(a)return a.status},getMeta:t=>t.meta};class ow extends Fe{constructor(){super("portals",{accountScoped:!0})}getPortal({portalSlug:e,locale:r}){return axios.get(`${this.url}/${e}?locale=${r}`)}updatePortal({portalSlug:e,portalObj:r}){return axios.patch(`${this.url}/${e}`,r)}deletePortal(e){return axios.delete(`${this.url}/${e}`)}deleteLogo(e){return axios.delete(`${this.url}/${e}/logo`)}}class HUe extends ow{constructor(){super("articles",{accountScoped:!0})}getArticles({pageNumber:e,portalSlug:r,locale:a,status:o,authorId:i,categorySlug:n,sort:s}){const l=z8({pageNumber:e,portalSlug:r,locale:a,status:o,authorId:i,categorySlug:n,sort:s,host:this.url});return axios.get(l)}searchArticles({portalSlug:e,query:r}){const a=z8({portalSlug:e,query:r,host:this.url});return axios.get(a)}getArticle({id:e,portalSlug:r}){return axios.get(`${this.url}/${r}/articles/${e}`)}updateArticle({portalSlug:e,articleId:r,articleObj:a}){return axios.patch(`${this.url}/${e}/articles/${r}`,a)}createArticle({portalSlug:e,articleObj:r}){const{content:a,title:o,authorId:i,categoryId:n,locale:s}=r;return axios.post(`${this.url}/${e}/articles`,{content:a,title:o,author_id:i,category_id:n,locale:s})}deleteArticle({articleId:e,portalSlug:r}){return axios.delete(`${this.url}/${r}/articles/${e}`)}reorderArticles({portalSlug:e,reorderedGroup:r,categorySlug:a}){return axios.post(`${this.url}/${e}/articles/reorder`,{positions_hash:r,category_slug:a})}}const Qi=new HUe,KUe={index:async({commit:t},{pageNumber:e,portalSlug:r,locale:a,status:o,authorId:i,categorySlug:n})=>{try{t(p.SET_UI_FLAG,{isFetching:!0});const{data:s}=await Qi.getArticles({pageNumber:e,portalSlug:r,locale:a,status:o,authorId:i,categorySlug:n}),l=mr(s.payload),c=mr(s.meta),u=l.map(d=>d.id);return t(p.CLEAR_ARTICLES),t(p.ADD_MANY_ARTICLES,l),t(p.SET_ARTICLES_META,c),t(p.ADD_MANY_ARTICLES_ID,u),u}catch(s){return Me(s)}finally{t(p.SET_UI_FLAG,{isFetching:!1})}},create:async({commit:t,dispatch:e},{portalSlug:r,...a})=>{t(p.SET_UI_FLAG,{isCreating:!0});try{const{data:o}=await Qi.createArticle({portalSlug:r,articleObj:a}),i=mr(o.payload),{id:n}=i;return t(p.ADD_ARTICLE,i),t(p.ADD_ARTICLE_ID,n),t(p.ADD_ARTICLE_FLAG,n),e("portals/updatePortal",r,{root:!0}),n}catch(o){return Me(o)}finally{t(p.SET_UI_FLAG,{isCreating:!1})}},show:async({commit:t},{id:e,portalSlug:r})=>{t(p.SET_UI_FLAG,{isFetching:!0});try{const{data:a}=await Qi.getArticle({id:e,portalSlug:r}),o=mr(a.payload),{id:i}=o;t(p.ADD_ARTICLE,o),t(p.ADD_ARTICLE_ID,i),t(p.SET_UI_FLAG,{isFetching:!1})}catch{t(p.SET_UI_FLAG,{isFetching:!1})}},updateAsync:async({commit:t},{portalSlug:e,articleId:r,...a})=>{t(p.UPDATE_ARTICLE_FLAG,{uiFlags:{isUpdating:!0},articleId:r});try{return await Qi.updateArticle({portalSlug:e,articleId:r,articleObj:a}),r}catch(o){return Me(o)}finally{t(p.UPDATE_ARTICLE_FLAG,{uiFlags:{isUpdating:!1},articleId:r})}},update:async({commit:t},{portalSlug:e,articleId:r,...a})=>{t(p.UPDATE_ARTICLE_FLAG,{uiFlags:{isUpdating:!0},articleId:r});try{const{data:o}=await Qi.updateArticle({portalSlug:e,articleId:r,articleObj:a}),i=mr(o.payload);return t(p.UPDATE_ARTICLE,i),r}catch(o){return Me(o)}finally{t(p.UPDATE_ARTICLE_FLAG,{uiFlags:{isUpdating:!1},articleId:r})}},updateArticleMeta:async({commit:t},{portalSlug:e,locale:r})=>{try{const{data:a}=await Qi.getArticles({pageNumber:1,portalSlug:e,locale:r}),o=mr(a.meta),{currentPage:i,...n}=o;t(p.SET_ARTICLES_META,n)}catch(a){Me(a)}},delete:async({commit:t},{portalSlug:e,articleId:r})=>{t(p.UPDATE_ARTICLE_FLAG,{uiFlags:{isDeleting:!0},articleId:r});try{return await Qi.deleteArticle({portalSlug:e,articleId:r}),t(p.REMOVE_ARTICLE,r),t(p.REMOVE_ARTICLE_ID,r),r}catch(a){return Me(a)}finally{t(p.UPDATE_ARTICLE_FLAG,{uiFlags:{isDeleting:!1},articleId:r})}},attachImage:async(t,{file:e})=>{const{fileUrl:r}=await $5(e);return r},uploadExternalImage:async(t,{url:e})=>{const{fileUrl:r}=await aDe(e);return r},reorder:async(t,{portalSlug:e,categorySlug:r,reorderedGroup:a})=>{try{await Qi.reorderArticles({portalSlug:e,reorderedGroup:a,categorySlug:r})}catch(o){Me(o)}return""}},WUe={[p.SET_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.ADD_ARTICLE]:(t,e)=>{e.id&&(t.articles.byId[e.id]=e)},[p.CLEAR_ARTICLES]:t=>{t.articles.allIds=[],t.articles.byId={},t.articles.uiFlags.byId={}},[p.ADD_MANY_ARTICLES](t,e){const r={...t.articles.byId};e.forEach(a=>{r[a.id]=a}),t.articles.byId=r},[p.ADD_MANY_ARTICLES_ID](t,e){t.articles.allIds.push(...e)},[p.SET_ARTICLES_META]:(t,e)=>{t.meta={...t.meta,...e}},[p.ADD_ARTICLE_ID]:(t,e)=>{t.articles.allIds.includes(e)||t.articles.allIds.push(e)},[p.UPDATE_ARTICLE_FLAG]:(t,{articleId:e,uiFlags:r})=>{const a=t.articles.uiFlags.byId[e]||{};t.articles.uiFlags.byId[e]={isFetching:!1,isUpdating:!1,isDeleting:!1,...a,...r}},[p.ADD_ARTICLE_FLAG]:(t,{articleId:e,uiFlags:r})=>{t.articles.uiFlags.byId[e]={isFetching:!1,isUpdating:!1,isDeleting:!1,...r}},[p.UPDATE_ARTICLE]:(t,e)=>{const r=e.id;if(t.articles.byId[r]){const a=t.articles.byId[r].position;t.articles.byId[r]={...e,position:a}}},[p.REMOVE_ARTICLE](t,e){const{[e]:r,...a}=t.articles.byId;t.articles.byId=a},[p.REMOVE_ARTICLE_ID](t,e){t.articles.allIds=t.articles.allIds.filter(r=>r!==e)}},ZUe={meta:{count:0,currentPage:1},articles:{byId:{},allIds:[],uiFlags:{byId:{}}},uiFlags:{allFetched:!1,isFetching:!1}},JUe={namespaced:!0,state:ZUe,getters:GUe,actions:KUe,mutations:WUe};class QUe extends Fe{constructor(){super("custom_attribute_definitions",{accountScoped:!0})}getAttributesByModel(){return axios.get(this.url)}}const R2=new QUe,XUe={records:[],uiFlags:{isFetching:!1,isCreating:!1,isUpdating:!1,isDeleting:!1}},YUe={getUIFlags(t){return t.uiFlags},getAttributes:t=>t.records,getConversationAttributes:t=>t.records.filter(e=>e.attribute_model==="conversation_attribute").map(mr),getContactAttributes:t=>t.records.filter(e=>e.attribute_model==="contact_attribute").map(mr),getAttributesByModel:t=>e=>t.records.filter(r=>r.attribute_model===e)},_Ue={get:async function({commit:e}){e(p.SET_CUSTOM_ATTRIBUTE_UI_FLAG,{isFetching:!0});try{const r=await R2.getAttributesByModel();e(p.SET_CUSTOM_ATTRIBUTE,r.data)}catch{}finally{e(p.SET_CUSTOM_ATTRIBUTE_UI_FLAG,{isFetching:!1})}},create:async function({commit:e},r){var a,o;e(p.SET_CUSTOM_ATTRIBUTE_UI_FLAG,{isCreating:!0});try{const i=await R2.create(r);e(p.ADD_CUSTOM_ATTRIBUTE,i.data)}catch(i){const n=(o=(a=i==null?void 0:i.response)==null?void 0:a.data)==null?void 0:o.message;throw new Error(n)}finally{e(p.SET_CUSTOM_ATTRIBUTE_UI_FLAG,{isCreating:!1})}},update:async({commit:t},{id:e,...r})=>{var a,o;t(p.SET_CUSTOM_ATTRIBUTE_UI_FLAG,{isUpdating:!0});try{const i=await R2.update(e,r);t(p.EDIT_CUSTOM_ATTRIBUTE,i.data)}catch(i){const n=(o=(a=i==null?void 0:i.response)==null?void 0:a.data)==null?void 0:o.message;throw new Error(n)}finally{t(p.SET_CUSTOM_ATTRIBUTE_UI_FLAG,{isUpdating:!1})}},delete:async({commit:t},e)=>{t(p.SET_CUSTOM_ATTRIBUTE_UI_FLAG,{isDeleting:!0});try{await R2.delete(e),t(p.DELETE_CUSTOM_ATTRIBUTE,e)}catch(r){throw new Error(r)}finally{t(p.SET_CUSTOM_ATTRIBUTE_UI_FLAG,{isDeleting:!1})}}},$Ue={[p.SET_CUSTOM_ATTRIBUTE_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.ADD_CUSTOM_ATTRIBUTE]:Ma,[p.SET_CUSTOM_ATTRIBUTE]:ur,[p.EDIT_CUSTOM_ATTRIBUTE]:ua,[p.DELETE_CUSTOM_ATTRIBUTE]:da},eje={namespaced:!0,actions:_Ue,state:XUe,getters:YUe,mutations:$Ue};class tje extends Fe{constructor(){super("audit_logs",{accountScoped:!0})}get({page:e}){const r=e?`${this.url}?page=${e}`:this.url;return axios.get(r)}}const rje=new tje,aje={records:[],meta:{currentPage:1,perPage:15,totalEntries:0},uiFlags:{fetchingList:!1}},oje={getAuditLogs(t){return t.records},getUIFlags(t){return t.uiFlags},getMeta(t){return t.meta}},ije={async fetch({commit:t},{page:e}={}){t(p.SET_AUDIT_LOGS_UI_FLAG,{fetchingList:!0});try{const r=await rje.get({page:e}),{audit_logs:a=[]}=r.data,{total_entries:o,per_page:i,current_page:n}=r.data;return t(p.SET_AUDIT_LOGS,a),t(p.SET_AUDIT_LOGS_META,{totalEntries:o,perPage:i,currentPage:n}),t(p.SET_AUDIT_LOGS_UI_FLAG,{fetchingList:!1}),a}catch(r){return t(p.SET_AUDIT_LOGS_UI_FLAG,{fetchingList:!1}),Me(r)}}},nje={[p.SET_AUDIT_LOGS_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.SET_AUDIT_LOGS]:ur,[p.SET_AUDIT_LOGS_META](t,e){t.meta={...t.meta,...e}}},sje={namespaced:!0,state:aje,getters:oje,actions:ije,mutations:nje},lje={resetPassword:{url:"auth/password"},register:{url:"api/v1/accounts.json"},validityCheck:{url:"/auth/validate_token"},profileUpdate:{url:"/api/v1/profile"},availabilityUpdate:{url:"/api/v1/profile/availability"},autoOffline:{url:"/api/v1/profile/auto_offline"},logout:{url:"auth/sign_out"},me:{url:"api/v1/conversations.json",params:{type:0,page:1}},getInbox:{url:"api/v1/conversations.json",params:{inbox_id:null}},fetchFacebookPages:{url(t){return`api/v1/accounts/${t}/callbacks/facebook_pages.json`},params:{omniauth_token:""}},deleteAvatar:{url:"/api/v1/profile/avatar"},setActiveAccount:{url:"/api/v1/profile/set_active_account"},resendConfirmation:{url:"/api/v1/profile/resend_confirmation"},resetAccessToken:{url:"/api/v1/profile/reset_access_token"}},Ja=t=>lje[t],Qa={async validityCheck(){if(this.hasAuthToken()){const e=Ja("profileUpdate"),r=await axios.get(e.url);return Promise.resolve({data:{payload:r}})}const t=Ja("validityCheck");return axios.get(t.url)},logout(){const t=Ja("logout");return new Promise((r,a)=>{axios.delete(t.url).then(o=>{sUe(),WI(),r(o)}).catch(o=>{a(o)})})},hasAuthCookie(){return!!Wl.get("cw_d_session_info")},hasAuthToken(){return!!window.__WOOT_ACCESS_TOKEN__},getAuthData(){if(this.hasAuthCookie()){const t=Wl.get("cw_d_session_info");return JSON.parse(t||"{}")}return!1},profileUpdate({password:t,password_confirmation:e,displayName:r,avatar:a,...o}){const i=new FormData;return Object.keys(o).forEach(n=>{o[n]===void 0||i.append(`profile[${n}]`,o[n])}),i.append("profile[display_name]",r||""),t&&e&&(i.append("profile[password]",t),i.append("profile[password_confirmation]",e)),a&&i.append("profile[avatar]",a),axios.put(Ja("profileUpdate").url,i)},updateUISettings({uiSettings:t}){return axios.put(Ja("profileUpdate").url,{profile:{ui_settings:t}})},updateAvailability(t){return axios.post(Ja("availabilityUpdate").url,{profile:{...t}})},updateAutoOffline(t,e=!1){return axios.post(Ja("autoOffline").url,{profile:{account_id:t,auto_offline:e}})},deleteAvatar(){return axios.delete(Ja("deleteAvatar").url)},resetPassword({email:t}){const e=Ja("resetPassword");return axios.post(e.url,{email:t})},setActiveAccount({accountId:t}){const e=Ja("setActiveAccount");return axios.put(e.url,{profile:{account_id:t}})},resendConfirmation(){const t=Ja("resendConfirmation");return axios.post(t.url)},resetAccessToken(){const t=Ja("resetAccessToken");return axios.post(t.url)}},XI={currentUser:{id:null,account_id:null,accounts:[],email:null,name:null},uiFlags:{isFetching:!0}},cje={isLoggedIn(t){return!!t.currentUser.id},getCurrentUserID(t){return t.currentUser.id},getUISettings(t){return t.currentUser.ui_settings||{}},getAuthUIFlags(t){return t.uiFlags},getCurrentUserAvailability(t,e){const{accounts:r=[]}=t.currentUser,[a={}]=r.filter(o=>o.id===e.getCurrentAccountId);return a.availability},getCurrentUserAutoOffline(t,e){const{accounts:r=[]}=t.currentUser,[a={}]=r.filter(o=>o.id===e.getCurrentAccountId);return a.auto_offline},getCurrentAccountId(t,e,r){return window.__WOOT_ACCOUNT_ID__?window.__WOOT_ACCOUNT_ID__:r.route.params&&r.route.params.accountId?Number(r.route.params.accountId):null},getCurrentRole(t,e){const{accounts:r=[]}=t.currentUser,[a={}]=r.filter(o=>o.id===e.getCurrentAccountId);return a.role},getCurrentCustomRoleId(t,e){const{accounts:r=[]}=t.currentUser,[a={}]=r.filter(o=>o.id===e.getCurrentAccountId);return a.custom_role_id},getCurrentUser(t){return t.currentUser},getMessageSignature(t){const{message_signature:e}=t.currentUser;return e||""},getCurrentAccount(t,e){const{accounts:r=[]}=t.currentUser,[a={}]=r.filter(o=>o.id===e.getCurrentAccountId);return a||{}},getUserAccounts(t){const{accounts:e=[]}=t.currentUser;return e}},uje={async validityCheck(t){var e;try{const a=(await Qa.validityCheck()).data.payload.data;aUe(a),t.commit(p.SET_CURRENT_USER,a)}catch(r){((e=r==null?void 0:r.response)==null?void 0:e.status)===401&&WI()}},async setUser({commit:t,dispatch:e}){Qa.hasAuthCookie()||Qa.hasAuthToken()?await e("validityCheck"):t(p.CLEAR_USER),t(p.SET_CURRENT_USER_UI_FLAGS,{isFetching:!1})},logout({commit:t}){t(p.CLEAR_USER)},updateProfile:async({commit:t},e)=>{try{const r=await Qa.profileUpdate(e);t(p.SET_CURRENT_USER,r.data)}catch(r){throw r}},deleteAvatar:async({commit:t})=>{try{const e=await Qa.deleteAvatar();t(p.SET_CURRENT_USER,e.data)}catch{}},updateUISettings:async({commit:t},e)=>{try{if(t(p.SET_CURRENT_USER_UI_SETTINGS,e),!rw.get(tw.IMPERSONATION_USER)){const a=await Qa.updateUISettings(e);t(p.SET_CURRENT_USER,a.data)}}catch{}},updateAvailability:async({commit:t,dispatch:e,getters:r},a)=>{const o=r.getCurrentUserAvailability;try{t(p.SET_CURRENT_USER_AVAILABILITY,a.availability);const i=await Qa.updateAvailability(a),n=i.data,{id:s}=n;t(p.SET_CURRENT_USER,i.data),e("agents/updateSingleAgentPresence",{id:s,availabilityStatus:a.availability})}catch{t(p.SET_CURRENT_USER_AVAILABILITY,o)}},updateAutoOffline:async({commit:t,getters:e},{accountId:r,autoOffline:a})=>{const o=e.getCurrentUserAutoOffline;try{t(p.SET_CURRENT_USER_AUTO_OFFLINE,a);const i=await Qa.updateAutoOffline(r,a);t(p.SET_CURRENT_USER,i.data)}catch{t(p.SET_CURRENT_USER_AUTO_OFFLINE,o)}},setCurrentUserAvailability({commit:t,state:e},r){r[e.currentUser.id]&&t(p.SET_CURRENT_USER_AVAILABILITY,r[e.currentUser.id])},setActiveAccount:async(t,{accountId:e})=>{try{await Qa.setActiveAccount({accountId:e})}catch{}},resetAccessToken:async({commit:t})=>{try{const e=await Qa.resetAccessToken();return t(p.SET_CURRENT_USER,e.data),!0}catch{return!1}},resendConfirmation:async()=>{try{await Qa.resendConfirmation()}catch{}}},dje={[p.SET_CURRENT_USER_AVAILABILITY](t,e){const r=t.currentUser.accounts.map(a=>a.id===t.currentUser.account_id?{...a,availability:e,availability_status:e}:a);t.currentUser={...t.currentUser,accounts:r}},[p.SET_CURRENT_USER_AUTO_OFFLINE](t,e){const r=t.currentUser.accounts.map(a=>a.id===t.currentUser.account_id?{...a,autoOffline:e}:a);t.currentUser={...t.currentUser,accounts:r}},[p.CLEAR_USER](t){t.currentUser=XI.currentUser},[p.SET_CURRENT_USER](t,e){t.currentUser=e},[p.SET_CURRENT_USER_UI_SETTINGS](t,{uiSettings:e}){t.currentUser={...t.currentUser,ui_settings:{...t.currentUser.ui_settings,...e}}},[p.SET_CURRENT_USER_UI_FLAGS](t,{isFetching:e}){t.uiFlags={isFetching:e}}},gje={state:XI,getters:cje,actions:uje,mutations:dje};class hje extends Fe{constructor(){super("automation_rules",{accountScoped:!0})}clone(e){return axios.post(`${this.url}/${e}/clone`)}}const t1=new hje,mje={records:[],uiFlags:{isFetching:!1,isCreating:!1,isDeleting:!1,isUpdating:!1}},pje={getAutomations(t){return t.records.sort((e,r)=>e.id-r.id)},getUIFlags(t){return t.uiFlags}},fje={get:async function({commit:e}){e(p.SET_AUTOMATION_UI_FLAG,{isFetching:!0});try{const r=await t1.get();e(p.SET_AUTOMATIONS,r.data.payload)}catch{}finally{e(p.SET_AUTOMATION_UI_FLAG,{isFetching:!1})}},create:async function({commit:e},r){e(p.SET_AUTOMATION_UI_FLAG,{isCreating:!0});try{const a=await t1.create(r);e(p.ADD_AUTOMATION,a.data)}catch(a){throw new Error(a)}finally{e(p.SET_AUTOMATION_UI_FLAG,{isCreating:!1})}},update:async({commit:t},{id:e,...r})=>{t(p.SET_AUTOMATION_UI_FLAG,{isUpdating:!0});try{const a=await t1.update(e,r);t(p.EDIT_AUTOMATION,a.data.payload)}catch(a){throw new Error(a)}finally{t(p.SET_AUTOMATION_UI_FLAG,{isUpdating:!1})}},delete:async({commit:t},e)=>{t(p.SET_AUTOMATION_UI_FLAG,{isDeleting:!0});try{await t1.delete(e),t(p.DELETE_AUTOMATION,e)}catch(r){throw new Error(r)}finally{t(p.SET_AUTOMATION_UI_FLAG,{isDeleting:!1})}},clone:async({commit:t},e)=>{t(p.SET_AUTOMATION_UI_FLAG,{isCloning:!0});try{await t1.clone(e)}catch(r){throw new Error(r)}finally{t(p.SET_AUTOMATION_UI_FLAG,{isCloning:!1})}},uploadAttachment:async(t,e)=>{const{blobId:r}=await $5(e);return r}},wje={[p.SET_AUTOMATION_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.ADD_AUTOMATION]:Ma,[p.SET_AUTOMATIONS]:ur,[p.EDIT_AUTOMATION]:ua,[p.DELETE_AUTOMATION]:da},vje={namespaced:!0,actions:fje,state:mje,getters:pje,mutations:wje};class bje extends Fe{constructor(){super("bulk_actions",{accountScoped:!0})}}const Eje=new bje,kje={selectedConversationIds:[],uiFlags:{isUpdating:!1}},Cje={getUIFlags(t){return t.uiFlags},getSelectedConversationIds(t){return t.selectedConversationIds}},Aje={process:async function({commit:e},r){e(p.SET_BULK_ACTIONS_FLAG,{isUpdating:!0});try{await Eje.create(r)}catch(a){throw new Error(a)}finally{e(p.SET_BULK_ACTIONS_FLAG,{isUpdating:!1})}},setSelectedConversationIds({commit:t},e){t(p.SET_SELECTED_CONVERSATION_IDS,e)},removeSelectedConversationIds({commit:t},e){t(p.REMOVE_SELECTED_CONVERSATION_IDS,e)},clearSelectedConversationIds({commit:t}){t(p.CLEAR_SELECTED_CONVERSATION_IDS)}},xje={[p.SET_BULK_ACTIONS_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.SET_SELECTED_CONVERSATION_IDS](t,e){const r=Array.isArray(e)?e:[e];t.selectedConversationIds=[...new Set([...t.selectedConversationIds,...r])]},[p.REMOVE_SELECTED_CONVERSATION_IDS](t,e){t.selectedConversationIds=t.selectedConversationIds.filter(r=>r!==e)},[p.CLEAR_SELECTED_CONVERSATION_IDS](t){t.selectedConversationIds=[]}},yje={namespaced:!0,actions:Aje,state:kje,getters:Cje,mutations:xje};class Tje extends Fe{constructor(){super("campaigns",{accountScoped:!0})}}const N2=new Tje,Sje={records:[],uiFlags:{isFetching:!1,isCreating:!1}},Ije={getUIFlags(t){return t.uiFlags},getCampaigns:t=>e=>t.records.filter(r=>r.campaign_type===e).sort((r,a)=>r.id-a.id),getAllCampaigns:t=>t.records},Mje={get:async function({commit:e}){e(p.SET_CAMPAIGN_UI_FLAG,{isFetching:!0});try{const r=await N2.get();e(p.SET_CAMPAIGNS,r.data)}catch{}finally{e(p.SET_CAMPAIGN_UI_FLAG,{isFetching:!1})}},create:async function({commit:e},r){e(p.SET_CAMPAIGN_UI_FLAG,{isCreating:!0});try{const a=await N2.create(r);e(p.ADD_CAMPAIGN,a.data)}catch(a){throw new Error(a)}finally{e(p.SET_CAMPAIGN_UI_FLAG,{isCreating:!1})}},update:async({commit:t},{id:e,...r})=>{t(p.SET_CAMPAIGN_UI_FLAG,{isUpdating:!0});try{const a=await N2.update(e,r);Fr.track(W6.UPDATE_CAMPAIGN),t(p.EDIT_CAMPAIGN,a.data)}catch(a){throw new Error(a)}finally{t(p.SET_CAMPAIGN_UI_FLAG,{isUpdating:!1})}},delete:async({commit:t},e)=>{t(p.SET_CAMPAIGN_UI_FLAG,{isDeleting:!0});try{await N2.delete(e),Fr.track(W6.DELETE_CAMPAIGN),t(p.DELETE_CAMPAIGN,e)}catch(r){throw new Error(r)}finally{t(p.SET_CAMPAIGN_UI_FLAG,{isDeleting:!1})}}},Oje={[p.SET_CAMPAIGN_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.ADD_CAMPAIGN]:Ma,[p.SET_CAMPAIGNS]:ur,[p.EDIT_CAMPAIGN]:ua,[p.DELETE_CAMPAIGN]:da},Lje={namespaced:!0,actions:Mje,state:Sje,getters:Ije,mutations:Oje};class Rje extends Fe{constructor(){super("canned_responses",{accountScoped:!0})}get({searchKey:e}){const r=e?`${this.url}?search=${e}`:this.url;return axios.get(r)}}const D2=new Rje,Nje={records:[],uiFlags:{fetchingList:!1,fetchingItem:!1,creatingItem:!1,updatingItem:!1,deletingItem:!1}},Dje={getCannedResponses(t){return t.records},getSortedCannedResponses(t){return e=>[...t.records].sort((r,a)=>e==="asc"?r.short_code.localeCompare(a.short_code):a.short_code.localeCompare(r.short_code))},getUIFlags(t){return t.uiFlags}},Vje={getCannedResponse:async function({commit:e},{searchKey:r}={}){e(p.SET_CANNED_UI_FLAG,{fetchingList:!0});try{const a=await D2.get({searchKey:r});e(p.SET_CANNED,a.data),e(p.SET_CANNED_UI_FLAG,{fetchingList:!1})}catch{e(p.SET_CANNED_UI_FLAG,{fetchingList:!1})}},createCannedResponse:async function({commit:e},r){e(p.SET_CANNED_UI_FLAG,{creatingItem:!0});try{const a=await D2.create(r);return e(p.ADD_CANNED,a.data),e(p.SET_CANNED_UI_FLAG,{creatingItem:!1}),a.data}catch(a){return e(p.SET_CANNED_UI_FLAG,{creatingItem:!1}),Me(a)}},updateCannedResponse:async function({commit:e},{id:r,...a}){e(p.SET_CANNED_UI_FLAG,{updatingItem:!0});try{const o=await D2.update(r,a);return e(p.EDIT_CANNED,o.data),e(p.SET_CANNED_UI_FLAG,{updatingItem:!1}),o.data}catch(o){return e(p.SET_CANNED_UI_FLAG,{updatingItem:!1}),Me(o)}},deleteCannedResponse:async function({commit:e},r){e(p.SET_CANNED_UI_FLAG,{deletingItem:!0});try{return await D2.delete(r),e(p.DELETE_CANNED,r),e(p.SET_CANNED_UI_FLAG,{deletingItem:!0}),r}catch(a){return e(p.SET_CANNED_UI_FLAG,{deletingItem:!0}),Me(a)}}},Bje={[p.SET_CANNED_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.SET_CANNED]:ur,[p.ADD_CANNED]:Ma,[p.EDIT_CANNED]:ua,[p.DELETE_CANNED]:da},Pje={state:Nje,getters:Dje,actions:Vje,mutations:Bje},Fje={uiFlags:t=>e=>{const r=t.categories.uiFlags.byId[e];return r||{isFetching:!1,isUpdating:!1,isDeleting:!1}},isFetching:t=>t.uiFlags.isFetching,isCreating:t=>t.uiFlags.isCreating,categoryById:(...t)=>e=>{const[r]=t,a=r.categories.byId[e];if(a)return a},allCategories:(...t)=>{const[e,r]=t;return e.categories.allIds.map(o=>r.categoryById(o))},categoriesByLocaleCode:(...t)=>e=>{const[r,a]=t;return r.categories.allIds.map(i=>a.categoryById(i)).filter(i=>i.locale===e)},getMeta:t=>t.meta};class Uje extends ow{constructor(){super("categories",{accountScoped:!0})}get({portalSlug:e,locale:r}){return axios.get(`${this.url}/${e}/categories?locale=${r}`)}create({portalSlug:e,categoryObj:r}){return axios.post(`${this.url}/${e}/categories`,r)}update({portalSlug:e,categoryId:r,categoryObj:a}){return axios.patch(`${this.url}/${e}/categories/${r}`,a)}delete({portalSlug:e,categoryId:r}){return axios.delete(`${this.url}/${e}/categories/${r}`)}}const V2=new Uje,jje={index:async({commit:t},{portalSlug:e,locale:r})=>{try{if(t(p.SET_UI_FLAG,{isFetching:!0}),e){const{data:{payload:a}}=await V2.get({portalSlug:e,locale:r});t(p.CLEAR_CATEGORIES);const o=a.map(i=>i.id);return t(p.ADD_MANY_CATEGORIES,a),t(p.ADD_MANY_CATEGORIES_ID,o),o}return""}catch(a){return Me(a)}finally{t(p.SET_UI_FLAG,{isFetching:!1})}},create:async({commit:t},{portalSlug:e,categoryObj:r})=>{t(p.SET_UI_FLAG,{isCreating:!0});try{const{data:{payload:a}}=await V2.create({portalSlug:e,categoryObj:r}),{id:o}=a;return t(p.ADD_CATEGORY,a),t(p.ADD_CATEGORY_ID,o),o}catch(a){return Me(a)}finally{t(p.SET_UI_FLAG,{isCreating:!1})}},update:async({commit:t},{portalSlug:e,categoryId:r,categoryObj:a})=>{t(p.ADD_CATEGORY_FLAG,{uiFlags:{isUpdating:!0},categoryId:r});try{const{data:{payload:o}}=await V2.update({portalSlug:e,categoryId:r,categoryObj:a});return t(p.UPDATE_CATEGORY,o),r}catch(o){return Me(o)}finally{t(p.ADD_CATEGORY_FLAG,{uiFlags:{isUpdating:!1},categoryId:r})}},delete:async({commit:t},{portalSlug:e,categoryId:r})=>{t(p.ADD_CATEGORY_FLAG,{uiFlags:{isDeleting:!0},categoryId:r});try{return await V2.delete({portalSlug:e,categoryId:r}),t(p.REMOVE_CATEGORY,r),t(p.REMOVE_CATEGORY_ID,r),r}catch(a){return Me(a)}finally{t(p.ADD_CATEGORY_FLAG,{uiFlags:{isDeleting:!1},categoryId:r})}}},zje={[p.SET_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.ADD_CATEGORY]:(t,e)=>{e.id&&(t.categories.byId[e.id]={...e})},[p.CLEAR_CATEGORIES]:t=>{t.categories.byId={},t.categories.allIds=[],t.categories.uiFlags.byId={}},[p.ADD_MANY_CATEGORIES](t,e){const r={...t.categories.byId};e.forEach(a=>{r[a.id]=a}),t.categories.byId=r},[p.ADD_MANY_CATEGORIES_ID](t,e){t.categories.allIds.push(...e)},[p.SET_CATEGORIES_META]:(t,e)=>{const{categories_count:r,current_page:a}=e;t.meta={...t.meta,count:r,currentPage:a}},[p.ADD_CATEGORY_ID]:(t,e)=>{t.categories.allIds.push(e)},[p.ADD_CATEGORY_FLAG]:(t,{categoryId:e,uiFlags:r})=>{const a=t.categories.uiFlags.byId[e];t.categories.uiFlags.byId[e]={isFetching:!1,isUpdating:!1,isDeleting:!1,...a,...r}},[p.UPDATE_CATEGORY](t,e){const r=e.id;t.categories.allIds.includes(r)&&(t.categories.byId[r]={...e})},[p.REMOVE_CATEGORY](t,e){const{[e]:r,...a}=t.categories.byId;t.categories.byId=a},[p.REMOVE_CATEGORY_ID](t,e){t.categories.allIds=t.categories.allIds.filter(r=>r!==e)}},qje={categories:{byId:{},byLocale:{},allIds:[],uiFlags:{byId:{}}},uiFlags:{allFetched:!1,isFetching:!1,isCreating:!1}},Gje={namespaced:!0,state:qje,getters:Fje,actions:jje,mutations:zje},B2=(t,e,r,a)=>{let o=`include_contact_inboxes=false&page=${t}&sort=${e}`;return a&&(o=`${o}&q=${a}`),r&&(o=`${o}&labels[]=${r}`),o};class Hje extends Fe{constructor(){super("contacts",{accountScoped:!0})}get(e,r="name",a=""){let o=`${this.url}?${B2(e,r,a,"")}`;return axios.get(o)}show(e){return axios.get(`${this.url}/${e}?include_contact_inboxes=false`)}update(e,r){return axios.patch(`${this.url}/${e}?include_contact_inboxes=false`,r)}getConversations(e){return axios.get(`${this.url}/${e}/conversations`)}getContactableInboxes(e){return axios.get(`${this.url}/${e}/contactable_inboxes`)}getContactLabels(e){return axios.get(`${this.url}/${e}/labels`)}updateContactLabels(e,r){return axios.post(`${this.url}/${e}/labels`,{labels:r})}search(e="",r=1,a="name",o=""){let i=`${this.url}/search?${B2(r,a,o,e)}`;return axios.get(i)}active(e=1,r="name"){let a=`${this.url}/active?${B2(e,r)}`;return axios.get(a)}filter(e=1,r="name",a){let o=`${this.url}/filter?${B2(e,r)}`;return axios.post(o,a)}importContacts(e){const r=new FormData;return r.append("import_file",e),axios.post(`${this.url}/import`,r,{headers:{"Content-Type":"multipart/form-data"}})}destroyCustomAttributes(e,r){return axios.post(`${this.url}/${e}/destroy_custom_attributes`,{custom_attributes:r})}destroyAvatar(e){return axios.delete(`${this.url}/${e}/avatar`)}exportContacts(e){return axios.post(`${this.url}/export`,e)}}const Rr=new Hje;let Kje=class extends Fe{constructor(){super("conversations",{accountScoped:!0})}getLabels(e){return axios.get(`${this.url}/${e}/labels`)}updateLabels(e,r){return axios.post(`${this.url}/${e}/labels`,{labels:r})}};const Rp=new Kje,Wje=(t,e)=>{const{content:r,cc_emails:a,bcc_emails:o}=e;t.append("message[content]",r),a&&t.append("message[cc_emails]",a),o&&t.append("message[bcc_emails]",o)},Zje=({params:t,contactId:e,files:r})=>{const{inboxId:a,message:o,sourceId:i,mailSubject:n,assigneeId:s}=t,l=new FormData;return o&&Wje(l,o),r&&r.length>0&&r.forEach(c=>l.append("message[attachments][]",c)),l.append("inbox_id",a),l.append("contact_id",e),l.append("source_id",i),l.append("additional_attributes[mail_subject]",n),l.append("assignee_id",s),l},Jje=({params:t})=>{const{inboxId:e,message:r,contactId:a,sourceId:o,assigneeId:i}=t;return{inbox_id:e,contact_id:a,source_id:o,message:r,assignee_id:i}},Qje=({isFromWhatsApp:t,params:e,contactId:r,files:a})=>t?Jje({params:e}):Zje({params:e,contactId:r,files:a}),Xje={records:{},uiFlags:{isFetching:!1}},Yje={getUIFlags(t){return t.uiFlags},getContactConversation:t=>e=>t.records[Number(e)]||[],getAllConversationsByContactId:t=>e=>{const r=t.records[Number(e)]||[];return mr(r,{deep:!0})}},_je={create:async({commit:t},{params:e,isFromWhatsApp:r})=>{t(p.SET_CONTACT_CONVERSATIONS_UI_FLAG,{isCreating:!0});const{contactId:a,files:o}=e;try{const i=Qje({isFromWhatsApp:r,params:e,contactId:a,files:o}),{data:n}=await Rp.create(i);return t(p.ADD_CONTACT_CONVERSATION,{id:a,data:n}),n}catch(i){throw new Error(i)}finally{t(p.SET_CONTACT_CONVERSATIONS_UI_FLAG,{isCreating:!1})}},get:async({commit:t},e)=>{t(p.SET_CONTACT_CONVERSATIONS_UI_FLAG,{isFetching:!0});try{const r=await Rr.getConversations(e);t(p.SET_CONTACT_CONVERSATIONS,{id:e,data:r.data.payload}),t(p.SET_CONTACT_CONVERSATIONS_UI_FLAG,{isFetching:!1})}catch{t(p.SET_CONTACT_CONVERSATIONS_UI_FLAG,{isFetching:!1})}}},$je={[p.SET_CONTACT_CONVERSATIONS_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.SET_CONTACT_CONVERSATIONS]:(t,{id:e,data:r})=>{t.records={...t.records,[e]:r}},[p.ADD_CONTACT_CONVERSATION]:(t,{id:e,data:r})=>{const a=t.records[e]||[],o=[...a],i=a.findIndex(n=>n.id===r.id);i!==-1?o[i]={...a[i],...r}:o.push(r),t.records={...t.records,[e]:o}},[p.DELETE_CONTACT_CONVERSATION]:(t,e)=>{const{[e]:r,...a}=t.records;t.records=a}},eze={namespaced:!0,state:Xje,getters:Yje,actions:_je,mutations:$je},tze={records:{},uiFlags:{isFetching:!1,isUpdating:!1,isError:!1}},rze={getUIFlags(t){return t.uiFlags},getContactLabels:t=>e=>t.records[Number(e)]||[]},aze={get:async({commit:t},e)=>{t(p.SET_CONTACT_LABELS_UI_FLAG,{isFetching:!0});try{const r=await Rr.getContactLabels(e);t(p.SET_CONTACT_LABELS,{id:e,data:r.data.payload}),t(p.SET_CONTACT_LABELS_UI_FLAG,{isFetching:!1})}catch{t(p.SET_CONTACT_LABELS_UI_FLAG,{isFetching:!1})}},update:async({commit:t},{contactId:e,labels:r})=>{t(p.SET_CONTACT_LABELS_UI_FLAG,{isUpdating:!0});try{const a=await Rr.updateContactLabels(e,r);t(p.SET_CONTACT_LABELS,{id:e,data:a.data.payload}),t(p.SET_CONTACT_LABELS_UI_FLAG,{isUpdating:!1,isError:!1})}catch(a){throw t(p.SET_CONTACT_LABELS_UI_FLAG,{isUpdating:!1,isError:!0}),new Error(a)}},setContactLabel({commit:t},{id:e,data:r}){t(p.SET_CONTACT_LABELS,{id:e,data:r})}},oze={[p.SET_CONTACT_LABELS_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.SET_CONTACT_LABELS]:(t,{id:e,data:r})=>{t.records={...t.records,[e]:r}}},ize={namespaced:!0,state:tze,getters:rze,actions:aze,mutations:oze};class nze extends Fe{constructor(){super("notes",{accountScoped:!0}),this.contactId=null}get url(){return`${this.baseUrl()}/contacts/${this.contactId}/notes`}get(e){return this.contactId=e,super.get()}create(e,r){return this.contactId=e,super.create({content:r})}delete(e,r){return this.contactId=e,super.delete(r)}}const k3=new nze,sze={records:{},uiFlags:{isFetching:!1,isCreating:!1,isDeleting:!1}},lze={getAllNotesByContact:t=>e=>(t.records[e]||[]).sort((a,o)=>o.id-a.id),getUIFlags(t){return t.uiFlags},getAllNotesByContactId:t=>e=>{const a=(t.records[e]||[]).sort((o,i)=>i.id-o.id);return mr(a)}},cze={async get({commit:t},{contactId:e}){t(p.SET_CONTACT_NOTES_UI_FLAG,{isFetching:!0});try{const{data:r}=await k3.get(e);t(p.SET_CONTACT_NOTES,{contactId:e,data:r})}catch(r){throw new Error(r)}finally{t(p.SET_CONTACT_NOTES_UI_FLAG,{isFetching:!1})}},async create({commit:t},{contactId:e,content:r}){t(p.SET_CONTACT_NOTES_UI_FLAG,{isCreating:!0});try{const{data:a}=await k3.create(e,r);t(p.ADD_CONTACT_NOTE,{contactId:e,data:a})}catch(a){throw new Error(a)}finally{t(p.SET_CONTACT_NOTES_UI_FLAG,{isCreating:!1})}},async delete({commit:t},{noteId:e,contactId:r}){t(p.SET_CONTACT_NOTES_UI_FLAG,{isDeleting:!0});try{await k3.delete(r,e),t(p.DELETE_CONTACT_NOTE,{contactId:r,noteId:e})}catch(a){throw new Error(a)}finally{t(p.SET_CONTACT_NOTES_UI_FLAG,{isDeleting:!1})}}},uze={[p.SET_CONTACT_NOTES_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.SET_CONTACT_NOTES](t,{data:e,contactId:r}){t.records={...t.records,[r]:e}},[p.ADD_CONTACT_NOTE](t,{data:e,contactId:r}){const a=t.records[r]||[];t.records[r]=[...a,e]},[p.DELETE_CONTACT_NOTE](t,{noteId:e,contactId:r}){const o=t.records[r].filter(i=>i.id!==e);t.records[r]=[...o]}},dze={namespaced:!0,state:sze,getters:lze,actions:cze,mutations:uze},gze={getContacts(t){return t.sortOrder.map(e=>t.records[e])},getContactsList(t){const e=t.sortOrder.map(r=>t.records[r]);return mr(e,{deep:!0})},getUIFlags(t){return t.uiFlags},getContact:t=>e=>t.records[e]||{},getContactById:t=>e=>{const r=t.records[e];return mr(r||{},{deep:!0,stopPaths:["custom_attributes"]})},getMeta:t=>t.meta,getAppliedContactFilters:t=>t.appliedFilters,getAppliedContactFiltersV4:t=>t.appliedFilters.map(mr)};class hze extends Fe{constructor(){super("actions",{accountScoped:!0})}merge(e,r){return axios.post(`${this.url}/contact_merge`,{base_contact_id:e,mergee_contact_id:r})}}const mze=new hze,nk=t=>{const e=new FormData,{additional_attributes:r={},...a}=t;Object.keys(a).forEach(n=>{a[n]&&e.append(n,a[n])});const{social_profiles:o,...i}=r;return Object.keys(i).forEach(n=>{e.append(`additional_attributes[${n}]`,i[n])}),Object.keys(o).forEach(n=>{e.append(`additional_attributes[social_profiles][${n}]`,o[n])}),e},sk=t=>{var e,r,a;throw((e=t.response)==null?void 0:e.status)===422?new Zy(t.response.data.attributes):(a=(r=t.response)==null?void 0:r.data)!=null&&a.message?new _u(t.response.data.message):new Error(t)},pze={search:async({commit:t},{search:e,page:r,sortAttr:a,label:o})=>{t(p.SET_CONTACT_UI_FLAG,{isFetching:!0});try{const{data:{payload:i,meta:n}}=await Rr.search(e,r,a,o);t(p.CLEAR_CONTACTS),t(p.SET_CONTACTS,i),t(p.SET_CONTACT_META,n),t(p.SET_CONTACT_UI_FLAG,{isFetching:!1})}catch{t(p.SET_CONTACT_UI_FLAG,{isFetching:!1})}},get:async({commit:t},{page:e=1,sortAttr:r,label:a}={})=>{t(p.SET_CONTACT_UI_FLAG,{isFetching:!0});try{const{data:{payload:o,meta:i}}=await Rr.get(e,r,a);t(p.CLEAR_CONTACTS),t(p.SET_CONTACTS,o),t(p.SET_CONTACT_META,i),t(p.SET_CONTACT_UI_FLAG,{isFetching:!1})}catch{t(p.SET_CONTACT_UI_FLAG,{isFetching:!1})}},active:async({commit:t},{page:e=1,sortAttr:r}={})=>{t(p.SET_CONTACT_UI_FLAG,{isFetching:!0});try{const{data:{payload:a,meta:o}}=await Rr.active(e,r);t(p.CLEAR_CONTACTS),t(p.SET_CONTACTS,a),t(p.SET_CONTACT_META,o),t(p.SET_CONTACT_UI_FLAG,{isFetching:!1})}catch{t(p.SET_CONTACT_UI_FLAG,{isFetching:!1})}},show:async({commit:t},{id:e})=>{t(p.SET_CONTACT_UI_FLAG,{isFetchingItem:!0});try{const r=await Rr.show(e);t(p.SET_CONTACT_ITEM,r.data.payload),t(p.SET_CONTACT_UI_FLAG,{isFetchingItem:!1})}catch{t(p.SET_CONTACT_UI_FLAG,{isFetchingItem:!1})}},update:async({commit:t},{id:e,isFormData:r=!1,...a})=>{const{avatar:o,customAttributes:i,...n}=a,s={...Em(n,{deep:!0}),...i&&{custom_attributes:i},...o&&{avatar:o}};t(p.SET_CONTACT_UI_FLAG,{isUpdating:!0});try{const l=await Rr.update(e,r?nk(s):s);t(p.EDIT_CONTACT,l.data.payload),t(p.SET_CONTACT_UI_FLAG,{isUpdating:!1})}catch(l){t(p.SET_CONTACT_UI_FLAG,{isUpdating:!1}),sk(l)}},create:async({commit:t},{isFormData:e=!1,...r})=>{const a=Em(r,{deep:!0});t(p.SET_CONTACT_UI_FLAG,{isCreating:!0});try{const o=await Rr.create(e?nk(a):a);return Fr.track(Yj.CREATE_CONTACT),t(p.SET_CONTACT_ITEM,o.data.payload.contact),t(p.SET_CONTACT_UI_FLAG,{isCreating:!1}),o.data.payload.contact}catch(o){return t(p.SET_CONTACT_UI_FLAG,{isCreating:!1}),sk(o)}},import:async({commit:t},e)=>{var r,a;t(p.SET_CONTACT_UI_FLAG,{isImporting:!0});try{await Rr.importContacts(e),t(p.SET_CONTACT_UI_FLAG,{isImporting:!1})}catch(o){if(t(p.SET_CONTACT_UI_FLAG,{isImporting:!1}),(a=(r=o.response)==null?void 0:r.data)!=null&&a.message)throw new _u(o.response.data.message)}},export:async({commit:t},{payload:e,label:r})=>{var a,o;t(p.SET_CONTACT_UI_FLAG,{isExporting:!0});try{await Rr.exportContacts({payload:e,label:r}),t(p.SET_CONTACT_UI_FLAG,{isExporting:!1})}catch(i){throw t(p.SET_CONTACT_UI_FLAG,{isExporting:!1}),(o=(a=i.response)==null?void 0:a.data)!=null&&o.message?new Error(i.response.data.message):new Error(i)}},delete:async({commit:t},e)=>{var r,a;t(p.SET_CONTACT_UI_FLAG,{isDeleting:!0});try{await Rr.delete(e),t(p.SET_CONTACT_UI_FLAG,{isDeleting:!1})}catch(o){throw t(p.SET_CONTACT_UI_FLAG,{isDeleting:!1}),(a=(r=o.response)==null?void 0:r.data)!=null&&a.message?new Error(o.response.data.message):new Error(o)}},deleteCustomAttributes:async({commit:t},{id:e,customAttributes:r})=>{try{const a=await Rr.destroyCustomAttributes(e,r);t(p.EDIT_CONTACT,a.data.payload)}catch(a){throw new Error(a)}},deleteAvatar:async({commit:t},e)=>{try{const r=await Rr.destroyAvatar(e);t(p.EDIT_CONTACT,r.data.payload)}catch(r){throw new Error(r)}},fetchContactableInbox:async({commit:t},e)=>{var r,a;t(p.SET_CONTACT_UI_FLAG,{isFetchingInboxes:!0});try{const o=await Rr.getContactableInboxes(e),i={id:Number(e),contact_inboxes:o.data.payload};t(p.SET_CONTACT_ITEM,i)}catch(o){throw(a=(r=o.response)==null?void 0:r.data)!=null&&a.message?new _u(o.response.data.message):new Error(o)}finally{t(p.SET_CONTACT_UI_FLAG,{isFetchingInboxes:!1})}},updatePresence:({commit:t},e)=>{t(p.UPDATE_CONTACTS_PRESENCE,e)},setContact({commit:t},e){t(p.SET_CONTACT_ITEM,e)},merge:async({commit:t},{childId:e,parentId:r})=>{t(p.SET_CONTACT_UI_FLAG,{isMerging:!0});try{const a=await mze.merge(r,e);t(p.SET_CONTACT_ITEM,a.data)}catch(a){throw new Error(a)}finally{t(p.SET_CONTACT_UI_FLAG,{isMerging:!1})}},deleteContactThroughConversations:({commit:t},e)=>{t(p.DELETE_CONTACT,e),t(p.CLEAR_CONTACT_CONVERSATIONS,e,{root:!0}),t(`contactConversations/${p.DELETE_CONTACT_CONVERSATION}`,e,{root:!0})},updateContact:async({commit:t},e)=>{t(p.SET_CONTACT_UI_FLAG,{isUpdating:!0});try{t(p.EDIT_CONTACT,e),t(p.SET_CONTACT_UI_FLAG,{isUpdating:!1})}catch{t(p.SET_CONTACT_UI_FLAG,{isUpdating:!1})}},filter:async({commit:t},{page:e=1,sortAttr:r,queryPayload:a,resetState:o=!0}={})=>{t(p.SET_CONTACT_UI_FLAG,{isFetching:!0});try{const{data:{payload:i,meta:n}}=await Rr.filter(e,r,a);return o&&(t(p.CLEAR_CONTACTS),t(p.SET_CONTACTS,i),t(p.SET_CONTACT_META,n),t(p.SET_CONTACT_UI_FLAG,{isFetching:!1})),i}catch{t(p.SET_CONTACT_UI_FLAG,{isFetching:!1})}return[]},setContactFilters({commit:t},e){t(p.SET_CONTACT_FILTERS,e)},clearContactFilters({commit:t}){t(p.CLEAR_CONTACT_FILTERS)}},fze={[p.SET_CONTACT_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.CLEAR_CONTACTS]:t=>{t.records={},t.sortOrder=[]},[p.SET_CONTACT_META]:(t,e)=>{const{count:r,current_page:a}=e;t.meta.count=r,t.meta.currentPage=a},[p.SET_CONTACTS]:(t,e)=>{const r=e.map(a=>(t.records[a.id]={...t.records[a.id]||{},...a},a.id));t.sortOrder=r},[p.SET_CONTACT_ITEM]:(t,e)=>{t.records[e.id]={...t.records[e.id]||{},...e},t.sortOrder.includes(e.id)||t.sortOrder.push(e.id)},[p.EDIT_CONTACT]:(t,e)=>{t.records[e.id]=e},[p.DELETE_CONTACT]:(t,e)=>{const r=t.sortOrder.findIndex(a=>a===e);t.sortOrder.splice(r,1),delete t.records[e]},[p.UPDATE_CONTACTS_PRESENCE]:(t,e)=>{Object.values(t.records).forEach(r=>{let a;try{a=e[r.id]}catch(o){tg("contact is undefined",{records:t.records,data:e}),Rc(o);return}a?t.records[r.id].availability_status=a:t.records[r.id].availability_status=null})},[p.SET_CONTACT_FILTERS](t,e){t.appliedFilters=e},[p.CLEAR_CONTACT_FILTERS](t){t.appliedFilters=[]}},wze={meta:{count:0,currentPage:1},records:{},uiFlags:{isFetching:!1,isFetchingItem:!1,isFetchingInboxes:!1,isUpdating:!1,isMerging:!1,isDeleting:!1,isExporting:!1,isImporting:!1},sortOrder:[],appliedFilters:[]},vze={namespaced:!0,state:wze,getters:gze,actions:pze,mutations:fze},bze={records:{},uiFlags:{isFetching:!1,isUpdating:!1,isError:!1}},Eze={getUIFlags(t){return t.uiFlags},getConversationLabels:t=>e=>t.records[Number(e)]||[]},kze={get:async({commit:t},e)=>{t(p.SET_CONVERSATION_LABELS_UI_FLAG,{isFetching:!0});try{const r=await Rp.getLabels(e);t(p.SET_CONVERSATION_LABELS,{id:e,data:r.data.payload}),t(p.SET_CONVERSATION_LABELS_UI_FLAG,{isFetching:!1})}catch{t(p.SET_CONVERSATION_LABELS_UI_FLAG,{isFetching:!1})}},update:async({commit:t},{conversationId:e,labels:r})=>{t(p.SET_CONVERSATION_LABELS_UI_FLAG,{isUpdating:!0});try{const a=await Rp.updateLabels(e,r);t(p.SET_CONVERSATION_LABELS,{id:e,data:a.data.payload}),t(p.SET_CONVERSATION_LABELS_UI_FLAG,{isUpdating:!1,isError:!1})}catch{t(p.SET_CONVERSATION_LABELS_UI_FLAG,{isUpdating:!1,isError:!0})}},setBulkConversationLabels({commit:t},e){t(p.SET_BULK_CONVERSATION_LABELS,e)},setConversationLabel({commit:t},{id:e,data:r}){t(p.SET_CONVERSATION_LABELS,{id:e,data:r})}},Cze={[p.SET_CONVERSATION_LABELS_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.SET_CONVERSATION_LABELS]:(t,{id:e,data:r})=>{t.records={...t.records,[e]:r}},[p.SET_BULK_CONVERSATION_LABELS]:(t,e)=>{const r={...t.records};e.forEach(a=>{r[a.id]=a.labels}),t.records=r}},Aze={namespaced:!0,state:bze,getters:Eze,actions:kze,mutations:Cze},xze={records:{}},yze={getConversationMetadata:t=>e=>t.records[Number(e)]||{}},Tze={},Sze={[p.SET_CONVERSATION_METADATA]:(t,{id:e,data:r})=>{t.records={...t.records,[e]:r}}},Ize={namespaced:!0,state:xze,getters:yze,actions:Tze,mutations:Sze},Mze={currentPage:{me:0,unassigned:0,all:0,appliedFilters:0},hasEndReached:{me:!1,unassigned:!1,all:!1}},Oze={getHasEndReached:t=>e=>t.hasEndReached[e],getCurrentPageFilter:t=>e=>t.currentPage[e],getCurrentPage:t=>t.currentPage},Lze={setCurrentPage({commit:t},{filter:e,page:r}){t(p.SET_CURRENT_PAGE,{filter:e,page:r})},setEndReached({commit:t},{filter:e}){t(p.SET_CONVERSATION_END_REACHED,{filter:e})},reset({commit:t}){t(p.CLEAR_CONVERSATION_PAGE)}},Rze={[p.SET_CURRENT_PAGE]:(t,{filter:e,page:r})=>{t.currentPage={...t.currentPage,[e]:r}},[p.SET_CONVERSATION_END_REACHED]:(t,{filter:e})=>{e==="all"&&(t.hasEndReached={...t.hasEndReached,unassigned:!0,me:!0}),t.hasEndReached={...t.hasEndReached,[e]:!0}},[p.CLEAR_CONVERSATION_PAGE]:t=>{t.currentPage={me:0,unassigned:0,all:0,appliedFilters:0},t.hasEndReached={me:!1,unassigned:!1,all:!1,appliedFilters:!1}}},Nze={namespaced:!0,state:Mze,getters:Oze,actions:Lze,mutations:Rze},Dze=(t,e)=>{const{echo_id:r}=e;return t.messages.findIndex(a=>a.id===e.id||a.id===r)},Vze=(t,e)=>e==="all"?!0:t===e,Bze=(t,e,r)=>{const a=Number(e)===r;return e?a&&t:t},Pze=(t,e,r)=>{const a=Number(e)===r;return e?a&&t:t},Fze=(t,e,r)=>{const a=e.every(o=>r.includes(o));return e.length?a&&t:t},Uze=(t,e,r,a)=>e==="unattended"?(!r||!!a)&&t:t,C3=(t,e)=>{const{inboxId:r,status:a,labels:o=[],teamId:i,conversationType:n}=e,{status:s,inbox_id:l,labels:c=[],meta:u={},first_reply_created_at:d,waiting_since:g}=t,h=u.team||{},{id:m}=h;let f=Vze(s,a);return f=Bze(f,r,l),f=Pze(f,i,m),f=Fze(f,o,c),f=Uze(f,n,d,g),f},lk=(t,e,r,a)=>{if(["administrator","agent"].includes(e)||r.includes("conversation_manage"))return!0;const o=t.meta.assignee,i=!o,n=(o==null?void 0:o.id)===a;return r.includes("conversation_unassigned_manage")?i||n:r.includes("conversation_participating_manage")?n:!1},ck={last_activity_at_asc:["sortOnLastActivityAt","asc"],last_activity_at_desc:["sortOnLastActivityAt","desc"],created_at_asc:["sortOnCreatedAt","asc"],created_at_desc:["sortOnCreatedAt","desc"],priority_asc:["sortOnPriority","asc"],priority_desc:["sortOnPriority","desc"],waiting_since_asc:["sortOnWaitingSince","asc"],waiting_since_desc:["sortOnWaitingSince","desc"]},jze=(t,e)=>t-e,zze=(t,e)=>e-t,P2=t=>t==="asc"?jze:zze,qze={sortOnLastActivityAt:(t,e,r)=>P2(r)(t.last_activity_at,e.last_activity_at),sortOnCreatedAt:(t,e,r)=>P2(r)(t.created_at,e.created_at),sortOnPriority:(t,e,r)=>{const a=r==="asc"?5:0,o=Y8[t.priority]||a,i=Y8[e.priority]||a;return P2(r)(o,i)},sortOnWaitingSince:(t,e,r)=>{const a=P2(r);return!t.waiting_since||!e.waiting_since?!t.waiting_since&&!e.waiting_since?a(t.created_at,e.created_at):a(t.waiting_since?0:1,e.waiting_since?0:1):a(t.waiting_since,e.waiting_since)}},uk=(t,e,r)=>{const[a,o]=ck[r]||ck.last_activity_at_desc;return qze[a](t,e,o)},Gze=t=>{var e;return(e=t.values[0])!=null&&e.id?t.values.map(r=>r.id):t.values},Hze=t=>t.attribute_key==="content"?(t.values||"").split(","):Array.isArray(t.values)?Gze(t):typeof t.values=="object"?[t.values.id]:t.values?[t.values]:[],Kze=t=>{let r=JSON.parse(JSON.stringify(t)).map(a=>(a.values=Hze(a),a));return r[r.length-1].query_operator=void 0,{payload:r}};var YI={exports:{}};(function(t,e){(function(r,a){t.exports=a()})(ct,function(){Array.isArray||(Array.isArray=function(i){return Object.prototype.toString.call(i)==="[object Array]"});function r(i){for(var n=[],s=0,l=i.length;s<l;s++)n.indexOf(i[s])===-1&&n.push(i[s]);return n}var a={},o={"==":function(i,n){return i==n},"===":function(i,n){return i===n},"!=":function(i,n){return i!=n},"!==":function(i,n){return i!==n},">":function(i,n){return i>n},">=":function(i,n){return i>=n},"<":function(i,n,s){return s===void 0?i<n:i<n&&n<s},"<=":function(i,n,s){return s===void 0?i<=n:i<=n&&n<=s},"!!":function(i){return a.truthy(i)},"!":function(i){return!a.truthy(i)},"%":function(i,n){return i%n},log:function(i){return console.log(i),i},in:function(i,n){return!n||typeof n.indexOf>"u"?!1:n.indexOf(i)!==-1},cat:function(){return Array.prototype.join.call(arguments,"")},substr:function(i,n,s){if(s<0){var l=String(i).substr(n);return l.substr(0,l.length+s)}return String(i).substr(n,s)},"+":function(){return Array.prototype.reduce.call(arguments,function(i,n){return parseFloat(i,10)+parseFloat(n,10)},0)},"*":function(){return Array.prototype.reduce.call(arguments,function(i,n){return parseFloat(i,10)*parseFloat(n,10)})},"-":function(i,n){return n===void 0?-i:i-n},"/":function(i,n){return i/n},min:function(){return Math.min.apply(this,arguments)},max:function(){return Math.max.apply(this,arguments)},merge:function(){return Array.prototype.reduce.call(arguments,function(i,n){return i.concat(n)},[])},var:function(i,n){var s=n===void 0?null:n,l=this;if(typeof i>"u"||i===""||i===null)return l;for(var c=String(i).split("."),u=0;u<c.length;u++)if(l==null||(l=l[c[u]],l===void 0))return s;return l},missing:function(){for(var i=[],n=Array.isArray(arguments[0])?arguments[0]:arguments,s=0;s<n.length;s++){var l=n[s],c=a.apply({var:l},this);(c===null||c==="")&&i.push(l)}return i},missing_some:function(i,n){var s=a.apply({missing:n},this);return n.length-s.length>=i?[]:s}};return a.is_logic=function(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)&&Object.keys(i).length===1},a.truthy=function(i){return Array.isArray(i)&&i.length===0?!1:!!i},a.get_operator=function(i){return Object.keys(i)[0]},a.get_values=function(i){return i[a.get_operator(i)]},a.apply=function(i,n){if(Array.isArray(i))return i.map(function(b){return a.apply(b,n)});if(!a.is_logic(i))return i;var s=a.get_operator(i),l=i[s],c,u,d,g,h;if(Array.isArray(l)||(l=[l]),s==="if"||s=="?:"){for(c=0;c<l.length-1;c+=2)if(a.truthy(a.apply(l[c],n)))return a.apply(l[c+1],n);return l.length===c+1?a.apply(l[c],n):null}else if(s==="and"){for(c=0;c<l.length;c+=1)if(u=a.apply(l[c],n),!a.truthy(u))return u;return u}else if(s==="or"){for(c=0;c<l.length;c+=1)if(u=a.apply(l[c],n),a.truthy(u))return u;return u}else{if(s==="filter")return g=a.apply(l[0],n),d=l[1],Array.isArray(g)?g.filter(function(b){return a.truthy(a.apply(d,b))}):[];if(s==="map")return g=a.apply(l[0],n),d=l[1],Array.isArray(g)?g.map(function(b){return a.apply(d,b)}):[];if(s==="reduce")return g=a.apply(l[0],n),d=l[1],h=typeof l[2]<"u"?a.apply(l[2],n):null,Array.isArray(g)?g.reduce(function(b,k){return a.apply(d,{current:k,accumulator:b})},h):h;if(s==="all"){if(g=a.apply(l[0],n),d=l[1],!Array.isArray(g)||!g.length)return!1;for(c=0;c<g.length;c+=1)if(!a.truthy(a.apply(d,g[c])))return!1;return!0}else if(s==="none"){if(g=a.apply(l[0],n),d=l[1],!Array.isArray(g)||!g.length)return!0;for(c=0;c<g.length;c+=1)if(a.truthy(a.apply(d,g[c])))return!1;return!0}else if(s==="some"){if(g=a.apply(l[0],n),d=l[1],!Array.isArray(g)||!g.length)return!1;for(c=0;c<g.length;c+=1)if(a.truthy(a.apply(d,g[c])))return!0;return!1}}if(l=l.map(function(b){return a.apply(b,n)}),o.hasOwnProperty(s)&&typeof o[s]=="function")return o[s].apply(n,l);if(s.indexOf(".")>0){var m=String(s).split("."),f=o;for(c=0;c<m.length;c++){if(!f.hasOwnProperty(m[c]))throw new Error("Unrecognized operation "+s+" (failed at "+m.slice(0,c+1).join(".")+")");f=f[m[c]]}return f.apply(n,l)}throw new Error("Unrecognized operation "+s)},a.uses_data=function(i){var n=[];if(a.is_logic(i)){var s=a.get_operator(i),l=i[s];Array.isArray(l)||(l=[l]),s==="var"?n.push(l[0]):l.forEach(function(c){n.push.apply(n,a.uses_data(c))})}return r(n)},a.add_operation=function(i,n){o[i]=n},a.rm_operation=function(i){delete o[i]},a.rule_like=function(i,n){if(n===i||n==="@")return!0;if(n==="number")return typeof i=="number";if(n==="string")return typeof i=="string";if(n==="array")return Array.isArray(i)&&!a.is_logic(i);if(a.is_logic(n)){if(a.is_logic(i)){var s=a.get_operator(n),l=a.get_operator(i);if(s==="@"||s===l)return a.rule_like(a.get_values(i,!1),a.get_values(n,!1))}return!1}if(Array.isArray(n))if(Array.isArray(i)){if(n.length!==i.length)return!1;for(var c=0;c<n.length;c+=1)if(!a.rule_like(i[c],n[c]))return!1;return!0}else return!1;return!1},a})})(YI);var Wze=YI.exports;const Zze=Fn(Wze),_I=(t,e)=>{var r,a,o,i,n;switch(e){case"status":case"priority":case"display_id":case"labels":case"created_at":case"last_activity_at":return t[e];case"assignee_id":return(a=(r=t.meta)==null?void 0:r.assignee)==null?void 0:a.id;case"inbox_id":return t.inbox_id;case"team_id":return(i=(o=t.meta)==null?void 0:o.team)==null?void 0:i.id;case"browser_language":case"country_code":case"referer":return(n=t.additional_attributes)==null?void 0:n[e];default:return t.custom_attributes&&t.custom_attributes[e]?t.custom_attributes[e]:null}},dk=t=>typeof t=="object"&&t!==null&&"id"in t?t.id:t,gk=(t,e)=>{if(Array.isArray(t)){if(t.includes("all")||t==="all")return!0;if(Array.isArray(e))return t.every(r=>e.includes(r));if(!Array.isArray(e))return t.includes(e)}return e===t},hk=(t,e)=>typeof e=="string"?e.toLowerCase().includes(t.toLowerCase()):!1,mk=(t,e,r)=>{const a=j8(t),o=j8(e);return a===null||o===null?!1:r(a,o)},$I=(t,e)=>{const{filter_operator:r,values:a}=e;if(t==null)return r==="is_not_present";const o=Array.isArray(a)?a.map(dk):dk(a);switch(r){case"equal_to":return gk(o,t);case"not_equal_to":return!gk(o,t);case"contains":return hk(o,t);case"does_not_contain":return!hk(o,t);case"is_present":return!0;case"is_not_present":return!1;case"is_greater_than":return mk(t,o,(i,n)=>i>n);case"is_less_than":return mk(t,o,(i,n)=>i<n);case"days_before":{const i=new Date,n=o*24*60*60*1e3,s=new Date(i.getTime()-n);return t<s.getTime()}default:return!1}},Jze=t=>{const e=[];let r=[t[0].result];for(let a=0;a<t.length-1;a+=1)t[a].operator==="and"?r.push(t[a+1].result):(e.push(r.length===1?r[0]:{and:r}),r=[t[a+1].result]);return r.length>0&&e.push(r.length===1?r[0]:{and:r}),e.length>1?{or:e}:e[0]},Qze=(t,e)=>e.map((r,a)=>{const o=_I(t,r.attribute_key),i=$I(o,r),s=a===e.length-1?null:r.query_operator||"and";return{result:i,operator:s}}),Xze=(t,e)=>{if(!e||e.length===0)return!0;if(e.length===1){const a=_I(t,e[0].attribute_key);return $I(a,e[0])}const r=Qze(t,e);return Zze.apply(Jze(r))},eM=({accounts:t}={},e=null)=>t.find(r=>Number(r.id)===Number(e)),Np=(t,e)=>(eM(t,e)||{}).permissions||[],pk=(t,e)=>{const r=eM(t,e)||{};return r.custom_role_id?"custom_role":r.role||"agent"},Ti=({allConversations:t,selectedChatId:e})=>t.filter(r=>r.id===e),tM={getAllConversations:({allConversations:t,chatSortFilter:e})=>t.sort((r,a)=>uk(r,a,e)),getFilteredConversations:({allConversations:t,chatSortFilter:e,appliedFilters:r},a,o,i)=>{const n=i.getCurrentUser,s=i.getCurrentUser.id,l=i.getCurrentAccountId,c=Np(n,l),u=pk(n,l);return t.filter(d=>{const g=Xze(d,r),h=lk(d,u,c,s);return g&&h}).sort((d,g)=>uk(d,g,e))},getSelectedChat:({selectedChatId:t,allConversations:e})=>e.find(a=>a.id===t)||{},getSelectedChatAttachments:({selectedChatId:t,attachments:e})=>e[t]||[],getChatListFilters:({conversationFilters:t})=>t,getLastEmailInSelectedChat:(t,e)=>{const r=e.getSelectedChat,{messages:a=[]}=r;return[...a].reverse().find(i=>{const{message_type:n}=i;return i.private?!1:[nc.OUTGOING,nc.INCOMING].includes(n)})},getMineChats:(t,e,r,a)=>o=>{var n;const i=(n=a.getCurrentUser)==null?void 0:n.id;return t.allConversations.filter(s=>{const{assignee:l}=s.meta,c=l&&l.id===i,u=C3(s,o);return c&&u})},getAppliedConversationFiltersV2:t=>t.appliedFilters.map(mr),getAppliedConversationFilters:t=>t.appliedFilters,getAppliedConversationFiltersQuery:t=>t.appliedFilters.length!==0?Kze(t.appliedFilters):[],getUnAssignedChats:t=>e=>t.allConversations.filter(r=>{const a=!r.meta.assignee,o=C3(r,e);return a&&o}),getAllStatusChats:(t,e,r,a)=>o=>{const i=a.getCurrentUser,n=a.getCurrentUser.id,s=a.getCurrentAccountId,l=Np(i,s),c=pk(i,s);return t.allConversations.filter(u=>{const d=C3(u,o),g=lk(u,c,l,n);return d&&g})},getChatListLoadingStatus:({listLoadingStatus:t})=>t,getAllMessagesLoaded(t){const[e]=Ti(t);return!e||e.allMessagesLoaded===void 0?!1:e.allMessagesLoaded},getUnreadCount(t){const[e]=Ti(t);return e?e.messages.filter(r=>r.created_at*1e3>e.agent_last_seen_at*1e3&&r.message_type===0&&r.private!==!0).length:[]},getChatStatusFilter:({chatStatusFilter:t})=>t,getChatSortFilter:({chatSortFilter:t})=>t,getSelectedInbox:({currentInbox:t})=>t,getConversationById:t=>e=>t.allConversations.find(r=>r.id===Number(e)),getConversationParticipants:t=>t.conversationParticipants,getConversationLastSeen:t=>t.conversationLastSeen,getContextMenuChatId:t=>t.contextMenuChatId,getCopilotAssistant:t=>t.copilotAssistant};class Yze extends Fe{constructor(){super("conversations",{accountScoped:!0})}get({inboxId:e,status:r,assigneeType:a,page:o,labels:i,teamId:n,conversationType:s,sortBy:l,updatedWithin:c}){return axios.get(this.url,{params:{inbox_id:e,team_id:n,status:r,assignee_type:a,page:o,labels:i,conversation_type:s,sort_by:l,updated_within:c}})}filter(e){return axios.post(`${this.url}/filter`,e.queryData,{params:{page:e.page}})}search({q:e}){return axios.get(`${this.url}/search`,{params:{q:e,page:1}})}toggleStatus({conversationId:e,status:r,snoozedUntil:a=null}){return axios.post(`${this.url}/${e}/toggle_status`,{status:r,snoozed_until:a})}togglePriority({conversationId:e,priority:r}){return axios.post(`${this.url}/${e}/toggle_priority`,{priority:r})}assignAgent({conversationId:e,agentId:r}){return axios.post(`${this.url}/${e}/assignments?assignee_id=${r}`,{})}assignTeam({conversationId:e,teamId:r}){const a={team_id:r};return axios.post(`${this.url}/${e}/assignments`,a)}markMessageRead({id:e}){return axios.post(`${this.url}/${e}/update_last_seen`)}markMessagesUnread({id:e}){return axios.post(`${this.url}/${e}/unread`)}toggleTyping({conversationId:e,status:r,isPrivate:a}){return axios.post(`${this.url}/${e}/toggle_typing_status`,{typing_status:r,is_private:a})}mute(e){return axios.post(`${this.url}/${e}/mute`)}unmute(e){return axios.post(`${this.url}/${e}/unmute`)}meta({inboxId:e,status:r,assigneeType:a,labels:o,teamId:i,conversationType:n}){return axios.get(`${this.url}/meta`,{params:{inbox_id:e,status:r,assignee_type:a,labels:o,team_id:i,conversation_type:n}})}sendEmailTranscript({conversationId:e,email:r}){return axios.post(`${this.url}/${e}/transcript`,{email:r})}updateCustomAttributes({conversationId:e,customAttributes:r}){return axios.post(`${this.url}/${e}/custom_attributes`,{custom_attributes:r})}fetchParticipants(e){return axios.get(`${this.url}/${e}/participants`)}updateParticipants({conversationId:e,userIds:r}){return axios.patch(`${this.url}/${e}/participants`,{user_ids:r})}getAllAttachments(e){return axios.get(`${this.url}/${e}/attachments`)}getInboxAssistant(e){return axios.get(`${this.url}/${e}/inbox_assistant`)}delete(e){return axios.delete(`${this.url}/${e}`)}}const ar=new Yze,_ze=({message:t,isPrivate:e,contentAttributes:r,echoId:a,files:o,ccEmails:i="",bccEmails:n="",toEmails:s="",templateParams:l})=>{let c;return o&&o.length!==0?(c=new FormData,t&&c.append("content",t),o.forEach(u=>{c.append("attachments[]",u)}),c.append("private",e),c.append("echo_id",a),c.append("cc_emails",i),c.append("bcc_emails",n),s&&c.append("to_emails",s),r&&c.append("content_attributes",JSON.stringify(r))):c={content:t,private:e,echo_id:a,content_attributes:r,cc_emails:i,bcc_emails:n,to_emails:s,template_params:l},c};class $ze extends Fe{constructor(){super("conversations",{accountScoped:!0})}create({conversationId:e,message:r,private:a,contentAttributes:o,echo_id:i,files:n,ccEmails:s="",bccEmails:l="",toEmails:c="",templateParams:u}){return axios({method:"post",url:`${this.url}/${e}/messages`,data:_ze({message:r,isPrivate:a,contentAttributes:o,echoId:i,files:n,ccEmails:s,bccEmails:l,toEmails:c,templateParams:u})})}delete(e,r){return axios.delete(`${this.url}/${e}/messages/${r}`)}retry(e,r){return axios.post(`${this.url}/${e}/messages/${r}/retry`)}getPreviousMessages({conversationId:e,after:r,before:a}){const o={before:a};return r&&Number(r)!==Number(a)&&(o.after=r),axios.get(`${this.url}/${e}/messages`,{params:o})}translateMessage(e,r,a){return axios.post(`${this.url}/${e}/messages/${r}/translate`,{target_language:a})}}const yl=new $ze,eqe=({dispatch:t,filter:e,page:r,markEndReached:a})=>{t("conversationPage/setCurrentPage",{filter:e,page:r},{root:!0}),a&&t("conversationPage/setEndReached",{filter:e},{root:!0})},tqe=(t,e)=>{t(`contacts/${p.SET_CONTACTS}`,e.map(r=>r.meta.sender))},fk=({route:{name:t}})=>["conversation_mentions","conversation_through_mentions"].includes(t),wk=({route:{name:t}})=>["conversation_unattended","conversation_through_unattended"].includes(t),rqe=({route:{name:t}})=>["folder_conversations","conversations_through_folders"].includes(t),vk=(t,e,r,a)=>{const{payload:o,meta:i}=r;t.commit(p.SET_ALL_CONVERSATION,o),t.dispatch("conversationStats/set",i),t.dispatch("conversationLabels/setBulkConversationLabels",o),t.commit(p.CLEAR_LIST_LOADING_STATUS),tqe(t.commit,o),eqe({dispatch:t.dispatch,filter:a,page:e.page,markEndReached:!o.length})},aqe={markMessagesRead:async({commit:t},e)=>{try{const{data:{id:r,agent_last_seen_at:a}}=await ar.markMessageRead(e);setTimeout(()=>t(p.UPDATE_MESSAGE_UNREAD_COUNT,{id:r,lastSeen:a}),4e3)}catch{}},markMessagesUnread:async({commit:t},{id:e})=>{try{const{data:{agent_last_seen_at:r,unread_count:a}}=await ar.markMessagesUnread({id:e});t(p.UPDATE_MESSAGE_UNREAD_COUNT,{id:e,lastSeen:r,unreadCount:a})}catch(r){Me(r)}}},oqe={async translateMessage(t,{conversationId:e,messageId:r,targetLanguage:a}){try{await yl.translateMessage(e,r,a)}catch{}}},iqe=t=>{const{content_attributes:e,status:r}=t,a=(e==null?void 0:e.external_error)??"";return r===fn.FAILED&&a!==""},nqe={getConversation:async({commit:t},e)=>{try{const r=await ar.show(e);t(p.UPDATE_CONVERSATION,r.data),t(`contacts/${p.SET_CONTACT_ITEM}`,r.data.meta.sender)}catch{}},fetchAllConversations:async({commit:t,state:e,dispatch:r})=>{t(p.SET_LIST_LOADING_STATUS);try{const a=e.conversationFilters,{data:{data:o}}=await ar.get(a);vk({commit:t,dispatch:r},a,o,a.assigneeType)}catch{}},fetchFilteredConversations:async({commit:t,dispatch:e},r)=>{t(p.SET_LIST_LOADING_STATUS);try{const{data:a}=await ar.filter(r);vk({commit:t,dispatch:e},r,a,"appliedFilters")}catch{}},emptyAllConversations({commit:t}){t(p.EMPTY_ALL_CONVERSATION)},clearSelectedState({commit:t}){t(p.CLEAR_CURRENT_CHAT_WINDOW)},fetchPreviousMessages:async({commit:t},e)=>{try{const{data:{meta:r,payload:a}}=await yl.getPreviousMessages(e);t(`conversationMetadata/${p.SET_CONVERSATION_METADATA}`,{id:e.conversationId,data:r}),t(p.SET_PREVIOUS_CONVERSATIONS,{id:e.conversationId,data:a}),a.length||t(p.SET_ALL_MESSAGES_LOADED)}catch{}},fetchAllAttachments:async({commit:t},e)=>{let r=[];try{const{data:a}=await ar.getAllAttachments(e);r=a.payload}catch(a){tg("Conversation",{id:e}),Rc(a)}finally{t(p.SET_ALL_ATTACHMENTS,{id:e,data:r})}},syncActiveConversationMessages:async({commit:t,state:e,dispatch:r},{conversationId:a})=>{const{allConversations:o,syncConversationsMessages:i}=e,n=i[a],s=o.find(l=>l.id===a);if(s)try{const{messages:l}=s,{data:{meta:c,payload:u}}=await yl.getPreviousMessages({conversationId:a,after:n});t(`conversationMetadata/${p.SET_CONVERSATION_METADATA}`,{id:a,data:c});const d=u.filter(h=>!l.find(m=>m.id===h.id));s.messages.push(...d);const g=s.messages.sort((h,m)=>new Date(h.created_at)-new Date(m.created_at));t(p.SET_MISSING_MESSAGES,{id:a,data:g}),t(p.SET_LAST_MESSAGE_ID_IN_SYNC_CONVERSATION,{conversationId:a,messageId:null}),r("markMessagesRead",{id:a},{root:!0})}catch{}},setConversationLastMessageId:async({commit:t,state:e},{conversationId:r})=>{const{allConversations:a}=e,o=a.find(s=>s.id===r);if(!o)return;const{messages:i}=o,n=i.last();n&&t(p.SET_LAST_MESSAGE_ID_IN_SYNC_CONVERSATION,{conversationId:r,messageId:n.id})},async setActiveChat({commit:t,dispatch:e},{data:r,after:a}){if(t(p.SET_CURRENT_CHAT_WINDOW,r),t(p.CLEAR_ALL_MESSAGES_LOADED),r.dataFetched===void 0)try{await e("fetchPreviousMessages",{after:a,before:r.messages[0].id,conversationId:r.id}),r.dataFetched=!0}catch{}},assignAgent:async({dispatch:t},{conversationId:e,agentId:r})=>{try{const a=await ar.assignAgent({conversationId:e,agentId:r});t("setCurrentChatAssignee",a.data)}catch{}},setCurrentChatAssignee({commit:t},e){t(p.ASSIGN_AGENT,e)},assignTeam:async({dispatch:t},{conversationId:e,teamId:r})=>{try{const a=await ar.assignTeam({conversationId:e,teamId:r});t("setCurrentChatTeam",{team:a.data,conversationId:e})}catch{}},setCurrentChatTeam({commit:t},{team:e,conversationId:r}){t(p.ASSIGN_TEAM,{team:e,conversationId:r})},toggleStatus:async({commit:t},{conversationId:e,status:r,snoozedUntil:a=null})=>{try{const{data:{payload:{current_status:o,snoozed_until:i}={}}={}}=await ar.toggleStatus({conversationId:e,status:r,snoozedUntil:a});t(p.CHANGE_CONVERSATION_STATUS,{conversationId:e,status:o,snoozedUntil:i})}catch{}},createPendingMessageAndSend:async({dispatch:t},e)=>{const r=mBe(e);t("sendMessageWithData",r)},sendMessageWithData:async({commit:t},e)=>{const{conversation_id:r,id:a}=e;try{t(p.ADD_MESSAGE,{...e,status:fn.PROGRESS});const o=iqe(e)?await yl.retry(r,a):await yl.create(e);t(p.ADD_MESSAGE,{...o.data,status:fn.SENT}),t(p.ADD_CONVERSATION_ATTACHMENTS,{...o.data,status:fn.SENT})}catch(o){const i=o.response?o.response.data.error:void 0;throw t(p.ADD_MESSAGE,{...e,meta:{error:i},status:fn.FAILED}),o}},addMessage({commit:t},e){t(p.ADD_MESSAGE,e),e.message_type===nc.INCOMING&&(t(p.SET_CONVERSATION_CAN_REPLY,{conversationId:e.conversation_id,canReply:!0}),t(p.ADD_CONVERSATION_ATTACHMENTS,e))},updateMessage({commit:t},e){t(p.ADD_MESSAGE,e)},deleteMessage:async function({commit:e},{conversationId:r,messageId:a}){try{const{data:o}=await yl.delete(r,a);e(p.ADD_MESSAGE,o),e(p.DELETE_CONVERSATION_ATTACHMENTS,o)}catch(o){throw new Error(o)}},deleteConversation:async({commit:t,dispatch:e},r)=>{try{await ar.delete(r),t(p.DELETE_CONVERSATION,r),e("conversationStats/get",{},{root:!0})}catch(a){throw new Error(a)}},addConversation({commit:t,state:e,dispatch:r,rootState:a},o){const{currentInbox:i,appliedFilters:n}=e,{inbox_id:s,meta:{sender:l}}=o,c=!!n.length,u=!i||Number(i)===s;!c&&!rqe(a)&&!fk(a)&&!wk(a)&&u&&(t(p.ADD_CONVERSATION,o),r("contacts/setContact",l))},addMentions({dispatch:t,rootState:e},r){fk(e)&&t("updateConversation",r)},addUnattended({dispatch:t,rootState:e},r){wk(e)&&t("updateConversation",r)},updateConversation({commit:t,dispatch:e},r){const{meta:{sender:a}}=r;t(p.UPDATE_CONVERSATION,r),e("conversationLabels/setConversationLabel",{id:r.id,data:r.labels}),e("contacts/setContact",a)},updateConversationLastActivity({commit:t},{conversationId:e,lastActivityAt:r}){t(p.UPDATE_CONVERSATION_LAST_ACTIVITY,{lastActivityAt:r,conversationId:e})},setChatStatusFilter({commit:t},e){t(p.CHANGE_CHAT_STATUS_FILTER,e)},setChatSortFilter({commit:t},e){t(p.CHANGE_CHAT_SORT_FILTER,e)},updateAssignee({commit:t},e){t(p.UPDATE_ASSIGNEE,e)},updateConversationContact({commit:t},e){e.id&&t(`contacts/${p.SET_CONTACT_ITEM}`,e),t(p.UPDATE_CONVERSATION_CONTACT,e)},setActiveInbox({commit:t},e){t(p.SET_ACTIVE_INBOX,e)},muteConversation:async({commit:t},e)=>{try{await ar.mute(e),t(p.MUTE_CONVERSATION)}catch{}},unmuteConversation:async({commit:t},e)=>{try{await ar.unmute(e),t(p.UNMUTE_CONVERSATION)}catch{}},sendEmailTranscript:async(t,{conversationId:e,email:r})=>{try{await ar.sendEmailTranscript({conversationId:e,email:r})}catch(a){throw new Error(a)}},updateCustomAttributes:async({commit:t},{conversationId:e,customAttributes:r})=>{try{const a=await ar.updateCustomAttributes({conversationId:e,customAttributes:r}),{custom_attributes:o}=a.data;t(p.UPDATE_CONVERSATION_CUSTOM_ATTRIBUTES,o)}catch{}},setConversationFilters({commit:t},e){t(p.SET_CONVERSATION_FILTERS,e)},clearConversationFilters({commit:t}){t(p.CLEAR_CONVERSATION_FILTERS)},setChatListFilters({commit:t},e){t(p.SET_CHAT_LIST_FILTERS,e)},updateChatListFilters({commit:t},e){t(p.UPDATE_CHAT_LIST_FILTERS,e)},assignPriority:async({dispatch:t},{conversationId:e,priority:r})=>{try{await ar.togglePriority({conversationId:e,priority:r}),t("setCurrentChatPriority",{priority:r,conversationId:e})}catch{}},setCurrentChatPriority({commit:t},{priority:e,conversationId:r}){t(p.ASSIGN_PRIORITY,{priority:e,conversationId:r})},setContextMenuChatId({commit:t},e){t(p.SET_CONTEXT_MENU_CHAT_ID,e)},getInboxCaptainAssistantById:async({commit:t},e)=>{try{const r=await ar.getInboxAssistant(e);t(p.SET_INBOX_CAPTAIN_ASSISTANT,r.data)}catch{}},...aqe,...oqe},sqe={allConversations:[],attachments:{},listLoadingStatus:!0,chatStatusFilter:oc.STATUS_TYPE.OPEN,chatSortFilter:oc.SORT_BY_TYPE.LATEST,currentInbox:null,selectedChatId:null,appliedFilters:[],contextMenuChatId:null,conversationParticipants:[],conversationLastSeen:null,syncConversationsMessages:{},conversationFilters:{},copilotAssistant:{}},lqe={[p.SET_ALL_CONVERSATION](t,e){const r=[...t.allConversations];e.forEach(a=>{const o=r.findIndex(i=>i.id===a.id);if(o<0)r.push(a);else if(a.id!==t.selectedChatId)r[o]=a;else{const i=r[o];r[o]={...a,allMessagesLoaded:i.allMessagesLoaded,messages:i.messages,dataFetched:i.dataFetched}}}),t.allConversations=r},[p.EMPTY_ALL_CONVERSATION](t){t.allConversations=[],t.selectedChatId=null},[p.SET_ALL_MESSAGES_LOADED](t){const[e]=Ti(t);e.allMessagesLoaded=!0},[p.CLEAR_ALL_MESSAGES_LOADED](t){const[e]=Ti(t);e.allMessagesLoaded=!1},[p.CLEAR_CURRENT_CHAT_WINDOW](t){t.selectedChatId=null},[p.SET_PREVIOUS_CONVERSATIONS](t,{id:e,data:r}){if(r.length){const[a]=t.allConversations.filter(o=>o.id===e);a.messages.unshift(...r)}},[p.SET_ALL_ATTACHMENTS](t,{id:e,data:r}){t.attachments[e]=[...r]},[p.SET_MISSING_MESSAGES](t,{id:e,data:r}){const[a]=t.allConversations.filter(o=>o.id===e);a&&(a.messages=r)},[p.SET_CURRENT_CHAT_WINDOW](t,e){e&&(t.selectedChatId=e.id)},[p.ASSIGN_AGENT](t,e){const[r]=Ti(t);r.meta.assignee=e},[p.ASSIGN_TEAM](t,{team:e,conversationId:r}){const[a]=t.allConversations.filter(o=>o.id===r);a.meta.team=e},[p.UPDATE_CONVERSATION_LAST_ACTIVITY](t,{lastActivityAt:e,conversationId:r}){const[a]=t.allConversations.filter(o=>o.id===r);a&&(a.last_activity_at=e)},[p.ASSIGN_PRIORITY](t,{priority:e,conversationId:r}){const[a]=t.allConversations.filter(o=>o.id===r);a.priority=e},[p.UPDATE_CONVERSATION_CUSTOM_ATTRIBUTES](t,e){const[r]=Ti(t);r.custom_attributes=e},[p.CHANGE_CONVERSATION_STATUS](t,{conversationId:e,status:r,snoozedUntil:a}){const o=tM.getConversationById(t)(e)||{};o.snoozed_until=a,o.status=r},[p.MUTE_CONVERSATION](t){const[e]=Ti(t);e.muted=!0},[p.UNMUTE_CONVERSATION](t){const[e]=Ti(t);e.muted=!1},[p.ADD_CONVERSATION_ATTACHMENTS](t,e){var i;if(e.status!==fn.SENT||!((i=e.attachments)!=null&&i.length))return;const r=e.conversation_id,a=t.attachments[r]||[],o=e.attachments.filter(n=>!a.some(s=>s.id===n.id));t.attachments[r]=[...a,...o]},[p.DELETE_CONVERSATION_ATTACHMENTS](t,e){if(e.status!==fn.SENT)return;const{conversation_id:r}=e,a=t.attachments[r]||[];a.length&&(t.attachments[r]=a.filter(o=>o.message_id!==e.id))},[p.ADD_MESSAGE]({allConversations:t,selectedChatId:e},r){const{conversation_id:a}=r,[o]=Ti({allConversations:t,selectedChatId:a});if(!o)return;const i=Dze(o,r);if(i!==-1)o.messages[i]=r;else{o.messages.push(r),o.timestamp=r.created_at;const{conversation:{unread_count:n=0}={}}=r;o.unread_count=n,e===a&&(yr.emit(Ri.FETCH_LABEL_SUGGESTIONS),yr.emit(Ri.SCROLL_TO_MESSAGE))}},[p.ADD_CONVERSATION](t,e){t.allConversations.push(e)},[p.DELETE_CONVERSATION](t,e){t.allConversations=t.allConversations.filter(r=>r.id!==e)},[p.UPDATE_CONVERSATION](t,e){const{allConversations:r}=t,a=r.findIndex(o=>o.id===e.id);if(a>-1){const o=r[a];if(e.updated_at<o.updated_at)return;const{messages:i,...n}=e;r[a]={...o,...n},t.selectedChatId===e.id&&(yr.emit(Ri.FETCH_LABEL_SUGGESTIONS),yr.emit(Ri.SCROLL_TO_MESSAGE))}else t.allConversations.push(e)},[p.SET_LIST_LOADING_STATUS](t){t.listLoadingStatus=!0},[p.CLEAR_LIST_LOADING_STATUS](t){t.listLoadingStatus=!1},[p.UPDATE_MESSAGE_UNREAD_COUNT](t,{id:e,lastSeen:r,unreadCount:a=0}){const[o]=t.allConversations.filter(i=>i.id===e);o&&(o.agent_last_seen_at=r,o.unread_count=a)},[p.CHANGE_CHAT_STATUS_FILTER](t,e){t.chatStatusFilter=e},[p.CHANGE_CHAT_SORT_FILTER](t,e){t.chatSortFilter=e},[p.UPDATE_ASSIGNEE](t,e){const[r]=t.allConversations.filter(a=>a.id===e.id);r.meta.assignee=e.assignee},[p.UPDATE_CONVERSATION_CONTACT](t,{conversationId:e,...r}){const[a]=t.allConversations.filter(o=>o.id===e);a&&(a.meta.sender=r)},[p.SET_ACTIVE_INBOX](t,e){t.currentInbox=e?parseInt(e,10):null},[p.SET_CONVERSATION_CAN_REPLY](t,{conversationId:e,canReply:r}){const[a]=t.allConversations.filter(o=>o.id===e);a&&(a.can_reply=r)},[p.CLEAR_CONTACT_CONVERSATIONS](t,e){const r=t.allConversations.filter(a=>a.meta.sender.id!==e);t.allConversations=r},[p.SET_CONVERSATION_FILTERS](t,e){t.appliedFilters=e},[p.CLEAR_CONVERSATION_FILTERS](t){t.appliedFilters=[]},[p.SET_LAST_MESSAGE_ID_IN_SYNC_CONVERSATION](t,{conversationId:e,messageId:r}){t.syncConversationsMessages[e]=r},[p.SET_CONTEXT_MENU_CHAT_ID](t,e){t.contextMenuChatId=e},[p.SET_CHAT_LIST_FILTERS](t,e){t.conversationFilters=e},[p.UPDATE_CHAT_LIST_FILTERS](t,e){t.conversationFilters={...t.conversationFilters,...e}},[p.SET_INBOX_CAPTAIN_ASSISTANT](t,e){t.copilotAssistant=e.assistant}},cqe={state:sqe,getters:tM,actions:nqe,mutations:lqe};class uqe extends Fe{constructor(){super("search",{accountScoped:!0})}get({q:e}){return axios.get(this.url,{params:{q:e}})}contacts({q:e,page:r=1}){return axios.get(`${this.url}/contacts`,{params:{q:e,page:r}})}conversations({q:e,page:r=1}){return axios.get(`${this.url}/conversations`,{params:{q:e,page:r}})}messages({q:e,page:r=1}){return axios.get(`${this.url}/messages`,{params:{q:e,page:r}})}articles({q:e,page:r=1}){return axios.get(`${this.url}/articles`,{params:{q:e,page:r}})}}const r1=new uqe,dqe={records:[],contactRecords:[],conversationRecords:[],messageRecords:[],articleRecords:[],uiFlags:{isFetching:!1,isSearchCompleted:!1,contact:{isFetching:!1},conversation:{isFetching:!1},message:{isFetching:!1},article:{isFetching:!1}}},gqe={getConversations(t){return t.records},getContactRecords(t){return t.contactRecords},getConversationRecords(t){return t.conversationRecords},getMessageRecords(t){return t.messageRecords},getArticleRecords(t){return t.articleRecords},getUIFlags(t){return t.uiFlags}},hqe={async get({commit:t},{q:e}){if(t(p.SEARCH_CONVERSATIONS_SET,[]),!!e){t(p.SEARCH_CONVERSATIONS_SET_UI_FLAG,{isFetching:!0});try{const{data:{payload:r}}=await r1.get({q:e});t(p.SEARCH_CONVERSATIONS_SET,r)}catch{}finally{t(p.SEARCH_CONVERSATIONS_SET_UI_FLAG,{isFetching:!1})}}},async fullSearch({commit:t,dispatch:e},{q:r}){if(r){t(p.FULL_SEARCH_SET_UI_FLAG,{isFetching:!0,isSearchCompleted:!1});try{await Promise.all([e("contactSearch",{q:r}),e("conversationSearch",{q:r}),e("messageSearch",{q:r}),e("articleSearch",{q:r})])}catch{}finally{t(p.FULL_SEARCH_SET_UI_FLAG,{isFetching:!1,isSearchCompleted:!0})}}},async contactSearch({commit:t},{q:e,page:r=1}){t(p.CONTACT_SEARCH_SET_UI_FLAG,{isFetching:!0});try{const{data:a}=await r1.contacts({q:e,page:r});t(p.CONTACT_SEARCH_SET,a.payload.contacts)}catch{}finally{t(p.CONTACT_SEARCH_SET_UI_FLAG,{isFetching:!1})}},async conversationSearch({commit:t},{q:e,page:r=1}){t(p.CONVERSATION_SEARCH_SET_UI_FLAG,{isFetching:!0});try{const{data:a}=await r1.conversations({q:e,page:r});t(p.CONVERSATION_SEARCH_SET,a.payload.conversations)}catch{}finally{t(p.CONVERSATION_SEARCH_SET_UI_FLAG,{isFetching:!1})}},async messageSearch({commit:t},{q:e,page:r=1}){t(p.MESSAGE_SEARCH_SET_UI_FLAG,{isFetching:!0});try{const{data:a}=await r1.messages({q:e,page:r});t(p.MESSAGE_SEARCH_SET,a.payload.messages)}catch{}finally{t(p.MESSAGE_SEARCH_SET_UI_FLAG,{isFetching:!1})}},async articleSearch({commit:t},{q:e,page:r=1}){t(p.ARTICLE_SEARCH_SET_UI_FLAG,{isFetching:!0});try{const{data:a}=await r1.articles({q:e,page:r});t(p.ARTICLE_SEARCH_SET,a.payload.articles)}catch{}finally{t(p.ARTICLE_SEARCH_SET_UI_FLAG,{isFetching:!1})}},async clearSearchResults({commit:t}){t(p.CLEAR_SEARCH_RESULTS)}},mqe={[p.SEARCH_CONVERSATIONS_SET](t,e){t.records=e},[p.CONTACT_SEARCH_SET](t,e){t.contactRecords=[...t.contactRecords,...e]},[p.CONVERSATION_SEARCH_SET](t,e){t.conversationRecords=[...t.conversationRecords,...e]},[p.MESSAGE_SEARCH_SET](t,e){t.messageRecords=[...t.messageRecords,...e]},[p.ARTICLE_SEARCH_SET](t,e){t.articleRecords=[...t.articleRecords,...e]},[p.SEARCH_CONVERSATIONS_SET_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.FULL_SEARCH_SET_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.CONTACT_SEARCH_SET_UI_FLAG](t,e){t.uiFlags.contact={...t.uiFlags.contact,...e}},[p.CONVERSATION_SEARCH_SET_UI_FLAG](t,e){t.uiFlags.conversation={...t.uiFlags.conversation,...e}},[p.MESSAGE_SEARCH_SET_UI_FLAG](t,e){t.uiFlags.message={...t.uiFlags.message,...e}},[p.ARTICLE_SEARCH_SET_UI_FLAG](t,e){t.uiFlags.article={...t.uiFlags.article,...e}},[p.CLEAR_SEARCH_RESULTS](t){t.contactRecords=[],t.conversationRecords=[],t.messageRecords=[],t.articleRecords=[]}},pqe={namespaced:!0,state:dqe,getters:gqe,actions:hqe,mutations:mqe},fqe={mineCount:0,unAssignedCount:0,allCount:0},wqe={getStats:t=>t},rM=async(t,e)=>{try{const r=await ar.meta(e),{data:{meta:a}}=r;t(p.SET_CONV_TAB_META,a)}catch{}},vqe=Yu(rM,500,!1,1e3),bqe=Yu(rM,500,!1,5e3),Eqe={get:async({commit:t,state:e},r)=>{e.allCount>100?bqe(t,r):vqe(t,r)},set({commit:t},e){t(p.SET_CONV_TAB_META,e)}},kqe={[p.SET_CONV_TAB_META](t,{mine_count:e,unassigned_count:r,all_count:a}={}){t.mineCount=e,t.allCount=a,t.unAssignedCount=r,t.updatedOn=new Date}},Cqe={namespaced:!0,state:fqe,getters:wqe,actions:Eqe,mutations:kqe},Aqe={records:{}},xqe={getUserList:t=>e=>t.records[Number(e)]||[]},yqe={toggleTyping:async(t,{status:e,conversationId:r,isPrivate:a})=>{try{await ar.toggleTyping({status:e,conversationId:r,isPrivate:a})}catch{}},create:({commit:t},{conversationId:e,user:r})=>{t(p.ADD_USER_TYPING_TO_CONVERSATION,{conversationId:e,user:r})},destroy:({commit:t},{conversationId:e,user:r})=>{t(p.REMOVE_USER_TYPING_FROM_CONVERSATION,{conversationId:e,user:r})}},Tqe={[p.ADD_USER_TYPING_TO_CONVERSATION]:(t,{conversationId:e,user:r})=>{const a=t.records[e]||[];!!a.filter(i=>i.id===r.id&&i.type===r.type).length||(t.records={...t.records,[e]:[...a,r]})},[p.REMOVE_USER_TYPING_FROM_CONVERSATION]:(t,{conversationId:e,user:r})=>{const o=(t.records[e]||[]).filter(i=>i.id!==r.id||i.type!==r.type);t.records={...t.records,[e]:o}}},Sqe={namespaced:!0,state:Aqe,getters:xqe,actions:yqe,mutations:Tqe},Iqe={records:{},uiFlags:{isFetching:!1,isUpdating:!1}},Mqe={getUIFlags(t){return t.uiFlags},getByConversationId:t=>e=>t.records[e]},Oqe={show:async({commit:t},{conversationId:e})=>{t(p.SET_CONVERSATION_PARTICIPANTS_UI_FLAG,{isFetching:!0});try{const r=await ar.fetchParticipants(e);t(p.SET_CONVERSATION_PARTICIPANTS,{conversationId:e,data:r.data})}catch(r){Me(r)}finally{t(p.SET_CONVERSATION_PARTICIPANTS_UI_FLAG,{isFetching:!1})}},update:async({commit:t},{conversationId:e,userIds:r})=>{t(p.SET_CONVERSATION_PARTICIPANTS_UI_FLAG,{isUpdating:!0});try{const a=await ar.updateParticipants({conversationId:e,userIds:r});t(p.SET_CONVERSATION_PARTICIPANTS,{conversationId:e,data:a.data})}catch(a){Me(a)}finally{t(p.SET_CONVERSATION_PARTICIPANTS_UI_FLAG,{isUpdating:!1})}}},Lqe={[p.SET_CONVERSATION_PARTICIPANTS_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.SET_CONVERSATION_PARTICIPANTS](t,{data:e,conversationId:r}){t.records={...t.records,[r]:e}}},Rqe={namespaced:!0,state:Iqe,getters:Mqe,actions:Oqe,mutations:Lqe};class Nqe extends Fe{constructor(){super("csat_survey_responses",{accountScoped:!0})}get({page:e,from:r,to:a,user_ids:o,inbox_id:i,team_id:n,rating:s}={}){return axios.get(this.url,{params:{page:e,since:r,until:a,sort:"-created_at",user_ids:o,inbox_id:i,team_id:n,rating:s}})}download({from:e,to:r,user_ids:a,inbox_id:o,team_id:i,rating:n}={}){return axios.get(`${this.url}/download`,{params:{since:e,until:r,sort:"-created_at",user_ids:a,inbox_id:o,team_id:i,rating:n}})}getMetrics({from:e,to:r,user_ids:a,inbox_id:o,team_id:i,rating:n}={}){return axios.get(`${this.url}/metrics`,{params:{since:e,until:r,user_ids:a,inbox_id:o,team_id:i,rating:n}})}}const A3=new Nqe,ls=(t,e)=>{const r="data:text/csv;charset=utf-8;",a=new Blob([e],{type:r}),o=URL.createObjectURL(a),i=document.createElement("a");return i.setAttribute("download",t),i.setAttribute("href",o),i.click(),i},Dqe=({type:t,to:e,businessHours:r=!1})=>{let a=`${t}-report-${Gm(ty(e),"dd-MM-yyyy")}`;return r&&(a=`${a}-business-hours`),`${a}.csv`},ts=(t,e)=>(t*100/e).toFixed(2),Vqe={records:[],metrics:{totalResponseCount:0,ratingsCount:{1:0,2:0,3:0,4:0,5:0},totalSentMessagesCount:0},uiFlags:{isFetching:!1,isFetchingMetrics:!1}},Bqe={getCSATResponses(t){return t.records},getMetrics(t){return t.metrics},getUIFlags(t){return t.uiFlags},getSatisfactionScore(t){return t.metrics.totalResponseCount?ts(t.metrics.ratingsCount[4]+t.metrics.ratingsCount[5],t.metrics.totalResponseCount):0},getResponseRate(t){return t.metrics.totalSentMessagesCount?ts(t.metrics.totalResponseCount,t.metrics.totalSentMessagesCount):0},getRatingPercentage(t){return t.metrics.totalResponseCount?{1:ts(t.metrics.ratingsCount[1],t.metrics.totalResponseCount),2:ts(t.metrics.ratingsCount[2],t.metrics.totalResponseCount),3:ts(t.metrics.ratingsCount[3],t.metrics.totalResponseCount),4:ts(t.metrics.ratingsCount[4],t.metrics.totalResponseCount),5:ts(t.metrics.ratingsCount[5],t.metrics.totalResponseCount)}:{1:0,2:0,3:0,4:0,5:0}}},Pqe={get:async function({commit:e},r){e(p.SET_CSAT_RESPONSE_UI_FLAG,{isFetching:!0});try{const a=await A3.get(r);e(p.SET_CSAT_RESPONSE,a.data)}catch{}finally{e(p.SET_CSAT_RESPONSE_UI_FLAG,{isFetching:!1})}},getMetrics:async function({commit:e},r){e(p.SET_CSAT_RESPONSE_UI_FLAG,{isFetchingMetrics:!0});try{const a=await A3.getMetrics(r);e(p.SET_CSAT_RESPONSE_METRICS,a.data)}catch{}finally{e(p.SET_CSAT_RESPONSE_UI_FLAG,{isFetchingMetrics:!1})}},downloadCSATReports(t,e){return A3.download(e).then(r=>{ls(e.fileName,r.data),Fr.track(Cl.DOWNLOAD_REPORT,{reportType:"csat"})})}},Fqe={[p.SET_CSAT_RESPONSE_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.SET_CSAT_RESPONSE]:ur,[p.SET_CSAT_RESPONSE_METRICS](t,{total_count:e,ratings_count:r,total_sent_messages_count:a}){t.metrics.totalResponseCount=e||0,t.metrics.ratingsCount={1:r[1]||0,2:r[2]||0,3:r[3]||0,4:r[4]||0,5:r[5]||0},t.metrics.totalSentMessagesCount=a||0}},Uqe={namespaced:!0,state:Vqe,getters:Bqe,actions:Pqe,mutations:Fqe};class jqe extends Fe{constructor(){super("custom_roles",{accountScoped:!0})}}const F2=new jqe,zqe={records:[],uiFlags:{fetchingList:!1,creatingItem:!1,updatingItem:!1,deletingItem:!1}},qqe={getCustomRoles(t){return t.records},getUIFlags(t){return t.uiFlags}},Gqe={getCustomRole:async function({commit:e}){e(p.SET_CUSTOM_ROLE_UI_FLAG,{fetchingList:!0});try{const r=await F2.get();e(p.SET_CUSTOM_ROLE,r.data),e(p.SET_CUSTOM_ROLE_UI_FLAG,{fetchingList:!1})}catch{e(p.SET_CUSTOM_ROLE_UI_FLAG,{fetchingList:!1})}},createCustomRole:async function({commit:e},r){e(p.SET_CUSTOM_ROLE_UI_FLAG,{creatingItem:!0});try{const a=await F2.create(r);return e(p.ADD_CUSTOM_ROLE,a.data),e(p.SET_CUSTOM_ROLE_UI_FLAG,{creatingItem:!1}),a.data}catch(a){return e(p.SET_CUSTOM_ROLE_UI_FLAG,{creatingItem:!1}),Me(a)}},updateCustomRole:async function({commit:e},{id:r,...a}){e(p.SET_CUSTOM_ROLE_UI_FLAG,{updatingItem:!0});try{const o=await F2.update(r,a);return e(p.EDIT_CUSTOM_ROLE,o.data),e(p.SET_CUSTOM_ROLE_UI_FLAG,{updatingItem:!1}),o.data}catch(o){return e(p.SET_CUSTOM_ROLE_UI_FLAG,{updatingItem:!1}),Me(o)}},deleteCustomRole:async function({commit:e},r){e(p.SET_CUSTOM_ROLE_UI_FLAG,{deletingItem:!0});try{return await F2.delete(r),e(p.DELETE_CUSTOM_ROLE,r),e(p.SET_CUSTOM_ROLE_UI_FLAG,{deletingItem:!0}),r}catch(a){return e(p.SET_CUSTOM_ROLE_UI_FLAG,{deletingItem:!0}),Me(a)}}},Hqe={[p.SET_CUSTOM_ROLE_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.SET_CUSTOM_ROLE]:ur,[p.ADD_CUSTOM_ROLE]:Ma,[p.EDIT_CUSTOM_ROLE]:ua,[p.DELETE_CUSTOM_ROLE]:da},Kqe={namespaced:!0,state:zqe,getters:qqe,actions:Gqe,mutations:Hqe};class Wqe extends Fe{constructor(){super("custom_filters",{accountScoped:!0})}getCustomViewsByFilterType(e){return axios.get(`${this.url}?filter_type=${e}`)}deleteCustomViews(e,r){return axios.delete(`${this.url}/${e}?filter_type=${r}`)}}const U2=new Wqe,Ko={CONVERSATION:"conversation",CONTACT:"contact"},Dp={0:Ko.CONVERSATION,1:Ko.CONTACT,[Ko.CONVERSATION]:Ko.CONVERSATION,[Ko.CONTACT]:Ko.CONTACT},Zqe={[Ko.CONVERSATION]:{records:[]},[Ko.CONTACT]:{records:[]},uiFlags:{isFetching:!1,isCreating:!1,isDeleting:!1},activeConversationFolder:null},Jqe={getUIFlags(t){return t.uiFlags},getCustomViewsByFilterType:t=>e=>{const r=Dp[e];return t[r].records},getConversationCustomViews(t){return t[Ko.CONVERSATION].records},getContactCustomViews(t){return t[Ko.CONTACT].records},getActiveConversationFolder(t){return t.activeConversationFolder}},Qqe={get:async function({commit:e},r){e(p.SET_CUSTOM_VIEW_UI_FLAG,{isFetching:!0});try{const a=await U2.getCustomViewsByFilterType(r);e(p.SET_CUSTOM_VIEW,{data:a.data,filterType:r})}catch{}finally{e(p.SET_CUSTOM_VIEW_UI_FLAG,{isFetching:!1})}},create:async function({commit:e},r){var a,o;e(p.SET_CUSTOM_VIEW_UI_FLAG,{isCreating:!0});try{const i=await U2.create(r);return e(p.ADD_CUSTOM_VIEW,{data:i.data,filterType:Dp[r.filter_type]}),i}catch(i){const n=(o=(a=i==null?void 0:i.response)==null?void 0:a.data)==null?void 0:o.message;throw new Error(n)}finally{e(p.SET_CUSTOM_VIEW_UI_FLAG,{isCreating:!1})}},update:async function({commit:e},r){var a,o;e(p.SET_CUSTOM_VIEW_UI_FLAG,{isCreating:!0});try{const i=await U2.update(r.id,r);e(p.UPDATE_CUSTOM_VIEW,{data:i.data,filterType:Dp[r.filter_type]})}catch(i){const n=(o=(a=i==null?void 0:i.response)==null?void 0:a.data)==null?void 0:o.message;throw new Error(n)}finally{e(p.SET_CUSTOM_VIEW_UI_FLAG,{isCreating:!1})}},delete:async({commit:t},{id:e,filterType:r})=>{t(p.SET_CUSTOM_VIEW_UI_FLAG,{isDeleting:!0});try{await U2.deleteCustomViews(e,r),t(p.DELETE_CUSTOM_VIEW,{data:e,filterType:r})}catch(a){throw new Error(a)}finally{t(p.SET_CUSTOM_VIEW_UI_FLAG,{isDeleting:!1})}},setActiveConversationFolder({commit:t},e){t(p.SET_ACTIVE_CONVERSATION_FOLDER,e)}},Xqe={[p.SET_CUSTOM_VIEW_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.ADD_CUSTOM_VIEW]:(t,{data:e,filterType:r})=>{Ma(t[r],e)},[p.SET_CUSTOM_VIEW]:(t,{data:e,filterType:r})=>{ur(t[r],e)},[p.UPDATE_CUSTOM_VIEW]:(t,{data:e,filterType:r})=>{ua(t[r],e)},[p.DELETE_CUSTOM_VIEW]:(t,{data:e,filterType:r})=>{da(t[r],e)},[p.SET_ACTIVE_CONVERSATION_FOLDER](t,e){t.activeConversationFolder=e}},Yqe={namespaced:!0,actions:Qqe,state:Zqe,getters:Jqe,mutations:Xqe};class _qe extends Fe{constructor(){super("dashboard_apps",{accountScoped:!0})}}const j2=new _qe,$qe={records:[],uiFlags:{isFetching:!1,isCreating:!1,isDeleting:!1}},eGe={getUIFlags(t){return t.uiFlags},getRecords(t){return t.records}},tGe={get:async function({commit:e}){e(p.SET_DASHBOARD_APPS_UI_FLAG,{isFetching:!0});try{const r=await j2.get();e(p.SET_DASHBOARD_APPS,r.data)}catch{}finally{e(p.SET_DASHBOARD_APPS_UI_FLAG,{isFetching:!1})}},create:async function({commit:e},r){var a,o;e(p.SET_DASHBOARD_APPS_UI_FLAG,{isCreating:!0});try{const i=await j2.create(r);e(p.CREATE_DASHBOARD_APP,i.data)}catch(i){const n=(o=(a=i==null?void 0:i.response)==null?void 0:a.data)==null?void 0:o.message;throw new Error(n)}finally{e(p.SET_DASHBOARD_APPS_UI_FLAG,{isCreating:!1})}},update:async function({commit:e},{id:r,...a}){e(p.SET_DASHBOARD_APPS_UI_FLAG,{isUpdating:!0});try{const o=await j2.update(r,a);e(p.EDIT_DASHBOARD_APP,o.data)}catch(o){throw new Error(o)}finally{e(p.SET_DASHBOARD_APPS_UI_FLAG,{isUpdating:!1})}},delete:async function({commit:e},r){e(p.SET_DASHBOARD_APPS_UI_FLAG,{isDeleting:!0});try{await j2.delete(r),e(p.DELETE_DASHBOARD_APP,r)}catch(a){throw new Error(a)}finally{e(p.SET_DASHBOARD_APPS_UI_FLAG,{isDeleting:!1})}}},rGe={[p.SET_DASHBOARD_APPS_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.SET_DASHBOARD_APPS]:ur,[p.CREATE_DASHBOARD_APP]:Ma,[p.EDIT_DASHBOARD_APP]:ua,[p.DELETE_DASHBOARD_APP]:da},aGe={namespaced:!0,actions:tGe,state:$qe,getters:eGe,mutations:rGe},oGe={records:rc.get(ac.DRAFT_MESSAGES)||{},replyEditorMode:Cr.REPLY},iGe={get:t=>e=>t.records[e]||"",getReplyEditorMode:t=>t.replyEditorMode},nGe={set:async({commit:t},{key:e,message:r})=>{t(p.SET_DRAFT_MESSAGES,{key:e,message:r})},delete:({commit:t},{key:e})=>{t(p.SET_DRAFT_MESSAGES,{key:e})},setReplyEditorMode:({commit:t},{mode:e})=>{t(p.SET_REPLY_EDITOR_MODE,{mode:e})}},sGe={[p.SET_DRAFT_MESSAGES](t,{key:e,message:r}){t.records={...t.records,[e]:r},rc.set(ac.DRAFT_MESSAGES,t.records)},[p.REMOVE_DRAFT_MESSAGES](t,{key:e}){const{[e]:r,...a}=t.records;t.records=a,rc.set(ac.DRAFT_MESSAGES,t.records)},[p.SET_REPLY_EDITOR_MODE](t,{mode:e}){t.replyEditorMode=e}},lGe={namespaced:!0,state:oGe,getters:iGe,actions:nGe,mutations:sGe},{API_CHANNEL_NAME:cGe,API_CHANNEL_THUMBNAIL:uGe,APP_VERSION:dGe,AZURE_APP_ID:gGe,BRAND_NAME:hGe,CHATWOOT_INBOX_TOKEN:mGe,CREATE_NEW_ACCOUNT_FROM_DASHBOARD:pGe,DIRECT_UPLOADS_ENABLED:fGe,DISPLAY_MANIFEST:wGe,GIT_SHA:vGe,HCAPTCHA_SITE_KEY:bGe,INSTALLATION_NAME:EGe,LOGO_THUMBNAIL:kGe,LOGO:CGe,LOGO_DARK:AGe,PRIVACY_URL:xGe,TERMS_URL:yGe,WIDGET_BRAND_URL:TGe,DISABLE_USER_PROFILE_UPDATE:SGe,DEPLOYMENT_ENV:IGe}=window.globalConfig||{},MGe={apiChannelName:cGe,apiChannelThumbnail:uGe,appVersion:dGe,azureAppId:gGe,brandName:hGe,chatwootInboxToken:mGe,deploymentEnv:IGe,createNewAccountFromDashboard:pGe,directUploadsEnabled:fGe==="true",disableUserProfileUpdate:SGe==="true",displayManifest:wGe,gitSha:vGe,hCaptchaSiteKey:bGe,installationName:EGe,logo:CGe,logoDark:AGe,logoThumbnail:kGe,privacyURL:xGe,termsURL:yGe,widgetBrandURL:TGe},OGe={get:t=>t,isOnChatwootCloud:t=>t.deploymentEnv==="cloud",isACustomBrandedInstance:t=>t.installationName!=="Chatwoot",isAChatwootInstance:t=>t.installationName==="Chatwoot"},LGe={},RGe={},NGe={namespaced:!0,state:MGe,getters:OGe,actions:LGe,mutations:RGe};class DGe extends Fe{constructor(){super("assignable_agents",{accountScoped:!0})}get(e){return axios.get(this.url,{params:{inbox_ids:e}})}}const VGe=new DGe,BGe={records:{},uiFlags:{isFetching:!1}},V1={SET_INBOX_ASSIGNABLE_AGENTS_UI_FLAG:"SET_INBOX_ASSIGNABLE_AGENTS_UI_FLAG",SET_INBOX_ASSIGNABLE_AGENTS:"SET_INBOX_ASSIGNABLE_AGENTS"},PGe={getAssignableAgents:t=>e=>(t.records[e]||[]).filter(o=>o.confirmed),getUIFlags(t){return t.uiFlags}},FGe={async fetch({commit:t},e){t(V1.SET_INBOX_ASSIGNABLE_AGENTS_UI_FLAG,{isFetching:!0});try{const{data:{payload:r}}=await VGe.get(e);t(V1.SET_INBOX_ASSIGNABLE_AGENTS,{inboxId:e.join(","),members:r})}catch(r){throw new Error(r)}finally{t(V1.SET_INBOX_ASSIGNABLE_AGENTS_UI_FLAG,{isFetching:!1})}}},UGe={[V1.SET_INBOX_ASSIGNABLE_AGENTS_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[V1.SET_INBOX_ASSIGNABLE_AGENTS]:(t,{inboxId:e,members:r})=>{t.records={...t.records,[e]:r}}},jGe={namespaced:!0,state:BGe,getters:PGe,actions:FGe,mutations:UGe};class zGe extends Fe{constructor(){super("inboxes",{accountScoped:!0})}}const bk=new zGe;class qGe extends Fe{constructor(){super("facebook_indicators",{accountScoped:!0})}create(e){return axios.post(`${this.url.replace(this.resource,"")}callbacks/register_facebook_page`,e)}reauthorizeFacebookPage({omniauthToken:e,inboxId:r}){return axios.post(`${this.baseUrl()}/callbacks/reauthorize_page`,{omniauth_token:e,inbox_id:r})}}const Ek=new qGe;class GGe extends Fe{constructor(){super("channels/twilio_channel",{accountScoped:!0})}}const HGe=new GGe,kk=t=>{const e=new FormData,{channel:r={},...a}=t;Object.keys(a).forEach(n=>{e.append(n,a[n])});const{selectedFeatureFlags:o,...i}=r;return o&&(o.length?o.forEach(n=>{e.append("channel[selected_feature_flags][]",n)}):e.append("channel[selected_feature_flags][]","")),Object.keys(i).forEach(n=>{e.append(`channel[${n}]`,r[n])}),e},KGe={records:[],uiFlags:{isFetching:!1,isFetchingItem:!1,isCreating:!1,isUpdating:!1,isDeleting:!1,isUpdatingIMAP:!1,isUpdatingSMTP:!1}},WGe={getInboxes(t){return t.records},getWhatsAppTemplates:t=>e=>{const[r]=t.records.filter(s=>s.id===Number(e)),{message_templates:a,additional_attributes:o}=r||{},{message_templates:i}=o||{},n=a||i;return n instanceof Array?n.filter(s=>!s.components.some(l=>l.format==="IMAGE"||l.format==="VIDEO")):[]},getNewConversationInboxes(t){return t.records.filter(e=>{const{channel_type:r,phone_number:a=""}=e,o=r===Ue.EMAIL,i=r===Ue.TWILIO&&a.startsWith("whatsapp");return o||i})},getInbox:t=>e=>{const[r]=t.records.filter(a=>a.id===Number(e));return r||{}},getInboxById:t=>e=>{const[r]=t.records.filter(a=>a.id===Number(e));return mr(r||{},{deep:!0})},getUIFlags(t){return t.uiFlags},getWebsiteInboxes(t){return t.records.filter(e=>e.channel_type===Ue.WEB)},getTwilioInboxes(t){return t.records.filter(e=>e.channel_type===Ue.TWILIO)},getSMSInboxes(t){return t.records.filter(e=>e.channel_type===Ue.SMS||e.channel_type===Ue.TWILIO&&e.medium==="sms")},dialogFlowEnabledInboxes(t){return t.records.filter(e=>e.channel_type!==Ue.EMAIL)},getFacebookInboxByInstagramId:t=>e=>t.records.find(r=>r.instagram_id===e&&r.channel_type===Ue.FB),getInstagramInboxByInstagramId:t=>e=>t.records.find(r=>r.instagram_id===e&&r.channel_type===Ue.INSTAGRAM)},z2=t=>{Fr.track(s5.ADDED_AN_INBOX,{channelType:t})},ZGe={revalidate:async({commit:t},{newKey:e})=>{try{if(!await ho.validateCacheKey(e)){const a=await ho.refetchAndCommit(e);t(p.SET_INBOXES,a.data.payload)}}catch{}},get:async({commit:t})=>{t(p.SET_INBOXES_UI_FLAG,{isFetching:!0});try{const e=await ho.get(!0);t(p.SET_INBOXES_UI_FLAG,{isFetching:!1}),t(p.SET_INBOXES,e.data.payload)}catch{t(p.SET_INBOXES_UI_FLAG,{isFetching:!1})}},createChannel:async({commit:t},e)=>{var r,a;try{t(p.SET_INBOXES_UI_FLAG,{isCreating:!0});const o=await bk.create(e);t(p.ADD_INBOXES,o.data),t(p.SET_INBOXES_UI_FLAG,{isCreating:!1});const{channel:i={}}=e;return z2(i.type),o.data}catch(o){const i=(a=(r=o==null?void 0:o.response)==null?void 0:r.data)==null?void 0:a.message;throw t(p.SET_INBOXES_UI_FLAG,{isCreating:!1}),new Error(i)}},createWebsiteChannel:async({commit:t},e)=>{try{t(p.SET_INBOXES_UI_FLAG,{isCreating:!0});const r=await bk.create(kk(e));return t(p.ADD_INBOXES,r.data),t(p.SET_INBOXES_UI_FLAG,{isCreating:!1}),z2("website"),r.data}catch(r){return t(p.SET_INBOXES_UI_FLAG,{isCreating:!1}),Me(r)}},createTwilioChannel:async({commit:t},e)=>{try{t(p.SET_INBOXES_UI_FLAG,{isCreating:!0});const r=await HGe.create(e);return t(p.ADD_INBOXES,r.data),t(p.SET_INBOXES_UI_FLAG,{isCreating:!1}),z2("twilio"),r.data}catch(r){throw t(p.SET_INBOXES_UI_FLAG,{isCreating:!1}),r}},createFBChannel:async({commit:t},e)=>{try{t(p.SET_INBOXES_UI_FLAG,{isCreating:!0});const r=await Ek.create(e);return t(p.ADD_INBOXES,r.data),t(p.SET_INBOXES_UI_FLAG,{isCreating:!1}),z2("facebook"),r.data}catch(r){throw t(p.SET_INBOXES_UI_FLAG,{isCreating:!1}),new Error(r)}},updateInbox:async({commit:t},{id:e,formData:r=!0,...a})=>{t(p.SET_INBOXES_UI_FLAG,{isUpdating:!0});try{const o=await ho.update(e,r?kk(a):a);t(p.EDIT_INBOXES,o.data),t(p.SET_INBOXES_UI_FLAG,{isUpdating:!1})}catch(o){t(p.SET_INBOXES_UI_FLAG,{isUpdating:!1}),Me(o)}},updateInboxIMAP:async({commit:t},{id:e,...r})=>{t(p.SET_INBOXES_UI_FLAG,{isUpdatingIMAP:!0});try{const a=await ho.update(e,r);t(p.EDIT_INBOXES,a.data),t(p.SET_INBOXES_UI_FLAG,{isUpdatingIMAP:!1})}catch(a){t(p.SET_INBOXES_UI_FLAG,{isUpdatingIMAP:!1}),Me(a)}},updateInboxSMTP:async({commit:t},{id:e,...r})=>{t(p.SET_INBOXES_UI_FLAG,{isUpdatingSMTP:!0});try{const a=await ho.update(e,r);t(p.EDIT_INBOXES,a.data),t(p.SET_INBOXES_UI_FLAG,{isUpdatingSMTP:!1})}catch(a){t(p.SET_INBOXES_UI_FLAG,{isUpdatingSMTP:!1}),Me(a)}},delete:async({commit:t},e)=>{t(p.SET_INBOXES_UI_FLAG,{isDeleting:!0});try{await ho.delete(e),t(p.DELETE_INBOXES,e),t(p.SET_INBOXES_UI_FLAG,{isDeleting:!1})}catch(r){throw t(p.SET_INBOXES_UI_FLAG,{isDeleting:!1}),new Error(r)}},reauthorizeFacebookPage:async({commit:t},e)=>{try{const r=await Ek.reauthorizeFacebookPage(e);t(p.EDIT_INBOXES,r.data)}catch(r){throw new Error(r.message)}},deleteInboxAvatar:async(t,e)=>{try{await ho.deleteInboxAvatar(e)}catch(r){throw new Error(r)}}},JGe={[p.SET_INBOXES_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.SET_INBOXES]:ur,[p.SET_INBOXES_ITEM]:Kc,[p.ADD_INBOXES]:Ma,[p.EDIT_INBOXES]:ua,[p.DELETE_INBOXES]:da},QGe={namespaced:!0,state:KGe,getters:WGe,actions:ZGe,mutations:JGe};class XGe extends Fe{constructor(){super("inbox_members",{accountScoped:!0})}update({inboxId:e,agentList:r}){return axios.patch(this.url,{inbox_id:e,user_ids:r})}}const Ck=new XGe,YGe={get(t,{inboxId:e}){return Ck.show(e)},create(t,{inboxId:e,agentList:r}){return Ck.update({inboxId:e,agentList:r})}},_Ge={namespaced:!0,actions:YGe};class $Ge extends Fe{constructor(){super("integrations/apps",{accountScoped:!0})}connectSlack(e){return axios.post(`${this.baseUrl()}/integrations/slack`,{code:e})}updateSlack({referenceId:e}){return axios.patch(`${this.baseUrl()}/integrations/slack`,{reference_id:e})}listAllSlackChannels(){return axios.get(`${this.baseUrl()}/integrations/slack/list_all_channels`)}delete(e){return axios.delete(`${this.baseUrl()}/integrations/${e}`)}createHook(e){return axios.post(`${this.baseUrl()}/integrations/hooks`,e)}deleteHook(e){return axios.delete(`${this.baseUrl()}/integrations/hooks/${e}`)}connectShopify({shopDomain:e}){return axios.post(`${this.baseUrl()}/integrations/shopify/auth`,{shop_domain:e})}}const Xi=new $Ge,eHe={records:[],uiFlags:{isCreating:!1,isFetching:!1,isFetchingItem:!1,isUpdating:!1,isCreatingHook:!1,isDeletingHook:!1,isCreatingSlack:!1,isUpdatingSlack:!1,isFetchingSlackChannels:!1}},tHe={getAppIntegrations(t){return t.records},getIntegration:t=>(e,r={})=>{const[a]=t.records.filter(o=>o.id===e);return a||r},getUIFlags(t){return t.uiFlags}},rHe={get:async({commit:t})=>{t(p.SET_INTEGRATIONS_UI_FLAG,{isFetching:!0});try{const e=await Xi.get();t(p.SET_INTEGRATIONS,e.data.payload),t(p.SET_INTEGRATIONS_UI_FLAG,{isFetching:!1})}catch{t(p.SET_INTEGRATIONS_UI_FLAG,{isFetching:!1})}},connectSlack:async({commit:t},e)=>{t(p.SET_INTEGRATIONS_UI_FLAG,{isCreatingSlack:!0});try{const r=await Xi.connectSlack(e);t(p.ADD_INTEGRATION,r.data)}catch(r){Me(r)}finally{t(p.SET_INTEGRATIONS_UI_FLAG,{isCreatingSlack:!1})}},updateSlack:async({commit:t},e)=>{t(p.SET_INTEGRATIONS_UI_FLAG,{isUpdatingSlack:!0});try{const r=await Xi.updateSlack(e);t(p.ADD_INTEGRATION,r.data)}catch(r){Me(r)}finally{t(p.SET_INTEGRATIONS_UI_FLAG,{isUpdatingSlack:!1})}},listAllSlackChannels:async({commit:t})=>{t(p.SET_INTEGRATIONS_UI_FLAG,{isFetchingSlackChannels:!0});try{return(await Xi.listAllSlackChannels()).data}catch{t(p.SET_INTEGRATIONS_UI_FLAG,{isFetchingSlackChannels:!1})}return null},deleteIntegration:async({commit:t},e)=>{t(p.SET_INTEGRATIONS_UI_FLAG,{isDeleting:!0});try{await Xi.delete(e),t(p.DELETE_INTEGRATION,{id:e,enabled:!1}),t(p.SET_INTEGRATIONS_UI_FLAG,{isDeleting:!1})}catch{t(p.SET_INTEGRATIONS_UI_FLAG,{isDeleting:!1})}},showHook:async({commit:t},e)=>{t(p.SET_INTEGRATIONS_UI_FLAG,{isFetchingItem:!0});try{const r=await Xi.showHook(e);t(p.ADD_INTEGRATION_HOOKS,r.data),t(p.SET_INTEGRATIONS_UI_FLAG,{isFetchingItem:!1})}catch(r){throw t(p.SET_INTEGRATIONS_UI_FLAG,{isFetchingItem:!1}),new Error(r)}},createHook:async({commit:t},e)=>{t(p.SET_INTEGRATIONS_UI_FLAG,{isCreatingHook:!0});try{const r=await Xi.createHook(e);t(p.ADD_INTEGRATION_HOOKS,r.data),t(p.SET_INTEGRATIONS_UI_FLAG,{isCreatingHook:!1})}catch(r){throw t(p.SET_INTEGRATIONS_UI_FLAG,{isCreatingHook:!1}),new Error(r)}},deleteHook:async({commit:t},{appId:e,hookId:r})=>{t(p.SET_INTEGRATIONS_UI_FLAG,{isDeletingHook:!0});try{await Xi.deleteHook(r),t(p.DELETE_INTEGRATION_HOOKS,{appId:e,hookId:r}),t(p.SET_INTEGRATIONS_UI_FLAG,{isDeletingHook:!1})}catch(a){throw t(p.SET_INTEGRATIONS_UI_FLAG,{isDeletingHook:!1}),new Error(a)}}},aHe={[p.SET_INTEGRATIONS_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.SET_INTEGRATIONS]:ur,[p.ADD_INTEGRATION]:yp,[p.DELETE_INTEGRATION]:yp,[p.ADD_INTEGRATION_HOOKS]:(t,e)=>{t.records=t.records.map(r=>r.id===e.app_id?{...r,hooks:[...r.hooks,e]}:r)},[p.DELETE_INTEGRATION_HOOKS]:(t,{appId:e,hookId:r})=>{t.records=t.records.map(a=>a.id===e?{...a,hooks:a.hooks.filter(o=>o.id!==r)}:a)}},oHe={namespaced:!0,state:eHe,getters:tHe,actions:rHe,mutations:aHe};class iHe extends aw{constructor(){super("labels",{accountScoped:!0})}get cacheModelName(){return"label"}}const fl=new iHe,nHe={records:[],uiFlags:{isFetching:!1,isFetchingItem:!1,isCreating:!1,isDeleting:!1}},sHe={getLabels(t){return t.records},getUIFlags(t){return t.uiFlags},getLabelsOnSidebar(t){return t.records.filter(e=>e.show_on_sidebar).sort((e,r)=>e.title.localeCompare(r.title))}},lHe={revalidate:async function({commit:e},{newKey:r}){try{if(!await fl.validateCacheKey(r)){const o=await fl.refetchAndCommit(r);e(p.SET_LABELS,o.data.payload)}}catch{}},get:async function({commit:e}){e(p.SET_LABEL_UI_FLAG,{isFetching:!0});try{const a=(await fl.get(!0)).data.payload.sort((o,i)=>o.title.localeCompare(i.title));e(p.SET_LABELS,a)}catch{}finally{e(p.SET_LABEL_UI_FLAG,{isFetching:!1})}},create:async function({commit:e},r){var a,o;e(p.SET_LABEL_UI_FLAG,{isCreating:!0});try{const i=await fl.create(r);Fr.track(Ah.CREATE),e(p.ADD_LABEL,i.data)}catch(i){const n=(o=(a=i==null?void 0:i.response)==null?void 0:a.data)==null?void 0:o.message;throw new Error(n)}finally{e(p.SET_LABEL_UI_FLAG,{isCreating:!1})}},update:async function({commit:e},{id:r,...a}){e(p.SET_LABEL_UI_FLAG,{isUpdating:!0});try{const o=await fl.update(r,a);Fr.track(Ah.UPDATE),e(p.EDIT_LABEL,o.data)}catch(o){throw new Error(o)}finally{e(p.SET_LABEL_UI_FLAG,{isUpdating:!1})}},delete:async function({commit:e},r){e(p.SET_LABEL_UI_FLAG,{isDeleting:!0});try{await fl.delete(r),Fr.track(Ah.DELETED),e(p.DELETE_LABEL,r)}catch(a){throw new Error(a)}finally{e(p.SET_LABEL_UI_FLAG,{isDeleting:!1})}}},cHe={[p.SET_LABEL_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.SET_LABELS]:ur,[p.ADD_LABEL]:Ma,[p.EDIT_LABEL]:ua,[p.DELETE_LABEL]:da},uHe={namespaced:!0,state:nHe,getters:sHe,actions:lHe,mutations:cHe};class dHe extends Fe{constructor(){super("macros",{accountScoped:!0})}executeMacro({macroId:e,conversationIds:r}){return axios.post(`${this.url}/${e}/execute`,{conversation_ids:r})}}const wl=new dHe,gHe={records:[],uiFlags:{isFetchingItem:!1,isFetching:!1,isCreating:!1,isDeleting:!1,isUpdating:!1,isExecuting:!1}},hHe={getMacros(t){return t.records},getMacro:t=>e=>t.records.find(r=>r.id===Number(e)),getUIFlags(t){return t.uiFlags}},mHe={get:async function({commit:e}){e(p.SET_MACROS_UI_FLAG,{isFetching:!0});try{const r=await wl.get();e(p.SET_MACROS,r.data.payload)}catch{}finally{e(p.SET_MACROS_UI_FLAG,{isFetching:!1})}},getSingleMacro:async function({commit:e},r){e(p.SET_MACROS_UI_FLAG,{isFetchingItem:!0});try{const a=await wl.show(r);e(p.ADD_MACRO,a.data.payload)}catch{}finally{e(p.SET_MACROS_UI_FLAG,{isFetchingItem:!1})}},create:async function({commit:e},r){e(p.SET_MACROS_UI_FLAG,{isCreating:!0});try{const a=await wl.create(r);e(p.ADD_MACRO,a.data.payload)}catch(a){Me(a)}finally{e(p.SET_MACROS_UI_FLAG,{isCreating:!1})}},execute:async function({commit:e},r){e(p.SET_MACROS_UI_FLAG,{isExecuting:!0});try{await wl.executeMacro(r)}catch(a){Me(a)}finally{e(p.SET_MACROS_UI_FLAG,{isExecuting:!1})}},update:async({commit:t},{id:e,...r})=>{t(p.SET_MACROS_UI_FLAG,{isUpdating:!0});try{const a=await wl.update(e,r);t(p.EDIT_MACRO,a.data.payload)}catch(a){Me(a)}finally{t(p.SET_MACROS_UI_FLAG,{isUpdating:!1})}},delete:async({commit:t},e)=>{t(p.SET_MACROS_UI_FLAG,{isDeleting:!0});try{await wl.delete(e),t(p.DELETE_MACRO,e)}catch(r){Me(r)}finally{t(p.SET_MACROS_UI_FLAG,{isDeleting:!1})}}},pHe={[p.SET_MACROS_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.ADD_MACRO]:Kc,[p.SET_MACROS]:ur,[p.EDIT_MACRO]:ua,[p.DELETE_MACRO]:da},fHe={namespaced:!0,actions:mHe,state:gHe,getters:hHe,mutations:pHe},wHe={newest:"desc",oldest:"asc"},vHe={newest:(t,e)=>e.created_at-t.created_at,oldest:(t,e)=>t.created_at-e.created_at},Ak=(t,e,r)=>{const a=wHe[r];return r==="newest"||r==="oldest"?vHe[r](t,e,a):0},bHe={getNotifications(t){return Object.values(t.records).sort((e,r)=>r.id-e.id)},getFilteredNotifications:t=>e=>{const r=e.sortOrder==="desc"?"newest":"oldest";return Object.values(t.records).sort((o,i)=>Ak(o,i,r))},getFilteredNotificationsV4:t=>e=>{const r=e.sortOrder==="desc"?"newest":"oldest",a=Object.values(t.records).sort((o,i)=>Ak(o,i,r));return mr(a,{deep:!0})},getNotificationById:t=>e=>t.records[e]||{},getUIFlags(t){return t.uiFlags},getNotification:t=>e=>t.records[e]||{},getMeta:t=>t.meta,getNotificationFilters(t){return t.notificationFilters},getHasUnreadNotifications:t=>t.meta.unreadCount>0};class EHe extends Fe{constructor(){super("notifications",{accountScoped:!0})}get({page:e,status:r,type:a,sortOrder:o}){const i=[r,a].filter(n=>!!n);return axios.get(this.url,{params:{page:e,sort_order:o,includes:i}})}getNotifications(e){return axios.get(`${this.url}/${e}/notifications`)}getUnreadCount(){return axios.get(`${this.url}/unread_count`)}read(e,r){return axios.post(`${this.url}/read_all`,{primary_actor_type:e,primary_actor_id:r})}unRead(e){return axios.post(`${this.url}/${e}/unread`)}readAll(){return axios.post(`${this.url}/read_all`)}delete(e){return axios.delete(`${this.url}/${e}`)}deleteAll({type:e="all"}){return axios.post(`${this.url}/destroy_all`,{type:e})}snooze({id:e,snoozedUntil:r=null}){return axios.post(`${this.url}/${e}/snooze`,{snoozed_until:r})}}const Bo=new EHe,kHe={get:async({commit:t},{page:e=1}={})=>{t(p.SET_NOTIFICATIONS_UI_FLAG,{isFetching:!0});try{const{data:{data:{payload:r,meta:a}}}=await Bo.get({page:e});t(p.CLEAR_NOTIFICATIONS),t(p.SET_NOTIFICATIONS,r),t(p.SET_NOTIFICATIONS_META,a),t(p.SET_NOTIFICATIONS_UI_FLAG,{isFetching:!1})}catch{t(p.SET_NOTIFICATIONS_UI_FLAG,{isFetching:!1})}},index:async({commit:t},{page:e=1,status:r,type:a,sortOrder:o}={})=>{t(p.SET_NOTIFICATIONS_UI_FLAG,{isFetching:!0});try{const{data:{data:{payload:i,meta:n}}}=await Bo.get({page:e,status:r,type:a,sortOrder:o});t(p.SET_NOTIFICATIONS,i),t(p.SET_NOTIFICATIONS_META,n),t(p.SET_NOTIFICATIONS_UI_FLAG,{isFetching:!1}),i.length<15&&t(p.SET_ALL_NOTIFICATIONS_LOADED)}catch{t(p.SET_NOTIFICATIONS_UI_FLAG,{isFetching:!1})}},unReadCount:async({commit:t}={})=>{t(p.SET_NOTIFICATIONS_UI_FLAG,{isUpdatingUnreadCount:!0});try{const{data:e}=await Bo.getUnreadCount();t(p.SET_NOTIFICATIONS_UNREAD_COUNT,e),t(p.SET_NOTIFICATIONS_UI_FLAG,{isUpdatingUnreadCount:!1})}catch{t(p.SET_NOTIFICATIONS_UI_FLAG,{isUpdatingUnreadCount:!1})}},read:async({commit:t},{id:e,primaryActorType:r,primaryActorId:a,unreadCount:o})=>{t(p.SET_NOTIFICATIONS_UI_FLAG,{isUpdating:!0});try{await Bo.read(r,a),t(p.SET_NOTIFICATIONS_UNREAD_COUNT,o-1),t(p.READ_NOTIFICATION,{id:e,read_at:new Date}),t(p.SET_NOTIFICATIONS_UI_FLAG,{isUpdating:!1})}catch{t(p.SET_NOTIFICATIONS_UI_FLAG,{isUpdating:!1})}},unread:async({commit:t},{id:e})=>{t(p.SET_NOTIFICATIONS_UI_FLAG,{isUpdating:!0});try{await Bo.unRead(e),t(p.READ_NOTIFICATION,{id:e,read_at:null}),t(p.SET_NOTIFICATIONS_UI_FLAG,{isUpdating:!1})}catch{t(p.SET_NOTIFICATIONS_UI_FLAG,{isUpdating:!1})}},readAll:async({commit:t})=>{t(p.SET_NOTIFICATIONS_UI_FLAG,{isUpdating:!0});try{await Bo.readAll(),t(p.SET_NOTIFICATIONS_UNREAD_COUNT,0),t(p.UPDATE_ALL_NOTIFICATIONS),t(p.SET_NOTIFICATIONS_UI_FLAG,{isUpdating:!1})}catch(e){throw t(p.SET_NOTIFICATIONS_UI_FLAG,{isUpdating:!1}),new Error(e)}},delete:async({commit:t},{notification:e,count:r,unreadCount:a})=>{t(p.SET_NOTIFICATIONS_UI_FLAG,{isDeleting:!0});try{await Bo.delete(e.id),t(p.SET_NOTIFICATIONS_UNREAD_COUNT,a-1),t(p.DELETE_NOTIFICATION,{notification:e,count:r,unreadCount:a}),t(p.SET_NOTIFICATIONS_UI_FLAG,{isDeleting:!1})}catch{t(p.SET_NOTIFICATIONS_UI_FLAG,{isDeleting:!1})}},deleteAllRead:async({commit:t})=>{t(p.SET_NOTIFICATIONS_UI_FLAG,{isDeleting:!0});try{await Bo.deleteAll({type:"read"}),t(p.DELETE_READ_NOTIFICATIONS),t(p.SET_NOTIFICATIONS_UI_FLAG,{isDeleting:!1})}catch{t(p.SET_NOTIFICATIONS_UI_FLAG,{isDeleting:!1})}},deleteAll:async({commit:t})=>{t(p.SET_NOTIFICATIONS_UI_FLAG,{isDeleting:!0});try{await Bo.deleteAll({type:"all"}),t(p.DELETE_ALL_NOTIFICATIONS),t(p.SET_NOTIFICATIONS_UI_FLAG,{isDeleting:!1})}catch{t(p.SET_NOTIFICATIONS_UI_FLAG,{isDeleting:!1})}},snooze:async({commit:t},{id:e,snoozedUntil:r})=>{t(p.SET_NOTIFICATIONS_UI_FLAG,{isUpdating:!0});try{const a=await Bo.snooze({id:e,snoozedUntil:r}),{data:{snoozed_until:o=null}}=a;t(p.SNOOZE_NOTIFICATION,{id:e,snoozed_until:o}),t(p.SET_NOTIFICATIONS_UI_FLAG,{isUpdating:!1})}catch{t(p.SET_NOTIFICATIONS_UI_FLAG,{isUpdating:!1})}},updateNotification:async({commit:t},e)=>{t(p.UPDATE_NOTIFICATION,e)},addNotification({commit:t},e){t(p.ADD_NOTIFICATION,e)},deleteNotification({commit:t},e){t(p.DELETE_NOTIFICATION,e)},clear({commit:t}){t(p.CLEAR_NOTIFICATIONS)},setNotificationFilters:({commit:t},e)=>{t(p.SET_NOTIFICATION_FILTERS,e)},updateNotificationFilters:({commit:t},e)=>{t(p.UPDATE_NOTIFICATION_FILTERS,e)}},CHe={[p.SET_NOTIFICATIONS_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.CLEAR_NOTIFICATIONS]:t=>{t.records={},t.uiFlags.isAllNotificationsLoaded=!1},[p.SET_NOTIFICATIONS_META]:(t,e)=>{const{count:r,current_page:a,unread_count:o}=e;t.meta={...t.meta,count:r,currentPage:a,unreadCount:o}},[p.SET_NOTIFICATIONS_UNREAD_COUNT]:(t,e)=>{t.meta.unreadCount=e<0?0:e},[p.SET_NOTIFICATIONS]:(t,e)=>{e.forEach(r=>{const a=Object.values(t.records).find(o=>o.primary_actor_id===r.primary_actor_id);a&&delete t.records[a.id],t.records[r.id]={...t.records[r.id]||{},...r}})},[p.READ_NOTIFICATION]:(t,{id:e,read_at:r})=>{t.records[e].read_at=r},[p.UPDATE_ALL_NOTIFICATIONS]:t=>{Object.values(t.records).forEach(e=>{t.records[e.id].read_at=!0})},[p.ADD_NOTIFICATION](t,e){const{notification:r,unread_count:a,count:o}=e;t.records[r.id]={...t.records[r.id]||{},...r},t.meta.unreadCount=a,t.meta.count=o},[p.UPDATE_NOTIFICATION](t,e){const{notification:r,unread_count:a,count:o}=e;t.records[r.id]={...t.records[r.id]||{},...r},t.meta.unreadCount=a,t.meta.count=o},[p.DELETE_NOTIFICATION](t,e){const{notification:r,unread_count:a,count:o}=e;delete t.records[r.id],t.meta.unreadCount=a,t.meta.count=o},[p.SET_ALL_NOTIFICATIONS_LOADED]:t=>{t.uiFlags.isAllNotificationsLoaded=!0},[p.DELETE_READ_NOTIFICATIONS]:t=>{Object.values(t.records).forEach(e=>{e.read_at&&delete t.records[e.id]})},[p.DELETE_ALL_NOTIFICATIONS]:t=>{t.records={}},[p.SNOOZE_NOTIFICATION]:(t,{id:e,snoozed_until:r})=>{t.records[e].snoozed_until=r},[p.SET_NOTIFICATION_FILTERS]:(t,e)=>{t.notificationFilters=e},[p.UPDATE_NOTIFICATION_FILTERS]:(t,e)=>{t.notificationFilters={...t.notificationFilters,...e}}},AHe={meta:{count:0,currentPage:1,unreadCount:0},records:{},uiFlags:{isFetching:!1,isFetchingItem:!1,isUpdating:!1,isDeleting:!1,isUpdatingUnreadCount:!1,isAllNotificationsLoaded:!1},notificationFilters:{}},xHe={namespaced:!0,state:AHe,getters:bHe,actions:kHe,mutations:CHe},yHe={uiFlagsIn:t=>e=>{const r=t.portals.uiFlags.byId[e];return r||{isFetching:!1,isUpdating:!1,isDeleting:!1}},isFetchingPortals:t=>t.uiFlags.isFetching,isCreatingPortal:t=>t.uiFlags.isCreating,isSwitchingPortal:t=>t.uiFlags.isSwitching,portalBySlug:(...t)=>e=>{const[r]=t;return r.portals.byId[e]},allPortals:(...t)=>{const[e,r]=t;return e.portals.allIds.map(o=>r.portalBySlug(o))},count:t=>t.portals.allIds.length||0,getMeta:t=>t.meta,isSwitching:t=>t.isSwitching},et={SET_UI_FLAG:"setUIFlag",ADD_PORTAL_ENTRY:"addPortalEntry",SET_PORTALS_META:"setPortalsMeta",ADD_MANY_PORTALS_ENTRY:"addManyPortalsEntry",ADD_PORTAL_ID:"addPortalId",CLEAR_PORTALS:"clearPortals",ADD_MANY_PORTALS_IDS:"addManyPortalsIds",UPDATE_PORTAL_ENTRY:"updatePortalEntry",REMOVE_PORTAL_ENTRY:"removePortalEntry",REMOVE_PORTAL_ID:"removePortalId",SET_HELP_PORTAL_UI_FLAG:"setHelpCenterUIFlag",SET_PORTAL_SWITCHING_FLAG:"setPortalSwitchingFlag"},THe={[et.SET_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[et.ADD_PORTAL_ENTRY](t,e){t.portals.byId={...t.portals.byId,[e.slug]:{...e}}},[et.ADD_MANY_PORTALS_ENTRY](t,e){const r={...t.portals.byId};e.forEach(a=>{r[a.slug]=a}),t.portals.byId=r},[et.CLEAR_PORTALS]:t=>{t.portals.byId={},t.portals.allIds=[],t.portals.uiFlags.byId={}},[et.SET_PORTALS_META]:(t,e)=>{const{all_articles_count:r=0,mine_articles_count:a=0,draft_articles_count:o=0,archived_articles_count:i=0}=e;t.meta={...t.meta,allArticlesCount:r,archivedArticlesCount:i,mineArticlesCount:a,draftArticlesCount:o}},[et.ADD_PORTAL_ID](t,e){t.portals.allIds.push(e)},[et.ADD_MANY_PORTALS_IDS](t,e){t.portals.allIds.push(...e)},[et.UPDATE_PORTAL_ENTRY](t,e){const r=e.slug;t.portals.allIds.includes(r)&&(t.portals.byId={...t.portals.byId,[r]:{...e}})},[et.REMOVE_PORTAL_ENTRY](t,e){if(!e)return;const{[e]:r,...a}=t.portals.byId;t.portals.byId=a},[et.REMOVE_PORTAL_ID](t,e){t.portals.allIds=t.portals.allIds.filter(r=>r!==e)},[et.SET_HELP_PORTAL_UI_FLAG](t,{portalSlug:e,uiFlags:r}){const a=t.portals.uiFlags.byId[e];t.portals.uiFlags.byId={...t.portals.uiFlags.byId,[e]:{...IHe,...a,...r}}},[et.SET_PORTAL_SWITCHING_FLAG](t,{isSwitching:e}){t.uiFlags.isSwitching=e}},vl=new ow,SHe={index:async({commit:t})=>{try{t(et.SET_UI_FLAG,{isFetching:!0});const{data:{payload:e}}=await vl.get();t(et.CLEAR_PORTALS);const r=e.map(a=>a.slug);t(et.ADD_MANY_PORTALS_ENTRY,e),t(et.ADD_MANY_PORTALS_IDS,r)}catch(e){Me(e)}finally{t(et.SET_UI_FLAG,{isFetching:!1})}},show:async({commit:t},{portalSlug:e,locale:r})=>{t(et.SET_UI_FLAG,{isFetchingItem:!0});try{const a=await vl.getPortal({portalSlug:e,locale:r}),{data:{meta:o}}=a;t(et.SET_PORTALS_META,o)}catch{}finally{t(et.SET_UI_FLAG,{isFetchingItem:!1})}},create:async({commit:t},e)=>{t(et.SET_UI_FLAG,{isCreating:!0});try{const{data:r}=await vl.create(e),{slug:a}=r;t(et.ADD_PORTAL_ENTRY,r),t(et.ADD_PORTAL_ID,a)}catch(r){Me(r)}finally{t(et.SET_UI_FLAG,{isCreating:!1})}},update:async({commit:t},{portalSlug:e,...r})=>{t(et.SET_HELP_PORTAL_UI_FLAG,{uiFlags:{isUpdating:!0},portalSlug:e});try{const{data:a}=await vl.updatePortal({portalSlug:e,portalObj:r});t(et.UPDATE_PORTAL_ENTRY,a)}catch(a){Me(a)}finally{t(et.SET_HELP_PORTAL_UI_FLAG,{uiFlags:{isUpdating:!1},portalSlug:e})}},delete:async({commit:t},{portalSlug:e})=>{t(et.SET_HELP_PORTAL_UI_FLAG,{uiFlags:{isDeleting:!0},portalSlug:e});try{await vl.delete(e),t(et.REMOVE_PORTAL_ENTRY,e),t(et.REMOVE_PORTAL_ID,e)}catch(r){Me(r)}finally{t(et.SET_HELP_PORTAL_UI_FLAG,{uiFlags:{isDeleting:!1},portalSlug:e})}},deleteLogo:async({commit:t},{portalSlug:e})=>{t(et.SET_HELP_PORTAL_UI_FLAG,{uiFlags:{isUpdating:!0},portalSlug:e});try{await vl.deleteLogo(e)}catch(r){Me(r)}finally{t(et.SET_HELP_PORTAL_UI_FLAG,{uiFlags:{isUpdating:!1},portalSlug:e})}},updatePortal:async({commit:t},e)=>{t(et.UPDATE_PORTAL_ENTRY,e)},switchPortal:async({commit:t},e)=>{t(et.SET_PORTAL_SWITCHING_FLAG,{isSwitching:e})}},IHe={isFetching:!1,isUpdating:!1,isDeleting:!1},MHe={meta:{allArticlesCount:0,mineArticlesCount:0,draftArticlesCount:0,archivedArticlesCount:0},portals:{byId:{},allIds:[],uiFlags:{byId:{}},meta:{byId:{}}},uiFlags:{allFetched:!1,isFetching:!1,isSwitching:!1}},OHe={namespaced:!0,state:MHe,getters:yHe,actions:SHe,mutations:THe},dn={FAILED:"failed",FETCHING:"fetching",FINISHED:"finished"},x3=()=>-new Date().getTimezoneOffset()/60;class LHe extends Fe{constructor(){super("reports",{accountScoped:!0,apiVersion:"v2"})}getReports({metric:e,from:r,to:a,type:o="account",id:i,groupBy:n,businessHours:s}){return axios.get(`${this.url}`,{params:{metric:e,since:r,until:a,type:o,id:i,group_by:n,business_hours:s,timezone_offset:x3()}})}getSummary(e,r,a="account",o,i,n){return axios.get(`${this.url}/summary`,{params:{since:e,until:r,type:a,id:o,group_by:i,business_hours:n,timezone_offset:x3()}})}getConversationMetric(e="account",r=1){return axios.get(`${this.url}/conversations`,{params:{type:e,page:r}})}getAgentReports({from:e,to:r,businessHours:a}){return axios.get(`${this.url}/agents`,{params:{since:e,until:r,business_hours:a}})}getConversationTrafficCSV({daysBefore:e=6}={}){return axios.get(`${this.url}/conversation_traffic`,{params:{timezone_offset:x3(),days_before:e}})}getLabelReports({from:e,to:r,businessHours:a}){return axios.get(`${this.url}/labels`,{params:{since:e,until:r,business_hours:a}})}getInboxReports({from:e,to:r,businessHours:a}){return axios.get(`${this.url}/inboxes`,{params:{since:e,until:r,business_hours:a}})}getTeamReports({from:e,to:r,businessHours:a}){return axios.get(`${this.url}/teams`,{params:{since:e,until:r,business_hours:a}})}getBotMetrics({from:e,to:r}={}){return axios.get(`${this.url}/bot_metrics`,{params:{since:e,until:r}})}getBotSummary({from:e,to:r,groupBy:a,businessHours:o}={}){return axios.get(`${this.url}/bot_summary`,{params:{since:e,until:r,type:"account",group_by:a,business_hours:o}})}}const ki=new LHe,xk=(t,e,r)=>e===void 0&&r===void 0?t:t.filter(a=>{const{timestamp:o}=a,i=e===void 0||o-e>=0,n=r===void 0||r-o>0;return i&&n});class RHe extends Fe{constructor(){super("live_reports",{accountScoped:!0,apiVersion:"v2"})}getConversationMetric(e={}){return axios.get(`${this.url}/conversation_metrics`,{params:e})}getGroupedConversations({groupBy:e}={groupBy:"assignee_id"}){return axios.get(`${this.url}/grouped_conversation_metrics`,{params:{group_by:e}})}}const y3=new RHe,NHe={fetchingStatus:!1,accountSummaryFetchingStatus:dn.FINISHED,botSummaryFetchingStatus:dn.FINISHED,accountReport:{isFetching:{conversations_count:!1,incoming_messages_count:!1,outgoing_messages_count:!1,avg_first_response_time:!1,avg_resolution_time:!1,resolutions_count:!1,bot_resolutions_count:!1,bot_handoffs_count:!1,reply_time:!1},data:{conversations_count:[],incoming_messages_count:[],outgoing_messages_count:[],avg_first_response_time:[],avg_resolution_time:[],resolutions_count:[],bot_resolutions_count:[],bot_handoffs_count:[],reply_time:[]}},accountSummary:{avg_first_response_time:0,avg_resolution_time:0,conversations_count:0,incoming_messages_count:0,outgoing_messages_count:0,reply_time:0,resolutions_count:0,bot_resolutions_count:0,bot_handoffs_count:0,previous:{}},botSummary:{bot_resolutions_count:0,bot_handoffs_count:0,previous:{}},overview:{uiFlags:{isFetchingAccountConversationMetric:!1,isFetchingAccountConversationsHeatmap:!1,isFetchingAgentConversationMetric:!1,isFetchingTeamConversationMetric:!1},accountConversationMetric:{},accountConversationHeatmap:[],agentConversationMetric:[],teamConversationMetric:[]}},DHe={getAccountReports(t){return t.accountReport},getAccountSummary(t){return t.accountSummary},getBotSummary(t){return t.botSummary},getAccountSummaryFetchingStatus(t){return t.accountSummaryFetchingStatus},getBotSummaryFetchingStatus(t){return t.botSummaryFetchingStatus},getAccountConversationMetric(t){return t.overview.accountConversationMetric},getAccountConversationHeatmapData(t){return t.overview.accountConversationHeatmap},getAgentConversationMetric(t){return t.overview.agentConversationMetric},getTeamConversationMetric(t){return t.overview.teamConversationMetric},getOverviewUIFlags(t){return t.overview.uiFlags}},VHe={fetchAccountReport({commit:t},e){const{metric:r}=e;t(p.TOGGLE_ACCOUNT_REPORT_LOADING,{metric:r,value:!0}),ki.getReports(e).then(a=>{let{data:o}=a;o=xk(o,e.from,e.to),t(p.SET_ACCOUNT_REPORTS,{metric:r,data:o}),t(p.TOGGLE_ACCOUNT_REPORT_LOADING,{metric:r,value:!1})})},fetchAccountConversationHeatmap({commit:t},e){t(p.TOGGLE_HEATMAP_LOADING,!0),ki.getReports({...e,groupBy:"hour"}).then(r=>{let{data:a}=r;a=xk(a,e.from,e.to),t(p.SET_HEATMAP_DATA,a),t(p.TOGGLE_HEATMAP_LOADING,!1)})},fetchAccountSummary({commit:t},e){t(p.SET_ACCOUNT_SUMMARY_STATUS,dn.FETCHING),ki.getSummary(e.from,e.to,e.type,e.id,e.groupBy,e.businessHours).then(r=>{t(p.SET_ACCOUNT_SUMMARY,r.data),t(p.SET_ACCOUNT_SUMMARY_STATUS,dn.FINISHED)}).catch(()=>{t(p.SET_ACCOUNT_SUMMARY_STATUS,dn.FAILED)})},fetchBotSummary({commit:t},e){t(p.SET_BOT_SUMMARY_STATUS,dn.FETCHING),ki.getBotSummary({from:e.from,to:e.to,groupBy:e.groupBy,businessHours:e.businessHours}).then(r=>{t(p.SET_BOT_SUMMARY,r.data),t(p.SET_BOT_SUMMARY_STATUS,dn.FINISHED)}).catch(()=>{t(p.SET_BOT_SUMMARY_STATUS,dn.FAILED)})},fetchAccountConversationMetric({commit:t},e={}){t(p.TOGGLE_ACCOUNT_CONVERSATION_METRIC_LOADING,!0),y3.getConversationMetric(e).then(r=>{t(p.SET_ACCOUNT_CONVERSATION_METRIC,r.data),t(p.TOGGLE_ACCOUNT_CONVERSATION_METRIC_LOADING,!1)}).catch(()=>{t(p.TOGGLE_ACCOUNT_CONVERSATION_METRIC_LOADING,!1)})},fetchAgentConversationMetric({commit:t}){t(p.TOGGLE_AGENT_CONVERSATION_METRIC_LOADING,!0),y3.getGroupedConversations({groupBy:"assignee_id"}).then(e=>{t(p.SET_AGENT_CONVERSATION_METRIC,e.data),t(p.TOGGLE_AGENT_CONVERSATION_METRIC_LOADING,!1)}).catch(()=>{t(p.TOGGLE_AGENT_CONVERSATION_METRIC_LOADING,!1)})},fetchTeamConversationMetric({commit:t}){t(p.TOGGLE_TEAM_CONVERSATION_METRIC_LOADING,!0),y3.getGroupedConversations({groupBy:"team_id"}).then(e=>{t(p.SET_TEAM_CONVERSATION_METRIC,e.data),t(p.TOGGLE_TEAM_CONVERSATION_METRIC_LOADING,!1)}).catch(()=>{t(p.TOGGLE_TEAM_CONVERSATION_METRIC_LOADING,!1)})},downloadAgentReports(t,e){return ki.getAgentReports(e).then(r=>{ls(e.fileName,r.data),Fr.track(Cl.DOWNLOAD_REPORT,{reportType:"agent",businessHours:e==null?void 0:e.businessHours})}).catch(r=>{console.error(r)})},downloadLabelReports(t,e){return ki.getLabelReports(e).then(r=>{ls(e.fileName,r.data),Fr.track(Cl.DOWNLOAD_REPORT,{reportType:"label",businessHours:e==null?void 0:e.businessHours})}).catch(r=>{console.error(r)})},downloadInboxReports(t,e){return ki.getInboxReports(e).then(r=>{ls(e.fileName,r.data),Fr.track(Cl.DOWNLOAD_REPORT,{reportType:"inbox",businessHours:e==null?void 0:e.businessHours})}).catch(r=>{console.error(r)})},downloadTeamReports(t,e){return ki.getTeamReports(e).then(r=>{ls(e.fileName,r.data),Fr.track(Cl.DOWNLOAD_REPORT,{reportType:"team",businessHours:e==null?void 0:e.businessHours})}).catch(r=>{console.error(r)})},downloadAccountConversationHeatmap(t,e){ki.getConversationTrafficCSV({daysBefore:e.daysBefore}).then(r=>{ls(Dqe({type:"Conversation traffic",to:e.to}),r.data),Fr.track(Cl.DOWNLOAD_REPORT,{reportType:"conversation_heatmap",businessHours:!1})}).catch(r=>{console.error(r)})}},BHe={[p.SET_ACCOUNT_REPORTS](t,{metric:e,data:r}){t.accountReport.data[e]=r},[p.SET_HEATMAP_DATA](t,e){t.overview.accountConversationHeatmap=e},[p.TOGGLE_ACCOUNT_REPORT_LOADING](t,{metric:e,value:r}){t.accountReport.isFetching[e]=r},[p.SET_BOT_SUMMARY_STATUS](t,e){t.botSummaryFetchingStatus=e},[p.SET_ACCOUNT_SUMMARY_STATUS](t,e){t.accountSummaryFetchingStatus=e},[p.TOGGLE_HEATMAP_LOADING](t,e){t.overview.uiFlags.isFetchingAccountConversationsHeatmap=e},[p.SET_ACCOUNT_SUMMARY](t,e){t.accountSummary=e},[p.SET_BOT_SUMMARY](t,e){t.botSummary=e},[p.SET_ACCOUNT_CONVERSATION_METRIC](t,e){t.overview.accountConversationMetric=e},[p.TOGGLE_ACCOUNT_CONVERSATION_METRIC_LOADING](t,e){t.overview.uiFlags.isFetchingAccountConversationMetric=e},[p.SET_AGENT_CONVERSATION_METRIC](t,e){t.overview.agentConversationMetric=e},[p.TOGGLE_AGENT_CONVERSATION_METRIC_LOADING](t,e){t.overview.uiFlags.isFetchingAgentConversationMetric=e},[p.SET_TEAM_CONVERSATION_METRIC](t,e){t.overview.teamConversationMetric=e},[p.TOGGLE_TEAM_CONVERSATION_METRIC_LOADING](t,e){t.overview.uiFlags.isFetchingTeamConversationMetric=e}},PHe={state:NHe,getters:DHe,actions:VHe,mutations:BHe};class FHe extends Fe{constructor(){super("sla_policies",{accountScoped:!0})}}const T3=new FHe,UHe={records:[],uiFlags:{isFetching:!1,isFetchingItem:!1,isCreating:!1,isDeleting:!1}},jHe={getSLA(t){return t.records},getUIFlags(t){return t.uiFlags}},zHe={get:async function({commit:e}){e(p.SET_SLA_UI_FLAG,{isFetching:!0});try{const r=await T3.get();e(p.SET_SLA,r.data.payload)}catch{}finally{e(p.SET_SLA_UI_FLAG,{isFetching:!1})}},create:async function({commit:e},r){e(p.SET_SLA_UI_FLAG,{isCreating:!0});try{const a=await T3.create(r);Fr.track(Z6.CREATE),e(p.ADD_SLA,a.data.payload)}catch(a){Me(a)}finally{e(p.SET_SLA_UI_FLAG,{isCreating:!1})}},delete:async function({commit:e},r){e(p.SET_SLA_UI_FLAG,{isDeleting:!0});try{await T3.delete(r),Fr.track(Z6.DELETED),e(p.DELETE_SLA,r)}catch(a){Me(a)}finally{e(p.SET_SLA_UI_FLAG,{isDeleting:!1})}}},qHe={[p.SET_SLA_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.SET_SLA]:ur,[p.ADD_SLA]:Ma,[p.DELETE_SLA]:da},GHe={namespaced:!0,state:UHe,getters:jHe,actions:zHe,mutations:qHe};class HHe extends Fe{constructor(){super("applied_slas",{accountScoped:!0})}get({from:e,to:r,assigned_agent_id:a,inbox_id:o,team_id:i,sla_policy_id:n,label_list:s,page:l}={}){return axios.get(this.url,{params:{since:e,until:r,assigned_agent_id:a,inbox_id:o,team_id:i,sla_policy_id:n,label_list:s,page:l}})}download({from:e,to:r,assigned_agent_id:a,inbox_id:o,team_id:i,sla_policy_id:n,label_list:s}={}){return axios.get(`${this.url}/download`,{params:{since:e,until:r,assigned_agent_id:a,inbox_id:o,team_id:i,label_list:s,sla_policy_id:n}})}getMetrics({from:e,to:r,assigned_agent_id:a,inbox_id:o,team_id:i,label_list:n,sla_policy_id:s}={}){return axios.get(`${this.url}/metrics`,{params:{since:e,until:r,assigned_agent_id:a,inbox_id:o,label_list:n,team_id:i,sla_policy_id:s}})}}const S3=new HHe,KHe={records:[],metrics:{numberOfConversations:0,numberOfSLAMisses:0,hitRate:"0%"},uiFlags:{isFetching:!1,isFetchingMetrics:!1},meta:{count:0,currentPage:1}},WHe={getAll(t){return t.records},getMeta(t){return t.meta},getMetrics(t){return t.metrics},getUIFlags(t){return t.uiFlags}},ZHe={get:async function({commit:e},r){e(p.SET_SLA_REPORTS_UI_FLAG,{isFetching:!0});try{const a=await S3.get(r),{payload:o,meta:i}=a.data;e(p.SET_SLA_REPORTS,o),e(p.SET_SLA_REPORTS_META,i)}catch(a){throw new Error(a)}finally{e(p.SET_SLA_REPORTS_UI_FLAG,{isFetching:!1})}},getMetrics:async function({commit:e},r){e(p.SET_SLA_REPORTS_UI_FLAG,{isFetchingMetrics:!0});try{const a=await S3.getMetrics(r);e(p.SET_SLA_REPORTS_METRICS,a.data)}catch{}finally{e(p.SET_SLA_REPORTS_UI_FLAG,{isFetchingMetrics:!1})}},download(t,e){return S3.download(e).then(r=>{ls(e.fileName,r.data)})}},JHe={[p.SET_SLA_REPORTS_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.SET_SLA_REPORTS]:ur,[p.SET_SLA_REPORTS_METRICS](t,{number_of_sla_misses:e,hit_rate:r,total_applied_slas:a}){t.metrics={numberOfSLAMisses:e,hitRate:r,numberOfConversations:a}},[p.SET_SLA_REPORTS_META](t,{count:e,current_page:r}){t.meta={count:e,currentPage:r}}},QHe={namespaced:!0,state:KHe,getters:WHe,actions:ZHe,mutations:JHe};class XHe extends Fe{constructor(){super("summary_reports",{accountScoped:!0,apiVersion:"v2"})}getTeamReports({since:e,until:r,businessHours:a}={}){return axios.get(`${this.url}/team`,{params:{since:e,until:r,business_hours:a}})}getAgentReports({since:e,until:r,businessHours:a}={}){return axios.get(`${this.url}/agent`,{params:{since:e,until:r,business_hours:a}})}getInboxReports({since:e,until:r,businessHours:a}={}){return axios.get(`${this.url}/inbox`,{params:{since:e,until:r,business_hours:a}})}}const YHe=new XHe,_He={inbox:{flagKey:"isFetchingInboxSummaryReports",apiMethod:"getInboxReports",mutationKey:"setInboxSummaryReport"},agent:{flagKey:"isFetchingAgentSummaryReports",apiMethod:"getAgentReports",mutationKey:"setAgentSummaryReport"},team:{flagKey:"isFetchingTeamSummaryReports",apiMethod:"getTeamReports",mutationKey:"setTeamSummaryReport"}};async function I3(t,e,{commit:r}){const a=_He[t];if(a)try{r("setUIFlags",{[a.flagKey]:!0});const o=await YHe[a.apiMethod](e);r(a.mutationKey,mr(o.data,{deep:!0}))}catch{}finally{r("setUIFlags",{[a.flagKey]:!1})}}const $He={inboxSummaryReports:[],agentSummaryReports:[],teamSummaryReports:[],uiFlags:{isFetchingInboxSummaryReports:!1,isFetchingAgentSummaryReports:!1,isFetchingTeamSummaryReports:!1}},eKe={getInboxSummaryReports(t){return t.inboxSummaryReports},getAgentSummaryReports(t){return t.agentSummaryReports},getTeamSummaryReports(t){return t.teamSummaryReports},getUIFlags(t){return t.uiFlags}},tKe={fetchInboxSummaryReports({commit:t},e){return I3("inbox",e,{commit:t})},fetchAgentSummaryReports({commit:t},e){return I3("agent",e,{commit:t})},fetchTeamSummaryReports({commit:t},e){return I3("team",e,{commit:t})}},rKe={setInboxSummaryReport(t,e){t.inboxSummaryReports=e},setAgentSummaryReport(t,e){t.agentSummaryReports=e},setTeamSummaryReport(t,e){t.teamSummaryReports=e},setUIFlags(t,e){t.uiFlags={...t.uiFlags,...e}}},aKe={namespaced:!0,state:$He,getters:eKe,actions:tKe,mutations:rKe};class oKe extends aw{constructor(){super("teams",{accountScoped:!0})}get cacheModelName(){return"team"}extractDataFromResponse(e){return e.data}marshallData(e){return{data:e}}getAgents({teamId:e}){return axios.get(`${this.url}/${e}/team_members`)}addAgents({teamId:e,agentsList:r}){return axios.post(`${this.url}/${e}/team_members`,{user_ids:r})}updateAgents({teamId:e,agentsList:r}){return axios.patch(`${this.url}/${e}/team_members`,{user_ids:r})}}const Ho=new oKe,is="SET_TEAM_MEMBERS_UI_FLAG",uu="ADD_AGENTS_TO_TEAM",iKe={records:{},uiFlags:{isFetching:!1,isCreating:!1,isUpdating:!1,isDeleting:!1}},nKe={getUIFlags(t){return t.uiFlags},getTeamMembers:t=>e=>t.records[e]||[]},sKe={get:async({commit:t},{teamId:e})=>{t(is,{isFetching:!0});try{const{data:r}=await Ho.getAgents({teamId:e});t(uu,{data:r,teamId:e})}catch(r){throw new Error(r)}finally{t(is,{isFetching:!1})}},create:async({commit:t},{agentsList:e,teamId:r})=>{t(is,{isCreating:!0});try{const{data:a}=await Ho.addAgents({agentsList:e,teamId:r});t(uu,{teamId:r,data:a})}catch(a){throw new Error(a)}finally{t(is,{isCreating:!1})}},update:async({commit:t},{agentsList:e,teamId:r})=>{t(is,{isUpdating:!0});try{const a=await Ho.updateAgents({agentsList:e,teamId:r});t(uu,a)}catch(a){throw new Error(a)}finally{t(is,{isUpdating:!1})}}},lKe={[is](t,e){t.uiFlags={...t.uiFlags,...e}},[uu](t,{data:e,teamId:r}){t.records={...t.records,[r]:e}}},cKe={namespaced:!0,state:iKe,getters:nKe,actions:sKe,mutations:lKe},uKe={getTeams(t){return Object.values(t.records).sort((e,r)=>e.id-r.id)},getTeamById:t=>e=>Object.values(t.records).find(r=>r.id===Number(e))||{},getMyTeams(t,e){return e.getTeams.filter(r=>{const{is_member:a}=r;return a})},getUIFlags(t){return t.uiFlags},getTeam:t=>e=>t.records[e]||{}},Xa="SET_TEAM_UI_FLAG",aM="CLEAR_TEAMS",Vp="SET_TEAMS",Bp="SET_TEAM_ITEM",oM="EDIT_TEAM",iM="DELETE_TEAM",dKe={create:async({commit:t},e)=>{t(Xa,{isCreating:!0});try{const a=(await Ho.create(e)).data;return t(Bp,a),a}catch(r){throw new Error(r)}finally{t(Xa,{isCreating:!1})}},revalidate:async({commit:t},{newKey:e})=>{try{if(!await Ho.validateCacheKey(e)){const a=await Ho.refetchAndCommit(e);t(Vp,a.data)}}catch{}},get:async({commit:t})=>{t(Xa,{isFetching:!0});try{const{data:e}=await Ho.get(!0);t(aM),t(Vp,e)}catch(e){throw new Error(e)}finally{t(Xa,{isFetching:!1})}},show:async({commit:t},{id:e})=>{t(Xa,{isFetchingItem:!0});try{const r=await Ho.show(e);t(Bp,r.data.payload),t(Xa,{isFetchingItem:!1})}catch(r){throw new Error(r)}finally{t(Xa,{isFetchingItem:!1})}},update:async({commit:t},{id:e,...r})=>{t(Xa,{isUpdating:!0});try{const a=await Ho.update(e,r);t(oM,a.data)}catch(a){throw new Error(a)}finally{t(Xa,{isUpdating:!1})}},delete:async({commit:t},e)=>{t(Xa,{isDeleting:!0});try{await Ho.delete(e),t(iM,e)}catch(r){throw new Error(r)}finally{t(Xa,{isDeleting:!1})}}},gKe={[Xa](t,e){t.uiFlags={...t.uiFlags,...e}},[aM]:t=>{t.records={}},[Vp]:(t,e)=>{const r={...t.records};e.forEach(a=>{r[a.id]={...r[a.id]||{},...a}}),t.records=r},[Bp]:(t,e)=>{t.records={...t.records,[e.id]:{...t.records[e.id]||{},...e}}},[oM]:(t,e)=>{t.records={...t.records,[e.id]:e}},[iM]:(t,e)=>{const{[e]:r,...a}=t.records;t.records=a}},hKe={meta:{},records:{},uiFlags:{isFetching:!1,isCreating:!1,isUpdating:!1,isDeleting:!1}},mKe={namespaced:!0,state:hKe,getters:uKe,actions:dKe,mutations:gKe};class pKe extends Fe{constructor(){super("notification_settings",{accountScoped:!0})}update(e){return axios.patch(`${this.url}`,e)}}const yk=new pKe,fKe={record:{},uiFlags:{isFetching:!1,isUpdating:!1}},wKe={getUIFlags(t){return t.uiFlags},getSelectedEmailFlags:t=>t.record.selected_email_flags,getSelectedPushFlags:t=>t.record.selected_push_flags},vKe={get:async({commit:t})=>{t(p.SET_USER_NOTIFICATION_UI_FLAG,{isFetching:!0});try{const e=await yk.get();t(p.SET_USER_NOTIFICATION,e.data),t(p.SET_USER_NOTIFICATION_UI_FLAG,{isFetching:!1})}catch{t(p.SET_USER_NOTIFICATION_UI_FLAG,{isFetching:!1})}},update:async({commit:t},{selectedEmailFlags:e,selectedPushFlags:r})=>{t(p.SET_USER_NOTIFICATION_UI_FLAG,{isUpdating:!0});try{const a=await yk.update({notification_settings:{selected_email_flags:e,selected_push_flags:r}});t(p.SET_USER_NOTIFICATION,a.data),t(p.SET_USER_NOTIFICATION_UI_FLAG,{isUpdating:!1})}catch(a){throw t(p.SET_USER_NOTIFICATION_UI_FLAG,{isUpdating:!1}),a}}},bKe={[p.SET_USER_NOTIFICATION_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.SET_USER_NOTIFICATION]:(t,e)=>{t.record=e}},EKe={namespaced:!0,state:fKe,getters:wKe,actions:vKe,mutations:bKe};class kKe extends Fe{constructor(){super("webhooks",{accountScoped:!0})}}const q2=new kKe,CKe={records:[],uiFlags:{fetchingList:!1,creatingItem:!1,deletingItem:!1,updatingItem:!1}},AKe={getWebhooks(t){return t.records.sort((e,r)=>e.id-r.id)},getUIFlags(t){return t.uiFlags}},xKe={async get({commit:t}){t(p.SET_WEBHOOK_UI_FLAG,{fetchingList:!0});try{const e=await q2.get();t(p.SET_WEBHOOK,e.data.payload.webhooks),t(p.SET_WEBHOOK_UI_FLAG,{fetchingList:!1})}catch{t(p.SET_WEBHOOK_UI_FLAG,{fetchingList:!1})}},async create({commit:t},e){t(p.SET_WEBHOOK_UI_FLAG,{creatingItem:!0});try{const r=await q2.create(e),{payload:{webhook:a}}=r.data;t(p.ADD_WEBHOOK,a),t(p.SET_WEBHOOK_UI_FLAG,{creatingItem:!1})}catch(r){throw t(p.SET_WEBHOOK_UI_FLAG,{creatingItem:!1}),r}},update:async({commit:t},{id:e,...r})=>{t(p.SET_WEBHOOK_UI_FLAG,{updatingItem:!0});try{const a=await q2.update(e,r);t(p.UPDATE_WEBHOOK,a.data.payload.webhook)}catch(a){throw new Error(a)}finally{t(p.SET_WEBHOOK_UI_FLAG,{updatingItem:!1})}},async delete({commit:t},e){t(p.SET_WEBHOOK_UI_FLAG,{deletingItem:!0});try{await q2.delete(e),t(p.DELETE_WEBHOOK,e),t(p.SET_WEBHOOK_UI_FLAG,{deletingItem:!1})}catch(r){throw t(p.SET_WEBHOOK_UI_FLAG,{deletingItem:!1}),r}}},yKe={[p.SET_WEBHOOK_UI_FLAG](t,e){t.uiFlags={...t.uiFlags,...e}},[p.SET_WEBHOOK]:ur,[p.ADD_WEBHOOK]:Ma,[p.DELETE_WEBHOOK]:da,[p.UPDATE_WEBHOOK]:ua},TKe={namespaced:!0,state:CKe,getters:AKe,actions:xKe,mutations:yKe};class SKe extends Fe{constructor(){super("captain/assistants",{accountScoped:!0})}get({page:e=1,searchKey:r}={}){return axios.get(this.url,{params:{page:e,searchKey:r}})}playground({assistantId:e,messageContent:r,messageHistory:a}){return axios.post(`${this.url}/${e}/playground`,{message_content:r,message_history:a})}}const IKe=new SKe,MKe=(t,e)=>async({commit:r},a={})=>{r(t.SET_UI_FLAG,{fetchingList:!0});try{const o=await e.get(a);return r(t.SET,o.data.payload),r(t.SET_META,o.data.meta),o.data.payload}catch(o){return Me(o)}finally{r(t.SET_UI_FLAG,{fetchingList:!1})}},OKe=(t,e)=>async({commit:r},a)=>{r(t.SET_UI_FLAG,{fetchingItem:!0});try{const o=await e.show(a);return r(t.ADD,o.data),o.data}catch(o){return Me(o)}finally{r(t.SET_UI_FLAG,{fetchingItem:!1})}},LKe=(t,e)=>async({commit:r},a)=>{r(t.SET_UI_FLAG,{creatingItem:!0});try{const o=await e.create(a);return r(t.UPSERT,o.data),o.data}catch(o){return Me(o)}finally{r(t.SET_UI_FLAG,{creatingItem:!1})}},RKe=(t,e)=>async({commit:r},{id:a,...o})=>{r(t.SET_UI_FLAG,{updatingItem:!0});try{const i=await e.update(a,o);return r(t.EDIT,i.data),i.data}catch(i){return Me(i)}finally{r(t.SET_UI_FLAG,{updatingItem:!1})}},NKe=(t,e)=>async({commit:r},a)=>{r(t.SET_UI_FLAG,{deletingItem:!0});try{return await e.delete(a),r(t.DELETE,a),a}catch(o){return Me(o)}finally{r(t.SET_UI_FLAG,{deletingItem:!1})}},DKe=t=>{const e=t.toUpperCase();return{SET_UI_FLAG:`SET_${e}_UI_FLAG`,SET:`SET_${e}`,ADD:`ADD_${e}`,EDIT:`EDIT_${e}`,DELETE:`DELETE_${e}`,SET_META:`SET_${e}_META`,UPSERT:`UPSERT_${e}`}},VKe=()=>({records:[],meta:{},uiFlags:{fetchingList:!1,fetchingItem:!1,creatingItem:!1,updatingItem:!1,deletingItem:!1}}),BKe=()=>({getRecords:t=>t.records.sort((e,r)=>r.id-e.id),getRecord:t=>e=>t.records.find(r=>r.id===Number(e))||{},getUIFlags:t=>t.uiFlags,getMeta:t=>t.meta}),PKe=t=>({[t.SET_UI_FLAG](e,r){e.uiFlags={...e.uiFlags,...r}},[t.SET_META](e,r){e.meta={totalCount:Number(r.total_count),page:Number(r.page)}},[t.SET]:ur,[t.ADD]:Ma,[t.EDIT]:ua,[t.DELETE]:da,[t.UPSERT]:Kc}),FKe=(t,e)=>({get:MKe(e,t),show:OKe(e,t),create:LKe(e,t),update:RKe(e,t),delete:NKe(e,t)}),$s=t=>{const{name:e,API:r,actions:a,getters:o}=t,i=DKe(e),n=a?a(i):{};return{namespaced:!0,state:VKe(),getters:{...BKe(),...o||{}},mutations:PKe(i),actions:{...FKe(r,i),...n}}},UKe=$s({name:"CaptainAssistant",API:IKe});class jKe extends Fe{constructor(){super("captain/documents",{accountScoped:!0})}get({page:e=1,searchKey:r,assistantId:a}={}){return axios.get(this.url,{params:{page:e,searchKey:r,assistant_id:a}})}}const zKe=new jKe,qKe=$s({name:"CaptainDocument",API:zKe});class GKe extends Fe{constructor(){super("captain/assistant_responses",{accountScoped:!0})}get({page:e=1,searchKey:r,assistantId:a,documentId:o,status:i}={}){return axios.get(this.url,{params:{page:e,searchKey:r,assistant_id:a,document_id:o,status:i}})}}const HKe=new GKe,KKe=$s({name:"CaptainResponse",API:HKe,actions:t=>({removeBulkResponses:({commit:e,state:r},a)=>{const o=r.records.filter(i=>!a.includes(i.id));e(t.SET,o)},updateBulkResponses:({commit:e,state:r},a)=>{const o=a.reduce((n,s)=>(n[s.id]=s,n),{}),i=r.records.map(n=>o[n.id]?o[n.id]:n);e(t.SET,i)}})});class WKe extends Fe{constructor(){super("captain/assistants",{accountScoped:!0})}get({assistantId:e}={}){return axios.get(`${this.url}/${e}/inboxes`)}create(e={}){const{assistantId:r,inboxId:a}=e;return axios.post(`${this.url}/${r}/inboxes`,{inbox:{inbox_id:a}})}delete(e={}){const{assistantId:r,inboxId:a}=e;return axios.delete(`${this.url}/${r}/inboxes/${a}`)}}const Tk=new WKe,ZKe=$s({name:"CaptainInbox",API:Tk,actions:t=>({delete:async function({commit:r},{inboxId:a,assistantId:o}){r(t.SET_UI_FLAG,{deletingItem:!0});try{return await Tk.delete({inboxId:a,assistantId:o}),r(t.DELETE,a),r(t.SET_UI_FLAG,{deletingItem:!1}),a}catch(i){return r(t.SET_UI_FLAG,{deletingItem:!1}),Me(i)}}})});class JKe extends Fe{constructor(){super("captain/bulk_actions",{accountScoped:!0})}}const Sk=new JKe,QKe=$s({name:"CaptainBulkAction",API:Sk,actions:t=>({processBulkAction:async function({commit:r},{type:a,actionType:o,ids:i}){r(t.SET_UI_FLAG,{isUpdating:!0});try{const n=await Sk.create({type:a,ids:i,fields:{status:o}});return r(t.SET_UI_FLAG,{isUpdating:!1}),n.data}catch(n){return r(t.SET_UI_FLAG,{isUpdating:!1}),Me(n)}},handleBulkDelete:async function({dispatch:r},a){const o=await r("processBulkAction",{type:"AssistantResponse",actionType:"delete",ids:a});return await r("captainResponses/removeBulkResponses",a,{root:!0}),o},handleBulkApprove:async function({dispatch:r},a){const o=await r("processBulkAction",{type:"AssistantResponse",actionType:"approve",ids:a});return await r("captainResponses/updateBulkResponses",o,{root:!0}),o}})});class XKe extends Fe{constructor(){super("captain/copilot_threads",{accountScoped:!0})}}const YKe=new XKe,_Ke=$s({name:"CopilotThreads",API:YKe});class $Ke extends Fe{constructor(){super("captain/copilot_threads",{accountScoped:!0})}get(e){return axios.get(`${this.url}/${e}/copilot_messages`)}create({threadId:e,...r}){return axios.post(`${this.url}/${e}/copilot_messages`,r)}}const eWe=new $Ke,tWe=$s({name:"CopilotMessages",API:eWe,getters:{getMessagesByThreadId:t=>e=>t.records.filter(r=>{var a;return((a=r.copilot_thread)==null?void 0:a.id)===Number(e)}).sort((r,a)=>r.id-a.id)},actions:t=>({upsert({commit:e},r){e(t.UPSERT,r)}})}),rWe=[],bc=gxe({modules:{accounts:pUe,agentBots:BUe,agents:qUe,articles:JUe,attributes:eje,auditlogs:sje,auth:gje,automations:vje,bulkActions:yje,campaigns:Lje,cannedResponse:Pje,categories:Gje,contactConversations:eze,contactLabels:ize,contactNotes:dze,contacts:vze,conversationLabels:Aze,conversationMetadata:Ize,conversationPage:Nze,conversations:cqe,conversationSearch:pqe,conversationStats:Cqe,conversationTypingStatus:Sqe,conversationWatchers:Rqe,csat:Uqe,customRole:Kqe,customViews:Yqe,dashboardApps:aGe,draftMessages:lGe,globalConfig:NGe,inboxAssignableAgents:jGe,inboxes:QGe,inboxMembers:_Ge,integrations:oHe,labels:uHe,macros:fHe,notifications:xHe,portals:OHe,reports:PHe,sla:GHe,slaReports:QHe,summaryReports:aKe,teamMembers:cKe,teams:mKe,userNotificationSettings:EKe,webhooks:TKe,captainAssistants:UKe,captainDocuments:qKe,captainResponses:KKe,captainInboxes:ZKe,captainBulkActions:QKe,copilotThreads:_Ke,copilotMessages:tWe},plugins:rWe});var Pp={exports:{}};(function(t,e){(function(r,a){a(e)})(ct,function(r){var a={logger:self.console,WebSocket:self.WebSocket},o={log:function(){if(this.enabled){for(var N,q=arguments.length,j=Array(q),J=0;J<q;J++)j[J]=arguments[J];j.push(Date.now()),(N=a.logger).log.apply(N,["[ActionCable]"].concat(j))}}},i=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(S){return typeof S}:function(S){return S&&typeof Symbol=="function"&&S.constructor===Symbol&&S!==Symbol.prototype?"symbol":typeof S},n=function(S,N){if(!(S instanceof N))throw new TypeError("Cannot call a class as a function")},s=function(){function S(N,q){for(var j=0;j<q.length;j++){var J=q[j];J.enumerable=J.enumerable||!1,J.configurable=!0,"value"in J&&(J.writable=!0),Object.defineProperty(N,J.key,J)}}return function(N,q,j){return q&&S(N.prototype,q),j&&S(N,j),N}}(),l=function(){return new Date().getTime()},c=function(N){return(l()-N)/1e3},u=function(N,q,j){return Math.max(q,Math.min(j,N))},d=function(){function S(N){n(this,S),this.visibilityDidChange=this.visibilityDidChange.bind(this),this.connection=N,this.reconnectAttempts=0}return S.prototype.start=function(){this.isRunning()||(this.startedAt=l(),delete this.stoppedAt,this.startPolling(),addEventListener("visibilitychange",this.visibilityDidChange),o.log("ConnectionMonitor started. pollInterval = "+this.getPollInterval()+" ms"))},S.prototype.stop=function(){this.isRunning()&&(this.stoppedAt=l(),this.stopPolling(),removeEventListener("visibilitychange",this.visibilityDidChange),o.log("ConnectionMonitor stopped"))},S.prototype.isRunning=function(){return this.startedAt&&!this.stoppedAt},S.prototype.recordPing=function(){this.pingedAt=l()},S.prototype.recordConnect=function(){this.reconnectAttempts=0,this.recordPing(),delete this.disconnectedAt,o.log("ConnectionMonitor recorded connect")},S.prototype.recordDisconnect=function(){this.disconnectedAt=l(),o.log("ConnectionMonitor recorded disconnect")},S.prototype.startPolling=function(){this.stopPolling(),this.poll()},S.prototype.stopPolling=function(){clearTimeout(this.pollTimeout)},S.prototype.poll=function(){var q=this;this.pollTimeout=setTimeout(function(){q.reconnectIfStale(),q.poll()},this.getPollInterval())},S.prototype.getPollInterval=function(){var q=this.constructor.pollInterval,j=q.min,J=q.max,_=q.multiplier,B=_*Math.log(this.reconnectAttempts+1);return Math.round(u(B,j,J)*1e3)},S.prototype.reconnectIfStale=function(){this.connectionIsStale()&&(o.log("ConnectionMonitor detected stale connection. reconnectAttempts = "+this.reconnectAttempts+", pollInterval = "+this.getPollInterval()+" ms, time disconnected = "+c(this.disconnectedAt)+" s, stale threshold = "+this.constructor.staleThreshold+" s"),this.reconnectAttempts++,this.disconnectedRecently()?o.log("ConnectionMonitor skipping reopening recent disconnect"):(o.log("ConnectionMonitor reopening"),this.connection.reopen()))},S.prototype.connectionIsStale=function(){return c(this.pingedAt?this.pingedAt:this.startedAt)>this.constructor.staleThreshold},S.prototype.disconnectedRecently=function(){return this.disconnectedAt&&c(this.disconnectedAt)<this.constructor.staleThreshold},S.prototype.visibilityDidChange=function(){var q=this;document.visibilityState==="visible"&&setTimeout(function(){(q.connectionIsStale()||!q.connection.isOpen())&&(o.log("ConnectionMonitor reopening stale connection on visibilitychange. visibilityState = "+document.visibilityState),q.connection.reopen())},200)},S}();d.pollInterval={min:3,max:30,multiplier:5},d.staleThreshold=6;var g={message_types:{welcome:"welcome",disconnect:"disconnect",ping:"ping",confirmation:"confirm_subscription",rejection:"reject_subscription"},disconnect_reasons:{unauthorized:"unauthorized",invalid_request:"invalid_request",server_restart:"server_restart"},default_mount_path:"/cable",protocols:["actioncable-v1-json","actioncable-unsupported"]},h=g.message_types,m=g.protocols,f=m.slice(0,m.length-1),b=[].indexOf,k=function(){function S(N){n(this,S),this.open=this.open.bind(this),this.consumer=N,this.subscriptions=this.consumer.subscriptions,this.monitor=new d(this),this.disconnected=!0}return S.prototype.send=function(q){return this.isOpen()?(this.webSocket.send(JSON.stringify(q)),!0):!1},S.prototype.open=function(){return this.isActive()?(o.log("Attempted to open WebSocket, but existing socket is "+this.getState()),!1):(o.log("Opening WebSocket, current state is "+this.getState()+", subprotocols: "+m),this.webSocket&&this.uninstallEventHandlers(),this.webSocket=new a.WebSocket(this.consumer.url,m),this.installEventHandlers(),this.monitor.start(),!0)},S.prototype.close=function(){var q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{allowReconnect:!0},j=q.allowReconnect;if(j||this.monitor.stop(),this.isActive())return this.webSocket.close()},S.prototype.reopen=function(){if(o.log("Reopening WebSocket, current state is "+this.getState()),this.isActive())try{return this.close()}catch(q){o.log("Failed to reopen WebSocket",q)}finally{o.log("Reopening WebSocket in "+this.constructor.reopenDelay+"ms"),setTimeout(this.open,this.constructor.reopenDelay)}else return this.open()},S.prototype.getProtocol=function(){if(this.webSocket)return this.webSocket.protocol},S.prototype.isOpen=function(){return this.isState("open")},S.prototype.isActive=function(){return this.isState("open","connecting")},S.prototype.isProtocolSupported=function(){return b.call(f,this.getProtocol())>=0},S.prototype.isState=function(){for(var q=arguments.length,j=Array(q),J=0;J<q;J++)j[J]=arguments[J];return b.call(j,this.getState())>=0},S.prototype.getState=function(){if(this.webSocket){for(var q in a.WebSocket)if(a.WebSocket[q]===this.webSocket.readyState)return q.toLowerCase()}return null},S.prototype.installEventHandlers=function(){for(var q in this.events){var j=this.events[q].bind(this);this.webSocket["on"+q]=j}},S.prototype.uninstallEventHandlers=function(){for(var q in this.events)this.webSocket["on"+q]=function(){}},S}();k.reopenDelay=500,k.prototype.events={message:function(N){if(this.isProtocolSupported()){var q=JSON.parse(N.data),j=q.identifier,J=q.message,_=q.reason,B=q.reconnect,T=q.type;switch(T){case h.welcome:return this.monitor.recordConnect(),this.subscriptions.reload();case h.disconnect:return o.log("Disconnecting. Reason: "+_),this.close({allowReconnect:B});case h.ping:return this.monitor.recordPing();case h.confirmation:return this.subscriptions.notify(j,"connected");case h.rejection:return this.subscriptions.reject(j);default:return this.subscriptions.notify(j,"received",J)}}},open:function(){if(o.log("WebSocket onopen event, using '"+this.getProtocol()+"' subprotocol"),this.disconnected=!1,!this.isProtocolSupported())return o.log("Protocol is unsupported. Stopping monitor and disconnecting."),this.close({allowReconnect:!1})},close:function(N){if(o.log("WebSocket onclose event"),!this.disconnected)return this.disconnected=!0,this.monitor.recordDisconnect(),this.subscriptions.notifyAll("disconnected",{willAttemptReconnect:this.monitor.isRunning()})},error:function(){o.log("WebSocket onerror event")}};var C=function(N,q){if(q!=null)for(var j in q){var J=q[j];N[j]=J}return N},w=function(){function S(N){var q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},j=arguments[2];n(this,S),this.consumer=N,this.identifier=JSON.stringify(q),C(this,j)}return S.prototype.perform=function(q){var j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return j.action=q,this.send(j)},S.prototype.send=function(q){return this.consumer.send({command:"message",identifier:this.identifier,data:JSON.stringify(q)})},S.prototype.unsubscribe=function(){return this.consumer.subscriptions.remove(this)},S}(),v=function(){function S(N){n(this,S),this.consumer=N,this.subscriptions=[]}return S.prototype.create=function(q,j){var J=q,_=(typeof J>"u"?"undefined":i(J))==="object"?J:{channel:J},B=new w(this.consumer,_,j);return this.add(B)},S.prototype.add=function(q){return this.subscriptions.push(q),this.consumer.ensureActiveConnection(),this.notify(q,"initialized"),this.sendCommand(q,"subscribe"),q},S.prototype.remove=function(q){return this.forget(q),this.findAll(q.identifier).length||this.sendCommand(q,"unsubscribe"),q},S.prototype.reject=function(q){var j=this;return this.findAll(q).map(function(J){return j.forget(J),j.notify(J,"rejected"),J})},S.prototype.forget=function(q){return this.subscriptions=this.subscriptions.filter(function(j){return j!==q}),q},S.prototype.findAll=function(q){return this.subscriptions.filter(function(j){return j.identifier===q})},S.prototype.reload=function(){var q=this;return this.subscriptions.map(function(j){return q.sendCommand(j,"subscribe")})},S.prototype.notifyAll=function(q){for(var j=this,J=arguments.length,_=Array(J>1?J-1:0),B=1;B<J;B++)_[B-1]=arguments[B];return this.subscriptions.map(function(T){return j.notify.apply(j,[T,q].concat(_))})},S.prototype.notify=function(q,j){for(var J=arguments.length,_=Array(J>2?J-2:0),B=2;B<J;B++)_[B-2]=arguments[B];var T=void 0;return typeof q=="string"?T=this.findAll(q):T=[q],T.map(function(L){return typeof L[j]=="function"?L[j].apply(L,_):void 0})},S.prototype.sendCommand=function(q,j){var J=q.identifier;return this.consumer.send({command:j,identifier:J})},S}(),A=function(){function S(N){n(this,S),this._url=N,this.subscriptions=new v(this),this.connection=new k(this)}return S.prototype.send=function(q){return this.connection.send(q)},S.prototype.connect=function(){return this.connection.open()},S.prototype.disconnect=function(){return this.connection.close({allowReconnect:!1})},S.prototype.ensureActiveConnection=function(){if(!this.connection.isActive())return this.connection.open()},s(S,[{key:"url",get:function(){return E(this._url)}}]),S}();function E(S){if(typeof S=="function"&&(S=S()),S&&!/^wss?:/i.test(S)){var N=document.createElement("a");return N.href=S,N.href=N.href,N.protocol=N.protocol.replace("http","ws"),N.href}else return S}function M(){var S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:P("url")||g.default_mount_path;return new A(S)}function P(S){var N=document.head.querySelector("meta[name='action-cable-"+S+"']");if(N)return N.getAttribute("content")}r.Connection=k,r.ConnectionMonitor=d,r.Consumer=A,r.INTERNAL=g,r.Subscription=w,r.Subscriptions=v,r.adapters=a,r.createWebSocketURL=E,r.logger=o,r.createConsumer=M,r.getConfig=P,Object.defineProperty(r,"__esModule",{value:!0})})})(Pp,Pp.exports);var aWe=Pp.exports;const oWe=2e4,iWe=1e3,Ml=class Ml{constructor(e,r,a=""){Ve(this,"clearReconnectTimer",()=>{this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null)});Ve(this,"initReconnectTimer",()=>{this.clearReconnectTimer(),this.reconnectTimer=setTimeout(()=>{this.checkConnection()},iWe)});Ve(this,"onReconnect",()=>{});Ve(this,"onDisconnected",()=>{});Ve(this,"onReceived",({event:e,data:r}={})=>{console.group(e),console.log("ActionCable received:",{event:e,data:r}),this.isAValidEvent(r)?(console.log("Event validation passed for:",e),this.events[e]&&typeof this.events[e]=="function"?(console.log("Executing event handler for:",e),this.events[e](r)):console.log("No handler found for event:",e)):console.log("Event validation failed for:",e,r),console.groupEnd()});const o=a?`${a}/cable`:void 0;this.consumer=aWe.createConsumer(o),this.subscription=this.consumer.subscriptions.create({channel:"RoomChannel",pubsub_token:r,account_id:e.$store.getters.getCurrentAccountId,user_id:e.$store.getters.getCurrentUserID},{updatePresence(){this.perform("update_presence")},received:this.onReceived,disconnected:()=>{Ml.isDisconnected=!0,this.onDisconnected(),this.initReconnectTimer()}}),this.app=e,this.events={},this.reconnectTimer=null,this.isAValidEvent=()=>!0,this.triggerPresenceInterval=()=>{setTimeout(()=>{this.subscription.updatePresence(),this.triggerPresenceInterval()},oWe)},this.triggerPresenceInterval()}checkConnection(){const e=this.consumer.connection.isOpen();Ml.isDisconnected&&e?(this.clearReconnectTimer(),this.onReconnect(),Ml.isDisconnected=!1):this.initReconnectTimer()}disconnect(){this.consumer.disconnect()}};Ve(Ml,"isDisconnected",!1);let Fp=Ml;const Ik=()=>{document.querySelectorAll(".favicon").forEach(e=>{const r=`/favicon-badge-${e.sizes[[0]]}.png`;e.href=r})},nWe=()=>{const t=document.querySelectorAll(".favicon");document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&t.forEach(e=>{const r=`/favicon-${e.sizes[[0]]}.png`;e.href=r})})},M3={ASSIGNED:"assigned",NOTME:"notme",UNASSIGNED:"unassigned"},sWe=["agent","administrator"],lWe=["conversation_manage","conversation_unassigned_manage","conversation_participating_manage"];class cWe{constructor(e){Ve(this,"hasUnreadConversation",()=>this.store.getters.getMineChats({assigneeType:"me",status:"open"}).some(r=>r.unread_count>0));Ve(this,"isMessageFromPendingConversation",(e={})=>{const{conversation_id:r}=e||{};if(!r)return!1;const a=this.store.getters.getConversationById(r);return(a==null?void 0:a.status)===oc.STATUS_TYPE.PENDING});Ve(this,"isMessageFromCurrentConversation",e=>{var r;return((r=this.store.getters.getSelectedChat)==null?void 0:r.id)===e.conversation_id});Ve(this,"hasConversationPermission",e=>{const r=this.store.getters.getCurrentAccountId,a=Np(e,r);return[...sWe,...lWe].some(i=>a.includes(i))});this.store=e}}const nM=t=>{var e;return(e=t==null?void 0:t.conversation)==null?void 0:e.assignee_id},uWe=t=>!nM(t),dWe=(t,e)=>nM(t)===e,gWe=(t,e)=>{var r;return((r=t==null?void 0:t.sender)==null?void 0:r.id)===e};class hWe{constructor(){Ve(this,"initializeEvent",()=>{window.addEventListener("blur",()=>{this.isVisible=!1}),window.addEventListener("focus",()=>{this.isVisible=!0})});this.isVisible=!0,this.initializeEvent()}isWindowVisible(){return!document.hidden&&this.isVisible}}const Mk=new hWe,mWe=3e4,pWe=1e4,fWe="/audio/dashboard/",Ok="ding",Lk=["none"];class wWe{constructor(e){Ve(this,"intializeAudio",()=>{const e=`${fWe}${this.audioConfig.tone}.mp3`;return this.audioConfig.audio=new Audio(e),this.audioConfig.audio.load()});Ve(this,"playAudioAlert",async()=>{try{await this.audioConfig.audio.play()}catch(e){e.name==="NotAllowedError"&&!this.hasSentSoundPermissionsRequest&&(this.hasSentSoundPermissionsRequest=!0,It("PROFILE_SETTINGS.FORM.AUDIO_NOTIFICATIONS_SECTION.SOUND_PERMISSION_ERROR",{usei18n:!0,duration:pWe}))}});Ve(this,"set",({currentUser:e,alwaysPlayAudioAlert:r,alertIfUnreadConversationExist:a,audioAlertType:o=Lk,audioAlertTone:i=Ok})=>{this.notificationConfig={...this.notificationConfig,audioAlertType:o.split("+").filter(Boolean),playAlertOnlyWhenHidden:!r,alertIfUnreadConversationExist:a},this.currentUser=e;const n=this.audioConfig.tone;this.audioConfig={...this.audioConfig,tone:i},n!==i&&this.intializeAudio(),nWe(),this.clearRecurringTimer(),this.playAudioEvery30Seconds()});Ve(this,"shouldPlayAlert",()=>this.notificationConfig.playAlertOnlyWhenHidden?!Mk.isWindowVisible():!0);Ve(this,"executeRecurringNotification",()=>{this.store.hasUnreadConversation()&&this.shouldPlayAlert()&&(this.playAudioAlert(),Ik()),this.resetRecurringTimer()});Ve(this,"clearRecurringTimer",()=>{this.recurringNotificationTimer&&clearTimeout(this.recurringNotificationTimer)});Ve(this,"resetRecurringTimer",()=>{this.clearRecurringTimer(),this.recurringNotificationTimer=setTimeout(this.executeRecurringNotification,mWe)});Ve(this,"playAudioEvery30Seconds",()=>{const{audioAlertType:e,alertIfUnreadConversationExist:r}=this.notificationConfig;e.includes("none")||r&&this.resetRecurringTimer()});Ve(this,"shouldNotifyOnMessage",e=>{const{audioAlertType:r}=this.notificationConfig;if(r.includes("none"))return!1;if(r.includes("all"))return!0;const a=dWe(e,this.currentUser.id),o=uWe(e),i=[];return(r.includes(M3.ASSIGNED)||r.includes("mine"))&&i.push(a),r.includes(M3.UNASSIGNED)&&i.push(o),r.includes(M3.NOTME)&&i.push(!o&&!a),i.some(Boolean)});Ve(this,"onNewMessage",e=>{if(!this.store.hasConversationPermission(this.currentUser)||this.store.isMessageFromPendingConversation(e)||gWe(e,this.currentUser.id)||!this.shouldNotifyOnMessage(e))return;const{message_type:r,private:a}=e;r!==nc.INCOMING&&!a||Mk.isWindowVisible()&&(this.store.isMessageFromCurrentConversation(e)||this.notificationConfig.playAlertOnlyWhenHidden)||(this.playAudioAlert(),Ik(),this.playAudioEvery30Seconds())});if(!e)throw new Error("store is required");this.store=new cWe(e),this.notificationConfig={audioAlertType:Lk,playAlertOnlyWhenHidden:!0,alertIfUnreadConversationExist:!1},this.recurringNotificationTimer=null,this.audioConfig={audio:null,tone:Ok,hasSentSoundPermissionsRequest:!1},this.currentUser=null}}const vWe=new wWe(bc);function bWe(){return{isImpersonating:K(()=>rw.get(tw.IMPERSONATION_USER))}}const{isImpersonating:EWe}=bWe();class kWe extends Fp{constructor(r,a){const{websocketURL:o=""}=window.chatwootConfig||{},i=o||window.__WEBSOCKET_URL__||"";super(r,a,i);Ve(this,"onReconnect",()=>{yr.emit(Ri.WEBSOCKET_RECONNECT)});Ve(this,"onDisconnected",()=>{yr.emit(Ri.WEBSOCKET_DISCONNECT)});Ve(this,"isAValidEvent",r=>this.app.$store.getters.getCurrentAccountId===r.account_id);Ve(this,"onMessageUpdated",r=>{this.app.$store.dispatch("updateMessage",r)});Ve(this,"onPresenceUpdate",r=>{EWe.value||(this.app.$store.dispatch("contacts/updatePresence",r.contacts),this.app.$store.dispatch("agents/updatePresence",r.users),this.app.$store.dispatch("setCurrentUserAvailability",r.users))});Ve(this,"onConversationContactChange",r=>{const{meta:a={},id:o}=r,{sender:i}=a||{};o&&this.app.$store.dispatch("updateConversationContact",{conversationId:o,...i})});Ve(this,"onAssigneeChanged",r=>{const{id:a}=r;a&&this.app.$store.dispatch("updateConversation",r),this.fetchConversationStats()});Ve(this,"onConversationCreated",r=>{this.app.$store.dispatch("addConversation",r),this.fetchConversationStats()});Ve(this,"onConversationRead",r=>{this.app.$store.dispatch("updateConversation",r)});Ve(this,"onLogout",()=>Qa.logout());Ve(this,"onMessageCreated",r=>{const{conversation:{last_activity_at:a},conversation_id:o}=r;window.__WOOT_ISOLATED_SHELL__||vWe.onNewMessage(r),console.log("PROCESSING MESSAGE CREATED"),this.app.$store.dispatch("addMessage",r),this.app.$store.dispatch("updateConversationLastActivity",{lastActivityAt:a,conversationId:o})});Ve(this,"onReload",()=>window.location.reload());Ve(this,"onStatusChange",r=>{this.app.$store.dispatch("updateConversation",r),this.fetchConversationStats()});Ve(this,"onConversationUpdated",r=>{this.app.$store.dispatch("updateConversation",r),this.fetchConversationStats()});Ve(this,"onTypingOn",({conversation:r,user:a})=>{const o=r.id;this.clearTimer(o),this.app.$store.dispatch("conversationTypingStatus/create",{conversationId:o,user:a}),this.initTimer({conversation:r,user:a})});Ve(this,"onTypingOff",({conversation:r,user:a})=>{const o=r.id;this.clearTimer(o),this.app.$store.dispatch("conversationTypingStatus/destroy",{conversationId:o,user:a})});Ve(this,"onConversationMentioned",r=>{this.app.$store.dispatch("addMentions",r)});Ve(this,"clearTimer",r=>{const a=this.CancelTyping[r];a&&(clearTimeout(a),this.CancelTyping[r]=null)});Ve(this,"initTimer",({conversation:r,user:a})=>{const o=r.id;this.CancelTyping[o]=setTimeout(()=>{this.onTypingOff({conversation:r,user:a})},3e4)});Ve(this,"fetchConversationStats",()=>{yr.emit("fetch_conversation_stats")});Ve(this,"onContactDelete",r=>{this.app.$store.dispatch("contacts/deleteContactThroughConversations",r.id),this.fetchConversationStats()});Ve(this,"onContactUpdate",r=>{this.app.$store.dispatch("contacts/updateContact",r)});Ve(this,"onNotificationCreated",r=>{this.app.$store.dispatch("notifications/addNotification",r)});Ve(this,"onNotificationDeleted",r=>{this.app.$store.dispatch("notifications/deleteNotification",r)});Ve(this,"onNotificationUpdated",r=>{this.app.$store.dispatch("notifications/updateNotification",r)});Ve(this,"onCopilotMessageCreated",r=>{this.app.$store.dispatch("copilotMessages/upsert",r)});Ve(this,"onCacheInvalidate",r=>{const a=r.cache_keys;this.app.$store.dispatch("labels/revalidate",{newKey:a.label}),this.app.$store.dispatch("inboxes/revalidate",{newKey:a.inbox}),this.app.$store.dispatch("teams/revalidate",{newKey:a.team})});this.CancelTyping=[],this.events={"message.created":this.onMessageCreated,"message.updated":this.onMessageUpdated,"conversation.created":this.onConversationCreated,"conversation.status_changed":this.onStatusChange,"user:logout":this.onLogout,"page:reload":this.onReload,"assignee.changed":this.onAssigneeChanged,"conversation.typing_on":this.onTypingOn,"conversation.typing_off":this.onTypingOff,"conversation.contact_changed":this.onConversationContactChange,"presence.update":this.onPresenceUpdate,"contact.deleted":this.onContactDelete,"contact.updated":this.onContactUpdate,"conversation.mentioned":this.onConversationMentioned,"notification.created":this.onNotificationCreated,"notification.deleted":this.onNotificationDeleted,"notification.updated":this.onNotificationUpdated,"conversation.read":this.onConversationRead,"conversation.updated":this.onConversationUpdated,"account.cache_invalidated":this.onCacheInvalidate,"copilot.message.created":this.onCopilotMessageCreated}}}const sM={init(t,e){return console.log("INITIALIZING ACTIONCABLE",{pubsubToken:e}),new kWe({$store:t},e)}};/*! @license DOMPurify 3.2.4 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.4/LICENSE */const{entries:lM,setPrototypeOf:Rk,isFrozen:CWe,getPrototypeOf:AWe,getOwnPropertyDescriptor:xWe}=Object;let{freeze:la,seal:co,create:cM}=Object,{apply:Up,construct:jp}=typeof Reflect<"u"&&Reflect;la||(la=function(e){return e});co||(co=function(e){return e});Up||(Up=function(e,r,a){return e.apply(r,a)});jp||(jp=function(e,r){return new e(...r)});const G2=ca(Array.prototype.forEach),yWe=ca(Array.prototype.lastIndexOf),Nk=ca(Array.prototype.pop),a1=ca(Array.prototype.push),TWe=ca(Array.prototype.splice),du=ca(String.prototype.toLowerCase),O3=ca(String.prototype.toString),Dk=ca(String.prototype.match),o1=ca(String.prototype.replace),SWe=ca(String.prototype.indexOf),IWe=ca(String.prototype.trim),go=ca(Object.prototype.hasOwnProperty),Xr=ca(RegExp.prototype.test),i1=MWe(TypeError);function ca(t){return function(e){for(var r=arguments.length,a=new Array(r>1?r-1:0),o=1;o<r;o++)a[o-1]=arguments[o];return Up(t,e,a)}}function MWe(t){return function(){for(var e=arguments.length,r=new Array(e),a=0;a<e;a++)r[a]=arguments[a];return jp(t,r)}}function Xe(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:du;Rk&&Rk(t,null);let a=e.length;for(;a--;){let o=e[a];if(typeof o=="string"){const i=r(o);i!==o&&(CWe(e)||(e[a]=i),o=i)}t[o]=!0}return t}function OWe(t){for(let e=0;e<t.length;e++)go(t,e)||(t[e]=null);return t}function ns(t){const e=cM(null);for(const[r,a]of lM(t))go(t,r)&&(Array.isArray(a)?e[r]=OWe(a):a&&typeof a=="object"&&a.constructor===Object?e[r]=ns(a):e[r]=a);return e}function n1(t,e){for(;t!==null;){const a=xWe(t,e);if(a){if(a.get)return ca(a.get);if(typeof a.value=="function")return ca(a.value)}t=AWe(t)}function r(){return null}return r}const Vk=la(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),L3=la(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),R3=la(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),LWe=la(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),N3=la(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),RWe=la(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Bk=la(["#text"]),Pk=la(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),D3=la(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Fk=la(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),H2=la(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),NWe=co(/\{\{[\w\W]*|[\w\W]*\}\}/gm),DWe=co(/<%[\w\W]*|[\w\W]*%>/gm),VWe=co(/\$\{[\w\W]*/gm),BWe=co(/^data-[\-\w.\u00B7-\uFFFF]+$/),PWe=co(/^aria-[\-\w]+$/),uM=co(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),FWe=co(/^(?:\w+script|data):/i),UWe=co(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),dM=co(/^html$/i),jWe=co(/^[a-z][.\w]*(-[.\w]+)+$/i);var Uk=Object.freeze({__proto__:null,ARIA_ATTR:PWe,ATTR_WHITESPACE:UWe,CUSTOM_ELEMENT:jWe,DATA_ATTR:BWe,DOCTYPE_NAME:dM,ERB_EXPR:DWe,IS_ALLOWED_URI:uM,IS_SCRIPT_OR_DATA:FWe,MUSTACHE_EXPR:NWe,TMPLIT_EXPR:VWe});const s1={element:1,text:3,progressingInstruction:7,comment:8,document:9},zWe=function(){return typeof window>"u"?null:window},qWe=function(e,r){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let a=null;const o="data-tt-policy-suffix";r&&r.hasAttribute(o)&&(a=r.getAttribute(o));const i="dompurify"+(a?"#"+a:"");try{return e.createPolicy(i,{createHTML(n){return n},createScriptURL(n){return n}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},jk=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function gM(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:zWe();const e=Oe=>gM(Oe);if(e.version="3.2.4",e.removed=[],!t||!t.document||t.document.nodeType!==s1.document||!t.Element)return e.isSupported=!1,e;let{document:r}=t;const a=r,o=a.currentScript,{DocumentFragment:i,HTMLTemplateElement:n,Node:s,Element:l,NodeFilter:c,NamedNodeMap:u=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:d,DOMParser:g,trustedTypes:h}=t,m=l.prototype,f=n1(m,"cloneNode"),b=n1(m,"remove"),k=n1(m,"nextSibling"),C=n1(m,"childNodes"),w=n1(m,"parentNode");if(typeof n=="function"){const Oe=r.createElement("template");Oe.content&&Oe.content.ownerDocument&&(r=Oe.content.ownerDocument)}let v,A="";const{implementation:E,createNodeIterator:M,createDocumentFragment:P,getElementsByTagName:S}=r,{importNode:N}=a;let q=jk();e.isSupported=typeof lM=="function"&&typeof w=="function"&&E&&E.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:j,ERB_EXPR:J,TMPLIT_EXPR:_,DATA_ATTR:B,ARIA_ATTR:T,IS_SCRIPT_OR_DATA:L,ATTR_WHITESPACE:y,CUSTOM_ELEMENT:I}=Uk;let{IS_ALLOWED_URI:O}=Uk,U=null;const Y=Xe({},[...Vk,...L3,...R3,...N3,...Bk]);let le=null;const me=Xe({},[...Pk,...D3,...Fk,...H2]);let ue=Object.seal(cM(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),xe=null,ve=null,Le=!0,Ye=!0,Ge=!1,st=!0,at=!1,H=!0,V=!1,z=!1,Z=!1,D=!1,R=!1,G=!1,x=!0,F=!1;const X="user-content-";let se=!0,ee=!1,te={},Q=null;const re=Xe({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let ye=null;const Ae=Xe({},["audio","video","img","source","image","track"]);let Et=null;const Ot=Xe({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ft="http://www.w3.org/1998/Math/MathML",tr="http://www.w3.org/2000/svg",Mr="http://www.w3.org/1999/xhtml";let mi=Mr,vr=!1,ga=null;const Jc=Xe({},[Ft,tr,Mr],O3);let Qc=Xe({},["mi","mo","mn","ms","mtext"]),Xc=Xe({},["annotation-xml"]);const vO=Xe({},["title","style","font","a","script"]);let j0=null;const bO=["application/xhtml+xml","text/html"],EO="text/html";let dr=null,el=null;const kO=r.createElement("form"),fw=function($){return $ instanceof RegExp||$ instanceof Function},Yg=function(){let $=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(el&&el===$)){if((!$||typeof $!="object")&&($={}),$=ns($),j0=bO.indexOf($.PARSER_MEDIA_TYPE)===-1?EO:$.PARSER_MEDIA_TYPE,dr=j0==="application/xhtml+xml"?O3:du,U=go($,"ALLOWED_TAGS")?Xe({},$.ALLOWED_TAGS,dr):Y,le=go($,"ALLOWED_ATTR")?Xe({},$.ALLOWED_ATTR,dr):me,ga=go($,"ALLOWED_NAMESPACES")?Xe({},$.ALLOWED_NAMESPACES,O3):Jc,Et=go($,"ADD_URI_SAFE_ATTR")?Xe(ns(Ot),$.ADD_URI_SAFE_ATTR,dr):Ot,ye=go($,"ADD_DATA_URI_TAGS")?Xe(ns(Ae),$.ADD_DATA_URI_TAGS,dr):Ae,Q=go($,"FORBID_CONTENTS")?Xe({},$.FORBID_CONTENTS,dr):re,xe=go($,"FORBID_TAGS")?Xe({},$.FORBID_TAGS,dr):{},ve=go($,"FORBID_ATTR")?Xe({},$.FORBID_ATTR,dr):{},te=go($,"USE_PROFILES")?$.USE_PROFILES:!1,Le=$.ALLOW_ARIA_ATTR!==!1,Ye=$.ALLOW_DATA_ATTR!==!1,Ge=$.ALLOW_UNKNOWN_PROTOCOLS||!1,st=$.ALLOW_SELF_CLOSE_IN_ATTR!==!1,at=$.SAFE_FOR_TEMPLATES||!1,H=$.SAFE_FOR_XML!==!1,V=$.WHOLE_DOCUMENT||!1,D=$.RETURN_DOM||!1,R=$.RETURN_DOM_FRAGMENT||!1,G=$.RETURN_TRUSTED_TYPE||!1,Z=$.FORCE_BODY||!1,x=$.SANITIZE_DOM!==!1,F=$.SANITIZE_NAMED_PROPS||!1,se=$.KEEP_CONTENT!==!1,ee=$.IN_PLACE||!1,O=$.ALLOWED_URI_REGEXP||uM,mi=$.NAMESPACE||Mr,Qc=$.MATHML_TEXT_INTEGRATION_POINTS||Qc,Xc=$.HTML_INTEGRATION_POINTS||Xc,ue=$.CUSTOM_ELEMENT_HANDLING||{},$.CUSTOM_ELEMENT_HANDLING&&fw($.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ue.tagNameCheck=$.CUSTOM_ELEMENT_HANDLING.tagNameCheck),$.CUSTOM_ELEMENT_HANDLING&&fw($.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(ue.attributeNameCheck=$.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),$.CUSTOM_ELEMENT_HANDLING&&typeof $.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(ue.allowCustomizedBuiltInElements=$.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),at&&(Ye=!1),R&&(D=!0),te&&(U=Xe({},Bk),le=[],te.html===!0&&(Xe(U,Vk),Xe(le,Pk)),te.svg===!0&&(Xe(U,L3),Xe(le,D3),Xe(le,H2)),te.svgFilters===!0&&(Xe(U,R3),Xe(le,D3),Xe(le,H2)),te.mathMl===!0&&(Xe(U,N3),Xe(le,Fk),Xe(le,H2))),$.ADD_TAGS&&(U===Y&&(U=ns(U)),Xe(U,$.ADD_TAGS,dr)),$.ADD_ATTR&&(le===me&&(le=ns(le)),Xe(le,$.ADD_ATTR,dr)),$.ADD_URI_SAFE_ATTR&&Xe(Et,$.ADD_URI_SAFE_ATTR,dr),$.FORBID_CONTENTS&&(Q===re&&(Q=ns(Q)),Xe(Q,$.FORBID_CONTENTS,dr)),se&&(U["#text"]=!0),V&&Xe(U,["html","head","body"]),U.table&&(Xe(U,["tbody"]),delete xe.tbody),$.TRUSTED_TYPES_POLICY){if(typeof $.TRUSTED_TYPES_POLICY.createHTML!="function")throw i1('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof $.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw i1('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');v=$.TRUSTED_TYPES_POLICY,A=v.createHTML("")}else v===void 0&&(v=qWe(h,o)),v!==null&&typeof A=="string"&&(A=v.createHTML(""));la&&la($),el=$}},ww=Xe({},[...L3,...R3,...LWe]),vw=Xe({},[...N3,...RWe]),CO=function($){let fe=w($);(!fe||!fe.tagName)&&(fe={namespaceURI:mi,tagName:"template"});const Te=du($.tagName),Lt=du(fe.tagName);return ga[$.namespaceURI]?$.namespaceURI===tr?fe.namespaceURI===Mr?Te==="svg":fe.namespaceURI===Ft?Te==="svg"&&(Lt==="annotation-xml"||Qc[Lt]):!!ww[Te]:$.namespaceURI===Ft?fe.namespaceURI===Mr?Te==="math":fe.namespaceURI===tr?Te==="math"&&Xc[Lt]:!!vw[Te]:$.namespaceURI===Mr?fe.namespaceURI===tr&&!Xc[Lt]||fe.namespaceURI===Ft&&!Qc[Lt]?!1:!vw[Te]&&(vO[Te]||!ww[Te]):!!(j0==="application/xhtml+xml"&&ga[$.namespaceURI]):!1},No=function($){a1(e.removed,{element:$});try{w($).removeChild($)}catch{b($)}},Yc=function($,fe){try{a1(e.removed,{attribute:fe.getAttributeNode($),from:fe})}catch{a1(e.removed,{attribute:null,from:fe})}if(fe.removeAttribute($),$==="is")if(D||R)try{No(fe)}catch{}else try{fe.setAttribute($,"")}catch{}},bw=function($){let fe=null,Te=null;if(Z)$="<remove></remove>"+$;else{const br=Dk($,/^[\r\n\t ]+/);Te=br&&br[0]}j0==="application/xhtml+xml"&&mi===Mr&&($='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+$+"</body></html>");const Lt=v?v.createHTML($):$;if(mi===Mr)try{fe=new g().parseFromString(Lt,j0)}catch{}if(!fe||!fe.documentElement){fe=E.createDocument(mi,"template",null);try{fe.documentElement.innerHTML=vr?A:Lt}catch{}}const Or=fe.body||fe.documentElement;return $&&Te&&Or.insertBefore(r.createTextNode(Te),Or.childNodes[0]||null),mi===Mr?S.call(fe,V?"html":"body")[0]:V?fe.documentElement:Or},Ew=function($){return M.call($.ownerDocument||$,$,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},_g=function($){return $ instanceof d&&(typeof $.nodeName!="string"||typeof $.textContent!="string"||typeof $.removeChild!="function"||!($.attributes instanceof u)||typeof $.removeAttribute!="function"||typeof $.setAttribute!="function"||typeof $.namespaceURI!="string"||typeof $.insertBefore!="function"||typeof $.hasChildNodes!="function")},kw=function($){return typeof s=="function"&&$ instanceof s};function pi(Oe,$,fe){G2(Oe,Te=>{Te.call(e,$,fe,el)})}const Cw=function($){let fe=null;if(pi(q.beforeSanitizeElements,$,null),_g($))return No($),!0;const Te=dr($.nodeName);if(pi(q.uponSanitizeElement,$,{tagName:Te,allowedTags:U}),$.hasChildNodes()&&!kw($.firstElementChild)&&Xr(/<[/\w]/g,$.innerHTML)&&Xr(/<[/\w]/g,$.textContent)||$.nodeType===s1.progressingInstruction||H&&$.nodeType===s1.comment&&Xr(/<[/\w]/g,$.data))return No($),!0;if(!U[Te]||xe[Te]){if(!xe[Te]&&xw(Te)&&(ue.tagNameCheck instanceof RegExp&&Xr(ue.tagNameCheck,Te)||ue.tagNameCheck instanceof Function&&ue.tagNameCheck(Te)))return!1;if(se&&!Q[Te]){const Lt=w($)||$.parentNode,Or=C($)||$.childNodes;if(Or&&Lt){const br=Or.length;for(let ha=br-1;ha>=0;--ha){const Do=f(Or[ha],!0);Do.__removalCount=($.__removalCount||0)+1,Lt.insertBefore(Do,k($))}}}return No($),!0}return $ instanceof l&&!CO($)||(Te==="noscript"||Te==="noembed"||Te==="noframes")&&Xr(/<\/no(script|embed|frames)/i,$.innerHTML)?(No($),!0):(at&&$.nodeType===s1.text&&(fe=$.textContent,G2([j,J,_],Lt=>{fe=o1(fe,Lt," ")}),$.textContent!==fe&&(a1(e.removed,{element:$.cloneNode()}),$.textContent=fe)),pi(q.afterSanitizeElements,$,null),!1)},Aw=function($,fe,Te){if(x&&(fe==="id"||fe==="name")&&(Te in r||Te in kO))return!1;if(!(Ye&&!ve[fe]&&Xr(B,fe))){if(!(Le&&Xr(T,fe))){if(!le[fe]||ve[fe]){if(!(xw($)&&(ue.tagNameCheck instanceof RegExp&&Xr(ue.tagNameCheck,$)||ue.tagNameCheck instanceof Function&&ue.tagNameCheck($))&&(ue.attributeNameCheck instanceof RegExp&&Xr(ue.attributeNameCheck,fe)||ue.attributeNameCheck instanceof Function&&ue.attributeNameCheck(fe))||fe==="is"&&ue.allowCustomizedBuiltInElements&&(ue.tagNameCheck instanceof RegExp&&Xr(ue.tagNameCheck,Te)||ue.tagNameCheck instanceof Function&&ue.tagNameCheck(Te))))return!1}else if(!Et[fe]){if(!Xr(O,o1(Te,y,""))){if(!((fe==="src"||fe==="xlink:href"||fe==="href")&&$!=="script"&&SWe(Te,"data:")===0&&ye[$])){if(!(Ge&&!Xr(L,o1(Te,y,"")))){if(Te)return!1}}}}}}return!0},xw=function($){return $!=="annotation-xml"&&Dk($,I)},yw=function($){pi(q.beforeSanitizeAttributes,$,null);const{attributes:fe}=$;if(!fe||_g($))return;const Te={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:le,forceKeepAttr:void 0};let Lt=fe.length;for(;Lt--;){const Or=fe[Lt],{name:br,namespaceURI:ha,value:Do}=Or,z0=dr(br);let Qr=br==="value"?Do:IWe(Do);if(Te.attrName=z0,Te.attrValue=Qr,Te.keepAttr=!0,Te.forceKeepAttr=void 0,pi(q.uponSanitizeAttribute,$,Te),Qr=Te.attrValue,F&&(z0==="id"||z0==="name")&&(Yc(br,$),Qr=X+Qr),H&&Xr(/((--!?|])>)|<\/(style|title)/i,Qr)){Yc(br,$);continue}if(Te.forceKeepAttr||(Yc(br,$),!Te.keepAttr))continue;if(!st&&Xr(/\/>/i,Qr)){Yc(br,$);continue}at&&G2([j,J,_],Sw=>{Qr=o1(Qr,Sw," ")});const Tw=dr($.nodeName);if(Aw(Tw,z0,Qr)){if(v&&typeof h=="object"&&typeof h.getAttributeType=="function"&&!ha)switch(h.getAttributeType(Tw,z0)){case"TrustedHTML":{Qr=v.createHTML(Qr);break}case"TrustedScriptURL":{Qr=v.createScriptURL(Qr);break}}try{ha?$.setAttributeNS(ha,br,Qr):$.setAttribute(br,Qr),_g($)?No($):Nk(e.removed)}catch{}}}pi(q.afterSanitizeAttributes,$,null)},AO=function Oe($){let fe=null;const Te=Ew($);for(pi(q.beforeSanitizeShadowDOM,$,null);fe=Te.nextNode();)pi(q.uponSanitizeShadowNode,fe,null),Cw(fe),yw(fe),fe.content instanceof i&&Oe(fe.content);pi(q.afterSanitizeShadowDOM,$,null)};return e.sanitize=function(Oe){let $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},fe=null,Te=null,Lt=null,Or=null;if(vr=!Oe,vr&&(Oe="<!-->"),typeof Oe!="string"&&!kw(Oe))if(typeof Oe.toString=="function"){if(Oe=Oe.toString(),typeof Oe!="string")throw i1("dirty is not a string, aborting")}else throw i1("toString is not a function");if(!e.isSupported)return Oe;if(z||Yg($),e.removed=[],typeof Oe=="string"&&(ee=!1),ee){if(Oe.nodeName){const Do=dr(Oe.nodeName);if(!U[Do]||xe[Do])throw i1("root node is forbidden and cannot be sanitized in-place")}}else if(Oe instanceof s)fe=bw("<!---->"),Te=fe.ownerDocument.importNode(Oe,!0),Te.nodeType===s1.element&&Te.nodeName==="BODY"||Te.nodeName==="HTML"?fe=Te:fe.appendChild(Te);else{if(!D&&!at&&!V&&Oe.indexOf("<")===-1)return v&&G?v.createHTML(Oe):Oe;if(fe=bw(Oe),!fe)return D?null:G?A:""}fe&&Z&&No(fe.firstChild);const br=Ew(ee?Oe:fe);for(;Lt=br.nextNode();)Cw(Lt),yw(Lt),Lt.content instanceof i&&AO(Lt.content);if(ee)return Oe;if(D){if(R)for(Or=P.call(fe.ownerDocument);fe.firstChild;)Or.appendChild(fe.firstChild);else Or=fe;return(le.shadowroot||le.shadowrootmode)&&(Or=N.call(a,Or,!0)),Or}let ha=V?fe.outerHTML:fe.innerHTML;return V&&U["!doctype"]&&fe.ownerDocument&&fe.ownerDocument.doctype&&fe.ownerDocument.doctype.name&&Xr(dM,fe.ownerDocument.doctype.name)&&(ha="<!DOCTYPE "+fe.ownerDocument.doctype.name+`>
|
|
187
187
|
`+ha),at&&G2([j,J,_],Do=>{ha=o1(ha,Do," ")}),v&&G?v.createHTML(ha):ha},e.setConfig=function(){let Oe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Yg(Oe),z=!0},e.clearConfig=function(){el=null,z=!1},e.isValidAttribute=function(Oe,$,fe){el||Yg({});const Te=dr(Oe),Lt=dr($);return Aw(Te,Lt,fe)},e.addHook=function(Oe,$){typeof $=="function"&&a1(q[Oe],$)},e.removeHook=function(Oe,$){if($!==void 0){const fe=yWe(q[Oe],$);return fe===-1?void 0:TWe(q[Oe],fe,1)[0]}return Nk(q[Oe])},e.removeHooks=function(Oe){q[Oe]=[]},e.removeAllHooks=function(){q=jk()},e}var GWe=gM();function HWe(t,e){const r=t.hooks??{};let a;for(a in r){const o=r[a];o!==void 0&&e.addHook(a,o)}}function hM(){return GWe()}function KWe(t={},e=hM){const r=e();HWe(t,r);const a=function(o,i){const n=i.value;if(i.oldValue===n)return;const s=`${n}`,l=i.arg,c=t.namedConfigurations,u=t.default??{};if(c&&l!==void 0){o.innerHTML=r.sanitize(s,c[l]??u);return}o.innerHTML=r.sanitize(s,u)};return{mounted:a,updated:a}}const WWe={install(t,e={},r=hM){t.directive("dompurify-html",KWe(e,r))}},ZWe=t=>{"target"in t&&t.setAttribute("target","_blank")},JWe={hooks:{afterSanitizeAttributes:ZWe}},zk=Fj({legacy:!1,locale:"en",messages:{en:ZFe}}),QWe={configureApp(t){t.use(bc),t.use(WWe,JWe),t.use(zk),t.provide(Jx,zk),sM.init(bc,window.__PUBSUB_TOKEN__)}},XWe=Wd(yBe,QWe),YWe=()=>{customElements.get("chatwoot-message-list")||(customElements.define("chatwoot-message-list",XWe),console.log("✅ Registered chatwoot-message-list Web Component"))};function mM(t,e){return function(){return t.apply(e,arguments)}}const{toString:_We}=Object.prototype,{getPrototypeOf:iw}=Object,Gg=(t=>e=>{const r=_We.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Ro=t=>(t=t.toLowerCase(),e=>Gg(e)===t),Hg=t=>e=>typeof e===t,{isArray:P0}=Array,Ec=Hg("undefined");function $We(t){return t!==null&&!Ec(t)&&t.constructor!==null&&!Ec(t.constructor)&&Pa(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const pM=Ro("ArrayBuffer");function eZe(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&pM(t.buffer),e}const tZe=Hg("string"),Pa=Hg("function"),fM=Hg("number"),Kg=t=>t!==null&&typeof t=="object",rZe=t=>t===!0||t===!1,gu=t=>{if(Gg(t)!=="object")return!1;const e=iw(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},aZe=Ro("Date"),oZe=Ro("File"),iZe=Ro("Blob"),nZe=Ro("FileList"),sZe=t=>Kg(t)&&Pa(t.pipe),lZe=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Pa(t.append)&&((e=Gg(t))==="formdata"||e==="object"&&Pa(t.toString)&&t.toString()==="[object FormData]"))},cZe=Ro("URLSearchParams"),[uZe,dZe,gZe,hZe]=["ReadableStream","Request","Response","Headers"].map(Ro),mZe=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Wc(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let a,o;if(typeof t!="object"&&(t=[t]),P0(t))for(a=0,o=t.length;a<o;a++)e.call(null,t[a],a,t);else{const i=r?Object.getOwnPropertyNames(t):Object.keys(t),n=i.length;let s;for(a=0;a<n;a++)s=i[a],e.call(null,t[s],s,t)}}function wM(t,e){e=e.toLowerCase();const r=Object.keys(t);let a=r.length,o;for(;a-- >0;)if(o=r[a],e===o.toLowerCase())return o;return null}const ps=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,vM=t=>!Ec(t)&&t!==ps;function zp(){const{caseless:t}=vM(this)&&this||{},e={},r=(a,o)=>{const i=t&&wM(e,o)||o;gu(e[i])&&gu(a)?e[i]=zp(e[i],a):gu(a)?e[i]=zp({},a):P0(a)?e[i]=a.slice():e[i]=a};for(let a=0,o=arguments.length;a<o;a++)arguments[a]&&Wc(arguments[a],r);return e}const pZe=(t,e,r,{allOwnKeys:a}={})=>(Wc(e,(o,i)=>{r&&Pa(o)?t[i]=mM(o,r):t[i]=o},{allOwnKeys:a}),t),fZe=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),wZe=(t,e,r,a)=>{t.prototype=Object.create(e.prototype,a),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},vZe=(t,e,r,a)=>{let o,i,n;const s={};if(e=e||{},t==null)return e;do{for(o=Object.getOwnPropertyNames(t),i=o.length;i-- >0;)n=o[i],(!a||a(n,t,e))&&!s[n]&&(e[n]=t[n],s[n]=!0);t=r!==!1&&iw(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},bZe=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;const a=t.indexOf(e,r);return a!==-1&&a===r},EZe=t=>{if(!t)return null;if(P0(t))return t;let e=t.length;if(!fM(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},kZe=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&iw(Uint8Array)),CZe=(t,e)=>{const a=(t&&t[Symbol.iterator]).call(t);let o;for(;(o=a.next())&&!o.done;){const i=o.value;e.call(t,i[0],i[1])}},AZe=(t,e)=>{let r;const a=[];for(;(r=t.exec(e))!==null;)a.push(r);return a},xZe=Ro("HTMLFormElement"),yZe=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,a,o){return a.toUpperCase()+o}),qk=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),TZe=Ro("RegExp"),bM=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),a={};Wc(r,(o,i)=>{let n;(n=e(o,i,t))!==!1&&(a[i]=n||o)}),Object.defineProperties(t,a)},SZe=t=>{bM(t,(e,r)=>{if(Pa(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const a=t[r];if(Pa(a)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},IZe=(t,e)=>{const r={},a=o=>{o.forEach(i=>{r[i]=!0})};return P0(t)?a(t):a(String(t).split(e)),r},MZe=()=>{},OZe=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function LZe(t){return!!(t&&Pa(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const RZe=t=>{const e=new Array(10),r=(a,o)=>{if(Kg(a)){if(e.indexOf(a)>=0)return;if(!("toJSON"in a)){e[o]=a;const i=P0(a)?[]:{};return Wc(a,(n,s)=>{const l=r(n,o+1);!Ec(l)&&(i[s]=l)}),e[o]=void 0,i}}return a};return r(t,0)},NZe=Ro("AsyncFunction"),DZe=t=>t&&(Kg(t)||Pa(t))&&Pa(t.then)&&Pa(t.catch),EM=((t,e)=>t?setImmediate:e?((r,a)=>(ps.addEventListener("message",({source:o,data:i})=>{o===ps&&i===r&&a.length&&a.shift()()},!1),o=>{a.push(o),ps.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Pa(ps.postMessage)),VZe=typeof queueMicrotask<"u"?queueMicrotask.bind(ps):typeof process<"u"&&process.nextTick||EM,ne={isArray:P0,isArrayBuffer:pM,isBuffer:$We,isFormData:lZe,isArrayBufferView:eZe,isString:tZe,isNumber:fM,isBoolean:rZe,isObject:Kg,isPlainObject:gu,isReadableStream:uZe,isRequest:dZe,isResponse:gZe,isHeaders:hZe,isUndefined:Ec,isDate:aZe,isFile:oZe,isBlob:iZe,isRegExp:TZe,isFunction:Pa,isStream:sZe,isURLSearchParams:cZe,isTypedArray:kZe,isFileList:nZe,forEach:Wc,merge:zp,extend:pZe,trim:mZe,stripBOM:fZe,inherits:wZe,toFlatObject:vZe,kindOf:Gg,kindOfTest:Ro,endsWith:bZe,toArray:EZe,forEachEntry:CZe,matchAll:AZe,isHTMLForm:xZe,hasOwnProperty:qk,hasOwnProp:qk,reduceDescriptors:bM,freezeMethods:SZe,toObjectSet:IZe,toCamelCase:yZe,noop:MZe,toFiniteNumber:OZe,findKey:wM,global:ps,isContextDefined:vM,isSpecCompliantForm:LZe,toJSONObject:RZe,isAsyncFn:NZe,isThenable:DZe,setImmediate:EM,asap:VZe};function He(t,e,r,a,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),a&&(this.request=a),o&&(this.response=o,this.status=o.status?o.status:null)}ne.inherits(He,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:ne.toJSONObject(this.config),code:this.code,status:this.status}}});const kM=He.prototype,CM={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{CM[t]={value:t}});Object.defineProperties(He,CM);Object.defineProperty(kM,"isAxiosError",{value:!0});He.from=(t,e,r,a,o,i)=>{const n=Object.create(kM);return ne.toFlatObject(t,n,function(l){return l!==Error.prototype},s=>s!=="isAxiosError"),He.call(n,t.message,e,r,a,o),n.cause=t,n.name=t.name,i&&Object.assign(n,i),n};const BZe=null;function qp(t){return ne.isPlainObject(t)||ne.isArray(t)}function AM(t){return ne.endsWith(t,"[]")?t.slice(0,-2):t}function Gk(t,e,r){return t?t.concat(e).map(function(o,i){return o=AM(o),!r&&i?"["+o+"]":o}).join(r?".":""):e}function PZe(t){return ne.isArray(t)&&!t.some(qp)}const FZe=ne.toFlatObject(ne,{},null,function(e){return/^is[A-Z]/.test(e)});function Wg(t,e,r){if(!ne.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,r=ne.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(f,b){return!ne.isUndefined(b[f])});const a=r.metaTokens,o=r.visitor||u,i=r.dots,n=r.indexes,l=(r.Blob||typeof Blob<"u"&&Blob)&&ne.isSpecCompliantForm(e);if(!ne.isFunction(o))throw new TypeError("visitor must be a function");function c(m){if(m===null)return"";if(ne.isDate(m))return m.toISOString();if(!l&&ne.isBlob(m))throw new He("Blob is not supported. Use a Buffer instead.");return ne.isArrayBuffer(m)||ne.isTypedArray(m)?l&&typeof Blob=="function"?new Blob([m]):Buffer.from(m):m}function u(m,f,b){let k=m;if(m&&!b&&typeof m=="object"){if(ne.endsWith(f,"{}"))f=a?f:f.slice(0,-2),m=JSON.stringify(m);else if(ne.isArray(m)&&PZe(m)||(ne.isFileList(m)||ne.endsWith(f,"[]"))&&(k=ne.toArray(m)))return f=AM(f),k.forEach(function(w,v){!(ne.isUndefined(w)||w===null)&&e.append(n===!0?Gk([f],v,i):n===null?f:f+"[]",c(w))}),!1}return qp(m)?!0:(e.append(Gk(b,f,i),c(m)),!1)}const d=[],g=Object.assign(FZe,{defaultVisitor:u,convertValue:c,isVisitable:qp});function h(m,f){if(!ne.isUndefined(m)){if(d.indexOf(m)!==-1)throw Error("Circular reference detected in "+f.join("."));d.push(m),ne.forEach(m,function(k,C){(!(ne.isUndefined(k)||k===null)&&o.call(e,k,ne.isString(C)?C.trim():C,f,g))===!0&&h(k,f?f.concat(C):[C])}),d.pop()}}if(!ne.isObject(t))throw new TypeError("data must be an object");return h(t),e}function Hk(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(a){return e[a]})}function nw(t,e){this._pairs=[],t&&Wg(t,this,e)}const xM=nw.prototype;xM.append=function(e,r){this._pairs.push([e,r])};xM.toString=function(e){const r=e?function(a){return e.call(this,a,Hk)}:Hk;return this._pairs.map(function(o){return r(o[0])+"="+r(o[1])},"").join("&")};function UZe(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function yM(t,e,r){if(!e)return t;const a=r&&r.encode||UZe;ne.isFunction(r)&&(r={serialize:r});const o=r&&r.serialize;let i;if(o?i=o(e,r):i=ne.isURLSearchParams(e)?e.toString():new nw(e,r).toString(a),i){const n=t.indexOf("#");n!==-1&&(t=t.slice(0,n)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}class Kk{constructor(){this.handlers=[]}use(e,r,a){return this.handlers.push({fulfilled:e,rejected:r,synchronous:a?a.synchronous:!1,runWhen:a?a.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){ne.forEach(this.handlers,function(a){a!==null&&e(a)})}}const TM={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},jZe=typeof URLSearchParams<"u"?URLSearchParams:nw,zZe=typeof FormData<"u"?FormData:null,qZe=typeof Blob<"u"?Blob:null,GZe={isBrowser:!0,classes:{URLSearchParams:jZe,FormData:zZe,Blob:qZe},protocols:["http","https","file","blob","url","data"]},sw=typeof window<"u"&&typeof document<"u",Gp=typeof navigator=="object"&&navigator||void 0,HZe=sw&&(!Gp||["ReactNative","NativeScript","NS"].indexOf(Gp.product)<0),KZe=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",WZe=sw&&window.location.href||"http://localhost",ZZe=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:sw,hasStandardBrowserEnv:HZe,hasStandardBrowserWebWorkerEnv:KZe,navigator:Gp,origin:WZe},Symbol.toStringTag,{value:"Module"})),Ur={...ZZe,...GZe};function JZe(t,e){return Wg(t,new Ur.classes.URLSearchParams,Object.assign({visitor:function(r,a,o,i){return Ur.isNode&&ne.isBuffer(r)?(this.append(a,r.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},e))}function QZe(t){return ne.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function XZe(t){const e={},r=Object.keys(t);let a;const o=r.length;let i;for(a=0;a<o;a++)i=r[a],e[i]=t[i];return e}function SM(t){function e(r,a,o,i){let n=r[i++];if(n==="__proto__")return!0;const s=Number.isFinite(+n),l=i>=r.length;return n=!n&&ne.isArray(o)?o.length:n,l?(ne.hasOwnProp(o,n)?o[n]=[o[n],a]:o[n]=a,!s):((!o[n]||!ne.isObject(o[n]))&&(o[n]=[]),e(r,a,o[n],i)&&ne.isArray(o[n])&&(o[n]=XZe(o[n])),!s)}if(ne.isFormData(t)&&ne.isFunction(t.entries)){const r={};return ne.forEachEntry(t,(a,o)=>{e(QZe(a),o,r,0)}),r}return null}function YZe(t,e,r){if(ne.isString(t))try{return(e||JSON.parse)(t),ne.trim(t)}catch(a){if(a.name!=="SyntaxError")throw a}return(r||JSON.stringify)(t)}const Zc={transitional:TM,adapter:["xhr","http","fetch"],transformRequest:[function(e,r){const a=r.getContentType()||"",o=a.indexOf("application/json")>-1,i=ne.isObject(e);if(i&&ne.isHTMLForm(e)&&(e=new FormData(e)),ne.isFormData(e))return o?JSON.stringify(SM(e)):e;if(ne.isArrayBuffer(e)||ne.isBuffer(e)||ne.isStream(e)||ne.isFile(e)||ne.isBlob(e)||ne.isReadableStream(e))return e;if(ne.isArrayBufferView(e))return e.buffer;if(ne.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let s;if(i){if(a.indexOf("application/x-www-form-urlencoded")>-1)return JZe(e,this.formSerializer).toString();if((s=ne.isFileList(e))||a.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return Wg(s?{"files[]":e}:e,l&&new l,this.formSerializer)}}return i||o?(r.setContentType("application/json",!1),YZe(e)):e}],transformResponse:[function(e){const r=this.transitional||Zc.transitional,a=r&&r.forcedJSONParsing,o=this.responseType==="json";if(ne.isResponse(e)||ne.isReadableStream(e))return e;if(e&&ne.isString(e)&&(a&&!this.responseType||o)){const n=!(r&&r.silentJSONParsing)&&o;try{return JSON.parse(e)}catch(s){if(n)throw s.name==="SyntaxError"?He.from(s,He.ERR_BAD_RESPONSE,this,null,this.response):s}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ur.classes.FormData,Blob:Ur.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ne.forEach(["delete","get","head","post","put","patch"],t=>{Zc.headers[t]={}});const _Ze=ne.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),$Ze=t=>{const e={};let r,a,o;return t&&t.split(`
|
|
188
188
|
`).forEach(function(n){o=n.indexOf(":"),r=n.substring(0,o).trim().toLowerCase(),a=n.substring(o+1).trim(),!(!r||e[r]&&_Ze[r])&&(r==="set-cookie"?e[r]?e[r].push(a):e[r]=[a]:e[r]=e[r]?e[r]+", "+a:a)}),e},Wk=Symbol("internals");function l1(t){return t&&String(t).trim().toLowerCase()}function hu(t){return t===!1||t==null?t:ne.isArray(t)?t.map(hu):String(t)}function eJe(t){const e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let a;for(;a=r.exec(t);)e[a[1]]=a[2];return e}const tJe=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function V3(t,e,r,a,o){if(ne.isFunction(a))return a.call(this,e,r);if(o&&(e=r),!!ne.isString(e)){if(ne.isString(a))return e.indexOf(a)!==-1;if(ne.isRegExp(a))return a.test(e)}}function rJe(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,a)=>r.toUpperCase()+a)}function aJe(t,e){const r=ne.toCamelCase(" "+e);["get","set","has"].forEach(a=>{Object.defineProperty(t,a+r,{value:function(o,i,n){return this[a].call(this,e,o,i,n)},configurable:!0})})}let xa=class{constructor(e){e&&this.set(e)}set(e,r,a){const o=this;function i(s,l,c){const u=l1(l);if(!u)throw new Error("header name must be a non-empty string");const d=ne.findKey(o,u);(!d||o[d]===void 0||c===!0||c===void 0&&o[d]!==!1)&&(o[d||l]=hu(s))}const n=(s,l)=>ne.forEach(s,(c,u)=>i(c,u,l));if(ne.isPlainObject(e)||e instanceof this.constructor)n(e,r);else if(ne.isString(e)&&(e=e.trim())&&!tJe(e))n($Ze(e),r);else if(ne.isHeaders(e))for(const[s,l]of e.entries())i(l,s,a);else e!=null&&i(r,e,a);return this}get(e,r){if(e=l1(e),e){const a=ne.findKey(this,e);if(a){const o=this[a];if(!r)return o;if(r===!0)return eJe(o);if(ne.isFunction(r))return r.call(this,o,a);if(ne.isRegExp(r))return r.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=l1(e),e){const a=ne.findKey(this,e);return!!(a&&this[a]!==void 0&&(!r||V3(this,this[a],a,r)))}return!1}delete(e,r){const a=this;let o=!1;function i(n){if(n=l1(n),n){const s=ne.findKey(a,n);s&&(!r||V3(a,a[s],s,r))&&(delete a[s],o=!0)}}return ne.isArray(e)?e.forEach(i):i(e),o}clear(e){const r=Object.keys(this);let a=r.length,o=!1;for(;a--;){const i=r[a];(!e||V3(this,this[i],i,e,!0))&&(delete this[i],o=!0)}return o}normalize(e){const r=this,a={};return ne.forEach(this,(o,i)=>{const n=ne.findKey(a,i);if(n){r[n]=hu(o),delete r[i];return}const s=e?rJe(i):String(i).trim();s!==i&&delete r[i],r[s]=hu(o),a[s]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const r=Object.create(null);return ne.forEach(this,(a,o)=>{a!=null&&a!==!1&&(r[o]=e&&ne.isArray(a)?a.join(", "):a)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(`
|
|
189
189
|
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){const a=new this(e);return r.forEach(o=>a.set(o)),a}static accessor(e){const a=(this[Wk]=this[Wk]={accessors:{}}).accessors,o=this.prototype;function i(n){const s=l1(n);a[s]||(aJe(o,n),a[s]=!0)}return ne.isArray(e)?e.forEach(i):i(e),this}};xa.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);ne.reduceDescriptors(xa.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(a){this[r]=a}}});ne.freezeMethods(xa);function B3(t,e){const r=this||Zc,a=e||r,o=xa.from(a.headers);let i=a.data;return ne.forEach(t,function(s){i=s.call(r,i,o.normalize(),e?e.status:void 0)}),o.normalize(),i}function IM(t){return!!(t&&t.__CANCEL__)}function F0(t,e,r){He.call(this,t??"canceled",He.ERR_CANCELED,e,r),this.name="CanceledError"}ne.inherits(F0,He,{__CANCEL__:!0});function MM(t,e,r){const a=r.config.validateStatus;!r.status||!a||a(r.status)?t(r):e(new He("Request failed with status code "+r.status,[He.ERR_BAD_REQUEST,He.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function oJe(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function iJe(t,e){t=t||10;const r=new Array(t),a=new Array(t);let o=0,i=0,n;return e=e!==void 0?e:1e3,function(l){const c=Date.now(),u=a[i];n||(n=c),r[o]=l,a[o]=c;let d=i,g=0;for(;d!==o;)g+=r[d++],d=d%t;if(o=(o+1)%t,o===i&&(i=(i+1)%t),c-n<e)return;const h=u&&c-u;return h?Math.round(g*1e3/h):void 0}}function nJe(t,e){let r=0,a=1e3/e,o,i;const n=(c,u=Date.now())=>{r=u,o=null,i&&(clearTimeout(i),i=null),t.apply(null,c)};return[(...c)=>{const u=Date.now(),d=u-r;d>=a?n(c,u):(o=c,i||(i=setTimeout(()=>{i=null,n(o)},a-d)))},()=>o&&n(o)]}const bd=(t,e,r=3)=>{let a=0;const o=iJe(50,250);return nJe(i=>{const n=i.loaded,s=i.lengthComputable?i.total:void 0,l=n-a,c=o(l),u=n<=s;a=n;const d={loaded:n,total:s,progress:s?n/s:void 0,bytes:l,rate:c||void 0,estimated:c&&s&&u?(s-n)/c:void 0,event:i,lengthComputable:s!=null,[e?"download":"upload"]:!0};t(d)},r)},Zk=(t,e)=>{const r=t!=null;return[a=>e[0]({lengthComputable:r,total:t,loaded:a}),e[1]]},Jk=t=>(...e)=>ne.asap(()=>t(...e)),sJe=Ur.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,Ur.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL(Ur.origin),Ur.navigator&&/(msie|trident)/i.test(Ur.navigator.userAgent)):()=>!0,lJe=Ur.hasStandardBrowserEnv?{write(t,e,r,a,o,i){const n=[t+"="+encodeURIComponent(e)];ne.isNumber(r)&&n.push("expires="+new Date(r).toGMTString()),ne.isString(a)&&n.push("path="+a),ne.isString(o)&&n.push("domain="+o),i===!0&&n.push("secure"),document.cookie=n.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function cJe(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function uJe(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function OM(t,e,r){let a=!cJe(e);return t&&a||r==!1?uJe(t,e):e}const Qk=t=>t instanceof xa?{...t}:t;function qs(t,e){e=e||{};const r={};function a(c,u,d,g){return ne.isPlainObject(c)&&ne.isPlainObject(u)?ne.merge.call({caseless:g},c,u):ne.isPlainObject(u)?ne.merge({},u):ne.isArray(u)?u.slice():u}function o(c,u,d,g){if(ne.isUndefined(u)){if(!ne.isUndefined(c))return a(void 0,c,d,g)}else return a(c,u,d,g)}function i(c,u){if(!ne.isUndefined(u))return a(void 0,u)}function n(c,u){if(ne.isUndefined(u)){if(!ne.isUndefined(c))return a(void 0,c)}else return a(void 0,u)}function s(c,u,d){if(d in e)return a(c,u);if(d in t)return a(void 0,c)}const l={url:i,method:i,data:i,baseURL:n,transformRequest:n,transformResponse:n,paramsSerializer:n,timeout:n,timeoutMessage:n,withCredentials:n,withXSRFToken:n,adapter:n,responseType:n,xsrfCookieName:n,xsrfHeaderName:n,onUploadProgress:n,onDownloadProgress:n,decompress:n,maxContentLength:n,maxBodyLength:n,beforeRedirect:n,transport:n,httpAgent:n,httpsAgent:n,cancelToken:n,socketPath:n,responseEncoding:n,validateStatus:s,headers:(c,u,d)=>o(Qk(c),Qk(u),d,!0)};return ne.forEach(Object.keys(Object.assign({},t,e)),function(u){const d=l[u]||o,g=d(t[u],e[u],u);ne.isUndefined(g)&&d!==s||(r[u]=g)}),r}const LM=t=>{const e=qs({},t);let{data:r,withXSRFToken:a,xsrfHeaderName:o,xsrfCookieName:i,headers:n,auth:s}=e;e.headers=n=xa.from(n),e.url=yM(OM(e.baseURL,e.url),t.params,t.paramsSerializer),s&&n.set("Authorization","Basic "+btoa((s.username||"")+":"+(s.password?unescape(encodeURIComponent(s.password)):"")));let l;if(ne.isFormData(r)){if(Ur.hasStandardBrowserEnv||Ur.hasStandardBrowserWebWorkerEnv)n.setContentType(void 0);else if((l=n.getContentType())!==!1){const[c,...u]=l?l.split(";").map(d=>d.trim()).filter(Boolean):[];n.setContentType([c||"multipart/form-data",...u].join("; "))}}if(Ur.hasStandardBrowserEnv&&(a&&ne.isFunction(a)&&(a=a(e)),a||a!==!1&&sJe(e.url))){const c=o&&i&&lJe.read(i);c&&n.set(o,c)}return e},dJe=typeof XMLHttpRequest<"u",gJe=dJe&&function(t){return new Promise(function(r,a){const o=LM(t);let i=o.data;const n=xa.from(o.headers).normalize();let{responseType:s,onUploadProgress:l,onDownloadProgress:c}=o,u,d,g,h,m;function f(){h&&h(),m&&m(),o.cancelToken&&o.cancelToken.unsubscribe(u),o.signal&&o.signal.removeEventListener("abort",u)}let b=new XMLHttpRequest;b.open(o.method.toUpperCase(),o.url,!0),b.timeout=o.timeout;function k(){if(!b)return;const w=xa.from("getAllResponseHeaders"in b&&b.getAllResponseHeaders()),A={data:!s||s==="text"||s==="json"?b.responseText:b.response,status:b.status,statusText:b.statusText,headers:w,config:t,request:b};MM(function(M){r(M),f()},function(M){a(M),f()},A),b=null}"onloadend"in b?b.onloadend=k:b.onreadystatechange=function(){!b||b.readyState!==4||b.status===0&&!(b.responseURL&&b.responseURL.indexOf("file:")===0)||setTimeout(k)},b.onabort=function(){b&&(a(new He("Request aborted",He.ECONNABORTED,t,b)),b=null)},b.onerror=function(){a(new He("Network Error",He.ERR_NETWORK,t,b)),b=null},b.ontimeout=function(){let v=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const A=o.transitional||TM;o.timeoutErrorMessage&&(v=o.timeoutErrorMessage),a(new He(v,A.clarifyTimeoutError?He.ETIMEDOUT:He.ECONNABORTED,t,b)),b=null},i===void 0&&n.setContentType(null),"setRequestHeader"in b&&ne.forEach(n.toJSON(),function(v,A){b.setRequestHeader(A,v)}),ne.isUndefined(o.withCredentials)||(b.withCredentials=!!o.withCredentials),s&&s!=="json"&&(b.responseType=o.responseType),c&&([g,m]=bd(c,!0),b.addEventListener("progress",g)),l&&b.upload&&([d,h]=bd(l),b.upload.addEventListener("progress",d),b.upload.addEventListener("loadend",h)),(o.cancelToken||o.signal)&&(u=w=>{b&&(a(!w||w.type?new F0(null,t,b):w),b.abort(),b=null)},o.cancelToken&&o.cancelToken.subscribe(u),o.signal&&(o.signal.aborted?u():o.signal.addEventListener("abort",u)));const C=oJe(o.url);if(C&&Ur.protocols.indexOf(C)===-1){a(new He("Unsupported protocol "+C+":",He.ERR_BAD_REQUEST,t));return}b.send(i||null)})},hJe=(t,e)=>{const{length:r}=t=t?t.filter(Boolean):[];if(e||r){let a=new AbortController,o;const i=function(c){if(!o){o=!0,s();const u=c instanceof Error?c:this.reason;a.abort(u instanceof He?u:new F0(u instanceof Error?u.message:u))}};let n=e&&setTimeout(()=>{n=null,i(new He(`timeout ${e} of ms exceeded`,He.ETIMEDOUT))},e);const s=()=>{t&&(n&&clearTimeout(n),n=null,t.forEach(c=>{c.unsubscribe?c.unsubscribe(i):c.removeEventListener("abort",i)}),t=null)};t.forEach(c=>c.addEventListener("abort",i));const{signal:l}=a;return l.unsubscribe=()=>ne.asap(s),l}},mJe=function*(t,e){let r=t.byteLength;if(r<e){yield t;return}let a=0,o;for(;a<r;)o=a+e,yield t.slice(a,o),a=o},pJe=async function*(t,e){for await(const r of fJe(t))yield*mJe(r,e)},fJe=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:r,value:a}=await e.read();if(r)break;yield a}}finally{await e.cancel()}},Xk=(t,e,r,a)=>{const o=pJe(t,e);let i=0,n,s=l=>{n||(n=!0,a&&a(l))};return new ReadableStream({async pull(l){try{const{done:c,value:u}=await o.next();if(c){s(),l.close();return}let d=u.byteLength;if(r){let g=i+=d;r(g)}l.enqueue(new Uint8Array(u))}catch(c){throw s(c),c}},cancel(l){return s(l),o.return()}},{highWaterMark:2})},Zg=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",RM=Zg&&typeof ReadableStream=="function",wJe=Zg&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),NM=(t,...e)=>{try{return!!t(...e)}catch{return!1}},vJe=RM&&NM(()=>{let t=!1;const e=new Request(Ur.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),Yk=64*1024,Hp=RM&&NM(()=>ne.isReadableStream(new Response("").body)),Ed={stream:Hp&&(t=>t.body)};Zg&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!Ed[e]&&(Ed[e]=ne.isFunction(t[e])?r=>r[e]():(r,a)=>{throw new He(`Response type '${e}' is not supported`,He.ERR_NOT_SUPPORT,a)})})})(new Response);const bJe=async t=>{if(t==null)return 0;if(ne.isBlob(t))return t.size;if(ne.isSpecCompliantForm(t))return(await new Request(Ur.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(ne.isArrayBufferView(t)||ne.isArrayBuffer(t))return t.byteLength;if(ne.isURLSearchParams(t)&&(t=t+""),ne.isString(t))return(await wJe(t)).byteLength},EJe=async(t,e)=>{const r=ne.toFiniteNumber(t.getContentLength());return r??bJe(e)},kJe=Zg&&(async t=>{let{url:e,method:r,data:a,signal:o,cancelToken:i,timeout:n,onDownloadProgress:s,onUploadProgress:l,responseType:c,headers:u,withCredentials:d="same-origin",fetchOptions:g}=LM(t);c=c?(c+"").toLowerCase():"text";let h=hJe([o,i&&i.toAbortSignal()],n),m;const f=h&&h.unsubscribe&&(()=>{h.unsubscribe()});let b;try{if(l&&vJe&&r!=="get"&&r!=="head"&&(b=await EJe(u,a))!==0){let A=new Request(e,{method:"POST",body:a,duplex:"half"}),E;if(ne.isFormData(a)&&(E=A.headers.get("content-type"))&&u.setContentType(E),A.body){const[M,P]=Zk(b,bd(Jk(l)));a=Xk(A.body,Yk,M,P)}}ne.isString(d)||(d=d?"include":"omit");const k="credentials"in Request.prototype;m=new Request(e,{...g,signal:h,method:r.toUpperCase(),headers:u.normalize().toJSON(),body:a,duplex:"half",credentials:k?d:void 0});let C=await fetch(m);const w=Hp&&(c==="stream"||c==="response");if(Hp&&(s||w&&f)){const A={};["status","statusText","headers"].forEach(S=>{A[S]=C[S]});const E=ne.toFiniteNumber(C.headers.get("content-length")),[M,P]=s&&Zk(E,bd(Jk(s),!0))||[];C=new Response(Xk(C.body,Yk,M,()=>{P&&P(),f&&f()}),A)}c=c||"text";let v=await Ed[ne.findKey(Ed,c)||"text"](C,t);return!w&&f&&f(),await new Promise((A,E)=>{MM(A,E,{data:v,headers:xa.from(C.headers),status:C.status,statusText:C.statusText,config:t,request:m})})}catch(k){throw f&&f(),k&&k.name==="TypeError"&&/fetch/i.test(k.message)?Object.assign(new He("Network Error",He.ERR_NETWORK,t,m),{cause:k.cause||k}):He.from(k,k&&k.code,t,m)}}),Kp={http:BZe,xhr:gJe,fetch:kJe};ne.forEach(Kp,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const _k=t=>`- ${t}`,CJe=t=>ne.isFunction(t)||t===null||t===!1,DM={getAdapter:t=>{t=ne.isArray(t)?t:[t];const{length:e}=t;let r,a;const o={};for(let i=0;i<e;i++){r=t[i];let n;if(a=r,!CJe(r)&&(a=Kp[(n=String(r)).toLowerCase()],a===void 0))throw new He(`Unknown adapter '${n}'`);if(a)break;o[n||"#"+i]=a}if(!a){const i=Object.entries(o).map(([s,l])=>`adapter ${s} `+(l===!1?"is not supported by the environment":"is not available in the build"));let n=e?i.length>1?`since :
|
|
190
190
|
`+i.map(_k).join(`
|
|
191
191
|
`):" "+_k(i[0]):"as no adapter specified";throw new He("There is no suitable adapter to dispatch the request "+n,"ERR_NOT_SUPPORT")}return a},adapters:Kp};function P3(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new F0(null,t)}function $k(t){return P3(t),t.headers=xa.from(t.headers),t.data=B3.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),DM.getAdapter(t.adapter||Zc.adapter)(t).then(function(a){return P3(t),a.data=B3.call(t,t.transformResponse,a),a.headers=xa.from(a.headers),a},function(a){return IM(a)||(P3(t),a&&a.response&&(a.response.data=B3.call(t,t.transformResponse,a.response),a.response.headers=xa.from(a.response.headers))),Promise.reject(a)})}const VM="1.8.2",Jg={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{Jg[t]=function(a){return typeof a===t||"a"+(e<1?"n ":" ")+t}});const e7={};Jg.transitional=function(e,r,a){function o(i,n){return"[Axios v"+VM+"] Transitional option '"+i+"'"+n+(a?". "+a:"")}return(i,n,s)=>{if(e===!1)throw new He(o(n," has been removed"+(r?" in "+r:"")),He.ERR_DEPRECATED);return r&&!e7[n]&&(e7[n]=!0,console.warn(o(n," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(i,n,s):!0}};Jg.spelling=function(e){return(r,a)=>(console.warn(`${a} is likely a misspelling of ${e}`),!0)};function AJe(t,e,r){if(typeof t!="object")throw new He("options must be an object",He.ERR_BAD_OPTION_VALUE);const a=Object.keys(t);let o=a.length;for(;o-- >0;){const i=a[o],n=e[i];if(n){const s=t[i],l=s===void 0||n(s,i,t);if(l!==!0)throw new He("option "+i+" must be "+l,He.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new He("Unknown option "+i,He.ERR_BAD_OPTION)}}const mu={assertOptions:AJe,validators:Jg},Po=mu.validators;let Ls=class{constructor(e){this.defaults=e,this.interceptors={request:new Kk,response:new Kk}}async request(e,r){try{return await this._request(e,r)}catch(a){if(a instanceof Error){let o={};Error.captureStackTrace?Error.captureStackTrace(o):o=new Error;const i=o.stack?o.stack.replace(/^.+\n/,""):"";try{a.stack?i&&!String(a.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(a.stack+=`
|
|
192
|
-
`+i):a.stack=i}catch{}}throw a}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=qs(this.defaults,r);const{transitional:a,paramsSerializer:o,headers:i}=r;a!==void 0&&mu.assertOptions(a,{silentJSONParsing:Po.transitional(Po.boolean),forcedJSONParsing:Po.transitional(Po.boolean),clarifyTimeoutError:Po.transitional(Po.boolean)},!1),o!=null&&(ne.isFunction(o)?r.paramsSerializer={serialize:o}:mu.assertOptions(o,{encode:Po.function,serialize:Po.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),mu.assertOptions(r,{baseUrl:Po.spelling("baseURL"),withXsrfToken:Po.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let n=i&&ne.merge(i.common,i[r.method]);i&&ne.forEach(["delete","get","head","post","put","patch","common"],m=>{delete i[m]}),r.headers=xa.concat(n,i);const s=[];let l=!0;this.interceptors.request.forEach(function(f){typeof f.runWhen=="function"&&f.runWhen(r)===!1||(l=l&&f.synchronous,s.unshift(f.fulfilled,f.rejected))});const c=[];this.interceptors.response.forEach(function(f){c.push(f.fulfilled,f.rejected)});let u,d=0,g;if(!l){const m=[$k.bind(this),void 0];for(m.unshift.apply(m,s),m.push.apply(m,c),g=m.length,u=Promise.resolve(r);d<g;)u=u.then(m[d++],m[d++]);return u}g=s.length;let h=r;for(d=0;d<g;){const m=s[d++],f=s[d++];try{h=m(h)}catch(b){f.call(this,b);break}}try{u=$k.call(this,h)}catch(m){return Promise.reject(m)}for(d=0,g=c.length;d<g;)u=u.then(c[d++],c[d++]);return u}getUri(e){e=qs(this.defaults,e);const r=OM(e.baseURL,e.url,e.allowAbsoluteUrls);return yM(r,e.params,e.paramsSerializer)}};ne.forEach(["delete","get","head","options"],function(e){Ls.prototype[e]=function(r,a){return this.request(qs(a||{},{method:e,url:r,data:(a||{}).data}))}});ne.forEach(["post","put","patch"],function(e){function r(a){return function(i,n,s){return this.request(qs(s||{},{method:e,headers:a?{"Content-Type":"multipart/form-data"}:{},url:i,data:n}))}}Ls.prototype[e]=r(),Ls.prototype[e+"Form"]=r(!0)});let xJe=class BM{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(i){r=i});const a=this;this.promise.then(o=>{if(!a._listeners)return;let i=a._listeners.length;for(;i-- >0;)a._listeners[i](o);a._listeners=null}),this.promise.then=o=>{let i;const n=new Promise(s=>{a.subscribe(s),i=s}).then(o);return n.cancel=function(){a.unsubscribe(i)},n},e(function(i,n,s){a.reason||(a.reason=new F0(i,n,s),r(a.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const e=new AbortController,r=a=>{e.abort(a)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new BM(function(o){e=o}),cancel:e}}};function yJe(t){return function(r){return t.apply(null,r)}}function TJe(t){return ne.isObject(t)&&t.isAxiosError===!0}const Wp={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Wp).forEach(([t,e])=>{Wp[e]=t});function PM(t){const e=new Ls(t),r=mM(Ls.prototype.request,e);return ne.extend(r,Ls.prototype,e,{allOwnKeys:!0}),ne.extend(r,e,null,{allOwnKeys:!0}),r.create=function(o){return PM(qs(t,o))},r}const _t=PM(Zc);_t.Axios=Ls;_t.CanceledError=F0;_t.CancelToken=xJe;_t.isCancel=IM;_t.VERSION=VM;_t.toFormData=Wg;_t.AxiosError=He;_t.Cancel=_t.CanceledError;_t.all=function(e){return Promise.all(e)};_t.spread=yJe;_t.isAxiosError=TJe;_t.mergeConfig=qs;_t.AxiosHeaders=xa;_t.formToJSON=t=>SM(ne.isHTMLForm(t)?new FormData(t):t);_t.getAdapter=DM.getAdapter;_t.HttpStatusCode=Wp;_t.default=_t;const{Axios:Aet,AxiosError:xet,CanceledError:yet,isCancel:Tet,CancelToken:Iet,VERSION:Met,all:Oet,Cancel:Let,isAxiosError:Ret,spread:Net,toFormData:Det,AxiosHeaders:Vet,HttpStatusCode:Bet,formToJSON:Pet,getAdapter:Fet,mergeConfig:Uet}=_t,SJe=t=>Promise.reject(t),IJe=t=>{const e=window.__WOOT_API_HOST__,r=window.__WOOT_ACCESS_TOKEN__,a=t.create({baseURL:`${e}/`});return Object.assign(a.defaults.headers.common,{api_access_token:r}),a.interceptors.response.use(o=>o,o=>SJe(o)),a},FM=kn.createContext(),MJe=({baseURL:t,accountId:e,userToken:r,websocketURL:a,pubsubToken:o,conversationId:i,disableUpload:n,disableEditor:s,disablePrivateNote:l,children:c})=>{const u=kn.useRef(!1),[d,g]=kn.useState(!1);if(!t)throw new Error("ChatwootProvider: baseURL is required");if(!r)throw new Error("ChatwootProvider: userToken is required");const h={baseURL:t.replace(/\/$/,""),userToken:r,accountId:Number(e),conversationId:Number(i),disableEditor:s||!1,disablePrivateNote:l||!1,disableUpload:n||!1,websocketURL:a,pubsubToken:o};function m(){YWe(),window.__WOOT_API_HOST__=h.baseURL,window.__WOOT_ACCOUNT_ID__=h.accountId,window.__WOOT_ACCESS_TOKEN__=h.userToken,window.__WEBSOCKET_URL__=h.websocketURL,window.__PUBSUB_TOKEN__=h.pubsubToken,window.__WOOT_CONVERSATION_ID__=h.conversationId,window.__EDITOR_DISABLE_UPLOAD__=h.disableUpload,window.__EDITOR_DISABLE_PRIVATE_NOTE__=h.disablePrivateNote,window.__DISABLE_EDITOR__=h.disableEditor,window.__WOOT_ISOLATED_SHELL__=!0,gBe(),window.WootConstants=oc,window.axios=IJe(_t),bc.dispatch("setUser").then(()=>{sM.init(bc,h.pubsubToken),g(!0)})}return kn.useEffect(()=>{u.current||(m(),u.current=!0)},[h.baseURL,h.userToken,h.websocketURL,h.pubsubToken]),d?fu.jsx(FM.Provider,{value:h,children:c}):null},UM=()=>{const t=kn.useContext(FM);if(!t)throw new Error("useChatwoot must be used within ChatwootProvider");return t},jM=({conversationId:t,className:e="",style:r={},onError:a=null,onLoad:o=null,...i})=>{const n=kn.useRef();return kn.useEffect(()=>{if(!n.current)return;const s=n.current;s.conversationId=t},[t]),kn.useEffect(()=>{if(!n.current)return;const s=n.current,l=()=>{o==null||o()},c=u=>{var g;const d=((g=u.detail)==null?void 0:g.message)||"Unknown error occurred";a==null||a(new Error(d))};return s.addEventListener("chatwoot:loaded",l),s.addEventListener("chatwoot:error",c),()=>{s.removeEventListener("chatwoot:loaded",l),s.removeEventListener("chatwoot:error",c)}},[o,a]),fu.jsx("chatwoot-message-list",{ref:n,className:e,style:r,...i})},OJe=({conversationId:t,className:e="",style:r={},...a})=>(UM(),fu.jsx("div",{className:`chatwoot-conversation ${e} text-n-slate-11`,style:{height:"100%",width:"100%",position:"relative",...r},children:fu.jsx(jM,{className:"h-full w-full",...a})}));function LJe(t){var e=t;return!!(e.ctrlKey||e.shiftKey||e.metaKey||e.button&&e.button==1)}function RJe(t,e){return!!(t.target==="_blank"&&e)}function NJe(t,e,r,a){var o=this,i=[];return t?(t instanceof Element?i=[t]:"toArray"in t?i=t.toArray():i=t,i.forEach(function(n){n.addEventListener("click",function(s){var l,c,u=e instanceof Function?e(n):e,d=r instanceof Function?r(n):r,g=n.getAttribute("href")||n.getAttributeNS("http://www.w3.org/1999/xlink","href")||n.getAttribute("xlink:href")||((l=n.getElementsByTagName("a")[0])===null||l===void 0?void 0:l.getAttribute("href")),h=O4(o.track(u,d,a??{}),(c=o.settings.timeout)!==null&&c!==void 0?c:500);!RJe(n,g)&&!LJe(s)&&g&&(s.preventDefault?s.preventDefault():s.returnValue=!1,h.catch(console.error).then(function(){window.location.href=g}).catch(console.error))},!1)}),this):this}function DJe(t,e,r,a){var o=this;if(!t)return this;t instanceof HTMLFormElement&&(t=[t]);var i=t;return i.forEach(function(n){if(!(n instanceof Element))throw new TypeError("Must pass HTMLElement to trackForm/trackSubmit.");var s=function(c){var u;c.preventDefault?c.preventDefault():c.returnValue=!1;var d=e instanceof Function?e(n):e,g=r instanceof Function?r(n):r,h=O4(o.track(d,g,a??{}),(u=o.settings.timeout)!==null&&u!==void 0?u:500);h.catch(console.error).then(function(){n.submit()}).catch(console.error)},l=window.jQuery||window.Zepto;l?l(n).submit(s):n.addEventListener("submit",s,!1)}),this}const K2=Object.freeze(Object.defineProperty({__proto__:null,form:DJe,link:NJe},Symbol.toStringTag,{value:"Module"}));function t7(t,e){return Object.keys(e).reduce(function(r,a){if(a.startsWith(t)){var o=a.substr(t.length);r[o]=e[a]}return r},{})}function VJe(t,e){var r=document.createElement("a");r.href=e;var a=r.search.slice(1),o=a.split("&").reduce(function(w,v){var A=v.split("="),E=A[0],M=A[1];return w[E]=$9(M),w},{}),i=[],n=o.ajs_uid,s=o.ajs_event,l=o.ajs_aid,c=ym(t.options.useQueryString)?t.options.useQueryString:{},u=c.aid,d=u===void 0?/.+/:u,g=c.uid,h=g===void 0?/.+/:g;if(l){var m=Array.isArray(o.ajs_aid)?o.ajs_aid[0]:o.ajs_aid;d.test(m)&&t.setAnonymousId(m)}if(n){var f=Array.isArray(o.ajs_uid)?o.ajs_uid[0]:o.ajs_uid;if(h.test(f)){var b=t7("ajs_trait_",o);i.push(t.identify(f,b))}}if(s){var k=Array.isArray(o.ajs_event)?o.ajs_event[0]:o.ajs_event,C=t7("ajs_prop_",o);i.push(t.track(k,C))}return Promise.all(i)}const BJe=Object.freeze(Object.defineProperty({__proto__:null,queryString:VJe},Symbol.toStringTag,{value:"Module"}));var pu={},lw={};for(var zM=[],fs=0;fs<64;)zM[fs]=0|4294967296*Math.sin(++fs%Math.PI);function PJe(t){var e,r,a,o=[e=1732584193,r=4023233417,~e,~r],i=[],n=unescape(encodeURI(t))+"",s=n.length;for(t=--s/4+2|15,i[--t]=8*s;~s;)i[s>>2]|=n.charCodeAt(s)<<8*s--;for(fs=n=0;fs<t;fs+=16){for(s=o;n<64;s=[a=s[3],e+((a=s[0]+[e&r|~e&a,a&e|~a&r,e^r^a,r^(e|~a)][s=n>>4]+zM[n]+~~i[fs|15&[n,5*n+1,3*n+5,7*n][s]])<<(s=[7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21][4*s+n++%4])|a>>>-s),e,r])e=0|s[1],r=s[2];for(n=4;n;)o[--n]+=s[n]}for(t="";n<32;)t+=(o[n>>3]>>4*(1^n++)&15).toString(16);return t}const FJe=Object.freeze(Object.defineProperty({__proto__:null,default:PJe},Symbol.toStringTag,{value:"Module"})),UJe=Cd(FJe);var qM={exports:{}};(function(t,e){(function(r,a){t.exports=function(o,i,n,s,l){for(i=i.split?i.split("."):i,s=0;s<i.length;s++)o=o?o[i[s]]:l;return o===l?n:o}})()})(qM);var cw=qM.exports;/**
|
|
192
|
+
`+i):a.stack=i}catch{}}throw a}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=qs(this.defaults,r);const{transitional:a,paramsSerializer:o,headers:i}=r;a!==void 0&&mu.assertOptions(a,{silentJSONParsing:Po.transitional(Po.boolean),forcedJSONParsing:Po.transitional(Po.boolean),clarifyTimeoutError:Po.transitional(Po.boolean)},!1),o!=null&&(ne.isFunction(o)?r.paramsSerializer={serialize:o}:mu.assertOptions(o,{encode:Po.function,serialize:Po.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),mu.assertOptions(r,{baseUrl:Po.spelling("baseURL"),withXsrfToken:Po.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let n=i&&ne.merge(i.common,i[r.method]);i&&ne.forEach(["delete","get","head","post","put","patch","common"],m=>{delete i[m]}),r.headers=xa.concat(n,i);const s=[];let l=!0;this.interceptors.request.forEach(function(f){typeof f.runWhen=="function"&&f.runWhen(r)===!1||(l=l&&f.synchronous,s.unshift(f.fulfilled,f.rejected))});const c=[];this.interceptors.response.forEach(function(f){c.push(f.fulfilled,f.rejected)});let u,d=0,g;if(!l){const m=[$k.bind(this),void 0];for(m.unshift.apply(m,s),m.push.apply(m,c),g=m.length,u=Promise.resolve(r);d<g;)u=u.then(m[d++],m[d++]);return u}g=s.length;let h=r;for(d=0;d<g;){const m=s[d++],f=s[d++];try{h=m(h)}catch(b){f.call(this,b);break}}try{u=$k.call(this,h)}catch(m){return Promise.reject(m)}for(d=0,g=c.length;d<g;)u=u.then(c[d++],c[d++]);return u}getUri(e){e=qs(this.defaults,e);const r=OM(e.baseURL,e.url,e.allowAbsoluteUrls);return yM(r,e.params,e.paramsSerializer)}};ne.forEach(["delete","get","head","options"],function(e){Ls.prototype[e]=function(r,a){return this.request(qs(a||{},{method:e,url:r,data:(a||{}).data}))}});ne.forEach(["post","put","patch"],function(e){function r(a){return function(i,n,s){return this.request(qs(s||{},{method:e,headers:a?{"Content-Type":"multipart/form-data"}:{},url:i,data:n}))}}Ls.prototype[e]=r(),Ls.prototype[e+"Form"]=r(!0)});let xJe=class BM{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(i){r=i});const a=this;this.promise.then(o=>{if(!a._listeners)return;let i=a._listeners.length;for(;i-- >0;)a._listeners[i](o);a._listeners=null}),this.promise.then=o=>{let i;const n=new Promise(s=>{a.subscribe(s),i=s}).then(o);return n.cancel=function(){a.unsubscribe(i)},n},e(function(i,n,s){a.reason||(a.reason=new F0(i,n,s),r(a.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const e=new AbortController,r=a=>{e.abort(a)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new BM(function(o){e=o}),cancel:e}}};function yJe(t){return function(r){return t.apply(null,r)}}function TJe(t){return ne.isObject(t)&&t.isAxiosError===!0}const Wp={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Wp).forEach(([t,e])=>{Wp[e]=t});function PM(t){const e=new Ls(t),r=mM(Ls.prototype.request,e);return ne.extend(r,Ls.prototype,e,{allOwnKeys:!0}),ne.extend(r,e,null,{allOwnKeys:!0}),r.create=function(o){return PM(qs(t,o))},r}const _t=PM(Zc);_t.Axios=Ls;_t.CanceledError=F0;_t.CancelToken=xJe;_t.isCancel=IM;_t.VERSION=VM;_t.toFormData=Wg;_t.AxiosError=He;_t.Cancel=_t.CanceledError;_t.all=function(e){return Promise.all(e)};_t.spread=yJe;_t.isAxiosError=TJe;_t.mergeConfig=qs;_t.AxiosHeaders=xa;_t.formToJSON=t=>SM(ne.isHTMLForm(t)?new FormData(t):t);_t.getAdapter=DM.getAdapter;_t.HttpStatusCode=Wp;_t.default=_t;const{Axios:Aet,AxiosError:xet,CanceledError:yet,isCancel:Tet,CancelToken:Iet,VERSION:Met,all:Oet,Cancel:Let,isAxiosError:Ret,spread:Net,toFormData:Det,AxiosHeaders:Vet,HttpStatusCode:Bet,formToJSON:Pet,getAdapter:Fet,mergeConfig:Uet}=_t,SJe=t=>Promise.reject(t),IJe=t=>{const e=window.__WOOT_API_HOST__,r=window.__WOOT_ACCESS_TOKEN__,a=t.create({baseURL:`${e}/`});return Object.assign(a.defaults.headers.common,{api_access_token:r}),a.interceptors.response.use(o=>o,o=>SJe(o)),a},FM=kn.createContext(),MJe=({baseURL:t,accountId:e,userToken:r,websocketURL:a,pubsubToken:o,conversationId:i,disableUpload:n,disableEditor:s,disablePrivateNote:l,children:c})=>{const u=kn.useRef(!1),[d,g]=kn.useState(!1);if(!t)throw new Error("ChatwootProvider: baseURL is required");if(!r)throw new Error("ChatwootProvider: userToken is required");const h={baseURL:t.replace(/\/$/,""),userToken:r,accountId:Number(e),conversationId:Number(i),disableEditor:s||!1,disablePrivateNote:l||!1,disableUpload:n||!1,websocketURL:a,pubsubToken:o};function m(){YWe(),window.__WOOT_API_HOST__=h.baseURL,window.__WOOT_ACCOUNT_ID__=h.accountId,window.__WOOT_ACCESS_TOKEN__=h.userToken,window.__WEBSOCKET_URL__=h.websocketURL,window.__PUBSUB_TOKEN__=h.pubsubToken,window.__WOOT_CONVERSATION_ID__=h.conversationId,window.__EDITOR_DISABLE_UPLOAD__=h.disableUpload,window.__EDITOR_DISABLE_PRIVATE_NOTE__=h.disablePrivateNote,window.__DISABLE_EDITOR__=h.disableEditor,window.__WOOT_ISOLATED_SHELL__=!0,gBe(),window.WootConstants=oc,window.axios=IJe(_t),bc.dispatch("setUser").then(()=>{console.log("INITALIZING USER AND ACTION CABLE"),sM.init(bc,h.pubsubToken),g(!0)})}return kn.useEffect(()=>{u.current||(m(),u.current=!0)},[h.baseURL,h.userToken,h.websocketURL,h.pubsubToken]),d?fu.jsx(FM.Provider,{value:h,children:c}):null},UM=()=>{const t=kn.useContext(FM);if(!t)throw new Error("useChatwoot must be used within ChatwootProvider");return t},jM=({conversationId:t,className:e="",style:r={},onError:a=null,onLoad:o=null,...i})=>{const n=kn.useRef();return kn.useEffect(()=>{if(!n.current)return;const s=n.current;s.conversationId=t},[t]),kn.useEffect(()=>{if(!n.current)return;const s=n.current,l=()=>{o==null||o()},c=u=>{var g;const d=((g=u.detail)==null?void 0:g.message)||"Unknown error occurred";a==null||a(new Error(d))};return s.addEventListener("chatwoot:loaded",l),s.addEventListener("chatwoot:error",c),()=>{s.removeEventListener("chatwoot:loaded",l),s.removeEventListener("chatwoot:error",c)}},[o,a]),fu.jsx("chatwoot-message-list",{ref:n,className:e,style:r,...i})},OJe=({conversationId:t,className:e="",style:r={},...a})=>(UM(),fu.jsx("div",{className:`chatwoot-conversation ${e} text-n-slate-11`,style:{height:"100%",width:"100%",position:"relative",...r},children:fu.jsx(jM,{className:"h-full w-full",...a})}));function LJe(t){var e=t;return!!(e.ctrlKey||e.shiftKey||e.metaKey||e.button&&e.button==1)}function RJe(t,e){return!!(t.target==="_blank"&&e)}function NJe(t,e,r,a){var o=this,i=[];return t?(t instanceof Element?i=[t]:"toArray"in t?i=t.toArray():i=t,i.forEach(function(n){n.addEventListener("click",function(s){var l,c,u=e instanceof Function?e(n):e,d=r instanceof Function?r(n):r,g=n.getAttribute("href")||n.getAttributeNS("http://www.w3.org/1999/xlink","href")||n.getAttribute("xlink:href")||((l=n.getElementsByTagName("a")[0])===null||l===void 0?void 0:l.getAttribute("href")),h=O4(o.track(u,d,a??{}),(c=o.settings.timeout)!==null&&c!==void 0?c:500);!RJe(n,g)&&!LJe(s)&&g&&(s.preventDefault?s.preventDefault():s.returnValue=!1,h.catch(console.error).then(function(){window.location.href=g}).catch(console.error))},!1)}),this):this}function DJe(t,e,r,a){var o=this;if(!t)return this;t instanceof HTMLFormElement&&(t=[t]);var i=t;return i.forEach(function(n){if(!(n instanceof Element))throw new TypeError("Must pass HTMLElement to trackForm/trackSubmit.");var s=function(c){var u;c.preventDefault?c.preventDefault():c.returnValue=!1;var d=e instanceof Function?e(n):e,g=r instanceof Function?r(n):r,h=O4(o.track(d,g,a??{}),(u=o.settings.timeout)!==null&&u!==void 0?u:500);h.catch(console.error).then(function(){n.submit()}).catch(console.error)},l=window.jQuery||window.Zepto;l?l(n).submit(s):n.addEventListener("submit",s,!1)}),this}const K2=Object.freeze(Object.defineProperty({__proto__:null,form:DJe,link:NJe},Symbol.toStringTag,{value:"Module"}));function t7(t,e){return Object.keys(e).reduce(function(r,a){if(a.startsWith(t)){var o=a.substr(t.length);r[o]=e[a]}return r},{})}function VJe(t,e){var r=document.createElement("a");r.href=e;var a=r.search.slice(1),o=a.split("&").reduce(function(w,v){var A=v.split("="),E=A[0],M=A[1];return w[E]=$9(M),w},{}),i=[],n=o.ajs_uid,s=o.ajs_event,l=o.ajs_aid,c=ym(t.options.useQueryString)?t.options.useQueryString:{},u=c.aid,d=u===void 0?/.+/:u,g=c.uid,h=g===void 0?/.+/:g;if(l){var m=Array.isArray(o.ajs_aid)?o.ajs_aid[0]:o.ajs_aid;d.test(m)&&t.setAnonymousId(m)}if(n){var f=Array.isArray(o.ajs_uid)?o.ajs_uid[0]:o.ajs_uid;if(h.test(f)){var b=t7("ajs_trait_",o);i.push(t.identify(f,b))}}if(s){var k=Array.isArray(o.ajs_event)?o.ajs_event[0]:o.ajs_event,C=t7("ajs_prop_",o);i.push(t.track(k,C))}return Promise.all(i)}const BJe=Object.freeze(Object.defineProperty({__proto__:null,queryString:VJe},Symbol.toStringTag,{value:"Module"}));var pu={},lw={};for(var zM=[],fs=0;fs<64;)zM[fs]=0|4294967296*Math.sin(++fs%Math.PI);function PJe(t){var e,r,a,o=[e=1732584193,r=4023233417,~e,~r],i=[],n=unescape(encodeURI(t))+"",s=n.length;for(t=--s/4+2|15,i[--t]=8*s;~s;)i[s>>2]|=n.charCodeAt(s)<<8*s--;for(fs=n=0;fs<t;fs+=16){for(s=o;n<64;s=[a=s[3],e+((a=s[0]+[e&r|~e&a,a&e|~a&r,e^r^a,r^(e|~a)][s=n>>4]+zM[n]+~~i[fs|15&[n,5*n+1,3*n+5,7*n][s]])<<(s=[7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21][4*s+n++%4])|a>>>-s),e,r])e=0|s[1],r=s[2];for(n=4;n;)o[--n]+=s[n]}for(t="";n<32;)t+=(o[n>>3]>>4*(1^n++)&15).toString(16);return t}const FJe=Object.freeze(Object.defineProperty({__proto__:null,default:PJe},Symbol.toStringTag,{value:"Module"})),UJe=Cd(FJe);var qM={exports:{}};(function(t,e){(function(r,a){t.exports=function(o,i,n,s,l){for(i=i.split?i.split("."):i,s=0;s<i.length;s++)o=o?o[i[s]]:l;return o===l?n:o}})()})(qM);var cw=qM.exports;/**
|
|
193
193
|
* @license Apache-2.0
|
|
194
194
|
*
|
|
195
195
|
* Copyright (c) 2018 The Stdlib Authors.
|