@iccandle/widget-web-trading 0.3.3 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/web-trading-widget.cjs +13 -53
- package/dist/web-trading-widget.css +1 -1
- package/dist/web-trading-widget.js +6258 -13512
- package/package.json +1 -1
|
@@ -1,44 +1,4 @@
|
|
|
1
|
-
"use strict";var Fh=Object.defineProperty;var rl=e=>{throw TypeError(e)};var Uh=(e,t,n)=>t in e?Fh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ot=(e,t,n)=>Uh(e,typeof t!="symbol"?t+"":t,n),uo=(e,t,n)=>t.has(e)||rl("Cannot "+n);var E=(e,t,n)=>(uo(e,t,"read from private field"),n?n.call(e):t.get(e)),oe=(e,t,n)=>t.has(e)?rl("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Y=(e,t,n,r)=>(uo(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),be=(e,t,n)=>(uo(e,t,"access private method"),n);var Ei=(e,t,n,r)=>({set _(i){Y(e,t,i,n)},get _(){return E(e,t,r)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),S=require("react"),Bh=require("react-dom");function ku(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const w=ku(S),Er=ku(Bh),Wh=["en","zh","vi","th","ko","ja","mn","ru"],ss="en";function Ns(e){if(!e)return ss;const t=e.toLowerCase().split("-")[0];return Wh.includes(t)?t:ss}const $h={en:"en",zh:"zh",vi:"vi",th:"th",ko:"ko",ja:"ja",mn:"en",ru:"ru"};function Vh(e){return $h[e]}const Hh={symbol:"Symbol",back:"Back",continue:"Continue",error:"Error",selectTradingAccount:"Select trading account",selectAccountDescription:"Choose an account to continue trading on the chart.",loadingAccounts:"Loading accounts…",noTradingAccounts:"No trading accounts available.",selectAccount:"Select account",createAccount:"Create account",ticket:"Ticket",serverTime:"Server time",type:"Type",volume:"Volume",price:"Price",stopLossShort:"S / L",takeProfitShort:"T / P",swap:"Swap",profit:"Profit",comment:"Comment",close:"Close",balance:"Balance",equity:"Equity",margin:"Margin",freeMargin:"Free margin",level:"Level",trade:"Trade",history:"History",terminalPanelTabs:"Terminal panel tabs",closeAll:"Close all",closing:"Closing…",refresh:"Refresh",refreshing:"Refreshing…",refreshDealHistory:"Refresh deal history",notAvailable:"N/A",closePositionTicket:"Close position #{ticket}",closePosition:"Close position",deleteOrderTicket:"Delete order #{ticket}",deleteOrder:"Delete order",resizeTerminalPanel:"Resize terminal panel",loading:"Loading…",noPositions:"You don't have any positions",createNewOrder:"Create New Order",chartSidePanel:"Chart side panel",scanResult:"Scan Result",openTerminal:"Open terminal",orders:"Orders",terminal:"Terminal",closeTerminalPanel:"Close terminal panel",buy:"Buy",sell:"Sell",balanceType:"Balance",credit:"Credit",deal:"Deal",login:"Login",action:"Action",entry:"Entry",time:"Time",localTime:"Local time",entryIn:"IN",entryOut:"OUT",selectAccountForDeals:"Select an account to view deal history",noDealsFound:"No deals found",seeFullDealHistory:"See full deal history",unknownAction:"Action {action}",failedClosePosition:"Failed to close position.",positionClosed:"Position #{ticket} closed at {price}.",closePositionNotConfigured:"Close position is not configured.",onePositionClosed:"1 position closed.",positionsClosed:"{count} positions closed.",failedClosePositions:"Failed to close positions.",closedFailedSummary:"Closed {closed}, failed {failed}.",failedDeleteOrder:"Failed to delete order.",orderDeleted:"Order #{ticket} deleted.",positionUpdated:"Position #{ticket} updated.",stopLoss:"Stop Loss",takeProfit:"Take Profit",stopPrice:"Stop Price",limitPrice:"Limit Price",volumeSetting:"Volume Setting",riskManagement:"Risk Management",expiration:"Expiration",orderExecutionType:"Order execution type",orderExpirationType:"Order expiration type",expirationTime:"Expiration time",expirationDay:"Expiration day",placed:"Placed",closeConfirmation:"Close confirmation",closePositionPanel:"Close position panel",closeOrderPanel:"Close order panel",minimizeToQuickOrder:"Minimize to quick order panel",moveQuickOrderPanel:"Move quick order panel",decreaseVolume:"Decrease volume",increaseVolume:"Increase volume",expandQuickOrderPanel:"Expand quick order panel",collapseQuickOrderPanel:"Collapse quick order panel",searchSymbol:"Search symbol",bid:"Bid",ask:"Ask",lots:"Lots",orderPrice:"Order Price",sellByMarket:"Sell by Market",buyByMarket:"Buy by Market",placeOrder:"Place {label}",selectAccountToTrade:"Select a trading account to start placing orders.",executionMarket:"Market Execution",executionBuyLimit:"Buy Limit",executionSellLimit:"Sell Limit",executionBuyStop:"Buy Stop",executionSellStop:"Sell Stop",executionBuyStopLimit:"Buy Stop Limit",executionSellStopLimit:"Sell Stop Limit",expirationGtc:"GTC",expirationToday:"Today",expirationSpecified:"Specified",expirationSpecifiedDay:"Specified Day",ok:"OK",orderAtPrice:"at {price}",modify:"Modify",failedModifyPosition:"Failed to modify position.",failedModifyOrder:"Failed to modify order.",positionClosedSimple:"Position #{ticket} closed.",orderUpdated:"Order #{ticket} updated.",closePositionDetail:"Close #{ticket} {type} {volume} {symbol} {openPrice} at {closePrice} with Profit {profit}",deleteOrderDetail:"Delete #{ticket} {typeLabel} {volume} {symbol} at {price}",pleaseSelectTradingAccount:"Please select a trading account.",pleaseSetLimitPrice:"Please set a limit price for this order.",pleaseSetOrderPrice:"Please set an order price for pending orders.",pleaseSetStopPrice:"Please set a stop price for stop limit orders.",pleaseSetExpirationDate:"Please set an expiration date for this order.",pleaseSetStopAndLimitPrices:"Please set both stop and limit prices.",failedPlaceOrder:"Failed to place order.",orderNotAccepted:"Order was not accepted.",newOrder:"New Order",selectYourTradingAccount:"Select your trading account",switchingAccount:"Switching account…",activeAccount:"Active"},zh={WebTrading:Hh},Kh={symbol:"代码",back:"返回",continue:"继续",error:"错误",selectTradingAccount:"选择交易账户",selectAccountDescription:"选择一个账户以继续在图表上交易。",loadingAccounts:"正在加载账户…",noTradingAccounts:"暂无可用交易账户。",selectAccount:"选择账户",createAccount:"创建账户",ticket:"订单号",serverTime:"服务器时间",type:"类型",volume:"交易量",price:"价格",stopLossShort:"止损",takeProfitShort:"止盈",swap:"隔夜利息",profit:"利润",comment:"备注",close:"关闭",balance:"余额",equity:"净值",margin:"保证金",freeMargin:"可用保证金",level:"等级",trade:"交易",history:"历史",terminalPanelTabs:"终端面板标签",closeAll:"全部关闭",closing:"正在关闭…",refresh:"刷新",refreshing:"正在刷新…",refreshDealHistory:"刷新交易历史",notAvailable:"不适用",closePositionTicket:"关闭仓位 #{ticket}",closePosition:"关闭仓位",deleteOrderTicket:"删除订单 #{ticket}",deleteOrder:"删除订单",resizeTerminalPanel:"调整终端面板大小",loading:"正在加载…",noPositions:"您当前没有任何仓位",createNewOrder:"创建新订单",chartSidePanel:"图表侧边栏",scanResult:"扫描结果",openTerminal:"打开终端",orders:"订单",terminal:"终端",closeTerminalPanel:"关闭终端面板",buy:"买入",sell:"卖出",balanceType:"余额",credit:"信用额",deal:"成交",login:"登录",action:"操作",entry:"入场",time:"时间",localTime:"本地时间",entryIn:"入",entryOut:"出",selectAccountForDeals:"选择一个账户查看交易历史",noDealsFound:"未找到交易记录",seeFullDealHistory:"查看完整交易历史",unknownAction:"操作 {action}",failedClosePosition:"关闭仓位失败。",positionClosed:"仓位 #{ticket} 已在 {price} 关闭。",closePositionNotConfigured:"关闭仓位功能未配置。",onePositionClosed:"已关闭 1 个仓位。",positionsClosed:"已关闭 {count} 个仓位。",failedClosePositions:"关闭仓位失败。",closedFailedSummary:"已关闭 {closed} 个,失败 {failed} 个。",failedDeleteOrder:"删除订单失败。",orderDeleted:"订单 #{ticket} 已删除。",positionUpdated:"仓位 #{ticket} 已更新。",stopLoss:"止损",takeProfit:"止盈",stopPrice:"止损价格",limitPrice:"限价",volumeSetting:"交易量设置",riskManagement:"风险管理",expiration:"到期时间",orderExecutionType:"订单执行类型",orderExpirationType:"订单到期类型",expirationTime:"到期时间",expirationDay:"到期日期",placed:"已提交",closeConfirmation:"关闭确认",closePositionPanel:"关闭仓位面板",closeOrderPanel:"关闭订单面板",minimizeToQuickOrder:"最小化到快速下单面板",moveQuickOrderPanel:"移动快速下单面板",decreaseVolume:"减少交易量",increaseVolume:"增加交易量",expandQuickOrderPanel:"展开快速下单面板",collapseQuickOrderPanel:"收起快速下单面板",searchSymbol:"搜索交易品种",bid:"卖价",ask:"买价",lots:"手数",orderPrice:"订单价格",sellByMarket:"按市价卖出",buyByMarket:"按市价买入",placeOrder:"下单 {label}",selectAccountToTrade:"请选择一个交易账户以开始下单。",executionMarket:"市价执行",executionBuyLimit:"买入限价",executionSellLimit:"卖出限价",executionBuyStop:"买入止损",executionSellStop:"卖出止损",executionBuyStopLimit:"买入止损限价",executionSellStopLimit:"卖出止损限价",expirationGtc:"永久有效",expirationToday:"今天",expirationSpecified:"指定时间",expirationSpecifiedDay:"指定日期",ok:"确定",orderAtPrice:"于 {price}",modify:"修改",failedModifyPosition:"修改仓位失败。",failedModifyOrder:"修改订单失败。",positionClosedSimple:"仓位 #{ticket} 已关闭。",orderUpdated:"订单 #{ticket} 已更新。",closePositionDetail:"关闭 #{ticket} {type} {volume} {symbol} {openPrice} 于 {closePrice},利润为 {profit}",deleteOrderDetail:"删除 #{ticket} {typeLabel} {volume} {symbol} 于 {price}",pleaseSelectTradingAccount:"请选择一个交易账户。",pleaseSetLimitPrice:"请为此订单设置限价。",pleaseSetOrderPrice:"请为挂单设置订单价格。",pleaseSetStopPrice:"请为止损限价单设置止损价格。",pleaseSetExpirationDate:"请为此订单设置到期日期。",pleaseSetStopAndLimitPrices:"请同时设置止损价格和限价。",failedPlaceOrder:"下单失败。",orderNotAccepted:"订单未被接受。",newOrder:"新订单",selectYourTradingAccount:"选择您的交易账户",switchingAccount:"正在切换账户…",activeAccount:"活跃"},Gh={WebTrading:Kh},qh={symbol:"Ký hiệu",back:"Quay lại",continue:"Tiếp tục",error:"Lỗi",selectTradingAccount:"Chọn tài khoản giao dịch",selectAccountDescription:"Chọn một tài khoản để tiếp tục giao dịch trên biểu đồ.",loadingAccounts:"Đang tải tài khoản…",noTradingAccounts:"Không có tài khoản giao dịch nào khả dụng.",selectAccount:"Chọn tài khoản",createAccount:"Tạo tài khoản",ticket:"Mã lệnh",serverTime:"Thời gian máy chủ",type:"Loại",volume:"Khối lượng",price:"Giá",stopLossShort:"S / L",takeProfitShort:"T / P",swap:"Phí qua đêm",profit:"Lợi nhuận",comment:"Ghi chú",close:"Đóng",balance:"Số dư",equity:"Vốn chủ sở hữu",margin:"Ký quỹ",freeMargin:"Ký quỹ khả dụng",level:"Mức",trade:"Giao dịch",history:"Lịch sử",terminalPanelTabs:"Các tab bảng điều khiển",closeAll:"Đóng tất cả",closing:"Đang đóng…",refresh:"Làm mới",refreshing:"Đang làm mới…",refreshDealHistory:"Làm mới lịch sử giao dịch",notAvailable:"Không có",closePositionTicket:"Đóng vị thế #{ticket}",closePosition:"Đóng vị thế",deleteOrderTicket:"Xóa lệnh #{ticket}",deleteOrder:"Xóa lệnh",resizeTerminalPanel:"Thay đổi kích thước bảng điều khiển",loading:"Đang tải…",noPositions:"Bạn không có vị thế nào",createNewOrder:"Tạo lệnh mới",chartSidePanel:"Bảng bên biểu đồ",scanResult:"Kết quả quét",openTerminal:"Mở bảng giao dịch",orders:"Lệnh",terminal:"Bảng giao dịch",closeTerminalPanel:"Đóng bảng giao dịch",buy:"Mua",sell:"Bán",balanceType:"Số dư",credit:"Tín dụng",deal:"Giao dịch",login:"Đăng nhập",action:"Hành động",entry:"Vào lệnh",time:"Thời gian",localTime:"Giờ địa phương",entryIn:"Vào",entryOut:"Ra",selectAccountForDeals:"Chọn một tài khoản để xem lịch sử giao dịch",noDealsFound:"Không tìm thấy giao dịch nào",seeFullDealHistory:"Xem toàn bộ lịch sử giao dịch",unknownAction:"Hành động {action}",failedClosePosition:"Không thể đóng vị thế.",positionClosed:"Vị thế #{ticket} đã được đóng tại {price}.",closePositionNotConfigured:"Chức năng đóng vị thế chưa được cấu hình.",onePositionClosed:"Đã đóng 1 vị thế.",positionsClosed:"Đã đóng {count} vị thế.",failedClosePositions:"Không thể đóng các vị thế.",closedFailedSummary:"Đã đóng {closed}, thất bại {failed}.",failedDeleteOrder:"Không thể xóa lệnh.",orderDeleted:"Lệnh #{ticket} đã được xóa.",positionUpdated:"Vị thế #{ticket} đã được cập nhật.",stopLoss:"Cắt lỗ",takeProfit:"Chốt lời",stopPrice:"Giá dừng",limitPrice:"Giá giới hạn",volumeSetting:"Cài đặt khối lượng",riskManagement:"Quản lý rủi ro",expiration:"Hết hạn",orderExecutionType:"Loại khớp lệnh",orderExpirationType:"Loại hết hạn của lệnh",expirationTime:"Thời gian hết hạn",expirationDay:"Ngày hết hạn",placed:"Đã đặt",closeConfirmation:"Xác nhận đóng",closePositionPanel:"Bảng đóng vị thế",closeOrderPanel:"Bảng đóng lệnh",minimizeToQuickOrder:"Thu nhỏ thành bảng đặt lệnh nhanh",moveQuickOrderPanel:"Di chuyển bảng đặt lệnh nhanh",decreaseVolume:"Giảm khối lượng",increaseVolume:"Tăng khối lượng",expandQuickOrderPanel:"Mở rộng bảng đặt lệnh nhanh",collapseQuickOrderPanel:"Thu gọn bảng đặt lệnh nhanh",searchSymbol:"Tìm kiếm mã giao dịch",bid:"Giá bán",ask:"Giá mua",lots:"Lot",orderPrice:"Giá đặt lệnh",sellByMarket:"Bán theo giá thị trường",buyByMarket:"Mua theo giá thị trường",placeOrder:"Đặt {label}",selectAccountToTrade:"Chọn một tài khoản giao dịch để bắt đầu đặt lệnh.",executionMarket:"Khớp lệnh thị trường",executionBuyLimit:"Buy Limit",executionSellLimit:"Sell Limit",executionBuyStop:"Buy Stop",executionSellStop:"Sell Stop",executionBuyStopLimit:"Buy Stop Limit",executionSellStopLimit:"Sell Stop Limit",expirationGtc:"GTC",expirationToday:"Hôm nay",expirationSpecified:"Chỉ định",expirationSpecifiedDay:"Ngày chỉ định",ok:"OK",orderAtPrice:"tại {price}",modify:"Chỉnh sửa",failedModifyPosition:"Không thể chỉnh sửa vị thế.",failedModifyOrder:"Không thể chỉnh sửa lệnh.",positionClosedSimple:"Vị thế #{ticket} đã được đóng.",orderUpdated:"Lệnh #{ticket} đã được cập nhật.",closePositionDetail:"Đóng #{ticket} {type} {volume} {symbol} từ {openPrice} tại {closePrice} với lợi nhuận {profit}",deleteOrderDetail:"Xóa #{ticket} {typeLabel} {volume} {symbol} tại {price}",pleaseSelectTradingAccount:"Vui lòng chọn một tài khoản giao dịch.",pleaseSetLimitPrice:"Vui lòng đặt giá giới hạn cho lệnh này.",pleaseSetOrderPrice:"Vui lòng đặt giá cho các lệnh chờ.",pleaseSetStopPrice:"Vui lòng đặt giá dừng cho các lệnh stop limit.",pleaseSetExpirationDate:"Vui lòng đặt ngày hết hạn cho lệnh này.",pleaseSetStopAndLimitPrices:"Vui lòng đặt cả giá dừng và giá giới hạn.",failedPlaceOrder:"Không thể đặt lệnh.",orderNotAccepted:"Lệnh không được chấp nhận.",newOrder:"Lệnh mới",selectYourTradingAccount:"Chọn tài khoản giao dịch của bạn",switchingAccount:"Đang chuyển tài khoản…",activeAccount:"Đang hoạt động"},Qh={WebTrading:qh},Yh={symbol:"สัญลักษณ์",back:"กลับ",continue:"ดำเนินการต่อ",error:"ข้อผิดพลาด",selectTradingAccount:"เลือกบัญชีซื้อขาย",selectAccountDescription:"เลือกบัญชีเพื่อดำเนินการซื้อขายบนกราฟต่อ",loadingAccounts:"กำลังโหลดบัญชี…",noTradingAccounts:"ไม่มีบัญชีซื้อขายที่ใช้งานได้",selectAccount:"เลือกบัญชี",createAccount:"สร้างบัญชี",ticket:"หมายเลขคำสั่ง",serverTime:"เวลาของเซิร์ฟเวอร์",type:"ประเภท",volume:"ปริมาณ",price:"ราคา",stopLossShort:"S / L",takeProfitShort:"T / P",swap:"สวอป",profit:"กำไร",comment:"หมายเหตุ",close:"ปิด",balance:"ยอดคงเหลือ",equity:"ส่วนของผู้ถือหุ้น",margin:"มาร์จิ้น",freeMargin:"มาร์จิ้นคงเหลือ",level:"ระดับ",trade:"ซื้อขาย",history:"ประวัติ",terminalPanelTabs:"แท็บแผงเทอร์มินัล",closeAll:"ปิดทั้งหมด",closing:"กำลังปิด…",refresh:"รีเฟรช",refreshing:"กำลังรีเฟรช…",refreshDealHistory:"รีเฟรชประวัติการซื้อขาย",notAvailable:"ไม่มีข้อมูล",closePositionTicket:"ปิดสถานะ #{ticket}",closePosition:"ปิดสถานะ",deleteOrderTicket:"ลบคำสั่ง #{ticket}",deleteOrder:"ลบคำสั่ง",resizeTerminalPanel:"ปรับขนาดแผงเทอร์มินัล",loading:"กำลังโหลด…",noPositions:"คุณไม่มีสถานะใด ๆ",createNewOrder:"สร้างคำสั่งใหม่",chartSidePanel:"แผงด้านข้างกราฟ",scanResult:"ผลการสแกน",openTerminal:"เปิดเทอร์มินัล",orders:"คำสั่งซื้อขาย",terminal:"เทอร์มินัล",closeTerminalPanel:"ปิดแผงเทอร์มินัล",buy:"ซื้อ",sell:"ขาย",balanceType:"ยอดคงเหลือ",credit:"เครดิต",deal:"ดีล",login:"เข้าสู่ระบบ",action:"การดำเนินการ",entry:"รายการ",time:"เวลา",localTime:"เวลาท้องถิ่น",entryIn:"เข้า",entryOut:"ออก",selectAccountForDeals:"เลือกบัญชีเพื่อดูประวัติการซื้อขาย",noDealsFound:"ไม่พบรายการซื้อขาย",seeFullDealHistory:"ดูประวัติการซื้อขายทั้งหมด",unknownAction:"การดำเนินการ {action}",failedClosePosition:"ไม่สามารถปิดสถานะได้",positionClosed:"สถานะ #{ticket} ถูกปิดที่ราคา {price}",closePositionNotConfigured:"ยังไม่ได้ตั้งค่าการปิดสถานะ",onePositionClosed:"ปิดสถานะแล้ว 1 รายการ",positionsClosed:"ปิดสถานะแล้ว {count} รายการ",failedClosePositions:"ไม่สามารถปิดสถานะได้",closedFailedSummary:"ปิดแล้ว {closed} รายการ ล้มเหลว {failed} รายการ",failedDeleteOrder:"ไม่สามารถลบคำสั่งได้",orderDeleted:"ลบคำสั่ง #{ticket} แล้ว",positionUpdated:"สถานะ #{ticket} ได้รับการอัปเดตแล้ว",stopLoss:"หยุดขาดทุน",takeProfit:"ทำกำไร",stopPrice:"ราคาหยุด",limitPrice:"ราคาจำกัด",volumeSetting:"การตั้งค่าปริมาณ",riskManagement:"การจัดการความเสี่ยง",expiration:"วันหมดอายุ",orderExecutionType:"ประเภทการดำเนินการคำสั่ง",orderExpirationType:"ประเภทวันหมดอายุของคำสั่ง",expirationTime:"เวลาหมดอายุ",expirationDay:"วันหมดอายุ",placed:"ส่งแล้ว",closeConfirmation:"ยืนยันการปิด",closePositionPanel:"แผงปิดสถานะ",closeOrderPanel:"แผงปิดคำสั่ง",minimizeToQuickOrder:"ย่อเป็นแผงคำสั่งด่วน",moveQuickOrderPanel:"ย้ายแผงคำสั่งด่วน",decreaseVolume:"ลดปริมาณ",increaseVolume:"เพิ่มปริมาณ",expandQuickOrderPanel:"ขยายแผงคำสั่งด่วน",collapseQuickOrderPanel:"ยุบแผงคำสั่งด่วน",searchSymbol:"ค้นหาสัญลักษณ์",bid:"ราคาขาย",ask:"ราคาซื้อ",lots:"ล็อต",orderPrice:"ราคาคำสั่ง",sellByMarket:"ขายตามราคาตลาด",buyByMarket:"ซื้อตามราคาตลาด",placeOrder:"ส่งคำสั่ง {label}",selectAccountToTrade:"เลือกบัญชีซื้อขายเพื่อเริ่มส่งคำสั่ง",executionMarket:"ดำเนินการตามราคาตลาด",executionBuyLimit:"Buy Limit",executionSellLimit:"Sell Limit",executionBuyStop:"Buy Stop",executionSellStop:"Sell Stop",executionBuyStopLimit:"Buy Stop Limit",executionSellStopLimit:"Sell Stop Limit",expirationGtc:"GTC",expirationToday:"วันนี้",expirationSpecified:"กำหนดเอง",expirationSpecifiedDay:"วันที่กำหนด",ok:"ตกลง",orderAtPrice:"ที่ราคา {price}",modify:"แก้ไข",failedModifyPosition:"ไม่สามารถแก้ไขสถานะได้",failedModifyOrder:"ไม่สามารถแก้ไขคำสั่งได้",positionClosedSimple:"สถานะ #{ticket} ถูกปิดแล้ว",orderUpdated:"คำสั่ง #{ticket} ได้รับการอัปเดตแล้ว",closePositionDetail:"ปิด #{ticket} {type} {volume} {symbol} {openPrice} ที่ {closePrice} ด้วยกำไร {profit}",deleteOrderDetail:"ลบ #{ticket} {typeLabel} {volume} {symbol} ที่ราคา {price}",pleaseSelectTradingAccount:"กรุณาเลือกบัญชีซื้อขาย",pleaseSetLimitPrice:"กรุณากำหนดราคาจำกัดสำหรับคำสั่งนี้",pleaseSetOrderPrice:"กรุณากำหนดราคาสำหรับคำสั่งรอดำเนินการ",pleaseSetStopPrice:"กรุณากำหนดราคาหยุดสำหรับคำสั่ง Stop Limit",pleaseSetExpirationDate:"กรุณากำหนดวันหมดอายุสำหรับคำสั่งนี้",pleaseSetStopAndLimitPrices:"กรุณากำหนดทั้งราคาหยุดและราคาจำกัด",failedPlaceOrder:"ไม่สามารถส่งคำสั่งได้",orderNotAccepted:"คำสั่งไม่ได้รับการยอมรับ",newOrder:"คำสั่งใหม่",selectYourTradingAccount:"เลือกบัญชีซื้อขายของคุณ",switchingAccount:"กำลังสลับบัญชี…",activeAccount:"ใช้งานอยู่"},Zh={WebTrading:Yh},Xh={symbol:"심볼",back:"뒤로",continue:"계속",error:"오류",selectTradingAccount:"거래 계좌 선택",selectAccountDescription:"차트에서 거래를 계속하려면 계좌를 선택하세요.",loadingAccounts:"계좌를 불러오는 중…",noTradingAccounts:"사용 가능한 거래 계좌가 없습니다.",selectAccount:"계좌 선택",createAccount:"계좌 생성",ticket:"티켓",serverTime:"서버 시간",type:"유형",volume:"거래량",price:"가격",stopLossShort:"손절가",takeProfitShort:"이익실현가",swap:"스왑",profit:"수익",comment:"메모",close:"닫기",balance:"잔액",equity:"순자산",margin:"증거금",freeMargin:"사용 가능 증거금",level:"수준",trade:"거래",history:"내역",terminalPanelTabs:"터미널 패널 탭",closeAll:"모두 닫기",closing:"닫는 중…",refresh:"새로고침",refreshing:"새로고침 중…",refreshDealHistory:"거래 내역 새로고침",notAvailable:"해당 없음",closePositionTicket:"포지션 닫기 #{ticket}",closePosition:"포지션 닫기",deleteOrderTicket:"주문 삭제 #{ticket}",deleteOrder:"주문 삭제",resizeTerminalPanel:"터미널 패널 크기 조정",loading:"불러오는 중…",noPositions:"보유 중인 포지션이 없습니다",createNewOrder:"새 주문 생성",chartSidePanel:"차트 사이드 패널",scanResult:"스캔 결과",openTerminal:"터미널 열기",orders:"주문",terminal:"터미널",closeTerminalPanel:"터미널 패널 닫기",buy:"매수",sell:"매도",balanceType:"잔액",credit:"크레딧",deal:"거래",login:"로그인",action:"작업",entry:"진입",time:"시간",localTime:"현지 시간",entryIn:"진입",entryOut:"청산",selectAccountForDeals:"거래 내역을 보려면 계좌를 선택하세요",noDealsFound:"거래 내역이 없습니다",seeFullDealHistory:"전체 거래 내역 보기",unknownAction:"작업 {action}",failedClosePosition:"포지션을 닫지 못했습니다.",positionClosed:"포지션 #{ticket}이(가) {price}에 청산되었습니다.",closePositionNotConfigured:"포지션 닫기가 구성되지 않았습니다.",onePositionClosed:"1개의 포지션이 청산되었습니다.",positionsClosed:"{count}개의 포지션이 청산되었습니다.",failedClosePositions:"포지션을 닫지 못했습니다.",closedFailedSummary:"{closed}개 청산, {failed}개 실패.",failedDeleteOrder:"주문을 삭제하지 못했습니다.",orderDeleted:"주문 #{ticket}이(가) 삭제되었습니다.",positionUpdated:"포지션 #{ticket}이(가) 업데이트되었습니다.",stopLoss:"손절",takeProfit:"이익실현",stopPrice:"스톱 가격",limitPrice:"지정가",volumeSetting:"거래량 설정",riskManagement:"위험 관리",expiration:"만료",orderExecutionType:"주문 실행 유형",orderExpirationType:"주문 만료 유형",expirationTime:"만료 시간",expirationDay:"만료 날짜",placed:"접수됨",closeConfirmation:"청산 확인",closePositionPanel:"포지션 닫기 패널",closeOrderPanel:"주문 닫기 패널",minimizeToQuickOrder:"빠른 주문 패널로 최소화",moveQuickOrderPanel:"빠른 주문 패널 이동",decreaseVolume:"거래량 감소",increaseVolume:"거래량 증가",expandQuickOrderPanel:"빠른 주문 패널 확장",collapseQuickOrderPanel:"빠른 주문 패널 축소",searchSymbol:"심볼 검색",bid:"매도호가",ask:"매수호가",lots:"랏",orderPrice:"주문 가격",sellByMarket:"시장가 매도",buyByMarket:"시장가 매수",placeOrder:"{label} 주문",selectAccountToTrade:"주문을 시작하려면 거래 계좌를 선택하세요.",executionMarket:"시장가 실행",executionBuyLimit:"매수 지정가",executionSellLimit:"매도 지정가",executionBuyStop:"매수 스톱",executionSellStop:"매도 스톱",executionBuyStopLimit:"매수 스톱 지정가",executionSellStopLimit:"매도 스톱 지정가",expirationGtc:"GTC",expirationToday:"오늘",expirationSpecified:"지정",expirationSpecifiedDay:"지정일",ok:"확인",orderAtPrice:"{price}에서",modify:"수정",failedModifyPosition:"포지션을 수정하지 못했습니다.",failedModifyOrder:"주문을 수정하지 못했습니다.",positionClosedSimple:"포지션 #{ticket}이(가) 청산되었습니다.",orderUpdated:"주문 #{ticket}이(가) 업데이트되었습니다.",closePositionDetail:"#{ticket} {type} {volume} {symbol} {openPrice}를 {closePrice}에서 청산, 수익 {profit}",deleteOrderDetail:"#{ticket} {typeLabel} {volume} {symbol}을 {price}에서 삭제",pleaseSelectTradingAccount:"거래 계좌를 선택하세요.",pleaseSetLimitPrice:"이 주문의 지정가를 설정하세요.",pleaseSetOrderPrice:"대기 주문의 가격을 설정하세요.",pleaseSetStopPrice:"스톱 지정가 주문의 스톱 가격을 설정하세요.",pleaseSetExpirationDate:"이 주문의 만료일을 설정하세요.",pleaseSetStopAndLimitPrices:"스톱 가격과 지정가를 모두 설정하세요.",failedPlaceOrder:"주문을 접수하지 못했습니다.",orderNotAccepted:"주문이 승인되지 않았습니다.",newOrder:"새 주문",selectYourTradingAccount:"거래 계좌 선택",switchingAccount:"계좌 전환 중…",activeAccount:"활성화됨"},Jh={WebTrading:Xh},eg={symbol:"シンボル",back:"戻る",continue:"続行",error:"エラー",selectTradingAccount:"取引口座を選択",selectAccountDescription:"チャートで取引を続けるための口座を選択してください。",loadingAccounts:"口座を読み込み中…",noTradingAccounts:"利用可能な取引口座がありません。",selectAccount:"口座を選択",createAccount:"口座を作成",ticket:"チケット",serverTime:"サーバー時間",type:"タイプ",volume:"数量",price:"価格",stopLossShort:"損切り",takeProfitShort:"利確",swap:"スワップ",profit:"利益",comment:"コメント",close:"閉じる",balance:"残高",equity:"有効証拠金",margin:"証拠金",freeMargin:"余剰証拠金",level:"レベル",trade:"取引",history:"履歴",terminalPanelTabs:"ターミナルパネルのタブ",closeAll:"すべて閉じる",closing:"閉じています…",refresh:"更新",refreshing:"更新中…",refreshDealHistory:"取引履歴を更新",notAvailable:"該当なし",closePositionTicket:"ポジションを閉じる #{ticket}",closePosition:"ポジションを閉じる",deleteOrderTicket:"注文を削除 #{ticket}",deleteOrder:"注文を削除",resizeTerminalPanel:"ターミナルパネルのサイズを変更",loading:"読み込み中…",noPositions:"保有中のポジションはありません",createNewOrder:"新規注文を作成",chartSidePanel:"チャートサイドパネル",scanResult:"スキャン結果",openTerminal:"ターミナルを開く",orders:"注文",terminal:"ターミナル",closeTerminalPanel:"ターミナルパネルを閉じる",buy:"買い",sell:"売り",balanceType:"残高",credit:"クレジット",deal:"取引",login:"ログイン",action:"操作",entry:"エントリー",time:"時間",localTime:"現地時間",entryIn:"入場",entryOut:"出場",selectAccountForDeals:"取引履歴を表示するには口座を選択してください",noDealsFound:"取引履歴が見つかりません",seeFullDealHistory:"すべての取引履歴を表示",unknownAction:"操作 {action}",failedClosePosition:"ポジションを閉じられませんでした。",positionClosed:"ポジション #{ticket} は {price} で決済されました。",closePositionNotConfigured:"ポジションを閉じる機能が設定されていません。",onePositionClosed:"1件のポジションが決済されました。",positionsClosed:"{count}件のポジションが決済されました。",failedClosePositions:"ポジションを閉じられませんでした。",closedFailedSummary:"{closed}件決済、{failed}件失敗しました。",failedDeleteOrder:"注文を削除できませんでした。",orderDeleted:"注文 #{ticket} が削除されました。",positionUpdated:"ポジション #{ticket} が更新されました。",stopLoss:"損切り",takeProfit:"利確",stopPrice:"ストップ価格",limitPrice:"指値価格",volumeSetting:"数量設定",riskManagement:"リスク管理",expiration:"有効期限",orderExecutionType:"注文執行タイプ",orderExpirationType:"注文の有効期限タイプ",expirationTime:"有効期限時間",expirationDay:"有効期限日",placed:"発注済み",closeConfirmation:"決済確認",closePositionPanel:"ポジション決済パネル",closeOrderPanel:"注文決済パネル",minimizeToQuickOrder:"クイック注文パネルに最小化",moveQuickOrderPanel:"クイック注文パネルを移動",decreaseVolume:"数量を減らす",increaseVolume:"数量を増やす",expandQuickOrderPanel:"クイック注文パネルを展開",collapseQuickOrderPanel:"クイック注文パネルを折りたたむ",searchSymbol:"シンボルを検索",bid:"売値",ask:"買値",lots:"ロット",orderPrice:"注文価格",sellByMarket:"成行売り",buyByMarket:"成行買い",placeOrder:"{label}を発注",selectAccountToTrade:"注文を開始するには取引口座を選択してください。",executionMarket:"成行執行",executionBuyLimit:"買い指値",executionSellLimit:"売り指値",executionBuyStop:"買い逆指値",executionSellStop:"売り逆指値",executionBuyStopLimit:"買い逆指値指値",executionSellStopLimit:"売り逆指値指値",expirationGtc:"GTC",expirationToday:"今日",expirationSpecified:"指定",expirationSpecifiedDay:"指定日",ok:"OK",orderAtPrice:"{price}で",modify:"変更",failedModifyPosition:"ポジションを変更できませんでした。",failedModifyOrder:"注文を変更できませんでした。",positionClosedSimple:"ポジション #{ticket} が決済されました。",orderUpdated:"注文 #{ticket} が更新されました。",closePositionDetail:"#{ticket} {type} {volume} {symbol} {openPrice} を {closePrice} で決済、利益 {profit}",deleteOrderDetail:"#{ticket} {typeLabel} {volume} {symbol} を {price} で削除",pleaseSelectTradingAccount:"取引口座を選択してください。",pleaseSetLimitPrice:"この注文の指値価格を設定してください。",pleaseSetOrderPrice:"保留注文の価格を設定してください。",pleaseSetStopPrice:"逆指値指値注文のストップ価格を設定してください。",pleaseSetExpirationDate:"この注文の有効期限を設定してください。",pleaseSetStopAndLimitPrices:"ストップ価格と指値価格の両方を設定してください。",failedPlaceOrder:"注文を発注できませんでした。",orderNotAccepted:"注文は受け付けられませんでした。",newOrder:"新規注文",selectYourTradingAccount:"取引口座を選択",switchingAccount:"口座を切り替え中…",activeAccount:"有効"},tg={WebTrading:eg},ng={symbol:"Симбол",back:"Буцах",continue:"Үргэлжлүүлэх",error:"Алдаа",selectTradingAccount:"Арилжааны данс сонгох",selectAccountDescription:"График дээр арилжаагаа үргэлжлүүлэхийн тулд данс сонгоно уу.",loadingAccounts:"Дансуудыг ачаалж байна…",noTradingAccounts:"Боломжтой арилжааны данс алга.",selectAccount:"Данс сонгох",createAccount:"Данс үүсгэх",ticket:"Тасалбар",serverTime:"Серверийн цаг",type:"Төрөл",volume:"Хэмжээ",price:"Үнэ",stopLossShort:"S/L",takeProfitShort:"T/P",swap:"Своп",profit:"Ашиг",comment:"Тайлбар",close:"Хаах",balance:"Үлдэгдэл",equity:"Equity",margin:"Маржин",freeMargin:"Free маржин",level:"Түвшин",trade:"Арилжаа",history:"Түүх",terminalPanelTabs:"Терминалын самбарын табууд",closeAll:"Бүгдийг хаах",closing:"Хааж байна…",refresh:"Сэргээх",refreshing:"Сэргээж байна…",refreshDealHistory:"Хэлцлийн түүхийг сэргээх",notAvailable:"Байхгүй",closePositionTicket:"Позици хаах #{ticket}",closePosition:"Позици хаах",deleteOrderTicket:"Захиалга устгах #{ticket}",deleteOrder:"Захиалга устгах",resizeTerminalPanel:"Терминалын самбарын хэмжээг өөрчлөх",loading:"Ачаалж байна…",noPositions:"Танд нээлттэй позици алга",createNewOrder:"Шинэ захиалга үүсгэх",chartSidePanel:"Графикийн хажуугийн самбар",scanResult:"Сканны үр дүн",openTerminal:"Терминал нээх",orders:"Захиалгууд",terminal:"Терминал",closeTerminalPanel:"Терминалын самбарыг хаах",buy:"Худалдан авах",sell:"Зарах",balanceType:"Үлдэгдэл",credit:"Кредит",deal:"Хэлцэл",login:"Нэвтрэх",action:"Үйлдэл",entry:"Нэвтрэлт",time:"Цаг",localTime:"Орон нутгийн цаг",entryIn:"ОРСОН",entryOut:"ГАРСАН",selectAccountForDeals:"Хэлцлийн түүхийг харахын тулд данс сонгоно уу",noDealsFound:"Хэлцэл олдсонгүй",seeFullDealHistory:"Бүтэн хэлцлийн түүхийг харах",unknownAction:"Үйлдэл {action}",failedClosePosition:"Позици хааж чадсангүй.",positionClosed:"Позици #{ticket} {price} үнээр хаагдлаа.",closePositionNotConfigured:"Позици хаах тохиргоо хийгдээгүй байна.",onePositionClosed:"1 позици хаагдлаа.",positionsClosed:"{count} позици хаагдлаа.",failedClosePositions:"Позициудыг хааж чадсангүй.",closedFailedSummary:"{closed} хаагдсан, {failed} амжилтгүй.",failedDeleteOrder:"Захиалга устгаж чадсангүй.",orderDeleted:"Захиалга #{ticket} устгагдлаа.",positionUpdated:"Позици #{ticket} шинэчлэгдлээ.",stopLoss:"Стоп-лосс",takeProfit:"Тейк-профит",stopPrice:"Стоп үнэ",limitPrice:"Лимит үнэ",volumeSetting:"Хэмжээний тохиргоо",riskManagement:"Эрсдэлийн удирдлага",expiration:"Хүчинтэй хугацаа",orderExecutionType:"Захиалга гүйцэтгэх төрөл",orderExpirationType:"Захиалгын хугацааны төрөл",expirationTime:"Дуусах цаг",expirationDay:"Дуусах өдөр",placed:"Илгээгдсэн",closeConfirmation:"Хаах баталгаажуулалт",closePositionPanel:"Позици хаах самбар",closeOrderPanel:"Захиалга хаах самбар",minimizeToQuickOrder:"Хурдан захиалгын самбар болгон жижигрүүлэх",moveQuickOrderPanel:"Хурдан захиалгын самбарыг зөөх",decreaseVolume:"Хэмжээг багасгах",increaseVolume:"Хэмжээг нэмэх",expandQuickOrderPanel:"Хурдан захиалгын самбарыг дэлгэх",collapseQuickOrderPanel:"Хурдан захиалгын самбарыг хумих",searchSymbol:"Симбол хайх",bid:"Bid",ask:"Ask",lots:"Лот",orderPrice:"Захиалгын үнэ",sellByMarket:"Зах зээлийн үнээр зарах",buyByMarket:"Зах зээлийн үнээр худалдаж авах",placeOrder:"{label} байрлуулах",selectAccountToTrade:"Захиалга байршуулж эхлэхийн тулд арилжааны данс сонгоно уу.",executionMarket:"Зах зээлийн гүйцэтгэл",executionBuyLimit:"Худалдан авах лимит",executionSellLimit:"Зарах лимит",executionBuyStop:"Худалдан авах стоп",executionSellStop:"Зарах стоп",executionBuyStopLimit:"Худалдан авах стоп лимит",executionSellStopLimit:"Зарах стоп лимит",expirationGtc:"GTC",expirationToday:"Өнөөдөр",expirationSpecified:"Тодорхой хугацаа",expirationSpecifiedDay:"Тодорхой өдөр",ok:"OK",orderAtPrice:"{price} үнээр",modify:"Засах",failedModifyPosition:"Позици өөрчилж чадсангүй.",failedModifyOrder:"Захиалга өөрчилж чадсангүй.",positionClosedSimple:"Позици #{ticket} хаагдлаа.",orderUpdated:"Захиалга #{ticket} шинэчлэгдлээ.",closePositionDetail:"#{ticket} {type} {volume} {symbol} {openPrice}-ийг {closePrice} үнээр хааж, {profit} ашигтай болсон",deleteOrderDetail:"#{ticket} {typeLabel} {volume} {symbol}-ийг {price} үнээр устгах",pleaseSelectTradingAccount:"Арилжааны данс сонгоно уу.",pleaseSetLimitPrice:"Энэ захиалгад лимит үнэ оруулна уу.",pleaseSetOrderPrice:"Хүлээгдэж буй захиалгад үнэ оруулна уу.",pleaseSetStopPrice:"Стоп лимит захиалгад стоп үнэ оруулна уу.",pleaseSetExpirationDate:"Энэ захиалгад дуусах хугацаа оруулна уу.",pleaseSetStopAndLimitPrices:"Стоп болон лимит үнийг хоёуланг нь оруулна уу.",failedPlaceOrder:"Захиалга байршуулж чадсангүй.",orderNotAccepted:"Захиалгыг зөвшөөрсөнгүй.",newOrder:"Шинэ захиалга",selectYourTradingAccount:"Арилжааны дансаа сонгоно уу",switchingAccount:"Данс сольж байна…",activeAccount:"Идэвхтэй"},rg={WebTrading:ng},ig={symbol:"Символ",back:"Назад",continue:"Продолжить",error:"Ошибка",selectTradingAccount:"Выберите торговый счет",selectAccountDescription:"Выберите счет, чтобы продолжить торговлю на графике.",loadingAccounts:"Загрузка счетов…",noTradingAccounts:"Нет доступных торговых счетов.",selectAccount:"Выбрать счет",createAccount:"Создать счет",ticket:"Тикет",serverTime:"Время сервера",type:"Тип",volume:"Объем",price:"Цена",stopLossShort:"S / L",takeProfitShort:"T / P",swap:"Своп",profit:"Прибыль",comment:"Комментарий",close:"Закрыть",balance:"Баланс",equity:"Собственный капитал",margin:"Маржа",freeMargin:"Свободная маржа",level:"Уровень",trade:"Торговля",history:"История",terminalPanelTabs:"Вкладки панели терминала",closeAll:"Закрыть все",closing:"Закрытие…",refresh:"Обновить",refreshing:"Обновление…",refreshDealHistory:"Обновить историю сделок",notAvailable:"Н/Д",closePositionTicket:"Закрыть позицию #{ticket}",closePosition:"Закрыть позицию",deleteOrderTicket:"Удалить ордер #{ticket}",deleteOrder:"Удалить ордер",resizeTerminalPanel:"Изменить размер панели терминала",loading:"Загрузка…",noPositions:"У вас нет открытых позиций",createNewOrder:"Создать новый ордер",chartSidePanel:"Боковая панель графика",scanResult:"Результат сканирования",openTerminal:"Открыть терминал",orders:"Ордеры",terminal:"Терминал",closeTerminalPanel:"Закрыть панель терминала",buy:"Покупка",sell:"Продажа",balanceType:"Баланс",credit:"Кредит",deal:"Сделка",login:"Вход",action:"Действие",entry:"Вход",time:"Время",localTime:"Местное время",entryIn:"ВХОД",entryOut:"ВЫХОД",selectAccountForDeals:"Выберите счет для просмотра истории сделок",noDealsFound:"Сделки не найдены",seeFullDealHistory:"Посмотреть полную историю сделок",unknownAction:"Действие {action}",failedClosePosition:"Не удалось закрыть позицию.",positionClosed:"Позиция #{ticket} закрыта по цене {price}.",closePositionNotConfigured:"Функция закрытия позиции не настроена.",onePositionClosed:"Закрыта 1 позиция.",positionsClosed:"Закрыто {count} позиций.",failedClosePositions:"Не удалось закрыть позиции.",closedFailedSummary:"Закрыто {closed}, не удалось {failed}.",failedDeleteOrder:"Не удалось удалить ордер.",orderDeleted:"Ордер #{ticket} удален.",positionUpdated:"Позиция #{ticket} обновлена.",stopLoss:"Стоп-лосс",takeProfit:"Тейк-профит",stopPrice:"Стоп-цена",limitPrice:"Лимитная цена",volumeSetting:"Настройка объема",riskManagement:"Управление рисками",expiration:"Срок действия",orderExecutionType:"Тип исполнения ордера",orderExpirationType:"Тип истечения ордера",expirationTime:"Время истечения",expirationDay:"Дата истечения",placed:"Размещено",closeConfirmation:"Подтверждение закрытия",closePositionPanel:"Панель закрытия позиции",closeOrderPanel:"Панель закрытия ордера",minimizeToQuickOrder:"Свернуть в панель быстрого ордера",moveQuickOrderPanel:"Переместить панель быстрого ордера",decreaseVolume:"Уменьшить объем",increaseVolume:"Увеличить объем",expandQuickOrderPanel:"Развернуть панель быстрого ордера",collapseQuickOrderPanel:"Свернуть панель быстрого ордера",searchSymbol:"Поиск символа",bid:"Цена Bid",ask:"Цена Ask",lots:"Лоты",orderPrice:"Цена ордера",sellByMarket:"Продать по рынку",buyByMarket:"Купить по рынку",placeOrder:"Разместить {label}",selectAccountToTrade:"Выберите торговый счет для размещения ордеров.",executionMarket:"Рыночное исполнение",executionBuyLimit:"Лимит на покупку",executionSellLimit:"Лимит на продажу",executionBuyStop:"Стоп на покупку",executionSellStop:"Стоп на продажу",executionBuyStopLimit:"Стоп-лимит на покупку",executionSellStopLimit:"Стоп-лимит на продажу",expirationGtc:"GTC",expirationToday:"Сегодня",expirationSpecified:"Указанный",expirationSpecifiedDay:"Указанный день",ok:"OK",orderAtPrice:"по цене {price}",modify:"Изменить",failedModifyPosition:"Не удалось изменить позицию.",failedModifyOrder:"Не удалось изменить ордер.",positionClosedSimple:"Позиция #{ticket} закрыта.",orderUpdated:"Ордер #{ticket} обновлен.",closePositionDetail:"Закрытие #{ticket} {type} {volume} {symbol} {openPrice} по {closePrice} с прибылью {profit}",deleteOrderDetail:"Удалить #{ticket} {typeLabel} {volume} {symbol} по цене {price}",pleaseSelectTradingAccount:"Пожалуйста, выберите торговый счет.",pleaseSetLimitPrice:"Пожалуйста, задайте лимитную цену для этого ордера.",pleaseSetOrderPrice:"Пожалуйста, задайте цену для отложенных ордеров.",pleaseSetStopPrice:"Пожалуйста, задайте стоп-цену для стоп-лимитных ордеров.",pleaseSetExpirationDate:"Пожалуйста, задайте дату истечения для этого ордера.",pleaseSetStopAndLimitPrices:"Пожалуйста, задайте и стоп-цену, и лимитную цену.",failedPlaceOrder:"Не удалось разместить ордер.",orderNotAccepted:"Ордер не был принят.",newOrder:"Новый ордер",selectYourTradingAccount:"Выберите свой торговый счет",switchingAccount:"Переключение счета…",activeAccount:"Активен"},sg={WebTrading:ig},il={en:zh,zh:Gh,vi:Qh,th:Zh,ko:Jh,ja:tg,mn:rg,ru:sg};function sl(e,t){const n=t.split(".");let r=e;for(const i of n){if(!r||typeof r!="object"||!(i in r))return;r=r[i]}return typeof r=="string"?r:void 0}function og(e,t){return t?e.replace(/\{(\w+)\}/g,(n,r)=>t[r]!=null?String(t[r]):`{${r}}`):e}function Yr(e,t,n){const r=sl(il[e],t)??sl(il.en,t)??t;return og(r,n)}const Au=S.createContext({language:ss,t:(e,t)=>Yr(ss,e,t)});function Ou({language:e,children:t}){const n=S.useMemo(()=>{const r=Ns(e);return{language:r,t:(i,s)=>Yr(r,i,s)}},[e]);return c.jsx(Au.Provider,{value:n,children:t})}function Le(){return S.useContext(Au)}function ol(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function ag(...e){return t=>{let n=!1;const r=e.map(i=>{const s=ol(i,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let i=0;i<r.length;i++){const s=r[i];typeof s=="function"?s():ol(e[i],null)}}}}function Ne(...e){return w.useCallback(ag(...e),e)}function gr(e){const t=w.forwardRef((n,r)=>{let{children:i,...s}=n,o=null,a=!1;const l=[];al(i)&&typeof ki=="function"&&(i=ki(i._payload)),w.Children.forEach(i,m=>{var p;if(pg(m)){a=!0;const b=m;let h="child"in b.props?b.props.child:b.props.children;al(h)&&typeof ki=="function"&&(h=ki(h._payload)),o=dg(b,h),l.push((p=o==null?void 0:o.props)==null?void 0:p.children)}else l.push(m)}),o?o=w.cloneElement(o,void 0,l):!a&&w.Children.count(i)===1&&w.isValidElement(i)&&(o=i);const d=o?fg(o):void 0,u=Ne(r,d);if(!o){if(i||i===0)throw new Error(a?yg(e):gg(e));return i}const f=ug(s,o.props??{});return o.type!==w.Fragment&&(f.ref=r?u:d),w.cloneElement(o,f)});return t.displayName=`${e}.Slot`,t}var cg=gr("Slot"),lg=Symbol.for("radix.slottable"),dg=(e,t)=>{if("child"in e.props){const n=e.props.child;return w.isValidElement(n)?w.cloneElement(n,void 0,e.props.children(n.props.children)):null}return w.isValidElement(t)?t:null};function ug(e,t){const n={...t};for(const r in t){const i=e[r],s=t[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...e,...n}}function fg(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function pg(e){return w.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===lg}var mg=Symbol.for("react.lazy");function al(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===mg&&"_payload"in e&&hg(e._payload)}function hg(e){return typeof e=="object"&&e!==null&&"then"in e}var gg=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,yg=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,ki=w[" use ".trim().toString()];function Nu(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Nu(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Ru(){for(var e,t,n=0,r="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Nu(e))&&(r&&(r+=" "),r+=t);return r}const cl=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,ll=Ru,Ba=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return ll(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:s}=t,o=Object.keys(i).map(d=>{const u=n==null?void 0:n[d],f=s==null?void 0:s[d];if(u===null)return null;const m=cl(u)||cl(f);return i[d][m]}),a=n&&Object.entries(n).reduce((d,u)=>{let[f,m]=u;return m===void 0||(d[f]=m),d},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((d,u)=>{let{class:f,className:m,...p}=u;return Object.entries(p).every(b=>{let[h,g]=b;return Array.isArray(g)?g.includes({...s,...a}[h]):{...s,...a}[h]===g})?[...d,f,m]:d},[]);return ll(e,o,l,n==null?void 0:n.class,n==null?void 0:n.className)},Wt=[{ticker:"EUR_JPY",display_name:"EURJPY",logo_urls:["https://cdn.iccandle.ai/web-assets/EUR.svg","https://cdn.iccandle.ai/web-assets/JPY.svg"],description:"EUR JPY",type:"forex",session:"1700-1700",pricescale:1e3,resolve_symbol:"EURJPY"},{ticker:"GBP_JPY",display_name:"GBPJPY",logo_urls:["https://cdn.iccandle.ai/web-assets/GBP.svg","https://cdn.iccandle.ai/web-assets/JPY.svg"],description:"GBP JPY",type:"forex",session:"1700-1700",pricescale:1e3,resolve_symbol:"GBPJPY"},{ticker:"AUD_JPY",display_name:"AUDJPY",logo_urls:["https://cdn.iccandle.ai/web-assets/AUD.svg","https://cdn.iccandle.ai/web-assets/JPY.svg"],description:"AUD JPY",type:"forex",session:"1700-1700",pricescale:1e3,resolve_symbol:"AUDJPY"},{ticker:"NZD_JPY",display_name:"NZDJPY",logo_urls:["https://cdn.iccandle.ai/web-assets/NZD.svg","https://cdn.iccandle.ai/web-assets/JPY.svg"],description:"NZD JPY",type:"forex",session:"1700-1700",pricescale:1e3,resolve_symbol:"NZDJPY"},{ticker:"CAD_JPY",display_name:"CADJPY",logo_urls:["https://cdn.iccandle.ai/web-assets/CAD.svg","https://cdn.iccandle.ai/web-assets/JPY.svg"],description:"CAD JPY",type:"forex",session:"1700-1700",pricescale:1e3,resolve_symbol:"CADJPY"},{ticker:"CHF_JPY",display_name:"CHFJPY",logo_urls:["https://cdn.iccandle.ai/web-assets/CHF.svg","https://cdn.iccandle.ai/web-assets/JPY.svg"],description:"CHF JPY",type:"forex",session:"1700-1700",pricescale:1e3,resolve_symbol:"CHFJPY"},{ticker:"USD_JPY",display_name:"USDJPY",logo_urls:["https://cdn.iccandle.ai/web-assets/USD.svg","https://cdn.iccandle.ai/web-assets/JPY.svg"],description:"USD JPY",type:"forex",session:"1700-1700",pricescale:1e3,resolve_symbol:"USDJPY"},{ticker:"EUR_USD",display_name:"EURUSD",logo_urls:["https://cdn.iccandle.ai/web-assets/EUR.svg","https://cdn.iccandle.ai/web-assets/USD.svg"],description:"EUR USD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"EURUSD"},{ticker:"AUD_USD",display_name:"AUDUSD",logo_urls:["https://cdn.iccandle.ai/web-assets/AUD.svg","https://cdn.iccandle.ai/web-assets/USD.svg"],description:"AUD USD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"AUDUSD"},{ticker:"NZD_USD",display_name:"NZDUSD",logo_urls:["https://cdn.iccandle.ai/web-assets/NZD.svg","https://cdn.iccandle.ai/web-assets/USD.svg"],description:"NZD USD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"NZDUSD"},{ticker:"USD_CHF",display_name:"USDCHF",logo_urls:["https://cdn.iccandle.ai/web-assets/USD.svg","https://cdn.iccandle.ai/web-assets/CHF.svg"],description:"USD CHF",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"USDCHF"},{ticker:"USD_CAD",display_name:"USDCAD",logo_urls:["https://cdn.iccandle.ai/web-assets/USD.svg","https://cdn.iccandle.ai/web-assets/CAD.svg"],description:"USD CAD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"USDCAD"},{ticker:"GBP_AUD",display_name:"GBPAUD",logo_urls:["https://cdn.iccandle.ai/web-assets/GBP.svg","https://cdn.iccandle.ai/web-assets/AUD.svg"],description:"GBP AUD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"GBPAUD"},{ticker:"GBP_CAD",display_name:"GBPCAD",logo_urls:["https://cdn.iccandle.ai/web-assets/GBP.svg","https://cdn.iccandle.ai/web-assets/CAD.svg"],description:"GBP CAD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"GBPCAD"},{ticker:"GBP_CHF",display_name:"GBPCHF",logo_urls:["https://cdn.iccandle.ai/web-assets/GBP.svg","https://cdn.iccandle.ai/web-assets/CHF.svg"],description:"GBP CHF",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"GBPCHF"},{ticker:"GBP_NZD",display_name:"GBPNZD",logo_urls:["https://cdn.iccandle.ai/web-assets/GBP.svg","https://cdn.iccandle.ai/web-assets/NZD.svg"],description:"GBP NZD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"GBPNZD"},{ticker:"GBP_USD",display_name:"GBPUSD",logo_urls:["https://cdn.iccandle.ai/web-assets/GBP.svg","https://cdn.iccandle.ai/web-assets/USD.svg"],description:"GBP USD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"GBPUSD"},{ticker:"NZD_CAD",display_name:"NZDCAD",logo_urls:["https://cdn.iccandle.ai/web-assets/NZD.svg","https://cdn.iccandle.ai/web-assets/CAD.svg"],description:"NZD CAD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"NZDCAD"},{ticker:"EUR_CAD",display_name:"EURCAD",logo_urls:["https://cdn.iccandle.ai/web-assets/EUR.svg","https://cdn.iccandle.ai/web-assets/CAD.svg"],description:"EUR CAD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"EURCAD"},{ticker:"EUR_AUD",display_name:"EURAUD",logo_urls:["https://cdn.iccandle.ai/web-assets/EUR.svg","https://cdn.iccandle.ai/web-assets/AUD.svg"],description:"EUR AUD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"EURAUD"},{ticker:"XAU_USD",display_name:"XAUUSD",logo_urls:["https://cdn.iccandle.ai/web-assets/XAU.svg"],description:"Gold",type:"commodity",session:"1700-1700",pricescale:1e3,resolve_symbol:"XAUUSD"},{ticker:"BCO_USD",display_name:"BCOUSD",logo_urls:["https://cdn.iccandle.ai/web-assets/BCO.svg"],description:"Brent Crude Oil",type:"commodity",session:"1700-1700",pricescale:1e3,resolve_symbol:"SpotBrent"},{ticker:"SPX500_USD",display_name:"S&P500",logo_urls:["https://cdn.iccandle.ai/web-assets/SPX500.svg"],description:"S&P 500",type:"indices",session:"1700-1700",pricescale:10,resolve_symbol:"SP500"},{ticker:"NAS100_USD",display_name:"NASDAQ100",logo_urls:["https://cdn.iccandle.ai/web-assets/NAS100.svg"],description:"NASDAQ 100",type:"indices",session:"1700-1700",pricescale:10,resolve_symbol:"NAS100"},{ticker:"US30_USD",display_name:"US30",logo_urls:["https://cdn.iccandle.ai/web-assets/US30.svg"],description:"US Wall St 30",type:"indices",session:"1700-1700",pricescale:10,resolve_symbol:"US30"},{ticker:"BTCUSDT",display_name:"BTCUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/BTC.svg"],description:"BTCUSDT",type:"crypto",session:"24x7",pricescale:100,resolve_symbol:"BTCUSD"},{ticker:"ETHUSDT",display_name:"ETHUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/ETH.svg"],description:"ETHUSDT",type:"crypto",session:"24x7",pricescale:100,resolve_symbol:"ETHUSD"},{ticker:"XRPUSDT",display_name:"XRPUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/XRP.svg"],description:"XRPUSDT",type:"crypto",session:"24x7",pricescale:1e4,resolve_symbol:"XRPUSD"},{ticker:"SOLUSDT",display_name:"SOLUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/SOL.svg"],description:"SOLUSDT",type:"crypto",session:"24x7",pricescale:100,resolve_symbol:"SOLUSD"},{ticker:"ADAUSDT",display_name:"ADAUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/ADA.svg"],description:"ADAUSDT",type:"crypto",session:"24x7",pricescale:1e4,resolve_symbol:"ADAUSD"},{ticker:"AVAUSDT",display_name:"AVAUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/AVA.svg"],description:"AVAUSDT",type:"crypto",session:"24x7",pricescale:1e4,resolve_symbol:"AVAUSD"},{ticker:"AVAXUSDT",display_name:"AVAXUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/AVAX.svg"],description:"AVAXUSDT",type:"crypto",session:"24x7",pricescale:100,resolve_symbol:"AVAXUSD"},{ticker:"BNBUSDT",display_name:"BNBUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/BNB.svg"],description:"BNBUSDT",type:"crypto",session:"24x7",pricescale:100,resolve_symbol:"BNBUSD"},{ticker:"DOGEUSDT",display_name:"DOGEUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/DOGE.svg"],description:"DOGEUSDT",type:"crypto",session:"24x7",pricescale:1e5,resolve_symbol:"DOGUSD"},{ticker:"DOTUSDT",display_name:"DOTUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/DOT.svg"],description:"DOTUSDT",type:"crypto",session:"24x7",pricescale:1e3,resolve_symbol:"DOTUSD"},{ticker:"TRXUSDT",display_name:"TRXUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/TRX.svg"],description:"TRXUSDT",type:"crypto",session:"24x7",pricescale:1e4,resolve_symbol:"TRXUSD"},{ticker:"AAPL",display_name:"AAPL",logo_urls:["https://cdn.iccandle.ai/web-assets/AAPL.svg"],description:"Apple Inc.",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"AAPL"},{ticker:"AMZN",display_name:"AMZN",logo_urls:["https://cdn.iccandle.ai/web-assets/AMZN.svg"],description:"Amazon.Com Inc",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"AMZN"},{ticker:"BRK.B",display_name:"BRK.B",logo_urls:["https://cdn.iccandle.ai/web-assets/BRK.B.svg"],description:"BERKSHIRE HATHAWAY Class B",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"BRKB"},{ticker:"GOOGL",display_name:"GOOGL",logo_urls:["https://cdn.iccandle.ai/web-assets/GOOGL.svg"],description:"Alphabet Inc. Class A Common Stock",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"GOOGL"},{ticker:"KO",display_name:"KO",logo_urls:["https://cdn.iccandle.ai/web-assets/KO.svg"],description:"Coca-Cola Company",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"KO"},{ticker:"META",display_name:"META",logo_urls:["https://cdn.iccandle.ai/web-assets/META.svg"],description:"Meta Platforms, Inc. Class A Common Stock",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"META"},{ticker:"MSFT",display_name:"MSFT",logo_urls:["https://cdn.iccandle.ai/web-assets/MSFT.svg"],description:"Microsoft Corp",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"MSFT"},{ticker:"NFLX",display_name:"NFLX",logo_urls:["https://cdn.iccandle.ai/web-assets/NFLX.svg"],description:"NetFlix Inc",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"NFLX"},{ticker:"NKE",display_name:"NKE",logo_urls:["https://cdn.iccandle.ai/web-assets/NKE.svg"],description:"Nike, Inc.",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"NKE"},{ticker:"NVDA",display_name:"NVDA",logo_urls:["https://cdn.iccandle.ai/web-assets/NVDA.svg"],description:"Nvidia Corp",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"NVDA"},{ticker:"TME",display_name:"TME",logo_urls:["https://cdn.iccandle.ai/web-assets/TME.svg"],description:"Tencent Music Entertainment Group American Depositary Shares, each representing two Class A Ordinary Shares",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"TME"},{ticker:"TSLA",display_name:"TSLA",logo_urls:["https://cdn.iccandle.ai/web-assets/TSLA.svg"],description:"Tesla, Inc. Common Stock",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"TSLA"},{ticker:"XAG_USD",display_name:"XAGUSD",logo_urls:["https://cdn.iccandle.ai/web-assets/XAG.svg"],description:"Silver",type:"commodity",session:"1700-1700",pricescale:1e3,resolve_symbol:"XAGUSD"},{ticker:"XCU_USD",display_name:"XCUUSD",logo_urls:["https://cdn.iccandle.ai/web-assets/XCU.svg"],description:"Copper",type:"commodity",session:"1700-1700",pricescale:1e3,resolve_symbol:"XCUUSD"}],bg={[-11]:["Pacific/Fakaofo"],[-10]:["Pacific/Honolulu"],[-9]:["America/Anchorage","America/Juneau"],[-8]:["America/Los_Angeles","America/Vancouver"],[-7]:["US/Mountain"],[-6]:["America/Chicago","America/El_Salvador"],[-5]:["America/New_York","America/Lima","America/Bogota"],[-4]:["America/Caracas","America/Santiago","America/Toronto"],[-3]:["America/Argentina/Buenos_Aires","America/Sao_Paulo"],0:["Europe/London","Atlantic/Reykjavik","Africa/Casablanca","Africa/Tunis","Africa/Lagos"],1:["Europe/Amsterdam","Europe/Berlin","Europe/Madrid","Europe/Paris"],2:["Europe/Athens","Africa/Cairo","Africa/Johannesburg"],3:["Europe/Moscow","Asia/Riyadh","Asia/Qatar"],3.5:["Asia/Tehran"],4:["Asia/Dubai","Asia/Muscat"],4.5:[],5:["Asia/Karachi"],5.5:["Asia/Kolkata","Asia/Colombo"],5.75:["Asia/Kathmandu"],6:["Asia/Dhaka","Asia/Almaty"],6.5:["Asia/Yangon"],7:["Asia/Bangkok","Asia/Jakarta"],8:["Asia/Shanghai","Asia/Singapore","Asia/Hong_Kong","Asia/Kuala_Lumpur"],9:["Asia/Tokyo","Asia/Seoul"],9.5:["Australia/Adelaide"],10:["Australia/Sydney","Australia/Brisbane"],11:["Pacific/Norfolk"],12:["Pacific/Auckland"]};function vg(){const e=-new Date().getTimezoneOffset()/60,t=bg[e];return t&&t.length>0?t[0]:"Etc/UTC"}const er="tv:latest-symbol",Lu="web-trading-last-account-login";function wg(){for(var e=0,t,n,r="";e<arguments.length;)(t=arguments[e++])&&(n=Du(t))&&(r&&(r+=" "),r+=n);return r}function Du(e){if(typeof e=="string")return e;for(var t,n="",r=0;r<e.length;r++)e[r]&&(t=Du(e[r]))&&(n&&(n+=" "),n+=t);return n}var Wa="-";function xg(e){var t=Sg(e),n=e.conflictingClassGroups,r=e.conflictingClassGroupModifiers,i=r===void 0?{}:r;function s(a){var l=a.split(Wa);return l[0]===""&&l.length!==1&&l.shift(),ju(l,t)||_g(a)}function o(a,l){var d=n[a]||[];return l&&i[a]?[].concat(d,i[a]):d}return{getClassGroupId:s,getConflictingClassGroupIds:o}}function ju(e,t){var o;if(e.length===0)return t.classGroupId;var n=e[0],r=t.nextPart.get(n),i=r?ju(e.slice(1),r):void 0;if(i)return i;if(t.validators.length!==0){var s=e.join(Wa);return(o=t.validators.find(function(a){var l=a.validator;return l(s)}))==null?void 0:o.classGroupId}}var dl=/^\[(.+)\]$/;function _g(e){if(dl.test(e)){var t=dl.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}}function Sg(e){var t=e.theme,n=e.prefix,r={nextPart:new Map,validators:[]},i=Cg(Object.entries(e.classGroups),n);return i.forEach(function(s){var o=s[0],a=s[1];Wo(a,r,o,t)}),r}function Wo(e,t,n,r){e.forEach(function(i){if(typeof i=="string"){var s=i===""?t:ul(t,i);s.classGroupId=n;return}if(typeof i=="function"){if(Tg(i)){Wo(i(r),t,n,r);return}t.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(function(o){var a=o[0],l=o[1];Wo(l,ul(t,a),n,r)})})}function ul(e,t){var n=e;return t.split(Wa).forEach(function(r){n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n}function Tg(e){return e.isThemeGetter}function Cg(e,t){return t?e.map(function(n){var r=n[0],i=n[1],s=i.map(function(o){return typeof o=="string"?t+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(function(a){var l=a[0],d=a[1];return[t+l,d]})):o});return[r,s]}):e}function Pg(e){if(e<1)return{get:function(){},set:function(){}};var t=0,n=new Map,r=new Map;function i(s,o){n.set(s,o),t++,t>e&&(t=0,r=n,n=new Map)}return{get:function(o){var a=n.get(o);if(a!==void 0)return a;if((a=r.get(o))!==void 0)return i(o,a),a},set:function(o,a){n.has(o)?n.set(o,a):i(o,a)}}}var Mu="!";function Eg(e){var t=e.separator||":",n=t.length===1,r=t[0],i=t.length;return function(o){for(var a=[],l=0,d=0,u,f=0;f<o.length;f++){var m=o[f];if(l===0){if(m===r&&(n||o.slice(f,f+i)===t)){a.push(o.slice(d,f)),d=f+i;continue}if(m==="/"){u=f;continue}}m==="["?l++:m==="]"&&l--}var p=a.length===0?o:o.substring(d),b=p.startsWith(Mu),h=b?p.substring(1):p,g=u&&u>d?u-d:void 0;return{modifiers:a,hasImportantModifier:b,baseClassName:h,maybePostfixModifierPosition:g}}}function kg(e){if(e.length<=1)return e;var t=[],n=[];return e.forEach(function(r){var i=r[0]==="[";i?(t.push.apply(t,n.sort().concat([r])),n=[]):n.push(r)}),t.push.apply(t,n.sort()),t}function Ag(e){return{cache:Pg(e.cacheSize),splitModifiers:Eg(e),...xg(e)}}var Og=/\s+/;function Ng(e,t){var n=t.splitModifiers,r=t.getClassGroupId,i=t.getConflictingClassGroupIds,s=new Set;return e.trim().split(Og).map(function(o){var a=n(o),l=a.modifiers,d=a.hasImportantModifier,u=a.baseClassName,f=a.maybePostfixModifierPosition,m=r(f?u.substring(0,f):u),p=!!f;if(!m){if(!f)return{isTailwindClass:!1,originalClassName:o};if(m=r(u),!m)return{isTailwindClass:!1,originalClassName:o};p=!1}var b=kg(l).join(":"),h=d?b+Mu:b;return{isTailwindClass:!0,modifierId:h,classGroupId:m,originalClassName:o,hasPostfixModifier:p}}).reverse().filter(function(o){if(!o.isTailwindClass)return!0;var a=o.modifierId,l=o.classGroupId,d=o.hasPostfixModifier,u=a+l;return s.has(u)?!1:(s.add(u),i(l,d).forEach(function(f){return s.add(a+f)}),!0)}).reverse().map(function(o){return o.originalClassName}).join(" ")}function Rg(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r,i,s,o=a;function a(d){var u=t[0],f=t.slice(1),m=f.reduce(function(p,b){return b(p)},u());return r=Ag(m),i=r.cache.get,s=r.cache.set,o=l,l(d)}function l(d){var u=i(d);if(u)return u;var f=Ng(d,r);return s(d,f),f}return function(){return o(wg.apply(null,arguments))}}function Oe(e){var t=function(r){return r[e]||[]};return t.isThemeGetter=!0,t}var Iu=/^\[(?:([a-z-]+):)?(.+)\]$/i,Lg=/^\d+\/\d+$/,Dg=new Set(["px","full","screen"]),jg=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Mg=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Ig=/^-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/;function mt(e){return vn(e)||Dg.has(e)||Lg.test(e)||$o(e)}function $o(e){return Wn(e,"length",Vg)}function Fg(e){return Wn(e,"size",Fu)}function Ug(e){return Wn(e,"position",Fu)}function Bg(e){return Wn(e,"url",Hg)}function Ai(e){return Wn(e,"number",vn)}function vn(e){return!Number.isNaN(Number(e))}function Wg(e){return e.endsWith("%")&&vn(e.slice(0,-1))}function Mr(e){return fl(e)||Wn(e,"number",fl)}function ve(e){return Iu.test(e)}function Ir(){return!0}function Kt(e){return jg.test(e)}function $g(e){return Wn(e,"",zg)}function Wn(e,t,n){var r=Iu.exec(e);return r?r[1]?r[1]===t:n(r[2]):!1}function Vg(e){return Mg.test(e)}function Fu(){return!1}function Hg(e){return e.startsWith("url(")}function fl(e){return Number.isInteger(Number(e))}function zg(e){return Ig.test(e)}function Kg(){var e=Oe("colors"),t=Oe("spacing"),n=Oe("blur"),r=Oe("brightness"),i=Oe("borderColor"),s=Oe("borderRadius"),o=Oe("borderSpacing"),a=Oe("borderWidth"),l=Oe("contrast"),d=Oe("grayscale"),u=Oe("hueRotate"),f=Oe("invert"),m=Oe("gap"),p=Oe("gradientColorStops"),b=Oe("gradientColorStopPositions"),h=Oe("inset"),g=Oe("margin"),y=Oe("opacity"),v=Oe("padding"),_=Oe("saturate"),x=Oe("scale"),T=Oe("sepia"),C=Oe("skew"),O=Oe("space"),P=Oe("translate"),L=function(){return["auto","contain","none"]},I=function(){return["auto","hidden","clip","visible","scroll"]},U=function(){return["auto",ve,t]},N=function(){return[ve,t]},V=function(){return["",mt]},M=function(){return["auto",vn,ve]},z=function(){return["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"]},k=function(){return["solid","dashed","dotted","double","none"]},j=function(){return["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-lighter"]},D=function(){return["start","end","center","between","around","evenly","stretch"]},R=function(){return["","0",ve]},W=function(){return["auto","avoid","all","avoid-page","page","left","right","column"]},F=function(){return[vn,Ai]},G=function(){return[vn,ve]};return{cacheSize:500,theme:{colors:[Ir],spacing:[mt],blur:["none","",Kt,ve],brightness:F(),borderColor:[e],borderRadius:["none","","full",Kt,ve],borderSpacing:N(),borderWidth:V(),contrast:F(),grayscale:R(),hueRotate:G(),invert:R(),gap:N(),gradientColorStops:[e],gradientColorStopPositions:[Wg,$o],inset:U(),margin:U(),opacity:F(),padding:N(),saturate:F(),scale:F(),sepia:R(),skew:G(),space:N(),translate:N()},classGroups:{aspect:[{aspect:["auto","square","video",ve]}],container:["container"],columns:[{columns:[Kt]}],"break-after":[{"break-after":W()}],"break-before":[{"break-before":W()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none"]}],clear:[{clear:["left","right","both","none"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[].concat(z(),[ve])}],overflow:[{overflow:I()}],"overflow-x":[{"overflow-x":I()}],"overflow-y":[{"overflow-y":I()}],overscroll:[{overscroll:L()}],"overscroll-x":[{"overscroll-x":L()}],"overscroll-y":[{"overscroll-y":L()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[h]}],"inset-x":[{"inset-x":[h]}],"inset-y":[{"inset-y":[h]}],start:[{start:[h]}],end:[{end:[h]}],top:[{top:[h]}],right:[{right:[h]}],bottom:[{bottom:[h]}],left:[{left:[h]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Mr]}],basis:[{basis:U()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ve]}],grow:[{grow:R()}],shrink:[{shrink:R()}],order:[{order:["first","last","none",Mr]}],"grid-cols":[{"grid-cols":[Ir]}],"col-start-end":[{col:["auto",{span:["full",Mr]},ve]}],"col-start":[{"col-start":M()}],"col-end":[{"col-end":M()}],"grid-rows":[{"grid-rows":[Ir]}],"row-start-end":[{row:["auto",{span:[Mr]},ve]}],"row-start":[{"row-start":M()}],"row-end":[{"row-end":M()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ve]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ve]}],gap:[{gap:[m]}],"gap-x":[{"gap-x":[m]}],"gap-y":[{"gap-y":[m]}],"justify-content":[{justify:["normal"].concat(D())}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal"].concat(D(),["baseline"])}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[].concat(D(),["baseline"])}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[v]}],px:[{px:[v]}],py:[{py:[v]}],ps:[{ps:[v]}],pe:[{pe:[v]}],pt:[{pt:[v]}],pr:[{pr:[v]}],pb:[{pb:[v]}],pl:[{pl:[v]}],m:[{m:[g]}],mx:[{mx:[g]}],my:[{my:[g]}],ms:[{ms:[g]}],me:[{me:[g]}],mt:[{mt:[g]}],mr:[{mr:[g]}],mb:[{mb:[g]}],ml:[{ml:[g]}],"space-x":[{"space-x":[O]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[O]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit",ve,t]}],"min-w":[{"min-w":["min","max","fit",ve,mt]}],"max-w":[{"max-w":["0","none","full","min","max","fit","prose",{screen:[Kt]},Kt,ve]}],h:[{h:[ve,t,"auto","min","max","fit"]}],"min-h":[{"min-h":["min","max","fit",ve,mt]}],"max-h":[{"max-h":[ve,t,"min","max","fit"]}],"font-size":[{text:["base",Kt,$o]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Ai]}],"font-family":[{font:[Ir]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",ve]}],"line-clamp":[{"line-clamp":["none",vn,Ai]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",ve,mt]}],"list-image":[{"list-image":["none",ve]}],"list-style-type":[{list:["none","disc","decimal",ve]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[y]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[y]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[].concat(k(),["wavy"])}],"text-decoration-thickness":[{decoration:["auto","from-font",mt]}],"underline-offset":[{"underline-offset":["auto",ve,mt]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],indent:[{indent:N()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ve]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ve]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[y]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[].concat(z(),[Ug])}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Fg]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Bg]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[b]}],"gradient-via-pos":[{via:[b]}],"gradient-to-pos":[{to:[b]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[y]}],"border-style":[{border:[].concat(k(),["hidden"])}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[y]}],"divide-style":[{divide:k()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:[""].concat(k())}],"outline-offset":[{"outline-offset":[ve,mt]}],"outline-w":[{outline:[mt]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:V()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[y]}],"ring-offset-w":[{"ring-offset":[mt]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Kt,$g]}],"shadow-color":[{shadow:[Ir]}],opacity:[{opacity:[y]}],"mix-blend":[{"mix-blend":j()}],"bg-blend":[{"bg-blend":j()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Kt,ve]}],grayscale:[{grayscale:[d]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[f]}],saturate:[{saturate:[_]}],sepia:[{sepia:[T]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[d]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[y]}],"backdrop-saturate":[{"backdrop-saturate":[_]}],"backdrop-sepia":[{"backdrop-sepia":[T]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",ve]}],duration:[{duration:G()}],ease:[{ease:["linear","in","out","in-out",ve]}],delay:[{delay:G()}],animate:[{animate:["none","spin","ping","pulse","bounce",ve]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[x]}],"scale-x":[{"scale-x":[x]}],"scale-y":[{"scale-y":[x]}],rotate:[{rotate:[Mr,ve]}],"translate-x":[{"translate-x":[P]}],"translate-y":[{"translate-y":[P]}],"skew-x":[{"skew-x":[C]}],"skew-y":[{"skew-y":[C]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ve]}],accent:[{accent:["auto",e]}],appearance:["appearance-none"],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ve]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":N()}],"scroll-mx":[{"scroll-mx":N()}],"scroll-my":[{"scroll-my":N()}],"scroll-ms":[{"scroll-ms":N()}],"scroll-me":[{"scroll-me":N()}],"scroll-mt":[{"scroll-mt":N()}],"scroll-mr":[{"scroll-mr":N()}],"scroll-mb":[{"scroll-mb":N()}],"scroll-ml":[{"scroll-ml":N()}],"scroll-p":[{"scroll-p":N()}],"scroll-px":[{"scroll-px":N()}],"scroll-py":[{"scroll-py":N()}],"scroll-ps":[{"scroll-ps":N()}],"scroll-pe":[{"scroll-pe":N()}],"scroll-pt":[{"scroll-pt":N()}],"scroll-pr":[{"scroll-pr":N()}],"scroll-pb":[{"scroll-pb":N()}],"scroll-pl":[{"scroll-pl":N()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","pinch-zoom","manipulation",{pan:["x","left","right","y","up","down"]}]}],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ve]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[mt,Ai]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}}var Gg=Rg(Kg);function Ae(...e){return Gg(Ru(e))}const qg=({className:e=""})=>c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-loader-circle s absolute animate-spin",children:c.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56",className:e})}),pl=Ba("inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:opacity-60",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input dark:border-[#FFFFFF1A] hover:opacity-60 dark:bg-[#202020] dark:text-white shadow-sm hover:bg-primary-1 ",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",cobalt:"text-cobalt-600 bg-cobalt-100 border border-cobalt-600 font-semibold hover:bg-cobalt-50 hover:text-cobalt-300",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),lt=w.forwardRef(({children:e,className:t,variant:n,size:r,loading:i,asChild:s=!1,disabled:o,loaderClassName:a="",loaderParentClassName:l="",...d},u)=>{const f=s?cg:"button";return s?c.jsx(f,{className:Ae(pl({variant:n,size:r,className:t}),o&&"cursor-default","relative"),ref:u,...d,children:e}):c.jsxs(f,{className:Ae(pl({variant:n,size:r,className:t}),o&&"cursor-default","relative"),ref:u,disabled:i||o,...d,children:[i&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"absolute left-0 z-10 h-full w-full rounded-md bg-white"}),c.jsx("span",{className:Ae("absolute left-0 z-20 flex h-full w-full items-center justify-center rounded-md bg-inherit text-orange-300",l),children:c.jsx(qg,{className:a})})]}),e]})});lt.displayName="Button";function he(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e==null||e(i),n===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}function $n(e,t=[]){let n=[];function r(s,o){const a=w.createContext(o);a.displayName=s+"Context";const l=n.length;n=[...n,o];const d=f=>{var y;const{scope:m,children:p,...b}=f,h=((y=m==null?void 0:m[e])==null?void 0:y[l])||a,g=w.useMemo(()=>b,Object.values(b));return c.jsx(h.Provider,{value:g,children:p})};d.displayName=s+"Provider";function u(f,m){var h;const p=((h=m==null?void 0:m[e])==null?void 0:h[l])||a,b=w.useContext(p);if(b)return b;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${s}\``)}return[d,u]}const i=()=>{const s=n.map(o=>w.createContext(o));return function(a){const l=(a==null?void 0:a[e])||s;return w.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return i.scopeName=e,[r,Qg(i,...t)]}function Qg(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=r.reduce((a,{useScope:l,scopeName:d})=>{const f=l(s)[`__scope${d}`];return{...a,...f}},{});return w.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}var Ie=globalThis!=null&&globalThis.document?w.useLayoutEffect:()=>{},Yg=w[" useId ".trim().toString()]||(()=>{}),Zg=0;function an(e){const[t,n]=w.useState(Yg());return Ie(()=>{n(r=>r??String(Zg++))},[e]),e||(t?`radix-${t}`:"")}var Xg=w[" useInsertionEffect ".trim().toString()]||Ie;function jn({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[i,s,o]=Jg({defaultProp:t,onChange:n}),a=e!==void 0,l=a?e:i;{const u=w.useRef(e!==void 0);w.useEffect(()=>{const f=u.current;f!==a&&console.warn(`${r} is changing from ${f?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=a},[a,r])}const d=w.useCallback(u=>{var f;if(a){const m=ey(u)?u(e):u;m!==e&&((f=o.current)==null||f.call(o,m))}else s(u)},[a,e,s,o]);return[l,d]}function Jg({defaultProp:e,onChange:t}){const[n,r]=w.useState(e),i=w.useRef(n),s=w.useRef(t);return Xg(()=>{s.current=t},[t]),w.useEffect(()=>{var o;i.current!==n&&((o=s.current)==null||o.call(s,n),i.current=n)},[n,i]),[n,r,s]}function ey(e){return typeof e=="function"}var ty=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ge=ty.reduce((e,t)=>{const n=gr(`Primitive.${t}`),r=w.forwardRef((i,s)=>{const{asChild:o,...a}=i,l=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(l,{...a,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Uu(e,t){e&&Er.flushSync(()=>e.dispatchEvent(t))}function yt(e){const t=w.useRef(e);return w.useEffect(()=>{t.current=e}),w.useMemo(()=>((...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)}),[])}function ny(e,t=globalThis==null?void 0:globalThis.document){const n=yt(e);w.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var ry="DismissableLayer",Vo="dismissableLayer.update",iy="dismissableLayer.pointerDownOutside",sy="dismissableLayer.focusOutside",ml,$a=w.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Rs=w.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:a,onDismiss:l,...d}=e,u=w.useContext($a),[f,m]=w.useState(null),p=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,b]=w.useState({}),h=Ne(t,L=>m(L)),g=Array.from(u.layers),[y]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=g.indexOf(y),_=f?g.indexOf(f):-1,x=u.layersWithOutsidePointerEventsDisabled.size>0,T=_>=v,C=w.useRef(!1),O=cy(L=>{const I=L.target;if(!(I instanceof Node))return;const U=[...u.branches].some(N=>N.contains(I));!T||U||(s==null||s(L),a==null||a(L),L.defaultPrevented||l==null||l())},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:C,dismissableSurfaces:u.dismissableSurfaces}),P=ly(L=>{if(r&&C.current)return;const I=L.target;[...u.branches].some(N=>N.contains(I))||(o==null||o(L),a==null||a(L),L.defaultPrevented||l==null||l())},p);return ny(L=>{_===u.layers.size-1&&(i==null||i(L),!L.defaultPrevented&&l&&(L.preventDefault(),l()))},p),w.useEffect(()=>{if(f)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(ml=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),hl(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(f),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=ml))}},[f,p,n,u]),w.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),hl())},[f,u]),w.useEffect(()=>{const L=()=>b({});return document.addEventListener(Vo,L),()=>document.removeEventListener(Vo,L)},[]),c.jsx(ge.div,{...d,ref:h,style:{pointerEvents:x?T?"auto":"none":void 0,...e.style},onFocusCapture:he(e.onFocusCapture,P.onFocusCapture),onBlurCapture:he(e.onBlurCapture,P.onBlurCapture),onPointerDownCapture:he(e.onPointerDownCapture,O.onPointerDownCapture)})});Rs.displayName=ry;var oy="DismissableLayerBranch",Bu=w.forwardRef((e,t)=>{const n=w.useContext($a),r=w.useRef(null),i=Ne(t,r);return w.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),c.jsx(ge.div,{...e,ref:i})});Bu.displayName=oy;function ay(){const e=w.useContext($a),[t,n]=w.useState(null);return w.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}function cy(e,t){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:s}=t,o=yt(e),a=w.useRef(!1),l=w.useRef(!1),d=w.useRef(new Map),u=w.useRef(()=>{});return w.useEffect(()=>{function f(){l.current=!1,i.current=!1,d.current.clear()}function m(){return Array.from(d.current.values()).some(Boolean)}function p(v){if(!l.current)return;const _=v.target;_ instanceof Node&&[...s].some(T=>T.contains(_))||d.current.set(v.type,!0),v.type==="click"&&window.setTimeout(()=>{l.current&&u.current()},0)}function b(v){l.current&&d.current.set(v.type,!1)}const h=v=>{if(v.target&&!a.current){let _=function(){n.removeEventListener("click",u.current);const T=m();f(),T||Wu(iy,o,x,{discrete:!0})};const x={originalEvent:v};l.current=!0,i.current=r&&v.button===0,d.current.clear(),!r||v.button!==0?_():(n.removeEventListener("click",u.current),u.current=_,n.addEventListener("click",u.current,{once:!0}))}else n.removeEventListener("click",u.current),f();a.current=!1},g=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const v of g)n.addEventListener(v,p,!0),n.addEventListener(v,b);const y=window.setTimeout(()=>{n.addEventListener("pointerdown",h)},0);return()=>{window.clearTimeout(y),n.removeEventListener("pointerdown",h),n.removeEventListener("click",u.current);for(const v of g)n.removeEventListener(v,p,!0),n.removeEventListener(v,b)}},[n,o,r,i,s]),{onPointerDownCapture:()=>a.current=!0}}function ly(e,t=globalThis==null?void 0:globalThis.document){const n=yt(e),r=w.useRef(!1);return w.useEffect(()=>{const i=s=>{s.target&&!r.current&&Wu(sy,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function hl(){const e=new CustomEvent(Vo);document.dispatchEvent(e)}function Wu(e,t,n,{discrete:r}){const i=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?Uu(i,s):i.dispatchEvent(s)}var dy=Rs,uy=Bu,fo="focusScope.autoFocusOnMount",po="focusScope.autoFocusOnUnmount",gl={bubbles:!1,cancelable:!0},fy="FocusScope",Va=w.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=e,[a,l]=w.useState(null),d=yt(i),u=yt(s),f=w.useRef(null),m=Ne(t,h=>l(h)),p=w.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;w.useEffect(()=>{if(r){let h=function(_){if(p.paused||!a)return;const x=_.target;a.contains(x)?f.current=x:Gt(f.current,{select:!0})},g=function(_){if(p.paused||!a)return;const x=_.relatedTarget;x!==null&&(a.contains(x)||Gt(f.current,{select:!0}))},y=function(_){if(document.activeElement===document.body)for(const T of _)T.removedNodes.length>0&&Gt(a)};document.addEventListener("focusin",h),document.addEventListener("focusout",g);const v=new MutationObserver(y);return a&&v.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",h),document.removeEventListener("focusout",g),v.disconnect()}}},[r,a,p.paused]),w.useEffect(()=>{if(a){bl.add(p);const h=document.activeElement;if(!a.contains(h)){const y=new CustomEvent(fo,gl);a.addEventListener(fo,d),a.dispatchEvent(y),y.defaultPrevented||(py(by($u(a)),{select:!0}),document.activeElement===h&&Gt(a))}return()=>{a.removeEventListener(fo,d),setTimeout(()=>{const y=new CustomEvent(po,gl);a.addEventListener(po,u),a.dispatchEvent(y),y.defaultPrevented||Gt(h??document.body,{select:!0}),a.removeEventListener(po,u),bl.remove(p)},0)}}},[a,d,u,p]);const b=w.useCallback(h=>{if(!n&&!r||p.paused)return;const g=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,y=document.activeElement;if(g&&y){const v=h.currentTarget,[_,x]=my(v);_&&x?!h.shiftKey&&y===x?(h.preventDefault(),n&&Gt(_,{select:!0})):h.shiftKey&&y===_&&(h.preventDefault(),n&&Gt(x,{select:!0})):y===v&&h.preventDefault()}},[n,r,p.paused]);return c.jsx(ge.div,{tabIndex:-1,...o,ref:m,onKeyDown:b})});Va.displayName=fy;function py(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Gt(r,{select:t}),document.activeElement!==n)return}function my(e){const t=$u(e),n=yl(t,e),r=yl(t.reverse(),e);return[n,r]}function $u(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function yl(e,t){for(const n of e)if(!hy(n,{upTo:t}))return n}function hy(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function gy(e){return e instanceof HTMLInputElement&&"select"in e}function Gt(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&gy(e)&&t&&e.select()}}var bl=yy();function yy(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=vl(e,t),e.unshift(t)},remove(t){var n;e=vl(e,t),(n=e[0])==null||n.resume()}}}function vl(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function by(e){return e.filter(t=>t.tagName!=="A")}var vy="Portal",Ls=w.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[i,s]=w.useState(!1);Ie(()=>s(!0),[]);const o=n||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?Er.createPortal(c.jsx(ge.div,{...r,ref:t}),o):null});Ls.displayName=vy;function wy(e,t){return w.useReducer((n,r)=>t[n][r]??n,e)}var Vn=e=>{const{present:t,children:n}=e,r=xy(t),i=typeof n=="function"?n({present:r.isPresent}):w.Children.only(n),s=_y(r.ref,Sy(i));return typeof n=="function"||r.isPresent?w.cloneElement(i,{ref:s}):null};Vn.displayName="Presence";function xy(e){const[t,n]=w.useState(),r=w.useRef(null),i=w.useRef(e),s=w.useRef("none"),o=e?"mounted":"unmounted",[a,l]=wy(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{const d=Oi(r.current);s.current=a==="mounted"?d:"none"},[a]),Ie(()=>{const d=r.current,u=i.current;if(u!==e){const m=s.current,p=Oi(d);e?l("MOUNT"):p==="none"||(d==null?void 0:d.display)==="none"?l("UNMOUNT"):l(u&&m!==p?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,l]),Ie(()=>{if(t){let d;const u=t.ownerDocument.defaultView??window,f=p=>{const h=Oi(r.current).includes(CSS.escape(p.animationName));if(p.target===t&&h&&(l("ANIMATION_END"),!i.current)){const g=t.style.animationFillMode;t.style.animationFillMode="forwards",d=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=g)})}},m=p=>{p.target===t&&(s.current=Oi(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{u.clearTimeout(d),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:w.useCallback(d=>{r.current=d?getComputedStyle(d):null,n(d)},[])}}function wl(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function _y(...e){const t=w.useRef(e);return t.current=e,w.useCallback(n=>{const r=t.current;let i=!1;const s=r.map(o=>{const a=wl(o,n);return!i&&typeof a=="function"&&(i=!0),a});if(i)return()=>{for(let o=0;o<s.length;o++){const a=s[o];typeof a=="function"?a():wl(r[o],null)}}},[])}function Oi(e){return(e==null?void 0:e.animationName)||"none"}function Sy(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Ni=0,Tt=null;function Vu(){w.useEffect(()=>{Tt||(Tt={start:xl(),end:xl()});const{start:e,end:t}=Tt;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),Ni++,()=>{Ni===1&&(Tt==null||Tt.start.remove(),Tt==null||Tt.end.remove(),Tt=null),Ni=Math.max(0,Ni-1)}},[])}function xl(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var At=function(){return At=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},At.apply(this,arguments)};function Hu(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Ty(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,s;r<i;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}var qi="right-scroll-bar-position",Qi="width-before-scroll-bar",Cy="with-scroll-bars-hidden",Py="--removed-body-scroll-bar-size";function mo(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Ey(e,t){var n=S.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var i=n.value;i!==r&&(n.value=r,n.callback(r,i))}}}})[0];return n.callback=t,n.facade}var ky=typeof window<"u"?w.useLayoutEffect:w.useEffect,_l=new WeakMap;function Ay(e,t){var n=Ey(null,function(r){return e.forEach(function(i){return mo(i,r)})});return ky(function(){var r=_l.get(n);if(r){var i=new Set(r),s=new Set(e),o=n.current;i.forEach(function(a){s.has(a)||mo(a,null)}),s.forEach(function(a){i.has(a)||mo(a,o)})}_l.set(n,e)},[e]),n}function Oy(e){return e}function Ny(e,t){t===void 0&&(t=Oy);var n=[],r=!1,i={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(s){var o=t(s,r);return n.push(o),function(){n=n.filter(function(a){return a!==o})}},assignSyncMedium:function(s){for(r=!0;n.length;){var o=n;n=[],o.forEach(s)}n={push:function(a){return s(a)},filter:function(){return n}}},assignMedium:function(s){r=!0;var o=[];if(n.length){var a=n;n=[],a.forEach(s),o=n}var l=function(){var u=o;o=[],u.forEach(s)},d=function(){return Promise.resolve().then(l)};d(),n={push:function(u){o.push(u),d()},filter:function(u){return o=o.filter(u),n}}}};return i}function Ry(e){e===void 0&&(e={});var t=Ny(null);return t.options=At({async:!0,ssr:!1},e),t}var zu=function(e){var t=e.sideCar,n=Hu(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return w.createElement(r,At({},n))};zu.isSideCarExport=!0;function Ly(e,t){return e.useMedium(t),zu}var Ku=Ry(),ho=function(){},Ds=w.forwardRef(function(e,t){var n=w.useRef(null),r=w.useState({onScrollCapture:ho,onWheelCapture:ho,onTouchMoveCapture:ho}),i=r[0],s=r[1],o=e.forwardProps,a=e.children,l=e.className,d=e.removeScrollBar,u=e.enabled,f=e.shards,m=e.sideCar,p=e.noRelative,b=e.noIsolation,h=e.inert,g=e.allowPinchZoom,y=e.as,v=y===void 0?"div":y,_=e.gapMode,x=Hu(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),T=m,C=Ay([n,t]),O=At(At({},x),i);return w.createElement(w.Fragment,null,u&&w.createElement(T,{sideCar:Ku,removeScrollBar:d,shards:f,noRelative:p,noIsolation:b,inert:h,setCallbacks:s,allowPinchZoom:!!g,lockRef:n,gapMode:_}),o?w.cloneElement(w.Children.only(a),At(At({},O),{ref:C})):w.createElement(v,At({},O,{className:l,ref:C}),a))});Ds.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Ds.classNames={fullWidth:Qi,zeroRight:qi};var Dy=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function jy(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Dy();return t&&e.setAttribute("nonce",t),e}function My(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Iy(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Fy=function(){var e=0,t=null;return{add:function(n){e==0&&(t=jy())&&(My(t,n),Iy(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Uy=function(){var e=Fy();return function(t,n){w.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Gu=function(){var e=Uy(),t=function(n){var r=n.styles,i=n.dynamic;return e(r,i),null};return t},By={left:0,top:0,right:0,gap:0},go=function(e){return parseInt(e||"",10)||0},Wy=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[go(n),go(r),go(i)]},$y=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return By;var t=Wy(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Vy=Gu(),tr="data-scroll-locked",Hy=function(e,t,n,r){var i=e.left,s=e.top,o=e.right,a=e.gap;return n===void 0&&(n="margin"),`
|
|
2
|
-
.`.concat(Cy,` {
|
|
3
|
-
overflow: hidden `).concat(r,`;
|
|
4
|
-
padding-right: `).concat(a,"px ").concat(r,`;
|
|
5
|
-
}
|
|
6
|
-
body[`).concat(tr,`] {
|
|
7
|
-
overflow: hidden `).concat(r,`;
|
|
8
|
-
overscroll-behavior: contain;
|
|
9
|
-
`).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
|
|
10
|
-
padding-left: `.concat(i,`px;
|
|
11
|
-
padding-top: `).concat(s,`px;
|
|
12
|
-
padding-right: `).concat(o,`px;
|
|
13
|
-
margin-left:0;
|
|
14
|
-
margin-top:0;
|
|
15
|
-
margin-right: `).concat(a,"px ").concat(r,`;
|
|
16
|
-
`),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),`
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.`).concat(qi,` {
|
|
20
|
-
right: `).concat(a,"px ").concat(r,`;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.`).concat(Qi,` {
|
|
24
|
-
margin-right: `).concat(a,"px ").concat(r,`;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.`).concat(qi," .").concat(qi,` {
|
|
28
|
-
right: 0 `).concat(r,`;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.`).concat(Qi," .").concat(Qi,` {
|
|
32
|
-
margin-right: 0 `).concat(r,`;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
body[`).concat(tr,`] {
|
|
36
|
-
`).concat(Py,": ").concat(a,`px;
|
|
37
|
-
}
|
|
38
|
-
`)},Sl=function(){var e=parseInt(document.body.getAttribute(tr)||"0",10);return isFinite(e)?e:0},zy=function(){w.useEffect(function(){return document.body.setAttribute(tr,(Sl()+1).toString()),function(){var e=Sl()-1;e<=0?document.body.removeAttribute(tr):document.body.setAttribute(tr,e.toString())}},[])},Ky=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?"margin":r;zy();var s=w.useMemo(function(){return $y(i)},[i]);return w.createElement(Vy,{styles:Hy(s,!t,i,n?"":"!important")})},Ho=!1;if(typeof window<"u")try{var Ri=Object.defineProperty({},"passive",{get:function(){return Ho=!0,!0}});window.addEventListener("test",Ri,Ri),window.removeEventListener("test",Ri,Ri)}catch{Ho=!1}var zn=Ho?{passive:!1}:!1,Gy=function(e){return e.tagName==="TEXTAREA"},qu=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Gy(e)&&n[t]==="visible")},qy=function(e){return qu(e,"overflowY")},Qy=function(e){return qu(e,"overflowX")},Tl=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=Qu(e,r);if(i){var s=Yu(e,r),o=s[1],a=s[2];if(o>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Yy=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},Zy=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Qu=function(e,t){return e==="v"?qy(t):Qy(t)},Yu=function(e,t){return e==="v"?Yy(t):Zy(t)},Xy=function(e,t){return e==="h"&&t==="rtl"?-1:1},Jy=function(e,t,n,r,i){var s=Xy(e,window.getComputedStyle(t).direction),o=s*r,a=n.target,l=t.contains(a),d=!1,u=o>0,f=0,m=0;do{if(!a)break;var p=Yu(e,a),b=p[0],h=p[1],g=p[2],y=h-g-s*b;(b||y)&&Qu(e,a)&&(f+=y,m+=b);var v=a.parentNode;a=v&&v.nodeType===Node.DOCUMENT_FRAGMENT_NODE?v.host:v}while(!l&&a!==document.body||l&&(t.contains(a)||t===a));return(u&&Math.abs(f)<1||!u&&Math.abs(m)<1)&&(d=!0),d},Li=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Cl=function(e){return[e.deltaX,e.deltaY]},Pl=function(e){return e&&"current"in e?e.current:e},eb=function(e,t){return e[0]===t[0]&&e[1]===t[1]},tb=function(e){return`
|
|
39
|
-
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
40
|
-
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
41
|
-
`)},nb=0,Kn=[];function rb(e){var t=w.useRef([]),n=w.useRef([0,0]),r=w.useRef(),i=w.useState(nb++)[0],s=w.useState(Gu)[0],o=w.useRef(e);w.useEffect(function(){o.current=e},[e]),w.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var h=Ty([e.lockRef.current],(e.shards||[]).map(Pl),!0).filter(Boolean);return h.forEach(function(g){return g.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),h.forEach(function(g){return g.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var a=w.useCallback(function(h,g){if("touches"in h&&h.touches.length===2||h.type==="wheel"&&h.ctrlKey)return!o.current.allowPinchZoom;var y=Li(h),v=n.current,_="deltaX"in h?h.deltaX:v[0]-y[0],x="deltaY"in h?h.deltaY:v[1]-y[1],T,C=h.target,O=Math.abs(_)>Math.abs(x)?"h":"v";if("touches"in h&&O==="h"&&C.type==="range")return!1;var P=window.getSelection(),L=P&&P.anchorNode,I=L?L===C||L.contains(C):!1;if(I)return!1;var U=Tl(O,C);if(!U)return!0;if(U?T=O:(T=O==="v"?"h":"v",U=Tl(O,C)),!U)return!1;if(!r.current&&"changedTouches"in h&&(_||x)&&(r.current=T),!T)return!0;var N=r.current||T;return Jy(N,g,h,N==="h"?_:x)},[]),l=w.useCallback(function(h){var g=h;if(!(!Kn.length||Kn[Kn.length-1]!==s)){var y="deltaY"in g?Cl(g):Li(g),v=t.current.filter(function(T){return T.name===g.type&&(T.target===g.target||g.target===T.shadowParent)&&eb(T.delta,y)})[0];if(v&&v.should){g.cancelable&&g.preventDefault();return}if(!v){var _=(o.current.shards||[]).map(Pl).filter(Boolean).filter(function(T){return T.contains(g.target)}),x=_.length>0?a(g,_[0]):!o.current.noIsolation;x&&g.cancelable&&g.preventDefault()}}},[]),d=w.useCallback(function(h,g,y,v){var _={name:h,delta:g,target:y,should:v,shadowParent:ib(y)};t.current.push(_),setTimeout(function(){t.current=t.current.filter(function(x){return x!==_})},1)},[]),u=w.useCallback(function(h){n.current=Li(h),r.current=void 0},[]),f=w.useCallback(function(h){d(h.type,Cl(h),h.target,a(h,e.lockRef.current))},[]),m=w.useCallback(function(h){d(h.type,Li(h),h.target,a(h,e.lockRef.current))},[]);w.useEffect(function(){return Kn.push(s),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:m}),document.addEventListener("wheel",l,zn),document.addEventListener("touchmove",l,zn),document.addEventListener("touchstart",u,zn),function(){Kn=Kn.filter(function(h){return h!==s}),document.removeEventListener("wheel",l,zn),document.removeEventListener("touchmove",l,zn),document.removeEventListener("touchstart",u,zn)}},[]);var p=e.removeScrollBar,b=e.inert;return w.createElement(w.Fragment,null,b?w.createElement(s,{styles:tb(i)}):null,p?w.createElement(Ky,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function ib(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const sb=Ly(Ku,rb);var Ha=w.forwardRef(function(e,t){return w.createElement(Ds,At({},e,{ref:t,sideCar:sb}))});Ha.classNames=Ds.classNames;var ob=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Gn=new WeakMap,Di=new WeakMap,ji={},yo=0,Zu=function(e){return e&&(e.host||Zu(e.parentNode))},ab=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Zu(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},cb=function(e,t,n,r){var i=ab(t,Array.isArray(e)?e:[e]);ji[n]||(ji[n]=new WeakMap);var s=ji[n],o=[],a=new Set,l=new Set(i),d=function(f){!f||a.has(f)||(a.add(f),d(f.parentNode))};i.forEach(d);var u=function(f){!f||l.has(f)||Array.prototype.forEach.call(f.children,function(m){if(a.has(m))u(m);else try{var p=m.getAttribute(r),b=p!==null&&p!=="false",h=(Gn.get(m)||0)+1,g=(s.get(m)||0)+1;Gn.set(m,h),s.set(m,g),o.push(m),h===1&&b&&Di.set(m,!0),g===1&&m.setAttribute(n,"true"),b||m.setAttribute(r,"true")}catch(y){console.error("aria-hidden: cannot operate on ",m,y)}})};return u(t),a.clear(),yo++,function(){o.forEach(function(f){var m=Gn.get(f)-1,p=s.get(f)-1;Gn.set(f,m),s.set(f,p),m||(Di.has(f)||f.removeAttribute(r),Di.delete(f)),p||f.removeAttribute(n)}),yo--,yo||(Gn=new WeakMap,Gn=new WeakMap,Di=new WeakMap,ji={})}},Xu=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),i=ob(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),cb(r,i,n,"aria-hidden")):function(){return null}},js="Dialog",[Ju]=$n(js),[lb,wt]=Ju(js),ef=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:o=!0}=e,a=w.useRef(null),l=w.useRef(null),[d,u]=jn({prop:r,defaultProp:i??!1,onChange:s,caller:js});return c.jsx(lb,{scope:t,triggerRef:a,contentRef:l,contentId:an(),titleId:an(),descriptionId:an(),open:d,onOpenChange:u,onOpenToggle:w.useCallback(()=>u(f=>!f),[u]),modal:o,children:n})};ef.displayName=js;var tf="DialogTrigger",db=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=wt(tf,n),s=Ne(t,i.triggerRef);return c.jsx(ge.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":Ya(i.open),...r,ref:s,onClick:he(e.onClick,i.onOpenToggle)})});db.displayName=tf;var za="DialogPortal",[ub,nf]=Ju(za,{forceMount:void 0}),rf=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:i}=e,s=wt(za,t);return c.jsx(ub,{scope:t,forceMount:n,children:w.Children.map(r,o=>c.jsx(Vn,{present:n||s.open,children:c.jsx(Ls,{asChild:!0,container:i,children:o})}))})};rf.displayName=za;var os="DialogOverlay",Ka=w.forwardRef((e,t)=>{const n=nf(os,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,s=wt(os,e.__scopeDialog);return s.modal?c.jsx(Vn,{present:r||s.open,children:c.jsx(pb,{...i,ref:t})}):null});Ka.displayName=os;var fb=gr("DialogOverlay.RemoveScroll"),pb=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=wt(os,n),s=ay(),o=Ne(t,s);return c.jsx(Ha,{as:fb,allowPinchZoom:!0,shards:[i.contentRef],children:c.jsx(ge.div,{"data-state":Ya(i.open),...r,ref:o,style:{pointerEvents:"auto",...r.style}})})}),yr="DialogContent",Ga=w.forwardRef((e,t)=>{const n=nf(yr,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,s=wt(yr,e.__scopeDialog);return c.jsx(Vn,{present:r||s.open,children:s.modal?c.jsx(mb,{...i,ref:t}):c.jsx(hb,{...i,ref:t})})});Ga.displayName=yr;var mb=w.forwardRef((e,t)=>{const n=wt(yr,e.__scopeDialog),r=w.useRef(null),i=Ne(t,n.contentRef,r);return w.useEffect(()=>{const s=r.current;if(s)return Xu(s)},[]),c.jsx(sf,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:he(e.onCloseAutoFocus,s=>{var o;s.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:he(e.onPointerDownOutside,s=>{const o=s.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&s.preventDefault()}),onFocusOutside:he(e.onFocusOutside,s=>s.preventDefault())})}),hb=w.forwardRef((e,t)=>{const n=wt(yr,e.__scopeDialog),r=w.useRef(!1),i=w.useRef(!1);return c.jsx(sf,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var o,a;(o=e.onCloseAutoFocus)==null||o.call(e,s),s.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),s.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:s=>{var l,d;(l=e.onInteractOutside)==null||l.call(e,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=s.target;((d=n.triggerRef.current)==null?void 0:d.contains(o))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),sf=w.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,...o}=e,a=wt(yr,n);return Vu(),c.jsx(c.Fragment,{children:c.jsx(Va,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:c.jsx(Rs,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":Ya(a.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>a.onOpenChange(!1)})})})}),of="DialogTitle",qa=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=wt(of,n);return c.jsx(ge.h2,{id:i.titleId,...r,ref:t})});qa.displayName=of;var af="DialogDescription",Qa=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=wt(af,n);return c.jsx(ge.p,{id:i.descriptionId,...r,ref:t})});Qa.displayName=af;var cf="DialogClose",gb=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=wt(cf,n);return c.jsx(ge.button,{type:"button",...r,ref:t,onClick:he(e.onClick,()=>i.onOpenChange(!1))})});gb.displayName=cf;function Ya(e){return e?"open":"closed"}const yb=ef,bb=rf,lf=w.forwardRef(({className:e,...t},n)=>c.jsx(Ka,{ref:n,className:Ae("bg-background/80 fixed inset-0 z-50 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));lf.displayName=Ka.displayName;const df=w.forwardRef(({className:e,overlayClass:t,children:n,...r},i)=>c.jsxs(bb,{children:[c.jsx(lf,{className:t}),c.jsx(Ga,{ref:i,className:Ae("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-2xl md:w-full",e),...r,children:n})]}));df.displayName=Ga.displayName;const uf=({className:e,...t})=>c.jsx("div",{className:Ae("flex flex-col space-y-1.5 border-b text-center sm:text-left",e),...t});uf.displayName="DialogHeader";const ff=({className:e,...t})=>c.jsx("div",{className:Ae("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});ff.displayName="DialogFooter";const pf=w.forwardRef(({className:e,...t},n)=>c.jsx(qa,{ref:n,className:Ae("text-lg font-semibold leading-none tracking-tight",e),...t}));pf.displayName=qa.displayName;const mf=w.forwardRef(({className:e,...t},n)=>c.jsx(Qa,{ref:n,className:Ae("text-sm text-muted-foreground",e),...t}));mf.displayName=Qa.displayName;function El(e,[t,n]){return Math.min(n,Math.max(t,e))}function Za(e){const t=e+"CollectionProvider",[n,r]=$n(t),[i,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=h=>{const{scope:g,children:y}=h,v=w.useRef(null),_=w.useRef(new Map).current;return c.jsx(i,{scope:g,itemMap:_,collectionRef:v,children:y})};o.displayName=t;const a=e+"CollectionSlot",l=gr(a),d=w.forwardRef((h,g)=>{const{scope:y,children:v}=h,_=s(a,y),x=Ne(g,_.collectionRef);return c.jsx(l,{ref:x,children:v})});d.displayName=a;const u=e+"CollectionItemSlot",f="data-radix-collection-item",m=gr(u),p=w.forwardRef((h,g)=>{const{scope:y,children:v,..._}=h,x=w.useRef(null),T=Ne(g,x),C=s(u,y);return w.useEffect(()=>(C.itemMap.set(x,{ref:x,..._}),()=>void C.itemMap.delete(x))),c.jsx(m,{[f]:"",ref:T,children:v})});p.displayName=u;function b(h){const g=s(e+"CollectionConsumer",h);return w.useCallback(()=>{const v=g.collectionRef.current;if(!v)return[];const _=Array.from(v.querySelectorAll(`[${f}]`));return Array.from(g.itemMap.values()).sort((C,O)=>_.indexOf(C.ref.current)-_.indexOf(O.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:o,Slot:d,ItemSlot:p},b,r]}var vb=w.createContext(void 0);function hf(e){const t=w.useContext(vb);return e||t||"ltr"}const wb=["top","right","bottom","left"],dn=Math.min,rt=Math.max,as=Math.round,Mi=Math.floor,Nt=e=>({x:e,y:e}),xb={left:"right",right:"left",bottom:"top",top:"bottom"};function zo(e,t,n){return rt(e,dn(t,n))}function Ft(e,t){return typeof e=="function"?e(t):e}function Ut(e){return e.split("-")[0]}function kr(e){return e.split("-")[1]}function Xa(e){return e==="x"?"y":"x"}function Ja(e){return e==="y"?"height":"width"}function Ot(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function ec(e){return Xa(Ot(e))}function _b(e,t,n){n===void 0&&(n=!1);const r=kr(e),i=ec(e),s=Ja(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=cs(o)),[o,cs(o)]}function Sb(e){const t=cs(e);return[Ko(e),t,Ko(t)]}function Ko(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const kl=["left","right"],Al=["right","left"],Tb=["top","bottom"],Cb=["bottom","top"];function Pb(e,t,n){switch(e){case"top":case"bottom":return n?t?Al:kl:t?kl:Al;case"left":case"right":return t?Tb:Cb;default:return[]}}function Eb(e,t,n,r){const i=kr(e);let s=Pb(Ut(e),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),t&&(s=s.concat(s.map(Ko)))),s}function cs(e){const t=Ut(e);return xb[t]+e.slice(t.length)}function kb(e){return{top:0,right:0,bottom:0,left:0,...e}}function gf(e){return typeof e!="number"?kb(e):{top:e,right:e,bottom:e,left:e}}function ls(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Ol(e,t,n){let{reference:r,floating:i}=e;const s=Ot(t),o=ec(t),a=Ja(o),l=Ut(t),d=s==="y",u=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,m=r[a]/2-i[a]/2;let p;switch(l){case"top":p={x:u,y:r.y-i.height};break;case"bottom":p={x:u,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-i.width,y:f};break;default:p={x:r.x,y:r.y}}switch(kr(t)){case"start":p[o]-=m*(n&&d?-1:1);break;case"end":p[o]+=m*(n&&d?-1:1);break}return p}async function Ab(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:s,rects:o,elements:a,strategy:l}=e,{boundary:d="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:m=!1,padding:p=0}=Ft(t,e),b=gf(p),g=a[m?f==="floating"?"reference":"floating":f],y=ls(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(g)))==null||n?g:g.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:d,rootBoundary:u,strategy:l})),v=f==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,_=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),x=await(s.isElement==null?void 0:s.isElement(_))?await(s.getScale==null?void 0:s.getScale(_))||{x:1,y:1}:{x:1,y:1},T=ls(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:_,strategy:l}):v);return{top:(y.top-T.top+b.top)/x.y,bottom:(T.bottom-y.bottom+b.bottom)/x.y,left:(y.left-T.left+b.left)/x.x,right:(T.right-y.right+b.right)/x.x}}const Ob=50,Nb=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,a=o.detectOverflow?o:{...o,detectOverflow:Ab},l=await(o.isRTL==null?void 0:o.isRTL(t));let d=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:f}=Ol(d,r,l),m=r,p=0;const b={};for(let h=0;h<s.length;h++){const g=s[h];if(!g)continue;const{name:y,fn:v}=g,{x:_,y:x,data:T,reset:C}=await v({x:u,y:f,initialPlacement:r,placement:m,strategy:i,middlewareData:b,rects:d,platform:a,elements:{reference:e,floating:t}});u=_??u,f=x??f,b[y]={...b[y],...T},C&&p<Ob&&(p++,typeof C=="object"&&(C.placement&&(m=C.placement),C.rects&&(d=C.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):C.rects),{x:u,y:f}=Ol(d,m,l)),h=-1)}return{x:u,y:f,placement:m,strategy:i,middlewareData:b}},Rb=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:s,platform:o,elements:a,middlewareData:l}=t,{element:d,padding:u=0}=Ft(e,t)||{};if(d==null)return{};const f=gf(u),m={x:n,y:r},p=ec(i),b=Ja(p),h=await o.getDimensions(d),g=p==="y",y=g?"top":"left",v=g?"bottom":"right",_=g?"clientHeight":"clientWidth",x=s.reference[b]+s.reference[p]-m[p]-s.floating[b],T=m[p]-s.reference[p],C=await(o.getOffsetParent==null?void 0:o.getOffsetParent(d));let O=C?C[_]:0;(!O||!await(o.isElement==null?void 0:o.isElement(C)))&&(O=a.floating[_]||s.floating[b]);const P=x/2-T/2,L=O/2-h[b]/2-1,I=dn(f[y],L),U=dn(f[v],L),N=I,V=O-h[b]-U,M=O/2-h[b]/2+P,z=zo(N,M,V),k=!l.arrow&&kr(i)!=null&&M!==z&&s.reference[b]/2-(M<N?I:U)-h[b]/2<0,j=k?M<N?M-N:M-V:0;return{[p]:m[p]+j,data:{[p]:z,centerOffset:M-z-j,...k&&{alignmentOffset:j}},reset:k}}}),Lb=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:s,rects:o,initialPlacement:a,platform:l,elements:d}=t,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:m,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:h=!0,...g}=Ft(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const y=Ut(i),v=Ot(a),_=Ut(a)===a,x=await(l.isRTL==null?void 0:l.isRTL(d.floating)),T=m||(_||!h?[cs(a)]:Sb(a)),C=b!=="none";!m&&C&&T.push(...Eb(a,h,b,x));const O=[a,...T],P=await l.detectOverflow(t,g),L=[];let I=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&L.push(P[y]),f){const M=_b(i,o,x);L.push(P[M[0]],P[M[1]])}if(I=[...I,{placement:i,overflows:L}],!L.every(M=>M<=0)){var U,N;const M=(((U=s.flip)==null?void 0:U.index)||0)+1,z=O[M];if(z&&(!(f==="alignment"?v!==Ot(z):!1)||I.every(D=>Ot(D.placement)===v?D.overflows[0]>0:!0)))return{data:{index:M,overflows:I},reset:{placement:z}};let k=(N=I.filter(j=>j.overflows[0]<=0).sort((j,D)=>j.overflows[1]-D.overflows[1])[0])==null?void 0:N.placement;if(!k)switch(p){case"bestFit":{var V;const j=(V=I.filter(D=>{if(C){const R=Ot(D.placement);return R===v||R==="y"}return!0}).map(D=>[D.placement,D.overflows.filter(R=>R>0).reduce((R,W)=>R+W,0)]).sort((D,R)=>D[1]-R[1])[0])==null?void 0:V[0];j&&(k=j);break}case"initialPlacement":k=a;break}if(i!==k)return{reset:{placement:k}}}return{}}}};function Nl(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Rl(e){return wb.some(t=>e[t]>=0)}const Db=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:i="referenceHidden",...s}=Ft(e,t);switch(i){case"referenceHidden":{const o=await r.detectOverflow(t,{...s,elementContext:"reference"}),a=Nl(o,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:Rl(a)}}}case"escaped":{const o=await r.detectOverflow(t,{...s,altBoundary:!0}),a=Nl(o,n.floating);return{data:{escapedOffsets:a,escaped:Rl(a)}}}default:return{}}}}},yf=new Set(["left","top"]);async function jb(e,t){const{placement:n,platform:r,elements:i}=e,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Ut(n),a=kr(n),l=Ot(n)==="y",d=yf.has(o)?-1:1,u=s&&l?-1:1,f=Ft(t,e);let{mainAxis:m,crossAxis:p,alignmentAxis:b}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof b=="number"&&(p=a==="end"?b*-1:b),l?{x:p*u,y:m*d}:{x:m*d,y:p*u}}const Mb=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:s,placement:o,middlewareData:a}=t,l=await jb(t,e);return o===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:o}}}}},Ib=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i,platform:s}=t,{mainAxis:o=!0,crossAxis:a=!1,limiter:l={fn:y=>{let{x:v,y:_}=y;return{x:v,y:_}}},...d}=Ft(e,t),u={x:n,y:r},f=await s.detectOverflow(t,d),m=Ot(Ut(i)),p=Xa(m);let b=u[p],h=u[m];if(o){const y=p==="y"?"top":"left",v=p==="y"?"bottom":"right",_=b+f[y],x=b-f[v];b=zo(_,b,x)}if(a){const y=m==="y"?"top":"left",v=m==="y"?"bottom":"right",_=h+f[y],x=h-f[v];h=zo(_,h,x)}const g=l.fn({...t,[p]:b,[m]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[m]:a}}}}}},Fb=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:i,rects:s,middlewareData:o}=t,{offset:a=0,mainAxis:l=!0,crossAxis:d=!0}=Ft(e,t),u={x:n,y:r},f=Ot(i),m=Xa(f);let p=u[m],b=u[f];const h=Ft(a,t),g=typeof h=="number"?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(l){const _=m==="y"?"height":"width",x=s.reference[m]-s.floating[_]+g.mainAxis,T=s.reference[m]+s.reference[_]-g.mainAxis;p<x?p=x:p>T&&(p=T)}if(d){var y,v;const _=m==="y"?"width":"height",x=yf.has(Ut(i)),T=s.reference[f]-s.floating[_]+(x&&((y=o.offset)==null?void 0:y[f])||0)+(x?0:g.crossAxis),C=s.reference[f]+s.reference[_]+(x?0:((v=o.offset)==null?void 0:v[f])||0)-(x?g.crossAxis:0);b<T?b=T:b>C&&(b=C)}return{[m]:p,[f]:b}}}},Ub=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:i,rects:s,platform:o,elements:a}=t,{apply:l=()=>{},...d}=Ft(e,t),u=await o.detectOverflow(t,d),f=Ut(i),m=kr(i),p=Ot(i)==="y",{width:b,height:h}=s.floating;let g,y;f==="top"||f==="bottom"?(g=f,y=m===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(y=f,g=m==="end"?"top":"bottom");const v=h-u.top-u.bottom,_=b-u.left-u.right,x=dn(h-u[g],v),T=dn(b-u[y],_),C=!t.middlewareData.shift;let O=x,P=T;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(P=_),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(O=v),C&&!m){const I=rt(u.left,0),U=rt(u.right,0),N=rt(u.top,0),V=rt(u.bottom,0);p?P=b-2*(I!==0||U!==0?I+U:rt(u.left,u.right)):O=h-2*(N!==0||V!==0?N+V:rt(u.top,u.bottom))}await l({...t,availableWidth:P,availableHeight:O});const L=await o.getDimensions(a.floating);return b!==L.width||h!==L.height?{reset:{rects:!0}}:{}}}};function Ms(){return typeof window<"u"}function Ar(e){return bf(e)?(e.nodeName||"").toLowerCase():"#document"}function it(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Lt(e){var t;return(t=(bf(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function bf(e){return Ms()?e instanceof Node||e instanceof it(e).Node:!1}function bt(e){return Ms()?e instanceof Element||e instanceof it(e).Element:!1}function $t(e){return Ms()?e instanceof HTMLElement||e instanceof it(e).HTMLElement:!1}function Ll(e){return!Ms()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof it(e).ShadowRoot}function fi(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=vt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!=="inline"&&i!=="contents"}function Bb(e){return/^(table|td|th)$/.test(Ar(e))}function Is(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Wb=/transform|translate|scale|rotate|perspective|filter/,$b=/paint|layout|strict|content/,bn=e=>!!e&&e!=="none";let bo;function tc(e){const t=bt(e)?vt(e):e;return bn(t.transform)||bn(t.translate)||bn(t.scale)||bn(t.rotate)||bn(t.perspective)||!nc()&&(bn(t.backdropFilter)||bn(t.filter))||Wb.test(t.willChange||"")||$b.test(t.contain||"")}function Vb(e){let t=un(e);for(;$t(t)&&!br(t);){if(tc(t))return t;if(Is(t))return null;t=un(t)}return null}function nc(){return bo==null&&(bo=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),bo}function br(e){return/^(html|body|#document)$/.test(Ar(e))}function vt(e){return it(e).getComputedStyle(e)}function Fs(e){return bt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function un(e){if(Ar(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ll(e)&&e.host||Lt(e);return Ll(t)?t.host:t}function vf(e){const t=un(e);return br(t)?e.ownerDocument?e.ownerDocument.body:e.body:$t(t)&&fi(t)?t:vf(t)}function Zr(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=vf(e),s=i===((r=e.ownerDocument)==null?void 0:r.body),o=it(i);if(s){const a=Go(o);return t.concat(o,o.visualViewport||[],fi(i)?i:[],a&&n?Zr(a):[])}else return t.concat(i,Zr(i,[],n))}function Go(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function wf(e){const t=vt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=$t(e),s=i?e.offsetWidth:n,o=i?e.offsetHeight:r,a=as(n)!==s||as(r)!==o;return a&&(n=s,r=o),{width:n,height:r,$:a}}function rc(e){return bt(e)?e:e.contextElement}function nr(e){const t=rc(e);if(!$t(t))return Nt(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:s}=wf(t);let o=(s?as(n.width):n.width)/r,a=(s?as(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const Hb=Nt(0);function xf(e){const t=it(e);return!nc()||!t.visualViewport?Hb:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function zb(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==it(e)?!1:t}function Mn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),s=rc(e);let o=Nt(1);t&&(r?bt(r)&&(o=nr(r)):o=nr(e));const a=zb(s,n,r)?xf(s):Nt(0);let l=(i.left+a.x)/o.x,d=(i.top+a.y)/o.y,u=i.width/o.x,f=i.height/o.y;if(s){const m=it(s),p=r&&bt(r)?it(r):r;let b=m,h=Go(b);for(;h&&r&&p!==b;){const g=nr(h),y=h.getBoundingClientRect(),v=vt(h),_=y.left+(h.clientLeft+parseFloat(v.paddingLeft))*g.x,x=y.top+(h.clientTop+parseFloat(v.paddingTop))*g.y;l*=g.x,d*=g.y,u*=g.x,f*=g.y,l+=_,d+=x,b=it(h),h=Go(b)}}return ls({width:u,height:f,x:l,y:d})}function Us(e,t){const n=Fs(e).scrollLeft;return t?t.left+n:Mn(Lt(e)).left+n}function _f(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Us(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function Kb(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const s=i==="fixed",o=Lt(r),a=t?Is(t.floating):!1;if(r===o||a&&s)return n;let l={scrollLeft:0,scrollTop:0},d=Nt(1);const u=Nt(0),f=$t(r);if((f||!f&&!s)&&((Ar(r)!=="body"||fi(o))&&(l=Fs(r)),f)){const p=Mn(r);d=nr(r),u.x=p.x+r.clientLeft,u.y=p.y+r.clientTop}const m=o&&!f&&!s?_f(o,l):Nt(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-l.scrollLeft*d.x+u.x+m.x,y:n.y*d.y-l.scrollTop*d.y+u.y+m.y}}function Gb(e){return Array.from(e.getClientRects())}function qb(e){const t=Lt(e),n=Fs(e),r=e.ownerDocument.body,i=rt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=rt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+Us(e);const a=-n.scrollTop;return vt(r).direction==="rtl"&&(o+=rt(t.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:a}}const Dl=25;function Qb(e,t){const n=it(e),r=Lt(e),i=n.visualViewport;let s=r.clientWidth,o=r.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;const u=nc();(!u||u&&t==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}const d=Us(r);if(d<=0){const u=r.ownerDocument,f=u.body,m=getComputedStyle(f),p=u.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,b=Math.abs(r.clientWidth-f.clientWidth-p);b<=Dl&&(s-=b)}else d<=Dl&&(s+=d);return{width:s,height:o,x:a,y:l}}function Yb(e,t){const n=Mn(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,s=$t(e)?nr(e):Nt(1),o=e.clientWidth*s.x,a=e.clientHeight*s.y,l=i*s.x,d=r*s.y;return{width:o,height:a,x:l,y:d}}function jl(e,t,n){let r;if(t==="viewport")r=Qb(e,n);else if(t==="document")r=qb(Lt(e));else if(bt(t))r=Yb(t,n);else{const i=xf(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return ls(r)}function Sf(e,t){const n=un(e);return n===t||!bt(n)||br(n)?!1:vt(n).position==="fixed"||Sf(n,t)}function Zb(e,t){const n=t.get(e);if(n)return n;let r=Zr(e,[],!1).filter(a=>bt(a)&&Ar(a)!=="body"),i=null;const s=vt(e).position==="fixed";let o=s?un(e):e;for(;bt(o)&&!br(o);){const a=vt(o),l=tc(o);!l&&a.position==="fixed"&&(i=null),(s?!l&&!i:!l&&a.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||fi(o)&&!l&&Sf(e,o))?r=r.filter(u=>u!==o):i=a,o=un(o)}return t.set(e,r),r}function Xb(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const o=[...n==="clippingAncestors"?Is(t)?[]:Zb(t,this._c):[].concat(n),r],a=jl(t,o[0],i);let l=a.top,d=a.right,u=a.bottom,f=a.left;for(let m=1;m<o.length;m++){const p=jl(t,o[m],i);l=rt(p.top,l),d=dn(p.right,d),u=dn(p.bottom,u),f=rt(p.left,f)}return{width:d-f,height:u-l,x:f,y:l}}function Jb(e){const{width:t,height:n}=wf(e);return{width:t,height:n}}function ev(e,t,n){const r=$t(t),i=Lt(t),s=n==="fixed",o=Mn(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const l=Nt(0);function d(){l.x=Us(i)}if(r||!r&&!s)if((Ar(t)!=="body"||fi(i))&&(a=Fs(t)),r){const p=Mn(t,!0,s,t);l.x=p.x+t.clientLeft,l.y=p.y+t.clientTop}else i&&d();s&&!r&&i&&d();const u=i&&!r&&!s?_f(i,a):Nt(0),f=o.left+a.scrollLeft-l.x-u.x,m=o.top+a.scrollTop-l.y-u.y;return{x:f,y:m,width:o.width,height:o.height}}function vo(e){return vt(e).position==="static"}function Ml(e,t){if(!$t(e)||vt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Lt(e)===n&&(n=n.ownerDocument.body),n}function Tf(e,t){const n=it(e);if(Is(e))return n;if(!$t(e)){let i=un(e);for(;i&&!br(i);){if(bt(i)&&!vo(i))return i;i=un(i)}return n}let r=Ml(e,t);for(;r&&Bb(r)&&vo(r);)r=Ml(r,t);return r&&br(r)&&vo(r)&&!tc(r)?n:r||Vb(e)||n}const tv=async function(e){const t=this.getOffsetParent||Tf,n=this.getDimensions,r=await n(e.floating);return{reference:ev(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function nv(e){return vt(e).direction==="rtl"}const rv={convertOffsetParentRelativeRectToViewportRelativeRect:Kb,getDocumentElement:Lt,getClippingRect:Xb,getOffsetParent:Tf,getElementRects:tv,getClientRects:Gb,getDimensions:Jb,getScale:nr,isElement:bt,isRTL:nv};function Cf(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function iv(e,t){let n=null,r;const i=Lt(e);function s(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),s();const d=e.getBoundingClientRect(),{left:u,top:f,width:m,height:p}=d;if(a||t(),!m||!p)return;const b=Mi(f),h=Mi(i.clientWidth-(u+m)),g=Mi(i.clientHeight-(f+p)),y=Mi(u),_={rootMargin:-b+"px "+-h+"px "+-g+"px "+-y+"px",threshold:rt(0,dn(1,l))||1};let x=!0;function T(C){const O=C[0].intersectionRatio;if(O!==l){if(!x)return o();O?o(!1,O):r=setTimeout(()=>{o(!1,1e-7)},1e3)}O===1&&!Cf(d,e.getBoundingClientRect())&&o(),x=!1}try{n=new IntersectionObserver(T,{..._,root:i.ownerDocument})}catch{n=new IntersectionObserver(T,_)}n.observe(e)}return o(!0),s}function sv(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,d=rc(e),u=i||s?[...d?Zr(d):[],...t?Zr(t):[]]:[];u.forEach(y=>{i&&y.addEventListener("scroll",n,{passive:!0}),s&&y.addEventListener("resize",n)});const f=d&&a?iv(d,n):null;let m=-1,p=null;o&&(p=new ResizeObserver(y=>{let[v]=y;v&&v.target===d&&p&&t&&(p.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var _;(_=p)==null||_.observe(t)})),n()}),d&&!l&&p.observe(d),t&&p.observe(t));let b,h=l?Mn(e):null;l&&g();function g(){const y=Mn(e);h&&!Cf(h,y)&&n(),h=y,b=requestAnimationFrame(g)}return n(),()=>{var y;u.forEach(v=>{i&&v.removeEventListener("scroll",n),s&&v.removeEventListener("resize",n)}),f==null||f(),(y=p)==null||y.disconnect(),p=null,l&&cancelAnimationFrame(b)}}const ov=Mb,av=Ib,cv=Lb,lv=Ub,dv=Db,Il=Rb,uv=Fb,fv=(e,t,n)=>{const r=new Map,i={platform:rv,...n},s={...i.platform,_c:r};return Nb(e,t,{...i,platform:s})};var pv=typeof document<"u",mv=function(){},Yi=pv?S.useLayoutEffect:mv;function ds(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!ds(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(!(s==="_owner"&&e.$$typeof)&&!ds(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Pf(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Fl(e,t){const n=Pf(e);return Math.round(t*n)/n}function wo(e){const t=w.useRef(e);return Yi(()=>{t.current=e}),t}function hv(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:o}={},transform:a=!0,whileElementsMounted:l,open:d}=e,[u,f]=w.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,p]=w.useState(r);ds(m,r)||p(r);const[b,h]=w.useState(null),[g,y]=w.useState(null),v=w.useCallback(D=>{D!==C.current&&(C.current=D,h(D))},[]),_=w.useCallback(D=>{D!==O.current&&(O.current=D,y(D))},[]),x=s||b,T=o||g,C=w.useRef(null),O=w.useRef(null),P=w.useRef(u),L=l!=null,I=wo(l),U=wo(i),N=wo(d),V=w.useCallback(()=>{if(!C.current||!O.current)return;const D={placement:t,strategy:n,middleware:m};U.current&&(D.platform=U.current),fv(C.current,O.current,D).then(R=>{const W={...R,isPositioned:N.current!==!1};M.current&&!ds(P.current,W)&&(P.current=W,Er.flushSync(()=>{f(W)}))})},[m,t,n,U,N]);Yi(()=>{d===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,f(D=>({...D,isPositioned:!1})))},[d]);const M=w.useRef(!1);Yi(()=>(M.current=!0,()=>{M.current=!1}),[]),Yi(()=>{if(x&&(C.current=x),T&&(O.current=T),x&&T){if(I.current)return I.current(x,T,V);V()}},[x,T,V,I,L]);const z=w.useMemo(()=>({reference:C,floating:O,setReference:v,setFloating:_}),[v,_]),k=w.useMemo(()=>({reference:x,floating:T}),[x,T]),j=w.useMemo(()=>{const D={position:n,left:0,top:0};if(!k.floating)return D;const R=Fl(k.floating,u.x),W=Fl(k.floating,u.y);return a?{...D,transform:"translate("+R+"px, "+W+"px)",...Pf(k.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:R,top:W}},[n,a,k.floating,u.x,u.y]);return w.useMemo(()=>({...u,update:V,refs:z,elements:k,floatingStyles:j}),[u,V,z,k,j])}const gv=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:i}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?Il({element:r.current,padding:i}).fn(n):{}:r?Il({element:r,padding:i}).fn(n):{}}}},yv=(e,t)=>{const n=ov(e);return{name:n.name,fn:n.fn,options:[e,t]}},bv=(e,t)=>{const n=av(e);return{name:n.name,fn:n.fn,options:[e,t]}},vv=(e,t)=>({fn:uv(e).fn,options:[e,t]}),wv=(e,t)=>{const n=cv(e);return{name:n.name,fn:n.fn,options:[e,t]}},xv=(e,t)=>{const n=lv(e);return{name:n.name,fn:n.fn,options:[e,t]}},_v=(e,t)=>{const n=dv(e);return{name:n.name,fn:n.fn,options:[e,t]}},Sv=(e,t)=>{const n=gv(e);return{name:n.name,fn:n.fn,options:[e,t]}};var Tv="Arrow",Ef=w.forwardRef((e,t)=>{const{children:n,width:r=10,height:i=5,...s}=e;return c.jsx(ge.svg,{...s,ref:t,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:c.jsx("polygon",{points:"0,0 30,0 15,10"})})});Ef.displayName=Tv;var Cv=Ef;function Pv(e){const[t,n]=w.useState(void 0);return Ie(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let o,a;if("borderBoxSize"in s){const l=s.borderBoxSize,d=Array.isArray(l)?l[0]:l;o=d.inlineSize,a=d.blockSize}else o=e.offsetWidth,a=e.offsetHeight;n({width:o,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var ic="Popper",[kf,Af]=$n(ic),[Ev,Of]=kf(ic),Nf=e=>{const{__scopePopper:t,children:n}=e,[r,i]=w.useState(null),[s,o]=w.useState(void 0);return c.jsx(Ev,{scope:t,anchor:r,onAnchorChange:i,placementState:s,setPlacementState:o,children:n})};Nf.displayName=ic;var Rf="PopperAnchor",Lf=w.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...i}=e,s=Of(Rf,n),o=w.useRef(null),a=s.onAnchorChange,l=w.useCallback(b=>{o.current=b,b&&a(b)},[a]),d=Ne(t,l),u=w.useRef(null);w.useEffect(()=>{if(!r)return;const b=u.current;u.current=r.current,b!==u.current&&a(u.current)});const f=s.placementState&&oc(s.placementState),m=f==null?void 0:f[0],p=f==null?void 0:f[1];return r?null:c.jsx(ge.div,{"data-radix-popper-side":m,"data-radix-popper-align":p,...i,ref:d})});Lf.displayName=Rf;var sc="PopperContent",[kv,Av]=kf(sc),Df=w.forwardRef((e,t)=>{var Q,ye,ce,ee,ae,ke;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:s="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:d=[],collisionPadding:u=0,sticky:f="partial",hideWhenDetached:m=!1,updatePositionStrategy:p="optimized",onPlaced:b,...h}=e,g=Of(sc,n),[y,v]=w.useState(null),_=Ne(t,K=>v(K)),[x,T]=w.useState(null),C=Pv(x),O=(C==null?void 0:C.width)??0,P=(C==null?void 0:C.height)??0,L=r+(s!=="center"?"-"+s:""),I=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},U=Array.isArray(d)?d:[d],N=U.length>0,V={padding:I,boundary:U.filter(Nv),altBoundary:N},{refs:M,floatingStyles:z,placement:k,isPositioned:j,middlewareData:D}=hv({strategy:"fixed",placement:L,whileElementsMounted:(...K)=>sv(...K,{animationFrame:p==="always"}),elements:{reference:g.anchor},middleware:[yv({mainAxis:i+P,alignmentAxis:o}),l&&bv({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?vv():void 0,...V}),l&&wv({...V}),xv({...V,apply:({elements:K,rects:xe,availableWidth:re,availableHeight:_e})=>{const{width:Fe,height:He}=xe.reference,pt=K.floating.style;pt.setProperty("--radix-popper-available-width",`${re}px`),pt.setProperty("--radix-popper-available-height",`${_e}px`),pt.setProperty("--radix-popper-anchor-width",`${Fe}px`),pt.setProperty("--radix-popper-anchor-height",`${He}px`)}}),x&&Sv({element:x,padding:a}),Rv({arrowWidth:O,arrowHeight:P}),m&&_v({strategy:"referenceHidden",...V,boundary:N?V.boundary:void 0})]}),R=g.setPlacementState;Ie(()=>(R(k),()=>{R(void 0)}),[k,R]);const[W,F]=oc(k),G=yt(b);Ie(()=>{j&&(G==null||G())},[j,G]);const X=(Q=D.arrow)==null?void 0:Q.x,de=(ye=D.arrow)==null?void 0:ye.y,ne=((ce=D.arrow)==null?void 0:ce.centerOffset)!==0,[B,$]=w.useState();return Ie(()=>{y&&$(window.getComputedStyle(y).zIndex)},[y]),c.jsx("div",{ref:M.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:j?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:B,"--radix-popper-transform-origin":[(ee=D.transformOrigin)==null?void 0:ee.x,(ae=D.transformOrigin)==null?void 0:ae.y].join(" "),...((ke=D.hide)==null?void 0:ke.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:c.jsx(kv,{scope:n,placedSide:W,placedAlign:F,onArrowChange:T,arrowX:X,arrowY:de,shouldHideArrow:ne,children:c.jsx(ge.div,{"data-side":W,"data-align":F,...h,ref:_,style:{...h.style,animation:j?void 0:"none"}})})})});Df.displayName=sc;var jf="PopperArrow",Ov={top:"bottom",right:"left",bottom:"top",left:"right"},Mf=w.forwardRef(function(t,n){const{__scopePopper:r,...i}=t,s=Av(jf,r),o=Ov[s.placedSide];return c.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:c.jsx(Cv,{...i,ref:n,style:{...i.style,display:"block"}})})});Mf.displayName=jf;function Nv(e){return e!==null}var Rv=e=>({name:"transformOrigin",options:e,fn(t){var g,y,v;const{placement:n,rects:r,middlewareData:i}=t,o=((g=i.arrow)==null?void 0:g.centerOffset)!==0,a=o?0:e.arrowWidth,l=o?0:e.arrowHeight,[d,u]=oc(n),f={start:"0%",center:"50%",end:"100%"}[u],m=(((y=i.arrow)==null?void 0:y.x)??0)+a/2,p=(((v=i.arrow)==null?void 0:v.y)??0)+l/2;let b="",h="";return d==="bottom"?(b=o?f:`${m}px`,h=`${-l}px`):d==="top"?(b=o?f:`${m}px`,h=`${r.floating.height+l}px`):d==="right"?(b=`${-l}px`,h=o?f:`${p}px`):d==="left"&&(b=`${r.floating.width+l}px`,h=o?f:`${p}px`),{data:{x:b,y:h}}}});function oc(e){const[t,n="center"]=e.split("-");return[t,n]}var Lv=Nf,Dv=Lf,jv=Df,Mv=Mf;function Iv(e){const t=w.useRef({value:e,previous:e});return w.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var If=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Fv="VisuallyHidden",ac=w.forwardRef((e,t)=>c.jsx(ge.span,{...e,ref:t,style:{...If,...e.style}}));ac.displayName=Fv;var Uv=[" ","Enter","ArrowUp","ArrowDown"],Bv=[" ","Enter"],In="Select",[Bs,Ws,Wv]=Za(In),[Hn]=$n(In,[Wv,Af]),$s=Af(),[$v,hn]=Hn(In),[Vv,Hv]=Hn(In),zv="SelectProvider";function Ff(e){const{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:s,value:o,defaultValue:a,onValueChange:l,dir:d,name:u,autoComplete:f,disabled:m,required:p,form:b,internal_do_not_use_render:h}=e,g=$s(t),[y,v]=w.useState(null),[_,x]=w.useState(null),[T,C]=w.useState(!1),O=hf(d),[P,L]=jn({prop:r,defaultProp:i??!1,onChange:s,caller:In}),[I,U]=jn({prop:o,defaultProp:a,onChange:l,caller:In}),N=w.useRef(null),V=y?!!b||!!y.closest("form"):!0,[M,z]=w.useState(new Set),k=an(),j=Array.from(M).map(F=>F.props.value).join(";"),D=w.useCallback(F=>{z(G=>new Set(G).add(F))},[]),R=w.useCallback(F=>{z(G=>{const X=new Set(G);return X.delete(F),X})},[]),W={required:p,trigger:y,onTriggerChange:v,valueNode:_,onValueNodeChange:x,valueNodeHasChildren:T,onValueNodeHasChildrenChange:C,contentId:k,value:I,onValueChange:U,open:P,onOpenChange:L,dir:O,triggerPointerDownPosRef:N,disabled:m,name:u,autoComplete:f,form:b,nativeOptions:M,nativeSelectKey:j,isFormControl:V};return c.jsx(Lv,{...g,children:c.jsx($v,{scope:t,...W,children:c.jsx(Bs.Provider,{scope:t,children:c.jsx(Vv,{scope:t,onNativeOptionAdd:D,onNativeOptionRemove:R,children:ow(h)?h(W):n})})})})}Ff.displayName=zv;var Uf=e=>{const{__scopeSelect:t,children:n,...r}=e;return c.jsx(Ff,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:i})=>c.jsxs(c.Fragment,{children:[n,i?c.jsx(op,{__scopeSelect:t}):null]})})};Uf.displayName=In;var Bf="SelectTrigger",cc=w.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...i}=e,s=$s(n),o=hn(Bf,n),a=o.disabled||r,l=Ne(t,o.onTriggerChange),d=Ws(n),u=w.useRef("touch"),[f,m,p]=ap(h=>{const g=d().filter(_=>!_.disabled),y=g.find(_=>_.value===o.value),v=cp(g,h,y);v!==void 0&&o.onValueChange(v.value)}),b=h=>{a||(o.onOpenChange(!0),p()),h&&(o.triggerPointerDownPosRef.current={x:Math.round(h.pageX),y:Math.round(h.pageY)})};return c.jsx(Dv,{asChild:!0,...s,children:c.jsx(ge.button,{type:"button",role:"combobox","aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":Vs(o.value)?"":void 0,...i,ref:l,onClick:he(i.onClick,h=>{h.currentTarget.focus(),u.current!=="mouse"&&b(h)}),onPointerDown:he(i.onPointerDown,h=>{u.current=h.pointerType;const g=h.target;g.hasPointerCapture(h.pointerId)&&g.releasePointerCapture(h.pointerId),h.button===0&&h.ctrlKey===!1&&h.pointerType==="mouse"&&(b(h),h.preventDefault())}),onKeyDown:he(i.onKeyDown,h=>{const g=f.current!=="";!(h.ctrlKey||h.altKey||h.metaKey)&&h.key.length===1&&m(h.key),!(g&&h.key===" ")&&Uv.includes(h.key)&&(b(),h.preventDefault())})})})});cc.displayName=Bf;var Wf="SelectValue",$f=w.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:i,children:s,placeholder:o="",...a}=e,l=hn(Wf,n),{onValueNodeHasChildrenChange:d}=l,u=s!==void 0,f=Ne(t,l.onValueNodeChange);Ie(()=>{d(u)},[d,u]);const m=Vs(l.value);return c.jsx(ge.span,{...a,asChild:m?!1:a.asChild,ref:f,style:{pointerEvents:"none"},children:c.jsx(w.Fragment,{children:m?o:s},m?"placeholder":"value")})});$f.displayName=Wf;var Kv="SelectIcon",Vf=w.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...i}=e;return c.jsx(ge.span,{"aria-hidden":!0,...i,ref:t,children:r||"▼"})});Vf.displayName=Kv;var Hf="SelectPortal",[Gv,qv]=Hn(Hf,{forceMount:void 0}),zf=e=>{const{__scopeSelect:t,forceMount:n,...r}=e;return c.jsx(Gv,{scope:e.__scopeSelect,forceMount:n,children:c.jsx(Ls,{asChild:!0,...r})})};zf.displayName=Hf;var fn="SelectContent",lc=w.forwardRef((e,t)=>{const n=qv(fn,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,s=hn(fn,e.__scopeSelect),[o,a]=w.useState();return Ie(()=>{a(new DocumentFragment)},[]),c.jsx(Vn,{present:r||s.open,children:({present:l})=>l?c.jsx(qf,{...i,ref:t}):c.jsx(Kf,{...i,fragment:o})})});lc.displayName=fn;var Kf=w.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,fragment:i}=e;return i?Er.createPortal(c.jsx(Gf,{scope:n,children:c.jsx(Bs.Slot,{scope:n,children:c.jsx("div",{ref:t,children:r})})}),i):null});Kf.displayName="SelectContentFragment";var ht=10,[Gf,gn]=Hn(fn),Qv="SelectContentImpl",Yv=gr("SelectContent.RemoveScroll"),qf=w.forwardRef((e,t)=>{const{__scopeSelect:n}=e,{position:r="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:s,onPointerDownOutside:o,side:a,sideOffset:l,align:d,alignOffset:u,arrowPadding:f,collisionBoundary:m,collisionPadding:p,sticky:b,hideWhenDetached:h,avoidCollisions:g,...y}=e,v=hn(fn,n),[_,x]=w.useState(null),[T,C]=w.useState(null),O=Ne(t,$=>x($)),[P,L]=w.useState(null),[I,U]=w.useState(null),N=Ws(n),[V,M]=w.useState(!1),z=w.useRef(!1);w.useEffect(()=>{if(_)return Xu(_)},[_]),Vu();const k=w.useCallback($=>{const[Q,...ye]=N().map(ae=>ae.ref.current),[ce]=ye.slice(-1),ee=document.activeElement;for(const ae of $)if(ae===ee||(ae==null||ae.scrollIntoView({block:"nearest"}),ae===Q&&T&&(T.scrollTop=0),ae===ce&&T&&(T.scrollTop=T.scrollHeight),ae==null||ae.focus(),document.activeElement!==ee))return},[N,T]),j=w.useCallback(()=>k([P,_]),[k,P,_]);w.useEffect(()=>{V&&j()},[V,j]);const{onOpenChange:D,triggerPointerDownPosRef:R}=v;w.useEffect(()=>{if(_){let $={x:0,y:0};const Q=ce=>{var ee,ae;$={x:Math.abs(Math.round(ce.pageX)-(((ee=R.current)==null?void 0:ee.x)??0)),y:Math.abs(Math.round(ce.pageY)-(((ae=R.current)==null?void 0:ae.y)??0))}},ye=ce=>{$.x<=10&&$.y<=10?ce.preventDefault():ce.composedPath().includes(_)||D(!1),document.removeEventListener("pointermove",Q),R.current=null};return R.current!==null&&(document.addEventListener("pointermove",Q),document.addEventListener("pointerup",ye,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Q),document.removeEventListener("pointerup",ye,{capture:!0})}}},[_,D,R]),w.useEffect(()=>{const $=()=>D(!1);return window.addEventListener("blur",$),window.addEventListener("resize",$),()=>{window.removeEventListener("blur",$),window.removeEventListener("resize",$)}},[D]);const[W,F]=ap($=>{const Q=N().filter(ee=>!ee.disabled),ye=Q.find(ee=>ee.ref.current===document.activeElement),ce=cp(Q,$,ye);ce&&setTimeout(()=>{var ee;return(ee=ce.ref.current)==null?void 0:ee.focus()})}),G=w.useCallback(($,Q,ye)=>{const ce=!z.current&&!ye;(v.value!==void 0&&v.value===Q||ce)&&(L($),ce&&(z.current=!0))},[v.value]),X=w.useCallback(()=>_==null?void 0:_.focus(),[_]),de=w.useCallback(($,Q,ye)=>{const ce=!z.current&&!ye;(v.value!==void 0&&v.value===Q||ce)&&U($)},[v.value]),ne=r==="popper"?qo:Qf,B=ne===qo?{side:a,sideOffset:l,align:d,alignOffset:u,arrowPadding:f,collisionBoundary:m,collisionPadding:p,sticky:b,hideWhenDetached:h,avoidCollisions:g}:{};return c.jsx(Gf,{scope:n,content:_,viewport:T,onViewportChange:C,itemRefCallback:G,selectedItem:P,onItemLeave:X,itemTextRefCallback:de,focusSelectedItem:j,selectedItemText:I,position:r,isPositioned:V,searchRef:W,children:c.jsx(Ha,{as:Yv,allowPinchZoom:!0,children:c.jsx(Va,{asChild:!0,trapped:v.open,onMountAutoFocus:$=>{$.preventDefault()},onUnmountAutoFocus:he(i,$=>{var Q;(Q=v.trigger)==null||Q.focus({preventScroll:!0}),$.preventDefault()}),children:c.jsx(Rs,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:$=>$.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:c.jsx(ne,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:$=>$.preventDefault(),...y,...B,onPlaced:()=>M(!0),ref:O,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:he(y.onKeyDown,$=>{const Q=$.ctrlKey||$.altKey||$.metaKey;if($.key==="Tab"&&$.preventDefault(),!Q&&$.key.length===1&&F($.key),["ArrowUp","ArrowDown","Home","End"].includes($.key)){let ce=N().filter(ee=>!ee.disabled).map(ee=>ee.ref.current);if(["ArrowUp","End"].includes($.key)&&(ce=ce.slice().reverse()),["ArrowUp","ArrowDown"].includes($.key)){const ee=$.target,ae=ce.indexOf(ee);ce=ce.slice(ae+1)}setTimeout(()=>k(ce)),$.preventDefault()}})})})})})})});qf.displayName=Qv;var Zv="SelectItemAlignedPosition",Qf=w.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...i}=e,s=hn(fn,n),o=gn(fn,n),[a,l]=w.useState(null),[d,u]=w.useState(null),f=Ne(t,O=>u(O)),m=Ws(n),p=w.useRef(!1),b=w.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:y,focusSelectedItem:v}=o,_=w.useCallback(()=>{if(s.trigger&&s.valueNode&&a&&d&&h&&g&&y){const O=s.trigger.getBoundingClientRect(),P=d.getBoundingClientRect(),L=s.valueNode.getBoundingClientRect(),I=y.getBoundingClientRect();if(s.dir!=="rtl"){const ee=I.left-P.left,ae=L.left-ee,ke=O.left-ae,K=O.width+ke,xe=Math.max(K,P.width),re=window.innerWidth-ht,_e=El(ae,[ht,Math.max(ht,re-xe)]);a.style.minWidth=K+"px",a.style.left=_e+"px"}else{const ee=P.right-I.right,ae=window.innerWidth-L.right-ee,ke=window.innerWidth-O.right-ae,K=O.width+ke,xe=Math.max(K,P.width),re=window.innerWidth-ht,_e=El(ae,[ht,Math.max(ht,re-xe)]);a.style.minWidth=K+"px",a.style.right=_e+"px"}const U=m(),N=window.innerHeight-ht*2,V=h.scrollHeight,M=window.getComputedStyle(d),z=parseInt(M.borderTopWidth,10),k=parseInt(M.paddingTop,10),j=parseInt(M.borderBottomWidth,10),D=parseInt(M.paddingBottom,10),R=z+k+V+D+j,W=Math.min(g.offsetHeight*5,R),F=window.getComputedStyle(h),G=parseInt(F.paddingTop,10),X=parseInt(F.paddingBottom,10),de=O.top+O.height/2-ht,ne=N-de,B=g.offsetHeight/2,$=g.offsetTop+B,Q=z+k+$,ye=R-Q;if(Q<=de){const ee=U.length>0&&g===U[U.length-1].ref.current;a.style.bottom="0px";const ae=d.clientHeight-h.offsetTop-h.offsetHeight,ke=Math.max(ne,B+(ee?X:0)+ae+j),K=Q+ke;a.style.height=K+"px"}else{const ee=U.length>0&&g===U[0].ref.current;a.style.top="0px";const ke=Math.max(de,z+h.offsetTop+(ee?G:0)+B)+ye;a.style.height=ke+"px",h.scrollTop=Q-de+h.offsetTop}a.style.margin=`${ht}px 0`,a.style.minHeight=W+"px",a.style.maxHeight=N+"px",r==null||r(),requestAnimationFrame(()=>p.current=!0)}},[m,s.trigger,s.valueNode,a,d,h,g,y,s.dir,r]);Ie(()=>_(),[_]);const[x,T]=w.useState();Ie(()=>{d&&T(window.getComputedStyle(d).zIndex)},[d]);const C=w.useCallback(O=>{O&&b.current===!0&&(_(),v==null||v(),b.current=!1)},[_,v]);return c.jsx(Jv,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:p,onScrollButtonChange:C,children:c.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:x},children:c.jsx(ge.div,{...i,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});Qf.displayName=Zv;var Xv="SelectPopperPosition",qo=w.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:i=ht,...s}=e,o=$s(n);return c.jsx(jv,{...o,...s,ref:t,align:r,collisionPadding:i,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});qo.displayName=Xv;var[Jv,dc]=Hn(fn,{}),Qo="SelectViewport",Yf=w.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...i}=e,s=gn(Qo,n),o=dc(Qo,n),a=Ne(t,s.onViewportChange),l=w.useRef(0);return c.jsxs(c.Fragment,{children:[c.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),c.jsx(Bs.Slot,{scope:n,children:c.jsx(ge.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:he(i.onScroll,d=>{const u=d.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:m}=o;if(m!=null&&m.current&&f){const p=Math.abs(l.current-u.scrollTop);if(p>0){const b=window.innerHeight-ht*2,h=parseFloat(f.style.minHeight),g=parseFloat(f.style.height),y=Math.max(h,g);if(y<b){const v=y+p,_=Math.min(b,v),x=v-_;f.style.height=_+"px",f.style.bottom==="0px"&&(u.scrollTop=x>0?x:0,f.style.justifyContent="flex-end")}}}l.current=u.scrollTop})})})]})});Yf.displayName=Qo;var Zf="SelectGroup",[ew,tw]=Hn(Zf),nw=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=an();return c.jsx(ew,{scope:n,id:i,children:c.jsx(ge.div,{role:"group","aria-labelledby":i,...r,ref:t})})});nw.displayName=Zf;var Xf="SelectLabel",uc=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=tw(Xf,n);return c.jsx(ge.div,{id:i.id,...r,ref:t})});uc.displayName=Xf;var us="SelectItem",[rw,Jf]=Hn(us),fc=w.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:i=!1,textValue:s,...o}=e,a=hn(us,n),l=gn(us,n),d=a.value===r,[u,f]=w.useState(s??""),[m,p]=w.useState(!1),b=Ne(t,v=>{var _;return(_=l.itemRefCallback)==null?void 0:_.call(l,v,r,i)}),h=an(),g=w.useRef("touch"),y=()=>{i||(a.onValueChange(r),a.onOpenChange(!1))};return c.jsx(rw,{scope:n,value:r,disabled:i,textId:h,isSelected:d,onItemTextChange:w.useCallback(v=>{f(_=>_||((v==null?void 0:v.textContent)??"").trim())},[]),children:c.jsx(Bs.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:c.jsx(ge.div,{role:"option","aria-labelledby":h,"data-highlighted":m?"":void 0,"aria-selected":d&&m,"data-state":d?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...o,ref:b,onFocus:he(o.onFocus,()=>p(!0)),onBlur:he(o.onBlur,()=>p(!1)),onClick:he(o.onClick,()=>{g.current!=="mouse"&&y()}),onPointerUp:he(o.onPointerUp,()=>{g.current==="mouse"&&y()}),onPointerDown:he(o.onPointerDown,v=>{g.current=v.pointerType}),onPointerMove:he(o.onPointerMove,v=>{var _;g.current=v.pointerType,i?(_=l.onItemLeave)==null||_.call(l):g.current==="mouse"&&v.currentTarget.focus({preventScroll:!0})}),onPointerLeave:he(o.onPointerLeave,v=>{var _;v.currentTarget===document.activeElement&&((_=l.onItemLeave)==null||_.call(l))}),onKeyDown:he(o.onKeyDown,v=>{var x;((x=l.searchRef)==null?void 0:x.current)!==""&&v.key===" "||(Bv.includes(v.key)&&y(),v.key===" "&&v.preventDefault())})})})})});fc.displayName=us;var $r="SelectItemText",ep=w.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:i,...s}=e,o=hn($r,n),a=gn($r,n),l=Jf($r,n),d=Hv($r,n),[u,f]=w.useState(null),m=Ne(t,y=>f(y),l.onItemTextChange,y=>{var v;return(v=a.itemTextRefCallback)==null?void 0:v.call(a,y,l.value,l.disabled)}),p=u==null?void 0:u.textContent,b=w.useMemo(()=>c.jsx("option",{value:l.value,disabled:l.disabled,children:p},l.value),[l.disabled,l.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:g}=d;return Ie(()=>(h(b),()=>g(b)),[h,g,b]),c.jsxs(c.Fragment,{children:[c.jsx(ge.span,{id:l.textId,...s,ref:m}),l.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!Vs(o.value)?Er.createPortal(s.children,o.valueNode):null]})});ep.displayName=$r;var tp="SelectItemIndicator",np=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return Jf(tp,n).isSelected?c.jsx(ge.span,{"aria-hidden":!0,...r,ref:t}):null});np.displayName=tp;var Yo="SelectScrollUpButton",pc=w.forwardRef((e,t)=>{const n=gn(Yo,e.__scopeSelect),r=dc(Yo,e.__scopeSelect),[i,s]=w.useState(!1),o=Ne(t,r.onScrollButtonChange);return Ie(()=>{if(n.viewport&&n.isPositioned){let a=function(){const d=l.scrollTop>0;s(d)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),i?c.jsx(rp,{...e,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});pc.displayName=Yo;var Zo="SelectScrollDownButton",mc=w.forwardRef((e,t)=>{const n=gn(Zo,e.__scopeSelect),r=dc(Zo,e.__scopeSelect),[i,s]=w.useState(!1),o=Ne(t,r.onScrollButtonChange);return Ie(()=>{if(n.viewport&&n.isPositioned){let a=function(){const d=l.scrollHeight-l.clientHeight,u=Math.ceil(l.scrollTop)<d;s(u)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),i?c.jsx(rp,{...e,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});mc.displayName=Zo;var rp=w.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...i}=e,s=gn("SelectScrollButton",n),o=w.useRef(null),a=Ws(n),l=w.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return w.useEffect(()=>()=>l(),[l]),Ie(()=>{var u;const d=a().find(f=>f.ref.current===document.activeElement);(u=d==null?void 0:d.ref.current)==null||u.scrollIntoView({block:"nearest"})},[a]),c.jsx(ge.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:he(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:he(i.onPointerMove,()=>{var d;(d=s.onItemLeave)==null||d.call(s),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:he(i.onPointerLeave,()=>{l()})})}),iw="SelectSeparator",hc=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return c.jsx(ge.div,{"aria-hidden":!0,...r,ref:t})});hc.displayName=iw;var ip="SelectArrow",sw=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=$s(n);return gn(ip,n).position==="popper"?c.jsx(Mv,{...i,...r,ref:t}):null});sw.displayName=ip;var sp="SelectBubbleInput",op=w.forwardRef(({__scopeSelect:e,...t},n)=>{const r=hn(sp,e),{value:i,onValueChange:s,required:o,disabled:a,name:l,autoComplete:d,form:u}=r,{nativeOptions:f,nativeSelectKey:m}=r,p=w.useRef(null),b=Ne(n,p),h=i??"",g=Iv(h),y=Array.from(f).some(v=>(v.props.value??"")==="");return w.useEffect(()=>{const v=p.current;if(!v)return;const _=window.HTMLSelectElement.prototype,T=Object.getOwnPropertyDescriptor(_,"value").set;if(g!==h&&T){const C=new Event("change",{bubbles:!0});T.call(v,h),v.dispatchEvent(C)}},[g,h]),c.jsxs(ge.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:l,autoComplete:d,disabled:a,form:u,onChange:v=>s(v.target.value),...t,style:{...If,...t.style},ref:b,defaultValue:h,children:[Vs(i)&&!y?c.jsx("option",{value:""}):null,Array.from(f)]},m)});op.displayName=sp;function ow(e){return typeof e=="function"}function Vs(e){return e===""||e===void 0}function ap(e){const t=yt(e),n=w.useRef(""),r=w.useRef(0),i=w.useCallback(o=>{const a=n.current+o;t(a),(function l(d){n.current=d,window.clearTimeout(r.current),d!==""&&(r.current=window.setTimeout(()=>l(""),1e3))})(a)},[t]),s=w.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return w.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,s]}function cp(e,t,n){const i=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let o=aw(e,Math.max(s,0));i.length===1&&(o=o.filter(d=>d!==n));const l=o.find(d=>d.textValue.toLowerCase().startsWith(i.toLowerCase()));return l!==n?l:void 0}function aw(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Hs(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,s;for(s=0;s<r.length;s++)i=r[s],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var cw=["color"],lw=S.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=Hs(e,cw);return S.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:t}),S.createElement("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),dw=["color"],gc=S.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=Hs(e,dw);return S.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:t}),S.createElement("path",{d:"M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),uw=["color"],fw=S.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=Hs(e,uw);return S.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:t}),S.createElement("path",{d:"M3.13523 8.84197C3.3241 9.04343 3.64052 9.05363 3.84197 8.86477L7.5 5.43536L11.158 8.86477C11.3595 9.05363 11.6759 9.04343 11.8648 8.84197C12.0536 8.64051 12.0434 8.32409 11.842 8.13523L7.84197 4.38523C7.64964 4.20492 7.35036 4.20492 7.15803 4.38523L3.15803 8.13523C2.95657 8.32409 2.94637 8.64051 3.13523 8.84197Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),pw=["color"],mw=S.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=Hs(e,pw);return S.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:t}),S.createElement("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))});const fs=Uf,ps=$f,Xr=w.forwardRef(({className:e,children:t,...n},r)=>c.jsxs(cc,{ref:r,className:Ae("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[placeholder]:text-muted-foreground [&>span]:line-clamp-1",e),...n,children:[t,c.jsx(Vf,{asChild:!0,children:c.jsx(gc,{className:"h-4 w-4 opacity-50"})})]}));Xr.displayName=cc.displayName;const lp=w.forwardRef(({className:e,...t},n)=>c.jsx(pc,{ref:n,className:Ae("flex cursor-default items-center justify-center py-1",e),...t,children:c.jsx(fw,{className:"h-4 w-4"})}));lp.displayName=pc.displayName;const dp=w.forwardRef(({className:e,...t},n)=>c.jsx(mc,{ref:n,className:Ae("flex cursor-default items-center justify-center py-1",e),...t,children:c.jsx(gc,{className:"h-4 w-4"})}));dp.displayName=mc.displayName;const Jr=w.forwardRef(({className:e,children:t,position:n="popper",...r},i)=>c.jsx(zf,{children:c.jsxs(lc,{ref:i,className:Ae("relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] origin-[--radix-select-content-transform-origin] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[c.jsx(lp,{}),c.jsx(Yf,{className:Ae("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),c.jsx(dp,{})]})}));Jr.displayName=lc.displayName;const hw=w.forwardRef(({className:e,...t},n)=>c.jsx(uc,{ref:n,className:Ae("px-2 py-1.5 text-sm font-semibold",e),...t}));hw.displayName=uc.displayName;const ei=w.forwardRef(({className:e,children:t,...n},r)=>c.jsxs(fc,{ref:r,className:Ae("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[c.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:c.jsx(np,{children:c.jsx(lw,{className:"h-4 w-4"})})}),c.jsx(ep,{children:t})]}));ei.displayName=fc.displayName;const gw=w.forwardRef(({className:e,...t},n)=>c.jsx(hc,{ref:n,className:Ae("-mx-1 my-1 h-px bg-muted",e),...t}));gw.displayName=hc.displayName;function up({open:e,isAccountsLoading:t,accountOptions:n,onConfirm:r,backUrl:i,createAccountUrl:s}){var m;const{t:o}=Le(),[a,l]=S.useState(""),d=a||((m=n[0])==null?void 0:m.login)||"",u=!t&&n.length>0&&d!=="",f=!t&&n.length===0;return c.jsx(yb,{open:e,children:c.jsxs(df,{className:"web-trading-widget-account-modal",onPointerDownOutside:p=>p.preventDefault(),onEscapeKeyDown:p=>p.preventDefault(),children:[c.jsxs(uf,{children:[c.jsx(pf,{children:o("WebTrading.selectTradingAccount")}),c.jsx(mf,{children:o("WebTrading.selectAccountDescription")})]}),t?c.jsx("p",{className:"web-trading-widget-account-modal__loading",children:o("WebTrading.loadingAccounts")}):n.length===0?c.jsx("p",{className:"web-trading-widget-account-modal__error",children:o("WebTrading.noTradingAccounts")}):c.jsxs(fs,{value:d,onValueChange:l,children:[c.jsx(Xr,{className:"web-trading-widget-account-modal__select",children:c.jsx(ps,{placeholder:o("WebTrading.selectAccount")})}),c.jsx(Jr,{children:n.map(p=>c.jsxs(ei,{value:p.login,children:[p.label," (",p.balance.toFixed(2)," ",p.currency,")"]},p.login))})]}),c.jsx(ff,{children:f?c.jsxs(c.Fragment,{children:[i?c.jsx(lt,{asChild:!0,variant:"outline",children:c.jsx("a",{href:i,children:o("WebTrading.back")})}):null,s?c.jsx(lt,{asChild:!0,children:c.jsx("a",{href:s,children:o("WebTrading.createAccount")})}):null]}):c.jsx(lt,{type:"button",disabled:!u,onClick:()=>r(d),children:o("WebTrading.continue")})})]})})}var yw={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const bw=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),dt=(e,t)=>{const n=S.forwardRef(({color:r="currentColor",size:i=24,strokeWidth:s=2,absoluteStrokeWidth:o,children:a,...l},d)=>S.createElement("svg",{ref:d,...yw,width:i,height:i,stroke:r,strokeWidth:o?Number(s)*24/Number(i):s,className:`lucide lucide-${bw(e)}`,...l},[...t.map(([u,f])=>S.createElement(u,f)),...(Array.isArray(a)?a:[a])||[]]));return n.displayName=`${e}`,n},ms=dt("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),vw=dt("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),ww=dt("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),Xo=dt("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),fp=dt("GripHorizontal",[["circle",{cx:"12",cy:"9",r:"1",key:"124mty"}],["circle",{cx:"19",cy:"9",r:"1",key:"1ruzo2"}],["circle",{cx:"5",cy:"9",r:"1",key:"1a8b28"}],["circle",{cx:"12",cy:"15",r:"1",key:"1e56xg"}],["circle",{cx:"19",cy:"15",r:"1",key:"1a92ep"}],["circle",{cx:"5",cy:"15",r:"1",key:"5r1jwy"}]]),pp=dt("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]),xw=dt("ListOrdered",[["line",{x1:"10",x2:"21",y1:"6",y2:"6",key:"76qw6h"}],["line",{x1:"10",x2:"21",y1:"12",y2:"12",key:"16nom4"}],["line",{x1:"10",x2:"21",y1:"18",y2:"18",key:"u3jurt"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]),_w=dt("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]),Sw=dt("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]),Tw=dt("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),Cw=dt("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]),yn=dt("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function Pw(e){const t=Math.round(Math.log10(e));return Number.isFinite(t)&&t>0?t:5}function yc(e){const t=$e(e).toUpperCase();if(t)return Wt.find(n=>{var r,i;return((r=n.resolve_symbol)==null?void 0:r.toUpperCase())===t||((i=n.display_name)==null?void 0:i.toUpperCase())===t||n.ticker.replace(/_/g,"").toUpperCase()===t})}function Ew(e){const t=yc(e);return t!=null&&t.pricescale?Pw(t.pricescale):5}function mp(e,t){if(t)for(const r of["digits","Digits"]){const i=t[r];if(i!=null&&i!==""){const s=Number(i);if(Number.isFinite(s))return Math.round(s)}}const n=$e(e).toUpperCase();return n.includes("XAU")||n.includes("GOLD")?2:n.includes("JPY")?3:5}function kw(e){const t=yc(e);switch(t==null?void 0:t.type){case"commodity":return 100;case"crypto":case"indices":case"stock":return 1;case"forex":default:return 1e5}}const Aw=.1;function hp(e,t,n){return e==="buy"?n-t:t-n}function Ow(e,t,n,r){const i=hp(e,t,n);if(!(!Number.isFinite(i)||i===0)&&!(!Number.isFinite(r)||Math.abs(r)<Aw))return r/i}const bc="USD";function pi(e){return $e(e).toUpperCase()}function zs(e){const t=pi(e);return t.length>=6?t.slice(3):bc}function vc(e){if(e!==bc&&e==="JPY")return"USDJPY"}function Nw(e,t,n,r,i){const s=zs(e),o=vc(s);if(!o)return;if(pi(e)===o){const d=t==="buy"?n:r;return d>0?d:void 0}const a=i[o];if(!a)return;const l=(a.bid+a.ask)/2;return l>0?l:void 0}function Rw(e,t,n,r,i,s,o={}){const a=e==="buy"?n:r;let d=(e==="buy"?a-t:t-a)*i*kw(s);const u=zs(s),f=Nw(s,e,n,r,o);if(f!==void 0)d/=f;else if(u!==bc)return null;return Math.round(d*100)/100}function Lw(e){const t=new Set;for(const n of e){const r=vc(zs(n));r&&pi(n)!==r&&t.add(r)}return[...t]}function Dw(e,t){const n=pi(e);if(n===t)return!0;const r=vc(zs(e));return r===t&&n!==r}function jw(e,t,n,r,i){if(!Dw(e.symbol,t))return e;const s=pi(e.symbol)===t,o=s?n:e.marketBid??e.currentPrice,a=s?r:e.marketAsk??e.currentPrice,l=e.type==="buy"?o:a,d=e.profitPerPriceUnit!==void 0?Math.round(hp(e.type,e.openPrice,l)*e.profitPerPriceUnit*100)/100:Rw(e.type,e.openPrice,o,a,e.volumeLots,e.symbol,i);return{...e,currentPrice:l,marketBid:o,marketAsk:a,profit:d??e.profit}}function $e(e){const t=e.trim();return t?t.replace(/m$/i,""):""}function Ks(e){return $e(e)||"—"}const Xe={BUY:0,SELL:1,BUY_LIMIT:2,SELL_LIMIT:3,BUY_STOP:4,SELL_STOP:5,BUY_STOP_LIMIT:6,SELL_STOP_LIMIT:7},hs=[{mode:"market",label:"Market Execution",orderType:null,isMarket:!0},{mode:"buy_limit",label:"Buy Limit",orderType:Xe.BUY_LIMIT,isMarket:!1},{mode:"sell_limit",label:"Sell Limit",orderType:Xe.SELL_LIMIT,isMarket:!1},{mode:"buy_stop",label:"Buy Stop",orderType:Xe.BUY_STOP,isMarket:!1},{mode:"sell_stop",label:"Sell Stop",orderType:Xe.SELL_STOP,isMarket:!1},{mode:"buy_stop_limit",label:"Buy Stop Limit",orderType:Xe.BUY_STOP_LIMIT,isMarket:!1},{mode:"sell_stop_limit",label:"Sell Stop Limit",orderType:Xe.SELL_STOP_LIMIT,isMarket:!1}];function Gs(e){return hs.find(t=>t.mode===e)??hs[0]}function qs(e){return Gs(e).isMarket}function Jo(e,t){const n=Gs(e);return n.orderType!==null?n.orderType:t==="buy"?Xe.BUY:Xe.SELL}function gs(e){return e%2===1?"sell":"buy"}function wc(e){return e>=Xe.BUY_LIMIT&&e<=Xe.SELL_STOP_LIMIT}function xc(e){return e===Xe.BUY_STOP_LIMIT||e===Xe.SELL_STOP_LIMIT}function gp(e){return e==="buy_stop_limit"||e==="sell_stop_limit"}const Qe={GTC:0,TODAY:1,SPECIFIED:2,SPECIFIED_DAY:3},yp=[{value:Qe.GTC,label:"GTC"},{value:Qe.TODAY,label:"Today"},{value:Qe.SPECIFIED,label:"Specified"},{value:Qe.SPECIFIED_DAY,label:"Specified Day"}];function _c(e){return e===Qe.SPECIFIED}function Sc(e){return e===Qe.SPECIFIED_DAY}const ys={market:"WebTrading.executionMarket",buy_limit:"WebTrading.executionBuyLimit",sell_limit:"WebTrading.executionSellLimit",buy_stop:"WebTrading.executionBuyStop",sell_stop:"WebTrading.executionSellStop",buy_stop_limit:"WebTrading.executionBuyStopLimit",sell_stop_limit:"WebTrading.executionSellStopLimit"},bp={[Qe.GTC]:"WebTrading.expirationGtc",[Qe.TODAY]:"WebTrading.expirationToday",[Qe.SPECIFIED]:"WebTrading.expirationSpecified",[Qe.SPECIFIED_DAY]:"WebTrading.expirationSpecifiedDay"};function Mw(e){return e.map(t=>({login:t.login,label:t.label,balance:t.tradeStat.balance,currency:t.currency}))}function Iw(){if(typeof window>"u")return null;const e=localStorage.getItem(Lu);return(e==null?void 0:e.trim())||null}function Ul(e){if(typeof window>"u")return;const t=e.trim();t&&localStorage.setItem(Lu,t)}function Fw(e,t){var n;return t&&e.some(r=>r.login===t)?t:((n=e[0])==null?void 0:n.login)??""}function Tc(e,t=Wt){return t.find(n=>n.ticker===e)}function Uw(e,t=Wt){var i;const n=$e(e).toUpperCase();if(!n)return null;const r=t.find(s=>{var o;return $e(s.resolve_symbol??"").toUpperCase()===n||((o=s.display_name)==null?void 0:o.toUpperCase())===n||s.ticker.replace(/_/g,"").toUpperCase()===n||s.ticker.toUpperCase()===n});return r?r.ticker:((i=yc(e))==null?void 0:i.ticker)??null}function mi(e,t=Wt){const n=Tc(e,t),r=(n==null?void 0:n.resolve_symbol)??e.replace(/_/g,"");return $e(r).toUpperCase()}function Qs(e,t=Wt){const n=Tc(e,t);return n!=null&&n.resolve_symbol?n.resolve_symbol:e.replace(/_/g,"")}function Vt(e){const t=Math.round(Math.log10(e));return String(Number.isFinite(t)&&t>0?t:5)}function Ht(e,t=Wt){const n=Tc(e,t);return(n==null?void 0:n.pricescale)??1e5}function Ce(e,t){return e.toFixed(t)}function Or(e){return 1/10**e}function Cc(e,t){return e===null||t===null?null:(e+t)/2}function We(e){const t=e.trim();if(!t)return;const n=Number(t);if(!(!Number.isFinite(n)||n<=0))return n}function vp(e,t,n){if(_c(e)){if(!t.trim())return;const r=Date.parse(t);return Number.isFinite(r)?Math.floor(r/1e3):void 0}if(Sc(e)){if(!n.trim())return;const r=Date.parse(`${n}T23:59:59`);return Number.isFinite(r)?Math.floor(r/1e3):void 0}}function Ys(e,t,n){return e===Qe.GTC||e===Qe.TODAY?!0:vp(e,t,n)!==void 0}const Bw={},Bl=e=>{let t;const n=new Set,r=(u,f)=>{const m=typeof u=="function"?u(t):u;if(!Object.is(m,t)){const p=t;t=f??(typeof m!="object"||m===null)?m:Object.assign({},t,m),n.forEach(b=>b(t,p))}},i=()=>t,l={setState:r,getState:i,getInitialState:()=>d,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(Bw?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},d=t=e(r,i,l);return l},Ww=e=>e?Bl(e):Bl;function $w(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ii={exports:{}},xo={},Fi={exports:{}},_o={};/**
|
|
1
|
+
"use strict";var Ul=Object.defineProperty;var ro=e=>{throw TypeError(e)};var Il=(e,t,n)=>t in e?Ul(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Je=(e,t,n)=>Il(e,typeof t!="symbol"?t+"":t,n),_i=(e,t,n)=>t.has(e)||ro("Cannot "+n);var w=(e,t,n)=>(_i(e,t,"read from private field"),n?n.call(e):t.get(e)),ee=(e,t,n)=>t.has(e)?ro("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),B=(e,t,n,r)=>(_i(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),ue=(e,t,n)=>(_i(e,t,"access private method"),n);var _r=(e,t,n,r)=>({set _(i){B(e,t,i,n)},get _(){return w(e,t,r)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),p=require("react");function Fl(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const Ie=Fl(p),Bl=["en","zh","vi","th","ko","ja","mn","ru"],Fr="en";function ri(e){if(!e)return Fr;const t=e.toLowerCase().split("-")[0];return Bl.includes(t)?t:Fr}const Wl={en:"en",zh:"zh",vi:"vi",th:"th",ko:"ko",ja:"ja",mn:"en",ru:"ru"};function $l(e){return Wl[e]}const Vl={symbol:"Symbol",back:"Back",continue:"Continue",error:"Error",selectTradingAccount:"Select trading account",selectAccountDescription:"Choose an account to continue trading on the chart.",loadingAccounts:"Loading accounts…",noTradingAccounts:"No trading accounts available.",selectAccount:"Select account",createAccount:"Create account",ticket:"Ticket",serverTime:"Server time",type:"Type",volume:"Volume",price:"Price",stopLossShort:"S / L",takeProfitShort:"T / P",swap:"Swap",profit:"Profit",comment:"Comment",close:"Close",balance:"Balance",equity:"Equity",margin:"Margin",freeMargin:"Free margin",level:"Level",trade:"Trade",history:"History",terminalPanelTabs:"Terminal panel tabs",closeAll:"Close all",closing:"Closing…",refresh:"Refresh",refreshing:"Refreshing…",refreshDealHistory:"Refresh deal history",notAvailable:"N/A",closePositionTicket:"Close position #{ticket}",closePosition:"Close position",deleteOrderTicket:"Delete order #{ticket}",deleteOrder:"Delete order",resizeTerminalPanel:"Resize terminal panel",loading:"Loading…",noPositions:"You don't have any positions",createNewOrder:"Create New Order",chartSidePanel:"Chart side panel",scanResult:"Scan Result",openTerminal:"Open terminal",orders:"Orders",terminal:"Terminal",closeTerminalPanel:"Close terminal panel",buy:"Buy",sell:"Sell",balanceType:"Balance",credit:"Credit",deal:"Deal",login:"Login",action:"Action",entry:"Entry",time:"Time",localTime:"Local time",entryIn:"IN",entryOut:"OUT",selectAccountForDeals:"Select an account to view deal history",noDealsFound:"No deals found",seeFullDealHistory:"See full deal history",unknownAction:"Action {action}",failedClosePosition:"Failed to close position.",positionClosed:"Position #{ticket} closed at {price}.",closePositionNotConfigured:"Close position is not configured.",onePositionClosed:"1 position closed.",positionsClosed:"{count} positions closed.",failedClosePositions:"Failed to close positions.",closedFailedSummary:"Closed {closed}, failed {failed}.",failedDeleteOrder:"Failed to delete order.",orderDeleted:"Order #{ticket} deleted.",positionUpdated:"Position #{ticket} updated.",stopLoss:"Stop Loss",takeProfit:"Take Profit",stopPrice:"Stop Price",limitPrice:"Limit Price",volumeSetting:"Volume Setting",riskManagement:"Risk Management",expiration:"Expiration",orderExecutionType:"Order execution type",orderExpirationType:"Order expiration type",expirationTime:"Expiration time",expirationDay:"Expiration day",placed:"Placed",closeConfirmation:"Close confirmation",closePositionPanel:"Close position panel",closeOrderPanel:"Close order panel",minimizeToQuickOrder:"Minimize to quick order panel",moveQuickOrderPanel:"Move quick order panel",decreaseVolume:"Decrease volume",increaseVolume:"Increase volume",expandQuickOrderPanel:"Expand quick order panel",collapseQuickOrderPanel:"Collapse quick order panel",searchSymbol:"Search symbol",bid:"Bid",ask:"Ask",lots:"Lots",orderPrice:"Order Price",sellByMarket:"Sell by Market",buyByMarket:"Buy by Market",placeOrder:"Place {label}",selectAccountToTrade:"Select a trading account to start placing orders.",executionMarket:"Market Execution",executionBuyLimit:"Buy Limit",executionSellLimit:"Sell Limit",executionBuyStop:"Buy Stop",executionSellStop:"Sell Stop",executionBuyStopLimit:"Buy Stop Limit",executionSellStopLimit:"Sell Stop Limit",expirationGtc:"GTC",expirationToday:"Today",expirationSpecified:"Specified",expirationSpecifiedDay:"Specified Day",ok:"OK",orderAtPrice:"at {price}",modify:"Modify",failedModifyPosition:"Failed to modify position.",failedModifyOrder:"Failed to modify order.",positionClosedSimple:"Position #{ticket} closed.",orderUpdated:"Order #{ticket} updated.",closePositionDetail:"Close #{ticket} {type} {volume} {symbol} {openPrice} at {closePrice} with Profit {profit}",deleteOrderDetail:"Delete #{ticket} {typeLabel} {volume} {symbol} at {price}",pleaseSelectTradingAccount:"Please select a trading account.",pleaseSetLimitPrice:"Please set a limit price for this order.",pleaseSetOrderPrice:"Please set an order price for pending orders.",pleaseSetStopPrice:"Please set a stop price for stop limit orders.",pleaseSetExpirationDate:"Please set an expiration date for this order.",pleaseSetStopAndLimitPrices:"Please set both stop and limit prices.",failedPlaceOrder:"Failed to place order.",orderNotAccepted:"Order was not accepted.",newOrder:"New Order",selectYourTradingAccount:"Select your trading account",switchingAccount:"Switching account…",activeAccount:"Active"},Hl={WebTrading:Vl},zl={symbol:"代码",back:"返回",continue:"继续",error:"错误",selectTradingAccount:"选择交易账户",selectAccountDescription:"选择一个账户以继续在图表上交易。",loadingAccounts:"正在加载账户…",noTradingAccounts:"暂无可用交易账户。",selectAccount:"选择账户",createAccount:"创建账户",ticket:"订单号",serverTime:"服务器时间",type:"类型",volume:"交易量",price:"价格",stopLossShort:"止损",takeProfitShort:"止盈",swap:"隔夜利息",profit:"利润",comment:"备注",close:"关闭",balance:"余额",equity:"净值",margin:"保证金",freeMargin:"可用保证金",level:"等级",trade:"交易",history:"历史",terminalPanelTabs:"终端面板标签",closeAll:"全部关闭",closing:"正在关闭…",refresh:"刷新",refreshing:"正在刷新…",refreshDealHistory:"刷新交易历史",notAvailable:"不适用",closePositionTicket:"关闭仓位 #{ticket}",closePosition:"关闭仓位",deleteOrderTicket:"删除订单 #{ticket}",deleteOrder:"删除订单",resizeTerminalPanel:"调整终端面板大小",loading:"正在加载…",noPositions:"您当前没有任何仓位",createNewOrder:"创建新订单",chartSidePanel:"图表侧边栏",scanResult:"扫描结果",openTerminal:"打开终端",orders:"订单",terminal:"终端",closeTerminalPanel:"关闭终端面板",buy:"买入",sell:"卖出",balanceType:"余额",credit:"信用额",deal:"成交",login:"登录",action:"操作",entry:"入场",time:"时间",localTime:"本地时间",entryIn:"入",entryOut:"出",selectAccountForDeals:"选择一个账户查看交易历史",noDealsFound:"未找到交易记录",seeFullDealHistory:"查看完整交易历史",unknownAction:"操作 {action}",failedClosePosition:"关闭仓位失败。",positionClosed:"仓位 #{ticket} 已在 {price} 关闭。",closePositionNotConfigured:"关闭仓位功能未配置。",onePositionClosed:"已关闭 1 个仓位。",positionsClosed:"已关闭 {count} 个仓位。",failedClosePositions:"关闭仓位失败。",closedFailedSummary:"已关闭 {closed} 个,失败 {failed} 个。",failedDeleteOrder:"删除订单失败。",orderDeleted:"订单 #{ticket} 已删除。",positionUpdated:"仓位 #{ticket} 已更新。",stopLoss:"止损",takeProfit:"止盈",stopPrice:"止损价格",limitPrice:"限价",volumeSetting:"交易量设置",riskManagement:"风险管理",expiration:"到期时间",orderExecutionType:"订单执行类型",orderExpirationType:"订单到期类型",expirationTime:"到期时间",expirationDay:"到期日期",placed:"已提交",closeConfirmation:"关闭确认",closePositionPanel:"关闭仓位面板",closeOrderPanel:"关闭订单面板",minimizeToQuickOrder:"最小化到快速下单面板",moveQuickOrderPanel:"移动快速下单面板",decreaseVolume:"减少交易量",increaseVolume:"增加交易量",expandQuickOrderPanel:"展开快速下单面板",collapseQuickOrderPanel:"收起快速下单面板",searchSymbol:"搜索交易品种",bid:"卖价",ask:"买价",lots:"手数",orderPrice:"订单价格",sellByMarket:"按市价卖出",buyByMarket:"按市价买入",placeOrder:"下单 {label}",selectAccountToTrade:"请选择一个交易账户以开始下单。",executionMarket:"市价执行",executionBuyLimit:"买入限价",executionSellLimit:"卖出限价",executionBuyStop:"买入止损",executionSellStop:"卖出止损",executionBuyStopLimit:"买入止损限价",executionSellStopLimit:"卖出止损限价",expirationGtc:"永久有效",expirationToday:"今天",expirationSpecified:"指定时间",expirationSpecifiedDay:"指定日期",ok:"确定",orderAtPrice:"于 {price}",modify:"修改",failedModifyPosition:"修改仓位失败。",failedModifyOrder:"修改订单失败。",positionClosedSimple:"仓位 #{ticket} 已关闭。",orderUpdated:"订单 #{ticket} 已更新。",closePositionDetail:"关闭 #{ticket} {type} {volume} {symbol} {openPrice} 于 {closePrice},利润为 {profit}",deleteOrderDetail:"删除 #{ticket} {typeLabel} {volume} {symbol} 于 {price}",pleaseSelectTradingAccount:"请选择一个交易账户。",pleaseSetLimitPrice:"请为此订单设置限价。",pleaseSetOrderPrice:"请为挂单设置订单价格。",pleaseSetStopPrice:"请为止损限价单设置止损价格。",pleaseSetExpirationDate:"请为此订单设置到期日期。",pleaseSetStopAndLimitPrices:"请同时设置止损价格和限价。",failedPlaceOrder:"下单失败。",orderNotAccepted:"订单未被接受。",newOrder:"新订单",selectYourTradingAccount:"选择您的交易账户",switchingAccount:"正在切换账户…",activeAccount:"活跃"},ql={WebTrading:zl},Kl={symbol:"Ký hiệu",back:"Quay lại",continue:"Tiếp tục",error:"Lỗi",selectTradingAccount:"Chọn tài khoản giao dịch",selectAccountDescription:"Chọn một tài khoản để tiếp tục giao dịch trên biểu đồ.",loadingAccounts:"Đang tải tài khoản…",noTradingAccounts:"Không có tài khoản giao dịch nào khả dụng.",selectAccount:"Chọn tài khoản",createAccount:"Tạo tài khoản",ticket:"Mã lệnh",serverTime:"Thời gian máy chủ",type:"Loại",volume:"Khối lượng",price:"Giá",stopLossShort:"S / L",takeProfitShort:"T / P",swap:"Phí qua đêm",profit:"Lợi nhuận",comment:"Ghi chú",close:"Đóng",balance:"Số dư",equity:"Vốn chủ sở hữu",margin:"Ký quỹ",freeMargin:"Ký quỹ khả dụng",level:"Mức",trade:"Giao dịch",history:"Lịch sử",terminalPanelTabs:"Các tab bảng điều khiển",closeAll:"Đóng tất cả",closing:"Đang đóng…",refresh:"Làm mới",refreshing:"Đang làm mới…",refreshDealHistory:"Làm mới lịch sử giao dịch",notAvailable:"Không có",closePositionTicket:"Đóng vị thế #{ticket}",closePosition:"Đóng vị thế",deleteOrderTicket:"Xóa lệnh #{ticket}",deleteOrder:"Xóa lệnh",resizeTerminalPanel:"Thay đổi kích thước bảng điều khiển",loading:"Đang tải…",noPositions:"Bạn không có vị thế nào",createNewOrder:"Tạo lệnh mới",chartSidePanel:"Bảng bên biểu đồ",scanResult:"Kết quả quét",openTerminal:"Mở bảng giao dịch",orders:"Lệnh",terminal:"Bảng giao dịch",closeTerminalPanel:"Đóng bảng giao dịch",buy:"Mua",sell:"Bán",balanceType:"Số dư",credit:"Tín dụng",deal:"Giao dịch",login:"Đăng nhập",action:"Hành động",entry:"Vào lệnh",time:"Thời gian",localTime:"Giờ địa phương",entryIn:"Vào",entryOut:"Ra",selectAccountForDeals:"Chọn một tài khoản để xem lịch sử giao dịch",noDealsFound:"Không tìm thấy giao dịch nào",seeFullDealHistory:"Xem toàn bộ lịch sử giao dịch",unknownAction:"Hành động {action}",failedClosePosition:"Không thể đóng vị thế.",positionClosed:"Vị thế #{ticket} đã được đóng tại {price}.",closePositionNotConfigured:"Chức năng đóng vị thế chưa được cấu hình.",onePositionClosed:"Đã đóng 1 vị thế.",positionsClosed:"Đã đóng {count} vị thế.",failedClosePositions:"Không thể đóng các vị thế.",closedFailedSummary:"Đã đóng {closed}, thất bại {failed}.",failedDeleteOrder:"Không thể xóa lệnh.",orderDeleted:"Lệnh #{ticket} đã được xóa.",positionUpdated:"Vị thế #{ticket} đã được cập nhật.",stopLoss:"Cắt lỗ",takeProfit:"Chốt lời",stopPrice:"Giá dừng",limitPrice:"Giá giới hạn",volumeSetting:"Cài đặt khối lượng",riskManagement:"Quản lý rủi ro",expiration:"Hết hạn",orderExecutionType:"Loại khớp lệnh",orderExpirationType:"Loại hết hạn của lệnh",expirationTime:"Thời gian hết hạn",expirationDay:"Ngày hết hạn",placed:"Đã đặt",closeConfirmation:"Xác nhận đóng",closePositionPanel:"Bảng đóng vị thế",closeOrderPanel:"Bảng đóng lệnh",minimizeToQuickOrder:"Thu nhỏ thành bảng đặt lệnh nhanh",moveQuickOrderPanel:"Di chuyển bảng đặt lệnh nhanh",decreaseVolume:"Giảm khối lượng",increaseVolume:"Tăng khối lượng",expandQuickOrderPanel:"Mở rộng bảng đặt lệnh nhanh",collapseQuickOrderPanel:"Thu gọn bảng đặt lệnh nhanh",searchSymbol:"Tìm kiếm mã giao dịch",bid:"Giá bán",ask:"Giá mua",lots:"Lot",orderPrice:"Giá đặt lệnh",sellByMarket:"Bán theo giá thị trường",buyByMarket:"Mua theo giá thị trường",placeOrder:"Đặt {label}",selectAccountToTrade:"Chọn một tài khoản giao dịch để bắt đầu đặt lệnh.",executionMarket:"Khớp lệnh thị trường",executionBuyLimit:"Buy Limit",executionSellLimit:"Sell Limit",executionBuyStop:"Buy Stop",executionSellStop:"Sell Stop",executionBuyStopLimit:"Buy Stop Limit",executionSellStopLimit:"Sell Stop Limit",expirationGtc:"GTC",expirationToday:"Hôm nay",expirationSpecified:"Chỉ định",expirationSpecifiedDay:"Ngày chỉ định",ok:"OK",orderAtPrice:"tại {price}",modify:"Chỉnh sửa",failedModifyPosition:"Không thể chỉnh sửa vị thế.",failedModifyOrder:"Không thể chỉnh sửa lệnh.",positionClosedSimple:"Vị thế #{ticket} đã được đóng.",orderUpdated:"Lệnh #{ticket} đã được cập nhật.",closePositionDetail:"Đóng #{ticket} {type} {volume} {symbol} từ {openPrice} tại {closePrice} với lợi nhuận {profit}",deleteOrderDetail:"Xóa #{ticket} {typeLabel} {volume} {symbol} tại {price}",pleaseSelectTradingAccount:"Vui lòng chọn một tài khoản giao dịch.",pleaseSetLimitPrice:"Vui lòng đặt giá giới hạn cho lệnh này.",pleaseSetOrderPrice:"Vui lòng đặt giá cho các lệnh chờ.",pleaseSetStopPrice:"Vui lòng đặt giá dừng cho các lệnh stop limit.",pleaseSetExpirationDate:"Vui lòng đặt ngày hết hạn cho lệnh này.",pleaseSetStopAndLimitPrices:"Vui lòng đặt cả giá dừng và giá giới hạn.",failedPlaceOrder:"Không thể đặt lệnh.",orderNotAccepted:"Lệnh không được chấp nhận.",newOrder:"Lệnh mới",selectYourTradingAccount:"Chọn tài khoản giao dịch của bạn",switchingAccount:"Đang chuyển tài khoản…",activeAccount:"Đang hoạt động"},Gl={WebTrading:Kl},Ql={symbol:"สัญลักษณ์",back:"กลับ",continue:"ดำเนินการต่อ",error:"ข้อผิดพลาด",selectTradingAccount:"เลือกบัญชีซื้อขาย",selectAccountDescription:"เลือกบัญชีเพื่อดำเนินการซื้อขายบนกราฟต่อ",loadingAccounts:"กำลังโหลดบัญชี…",noTradingAccounts:"ไม่มีบัญชีซื้อขายที่ใช้งานได้",selectAccount:"เลือกบัญชี",createAccount:"สร้างบัญชี",ticket:"หมายเลขคำสั่ง",serverTime:"เวลาของเซิร์ฟเวอร์",type:"ประเภท",volume:"ปริมาณ",price:"ราคา",stopLossShort:"S / L",takeProfitShort:"T / P",swap:"สวอป",profit:"กำไร",comment:"หมายเหตุ",close:"ปิด",balance:"ยอดคงเหลือ",equity:"ส่วนของผู้ถือหุ้น",margin:"มาร์จิ้น",freeMargin:"มาร์จิ้นคงเหลือ",level:"ระดับ",trade:"ซื้อขาย",history:"ประวัติ",terminalPanelTabs:"แท็บแผงเทอร์มินัล",closeAll:"ปิดทั้งหมด",closing:"กำลังปิด…",refresh:"รีเฟรช",refreshing:"กำลังรีเฟรช…",refreshDealHistory:"รีเฟรชประวัติการซื้อขาย",notAvailable:"ไม่มีข้อมูล",closePositionTicket:"ปิดสถานะ #{ticket}",closePosition:"ปิดสถานะ",deleteOrderTicket:"ลบคำสั่ง #{ticket}",deleteOrder:"ลบคำสั่ง",resizeTerminalPanel:"ปรับขนาดแผงเทอร์มินัล",loading:"กำลังโหลด…",noPositions:"คุณไม่มีสถานะใด ๆ",createNewOrder:"สร้างคำสั่งใหม่",chartSidePanel:"แผงด้านข้างกราฟ",scanResult:"ผลการสแกน",openTerminal:"เปิดเทอร์มินัล",orders:"คำสั่งซื้อขาย",terminal:"เทอร์มินัล",closeTerminalPanel:"ปิดแผงเทอร์มินัล",buy:"ซื้อ",sell:"ขาย",balanceType:"ยอดคงเหลือ",credit:"เครดิต",deal:"ดีล",login:"เข้าสู่ระบบ",action:"การดำเนินการ",entry:"รายการ",time:"เวลา",localTime:"เวลาท้องถิ่น",entryIn:"เข้า",entryOut:"ออก",selectAccountForDeals:"เลือกบัญชีเพื่อดูประวัติการซื้อขาย",noDealsFound:"ไม่พบรายการซื้อขาย",seeFullDealHistory:"ดูประวัติการซื้อขายทั้งหมด",unknownAction:"การดำเนินการ {action}",failedClosePosition:"ไม่สามารถปิดสถานะได้",positionClosed:"สถานะ #{ticket} ถูกปิดที่ราคา {price}",closePositionNotConfigured:"ยังไม่ได้ตั้งค่าการปิดสถานะ",onePositionClosed:"ปิดสถานะแล้ว 1 รายการ",positionsClosed:"ปิดสถานะแล้ว {count} รายการ",failedClosePositions:"ไม่สามารถปิดสถานะได้",closedFailedSummary:"ปิดแล้ว {closed} รายการ ล้มเหลว {failed} รายการ",failedDeleteOrder:"ไม่สามารถลบคำสั่งได้",orderDeleted:"ลบคำสั่ง #{ticket} แล้ว",positionUpdated:"สถานะ #{ticket} ได้รับการอัปเดตแล้ว",stopLoss:"หยุดขาดทุน",takeProfit:"ทำกำไร",stopPrice:"ราคาหยุด",limitPrice:"ราคาจำกัด",volumeSetting:"การตั้งค่าปริมาณ",riskManagement:"การจัดการความเสี่ยง",expiration:"วันหมดอายุ",orderExecutionType:"ประเภทการดำเนินการคำสั่ง",orderExpirationType:"ประเภทวันหมดอายุของคำสั่ง",expirationTime:"เวลาหมดอายุ",expirationDay:"วันหมดอายุ",placed:"ส่งแล้ว",closeConfirmation:"ยืนยันการปิด",closePositionPanel:"แผงปิดสถานะ",closeOrderPanel:"แผงปิดคำสั่ง",minimizeToQuickOrder:"ย่อเป็นแผงคำสั่งด่วน",moveQuickOrderPanel:"ย้ายแผงคำสั่งด่วน",decreaseVolume:"ลดปริมาณ",increaseVolume:"เพิ่มปริมาณ",expandQuickOrderPanel:"ขยายแผงคำสั่งด่วน",collapseQuickOrderPanel:"ยุบแผงคำสั่งด่วน",searchSymbol:"ค้นหาสัญลักษณ์",bid:"ราคาขาย",ask:"ราคาซื้อ",lots:"ล็อต",orderPrice:"ราคาคำสั่ง",sellByMarket:"ขายตามราคาตลาด",buyByMarket:"ซื้อตามราคาตลาด",placeOrder:"ส่งคำสั่ง {label}",selectAccountToTrade:"เลือกบัญชีซื้อขายเพื่อเริ่มส่งคำสั่ง",executionMarket:"ดำเนินการตามราคาตลาด",executionBuyLimit:"Buy Limit",executionSellLimit:"Sell Limit",executionBuyStop:"Buy Stop",executionSellStop:"Sell Stop",executionBuyStopLimit:"Buy Stop Limit",executionSellStopLimit:"Sell Stop Limit",expirationGtc:"GTC",expirationToday:"วันนี้",expirationSpecified:"กำหนดเอง",expirationSpecifiedDay:"วันที่กำหนด",ok:"ตกลง",orderAtPrice:"ที่ราคา {price}",modify:"แก้ไข",failedModifyPosition:"ไม่สามารถแก้ไขสถานะได้",failedModifyOrder:"ไม่สามารถแก้ไขคำสั่งได้",positionClosedSimple:"สถานะ #{ticket} ถูกปิดแล้ว",orderUpdated:"คำสั่ง #{ticket} ได้รับการอัปเดตแล้ว",closePositionDetail:"ปิด #{ticket} {type} {volume} {symbol} {openPrice} ที่ {closePrice} ด้วยกำไร {profit}",deleteOrderDetail:"ลบ #{ticket} {typeLabel} {volume} {symbol} ที่ราคา {price}",pleaseSelectTradingAccount:"กรุณาเลือกบัญชีซื้อขาย",pleaseSetLimitPrice:"กรุณากำหนดราคาจำกัดสำหรับคำสั่งนี้",pleaseSetOrderPrice:"กรุณากำหนดราคาสำหรับคำสั่งรอดำเนินการ",pleaseSetStopPrice:"กรุณากำหนดราคาหยุดสำหรับคำสั่ง Stop Limit",pleaseSetExpirationDate:"กรุณากำหนดวันหมดอายุสำหรับคำสั่งนี้",pleaseSetStopAndLimitPrices:"กรุณากำหนดทั้งราคาหยุดและราคาจำกัด",failedPlaceOrder:"ไม่สามารถส่งคำสั่งได้",orderNotAccepted:"คำสั่งไม่ได้รับการยอมรับ",newOrder:"คำสั่งใหม่",selectYourTradingAccount:"เลือกบัญชีซื้อขายของคุณ",switchingAccount:"กำลังสลับบัญชี…",activeAccount:"ใช้งานอยู่"},Zl={WebTrading:Ql},Yl={symbol:"심볼",back:"뒤로",continue:"계속",error:"오류",selectTradingAccount:"거래 계좌 선택",selectAccountDescription:"차트에서 거래를 계속하려면 계좌를 선택하세요.",loadingAccounts:"계좌를 불러오는 중…",noTradingAccounts:"사용 가능한 거래 계좌가 없습니다.",selectAccount:"계좌 선택",createAccount:"계좌 생성",ticket:"티켓",serverTime:"서버 시간",type:"유형",volume:"거래량",price:"가격",stopLossShort:"손절가",takeProfitShort:"이익실현가",swap:"스왑",profit:"수익",comment:"메모",close:"닫기",balance:"잔액",equity:"순자산",margin:"증거금",freeMargin:"사용 가능 증거금",level:"수준",trade:"거래",history:"내역",terminalPanelTabs:"터미널 패널 탭",closeAll:"모두 닫기",closing:"닫는 중…",refresh:"새로고침",refreshing:"새로고침 중…",refreshDealHistory:"거래 내역 새로고침",notAvailable:"해당 없음",closePositionTicket:"포지션 닫기 #{ticket}",closePosition:"포지션 닫기",deleteOrderTicket:"주문 삭제 #{ticket}",deleteOrder:"주문 삭제",resizeTerminalPanel:"터미널 패널 크기 조정",loading:"불러오는 중…",noPositions:"보유 중인 포지션이 없습니다",createNewOrder:"새 주문 생성",chartSidePanel:"차트 사이드 패널",scanResult:"스캔 결과",openTerminal:"터미널 열기",orders:"주문",terminal:"터미널",closeTerminalPanel:"터미널 패널 닫기",buy:"매수",sell:"매도",balanceType:"잔액",credit:"크레딧",deal:"거래",login:"로그인",action:"작업",entry:"진입",time:"시간",localTime:"현지 시간",entryIn:"진입",entryOut:"청산",selectAccountForDeals:"거래 내역을 보려면 계좌를 선택하세요",noDealsFound:"거래 내역이 없습니다",seeFullDealHistory:"전체 거래 내역 보기",unknownAction:"작업 {action}",failedClosePosition:"포지션을 닫지 못했습니다.",positionClosed:"포지션 #{ticket}이(가) {price}에 청산되었습니다.",closePositionNotConfigured:"포지션 닫기가 구성되지 않았습니다.",onePositionClosed:"1개의 포지션이 청산되었습니다.",positionsClosed:"{count}개의 포지션이 청산되었습니다.",failedClosePositions:"포지션을 닫지 못했습니다.",closedFailedSummary:"{closed}개 청산, {failed}개 실패.",failedDeleteOrder:"주문을 삭제하지 못했습니다.",orderDeleted:"주문 #{ticket}이(가) 삭제되었습니다.",positionUpdated:"포지션 #{ticket}이(가) 업데이트되었습니다.",stopLoss:"손절",takeProfit:"이익실현",stopPrice:"스톱 가격",limitPrice:"지정가",volumeSetting:"거래량 설정",riskManagement:"위험 관리",expiration:"만료",orderExecutionType:"주문 실행 유형",orderExpirationType:"주문 만료 유형",expirationTime:"만료 시간",expirationDay:"만료 날짜",placed:"접수됨",closeConfirmation:"청산 확인",closePositionPanel:"포지션 닫기 패널",closeOrderPanel:"주문 닫기 패널",minimizeToQuickOrder:"빠른 주문 패널로 최소화",moveQuickOrderPanel:"빠른 주문 패널 이동",decreaseVolume:"거래량 감소",increaseVolume:"거래량 증가",expandQuickOrderPanel:"빠른 주문 패널 확장",collapseQuickOrderPanel:"빠른 주문 패널 축소",searchSymbol:"심볼 검색",bid:"매도호가",ask:"매수호가",lots:"랏",orderPrice:"주문 가격",sellByMarket:"시장가 매도",buyByMarket:"시장가 매수",placeOrder:"{label} 주문",selectAccountToTrade:"주문을 시작하려면 거래 계좌를 선택하세요.",executionMarket:"시장가 실행",executionBuyLimit:"매수 지정가",executionSellLimit:"매도 지정가",executionBuyStop:"매수 스톱",executionSellStop:"매도 스톱",executionBuyStopLimit:"매수 스톱 지정가",executionSellStopLimit:"매도 스톱 지정가",expirationGtc:"GTC",expirationToday:"오늘",expirationSpecified:"지정",expirationSpecifiedDay:"지정일",ok:"확인",orderAtPrice:"{price}에서",modify:"수정",failedModifyPosition:"포지션을 수정하지 못했습니다.",failedModifyOrder:"주문을 수정하지 못했습니다.",positionClosedSimple:"포지션 #{ticket}이(가) 청산되었습니다.",orderUpdated:"주문 #{ticket}이(가) 업데이트되었습니다.",closePositionDetail:"#{ticket} {type} {volume} {symbol} {openPrice}를 {closePrice}에서 청산, 수익 {profit}",deleteOrderDetail:"#{ticket} {typeLabel} {volume} {symbol}을 {price}에서 삭제",pleaseSelectTradingAccount:"거래 계좌를 선택하세요.",pleaseSetLimitPrice:"이 주문의 지정가를 설정하세요.",pleaseSetOrderPrice:"대기 주문의 가격을 설정하세요.",pleaseSetStopPrice:"스톱 지정가 주문의 스톱 가격을 설정하세요.",pleaseSetExpirationDate:"이 주문의 만료일을 설정하세요.",pleaseSetStopAndLimitPrices:"스톱 가격과 지정가를 모두 설정하세요.",failedPlaceOrder:"주문을 접수하지 못했습니다.",orderNotAccepted:"주문이 승인되지 않았습니다.",newOrder:"새 주문",selectYourTradingAccount:"거래 계좌 선택",switchingAccount:"계좌 전환 중…",activeAccount:"활성화됨"},Jl={WebTrading:Yl},Xl={symbol:"シンボル",back:"戻る",continue:"続行",error:"エラー",selectTradingAccount:"取引口座を選択",selectAccountDescription:"チャートで取引を続けるための口座を選択してください。",loadingAccounts:"口座を読み込み中…",noTradingAccounts:"利用可能な取引口座がありません。",selectAccount:"口座を選択",createAccount:"口座を作成",ticket:"チケット",serverTime:"サーバー時間",type:"タイプ",volume:"数量",price:"価格",stopLossShort:"損切り",takeProfitShort:"利確",swap:"スワップ",profit:"利益",comment:"コメント",close:"閉じる",balance:"残高",equity:"有効証拠金",margin:"証拠金",freeMargin:"余剰証拠金",level:"レベル",trade:"取引",history:"履歴",terminalPanelTabs:"ターミナルパネルのタブ",closeAll:"すべて閉じる",closing:"閉じています…",refresh:"更新",refreshing:"更新中…",refreshDealHistory:"取引履歴を更新",notAvailable:"該当なし",closePositionTicket:"ポジションを閉じる #{ticket}",closePosition:"ポジションを閉じる",deleteOrderTicket:"注文を削除 #{ticket}",deleteOrder:"注文を削除",resizeTerminalPanel:"ターミナルパネルのサイズを変更",loading:"読み込み中…",noPositions:"保有中のポジションはありません",createNewOrder:"新規注文を作成",chartSidePanel:"チャートサイドパネル",scanResult:"スキャン結果",openTerminal:"ターミナルを開く",orders:"注文",terminal:"ターミナル",closeTerminalPanel:"ターミナルパネルを閉じる",buy:"買い",sell:"売り",balanceType:"残高",credit:"クレジット",deal:"取引",login:"ログイン",action:"操作",entry:"エントリー",time:"時間",localTime:"現地時間",entryIn:"入場",entryOut:"出場",selectAccountForDeals:"取引履歴を表示するには口座を選択してください",noDealsFound:"取引履歴が見つかりません",seeFullDealHistory:"すべての取引履歴を表示",unknownAction:"操作 {action}",failedClosePosition:"ポジションを閉じられませんでした。",positionClosed:"ポジション #{ticket} は {price} で決済されました。",closePositionNotConfigured:"ポジションを閉じる機能が設定されていません。",onePositionClosed:"1件のポジションが決済されました。",positionsClosed:"{count}件のポジションが決済されました。",failedClosePositions:"ポジションを閉じられませんでした。",closedFailedSummary:"{closed}件決済、{failed}件失敗しました。",failedDeleteOrder:"注文を削除できませんでした。",orderDeleted:"注文 #{ticket} が削除されました。",positionUpdated:"ポジション #{ticket} が更新されました。",stopLoss:"損切り",takeProfit:"利確",stopPrice:"ストップ価格",limitPrice:"指値価格",volumeSetting:"数量設定",riskManagement:"リスク管理",expiration:"有効期限",orderExecutionType:"注文執行タイプ",orderExpirationType:"注文の有効期限タイプ",expirationTime:"有効期限時間",expirationDay:"有効期限日",placed:"発注済み",closeConfirmation:"決済確認",closePositionPanel:"ポジション決済パネル",closeOrderPanel:"注文決済パネル",minimizeToQuickOrder:"クイック注文パネルに最小化",moveQuickOrderPanel:"クイック注文パネルを移動",decreaseVolume:"数量を減らす",increaseVolume:"数量を増やす",expandQuickOrderPanel:"クイック注文パネルを展開",collapseQuickOrderPanel:"クイック注文パネルを折りたたむ",searchSymbol:"シンボルを検索",bid:"売値",ask:"買値",lots:"ロット",orderPrice:"注文価格",sellByMarket:"成行売り",buyByMarket:"成行買い",placeOrder:"{label}を発注",selectAccountToTrade:"注文を開始するには取引口座を選択してください。",executionMarket:"成行執行",executionBuyLimit:"買い指値",executionSellLimit:"売り指値",executionBuyStop:"買い逆指値",executionSellStop:"売り逆指値",executionBuyStopLimit:"買い逆指値指値",executionSellStopLimit:"売り逆指値指値",expirationGtc:"GTC",expirationToday:"今日",expirationSpecified:"指定",expirationSpecifiedDay:"指定日",ok:"OK",orderAtPrice:"{price}で",modify:"変更",failedModifyPosition:"ポジションを変更できませんでした。",failedModifyOrder:"注文を変更できませんでした。",positionClosedSimple:"ポジション #{ticket} が決済されました。",orderUpdated:"注文 #{ticket} が更新されました。",closePositionDetail:"#{ticket} {type} {volume} {symbol} {openPrice} を {closePrice} で決済、利益 {profit}",deleteOrderDetail:"#{ticket} {typeLabel} {volume} {symbol} を {price} で削除",pleaseSelectTradingAccount:"取引口座を選択してください。",pleaseSetLimitPrice:"この注文の指値価格を設定してください。",pleaseSetOrderPrice:"保留注文の価格を設定してください。",pleaseSetStopPrice:"逆指値指値注文のストップ価格を設定してください。",pleaseSetExpirationDate:"この注文の有効期限を設定してください。",pleaseSetStopAndLimitPrices:"ストップ価格と指値価格の両方を設定してください。",failedPlaceOrder:"注文を発注できませんでした。",orderNotAccepted:"注文は受け付けられませんでした。",newOrder:"新規注文",selectYourTradingAccount:"取引口座を選択",switchingAccount:"口座を切り替え中…",activeAccount:"有効"},ed={WebTrading:Xl},td={symbol:"Симбол",back:"Буцах",continue:"Үргэлжлүүлэх",error:"Алдаа",selectTradingAccount:"Арилжааны данс сонгох",selectAccountDescription:"График дээр арилжаагаа үргэлжлүүлэхийн тулд данс сонгоно уу.",loadingAccounts:"Дансуудыг ачаалж байна…",noTradingAccounts:"Боломжтой арилжааны данс алга.",selectAccount:"Данс сонгох",createAccount:"Данс үүсгэх",ticket:"Тасалбар",serverTime:"Серверийн цаг",type:"Төрөл",volume:"Хэмжээ",price:"Үнэ",stopLossShort:"S/L",takeProfitShort:"T/P",swap:"Своп",profit:"Ашиг",comment:"Тайлбар",close:"Хаах",balance:"Үлдэгдэл",equity:"Equity",margin:"Маржин",freeMargin:"Free маржин",level:"Түвшин",trade:"Арилжаа",history:"Түүх",terminalPanelTabs:"Терминалын самбарын табууд",closeAll:"Бүгдийг хаах",closing:"Хааж байна…",refresh:"Сэргээх",refreshing:"Сэргээж байна…",refreshDealHistory:"Хэлцлийн түүхийг сэргээх",notAvailable:"Байхгүй",closePositionTicket:"Позици хаах #{ticket}",closePosition:"Позици хаах",deleteOrderTicket:"Захиалга устгах #{ticket}",deleteOrder:"Захиалга устгах",resizeTerminalPanel:"Терминалын самбарын хэмжээг өөрчлөх",loading:"Ачаалж байна…",noPositions:"Танд нээлттэй позици алга",createNewOrder:"Шинэ захиалга үүсгэх",chartSidePanel:"Графикийн хажуугийн самбар",scanResult:"Сканны үр дүн",openTerminal:"Терминал нээх",orders:"Захиалгууд",terminal:"Терминал",closeTerminalPanel:"Терминалын самбарыг хаах",buy:"Худалдан авах",sell:"Зарах",balanceType:"Үлдэгдэл",credit:"Кредит",deal:"Хэлцэл",login:"Нэвтрэх",action:"Үйлдэл",entry:"Нэвтрэлт",time:"Цаг",localTime:"Орон нутгийн цаг",entryIn:"ОРСОН",entryOut:"ГАРСАН",selectAccountForDeals:"Хэлцлийн түүхийг харахын тулд данс сонгоно уу",noDealsFound:"Хэлцэл олдсонгүй",seeFullDealHistory:"Бүтэн хэлцлийн түүхийг харах",unknownAction:"Үйлдэл {action}",failedClosePosition:"Позици хааж чадсангүй.",positionClosed:"Позици #{ticket} {price} үнээр хаагдлаа.",closePositionNotConfigured:"Позици хаах тохиргоо хийгдээгүй байна.",onePositionClosed:"1 позици хаагдлаа.",positionsClosed:"{count} позици хаагдлаа.",failedClosePositions:"Позициудыг хааж чадсангүй.",closedFailedSummary:"{closed} хаагдсан, {failed} амжилтгүй.",failedDeleteOrder:"Захиалга устгаж чадсангүй.",orderDeleted:"Захиалга #{ticket} устгагдлаа.",positionUpdated:"Позици #{ticket} шинэчлэгдлээ.",stopLoss:"Стоп-лосс",takeProfit:"Тейк-профит",stopPrice:"Стоп үнэ",limitPrice:"Лимит үнэ",volumeSetting:"Хэмжээний тохиргоо",riskManagement:"Эрсдэлийн удирдлага",expiration:"Хүчинтэй хугацаа",orderExecutionType:"Захиалга гүйцэтгэх төрөл",orderExpirationType:"Захиалгын хугацааны төрөл",expirationTime:"Дуусах цаг",expirationDay:"Дуусах өдөр",placed:"Илгээгдсэн",closeConfirmation:"Хаах баталгаажуулалт",closePositionPanel:"Позици хаах самбар",closeOrderPanel:"Захиалга хаах самбар",minimizeToQuickOrder:"Хурдан захиалгын самбар болгон жижигрүүлэх",moveQuickOrderPanel:"Хурдан захиалгын самбарыг зөөх",decreaseVolume:"Хэмжээг багасгах",increaseVolume:"Хэмжээг нэмэх",expandQuickOrderPanel:"Хурдан захиалгын самбарыг дэлгэх",collapseQuickOrderPanel:"Хурдан захиалгын самбарыг хумих",searchSymbol:"Симбол хайх",bid:"Bid",ask:"Ask",lots:"Лот",orderPrice:"Захиалгын үнэ",sellByMarket:"Зах зээлийн үнээр зарах",buyByMarket:"Зах зээлийн үнээр худалдаж авах",placeOrder:"{label} байрлуулах",selectAccountToTrade:"Захиалга байршуулж эхлэхийн тулд арилжааны данс сонгоно уу.",executionMarket:"Зах зээлийн гүйцэтгэл",executionBuyLimit:"Худалдан авах лимит",executionSellLimit:"Зарах лимит",executionBuyStop:"Худалдан авах стоп",executionSellStop:"Зарах стоп",executionBuyStopLimit:"Худалдан авах стоп лимит",executionSellStopLimit:"Зарах стоп лимит",expirationGtc:"GTC",expirationToday:"Өнөөдөр",expirationSpecified:"Тодорхой хугацаа",expirationSpecifiedDay:"Тодорхой өдөр",ok:"OK",orderAtPrice:"{price} үнээр",modify:"Засах",failedModifyPosition:"Позици өөрчилж чадсангүй.",failedModifyOrder:"Захиалга өөрчилж чадсангүй.",positionClosedSimple:"Позици #{ticket} хаагдлаа.",orderUpdated:"Захиалга #{ticket} шинэчлэгдлээ.",closePositionDetail:"#{ticket} {type} {volume} {symbol} {openPrice}-ийг {closePrice} үнээр хааж, {profit} ашигтай болсон",deleteOrderDetail:"#{ticket} {typeLabel} {volume} {symbol}-ийг {price} үнээр устгах",pleaseSelectTradingAccount:"Арилжааны данс сонгоно уу.",pleaseSetLimitPrice:"Энэ захиалгад лимит үнэ оруулна уу.",pleaseSetOrderPrice:"Хүлээгдэж буй захиалгад үнэ оруулна уу.",pleaseSetStopPrice:"Стоп лимит захиалгад стоп үнэ оруулна уу.",pleaseSetExpirationDate:"Энэ захиалгад дуусах хугацаа оруулна уу.",pleaseSetStopAndLimitPrices:"Стоп болон лимит үнийг хоёуланг нь оруулна уу.",failedPlaceOrder:"Захиалга байршуулж чадсангүй.",orderNotAccepted:"Захиалгыг зөвшөөрсөнгүй.",newOrder:"Шинэ захиалга",selectYourTradingAccount:"Арилжааны дансаа сонгоно уу",switchingAccount:"Данс сольж байна…",activeAccount:"Идэвхтэй"},nd={WebTrading:td},rd={symbol:"Символ",back:"Назад",continue:"Продолжить",error:"Ошибка",selectTradingAccount:"Выберите торговый счет",selectAccountDescription:"Выберите счет, чтобы продолжить торговлю на графике.",loadingAccounts:"Загрузка счетов…",noTradingAccounts:"Нет доступных торговых счетов.",selectAccount:"Выбрать счет",createAccount:"Создать счет",ticket:"Тикет",serverTime:"Время сервера",type:"Тип",volume:"Объем",price:"Цена",stopLossShort:"S / L",takeProfitShort:"T / P",swap:"Своп",profit:"Прибыль",comment:"Комментарий",close:"Закрыть",balance:"Баланс",equity:"Собственный капитал",margin:"Маржа",freeMargin:"Свободная маржа",level:"Уровень",trade:"Торговля",history:"История",terminalPanelTabs:"Вкладки панели терминала",closeAll:"Закрыть все",closing:"Закрытие…",refresh:"Обновить",refreshing:"Обновление…",refreshDealHistory:"Обновить историю сделок",notAvailable:"Н/Д",closePositionTicket:"Закрыть позицию #{ticket}",closePosition:"Закрыть позицию",deleteOrderTicket:"Удалить ордер #{ticket}",deleteOrder:"Удалить ордер",resizeTerminalPanel:"Изменить размер панели терминала",loading:"Загрузка…",noPositions:"У вас нет открытых позиций",createNewOrder:"Создать новый ордер",chartSidePanel:"Боковая панель графика",scanResult:"Результат сканирования",openTerminal:"Открыть терминал",orders:"Ордеры",terminal:"Терминал",closeTerminalPanel:"Закрыть панель терминала",buy:"Покупка",sell:"Продажа",balanceType:"Баланс",credit:"Кредит",deal:"Сделка",login:"Вход",action:"Действие",entry:"Вход",time:"Время",localTime:"Местное время",entryIn:"ВХОД",entryOut:"ВЫХОД",selectAccountForDeals:"Выберите счет для просмотра истории сделок",noDealsFound:"Сделки не найдены",seeFullDealHistory:"Посмотреть полную историю сделок",unknownAction:"Действие {action}",failedClosePosition:"Не удалось закрыть позицию.",positionClosed:"Позиция #{ticket} закрыта по цене {price}.",closePositionNotConfigured:"Функция закрытия позиции не настроена.",onePositionClosed:"Закрыта 1 позиция.",positionsClosed:"Закрыто {count} позиций.",failedClosePositions:"Не удалось закрыть позиции.",closedFailedSummary:"Закрыто {closed}, не удалось {failed}.",failedDeleteOrder:"Не удалось удалить ордер.",orderDeleted:"Ордер #{ticket} удален.",positionUpdated:"Позиция #{ticket} обновлена.",stopLoss:"Стоп-лосс",takeProfit:"Тейк-профит",stopPrice:"Стоп-цена",limitPrice:"Лимитная цена",volumeSetting:"Настройка объема",riskManagement:"Управление рисками",expiration:"Срок действия",orderExecutionType:"Тип исполнения ордера",orderExpirationType:"Тип истечения ордера",expirationTime:"Время истечения",expirationDay:"Дата истечения",placed:"Размещено",closeConfirmation:"Подтверждение закрытия",closePositionPanel:"Панель закрытия позиции",closeOrderPanel:"Панель закрытия ордера",minimizeToQuickOrder:"Свернуть в панель быстрого ордера",moveQuickOrderPanel:"Переместить панель быстрого ордера",decreaseVolume:"Уменьшить объем",increaseVolume:"Увеличить объем",expandQuickOrderPanel:"Развернуть панель быстрого ордера",collapseQuickOrderPanel:"Свернуть панель быстрого ордера",searchSymbol:"Поиск символа",bid:"Цена Bid",ask:"Цена Ask",lots:"Лоты",orderPrice:"Цена ордера",sellByMarket:"Продать по рынку",buyByMarket:"Купить по рынку",placeOrder:"Разместить {label}",selectAccountToTrade:"Выберите торговый счет для размещения ордеров.",executionMarket:"Рыночное исполнение",executionBuyLimit:"Лимит на покупку",executionSellLimit:"Лимит на продажу",executionBuyStop:"Стоп на покупку",executionSellStop:"Стоп на продажу",executionBuyStopLimit:"Стоп-лимит на покупку",executionSellStopLimit:"Стоп-лимит на продажу",expirationGtc:"GTC",expirationToday:"Сегодня",expirationSpecified:"Указанный",expirationSpecifiedDay:"Указанный день",ok:"OK",orderAtPrice:"по цене {price}",modify:"Изменить",failedModifyPosition:"Не удалось изменить позицию.",failedModifyOrder:"Не удалось изменить ордер.",positionClosedSimple:"Позиция #{ticket} закрыта.",orderUpdated:"Ордер #{ticket} обновлен.",closePositionDetail:"Закрытие #{ticket} {type} {volume} {symbol} {openPrice} по {closePrice} с прибылью {profit}",deleteOrderDetail:"Удалить #{ticket} {typeLabel} {volume} {symbol} по цене {price}",pleaseSelectTradingAccount:"Пожалуйста, выберите торговый счет.",pleaseSetLimitPrice:"Пожалуйста, задайте лимитную цену для этого ордера.",pleaseSetOrderPrice:"Пожалуйста, задайте цену для отложенных ордеров.",pleaseSetStopPrice:"Пожалуйста, задайте стоп-цену для стоп-лимитных ордеров.",pleaseSetExpirationDate:"Пожалуйста, задайте дату истечения для этого ордера.",pleaseSetStopAndLimitPrices:"Пожалуйста, задайте и стоп-цену, и лимитную цену.",failedPlaceOrder:"Не удалось разместить ордер.",orderNotAccepted:"Ордер не был принят.",newOrder:"Новый ордер",selectYourTradingAccount:"Выберите свой торговый счет",switchingAccount:"Переключение счета…",activeAccount:"Активен"},id={WebTrading:rd},io={en:Hl,zh:ql,vi:Gl,th:Zl,ko:Jl,ja:ed,mn:nd,ru:id};function so(e,t){const n=t.split(".");let r=e;for(const i of n){if(!r||typeof r!="object"||!(i in r))return;r=r[i]}return typeof r=="string"?r:void 0}function sd(e,t){return t?e.replace(/\{(\w+)\}/g,(n,r)=>t[r]!=null?String(t[r]):`{${r}}`):e}function Gn(e,t,n){const r=so(io[e],t)??so(io.en,t)??t;return sd(r,n)}const Za=p.createContext({language:Fr,t:(e,t)=>Gn(Fr,e,t)});function Ya({language:e,children:t}){const n=p.useMemo(()=>{const r=ri(e);return{language:r,t:(i,s)=>Gn(r,i,s)}},[e]);return c.jsx(Za.Provider,{value:n,children:t})}function Te(){return p.useContext(Za)}function ht(...e){return e.filter(Boolean).join(" ")}function od({open:e,children:t,className:n,onPointerDownOutside:r,onEscapeKeyDown:i}){return e?c.jsxs("div",{className:"web-trading-widget-dialog",role:"dialog","aria-modal":"true",children:[c.jsx("div",{className:"web-trading-widget-dialog__overlay",onPointerDown:s=>r==null?void 0:r(s.nativeEvent)}),c.jsx("div",{className:ht("web-trading-widget-dialog__content",n),children:t})]}):null}function ad({className:e,...t}){return c.jsx("div",{className:ht("web-trading-widget-dialog__header",e),...t})}function cd({className:e,...t}){return c.jsx("h2",{className:ht("web-trading-widget-dialog__title",e),...t})}function ld({className:e,...t}){return c.jsx("p",{className:ht("web-trading-widget-dialog__description",e),...t})}function dd({className:e,...t}){return c.jsx("div",{className:ht("web-trading-widget-dialog__footer",e),...t})}function Ja({open:e,isAccountsLoading:t,accountOptions:n,onConfirm:r,backUrl:i,createAccountUrl:s}){var m;const{t:o}=Te(),[a,l]=p.useState(""),d=a||((m=n[0])==null?void 0:m.login)||"",u=!t&&n.length>0&&d!=="",f=!t&&n.length===0;return c.jsxs(od,{open:e,className:"web-trading-widget-account-modal",onPointerDownOutside:h=>h.preventDefault(),onEscapeKeyDown:h=>h.preventDefault(),children:[c.jsxs(ad,{children:[c.jsx(cd,{children:o("WebTrading.selectTradingAccount")}),c.jsx(ld,{children:o("WebTrading.selectAccountDescription")})]}),t?c.jsx("p",{className:"web-trading-widget-account-modal__loading",children:o("WebTrading.loadingAccounts")}):n.length===0?c.jsx("p",{className:"web-trading-widget-account-modal__error",children:o("WebTrading.noTradingAccounts")}):c.jsx("select",{value:d,className:"web-trading-widget-account-modal__select web-trading-widget-market-panel__select-full","aria-label":o("WebTrading.selectAccount"),onChange:h=>l(h.target.value),children:n.map(h=>c.jsxs("option",{value:h.login,children:[h.label," (",h.balance.toFixed(2)," ",h.currency,")"]},h.login))}),c.jsx(dd,{children:f?c.jsxs(c.Fragment,{children:[i?c.jsx("a",{href:i,className:"web-trading-widget-btn web-trading-widget-btn--outline",children:o("WebTrading.back")}):null,s?c.jsx("a",{href:s,className:"web-trading-widget-btn web-trading-widget-btn--primary",children:o("WebTrading.createAccount")}):null]}):c.jsx("button",{type:"button",className:"web-trading-widget-btn web-trading-widget-btn--primary",disabled:!u,onClick:()=>r(d),children:o("WebTrading.continue")})})]})}var ud={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const fd=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),tt=(e,t)=>{const n=p.forwardRef(({color:r="currentColor",size:i=24,strokeWidth:s=2,absoluteStrokeWidth:o,children:a,...l},d)=>p.createElement("svg",{ref:d,...ud,width:i,height:i,stroke:r,strokeWidth:o?Number(s)*24/Number(i):s,className:`lucide lucide-${fd(e)}`,...l},[...t.map(([u,f])=>p.createElement(u,f)),...(Array.isArray(a)?a:[a])||[]]));return n.displayName=`${e}`,n},Br=tt("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),hd=tt("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),md=tt("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),$i=tt("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),Xa=tt("GripHorizontal",[["circle",{cx:"12",cy:"9",r:"1",key:"124mty"}],["circle",{cx:"19",cy:"9",r:"1",key:"1ruzo2"}],["circle",{cx:"5",cy:"9",r:"1",key:"1a8b28"}],["circle",{cx:"12",cy:"15",r:"1",key:"1e56xg"}],["circle",{cx:"19",cy:"15",r:"1",key:"1a92ep"}],["circle",{cx:"5",cy:"15",r:"1",key:"5r1jwy"}]]),ec=tt("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]),pd=tt("ListOrdered",[["line",{x1:"10",x2:"21",y1:"6",y2:"6",key:"76qw6h"}],["line",{x1:"10",x2:"21",y1:"12",y2:"12",key:"16nom4"}],["line",{x1:"10",x2:"21",y1:"18",y2:"18",key:"u3jurt"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]),gd=tt("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]),yd=tt("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]),bd=tt("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),_d=tt("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]),Bt=tt("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),wd={[-11]:["Pacific/Fakaofo"],[-10]:["Pacific/Honolulu"],[-9]:["America/Anchorage","America/Juneau"],[-8]:["America/Los_Angeles","America/Vancouver"],[-7]:["US/Mountain"],[-6]:["America/Chicago","America/El_Salvador"],[-5]:["America/New_York","America/Lima","America/Bogota"],[-4]:["America/Caracas","America/Santiago","America/Toronto"],[-3]:["America/Argentina/Buenos_Aires","America/Sao_Paulo"],0:["Europe/London","Atlantic/Reykjavik","Africa/Casablanca","Africa/Tunis","Africa/Lagos"],1:["Europe/Amsterdam","Europe/Berlin","Europe/Madrid","Europe/Paris"],2:["Europe/Athens","Africa/Cairo","Africa/Johannesburg"],3:["Europe/Moscow","Asia/Riyadh","Asia/Qatar"],3.5:["Asia/Tehran"],4:["Asia/Dubai","Asia/Muscat"],4.5:[],5:["Asia/Karachi"],5.5:["Asia/Kolkata","Asia/Colombo"],5.75:["Asia/Kathmandu"],6:["Asia/Dhaka","Asia/Almaty"],6.5:["Asia/Yangon"],7:["Asia/Bangkok","Asia/Jakarta"],8:["Asia/Shanghai","Asia/Singapore","Asia/Hong_Kong","Asia/Kuala_Lumpur"],9:["Asia/Tokyo","Asia/Seoul"],9.5:["Australia/Adelaide"],10:["Australia/Sydney","Australia/Brisbane"],11:["Pacific/Norfolk"],12:["Pacific/Auckland"]};function vd(){const e=-new Date().getTimezoneOffset()/60,t=wd[e];return t&&t.length>0?t[0]:"Etc/UTC"}const un="tv:latest-symbol",tc="web-trading-last-account-login",_t=[{ticker:"EUR_JPY",display_name:"EURJPY",logo_urls:["https://cdn.iccandle.ai/web-assets/EUR.svg","https://cdn.iccandle.ai/web-assets/JPY.svg"],description:"EUR JPY",type:"forex",session:"1700-1700",pricescale:1e3,resolve_symbol:"EURJPY"},{ticker:"GBP_JPY",display_name:"GBPJPY",logo_urls:["https://cdn.iccandle.ai/web-assets/GBP.svg","https://cdn.iccandle.ai/web-assets/JPY.svg"],description:"GBP JPY",type:"forex",session:"1700-1700",pricescale:1e3,resolve_symbol:"GBPJPY"},{ticker:"AUD_JPY",display_name:"AUDJPY",logo_urls:["https://cdn.iccandle.ai/web-assets/AUD.svg","https://cdn.iccandle.ai/web-assets/JPY.svg"],description:"AUD JPY",type:"forex",session:"1700-1700",pricescale:1e3,resolve_symbol:"AUDJPY"},{ticker:"NZD_JPY",display_name:"NZDJPY",logo_urls:["https://cdn.iccandle.ai/web-assets/NZD.svg","https://cdn.iccandle.ai/web-assets/JPY.svg"],description:"NZD JPY",type:"forex",session:"1700-1700",pricescale:1e3,resolve_symbol:"NZDJPY"},{ticker:"CAD_JPY",display_name:"CADJPY",logo_urls:["https://cdn.iccandle.ai/web-assets/CAD.svg","https://cdn.iccandle.ai/web-assets/JPY.svg"],description:"CAD JPY",type:"forex",session:"1700-1700",pricescale:1e3,resolve_symbol:"CADJPY"},{ticker:"CHF_JPY",display_name:"CHFJPY",logo_urls:["https://cdn.iccandle.ai/web-assets/CHF.svg","https://cdn.iccandle.ai/web-assets/JPY.svg"],description:"CHF JPY",type:"forex",session:"1700-1700",pricescale:1e3,resolve_symbol:"CHFJPY"},{ticker:"USD_JPY",display_name:"USDJPY",logo_urls:["https://cdn.iccandle.ai/web-assets/USD.svg","https://cdn.iccandle.ai/web-assets/JPY.svg"],description:"USD JPY",type:"forex",session:"1700-1700",pricescale:1e3,resolve_symbol:"USDJPY"},{ticker:"EUR_USD",display_name:"EURUSD",logo_urls:["https://cdn.iccandle.ai/web-assets/EUR.svg","https://cdn.iccandle.ai/web-assets/USD.svg"],description:"EUR USD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"EURUSD"},{ticker:"AUD_USD",display_name:"AUDUSD",logo_urls:["https://cdn.iccandle.ai/web-assets/AUD.svg","https://cdn.iccandle.ai/web-assets/USD.svg"],description:"AUD USD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"AUDUSD"},{ticker:"NZD_USD",display_name:"NZDUSD",logo_urls:["https://cdn.iccandle.ai/web-assets/NZD.svg","https://cdn.iccandle.ai/web-assets/USD.svg"],description:"NZD USD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"NZDUSD"},{ticker:"USD_CHF",display_name:"USDCHF",logo_urls:["https://cdn.iccandle.ai/web-assets/USD.svg","https://cdn.iccandle.ai/web-assets/CHF.svg"],description:"USD CHF",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"USDCHF"},{ticker:"USD_CAD",display_name:"USDCAD",logo_urls:["https://cdn.iccandle.ai/web-assets/USD.svg","https://cdn.iccandle.ai/web-assets/CAD.svg"],description:"USD CAD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"USDCAD"},{ticker:"GBP_AUD",display_name:"GBPAUD",logo_urls:["https://cdn.iccandle.ai/web-assets/GBP.svg","https://cdn.iccandle.ai/web-assets/AUD.svg"],description:"GBP AUD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"GBPAUD"},{ticker:"GBP_CAD",display_name:"GBPCAD",logo_urls:["https://cdn.iccandle.ai/web-assets/GBP.svg","https://cdn.iccandle.ai/web-assets/CAD.svg"],description:"GBP CAD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"GBPCAD"},{ticker:"GBP_CHF",display_name:"GBPCHF",logo_urls:["https://cdn.iccandle.ai/web-assets/GBP.svg","https://cdn.iccandle.ai/web-assets/CHF.svg"],description:"GBP CHF",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"GBPCHF"},{ticker:"GBP_NZD",display_name:"GBPNZD",logo_urls:["https://cdn.iccandle.ai/web-assets/GBP.svg","https://cdn.iccandle.ai/web-assets/NZD.svg"],description:"GBP NZD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"GBPNZD"},{ticker:"GBP_USD",display_name:"GBPUSD",logo_urls:["https://cdn.iccandle.ai/web-assets/GBP.svg","https://cdn.iccandle.ai/web-assets/USD.svg"],description:"GBP USD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"GBPUSD"},{ticker:"NZD_CAD",display_name:"NZDCAD",logo_urls:["https://cdn.iccandle.ai/web-assets/NZD.svg","https://cdn.iccandle.ai/web-assets/CAD.svg"],description:"NZD CAD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"NZDCAD"},{ticker:"EUR_CAD",display_name:"EURCAD",logo_urls:["https://cdn.iccandle.ai/web-assets/EUR.svg","https://cdn.iccandle.ai/web-assets/CAD.svg"],description:"EUR CAD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"EURCAD"},{ticker:"EUR_AUD",display_name:"EURAUD",logo_urls:["https://cdn.iccandle.ai/web-assets/EUR.svg","https://cdn.iccandle.ai/web-assets/AUD.svg"],description:"EUR AUD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"EURAUD"},{ticker:"XAU_USD",display_name:"XAUUSD",logo_urls:["https://cdn.iccandle.ai/web-assets/XAU.svg"],description:"Gold",type:"commodity",session:"1700-1700",pricescale:1e3,resolve_symbol:"XAUUSD"},{ticker:"BCO_USD",display_name:"BCOUSD",logo_urls:["https://cdn.iccandle.ai/web-assets/BCO.svg"],description:"Brent Crude Oil",type:"commodity",session:"1700-1700",pricescale:1e3,resolve_symbol:"SpotBrent"},{ticker:"SPX500_USD",display_name:"S&P500",logo_urls:["https://cdn.iccandle.ai/web-assets/SPX500.svg"],description:"S&P 500",type:"indices",session:"1700-1700",pricescale:10,resolve_symbol:"SP500"},{ticker:"NAS100_USD",display_name:"NASDAQ100",logo_urls:["https://cdn.iccandle.ai/web-assets/NAS100.svg"],description:"NASDAQ 100",type:"indices",session:"1700-1700",pricescale:10,resolve_symbol:"NAS100"},{ticker:"US30_USD",display_name:"US30",logo_urls:["https://cdn.iccandle.ai/web-assets/US30.svg"],description:"US Wall St 30",type:"indices",session:"1700-1700",pricescale:10,resolve_symbol:"US30"},{ticker:"BTCUSDT",display_name:"BTCUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/BTC.svg"],description:"BTCUSDT",type:"crypto",session:"24x7",pricescale:100,resolve_symbol:"BTCUSD"},{ticker:"ETHUSDT",display_name:"ETHUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/ETH.svg"],description:"ETHUSDT",type:"crypto",session:"24x7",pricescale:100,resolve_symbol:"ETHUSD"},{ticker:"XRPUSDT",display_name:"XRPUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/XRP.svg"],description:"XRPUSDT",type:"crypto",session:"24x7",pricescale:1e4,resolve_symbol:"XRPUSD"},{ticker:"SOLUSDT",display_name:"SOLUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/SOL.svg"],description:"SOLUSDT",type:"crypto",session:"24x7",pricescale:100,resolve_symbol:"SOLUSD"},{ticker:"ADAUSDT",display_name:"ADAUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/ADA.svg"],description:"ADAUSDT",type:"crypto",session:"24x7",pricescale:1e4,resolve_symbol:"ADAUSD"},{ticker:"AVAUSDT",display_name:"AVAUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/AVA.svg"],description:"AVAUSDT",type:"crypto",session:"24x7",pricescale:1e4,resolve_symbol:"AVAUSD"},{ticker:"AVAXUSDT",display_name:"AVAXUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/AVAX.svg"],description:"AVAXUSDT",type:"crypto",session:"24x7",pricescale:100,resolve_symbol:"AVAXUSD"},{ticker:"BNBUSDT",display_name:"BNBUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/BNB.svg"],description:"BNBUSDT",type:"crypto",session:"24x7",pricescale:100,resolve_symbol:"BNBUSD"},{ticker:"DOGEUSDT",display_name:"DOGEUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/DOGE.svg"],description:"DOGEUSDT",type:"crypto",session:"24x7",pricescale:1e5,resolve_symbol:"DOGUSD"},{ticker:"DOTUSDT",display_name:"DOTUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/DOT.svg"],description:"DOTUSDT",type:"crypto",session:"24x7",pricescale:1e3,resolve_symbol:"DOTUSD"},{ticker:"TRXUSDT",display_name:"TRXUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/TRX.svg"],description:"TRXUSDT",type:"crypto",session:"24x7",pricescale:1e4,resolve_symbol:"TRXUSD"},{ticker:"AAPL",display_name:"AAPL",logo_urls:["https://cdn.iccandle.ai/web-assets/AAPL.svg"],description:"Apple Inc.",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"AAPL"},{ticker:"AMZN",display_name:"AMZN",logo_urls:["https://cdn.iccandle.ai/web-assets/AMZN.svg"],description:"Amazon.Com Inc",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"AMZN"},{ticker:"BRK.B",display_name:"BRK.B",logo_urls:["https://cdn.iccandle.ai/web-assets/BRK.B.svg"],description:"BERKSHIRE HATHAWAY Class B",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"BRKB"},{ticker:"GOOGL",display_name:"GOOGL",logo_urls:["https://cdn.iccandle.ai/web-assets/GOOGL.svg"],description:"Alphabet Inc. Class A Common Stock",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"GOOGL"},{ticker:"KO",display_name:"KO",logo_urls:["https://cdn.iccandle.ai/web-assets/KO.svg"],description:"Coca-Cola Company",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"KO"},{ticker:"META",display_name:"META",logo_urls:["https://cdn.iccandle.ai/web-assets/META.svg"],description:"Meta Platforms, Inc. Class A Common Stock",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"META"},{ticker:"MSFT",display_name:"MSFT",logo_urls:["https://cdn.iccandle.ai/web-assets/MSFT.svg"],description:"Microsoft Corp",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"MSFT"},{ticker:"NFLX",display_name:"NFLX",logo_urls:["https://cdn.iccandle.ai/web-assets/NFLX.svg"],description:"NetFlix Inc",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"NFLX"},{ticker:"NKE",display_name:"NKE",logo_urls:["https://cdn.iccandle.ai/web-assets/NKE.svg"],description:"Nike, Inc.",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"NKE"},{ticker:"NVDA",display_name:"NVDA",logo_urls:["https://cdn.iccandle.ai/web-assets/NVDA.svg"],description:"Nvidia Corp",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"NVDA"},{ticker:"TME",display_name:"TME",logo_urls:["https://cdn.iccandle.ai/web-assets/TME.svg"],description:"Tencent Music Entertainment Group American Depositary Shares, each representing two Class A Ordinary Shares",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"TME"},{ticker:"TSLA",display_name:"TSLA",logo_urls:["https://cdn.iccandle.ai/web-assets/TSLA.svg"],description:"Tesla, Inc. Common Stock",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"TSLA"},{ticker:"XAG_USD",display_name:"XAGUSD",logo_urls:["https://cdn.iccandle.ai/web-assets/XAG.svg"],description:"Silver",type:"commodity",session:"1700-1700",pricescale:1e3,resolve_symbol:"XAGUSD"},{ticker:"XCU_USD",display_name:"XCUUSD",logo_urls:["https://cdn.iccandle.ai/web-assets/XCU.svg"],description:"Copper",type:"commodity",session:"1700-1700",pricescale:1e3,resolve_symbol:"XCUUSD"}];function Sd(e){const t=Math.round(Math.log10(e));return Number.isFinite(t)&&t>0?t:5}function Ps(e){const t=Ne(e).toUpperCase();if(t)return _t.find(n=>{var r,i;return((r=n.resolve_symbol)==null?void 0:r.toUpperCase())===t||((i=n.display_name)==null?void 0:i.toUpperCase())===t||n.ticker.replace(/_/g,"").toUpperCase()===t})}function Td(e){const t=Ps(e);return t!=null&&t.pricescale?Sd(t.pricescale):5}function nc(e,t){if(t)for(const r of["digits","Digits"]){const i=t[r];if(i!=null&&i!==""){const s=Number(i);if(Number.isFinite(s))return Math.round(s)}}const n=Ne(e).toUpperCase();return n.includes("XAU")||n.includes("GOLD")?2:n.includes("JPY")?3:5}function xd(e){const t=Ps(e);switch(t==null?void 0:t.type){case"commodity":return 100;case"crypto":case"indices":case"stock":return 1;case"forex":default:return 1e5}}const kd=.1;function rc(e,t,n){return e==="buy"?n-t:t-n}function Pd(e,t,n,r){const i=rc(e,t,n);if(!(!Number.isFinite(i)||i===0)&&!(!Number.isFinite(r)||Math.abs(r)<kd))return r/i}const Cs="USD";function or(e){return Ne(e).toUpperCase()}function ii(e){const t=or(e);return t.length>=6?t.slice(3):Cs}function Os(e){if(e!==Cs&&e==="JPY")return"USDJPY"}function Cd(e,t,n,r,i){const s=ii(e),o=Os(s);if(!o)return;if(or(e)===o){const d=t==="buy"?n:r;return d>0?d:void 0}const a=i[o];if(!a)return;const l=(a.bid+a.ask)/2;return l>0?l:void 0}function Od(e,t,n,r,i,s,o={}){const a=e==="buy"?n:r;let d=(e==="buy"?a-t:t-a)*i*xd(s);const u=ii(s),f=Cd(s,e,n,r,o);if(f!==void 0)d/=f;else if(u!==Cs)return null;return Math.round(d*100)/100}function Ed(e){const t=new Set;for(const n of e){const r=Os(ii(n));r&&or(n)!==r&&t.add(r)}return[...t]}function Ad(e,t){const n=or(e);if(n===t)return!0;const r=Os(ii(e));return r===t&&n!==r}function Ld(e,t,n,r,i){if(!Ad(e.symbol,t))return e;const s=or(e.symbol)===t,o=s?n:e.marketBid??e.currentPrice,a=s?r:e.marketAsk??e.currentPrice,l=e.type==="buy"?o:a,d=e.profitPerPriceUnit!==void 0?Math.round(rc(e.type,e.openPrice,l)*e.profitPerPriceUnit*100)/100:Od(e.type,e.openPrice,o,a,e.volumeLots,e.symbol,i);return{...e,currentPrice:l,marketBid:o,marketAsk:a,profit:d??e.profit}}function Ne(e){const t=e.trim();return t?t.replace(/m$/i,""):""}function si(e){return Ne(e)||"—"}const He={BUY:0,SELL:1,BUY_LIMIT:2,SELL_LIMIT:3,BUY_STOP:4,SELL_STOP:5,BUY_STOP_LIMIT:6,SELL_STOP_LIMIT:7},Wr=[{mode:"market",label:"Market Execution",orderType:null,isMarket:!0},{mode:"buy_limit",label:"Buy Limit",orderType:He.BUY_LIMIT,isMarket:!1},{mode:"sell_limit",label:"Sell Limit",orderType:He.SELL_LIMIT,isMarket:!1},{mode:"buy_stop",label:"Buy Stop",orderType:He.BUY_STOP,isMarket:!1},{mode:"sell_stop",label:"Sell Stop",orderType:He.SELL_STOP,isMarket:!1},{mode:"buy_stop_limit",label:"Buy Stop Limit",orderType:He.BUY_STOP_LIMIT,isMarket:!1},{mode:"sell_stop_limit",label:"Sell Stop Limit",orderType:He.SELL_STOP_LIMIT,isMarket:!1}];function oi(e){return Wr.find(t=>t.mode===e)??Wr[0]}function ai(e){return oi(e).isMarket}function Vi(e,t){const n=oi(e);return n.orderType!==null?n.orderType:t==="buy"?He.BUY:He.SELL}function $r(e){return e%2===1?"sell":"buy"}function Es(e){return e>=He.BUY_LIMIT&&e<=He.SELL_STOP_LIMIT}function As(e){return e===He.BUY_STOP_LIMIT||e===He.SELL_STOP_LIMIT}function ic(e){return e==="buy_stop_limit"||e==="sell_stop_limit"}const We={GTC:0,TODAY:1,SPECIFIED:2,SPECIFIED_DAY:3},sc=[{value:We.GTC,label:"GTC"},{value:We.TODAY,label:"Today"},{value:We.SPECIFIED,label:"Specified"},{value:We.SPECIFIED_DAY,label:"Specified Day"}];function Ls(e){return e===We.SPECIFIED}function Ns(e){return e===We.SPECIFIED_DAY}const Vr={market:"WebTrading.executionMarket",buy_limit:"WebTrading.executionBuyLimit",sell_limit:"WebTrading.executionSellLimit",buy_stop:"WebTrading.executionBuyStop",sell_stop:"WebTrading.executionSellStop",buy_stop_limit:"WebTrading.executionBuyStopLimit",sell_stop_limit:"WebTrading.executionSellStopLimit"},oc={[We.GTC]:"WebTrading.expirationGtc",[We.TODAY]:"WebTrading.expirationToday",[We.SPECIFIED]:"WebTrading.expirationSpecified",[We.SPECIFIED_DAY]:"WebTrading.expirationSpecifiedDay"};function Nd(e){return e.map(t=>({login:t.login,label:t.label,balance:t.tradeStat.balance,currency:t.currency}))}function Dd(){if(typeof window>"u")return null;const e=localStorage.getItem(tc);return(e==null?void 0:e.trim())||null}function oo(e){if(typeof window>"u")return;const t=e.trim();t&&localStorage.setItem(tc,t)}function Rd(e,t){var n;return t&&e.some(r=>r.login===t)?t:((n=e[0])==null?void 0:n.login)??""}function Ds(e,t=_t){return t.find(n=>n.ticker===e)}function jd(e,t=_t){var i;const n=Ne(e).toUpperCase();if(!n)return null;const r=t.find(s=>{var o;return Ne(s.resolve_symbol??"").toUpperCase()===n||((o=s.display_name)==null?void 0:o.toUpperCase())===n||s.ticker.replace(/_/g,"").toUpperCase()===n||s.ticker.toUpperCase()===n});return r?r.ticker:((i=Ps(e))==null?void 0:i.ticker)??null}function ar(e,t=_t){const n=Ds(e,t),r=(n==null?void 0:n.resolve_symbol)??e.replace(/_/g,"");return Ne(r).toUpperCase()}function ci(e,t=_t){const n=Ds(e,t);return n!=null&&n.resolve_symbol?n.resolve_symbol:e.replace(/_/g,"")}function wt(e){const t=Math.round(Math.log10(e));return String(Number.isFinite(t)&&t>0?t:5)}function vt(e,t=_t){const n=Ds(e,t);return(n==null?void 0:n.pricescale)??1e5}function pe(e,t){return e.toFixed(t)}function Dn(e){return 1/10**e}function Rs(e,t){return e===null||t===null?null:(e+t)/2}function Le(e){const t=e.trim();if(!t)return;const n=Number(t);if(!(!Number.isFinite(n)||n<=0))return n}function ac(e,t,n){if(Ls(e)){if(!t.trim())return;const r=Date.parse(t);return Number.isFinite(r)?Math.floor(r/1e3):void 0}if(Ns(e)){if(!n.trim())return;const r=Date.parse(`${n}T23:59:59`);return Number.isFinite(r)?Math.floor(r/1e3):void 0}}function li(e,t,n){return e===We.GTC||e===We.TODAY?!0:ac(e,t,n)!==void 0}const Md={},ao=e=>{let t;const n=new Set,r=(u,f)=>{const m=typeof u=="function"?u(t):u;if(!Object.is(m,t)){const h=t;t=f??(typeof m!="object"||m===null)?m:Object.assign({},t,m),n.forEach(b=>b(t,h))}},i=()=>t,l={setState:r,getState:i,getInitialState:()=>d,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(Md?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},d=t=e(r,i,l);return l},Ud=e=>e?ao(e):ao;function Id(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var wr={exports:{}},wi={},vr={exports:{}},vi={};/**
|
|
42
2
|
* @license React
|
|
43
3
|
* use-sync-external-store-shim.production.js
|
|
44
4
|
*
|
|
@@ -46,7 +6,7 @@
|
|
|
46
6
|
*
|
|
47
7
|
* This source code is licensed under the MIT license found in the
|
|
48
8
|
* LICENSE file in the root directory of this source tree.
|
|
49
|
-
*/var
|
|
9
|
+
*/var co;function Fd(){if(co)return vi;co=1;var e=p;function t(f,m){return f===m&&(f!==0||1/f===1/m)||f!==f&&m!==m}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,i=e.useEffect,s=e.useLayoutEffect,o=e.useDebugValue;function a(f,m){var h=m(),b=r({inst:{value:h,getSnapshot:m}}),v=b[0].inst,_=b[1];return s(function(){v.value=h,v.getSnapshot=m,l(v)&&_({inst:v})},[f,h,m]),i(function(){return l(v)&&_({inst:v}),f(function(){l(v)&&_({inst:v})})},[f]),o(h),h}function l(f){var m=f.getSnapshot;f=f.value;try{var h=m();return!n(f,h)}catch{return!0}}function d(f,m){return m()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:a;return vi.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,vi}var Si={};/**
|
|
50
10
|
* @license React
|
|
51
11
|
* use-sync-external-store-shim.development.js
|
|
52
12
|
*
|
|
@@ -54,7 +14,7 @@
|
|
|
54
14
|
*
|
|
55
15
|
* This source code is licensed under the MIT license found in the
|
|
56
16
|
* LICENSE file in the root directory of this source tree.
|
|
57
|
-
*/var
|
|
17
|
+
*/var lo;function Bd(){return lo||(lo=1,process.env.NODE_ENV!=="production"&&(function(){function e(h,b){return h===b&&(h!==0||1/h===1/b)||h!==h&&b!==b}function t(h,b){u||i.startTransition===void 0||(u=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var v=b();if(!f){var _=b();s(v,_)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),f=!0)}_=o({inst:{value:v,getSnapshot:b}});var g=_[0].inst,T=_[1];return l(function(){g.value=v,g.getSnapshot=b,n(g)&&T({inst:g})},[h,v,b]),a(function(){return n(g)&&T({inst:g}),h(function(){n(g)&&T({inst:g})})},[h]),d(v),v}function n(h){var b=h.getSnapshot;h=h.value;try{var v=b();return!s(h,v)}catch{return!0}}function r(h,b){return b()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var i=p,s=typeof Object.is=="function"?Object.is:e,o=i.useState,a=i.useEffect,l=i.useLayoutEffect,d=i.useDebugValue,u=!1,f=!1,m=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;Si.useSyncExternalStore=i.useSyncExternalStore!==void 0?i.useSyncExternalStore:m,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Si}var uo;function cc(){return uo||(uo=1,process.env.NODE_ENV==="production"?vr.exports=Fd():vr.exports=Bd()),vr.exports}/**
|
|
58
18
|
* @license React
|
|
59
19
|
* use-sync-external-store-shim/with-selector.production.js
|
|
60
20
|
*
|
|
@@ -62,7 +22,7 @@
|
|
|
62
22
|
*
|
|
63
23
|
* This source code is licensed under the MIT license found in the
|
|
64
24
|
* LICENSE file in the root directory of this source tree.
|
|
65
|
-
*/var
|
|
25
|
+
*/var fo;function Wd(){if(fo)return wi;fo=1;var e=p,t=cc();function n(d,u){return d===u&&(d!==0||1/d===1/u)||d!==d&&u!==u}var r=typeof Object.is=="function"?Object.is:n,i=t.useSyncExternalStore,s=e.useRef,o=e.useEffect,a=e.useMemo,l=e.useDebugValue;return wi.useSyncExternalStoreWithSelector=function(d,u,f,m,h){var b=s(null);if(b.current===null){var v={hasValue:!1,value:null};b.current=v}else v=b.current;b=a(function(){function g(C){if(!T){if(T=!0,x=C,C=m(C),h!==void 0&&v.hasValue){var E=v.value;if(h(E,C))return y=E}return y=C}if(E=y,r(x,C))return E;var k=m(C);return h!==void 0&&h(E,k)?(x=C,E):(x=C,y=k)}var T=!1,x,y,O=f===void 0?null:f;return[function(){return g(u())},O===null?void 0:function(){return g(O())}]},[u,f,m,h]);var _=i(d,b[0],b[1]);return o(function(){v.hasValue=!0,v.value=_},[_]),l(_),_},wi}var Ti={};/**
|
|
66
26
|
* @license React
|
|
67
27
|
* use-sync-external-store-shim/with-selector.development.js
|
|
68
28
|
*
|
|
@@ -70,21 +30,21 @@
|
|
|
70
30
|
*
|
|
71
31
|
* This source code is licensed under the MIT license found in the
|
|
72
32
|
* LICENSE file in the root directory of this source tree.
|
|
73
|
-
*/var zl;function Kw(){return zl||(zl=1,process.env.NODE_ENV!=="production"&&(function(){function e(d,u){return d===u&&(d!==0||1/d===1/u)||d!==d&&u!==u}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=S,n=wp(),r=typeof Object.is=="function"?Object.is:e,i=n.useSyncExternalStore,s=t.useRef,o=t.useEffect,a=t.useMemo,l=t.useDebugValue;To.useSyncExternalStoreWithSelector=function(d,u,f,m,p){var b=s(null);if(b.current===null){var h={hasValue:!1,value:null};b.current=h}else h=b.current;b=a(function(){function y(C){if(!v){if(v=!0,_=C,C=m(C),p!==void 0&&h.hasValue){var O=h.value;if(p(O,C))return x=O}return x=C}if(O=x,r(_,C))return O;var P=m(C);return p!==void 0&&p(O,P)?(_=C,O):(_=C,x=P)}var v=!1,_,x,T=f===void 0?null:f;return[function(){return y(u())},T===null?void 0:function(){return y(T())}]},[u,f,m,p]);var g=i(d,b[0],b[1]);return o(function(){h.hasValue=!0,h.value=g},[g]),l(g),g},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),To}var Kl;function Gw(){return Kl||(Kl=1,process.env.NODE_ENV==="production"?Ii.exports=zw():Ii.exports=Kw()),Ii.exports}var qw=Gw();const Qw=$w(qw),xp={},{useDebugValue:Yw}=S,{useSyncExternalStoreWithSelector:Zw}=Qw;let Gl=!1;const Xw=e=>e;function Jw(e,t=Xw,n){(xp?"production":void 0)!=="production"&&n&&!Gl&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),Gl=!0);const r=Zw(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Yw(r),r}const ql=e=>{(xp?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?Ww(e):e,n=(r,i)=>Jw(t,r,i);return Object.assign(n,t),n},Zs=e=>e?ql(e):ql,Ql={source:null,symbolKey:null,entryPrice:null,stopLoss:"",takeProfit:"",side:null,showEntryLine:!1,volumeLots:.01,digits:2,priceStep:.01},le=Zs(e=>({...Ql,setDraft:t=>e(n=>({source:t.source,symbolKey:t.symbolKey!==void 0?t.symbolKey:n.symbolKey,entryPrice:t.entryPrice!==void 0?t.entryPrice:n.entryPrice,stopLoss:t.stopLoss??n.stopLoss,takeProfit:t.takeProfit??n.takeProfit,side:t.side!==void 0?t.side:n.side,showEntryLine:t.showEntryLine??n.showEntryLine,volumeLots:t.volumeLots??n.volumeLots,digits:t.digits??n.digits,priceStep:t.priceStep??n.priceStep})),setOrderSide:({side:t,entryPrice:n})=>e({side:t,entryPrice:n,showEntryLine:!0}),setStopLoss:t=>e({stopLoss:t}),setTakeProfit:t=>e({takeProfit:t}),setVolumeLots:t=>e({volumeLots:t}),clearEntryLinePreview:()=>e({side:null,entryPrice:null,showEntryLine:!1}),clearDraft:()=>e({...Ql})}));function Co(e,t){return e.toFixed(t)}function ex({symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:i,minVolumeLots:s,isSubmitting:o,isAccountsLoading:a,selectedLogin:l,isDragging:d,sidePanelTab:u="trade",onDragHandlePointerDown:f,onExpandedChange:m,onExpand:p,onPlaceOrder:b}){const{t:h}=Le(),[g,y]=S.useState(String(r)),[v,_]=S.useState(null),[x,T]=S.useState(u),C=le(R=>R.setOrderSide),O=le(R=>R.setVolumeLots);u!==x&&(T(u),_(null));const P=v??u==="scan";S.useEffect(()=>{m()},[P,m]);const L=()=>{const R=!P;R&&p(),_(R)},I=Number(Vt(Ht(e))),U=t!==null?Ce(t,I):"—",N=n!==null?Ce(n,I):"—",M=!o&&!a&&l!==""&&(t!==null&&n!==null),z=R=>{const W=Number(g),F=Number.isFinite(W)&&W>0?W:r,G=Math.max(s,F+R*i),X=Co(G,2);y(X),O(G)},k=()=>{const R=Number(g);if(!Number.isFinite(R)||R<=0){y(Co(r,2)),O(r);return}const W=Math.max(s,R),F=Co(W,2);y(F),O(W)},j=R=>{t===null||n===null||C({side:R,entryPrice:R==="buy"?n:t})},D=R=>{if(t===null||n===null||!l)return;const W=Number(g),F=Math.max(s,Number.isFinite(W)&&W>0?W:r);C({side:R,entryPrice:R==="buy"?n:t}),b({login:l,side:R,volumeLots:F,bid:t,ask:n})};return c.jsx("div",{className:`web-trading-widget-mini-order${P?" web-trading-widget-mini-order--expanded":" web-trading-widget-mini-order--collapsed"}`,children:c.jsxs("div",{className:"web-trading-widget-mini-order__row",children:[c.jsx("button",{type:"button","aria-label":h("WebTrading.moveQuickOrderPanel"),onPointerDown:f,className:`web-trading-widget-mini-order__drag-handle${d?" web-trading-widget-mini-order__drag-handle--grabbing":""}`,children:c.jsx(pp,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2})}),P?c.jsxs(c.Fragment,{children:[c.jsxs("button",{type:"button",disabled:!M,className:"web-trading-widget-mini-order__side-btn web-trading-widget-mini-order__side-btn--sell",onMouseDown:()=>j("sell"),onClick:()=>D("sell"),children:[c.jsx("span",{className:"web-trading-widget-mini-order__price",children:U}),c.jsx("span",{className:"web-trading-widget-mini-order__label web-trading-widget-mini-order__label--sell",children:h("WebTrading.sell").toUpperCase()})]}),c.jsxs("div",{className:"web-trading-widget-mini-order__volume",children:[c.jsx("button",{type:"button","aria-label":h("WebTrading.decreaseVolume"),disabled:!M,className:"web-trading-widget-mini-order__volume-btn",onClick:()=>z(-1),children:c.jsx(ms,{className:"web-trading-widget-icon web-trading-widget-icon--xs",strokeWidth:2.5})}),c.jsx("input",{type:"text",inputMode:"decimal",value:g,disabled:!M,onChange:R=>y(R.target.value),onBlur:k,className:"web-trading-widget-mini-order__volume-input"}),c.jsx("button",{type:"button","aria-label":h("WebTrading.increaseVolume"),disabled:!M,className:"web-trading-widget-mini-order__volume-btn",onClick:()=>z(1),children:c.jsx(Xo,{className:"web-trading-widget-icon web-trading-widget-icon--xs",strokeWidth:2.5})})]}),c.jsxs("button",{type:"button",disabled:!M,className:"web-trading-widget-mini-order__side-btn web-trading-widget-mini-order__side-btn--buy",onMouseDown:()=>j("buy"),onClick:()=>D("buy"),children:[c.jsx("span",{className:"web-trading-widget-mini-order__label web-trading-widget-mini-order__label--buy",children:h("WebTrading.buy").toUpperCase()}),c.jsx("span",{className:"web-trading-widget-mini-order__price",children:N})]})]}):null,c.jsx("button",{type:"button","aria-label":h(P?"WebTrading.collapseQuickOrderPanel":"WebTrading.expandQuickOrderPanel"),"aria-expanded":P,className:"web-trading-widget-mini-order__toggle",onClick:L,children:P?c.jsx(vw,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2.5}):c.jsx(ww,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2.5})})]})})}const tx="web-trading-widget-mini-exec-panel-position",_p={x:56,y:96};function Yl(e,t){const n=t==null?void 0:t.offsetParent;if(!t||!n)return e;const r=Math.max(0,n.clientWidth-t.offsetWidth),i=Math.max(0,n.clientHeight-t.offsetHeight);return{x:Math.min(r,Math.max(0,e.x)),y:Math.min(i,Math.max(0,e.y))}}function Zl(e,t){e.style.left=`${t.x}px`,e.style.top=`${t.y}px`}function nx(e,t){const n=t==null?void 0:t.offsetParent;return!t||!n?null:{x:e==="top-right"?Math.max(0,n.clientWidth-t.offsetWidth-16):_p.x,y:16}}function rx(e){if(typeof window>"u")return null;try{const t=window.localStorage.getItem(e);if(!t)return null;const n=JSON.parse(t);if(typeof n.x=="number"&&typeof n.y=="number")return{x:n.x,y:n.y}}catch{}return null}function Xl(e,t){try{e.hasPointerCapture(t)&&e.releasePointerCapture(t)}catch{}}function Sp(e){const t=(e==null?void 0:e.storageKey)??tx,n=(e==null?void 0:e.defaultPosition)??_p,r=e==null?void 0:e.defaultAlign,i=(e==null?void 0:e.isActive)??!0,s=S.useRef(null),[o,a]=S.useState(n),[l,d]=S.useState(!1),u=S.useRef(n),f=S.useRef(null);S.useEffect(()=>{u.current=o},[o]);const m=S.useCallback(h=>{const g=s.current,y=Yl(h,g);u.current=y,a(y),g&&Zl(g,y)},[]),p=S.useCallback(()=>{m(u.current)},[m]);S.useEffect(()=>{if(!i)return;const h=rx(t);if(h){m(h);return}const g=r?nx(r,s.current):null;m(g??u.current)},[m,r,i,t]);const b=S.useCallback(h=>{h.preventDefault(),h.stopPropagation();const g=h.currentTarget,y=s.current;if(!y)return;const v=h.pointerId;g.setPointerCapture(v);const _=h.clientX,x=h.clientY,T=u.current;d(!0),document.body.style.cursor="grabbing",document.body.style.userSelect="none";const C=(L,I)=>{const U=Yl({x:T.x+(L-_),y:T.y+(I-x)},y);u.current=U,Zl(y,U)},O=L=>{if(L.pointerId===v){Xl(g,v),g.removeEventListener("pointermove",P),g.removeEventListener("pointerup",O),g.removeEventListener("pointercancel",O),f.current=null,d(!1),a(u.current),document.body.style.cursor="",document.body.style.userSelect="";try{window.localStorage.setItem(t,JSON.stringify(u.current))}catch{}}},P=L=>{L.pointerId===v&&(L.preventDefault(),C(L.clientX,L.clientY))};g.addEventListener("pointermove",P),g.addEventListener("pointerup",O),g.addEventListener("pointercancel",O),f.current=()=>{Xl(g,v),g.removeEventListener("pointermove",P),g.removeEventListener("pointerup",O),g.removeEventListener("pointercancel",O),document.body.style.cursor="",document.body.style.userSelect="",d(!1)}},[t]);return S.useEffect(()=>{const h=()=>{m(u.current)};return window.addEventListener("resize",h),()=>{var g;window.removeEventListener("resize",h),(g=f.current)==null||g.call(f),f.current=null,document.body.style.cursor="",document.body.style.userSelect=""}},[m]),{panelRef:s,position:o,isDragging:l,onDragStart:b,reclamp:p}}const Tp=200,ix=201,sx=202,ox=203,ax=204,Cp=0,cx=2,Pp=0;function hi(e){const t=Number(e.trim());if(!Number.isFinite(t))throw new Error("Invalid trading account login.");return t}function Pc(e){return Math.round(e*1e4)}function lx(e){return e>=2&&e<=7}function dx(e){return{Action:ax,Order:Number(e.orderTicket),Login:hi(e.login),Symbol:e.symbol.replace(/m$/i,""),Type:e.orderType}}function ux(e){return{Action:sx,Login:hi(e.login),Symbol:e.symbol.replace(/m$/i,""),Position:Number(e.positionTicket),Digits:e.digits,Comment:e.comment??"",...e.priceSL!==void 0?{PriceSL:e.priceSL}:{},...e.priceTP!==void 0?{PriceTP:e.priceTP}:{}}}function fx(e){return{Action:ox,Order:Number(e.orderTicket),Login:hi(e.login),Symbol:e.symbol.replace(/m$/i,""),Type:e.orderType,Volume:Pc(e.volumeLots),Digits:e.digits,TypeTime:e.typeTime,Comment:e.comment??"order modify",PriceOrder:e.priceOrder,...e.priceSL!==void 0?{PriceSL:e.priceSL}:{},...e.priceTP!==void 0?{PriceTP:e.priceTP}:{},...e.priceTrigger!==void 0?{PriceTrigger:e.priceTrigger}:{}}}function px(e){const t=e.positionSide==="buy"?1:0;return{Action:Tp,Login:hi(e.login),Symbol:e.symbol.replace(/m$/i,""),Type:t,TypeFill:Cp,Volume:Pc(e.volumeLots),Digits:e.digits,TypeTime:Pp,Comment:e.comment??"",Position:Number(e.positionTicket)}}function mx(e){const t=!lx(e.orderType);return{Action:t?Tp:ix,Login:hi(e.login),Symbol:e.symbol,Type:e.orderType,TypeFill:t?Cp:cx,Volume:Pc(e.volumeLots),Digits:e.digits,TypeTime:e.typeTime??Pp,Comment:e.comment,...e.priceOrder!==void 0?{PriceOrder:e.priceOrder}:{},...e.priceSL!==void 0?{PriceSL:e.priceSL}:{},...e.priceTP!==void 0?{PriceTP:e.priceTP}:{},...e.priceTrigger!==void 0?{PriceTrigger:e.priceTrigger}:{},...e.timeExpiration!==void 0?{TimeExpiration:e.timeExpiration}:{}}}function hx(e){return{async sendRequest(t){return e.post("/api/dealer/send_request",t,{headers:{"Content-Type":"application/json"}})},async getPositions(t){return t.trim()?e.get(`/api/trade/position/page?login=${encodeURIComponent(t)}&offset=0&total=50`):null},async getOrders(t){return t.trim()?e.get(`/api/trade/order/page?login=${encodeURIComponent(t)}&offset=0&total=10`):null},async getDealsTotal(t,n,r){return t.trim()?e.get(`/api/trade/deal/total?login=${encodeURIComponent(t)}&from=${n}&to=${r}`):null},async getDeals(t,n,r,i,s){return t.trim()?e.get(`/api/trade/deal/page?login=${encodeURIComponent(t)}&from=${n}&to=${r}&offset=${i}&total=${s}`):null}}}const gx=new Set(["10009","10008"]);function jt(e){if(e===void 0||e==="")return;const t=Number(e);return Number.isFinite(t)?t:void 0}function yx(e){const t=jt(e);return t===void 0?.01:t/1e4}function bx(e){var t;return(t=e.find(n=>n.answer))==null?void 0:t.answer}function vx(e){var t,n,r,i;for(const s of e){const o=((t=s.result)==null?void 0:t.Retcode)??((n=s.answer)==null?void 0:n.ResultRetcode);if(o)return{retcode:String(o),price:jt(((r=s.result)==null?void 0:r.Price)??((i=s.answer)==null?void 0:i.ResultPrice))}}return{retcode:""}}function Vr(e){return gx.has(e)}function Fr(e,t){var v,_,x;if(!e||typeof e!="object")return null;const r=e.data;if(!(r!=null&&r.length))return null;const i=bx(r),{retcode:s,price:o}=vx(r),a=Vr(s),l=(i==null?void 0:i.ResultDeal)||(i==null?void 0:i.ResultOrder)||(i==null?void 0:i.Order),d=((v=i==null?void 0:i.Symbol)==null?void 0:v.trim())||t.symbol,u=$e(d),f=jt(i==null?void 0:i.Type),m=f!==void 0?f%2===0?"buy":"sell":t.side,p=jt(i==null?void 0:i.ResultPrice)??jt(i==null?void 0:i.PriceOrder)??o??t.openPrice,b=jt(i==null?void 0:i.ResultMarketBid),h=jt(i==null?void 0:i.ResultMarketAsk),g=m==="buy"?b??p:h??p,y=Ew(u);return{ticket:String(l||Math.floor(Date.now()/1e3)),login:((_=i==null?void 0:i.Login)==null?void 0:_.trim())||t.login,symbol:u,displaySymbol:Ks(u),side:m,volumeLots:yx(i==null?void 0:i.Volume)||t.volumeLots,openPrice:p,currentPrice:g,stopLoss:jt(i==null?void 0:i.PriceSL),takeProfit:jt(i==null?void 0:i.PriceTP),comment:((x=i==null?void 0:i.Comment)==null?void 0:x.trim())||t.comment,digits:Math.round(y),retcode:s,isSuccess:a,marketBid:b,marketAsk:h}}function wx(e){return e.type==="buy"?e.marketBid??e.currentPrice:e.marketAsk??e.currentPrice}function xx(e,t){return{async submitOrder(n){const r=n.login.trim();if(!r)return{success:!1,message:"Please select a trading account."};const i=Math.max(.01,n.volumeLots),s=Qs(n.symbolTicker,t),o=Number(Vt(Ht(n.symbolTicker,t))),a=qs(n.executionMode),l=xc(n.orderType),d=n.typeTime;if(!a&&n.priceOrder===void 0)return{success:!1,message:l?"Please set a limit price for this order.":"Please set an order price for pending orders."};if(l&&n.priceTrigger===void 0)return{success:!1,message:"Please set a stop price for stop limit orders."};if(!a&&!Ys(d,n.expirationDateTime??"",n.expirationDay??""))return{success:!1,message:"Please set an expiration date for this order."};const u=a?n.side==="buy"?n.ask:n.bid:n.priceOrder??(n.side==="buy"?n.ask:n.bid),f=a?void 0:vp(d,n.expirationDateTime??"",n.expirationDay??"");try{const m=mx({login:r,symbol:s,volumeLots:i,orderType:n.orderType,digits:o,comment:n.comment.trim(),priceOrder:wc(n.orderType)?n.priceOrder:void 0,priceTrigger:l?n.priceTrigger:void 0,priceSL:n.stopLoss,priceTP:n.takeProfit,typeTime:a?void 0:d,timeExpiration:f}),p=await e.sendRequest(m),b=Fr(p,{login:r,symbol:s,side:gs(n.orderType),volumeLots:i,openPrice:u,digits:o,comment:n.comment.trim()});return b!=null&&b.isSuccess?{success:!0,ticket:b.ticket,side:b.side,volumeLots:b.volumeLots,displaySymbol:b.displaySymbol,price:b.openPrice}:{success:!1,message:p&&typeof p=="object"&&"message"in p&&typeof p.message=="string"?p.message:"Order was not accepted by the dealer."}}catch(m){return{success:!1,message:m instanceof Error?m.message:"Failed to place order."}}},async closePosition(n){try{const r=wx(n),i=px({login:n.login,symbol:n.symbol,positionTicket:n.ticket,volumeLots:n.volumeLots,positionSide:n.type,digits:n.digits,comment:n.comment.trim()}),s=await e.sendRequest(i),o=Fr(s,{login:n.login,symbol:n.symbol,side:n.type==="buy"?"sell":"buy",volumeLots:n.volumeLots,openPrice:r,digits:n.digits,comment:n.comment.trim()});return o&&!Vr(o.retcode)?{success:!1,message:`Close failed (retcode ${o.retcode}).`}:{success:!0}}catch(r){return{success:!1,message:r instanceof Error?r.message:"Failed to close position."}}},async deleteOrder(n){try{const r=dx({login:n.login,orderTicket:n.ticket,symbol:n.symbol,orderType:n.orderType}),i=await e.sendRequest(r),s=Fr(i,{login:n.login,symbol:n.symbol,side:n.side,volumeLots:n.volumeLots,openPrice:n.orderPrice,digits:n.digits,comment:n.comment});return s&&!Vr(s.retcode)?{success:!1,message:`Delete failed (retcode ${s.retcode}).`}:{success:!0}}catch(r){return{success:!1,message:r instanceof Error?r.message:"Failed to delete order."}}},async modifyOrder(n,r){try{const i=fx({login:n.login,orderTicket:n.ticket,symbol:n.symbol,orderType:n.orderType,volumeLots:r.volumeLots,digits:n.digits,priceOrder:r.priceOrder,priceTrigger:r.priceTrigger,priceSL:r.stopLoss,priceTP:r.takeProfit,typeTime:n.typeTime,comment:r.comment.trim()||"order modify"}),s=await e.sendRequest(i),o=Fr(s,{login:n.login,symbol:n.symbol,side:n.side,volumeLots:r.volumeLots,openPrice:r.priceOrder,digits:n.digits,comment:r.comment.trim()});return o&&!Vr(o.retcode)?{success:!1,message:`Modify failed (retcode ${o.retcode}).`}:{success:!0}}catch(i){return{success:!1,message:i instanceof Error?i.message:"Failed to modify order."}}},async modifyPosition(n,r){try{const i=ux({login:n.login,positionTicket:n.ticket,symbol:n.symbol,digits:n.digits,priceSL:r.stopLoss,priceTP:r.takeProfit,comment:r.comment.trim()}),s=await e.sendRequest(i),o=Fr(s,{login:n.login,symbol:n.symbol,side:n.type,volumeLots:n.volumeLots,openPrice:n.openPrice,digits:n.digits,comment:r.comment.trim()});return o&&!Vr(o.retcode)?{success:!1,message:`Modify failed (retcode ${o.retcode}).`}:{success:!0}}catch(i){return{success:!1,message:i instanceof Error?i.message:"Failed to modify position."}}}}}function Ep(e,t){return function(){return e.apply(t,arguments)}}const{toString:_x}=Object.prototype,{getPrototypeOf:vr}=Object,{iterator:gi,toStringTag:kp}=Symbol,bs=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),ti=(e,t)=>{let n=e;const r=[];for(;n!=null&&n!==Object.prototype;){if(r.indexOf(n)!==-1)return!1;if(r.push(n),bs(n,t))return!0;n=vr(n)}return!1},Sx=(e,t)=>e!=null&&ti(e,t)?e[t]:void 0,Ec=(e=>t=>{const n=_x.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),xt=e=>(e=e.toLowerCase(),t=>Ec(t)===e),Xs=e=>t=>typeof t===e,{isArray:Fn}=Array,wr=Xs("undefined");function Nr(e){return e!==null&&!wr(e)&&e.constructor!==null&&!wr(e.constructor)&&Je(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Ap=xt("ArrayBuffer");function Tx(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Ap(e.buffer),t}const Cx=Xs("string"),Je=Xs("function"),Op=Xs("number"),Rr=e=>e!==null&&typeof e=="object",Px=e=>e===!0||e===!1,Zi=e=>{if(!Rr(e))return!1;const t=vr(e);return(t===null||t===Object.prototype||vr(t)===null)&&!ti(e,kp)&&!ti(e,gi)},Ex=e=>{if(!Rr(e)||Nr(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},kx=xt("Date"),Ax=xt("File"),Ox=e=>!!(e&&typeof e.uri<"u"),Nx=e=>e&&typeof e.getParts<"u",Rx=xt("Blob"),Lx=xt("FileList"),Dx=e=>Rr(e)&&Je(e.pipe);function jx(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const Jl=jx(),ed=typeof Jl.FormData<"u"?Jl.FormData:void 0,Mx=e=>{if(!e)return!1;if(ed&&e instanceof ed)return!0;const t=vr(e);if(!t||t===Object.prototype||!Je(e.append))return!1;const n=Ec(e);return n==="formdata"||n==="object"&&Je(e.toString)&&e.toString()==="[object FormData]"},Ix=xt("URLSearchParams"),[Fx,Ux,Bx,Wx]=["ReadableStream","Request","Response","Headers"].map(xt),$x=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function yi(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,i;if(typeof e!="object"&&(e=[e]),Fn(e))for(r=0,i=e.length;r<i;r++)t.call(null,e[r],r,e);else{if(Nr(e))return;const s=n?Object.getOwnPropertyNames(e):Object.keys(e),o=s.length;let a;for(r=0;r<o;r++)a=s[r],t.call(null,e[a],a,e)}}function Np(e,t){if(Nr(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r=n.length,i;for(;r-- >0;)if(i=n[r],t===i.toLowerCase())return i;return null}const wn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Rp=e=>!wr(e)&&e!==wn;function ea(...e){const{caseless:t,skipUndefined:n}=Rp(this)&&this||{},r={},i=(s,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const a=t&&typeof o=="string"&&Np(r,o)||o,l=bs(r,a)?r[a]:void 0;Zi(l)&&Zi(s)?r[a]=ea(l,s):Zi(s)?r[a]=ea({},s):Fn(s)?r[a]=s.slice():(!n||!wr(s))&&(r[a]=s)};for(let s=0,o=e.length;s<o;s++){const a=e[s];if(!a||Nr(a)||(yi(a,i),typeof a!="object"||Fn(a)))continue;const l=Object.getOwnPropertySymbols(a);for(let d=0;d<l.length;d++){const u=l[d];e_.call(a,u)&&i(a[u],u)}}return r}const Vx=(e,t,n,{allOwnKeys:r}={})=>(yi(t,(i,s)=>{n&&Je(i)?Object.defineProperty(e,s,{__proto__:null,value:Ep(i,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,s,{__proto__:null,value:i,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),Hx=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),zx=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{__proto__:null,value:t.prototype}),n&&Object.assign(e.prototype,n)},Kx=(e,t,n,r)=>{let i,s,o;const a={};if(t=t||{},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),s=i.length;s-- >0;)o=i[s],(!r||r(o,e,t))&&!a[o]&&(t[o]=e[o],a[o]=!0);e=n!==!1&&vr(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},Gx=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},qx=e=>{if(!e)return null;if(Fn(e))return e;let t=e.length;if(!Op(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},Qx=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&vr(Uint8Array)),Yx=(e,t)=>{const r=(e&&e[gi]).call(e);let i;for(;(i=r.next())&&!i.done;){const s=i.value;t.call(e,s[0],s[1])}},Zx=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},Xx=xt("HTMLFormElement"),Jx=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,i){return r.toUpperCase()+i}),{propertyIsEnumerable:e_}=Object.prototype,t_=xt("RegExp"),Lp=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};yi(n,(i,s)=>{let o;(o=t(i,s,e))!==!1&&(r[s]=o||i)}),Object.defineProperties(e,r)},n_=e=>{Lp(e,(t,n)=>{if(Je(e)&&["arguments","caller","callee"].includes(n))return!1;const r=e[n];if(Je(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},r_=(e,t)=>{const n={},r=i=>{i.forEach(s=>{n[s]=!0})};return Fn(e)?r(e):r(String(e).split(t)),n},i_=()=>{},s_=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function o_(e){return!!(e&&Je(e.append)&&e[kp]==="FormData"&&e[gi])}const a_=e=>{const t=new WeakSet,n=r=>{if(Rr(r)){if(t.has(r))return;if(Nr(r))return r;if(!("toJSON"in r)){t.add(r);const i=Fn(r)?[]:{};return yi(r,(s,o)=>{const a=n(s);!wr(a)&&(i[o]=a)}),t.delete(r),i}}return r};return n(e)},c_=xt("AsyncFunction"),l_=e=>e&&(Rr(e)||Je(e))&&Je(e.then)&&Je(e.catch),Dp=((e,t)=>e?setImmediate:t?((n,r)=>(wn.addEventListener("message",({source:i,data:s})=>{i===wn&&s===n&&r.length&&r.shift()()},!1),i=>{r.push(i),wn.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Je(wn.postMessage)),d_=typeof queueMicrotask<"u"?queueMicrotask.bind(wn):typeof process<"u"&&process.nextTick||Dp,jp=e=>e!=null&&Je(e[gi]),u_=e=>e!=null&&ti(e,gi)&&jp(e),A={isArray:Fn,isArrayBuffer:Ap,isBuffer:Nr,isFormData:Mx,isArrayBufferView:Tx,isString:Cx,isNumber:Op,isBoolean:Px,isObject:Rr,isPlainObject:Zi,isEmptyObject:Ex,isReadableStream:Fx,isRequest:Ux,isResponse:Bx,isHeaders:Wx,isUndefined:wr,isDate:kx,isFile:Ax,isReactNativeBlob:Ox,isReactNative:Nx,isBlob:Rx,isRegExp:t_,isFunction:Je,isStream:Dx,isURLSearchParams:Ix,isTypedArray:Qx,isFileList:Lx,forEach:yi,merge:ea,extend:Vx,trim:$x,stripBOM:Hx,inherits:zx,toFlatObject:Kx,kindOf:Ec,kindOfTest:xt,endsWith:Gx,toArray:qx,forEachEntry:Yx,matchAll:Zx,isHTMLForm:Xx,hasOwnProperty:bs,hasOwnProp:bs,hasOwnInPrototypeChain:ti,getSafeProp:Sx,reduceDescriptors:Lp,freezeMethods:n_,toObjectSet:r_,toCamelCase:Jx,noop:i_,toFiniteNumber:s_,findKey:Np,global:wn,isContextDefined:Rp,isSpecCompliantForm:o_,toJSONObject:a_,isAsyncFn:c_,isThenable:l_,setImmediate:Dp,asap:d_,isIterable:jp,isSafeIterable:u_},f_=A.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"]),p_=e=>{const t={};let n,r,i;return e&&e.split(`
|
|
74
|
-
`).forEach(function(o){i=o.indexOf(":"),n=o.substring(0,i).trim().toLowerCase(),r=o.substring(i+1).trim(),!(!n||t[n]&&
|
|
75
|
-
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(i=>r.set(i)),r}static accessor(t){const r=(this[td]=this[td]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=Ur(o);r[a]||(__(i,o),r[a]=!0)}return A.isArray(t)?t.forEach(s):s(t),this}};Ge.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);A.reduceDescriptors(Ge.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});A.freezeMethods(Ge);const S_="[REDACTED ****]";function T_(e){if(A.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(A.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}function C_(e,t){const n=new Set(t.map(s=>String(s).toLowerCase())),r=[],i=s=>{if(s===null||typeof s!="object"||A.isBuffer(s))return s;if(r.indexOf(s)!==-1)return;s instanceof Ge&&(s=s.toJSON()),r.push(s);let o;if(A.isArray(s))o=[],s.forEach((a,l)=>{const d=i(a);A.isUndefined(d)||(o[l]=d)});else{if(!A.isPlainObject(s)&&T_(s))return r.pop(),s;o=Object.create(null);for(const[a,l]of Object.entries(s)){const d=n.has(a.toLowerCase())?S_:i(l);A.isUndefined(d)||(o[a]=d)}}return r.pop(),o};return i(e)}let q=class Ip extends Error{static from(t,n,r,i,s,o){const a=new Ip(t.message,n||t.code,r,i,s);return Object.defineProperty(a,"cause",{__proto__:null,value:t,writable:!0,enumerable:!1,configurable:!0}),a.name=t.name,t.status!=null&&a.status==null&&(a.status=t.status),o&&Object.assign(a,o),a}constructor(t,n,r,i,s){super(t),Object.defineProperty(this,"message",{__proto__:null,value:t,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,n&&(this.code=n),r&&(this.config=r),i&&(this.request=i),s&&(this.response=s,this.status=s.status)}toJSON(){const t=this.config,n=t&&A.hasOwnProp(t,"redact")?t.redact:void 0,r=A.isArray(n)&&n.length>0?C_(t,n):A.toJSONObject(t);return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:r,code:this.code,status:this.status}}};q.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";q.ERR_BAD_OPTION="ERR_BAD_OPTION";q.ECONNABORTED="ECONNABORTED";q.ETIMEDOUT="ETIMEDOUT";q.ECONNREFUSED="ECONNREFUSED";q.ERR_NETWORK="ERR_NETWORK";q.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";q.ERR_DEPRECATED="ERR_DEPRECATED";q.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";q.ERR_BAD_REQUEST="ERR_BAD_REQUEST";q.ERR_CANCELED="ERR_CANCELED";q.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";q.ERR_INVALID_URL="ERR_INVALID_URL";q.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const P_=null,Fp=100;function ta(e){return A.isPlainObject(e)||A.isArray(e)}function Up(e){return A.endsWith(e,"[]")?e.slice(0,-2):e}function Eo(e,t,n){return e?e.concat(t).map(function(i,s){return i=Up(i),!n&&s?"["+i+"]":i}).join(n?".":""):t}function E_(e){return A.isArray(e)&&!e.some(ta)}const k_=A.toFlatObject(A,{},null,function(t){return/^is[A-Z]/.test(t)});function Js(e,t,n){if(!A.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=A.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(v,_){return!A.isUndefined(_[v])});const r=n.metaTokens,i=n.visitor||b,s=n.dots,o=n.indexes,a=n.Blob||typeof Blob<"u"&&Blob,l=n.maxDepth===void 0?Fp:n.maxDepth,d=a&&A.isSpecCompliantForm(t),u=[];if(!A.isFunction(i))throw new TypeError("visitor must be a function");function f(y){if(y===null)return"";if(A.isDate(y))return y.toISOString();if(A.isBoolean(y))return y.toString();if(!d&&A.isBlob(y))throw new q("Blob is not supported. Use a Buffer instead.");if(A.isArrayBuffer(y)||A.isTypedArray(y)){if(d&&typeof a=="function")return new a([y]);if(typeof Buffer<"u")return Buffer.from(y);throw new q("Blob is not supported. Use a Buffer instead.",q.ERR_NOT_SUPPORT)}return y}function m(y){if(y>l)throw new q("Object is too deeply nested ("+y+" levels). Max depth: "+l,q.ERR_FORM_DATA_DEPTH_EXCEEDED)}function p(y,v){if(l===1/0)return JSON.stringify(y);const _=[];return JSON.stringify(y,function(T,C){if(!A.isObject(C))return C;for(;_.length&&_[_.length-1]!==this;)_.pop();return _.push(C),m(v+_.length-1),C})}function b(y,v,_){let x=y;if(A.isReactNative(t)&&A.isReactNativeBlob(y))return t.append(Eo(_,v,s),f(y)),!1;if(y&&!_&&typeof y=="object"){if(A.endsWith(v,"{}"))v=r?v:v.slice(0,-2),y=p(y,1);else if(A.isArray(y)&&E_(y)||(A.isFileList(y)||A.endsWith(v,"[]"))&&(x=A.toArray(y)))return v=Up(v),x.forEach(function(C,O){!(A.isUndefined(C)||C===null)&&t.append(o===!0?Eo([v],O,s):o===null?v:v+"[]",f(C))}),!1}return ta(y)?!0:(t.append(Eo(_,v,s),f(y)),!1)}const h=Object.assign(k_,{defaultVisitor:b,convertValue:f,isVisitable:ta});function g(y,v,_=0){if(!A.isUndefined(y)){if(m(_),u.indexOf(y)!==-1)throw new Error("Circular reference detected in "+v.join("."));u.push(y),A.forEach(y,function(T,C){(!(A.isUndefined(T)||T===null)&&i.call(t,T,A.isString(C)?C.trim():C,v,h))===!0&&g(T,v?v.concat(C):[C],_+1)}),u.pop()}}if(!A.isObject(e))throw new TypeError("data must be an object");return g(e),t}function nd(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(r){return t[r]})}function Ac(e,t){this._pairs=[],e&&Js(e,this,t)}const Bp=Ac.prototype;Bp.append=function(t,n){this._pairs.push([t,n])};Bp.toString=function(t){const n=t?r=>t.call(this,r,nd):nd;return this._pairs.map(function(i){return n(i[0])+"="+n(i[1])},"").join("&")};function A_(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Wp(e,t,n){if(!t)return e;e=e||"";const r=A.isFunction(n)?{serialize:n}:n,i=A.getSafeProp(r,"encode")||A_,s=A.getSafeProp(r,"serialize");let o;if(s?o=s(t,r):o=A.isURLSearchParams(t)?t.toString():new Ac(t,r).toString(i),o){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class rd{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){A.forEach(this.handlers,function(r){r!==null&&t(r)})}}const Oc={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},O_=typeof URLSearchParams<"u"?URLSearchParams:Ac,N_=typeof FormData<"u"?FormData:null,R_=typeof Blob<"u"?Blob:null,L_={isBrowser:!0,classes:{URLSearchParams:O_,FormData:N_,Blob:R_},protocols:["http","https","file","blob","url","data"]},Nc=typeof window<"u"&&typeof document<"u",na=typeof navigator=="object"&&navigator||void 0,D_=Nc&&(!na||["ReactNative","NativeScript","NS"].indexOf(na.product)<0),j_=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",M_=Nc&&window.location.href||"http://localhost",I_=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Nc,hasStandardBrowserEnv:D_,hasStandardBrowserWebWorkerEnv:j_,navigator:na,origin:M_},Symbol.toStringTag,{value:"Module"})),Ve={...I_,...L_};function F_(e,t){return Js(e,new Ve.classes.URLSearchParams,{visitor:function(n,r,i,s){return Ve.isNode&&A.isBuffer(n)?(this.append(r,n.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)},...t})}const id=Fp;function $p(e){if(e>id)throw new q("FormData field is too deeply nested ("+e+" levels). Max depth: "+id,q.ERR_FORM_DATA_DEPTH_EXCEEDED)}function U_(e){const t=[],n=/\w+|\[(\w*)]/g;let r;for(;(r=n.exec(e))!==null;)$p(t.length),t.push(r[0]==="[]"?"":r[1]||r[0]);return t}function B_(e){const t={},n=Object.keys(e);let r;const i=n.length;let s;for(r=0;r<i;r++)s=n[r],t[s]=e[s];return t}function Vp(e){function t(n,r,i,s){$p(s);let o=n[s++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),l=s>=n.length;return o=!o&&A.isArray(i)?i.length:o,l?(A.hasOwnProp(i,o)?i[o]=A.isArray(i[o])?i[o].concat(r):[i[o],r]:i[o]=r,!a):((!A.hasOwnProp(i,o)||!A.isObject(i[o]))&&(i[o]=[]),t(n,r,i[o],s)&&A.isArray(i[o])&&(i[o]=B_(i[o])),!a)}if(A.isFormData(e)&&A.isFunction(e.entries)){const n={};return A.forEachEntry(e,(r,i)=>{t(U_(r),i,n,0)}),n}return null}const qn=(e,t)=>e!=null&&A.hasOwnProp(e,t)?e[t]:void 0;function W_(e,t,n){if(A.isString(e))try{return(t||JSON.parse)(e),A.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const bi={transitional:Oc,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",i=r.indexOf("application/json")>-1,s=A.isObject(t);if(s&&A.isHTMLForm(t)&&(t=new FormData(t)),A.isFormData(t))return i?JSON.stringify(Vp(t)):t;if(A.isArrayBuffer(t)||A.isBuffer(t)||A.isStream(t)||A.isFile(t)||A.isBlob(t)||A.isReadableStream(t))return t;if(A.isArrayBufferView(t))return t.buffer;if(A.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(s){const l=qn(this,"formSerializer");if(r.indexOf("application/x-www-form-urlencoded")>-1)return F_(t,l).toString();if((a=A.isFileList(t))||r.indexOf("multipart/form-data")>-1){const d=qn(this,"env"),u=d&&d.FormData;return Js(a?{"files[]":t}:t,u&&new u,l)}}return s||i?(n.setContentType("application/json",!1),W_(t)):t}],transformResponse:[function(t){const n=qn(this,"transitional")||bi.transitional,r=n&&n.forcedJSONParsing,i=qn(this,"responseType"),s=i==="json";if(A.isResponse(t)||A.isReadableStream(t))return t;if(t&&A.isString(t)&&(r&&!i||s)){const a=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(t,qn(this,"parseReviver"))}catch(l){if(a)throw l.name==="SyntaxError"?q.from(l,q.ERR_BAD_RESPONSE,this,null,qn(this,"response")):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ve.classes.FormData,Blob:Ve.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};A.forEach(["delete","get","head","post","put","patch","query"],e=>{bi.headers[e]={}});function ko(e,t){const n=this||bi,r=t||n,i=Ge.from(r.headers);let s=r.data;return A.forEach(e,function(a){s=a.call(n,s,i.normalize(),t?t.status:void 0)}),i.normalize(),s}function Hp(e){return!!(e&&e.__CANCEL__)}let vi=class extends q{constructor(t,n,r){super(t??"canceled",q.ERR_CANCELED,n,r),this.name="CanceledError",this.__CANCEL__=!0}};function zp(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new q("Request failed with status code "+n.status,n.status>=400&&n.status<500?q.ERR_BAD_REQUEST:q.ERR_BAD_RESPONSE,n.config,n.request,n))}function $_(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}function V_(e,t){e=e||10;const n=new Array(e),r=new Array(e);let i=0,s=0,o;return t=t!==void 0?t:1e3,function(l){const d=Date.now(),u=r[s];o||(o=d),n[i]=l,r[i]=d;let f=s,m=0;for(;f!==i;)m+=n[f++],f=f%e;if(i=(i+1)%e,i===s&&(s=(s+1)%e),d-o<t)return;const p=u&&d-u;return p?Math.round(m*1e3/p):void 0}}function H_(e,t){let n=0,r=1e3/t,i,s;const o=(d,u=Date.now())=>{n=u,i=null,s&&(clearTimeout(s),s=null),e(...d)};return[(...d)=>{const u=Date.now(),f=u-n;f>=r?o(d,u):(i=d,s||(s=setTimeout(()=>{s=null,o(i)},r-f)))},()=>i&&o(i)]}const vs=(e,t,n=3)=>{let r=0;const i=V_(50,250);return H_(s=>{if(!s||typeof s.loaded!="number")return;const o=s.loaded,a=s.lengthComputable?s.total:void 0,l=a!=null?Math.min(o,a):o,d=Math.max(0,l-r),u=i(d);r=Math.max(r,l);const f={loaded:l,total:a,progress:a?l/a:void 0,bytes:d,rate:u||void 0,estimated:u&&a?(a-l)/u:void 0,event:s,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(f)},n)},sd=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},od=e=>(...t)=>A.asap(()=>e(...t)),z_=Ve.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,Ve.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(Ve.origin),Ve.navigator&&/(msie|trident)/i.test(Ve.navigator.userAgent)):()=>!0,K_=Ve.hasStandardBrowserEnv?{write(e,t,n,r,i,s,o){if(typeof document>"u")return;const a=[`${e}=${encodeURIComponent(t)}`];A.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),A.isString(r)&&a.push(`path=${r}`),A.isString(i)&&a.push(`domain=${i}`),s===!0&&a.push("secure"),A.isString(o)&&a.push(`SameSite=${o}`),document.cookie=a.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.split(";");for(let n=0;n<t.length;n++){const r=t[n].replace(/^\s+/,""),i=r.indexOf("=");if(i!==-1&&r.slice(0,i)===e)try{return decodeURIComponent(r.slice(i+1))}catch{return r.slice(i+1)}}return null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function G_(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function q_(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}const Q_=/^https?:(?!\/\/)/i,Y_=/[\t\n\r]/g;function Z_(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}function X_(e){return Z_(e).replace(Y_,"")}function ad(e,t){if(typeof e=="string"&&Q_.test(X_(e)))throw new q('Invalid URL: missing "//" after protocol',q.ERR_INVALID_URL,t)}function Kp(e,t,n,r){ad(t,r);let i=!G_(t);return e&&(i||n===!1)?(ad(e,r),q_(e,t)):t}const cd=e=>e instanceof Ge?{...e}:e;function Un(e,t){e=e||{},t=t||{};const n=Object.create(null);Object.defineProperty(n,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function r(u,f,m,p){return A.isPlainObject(u)&&A.isPlainObject(f)?A.merge.call({caseless:p},u,f):A.isPlainObject(f)?A.merge({},f):A.isArray(f)?f.slice():f}function i(u,f,m,p){if(A.isUndefined(f)){if(!A.isUndefined(u))return r(void 0,u,m,p)}else return r(u,f,m,p)}function s(u,f){if(!A.isUndefined(f))return r(void 0,f)}function o(u,f){if(A.isUndefined(f)){if(!A.isUndefined(u))return r(void 0,u)}else return r(void 0,f)}function a(u){const f=A.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!A.isUndefined(f))if(A.isPlainObject(f)){if(A.hasOwnProp(f,u))return f[u]}else return;const m=A.hasOwnProp(e,"transitional")?e.transitional:void 0;if(A.isPlainObject(m)&&A.hasOwnProp(m,u))return m[u]}function l(u,f,m){if(A.hasOwnProp(t,m))return r(u,f);if(A.hasOwnProp(e,m))return r(void 0,u)}const d={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,allowedSocketPaths:o,responseEncoding:o,validateStatus:l,headers:(u,f,m)=>i(cd(u),cd(f),m,!0)};return A.forEach(Object.keys({...e,...t}),function(f){if(f==="__proto__"||f==="constructor"||f==="prototype")return;const m=A.hasOwnProp(d,f)?d[f]:i,p=A.hasOwnProp(e,f)?e[f]:void 0,b=A.hasOwnProp(t,f)?t[f]:void 0,h=m(p,b,f);A.isUndefined(h)&&m!==l||(n[f]=h)}),A.hasOwnProp(t,"validateStatus")&&A.isUndefined(t.validateStatus)&&a("validateStatusUndefinedResolves")===!1&&(A.hasOwnProp(e,"validateStatus")?n.validateStatus=r(void 0,e.validateStatus):delete n.validateStatus),n}const J_=["content-type","content-length"];function eS(e,t,n){if(n!=="content-only"){e.set(t);return}Object.entries(t||{}).forEach(([r,i])=>{J_.includes(r.toLowerCase())&&e.set(r,i)})}const tS=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,n)=>String.fromCharCode(parseInt(n,16)));function Gp(e){const t=Un({},e),n=m=>A.hasOwnProp(t,m)?t[m]:void 0,r=n("data");let i=n("withXSRFToken");const s=n("xsrfHeaderName"),o=n("xsrfCookieName");let a=n("headers");const l=n("auth"),d=n("baseURL"),u=n("allowAbsoluteUrls"),f=n("url");if(t.headers=a=Ge.from(a),t.url=Wp(Kp(d,f,u,t),n("params"),n("paramsSerializer")),l){const m=A.getSafeProp(l,"username")||"",p=A.getSafeProp(l,"password")||"";try{a.set("Authorization","Basic "+btoa(m+":"+(p?tS(p):"")))}catch(b){throw q.from(b,q.ERR_BAD_OPTION_VALUE,e)}}if(A.isFormData(r)&&(Ve.hasStandardBrowserEnv||Ve.hasStandardBrowserWebWorkerEnv||A.isReactNative(r)?a.setContentType(void 0):A.isFunction(r.getHeaders)&&eS(a,r.getHeaders(),n("formDataHeaderPolicy"))),Ve.hasStandardBrowserEnv&&(A.isFunction(i)&&(i=i(t)),i===!0||i==null&&z_(t.url))){const p=s&&o&&K_.read(o);p&&a.set(s,p)}return t}const nS=typeof XMLHttpRequest<"u",rS=nS&&function(e){return new Promise(function(n,r){const i=Gp(e);let s=i.data;const o=Ge.from(i.headers).normalize();let{responseType:a,onUploadProgress:l,onDownloadProgress:d}=i,u,f,m,p,b;function h(){p&&p(),b&&b(),i.cancelToken&&i.cancelToken.unsubscribe(u),i.signal&&i.signal.removeEventListener("abort",u)}let g=new XMLHttpRequest;g.open(i.method.toUpperCase(),i.url,!0),g.timeout=i.timeout;function y(){if(!g)return;const _=Ge.from("getAllResponseHeaders"in g&&g.getAllResponseHeaders()),T={data:!a||a==="text"||a==="json"?g.responseText:g.response,status:g.status,statusText:g.statusText,headers:_,config:e,request:g};zp(function(O){n(O),h()},function(O){r(O),h()},T),g=null}"onloadend"in g?g.onloadend=y:g.onreadystatechange=function(){!g||g.readyState!==4||g.status===0&&!(g.responseURL&&g.responseURL.startsWith("file:"))||setTimeout(y)},g.onabort=function(){g&&(r(new q("Request aborted",q.ECONNABORTED,e,g)),h(),g=null)},g.onerror=function(x){const T=x&&x.message?x.message:"Network Error",C=new q(T,q.ERR_NETWORK,e,g);C.event=x||null,r(C),h(),g=null},g.ontimeout=function(){let x=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const T=i.transitional||Oc;i.timeoutErrorMessage&&(x=i.timeoutErrorMessage),r(new q(x,T.clarifyTimeoutError?q.ETIMEDOUT:q.ECONNABORTED,e,g)),h(),g=null},s===void 0&&o.setContentType(null),"setRequestHeader"in g&&A.forEach(Mp(o),function(x,T){g.setRequestHeader(T,x)}),A.isUndefined(i.withCredentials)||(g.withCredentials=!!i.withCredentials),a&&a!=="json"&&(g.responseType=i.responseType),d&&([m,b]=vs(d,!0),g.addEventListener("progress",m)),l&&g.upload&&([f,p]=vs(l),g.upload.addEventListener("progress",f),g.upload.addEventListener("loadend",p)),(i.cancelToken||i.signal)&&(u=_=>{g&&(r(!_||_.type?new vi(null,e,g):_),g.abort(),h(),g=null)},i.cancelToken&&i.cancelToken.subscribe(u),i.signal&&(i.signal.aborted?u():i.signal.addEventListener("abort",u)));const v=$_(i.url);if(v&&!Ve.protocols.includes(v)){r(new q("Unsupported protocol "+v+":",q.ERR_BAD_REQUEST,e)),h();return}g.send(s||null)})},iS=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const n=new AbortController;let r=!1;const i=function(l){if(!r){r=!0,o();const d=l instanceof Error?l:this.reason;n.abort(d instanceof q?d:new vi(d instanceof Error?d.message:d))}};let s=t&&setTimeout(()=>{s=null,i(new q(`timeout of ${t}ms exceeded`,q.ETIMEDOUT))},t);const o=()=>{e&&(s&&clearTimeout(s),s=null,e.forEach(l=>{l.unsubscribe?l.unsubscribe(i):l.removeEventListener("abort",i)}),e=null)};e.forEach(l=>l.addEventListener("abort",i,{once:!0}));const{signal:a}=n;return a.unsubscribe=()=>A.asap(o),a},sS=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,i;for(;r<n;)i=r+t,yield e.slice(r,i),r=i},oS=async function*(e,t){for await(const n of aS(e))yield*sS(n,t)},aS=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:r}=await t.read();if(n)break;yield r}}finally{await t.cancel()}},ld=(e,t,n,r)=>{const i=oS(e,t);let s=0,o,a=l=>{o||(o=!0,r&&r(l))};return new ReadableStream({async pull(l){try{const{done:d,value:u}=await i.next();if(d){a(),l.close();return}let f=u.byteLength;if(n){let m=s+=f;n(m)}l.enqueue(new Uint8Array(u))}catch(d){throw a(d),d}},cancel(l){return a(l),i.return()}},{highWaterMark:2})},ws=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,cS=(e,t,n)=>t+2<n&&ws(e.charCodeAt(t+1))&&ws(e.charCodeAt(t+2));function lS(e){if(!e||typeof e!="string"||!e.startsWith("data:"))return 0;const t=e.indexOf(",");if(t<0)return 0;const n=e.slice(5,t),r=e.slice(t+1);if(/;base64/i.test(n)){let o=r.length;const a=r.length;for(let p=0;p<a;p++)if(r.charCodeAt(p)===37&&p+2<a){const b=r.charCodeAt(p+1),h=r.charCodeAt(p+2);ws(b)&&ws(h)&&(o-=2,p+=2)}let l=0,d=a-1;const u=p=>p>=2&&r.charCodeAt(p-2)===37&&r.charCodeAt(p-1)===51&&(r.charCodeAt(p)===68||r.charCodeAt(p)===100);d>=0&&(r.charCodeAt(d)===61?(l++,d--):u(d)&&(l++,d-=3)),l===1&&d>=0&&(r.charCodeAt(d)===61||u(d))&&l++;const m=Math.floor(o/4)*3-(l||0);return m>0?m:0}let s=0;for(let o=0,a=r.length;o<a;o++){const l=r.charCodeAt(o);if(l===37&&cS(r,o,a))s+=1,o+=2;else if(l<128)s+=1;else if(l<2048)s+=2;else if(l>=55296&&l<=56319&&o+1<a){const d=r.charCodeAt(o+1);d>=56320&&d<=57343?(s+=4,o++):s+=3}else s+=3}return s}const Rc="1.18.1",dd=64*1024,{isFunction:Ui}=A,dS=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,n)=>String.fromCharCode(parseInt(n,16))),ud=e=>{if(!A.isString(e))return e;try{return decodeURIComponent(e)}catch{return e}},fd=(e,...t)=>{try{return!!e(...t)}catch{return!1}},uS=e=>{const t=e.indexOf("://");let n=e;return t!==-1&&(n=n.slice(t+3)),n.includes("@")||n.includes(":")},fS=e=>{const t=A.global!==void 0&&A.global!==null?A.global:globalThis,{ReadableStream:n,TextEncoder:r}=t;e=A.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:i,Request:s,Response:o}=e,a=i?Ui(i):typeof fetch=="function",l=Ui(s),d=Ui(o);if(!a)return!1;const u=a&&Ui(n),f=a&&(typeof r=="function"?(y=>v=>y.encode(v))(new r):async y=>new Uint8Array(await new s(y).arrayBuffer())),m=l&&u&&fd(()=>{let y=!1;const v=new s(Ve.origin,{body:new n,method:"POST",get duplex(){return y=!0,"half"}}),_=v.headers.has("Content-Type");return v.body!=null&&v.body.cancel(),y&&!_}),p=d&&u&&fd(()=>A.isReadableStream(new o("").body)),b={stream:p&&(y=>y.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(y=>{!b[y]&&(b[y]=(v,_)=>{let x=v&&v[y];if(x)return x.call(v);throw new q(`Response type '${y}' is not supported`,q.ERR_NOT_SUPPORT,_)})});const h=async y=>{if(y==null)return 0;if(A.isBlob(y))return y.size;if(A.isSpecCompliantForm(y))return(await new s(Ve.origin,{method:"POST",body:y}).arrayBuffer()).byteLength;if(A.isArrayBufferView(y)||A.isArrayBuffer(y))return y.byteLength;if(A.isURLSearchParams(y)&&(y=y+""),A.isString(y))return(await f(y)).byteLength},g=async(y,v)=>{const _=A.toFiniteNumber(y.getContentLength());return _??h(v)};return async y=>{let{url:v,method:_,data:x,signal:T,cancelToken:C,timeout:O,onDownloadProgress:P,onUploadProgress:L,responseType:I,headers:U,withCredentials:N="same-origin",fetchOptions:V,maxContentLength:M,maxBodyLength:z}=Gp(y);const k=A.isNumber(M)&&M>-1,j=A.isNumber(z)&&z>-1,D=B=>A.hasOwnProp(y,B)?y[B]:void 0;let R=i||fetch;I=I?(I+"").toLowerCase():"text";let W=iS([T,C&&C.toAbortSignal()],O),F=null;const G=W&&W.unsubscribe&&(()=>{W.unsubscribe()});let X,de=null;const ne=()=>new q("Request body larger than maxBodyLength limit",q.ERR_BAD_REQUEST,y,F);try{let B;const $=D("auth");if($){const re=A.getSafeProp($,"username")||"",_e=A.getSafeProp($,"password")||"";B={username:re,password:_e}}if(uS(v)){const re=new URL(v,Ve.origin);if(!B&&(re.username||re.password)){const _e=ud(re.username),Fe=ud(re.password);B={username:_e,password:Fe}}(re.username||re.password)&&(re.username="",re.password="",v=re.href)}if(B&&(U.delete("authorization"),U.set("Authorization","Basic "+btoa(dS((B.username||"")+":"+(B.password||""))))),k&&typeof v=="string"&&v.startsWith("data:")&&lS(v)>M)throw new q("maxContentLength size of "+M+" exceeded",q.ERR_BAD_RESPONSE,y,F);if(j&&_!=="get"&&_!=="head"){const re=await h(x);if(typeof re=="number"&&isFinite(re)&&(X=re,re>z))throw ne()}const Q=j&&(A.isReadableStream(x)||A.isStream(x)),ye=(re,_e,Fe)=>ld(re,dd,He=>{if(j&&He>z)throw de=ne();_e&&_e(He)},Fe);if(m&&_!=="get"&&_!=="head"&&(L||Q)){if(X=X??await g(U,x),X!==0||Q){let re=new s(v,{method:"POST",body:x,duplex:"half"}),_e;if(A.isFormData(x)&&(_e=re.headers.get("content-type"))&&U.setContentType(_e),re.body){const[Fe,He]=L&&sd(X,vs(od(L)))||[];x=ye(re.body,Fe,He)}}}else if(Q&&!l&&u&&_!=="get"&&_!=="head")x=ye(x);else if(Q&&l&&!m&&_!=="get"&&_!=="head")throw new q("Stream request bodies are not supported by the current fetch implementation",q.ERR_NOT_SUPPORT,y,F);A.isString(N)||(N=N?"include":"omit");const ce=l&&"credentials"in s.prototype;if(A.isFormData(x)){const re=U.getContentType();re&&/^multipart\/form-data/i.test(re)&&!/boundary=/i.test(re)&&U.delete("content-type")}U.set("User-Agent","axios/"+Rc,!1);const ee={...V,signal:W,method:_.toUpperCase(),headers:Mp(U.normalize()),body:x,duplex:"half",credentials:ce?N:void 0};F=l&&new s(v,ee);let ae=await(l?R(F,V):R(v,ee));const ke=Ge.from(ae.headers);if(k){const re=A.toFiniteNumber(ke.getContentLength());if(re!=null&&re>M)throw new q("maxContentLength size of "+M+" exceeded",q.ERR_BAD_RESPONSE,y,F)}const K=p&&(I==="stream"||I==="response");if(p&&ae.body&&(P||k||K&&G)){const re={};["status","statusText","headers"].forEach(ie=>{re[ie]=ae[ie]});const _e=A.toFiniteNumber(ke.getContentLength()),[Fe,He]=P&&sd(_e,vs(od(P),!0))||[];let pt=0;const Dr=ie=>{if(k&&(pt=ie,pt>M))throw new q("maxContentLength size of "+M+" exceeded",q.ERR_BAD_RESPONSE,y,F);Fe&&Fe(ie)};ae=new o(ld(ae.body,dd,Dr,()=>{He&&He(),G&&G()}),re)}I=I||"text";let xe=await b[A.findKey(b,I)||"text"](ae,y);if(k&&!p&&!K){let re;if(xe!=null&&(typeof xe.byteLength=="number"?re=xe.byteLength:typeof xe.size=="number"?re=xe.size:typeof xe=="string"&&(re=typeof r=="function"?new r().encode(xe).byteLength:xe.length)),typeof re=="number"&&re>M)throw new q("maxContentLength size of "+M+" exceeded",q.ERR_BAD_RESPONSE,y,F)}return!K&&G&&G(),await new Promise((re,_e)=>{zp(re,_e,{data:xe,headers:Ge.from(ae.headers),status:ae.status,statusText:ae.statusText,config:y,request:F})})}catch(B){if(G&&G(),W&&W.aborted&&W.reason instanceof q){const $=W.reason;throw $.config=y,F&&($.request=F),B!==$&&Object.defineProperty($,"cause",{__proto__:null,value:B,writable:!0,enumerable:!1,configurable:!0}),$}if(de)throw F&&!de.request&&(de.request=F),de;if(B instanceof q)throw F&&!B.request&&(B.request=F),B;if(B&&B.name==="TypeError"&&/Load failed|fetch/i.test(B.message)){const $=new q("Network Error",q.ERR_NETWORK,y,F,B&&B.response);throw Object.defineProperty($,"cause",{__proto__:null,value:B.cause||B,writable:!0,enumerable:!1,configurable:!0}),$}throw q.from(B,B&&B.code,y,F,B&&B.response)}}},pS=new Map,qp=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:i}=t,s=[r,i,n];let o=s.length,a=o,l,d,u=pS;for(;a--;)l=s[a],d=u.get(l),d===void 0&&u.set(l,d=a?new Map:fS(t)),u=d;return d};qp();const Lc={http:P_,xhr:rS,fetch:{get:qp}};A.forEach(Lc,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const pd=e=>`- ${e}`,mS=e=>A.isFunction(e)||e===null||e===!1;function hS(e,t){e=A.isArray(e)?e:[e];const{length:n}=e;let r,i;const s={};for(let o=0;o<n;o++){r=e[o];let a;if(i=r,!mS(r)&&(i=Lc[(a=String(r)).toLowerCase()],i===void 0))throw new q(`Unknown adapter '${a}'`);if(i&&(A.isFunction(i)||(i=i.get(t))))break;s[a||"#"+o]=i}if(!i){const o=Object.entries(s).map(([l,d])=>`adapter ${l} `+(d===!1?"is not supported by the environment":"is not available in the build"));let a=n?o.length>1?`since :
|
|
76
|
-
`+o.map(
|
|
77
|
-
`):" "+
|
|
33
|
+
*/var ho;function $d(){return ho||(ho=1,process.env.NODE_ENV!=="production"&&(function(){function e(d,u){return d===u&&(d!==0||1/d===1/u)||d!==d&&u!==u}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=p,n=cc(),r=typeof Object.is=="function"?Object.is:e,i=n.useSyncExternalStore,s=t.useRef,o=t.useEffect,a=t.useMemo,l=t.useDebugValue;Ti.useSyncExternalStoreWithSelector=function(d,u,f,m,h){var b=s(null);if(b.current===null){var v={hasValue:!1,value:null};b.current=v}else v=b.current;b=a(function(){function g(C){if(!T){if(T=!0,x=C,C=m(C),h!==void 0&&v.hasValue){var E=v.value;if(h(E,C))return y=E}return y=C}if(E=y,r(x,C))return E;var k=m(C);return h!==void 0&&h(E,k)?(x=C,E):(x=C,y=k)}var T=!1,x,y,O=f===void 0?null:f;return[function(){return g(u())},O===null?void 0:function(){return g(O())}]},[u,f,m,h]);var _=i(d,b[0],b[1]);return o(function(){v.hasValue=!0,v.value=_},[_]),l(_),_},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Ti}var mo;function Vd(){return mo||(mo=1,process.env.NODE_ENV==="production"?wr.exports=Wd():wr.exports=$d()),wr.exports}var Hd=Vd();const zd=Id(Hd),lc={},{useDebugValue:qd}=p,{useSyncExternalStoreWithSelector:Kd}=zd;let po=!1;const Gd=e=>e;function Qd(e,t=Gd,n){(lc?"production":void 0)!=="production"&&n&&!po&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),po=!0);const r=Kd(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return qd(r),r}const go=e=>{(lc?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?Ud(e):e,n=(r,i)=>Qd(t,r,i);return Object.assign(n,t),n},di=e=>e?go(e):go,yo={source:null,symbolKey:null,entryPrice:null,stopLoss:"",takeProfit:"",side:null,showEntryLine:!1,volumeLots:.01,digits:2,priceStep:.01},ne=di(e=>({...yo,setDraft:t=>e(n=>({source:t.source,symbolKey:t.symbolKey!==void 0?t.symbolKey:n.symbolKey,entryPrice:t.entryPrice!==void 0?t.entryPrice:n.entryPrice,stopLoss:t.stopLoss??n.stopLoss,takeProfit:t.takeProfit??n.takeProfit,side:t.side!==void 0?t.side:n.side,showEntryLine:t.showEntryLine??n.showEntryLine,volumeLots:t.volumeLots??n.volumeLots,digits:t.digits??n.digits,priceStep:t.priceStep??n.priceStep})),setOrderSide:({side:t,entryPrice:n})=>e({side:t,entryPrice:n,showEntryLine:!0}),setStopLoss:t=>e({stopLoss:t}),setTakeProfit:t=>e({takeProfit:t}),setVolumeLots:t=>e({volumeLots:t}),clearEntryLinePreview:()=>e({side:null,entryPrice:null,showEntryLine:!1}),clearDraft:()=>e({...yo})}));function xi(e,t){return e.toFixed(t)}function Zd({symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:i,minVolumeLots:s,isSubmitting:o,isAccountsLoading:a,selectedLogin:l,isDragging:d,sidePanelTab:u="trade",onDragHandlePointerDown:f,onExpandedChange:m,onExpand:h,onPlaceOrder:b}){const{t:v}=Te(),[_,g]=p.useState(String(r)),[T,x]=p.useState(null),[y,O]=p.useState(u),C=ne(A=>A.setOrderSide),E=ne(A=>A.setVolumeLots);u!==y&&(O(u),x(null));const k=T??u==="scan";p.useEffect(()=>{m()},[k,m]);const U=()=>{const A=!k;A&&h(),x(A)},F=Number(wt(vt(e))),H=t!==null?pe(t,F):"—",L=n!==null?pe(n,F):"—",K=!o&&!a&&l!==""&&(t!==null&&n!==null),re=A=>{const W=Number(_),R=Number.isFinite(W)&&W>0?W:r,G=Math.max(s,R+A*i),ae=xi(G,2);g(ae),E(G)},P=()=>{const A=Number(_);if(!Number.isFinite(A)||A<=0){g(xi(r,2)),E(r);return}const W=Math.max(s,A),R=xi(W,2);g(R),E(W)},D=A=>{t===null||n===null||C({side:A,entryPrice:A==="buy"?n:t})},j=A=>{if(t===null||n===null||!l)return;const W=Number(_),R=Math.max(s,Number.isFinite(W)&&W>0?W:r);C({side:A,entryPrice:A==="buy"?n:t}),b({login:l,side:A,volumeLots:R,bid:t,ask:n})};return c.jsx("div",{className:`web-trading-widget-mini-order${k?" web-trading-widget-mini-order--expanded":" web-trading-widget-mini-order--collapsed"}`,children:c.jsxs("div",{className:"web-trading-widget-mini-order__row",children:[c.jsx("button",{type:"button","aria-label":v("WebTrading.moveQuickOrderPanel"),onPointerDown:f,className:`web-trading-widget-mini-order__drag-handle${d?" web-trading-widget-mini-order__drag-handle--grabbing":""}`,children:c.jsx(ec,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2})}),k?c.jsxs(c.Fragment,{children:[c.jsxs("button",{type:"button",disabled:!K,className:"web-trading-widget-mini-order__side-btn web-trading-widget-mini-order__side-btn--sell",onMouseDown:()=>D("sell"),onClick:()=>j("sell"),children:[c.jsx("span",{className:"web-trading-widget-mini-order__price",children:H}),c.jsx("span",{className:"web-trading-widget-mini-order__label web-trading-widget-mini-order__label--sell",children:v("WebTrading.sell").toUpperCase()})]}),c.jsxs("div",{className:"web-trading-widget-mini-order__volume",children:[c.jsx("button",{type:"button","aria-label":v("WebTrading.decreaseVolume"),disabled:!K,className:"web-trading-widget-mini-order__volume-btn",onClick:()=>re(-1),children:c.jsx(Br,{className:"web-trading-widget-icon web-trading-widget-icon--xs",strokeWidth:2.5})}),c.jsx("input",{type:"text",inputMode:"decimal",value:_,disabled:!K,onChange:A=>g(A.target.value),onBlur:P,className:"web-trading-widget-mini-order__volume-input"}),c.jsx("button",{type:"button","aria-label":v("WebTrading.increaseVolume"),disabled:!K,className:"web-trading-widget-mini-order__volume-btn",onClick:()=>re(1),children:c.jsx($i,{className:"web-trading-widget-icon web-trading-widget-icon--xs",strokeWidth:2.5})})]}),c.jsxs("button",{type:"button",disabled:!K,className:"web-trading-widget-mini-order__side-btn web-trading-widget-mini-order__side-btn--buy",onMouseDown:()=>D("buy"),onClick:()=>j("buy"),children:[c.jsx("span",{className:"web-trading-widget-mini-order__label web-trading-widget-mini-order__label--buy",children:v("WebTrading.buy").toUpperCase()}),c.jsx("span",{className:"web-trading-widget-mini-order__price",children:L})]})]}):null,c.jsx("button",{type:"button","aria-label":v(k?"WebTrading.collapseQuickOrderPanel":"WebTrading.expandQuickOrderPanel"),"aria-expanded":k,className:"web-trading-widget-mini-order__toggle",onClick:U,children:k?c.jsx(hd,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2.5}):c.jsx(md,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2.5})})]})})}const Yd="web-trading-widget-mini-exec-panel-position",dc={x:56,y:96};function bo(e,t){const n=t==null?void 0:t.offsetParent;if(!t||!n)return e;const r=Math.max(0,n.clientWidth-t.offsetWidth),i=Math.max(0,n.clientHeight-t.offsetHeight);return{x:Math.min(r,Math.max(0,e.x)),y:Math.min(i,Math.max(0,e.y))}}function _o(e,t){e.style.left=`${t.x}px`,e.style.top=`${t.y}px`}function Jd(e,t){const n=t==null?void 0:t.offsetParent;return!t||!n?null:{x:e==="top-right"?Math.max(0,n.clientWidth-t.offsetWidth-16):dc.x,y:16}}function Xd(e){if(typeof window>"u")return null;try{const t=window.localStorage.getItem(e);if(!t)return null;const n=JSON.parse(t);if(typeof n.x=="number"&&typeof n.y=="number")return{x:n.x,y:n.y}}catch{}return null}function wo(e,t){try{e.hasPointerCapture(t)&&e.releasePointerCapture(t)}catch{}}function uc(e){const t=(e==null?void 0:e.storageKey)??Yd,n=(e==null?void 0:e.defaultPosition)??dc,r=e==null?void 0:e.defaultAlign,i=(e==null?void 0:e.isActive)??!0,s=p.useRef(null),[o,a]=p.useState(n),[l,d]=p.useState(!1),u=p.useRef(n),f=p.useRef(null);p.useEffect(()=>{u.current=o},[o]);const m=p.useCallback(v=>{const _=s.current,g=bo(v,_);u.current=g,a(g),_&&_o(_,g)},[]),h=p.useCallback(()=>{m(u.current)},[m]);p.useEffect(()=>{if(!i)return;const v=Xd(t);if(v){m(v);return}const _=r?Jd(r,s.current):null;m(_??u.current)},[m,r,i,t]);const b=p.useCallback(v=>{v.preventDefault(),v.stopPropagation();const _=v.currentTarget,g=s.current;if(!g)return;const T=v.pointerId;_.setPointerCapture(T);const x=v.clientX,y=v.clientY,O=u.current;d(!0),document.body.style.cursor="grabbing",document.body.style.userSelect="none";const C=(U,F)=>{const H=bo({x:O.x+(U-x),y:O.y+(F-y)},g);u.current=H,_o(g,H)},E=U=>{if(U.pointerId===T){wo(_,T),_.removeEventListener("pointermove",k),_.removeEventListener("pointerup",E),_.removeEventListener("pointercancel",E),f.current=null,d(!1),a(u.current),document.body.style.cursor="",document.body.style.userSelect="";try{window.localStorage.setItem(t,JSON.stringify(u.current))}catch{}}},k=U=>{U.pointerId===T&&(U.preventDefault(),C(U.clientX,U.clientY))};_.addEventListener("pointermove",k),_.addEventListener("pointerup",E),_.addEventListener("pointercancel",E),f.current=()=>{wo(_,T),_.removeEventListener("pointermove",k),_.removeEventListener("pointerup",E),_.removeEventListener("pointercancel",E),document.body.style.cursor="",document.body.style.userSelect="",d(!1)}},[t]);return p.useEffect(()=>{const v=()=>{m(u.current)};return window.addEventListener("resize",v),()=>{var _;window.removeEventListener("resize",v),(_=f.current)==null||_.call(f),f.current=null,document.body.style.cursor="",document.body.style.userSelect=""}},[m]),{panelRef:s,position:o,isDragging:l,onDragStart:b,reclamp:h}}const fc=200,eu=201,tu=202,nu=203,ru=204,hc=0,iu=2,mc=0;function cr(e){const t=Number(e.trim());if(!Number.isFinite(t))throw new Error("Invalid trading account login.");return t}function js(e){return Math.round(e*1e4)}function su(e){return e>=2&&e<=7}function ou(e){return{Action:ru,Order:Number(e.orderTicket),Login:cr(e.login),Symbol:e.symbol.replace(/m$/i,""),Type:e.orderType}}function au(e){return{Action:tu,Login:cr(e.login),Symbol:e.symbol.replace(/m$/i,""),Position:Number(e.positionTicket),Digits:e.digits,Comment:e.comment??"",...e.priceSL!==void 0?{PriceSL:e.priceSL}:{},...e.priceTP!==void 0?{PriceTP:e.priceTP}:{}}}function cu(e){return{Action:nu,Order:Number(e.orderTicket),Login:cr(e.login),Symbol:e.symbol.replace(/m$/i,""),Type:e.orderType,Volume:js(e.volumeLots),Digits:e.digits,TypeTime:e.typeTime,Comment:e.comment??"order modify",PriceOrder:e.priceOrder,...e.priceSL!==void 0?{PriceSL:e.priceSL}:{},...e.priceTP!==void 0?{PriceTP:e.priceTP}:{},...e.priceTrigger!==void 0?{PriceTrigger:e.priceTrigger}:{}}}function lu(e){const t=e.positionSide==="buy"?1:0;return{Action:fc,Login:cr(e.login),Symbol:e.symbol.replace(/m$/i,""),Type:t,TypeFill:hc,Volume:js(e.volumeLots),Digits:e.digits,TypeTime:mc,Comment:e.comment??"",Position:Number(e.positionTicket)}}function du(e){const t=!su(e.orderType);return{Action:t?fc:eu,Login:cr(e.login),Symbol:e.symbol,Type:e.orderType,TypeFill:t?hc:iu,Volume:js(e.volumeLots),Digits:e.digits,TypeTime:e.typeTime??mc,Comment:e.comment,...e.priceOrder!==void 0?{PriceOrder:e.priceOrder}:{},...e.priceSL!==void 0?{PriceSL:e.priceSL}:{},...e.priceTP!==void 0?{PriceTP:e.priceTP}:{},...e.priceTrigger!==void 0?{PriceTrigger:e.priceTrigger}:{},...e.timeExpiration!==void 0?{TimeExpiration:e.timeExpiration}:{}}}function uu(e){return{async sendRequest(t){return e.post("/api/dealer/send_request",t,{headers:{"Content-Type":"application/json"}})},async getPositions(t){return t.trim()?e.get(`/api/trade/position/page?login=${encodeURIComponent(t)}&offset=0&total=50`):null},async getOrders(t){return t.trim()?e.get(`/api/trade/order/page?login=${encodeURIComponent(t)}&offset=0&total=10`):null},async getDealsTotal(t,n,r){return t.trim()?e.get(`/api/trade/deal/total?login=${encodeURIComponent(t)}&from=${n}&to=${r}`):null},async getDeals(t,n,r,i,s){return t.trim()?e.get(`/api/trade/deal/page?login=${encodeURIComponent(t)}&from=${n}&to=${r}&offset=${i}&total=${s}`):null}}}const fu=new Set(["10009","10008"]);function pt(e){if(e===void 0||e==="")return;const t=Number(e);return Number.isFinite(t)?t:void 0}function hu(e){const t=pt(e);return t===void 0?.01:t/1e4}function mu(e){var t;return(t=e.find(n=>n.answer))==null?void 0:t.answer}function pu(e){var t,n,r,i;for(const s of e){const o=((t=s.result)==null?void 0:t.Retcode)??((n=s.answer)==null?void 0:n.ResultRetcode);if(o)return{retcode:String(o),price:pt(((r=s.result)==null?void 0:r.Price)??((i=s.answer)==null?void 0:i.ResultPrice))}}return{retcode:""}}function $n(e){return fu.has(e)}function Fn(e,t){var T,x,y;if(!e||typeof e!="object")return null;const r=e.data;if(!(r!=null&&r.length))return null;const i=mu(r),{retcode:s,price:o}=pu(r),a=$n(s),l=(i==null?void 0:i.ResultDeal)||(i==null?void 0:i.ResultOrder)||(i==null?void 0:i.Order),d=((T=i==null?void 0:i.Symbol)==null?void 0:T.trim())||t.symbol,u=Ne(d),f=pt(i==null?void 0:i.Type),m=f!==void 0?f%2===0?"buy":"sell":t.side,h=pt(i==null?void 0:i.ResultPrice)??pt(i==null?void 0:i.PriceOrder)??o??t.openPrice,b=pt(i==null?void 0:i.ResultMarketBid),v=pt(i==null?void 0:i.ResultMarketAsk),_=m==="buy"?b??h:v??h,g=Td(u);return{ticket:String(l||Math.floor(Date.now()/1e3)),login:((x=i==null?void 0:i.Login)==null?void 0:x.trim())||t.login,symbol:u,displaySymbol:si(u),side:m,volumeLots:hu(i==null?void 0:i.Volume)||t.volumeLots,openPrice:h,currentPrice:_,stopLoss:pt(i==null?void 0:i.PriceSL),takeProfit:pt(i==null?void 0:i.PriceTP),comment:((y=i==null?void 0:i.Comment)==null?void 0:y.trim())||t.comment,digits:Math.round(g),retcode:s,isSuccess:a,marketBid:b,marketAsk:v}}function gu(e){return e.type==="buy"?e.marketBid??e.currentPrice:e.marketAsk??e.currentPrice}function yu(e,t){return{async submitOrder(n){const r=n.login.trim();if(!r)return{success:!1,message:"Please select a trading account."};const i=Math.max(.01,n.volumeLots),s=ci(n.symbolTicker,t),o=Number(wt(vt(n.symbolTicker,t))),a=ai(n.executionMode),l=As(n.orderType),d=n.typeTime;if(!a&&n.priceOrder===void 0)return{success:!1,message:l?"Please set a limit price for this order.":"Please set an order price for pending orders."};if(l&&n.priceTrigger===void 0)return{success:!1,message:"Please set a stop price for stop limit orders."};if(!a&&!li(d,n.expirationDateTime??"",n.expirationDay??""))return{success:!1,message:"Please set an expiration date for this order."};const u=a?n.side==="buy"?n.ask:n.bid:n.priceOrder??(n.side==="buy"?n.ask:n.bid),f=a?void 0:ac(d,n.expirationDateTime??"",n.expirationDay??"");try{const m=du({login:r,symbol:s,volumeLots:i,orderType:n.orderType,digits:o,comment:n.comment.trim(),priceOrder:Es(n.orderType)?n.priceOrder:void 0,priceTrigger:l?n.priceTrigger:void 0,priceSL:n.stopLoss,priceTP:n.takeProfit,typeTime:a?void 0:d,timeExpiration:f}),h=await e.sendRequest(m),b=Fn(h,{login:r,symbol:s,side:$r(n.orderType),volumeLots:i,openPrice:u,digits:o,comment:n.comment.trim()});return b!=null&&b.isSuccess?{success:!0,ticket:b.ticket,side:b.side,volumeLots:b.volumeLots,displaySymbol:b.displaySymbol,price:b.openPrice}:{success:!1,message:h&&typeof h=="object"&&"message"in h&&typeof h.message=="string"?h.message:"Order was not accepted by the dealer."}}catch(m){return{success:!1,message:m instanceof Error?m.message:"Failed to place order."}}},async closePosition(n){try{const r=gu(n),i=lu({login:n.login,symbol:n.symbol,positionTicket:n.ticket,volumeLots:n.volumeLots,positionSide:n.type,digits:n.digits,comment:n.comment.trim()}),s=await e.sendRequest(i),o=Fn(s,{login:n.login,symbol:n.symbol,side:n.type==="buy"?"sell":"buy",volumeLots:n.volumeLots,openPrice:r,digits:n.digits,comment:n.comment.trim()});return o&&!$n(o.retcode)?{success:!1,message:`Close failed (retcode ${o.retcode}).`}:{success:!0}}catch(r){return{success:!1,message:r instanceof Error?r.message:"Failed to close position."}}},async deleteOrder(n){try{const r=ou({login:n.login,orderTicket:n.ticket,symbol:n.symbol,orderType:n.orderType}),i=await e.sendRequest(r),s=Fn(i,{login:n.login,symbol:n.symbol,side:n.side,volumeLots:n.volumeLots,openPrice:n.orderPrice,digits:n.digits,comment:n.comment});return s&&!$n(s.retcode)?{success:!1,message:`Delete failed (retcode ${s.retcode}).`}:{success:!0}}catch(r){return{success:!1,message:r instanceof Error?r.message:"Failed to delete order."}}},async modifyOrder(n,r){try{const i=cu({login:n.login,orderTicket:n.ticket,symbol:n.symbol,orderType:n.orderType,volumeLots:r.volumeLots,digits:n.digits,priceOrder:r.priceOrder,priceTrigger:r.priceTrigger,priceSL:r.stopLoss,priceTP:r.takeProfit,typeTime:n.typeTime,comment:r.comment.trim()||"order modify"}),s=await e.sendRequest(i),o=Fn(s,{login:n.login,symbol:n.symbol,side:n.side,volumeLots:r.volumeLots,openPrice:r.priceOrder,digits:n.digits,comment:r.comment.trim()});return o&&!$n(o.retcode)?{success:!1,message:`Modify failed (retcode ${o.retcode}).`}:{success:!0}}catch(i){return{success:!1,message:i instanceof Error?i.message:"Failed to modify order."}}},async modifyPosition(n,r){try{const i=au({login:n.login,positionTicket:n.ticket,symbol:n.symbol,digits:n.digits,priceSL:r.stopLoss,priceTP:r.takeProfit,comment:r.comment.trim()}),s=await e.sendRequest(i),o=Fn(s,{login:n.login,symbol:n.symbol,side:n.type,volumeLots:n.volumeLots,openPrice:n.openPrice,digits:n.digits,comment:r.comment.trim()});return o&&!$n(o.retcode)?{success:!1,message:`Modify failed (retcode ${o.retcode}).`}:{success:!0}}catch(i){return{success:!1,message:i instanceof Error?i.message:"Failed to modify position."}}}}}function pc(e,t){return function(){return e.apply(t,arguments)}}const{toString:bu}=Object.prototype,{getPrototypeOf:kn}=Object,{iterator:lr,toStringTag:gc}=Symbol,Hr=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Qn=(e,t)=>{let n=e;const r=[];for(;n!=null&&n!==Object.prototype;){if(r.indexOf(n)!==-1)return!1;if(r.push(n),Hr(n,t))return!0;n=kn(n)}return!1},_u=(e,t)=>e!=null&&Qn(e,t)?e[t]:void 0,Ms=(e=>t=>{const n=bu.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),ot=e=>(e=e.toLowerCase(),t=>Ms(t)===e),ui=e=>t=>typeof t===e,{isArray:rn}=Array,Pn=ui("undefined");function Rn(e){return e!==null&&!Pn(e)&&e.constructor!==null&&!Pn(e.constructor)&&ze(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const yc=ot("ArrayBuffer");function wu(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&yc(e.buffer),t}const vu=ui("string"),ze=ui("function"),bc=ui("number"),jn=e=>e!==null&&typeof e=="object",Su=e=>e===!0||e===!1,Ar=e=>{if(!jn(e))return!1;const t=kn(e);return(t===null||t===Object.prototype||kn(t)===null)&&!Qn(e,gc)&&!Qn(e,lr)},Tu=e=>{if(!jn(e)||Rn(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},xu=ot("Date"),ku=ot("File"),Pu=e=>!!(e&&typeof e.uri<"u"),Cu=e=>e&&typeof e.getParts<"u",Ou=ot("Blob"),Eu=ot("FileList"),Au=e=>jn(e)&&ze(e.pipe);function Lu(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const vo=Lu(),So=typeof vo.FormData<"u"?vo.FormData:void 0,Nu=e=>{if(!e)return!1;if(So&&e instanceof So)return!0;const t=kn(e);if(!t||t===Object.prototype||!ze(e.append))return!1;const n=Ms(e);return n==="formdata"||n==="object"&&ze(e.toString)&&e.toString()==="[object FormData]"},Du=ot("URLSearchParams"),[Ru,ju,Mu,Uu]=["ReadableStream","Request","Response","Headers"].map(ot),Iu=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function dr(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,i;if(typeof e!="object"&&(e=[e]),rn(e))for(r=0,i=e.length;r<i;r++)t.call(null,e[r],r,e);else{if(Rn(e))return;const s=n?Object.getOwnPropertyNames(e):Object.keys(e),o=s.length;let a;for(r=0;r<o;r++)a=s[r],t.call(null,e[a],a,e)}}function _c(e,t){if(Rn(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r=n.length,i;for(;r-- >0;)if(i=n[r],t===i.toLowerCase())return i;return null}const Wt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,wc=e=>!Pn(e)&&e!==Wt;function Hi(...e){const{caseless:t,skipUndefined:n}=wc(this)&&this||{},r={},i=(s,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const a=t&&typeof o=="string"&&_c(r,o)||o,l=Hr(r,a)?r[a]:void 0;Ar(l)&&Ar(s)?r[a]=Hi(l,s):Ar(s)?r[a]=Hi({},s):rn(s)?r[a]=s.slice():(!n||!Pn(s))&&(r[a]=s)};for(let s=0,o=e.length;s<o;s++){const a=e[s];if(!a||Rn(a)||(dr(a,i),typeof a!="object"||rn(a)))continue;const l=Object.getOwnPropertySymbols(a);for(let d=0;d<l.length;d++){const u=l[d];Zu.call(a,u)&&i(a[u],u)}}return r}const Fu=(e,t,n,{allOwnKeys:r}={})=>(dr(t,(i,s)=>{n&&ze(i)?Object.defineProperty(e,s,{__proto__:null,value:pc(i,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,s,{__proto__:null,value:i,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),Bu=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Wu=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{__proto__:null,value:t.prototype}),n&&Object.assign(e.prototype,n)},$u=(e,t,n,r)=>{let i,s,o;const a={};if(t=t||{},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),s=i.length;s-- >0;)o=i[s],(!r||r(o,e,t))&&!a[o]&&(t[o]=e[o],a[o]=!0);e=n!==!1&&kn(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},Vu=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},Hu=e=>{if(!e)return null;if(rn(e))return e;let t=e.length;if(!bc(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},zu=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&kn(Uint8Array)),qu=(e,t)=>{const r=(e&&e[lr]).call(e);let i;for(;(i=r.next())&&!i.done;){const s=i.value;t.call(e,s[0],s[1])}},Ku=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},Gu=ot("HTMLFormElement"),Qu=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,i){return r.toUpperCase()+i}),{propertyIsEnumerable:Zu}=Object.prototype,Yu=ot("RegExp"),vc=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};dr(n,(i,s)=>{let o;(o=t(i,s,e))!==!1&&(r[s]=o||i)}),Object.defineProperties(e,r)},Ju=e=>{vc(e,(t,n)=>{if(ze(e)&&["arguments","caller","callee"].includes(n))return!1;const r=e[n];if(ze(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},Xu=(e,t)=>{const n={},r=i=>{i.forEach(s=>{n[s]=!0})};return rn(e)?r(e):r(String(e).split(t)),n},ef=()=>{},tf=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function nf(e){return!!(e&&ze(e.append)&&e[gc]==="FormData"&&e[lr])}const rf=e=>{const t=new WeakSet,n=r=>{if(jn(r)){if(t.has(r))return;if(Rn(r))return r;if(!("toJSON"in r)){t.add(r);const i=rn(r)?[]:{};return dr(r,(s,o)=>{const a=n(s);!Pn(a)&&(i[o]=a)}),t.delete(r),i}}return r};return n(e)},sf=ot("AsyncFunction"),of=e=>e&&(jn(e)||ze(e))&&ze(e.then)&&ze(e.catch),Sc=((e,t)=>e?setImmediate:t?((n,r)=>(Wt.addEventListener("message",({source:i,data:s})=>{i===Wt&&s===n&&r.length&&r.shift()()},!1),i=>{r.push(i),Wt.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",ze(Wt.postMessage)),af=typeof queueMicrotask<"u"?queueMicrotask.bind(Wt):typeof process<"u"&&process.nextTick||Sc,Tc=e=>e!=null&&ze(e[lr]),cf=e=>e!=null&&Qn(e,lr)&&Tc(e),S={isArray:rn,isArrayBuffer:yc,isBuffer:Rn,isFormData:Nu,isArrayBufferView:wu,isString:vu,isNumber:bc,isBoolean:Su,isObject:jn,isPlainObject:Ar,isEmptyObject:Tu,isReadableStream:Ru,isRequest:ju,isResponse:Mu,isHeaders:Uu,isUndefined:Pn,isDate:xu,isFile:ku,isReactNativeBlob:Pu,isReactNative:Cu,isBlob:Ou,isRegExp:Yu,isFunction:ze,isStream:Au,isURLSearchParams:Du,isTypedArray:zu,isFileList:Eu,forEach:dr,merge:Hi,extend:Fu,trim:Iu,stripBOM:Bu,inherits:Wu,toFlatObject:$u,kindOf:Ms,kindOfTest:ot,endsWith:Vu,toArray:Hu,forEachEntry:qu,matchAll:Ku,isHTMLForm:Gu,hasOwnProperty:Hr,hasOwnProp:Hr,hasOwnInPrototypeChain:Qn,getSafeProp:_u,reduceDescriptors:vc,freezeMethods:Ju,toObjectSet:Xu,toCamelCase:Qu,noop:ef,toFiniteNumber:tf,findKey:_c,global:Wt,isContextDefined:wc,isSpecCompliantForm:nf,toJSONObject:rf,isAsyncFn:sf,isThenable:of,setImmediate:Sc,asap:af,isIterable:Tc,isSafeIterable:cf},lf=S.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"]),df=e=>{const t={};let n,r,i;return e&&e.split(`
|
|
34
|
+
`).forEach(function(o){i=o.indexOf(":"),n=o.substring(0,i).trim().toLowerCase(),r=o.substring(i+1).trim(),!(!n||t[n]&&lf[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t};function uf(e){let t=0,n=e.length;for(;t<n;){const r=e.charCodeAt(t);if(r!==9&&r!==32)break;t+=1}for(;n>t;){const r=e.charCodeAt(n-1);if(r!==9&&r!==32)break;n-=1}return t===0&&n===e.length?e:e.slice(t,n)}const ff=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),hf=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function Us(e,t){return S.isArray(e)?e.map(n=>Us(n,t)):uf(String(e).replace(t,""))}const mf=e=>Us(e,ff),pf=e=>Us(e,hf);function xc(e){const t=Object.create(null);return S.forEach(e.toJSON(),(n,r)=>{t[r]=pf(n)}),t}const To=Symbol("internals");function Bn(e){return e&&String(e).trim().toLowerCase()}function Lr(e){return e===!1||e==null?e:S.isArray(e)?e.map(Lr):mf(String(e))}function gf(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const yf=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function ki(e,t,n,r,i){if(S.isFunction(r))return r.call(this,t,n);if(i&&(t=n),!!S.isString(t)){if(S.isString(r))return t.indexOf(r)!==-1;if(S.isRegExp(r))return r.test(t)}}function bf(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function _f(e,t){const n=S.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{__proto__:null,value:function(i,s,o){return this[r].call(this,t,i,s,o)},configurable:!0})})}let Fe=class{constructor(t){t&&this.set(t)}set(t,n,r){const i=this;function s(a,l,d){const u=Bn(l);if(!u)return;const f=S.findKey(i,u);(!f||i[f]===void 0||d===!0||d===void 0&&i[f]!==!1)&&(i[f||l]=Lr(a))}const o=(a,l)=>S.forEach(a,(d,u)=>s(d,u,l));if(S.isPlainObject(t)||t instanceof this.constructor)o(t,n);else if(S.isString(t)&&(t=t.trim())&&!yf(t))o(df(t),n);else if(S.isObject(t)&&S.isSafeIterable(t)){let a=Object.create(null),l,d;for(const u of t){if(!S.isArray(u))throw new TypeError("Object iterator must return a key-value pair");d=u[0],S.hasOwnProp(a,d)?(l=a[d],a[d]=S.isArray(l)?[...l,u[1]]:[l,u[1]]):a[d]=u[1]}o(a,n)}else t!=null&&s(n,t,r);return this}get(t,n){if(t=Bn(t),t){const r=S.findKey(this,t);if(r){const i=this[r];if(!n)return i;if(n===!0)return gf(i);if(S.isFunction(n))return n.call(this,i,r);if(S.isRegExp(n))return n.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=Bn(t),t){const r=S.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||ki(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let i=!1;function s(o){if(o=Bn(o),o){const a=S.findKey(r,o);a&&(!n||ki(r,r[a],a,n))&&(delete r[a],i=!0)}}return S.isArray(t)?t.forEach(s):s(t),i}clear(t){const n=Object.keys(this);let r=n.length,i=!1;for(;r--;){const s=n[r];(!t||ki(this,this[s],s,t,!0))&&(delete this[s],i=!0)}return i}normalize(t){const n=this,r={};return S.forEach(this,(i,s)=>{const o=S.findKey(r,s);if(o){n[o]=Lr(i),delete n[s];return}const a=t?bf(s):String(s).trim();a!==s&&delete n[s],n[a]=Lr(i),r[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return S.forEach(this,(r,i)=>{r!=null&&r!==!1&&(n[i]=t&&S.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(`
|
|
35
|
+
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(i=>r.set(i)),r}static accessor(t){const r=(this[To]=this[To]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=Bn(o);r[a]||(_f(i,o),r[a]=!0)}return S.isArray(t)?t.forEach(s):s(t),this}};Fe.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);S.reduceDescriptors(Fe.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});S.freezeMethods(Fe);const wf="[REDACTED ****]";function vf(e){if(S.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(S.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}function Sf(e,t){const n=new Set(t.map(s=>String(s).toLowerCase())),r=[],i=s=>{if(s===null||typeof s!="object"||S.isBuffer(s))return s;if(r.indexOf(s)!==-1)return;s instanceof Fe&&(s=s.toJSON()),r.push(s);let o;if(S.isArray(s))o=[],s.forEach((a,l)=>{const d=i(a);S.isUndefined(d)||(o[l]=d)});else{if(!S.isPlainObject(s)&&vf(s))return r.pop(),s;o=Object.create(null);for(const[a,l]of Object.entries(s)){const d=n.has(a.toLowerCase())?wf:i(l);S.isUndefined(d)||(o[a]=d)}}return r.pop(),o};return i(e)}let I=class kc extends Error{static from(t,n,r,i,s,o){const a=new kc(t.message,n||t.code,r,i,s);return Object.defineProperty(a,"cause",{__proto__:null,value:t,writable:!0,enumerable:!1,configurable:!0}),a.name=t.name,t.status!=null&&a.status==null&&(a.status=t.status),o&&Object.assign(a,o),a}constructor(t,n,r,i,s){super(t),Object.defineProperty(this,"message",{__proto__:null,value:t,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,n&&(this.code=n),r&&(this.config=r),i&&(this.request=i),s&&(this.response=s,this.status=s.status)}toJSON(){const t=this.config,n=t&&S.hasOwnProp(t,"redact")?t.redact:void 0,r=S.isArray(n)&&n.length>0?Sf(t,n):S.toJSONObject(t);return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:r,code:this.code,status:this.status}}};I.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";I.ERR_BAD_OPTION="ERR_BAD_OPTION";I.ECONNABORTED="ECONNABORTED";I.ETIMEDOUT="ETIMEDOUT";I.ECONNREFUSED="ECONNREFUSED";I.ERR_NETWORK="ERR_NETWORK";I.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";I.ERR_DEPRECATED="ERR_DEPRECATED";I.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";I.ERR_BAD_REQUEST="ERR_BAD_REQUEST";I.ERR_CANCELED="ERR_CANCELED";I.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";I.ERR_INVALID_URL="ERR_INVALID_URL";I.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const Tf=null,Pc=100;function zi(e){return S.isPlainObject(e)||S.isArray(e)}function Cc(e){return S.endsWith(e,"[]")?e.slice(0,-2):e}function Pi(e,t,n){return e?e.concat(t).map(function(i,s){return i=Cc(i),!n&&s?"["+i+"]":i}).join(n?".":""):t}function xf(e){return S.isArray(e)&&!e.some(zi)}const kf=S.toFlatObject(S,{},null,function(t){return/^is[A-Z]/.test(t)});function fi(e,t,n){if(!S.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=S.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(T,x){return!S.isUndefined(x[T])});const r=n.metaTokens,i=n.visitor||b,s=n.dots,o=n.indexes,a=n.Blob||typeof Blob<"u"&&Blob,l=n.maxDepth===void 0?Pc:n.maxDepth,d=a&&S.isSpecCompliantForm(t),u=[];if(!S.isFunction(i))throw new TypeError("visitor must be a function");function f(g){if(g===null)return"";if(S.isDate(g))return g.toISOString();if(S.isBoolean(g))return g.toString();if(!d&&S.isBlob(g))throw new I("Blob is not supported. Use a Buffer instead.");if(S.isArrayBuffer(g)||S.isTypedArray(g)){if(d&&typeof a=="function")return new a([g]);if(typeof Buffer<"u")return Buffer.from(g);throw new I("Blob is not supported. Use a Buffer instead.",I.ERR_NOT_SUPPORT)}return g}function m(g){if(g>l)throw new I("Object is too deeply nested ("+g+" levels). Max depth: "+l,I.ERR_FORM_DATA_DEPTH_EXCEEDED)}function h(g,T){if(l===1/0)return JSON.stringify(g);const x=[];return JSON.stringify(g,function(O,C){if(!S.isObject(C))return C;for(;x.length&&x[x.length-1]!==this;)x.pop();return x.push(C),m(T+x.length-1),C})}function b(g,T,x){let y=g;if(S.isReactNative(t)&&S.isReactNativeBlob(g))return t.append(Pi(x,T,s),f(g)),!1;if(g&&!x&&typeof g=="object"){if(S.endsWith(T,"{}"))T=r?T:T.slice(0,-2),g=h(g,1);else if(S.isArray(g)&&xf(g)||(S.isFileList(g)||S.endsWith(T,"[]"))&&(y=S.toArray(g)))return T=Cc(T),y.forEach(function(C,E){!(S.isUndefined(C)||C===null)&&t.append(o===!0?Pi([T],E,s):o===null?T:T+"[]",f(C))}),!1}return zi(g)?!0:(t.append(Pi(x,T,s),f(g)),!1)}const v=Object.assign(kf,{defaultVisitor:b,convertValue:f,isVisitable:zi});function _(g,T,x=0){if(!S.isUndefined(g)){if(m(x),u.indexOf(g)!==-1)throw new Error("Circular reference detected in "+T.join("."));u.push(g),S.forEach(g,function(O,C){(!(S.isUndefined(O)||O===null)&&i.call(t,O,S.isString(C)?C.trim():C,T,v))===!0&&_(O,T?T.concat(C):[C],x+1)}),u.pop()}}if(!S.isObject(e))throw new TypeError("data must be an object");return _(e),t}function xo(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(r){return t[r]})}function Is(e,t){this._pairs=[],e&&fi(e,this,t)}const Oc=Is.prototype;Oc.append=function(t,n){this._pairs.push([t,n])};Oc.toString=function(t){const n=t?r=>t.call(this,r,xo):xo;return this._pairs.map(function(i){return n(i[0])+"="+n(i[1])},"").join("&")};function Pf(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Ec(e,t,n){if(!t)return e;e=e||"";const r=S.isFunction(n)?{serialize:n}:n,i=S.getSafeProp(r,"encode")||Pf,s=S.getSafeProp(r,"serialize");let o;if(s?o=s(t,r):o=S.isURLSearchParams(t)?t.toString():new Is(t,r).toString(i),o){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class ko{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){S.forEach(this.handlers,function(r){r!==null&&t(r)})}}const Fs={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},Cf=typeof URLSearchParams<"u"?URLSearchParams:Is,Of=typeof FormData<"u"?FormData:null,Ef=typeof Blob<"u"?Blob:null,Af={isBrowser:!0,classes:{URLSearchParams:Cf,FormData:Of,Blob:Ef},protocols:["http","https","file","blob","url","data"]},Bs=typeof window<"u"&&typeof document<"u",qi=typeof navigator=="object"&&navigator||void 0,Lf=Bs&&(!qi||["ReactNative","NativeScript","NS"].indexOf(qi.product)<0),Nf=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Df=Bs&&window.location.href||"http://localhost",Rf=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Bs,hasStandardBrowserEnv:Lf,hasStandardBrowserWebWorkerEnv:Nf,navigator:qi,origin:Df},Symbol.toStringTag,{value:"Module"})),De={...Rf,...Af};function jf(e,t){return fi(e,new De.classes.URLSearchParams,{visitor:function(n,r,i,s){return De.isNode&&S.isBuffer(n)?(this.append(r,n.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)},...t})}const Po=Pc;function Ac(e){if(e>Po)throw new I("FormData field is too deeply nested ("+e+" levels). Max depth: "+Po,I.ERR_FORM_DATA_DEPTH_EXCEEDED)}function Mf(e){const t=[],n=/\w+|\[(\w*)]/g;let r;for(;(r=n.exec(e))!==null;)Ac(t.length),t.push(r[0]==="[]"?"":r[1]||r[0]);return t}function Uf(e){const t={},n=Object.keys(e);let r;const i=n.length;let s;for(r=0;r<i;r++)s=n[r],t[s]=e[s];return t}function Lc(e){function t(n,r,i,s){Ac(s);let o=n[s++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),l=s>=n.length;return o=!o&&S.isArray(i)?i.length:o,l?(S.hasOwnProp(i,o)?i[o]=S.isArray(i[o])?i[o].concat(r):[i[o],r]:i[o]=r,!a):((!S.hasOwnProp(i,o)||!S.isObject(i[o]))&&(i[o]=[]),t(n,r,i[o],s)&&S.isArray(i[o])&&(i[o]=Uf(i[o])),!a)}if(S.isFormData(e)&&S.isFunction(e.entries)){const n={};return S.forEachEntry(e,(r,i)=>{t(Mf(r),i,n,0)}),n}return null}const cn=(e,t)=>e!=null&&S.hasOwnProp(e,t)?e[t]:void 0;function If(e,t,n){if(S.isString(e))try{return(t||JSON.parse)(e),S.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const ur={transitional:Fs,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",i=r.indexOf("application/json")>-1,s=S.isObject(t);if(s&&S.isHTMLForm(t)&&(t=new FormData(t)),S.isFormData(t))return i?JSON.stringify(Lc(t)):t;if(S.isArrayBuffer(t)||S.isBuffer(t)||S.isStream(t)||S.isFile(t)||S.isBlob(t)||S.isReadableStream(t))return t;if(S.isArrayBufferView(t))return t.buffer;if(S.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(s){const l=cn(this,"formSerializer");if(r.indexOf("application/x-www-form-urlencoded")>-1)return jf(t,l).toString();if((a=S.isFileList(t))||r.indexOf("multipart/form-data")>-1){const d=cn(this,"env"),u=d&&d.FormData;return fi(a?{"files[]":t}:t,u&&new u,l)}}return s||i?(n.setContentType("application/json",!1),If(t)):t}],transformResponse:[function(t){const n=cn(this,"transitional")||ur.transitional,r=n&&n.forcedJSONParsing,i=cn(this,"responseType"),s=i==="json";if(S.isResponse(t)||S.isReadableStream(t))return t;if(t&&S.isString(t)&&(r&&!i||s)){const a=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(t,cn(this,"parseReviver"))}catch(l){if(a)throw l.name==="SyntaxError"?I.from(l,I.ERR_BAD_RESPONSE,this,null,cn(this,"response")):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:De.classes.FormData,Blob:De.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};S.forEach(["delete","get","head","post","put","patch","query"],e=>{ur.headers[e]={}});function Ci(e,t){const n=this||ur,r=t||n,i=Fe.from(r.headers);let s=r.data;return S.forEach(e,function(a){s=a.call(n,s,i.normalize(),t?t.status:void 0)}),i.normalize(),s}function Nc(e){return!!(e&&e.__CANCEL__)}let fr=class extends I{constructor(t,n,r){super(t??"canceled",I.ERR_CANCELED,n,r),this.name="CanceledError",this.__CANCEL__=!0}};function Dc(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new I("Request failed with status code "+n.status,n.status>=400&&n.status<500?I.ERR_BAD_REQUEST:I.ERR_BAD_RESPONSE,n.config,n.request,n))}function Ff(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}function Bf(e,t){e=e||10;const n=new Array(e),r=new Array(e);let i=0,s=0,o;return t=t!==void 0?t:1e3,function(l){const d=Date.now(),u=r[s];o||(o=d),n[i]=l,r[i]=d;let f=s,m=0;for(;f!==i;)m+=n[f++],f=f%e;if(i=(i+1)%e,i===s&&(s=(s+1)%e),d-o<t)return;const h=u&&d-u;return h?Math.round(m*1e3/h):void 0}}function Wf(e,t){let n=0,r=1e3/t,i,s;const o=(d,u=Date.now())=>{n=u,i=null,s&&(clearTimeout(s),s=null),e(...d)};return[(...d)=>{const u=Date.now(),f=u-n;f>=r?o(d,u):(i=d,s||(s=setTimeout(()=>{s=null,o(i)},r-f)))},()=>i&&o(i)]}const zr=(e,t,n=3)=>{let r=0;const i=Bf(50,250);return Wf(s=>{if(!s||typeof s.loaded!="number")return;const o=s.loaded,a=s.lengthComputable?s.total:void 0,l=a!=null?Math.min(o,a):o,d=Math.max(0,l-r),u=i(d);r=Math.max(r,l);const f={loaded:l,total:a,progress:a?l/a:void 0,bytes:d,rate:u||void 0,estimated:u&&a?(a-l)/u:void 0,event:s,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(f)},n)},Co=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Oo=e=>(...t)=>S.asap(()=>e(...t)),$f=De.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,De.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(De.origin),De.navigator&&/(msie|trident)/i.test(De.navigator.userAgent)):()=>!0,Vf=De.hasStandardBrowserEnv?{write(e,t,n,r,i,s,o){if(typeof document>"u")return;const a=[`${e}=${encodeURIComponent(t)}`];S.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),S.isString(r)&&a.push(`path=${r}`),S.isString(i)&&a.push(`domain=${i}`),s===!0&&a.push("secure"),S.isString(o)&&a.push(`SameSite=${o}`),document.cookie=a.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.split(";");for(let n=0;n<t.length;n++){const r=t[n].replace(/^\s+/,""),i=r.indexOf("=");if(i!==-1&&r.slice(0,i)===e)try{return decodeURIComponent(r.slice(i+1))}catch{return r.slice(i+1)}}return null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Hf(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function zf(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}const qf=/^https?:(?!\/\/)/i,Kf=/[\t\n\r]/g;function Gf(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}function Qf(e){return Gf(e).replace(Kf,"")}function Eo(e,t){if(typeof e=="string"&&qf.test(Qf(e)))throw new I('Invalid URL: missing "//" after protocol',I.ERR_INVALID_URL,t)}function Rc(e,t,n,r){Eo(t,r);let i=!Hf(t);return e&&(i||n===!1)?(Eo(e,r),zf(e,t)):t}const Ao=e=>e instanceof Fe?{...e}:e;function sn(e,t){e=e||{},t=t||{};const n=Object.create(null);Object.defineProperty(n,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function r(u,f,m,h){return S.isPlainObject(u)&&S.isPlainObject(f)?S.merge.call({caseless:h},u,f):S.isPlainObject(f)?S.merge({},f):S.isArray(f)?f.slice():f}function i(u,f,m,h){if(S.isUndefined(f)){if(!S.isUndefined(u))return r(void 0,u,m,h)}else return r(u,f,m,h)}function s(u,f){if(!S.isUndefined(f))return r(void 0,f)}function o(u,f){if(S.isUndefined(f)){if(!S.isUndefined(u))return r(void 0,u)}else return r(void 0,f)}function a(u){const f=S.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!S.isUndefined(f))if(S.isPlainObject(f)){if(S.hasOwnProp(f,u))return f[u]}else return;const m=S.hasOwnProp(e,"transitional")?e.transitional:void 0;if(S.isPlainObject(m)&&S.hasOwnProp(m,u))return m[u]}function l(u,f,m){if(S.hasOwnProp(t,m))return r(u,f);if(S.hasOwnProp(e,m))return r(void 0,u)}const d={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,allowedSocketPaths:o,responseEncoding:o,validateStatus:l,headers:(u,f,m)=>i(Ao(u),Ao(f),m,!0)};return S.forEach(Object.keys({...e,...t}),function(f){if(f==="__proto__"||f==="constructor"||f==="prototype")return;const m=S.hasOwnProp(d,f)?d[f]:i,h=S.hasOwnProp(e,f)?e[f]:void 0,b=S.hasOwnProp(t,f)?t[f]:void 0,v=m(h,b,f);S.isUndefined(v)&&m!==l||(n[f]=v)}),S.hasOwnProp(t,"validateStatus")&&S.isUndefined(t.validateStatus)&&a("validateStatusUndefinedResolves")===!1&&(S.hasOwnProp(e,"validateStatus")?n.validateStatus=r(void 0,e.validateStatus):delete n.validateStatus),n}const Zf=["content-type","content-length"];function Yf(e,t,n){if(n!=="content-only"){e.set(t);return}Object.entries(t||{}).forEach(([r,i])=>{Zf.includes(r.toLowerCase())&&e.set(r,i)})}const Jf=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,n)=>String.fromCharCode(parseInt(n,16)));function jc(e){const t=sn({},e),n=m=>S.hasOwnProp(t,m)?t[m]:void 0,r=n("data");let i=n("withXSRFToken");const s=n("xsrfHeaderName"),o=n("xsrfCookieName");let a=n("headers");const l=n("auth"),d=n("baseURL"),u=n("allowAbsoluteUrls"),f=n("url");if(t.headers=a=Fe.from(a),t.url=Ec(Rc(d,f,u,t),n("params"),n("paramsSerializer")),l){const m=S.getSafeProp(l,"username")||"",h=S.getSafeProp(l,"password")||"";try{a.set("Authorization","Basic "+btoa(m+":"+(h?Jf(h):"")))}catch(b){throw I.from(b,I.ERR_BAD_OPTION_VALUE,e)}}if(S.isFormData(r)&&(De.hasStandardBrowserEnv||De.hasStandardBrowserWebWorkerEnv||S.isReactNative(r)?a.setContentType(void 0):S.isFunction(r.getHeaders)&&Yf(a,r.getHeaders(),n("formDataHeaderPolicy"))),De.hasStandardBrowserEnv&&(S.isFunction(i)&&(i=i(t)),i===!0||i==null&&$f(t.url))){const h=s&&o&&Vf.read(o);h&&a.set(s,h)}return t}const Xf=typeof XMLHttpRequest<"u",eh=Xf&&function(e){return new Promise(function(n,r){const i=jc(e);let s=i.data;const o=Fe.from(i.headers).normalize();let{responseType:a,onUploadProgress:l,onDownloadProgress:d}=i,u,f,m,h,b;function v(){h&&h(),b&&b(),i.cancelToken&&i.cancelToken.unsubscribe(u),i.signal&&i.signal.removeEventListener("abort",u)}let _=new XMLHttpRequest;_.open(i.method.toUpperCase(),i.url,!0),_.timeout=i.timeout;function g(){if(!_)return;const x=Fe.from("getAllResponseHeaders"in _&&_.getAllResponseHeaders()),O={data:!a||a==="text"||a==="json"?_.responseText:_.response,status:_.status,statusText:_.statusText,headers:x,config:e,request:_};Dc(function(E){n(E),v()},function(E){r(E),v()},O),_=null}"onloadend"in _?_.onloadend=g:_.onreadystatechange=function(){!_||_.readyState!==4||_.status===0&&!(_.responseURL&&_.responseURL.startsWith("file:"))||setTimeout(g)},_.onabort=function(){_&&(r(new I("Request aborted",I.ECONNABORTED,e,_)),v(),_=null)},_.onerror=function(y){const O=y&&y.message?y.message:"Network Error",C=new I(O,I.ERR_NETWORK,e,_);C.event=y||null,r(C),v(),_=null},_.ontimeout=function(){let y=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const O=i.transitional||Fs;i.timeoutErrorMessage&&(y=i.timeoutErrorMessage),r(new I(y,O.clarifyTimeoutError?I.ETIMEDOUT:I.ECONNABORTED,e,_)),v(),_=null},s===void 0&&o.setContentType(null),"setRequestHeader"in _&&S.forEach(xc(o),function(y,O){_.setRequestHeader(O,y)}),S.isUndefined(i.withCredentials)||(_.withCredentials=!!i.withCredentials),a&&a!=="json"&&(_.responseType=i.responseType),d&&([m,b]=zr(d,!0),_.addEventListener("progress",m)),l&&_.upload&&([f,h]=zr(l),_.upload.addEventListener("progress",f),_.upload.addEventListener("loadend",h)),(i.cancelToken||i.signal)&&(u=x=>{_&&(r(!x||x.type?new fr(null,e,_):x),_.abort(),v(),_=null)},i.cancelToken&&i.cancelToken.subscribe(u),i.signal&&(i.signal.aborted?u():i.signal.addEventListener("abort",u)));const T=Ff(i.url);if(T&&!De.protocols.includes(T)){r(new I("Unsupported protocol "+T+":",I.ERR_BAD_REQUEST,e)),v();return}_.send(s||null)})},th=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const n=new AbortController;let r=!1;const i=function(l){if(!r){r=!0,o();const d=l instanceof Error?l:this.reason;n.abort(d instanceof I?d:new fr(d instanceof Error?d.message:d))}};let s=t&&setTimeout(()=>{s=null,i(new I(`timeout of ${t}ms exceeded`,I.ETIMEDOUT))},t);const o=()=>{e&&(s&&clearTimeout(s),s=null,e.forEach(l=>{l.unsubscribe?l.unsubscribe(i):l.removeEventListener("abort",i)}),e=null)};e.forEach(l=>l.addEventListener("abort",i,{once:!0}));const{signal:a}=n;return a.unsubscribe=()=>S.asap(o),a},nh=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,i;for(;r<n;)i=r+t,yield e.slice(r,i),r=i},rh=async function*(e,t){for await(const n of ih(e))yield*nh(n,t)},ih=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:r}=await t.read();if(n)break;yield r}}finally{await t.cancel()}},Lo=(e,t,n,r)=>{const i=rh(e,t);let s=0,o,a=l=>{o||(o=!0,r&&r(l))};return new ReadableStream({async pull(l){try{const{done:d,value:u}=await i.next();if(d){a(),l.close();return}let f=u.byteLength;if(n){let m=s+=f;n(m)}l.enqueue(new Uint8Array(u))}catch(d){throw a(d),d}},cancel(l){return a(l),i.return()}},{highWaterMark:2})},qr=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,sh=(e,t,n)=>t+2<n&&qr(e.charCodeAt(t+1))&&qr(e.charCodeAt(t+2));function oh(e){if(!e||typeof e!="string"||!e.startsWith("data:"))return 0;const t=e.indexOf(",");if(t<0)return 0;const n=e.slice(5,t),r=e.slice(t+1);if(/;base64/i.test(n)){let o=r.length;const a=r.length;for(let h=0;h<a;h++)if(r.charCodeAt(h)===37&&h+2<a){const b=r.charCodeAt(h+1),v=r.charCodeAt(h+2);qr(b)&&qr(v)&&(o-=2,h+=2)}let l=0,d=a-1;const u=h=>h>=2&&r.charCodeAt(h-2)===37&&r.charCodeAt(h-1)===51&&(r.charCodeAt(h)===68||r.charCodeAt(h)===100);d>=0&&(r.charCodeAt(d)===61?(l++,d--):u(d)&&(l++,d-=3)),l===1&&d>=0&&(r.charCodeAt(d)===61||u(d))&&l++;const m=Math.floor(o/4)*3-(l||0);return m>0?m:0}let s=0;for(let o=0,a=r.length;o<a;o++){const l=r.charCodeAt(o);if(l===37&&sh(r,o,a))s+=1,o+=2;else if(l<128)s+=1;else if(l<2048)s+=2;else if(l>=55296&&l<=56319&&o+1<a){const d=r.charCodeAt(o+1);d>=56320&&d<=57343?(s+=4,o++):s+=3}else s+=3}return s}const Ws="1.18.1",No=64*1024,{isFunction:Sr}=S,ah=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,n)=>String.fromCharCode(parseInt(n,16))),Do=e=>{if(!S.isString(e))return e;try{return decodeURIComponent(e)}catch{return e}},Ro=(e,...t)=>{try{return!!e(...t)}catch{return!1}},ch=e=>{const t=e.indexOf("://");let n=e;return t!==-1&&(n=n.slice(t+3)),n.includes("@")||n.includes(":")},lh=e=>{const t=S.global!==void 0&&S.global!==null?S.global:globalThis,{ReadableStream:n,TextEncoder:r}=t;e=S.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:i,Request:s,Response:o}=e,a=i?Sr(i):typeof fetch=="function",l=Sr(s),d=Sr(o);if(!a)return!1;const u=a&&Sr(n),f=a&&(typeof r=="function"?(g=>T=>g.encode(T))(new r):async g=>new Uint8Array(await new s(g).arrayBuffer())),m=l&&u&&Ro(()=>{let g=!1;const T=new s(De.origin,{body:new n,method:"POST",get duplex(){return g=!0,"half"}}),x=T.headers.has("Content-Type");return T.body!=null&&T.body.cancel(),g&&!x}),h=d&&u&&Ro(()=>S.isReadableStream(new o("").body)),b={stream:h&&(g=>g.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(g=>{!b[g]&&(b[g]=(T,x)=>{let y=T&&T[g];if(y)return y.call(T);throw new I(`Response type '${g}' is not supported`,I.ERR_NOT_SUPPORT,x)})});const v=async g=>{if(g==null)return 0;if(S.isBlob(g))return g.size;if(S.isSpecCompliantForm(g))return(await new s(De.origin,{method:"POST",body:g}).arrayBuffer()).byteLength;if(S.isArrayBufferView(g)||S.isArrayBuffer(g))return g.byteLength;if(S.isURLSearchParams(g)&&(g=g+""),S.isString(g))return(await f(g)).byteLength},_=async(g,T)=>{const x=S.toFiniteNumber(g.getContentLength());return x??v(T)};return async g=>{let{url:T,method:x,data:y,signal:O,cancelToken:C,timeout:E,onDownloadProgress:k,onUploadProgress:U,responseType:F,headers:H,withCredentials:L="same-origin",fetchOptions:Q,maxContentLength:K,maxBodyLength:re}=jc(g);const P=S.isNumber(K)&&K>-1,D=S.isNumber(re)&&re>-1,j=N=>S.hasOwnProp(g,N)?g[N]:void 0;let A=i||fetch;F=F?(F+"").toLowerCase():"text";let W=th([O,C&&C.toAbortSignal()],E),R=null;const G=W&&W.unsubscribe&&(()=>{W.unsubscribe()});let ae,ce=null;const ie=()=>new I("Request body larger than maxBodyLength limit",I.ERR_BAD_REQUEST,g,R);try{let N;const Z=j("auth");if(Z){const Y=S.getSafeProp(Z,"username")||"",_e=S.getSafeProp(Z,"password")||"";N={username:Y,password:_e}}if(ch(T)){const Y=new URL(T,De.origin);if(!N&&(Y.username||Y.password)){const _e=Do(Y.username),je=Do(Y.password);N={username:_e,password:je}}(Y.username||Y.password)&&(Y.username="",Y.password="",T=Y.href)}if(N&&(H.delete("authorization"),H.set("Authorization","Basic "+btoa(ah((N.username||"")+":"+(N.password||""))))),P&&typeof T=="string"&&T.startsWith("data:")&&oh(T)>K)throw new I("maxContentLength size of "+K+" exceeded",I.ERR_BAD_RESPONSE,g,R);if(D&&x!=="get"&&x!=="head"){const Y=await v(y);if(typeof Y=="number"&&isFinite(Y)&&(ae=Y,Y>re))throw ie()}const te=D&&(S.isReadableStream(y)||S.isStream(y)),ve=(Y,_e,je)=>Lo(Y,No,Ze=>{if(D&&Ze>re)throw ce=ie();_e&&_e(Ze)},je);if(m&&x!=="get"&&x!=="head"&&(U||te)){if(ae=ae??await _(H,y),ae!==0||te){let Y=new s(T,{method:"POST",body:y,duplex:"half"}),_e;if(S.isFormData(y)&&(_e=Y.headers.get("content-type"))&&H.setContentType(_e),Y.body){const[je,Ze]=U&&Co(ae,zr(Oo(U)))||[];y=ve(Y.body,je,Ze)}}}else if(te&&!l&&u&&x!=="get"&&x!=="head")y=ve(y);else if(te&&l&&!m&&x!=="get"&&x!=="head")throw new I("Stream request bodies are not supported by the current fetch implementation",I.ERR_NOT_SUPPORT,g,R);S.isString(L)||(L=L?"include":"omit");const Re=l&&"credentials"in s.prototype;if(S.isFormData(y)){const Y=H.getContentType();Y&&/^multipart\/form-data/i.test(Y)&&!/boundary=/i.test(Y)&&H.delete("content-type")}H.set("User-Agent","axios/"+Ws,!1);const be={...Q,signal:W,method:x.toUpperCase(),headers:xc(H.normalize()),body:y,duplex:"half",credentials:Re?L:void 0};R=l&&new s(T,be);let Pe=await(l?A(R,Q):A(T,be));const Ce=Fe.from(Pe.headers);if(P){const Y=S.toFiniteNumber(Ce.getContentLength());if(Y!=null&&Y>K)throw new I("maxContentLength size of "+K+" exceeded",I.ERR_BAD_RESPONSE,g,R)}const V=h&&(F==="stream"||F==="response");if(h&&Pe.body&&(k||P||V&&G)){const Y={};["status","statusText","headers"].forEach(it=>{Y[it]=Pe[it]});const _e=S.toFiniteNumber(Ce.getContentLength()),[je,Ze]=k&&Co(_e,zr(Oo(k),!0))||[];let an=0;const Un=it=>{if(P&&(an=it,an>K))throw new I("maxContentLength size of "+K+" exceeded",I.ERR_BAD_RESPONSE,g,R);je&&je(it)};Pe=new o(Lo(Pe.body,No,Un,()=>{Ze&&Ze(),G&&G()}),Y)}F=F||"text";let we=await b[S.findKey(b,F)||"text"](Pe,g);if(P&&!h&&!V){let Y;if(we!=null&&(typeof we.byteLength=="number"?Y=we.byteLength:typeof we.size=="number"?Y=we.size:typeof we=="string"&&(Y=typeof r=="function"?new r().encode(we).byteLength:we.length)),typeof Y=="number"&&Y>K)throw new I("maxContentLength size of "+K+" exceeded",I.ERR_BAD_RESPONSE,g,R)}return!V&&G&&G(),await new Promise((Y,_e)=>{Dc(Y,_e,{data:we,headers:Fe.from(Pe.headers),status:Pe.status,statusText:Pe.statusText,config:g,request:R})})}catch(N){if(G&&G(),W&&W.aborted&&W.reason instanceof I){const Z=W.reason;throw Z.config=g,R&&(Z.request=R),N!==Z&&Object.defineProperty(Z,"cause",{__proto__:null,value:N,writable:!0,enumerable:!1,configurable:!0}),Z}if(ce)throw R&&!ce.request&&(ce.request=R),ce;if(N instanceof I)throw R&&!N.request&&(N.request=R),N;if(N&&N.name==="TypeError"&&/Load failed|fetch/i.test(N.message)){const Z=new I("Network Error",I.ERR_NETWORK,g,R,N&&N.response);throw Object.defineProperty(Z,"cause",{__proto__:null,value:N.cause||N,writable:!0,enumerable:!1,configurable:!0}),Z}throw I.from(N,N&&N.code,g,R,N&&N.response)}}},dh=new Map,Mc=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:i}=t,s=[r,i,n];let o=s.length,a=o,l,d,u=dh;for(;a--;)l=s[a],d=u.get(l),d===void 0&&u.set(l,d=a?new Map:lh(t)),u=d;return d};Mc();const $s={http:Tf,xhr:eh,fetch:{get:Mc}};S.forEach($s,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const jo=e=>`- ${e}`,uh=e=>S.isFunction(e)||e===null||e===!1;function fh(e,t){e=S.isArray(e)?e:[e];const{length:n}=e;let r,i;const s={};for(let o=0;o<n;o++){r=e[o];let a;if(i=r,!uh(r)&&(i=$s[(a=String(r)).toLowerCase()],i===void 0))throw new I(`Unknown adapter '${a}'`);if(i&&(S.isFunction(i)||(i=i.get(t))))break;s[a||"#"+o]=i}if(!i){const o=Object.entries(s).map(([l,d])=>`adapter ${l} `+(d===!1?"is not supported by the environment":"is not available in the build"));let a=n?o.length>1?`since :
|
|
36
|
+
`+o.map(jo).join(`
|
|
37
|
+
`):" "+jo(o[0]):"as no adapter specified";throw new I("There is no suitable adapter to dispatch the request "+a,I.ERR_NOT_SUPPORT)}return i}const Uc={getAdapter:fh,adapters:$s};function Oi(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new fr(null,e)}function Mo(e){return Oi(e),e.headers=Fe.from(e.headers),e.data=Ci.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Uc.getAdapter(e.adapter||ur.adapter,e)(e).then(function(r){Oi(e),e.response=r;try{r.data=Ci.call(e,e.transformResponse,r)}finally{delete e.response}return r.headers=Fe.from(r.headers),r},function(r){if(!Nc(r)&&(Oi(e),r&&r.response)){e.response=r.response;try{r.response.data=Ci.call(e,e.transformResponse,r.response)}finally{delete e.response}r.response.headers=Fe.from(r.response.headers)}return Promise.reject(r)})}const hi={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{hi[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const Uo={};hi.transitional=function(t,n,r){function i(s,o){return"[Axios v"+Ws+"] Transitional option '"+s+"'"+o+(r?". "+r:"")}return(s,o,a)=>{if(t===!1)throw new I(i(o," has been removed"+(n?" in "+n:"")),I.ERR_DEPRECATED);return n&&!Uo[o]&&(Uo[o]=!0,console.warn(i(o," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(s,o,a):!0}};hi.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function hh(e,t,n){if(typeof e!="object"||e===null)throw new I("options must be an object",I.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let i=r.length;for(;i-- >0;){const s=r[i],o=Object.prototype.hasOwnProperty.call(t,s)?t[s]:void 0;if(o){const a=e[s],l=a===void 0||o(a,s,e);if(l!==!0)throw new I("option "+s+" must be "+l,I.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new I("Unknown option "+s,I.ERR_BAD_OPTION)}}const Nr={assertOptions:hh,validators:hi},Me=Nr.validators;let Xt=class{constructor(t){this.defaults=t||{},this.interceptors={request:new ko,response:new ko}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const s=(()=>{if(!i.stack)return"";const o=i.stack.indexOf(`
|
|
78
38
|
`);return o===-1?"":i.stack.slice(o+1)})();try{if(!r.stack)r.stack=s;else if(s){const o=s.indexOf(`
|
|
79
39
|
`),a=o===-1?-1:s.indexOf(`
|
|
80
40
|
`,o+1),l=a===-1?"":s.slice(a+1);String(r.stack).endsWith(l)||(r.stack+=`
|
|
81
|
-
`+s)}}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Un(this.defaults,n);const{transitional:r,paramsSerializer:i,headers:s}=n;r!==void 0&&Ji.assertOptions(r,{silentJSONParsing:ze.transitional(ze.boolean),forcedJSONParsing:ze.transitional(ze.boolean),clarifyTimeoutError:ze.transitional(ze.boolean),legacyInterceptorReqResOrdering:ze.transitional(ze.boolean),advertiseZstdAcceptEncoding:ze.transitional(ze.boolean),validateStatusUndefinedResolves:ze.transitional(ze.boolean)},!1),i!=null&&(A.isFunction(i)?n.paramsSerializer={serialize:i}:Ji.assertOptions(i,{encode:ze.function,serialize:ze.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Ji.assertOptions(n,{baseUrl:ze.spelling("baseURL"),withXsrfToken:ze.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=s&&A.merge(s.common,s[n.method]);s&&A.forEach(["delete","get","head","post","put","patch","query","common"],b=>{delete s[b]}),n.headers=Ge.concat(o,s);const a=[];let l=!0;this.interceptors.request.forEach(function(h){if(typeof h.runWhen=="function"&&h.runWhen(n)===!1)return;l=l&&h.synchronous;const g=n.transitional||Oc;g&&g.legacyInterceptorReqResOrdering?a.unshift(h.fulfilled,h.rejected):a.push(h.fulfilled,h.rejected)});const d=[];this.interceptors.response.forEach(function(h){d.push(h.fulfilled,h.rejected)});let u,f=0,m;if(!l){const b=[md.bind(this),void 0];for(b.unshift(...a),b.push(...d),m=b.length,u=Promise.resolve(n);f<m;)u=u.then(b[f++],b[f++]);return u}m=a.length;let p=n;for(;f<m;){const b=a[f++],h=a[f++];try{p=b(p)}catch(g){h.call(this,g);break}}try{u=md.call(this,p)}catch(b){return Promise.reject(b)}for(f=0,m=d.length;f<m;)u=u.then(d[f++],d[f++]);return u}getUri(t){t=Un(this.defaults,t);const n=Kp(t.baseURL,t.url,t.allowAbsoluteUrls,t);return Wp(n,t.params,t.paramsSerializer)}};A.forEach(["delete","get","head","options"],function(t){Rn.prototype[t]=function(n,r){return this.request(Un(r||{},{method:t,url:n,data:r&&A.hasOwnProp(r,"data")?r.data:void 0}))}});A.forEach(["post","put","patch","query"],function(t){function n(r){return function(s,o,a){return this.request(Un(a||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:s,data:o}))}}Rn.prototype[t]=n(),t!=="query"&&(Rn.prototype[t+"Form"]=n(!0))});let yS=class Yp{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(s){n=s});const r=this;this.promise.then(i=>{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](i);r._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(a=>{r.subscribe(a),s=a}).then(i);return o.cancel=function(){r.unsubscribe(s)},o},t(function(s,o,a){r.reason||(r.reason=new vi(s,o,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new Yp(function(i){t=i}),cancel:t}}};function bS(e){return function(n){return e.apply(null,n)}}function vS(e){return A.isObject(e)&&e.isAxiosError===!0}const ra={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,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(ra).forEach(([e,t])=>{ra[t]=e});function Zp(e){const t=new Rn(e),n=Ep(Rn.prototype.request,t);return A.extend(n,Rn.prototype,t,{allOwnKeys:!0}),A.extend(n,t,null,{allOwnKeys:!0}),n.create=function(i){return Zp(Un(e,i))},n}const Re=Zp(bi);Re.Axios=Rn;Re.CanceledError=vi;Re.CancelToken=yS;Re.isCancel=Hp;Re.VERSION=Rc;Re.toFormData=Js;Re.AxiosError=q;Re.Cancel=Re.CanceledError;Re.all=function(t){return Promise.all(t)};Re.spread=bS;Re.isAxiosError=vS;Re.mergeConfig=Un;Re.AxiosHeaders=Ge;Re.formToJSON=e=>Vp(A.isHTMLForm(e)?new FormData(e):e);Re.getAdapter=Qp.getAdapter;Re.HttpStatusCode=ra;Re.default=Re;const{Axios:TE,AxiosError:CE,CanceledError:PE,isCancel:EE,CancelToken:kE,VERSION:AE,all:OE,Cancel:NE,isAxiosError:Xp,spread:RE,toFormData:LE,AxiosHeaders:DE,HttpStatusCode:jE,formToJSON:ME,getAdapter:IE,mergeConfig:FE,create:UE}=Re,wS="Bearer ",Jp="web-trading-token";function xS(){return typeof window>"u"?null:localStorage.getItem(Jp)}function xr(e){return e.replace(/\/$/,"")}function gd(e){const t=xr(e);async function n(r){const i=xS();return(await Re({...r,baseURL:t,headers:{...r.headers??{},...i?{Authorization:`${wS}${i}`}:{}}})).data}return{get(r,i){return n({...i,url:r,method:"get"})},post(r,i,s){return n({...s,url:r,method:"post",data:i})}}}function yd(e){return!e.isDemo&&!e.isArchive&&!!e.tradeStat}function _S(e){const t=e.filter(n=>yd(n)&&n.platformType==="mt5");return t.length>0?t:e.filter(yd)}function SS(e){const t=e,n=(t==null?void 0:t.accounts)??[];return _S(n).map(r=>{var i,s,o,a,l;return{id:r.id,login:String(r.login),label:`${r.displayTitle} · ${r.login}`,currency:r.currency,tradeStat:{balance:((i=r.tradeStat)==null?void 0:i.balance)??0,equity:((s=r.tradeStat)==null?void 0:s.equity)??0,margin:((o=r.tradeStat)==null?void 0:o.margin)??0,marginFree:((a=r.tradeStat)==null?void 0:a.marginFree)??0,marginLevel:(l=r.tradeStat)==null?void 0:l.marginLevel}}})}function TS(e){try{const t=new URL(xr(e));return t.hostname.includes("webtrade.")?(t.hostname=t.hostname.replace("webtrade.","api."),t.origin):(t.hostname.startsWith("webtrade")&&(t.hostname=t.hostname.replace(/^webtrade/,"api")),t.origin)}catch{return xr(e)}}function CS(e){try{const t=new URL(xr(e));return t.hostname.includes("opheleo")?"wss://ticks.opheleo.com":(t.protocol=t.protocol==="https:"?"wss:":"ws:",t.origin)}catch{return""}}function PS(e){const t=xr(e),n=gd(t),r=TS(t),i=gd(r),s=hx(n),o=Wt;return{baseUrl:t,platformApiBase:r,tickWebSocketUrl:CS(t),dealer:s,trading:xx(s,o),async getAccounts(){const a=await i.get("/account-config/api/v1");return SS(a)}}}const em=S.createContext(null);function tm({baseUrl:e,children:t}){const n=S.useMemo(()=>PS(e),[e]);return c.jsx(em.Provider,{value:n,children:t})}function ut(){const e=S.useContext(em);if(!e)throw new Error("useWidgetApiClient must be used within WidgetApiProvider");return e}function nm(){return ut().tickWebSocketUrl}const ES="wss://ticks.opheleo.com";function Dc(e){const[t,n]=S.useState(null),r=nm();return S.useEffect(()=>{n(null);const i=Qs(e).toUpperCase();let s=null,o=!1;const a=r||ES,l=()=>{s=new WebSocket(a),s.onopen=()=>{if(o){s==null||s.close(1e3,"Unmounted");return}s==null||s.send(JSON.stringify({action:"select_symbol",symbol:i}))},s.onmessage=d=>{var u;try{const f=JSON.parse(d.data);if(((u=f.symbol)==null?void 0:u.trim().toUpperCase())!==i)return;const p=Number(f.bid),b=Number(f.ask);if(!Number.isFinite(p)||!Number.isFinite(b))return;n({bid:p,ask:b})}catch{}},s.onclose=()=>{o||setTimeout(l,3e3)}};return l(),()=>{o=!0,s==null||s.close(1e3,"Unmounted")}},[e,r]),t}function kS(e,t){const n=Number(e),r=Number(t);return Number.isFinite(n)&&Number.isFinite(r)&&n!==r?n-r:e.localeCompare(t,void 0,{numeric:!0})}function AS(e,t){return e.openTimeMs!==t.openTimeMs?e.openTimeMs-t.openTimeMs:kS(e.ticket,t.ticket)}function bd(e){return[...e].sort(AS)}function vd(e){return $e(e).toUpperCase()}const pe=Zs(e=>({positions:[],orders:[],liveQuotes:{},selectedLogin:"",selectedPositionTicket:null,selectedOrderTicket:null,setSelectedLogin:t=>{e({selectedLogin:t})},setSelectedPositionTicket:t=>{e(n=>({selectedPositionTicket:t,selectedOrderTicket:t!==null?null:n.selectedOrderTicket}))},setSelectedOrderTicket:t=>{e(n=>({selectedOrderTicket:t,selectedPositionTicket:t!==null?null:n.selectedPositionTicket}))},setPositions:t=>{e({positions:bd(t)})},setOrders:t=>{e({orders:bd(t)})},removePosition:t=>{e(n=>({positions:n.positions.filter(r=>r.ticket!==t),selectedPositionTicket:n.selectedPositionTicket===t?null:n.selectedPositionTicket}))},removeOrder:t=>{e(n=>({orders:n.orders.filter(r=>r.ticket!==t),selectedOrderTicket:n.selectedOrderTicket===t?null:n.selectedOrderTicket}))},updateQuotes:(t,n,r)=>{const i=vd(t);e(s=>{const o={...s.liveQuotes,[i]:{bid:n,ask:r}};return{liveQuotes:o,positions:s.positions.map(a=>jw(a,i,n,r,o)),orders:s.orders.map(a=>{if(vd(a.symbol)!==i)return a;const l=a.side==="buy"?n:r;return{...a,currentPrice:l,marketBid:n,marketAsk:r}})}})},clearPositions:()=>{e({positions:[],orders:[],liveQuotes:{}})}}));function OS({symbolTicker:e,symbols:t,sidePanelTab:n,orderState:r,backUrl:i,createAccountUrl:s}){const o=Dc(e),{panelRef:a,position:l,isDragging:d,onDragStart:u,reclamp:f}=Sp(),{panel:m,isSubmitting:p,defaultVolumeLots:b,volumeStep:h,minVolumeLots:g,accountOptions:y,selectedLogin:v,isAccountsLoading:_,hasConfirmedAccount:x,needsAccountSelection:T,confirmAccountSelection:C,placeMarketOrder:O}=r,P=le(k=>k.setDraft),L=le(k=>k.clearDraft),I=pe(k=>k.selectedPositionTicket),U=pe(k=>k.selectedOrderTicket),N=I!==null||U!==null,V=Number(Vt(Ht(e))),M=Or(V);S.useEffect(()=>{if(x&&!N){if(m==="closed"||m==="confirmation"){L();return}P({source:"new-order",symbolKey:mi(e,t),entryPrice:null,side:null,showEntryLine:!1,stopLoss:"",takeProfit:"",volumeLots:b,digits:V,priceStep:M})}},[L,b,V,x,N,m,M,P,e,t]);const z=k=>{O({symbolTicker:e,login:k.login,executionMode:"market",side:k.side,orderType:k.side==="buy"?Xe.BUY:Xe.SELL,volumeLots:k.volumeLots,stopLoss:"",takeProfit:"",priceOrder:"",priceTrigger:"",comment:"",typeTime:Qe.GTC,expirationDateTime:"",expirationDay:"",bid:k.bid,ask:k.ask})};return c.jsxs(c.Fragment,{children:[c.jsx(up,{open:T,isAccountsLoading:_,accountOptions:y,onConfirm:C,backUrl:i,createAccountUrl:s}),x&&c.jsx("div",{ref:a,style:{left:l.x,top:l.y},className:`web-trading-widget-new-order-overlay${d?" web-trading-widget-new-order-overlay--dragging":""}`,children:c.jsx(ex,{symbolTicker:e,bid:(o==null?void 0:o.bid)??null,ask:(o==null?void 0:o.ask)??null,defaultVolumeLots:b,volumeStep:h,minVolumeLots:g,isSubmitting:p,isAccountsLoading:_,selectedLogin:v,isDragging:d,sidePanelTab:n,onDragHandlePointerDown:u,onExpandedChange:f,onExpand:f,onPlaceOrder:z})})]})}const NS="wss://ticks.opheleo.com";function RS(e,t){const n=new Set;for(const r of e){const i=$e(r.symbol).toUpperCase();i&&n.add(i)}for(const r of t){const i=$e(r.symbol).toUpperCase();i&&n.add(i)}for(const r of Lw([...n]))n.add(r);return[...n].sort().join("|")}function LS(e){return RS(e.positions,e.orders)}function DS(){const e=pe(LS),t=pe(r=>r.updateQuotes),n=nm();S.useEffect(()=>{if(!e)return;const r=e.split("|"),i=new Map;let s=!1;const o=n||NS,a=l=>{const d=new WebSocket(o);i.set(l,d),d.onopen=()=>{if(s){d.close(1e3,"Unmounted");return}d.send(JSON.stringify({action:"select_symbol",symbol:l}))},d.onmessage=u=>{var f;try{const m=JSON.parse(u.data),p=(f=m.symbol)==null?void 0:f.trim().toUpperCase();if(!p||p!==l)return;const b=Number(m.bid),h=Number(m.ask);if(!Number.isFinite(b)||!Number.isFinite(h))return;t(p,b,h)}catch{}},d.onclose=()=>{i.delete(l),s||setTimeout(()=>a(l),3e3)}};for(const l of r)a(l);return()=>{s=!0;for(const l of i.values())l.close(1e3,"Unmounted");i.clear()}},[e,n,t])}function rm(){return DS(),null}const ia=(e,t,n)=>{if(!e)return t;try{const r=e.activeChart().symbol(),i=n.find(s=>s.display_name===r||s.ticker===r);if(i)return mi(i.ticker,n)}catch{}return t},im={buy:"#2563eb",sell:"#dc2626"},Oo={positive:"#2563eb",negative:"#dc2626",neutral:"#94a3b8"},qr={linewidth:1,linestyle:2,fontsize:11},Qn={linewidth:qr.linewidth,linestyle:qr.linestyle},sm={stopLoss:"#f97316",takeProfit:"#22c55e"},om=e=>im[e],sa=(e,t)=>e==="entry"?t!=null?om(t):im.sell:sm[e],wd=(e,t)=>{if(e==="entry")return sa(e,t.side);const{side:n,entryPrice:r,linePrice:i,volumeLots:s}=t;if(n!=null&&r!==null&&r!==void 0&&i!==void 0&&s!==void 0){const o=am(n,r,i,s);return cm(o)}return sm[e]},am=(e,t,n,r)=>(e==="buy"?n-t:t-n)*r*100,jS=(e,t)=>!Number.isFinite(t)||t<=0?0:Math.round(e/t),MS=e=>{const t=am(e.side,e.entryPrice,e.linePrice,e.volumeLots),n=e.side==="buy"?e.linePrice-e.entryPrice:e.entryPrice-e.linePrice,r=jS(n,e.priceStep),i=e.kind==="takeProfit"?"TP":"SL",s=`${t.toFixed(2)} USD`,o=`${r} points`;return`${i} ${s}, ${o}`},IS=(e,t)=>e.toFixed(t),cm=e=>e>0?Oo.positive:e<0?Oo.negative:Oo.neutral,FS=e=>{const t=`${e.side.toUpperCase()} ${e.volumeLots.toFixed(2)}, `,n=`${e.profit.toFixed(2)} USD`;return`${t}${n}`},No=e=>{const t=om(e.side),n=cm(e.profit);return{text:FS(e),linecolor:t,textcolor:n,linewidth:qr.linewidth,linestyle:qr.linestyle,fontsize:qr.fontsize,showPrice:!0,horzLabelsAlign:"left"}},Ro=e=>We(e),US=e=>e==="entry"||e==="stopLoss"||e==="takeProfit",BS=["entry","stopLoss","takeProfit"],WS=32,xd=(e,t,n)=>{const{source:r,symbolKey:i}=le.getState();if(r===null)return!1;const s=ia(e,t,n);return i===s},Lo=e=>{e.setUserEditEnabled(!1),e.setSelectionEnabled(!1)},_d=(e,t,n)=>{if(e==="entry")return IS(t,n.digits);const{entryPrice:r,side:i}=n;return i!==null&&r!==null?MS({kind:e,side:i,entryPrice:r,linePrice:t,volumeLots:n.volumeLots,priceStep:n.priceStep}):`${e==="takeProfit"?"TP":"SL"} ${Ce(t,n.digits)}`},$S=({chartWidget:e,symbolTicker:t,symbols:n})=>{const r=le(k=>k.source),i=le(k=>k.entryPrice),s=le(k=>k.stopLoss),o=le(k=>k.takeProfit),a=le(k=>k.side),l=le(k=>k.showEntryLine),d=le(k=>k.volumeLots),u=le(k=>k.digits),f=le(k=>k.priceStep),m=le(k=>k.setStopLoss),p=le(k=>k.setTakeProfit),b=S.useMemo(()=>mi(t,n),[t,n]),h=S.useRef(b);S.useEffect(()=>{h.current=b},[b]);const g=S.useRef({}),y=S.useRef(null),v=S.useRef(null),_=S.useRef(null),x=S.useRef(!1),T=S.useRef({entryPrice:i,stopLoss:s,takeProfit:o,side:a,showEntryLine:l,volumeLots:d,digits:u,priceStep:f});S.useEffect(()=>{T.current={entryPrice:i,stopLoss:s,takeProfit:o,side:a,showEntryLine:l,volumeLots:d,digits:u,priceStep:f}},[u,i,f,l,a,s,o,d]);const C=S.useCallback(k=>{if(!e)return;const j=g.current[k];if(j){try{e.activeChart().removeEntity(j)}catch{}delete g.current[k]}},[e]),O=S.useCallback(()=>{for(const k of BS)C(k);g.current={}},[C]),P=S.useCallback((k,j,D,R)=>{const W=sa(j,R.side),F=wd(j,{side:R.side,entryPrice:R.entryPrice,linePrice:D,volumeLots:R.volumeLots});k.setProperties({text:_d(j,D,R),linecolor:W,textcolor:F,showPrice:!0,horzLabelsAlign:"left",...j==="entry"?Qn:{}})},[]),L=S.useCallback(async(k,j,D)=>{var de;if(!e)return;if(j===void 0){C(k);return}if(v.current===k)return;const R=e.activeChart(),W=sa(k,D.side),F=wd(k,{side:D.side,entryPrice:D.entryPrice,linePrice:j,volumeLots:D.volumeLots}),G=_d(k,j,D),X=g.current[k];if(X)try{const ne=R.getShapeById(X);k==="entry"&&Lo(ne);const B=(de=ne.getPoints()[0])==null?void 0:de.price;if(B!==void 0&&Math.abs(B-j)<D.priceStep/2){ne.setProperties({text:G,linecolor:W,textcolor:F,showPrice:!0,horzLabelsAlign:"left",...k==="entry"?Qn:{}});return}const $=ne.getPoints();if($.length>0){x.current=!0,ne.setPoints($.map(Q=>({...Q,price:j}))),x.current=!1,ne.setProperties({text:G,linecolor:W,textcolor:F,showPrice:!0,horzLabelsAlign:"left",...k==="entry"?Qn:{}});return}}catch{delete g.current[k]}try{const ne=R.getVisibleRange(),B=await R.createShape({time:ne.from,price:j},{shape:"horizontal_line",text:G,disableSave:!0,lock:k==="entry",disableSelection:k==="entry",overrides:{linecolor:W,textcolor:F,linewidth:k==="entry"?Qn.linewidth:2,...k==="entry"?{linestyle:Qn.linestyle}:{},showPrice:!0,horzLabelsAlign:"left"}});if(k==="entry")try{R.getShapeById(B).setProperties(Qn)}catch{}if(k==="entry"&&!T.current.showEntryLine){try{R.removeEntity(B)}catch{}return}if(k==="entry")try{Lo(R.getShapeById(B))}catch{}g.current[k]=B}catch{}},[e,C]),I=S.useCallback(async k=>{if(!xd(e,h.current,n)){O();return}const j=Ro(k.stopLoss),D=Ro(k.takeProfit);k.showEntryLine&&k.entryPrice!==null?await L("entry",k.entryPrice,k):await L("entry",void 0,k),await L("stopLoss",j,k),await L("takeProfit",D,k)},[e,O,n,L]),U=S.useCallback(()=>{e&&(O(),xd(e,h.current,n)&&I(T.current))},[e,O,n,I]),N=S.useRef(U);S.useEffect(()=>{N.current=U},[U]);const V=S.useCallback(()=>{y.current!==null&&clearTimeout(y.current),y.current=setTimeout(()=>{y.current=null,N.current()},WS)},[]),M=S.useRef(V);S.useEffect(()=>{M.current=V},[V]);const z=r!==null&&(l||s.trim()!==""||o.trim()!=="");S.useEffect(()=>{if(!e||!z)return;const k=(j,D)=>{var G,X,de;const R=(G=Object.entries(g.current).find(([,ne])=>ne===j))==null?void 0:G[0];if(!R||!US(R))return;const F=e.activeChart().getAllShapes().filter(ne=>ne.name==="horizontal_line").some(ne=>ne.id===j);if(R==="entry"){if((D==="move"||D==="points_changed")&&F){const ne=T.current;if(ne.entryPrice!==null)try{const B=e.activeChart().getShapeById(j),$=(X=B.getPoints()[0])==null?void 0:X.price;if($!==void 0&&Math.abs($-ne.entryPrice)>=ne.priceStep/2){const Q=B.getPoints();Q.length>0&&B.setPoints(Q.map(ye=>({...ye,price:ne.entryPrice})))}Lo(B)}catch{}}return}if(D==="remove"&&F){v.current=null,R==="stopLoss"&&m(""),R==="takeProfit"&&p(""),delete g.current[R];return}if(!(D!=="move"&&D!=="points_changed"&&!F)&&!x.current)try{const ne=e.activeChart().getShapeById(j),B=(de=ne.getPoints()[0])==null?void 0:de.price;if(!Number.isFinite(B)||B<=0)return;const $=T.current,Q=R==="stopLoss"?$.stopLoss:$.takeProfit,ye=Ro(Q),ce=ye!==void 0&&Math.abs(ye-B)<$.priceStep/2;if(D==="points_changed"&&F){v.current=R,P(ne,R,B,$),_.current!==null&&clearTimeout(_.current),_.current=setTimeout(()=>{v.current=null;const ke=Ce(B,T.current.digits);R==="stopLoss"?m(ke):p(ke)},120);return}if(_.current!==null&&(clearTimeout(_.current),_.current=null),v.current=null,ce){P(ne,R,B,$);return}const ee=Ce(B,$.digits),ae=R==="stopLoss"?{...$,stopLoss:ee}:{...$,takeProfit:ee};R==="stopLoss"?m(ee):p(ee),P(ne,R,B,ae)}catch{v.current=null}};try{e.subscribe("drawing_event",k)}catch{}return()=>{v.current=null,_.current!==null&&(clearTimeout(_.current),_.current=null);try{e.unsubscribe("drawing_event",k)}catch{}}},[e,z,m,p,P]),S.useEffect(()=>{if(!e)return;if(r===null){O();return}let k=!1;try{e.onChartReady(()=>{k||I(T.current)})}catch{}return()=>{k=!0}},[e,O,r,i,s,o,a,l,d,u,f,I]),S.useEffect(()=>{if(!e||r===null)return;let k=!1,j=null,D=!1;const R=()=>{k||(D=!0,M.current())},W=()=>{k||!D||(D=!1,M.current())};try{e.onChartReady(()=>{if(!k)try{j=e.activeChart(),j.onSymbolChanged().subscribe(null,R),j.onDataLoaded().subscribe(null,W)}catch{}})}catch{}return()=>{if(k=!0,y.current!==null&&(clearTimeout(y.current),y.current=null),j)try{j.onSymbolChanged().unsubscribe(null,R),j.onDataLoaded().unsubscribe(null,W)}catch{}}},[e,r]),S.useEffect(()=>{if(!e||r===null)return;let k=!1;try{e.onChartReady(()=>{k||M.current()})}catch{}return()=>{k=!0}},[b,e,r])},Do=e=>{e.setUserEditEnabled(!1),e.setSelectionEnabled(!1)},oa=(e,t)=>$e(e.symbol).toUpperCase()===t,Sd=e=>pe.getState().positions.filter(t=>oa(t,e)).map(t=>({ticket:t.ticket,openPrice:t.openPrice,type:t.type,digits:t.digits,volumeLots:t.volumeLots,profit:t.profit})),Td=(e,t,n)=>{var s;const r=(s=e.getPoints()[0])==null?void 0:s.price;if(r!==void 0&&Math.abs(r-t)<Number.EPSILON){e.setProperties(n);return}const i=e.getPoints();i.length>0&&e.setPoints(i.map(o=>({...o,price:t}))),e.setProperties(n)},VS=500,HS=({chartWidget:e,symbolTicker:t,symbols:n})=>{const r=pe(x=>x.positions),i=S.useRef(new Map),s=S.useRef(0),o=S.useMemo(()=>mi(t,n),[t,n]),a=S.useRef(o);S.useEffect(()=>{a.current=o},[o]);const l=S.useMemo(()=>r.filter(x=>oa(x,o)).map(x=>`${x.ticket}:${x.openPrice}:${x.type}:${x.digits}:${x.volumeLots}`).sort().join("|"),[o,r]),d=S.useMemo(()=>r.filter(x=>oa(x,o)).map(x=>`${x.ticket}:${x.profit.toFixed(2)}`).sort().join("|"),[o,r]),u=S.useCallback(x=>{if(!e)return;const T=i.current.get(x);if(T){try{e.activeChart().removeEntity(T)}catch{}i.current.delete(x)}},[e]),f=S.useCallback(()=>{for(const x of[...i.current.keys()])u(x);i.current.clear()},[u]),m=S.useCallback(async(x,T,C)=>{const O=No({side:T.type,volumeLots:T.volumeLots,profit:T.profit}),L={time:x.getVisibleRange().from,price:T.openPrice},I=await x.createShape(L,{shape:"horizontal_line",text:String(O.text),disableSave:!0,lock:!0,disableSelection:!0,overrides:O});if(C!==s.current){try{x.removeEntity(I)}catch{}return null}try{const U=x.getShapeById(I);U.setProperties(O),Do(U)}catch{}return I},[]),p=S.useCallback(async(x,T)=>{if(!e||T!==s.current)return;const C=e.activeChart(),O=No({side:x.type,volumeLots:x.volumeLots,profit:x.profit}),P=i.current.get(x.ticket);if(P)try{Td(C.getShapeById(P),x.openPrice,O),Do(C.getShapeById(P));return}catch{i.current.delete(x.ticket)}if(T===s.current)try{const L=await m(C,x,T);if(!L)return;i.current.set(x.ticket,L)}catch{}},[e,m]),b=S.useCallback(async(x,T)=>{if(!e||x!==s.current)return;const C=Sd(T),O=new Set(C.map(P=>P.ticket));for(const P of i.current.keys())O.has(P)||u(P);for(const P of C){if(x!==s.current)return;await p(P,x)}},[e,u,p]),h=S.useCallback(()=>{if(!e)return;let x;try{x=e.activeChart()}catch{return}const T=Sd(o);for(const C of T){const O=i.current.get(C.ticket);if(O)try{const P=No({side:C.type,volumeLots:C.volumeLots,profit:C.profit});Td(x.getShapeById(O),C.openPrice,P),Do(x.getShapeById(O))}catch{i.current.delete(C.ticket)}}},[o,e]),g=S.useCallback(x=>{if(!e)return;const T=s.current+1;s.current=T,x!=null&&x.resetLineIds&&f();const C=(x==null?void 0:x.symbolKey)??ia(e,a.current,n);b(T,C)},[e,f,n,b]),y=S.useCallback(()=>e?ia(e,a.current,n):a.current,[e,n]),v=S.useRef(g),_=S.useRef(y);S.useEffect(()=>{v.current=g},[g]),S.useEffect(()=>{_.current=y},[y]),S.useEffect(()=>{if(!e)return;let x=!1,T=null;const C=()=>{x||v.current({resetLineIds:!0,symbolKey:_.current()})};let O=!1;const P=()=>{O=!0,C()},L=()=>{x||!O||(O=!1,v.current({symbolKey:_.current()}))};try{e.onChartReady(()=>{if(!x)try{T=e.activeChart(),v.current({resetLineIds:!0,symbolKey:a.current}),T.onSymbolChanged().subscribe(null,P),T.onDataLoaded().subscribe(null,L)}catch{}})}catch{}return()=>{if(x=!0,s.current+=1,T)try{T.onSymbolChanged().unsubscribe(null,P),T.onDataLoaded().unsubscribe(null,L)}catch{}f()}},[e,f]),S.useEffect(()=>{if(!e)return;let x=!1;try{e.onChartReady(()=>{x||g({symbolKey:o})})}catch{}return()=>{x=!0}},[o,e,l,g]),S.useEffect(()=>{if(!e||!d)return;let x=!1,T=null;return T=setTimeout(()=>{if(!x)try{e.onChartReady(()=>{x||h()})}catch{}},VS),()=>{x=!0,T!==null&&clearTimeout(T)}},[e,d,h])},lm=({chartWidget:e,symbolTicker:t,symbols:n})=>(HS({chartWidget:e,symbolTicker:t,symbols:n}),$S({chartWidget:e,symbolTicker:t,symbols:n}),null);var wi=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},_n,Xt,rr,bu,zS=(bu=class extends wi{constructor(){super();oe(this,_n);oe(this,Xt);oe(this,rr);Y(this,rr,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){E(this,Xt)||this.setEventListener(E(this,rr))}onUnsubscribe(){var t;this.hasListeners()||((t=E(this,Xt))==null||t.call(this),Y(this,Xt,void 0))}setEventListener(t){var n;Y(this,rr,t),(n=E(this,Xt))==null||n.call(this),Y(this,Xt,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){E(this,_n)!==t&&(Y(this,_n,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof E(this,_n)=="boolean"?E(this,_n):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},_n=new WeakMap,Xt=new WeakMap,rr=new WeakMap,bu),jc=new zS,KS={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Ct,Sn,vu,GS=(vu=class{constructor(){oe(this,Ct,KS);oe(this,Sn,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&E(this,Sn)&&e!==E(this,Ct)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:E(this,Ct),provider:e}),Y(this,Ct,e),process.env.NODE_ENV!=="production"&&Y(this,Sn,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&Y(this,Sn,!0),E(this,Ct).setTimeout(e,t)}clearTimeout(e){E(this,Ct).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&Y(this,Sn,!0),E(this,Ct).setInterval(e,t)}clearInterval(e){E(this,Ct).clearInterval(e)}},Ct=new WeakMap,Sn=new WeakMap,vu),xn=new GS;function qS(e){setTimeout(e,0)}var QS=typeof window>"u"||"Deno"in globalThis;function Ze(){}function YS(e,t){return typeof e=="function"?e(t):e}function aa(e){return typeof e=="number"&&e>=0&&e!==1/0}function dm(e,t){return Math.max(e+(t||0)-Date.now(),0)}function cn(e,t){return typeof e=="function"?e(t):e}function nt(e,t){return typeof e=="function"?e(t):e}function Cd(e,t){const{type:n="all",exact:r,fetchStatus:i,predicate:s,queryKey:o,stale:a}=e;if(o){if(r){if(t.queryHash!==Mc(o,t.options))return!1}else if(!ri(t.queryKey,o))return!1}if(n!=="all"){const l=t.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||i&&i!==t.state.fetchStatus||s&&!s(t))}function Pd(e,t){const{exact:n,status:r,predicate:i,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return!1;if(n){if(ni(t.options.mutationKey)!==ni(s))return!1}else if(!ri(t.options.mutationKey,s))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function Mc(e,t){return((t==null?void 0:t.queryKeyHashFn)||ni)(e)}function ni(e){return JSON.stringify(e,(t,n)=>da(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function ri(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>ri(e[n],t[n])):!1}var ZS=Object.prototype.hasOwnProperty;function ca(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=Ed(e)&&Ed(t);if(!r&&!(da(e)&&da(t)))return t;const s=(r?e:Object.keys(e)).length,o=r?t:Object.keys(t),a=o.length,l=r?new Array(a):{};let d=0;for(let u=0;u<a;u++){const f=r?u:o[u],m=e[f],p=t[f];if(m===p){l[f]=m,(r?u<s:ZS.call(e,f))&&d++;continue}if(m===null||p===null||typeof m!="object"||typeof p!="object"){l[f]=p;continue}const b=ca(m,p,n+1);l[f]=b,b===m&&d++}return s===a&&d===s?e:l}function la(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function Ed(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function da(e){if(!kd(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!kd(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function kd(e){return Object.prototype.toString.call(e)==="[object Object]"}function XS(e){return new Promise(t=>{xn.setTimeout(t,e)})}function ua(e,t,n){if(typeof n.structuralSharing=="function")return n.structuralSharing(e,t);if(n.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return ca(e,t)}catch(r){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${r}`),r}return ca(e,t)}return t}function JS(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function eT(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var xs=Symbol();function um(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===xs&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===xs?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function fm(e,t){return typeof e=="function"?e(...t):!!e}function tT(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??(i=t()),r||(r=!0,i.aborted?n():i.addEventListener("abort",n,{once:!0})),i)}),e}var ii=(()=>{let e=()=>QS;return{isServer(){return e()},setIsServer(t){e=t}}})();function fa(){let e,t;const n=new Promise((i,s)=>{e=i,t=s});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),e(i)},n.reject=i=>{r({status:"rejected",reason:i}),t(i)},n}var nT=qS;function rT(){let e=[],t=0,n=a=>{a()},r=a=>{a()},i=nT;const s=a=>{t?e.push(a):i(()=>{n(a)})},o=()=>{const a=e;e=[],a.length&&i(()=>{r(()=>{a.forEach(l=>{n(l)})})})};return{batch:a=>{let l;t++;try{l=a()}finally{t--,t||o()}return l},batchCalls:a=>(...l)=>{s(()=>{a(...l)})},schedule:s,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{i=a}}}var Be=rT(),ir,Jt,sr,wu,iT=(wu=class extends wi{constructor(){super();oe(this,ir,!0);oe(this,Jt);oe(this,sr);Y(this,sr,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){E(this,Jt)||this.setEventListener(E(this,sr))}onUnsubscribe(){var t;this.hasListeners()||((t=E(this,Jt))==null||t.call(this),Y(this,Jt,void 0))}setEventListener(t){var n;Y(this,sr,t),(n=E(this,Jt))==null||n.call(this),Y(this,Jt,t(this.setOnline.bind(this)))}setOnline(t){E(this,ir)!==t&&(Y(this,ir,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return E(this,ir)}},ir=new WeakMap,Jt=new WeakMap,sr=new WeakMap,wu),_s=new iT;function sT(e){return Math.min(1e3*2**e,3e4)}function pm(e){return(e??"online")==="online"?_s.isOnline():!0}var pa=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function mm(e){let t=!1,n=0,r;const i=fa(),s=()=>i.status!=="pending",o=h=>{var g;if(!s()){const y=new pa(h);m(y),(g=e.onCancel)==null||g.call(e,y)}},a=()=>{t=!0},l=()=>{t=!1},d=()=>jc.isFocused()&&(e.networkMode==="always"||_s.isOnline())&&e.canRun(),u=()=>pm(e.networkMode)&&e.canRun(),f=h=>{s()||(r==null||r(),i.resolve(h))},m=h=>{s()||(r==null||r(),i.reject(h))},p=()=>new Promise(h=>{var g;r=y=>{(s()||d())&&h(y)},(g=e.onPause)==null||g.call(e)}).then(()=>{var h;r=void 0,s()||(h=e.onContinue)==null||h.call(e)}),b=()=>{if(s())return;let h;const g=n===0?e.initialPromise:void 0;try{h=g??e.fn()}catch(y){h=Promise.reject(y)}Promise.resolve(h).then(f).catch(y=>{var C;if(s())return;const v=e.retry??(ii.isServer()?0:3),_=e.retryDelay??sT,x=typeof _=="function"?_(n,y):_,T=v===!0||typeof v=="number"&&n<v||typeof v=="function"&&v(n,y);if(t||!T){m(y);return}n++,(C=e.onFail)==null||C.call(e,n,y),XS(x).then(()=>d()?void 0:p()).then(()=>{t?m(y):b()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r==null||r(),i),cancelRetry:a,continueRetry:l,canStart:u,start:()=>(u()?b():p().then(b),i)}}var Tn,xu,hm=(xu=class{constructor(){oe(this,Tn)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),aa(this.gcTime)&&Y(this,Tn,xn.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(ii.isServer()?1/0:300*1e3))}clearGcTimeout(){E(this,Tn)!==void 0&&(xn.clearTimeout(E(this,Tn)),Y(this,Tn,void 0))}},Tn=new WeakMap,xu);function oT(e){return{onFetch:(t,n)=>{var u,f,m,p,b;const r=t.options,i=(m=(f=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:f.fetchMore)==null?void 0:m.direction,s=((p=t.state.data)==null?void 0:p.pages)||[],o=((b=t.state.data)==null?void 0:b.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const d=async()=>{let h=!1;const g=_=>{tT(_,()=>t.signal,()=>h=!0)},y=um(t.options,t.fetchOptions),v=async(_,x,T)=>{if(h)return Promise.reject(t.signal.reason);if(x==null&&_.pages.length)return Promise.resolve(_);const O=(()=>{const U={client:t.client,queryKey:t.queryKey,pageParam:x,direction:T?"backward":"forward",meta:t.options.meta};return g(U),U})(),P=await y(O),{maxPages:L}=t.options,I=T?eT:JS;return{pages:I(_.pages,P,L),pageParams:I(_.pageParams,x,L)}};if(i&&s.length){const _=i==="backward",x=_?aT:Ad,T={pages:s,pageParams:o},C=x(r,T);a=await v(T,C,_)}else{const _=e??s.length;do{const x=l===0?o[0]??r.initialPageParam:Ad(r,a);if(l>0&&x==null)break;a=await v(a,x),l++}while(l<_)}return a};t.options.persister?t.fetchFn=()=>{var h,g;return(g=(h=t.options).persister)==null?void 0:g.call(h,d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=d}}}function Ad(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function aT(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var or,Cn,ar,ct,Pn,Ue,ai,En,tt,gm,Dt,_u,cT=(_u=class extends hm{constructor(t){super();oe(this,tt);oe(this,or);oe(this,Cn);oe(this,ar);oe(this,ct);oe(this,Pn);oe(this,Ue);oe(this,ai);oe(this,En);Y(this,En,!1),Y(this,ai,t.defaultOptions),this.setOptions(t.options),this.observers=[],Y(this,Pn,t.client),Y(this,ct,E(this,Pn).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Y(this,Cn,Nd(this.options)),this.state=t.state??E(this,Cn),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return E(this,or)}get promise(){var t;return(t=E(this,Ue))==null?void 0:t.promise}setOptions(t){if(this.options={...E(this,ai),...t},t!=null&&t._type&&Y(this,or,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=Nd(this.options);n.data!==void 0&&(this.setState(Od(n.data,n.dataUpdatedAt)),Y(this,Cn,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&E(this,ct).remove(this)}setData(t,n){const r=ua(this.state.data,t,this.options);return be(this,tt,Dt).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t){be(this,tt,Dt).call(this,{type:"setState",state:t})}cancel(t){var r,i;const n=(r=E(this,Ue))==null?void 0:r.promise;return(i=E(this,Ue))==null||i.cancel(t),n?n.then(Ze).catch(Ze):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return E(this,Cn)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>nt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===xs||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>cn(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!dm(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=E(this,Ue))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=E(this,Ue))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),E(this,ct).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(E(this,Ue)&&(E(this,En)||be(this,tt,gm).call(this)?E(this,Ue).cancel({revert:!0}):E(this,Ue).cancelRetry()),this.scheduleGc()),E(this,ct).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||be(this,tt,Dt).call(this,{type:"invalidate"})}async fetch(t,n){var d,u,f,m,p,b,h,g,y,v,_;if(this.state.fetchStatus!=="idle"&&((d=E(this,Ue))==null?void 0:d.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(E(this,Ue))return E(this,Ue).continueRetry(),E(this,Ue).promise}if(t&&this.setOptions(t),!this.options.queryFn){const x=this.observers.find(T=>T.options.queryFn);x&&this.setOptions(x.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const r=new AbortController,i=x=>{Object.defineProperty(x,"signal",{enumerable:!0,get:()=>(Y(this,En,!0),r.signal)})},s=()=>{const x=um(this.options,n),C=(()=>{const O={client:E(this,Pn),queryKey:this.queryKey,meta:this.meta};return i(O),O})();return Y(this,En,!1),this.options.persister?this.options.persister(x,C,this):x(C)},a=(()=>{const x={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:E(this,Pn),state:this.state,fetchFn:s};return i(x),x})(),l=E(this,or)==="infinite"?oT(this.options.pages):this.options.behavior;l==null||l.onFetch(a,this),Y(this,ar,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=a.fetchOptions)==null?void 0:u.meta))&&be(this,tt,Dt).call(this,{type:"fetch",meta:(f=a.fetchOptions)==null?void 0:f.meta}),Y(this,Ue,mm({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:x=>{x instanceof pa&&x.revert&&this.setState({...E(this,ar),fetchStatus:"idle"}),r.abort()},onFail:(x,T)=>{be(this,tt,Dt).call(this,{type:"failed",failureCount:x,error:T})},onPause:()=>{be(this,tt,Dt).call(this,{type:"pause"})},onContinue:()=>{be(this,tt,Dt).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const x=await E(this,Ue).start();if(x===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(x),(p=(m=E(this,ct).config).onSuccess)==null||p.call(m,x,this),(h=(b=E(this,ct).config).onSettled)==null||h.call(b,x,this.state.error,this),x}catch(x){if(x instanceof pa){if(x.silent)return E(this,Ue).promise;if(x.revert){if(this.state.data===void 0)throw x;return this.state.data}}throw be(this,tt,Dt).call(this,{type:"error",error:x}),(y=(g=E(this,ct).config).onError)==null||y.call(g,x,this),(_=(v=E(this,ct).config).onSettled)==null||_.call(v,this.state.data,x,this),x}finally{this.scheduleGc()}}},or=new WeakMap,Cn=new WeakMap,ar=new WeakMap,ct=new WeakMap,Pn=new WeakMap,Ue=new WeakMap,ai=new WeakMap,En=new WeakMap,tt=new WeakSet,gm=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Dt=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...ym(r.data,this.options),fetchMeta:t.meta??null};case"success":const i={...r,...Od(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Y(this,ar,t.manual?i:void 0),i;case"error":const s=t.error;return{...r,error:s,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),Be.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),E(this,ct).notify({query:this,type:"updated",action:t})})},_u);function ym(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:pm(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Od(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Nd(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Ye,we,ci,qe,kn,cr,Mt,en,li,lr,dr,An,On,tn,ur,Ee,Hr,ma,ha,ga,ya,ba,va,wa,bm,Su,lT=(Su=class extends wi{constructor(t,n){super();oe(this,Ee);oe(this,Ye);oe(this,we);oe(this,ci);oe(this,qe);oe(this,kn);oe(this,cr);oe(this,Mt);oe(this,en);oe(this,li);oe(this,lr);oe(this,dr);oe(this,An);oe(this,On);oe(this,tn);oe(this,ur,new Set);this.options=n,Y(this,Ye,t),Y(this,en,null),Y(this,Mt,fa()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(E(this,we).addObserver(this),Rd(E(this,we),this.options)?be(this,Ee,Hr).call(this):this.updateResult(),be(this,Ee,ya).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return xa(E(this,we),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return xa(E(this,we),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,be(this,Ee,ba).call(this),be(this,Ee,va).call(this),E(this,we).removeObserver(this)}setOptions(t){const n=this.options,r=E(this,we);if(this.options=E(this,Ye).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof nt(this.options.enabled,E(this,we))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");be(this,Ee,wa).call(this),E(this,we).setOptions(this.options),n._defaulted&&!la(this.options,n)&&E(this,Ye).getQueryCache().notify({type:"observerOptionsUpdated",query:E(this,we),observer:this});const i=this.hasListeners();i&&Ld(E(this,we),r,this.options,n)&&be(this,Ee,Hr).call(this),this.updateResult(),i&&(E(this,we)!==r||nt(this.options.enabled,E(this,we))!==nt(n.enabled,E(this,we))||cn(this.options.staleTime,E(this,we))!==cn(n.staleTime,E(this,we)))&&be(this,Ee,ma).call(this);const s=be(this,Ee,ha).call(this);i&&(E(this,we)!==r||nt(this.options.enabled,E(this,we))!==nt(n.enabled,E(this,we))||s!==E(this,tn))&&be(this,Ee,ga).call(this,s)}getOptimisticResult(t){const n=E(this,Ye).getQueryCache().build(E(this,Ye),t),r=this.createResult(n,t);return uT(this,r)&&(Y(this,qe,r),Y(this,cr,this.options),Y(this,kn,E(this,we).state)),r}getCurrentResult(){return E(this,qe)}trackResult(t,n){return new Proxy(t,{get:(r,i)=>(this.trackProp(i),n==null||n(i),i==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&E(this,Mt).status==="pending"&&E(this,Mt).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,i))})}trackProp(t){E(this,ur).add(t)}getCurrentQuery(){return E(this,we)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=E(this,Ye).defaultQueryOptions(t),r=E(this,Ye).getQueryCache().build(E(this,Ye),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return be(this,Ee,Hr).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),E(this,qe)))}createResult(t,n){var L;const r=E(this,we),i=this.options,s=E(this,qe),o=E(this,kn),a=E(this,cr),d=t!==r?t.state:E(this,ci),{state:u}=t;let f={...u},m=!1,p;if(n._optimisticResults){const I=this.hasListeners(),U=!I&&Rd(t,n),N=I&&Ld(t,r,n,i);(U||N)&&(f={...f,...ym(u.data,t.options)}),n._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:b,errorUpdatedAt:h,status:g}=f;p=f.data;let y=!1;if(n.placeholderData!==void 0&&p===void 0&&g==="pending"){let I;s!=null&&s.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(I=s.data,y=!0):I=typeof n.placeholderData=="function"?n.placeholderData((L=E(this,dr))==null?void 0:L.state.data,E(this,dr)):n.placeholderData,I!==void 0&&(g="success",p=ua(s==null?void 0:s.data,I,n),m=!0)}if(n.select&&p!==void 0&&!y)if(s&&p===(o==null?void 0:o.data)&&n.select===E(this,li))p=E(this,lr);else try{Y(this,li,n.select),p=n.select(p),p=ua(s==null?void 0:s.data,p,n),Y(this,lr,p),Y(this,en,null)}catch(I){Y(this,en,I)}E(this,en)&&(b=E(this,en),p=E(this,lr),h=Date.now(),g="error");const v=f.fetchStatus==="fetching",_=g==="pending",x=g==="error",T=_&&v,C=p!==void 0,P={status:g,fetchStatus:f.fetchStatus,isPending:_,isSuccess:g==="success",isError:x,isInitialLoading:T,isLoading:T,data:p,dataUpdatedAt:f.dataUpdatedAt,error:b,errorUpdatedAt:h,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:f.dataUpdateCount>d.dataUpdateCount||f.errorUpdateCount>d.errorUpdateCount,isFetching:v,isRefetching:v&&!_,isLoadingError:x&&!C,isPaused:f.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:x&&C,isStale:Ic(t,n),refetch:this.refetch,promise:E(this,Mt),isEnabled:nt(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const I=P.data!==void 0,U=P.status==="error"&&!I,N=z=>{U?z.reject(P.error):I&&z.resolve(P.data)},V=()=>{const z=Y(this,Mt,P.promise=fa());N(z)},M=E(this,Mt);switch(M.status){case"pending":t.queryHash===r.queryHash&&N(M);break;case"fulfilled":(U||P.data!==M.value)&&V();break;case"rejected":(!U||P.error!==M.reason)&&V();break}}return P}updateResult(){const t=E(this,qe),n=this.createResult(E(this,we),this.options);if(Y(this,kn,E(this,we).state),Y(this,cr,this.options),E(this,kn).data!==void 0&&Y(this,dr,E(this,we)),la(n,t))return;Y(this,qe,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:i}=this.options,s=typeof i=="function"?i():i;if(s==="all"||!s&&!E(this,ur).size)return!0;const o=new Set(s??E(this,ur));return this.options.throwOnError&&o.add("error"),Object.keys(E(this,qe)).some(a=>{const l=a;return E(this,qe)[l]!==t[l]&&o.has(l)})};be(this,Ee,bm).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&be(this,Ee,ya).call(this)}},Ye=new WeakMap,we=new WeakMap,ci=new WeakMap,qe=new WeakMap,kn=new WeakMap,cr=new WeakMap,Mt=new WeakMap,en=new WeakMap,li=new WeakMap,lr=new WeakMap,dr=new WeakMap,An=new WeakMap,On=new WeakMap,tn=new WeakMap,ur=new WeakMap,Ee=new WeakSet,Hr=function(t){be(this,Ee,wa).call(this);let n=E(this,we).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Ze)),n},ma=function(){be(this,Ee,ba).call(this);const t=cn(this.options.staleTime,E(this,we));if(ii.isServer()||E(this,qe).isStale||!aa(t))return;const r=dm(E(this,qe).dataUpdatedAt,t)+1;Y(this,An,xn.setTimeout(()=>{E(this,qe).isStale||this.updateResult()},r))},ha=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(E(this,we)):this.options.refetchInterval)??!1},ga=function(t){be(this,Ee,va).call(this),Y(this,tn,t),!(ii.isServer()||nt(this.options.enabled,E(this,we))===!1||!aa(E(this,tn))||E(this,tn)===0)&&Y(this,On,xn.setInterval(()=>{(this.options.refetchIntervalInBackground||jc.isFocused())&&be(this,Ee,Hr).call(this)},E(this,tn)))},ya=function(){be(this,Ee,ma).call(this),be(this,Ee,ga).call(this,be(this,Ee,ha).call(this))},ba=function(){E(this,An)!==void 0&&(xn.clearTimeout(E(this,An)),Y(this,An,void 0))},va=function(){E(this,On)!==void 0&&(xn.clearInterval(E(this,On)),Y(this,On,void 0))},wa=function(){const t=E(this,Ye).getQueryCache().build(E(this,Ye),this.options);if(t===E(this,we))return;const n=E(this,we);Y(this,we,t),Y(this,ci,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},bm=function(t){Be.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(E(this,qe))}),E(this,Ye).getQueryCache().notify({query:E(this,we),type:"observerResultsUpdated"})})},Su);function dT(e,t){return nt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&nt(t.retryOnMount,e)===!1)}function Rd(e,t){return dT(e,t)||e.state.data!==void 0&&xa(e,t,t.refetchOnMount)}function xa(e,t,n){if(nt(t.enabled,e)!==!1&&cn(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Ic(e,t)}return!1}function Ld(e,t,n,r){return(e!==t||nt(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Ic(e,n)}function Ic(e,t){return nt(t.enabled,e)!==!1&&e.isStaleByTime(cn(t.staleTime,e))}function uT(e,t){return!la(e.getCurrentResult(),t)}var di,Pt,Ke,Nn,Et,qt,Tu,fT=(Tu=class extends hm{constructor(t){super();oe(this,Et);oe(this,di);oe(this,Pt);oe(this,Ke);oe(this,Nn);Y(this,di,t.client),this.mutationId=t.mutationId,Y(this,Ke,t.mutationCache),Y(this,Pt,[]),this.state=t.state||pT(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){E(this,Pt).includes(t)||(E(this,Pt).push(t),this.clearGcTimeout(),E(this,Ke).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Y(this,Pt,E(this,Pt).filter(n=>n!==t)),this.scheduleGc(),E(this,Ke).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){E(this,Pt).length||(this.state.status==="pending"?this.scheduleGc():E(this,Ke).remove(this))}continue(){var t;return((t=E(this,Nn))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,a,l,d,u,f,m,p,b,h,g,y,v,_,x,T,C,O;const n=()=>{be(this,Et,qt).call(this,{type:"continue"})},r={client:E(this,di),meta:this.options.meta,mutationKey:this.options.mutationKey};Y(this,Nn,mm({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(P,L)=>{be(this,Et,qt).call(this,{type:"failed",failureCount:P,error:L})},onPause:()=>{be(this,Et,qt).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>E(this,Ke).canRun(this)}));const i=this.state.status==="pending",s=!E(this,Nn).canStart();try{if(i)n();else{be(this,Et,qt).call(this,{type:"pending",variables:t,isPaused:s}),E(this,Ke).config.onMutate&&await E(this,Ke).config.onMutate(t,this,r);const L=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,t,r));L!==this.state.context&&be(this,Et,qt).call(this,{type:"pending",context:L,variables:t,isPaused:s})}const P=await E(this,Nn).start();return await((d=(l=E(this,Ke).config).onSuccess)==null?void 0:d.call(l,P,t,this.state.context,this,r)),await((f=(u=this.options).onSuccess)==null?void 0:f.call(u,P,t,this.state.context,r)),await((p=(m=E(this,Ke).config).onSettled)==null?void 0:p.call(m,P,null,this.state.variables,this.state.context,this,r)),await((h=(b=this.options).onSettled)==null?void 0:h.call(b,P,null,t,this.state.context,r)),be(this,Et,qt).call(this,{type:"success",data:P}),P}catch(P){try{await((y=(g=E(this,Ke).config).onError)==null?void 0:y.call(g,P,t,this.state.context,this,r))}catch(L){Promise.reject(L)}try{await((_=(v=this.options).onError)==null?void 0:_.call(v,P,t,this.state.context,r))}catch(L){Promise.reject(L)}try{await((T=(x=E(this,Ke).config).onSettled)==null?void 0:T.call(x,void 0,P,this.state.variables,this.state.context,this,r))}catch(L){Promise.reject(L)}try{await((O=(C=this.options).onSettled)==null?void 0:O.call(C,void 0,P,t,this.state.context,r))}catch(L){Promise.reject(L)}throw be(this,Et,qt).call(this,{type:"error",error:P}),P}finally{E(this,Ke).runNext(this)}}},di=new WeakMap,Pt=new WeakMap,Ke=new WeakMap,Nn=new WeakMap,Et=new WeakSet,qt=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Be.batch(()=>{E(this,Pt).forEach(r=>{r.onMutationUpdate(t)}),E(this,Ke).notify({mutation:this,type:"updated",action:t})})},Tu);function pT(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var It,gt,ui,Cu,mT=(Cu=class extends wi{constructor(t={}){super();oe(this,It);oe(this,gt);oe(this,ui);this.config=t,Y(this,It,new Set),Y(this,gt,new Map),Y(this,ui,0)}build(t,n,r){const i=new fT({client:t,mutationCache:this,mutationId:++Ei(this,ui)._,options:t.defaultMutationOptions(n),state:r});return this.add(i),i}add(t){E(this,It).add(t);const n=Bi(t);if(typeof n=="string"){const r=E(this,gt).get(n);r?r.push(t):E(this,gt).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(E(this,It).delete(t)){const n=Bi(t);if(typeof n=="string"){const r=E(this,gt).get(n);if(r)if(r.length>1){const i=r.indexOf(t);i!==-1&&r.splice(i,1)}else r[0]===t&&E(this,gt).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=Bi(t);if(typeof n=="string"){const r=E(this,gt).get(n),i=r==null?void 0:r.find(s=>s.state.status==="pending");return!i||i===t}else return!0}runNext(t){var r;const n=Bi(t);if(typeof n=="string"){const i=(r=E(this,gt).get(n))==null?void 0:r.find(s=>s!==t&&s.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Be.batch(()=>{E(this,It).forEach(t=>{this.notify({type:"removed",mutation:t})}),E(this,It).clear(),E(this,gt).clear()})}getAll(){return Array.from(E(this,It))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Pd(n,r))}findAll(t={}){return this.getAll().filter(n=>Pd(t,n))}notify(t){Be.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Be.batch(()=>Promise.all(t.map(n=>n.continue().catch(Ze))))}},It=new WeakMap,gt=new WeakMap,ui=new WeakMap,Cu);function Bi(e){var t;return(t=e.options.scope)==null?void 0:t.id}var kt,Pu,hT=(Pu=class extends wi{constructor(t={}){super();oe(this,kt);this.config=t,Y(this,kt,new Map)}build(t,n,r){const i=n.queryKey,s=n.queryHash??Mc(i,n);let o=this.get(s);return o||(o=new cT({client:t,queryKey:i,queryHash:s,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(i)}),this.add(o)),o}add(t){E(this,kt).has(t.queryHash)||(E(this,kt).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=E(this,kt).get(t.queryHash);n&&(t.destroy(),n===t&&E(this,kt).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Be.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return E(this,kt).get(t)}getAll(){return[...E(this,kt).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Cd(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Cd(t,r)):n}notify(t){Be.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Be.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Be.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},kt=new WeakMap,Pu),De,nn,rn,fr,pr,sn,mr,hr,Eu,gT=(Eu=class{constructor(e={}){oe(this,De);oe(this,nn);oe(this,rn);oe(this,fr);oe(this,pr);oe(this,sn);oe(this,mr);oe(this,hr);Y(this,De,e.queryCache||new hT),Y(this,nn,e.mutationCache||new mT),Y(this,rn,e.defaultOptions||{}),Y(this,fr,new Map),Y(this,pr,new Map),Y(this,sn,0)}mount(){Ei(this,sn)._++,E(this,sn)===1&&(Y(this,mr,jc.subscribe(async e=>{e&&(await this.resumePausedMutations(),E(this,De).onFocus())})),Y(this,hr,_s.subscribe(async e=>{e&&(await this.resumePausedMutations(),E(this,De).onOnline())})))}unmount(){var e,t;Ei(this,sn)._--,E(this,sn)===0&&((e=E(this,mr))==null||e.call(this),Y(this,mr,void 0),(t=E(this,hr))==null||t.call(this),Y(this,hr,void 0))}isFetching(e){return E(this,De).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return E(this,nn).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=E(this,De).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=E(this,De).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(cn(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return E(this,De).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),i=E(this,De).get(r.queryHash),s=i==null?void 0:i.state.data,o=YS(t,s);if(o!==void 0)return E(this,De).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return Be.batch(()=>E(this,De).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=E(this,De).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=E(this,De);Be.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=E(this,De);return Be.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Be.batch(()=>E(this,De).findAll(e).map(i=>i.cancel(n)));return Promise.all(r).then(Ze).catch(Ze)}invalidateQueries(e,t={}){return Be.batch(()=>(E(this,De).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=Be.batch(()=>E(this,De).findAll(e).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let s=i.fetch(void 0,n);return n.throwOnError||(s=s.catch(Ze)),i.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(Ze)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=E(this,De).build(this,t);return n.isStaleByTime(cn(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Ze).catch(Ze)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ze).catch(Ze)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return _s.isOnline()?E(this,nn).resumePausedMutations():Promise.resolve()}getQueryCache(){return E(this,De)}getMutationCache(){return E(this,nn)}getDefaultOptions(){return E(this,rn)}setDefaultOptions(e){Y(this,rn,e)}setQueryDefaults(e,t){E(this,fr).set(ni(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...E(this,fr).values()],n={};return t.forEach(r=>{ri(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){E(this,pr).set(ni(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...E(this,pr).values()],n={};return t.forEach(r=>{ri(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...E(this,rn).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Mc(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===xs&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...E(this,rn).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){E(this,De).clear(),E(this,nn).clear()}},De=new WeakMap,nn=new WeakMap,rn=new WeakMap,fr=new WeakMap,pr=new WeakMap,sn=new WeakMap,mr=new WeakMap,hr=new WeakMap,Eu),vm=w.createContext(void 0),xi=e=>{const t=w.useContext(vm);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},yT=({client:e,children:t})=>(w.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),c.jsx(vm.Provider,{value:e,children:t})),wm=w.createContext(!1),bT=()=>w.useContext(wm);wm.Provider;function vT(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var wT=w.createContext(vT()),xT=()=>w.useContext(wT),_T=(e,t,n)=>{const r=n!=null&&n.state.error&&typeof e.throwOnError=="function"?fm(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},ST=e=>{w.useEffect(()=>{e.clearReset()},[e])},TT=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||fm(n,[e.error,r])),CT=e=>{if(e.suspense){const n=i=>i==="static"?i:Math.max(i??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...i)=>n(r(...i)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},PT=(e,t)=>e.isLoading&&e.isFetching&&!t,ET=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Dd=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function kT(e,t,n){var p,b,h,g;if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const r=bT(),i=xT(),s=xi(),o=s.defaultQueryOptions(e);(b=(p=s.getDefaultOptions().queries)==null?void 0:p._experimental_beforeQuery)==null||b.call(p,o);const a=s.getQueryCache().get(o.queryHash);process.env.NODE_ENV!=="production"&&(o.queryFn||console.error(`[${o.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`));const l=e.subscribed!==!1;o._optimisticResults=r?"isRestoring":l?"optimistic":void 0,CT(o),_T(o,i,a),ST(i);const d=!s.getQueryCache().get(o.queryHash),[u]=w.useState(()=>new t(s,o)),f=u.getOptimisticResult(o),m=!r&&l;if(w.useSyncExternalStore(w.useCallback(y=>{const v=m?u.subscribe(Be.batchCalls(y)):Ze;return u.updateResult(),v},[u,m]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),w.useEffect(()=>{u.setOptions(o)},[o,u]),ET(o,f))throw Dd(o,u,i);if(TT({result:f,errorResetBoundary:i,throwOnError:o.throwOnError,query:a,suspense:o.suspense}))throw f.error;if((g=(h=s.getDefaultOptions().queries)==null?void 0:h._experimental_afterQuery)==null||g.call(h,o,f),o.experimental_prefetchInRender&&!ii.isServer()&&PT(f,r)){const y=d?Dd(o,u,i):a==null?void 0:a.promise;y==null||y.catch(Ze).finally(()=>{u.updateResult()})}return o.notifyOnChangeProps?f:u.trackResult(f)}function Lr(e,t){return kT(e,lT)}function AT(e,t){const n=xi(),r=n.getQueryCache();return w.useSyncExternalStore(w.useCallback(i=>r.subscribe(Be.batchCalls(i)),[r]),()=>n.isFetching(e),()=>n.isFetching(e))}const xm=S.createContext(null);function OT(e){return typeof window>"u"?e??null:e?(localStorage.setItem(Jp,e),e):null}function NT({token:e,children:t}){const n=OT(e);return c.jsx(xm.Provider,{value:n,children:t})}function RT(){return S.useContext(xm)}const Fc="widget-accounts",Uc="widget-positions",Bc="widget-orders",_i="widget-deals",Si="widget-deals-total",LT=2e4,DT=3e4;function es(e){const t=String(e.getUTCDate()).padStart(2,"0"),n=String(e.getUTCMonth()+1).padStart(2,"0"),r=String(e.getUTCHours()).padStart(2,"0"),i=String(e.getUTCMinutes()).padStart(2,"0"),s=String(e.getUTCSeconds()).padStart(2,"0");return`${n}.${t} ${r}:${i}:${s}`}function _m(e){const t=["seconds","Seconds","timestamp","Timestamp","value","Value","time","Time"];for(const n of t)if(e[n]!==void 0&&e[n]!==null&&e[n]!=="")return e[n]}function Wc(e){if(e==null||e==="")return 0;if(typeof e=="number"&&Number.isFinite(e))return e>1e12?e:e*1e3;if(typeof e=="string"){const t=e.trim();if(!t)return 0;if(/^\d+$/.test(t)){const r=Number(t);if(Number.isFinite(r))return r>1e12?r:r*1e3}const n=Date.parse(t);if(Number.isFinite(n))return n}if(typeof e=="object"&&e!==null){const n=_m(e);if(n!==void 0)return Wc(n)}return 0}function $c(e){if(e==null||e==="")return"—";if(typeof e=="number"&&Number.isFinite(e)){const t=e>1e12?e:e*1e3;return es(new Date(t))}if(typeof e=="string"){const t=e.trim();if(!t)return"—";if(/^\d+$/.test(t)){const r=Number(t);if(Number.isFinite(r)){const i=r>1e12?r:r*1e3;return es(new Date(i))}}const n=Date.parse(t);return Number.isFinite(n)?es(new Date(n)):t}if(typeof e=="object"&&e!==null){const n=_m(e);if(n!==void 0)return $c(n)}return"—"}const Sm=["time","Time","openTime","open_time","OpenTime","TimeOpen","timeOpen","timeCreate","TimeCreate","timeSetup","TimeSetup","setupTime","setup_time","createdAt","created_at","createTime","CreateTime","timestamp","Timestamp","openDate","OpenDate","date","Date"];function jT(e){return es(e)}const MT={0:"buy",1:"sell",2:"buy limit",3:"sell limit",4:"buy stop",5:"sell stop",6:"buy stop limit",7:"sell stop limit"};function to(e,t){for(const n of t)if(e[n]!==void 0&&e[n]!==null&&e[n]!=="")return e[n]}function at(e,t){const n=to(e,t);if(n===void 0)return;const r=Number(n);return Number.isFinite(r)?r:void 0}function Wi(e,t){const n=to(e,t);if(n!==void 0)return String(n)}function IT(e){if(Array.isArray(e))return e.filter(r=>typeof r=="object"&&r!==null);if(!e||typeof e!="object")return[];const t=e,n=["data","body","result"];for(const r of n){const i=t[r];if(Array.isArray(i))return i.filter(s=>typeof s=="object"&&s!==null);if(i&&typeof i=="object"){const s=i,o=["list","items","records","orders","content","data"];for(const a of o){const l=s[a];if(Array.isArray(l))return l.filter(d=>typeof d=="object"&&d!==null)}}}return[]}function _a(e){return e===void 0?.01:e>=100?e/1e4:e}function FT(e,t){return mp(t,e)}function UT(e){const t=to(e,["type","Type","orderType","OrderType"]);if(typeof t=="string"){const r=t.toLowerCase().trim();if(r)return{label:r,side:r.includes("sell")?"sell":"buy",typeNum:r.includes("sell")?3:2}}const n=at(e,["type","Type","orderType","OrderType"])??2;return{label:MT[n]??(n%2===1?"sell":"buy"),side:gs(n),typeNum:n}}function BT(e,t){const n=at(e,["volumeFilled","volume_filled","VolumeFilled","filledVolume","FilledVolume"]);if(n!==void 0)return _a(n);const r=at(e,["volumeCurrent","volume_current","VolumeCurrent"]);return r!==void 0?_a(r):0}function WT(e,t){const n=Wi(e,["ticket","Ticket","order","Order","id","ID"]),r=Wi(e,["symbol","Symbol"])??"";if(!n||!r)return null;const i=$e(r),{label:s,side:o,typeNum:a}=UT(e),l=at(e,["typeTime","TypeTime"])??0,d=_a(at(e,["volumeLots","volume_lots","VolumeLots","volume","Volume"])),u=BT(e),f=at(e,["priceOrder","price_order","PriceOrder","openPrice","open_price","price","Price"])??0,m=at(e,["priceTrigger","price_trigger","PriceTrigger","triggerPrice","TriggerPrice"]),p=at(e,["currentPrice","current_price","PriceCurrent","priceCurrent","marketPrice","MarketPrice"])??f,b=at(e,["stopLoss","stop_loss","PriceSL","sl","SL"]),h=at(e,["takeProfit","take_profit","PriceTP","tp","TP"]),g=at(e,["marketBid","MarketBid","bid","Bid"])??p,y=at(e,["marketAsk","MarketAsk","ask","Ask"])??p,v=Wi(e,["comment","Comment"])??"",_=FT(e,i),x=to(e,Sm),T=Wc(x),C=$c(x);return{ticket:n,login:Wi(e,["login","Login"])??t,symbol:i,displaySymbol:Ks(i),openTimeMs:T,time:C,typeLabel:s,orderType:a,typeTime:l,side:o,volumeLots:d,volumeFilledLots:u,orderPrice:f,priceTrigger:m,stopLoss:b,takeProfit:h,currentPrice:p,marketBid:g,marketAsk:y,comment:v,digits:_}}function $T(e,t){return IT(e).map(n=>WT(n,t)).filter(n=>n!==null)}function no(e,t){for(const n of t)if(e[n]!==void 0&&e[n]!==null&&e[n]!=="")return e[n]}function Qt(e,t){const n=no(e,t);if(n===void 0)return;const r=Number(n);return Number.isFinite(r)?r:void 0}function $i(e,t){const n=no(e,t);if(n!==void 0)return String(n)}function VT(e){if(Array.isArray(e))return e.filter(r=>typeof r=="object"&&r!==null);if(!e||typeof e!="object")return[];const t=e,n=["data","body","result"];for(const r of n){const i=t[r];if(Array.isArray(i))return i.filter(s=>typeof s=="object"&&s!==null);if(i&&typeof i=="object"){const s=i,o=["list","items","records","positions","orders","content","data"];for(const a of o){const l=s[a];if(Array.isArray(l))return l.filter(d=>typeof d=="object"&&d!==null)}}}return[]}function HT(e){return e===void 0?.01:e>=100?e/1e4:e}function zT(e){const t=no(e,["type","Type","action","Action","side","Side"]);if(typeof t=="string"){const r=t.toLowerCase();if(r.includes("sell"))return"sell";if(r.includes("buy"))return"buy"}const n=Qt(e,["type","Type","action","Action"]);return n!==void 0&&n%2===1?"sell":"buy"}function KT(e,t){return mp(t,e)}function GT(e,t){const n=$i(e,["ticket","Ticket","position","Position","order","Order","id","ID"]),r=$i(e,["symbol","Symbol"])??"";if(!n||!r)return null;const i=$e(r),s=zT(e),o=HT(Qt(e,["volumeLots","volume_lots","VolumeLots","volume","Volume"])),a=Qt(e,["openPrice","open_price","PriceOpen","priceOpen","price","Price"])??0,l=Qt(e,["currentPrice","current_price","PriceCurrent","priceCurrent"])??a,d=Qt(e,["stopLoss","stop_loss","PriceSL","sl","SL"]),u=Qt(e,["takeProfit","take_profit","PriceTP","tp","TP"]),f=Qt(e,["profit","Profit","floating","Floating","pnl","PnL"])??0,m=Qt(e,["swap","Swap"])??0,p=$i(e,["comment","Comment"])??"",b=KT(e,i),h=no(e,Sm),g=$c(h),y=Wc(h),v=Ow(s,a,l,f);return{ticket:n,login:$i(e,["login","Login"])??t,symbol:i,displaySymbol:Ks(i),openTimeMs:y,time:g,type:s,volumeLots:o,openPrice:a,stopLoss:d,takeProfit:u,currentPrice:l,marketBid:l,marketAsk:l,swap:m,profit:f,profitPerPriceUnit:v,comment:p,digits:b}}function qT(e,t){return VT(e).map(n=>GT(n,t)).filter(n=>n!==null)}function Ti(){return Wt}function Tm(){const e=ut(),t=RT(),{data:n,isLoading:r,isError:i}=Lr({queryKey:[Fc,e.baseUrl,t],queryFn:()=>e.getAccounts(),enabled:!!t,refetchInterval:DT});return{accounts:n??[],isLoading:r,isError:i}}function QT(e){const t=ut();return Lr({queryKey:[Uc,t.baseUrl,e],queryFn:()=>t.dealer.getPositions(e),enabled:!!e,refetchInterval:LT})}function YT(e){const t=ut();return Lr({queryKey:[Bc,t.baseUrl,e],queryFn:()=>t.dealer.getOrders(e),enabled:!!e})}function ZT(e,t){e.invalidateQueries({queryKey:[Fc,t]})}function XT(e,t,n){e.invalidateQueries({queryKey:[Si,t,n]}),e.invalidateQueries({queryKey:[_i,t,n]})}function JT(){const e=xi(),t=ut();return S.useCallback(async n=>{await Promise.all([e.invalidateQueries({queryKey:[Si,t.baseUrl,n]}),e.invalidateQueries({queryKey:[_i,t.baseUrl,n]})])},[t.baseUrl,e])}function eC(){const e=xi(),t=ut();return S.useCallback(async n=>{await Promise.all([e.invalidateQueries({queryKey:[Fc,t.baseUrl]}),e.invalidateQueries({queryKey:[Uc,t.baseUrl,n]}),e.invalidateQueries({queryKey:[Bc,t.baseUrl,n]}),e.invalidateQueries({queryKey:[Si,t.baseUrl,n]}),e.invalidateQueries({queryKey:[_i,t.baseUrl,n]})])},[t.baseUrl,e])}function tC(){const e=xi(),t=ut();return S.useCallback((n,r,i)=>{ZT(e,t.baseUrl),e.invalidateQueries({queryKey:[Uc,t.baseUrl,n]}),(r===void 0||wc(r))&&e.invalidateQueries({queryKey:[Bc,t.baseUrl,n]}),(i==null?void 0:i.invalidateDeals)!==!1&&XT(e,t.baseUrl,n)},[t.baseUrl,e])}function ro(){const e=ut(),t=tC();return{async submitOrder(n){const r=await e.trading.submitOrder(n);return r.success&&t(n.login,n.orderType),r},async closePosition(n,r){const i=await e.trading.closePosition(n);return i.success&&!(r!=null&&r.skipInvalidation)&&t(n.login),i},async deleteOrder(n){const r=await e.trading.deleteOrder(n);return r.success&&t(n.login,n.orderType),r},async modifyOrder(n,r){const i=await e.trading.modifyOrder(n,r);return i.success&&t(n.login,n.orderType),i},async modifyPosition(n,r){const i=await e.trading.modifyPosition(n,r);return i.success&&t(n.login),i}}}function nC(e){if(e===null||typeof e!="object")return{deals:[],offset:0,count:0};const t=e,n=t.data??t,i=(Array.isArray(n.deals)?n.deals:[]).map(s=>{const o=s??{};return{deal:Number(o.Deal??0),login:Number(o.Login??0),symbol:String(o.Symbol??""),action:Number(o.Action??0),volume:Number(o.Volume??0),price:Number(o.Price??0),profit:Number(o.Profit??0),time:Number(o.Time??0),entry:Number(o.Entry??0),comment:String(o.Comment??"")}});return{deals:i,offset:Number(n.offset??0),count:Number(n.count??i.length)}}function rC(e){if(e===null||typeof e!="object")return{total:0};const t=e,n=t.data??t;return{total:Number(n.total??0)}}function iC(e,t,n,r={}){const i=ut();return Lr({queryKey:[Si,i.baseUrl,e,t,n],queryFn:async()=>{const s=await i.dealer.getDealsTotal(e,t,n);return rC(s)},enabled:r.enabled??!0})}function sC(e,t,n,r,i,s={}){const o=ut();return Lr({queryKey:[_i,o.baseUrl,e,t,n,r,i],queryFn:async()=>{const a=await o.dealer.getDeals(e,t,n,r,i);return nC(a)},enabled:s.enabled??!0})}function oC(e,t){return e!=null?qT(e,t):[]}function aC(e,t){return e!=null?$T(e,t):[]}function cC({symbolTicker:e,controlsRef:t,chartWidget:n,sidePanelTab:r,orderState:i,backUrl:s,createAccountUrl:o}){const{openMarketPanel:a,setSelectedLogin:l,hasConfirmedAccount:d}=i,u=Ti();return S.useEffect(()=>(t.current={open:a,setSelectedLogin:l},()=>{t.current=null}),[t,a,l]),c.jsxs(c.Fragment,{children:[d?c.jsx(lm,{chartWidget:n,symbolTicker:e,symbols:u}):null,d?c.jsx(rm,{}):null,c.jsx(OS,{symbolTicker:e,symbols:u,sidePanelTab:r,orderState:i,backUrl:s,createAccountUrl:o})]})}const lC=8,jd=11;function dC({wide:e}){return c.jsx("td",{className:"web-trading-widget-terminal__cell",children:c.jsx("div",{className:`web-trading-widget-terminal__skeleton-bar${e?" web-trading-widget-terminal__skeleton-bar--wide":""}`})})}function uC(){return c.jsx(c.Fragment,{children:Array.from({length:lC},(e,t)=>c.jsx("tr",{className:"web-trading-widget-terminal__skeleton-row",children:Array.from({length:jd},(n,r)=>c.jsx(dC,{wide:r===jd-1},r))},t))})}const fC="web-trading-widget-text-buy",pC="web-trading-widget-text-sell",mC="web-trading-widget-terminal__head-row",jo=50;function hC(e){return e===0?fC:e===1?pC:mC}const Md=e=>e.toISOString().split("T")[0],Cm=e=>Math.floor(new Date(e).getTime()/1e3),gC=e=>Cm(e),yC=e=>Cm(e)+86399;function bC(){const e=new Date,t=new Date;return t.setDate(t.getDate()-7),{fromTs:gC(Md(t)),toTs:yC(Md(e))}}const vC=10800,wC=e=>new Date((e-vC)*1e3).toLocaleString(void 0,{year:"numeric",month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!0});function xC(e){try{return decodeURIComponent(e)}catch{return e}}function _C(e,t){return`${e.replace(/\/$/,"")}/${encodeURIComponent(t)}`}function SC(){return c.jsxs("colgroup",{children:[c.jsx("col",{className:"web-trading-widget-terminal-col--deal"}),c.jsx("col",{className:"web-trading-widget-terminal-col--ticket"}),c.jsx("col",{className:"web-trading-widget-terminal-col--symbol"}),c.jsx("col",{className:"web-trading-widget-terminal-col--type"}),c.jsx("col",{className:"web-trading-widget-terminal-col--volume"}),c.jsx("col",{className:"web-trading-widget-terminal-col--price"}),c.jsx("col",{className:"web-trading-widget-terminal-col--profit"}),c.jsx("col",{className:"web-trading-widget-terminal-col--entry"}),c.jsx("col",{className:"web-trading-widget-terminal-col--time"}),c.jsx("col",{className:"web-trading-widget-terminal-col--local-time"}),c.jsx("col",{})]})}function TC(){const{t:e}=Le();return c.jsx("thead",{children:c.jsxs("tr",{className:"web-trading-widget-terminal__head-row",children:[c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:e("WebTrading.deal")}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:e("WebTrading.login")}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:e("WebTrading.symbol")}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:e("WebTrading.action")}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:e("WebTrading.volume")}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:e("WebTrading.price")}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:e("WebTrading.profit")}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:e("WebTrading.entry")}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:e("WebTrading.time")}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:e("WebTrading.localTime")}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:e("WebTrading.comment")})]})})}function CC({deal:e,dealActions:t}){const{t:n}=Le(),r=e.profit>0?"web-trading-widget-text-profit-positive":e.profit<0?"web-trading-widget-text-profit-negative":"";return c.jsxs("tr",{className:"web-trading-widget-terminal__deals-row",children:[c.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.deal}),c.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.login}),c.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.symbol||"—"}),c.jsx("td",{className:`web-trading-widget-terminal__cell web-trading-widget-terminal__cell--capitalize ${hC(e.action)}`,children:t[e.action]??n("WebTrading.unknownAction",{action:e.action})}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:(e.volume/1e4).toFixed(2)}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.price.toFixed(5)}),c.jsxs("td",{className:`web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right ${r}`,children:[e.profit>0?"+":"",e.profit.toFixed(2)]}),c.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.entry===1?n("WebTrading.entryOut"):n("WebTrading.entryIn")}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--nowrap",children:jT(new Date(e.time*1e3))}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--nowrap",children:wC(e.time)}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--truncate",children:e.comment?xC(e.comment):"—"})]})}function PC({login:e,detailUrl:t}){const{t:n}=Le(),r=S.useMemo(()=>({0:n("WebTrading.buy"),1:n("WebTrading.sell"),2:n("WebTrading.balanceType"),3:n("WebTrading.credit"),5:"-"}),[n]),{fromTs:i,toTs:s}=S.useMemo(()=>bC(),[]),o=e!=="",{data:a,isLoading:l}=iC(e,i,s,{enabled:o}),d=(a==null?void 0:a.total)??0,u=Math.max(0,d-jo),f=d>0?Math.min(jo,d):jo,{data:m,isLoading:p}=sC(e,i,s,u,f,{enabled:o}),b=o&&(l||p),h=S.useMemo(()=>[...(m==null?void 0:m.deals)??[]].sort((g,y)=>y.time-g.time),[m==null?void 0:m.deals]);return e?c.jsx("div",{className:"web-trading-widget-terminal__deals-wrap",children:c.jsxs("div",{className:"web-trading-widget-terminal__body-scroll",children:[c.jsxs("table",{className:"web-trading-widget-terminal__deals-table",children:[c.jsx(SC,{}),c.jsx(TC,{}),c.jsxs("tbody",{children:[b?c.jsx(uC,{}):null,!b&&h.length===0?c.jsx("tr",{children:c.jsx("td",{colSpan:11,className:"web-trading-widget-terminal__empty-cell",children:n("WebTrading.noDealsFound")})}):null,b?null:h.map(g=>c.jsx(CC,{deal:g,dealActions:r},g.deal))]})]}),t?c.jsx("div",{className:"web-trading-widget-terminal__deals-footer",children:c.jsx("a",{href:_C(t,e),className:"web-trading-widget-terminal__deals-detail-btn",children:n("WebTrading.seeFullDealHistory")})}):null]})}):c.jsx("div",{className:"web-trading-widget-terminal__empty-cell",children:n("WebTrading.selectAccountForDeals")})}function Pm(e,t=!0){const n=t&&e.trim()?e.trim():"",r=pe(f=>f.setPositions),i=pe(f=>f.setOrders),{data:s,isLoading:o,isError:a}=QT(n),{data:l,isLoading:d,isError:u}=YT(n);return S.useEffect(()=>{if(!n){r([]),i([]);return}s!=null&&r(oC(s,n)),l!=null&&i(aC(l,n))},[n,l,s,i,r]),{isLoading:t&&(o||d),isError:t&&!!(a||u)}}const Id=224,Fd=32,Vc=120;function Em(){return typeof window>"u"?560:Math.max(Vc,Math.floor(window.innerHeight*.7))}function EC(e){return Math.min(Em(),Math.max(Vc,e))}function kC(){const[e,t]=S.useState(Id),[n,r]=S.useState(!1),i=S.useRef(Id);S.useEffect(()=>{i.current=e},[e]);const s=S.useCallback(u=>{t(EC(u))},[]),o=S.useCallback(()=>{s(i.current+Fd)},[s]),a=S.useCallback(()=>{s(i.current-Fd)},[s]),l=S.useCallback(u=>{const f=u,m=i.current;r(!0);const p=h=>{const g=f-h.clientY;s(m+g)},b=()=>{r(!1),document.removeEventListener("mousemove",p),document.removeEventListener("mouseup",b),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",p),document.addEventListener("mouseup",b),document.body.style.cursor="row-resize",document.body.style.userSelect="none"},[s]);S.useEffect(()=>{const u=()=>{s(i.current)};return window.addEventListener("resize",u),()=>{window.removeEventListener("resize",u),document.body.style.cursor="",document.body.style.userSelect=""}},[s]);const d=Em();return{height:e,isResizing:n,canIncrement:e<d,canDecrement:e>Vc,onResizeStart:l,incrementHeight:o,decrementHeight:a}}const AC=e=>e==null?void 0:e.replace(/(\d+)\.0{18}/g,"$1"),OC=2e4;let Mo=0;function NC(){return Mo=(Mo+1)%Number.MAX_VALUE,Mo.toString()}const Io=new Map,Ud=(e,t)=>{if(Io.has(e))return;const n=setTimeout(()=>{Io.delete(e),Qr({type:"REMOVE_TOAST",toastId:e})},t||OC);Io.set(e,n)},RC=(e,t)=>{var n;switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,((n=t==null?void 0:t.toast)==null?void 0:n.limit)??1)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(r=>r.id===t.toast.id?{...r,...t.toast}:r)};case"DISMISS_TOAST":{const{toastId:r}=t;if(r){const i=e.toasts.find(s=>s.id===r);Ud(r,i==null?void 0:i.duration)}else e.toasts.forEach(i=>{Ud(i.id,i.duration)});return{...e,toasts:e.toasts.map(i=>i.id===r||r===void 0?{...i,open:!1}:i)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(r=>r.id!==t.toastId)}}},ts=[];let ns={toasts:[]};function Qr(e){ns=RC(ns,e),ts.forEach(t=>{t(ns)})}function Pe({duration:e=2e4,description:t,...n}){const r=NC(),i=typeof t=="string"?AC(t):t,s=a=>Qr({type:"UPDATE_TOAST",toast:{...a,description:i,id:r}}),o=()=>{Qr({type:"DISMISS_TOAST",toastId:r})};return Qr({type:"ADD_TOAST",toast:{...n,description:i,id:r,open:!0,duration:e,onOpenChange:a=>{a||o()}}}),e&&setTimeout(o,e),{id:r,dismiss:o,update:s}}function LC(){const[e,t]=w.useState(ns);return w.useEffect(()=>(ts.push(t),()=>{const n=ts.indexOf(t);n>-1&&ts.splice(n,1)}),[e]),{...e,toast:Pe,dismiss:n=>Qr({type:"DISMISS_TOAST",toastId:n})}}function DC(e){return e.type==="buy"?e.marketBid??e.currentPrice:e.marketAsk??e.currentPrice}function jC(){const{t:e}=Le(),{closePosition:t,deleteOrder:n}=ro(),r=eC(),i=pe(y=>y.removePosition),s=pe(y=>y.removeOrder),o=pe(y=>y.setSelectedPositionTicket),a=pe(y=>y.setSelectedOrderTicket),[l,d]=S.useState(new Set),[u,f]=S.useState(!1),m=S.useCallback((y,v)=>{d(_=>{const x=new Set(_);return v?x.add(y):x.delete(y),x})},[]),p=S.useCallback(y=>l.has(y),[l]),b=S.useCallback(async y=>{const v=`position-${y.ticket}`;m(v,!0);try{const _=await t(y);if(!_.success){Pe({variant:"destructive",description:_.message||e("WebTrading.failedClosePosition")});return}i(y.ticket),o(null),Pe({description:e("WebTrading.positionClosed",{ticket:y.ticket,price:DC(y).toFixed(y.digits)})})}catch(_){const x=_ instanceof Error?_.message:e("WebTrading.failedClosePosition");Pe({variant:"destructive",description:x})}finally{m(v,!1)}},[t,i,m,o,e]),h=S.useCallback(async y=>{var T;if(y.length===0||u)return;if(!t){Pe({variant:"destructive",description:e("WebTrading.closePositionNotConfigured")});return}f(!0);let v=0,_=0;const x=((T=y[0])==null?void 0:T.login)??"";for(const C of y){const O=`position-${C.ticket}`;m(O,!0);try{if(!(await t(C,{skipInvalidation:!0})).success){_+=1;continue}i(C.ticket),v+=1}catch{_+=1}finally{m(O,!1)}}o(null),v>0&&x&&await r(x),Pe(_===0?{description:v===1?e("WebTrading.onePositionClosed"):e("WebTrading.positionsClosed",{count:v})}:v===0?{variant:"destructive",description:e("WebTrading.failedClosePositions")}:{variant:"destructive",description:e("WebTrading.closedFailedSummary",{closed:v,failed:_})}),f(!1)},[u,t,r,i,m,o,e]),g=S.useCallback(async y=>{const v=`order-${y.ticket}`;m(v,!0);try{const _=await n(y);if(!_.success){Pe({variant:"destructive",description:_.message||e("WebTrading.failedDeleteOrder")});return}s(y.ticket),a(null),Pe({description:e("WebTrading.orderDeleted",{ticket:y.ticket})})}catch(_){const x=_ instanceof Error?_.message:e("WebTrading.failedDeleteOrder");Pe({variant:"destructive",description:x})}finally{m(v,!1)}},[n,s,m,a,e]);return{closePosition:b,closeAllPositions:h,deleteOrder:g,isClosingAll:u,isRowBusy:p}}function Yt(e,t=2){return e.toFixed(t)}function km(e){return e.reduce((t,n)=>t+n.profit+n.swap,0)}function MC(e,t,n){const r=(e==null?void 0:e.balance)??0,i=(e==null?void 0:e.credit)??0,s=(e==null?void 0:e.margin)??0;if(!e||t.length===0)return{balance:r,equity:(e==null?void 0:e.equity)??r+i,margin:s,marginFree:(e==null?void 0:e.marginFree)??0,marginLevel:e==null?void 0:e.marginLevel,totalProfit:0};const o=km(t),a=r+i+o+n,l=a-s,d=s>0?a/s*100:void 0;return{balance:r,equity:a,margin:s,marginFree:l,marginLevel:d,totalProfit:o}}function Sa(){return c.jsxs("colgroup",{children:[c.jsx("col",{className:"web-trading-widget-terminal-col--symbol"}),c.jsx("col",{className:"web-trading-widget-terminal-col--ticket"}),c.jsx("col",{className:"web-trading-widget-terminal-col--time"}),c.jsx("col",{className:"web-trading-widget-terminal-col--type"}),c.jsx("col",{className:"web-trading-widget-terminal-col--volume"}),c.jsx("col",{className:"web-trading-widget-terminal-col--price"}),c.jsx("col",{className:"web-trading-widget-terminal-col--sl"}),c.jsx("col",{className:"web-trading-widget-terminal-col--tp"}),c.jsx("col",{className:"web-trading-widget-terminal-col--price2"}),c.jsx("col",{className:"web-trading-widget-terminal-col--swap"}),c.jsx("col",{className:"web-trading-widget-terminal-col--profit"}),c.jsx("col",{}),c.jsx("col",{className:"web-trading-widget-terminal-col--close"})]})}function IC(){const{t:e}=Le();return c.jsx("thead",{children:c.jsxs("tr",{className:"web-trading-widget-terminal__head-row",children:[c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:e("WebTrading.symbol")}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:e("WebTrading.ticket")}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:e("WebTrading.serverTime")}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:e("WebTrading.type")}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:e("WebTrading.volume")}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:e("WebTrading.price")}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:e("WebTrading.stopLossShort")}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:e("WebTrading.takeProfitShort")}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:e("WebTrading.price")}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:e("WebTrading.swap")}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:e("WebTrading.profit")}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:e("WebTrading.comment")}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--close","aria-label":e("WebTrading.close")})]})})}function FC({balance:e,equity:t,margin:n,marginFree:r,marginLevel:i,totalPnL:s,scrollRef:o,onScroll:a}){const{t:l}=Le(),d=s>0?"web-trading-widget-text-profit-positive":s<0?"web-trading-widget-text-profit-negative":"";return c.jsx("div",{className:"web-trading-widget-terminal__stats",children:c.jsx("div",{ref:o,className:"web-trading-widget-terminal__header-scroll",onScroll:a,children:c.jsxs("table",{className:"web-trading-widget-terminal__table",children:[c.jsx(Sa,{}),c.jsx("tbody",{children:c.jsxs("tr",{children:[c.jsx("td",{colSpan:10,className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--nowrap",children:c.jsxs("div",{className:"web-trading-widget-terminal__stats-row web-trading-widget-terminal__stats-row--tabular",children:[c.jsxs("span",{children:[l("WebTrading.balance"),": ",Yt(e)]}),c.jsxs("span",{children:[l("WebTrading.equity"),": ",Yt(t)]}),c.jsxs("span",{children:[l("WebTrading.margin"),": ",Yt(n)]}),c.jsxs("span",{children:[l("WebTrading.freeMargin"),": ",Yt(r)]}),c.jsxs("span",{children:[l("WebTrading.level"),": ",i!==void 0?`${Yt(i,2)}%`:"0.00%"]})]})}),c.jsx("td",{className:`web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right ${d}`,children:Yt(s)}),c.jsx("td",{className:"web-trading-widget-terminal__cell"}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--close"})]})})]})})})}function UC({activeTab:e,onTabChange:t,positionCount:n,isClosingAll:r,onCloseAllPositions:i,isRefetchingDeals:s,onRefetchDeals:o}){const{t:a}=Le(),l=[{id:"trade",label:a("WebTrading.trade")},{id:"history",label:a("WebTrading.history")}],d=e==="trade"&&(n>0||r),u=e==="history";return c.jsxs("div",{role:"tablist","aria-label":a("WebTrading.terminalPanelTabs"),className:"web-trading-widget-terminal__tab-bar",children:[l.map(f=>{const m=e===f.id;return c.jsx("button",{type:"button",role:"tab","aria-selected":m,onClick:()=>t(f.id),className:`web-trading-widget-terminal__tab-btn${m?" web-trading-widget-terminal__tab-btn--active":""}`,children:f.label},f.id)}),c.jsxs("div",{className:"web-trading-widget-terminal__toolbar-actions",children:[d?c.jsx("button",{type:"button",disabled:r,onClick:i,className:"web-trading-widget-terminal__close-all-btn",children:a(r?"WebTrading.closing":"WebTrading.closeAll")}):null,u?c.jsxs("button",{type:"button",disabled:s,onClick:o,className:"web-trading-widget-terminal__refetch-btn","aria-label":a("WebTrading.refreshDealHistory"),children:[c.jsx(Cw,{className:`web-trading-widget-icon web-trading-widget-icon--sm${s?" web-trading-widget-terminal__refetch-icon--spinning":""}`}),a(s?"WebTrading.refreshing":"WebTrading.refresh")]}):null]})]})}function BC({position:e,isSelected:t,isClosing:n,onSelect:r,onClose:i}){const{t:s}=Le(),o=e.type==="buy"?"web-trading-widget-text-buy":"web-trading-widget-text-sell",a=e.profit>0?"web-trading-widget-text-profit-positive":e.profit<0?"web-trading-widget-text-profit-negative":"";return c.jsxs("tr",{className:`web-trading-widget-terminal__row${t?" web-trading-widget-terminal__row--selected":""}`,onClick:r,children:[c.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.displaySymbol}),c.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.ticket}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--nowrap",children:e.time}),c.jsx("td",{className:`web-trading-widget-terminal__cell web-trading-widget-terminal__cell--capitalize ${o}`,children:e.type}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.volumeLots.toFixed(2)}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:Ce(e.openPrice,e.digits)}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.stopLoss!==void 0&&e.stopLoss!==0?Ce(e.stopLoss,e.digits):s("WebTrading.notAvailable")}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.takeProfit!==void 0&&e.takeProfit!==0?Ce(e.takeProfit,e.digits):s("WebTrading.notAvailable")}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:Ce(e.currentPrice,e.digits)}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.swap!==0?Yt(e.swap):""}),c.jsx("td",{className:`web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right ${a}`,children:Yt(e.profit)}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--truncate",children:e.comment}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--close",children:c.jsx("button",{type:"button","aria-label":s("WebTrading.closePositionTicket",{ticket:e.ticket}),title:s("WebTrading.closePosition"),disabled:n,className:"web-trading-widget-terminal__row-close-btn",onClick:l=>{l.stopPropagation(),i()},children:c.jsx(yn,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})})})]})}function WC({order:e,isSelected:t,isDeleting:n,onSelect:r,onDelete:i}){const{t:s}=Le(),o=e.side==="buy"?"web-trading-widget-text-buy":"web-trading-widget-text-sell";return c.jsxs("tr",{className:`web-trading-widget-terminal__row${t?" web-trading-widget-terminal__row--selected":""}`,onClick:r,children:[c.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.displaySymbol}),c.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.ticket}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--nowrap",children:e.time}),c.jsx("td",{className:`web-trading-widget-terminal__cell web-trading-widget-terminal__cell--capitalize ${o}`,children:e.typeLabel}),c.jsxs("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:[e.volumeLots.toFixed(2)," / ",e.volumeFilledLots.toFixed(2)]}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:Ce(e.orderPrice,e.digits)}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.stopLoss!==void 0&&e.stopLoss!==0?Ce(e.stopLoss,e.digits):s("WebTrading.notAvailable")}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.takeProfit!==void 0&&e.takeProfit!==0?Ce(e.takeProfit,e.digits):s("WebTrading.notAvailable")}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:Ce(e.currentPrice,e.digits)}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right"}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right"}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--truncate",children:e.comment}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--close",children:c.jsx("button",{type:"button","aria-label":s("WebTrading.deleteOrderTicket",{ticket:e.ticket}),title:s("WebTrading.deleteOrder"),disabled:n,className:"web-trading-widget-terminal__row-close-btn",onClick:a=>{a.stopPropagation(),i()},children:c.jsx(yn,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})})})]})}function Am({embedded:e=!1,symbolTicker:t="",onSymbolChange:n,onCreateNewOrder:r,dealDetailUrl:i,tradeDataEnabled:s=!1}){const{t:o}=Le(),[a,l]=S.useState("trade"),d=Ti(),{accounts:u,isLoading:f}=Tm(),m=kC(),{height:p,isResizing:b,onResizeStart:h}=e?{height:0,isResizing:!1,onResizeStart:()=>{}}:m,g=pe(K=>K.selectedLogin),y=pe(K=>K.selectedPositionTicket),v=pe(K=>K.selectedOrderTicket),_=pe(K=>K.setSelectedPositionTicket),x=pe(K=>K.setSelectedOrderTicket),{isLoading:T}=Pm(g,s),C=pe(K=>K.positions),O=pe(K=>K.orders),{closePosition:P,closeAllPositions:L,deleteOrder:I,isClosingAll:U,isRowBusy:N}=jC(),V=JT(),M=ut(),z=AT({predicate:K=>{const xe=K.queryKey;return g?(xe[0]===_i||xe[0]===Si)&&xe[1]===M.baseUrl&&xe[2]===g:!1}})>0,k=f||T,j=S.useMemo(()=>g?C.filter(K=>K.login===g):C,[C,g]),D=S.useMemo(()=>g?O.filter(K=>K.login===g):O,[O,g]),R=S.useMemo(()=>{const K=u.find(xe=>xe.login===g);return(K==null?void 0:K.tradeStat)??null},[u,g]),W=S.useMemo(()=>j.map(K=>K.ticket).sort().join("|"),[j]),F=S.useMemo(()=>R?`${R.balance}:${R.credit??0}:${R.equity}:${R.margin}|${W}`:"",[R,W]),G=S.useMemo(()=>{if(!R||j.length===0)return 0;const K=km(j);return R.equity-R.balance-(R.credit??0)-K},[F]),X=S.useMemo(()=>MC(R,j,G),[R,j,G]),de=j.length===0&&D.length===0,ne=S.useRef(null),B=S.useRef(null),$=S.useRef(null),Q=S.useCallback(()=>{L(j)},[L,j]),ye=S.useCallback(()=>{g&&V(g)},[V,g]),ce=S.useCallback(K=>{const xe=Uw(K,d);xe&&(n==null||n(xe))},[n,d]),ee=S.useCallback(K=>{_(K.ticket),ce(K.symbol)},[_,ce]),ae=S.useCallback(K=>{x(K.ticket),ce(K.symbol)},[x,ce]),ke=S.useCallback(K=>{const xe=ne.current,re=B.current,_e=$.current;if(!xe||!re)return;const Fe=K==="header"?xe.scrollLeft:K==="body"?re.scrollLeft:(_e==null?void 0:_e.scrollLeft)??0;K!=="header"&&(xe.scrollLeft=Fe),K!=="body"&&(re.scrollLeft=Fe),_e&&K!=="footer"&&(_e.scrollLeft=Fe)},[]);return c.jsxs(c.Fragment,{children:[!e&&b?c.jsx("div",{className:"web-trading-widget-terminal-resize-overlay","aria-hidden":!0}):null,c.jsxs("div",{className:`web-trading-widget-terminal${e?" web-trading-widget-terminal--embedded":""}`,style:e?void 0:{height:p},children:[e?null:c.jsx("div",{className:"web-trading-widget-terminal__resize-bar-wrap",children:c.jsx("div",{role:"separator","aria-orientation":"horizontal","aria-label":o("WebTrading.resizeTerminalPanel"),"aria-valuenow":p,className:"web-trading-widget-terminal__resize-bar",onMouseDown:K=>{K.preventDefault(),h(K.clientY)},children:c.jsx(fp,{className:"web-trading-widget-icon web-trading-widget-icon--sm web-trading-widget-terminal__resize-icon"})})}),c.jsx(UC,{activeTab:a,onTabChange:l,positionCount:j.length,isClosingAll:U,onCloseAllPositions:Q,isRefetchingDeals:z,onRefetchDeals:ye}),a==="trade"?c.jsxs(c.Fragment,{children:[c.jsx("div",{ref:ne,className:"web-trading-widget-terminal__header-scroll",onScroll:()=>ke("header"),children:c.jsxs("table",{className:"web-trading-widget-terminal__table",children:[c.jsx(Sa,{}),c.jsx(IC,{})]})}),c.jsx("div",{ref:B,className:"web-trading-widget-terminal__body-scroll",onScroll:()=>ke("body"),children:c.jsxs("table",{className:"web-trading-widget-terminal__table",children:[c.jsx(Sa,{}),c.jsxs("tbody",{children:[k&&de?c.jsx("tr",{children:c.jsx("td",{colSpan:13,className:"web-trading-widget-terminal__empty-cell",children:o("WebTrading.loading")})}):null,!k&&de?c.jsx("tr",{children:c.jsx("td",{colSpan:13,className:"web-trading-widget-terminal__empty-cell",children:c.jsxs("div",{className:"web-trading-widget-terminal__empty-inner",children:[c.jsx("p",{className:"web-trading-widget-terminal__empty-text",children:o("WebTrading.noPositions")}),r?c.jsx("button",{type:"button",onClick:r,className:"web-trading-widget-terminal__create-btn",children:o("WebTrading.createNewOrder")}):null]})})}):null,j.map(K=>c.jsx(BC,{position:K,isSelected:y===K.ticket,isClosing:N(`position-${K.ticket}`),onSelect:()=>ee(K),onClose:()=>void P(K)},`position-${K.ticket}`)),D.map(K=>c.jsx(WC,{order:K,isSelected:v===K.ticket,isDeleting:N(`order-${K.ticket}`),onSelect:()=>ae(K),onDelete:()=>void I(K)},`order-${K.ticket}`))]})]})})]}):c.jsx(PC,{login:g??"",detailUrl:i}),c.jsx(FC,{balance:X.balance,equity:X.equity,margin:X.margin,marginFree:X.marginFree,marginLevel:X.marginLevel,totalPnL:X.totalProfit,scrollRef:a==="trade"?$:void 0,onScroll:a==="trade"?()=>ke("footer"):void 0})]})]})}const Ta=224,Ss=120;function $C(e){var n;const t=(n=e==null?void 0:e.current)==null?void 0:n.clientHeight;return t&&t>0?Math.max(Ss,Math.floor(t*.35)):Ta}function VC(e){var n;const t=(n=e==null?void 0:e.current)==null?void 0:n.clientHeight;return t&&t>0?Math.max(Ss,Math.floor(t*.85)):typeof window>"u"?560:Math.max(Ss,Math.floor(window.innerHeight*.7))}function HC(e,t){return Math.min(VC(t),Math.max(Ss,e))}function zC({containerRef:e,isOpen:t=!1}={}){const[n,r]=S.useState(Ta),[i,s]=S.useState(!1),o=S.useRef(Ta);S.useEffect(()=>{o.current=n},[n]);const a=S.useCallback(d=>{r(HC(d,e))},[e]);S.useEffect(()=>{if(!t)return;const d=Math.max(o.current,$C(e));a(d)},[e,t,a]);const l=S.useCallback(d=>{const u=d,f=o.current;s(!0);const m=b=>{const h=u-b.clientY;a(f+h)},p=()=>{s(!1),document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",p),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",m),document.addEventListener("mouseup",p),document.body.style.cursor="row-resize",document.body.style.userSelect="none"},[a]);return S.useEffect(()=>{const d=()=>{a(o.current)};return window.addEventListener("resize",d),()=>{window.removeEventListener("resize",d),document.body.style.cursor="",document.body.style.userSelect=""}},[a]),{height:n,isResizing:i,onResizeStart:l}}function Om({children:e}){const[t]=S.useState(()=>new gT({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}}));return c.jsx(yT,{client:t,children:e})}function Nm({containerRef:e,onCreateNewOrder:t,tradeDataEnabled:n=!1}){const{t:r}=Le(),[i,s]=S.useState(!1),{height:o,isResizing:a,onResizeStart:l}=zC({containerRef:e,isOpen:i}),d=pe(g=>g.selectedLogin),u=pe(g=>g.orders),f=pe(g=>g.positions),m=S.useMemo(()=>d?u.filter(g=>g.login===d):u,[d,u]),p=S.useMemo(()=>d?f.filter(g=>g.login===d):f,[d,f]),b=m.length+p.length,h=()=>{s(!1),t==null||t()};return c.jsxs("div",{className:"web-trading-widget-news-orders-overlay-root",children:[c.jsxs("button",{type:"button",className:"web-trading-widget-news-orders-overlay__trigger","aria-label":r("WebTrading.openTerminal"),"aria-expanded":i,onClick:()=>s(!0),children:[c.jsx(xw,{className:"web-trading-widget-icon web-trading-widget-icon--sm"}),c.jsx("span",{children:r("WebTrading.orders")}),b>0?c.jsx("span",{className:"web-trading-widget-news-orders-overlay__badge",children:b}):null]}),i?c.jsx(c.Fragment,{children:c.jsxs("div",{className:"web-trading-widget-news-orders__panel",style:{height:o},children:[a?c.jsx("div",{className:"web-trading-widget-terminal-resize-overlay","aria-hidden":!0}):null,c.jsx("div",{className:"web-trading-widget-news-orders__panel-resize-bar-wrap",children:c.jsx("div",{role:"separator","aria-orientation":"horizontal","aria-label":r("WebTrading.resizeTerminalPanel"),"aria-valuenow":o,className:"web-trading-widget-terminal__resize-bar",onMouseDown:g=>{g.preventDefault(),l(g.clientY)},children:c.jsx(fp,{className:"web-trading-widget-icon web-trading-widget-icon--sm web-trading-widget-terminal__resize-icon"})})}),c.jsxs("div",{className:"web-trading-widget-news-orders__panel-header",children:[c.jsx("h2",{className:"web-trading-widget-news-orders__panel-title",children:r("WebTrading.terminal")}),c.jsx("button",{type:"button",className:"web-trading-widget-news-orders__panel-close","aria-label":r("WebTrading.closeTerminalPanel"),onClick:()=>s(!1),children:c.jsx(yn,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})})]}),c.jsx("div",{className:"web-trading-widget-news-orders__panel-body",children:c.jsx(Am,{embedded:!0,onCreateNewOrder:t?h:void 0,tradeDataEnabled:n})})]})}):null]})}function KC({baseUrl:e,language:t,containerRef:n,onCreateNewOrder:r}){const i=S.useMemo(()=>Ns(t),[t]);return c.jsx(Ou,{language:i,children:c.jsx(Om,{children:c.jsx(tm,{baseUrl:e,children:c.jsx(Nm,{containerRef:n,onCreateNewOrder:r})})})})}const Ln=S.forwardRef(({className:e,type:t,...n},r)=>c.jsx("input",{type:t,className:Ae("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-xs placeholder:text-gray-300 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 dark:border-gray-3",e),ref:r,...n}));Ln.displayName="Input";var io="Collapsible",[GC,Rm]=$n(io),[qC,Hc]=GC(io),Lm=w.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:s,onOpenChange:o,...a}=e,[l,d]=jn({prop:r,defaultProp:i??!1,onChange:o,caller:io});return c.jsx(qC,{scope:n,disabled:s,contentId:an(),open:l,onOpenToggle:w.useCallback(()=>d(u=>!u),[d]),children:c.jsx(ge.div,{"data-state":Kc(l),"data-disabled":s?"":void 0,...a,ref:t})})});Lm.displayName=io;var Dm="CollapsibleTrigger",jm=w.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,i=Hc(Dm,n);return c.jsx(ge.button,{type:"button","aria-controls":i.open?i.contentId:void 0,"aria-expanded":i.open||!1,"data-state":Kc(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...r,ref:t,onClick:he(e.onClick,i.onOpenToggle)})});jm.displayName=Dm;var zc="CollapsibleContent",Mm=w.forwardRef((e,t)=>{const{forceMount:n,...r}=e,i=Hc(zc,e.__scopeCollapsible);return c.jsx(Vn,{present:n||i.open,children:({present:s})=>c.jsx(QC,{...r,ref:t,present:s})})});Mm.displayName=zc;var QC=w.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:i,...s}=e,o=Hc(zc,n),[a,l]=w.useState(r),d=w.useRef(null),u=Ne(t,d),f=w.useRef(0),m=f.current,p=w.useRef(0),b=p.current,h=o.open||a,g=w.useRef(h),y=w.useRef(void 0);return w.useEffect(()=>{const v=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(v)},[]),Ie(()=>{const v=d.current;if(v){y.current=y.current||{transitionDuration:v.style.transitionDuration,animationName:v.style.animationName},v.style.transitionDuration="0s",v.style.animationName="none";const _=v.getBoundingClientRect();f.current=_.height,p.current=_.width,g.current||(v.style.transitionDuration=y.current.transitionDuration,v.style.animationName=y.current.animationName),l(r)}},[o.open,r]),c.jsx(ge.div,{"data-state":Kc(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!h,...s,ref:u,style:{"--radix-collapsible-content-height":m?`${m}px`:void 0,"--radix-collapsible-content-width":b?`${b}px`:void 0,...e.style},children:h&&i})});function Kc(e){return e?"open":"closed"}var YC=Lm,ZC=jm,XC=Mm,_t="Accordion",JC=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[Gc,e0,t0]=Za(_t),[so]=$n(_t,[t0,Rm]),qc=Rm(),Im=w.forwardRef((e,t)=>{const{type:n,...r}=e,i=r,s=r;return c.jsx(Gc.Provider,{scope:e.__scopeAccordion,children:n==="multiple"?c.jsx(s0,{...s,ref:t}):c.jsx(i0,{...i,ref:t})})});Im.displayName=_t;var[Fm,n0]=so(_t),[Um,r0]=so(_t,{collapsible:!1}),i0=w.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:i=()=>{},collapsible:s=!1,...o}=e,[a,l]=jn({prop:n,defaultProp:r??"",onChange:i,caller:_t});return c.jsx(Fm,{scope:e.__scopeAccordion,value:w.useMemo(()=>a?[a]:[],[a]),onItemOpen:l,onItemClose:w.useCallback(()=>s&&l(""),[s,l]),children:c.jsx(Um,{scope:e.__scopeAccordion,collapsible:s,children:c.jsx(Bm,{...o,ref:t})})})}),s0=w.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:i=()=>{},...s}=e,[o,a]=jn({prop:n,defaultProp:r??[],onChange:i,caller:_t}),l=w.useCallback(u=>a((f=[])=>[...f,u]),[a]),d=w.useCallback(u=>a((f=[])=>f.filter(m=>m!==u)),[a]);return c.jsx(Fm,{scope:e.__scopeAccordion,value:o,onItemOpen:l,onItemClose:d,children:c.jsx(Um,{scope:e.__scopeAccordion,collapsible:!0,children:c.jsx(Bm,{...s,ref:t})})})}),[o0,oo]=so(_t),Bm=w.forwardRef((e,t)=>{const{__scopeAccordion:n,disabled:r,dir:i,orientation:s="vertical",...o}=e,a=w.useRef(null),l=Ne(a,t),d=e0(n),f=hf(i)==="ltr",m=he(e.onKeyDown,p=>{var P;if(!JC.includes(p.key))return;const b=p.target,h=d().filter(L=>{var I;return!((I=L.ref.current)!=null&&I.disabled)}),g=h.findIndex(L=>L.ref.current===b),y=h.length;if(g===-1)return;p.preventDefault();let v=g;const _=0,x=y-1,T=()=>{v=g+1,v>x&&(v=_)},C=()=>{v=g-1,v<_&&(v=x)};switch(p.key){case"Home":v=_;break;case"End":v=x;break;case"ArrowRight":s==="horizontal"&&(f?T():C());break;case"ArrowDown":s==="vertical"&&T();break;case"ArrowLeft":s==="horizontal"&&(f?C():T());break;case"ArrowUp":s==="vertical"&&C();break}const O=v%y;(P=h[O].ref.current)==null||P.focus()});return c.jsx(o0,{scope:n,disabled:r,direction:i,orientation:s,children:c.jsx(Gc.Slot,{scope:n,children:c.jsx(ge.div,{...o,"data-orientation":s,ref:l,onKeyDown:r?void 0:m})})})}),Ts="AccordionItem",[a0,Qc]=so(Ts),Wm=w.forwardRef((e,t)=>{const{__scopeAccordion:n,value:r,...i}=e,s=oo(Ts,n),o=n0(Ts,n),a=qc(n),l=an(),d=r&&o.value.includes(r)||!1,u=s.disabled||e.disabled;return c.jsx(a0,{scope:n,open:d,disabled:u,triggerId:l,children:c.jsx(YC,{"data-orientation":s.orientation,"data-state":Gm(d),...a,...i,ref:t,disabled:u,open:d,onOpenChange:f=>{f?o.onItemOpen(r):o.onItemClose(r)}})})});Wm.displayName=Ts;var $m="AccordionHeader",Vm=w.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,i=oo(_t,n),s=Qc($m,n);return c.jsx(ge.h3,{"data-orientation":i.orientation,"data-state":Gm(s.open),"data-disabled":s.disabled?"":void 0,...r,ref:t})});Vm.displayName=$m;var Ca="AccordionTrigger",Hm=w.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,i=oo(_t,n),s=Qc(Ca,n),o=r0(Ca,n),a=qc(n);return c.jsx(Gc.ItemSlot,{scope:n,children:c.jsx(ZC,{"aria-disabled":s.open&&!o.collapsible||void 0,"data-orientation":i.orientation,id:s.triggerId,...a,...r,ref:t})})});Hm.displayName=Ca;var zm="AccordionContent",Km=w.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,i=oo(_t,n),s=Qc(zm,n),o=qc(n);return c.jsx(XC,{role:"region","aria-labelledby":s.triggerId,"data-orientation":i.orientation,...o,...r,ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});Km.displayName=zm;function Gm(e){return e?"open":"closed"}var c0=Im,l0=Wm,d0=Vm,qm=Hm,Qm=Km;const u0=c0,Yn=w.forwardRef(({className:e,...t},n)=>c.jsx(l0,{ref:n,className:Ae("border-b",e),...t}));Yn.displayName="AccordionItem";const Zn=w.forwardRef(({className:e,children:t,...n},r)=>c.jsx(d0,{className:"flex",children:c.jsxs(qm,{ref:r,className:Ae("flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...n,children:[t,c.jsx(gc,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"})]})}));Zn.displayName=qm.displayName;const Xn=w.forwardRef(({className:e,children:t,...n},r)=>c.jsx(Qm,{ref:r,className:"overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...n,children:c.jsx("div",{className:Ae("pb-4 pt-0",e),children:t})}));Xn.displayName=Qm.displayName;function Bd(e){const t=e.trim().replace(/,/g,"");if(!t||t===".")return null;const n=Number(t);return Number.isFinite(n)?n:null}function Wd(e,t){return t<=0?String(Math.round(e)):e.toFixed(t)}function f0(e,t){const n=e.replace(/,/g,"").replace(/[^\d.]/g,""),r=n.indexOf(".");if(r===-1)return n;const i=n.slice(0,r),s=n.slice(r+1).replace(/\./g,""),o=t>0?s.slice(0,t):"";return`${i}.${o}`}function p0(e){const t=e.trim();return!t||t==="."?"":t.endsWith(".")?t.slice(0,-1):t}function je({label:e,value:t,onChange:n,step:r=.01,min:i,decimals:s=2,placeholder:o,basePrice:a,disabled:l=!1,clearable:d=!1}){const[u,f]=S.useState(t),[m,p]=S.useState(!1),b=m?u:t,h=b.trim()!=="",g=!d;S.useEffect(()=>{m||f(t)},[m,t]);const y=()=>a!=null&&Number.isFinite(a)?a:i??0,v=P=>{f(P),n(P)},_=P=>{if(l)return;const L=y(),I=Bd(b),U=b.trim()!=="";let N;!U||I===null?N=P===1?L:L-r:N=I+P*r;const V=i!==void 0?Math.max(i,N):N;if(V<=0)return;const M=Wd(V,s);p(!1),v(M)},x=()=>{p(!0),f(t)},T=()=>{p(!1);const P=p0(u);if(!P){u.trim()!==""&&v("");return}const L=Bd(P);if(L===null||L<=0){v("");return}if(g){v(Wd(L,s));return}v(P)},C=P=>{f(f0(P,s))},O=()=>{l||(p(!1),v(""))};return c.jsxs("div",{className:"web-trading-widget-stepper",children:[c.jsxs("div",{className:"web-trading-widget-stepper__header",children:[c.jsx("span",{className:"web-trading-widget-stepper__label",children:e}),d&&h?c.jsx("button",{type:"button","aria-label":`Clear ${e}`,className:"web-trading-widget-stepper__clear",disabled:l,onClick:O,children:c.jsx(yn,{className:"web-trading-widget-icon web-trading-widget-icon--xs"})}):null]}),c.jsxs("div",{className:`web-trading-widget-stepper__control${l?" web-trading-widget-stepper__control--disabled":""}`,children:[c.jsx("button",{type:"button","aria-label":`Decrease ${e}`,className:"web-trading-widget-stepper__btn web-trading-widget-stepper__btn--minus",disabled:l||a===null&&b.trim()==="",onClick:()=>_(-1),children:c.jsx(Sw,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})}),c.jsx("input",{type:"text",inputMode:"decimal",pattern:"[0-9]*[.]?[0-9]*",value:b,placeholder:o,disabled:l,onFocus:x,onChange:P=>C(P.target.value),onBlur:T,className:"web-trading-widget-stepper__input"}),c.jsx("button",{type:"button","aria-label":`Increase ${e}`,className:"web-trading-widget-stepper__btn web-trading-widget-stepper__btn--plus",disabled:l||a===null&&b.trim()==="",onClick:()=>_(1),children:c.jsx(Tw,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})})]})]})}function m0({symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:i,minVolumeLots:s,isSubmitting:o,isAccountsLoading:a,selectedLogin:l,embedded:d=!1,onMinimize:u,onClose:f,onPlaceOrder:m}){const{t:p}=Le(),[b,h]=S.useState("market"),[g,y]=S.useState(String(r)),[v,_]=S.useState(""),[x,T]=S.useState(""),C=le(ie=>ie.stopLoss),O=le(ie=>ie.takeProfit),P=le(ie=>ie.setStopLoss),L=le(ie=>ie.setTakeProfit),I=le(ie=>ie.setVolumeLots),U=le(ie=>ie.setOrderSide),[N,V]=S.useState(""),[M,z]=S.useState(Qe.GTC),[k,j]=S.useState(""),[D,R]=S.useState(""),W=Number(Vt(Ht(e))),F=Or(W),G=Cc(t,n),X=t!==null?Ce(t,W):"—",de=n!==null?Ce(n,W):"—",ne=qs(b),B=gp(b),$=Gs(b),Q=p(ys[b]),ye=!ne&&$.orderType!==null&&$.orderType%2===1,ce=S.useMemo(()=>G!==null?G:t??n,[n,t,G]),ee=ie=>{y(ie);const St=Number(ie);Number.isFinite(St)&&St>0&&I(St)},ae=ie=>t===null||n===null?null:ne?ie==="buy"?n:t:We(v)??(ie==="buy"?n:t),ke=ie=>{const St=ae(ie);St!==null&&U({side:ie,entryPrice:St})},K=ie=>{if(t===null||n===null||!l)return;const St=Math.max(s,Number(g)||s),lo=Jo(b,ie),Pi=ae(ie);Pi!==null&&U({side:ie,entryPrice:Pi}),m({login:l,executionMode:b,side:ie,orderType:lo,volumeLots:St,stopLoss:C,takeProfit:O,priceOrder:v,priceTrigger:x,comment:N,typeTime:M,expirationDateTime:k,expirationDay:D,bid:t,ask:n})},xe=t!==null&&n!==null,re=ne||We(v)!==void 0,_e=!B||We(x)!==void 0,Fe=ne||Ys(M,k,D),He=!o&&!a&&l!==""&&xe&&re&&_e&&Fe,pt=!ne&&_c(M),Dr=!ne&&Sc(M);return c.jsxs("div",{className:"web-trading-widget-market-panel",children:[c.jsxs("div",{className:"web-trading-widget-market-panel__header",children:[c.jsxs(fs,{value:b,onValueChange:ie=>h(ie),children:[c.jsx(Xr,{className:"web-trading-widget-market-panel__select-trigger","aria-label":p("WebTrading.orderExecutionType"),children:c.jsx(ps,{})}),c.jsx(Jr,{children:hs.map(ie=>c.jsx(ei,{value:ie.mode,children:p(ys[ie.mode])},ie.mode))})]}),d?null:c.jsxs("div",{className:"web-trading-widget-market-panel__header-actions",children:[c.jsx("button",{type:"button","aria-label":p("WebTrading.minimizeToQuickOrder"),className:"web-trading-widget-market-panel__header-btn",onClick:u,children:c.jsx(_w,{className:"web-trading-widget-icon web-trading-widget-icon--md"})}),c.jsx("button",{type:"button","aria-label":p("WebTrading.closeOrderPanel"),className:"web-trading-widget-market-panel__header-btn",onClick:f,children:c.jsx(yn,{className:"web-trading-widget-icon web-trading-widget-icon--md"})})]})]}),c.jsxs(u0,{type:"multiple",defaultValue:["volume-setting","risk-management"],className:"web-trading-widget-market-panel__accordion",children:[c.jsxs(Yn,{value:"volume-setting",className:"web-trading-widget-market-panel__accordion-item",children:[c.jsx(Zn,{className:"web-trading-widget-market-panel__accordion-trigger",children:p("WebTrading.volumeSetting")}),c.jsx(Xn,{className:"web-trading-widget-market-panel__accordion-content",children:c.jsx(je,{label:p("WebTrading.lots"),value:g,onChange:ee,step:i,min:s,decimals:2})})]}),ne?null:c.jsxs(Yn,{value:"order-price",className:"web-trading-widget-market-panel__accordion-item",children:[c.jsx(Zn,{className:"web-trading-widget-market-panel__accordion-trigger",children:p("WebTrading.orderPrice")}),c.jsx(Xn,{className:"web-trading-widget-market-panel__accordion-content",children:B?c.jsxs(c.Fragment,{children:[c.jsx(je,{label:p("WebTrading.stopPrice"),value:x,onChange:T,step:F,decimals:W,basePrice:ce,placeholder:G!==null?Ce(G,W):"—"}),c.jsx(je,{label:p("WebTrading.limitPrice"),value:v,onChange:_,step:F,decimals:W,basePrice:ce,placeholder:G!==null?Ce(G,W):"—"})]}):c.jsx(je,{label:p("WebTrading.price"),value:v,onChange:_,step:F,decimals:W,basePrice:ce,placeholder:G!==null?Ce(G,W):"—"})})]}),c.jsxs(Yn,{value:"risk-management",className:"web-trading-widget-market-panel__accordion-item",children:[c.jsx(Zn,{className:"web-trading-widget-market-panel__accordion-trigger",children:p("WebTrading.riskManagement")}),c.jsx(Xn,{className:"web-trading-widget-market-panel__accordion-content",children:c.jsxs("div",{className:"web-trading-widget-market-panel__grid-2",children:[c.jsx(je,{label:p("WebTrading.stopLoss"),value:C,onChange:P,step:F,decimals:W,basePrice:t,placeholder:t!==null?X:"—",clearable:!0}),c.jsx(je,{label:p("WebTrading.takeProfit"),value:O,onChange:L,step:F,decimals:W,basePrice:n,placeholder:n!==null?de:"—",clearable:!0})]})})]}),ne?null:c.jsxs(Yn,{value:"expiration",className:"web-trading-widget-market-panel__accordion-item",children:[c.jsx(Zn,{className:"web-trading-widget-market-panel__accordion-trigger",children:p("WebTrading.expiration")}),c.jsxs(Xn,{className:"web-trading-widget-market-panel__accordion-content",children:[c.jsxs(fs,{value:String(M),onValueChange:ie=>z(Number(ie)),children:[c.jsx(Xr,{className:"web-trading-widget-market-panel__select-full","aria-label":p("WebTrading.orderExpirationType"),children:c.jsx(ps,{})}),c.jsx(Jr,{children:yp.map(ie=>c.jsx(ei,{value:String(ie.value),children:p(bp[ie.value])},ie.value))})]}),pt?c.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[c.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:p("WebTrading.expirationTime")}),c.jsx(Ln,{type:"datetime-local",value:k,onChange:ie=>j(ie.target.value)})]}):null,Dr?c.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[c.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:p("WebTrading.expirationDay")}),c.jsx(Ln,{type:"date",value:D,onChange:ie=>R(ie.target.value)})]}):null]})]}),c.jsxs(Yn,{value:"comment",className:"web-trading-widget-market-panel__accordion-item",children:[c.jsx(Zn,{className:"web-trading-widget-market-panel__accordion-trigger",children:p("WebTrading.comment")}),c.jsx(Xn,{className:"web-trading-widget-market-panel__accordion-content",children:c.jsx(Ln,{value:N,onChange:ie=>V(ie.target.value),placeholder:""})})]})]}),c.jsxs("div",{className:"web-trading-widget-market-panel__footer",children:[c.jsxs("div",{className:"web-trading-widget-market-panel__quotes",children:[c.jsx("span",{children:X}),c.jsx("span",{className:"web-trading-widget-market-panel__quotes-ask",children:de})]}),ne?c.jsxs("div",{className:"web-trading-widget-market-panel__actions",children:[c.jsx(lt,{type:"button",variant:"destructive",className:"web-trading-widget-market-panel__sell-btn",disabled:!He,onMouseDown:()=>ke("sell"),onClick:()=>K("sell"),children:p("WebTrading.sellByMarket")}),c.jsx(lt,{type:"button",className:"web-trading-widget-market-panel__buy-btn",disabled:!He,onMouseDown:()=>ke("buy"),onClick:()=>K("buy"),children:p("WebTrading.buyByMarket")})]}):c.jsx(lt,{type:"button",variant:ye?"destructive":"default",className:`web-trading-widget-market-panel__place-btn${ye?"":" web-trading-widget-market-panel__place-btn--buy"}`,disabled:!He,onMouseDown:()=>{const ie=$.orderType!==null&&$.orderType%2===1?"sell":"buy";ke(ie)},onClick:()=>{const ie=$.orderType!==null&&$.orderType%2===1?"sell":"buy";K(ie)},children:p("WebTrading.placeOrder",{label:Q})})]})]})}function Ym({confirmation:e,symbolTicker:t,onDismiss:n}){const{t:r}=Le(),i=Number(Vt(Ht(t))),s=Ce(e.price,i),o=e.side==="sell"?r("WebTrading.sell"):r("WebTrading.buy"),a=Ks(e.symbol||Qs(t));return c.jsxs("div",{className:"web-trading-widget-confirmation",children:[c.jsx("div",{className:"web-trading-widget-confirmation__close-row",children:c.jsx("button",{type:"button","aria-label":r("WebTrading.closeConfirmation"),className:"web-trading-widget-confirmation__close-btn",onClick:n,children:c.jsx(yn,{className:"web-trading-widget-icon web-trading-widget-icon--md"})})}),c.jsxs("div",{className:"web-trading-widget-confirmation__body",children:[c.jsxs("p",{className:"web-trading-widget-confirmation__summary",children:[c.jsxs("span",{className:"web-trading-widget-confirmation__ticket",children:["#",e.ticket]})," ",c.jsx("span",{className:`web-trading-widget-confirmation__side web-trading-widget-confirmation__side--${e.side}`,children:o})," ",e.volumeLots.toFixed(2)," ",a]}),c.jsx("p",{className:"web-trading-widget-confirmation__price",children:r("WebTrading.orderAtPrice",{price:s})}),c.jsx("p",{className:"web-trading-widget-confirmation__status",children:r("WebTrading.placed")}),c.jsx(lt,{type:"button",className:"web-trading-widget-confirmation__ok-btn",onClick:n,children:r("WebTrading.ok")})]})]})}function Vi(e,t){return e.toLocaleString(void 0,{minimumFractionDigits:t,maximumFractionDigits:t})}function zr(e){if(!(e===void 0||e===0))return e}function $d(e,t){return e===void 0||e===0?"":Ce(e,t)}function Vd(e,t){const n=We(e);if(n!==void 0)return n;if(zr(t)!==void 0)return 0}function Zm({order:e,onClose:t}){const{t:n}=Le(),{deleteOrder:r,modifyOrder:i}=ro(),s=pe(B=>B.removeOrder),o=pe(B=>B.liveQuotes),[a,l]=S.useState(String(e.volumeLots)),[d,u]=S.useState(String(e.orderPrice)),[f,m]=S.useState(e.priceTrigger!==void 0?String(e.priceTrigger):""),p=le(B=>B.stopLoss),b=le(B=>B.takeProfit),h=le(B=>B.setStopLoss),g=le(B=>B.setTakeProfit),y=le(B=>B.setDraft),[v,_]=S.useState(e.comment),[x,T]=S.useState(!1),[C,O]=S.useState(!1),P=Or(e.digits),L=$e(e.symbol).toUpperCase(),I=o[L],U=(I==null?void 0:I.bid)??e.marketBid??null,N=(I==null?void 0:I.ask)??e.marketAsk??null,V=U!==null?Ce(U,e.digits):"—",M=N!==null?Ce(N,e.digits):"—",z=S.useMemo(()=>e.orderPrice>0?e.orderPrice:Cc(U,N)??U??N,[N,U,e.orderPrice]);S.useEffect(()=>{y({source:"order",symbolKey:$e(e.symbol).toUpperCase(),entryPrice:e.orderPrice,stopLoss:$d(e.stopLoss,e.digits),takeProfit:$d(e.takeProfit,e.digits),side:e.side,showEntryLine:!0,volumeLots:e.volumeLots,digits:e.digits,priceStep:P})},[e.digits,e.orderPrice,e.side,e.stopLoss,e.symbol,e.takeProfit,e.volumeLots,P,y]);const k=xc(e.orderType),j=e.volumeLots,D=Number(d)||e.orderPrice,R=We(f),W=x||C,G=(D!==e.orderPrice||(k?R!==e.priceTrigger:!1)||zr(We(p))!==zr(e.stopLoss)||zr(We(b))!==zr(e.takeProfit)||v.trim()!==e.comment.trim())&&(!k||R!==void 0&&Number.isFinite(D)&&D>0),X=S.useMemo(()=>n("WebTrading.deleteOrderDetail",{ticket:e.ticket,typeLabel:e.typeLabel,volume:j.toFixed(2),symbol:e.displaySymbol,price:Vi(D,e.digits)}),[e,D,n,j]),de=async()=>{if(!G){Pe({variant:"destructive",description:n(k?"WebTrading.pleaseSetStopAndLimitPrices":"WebTrading.pleaseSetOrderPrice")});return}T(!0);try{const B=await i(e,{volumeLots:j,priceOrder:D,priceTrigger:k?R:void 0,stopLoss:Vd(p,e.stopLoss),takeProfit:Vd(b,e.takeProfit),comment:v.trim()||"order modify"});if(!B.success){Pe({variant:"destructive",description:B.message||n("WebTrading.failedModifyOrder")});return}t(),Pe({description:n("WebTrading.orderUpdated",{ticket:e.ticket})})}catch(B){const $=B instanceof Error?B.message:n("WebTrading.failedModifyOrder");Pe({variant:"destructive",description:$})}finally{T(!1)}},ne=async()=>{O(!0);try{const B=await r(e);if(!B.success){Pe({variant:"destructive",description:B.message||n("WebTrading.failedDeleteOrder")});return}s(e.ticket),t(),Pe({description:n("WebTrading.orderDeleted",{ticket:e.ticket})})}catch(B){const $=B instanceof Error?B.message:n("WebTrading.failedDeleteOrder");Pe({variant:"destructive",description:$})}finally{O(!1)}};return c.jsxs("div",{className:"web-trading-widget-detail-panel",children:[c.jsxs("div",{className:"web-trading-widget-detail-panel__header",children:[c.jsxs("p",{className:`web-trading-widget-detail-panel__title web-trading-widget-detail-panel__title--${e.side}`,children:["#",e.ticket," ",e.typeLabel," ",j.toFixed(2)," / ",e.volumeFilledLots.toFixed(2)," ",e.displaySymbol," ",k&&R!==void 0?`${Vi(R,e.digits)} / ${Vi(D,e.digits)}`:Vi(D,e.digits)]}),c.jsx("button",{type:"button","aria-label":n("WebTrading.closeOrderPanel"),className:"web-trading-widget-icon-btn",onClick:t,children:c.jsx(yn,{className:"web-trading-widget-icon web-trading-widget-icon--md"})})]}),c.jsxs("div",{className:"web-trading-widget-detail-panel__body",children:[c.jsx(je,{label:n("WebTrading.lots"),value:a,onChange:l,step:.01,min:.01,decimals:2,disabled:!0}),k?c.jsxs(c.Fragment,{children:[c.jsx(je,{label:n("WebTrading.stopPrice"),value:f,onChange:m,step:P,decimals:e.digits,basePrice:z}),c.jsx(je,{label:n("WebTrading.limitPrice"),value:d,onChange:u,step:P,decimals:e.digits,basePrice:z})]}):c.jsx(je,{label:n("WebTrading.price"),value:d,onChange:u,step:P,decimals:e.digits,basePrice:z}),c.jsxs("div",{className:"web-trading-widget-market-panel__grid-2",children:[c.jsx(je,{label:n("WebTrading.stopLoss"),value:p,onChange:h,step:P,decimals:e.digits,basePrice:U,placeholder:V,clearable:!0}),c.jsx(je,{label:n("WebTrading.takeProfit"),value:b,onChange:g,step:P,decimals:e.digits,basePrice:N,placeholder:M,clearable:!0})]}),c.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[c.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:n("WebTrading.comment")}),c.jsx(Ln,{value:v,onChange:B=>_(B.target.value)})]}),c.jsx(lt,{type:"button",variant:"secondary",className:"web-trading-widget-detail-panel__btn-full",disabled:W||!G,onClick:()=>void de(),children:n("WebTrading.modify")}),c.jsx(lt,{type:"button",className:"web-trading-widget-detail-panel__action-btn",disabled:W,onClick:()=>void ne(),children:X})]})]})}function Hi(e,t){return e.toLocaleString(void 0,{minimumFractionDigits:t,maximumFractionDigits:t})}function Kr(e){if(!(e===void 0||e===0))return e}function Hd(e,t){return e===void 0||e===0?"":Ce(e,t)}function zd(e,t){const n=We(e);if(n!==void 0)return n;if(Kr(t)!==void 0)return 0}function h0(e,t,n){return e.type==="buy"?t??e.marketBid??e.currentPrice:n??e.marketAsk??e.currentPrice}function Xm({position:e,onClose:t}){const{t:n}=Le(),{closePosition:r,modifyPosition:i}=ro(),s=pe(k=>k.removePosition),o=pe(k=>k.liveQuotes),[a,l]=S.useState(String(e.volumeLots)),d=le(k=>k.stopLoss),u=le(k=>k.takeProfit),f=le(k=>k.setStopLoss),m=le(k=>k.setTakeProfit),p=le(k=>k.setDraft),[b,h]=S.useState(!1),[g,y]=S.useState(!1),v=Or(e.digits),_=$e(e.symbol).toUpperCase(),x=o[_],T=(x==null?void 0:x.bid)??e.marketBid??null,C=(x==null?void 0:x.ask)??e.marketAsk??null,O=T!==null?Ce(T,e.digits):"—",P=C!==null?Ce(C,e.digits):"—";S.useEffect(()=>{p({source:"position",symbolKey:$e(e.symbol).toUpperCase(),entryPrice:e.openPrice,stopLoss:Hd(e.stopLoss,e.digits),takeProfit:Hd(e.takeProfit,e.digits),side:e.type,showEntryLine:!1,volumeLots:e.volumeLots,digits:e.digits,priceStep:v})},[e.digits,e.openPrice,e.stopLoss,e.symbol,e.takeProfit,e.type,e.volumeLots,v,p]);const L=h0(e,T,C),I=e.volumeLots,U=b||g,N=Kr(We(d))!==Kr(e.stopLoss)||Kr(We(u))!==Kr(e.takeProfit),V=async()=>{if(N){y(!0);try{const k=await i(e,{stopLoss:zd(d,e.stopLoss),takeProfit:zd(u,e.takeProfit),comment:e.comment});if(!k.success){Pe({variant:"destructive",description:k.message||n("WebTrading.failedModifyPosition")});return}t(),Pe({description:n("WebTrading.positionUpdated",{ticket:e.ticket})})}catch(k){const j=k instanceof Error?k.message:n("WebTrading.failedModifyPosition");Pe({variant:"destructive",description:j})}finally{y(!1)}}},M=S.useMemo(()=>{const k=e.profit.toFixed(2),j=e.type==="buy"?n("WebTrading.buy"):n("WebTrading.sell");return n("WebTrading.closePositionDetail",{ticket:e.ticket,type:j,volume:I.toFixed(2),symbol:e.displaySymbol,openPrice:Hi(e.openPrice,e.digits),closePrice:Hi(L,e.digits),profit:k})},[L,e,n,I]),z=async()=>{h(!0);try{const k=await r(e);if(!k.success){Pe({variant:"destructive",description:k.message||n("WebTrading.failedClosePosition")});return}s(e.ticket),t(),Pe({description:n("WebTrading.positionClosedSimple",{ticket:e.ticket})})}catch(k){const j=k instanceof Error?k.message:n("WebTrading.failedClosePosition");Pe({variant:"destructive",description:j})}finally{h(!1)}};return c.jsxs("div",{className:"web-trading-widget-detail-panel",children:[c.jsxs("div",{className:"web-trading-widget-detail-panel__header",children:[c.jsxs("p",{className:"web-trading-widget-detail-panel__title web-trading-widget-detail-panel__title--position",children:["#",e.ticket," ",e.type," ",I.toFixed(2)," ",e.displaySymbol," ",Hi(e.openPrice,e.digits)]}),c.jsx("button",{type:"button","aria-label":n("WebTrading.closePositionPanel"),className:"web-trading-widget-icon-btn",onClick:t,children:c.jsx(yn,{className:"web-trading-widget-icon web-trading-widget-icon--md"})})]}),c.jsxs("div",{className:"web-trading-widget-detail-panel__body",children:[c.jsx(je,{label:n("WebTrading.lots"),value:a,onChange:l,step:.01,min:.01,decimals:2,disabled:!0}),c.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[c.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:n("WebTrading.price")}),c.jsx(Ln,{readOnly:!0,disabled:!0,value:Hi(e.openPrice,e.digits),className:"web-trading-widget-detail-panel__input-muted"})]}),c.jsxs("div",{className:"web-trading-widget-market-panel__grid-2",children:[c.jsx(je,{label:n("WebTrading.stopLoss"),value:d,onChange:f,step:v,decimals:e.digits,basePrice:T,placeholder:O,clearable:!0}),c.jsx(je,{label:n("WebTrading.takeProfit"),value:u,onChange:m,step:v,decimals:e.digits,basePrice:C,placeholder:P,clearable:!0})]}),c.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[c.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:n("WebTrading.comment")}),c.jsx(Ln,{readOnly:!0,disabled:!0,value:e.comment,className:"web-trading-widget-detail-panel__input-muted"})]}),c.jsx(lt,{type:"button",variant:"secondary",className:"web-trading-widget-detail-panel__btn-full",disabled:U||!N,onClick:()=>void V(),children:n("WebTrading.modify")}),c.jsx(lt,{type:"button",className:"web-trading-widget-detail-panel__action-btn",disabled:U,onClick:()=>void z(),children:M})]})]})}function Kd({symbolTicker:e,orderState:t}){const{t:n}=Le(),r=Dc(e),{confirmation:i,isSubmitting:s,defaultVolumeLots:o,volumeStep:a,minVolumeLots:l,selectedLogin:d,isAccountsLoading:u,hasConfirmedAccount:f,dismissConfirmation:m,placeMarketOrder:p}=t,b=pe(P=>P.positions),h=pe(P=>P.orders),g=pe(P=>P.selectedPositionTicket),y=pe(P=>P.selectedOrderTicket),v=pe(P=>P.setSelectedPositionTicket),_=pe(P=>P.setSelectedOrderTicket),x=g!==null?b.find(P=>P.ticket===g)??null:null,T=y!==null?h.find(P=>P.ticket===y)??null:null,C=i!==null,O=S.useCallback(P=>{p({symbolTicker:e,login:P.login,executionMode:P.executionMode,side:P.side,orderType:P.orderType,volumeLots:P.volumeLots,stopLoss:P.stopLoss,takeProfit:P.takeProfit,priceOrder:P.priceOrder,priceTrigger:P.priceTrigger,comment:P.comment,typeTime:P.typeTime,expirationDateTime:P.expirationDateTime,expirationDay:P.expirationDay,bid:P.bid,ask:P.ask})},[p,e]);return x!==null?c.jsx(Xm,{position:x,onClose:()=>v(null)}):T!==null?c.jsx(Zm,{order:T,onClose:()=>_(null)}):C&&i!==null?c.jsx(Ym,{confirmation:i,symbolTicker:e,onDismiss:m}):f?c.jsx(m0,{embedded:!0,symbolTicker:e,bid:(r==null?void 0:r.bid)??null,ask:(r==null?void 0:r.ask)??null,defaultVolumeLots:o,volumeStep:a,minVolumeLots:l,isSubmitting:s,isAccountsLoading:u,selectedLogin:d,onPlaceOrder:O}):c.jsx("div",{className:"web-trading-widget-side-panel__empty",children:n("WebTrading.selectAccountToTrade")})}function Gd({label:e,isActive:t,onClick:n}){return c.jsx("button",{type:"button",role:"tab","aria-selected":t,className:`web-trading-widget-side-panel__tab${t?" web-trading-widget-side-panel__tab--active":""}`,onClick:n,children:e})}function g0({symbolTicker:e,orderState:t,scanResultUrl:n,onScanResultLoad:r,initialTab:i="trade",activeTab:s,onTabChange:o}){const{t:a}=Le(),l=!!n,[d,u]=S.useState(i),f=s!==void 0,m=f?s:d,p=S.useCallback(b=>{f?o==null||o(b):u(b)},[f,o]);return c.jsx("aside",{className:`web-trading-widget-side-panel${l?" web-trading-widget-side-panel--with-scan":""}`,children:l?c.jsxs("div",{className:"web-trading-widget-side-panel__scan-layout",children:[c.jsxs("div",{role:"tablist","aria-label":a("WebTrading.chartSidePanel"),className:"web-trading-widget-side-panel__tablist",children:[c.jsx(Gd,{label:a("WebTrading.trade"),isActive:m==="trade",onClick:()=>p("trade")}),c.jsx(Gd,{label:a("WebTrading.scanResult"),isActive:m==="scan",onClick:()=>p("scan")})]}),c.jsxs("div",{className:"web-trading-widget-side-panel__panels",children:[c.jsx("div",{role:"tabpanel",hidden:m!=="trade",className:"web-trading-widget-side-panel__tabpanel",children:c.jsx(Kd,{symbolTicker:e,orderState:t})}),c.jsx("div",{role:"tabpanel",hidden:m!=="scan",className:"web-trading-widget-side-panel__tabpanel web-trading-widget-side-panel__tabpanel--scan",children:c.jsx("iframe",{src:n??void 0,title:a("WebTrading.scanResult"),className:"web-trading-widget-side-panel__iframe",onLoad:r},n)})]})]}):c.jsx("div",{className:"web-trading-widget-side-panel__scroll",children:c.jsx(Kd,{symbolTicker:e,orderState:t})})})}const y0=.01,b0=.01,qd=.01;function v0({symbols:e,defaultPanelAfterConfirm:t="mini"}){const{t:n}=Le(),[r,i]=S.useState("closed"),[s,o]=S.useState(null),[a,l]=S.useState(!1),[d,u]=S.useState("pending"),[f,m]=S.useState(null),p=pe(N=>N.setSelectedLogin),{accounts:b,isLoading:h}=Tm(),{submitOrder:g}=ro(),y=S.useMemo(()=>Mw(b),[b]),v=S.useMemo(()=>Fw(b,f),[b,f]),_=d==="confirmed",x=d==="needs-selection";S.useEffect(()=>{if(h)return;if(d==="confirmed"){f&&!y.some(V=>V.login===f)&&u("needs-selection");return}if(d==="needs-selection")return;const N=Iw();if(N&&y.some(V=>V.login===N)){m(N),u("confirmed"),i(t);return}u("needs-selection")},[d,y,t,h,f]),S.useEffect(()=>{v&&p(v)},[v,p]);const T=S.useCallback(N=>{m(N),p(N),Ul(N)},[p]),C=S.useCallback(N=>{N&&(Ul(N),T(N),u("confirmed"),o(null),i(t))},[t,T]),O=S.useCallback(()=>{o(null),i("market")},[]),P=S.useCallback(()=>{o(null),i("mini")},[]),L=S.useCallback(()=>{o(null),i("mini")},[]),I=S.useCallback(()=>{o(null),i("mini")},[]),U=S.useCallback(async N=>{const V=le.getState().clearEntryLinePreview,M=N.login.trim();if(!M){V(),Pe({variant:"destructive",description:n("WebTrading.pleaseSelectTradingAccount")});return}const z=Math.max(qd,N.volumeLots),k=Qs(N.symbolTicker,e);Number(Vt(Ht(N.symbolTicker,e)));const j=qs(N.executionMode),D=xc(N.orderType),R=We(N.priceOrder),W=We(N.priceTrigger);if(!j&&R===void 0){V(),Pe({variant:"destructive",description:n(D?"WebTrading.pleaseSetLimitPrice":"WebTrading.pleaseSetOrderPrice")});return}if(D&&W===void 0){V(),Pe({variant:"destructive",description:n("WebTrading.pleaseSetStopPrice")});return}if(!j&&!Ys(N.typeTime,N.expirationDateTime,N.expirationDay)){V(),Pe({variant:"destructive",description:n("WebTrading.pleaseSetExpirationDate")});return}const F=j?N.side==="buy"?N.ask:N.bid:R??(N.side==="buy"?N.ask:N.bid);l(!0);try{const G=await g({login:M,symbolTicker:N.symbolTicker,executionMode:N.executionMode,side:gs(N.orderType),orderType:N.orderType,volumeLots:z,stopLoss:We(N.stopLoss),takeProfit:We(N.takeProfit),priceOrder:wc(N.orderType)?R:void 0,priceTrigger:D?W:void 0,comment:N.comment.trim(),typeTime:N.typeTime,expirationDateTime:N.expirationDateTime,expirationDay:N.expirationDay,bid:N.bid,ask:N.ask});if(!G.success){V(),Pe({variant:"destructive",description:G.message||n("WebTrading.orderNotAccepted")});return}o({ticket:G.ticket??"",side:G.side??gs(N.orderType),volumeLots:G.volumeLots??z,symbol:G.displaySymbol??k,price:G.price??F}),i("confirmation")}catch(G){V();const X=G instanceof Error?G.message:n("WebTrading.failedPlaceOrder");Pe({variant:"destructive",description:X})}finally{l(!1)}},[g,e,n]);return{panel:r,confirmation:s,isSubmitting:a,defaultVolumeLots:y0,volumeStep:b0,minVolumeLots:qd,accountOptions:y,selectedLogin:v,setSelectedLogin:T,isAccountsLoading:h,hasConfirmedAccount:_,needsAccountSelection:x,confirmAccountSelection:C,openMarketPanel:O,openMiniPanel:P,closePanels:L,dismissConfirmation:I,placeMarketOrder:U}}function Cs(e){var t;if(typeof window<"u"){const n=localStorage.getItem(er);if(n&&e.some(r=>r.ticker===n))return n}return((t=e[0])==null?void 0:t.ticker)??"XAU_USD"}function Pa(e,t,n){var r;return((r=t.find(i=>i.display_name===e||i.ticker===e))==null?void 0:r.ticker)??n}function w0({chartWidget:e,symbols:t,chartSlotElement:n,onSymbolTickerChange:r,onScanResultUrlChange:i,selectSymbolTickerRef:s}){const o=S.useMemo(()=>Cs(t),[t]),a=S.useRef(o),l=S.useRef(e),[d,u]=S.useState(null);S.useEffect(()=>{l.current=e},[e]),S.useEffect(()=>{if(!n){u(null);return}const m=()=>{const b=n.querySelector(":scope > div");u(b)};m();const p=new MutationObserver(m);return p.observe(n,{childList:!0}),()=>{p.disconnect()}},[n]);const f=S.useCallback(m=>{if(m===a.current)return;const p=t.find(h=>h.ticker===m);if(!p)return;a.current=m,localStorage.setItem(er,m),r(m),i(null);const b=l.current;if(b)try{b.onChartReady(()=>{b.activeChart().setSymbol(p.ticker)})}catch{}},[i,r,t]);return S.useEffect(()=>(s.current=f,()=>{s.current=null}),[f,s]),S.useEffect(()=>{if(!e)return;let m=!1,p=null;try{e.onChartReady(()=>{if(m)return;let b;try{b=e.activeChart()}catch{return}const h=v=>{const _=b.symbol(),x=Pa(_,t,o);x!==a.current&&i(null);try{e.resetCache()}catch{}a.current=x,localStorage.setItem(er,x),r(x)},g=b.symbol(),y=Pa(g,t,o);y!==a.current&&(a.current=y,localStorage.setItem(er,y),r(y)),b.onSymbolChanged().subscribe(null,h),p=()=>{try{b.onSymbolChanged().unsubscribe(null,h)}catch{}}})}catch{}return()=>{m=!0,p==null||p()}},[e,i,r,o,t]),{chartContainer:d}}const x0=Ba("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function _0({className:e,variant:t,...n}){return c.jsx("div",{className:Ae(x0({variant:t}),e),...n})}function Jm(){var t;const e=(t=window.TradingView)==null?void 0:t.widget;return typeof e=="function"?e:null}function rs(){return Jm()!==null}const Qd="/charting_library/charting_library.js";function S0({onLoad:e}){return S.useEffect(()=>{if(rs()){e();return}const t=document.querySelector(`script[src="${Qd}"]`);if(t){const r=()=>{rs()&&e()};return t.addEventListener("load",r),()=>t.removeEventListener("load",r)}const n=document.createElement("script");return n.src=Qd,n.async=!1,n.onload=()=>{rs()&&e()},n.onerror=()=>{console.error("Failed to load TradingView charting library")},document.head.appendChild(n),()=>{n.onload=null,n.onerror=null}},[e]),null}const Yd=Zs(e=>({playEndTimestamp:null,setPlayEndTimestamp:t=>e({playEndTimestamp:t})})),eh=Zs(e=>({newsSelectedCandles:null,newsPlayEndTimestamp:null,gapCount:0,isReplayMode:!1,setNewsSelectedCandles:t=>e({newsSelectedCandles:t}),setNewsPlayEndTimestamp:t=>e({newsPlayEndTimestamp:t}),setGapCount:t=>e({gapCount:t}),setReplayMode:t=>e({isReplayMode:t})})),Ea=8,th=4,ka=5,Aa=e=>e==="1"?60:e==="5"?300:e==="1D"?1440*3600:parseInt(e,10)*60,T0=e=>{const t=new Date(e+Ea*60*60*1e3),n=t.getUTCDay(),r=t.getUTCHours();return n===0?!1:n===1?r>=ka:n===6?r<=th:!0},C0=e=>{const t=new Date(e+Ea*60*60*1e3),n=t.getUTCDay(),r=t.getUTCHours();if(n===0||n===1&&r<ka||n===6&&r>=th){const i=(8-n)%7;return t.setUTCDate(t.getUTCDate()+i),t.setUTCHours(ka,0,0,0),t.getTime()-Ea*60*60*1e3}return e},P0=(e,t,n)=>{const r=Aa(t)*1e3,i=[];let s=e;for(let o=0;o<n;o++)s+=r,T0(s)||(s=C0(s)),i.push(s);return i},E0=(e,t,n,r)=>{if(n<=0)return[];if(r==="24x7"){const s=Aa(t)*1e3;return Array.from({length:n},(o,a)=>e+(a+1)*s)}if(r==="1700-1700")return P0(e,t,n);const i=Aa(t)*1e3;return Array.from({length:n},(s,o)=>e+(o+1)*i)},k0=(e,t)=>{if(t==="1D"||t==="D"||t==="1440"){const n=new Date(e*1e3);return n.setUTCHours(0,0,0,0),n.getTime()}return e.toString().length>11?e:e*1e3},Zd="wss://ticks.opheleo.com";function A0(e){return{1:6e4,5:3e5,15:9e5,30:18e5,60:36e5,240:144e5}[e]??6e4}function Xd(e){return e.trim().toUpperCase()}function O0(e,t){return Math.floor(e/t)*t}let Br;async function N0(e){const t=new URLSearchParams({symbol:e.symbol,timeframe:e.timeframe,...e.endTimestamp&&{endTimestamp:e.endTimestamp.toString()}});return e.last_evaluated_key&&t.append("last_evaluated_key",e.last_evaluated_key),Re({baseURL:"https://corprate-widget.iccandle.ai",url:`/chart/endTimestamp?${t.toString()}`,method:"GET"})}class R0{constructor(t,n,r=Wt,i=Zd){ot(this,"futureBarsRef");ot(this,"type");ot(this,"symbols");ot(this,"tickWebSocketUrl");ot(this,"configuration",{supported_resolutions:["1","5","15","30","60"],supports_marks:!1,supports_timescale_marks:!0,supports_time:!1});ot(this,"ws",null);ot(this,"isWsConnecting",!1);ot(this,"wsSelectedSymbol",null);ot(this,"subscriptions",new Map);ot(this,"lastBarsCache",new Map);ot(this,"pushFutureBar",t=>{for(const[,n]of this.subscriptions.entries())return n.onTick(t),!0;return!1});this.futureBarsRef=t,this.type=n,this.symbols=r,this.tickWebSocketUrl=i||Zd}onReady(t){setTimeout(()=>t(this.configuration),0)}resolveSymbol(t,n,r){const i=this.symbols.find(o=>o.ticker===t),s=this.symbols.find(o=>o.display_name===t);try{setTimeout(()=>{const o={name:(i==null?void 0:i.display_name)||(s==null?void 0:s.display_name)||localStorage.getItem("tv:latest-symbol")||"XAU_USD",timezone:"America/New_York",minmov:1,session:(i==null?void 0:i.session)||(s==null?void 0:s.session)||"24x7",has_intraday:!0,visible_plots_set:"ohlc",library_custom_fields:{ticker:(i==null?void 0:i.ticker)||(s==null?void 0:s.ticker)||localStorage.getItem("tv:latest-symbol")||"XAU_USD"},description:(i==null?void 0:i.description)||(s==null?void 0:s.description)||"",type:(i==null?void 0:i.type)||(s==null?void 0:s.type)||"",pricescale:(i==null?void 0:i.pricescale)||(s==null?void 0:s.pricescale)||1e5,ticker:(i==null?void 0:i.display_name)||(s==null?void 0:s.display_name)||localStorage.getItem("tv:latest-symbol")||"XAU_USD",exchange:"FX",format:"price",listed_exchange:"FX",logo_urls:(i==null?void 0:i.logo_urls.map(a=>a.replace("https://cdn.iccandle.ai/web-assets","/images/symbols")))||(s==null?void 0:s.logo_urls.map(a=>a.replace("https://cdn.iccandle.ai/web-assets","/images/symbols")))};n(o)},0)}catch{r("Symbol not found")}}getBars(t,n,r,i,s){var f;const o=(f=t.library_custom_fields)==null?void 0:f.ticker,a=this.symbols.find(m=>o!==void 0&&m.ticker===o||m.ticker===t.ticker||m.display_name===t.name||m.display_name===t.ticker),l={symbol:(a==null?void 0:a.ticker)||"",timeframe:n};if(r.firstDataRequest&&(Br=void 0),!r.firstDataRequest)if(Br)l.last_evaluated_key=Br;else{i([],{noData:!0});return}const u=Yd.getState().playEndTimestamp;u&&(l.endTimestamp=u,Yd.getState().setPlayEndTimestamp(null),Br=void 0),(async()=>{var m;try{const{data:p}=await N0(l);if(p.data_status==="threshold_limited"){i([],{noData:!0});return}if(p.data_status==="end_of_data"){i([],{noData:!0});return}if(!((m=p.items)!=null&&m.length)){i([],{noData:!0});return}Br=p.last_evaluated_key;const h=[...p.items].map(_=>({open:_.o,high:_.h,low:_.l,close:_.c,time:k0(_.timestamp,n)})),g=eh.getState(),{gapCount:y,isReplayMode:v}=g;if(v&&event){const _=E0(h[h.length-1].time,n,y||0,t.session);if(_.length>0){const x=h[h.length-1].close;for(const T of _)h.push({open:x,high:x,low:x,close:x,time:T})}}i(h)}catch(p){s(p),i([],{noData:!0})}})()}searchSymbols(t,n,r,i){if(r==="all"||r===""){const s=this.symbols.filter(o=>{var a;return(a=o.display_name)==null?void 0:a.toUpperCase().includes(t.toUpperCase())}).map(o=>({...o,symbol:o.display_name,exchange:"FX",logo_urls:o.logo_urls.map(a=>a.replace("https://cdn.iccandle.ai/web-assets","/images/symbols"))}));i(s)}else{const s=this.symbols.filter(o=>{var a;return((a=o.display_name)==null?void 0:a.toUpperCase().includes(t.toUpperCase()))&&o.type.includes(r)}).map(o=>({...o,symbol:o.display_name,exchange:"FX",logo_urls:o.logo_urls.map(a=>a.replace("https://cdn.iccandle.ai/web-assets","/images/symbols"))}));i(s)}}subscribeBars(t,n,r,i,s){var f;const o=(f=t.library_custom_fields)==null?void 0:f.ticker,a=this.symbols.find(m=>o!==void 0&&m.ticker===o||m.display_name===t.ticker||m.display_name===t.name),l=a!=null&&a.resolve_symbol?Xd(a.resolve_symbol):Xd(t.ticker||t.name||""),d=A0(n),u=`${l}|${n}`;this.subscriptions.set(i,{symbol:l,resolution:n,periodMs:d,onTick:r,onResetCacheNeededCallback:s,liveCandle:this.lastBarsCache.get(u)??null}),this.ensureWebSocket(l)}unsubscribeBars(t){this.subscriptions.delete(t),this.subscriptions.size===0&&this.ws&&(this.ws.close(1e3,"No more subscriptions"),this.ws=null)}ensureWebSocket(t){var i;const n=t??((i=this.subscriptions.values().next().value)==null?void 0:i.symbol);if(this.ws&&this.ws.readyState===WebSocket.OPEN&&this.wsSelectedSymbol===n||(this.ws&&this.wsSelectedSymbol!==n&&(this.ws.close(1e3,"Symbol change"),this.ws=null,this.wsSelectedSymbol=null),this.isWsConnecting))return;this.isWsConnecting=!0;const r=new WebSocket(this.tickWebSocketUrl);this.ws=r,this.wsSelectedSymbol=n??null,r.onopen=()=>{this.isWsConnecting=!1,n&&r.send(JSON.stringify({action:"select_symbol",symbol:n}))},r.onmessage=s=>this.handleMessage(s),r.onerror=()=>{this.isWsConnecting=!1},r.onclose=()=>{this.ws=null,this.wsSelectedSymbol=null,this.isWsConnecting=!1,this.subscriptions.size>0&&setTimeout(()=>this.ensureWebSocket(),3e3)}}handleMessage(t){try{const n=JSON.parse(t.data);this.processTick(n)}catch{}}processTick(t){const n=t.symbol,r=Number(t.updatedAtMs),i=(Number(t.bid)+Number(t.ask))/2;if(!(!Number.isFinite(r)||!Number.isFinite(i)))for(const[s,o]of this.subscriptions.entries()){if(o.symbol!==n)continue;const a=`${o.symbol}|${o.resolution}`,l=O0(r,o.periodMs);let d=o.liveCandle;d?l>d.time?d={time:l,open:i,high:i,low:i,close:i,volume:0}:d={...d,high:Math.max(d.high,i),low:Math.min(d.low,i),close:i}:d={time:l,open:i,high:i,low:i,close:i,volume:0},o.liveCandle=d,this.lastBarsCache.set(a,d),this.subscriptions.set(s,o),(f=>{var m,p;(p=(m=this.futureBarsRef)==null?void 0:m.current)!=null&&p.length||o.onTick(f)})(d)}}extractErrorMessage(t){if(t instanceof Error)return t.message;if(typeof t=="string")return t;try{return JSON.stringify(t)}catch{return String(t)}}getTimescaleMarks(t,n,r,i){const s=[];if(this.type&&this.type=="selector")try{const o=JSON.parse(localStorage.getItem("tv:selected-news-events")||"[]");o==null||o.forEach(({id:a,timestamp:l,event_name:d,currency:u})=>{!a||!Number.isFinite(l)||l<=0||s.some(f=>String(f.id)===String(a))||s.push({id:a,time:l/1e3,color:"green",label:d.slice(0,1)||"N",tooltip:[d],...u?{imageUrl:`/images/symbols/${u}.svg`}:{},showLabelWhenImageLoaded:!0})})}catch{}if(this.type&&this.type=="news")try{const o=JSON.parse(localStorage.getItem("iccandle:current-news-event")||"{}"),{id:a,timestamp:l,event_name:d,currency:u,forecast:f,previous:m,actual:p}=o;if(!a||!Number.isFinite(l)||l<=0||s.some(h=>String(h.id)==="news:"+a))return;s.push({id:"news:"+a,time:l/1e3,color:"green",label:d.slice(0,1),tooltip:[d,`Current Forecast: ${f||"-"}`,`Previous Forecast: ${m||"-"}`,`Previous Actual: ${p||"-"}`],...u?{imageUrl:`https://cdn.iccandle.ai/web-assets/${u??"USD"}.svg`}:{}})}catch{}i(s)}}const L0=e=>{const t={name:"Generated Candles - By iC Candle",metainfo:{_metainfoVersion:51,id:"Generated Candles - By iC Candle@tv-basicstudies-1",description:"Generated Candles - By iC Candle",shortDescription:"Generated Candles",isCustomIndicator:!0,is_hidden_study:!1,is_price_study:!0,linkedToSeries:!0,format:{type:"price",precision:2},inputs:[],palettes:{palette_bar:{colors:{0:{name:"Bullish"},1:{name:"Bearish"}},valToIndex:{0:0,1:1}},palette_wick:{colors:{0:{name:"Bullish Wick"},1:{name:"Bearish Wick"}},valToIndex:{0:0,1:1}},palette_border:{colors:{0:{name:"Bullish Border"},1:{name:"Bearish Border"}},valToIndex:{0:0,1:1}}},plots:[{id:"plot_open",type:"ohlc_open",target:"plot_candle"},{id:"plot_high",type:"ohlc_high",target:"plot_candle"},{id:"plot_low",type:"ohlc_low",target:"plot_candle"},{id:"plot_close",type:"ohlc_close",target:"plot_candle"},{id:"plot_bar_color",type:"ohlc_colorer",palette:"palette_bar",target:"plot_candle"},{id:"plot_wick_color",type:"wick_colorer",palette:"palette_wick",target:"plot_candle"},{id:"plot_border_color",type:"border_colorer",palette:"palette_border",target:"plot_candle"}],ohlcPlots:{plot_candle:{title:"Generated Candles"}},styles:{},defaults:{styles:{},ohlcPlots:{plot_candle:{borderColor:"#000000",color:"#000000",drawBorder:!0,drawWick:!0,plottype:"ohlc_candles",visible:!0,wickColor:"#000000"}},palettes:{palette_bar:{colors:{0:{color:"#00dfb9",width:1,style:0},1:{color:"#ffb84d",width:1,style:0}}},palette_wick:{colors:{0:{color:"#00dfb9",width:1,style:0},1:{color:"#ffb84d",width:1,style:0}}},palette_border:{colors:{0:{color:"#00dfb9",width:1,style:0},1:{color:"#ffb84d",width:1,style:0}}}},precision:2,inputs:{}}},constructor:function(){this.init=function(n){this._context=n},this.main=function(n){this._context=n;const r=n.symbol.time,i=e.current,s=n.symbol.open,o=n.symbol.high,a=n.symbol.low,l=n.symbol.close;if(!Number.isFinite(r)||!i||i.length===0)return[s,o,a,l,Number.NaN,Number.NaN,Number.NaN];if(!i.some(m=>m.time===r))return[s,o,a,l,Number.NaN,Number.NaN,Number.NaN];const f=l<s?1:0;return[s,o,a,l,f,f,f]}}};return Promise.resolve([t])},Oa="An unknown error occurred",is=e=>{if(typeof e=="string")return e;if(typeof e!="object"||e===null)return Oa;if(typeof e.message=="string")return e.message;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const n=is(e[t]);if(n)return n}return Oa},D0=e=>{var t;if(Xp(e)){const n=(t=e.response)!=null&&t.data?is(e.response.data):void 0;return n&&n!==Oa?n:is(e)}return is(e)},j0=({queryKey:e,queryFn:t,...n})=>Lr({queryKey:e,queryFn:async r=>{var i;try{const s=r.queryKey[1];return await t(s)}catch(s){throw Pe({variant:"destructive",title:"Error",description:D0(Xp(s)?(i=s.response)==null?void 0:i.data:s)}),null}},...n});var Te;(function(e){e.assertEqual=i=>{};function t(i){}e.assertIs=t;function n(i){throw new Error}e.assertNever=n,e.arrayToEnum=i=>{const s={};for(const o of i)s[o]=o;return s},e.getValidEnumValues=i=>{const s=e.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),o={};for(const a of s)o[a]=i[a];return e.objectValues(o)},e.objectValues=i=>e.objectKeys(i).map(function(s){return i[s]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const s=[];for(const o in i)Object.prototype.hasOwnProperty.call(i,o)&&s.push(o);return s},e.find=(i,s)=>{for(const o of i)if(s(o))return o},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,s=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(s)}e.joinValues=r,e.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(Te||(Te={}));var Jd;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(Jd||(Jd={}));const J=Te.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Zt=e=>{switch(typeof e){case"undefined":return J.undefined;case"string":return J.string;case"number":return Number.isNaN(e)?J.nan:J.number;case"boolean":return J.boolean;case"function":return J.function;case"bigint":return J.bigint;case"symbol":return J.symbol;case"object":return Array.isArray(e)?J.array:e===null?J.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?J.promise:typeof Map<"u"&&e instanceof Map?J.map:typeof Set<"u"&&e instanceof Set?J.set:typeof Date<"u"&&e instanceof Date?J.date:J.object;default:return J.unknown}},H=Te.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Bt extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){const n=t||function(s){return s.message},r={_errors:[]},i=s=>{for(const o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let a=r,l=0;for(;l<o.path.length;){const d=o.path[l];l===o.path.length-1?(a[d]=a[d]||{_errors:[]},a[d]._errors.push(n(o))):a[d]=a[d]||{_errors:[]},a=a[d],l++}}};return i(this),r}static assert(t){if(!(t instanceof Bt))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Te.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const i of this.issues)if(i.path.length>0){const s=i.path[0];n[s]=n[s]||[],n[s].push(t(i))}else r.push(t(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Bt.create=e=>new Bt(e);const Na=(e,t)=>{let n;switch(e.code){case H.invalid_type:e.received===J.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case H.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Te.jsonStringifyReplacer)}`;break;case H.unrecognized_keys:n=`Unrecognized key(s) in object: ${Te.joinValues(e.keys,", ")}`;break;case H.invalid_union:n="Invalid input";break;case H.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Te.joinValues(e.options)}`;break;case H.invalid_enum_value:n=`Invalid enum value. Expected ${Te.joinValues(e.options)}, received '${e.received}'`;break;case H.invalid_arguments:n="Invalid function arguments";break;case H.invalid_return_type:n="Invalid function return type";break;case H.invalid_date:n="Invalid date";break;case H.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Te.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case H.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case H.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case H.custom:n="Invalid input";break;case H.invalid_intersection_types:n="Intersection results could not be merged";break;case H.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case H.not_finite:n="Number must be finite";break;default:n=t.defaultError,Te.assertNever(e)}return{message:n}};let M0=Na;function I0(){return M0}const F0=e=>{const{data:t,path:n,errorMaps:r,issueData:i}=e,s=[...n,...i.path||[]],o={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let a="";const l=r.filter(d=>!!d).slice().reverse();for(const d of l)a=d(o,{data:t,defaultError:a}).message;return{...i,path:s,message:a}};function Z(e,t){const n=I0(),r=F0({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Na?void 0:Na].filter(i=>!!i)});e.common.issues.push(r)}class st{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const i of n){if(i.status==="aborted")return ue;i.status==="dirty"&&t.dirty(),r.push(i.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const i of n){const s=await i.key,o=await i.value;r.push({key:s,value:o})}return st.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const i of n){const{key:s,value:o}=i;if(s.status==="aborted"||o.status==="aborted")return ue;s.status==="dirty"&&t.dirty(),o.status==="dirty"&&t.dirty(),s.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(r[s.value]=o.value)}return{status:t.value,value:r}}}const ue=Object.freeze({status:"aborted"}),Gr=e=>({status:"dirty",value:e}),ft=e=>({status:"valid",value:e}),eu=e=>e.status==="aborted",tu=e=>e.status==="dirty",_r=e=>e.status==="valid",Ps=e=>typeof Promise<"u"&&e instanceof Promise;var te;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(te||(te={}));class pn{constructor(t,n,r,i){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const nu=(e,t)=>{if(_r(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Bt(e.common.issues);return this._error=n,this._error}}};function me(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(o,a)=>{const{message:l}=e;return o.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??r??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:l??n??a.defaultError}},description:i}}class Se{get description(){return this._def.description}_getType(t){return Zt(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Zt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new st,ctx:{common:t.parent.common,data:t.data,parsedType:Zt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(Ps(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){const r={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Zt(t)},i=this._parseSync({data:t,path:r.path,parent:r});return nu(r,i)}"~validate"(t){var r,i;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Zt(t)};if(!this["~standard"].async)try{const s=this._parseSync({data:t,path:[],parent:n});return _r(s)?{value:s.value}:{issues:n.common.issues}}catch(s){(i=(r=s==null?void 0:s.message)==null?void 0:r.toLowerCase())!=null&&i.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(s=>_r(s)?{value:s.value}:{issues:n.common.issues})}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Zt(t)},i=this._parse({data:t,path:r.path,parent:r}),s=await(Ps(i)?i:Promise.resolve(i));return nu(r,s)}refine(t,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,s)=>{const o=t(i),a=()=>s.addIssue({code:H.custom,...r(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(t,n){return this._refinement((r,i)=>t(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(t){return new Cr({schema:this,typeName:fe.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return ln.create(this,this._def)}nullable(){return Pr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Rt.create(this)}promise(){return Os.create(this,this._def)}or(t){return ks.create([this,t],this._def)}and(t){return As.create(this,t,this._def)}transform(t){return new Cr({...me(this._def),schema:this,typeName:fe.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new Da({...me(this._def),innerType:this,defaultValue:n,typeName:fe.ZodDefault})}brand(){return new aP({typeName:fe.ZodBranded,type:this,...me(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new ja({...me(this._def),innerType:this,catchValue:n,typeName:fe.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Yc.create(this,t)}readonly(){return Ma.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const U0=/^c[^\s-]{8,}$/i,B0=/^[0-9a-z]+$/,W0=/^[0-9A-HJKMNP-TV-Z]{26}$/i,$0=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,V0=/^[a-z0-9_-]{21}$/i,H0=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,z0=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,K0=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,G0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Fo;const q0=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Q0=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Y0=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Z0=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,X0=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,J0=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nh="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",eP=new RegExp(`^${nh}$`);function rh(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function tP(e){return new RegExp(`^${rh(e)}$`)}function nP(e){let t=`${nh}T${rh(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function rP(e,t){return!!((t==="v4"||!t)&&q0.test(e)||(t==="v6"||!t)&&Y0.test(e))}function iP(e,t){if(!H0.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(atob(r));return!(typeof i!="object"||i===null||"typ"in i&&(i==null?void 0:i.typ)!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}function sP(e,t){return!!((t==="v4"||!t)&&Q0.test(e)||(t==="v6"||!t)&&Z0.test(e))}class on extends Se{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==J.string){const s=this._getOrReturnCtx(t);return Z(s,{code:H.invalid_type,expected:J.string,received:s.parsedType}),ue}const r=new st;let i;for(const s of this._def.checks)if(s.kind==="min")t.data.length<s.value&&(i=this._getOrReturnCtx(t,i),Z(i,{code:H.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")t.data.length>s.value&&(i=this._getOrReturnCtx(t,i),Z(i,{code:H.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){const o=t.data.length>s.value,a=t.data.length<s.value;(o||a)&&(i=this._getOrReturnCtx(t,i),o?Z(i,{code:H.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&Z(i,{code:H.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")K0.test(t.data)||(i=this._getOrReturnCtx(t,i),Z(i,{validation:"email",code:H.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")Fo||(Fo=new RegExp(G0,"u")),Fo.test(t.data)||(i=this._getOrReturnCtx(t,i),Z(i,{validation:"emoji",code:H.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")$0.test(t.data)||(i=this._getOrReturnCtx(t,i),Z(i,{validation:"uuid",code:H.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")V0.test(t.data)||(i=this._getOrReturnCtx(t,i),Z(i,{validation:"nanoid",code:H.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")U0.test(t.data)||(i=this._getOrReturnCtx(t,i),Z(i,{validation:"cuid",code:H.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")B0.test(t.data)||(i=this._getOrReturnCtx(t,i),Z(i,{validation:"cuid2",code:H.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")W0.test(t.data)||(i=this._getOrReturnCtx(t,i),Z(i,{validation:"ulid",code:H.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),Z(i,{validation:"url",code:H.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),Z(i,{validation:"regex",code:H.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?t.data=t.data.trim():s.kind==="includes"?t.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(t,i),Z(i,{code:H.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?t.data=t.data.toLowerCase():s.kind==="toUpperCase"?t.data=t.data.toUpperCase():s.kind==="startsWith"?t.data.startsWith(s.value)||(i=this._getOrReturnCtx(t,i),Z(i,{code:H.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?t.data.endsWith(s.value)||(i=this._getOrReturnCtx(t,i),Z(i,{code:H.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?nP(s).test(t.data)||(i=this._getOrReturnCtx(t,i),Z(i,{code:H.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?eP.test(t.data)||(i=this._getOrReturnCtx(t,i),Z(i,{code:H.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?tP(s).test(t.data)||(i=this._getOrReturnCtx(t,i),Z(i,{code:H.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?z0.test(t.data)||(i=this._getOrReturnCtx(t,i),Z(i,{validation:"duration",code:H.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?rP(t.data,s.version)||(i=this._getOrReturnCtx(t,i),Z(i,{validation:"ip",code:H.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?iP(t.data,s.alg)||(i=this._getOrReturnCtx(t,i),Z(i,{validation:"jwt",code:H.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?sP(t.data,s.version)||(i=this._getOrReturnCtx(t,i),Z(i,{validation:"cidr",code:H.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?X0.test(t.data)||(i=this._getOrReturnCtx(t,i),Z(i,{validation:"base64",code:H.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?J0.test(t.data)||(i=this._getOrReturnCtx(t,i),Z(i,{validation:"base64url",code:H.invalid_string,message:s.message}),r.dirty()):Te.assertNever(s);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(i=>t.test(i),{validation:n,code:H.invalid_string,...te.errToObj(r)})}_addCheck(t){return new on({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...te.errToObj(t)})}url(t){return this._addCheck({kind:"url",...te.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...te.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...te.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...te.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...te.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...te.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...te.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...te.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...te.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...te.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...te.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...te.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(t==null?void 0:t.offset)??!1,local:(t==null?void 0:t.local)??!1,...te.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...te.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...te.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...te.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...te.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...te.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...te.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...te.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...te.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...te.errToObj(n)})}nonempty(t){return this.min(1,te.errToObj(t))}trim(){return new on({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new on({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new on({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}on.create=e=>new on({checks:[],typeName:fe.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...me(e)});function oP(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,i=n>r?n:r,s=Number.parseInt(e.toFixed(i).replace(".","")),o=Number.parseInt(t.toFixed(i).replace(".",""));return s%o/10**i}class Sr extends Se{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==J.number){const s=this._getOrReturnCtx(t);return Z(s,{code:H.invalid_type,expected:J.number,received:s.parsedType}),ue}let r;const i=new st;for(const s of this._def.checks)s.kind==="int"?Te.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),Z(r,{code:H.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(r=this._getOrReturnCtx(t,r),Z(r,{code:H.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),Z(r,{code:H.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?oP(t.data,s.value)!==0&&(r=this._getOrReturnCtx(t,r),Z(r,{code:H.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),Z(r,{code:H.not_finite,message:s.message}),i.dirty()):Te.assertNever(s);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,te.toString(n))}gt(t,n){return this.setLimit("min",t,!1,te.toString(n))}lte(t,n){return this.setLimit("max",t,!0,te.toString(n))}lt(t,n){return this.setLimit("max",t,!1,te.toString(n))}setLimit(t,n,r,i){return new Sr({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:te.toString(i)}]})}_addCheck(t){return new Sr({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:te.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:te.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:te.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:te.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:te.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:te.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:te.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:te.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:te.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Te.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}}Sr.create=e=>new Sr({checks:[],typeName:fe.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...me(e)});class si extends Se{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==J.bigint)return this._getInvalidInput(t);let r;const i=new st;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(r=this._getOrReturnCtx(t,r),Z(r,{code:H.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),Z(r,{code:H.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?t.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),Z(r,{code:H.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):Te.assertNever(s);return{status:i.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return Z(n,{code:H.invalid_type,expected:J.bigint,received:n.parsedType}),ue}gte(t,n){return this.setLimit("min",t,!0,te.toString(n))}gt(t,n){return this.setLimit("min",t,!1,te.toString(n))}lte(t,n){return this.setLimit("max",t,!0,te.toString(n))}lt(t,n){return this.setLimit("max",t,!1,te.toString(n))}setLimit(t,n,r,i){return new si({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:te.toString(i)}]})}_addCheck(t){return new si({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:te.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:te.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:te.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:te.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:te.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}si.create=e=>new si({checks:[],typeName:fe.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...me(e)});class Ra extends Se{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==J.boolean){const r=this._getOrReturnCtx(t);return Z(r,{code:H.invalid_type,expected:J.boolean,received:r.parsedType}),ue}return ft(t.data)}}Ra.create=e=>new Ra({typeName:fe.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...me(e)});class Es extends Se{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==J.date){const s=this._getOrReturnCtx(t);return Z(s,{code:H.invalid_type,expected:J.date,received:s.parsedType}),ue}if(Number.isNaN(t.data.getTime())){const s=this._getOrReturnCtx(t);return Z(s,{code:H.invalid_date}),ue}const r=new st;let i;for(const s of this._def.checks)s.kind==="min"?t.data.getTime()<s.value&&(i=this._getOrReturnCtx(t,i),Z(i,{code:H.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?t.data.getTime()>s.value&&(i=this._getOrReturnCtx(t,i),Z(i,{code:H.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):Te.assertNever(s);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Es({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:te.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:te.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}}Es.create=e=>new Es({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:fe.ZodDate,...me(e)});class ru extends Se{_parse(t){if(this._getType(t)!==J.symbol){const r=this._getOrReturnCtx(t);return Z(r,{code:H.invalid_type,expected:J.symbol,received:r.parsedType}),ue}return ft(t.data)}}ru.create=e=>new ru({typeName:fe.ZodSymbol,...me(e)});class iu extends Se{_parse(t){if(this._getType(t)!==J.undefined){const r=this._getOrReturnCtx(t);return Z(r,{code:H.invalid_type,expected:J.undefined,received:r.parsedType}),ue}return ft(t.data)}}iu.create=e=>new iu({typeName:fe.ZodUndefined,...me(e)});class su extends Se{_parse(t){if(this._getType(t)!==J.null){const r=this._getOrReturnCtx(t);return Z(r,{code:H.invalid_type,expected:J.null,received:r.parsedType}),ue}return ft(t.data)}}su.create=e=>new su({typeName:fe.ZodNull,...me(e)});class ou extends Se{constructor(){super(...arguments),this._any=!0}_parse(t){return ft(t.data)}}ou.create=e=>new ou({typeName:fe.ZodAny,...me(e)});class au extends Se{constructor(){super(...arguments),this._unknown=!0}_parse(t){return ft(t.data)}}au.create=e=>new au({typeName:fe.ZodUnknown,...me(e)});class mn extends Se{_parse(t){const n=this._getOrReturnCtx(t);return Z(n,{code:H.invalid_type,expected:J.never,received:n.parsedType}),ue}}mn.create=e=>new mn({typeName:fe.ZodNever,...me(e)});class cu extends Se{_parse(t){if(this._getType(t)!==J.undefined){const r=this._getOrReturnCtx(t);return Z(r,{code:H.invalid_type,expected:J.void,received:r.parsedType}),ue}return ft(t.data)}}cu.create=e=>new cu({typeName:fe.ZodVoid,...me(e)});class Rt extends Se{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),i=this._def;if(n.parsedType!==J.array)return Z(n,{code:H.invalid_type,expected:J.array,received:n.parsedType}),ue;if(i.exactLength!==null){const o=n.data.length>i.exactLength.value,a=n.data.length<i.exactLength.value;(o||a)&&(Z(n,{code:o?H.too_big:H.too_small,minimum:a?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&(Z(n,{code:H.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&(Z(n,{code:H.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,a)=>i.type._parseAsync(new pn(n,o,n.path,a)))).then(o=>st.mergeArray(r,o));const s=[...n.data].map((o,a)=>i.type._parseSync(new pn(n,o,n.path,a)));return st.mergeArray(r,s)}get element(){return this._def.type}min(t,n){return new Rt({...this._def,minLength:{value:t,message:te.toString(n)}})}max(t,n){return new Rt({...this._def,maxLength:{value:t,message:te.toString(n)}})}length(t,n){return new Rt({...this._def,exactLength:{value:t,message:te.toString(n)}})}nonempty(t){return this.min(1,t)}}Rt.create=(e,t)=>new Rt({type:e,minLength:null,maxLength:null,exactLength:null,typeName:fe.ZodArray,...me(t)});function Jn(e){if(e instanceof Me){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=ln.create(Jn(r))}return new Me({...e._def,shape:()=>t})}else return e instanceof Rt?new Rt({...e._def,type:Jn(e.element)}):e instanceof ln?ln.create(Jn(e.unwrap())):e instanceof Pr?Pr.create(Jn(e.unwrap())):e instanceof Bn?Bn.create(e.items.map(t=>Jn(t))):e}class Me extends Se{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=Te.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==J.object){const d=this._getOrReturnCtx(t);return Z(d,{code:H.invalid_type,expected:J.object,received:d.parsedType}),ue}const{status:r,ctx:i}=this._processInputParams(t),{shape:s,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof mn&&this._def.unknownKeys==="strip"))for(const d in i.data)o.includes(d)||a.push(d);const l=[];for(const d of o){const u=s[d],f=i.data[d];l.push({key:{status:"valid",value:d},value:u._parse(new pn(i,f,i.path,d)),alwaysSet:d in i.data})}if(this._def.catchall instanceof mn){const d=this._def.unknownKeys;if(d==="passthrough")for(const u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(d==="strict")a.length>0&&(Z(i,{code:H.unrecognized_keys,keys:a}),r.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const d=this._def.catchall;for(const u of a){const f=i.data[u];l.push({key:{status:"valid",value:u},value:d._parse(new pn(i,f,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const d=[];for(const u of l){const f=await u.key,m=await u.value;d.push({key:f,value:m,alwaysSet:u.alwaysSet})}return d}).then(d=>st.mergeObjectSync(r,d)):st.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return te.errToObj,new Me({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var s,o;const i=((o=(s=this._def).errorMap)==null?void 0:o.call(s,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:te.errToObj(t).message??i}:{message:i}}}:{}})}strip(){return new Me({...this._def,unknownKeys:"strip"})}passthrough(){return new Me({...this._def,unknownKeys:"passthrough"})}extend(t){return new Me({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Me({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:fe.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new Me({...this._def,catchall:t})}pick(t){const n={};for(const r of Te.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new Me({...this._def,shape:()=>n})}omit(t){const n={};for(const r of Te.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new Me({...this._def,shape:()=>n})}deepPartial(){return Jn(this)}partial(t){const n={};for(const r of Te.objectKeys(this.shape)){const i=this.shape[r];t&&!t[r]?n[r]=i:n[r]=i.optional()}return new Me({...this._def,shape:()=>n})}required(t){const n={};for(const r of Te.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof ln;)s=s._def.innerType;n[r]=s}return new Me({...this._def,shape:()=>n})}keyof(){return ih(Te.objectKeys(this.shape))}}Me.create=(e,t)=>new Me({shape:()=>e,unknownKeys:"strip",catchall:mn.create(),typeName:fe.ZodObject,...me(t)});Me.strictCreate=(e,t)=>new Me({shape:()=>e,unknownKeys:"strict",catchall:mn.create(),typeName:fe.ZodObject,...me(t)});Me.lazycreate=(e,t)=>new Me({shape:e,unknownKeys:"strip",catchall:mn.create(),typeName:fe.ZodObject,...me(t)});class ks extends Se{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function i(s){for(const a of s)if(a.result.status==="valid")return a.result;for(const a of s)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const o=s.map(a=>new Bt(a.ctx.common.issues));return Z(n,{code:H.invalid_union,unionErrors:o}),ue}if(n.common.async)return Promise.all(r.map(async s=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(i);{let s;const o=[];for(const l of r){const d={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:d});if(u.status==="valid")return u;u.status==="dirty"&&!s&&(s={result:u,ctx:d}),d.common.issues.length&&o.push(d.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;const a=o.map(l=>new Bt(l));return Z(n,{code:H.invalid_union,unionErrors:a}),ue}}get options(){return this._def.options}}ks.create=(e,t)=>new ks({options:e,typeName:fe.ZodUnion,...me(t)});function La(e,t){const n=Zt(e),r=Zt(t);if(e===t)return{valid:!0,data:e};if(n===J.object&&r===J.object){const i=Te.objectKeys(t),s=Te.objectKeys(e).filter(a=>i.indexOf(a)!==-1),o={...e,...t};for(const a of s){const l=La(e[a],t[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}else if(n===J.array&&r===J.array){if(e.length!==t.length)return{valid:!1};const i=[];for(let s=0;s<e.length;s++){const o=e[s],a=t[s],l=La(o,a);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return n===J.date&&r===J.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class As extends Se{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=(s,o)=>{if(eu(s)||eu(o))return ue;const a=La(s.value,o.value);return a.valid?((tu(s)||tu(o))&&n.dirty(),{status:n.value,value:a.data}):(Z(r,{code:H.invalid_intersection_types}),ue)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,o])=>i(s,o)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}As.create=(e,t,n)=>new As({left:e,right:t,typeName:fe.ZodIntersection,...me(n)});class Bn extends Se{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==J.array)return Z(r,{code:H.invalid_type,expected:J.array,received:r.parsedType}),ue;if(r.data.length<this._def.items.length)return Z(r,{code:H.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ue;!this._def.rest&&r.data.length>this._def.items.length&&(Z(r,{code:H.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...r.data].map((o,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new pn(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(s).then(o=>st.mergeArray(n,o)):st.mergeArray(n,s)}get items(){return this._def.items}rest(t){return new Bn({...this._def,rest:t})}}Bn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Bn({items:e,typeName:fe.ZodTuple,rest:null,...me(t)})};class lu extends Se{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==J.map)return Z(r,{code:H.invalid_type,expected:J.map,received:r.parsedType}),ue;const i=this._def.keyType,s=this._def.valueType,o=[...r.data.entries()].map(([a,l],d)=>({key:i._parse(new pn(r,a,r.path,[d,"key"])),value:s._parse(new pn(r,l,r.path,[d,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of o){const d=await l.key,u=await l.value;if(d.status==="aborted"||u.status==="aborted")return ue;(d.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(d.value,u.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of o){const d=l.key,u=l.value;if(d.status==="aborted"||u.status==="aborted")return ue;(d.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(d.value,u.value)}return{status:n.value,value:a}}}}lu.create=(e,t,n)=>new lu({valueType:t,keyType:e,typeName:fe.ZodMap,...me(n)});class oi extends Se{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==J.set)return Z(r,{code:H.invalid_type,expected:J.set,received:r.parsedType}),ue;const i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(Z(r,{code:H.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(Z(r,{code:H.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const s=this._def.valueType;function o(l){const d=new Set;for(const u of l){if(u.status==="aborted")return ue;u.status==="dirty"&&n.dirty(),d.add(u.value)}return{status:n.value,value:d}}const a=[...r.data.values()].map((l,d)=>s._parse(new pn(r,l,r.path,d)));return r.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(t,n){return new oi({...this._def,minSize:{value:t,message:te.toString(n)}})}max(t,n){return new oi({...this._def,maxSize:{value:t,message:te.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}oi.create=(e,t)=>new oi({valueType:e,minSize:null,maxSize:null,typeName:fe.ZodSet,...me(t)});class du extends Se{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}du.create=(e,t)=>new du({getter:e,typeName:fe.ZodLazy,...me(t)});class uu extends Se{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return Z(n,{received:n.data,code:H.invalid_literal,expected:this._def.value}),ue}return{status:"valid",value:t.data}}get value(){return this._def.value}}uu.create=(e,t)=>new uu({value:e,typeName:fe.ZodLiteral,...me(t)});function ih(e,t){return new Tr({values:e,typeName:fe.ZodEnum,...me(t)})}class Tr extends Se{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return Z(n,{expected:Te.joinValues(r),received:n.parsedType,code:H.invalid_type}),ue}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return Z(n,{received:n.data,code:H.invalid_enum_value,options:r}),ue}return ft(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return Tr.create(t,{...this._def,...n})}exclude(t,n=this._def){return Tr.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}Tr.create=ih;class fu extends Se{_parse(t){const n=Te.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==J.string&&r.parsedType!==J.number){const i=Te.objectValues(n);return Z(r,{expected:Te.joinValues(i),received:r.parsedType,code:H.invalid_type}),ue}if(this._cache||(this._cache=new Set(Te.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const i=Te.objectValues(n);return Z(r,{received:r.data,code:H.invalid_enum_value,options:i}),ue}return ft(t.data)}get enum(){return this._def.values}}fu.create=(e,t)=>new fu({values:e,typeName:fe.ZodNativeEnum,...me(t)});class Os extends Se{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==J.promise&&n.common.async===!1)return Z(n,{code:H.invalid_type,expected:J.promise,received:n.parsedType}),ue;const r=n.parsedType===J.promise?n.data:Promise.resolve(n.data);return ft(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Os.create=(e,t)=>new Os({type:e,typeName:fe.ZodPromise,...me(t)});class Cr extends Se{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===fe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=this._def.effect||null,s={addIssue:o=>{Z(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){const o=i.transform(r.data,s);if(r.common.async)return Promise.resolve(o).then(async a=>{if(n.value==="aborted")return ue;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?ue:l.status==="dirty"||n.value==="dirty"?Gr(l.value):l});{if(n.value==="aborted")return ue;const a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?ue:a.status==="dirty"||n.value==="dirty"?Gr(a.value):a}}if(i.type==="refinement"){const o=a=>{const l=i.refinement(a,s);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?ue:(a.status==="dirty"&&n.dirty(),o(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?ue:(a.status==="dirty"&&n.dirty(),o(a.value).then(()=>({status:n.value,value:a.value}))))}if(i.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!_r(o))return ue;const a=i.transform(o.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>_r(o)?Promise.resolve(i.transform(o.value,s)).then(a=>({status:n.value,value:a})):ue);Te.assertNever(i)}}Cr.create=(e,t,n)=>new Cr({schema:e,typeName:fe.ZodEffects,effect:t,...me(n)});Cr.createWithPreprocess=(e,t,n)=>new Cr({schema:t,effect:{type:"preprocess",transform:e},typeName:fe.ZodEffects,...me(n)});class ln extends Se{_parse(t){return this._getType(t)===J.undefined?ft(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}ln.create=(e,t)=>new ln({innerType:e,typeName:fe.ZodOptional,...me(t)});class Pr extends Se{_parse(t){return this._getType(t)===J.null?ft(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Pr.create=(e,t)=>new Pr({innerType:e,typeName:fe.ZodNullable,...me(t)});class Da extends Se{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===J.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Da.create=(e,t)=>new Da({innerType:e,typeName:fe.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...me(t)});class ja extends Se{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Ps(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Bt(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Bt(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}ja.create=(e,t)=>new ja({innerType:e,typeName:fe.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...me(t)});class pu extends Se{_parse(t){if(this._getType(t)!==J.nan){const r=this._getOrReturnCtx(t);return Z(r,{code:H.invalid_type,expected:J.nan,received:r.parsedType}),ue}return{status:"valid",value:t.data}}}pu.create=e=>new pu({typeName:fe.ZodNaN,...me(e)});class aP extends Se{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class Yc extends Se{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?ue:s.status==="dirty"?(n.dirty(),Gr(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?ue:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(t,n){return new Yc({in:t,out:n,typeName:fe.ZodPipeline})}}class Ma extends Se{_parse(t){const n=this._def.innerType._parse(t),r=i=>(_r(i)&&(i.value=Object.freeze(i.value)),i);return Ps(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}}Ma.create=(e,t)=>new Ma({innerType:e,typeName:fe.ZodReadonly,...me(t)});var fe;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(fe||(fe={}));const Uo=on.create,zi=Sr.create,cP=Ra.create;mn.create;Rt.create;const lP=Me.create;ks.create;As.create;Bn.create;Tr.create;Os.create;ln.create;Pr.create;const dP="https://api.opheleo.com",uP="Bearer ",fP="Authorization";lP({id:Uo(),userId:Uo(),createdAt:zi(),updatedAt:zi(),active:cP(),perDayUsage:zi(),userEmail:Uo().email(),maxPerDayUsage:zi()});async function pP(e,t,n){const r=typeof window<"u"?localStorage.getItem("session_token"):null;return(await Re({baseURL:xr(n??dP),url:e,method:t,headers:r?{[fP]:`${uP}${r}`}:void 0})).data}async function mP(e){return pP("/iccandle/v1/iccandle-user-usage/me","get",e)}const hP=e=>{const t=e==null?void 0:e.platformApiBase;return j0({queryKey:["iccandle-user-usage",t],queryFn:()=>mP(t),...e})},gP=S.createContext(null);function yP(){const e=S.useContext(gP);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function bP({controlsRef:e,onSymbolTickerChange:t,onScanResultUrlChange:n,onChartWidgetChange:r,onChartContainerChange:i,selectSymbolTickerRef:s,headerSlot:o}){const{resolvedTheme:a}=yP(),l=ut(),d=Ti(),u=S.useRef([]),f=S.useRef(null),m=S.useRef(a),p=S.useRef(null),b=S.useRef(null),h=S.useMemo(()=>Cs(d),[d]),g=S.useRef(h),y=S.useRef("60"),{setGapCount:v,setReplayMode:_}=eh();S.useEffect(()=>{v(0),_(!1)},[v,_]),S.useEffect(()=>{rs()&&O(!0)},[]);const[x,T]=S.useState(null),[C,O]=S.useState(!1),[P,L]=S.useState(null),I=S.useCallback(D=>{if(D===g.current)return;const R=d.find(F=>F.ticker===D);if(!R)return;g.current=D,localStorage.setItem(er,D),t(D);const W=f.current;if(W)try{W.onChartReady(()=>{W.activeChart().setSymbol(R.ticker)})}catch{}},[t,d]);S.useEffect(()=>(s.current=I,()=>{s.current=null}),[I,s]);const U=S.useRef([]),N=S.useMemo(()=>new R0(U,"selector",d,l.tickWebSocketUrl),[l.tickWebSocketUrl,d]),{data:V,isLoading:M}=hP({enabled:!0,platformApiBase:l.platformApiBase}),z=!M&&V?V.perDayUsage>=V.maxPerDayUsage:!1;S.useEffect(()=>{i(x)},[x,i]),S.useEffect(()=>{r(P)},[P,r]),S.useEffect(()=>{if(!C||!x)return;if(f.current){L(null),r(null);try{f.current.remove()}catch{}f.current=null}const D=Cs(d);g.current=D,y.current="60";const R=Jm();if(!R)return;const W=new R({container:x,library_path:"/charting_library/",datafeed:N,symbol:D,interval:"60",autosize:!0,theme:m.current,disabled_features:["symbol_info","legend_inplace_edit","header_quick_search","header_compare"],enabled_features:["header_chart_type","show_symbol_logos","show_symbol_logo_in_legend"],custom_indicators_getter:()=>L0(u),drawings_access:{type:"black",tools:[{name:"Date Range"}]},locale:"en",timezone:vg(),overrides:{priceScaleSelectionStrategyName:"right","scalesProperties.showSeriesLastValue":!0}});let F=!1;return f.current=W,W.onChartReady(()=>{F||f.current!==W||L(W)}),()=>{if(F=!0,L(null),r(null),f.current){try{f.current.remove()}catch{}f.current=null}}},[x,N,r,C]),S.useEffect(()=>{if(!P)return;let D=!1;try{P.onChartReady(()=>{D||(async()=>{try{const R=P.activeChart(),W=await R.createStudy("Generated Candles - By iC Candle",!0,!0);if(D||(W&&R.bringToFront([W]),await P.headerReady(),D)||(await new Promise(X=>{setTimeout(()=>{if(!D)try{R.clearMarks(2)}catch{}X(!0)},150)}),D))return;localStorage.setItem("tv:selected-news-events","[]"),R.refreshMarks();const F=X=>{const de=R.symbol(),ne=Pa(de,d,h);ne!==g.current&&(n(null),u.current=[]);try{P.resetCache()}catch{}g.current=ne,localStorage.setItem(er,ne),t(ne)},G=X=>{X!==y.current&&(n(null),u.current=[]);try{P.resetCache()}catch{}y.current=X};p.current=F,b.current=G,R.onSymbolChanged().subscribe(null,F),R.onIntervalChanged().subscribe(null,G)}catch{}})()})}catch{}return()=>{D=!0,p.current=null,b.current=null}},[P,e,n,t,h,d]),S.useEffect(()=>{if(!P||!a)return;let D=!1;try{P.onChartReady(()=>{D||P.changeTheme(a).catch(()=>{})})}catch{}return()=>{D=!0}},[P,a]);const k=S.useCallback(()=>{O(!0)},[]),j=z?c.jsx("div",{className:"web-trading-widget-advanced__scan-limit-wrap",children:c.jsxs(_0,{variant:"destructive",className:"web-trading-widget-advanced__scan-limit-badge",children:[c.jsx("span",{className:"web-trading-widget-advanced__scan-limit-badge-title",children:"Daily scan limit reached"}),V&&c.jsxs("span",{className:"web-trading-widget-advanced__scan-limit-badge-count",children:[V.perDayUsage," of ",V.maxPerDayUsage," scans used today"]})]})}):null;return c.jsxs(c.Fragment,{children:[o??j,c.jsx(S0,{onLoad:k}),c.jsx("div",{ref:T,className:"web-trading-widget-advanced__container"})]})}const sh=S.createContext(null);function mu({value:e,children:t}){return c.jsx(sh.Provider,{value:e,children:t})}function vP(){const e=S.useContext(sh);if(!e)throw new Error("useWidgetChartSlot must be used within WidgetChartSlotProvider");return e}function Ki(e,t){return e.toFixed(t)}function wP({symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:i,minVolumeLots:s,isSubmitting:o,isAccountsLoading:a,selectedLogin:l,isDragging:d,isCollapsed:u,onToggleCollapsed:f,onDragHandlePointerDown:m,onPlaceOrder:p}){const{t:b}=Le(),[h,g]=S.useState(!0),y=u??h,v=()=>{f==null||f(),u===void 0&&g(j=>!j)},_=le(j=>j.setOrderSide),x=le(j=>j.setVolumeLots),T=le(j=>j.volumeLots),[C,O]=S.useState(String(T||r));S.useEffect(()=>{y||O(Ki(T,2))},[y,T]);const P=Number(Vt(Ht(e))),L=t!==null?Ce(t,P):"—",I=n!==null?Ce(n,P):"—",N=!o&&!a&&l!==""&&(t!==null&&n!==null),V=j=>{const D=Number(C),R=Number.isFinite(D)&&D>0?D:r,W=Math.max(s,R+j*i),F=Ki(W,2);O(F),x(W)},M=()=>{const j=Number(C);if(!Number.isFinite(j)||j<=0){O(Ki(r,2)),x(r);return}const D=Math.max(s,j),R=Ki(D,2);O(R),x(D)},z=j=>{t===null||n===null||_({side:j,entryPrice:j==="buy"?n:t})},k=j=>{if(t===null||n===null||!l)return;const D=Number(C),R=Math.max(s,Number.isFinite(D)&&D>0?D:r);_({side:j,entryPrice:j==="buy"?n:t}),p({login:l,side:j,volumeLots:R,bid:t,ask:n})};return c.jsx("div",{className:"web-trading-widget-mini-order web-trading-widget-mini-order--expanded",children:c.jsxs("div",{className:"web-trading-widget-mini-order__row",children:[c.jsx("button",{type:"button","aria-label":b("WebTrading.moveQuickOrderPanel"),onPointerDown:m,className:`web-trading-widget-mini-order__drag-handle${d?" web-trading-widget-mini-order__drag-handle--grabbing":""}`,children:c.jsx(pp,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2})}),c.jsxs(c.Fragment,{children:[c.jsxs("button",{type:"button",disabled:!N,className:"web-trading-widget-mini-order__side-btn web-trading-widget-mini-order__side-btn--sell",onMouseDown:()=>z("sell"),onClick:()=>k("sell"),children:[c.jsx("span",{className:"web-trading-widget-mini-order__price",children:L}),c.jsx("span",{className:"web-trading-widget-mini-order__label web-trading-widget-mini-order__label--sell",children:b("WebTrading.sell").toUpperCase()})]}),c.jsxs("div",{className:"web-trading-widget-mini-order__volume",children:[c.jsx("button",{type:"button","aria-label":b("WebTrading.decreaseVolume"),disabled:!N,className:"web-trading-widget-mini-order__volume-btn",onClick:()=>V(-1),children:c.jsx(ms,{className:"web-trading-widget-icon web-trading-widget-icon--xs",strokeWidth:2.5})}),c.jsx("input",{type:"text",inputMode:"decimal",value:C,disabled:!N,onChange:j=>O(j.target.value),onBlur:M,className:"web-trading-widget-mini-order__volume-input"}),c.jsx("button",{type:"button","aria-label":b("WebTrading.increaseVolume"),disabled:!N,className:"web-trading-widget-mini-order__volume-btn",onClick:()=>V(1),children:c.jsx(Xo,{className:"web-trading-widget-icon web-trading-widget-icon--xs",strokeWidth:2.5})})]}),c.jsxs("button",{type:"button",disabled:!N,className:"web-trading-widget-mini-order__side-btn web-trading-widget-mini-order__side-btn--buy",onMouseDown:()=>z("buy"),onClick:()=>k("buy"),children:[c.jsx("span",{className:"web-trading-widget-mini-order__label web-trading-widget-mini-order__label--buy",children:b("WebTrading.buy").toUpperCase()}),c.jsx("span",{className:"web-trading-widget-mini-order__price",children:I})]})]}),c.jsx("button",{type:"button","aria-label":b(y?"WebTrading.expandQuickOrderPanel":"WebTrading.collapseQuickOrderPanel"),"aria-expanded":!y,className:"web-trading-widget-mini-order__toggle",onClick:v,children:y?c.jsx(ms,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2.5}):c.jsx(Xo,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2.5})})]})})}function Wr({title:e,isOpen:t,onToggle:n,children:r}){return c.jsxs("div",{className:"web-trading-widget-market-panel__accordion-item",children:[c.jsxs("button",{type:"button",className:`web-trading-widget-market-panel__accordion-trigger${t?" web-trading-widget-market-panel__accordion-trigger--open":""}`,"aria-expanded":t,onClick:n,children:[e,c.jsx(ms,{className:"web-trading-widget-icon web-trading-widget-icon--md web-trading-widget-text-muted"})]}),t?c.jsx("div",{className:"web-trading-widget-market-panel__accordion-content",children:r}):null]})}const xP=new Set(["volume-setting","risk-management"]);function _P({symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:i,minVolumeLots:s,isSubmitting:o,isAccountsLoading:a,selectedLogin:l,isDragging:d,onDragHandlePointerDown:u,onLayoutChange:f,onClose:m,onPlaceOrder:p}){const{t:b}=Le(),[h,g]=S.useState(!0),[y,v]=S.useState("market"),_=le(se=>se.volumeLots),[x,T]=S.useState(String(_||r)),[C,O]=S.useState(""),[P,L]=S.useState(""),I=le(se=>se.stopLoss),U=le(se=>se.takeProfit),N=le(se=>se.setStopLoss),V=le(se=>se.setTakeProfit),M=le(se=>se.setVolumeLots),z=le(se=>se.setOrderSide),[k,j]=S.useState(""),[D,R]=S.useState(Qe.GTC),[W,F]=S.useState(""),[G,X]=S.useState(""),[de,ne]=S.useState(()=>new Set(xP));S.useEffect(()=>{f()},[h,f]);const B=Number(Vt(Ht(e))),$=Or(B),Q=Cc(t,n),ye=t!==null?Ce(t,B):"—",ce=n!==null?Ce(n,B):"—",ee=qs(y),ae=gp(y),ke=Gs(y),K=b(ys[y]),xe=!ee&&ke.orderType!==null&&ke.orderType%2===1,re=S.useMemo(()=>Q!==null?Q:t??n,[n,t,Q]),_e=se=>{ne(et=>{const zt=new Set(et);return zt.has(se)?zt.delete(se):zt.add(se),zt})},Fe=se=>{T(se);const et=Number(se);Number.isFinite(et)&&et>0&&M(et)},He=se=>t===null||n===null?null:ee?se==="buy"?n:t:We(C)??(se==="buy"?n:t),pt=se=>{const et=He(se);et!==null&&z({side:se,entryPrice:et})},Dr=se=>{if(t===null||n===null||!l)return;const et=Math.max(s,Number(x)||s),zt=Jo(y,se),jr=He(se);jr!==null&&z({side:se,entryPrice:jr}),p({login:l,executionMode:y,side:se,orderType:zt,volumeLots:et,stopLoss:I,takeProfit:U,priceOrder:C,priceTrigger:P,comment:k,typeTime:D,expirationDateTime:W,expirationDay:G,bid:t,ask:n})},ie=t!==null&&n!==null,St=ee||We(C)!==void 0,lo=!ae||We(P)!==void 0,Pi=ee||Ys(D,W,G),jh=!o&&!a&&l!==""&&ie&&St&&lo&&Pi,Mh=!ee&&_c(D),Ih=!ee&&Sc(D),tl=()=>ke.orderType!==null&&ke.orderType%2===1?"sell":"buy";return c.jsxs("div",{className:`web-trading-widget-market-panel web-trading-widget-market-panel--modal${h?" web-trading-widget-market-panel--collapsed":""}`,children:[c.jsx(wP,{symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:i,minVolumeLots:s,isSubmitting:o,isAccountsLoading:a,selectedLogin:l,isDragging:d,isCollapsed:h,onToggleCollapsed:()=>g(se=>!se),onDragHandlePointerDown:u,onPlaceOrder:({login:se,side:et,volumeLots:zt,bid:jr,ask:nl})=>{jr===null||nl===null||p({login:se,executionMode:"market",side:et,orderType:Jo("market",et),volumeLots:zt,stopLoss:I,takeProfit:U,priceOrder:"",priceTrigger:"",comment:k,typeTime:D,expirationDateTime:"",expirationDay:"",bid:jr,ask:nl})}}),h?null:c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"web-trading-widget-market-panel__header",children:c.jsxs(fs,{value:y,onValueChange:se=>v(se),children:[c.jsx(Xr,{className:"web-trading-widget-market-panel__select-trigger","aria-label":b("WebTrading.orderExecutionType"),children:c.jsx(ps,{})}),c.jsx(Jr,{children:hs.map(se=>c.jsx(ei,{value:se.mode,children:b(ys[se.mode])},se.mode))})]})}),c.jsxs("div",{className:"web-trading-widget-market-panel__accordion",children:[c.jsx(Wr,{id:"volume-setting",title:b("WebTrading.volumeSetting"),isOpen:de.has("volume-setting"),onToggle:()=>_e("volume-setting"),children:c.jsx(je,{label:b("WebTrading.lots"),value:x,onChange:Fe,step:i,min:s,decimals:2})}),ee?null:c.jsx(Wr,{id:"order-price",title:b("WebTrading.orderPrice"),isOpen:de.has("order-price"),onToggle:()=>_e("order-price"),children:ae?c.jsxs(c.Fragment,{children:[c.jsx(je,{label:b("WebTrading.stopPrice"),value:P,onChange:L,step:$,decimals:B,basePrice:re,placeholder:Q!==null?Ce(Q,B):"—"}),c.jsx(je,{label:b("WebTrading.limitPrice"),value:C,onChange:O,step:$,decimals:B,basePrice:re,placeholder:Q!==null?Ce(Q,B):"—"})]}):c.jsx(je,{label:b("WebTrading.price"),value:C,onChange:O,step:$,decimals:B,basePrice:re,placeholder:Q!==null?Ce(Q,B):"—"})}),c.jsx(Wr,{id:"risk-management",title:b("WebTrading.riskManagement"),isOpen:de.has("risk-management"),onToggle:()=>_e("risk-management"),children:c.jsxs("div",{className:"web-trading-widget-market-panel__grid-2",children:[c.jsx(je,{label:b("WebTrading.stopLoss"),value:I,onChange:N,step:$,decimals:B,basePrice:t,placeholder:t!==null?ye:"—",clearable:!0}),c.jsx(je,{label:b("WebTrading.takeProfit"),value:U,onChange:V,step:$,decimals:B,basePrice:n,placeholder:n!==null?ce:"—",clearable:!0})]})}),ee?null:c.jsxs(Wr,{id:"expiration",title:b("WebTrading.expiration"),isOpen:de.has("expiration"),onToggle:()=>_e("expiration"),children:[c.jsx("select",{value:String(D),className:"web-trading-widget-market-panel__select-full","aria-label":b("WebTrading.orderExpirationType"),onChange:se=>R(Number(se.target.value)),children:yp.map(se=>c.jsx("option",{value:String(se.value),children:b(bp[se.value])},se.value))}),Mh?c.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[c.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:b("WebTrading.expirationTime")}),c.jsx("input",{type:"datetime-local",value:W,className:"web-trading-widget-market-panel__input",onChange:se=>F(se.target.value)})]}):null,Ih?c.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[c.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:b("WebTrading.expirationDay")}),c.jsx("input",{type:"date",value:G,className:"web-trading-widget-market-panel__input",onChange:se=>X(se.target.value)})]}):null]}),c.jsx(Wr,{id:"comment",title:b("WebTrading.comment"),isOpen:de.has("comment"),onToggle:()=>_e("comment"),children:c.jsx("input",{type:"text",value:k,className:"web-trading-widget-market-panel__input",placeholder:"",onChange:se=>j(se.target.value)})})]}),c.jsx("div",{className:"web-trading-widget-market-panel__footer",children:c.jsxs("div",{className:"web-trading-widget-market-panel__quotes",children:[c.jsx("span",{children:ye}),c.jsx("span",{className:"web-trading-widget-market-panel__quotes-ask",children:ce})]})}),!ee&&c.jsx("button",{type:"button",className:`web-trading-widget-market-panel__place-btn${xe?" web-trading-widget-market-panel__place-btn--sell":" web-trading-widget-market-panel__place-btn--buy"}`,disabled:!jh,onMouseDown:()=>pt(tl()),onClick:()=>Dr(tl()),children:b("WebTrading.placeOrder",{label:K})})]})]})}function SP({symbolTicker:e,chartWidget:t,orderState:n}){const r=Ti(),i=Dc(e),{panel:s,confirmation:o,isSubmitting:a,defaultVolumeLots:l,volumeStep:d,minVolumeLots:u,selectedLogin:f,isAccountsLoading:m,hasConfirmedAccount:p,closePanels:b,dismissConfirmation:h,placeMarketOrder:g}=n,y=pe(F=>F.positions),v=pe(F=>F.orders),_=pe(F=>F.selectedPositionTicket),x=pe(F=>F.selectedOrderTicket),T=pe(F=>F.setSelectedPositionTicket),C=pe(F=>F.setSelectedOrderTicket),O=_!==null?y.find(F=>F.ticket===_)??null:null,P=x!==null?v.find(F=>F.ticket===x)??null:null,L=O!==null||P!==null,I=p&&s==="confirmation"&&o!==null,U=p&&s!=="confirmation"&&s!=="closed"&&O===null&&P===null,{panelRef:N,position:V,isDragging:M,onDragStart:z,reclamp:k}=Sp({storageKey:"web-trading-widget-modal-exec-panel-position",defaultAlign:"top-right",isActive:U}),j=le(F=>F.setDraft),D=le(F=>F.clearDraft),R=Number(Vt(Ht(e))),W=Or(R);return S.useEffect(()=>{if(p&&!L){if(s==="closed"||s==="confirmation"){D();return}j({source:"new-order",symbolKey:mi(e,r),entryPrice:null,side:null,showEntryLine:!1,stopLoss:"",takeProfit:"",volumeLots:l,digits:R,priceStep:W})}},[D,l,R,p,s,W,j,L,e,r]),!p&&!L?null:c.jsxs("div",{className:"web-trading-widget-new-order-overlay-layer",children:[c.jsx(lm,{chartWidget:t,symbolTicker:e,symbols:r}),L&&O!==null?c.jsx("div",{className:"web-trading-widget-new-order-overlay web-trading-widget-new-order-overlay--news web-trading-widget-new-order-overlay--side-panel",children:c.jsx(Xm,{position:O,onClose:()=>T(null)})}):null,L&&P!==null?c.jsx("div",{className:"web-trading-widget-new-order-overlay web-trading-widget-new-order-overlay--news web-trading-widget-new-order-overlay--side-panel",children:c.jsx(Zm,{order:P,onClose:()=>C(null)})}):null,I&&o!==null?c.jsx("div",{className:"web-trading-widget-new-order-overlay web-trading-widget-new-order-overlay--news",children:c.jsx(Ym,{confirmation:o,symbolTicker:e,onDismiss:h})}):null,U?c.jsx("div",{ref:N,style:{left:V.x,top:V.y},className:`web-trading-widget-new-order-overlay web-trading-widget-new-order-overlay--news web-trading-widget-new-order-overlay--draggable web-trading-widget-new-order-overlay--exec-panel${M?" web-trading-widget-new-order-overlay--dragging":""}`,children:c.jsx(_P,{symbolTicker:e,bid:(i==null?void 0:i.bid)??null,ask:(i==null?void 0:i.ask)??null,defaultVolumeLots:l,volumeStep:d,minVolumeLots:u,isSubmitting:a,isAccountsLoading:m,selectedLogin:f,isDragging:M,onDragHandlePointerDown:z,onLayoutChange:k,onClose:b,onPlaceOrder:F=>void g({symbolTicker:e,login:F.login,executionMode:F.executionMode,side:F.side,orderType:F.orderType,volumeLots:F.volumeLots,stopLoss:F.stopLoss,takeProfit:F.takeProfit,priceOrder:F.priceOrder,priceTrigger:F.priceTrigger,comment:F.comment,typeTime:F.typeTime,expirationDateTime:F.expirationDateTime,expirationDay:F.expirationDay,bid:F.bid,ask:F.ask})})}):null]})}const TP=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" aria-hidden="true">
|
|
41
|
+
`+s)}}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=sn(this.defaults,n);const{transitional:r,paramsSerializer:i,headers:s}=n;r!==void 0&&Nr.assertOptions(r,{silentJSONParsing:Me.transitional(Me.boolean),forcedJSONParsing:Me.transitional(Me.boolean),clarifyTimeoutError:Me.transitional(Me.boolean),legacyInterceptorReqResOrdering:Me.transitional(Me.boolean),advertiseZstdAcceptEncoding:Me.transitional(Me.boolean),validateStatusUndefinedResolves:Me.transitional(Me.boolean)},!1),i!=null&&(S.isFunction(i)?n.paramsSerializer={serialize:i}:Nr.assertOptions(i,{encode:Me.function,serialize:Me.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Nr.assertOptions(n,{baseUrl:Me.spelling("baseURL"),withXsrfToken:Me.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=s&&S.merge(s.common,s[n.method]);s&&S.forEach(["delete","get","head","post","put","patch","query","common"],b=>{delete s[b]}),n.headers=Fe.concat(o,s);const a=[];let l=!0;this.interceptors.request.forEach(function(v){if(typeof v.runWhen=="function"&&v.runWhen(n)===!1)return;l=l&&v.synchronous;const _=n.transitional||Fs;_&&_.legacyInterceptorReqResOrdering?a.unshift(v.fulfilled,v.rejected):a.push(v.fulfilled,v.rejected)});const d=[];this.interceptors.response.forEach(function(v){d.push(v.fulfilled,v.rejected)});let u,f=0,m;if(!l){const b=[Mo.bind(this),void 0];for(b.unshift(...a),b.push(...d),m=b.length,u=Promise.resolve(n);f<m;)u=u.then(b[f++],b[f++]);return u}m=a.length;let h=n;for(;f<m;){const b=a[f++],v=a[f++];try{h=b(h)}catch(_){v.call(this,_);break}}try{u=Mo.call(this,h)}catch(b){return Promise.reject(b)}for(f=0,m=d.length;f<m;)u=u.then(d[f++],d[f++]);return u}getUri(t){t=sn(this.defaults,t);const n=Rc(t.baseURL,t.url,t.allowAbsoluteUrls,t);return Ec(n,t.params,t.paramsSerializer)}};S.forEach(["delete","get","head","options"],function(t){Xt.prototype[t]=function(n,r){return this.request(sn(r||{},{method:t,url:n,data:r&&S.hasOwnProp(r,"data")?r.data:void 0}))}});S.forEach(["post","put","patch","query"],function(t){function n(r){return function(s,o,a){return this.request(sn(a||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:s,data:o}))}}Xt.prototype[t]=n(),t!=="query"&&(Xt.prototype[t+"Form"]=n(!0))});let mh=class Ic{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(s){n=s});const r=this;this.promise.then(i=>{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](i);r._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(a=>{r.subscribe(a),s=a}).then(i);return o.cancel=function(){r.unsubscribe(s)},o},t(function(s,o,a){r.reason||(r.reason=new fr(s,o,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new Ic(function(i){t=i}),cancel:t}}};function ph(e){return function(n){return e.apply(null,n)}}function gh(e){return S.isObject(e)&&e.isAxiosError===!0}const Ki={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,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Ki).forEach(([e,t])=>{Ki[t]=e});function Fc(e){const t=new Xt(e),n=pc(Xt.prototype.request,t);return S.extend(n,Xt.prototype,t,{allOwnKeys:!0}),S.extend(n,t,null,{allOwnKeys:!0}),n.create=function(i){return Fc(sn(e,i))},n}const Se=Fc(ur);Se.Axios=Xt;Se.CanceledError=fr;Se.CancelToken=mh;Se.isCancel=Nc;Se.VERSION=Ws;Se.toFormData=fi;Se.AxiosError=I;Se.Cancel=Se.CanceledError;Se.all=function(t){return Promise.all(t)};Se.spread=ph;Se.isAxiosError=gh;Se.mergeConfig=sn;Se.AxiosHeaders=Fe;Se.formToJSON=e=>Lc(S.isHTMLForm(e)?new FormData(e):e);Se.getAdapter=Uc.getAdapter;Se.HttpStatusCode=Ki;Se.default=Se;const{Axios:Iy,AxiosError:Fy,CanceledError:By,isCancel:Wy,CancelToken:$y,VERSION:Vy,all:Hy,Cancel:zy,isAxiosError:Bc,spread:qy,toFormData:Ky,AxiosHeaders:Gy,HttpStatusCode:Qy,formToJSON:Zy,getAdapter:Yy,mergeConfig:Jy,create:Xy}=Se,yh="Bearer ",Wc="web-trading-token";function bh(){return typeof window>"u"?null:localStorage.getItem(Wc)}function Cn(e){return e.replace(/\/$/,"")}function Io(e){const t=Cn(e);async function n(r){const i=bh();return(await Se({...r,baseURL:t,headers:{...r.headers??{},...i?{Authorization:`${yh}${i}`}:{}}})).data}return{get(r,i){return n({...i,url:r,method:"get"})},post(r,i,s){return n({...s,url:r,method:"post",data:i})}}}function Fo(e){return!e.isDemo&&!e.isArchive&&!!e.tradeStat}function _h(e){const t=e.filter(n=>Fo(n)&&n.platformType==="mt5");return t.length>0?t:e.filter(Fo)}function wh(e){const t=e,n=(t==null?void 0:t.accounts)??[];return _h(n).map(r=>{var i,s,o,a,l;return{id:r.id,login:String(r.login),label:`${r.displayTitle} · ${r.login}`,currency:r.currency,tradeStat:{balance:((i=r.tradeStat)==null?void 0:i.balance)??0,equity:((s=r.tradeStat)==null?void 0:s.equity)??0,margin:((o=r.tradeStat)==null?void 0:o.margin)??0,marginFree:((a=r.tradeStat)==null?void 0:a.marginFree)??0,marginLevel:(l=r.tradeStat)==null?void 0:l.marginLevel}}})}function vh(e){try{const t=new URL(Cn(e));return t.hostname.includes("webtrade.")?(t.hostname=t.hostname.replace("webtrade.","api."),t.origin):(t.hostname.startsWith("webtrade")&&(t.hostname=t.hostname.replace(/^webtrade/,"api")),t.origin)}catch{return Cn(e)}}function Sh(e){try{const t=new URL(Cn(e));return t.hostname.includes("opheleo")?"wss://ticks.opheleo.com":(t.protocol=t.protocol==="https:"?"wss:":"ws:",t.origin)}catch{return""}}function Th(e){const t=Cn(e),n=Io(t),r=vh(t),i=Io(r),s=uu(n),o=_t;return{baseUrl:t,platformApiBase:r,tickWebSocketUrl:Sh(t),dealer:s,trading:yu(s,o),async getAccounts(){const a=await i.get("/account-config/api/v1");return wh(a)}}}const $c=p.createContext(null);function Vc({baseUrl:e,children:t}){const n=p.useMemo(()=>Th(e),[e]);return c.jsx($c.Provider,{value:n,children:t})}function nt(){const e=p.useContext($c);if(!e)throw new Error("useWidgetApiClient must be used within WidgetApiProvider");return e}function Hc(){return nt().tickWebSocketUrl}const xh="wss://ticks.opheleo.com";function Vs(e){const[t,n]=p.useState(null),r=Hc();return p.useEffect(()=>{n(null);const i=ci(e).toUpperCase();let s=null,o=!1;const a=r||xh,l=()=>{s=new WebSocket(a),s.onopen=()=>{if(o){s==null||s.close(1e3,"Unmounted");return}s==null||s.send(JSON.stringify({action:"select_symbol",symbol:i}))},s.onmessage=d=>{var u;try{const f=JSON.parse(d.data);if(((u=f.symbol)==null?void 0:u.trim().toUpperCase())!==i)return;const h=Number(f.bid),b=Number(f.ask);if(!Number.isFinite(h)||!Number.isFinite(b))return;n({bid:h,ask:b})}catch{}},s.onclose=()=>{o||setTimeout(l,3e3)}};return l(),()=>{o=!0,s==null||s.close(1e3,"Unmounted")}},[e,r]),t}function kh(e,t){const n=Number(e),r=Number(t);return Number.isFinite(n)&&Number.isFinite(r)&&n!==r?n-r:e.localeCompare(t,void 0,{numeric:!0})}function Ph(e,t){return e.openTimeMs!==t.openTimeMs?e.openTimeMs-t.openTimeMs:kh(e.ticket,t.ticket)}function Bo(e){return[...e].sort(Ph)}function Wo(e){return Ne(e).toUpperCase()}const le=di(e=>({positions:[],orders:[],liveQuotes:{},selectedLogin:"",selectedPositionTicket:null,selectedOrderTicket:null,setSelectedLogin:t=>{e({selectedLogin:t})},setSelectedPositionTicket:t=>{e(n=>({selectedPositionTicket:t,selectedOrderTicket:t!==null?null:n.selectedOrderTicket}))},setSelectedOrderTicket:t=>{e(n=>({selectedOrderTicket:t,selectedPositionTicket:t!==null?null:n.selectedPositionTicket}))},setPositions:t=>{e({positions:Bo(t)})},setOrders:t=>{e({orders:Bo(t)})},removePosition:t=>{e(n=>({positions:n.positions.filter(r=>r.ticket!==t),selectedPositionTicket:n.selectedPositionTicket===t?null:n.selectedPositionTicket}))},removeOrder:t=>{e(n=>({orders:n.orders.filter(r=>r.ticket!==t),selectedOrderTicket:n.selectedOrderTicket===t?null:n.selectedOrderTicket}))},updateQuotes:(t,n,r)=>{const i=Wo(t);e(s=>{const o={...s.liveQuotes,[i]:{bid:n,ask:r}};return{liveQuotes:o,positions:s.positions.map(a=>Ld(a,i,n,r,o)),orders:s.orders.map(a=>{if(Wo(a.symbol)!==i)return a;const l=a.side==="buy"?n:r;return{...a,currentPrice:l,marketBid:n,marketAsk:r}})}})},clearPositions:()=>{e({positions:[],orders:[],liveQuotes:{}})}}));function Ch({symbolTicker:e,symbols:t,sidePanelTab:n,orderState:r,backUrl:i,createAccountUrl:s}){const o=Vs(e),{panelRef:a,position:l,isDragging:d,onDragStart:u,reclamp:f}=uc(),{panel:m,isSubmitting:h,defaultVolumeLots:b,volumeStep:v,minVolumeLots:_,accountOptions:g,selectedLogin:T,isAccountsLoading:x,hasConfirmedAccount:y,needsAccountSelection:O,confirmAccountSelection:C,placeMarketOrder:E}=r,k=ne(P=>P.setDraft),U=ne(P=>P.clearDraft),F=le(P=>P.selectedPositionTicket),H=le(P=>P.selectedOrderTicket),L=F!==null||H!==null,Q=Number(wt(vt(e))),K=Dn(Q);p.useEffect(()=>{if(y&&!L){if(m==="closed"||m==="confirmation"){U();return}k({source:"new-order",symbolKey:ar(e,t),entryPrice:null,side:null,showEntryLine:!1,stopLoss:"",takeProfit:"",volumeLots:b,digits:Q,priceStep:K})}},[U,b,Q,y,L,m,K,k,e,t]);const re=P=>{E({symbolTicker:e,login:P.login,executionMode:"market",side:P.side,orderType:P.side==="buy"?He.BUY:He.SELL,volumeLots:P.volumeLots,stopLoss:"",takeProfit:"",priceOrder:"",priceTrigger:"",comment:"",typeTime:We.GTC,expirationDateTime:"",expirationDay:"",bid:P.bid,ask:P.ask})};return c.jsxs(c.Fragment,{children:[c.jsx(Ja,{open:O,isAccountsLoading:x,accountOptions:g,onConfirm:C,backUrl:i,createAccountUrl:s}),y&&c.jsx("div",{ref:a,style:{left:l.x,top:l.y},className:`web-trading-widget-new-order-overlay${d?" web-trading-widget-new-order-overlay--dragging":""}`,children:c.jsx(Zd,{symbolTicker:e,bid:(o==null?void 0:o.bid)??null,ask:(o==null?void 0:o.ask)??null,defaultVolumeLots:b,volumeStep:v,minVolumeLots:_,isSubmitting:h,isAccountsLoading:x,selectedLogin:T,isDragging:d,sidePanelTab:n,onDragHandlePointerDown:u,onExpandedChange:f,onExpand:f,onPlaceOrder:re})})]})}const Oh="wss://ticks.opheleo.com";function Eh(e,t){const n=new Set;for(const r of e){const i=Ne(r.symbol).toUpperCase();i&&n.add(i)}for(const r of t){const i=Ne(r.symbol).toUpperCase();i&&n.add(i)}for(const r of Ed([...n]))n.add(r);return[...n].sort().join("|")}function Ah(e){return Eh(e.positions,e.orders)}function Lh(){const e=le(Ah),t=le(r=>r.updateQuotes),n=Hc();p.useEffect(()=>{if(!e)return;const r=e.split("|"),i=new Map;let s=!1;const o=n||Oh,a=l=>{const d=new WebSocket(o);i.set(l,d),d.onopen=()=>{if(s){d.close(1e3,"Unmounted");return}d.send(JSON.stringify({action:"select_symbol",symbol:l}))},d.onmessage=u=>{var f;try{const m=JSON.parse(u.data),h=(f=m.symbol)==null?void 0:f.trim().toUpperCase();if(!h||h!==l)return;const b=Number(m.bid),v=Number(m.ask);if(!Number.isFinite(b)||!Number.isFinite(v))return;t(h,b,v)}catch{}},d.onclose=()=>{i.delete(l),s||setTimeout(()=>a(l),3e3)}};for(const l of r)a(l);return()=>{s=!0;for(const l of i.values())l.close(1e3,"Unmounted");i.clear()}},[e,n,t])}function zc(){return Lh(),null}const Gi=(e,t,n)=>{if(!e)return t;try{const r=e.activeChart().symbol(),i=n.find(s=>s.display_name===r||s.ticker===r);if(i)return ar(i.ticker,n)}catch{}return t},qc={buy:"#2563eb",sell:"#dc2626"},Ei={positive:"#2563eb",negative:"#dc2626",neutral:"#94a3b8"},Kn={linewidth:1,linestyle:2,fontsize:11},ln={linewidth:Kn.linewidth,linestyle:Kn.linestyle},Kc={stopLoss:"#f97316",takeProfit:"#22c55e"},Gc=e=>qc[e],Qi=(e,t)=>e==="entry"?t!=null?Gc(t):qc.sell:Kc[e],$o=(e,t)=>{if(e==="entry")return Qi(e,t.side);const{side:n,entryPrice:r,linePrice:i,volumeLots:s}=t;if(n!=null&&r!==null&&r!==void 0&&i!==void 0&&s!==void 0){const o=Qc(n,r,i,s);return Zc(o)}return Kc[e]},Qc=(e,t,n,r)=>(e==="buy"?n-t:t-n)*r*100,Nh=(e,t)=>!Number.isFinite(t)||t<=0?0:Math.round(e/t),Dh=e=>{const t=Qc(e.side,e.entryPrice,e.linePrice,e.volumeLots),n=e.side==="buy"?e.linePrice-e.entryPrice:e.entryPrice-e.linePrice,r=Nh(n,e.priceStep),i=e.kind==="takeProfit"?"TP":"SL",s=`${t.toFixed(2)} USD`,o=`${r} points`;return`${i} ${s}, ${o}`},Rh=(e,t)=>e.toFixed(t),Zc=e=>e>0?Ei.positive:e<0?Ei.negative:Ei.neutral,jh=e=>{const t=`${e.side.toUpperCase()} ${e.volumeLots.toFixed(2)}, `,n=`${e.profit.toFixed(2)} USD`;return`${t}${n}`},Ai=e=>{const t=Gc(e.side),n=Zc(e.profit);return{text:jh(e),linecolor:t,textcolor:n,linewidth:Kn.linewidth,linestyle:Kn.linestyle,fontsize:Kn.fontsize,showPrice:!0,horzLabelsAlign:"left"}},Li=e=>Le(e),Mh=e=>e==="entry"||e==="stopLoss"||e==="takeProfit",Uh=["entry","stopLoss","takeProfit"],Ih=32,Vo=(e,t,n)=>{const{source:r,symbolKey:i}=ne.getState();if(r===null)return!1;const s=Gi(e,t,n);return i===s},Ni=e=>{e.setUserEditEnabled(!1),e.setSelectionEnabled(!1)},Ho=(e,t,n)=>{if(e==="entry")return Rh(t,n.digits);const{entryPrice:r,side:i}=n;return i!==null&&r!==null?Dh({kind:e,side:i,entryPrice:r,linePrice:t,volumeLots:n.volumeLots,priceStep:n.priceStep}):`${e==="takeProfit"?"TP":"SL"} ${pe(t,n.digits)}`},Fh=({chartWidget:e,symbolTicker:t,symbols:n})=>{const r=ne(P=>P.source),i=ne(P=>P.entryPrice),s=ne(P=>P.stopLoss),o=ne(P=>P.takeProfit),a=ne(P=>P.side),l=ne(P=>P.showEntryLine),d=ne(P=>P.volumeLots),u=ne(P=>P.digits),f=ne(P=>P.priceStep),m=ne(P=>P.setStopLoss),h=ne(P=>P.setTakeProfit),b=p.useMemo(()=>ar(t,n),[t,n]),v=p.useRef(b);p.useEffect(()=>{v.current=b},[b]);const _=p.useRef({}),g=p.useRef(null),T=p.useRef(null),x=p.useRef(null),y=p.useRef(!1),O=p.useRef({entryPrice:i,stopLoss:s,takeProfit:o,side:a,showEntryLine:l,volumeLots:d,digits:u,priceStep:f});p.useEffect(()=>{O.current={entryPrice:i,stopLoss:s,takeProfit:o,side:a,showEntryLine:l,volumeLots:d,digits:u,priceStep:f}},[u,i,f,l,a,s,o,d]);const C=p.useCallback(P=>{if(!e)return;const D=_.current[P];if(D){try{e.activeChart().removeEntity(D)}catch{}delete _.current[P]}},[e]),E=p.useCallback(()=>{for(const P of Uh)C(P);_.current={}},[C]),k=p.useCallback((P,D,j,A)=>{const W=Qi(D,A.side),R=$o(D,{side:A.side,entryPrice:A.entryPrice,linePrice:j,volumeLots:A.volumeLots});P.setProperties({text:Ho(D,j,A),linecolor:W,textcolor:R,showPrice:!0,horzLabelsAlign:"left",...D==="entry"?ln:{}})},[]),U=p.useCallback(async(P,D,j)=>{var ce;if(!e)return;if(D===void 0){C(P);return}if(T.current===P)return;const A=e.activeChart(),W=Qi(P,j.side),R=$o(P,{side:j.side,entryPrice:j.entryPrice,linePrice:D,volumeLots:j.volumeLots}),G=Ho(P,D,j),ae=_.current[P];if(ae)try{const ie=A.getShapeById(ae);P==="entry"&&Ni(ie);const N=(ce=ie.getPoints()[0])==null?void 0:ce.price;if(N!==void 0&&Math.abs(N-D)<j.priceStep/2){ie.setProperties({text:G,linecolor:W,textcolor:R,showPrice:!0,horzLabelsAlign:"left",...P==="entry"?ln:{}});return}const Z=ie.getPoints();if(Z.length>0){y.current=!0,ie.setPoints(Z.map(te=>({...te,price:D}))),y.current=!1,ie.setProperties({text:G,linecolor:W,textcolor:R,showPrice:!0,horzLabelsAlign:"left",...P==="entry"?ln:{}});return}}catch{delete _.current[P]}try{const ie=A.getVisibleRange(),N=await A.createShape({time:ie.from,price:D},{shape:"horizontal_line",text:G,disableSave:!0,lock:P==="entry",disableSelection:P==="entry",overrides:{linecolor:W,textcolor:R,linewidth:P==="entry"?ln.linewidth:2,...P==="entry"?{linestyle:ln.linestyle}:{},showPrice:!0,horzLabelsAlign:"left"}});if(P==="entry")try{A.getShapeById(N).setProperties(ln)}catch{}if(P==="entry"&&!O.current.showEntryLine){try{A.removeEntity(N)}catch{}return}if(P==="entry")try{Ni(A.getShapeById(N))}catch{}_.current[P]=N}catch{}},[e,C]),F=p.useCallback(async P=>{if(!Vo(e,v.current,n)){E();return}const D=Li(P.stopLoss),j=Li(P.takeProfit);P.showEntryLine&&P.entryPrice!==null?await U("entry",P.entryPrice,P):await U("entry",void 0,P),await U("stopLoss",D,P),await U("takeProfit",j,P)},[e,E,n,U]),H=p.useCallback(()=>{e&&(E(),Vo(e,v.current,n)&&F(O.current))},[e,E,n,F]),L=p.useRef(H);p.useEffect(()=>{L.current=H},[H]);const Q=p.useCallback(()=>{g.current!==null&&clearTimeout(g.current),g.current=setTimeout(()=>{g.current=null,L.current()},Ih)},[]),K=p.useRef(Q);p.useEffect(()=>{K.current=Q},[Q]);const re=r!==null&&(l||s.trim()!==""||o.trim()!=="");p.useEffect(()=>{if(!e||!re)return;const P=(D,j)=>{var G,ae,ce;const A=(G=Object.entries(_.current).find(([,ie])=>ie===D))==null?void 0:G[0];if(!A||!Mh(A))return;const R=e.activeChart().getAllShapes().filter(ie=>ie.name==="horizontal_line").some(ie=>ie.id===D);if(A==="entry"){if((j==="move"||j==="points_changed")&&R){const ie=O.current;if(ie.entryPrice!==null)try{const N=e.activeChart().getShapeById(D),Z=(ae=N.getPoints()[0])==null?void 0:ae.price;if(Z!==void 0&&Math.abs(Z-ie.entryPrice)>=ie.priceStep/2){const te=N.getPoints();te.length>0&&N.setPoints(te.map(ve=>({...ve,price:ie.entryPrice})))}Ni(N)}catch{}}return}if(j==="remove"&&R){T.current=null,A==="stopLoss"&&m(""),A==="takeProfit"&&h(""),delete _.current[A];return}if(!(j!=="move"&&j!=="points_changed"&&!R)&&!y.current)try{const ie=e.activeChart().getShapeById(D),N=(ce=ie.getPoints()[0])==null?void 0:ce.price;if(!Number.isFinite(N)||N<=0)return;const Z=O.current,te=A==="stopLoss"?Z.stopLoss:Z.takeProfit,ve=Li(te),Re=ve!==void 0&&Math.abs(ve-N)<Z.priceStep/2;if(j==="points_changed"&&R){T.current=A,k(ie,A,N,Z),x.current!==null&&clearTimeout(x.current),x.current=setTimeout(()=>{T.current=null;const Ce=pe(N,O.current.digits);A==="stopLoss"?m(Ce):h(Ce)},120);return}if(x.current!==null&&(clearTimeout(x.current),x.current=null),T.current=null,Re){k(ie,A,N,Z);return}const be=pe(N,Z.digits),Pe=A==="stopLoss"?{...Z,stopLoss:be}:{...Z,takeProfit:be};A==="stopLoss"?m(be):h(be),k(ie,A,N,Pe)}catch{T.current=null}};try{e.subscribe("drawing_event",P)}catch{}return()=>{T.current=null,x.current!==null&&(clearTimeout(x.current),x.current=null);try{e.unsubscribe("drawing_event",P)}catch{}}},[e,re,m,h,k]),p.useEffect(()=>{if(!e)return;if(r===null){E();return}let P=!1;try{e.onChartReady(()=>{P||F(O.current)})}catch{}return()=>{P=!0}},[e,E,r,i,s,o,a,l,d,u,f,F]),p.useEffect(()=>{if(!e||r===null)return;let P=!1,D=null,j=!1;const A=()=>{P||(j=!0,K.current())},W=()=>{P||!j||(j=!1,K.current())};try{e.onChartReady(()=>{if(!P)try{D=e.activeChart(),D.onSymbolChanged().subscribe(null,A),D.onDataLoaded().subscribe(null,W)}catch{}})}catch{}return()=>{if(P=!0,g.current!==null&&(clearTimeout(g.current),g.current=null),D)try{D.onSymbolChanged().unsubscribe(null,A),D.onDataLoaded().unsubscribe(null,W)}catch{}}},[e,r]),p.useEffect(()=>{if(!e||r===null)return;let P=!1;try{e.onChartReady(()=>{P||K.current()})}catch{}return()=>{P=!0}},[b,e,r])},Di=e=>{e.setUserEditEnabled(!1),e.setSelectionEnabled(!1)},Zi=(e,t)=>Ne(e.symbol).toUpperCase()===t,zo=e=>le.getState().positions.filter(t=>Zi(t,e)).map(t=>({ticket:t.ticket,openPrice:t.openPrice,type:t.type,digits:t.digits,volumeLots:t.volumeLots,profit:t.profit})),qo=(e,t,n)=>{var s;const r=(s=e.getPoints()[0])==null?void 0:s.price;if(r!==void 0&&Math.abs(r-t)<Number.EPSILON){e.setProperties(n);return}const i=e.getPoints();i.length>0&&e.setPoints(i.map(o=>({...o,price:t}))),e.setProperties(n)},Bh=500,Wh=({chartWidget:e,symbolTicker:t,symbols:n})=>{const r=le(y=>y.positions),i=p.useRef(new Map),s=p.useRef(0),o=p.useMemo(()=>ar(t,n),[t,n]),a=p.useRef(o);p.useEffect(()=>{a.current=o},[o]);const l=p.useMemo(()=>r.filter(y=>Zi(y,o)).map(y=>`${y.ticket}:${y.openPrice}:${y.type}:${y.digits}:${y.volumeLots}`).sort().join("|"),[o,r]),d=p.useMemo(()=>r.filter(y=>Zi(y,o)).map(y=>`${y.ticket}:${y.profit.toFixed(2)}`).sort().join("|"),[o,r]),u=p.useCallback(y=>{if(!e)return;const O=i.current.get(y);if(O){try{e.activeChart().removeEntity(O)}catch{}i.current.delete(y)}},[e]),f=p.useCallback(()=>{for(const y of[...i.current.keys()])u(y);i.current.clear()},[u]),m=p.useCallback(async(y,O,C)=>{const E=Ai({side:O.type,volumeLots:O.volumeLots,profit:O.profit}),U={time:y.getVisibleRange().from,price:O.openPrice},F=await y.createShape(U,{shape:"horizontal_line",text:String(E.text),disableSave:!0,lock:!0,disableSelection:!0,overrides:E});if(C!==s.current){try{y.removeEntity(F)}catch{}return null}try{const H=y.getShapeById(F);H.setProperties(E),Di(H)}catch{}return F},[]),h=p.useCallback(async(y,O)=>{if(!e||O!==s.current)return;const C=e.activeChart(),E=Ai({side:y.type,volumeLots:y.volumeLots,profit:y.profit}),k=i.current.get(y.ticket);if(k)try{qo(C.getShapeById(k),y.openPrice,E),Di(C.getShapeById(k));return}catch{i.current.delete(y.ticket)}if(O===s.current)try{const U=await m(C,y,O);if(!U)return;i.current.set(y.ticket,U)}catch{}},[e,m]),b=p.useCallback(async(y,O)=>{if(!e||y!==s.current)return;const C=zo(O),E=new Set(C.map(k=>k.ticket));for(const k of i.current.keys())E.has(k)||u(k);for(const k of C){if(y!==s.current)return;await h(k,y)}},[e,u,h]),v=p.useCallback(()=>{if(!e)return;let y;try{y=e.activeChart()}catch{return}const O=zo(o);for(const C of O){const E=i.current.get(C.ticket);if(E)try{const k=Ai({side:C.type,volumeLots:C.volumeLots,profit:C.profit});qo(y.getShapeById(E),C.openPrice,k),Di(y.getShapeById(E))}catch{i.current.delete(C.ticket)}}},[o,e]),_=p.useCallback(y=>{if(!e)return;const O=s.current+1;s.current=O,y!=null&&y.resetLineIds&&f();const C=(y==null?void 0:y.symbolKey)??Gi(e,a.current,n);b(O,C)},[e,f,n,b]),g=p.useCallback(()=>e?Gi(e,a.current,n):a.current,[e,n]),T=p.useRef(_),x=p.useRef(g);p.useEffect(()=>{T.current=_},[_]),p.useEffect(()=>{x.current=g},[g]),p.useEffect(()=>{if(!e)return;let y=!1,O=null;const C=()=>{y||T.current({resetLineIds:!0,symbolKey:x.current()})};let E=!1;const k=()=>{E=!0,C()},U=()=>{y||!E||(E=!1,T.current({symbolKey:x.current()}))};try{e.onChartReady(()=>{if(!y)try{O=e.activeChart(),T.current({resetLineIds:!0,symbolKey:a.current}),O.onSymbolChanged().subscribe(null,k),O.onDataLoaded().subscribe(null,U)}catch{}})}catch{}return()=>{if(y=!0,s.current+=1,O)try{O.onSymbolChanged().unsubscribe(null,k),O.onDataLoaded().unsubscribe(null,U)}catch{}f()}},[e,f]),p.useEffect(()=>{if(!e)return;let y=!1;try{e.onChartReady(()=>{y||_({symbolKey:o})})}catch{}return()=>{y=!0}},[o,e,l,_]),p.useEffect(()=>{if(!e||!d)return;let y=!1,O=null;return O=setTimeout(()=>{if(!y)try{e.onChartReady(()=>{y||v()})}catch{}},Bh),()=>{y=!0,O!==null&&clearTimeout(O)}},[e,d,v])},Yc=({chartWidget:e,symbolTicker:t,symbols:n})=>(Wh({chartWidget:e,symbolTicker:t,symbols:n}),Fh({chartWidget:e,symbolTicker:t,symbols:n}),null);var hr=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Vt,Ot,fn,Ba,$h=(Ba=class extends hr{constructor(){super();ee(this,Vt);ee(this,Ot);ee(this,fn);B(this,fn,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){w(this,Ot)||this.setEventListener(w(this,fn))}onUnsubscribe(){var t;this.hasListeners()||((t=w(this,Ot))==null||t.call(this),B(this,Ot,void 0))}setEventListener(t){var n;B(this,fn,t),(n=w(this,Ot))==null||n.call(this),B(this,Ot,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){w(this,Vt)!==t&&(B(this,Vt,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof w(this,Vt)=="boolean"?w(this,Vt):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Vt=new WeakMap,Ot=new WeakMap,fn=new WeakMap,Ba),Hs=new $h,Vh={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},at,Ht,Wa,Hh=(Wa=class{constructor(){ee(this,at,Vh);ee(this,Ht,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&w(this,Ht)&&e!==w(this,at)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:w(this,at),provider:e}),B(this,at,e),process.env.NODE_ENV!=="production"&&B(this,Ht,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&B(this,Ht,!0),w(this,at).setTimeout(e,t)}clearTimeout(e){w(this,at).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&B(this,Ht,!0),w(this,at).setInterval(e,t)}clearInterval(e){w(this,at).clearInterval(e)}},at=new WeakMap,Ht=new WeakMap,Wa),$t=new Hh;function zh(e){setTimeout(e,0)}var qh=typeof window>"u"||"Deno"in globalThis;function Ve(){}function Kh(e,t){return typeof e=="function"?e(t):e}function Yi(e){return typeof e=="number"&&e>=0&&e!==1/0}function Jc(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Mt(e,t){return typeof e=="function"?e(t):e}function Ge(e,t){return typeof e=="function"?e(t):e}function Ko(e,t){const{type:n="all",exact:r,fetchStatus:i,predicate:s,queryKey:o,stale:a}=e;if(o){if(r){if(t.queryHash!==zs(o,t.options))return!1}else if(!Yn(t.queryKey,o))return!1}if(n!=="all"){const l=t.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||i&&i!==t.state.fetchStatus||s&&!s(t))}function Go(e,t){const{exact:n,status:r,predicate:i,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return!1;if(n){if(Zn(t.options.mutationKey)!==Zn(s))return!1}else if(!Yn(t.options.mutationKey,s))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function zs(e,t){return((t==null?void 0:t.queryKeyHashFn)||Zn)(e)}function Zn(e){return JSON.stringify(e,(t,n)=>es(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function Yn(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Yn(e[n],t[n])):!1}var Gh=Object.prototype.hasOwnProperty;function Ji(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=Qo(e)&&Qo(t);if(!r&&!(es(e)&&es(t)))return t;const s=(r?e:Object.keys(e)).length,o=r?t:Object.keys(t),a=o.length,l=r?new Array(a):{};let d=0;for(let u=0;u<a;u++){const f=r?u:o[u],m=e[f],h=t[f];if(m===h){l[f]=m,(r?u<s:Gh.call(e,f))&&d++;continue}if(m===null||h===null||typeof m!="object"||typeof h!="object"){l[f]=h;continue}const b=Ji(m,h,n+1);l[f]=b,b===m&&d++}return s===a&&d===s?e:l}function Xi(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function Qo(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function es(e){if(!Zo(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Zo(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Zo(e){return Object.prototype.toString.call(e)==="[object Object]"}function Qh(e){return new Promise(t=>{$t.setTimeout(t,e)})}function ts(e,t,n){if(typeof n.structuralSharing=="function")return n.structuralSharing(e,t);if(n.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return Ji(e,t)}catch(r){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${r}`),r}return Ji(e,t)}return t}function Zh(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function Yh(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Kr=Symbol();function Xc(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Kr&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Kr?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function el(e,t){return typeof e=="function"?e(...t):!!e}function Jh(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??(i=t()),r||(r=!0,i.aborted?n():i.addEventListener("abort",n,{once:!0})),i)}),e}var Jn=(()=>{let e=()=>qh;return{isServer(){return e()},setIsServer(t){e=t}}})();function ns(){let e,t;const n=new Promise((i,s)=>{e=i,t=s});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),e(i)},n.reject=i=>{r({status:"rejected",reason:i}),t(i)},n}var Xh=zh;function em(){let e=[],t=0,n=a=>{a()},r=a=>{a()},i=Xh;const s=a=>{t?e.push(a):i(()=>{n(a)})},o=()=>{const a=e;e=[],a.length&&i(()=>{r(()=>{a.forEach(l=>{n(l)})})})};return{batch:a=>{let l;t++;try{l=a()}finally{t--,t||o()}return l},batchCalls:a=>(...l)=>{s(()=>{a(...l)})},schedule:s,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{i=a}}}var Ae=em(),hn,Et,mn,$a,tm=($a=class extends hr{constructor(){super();ee(this,hn,!0);ee(this,Et);ee(this,mn);B(this,mn,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){w(this,Et)||this.setEventListener(w(this,mn))}onUnsubscribe(){var t;this.hasListeners()||((t=w(this,Et))==null||t.call(this),B(this,Et,void 0))}setEventListener(t){var n;B(this,mn,t),(n=w(this,Et))==null||n.call(this),B(this,Et,t(this.setOnline.bind(this)))}setOnline(t){w(this,hn)!==t&&(B(this,hn,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return w(this,hn)}},hn=new WeakMap,Et=new WeakMap,mn=new WeakMap,$a),Gr=new tm;function nm(e){return Math.min(1e3*2**e,3e4)}function tl(e){return(e??"online")==="online"?Gr.isOnline():!0}var rs=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function nl(e){let t=!1,n=0,r;const i=ns(),s=()=>i.status!=="pending",o=v=>{var _;if(!s()){const g=new rs(v);m(g),(_=e.onCancel)==null||_.call(e,g)}},a=()=>{t=!0},l=()=>{t=!1},d=()=>Hs.isFocused()&&(e.networkMode==="always"||Gr.isOnline())&&e.canRun(),u=()=>tl(e.networkMode)&&e.canRun(),f=v=>{s()||(r==null||r(),i.resolve(v))},m=v=>{s()||(r==null||r(),i.reject(v))},h=()=>new Promise(v=>{var _;r=g=>{(s()||d())&&v(g)},(_=e.onPause)==null||_.call(e)}).then(()=>{var v;r=void 0,s()||(v=e.onContinue)==null||v.call(e)}),b=()=>{if(s())return;let v;const _=n===0?e.initialPromise:void 0;try{v=_??e.fn()}catch(g){v=Promise.reject(g)}Promise.resolve(v).then(f).catch(g=>{var C;if(s())return;const T=e.retry??(Jn.isServer()?0:3),x=e.retryDelay??nm,y=typeof x=="function"?x(n,g):x,O=T===!0||typeof T=="number"&&n<T||typeof T=="function"&&T(n,g);if(t||!O){m(g);return}n++,(C=e.onFail)==null||C.call(e,n,g),Qh(y).then(()=>d()?void 0:h()).then(()=>{t?m(g):b()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r==null||r(),i),cancelRetry:a,continueRetry:l,canStart:u,start:()=>(u()?b():h().then(b),i)}}var zt,Va,rl=(Va=class{constructor(){ee(this,zt)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Yi(this.gcTime)&&B(this,zt,$t.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Jn.isServer()?1/0:300*1e3))}clearGcTimeout(){w(this,zt)!==void 0&&($t.clearTimeout(w(this,zt)),B(this,zt,void 0))}},zt=new WeakMap,Va);function rm(e){return{onFetch:(t,n)=>{var u,f,m,h,b;const r=t.options,i=(m=(f=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:f.fetchMore)==null?void 0:m.direction,s=((h=t.state.data)==null?void 0:h.pages)||[],o=((b=t.state.data)==null?void 0:b.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const d=async()=>{let v=!1;const _=x=>{Jh(x,()=>t.signal,()=>v=!0)},g=Xc(t.options,t.fetchOptions),T=async(x,y,O)=>{if(v)return Promise.reject(t.signal.reason);if(y==null&&x.pages.length)return Promise.resolve(x);const E=(()=>{const H={client:t.client,queryKey:t.queryKey,pageParam:y,direction:O?"backward":"forward",meta:t.options.meta};return _(H),H})(),k=await g(E),{maxPages:U}=t.options,F=O?Yh:Zh;return{pages:F(x.pages,k,U),pageParams:F(x.pageParams,y,U)}};if(i&&s.length){const x=i==="backward",y=x?im:Yo,O={pages:s,pageParams:o},C=y(r,O);a=await T(O,C,x)}else{const x=e??s.length;do{const y=l===0?o[0]??r.initialPageParam:Yo(r,a);if(l>0&&y==null)break;a=await T(a,y),l++}while(l<x)}return a};t.options.persister?t.fetchFn=()=>{var v,_;return(_=(v=t.options).persister)==null?void 0:_.call(v,d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=d}}}function Yo(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function im(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var pn,qt,gn,et,Kt,Ee,tr,Gt,Ke,il,mt,Ha,sm=(Ha=class extends rl{constructor(t){super();ee(this,Ke);ee(this,pn);ee(this,qt);ee(this,gn);ee(this,et);ee(this,Kt);ee(this,Ee);ee(this,tr);ee(this,Gt);B(this,Gt,!1),B(this,tr,t.defaultOptions),this.setOptions(t.options),this.observers=[],B(this,Kt,t.client),B(this,et,w(this,Kt).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,B(this,qt,Xo(this.options)),this.state=t.state??w(this,qt),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return w(this,pn)}get promise(){var t;return(t=w(this,Ee))==null?void 0:t.promise}setOptions(t){if(this.options={...w(this,tr),...t},t!=null&&t._type&&B(this,pn,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=Xo(this.options);n.data!==void 0&&(this.setState(Jo(n.data,n.dataUpdatedAt)),B(this,qt,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&w(this,et).remove(this)}setData(t,n){const r=ts(this.state.data,t,this.options);return ue(this,Ke,mt).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t){ue(this,Ke,mt).call(this,{type:"setState",state:t})}cancel(t){var r,i;const n=(r=w(this,Ee))==null?void 0:r.promise;return(i=w(this,Ee))==null||i.cancel(t),n?n.then(Ve).catch(Ve):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return w(this,qt)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>Ge(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Kr||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Mt(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!Jc(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=w(this,Ee))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=w(this,Ee))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),w(this,et).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(w(this,Ee)&&(w(this,Gt)||ue(this,Ke,il).call(this)?w(this,Ee).cancel({revert:!0}):w(this,Ee).cancelRetry()),this.scheduleGc()),w(this,et).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||ue(this,Ke,mt).call(this,{type:"invalidate"})}async fetch(t,n){var d,u,f,m,h,b,v,_,g,T,x;if(this.state.fetchStatus!=="idle"&&((d=w(this,Ee))==null?void 0:d.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(w(this,Ee))return w(this,Ee).continueRetry(),w(this,Ee).promise}if(t&&this.setOptions(t),!this.options.queryFn){const y=this.observers.find(O=>O.options.queryFn);y&&this.setOptions(y.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const r=new AbortController,i=y=>{Object.defineProperty(y,"signal",{enumerable:!0,get:()=>(B(this,Gt,!0),r.signal)})},s=()=>{const y=Xc(this.options,n),C=(()=>{const E={client:w(this,Kt),queryKey:this.queryKey,meta:this.meta};return i(E),E})();return B(this,Gt,!1),this.options.persister?this.options.persister(y,C,this):y(C)},a=(()=>{const y={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:w(this,Kt),state:this.state,fetchFn:s};return i(y),y})(),l=w(this,pn)==="infinite"?rm(this.options.pages):this.options.behavior;l==null||l.onFetch(a,this),B(this,gn,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=a.fetchOptions)==null?void 0:u.meta))&&ue(this,Ke,mt).call(this,{type:"fetch",meta:(f=a.fetchOptions)==null?void 0:f.meta}),B(this,Ee,nl({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:y=>{y instanceof rs&&y.revert&&this.setState({...w(this,gn),fetchStatus:"idle"}),r.abort()},onFail:(y,O)=>{ue(this,Ke,mt).call(this,{type:"failed",failureCount:y,error:O})},onPause:()=>{ue(this,Ke,mt).call(this,{type:"pause"})},onContinue:()=>{ue(this,Ke,mt).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const y=await w(this,Ee).start();if(y===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(y),(h=(m=w(this,et).config).onSuccess)==null||h.call(m,y,this),(v=(b=w(this,et).config).onSettled)==null||v.call(b,y,this.state.error,this),y}catch(y){if(y instanceof rs){if(y.silent)return w(this,Ee).promise;if(y.revert){if(this.state.data===void 0)throw y;return this.state.data}}throw ue(this,Ke,mt).call(this,{type:"error",error:y}),(g=(_=w(this,et).config).onError)==null||g.call(_,y,this),(x=(T=w(this,et).config).onSettled)==null||x.call(T,this.state.data,y,this),y}finally{this.scheduleGc()}}},pn=new WeakMap,qt=new WeakMap,gn=new WeakMap,et=new WeakMap,Kt=new WeakMap,Ee=new WeakMap,tr=new WeakMap,Gt=new WeakMap,Ke=new WeakSet,il=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},mt=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...sl(r.data,this.options),fetchMeta:t.meta??null};case"success":const i={...r,...Jo(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return B(this,gn,t.manual?i:void 0),i;case"error":const s=t.error;return{...r,error:s,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),Ae.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),w(this,et).notify({query:this,type:"updated",action:t})})},Ha);function sl(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:tl(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Jo(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Xo(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var $e,fe,nr,Be,Qt,yn,gt,At,rr,bn,_n,Zt,Yt,Lt,wn,ye,Vn,is,ss,os,as,cs,ls,ds,ol,za,om=(za=class extends hr{constructor(t,n){super();ee(this,ye);ee(this,$e);ee(this,fe);ee(this,nr);ee(this,Be);ee(this,Qt);ee(this,yn);ee(this,gt);ee(this,At);ee(this,rr);ee(this,bn);ee(this,_n);ee(this,Zt);ee(this,Yt);ee(this,Lt);ee(this,wn,new Set);this.options=n,B(this,$e,t),B(this,At,null),B(this,gt,ns()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(w(this,fe).addObserver(this),ea(w(this,fe),this.options)?ue(this,ye,Vn).call(this):this.updateResult(),ue(this,ye,as).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return us(w(this,fe),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return us(w(this,fe),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,ue(this,ye,cs).call(this),ue(this,ye,ls).call(this),w(this,fe).removeObserver(this)}setOptions(t){const n=this.options,r=w(this,fe);if(this.options=w(this,$e).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Ge(this.options.enabled,w(this,fe))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");ue(this,ye,ds).call(this),w(this,fe).setOptions(this.options),n._defaulted&&!Xi(this.options,n)&&w(this,$e).getQueryCache().notify({type:"observerOptionsUpdated",query:w(this,fe),observer:this});const i=this.hasListeners();i&&ta(w(this,fe),r,this.options,n)&&ue(this,ye,Vn).call(this),this.updateResult(),i&&(w(this,fe)!==r||Ge(this.options.enabled,w(this,fe))!==Ge(n.enabled,w(this,fe))||Mt(this.options.staleTime,w(this,fe))!==Mt(n.staleTime,w(this,fe)))&&ue(this,ye,is).call(this);const s=ue(this,ye,ss).call(this);i&&(w(this,fe)!==r||Ge(this.options.enabled,w(this,fe))!==Ge(n.enabled,w(this,fe))||s!==w(this,Lt))&&ue(this,ye,os).call(this,s)}getOptimisticResult(t){const n=w(this,$e).getQueryCache().build(w(this,$e),t),r=this.createResult(n,t);return cm(this,r)&&(B(this,Be,r),B(this,yn,this.options),B(this,Qt,w(this,fe).state)),r}getCurrentResult(){return w(this,Be)}trackResult(t,n){return new Proxy(t,{get:(r,i)=>(this.trackProp(i),n==null||n(i),i==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&w(this,gt).status==="pending"&&w(this,gt).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,i))})}trackProp(t){w(this,wn).add(t)}getCurrentQuery(){return w(this,fe)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=w(this,$e).defaultQueryOptions(t),r=w(this,$e).getQueryCache().build(w(this,$e),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return ue(this,ye,Vn).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),w(this,Be)))}createResult(t,n){var U;const r=w(this,fe),i=this.options,s=w(this,Be),o=w(this,Qt),a=w(this,yn),d=t!==r?t.state:w(this,nr),{state:u}=t;let f={...u},m=!1,h;if(n._optimisticResults){const F=this.hasListeners(),H=!F&&ea(t,n),L=F&&ta(t,r,n,i);(H||L)&&(f={...f,...sl(u.data,t.options)}),n._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:b,errorUpdatedAt:v,status:_}=f;h=f.data;let g=!1;if(n.placeholderData!==void 0&&h===void 0&&_==="pending"){let F;s!=null&&s.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(F=s.data,g=!0):F=typeof n.placeholderData=="function"?n.placeholderData((U=w(this,_n))==null?void 0:U.state.data,w(this,_n)):n.placeholderData,F!==void 0&&(_="success",h=ts(s==null?void 0:s.data,F,n),m=!0)}if(n.select&&h!==void 0&&!g)if(s&&h===(o==null?void 0:o.data)&&n.select===w(this,rr))h=w(this,bn);else try{B(this,rr,n.select),h=n.select(h),h=ts(s==null?void 0:s.data,h,n),B(this,bn,h),B(this,At,null)}catch(F){B(this,At,F)}w(this,At)&&(b=w(this,At),h=w(this,bn),v=Date.now(),_="error");const T=f.fetchStatus==="fetching",x=_==="pending",y=_==="error",O=x&&T,C=h!==void 0,k={status:_,fetchStatus:f.fetchStatus,isPending:x,isSuccess:_==="success",isError:y,isInitialLoading:O,isLoading:O,data:h,dataUpdatedAt:f.dataUpdatedAt,error:b,errorUpdatedAt:v,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:f.dataUpdateCount>d.dataUpdateCount||f.errorUpdateCount>d.errorUpdateCount,isFetching:T,isRefetching:T&&!x,isLoadingError:y&&!C,isPaused:f.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:y&&C,isStale:qs(t,n),refetch:this.refetch,promise:w(this,gt),isEnabled:Ge(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const F=k.data!==void 0,H=k.status==="error"&&!F,L=re=>{H?re.reject(k.error):F&&re.resolve(k.data)},Q=()=>{const re=B(this,gt,k.promise=ns());L(re)},K=w(this,gt);switch(K.status){case"pending":t.queryHash===r.queryHash&&L(K);break;case"fulfilled":(H||k.data!==K.value)&&Q();break;case"rejected":(!H||k.error!==K.reason)&&Q();break}}return k}updateResult(){const t=w(this,Be),n=this.createResult(w(this,fe),this.options);if(B(this,Qt,w(this,fe).state),B(this,yn,this.options),w(this,Qt).data!==void 0&&B(this,_n,w(this,fe)),Xi(n,t))return;B(this,Be,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:i}=this.options,s=typeof i=="function"?i():i;if(s==="all"||!s&&!w(this,wn).size)return!0;const o=new Set(s??w(this,wn));return this.options.throwOnError&&o.add("error"),Object.keys(w(this,Be)).some(a=>{const l=a;return w(this,Be)[l]!==t[l]&&o.has(l)})};ue(this,ye,ol).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&ue(this,ye,as).call(this)}},$e=new WeakMap,fe=new WeakMap,nr=new WeakMap,Be=new WeakMap,Qt=new WeakMap,yn=new WeakMap,gt=new WeakMap,At=new WeakMap,rr=new WeakMap,bn=new WeakMap,_n=new WeakMap,Zt=new WeakMap,Yt=new WeakMap,Lt=new WeakMap,wn=new WeakMap,ye=new WeakSet,Vn=function(t){ue(this,ye,ds).call(this);let n=w(this,fe).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Ve)),n},is=function(){ue(this,ye,cs).call(this);const t=Mt(this.options.staleTime,w(this,fe));if(Jn.isServer()||w(this,Be).isStale||!Yi(t))return;const r=Jc(w(this,Be).dataUpdatedAt,t)+1;B(this,Zt,$t.setTimeout(()=>{w(this,Be).isStale||this.updateResult()},r))},ss=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(w(this,fe)):this.options.refetchInterval)??!1},os=function(t){ue(this,ye,ls).call(this),B(this,Lt,t),!(Jn.isServer()||Ge(this.options.enabled,w(this,fe))===!1||!Yi(w(this,Lt))||w(this,Lt)===0)&&B(this,Yt,$t.setInterval(()=>{(this.options.refetchIntervalInBackground||Hs.isFocused())&&ue(this,ye,Vn).call(this)},w(this,Lt)))},as=function(){ue(this,ye,is).call(this),ue(this,ye,os).call(this,ue(this,ye,ss).call(this))},cs=function(){w(this,Zt)!==void 0&&($t.clearTimeout(w(this,Zt)),B(this,Zt,void 0))},ls=function(){w(this,Yt)!==void 0&&($t.clearInterval(w(this,Yt)),B(this,Yt,void 0))},ds=function(){const t=w(this,$e).getQueryCache().build(w(this,$e),this.options);if(t===w(this,fe))return;const n=w(this,fe);B(this,fe,t),B(this,nr,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},ol=function(t){Ae.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(w(this,Be))}),w(this,$e).getQueryCache().notify({query:w(this,fe),type:"observerResultsUpdated"})})},za);function am(e,t){return Ge(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&Ge(t.retryOnMount,e)===!1)}function ea(e,t){return am(e,t)||e.state.data!==void 0&&us(e,t,t.refetchOnMount)}function us(e,t,n){if(Ge(t.enabled,e)!==!1&&Mt(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&qs(e,t)}return!1}function ta(e,t,n,r){return(e!==t||Ge(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&qs(e,n)}function qs(e,t){return Ge(t.enabled,e)!==!1&&e.isStaleByTime(Mt(t.staleTime,e))}function cm(e,t){return!Xi(e.getCurrentResult(),t)}var ir,ct,Ue,Jt,lt,xt,qa,lm=(qa=class extends rl{constructor(t){super();ee(this,lt);ee(this,ir);ee(this,ct);ee(this,Ue);ee(this,Jt);B(this,ir,t.client),this.mutationId=t.mutationId,B(this,Ue,t.mutationCache),B(this,ct,[]),this.state=t.state||dm(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){w(this,ct).includes(t)||(w(this,ct).push(t),this.clearGcTimeout(),w(this,Ue).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){B(this,ct,w(this,ct).filter(n=>n!==t)),this.scheduleGc(),w(this,Ue).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){w(this,ct).length||(this.state.status==="pending"?this.scheduleGc():w(this,Ue).remove(this))}continue(){var t;return((t=w(this,Jt))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,a,l,d,u,f,m,h,b,v,_,g,T,x,y,O,C,E;const n=()=>{ue(this,lt,xt).call(this,{type:"continue"})},r={client:w(this,ir),meta:this.options.meta,mutationKey:this.options.mutationKey};B(this,Jt,nl({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(k,U)=>{ue(this,lt,xt).call(this,{type:"failed",failureCount:k,error:U})},onPause:()=>{ue(this,lt,xt).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>w(this,Ue).canRun(this)}));const i=this.state.status==="pending",s=!w(this,Jt).canStart();try{if(i)n();else{ue(this,lt,xt).call(this,{type:"pending",variables:t,isPaused:s}),w(this,Ue).config.onMutate&&await w(this,Ue).config.onMutate(t,this,r);const U=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,t,r));U!==this.state.context&&ue(this,lt,xt).call(this,{type:"pending",context:U,variables:t,isPaused:s})}const k=await w(this,Jt).start();return await((d=(l=w(this,Ue).config).onSuccess)==null?void 0:d.call(l,k,t,this.state.context,this,r)),await((f=(u=this.options).onSuccess)==null?void 0:f.call(u,k,t,this.state.context,r)),await((h=(m=w(this,Ue).config).onSettled)==null?void 0:h.call(m,k,null,this.state.variables,this.state.context,this,r)),await((v=(b=this.options).onSettled)==null?void 0:v.call(b,k,null,t,this.state.context,r)),ue(this,lt,xt).call(this,{type:"success",data:k}),k}catch(k){try{await((g=(_=w(this,Ue).config).onError)==null?void 0:g.call(_,k,t,this.state.context,this,r))}catch(U){Promise.reject(U)}try{await((x=(T=this.options).onError)==null?void 0:x.call(T,k,t,this.state.context,r))}catch(U){Promise.reject(U)}try{await((O=(y=w(this,Ue).config).onSettled)==null?void 0:O.call(y,void 0,k,this.state.variables,this.state.context,this,r))}catch(U){Promise.reject(U)}try{await((E=(C=this.options).onSettled)==null?void 0:E.call(C,void 0,k,t,this.state.context,r))}catch(U){Promise.reject(U)}throw ue(this,lt,xt).call(this,{type:"error",error:k}),k}finally{w(this,Ue).runNext(this)}}},ir=new WeakMap,ct=new WeakMap,Ue=new WeakMap,Jt=new WeakMap,lt=new WeakSet,xt=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Ae.batch(()=>{w(this,ct).forEach(r=>{r.onMutationUpdate(t)}),w(this,Ue).notify({mutation:this,type:"updated",action:t})})},qa);function dm(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var yt,st,sr,Ka,um=(Ka=class extends hr{constructor(t={}){super();ee(this,yt);ee(this,st);ee(this,sr);this.config=t,B(this,yt,new Set),B(this,st,new Map),B(this,sr,0)}build(t,n,r){const i=new lm({client:t,mutationCache:this,mutationId:++_r(this,sr)._,options:t.defaultMutationOptions(n),state:r});return this.add(i),i}add(t){w(this,yt).add(t);const n=Tr(t);if(typeof n=="string"){const r=w(this,st).get(n);r?r.push(t):w(this,st).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(w(this,yt).delete(t)){const n=Tr(t);if(typeof n=="string"){const r=w(this,st).get(n);if(r)if(r.length>1){const i=r.indexOf(t);i!==-1&&r.splice(i,1)}else r[0]===t&&w(this,st).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=Tr(t);if(typeof n=="string"){const r=w(this,st).get(n),i=r==null?void 0:r.find(s=>s.state.status==="pending");return!i||i===t}else return!0}runNext(t){var r;const n=Tr(t);if(typeof n=="string"){const i=(r=w(this,st).get(n))==null?void 0:r.find(s=>s!==t&&s.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Ae.batch(()=>{w(this,yt).forEach(t=>{this.notify({type:"removed",mutation:t})}),w(this,yt).clear(),w(this,st).clear()})}getAll(){return Array.from(w(this,yt))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Go(n,r))}findAll(t={}){return this.getAll().filter(n=>Go(t,n))}notify(t){Ae.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Ae.batch(()=>Promise.all(t.map(n=>n.continue().catch(Ve))))}},yt=new WeakMap,st=new WeakMap,sr=new WeakMap,Ka);function Tr(e){var t;return(t=e.options.scope)==null?void 0:t.id}var dt,Ga,fm=(Ga=class extends hr{constructor(t={}){super();ee(this,dt);this.config=t,B(this,dt,new Map)}build(t,n,r){const i=n.queryKey,s=n.queryHash??zs(i,n);let o=this.get(s);return o||(o=new sm({client:t,queryKey:i,queryHash:s,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(i)}),this.add(o)),o}add(t){w(this,dt).has(t.queryHash)||(w(this,dt).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=w(this,dt).get(t.queryHash);n&&(t.destroy(),n===t&&w(this,dt).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Ae.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return w(this,dt).get(t)}getAll(){return[...w(this,dt).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Ko(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Ko(t,r)):n}notify(t){Ae.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Ae.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Ae.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},dt=new WeakMap,Ga),xe,Nt,Dt,vn,Sn,Rt,Tn,xn,Qa,hm=(Qa=class{constructor(e={}){ee(this,xe);ee(this,Nt);ee(this,Dt);ee(this,vn);ee(this,Sn);ee(this,Rt);ee(this,Tn);ee(this,xn);B(this,xe,e.queryCache||new fm),B(this,Nt,e.mutationCache||new um),B(this,Dt,e.defaultOptions||{}),B(this,vn,new Map),B(this,Sn,new Map),B(this,Rt,0)}mount(){_r(this,Rt)._++,w(this,Rt)===1&&(B(this,Tn,Hs.subscribe(async e=>{e&&(await this.resumePausedMutations(),w(this,xe).onFocus())})),B(this,xn,Gr.subscribe(async e=>{e&&(await this.resumePausedMutations(),w(this,xe).onOnline())})))}unmount(){var e,t;_r(this,Rt)._--,w(this,Rt)===0&&((e=w(this,Tn))==null||e.call(this),B(this,Tn,void 0),(t=w(this,xn))==null||t.call(this),B(this,xn,void 0))}isFetching(e){return w(this,xe).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return w(this,Nt).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=w(this,xe).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=w(this,xe).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Mt(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return w(this,xe).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),i=w(this,xe).get(r.queryHash),s=i==null?void 0:i.state.data,o=Kh(t,s);if(o!==void 0)return w(this,xe).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return Ae.batch(()=>w(this,xe).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=w(this,xe).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=w(this,xe);Ae.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=w(this,xe);return Ae.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Ae.batch(()=>w(this,xe).findAll(e).map(i=>i.cancel(n)));return Promise.all(r).then(Ve).catch(Ve)}invalidateQueries(e,t={}){return Ae.batch(()=>(w(this,xe).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=Ae.batch(()=>w(this,xe).findAll(e).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let s=i.fetch(void 0,n);return n.throwOnError||(s=s.catch(Ve)),i.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(Ve)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=w(this,xe).build(this,t);return n.isStaleByTime(Mt(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Ve).catch(Ve)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ve).catch(Ve)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return Gr.isOnline()?w(this,Nt).resumePausedMutations():Promise.resolve()}getQueryCache(){return w(this,xe)}getMutationCache(){return w(this,Nt)}getDefaultOptions(){return w(this,Dt)}setDefaultOptions(e){B(this,Dt,e)}setQueryDefaults(e,t){w(this,vn).set(Zn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...w(this,vn).values()],n={};return t.forEach(r=>{Yn(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){w(this,Sn).set(Zn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...w(this,Sn).values()],n={};return t.forEach(r=>{Yn(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...w(this,Dt).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=zs(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Kr&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...w(this,Dt).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){w(this,xe).clear(),w(this,Nt).clear()}},xe=new WeakMap,Nt=new WeakMap,Dt=new WeakMap,vn=new WeakMap,Sn=new WeakMap,Rt=new WeakMap,Tn=new WeakMap,xn=new WeakMap,Qa),al=Ie.createContext(void 0),mr=e=>{const t=Ie.useContext(al);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},mm=({client:e,children:t})=>(Ie.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),c.jsx(al.Provider,{value:e,children:t})),cl=Ie.createContext(!1),pm=()=>Ie.useContext(cl);cl.Provider;function gm(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var ym=Ie.createContext(gm()),bm=()=>Ie.useContext(ym),_m=(e,t,n)=>{const r=n!=null&&n.state.error&&typeof e.throwOnError=="function"?el(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},wm=e=>{Ie.useEffect(()=>{e.clearReset()},[e])},vm=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||el(n,[e.error,r])),Sm=e=>{if(e.suspense){const n=i=>i==="static"?i:Math.max(i??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...i)=>n(r(...i)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},Tm=(e,t)=>e.isLoading&&e.isFetching&&!t,xm=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,na=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function km(e,t,n){var h,b,v,_;if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const r=pm(),i=bm(),s=mr(),o=s.defaultQueryOptions(e);(b=(h=s.getDefaultOptions().queries)==null?void 0:h._experimental_beforeQuery)==null||b.call(h,o);const a=s.getQueryCache().get(o.queryHash);process.env.NODE_ENV!=="production"&&(o.queryFn||console.error(`[${o.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`));const l=e.subscribed!==!1;o._optimisticResults=r?"isRestoring":l?"optimistic":void 0,Sm(o),_m(o,i,a),wm(i);const d=!s.getQueryCache().get(o.queryHash),[u]=Ie.useState(()=>new t(s,o)),f=u.getOptimisticResult(o),m=!r&&l;if(Ie.useSyncExternalStore(Ie.useCallback(g=>{const T=m?u.subscribe(Ae.batchCalls(g)):Ve;return u.updateResult(),T},[u,m]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),Ie.useEffect(()=>{u.setOptions(o)},[o,u]),xm(o,f))throw na(o,u,i);if(vm({result:f,errorResetBoundary:i,throwOnError:o.throwOnError,query:a,suspense:o.suspense}))throw f.error;if((_=(v=s.getDefaultOptions().queries)==null?void 0:v._experimental_afterQuery)==null||_.call(v,o,f),o.experimental_prefetchInRender&&!Jn.isServer()&&Tm(f,r)){const g=d?na(o,u,i):a==null?void 0:a.promise;g==null||g.catch(Ve).finally(()=>{u.updateResult()})}return o.notifyOnChangeProps?f:u.trackResult(f)}function Mn(e,t){return km(e,om)}function Pm(e,t){const n=mr(),r=n.getQueryCache();return Ie.useSyncExternalStore(Ie.useCallback(i=>r.subscribe(Ae.batchCalls(i)),[r]),()=>n.isFetching(e),()=>n.isFetching(e))}const ll=p.createContext(null);function Cm(e){return typeof window>"u"?e??null:e?(localStorage.setItem(Wc,e),e):null}function Om({token:e,children:t}){const n=Cm(e);return c.jsx(ll.Provider,{value:n,children:t})}function Em(){return p.useContext(ll)}const Ks="widget-accounts",Gs="widget-positions",Qs="widget-orders",pr="widget-deals",gr="widget-deals-total",Am=2e4,Lm=3e4;function Dr(e){const t=String(e.getUTCDate()).padStart(2,"0"),n=String(e.getUTCMonth()+1).padStart(2,"0"),r=String(e.getUTCHours()).padStart(2,"0"),i=String(e.getUTCMinutes()).padStart(2,"0"),s=String(e.getUTCSeconds()).padStart(2,"0");return`${n}.${t} ${r}:${i}:${s}`}function dl(e){const t=["seconds","Seconds","timestamp","Timestamp","value","Value","time","Time"];for(const n of t)if(e[n]!==void 0&&e[n]!==null&&e[n]!=="")return e[n]}function Zs(e){if(e==null||e==="")return 0;if(typeof e=="number"&&Number.isFinite(e))return e>1e12?e:e*1e3;if(typeof e=="string"){const t=e.trim();if(!t)return 0;if(/^\d+$/.test(t)){const r=Number(t);if(Number.isFinite(r))return r>1e12?r:r*1e3}const n=Date.parse(t);if(Number.isFinite(n))return n}if(typeof e=="object"&&e!==null){const n=dl(e);if(n!==void 0)return Zs(n)}return 0}function Ys(e){if(e==null||e==="")return"—";if(typeof e=="number"&&Number.isFinite(e)){const t=e>1e12?e:e*1e3;return Dr(new Date(t))}if(typeof e=="string"){const t=e.trim();if(!t)return"—";if(/^\d+$/.test(t)){const r=Number(t);if(Number.isFinite(r)){const i=r>1e12?r:r*1e3;return Dr(new Date(i))}}const n=Date.parse(t);return Number.isFinite(n)?Dr(new Date(n)):t}if(typeof e=="object"&&e!==null){const n=dl(e);if(n!==void 0)return Ys(n)}return"—"}const ul=["time","Time","openTime","open_time","OpenTime","TimeOpen","timeOpen","timeCreate","TimeCreate","timeSetup","TimeSetup","setupTime","setup_time","createdAt","created_at","createTime","CreateTime","timestamp","Timestamp","openDate","OpenDate","date","Date"];function Nm(e){return Dr(e)}const Dm={0:"buy",1:"sell",2:"buy limit",3:"sell limit",4:"buy stop",5:"sell stop",6:"buy stop limit",7:"sell stop limit"};function mi(e,t){for(const n of t)if(e[n]!==void 0&&e[n]!==null&&e[n]!=="")return e[n]}function Xe(e,t){const n=mi(e,t);if(n===void 0)return;const r=Number(n);return Number.isFinite(r)?r:void 0}function xr(e,t){const n=mi(e,t);if(n!==void 0)return String(n)}function Rm(e){if(Array.isArray(e))return e.filter(r=>typeof r=="object"&&r!==null);if(!e||typeof e!="object")return[];const t=e,n=["data","body","result"];for(const r of n){const i=t[r];if(Array.isArray(i))return i.filter(s=>typeof s=="object"&&s!==null);if(i&&typeof i=="object"){const s=i,o=["list","items","records","orders","content","data"];for(const a of o){const l=s[a];if(Array.isArray(l))return l.filter(d=>typeof d=="object"&&d!==null)}}}return[]}function fs(e){return e===void 0?.01:e>=100?e/1e4:e}function jm(e,t){return nc(t,e)}function Mm(e){const t=mi(e,["type","Type","orderType","OrderType"]);if(typeof t=="string"){const r=t.toLowerCase().trim();if(r)return{label:r,side:r.includes("sell")?"sell":"buy",typeNum:r.includes("sell")?3:2}}const n=Xe(e,["type","Type","orderType","OrderType"])??2;return{label:Dm[n]??(n%2===1?"sell":"buy"),side:$r(n),typeNum:n}}function Um(e,t){const n=Xe(e,["volumeFilled","volume_filled","VolumeFilled","filledVolume","FilledVolume"]);if(n!==void 0)return fs(n);const r=Xe(e,["volumeCurrent","volume_current","VolumeCurrent"]);return r!==void 0?fs(r):0}function Im(e,t){const n=xr(e,["ticket","Ticket","order","Order","id","ID"]),r=xr(e,["symbol","Symbol"])??"";if(!n||!r)return null;const i=Ne(r),{label:s,side:o,typeNum:a}=Mm(e),l=Xe(e,["typeTime","TypeTime"])??0,d=fs(Xe(e,["volumeLots","volume_lots","VolumeLots","volume","Volume"])),u=Um(e),f=Xe(e,["priceOrder","price_order","PriceOrder","openPrice","open_price","price","Price"])??0,m=Xe(e,["priceTrigger","price_trigger","PriceTrigger","triggerPrice","TriggerPrice"]),h=Xe(e,["currentPrice","current_price","PriceCurrent","priceCurrent","marketPrice","MarketPrice"])??f,b=Xe(e,["stopLoss","stop_loss","PriceSL","sl","SL"]),v=Xe(e,["takeProfit","take_profit","PriceTP","tp","TP"]),_=Xe(e,["marketBid","MarketBid","bid","Bid"])??h,g=Xe(e,["marketAsk","MarketAsk","ask","Ask"])??h,T=xr(e,["comment","Comment"])??"",x=jm(e,i),y=mi(e,ul),O=Zs(y),C=Ys(y);return{ticket:n,login:xr(e,["login","Login"])??t,symbol:i,displaySymbol:si(i),openTimeMs:O,time:C,typeLabel:s,orderType:a,typeTime:l,side:o,volumeLots:d,volumeFilledLots:u,orderPrice:f,priceTrigger:m,stopLoss:b,takeProfit:v,currentPrice:h,marketBid:_,marketAsk:g,comment:T,digits:x}}function Fm(e,t){return Rm(e).map(n=>Im(n,t)).filter(n=>n!==null)}function pi(e,t){for(const n of t)if(e[n]!==void 0&&e[n]!==null&&e[n]!=="")return e[n]}function kt(e,t){const n=pi(e,t);if(n===void 0)return;const r=Number(n);return Number.isFinite(r)?r:void 0}function kr(e,t){const n=pi(e,t);if(n!==void 0)return String(n)}function Bm(e){if(Array.isArray(e))return e.filter(r=>typeof r=="object"&&r!==null);if(!e||typeof e!="object")return[];const t=e,n=["data","body","result"];for(const r of n){const i=t[r];if(Array.isArray(i))return i.filter(s=>typeof s=="object"&&s!==null);if(i&&typeof i=="object"){const s=i,o=["list","items","records","positions","orders","content","data"];for(const a of o){const l=s[a];if(Array.isArray(l))return l.filter(d=>typeof d=="object"&&d!==null)}}}return[]}function Wm(e){return e===void 0?.01:e>=100?e/1e4:e}function $m(e){const t=pi(e,["type","Type","action","Action","side","Side"]);if(typeof t=="string"){const r=t.toLowerCase();if(r.includes("sell"))return"sell";if(r.includes("buy"))return"buy"}const n=kt(e,["type","Type","action","Action"]);return n!==void 0&&n%2===1?"sell":"buy"}function Vm(e,t){return nc(t,e)}function Hm(e,t){const n=kr(e,["ticket","Ticket","position","Position","order","Order","id","ID"]),r=kr(e,["symbol","Symbol"])??"";if(!n||!r)return null;const i=Ne(r),s=$m(e),o=Wm(kt(e,["volumeLots","volume_lots","VolumeLots","volume","Volume"])),a=kt(e,["openPrice","open_price","PriceOpen","priceOpen","price","Price"])??0,l=kt(e,["currentPrice","current_price","PriceCurrent","priceCurrent"])??a,d=kt(e,["stopLoss","stop_loss","PriceSL","sl","SL"]),u=kt(e,["takeProfit","take_profit","PriceTP","tp","TP"]),f=kt(e,["profit","Profit","floating","Floating","pnl","PnL"])??0,m=kt(e,["swap","Swap"])??0,h=kr(e,["comment","Comment"])??"",b=Vm(e,i),v=pi(e,ul),_=Ys(v),g=Zs(v),T=Pd(s,a,l,f);return{ticket:n,login:kr(e,["login","Login"])??t,symbol:i,displaySymbol:si(i),openTimeMs:g,time:_,type:s,volumeLots:o,openPrice:a,stopLoss:d,takeProfit:u,currentPrice:l,marketBid:l,marketAsk:l,swap:m,profit:f,profitPerPriceUnit:T,comment:h,digits:b}}function zm(e,t){return Bm(e).map(n=>Hm(n,t)).filter(n=>n!==null)}function yr(){return _t}function fl(){const e=nt(),t=Em(),{data:n,isLoading:r,isError:i}=Mn({queryKey:[Ks,e.baseUrl,t],queryFn:()=>e.getAccounts(),enabled:!!t,refetchInterval:Lm});return{accounts:n??[],isLoading:r,isError:i}}function qm(e){const t=nt();return Mn({queryKey:[Gs,t.baseUrl,e],queryFn:()=>t.dealer.getPositions(e),enabled:!!e,refetchInterval:Am})}function Km(e){const t=nt();return Mn({queryKey:[Qs,t.baseUrl,e],queryFn:()=>t.dealer.getOrders(e),enabled:!!e})}function Gm(e,t){e.invalidateQueries({queryKey:[Ks,t]})}function Qm(e,t,n){e.invalidateQueries({queryKey:[gr,t,n]}),e.invalidateQueries({queryKey:[pr,t,n]})}function Zm(){const e=mr(),t=nt();return p.useCallback(async n=>{await Promise.all([e.invalidateQueries({queryKey:[gr,t.baseUrl,n]}),e.invalidateQueries({queryKey:[pr,t.baseUrl,n]})])},[t.baseUrl,e])}function Ym(){const e=mr(),t=nt();return p.useCallback(async n=>{await Promise.all([e.invalidateQueries({queryKey:[Ks,t.baseUrl]}),e.invalidateQueries({queryKey:[Gs,t.baseUrl,n]}),e.invalidateQueries({queryKey:[Qs,t.baseUrl,n]}),e.invalidateQueries({queryKey:[gr,t.baseUrl,n]}),e.invalidateQueries({queryKey:[pr,t.baseUrl,n]})])},[t.baseUrl,e])}function Jm(){const e=mr(),t=nt();return p.useCallback((n,r,i)=>{Gm(e,t.baseUrl),e.invalidateQueries({queryKey:[Gs,t.baseUrl,n]}),(r===void 0||Es(r))&&e.invalidateQueries({queryKey:[Qs,t.baseUrl,n]}),(i==null?void 0:i.invalidateDeals)!==!1&&Qm(e,t.baseUrl,n)},[t.baseUrl,e])}function gi(){const e=nt(),t=Jm();return{async submitOrder(n){const r=await e.trading.submitOrder(n);return r.success&&t(n.login,n.orderType),r},async closePosition(n,r){const i=await e.trading.closePosition(n);return i.success&&!(r!=null&&r.skipInvalidation)&&t(n.login),i},async deleteOrder(n){const r=await e.trading.deleteOrder(n);return r.success&&t(n.login,n.orderType),r},async modifyOrder(n,r){const i=await e.trading.modifyOrder(n,r);return i.success&&t(n.login,n.orderType),i},async modifyPosition(n,r){const i=await e.trading.modifyPosition(n,r);return i.success&&t(n.login),i}}}function Xm(e){if(e===null||typeof e!="object")return{deals:[],offset:0,count:0};const t=e,n=t.data??t,i=(Array.isArray(n.deals)?n.deals:[]).map(s=>{const o=s??{};return{deal:Number(o.Deal??0),login:Number(o.Login??0),symbol:String(o.Symbol??""),action:Number(o.Action??0),volume:Number(o.Volume??0),price:Number(o.Price??0),profit:Number(o.Profit??0),time:Number(o.Time??0),entry:Number(o.Entry??0),comment:String(o.Comment??"")}});return{deals:i,offset:Number(n.offset??0),count:Number(n.count??i.length)}}function ep(e){if(e===null||typeof e!="object")return{total:0};const t=e,n=t.data??t;return{total:Number(n.total??0)}}function tp(e,t,n,r={}){const i=nt();return Mn({queryKey:[gr,i.baseUrl,e,t,n],queryFn:async()=>{const s=await i.dealer.getDealsTotal(e,t,n);return ep(s)},enabled:r.enabled??!0})}function np(e,t,n,r,i,s={}){const o=nt();return Mn({queryKey:[pr,o.baseUrl,e,t,n,r,i],queryFn:async()=>{const a=await o.dealer.getDeals(e,t,n,r,i);return Xm(a)},enabled:s.enabled??!0})}function rp(e,t){return e!=null?zm(e,t):[]}function ip(e,t){return e!=null?Fm(e,t):[]}function sp({symbolTicker:e,controlsRef:t,chartWidget:n,sidePanelTab:r,orderState:i,backUrl:s,createAccountUrl:o}){const{openMarketPanel:a,setSelectedLogin:l,hasConfirmedAccount:d}=i,u=yr();return p.useEffect(()=>(t.current={open:a,setSelectedLogin:l},()=>{t.current=null}),[t,a,l]),c.jsxs(c.Fragment,{children:[d?c.jsx(Yc,{chartWidget:n,symbolTicker:e,symbols:u}):null,d?c.jsx(zc,{}):null,c.jsx(Ch,{symbolTicker:e,symbols:u,sidePanelTab:r,orderState:i,backUrl:s,createAccountUrl:o})]})}const op=8,ra=11;function ap({wide:e}){return c.jsx("td",{className:"web-trading-widget-terminal__cell",children:c.jsx("div",{className:`web-trading-widget-terminal__skeleton-bar${e?" web-trading-widget-terminal__skeleton-bar--wide":""}`})})}function cp(){return c.jsx(c.Fragment,{children:Array.from({length:op},(e,t)=>c.jsx("tr",{className:"web-trading-widget-terminal__skeleton-row",children:Array.from({length:ra},(n,r)=>c.jsx(ap,{wide:r===ra-1},r))},t))})}const lp="web-trading-widget-text-buy",dp="web-trading-widget-text-sell",up="web-trading-widget-terminal__head-row",Ri=50;function fp(e){return e===0?lp:e===1?dp:up}const ia=e=>e.toISOString().split("T")[0],hl=e=>Math.floor(new Date(e).getTime()/1e3),hp=e=>hl(e),mp=e=>hl(e)+86399;function pp(){const e=new Date,t=new Date;return t.setDate(t.getDate()-7),{fromTs:hp(ia(t)),toTs:mp(ia(e))}}const gp=10800,yp=e=>new Date((e-gp)*1e3).toLocaleString(void 0,{year:"numeric",month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!0});function bp(e){try{return decodeURIComponent(e)}catch{return e}}function _p(e,t){return`${e.replace(/\/$/,"")}/${encodeURIComponent(t)}`}function wp(){return c.jsxs("colgroup",{children:[c.jsx("col",{className:"web-trading-widget-terminal-col--deal"}),c.jsx("col",{className:"web-trading-widget-terminal-col--ticket"}),c.jsx("col",{className:"web-trading-widget-terminal-col--symbol"}),c.jsx("col",{className:"web-trading-widget-terminal-col--type"}),c.jsx("col",{className:"web-trading-widget-terminal-col--volume"}),c.jsx("col",{className:"web-trading-widget-terminal-col--price"}),c.jsx("col",{className:"web-trading-widget-terminal-col--profit"}),c.jsx("col",{className:"web-trading-widget-terminal-col--entry"}),c.jsx("col",{className:"web-trading-widget-terminal-col--time"}),c.jsx("col",{className:"web-trading-widget-terminal-col--local-time"}),c.jsx("col",{})]})}function vp(){const{t:e}=Te();return c.jsx("thead",{children:c.jsxs("tr",{className:"web-trading-widget-terminal__head-row",children:[c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:e("WebTrading.deal")}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:e("WebTrading.login")}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:e("WebTrading.symbol")}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:e("WebTrading.action")}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:e("WebTrading.volume")}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:e("WebTrading.price")}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:e("WebTrading.profit")}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:e("WebTrading.entry")}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:e("WebTrading.time")}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:e("WebTrading.localTime")}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:e("WebTrading.comment")})]})})}function Sp({deal:e,dealActions:t}){const{t:n}=Te(),r=e.profit>0?"web-trading-widget-text-profit-positive":e.profit<0?"web-trading-widget-text-profit-negative":"";return c.jsxs("tr",{className:"web-trading-widget-terminal__deals-row",children:[c.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.deal}),c.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.login}),c.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.symbol||"—"}),c.jsx("td",{className:`web-trading-widget-terminal__cell web-trading-widget-terminal__cell--capitalize ${fp(e.action)}`,children:t[e.action]??n("WebTrading.unknownAction",{action:e.action})}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:(e.volume/1e4).toFixed(2)}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.price.toFixed(5)}),c.jsxs("td",{className:`web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right ${r}`,children:[e.profit>0?"+":"",e.profit.toFixed(2)]}),c.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.entry===1?n("WebTrading.entryOut"):n("WebTrading.entryIn")}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--nowrap",children:Nm(new Date(e.time*1e3))}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--nowrap",children:yp(e.time)}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--truncate",children:e.comment?bp(e.comment):"—"})]})}function Tp({login:e,detailUrl:t}){const{t:n}=Te(),r=p.useMemo(()=>({0:n("WebTrading.buy"),1:n("WebTrading.sell"),2:n("WebTrading.balanceType"),3:n("WebTrading.credit"),5:"-"}),[n]),{fromTs:i,toTs:s}=p.useMemo(()=>pp(),[]),o=e!=="",{data:a,isLoading:l}=tp(e,i,s,{enabled:o}),d=(a==null?void 0:a.total)??0,u=Math.max(0,d-Ri),f=d>0?Math.min(Ri,d):Ri,{data:m,isLoading:h}=np(e,i,s,u,f,{enabled:o}),b=o&&(l||h),v=p.useMemo(()=>[...(m==null?void 0:m.deals)??[]].sort((_,g)=>g.time-_.time),[m==null?void 0:m.deals]);return e?c.jsx("div",{className:"web-trading-widget-terminal__deals-wrap",children:c.jsxs("div",{className:"web-trading-widget-terminal__body-scroll",children:[c.jsxs("table",{className:"web-trading-widget-terminal__deals-table",children:[c.jsx(wp,{}),c.jsx(vp,{}),c.jsxs("tbody",{children:[b?c.jsx(cp,{}):null,!b&&v.length===0?c.jsx("tr",{children:c.jsx("td",{colSpan:11,className:"web-trading-widget-terminal__empty-cell",children:n("WebTrading.noDealsFound")})}):null,b?null:v.map(_=>c.jsx(Sp,{deal:_,dealActions:r},_.deal))]})]}),t?c.jsx("div",{className:"web-trading-widget-terminal__deals-footer",children:c.jsx("a",{href:_p(t,e),className:"web-trading-widget-terminal__deals-detail-btn",children:n("WebTrading.seeFullDealHistory")})}):null]})}):c.jsx("div",{className:"web-trading-widget-terminal__empty-cell",children:n("WebTrading.selectAccountForDeals")})}function ml(e,t=!0){const n=t&&e.trim()?e.trim():"",r=le(f=>f.setPositions),i=le(f=>f.setOrders),{data:s,isLoading:o,isError:a}=qm(n),{data:l,isLoading:d,isError:u}=Km(n);return p.useEffect(()=>{if(!n){r([]),i([]);return}s!=null&&r(rp(s,n)),l!=null&&i(ip(l,n))},[n,l,s,i,r]),{isLoading:t&&(o||d),isError:t&&!!(a||u)}}const sa=224,oa=32,Js=120;function pl(){return typeof window>"u"?560:Math.max(Js,Math.floor(window.innerHeight*.7))}function xp(e){return Math.min(pl(),Math.max(Js,e))}function kp(){const[e,t]=p.useState(sa),[n,r]=p.useState(!1),i=p.useRef(sa);p.useEffect(()=>{i.current=e},[e]);const s=p.useCallback(u=>{t(xp(u))},[]),o=p.useCallback(()=>{s(i.current+oa)},[s]),a=p.useCallback(()=>{s(i.current-oa)},[s]),l=p.useCallback(u=>{const f=u,m=i.current;r(!0);const h=v=>{const _=f-v.clientY;s(m+_)},b=()=>{r(!1),document.removeEventListener("mousemove",h),document.removeEventListener("mouseup",b),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",h),document.addEventListener("mouseup",b),document.body.style.cursor="row-resize",document.body.style.userSelect="none"},[s]);p.useEffect(()=>{const u=()=>{s(i.current)};return window.addEventListener("resize",u),()=>{window.removeEventListener("resize",u),document.body.style.cursor="",document.body.style.userSelect=""}},[s]);const d=pl();return{height:e,isResizing:n,canIncrement:e<d,canDecrement:e>Js,onResizeStart:l,incrementHeight:o,decrementHeight:a}}const gl=e=>e==null?void 0:e.replace(/(\d+)\.0{18}/g,"$1"),Pp=2e4,en={ADD_TOAST:"ADD_TOAST",DISMISS_TOAST:"DISMISS_TOAST",REMOVE_TOAST:"REMOVE_TOAST"},ji=new Map,aa=(e,t)=>{if(ji.has(e))return;const n=setTimeout(()=>{ji.delete(e),Qr({type:en.REMOVE_TOAST,toastId:e})},t??Pp);ji.set(e,n)};function Cp(e,t){switch(t.type){case en.ADD_TOAST:return{...e,toasts:[t.toast,...e.toasts].slice(0,t.limit??1)};case en.DISMISS_TOAST:{const{toastId:n}=t;if(n){const r=e.toasts.find(i=>i.id===n);aa(n,r==null?void 0:r.duration)}else e.toasts.forEach(r=>{aa(r.id,r.duration)});return{...e,toasts:e.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case en.REMOVE_TOAST:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)};default:return e}}const Rr=[];let jr={toasts:[]},Mi=0;function Op(){return Mi=(Mi+1)%Number.MAX_VALUE,Mi.toString()}function Qr(e){jr=Cp(jr,e),Rr.forEach(t=>{t(jr)})}function ge({duration:e=2e4,description:t,limit:n,...r}){const i=Op(),s=typeof t=="string"?gl(t):t,o=()=>{Qr({type:en.DISMISS_TOAST,toastId:i})};return Qr({type:en.ADD_TOAST,limit:n,toast:{...r,description:s,id:i,open:!0,duration:e}}),e&&setTimeout(o,e),{id:i,dismiss:o}}function Ep(){const[e,t]=Ie.useState(jr);return Ie.useEffect(()=>(Rr.push(t),()=>{const n=Rr.indexOf(t);n>-1&&Rr.splice(n,1)}),[]),{...e,toast:ge,dismiss:n=>Qr({type:en.DISMISS_TOAST,toastId:n})}}function Ap(e){return e.type==="buy"?e.marketBid??e.currentPrice:e.marketAsk??e.currentPrice}function Lp(){const{t:e}=Te(),{closePosition:t,deleteOrder:n}=gi(),r=Ym(),i=le(g=>g.removePosition),s=le(g=>g.removeOrder),o=le(g=>g.setSelectedPositionTicket),a=le(g=>g.setSelectedOrderTicket),[l,d]=p.useState(new Set),[u,f]=p.useState(!1),m=p.useCallback((g,T)=>{d(x=>{const y=new Set(x);return T?y.add(g):y.delete(g),y})},[]),h=p.useCallback(g=>l.has(g),[l]),b=p.useCallback(async g=>{const T=`position-${g.ticket}`;m(T,!0);try{const x=await t(g);if(!x.success){ge({variant:"destructive",description:x.message||e("WebTrading.failedClosePosition")});return}i(g.ticket),o(null),ge({description:e("WebTrading.positionClosed",{ticket:g.ticket,price:Ap(g).toFixed(g.digits)})})}catch(x){const y=x instanceof Error?x.message:e("WebTrading.failedClosePosition");ge({variant:"destructive",description:y})}finally{m(T,!1)}},[t,i,m,o,e]),v=p.useCallback(async g=>{var O;if(g.length===0||u)return;if(!t){ge({variant:"destructive",description:e("WebTrading.closePositionNotConfigured")});return}f(!0);let T=0,x=0;const y=((O=g[0])==null?void 0:O.login)??"";for(const C of g){const E=`position-${C.ticket}`;m(E,!0);try{if(!(await t(C,{skipInvalidation:!0})).success){x+=1;continue}i(C.ticket),T+=1}catch{x+=1}finally{m(E,!1)}}o(null),T>0&&y&&await r(y),ge(x===0?{description:T===1?e("WebTrading.onePositionClosed"):e("WebTrading.positionsClosed",{count:T})}:T===0?{variant:"destructive",description:e("WebTrading.failedClosePositions")}:{variant:"destructive",description:e("WebTrading.closedFailedSummary",{closed:T,failed:x})}),f(!1)},[u,t,r,i,m,o,e]),_=p.useCallback(async g=>{const T=`order-${g.ticket}`;m(T,!0);try{const x=await n(g);if(!x.success){ge({variant:"destructive",description:x.message||e("WebTrading.failedDeleteOrder")});return}s(g.ticket),a(null),ge({description:e("WebTrading.orderDeleted",{ticket:g.ticket})})}catch(x){const y=x instanceof Error?x.message:e("WebTrading.failedDeleteOrder");ge({variant:"destructive",description:y})}finally{m(T,!1)}},[n,s,m,a,e]);return{closePosition:b,closeAllPositions:v,deleteOrder:_,isClosingAll:u,isRowBusy:h}}function Pt(e,t=2){return e.toFixed(t)}function yl(e){return e.reduce((t,n)=>t+n.profit+n.swap,0)}function Np(e,t,n){const r=(e==null?void 0:e.balance)??0,i=(e==null?void 0:e.credit)??0,s=(e==null?void 0:e.margin)??0;if(!e||t.length===0)return{balance:r,equity:(e==null?void 0:e.equity)??r+i,margin:s,marginFree:(e==null?void 0:e.marginFree)??0,marginLevel:e==null?void 0:e.marginLevel,totalProfit:0};const o=yl(t),a=r+i+o+n,l=a-s,d=s>0?a/s*100:void 0;return{balance:r,equity:a,margin:s,marginFree:l,marginLevel:d,totalProfit:o}}function hs(){return c.jsxs("colgroup",{children:[c.jsx("col",{className:"web-trading-widget-terminal-col--symbol"}),c.jsx("col",{className:"web-trading-widget-terminal-col--ticket"}),c.jsx("col",{className:"web-trading-widget-terminal-col--time"}),c.jsx("col",{className:"web-trading-widget-terminal-col--type"}),c.jsx("col",{className:"web-trading-widget-terminal-col--volume"}),c.jsx("col",{className:"web-trading-widget-terminal-col--price"}),c.jsx("col",{className:"web-trading-widget-terminal-col--sl"}),c.jsx("col",{className:"web-trading-widget-terminal-col--tp"}),c.jsx("col",{className:"web-trading-widget-terminal-col--price2"}),c.jsx("col",{className:"web-trading-widget-terminal-col--swap"}),c.jsx("col",{className:"web-trading-widget-terminal-col--profit"}),c.jsx("col",{}),c.jsx("col",{className:"web-trading-widget-terminal-col--close"})]})}function Dp(){const{t:e}=Te();return c.jsx("thead",{children:c.jsxs("tr",{className:"web-trading-widget-terminal__head-row",children:[c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:e("WebTrading.symbol")}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:e("WebTrading.ticket")}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:e("WebTrading.serverTime")}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:e("WebTrading.type")}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:e("WebTrading.volume")}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:e("WebTrading.price")}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:e("WebTrading.stopLossShort")}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:e("WebTrading.takeProfitShort")}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:e("WebTrading.price")}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:e("WebTrading.swap")}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:e("WebTrading.profit")}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:e("WebTrading.comment")}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--close","aria-label":e("WebTrading.close")})]})})}function Rp({balance:e,equity:t,margin:n,marginFree:r,marginLevel:i,totalPnL:s,scrollRef:o,onScroll:a}){const{t:l}=Te(),d=s>0?"web-trading-widget-text-profit-positive":s<0?"web-trading-widget-text-profit-negative":"";return c.jsx("div",{className:"web-trading-widget-terminal__stats",children:c.jsx("div",{ref:o,className:"web-trading-widget-terminal__header-scroll",onScroll:a,children:c.jsxs("table",{className:"web-trading-widget-terminal__table",children:[c.jsx(hs,{}),c.jsx("tbody",{children:c.jsxs("tr",{children:[c.jsx("td",{colSpan:10,className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--nowrap",children:c.jsxs("div",{className:"web-trading-widget-terminal__stats-row web-trading-widget-terminal__stats-row--tabular",children:[c.jsxs("span",{children:[l("WebTrading.balance"),": ",Pt(e)]}),c.jsxs("span",{children:[l("WebTrading.equity"),": ",Pt(t)]}),c.jsxs("span",{children:[l("WebTrading.margin"),": ",Pt(n)]}),c.jsxs("span",{children:[l("WebTrading.freeMargin"),": ",Pt(r)]}),c.jsxs("span",{children:[l("WebTrading.level"),": ",i!==void 0?`${Pt(i,2)}%`:"0.00%"]})]})}),c.jsx("td",{className:`web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right ${d}`,children:Pt(s)}),c.jsx("td",{className:"web-trading-widget-terminal__cell"}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--close"})]})})]})})})}function jp({activeTab:e,onTabChange:t,positionCount:n,isClosingAll:r,onCloseAllPositions:i,isRefetchingDeals:s,onRefetchDeals:o}){const{t:a}=Te(),l=[{id:"trade",label:a("WebTrading.trade")},{id:"history",label:a("WebTrading.history")}],d=e==="trade"&&(n>0||r),u=e==="history";return c.jsxs("div",{role:"tablist","aria-label":a("WebTrading.terminalPanelTabs"),className:"web-trading-widget-terminal__tab-bar",children:[l.map(f=>{const m=e===f.id;return c.jsx("button",{type:"button",role:"tab","aria-selected":m,onClick:()=>t(f.id),className:`web-trading-widget-terminal__tab-btn${m?" web-trading-widget-terminal__tab-btn--active":""}`,children:f.label},f.id)}),c.jsxs("div",{className:"web-trading-widget-terminal__toolbar-actions",children:[d?c.jsx("button",{type:"button",disabled:r,onClick:i,className:"web-trading-widget-terminal__close-all-btn",children:a(r?"WebTrading.closing":"WebTrading.closeAll")}):null,u?c.jsxs("button",{type:"button",disabled:s,onClick:o,className:"web-trading-widget-terminal__refetch-btn","aria-label":a("WebTrading.refreshDealHistory"),children:[c.jsx(_d,{className:`web-trading-widget-icon web-trading-widget-icon--sm${s?" web-trading-widget-terminal__refetch-icon--spinning":""}`}),a(s?"WebTrading.refreshing":"WebTrading.refresh")]}):null]})]})}function Mp({position:e,isSelected:t,isClosing:n,onSelect:r,onClose:i}){const{t:s}=Te(),o=e.type==="buy"?"web-trading-widget-text-buy":"web-trading-widget-text-sell",a=e.profit>0?"web-trading-widget-text-profit-positive":e.profit<0?"web-trading-widget-text-profit-negative":"";return c.jsxs("tr",{className:`web-trading-widget-terminal__row${t?" web-trading-widget-terminal__row--selected":""}`,onClick:r,children:[c.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.displaySymbol}),c.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.ticket}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--nowrap",children:e.time}),c.jsx("td",{className:`web-trading-widget-terminal__cell web-trading-widget-terminal__cell--capitalize ${o}`,children:e.type}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.volumeLots.toFixed(2)}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:pe(e.openPrice,e.digits)}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.stopLoss!==void 0&&e.stopLoss!==0?pe(e.stopLoss,e.digits):s("WebTrading.notAvailable")}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.takeProfit!==void 0&&e.takeProfit!==0?pe(e.takeProfit,e.digits):s("WebTrading.notAvailable")}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:pe(e.currentPrice,e.digits)}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.swap!==0?Pt(e.swap):""}),c.jsx("td",{className:`web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right ${a}`,children:Pt(e.profit)}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--truncate",children:e.comment}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--close",children:c.jsx("button",{type:"button","aria-label":s("WebTrading.closePositionTicket",{ticket:e.ticket}),title:s("WebTrading.closePosition"),disabled:n,className:"web-trading-widget-terminal__row-close-btn",onClick:l=>{l.stopPropagation(),i()},children:c.jsx(Bt,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})})})]})}function Up({order:e,isSelected:t,isDeleting:n,onSelect:r,onDelete:i}){const{t:s}=Te(),o=e.side==="buy"?"web-trading-widget-text-buy":"web-trading-widget-text-sell";return c.jsxs("tr",{className:`web-trading-widget-terminal__row${t?" web-trading-widget-terminal__row--selected":""}`,onClick:r,children:[c.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.displaySymbol}),c.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.ticket}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--nowrap",children:e.time}),c.jsx("td",{className:`web-trading-widget-terminal__cell web-trading-widget-terminal__cell--capitalize ${o}`,children:e.typeLabel}),c.jsxs("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:[e.volumeLots.toFixed(2)," / ",e.volumeFilledLots.toFixed(2)]}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:pe(e.orderPrice,e.digits)}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.stopLoss!==void 0&&e.stopLoss!==0?pe(e.stopLoss,e.digits):s("WebTrading.notAvailable")}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.takeProfit!==void 0&&e.takeProfit!==0?pe(e.takeProfit,e.digits):s("WebTrading.notAvailable")}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:pe(e.currentPrice,e.digits)}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right"}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right"}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--truncate",children:e.comment}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--close",children:c.jsx("button",{type:"button","aria-label":s("WebTrading.deleteOrderTicket",{ticket:e.ticket}),title:s("WebTrading.deleteOrder"),disabled:n,className:"web-trading-widget-terminal__row-close-btn",onClick:a=>{a.stopPropagation(),i()},children:c.jsx(Bt,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})})})]})}function bl({embedded:e=!1,symbolTicker:t="",onSymbolChange:n,onCreateNewOrder:r,dealDetailUrl:i,tradeDataEnabled:s=!1}){const{t:o}=Te(),[a,l]=p.useState("trade"),d=yr(),{accounts:u,isLoading:f}=fl(),m=kp(),{height:h,isResizing:b,onResizeStart:v}=e?{height:0,isResizing:!1,onResizeStart:()=>{}}:m,_=le(V=>V.selectedLogin),g=le(V=>V.selectedPositionTicket),T=le(V=>V.selectedOrderTicket),x=le(V=>V.setSelectedPositionTicket),y=le(V=>V.setSelectedOrderTicket),{isLoading:O}=ml(_,s),C=le(V=>V.positions),E=le(V=>V.orders),{closePosition:k,closeAllPositions:U,deleteOrder:F,isClosingAll:H,isRowBusy:L}=Lp(),Q=Zm(),K=nt(),re=Pm({predicate:V=>{const we=V.queryKey;return _?(we[0]===pr||we[0]===gr)&&we[1]===K.baseUrl&&we[2]===_:!1}})>0,P=f||O,D=p.useMemo(()=>_?C.filter(V=>V.login===_):C,[C,_]),j=p.useMemo(()=>_?E.filter(V=>V.login===_):E,[E,_]),A=p.useMemo(()=>{const V=u.find(we=>we.login===_);return(V==null?void 0:V.tradeStat)??null},[u,_]),W=p.useMemo(()=>D.map(V=>V.ticket).sort().join("|"),[D]),R=p.useMemo(()=>A?`${A.balance}:${A.credit??0}:${A.equity}:${A.margin}|${W}`:"",[A,W]),G=p.useMemo(()=>{if(!A||D.length===0)return 0;const V=yl(D);return A.equity-A.balance-(A.credit??0)-V},[R]),ae=p.useMemo(()=>Np(A,D,G),[A,D,G]),ce=D.length===0&&j.length===0,ie=p.useRef(null),N=p.useRef(null),Z=p.useRef(null),te=p.useCallback(()=>{U(D)},[U,D]),ve=p.useCallback(()=>{_&&Q(_)},[Q,_]),Re=p.useCallback(V=>{const we=jd(V,d);we&&(n==null||n(we))},[n,d]),be=p.useCallback(V=>{x(V.ticket),Re(V.symbol)},[x,Re]),Pe=p.useCallback(V=>{y(V.ticket),Re(V.symbol)},[y,Re]),Ce=p.useCallback(V=>{const we=ie.current,Y=N.current,_e=Z.current;if(!we||!Y)return;const je=V==="header"?we.scrollLeft:V==="body"?Y.scrollLeft:(_e==null?void 0:_e.scrollLeft)??0;V!=="header"&&(we.scrollLeft=je),V!=="body"&&(Y.scrollLeft=je),_e&&V!=="footer"&&(_e.scrollLeft=je)},[]);return c.jsxs(c.Fragment,{children:[!e&&b?c.jsx("div",{className:"web-trading-widget-terminal-resize-overlay","aria-hidden":!0}):null,c.jsxs("div",{className:`web-trading-widget-terminal${e?" web-trading-widget-terminal--embedded":""}`,style:e?void 0:{height:h},children:[e?null:c.jsx("div",{className:"web-trading-widget-terminal__resize-bar-wrap",children:c.jsx("div",{role:"separator","aria-orientation":"horizontal","aria-label":o("WebTrading.resizeTerminalPanel"),"aria-valuenow":h,className:"web-trading-widget-terminal__resize-bar",onMouseDown:V=>{V.preventDefault(),v(V.clientY)},children:c.jsx(Xa,{className:"web-trading-widget-icon web-trading-widget-icon--sm web-trading-widget-terminal__resize-icon"})})}),c.jsx(jp,{activeTab:a,onTabChange:l,positionCount:D.length,isClosingAll:H,onCloseAllPositions:te,isRefetchingDeals:re,onRefetchDeals:ve}),a==="trade"?c.jsxs(c.Fragment,{children:[c.jsx("div",{ref:ie,className:"web-trading-widget-terminal__header-scroll",onScroll:()=>Ce("header"),children:c.jsxs("table",{className:"web-trading-widget-terminal__table",children:[c.jsx(hs,{}),c.jsx(Dp,{})]})}),c.jsx("div",{ref:N,className:"web-trading-widget-terminal__body-scroll",onScroll:()=>Ce("body"),children:c.jsxs("table",{className:"web-trading-widget-terminal__table",children:[c.jsx(hs,{}),c.jsxs("tbody",{children:[P&&ce?c.jsx("tr",{children:c.jsx("td",{colSpan:13,className:"web-trading-widget-terminal__empty-cell",children:o("WebTrading.loading")})}):null,!P&&ce?c.jsx("tr",{children:c.jsx("td",{colSpan:13,className:"web-trading-widget-terminal__empty-cell",children:c.jsxs("div",{className:"web-trading-widget-terminal__empty-inner",children:[c.jsx("p",{className:"web-trading-widget-terminal__empty-text",children:o("WebTrading.noPositions")}),r?c.jsx("button",{type:"button",onClick:r,className:"web-trading-widget-terminal__create-btn",children:o("WebTrading.createNewOrder")}):null]})})}):null,D.map(V=>c.jsx(Mp,{position:V,isSelected:g===V.ticket,isClosing:L(`position-${V.ticket}`),onSelect:()=>be(V),onClose:()=>void k(V)},`position-${V.ticket}`)),j.map(V=>c.jsx(Up,{order:V,isSelected:T===V.ticket,isDeleting:L(`order-${V.ticket}`),onSelect:()=>Pe(V),onDelete:()=>void F(V)},`order-${V.ticket}`))]})]})})]}):c.jsx(Tp,{login:_??"",detailUrl:i}),c.jsx(Rp,{balance:ae.balance,equity:ae.equity,margin:ae.margin,marginFree:ae.marginFree,marginLevel:ae.marginLevel,totalPnL:ae.totalProfit,scrollRef:a==="trade"?Z:void 0,onScroll:a==="trade"?()=>Ce("footer"):void 0})]})]})}const ms=224,Zr=120;function Ip(e){var n;const t=(n=e==null?void 0:e.current)==null?void 0:n.clientHeight;return t&&t>0?Math.max(Zr,Math.floor(t*.35)):ms}function Fp(e){var n;const t=(n=e==null?void 0:e.current)==null?void 0:n.clientHeight;return t&&t>0?Math.max(Zr,Math.floor(t*.85)):typeof window>"u"?560:Math.max(Zr,Math.floor(window.innerHeight*.7))}function Bp(e,t){return Math.min(Fp(t),Math.max(Zr,e))}function Wp({containerRef:e,isOpen:t=!1}={}){const[n,r]=p.useState(ms),[i,s]=p.useState(!1),o=p.useRef(ms);p.useEffect(()=>{o.current=n},[n]);const a=p.useCallback(d=>{r(Bp(d,e))},[e]);p.useEffect(()=>{if(!t)return;const d=Math.max(o.current,Ip(e));a(d)},[e,t,a]);const l=p.useCallback(d=>{const u=d,f=o.current;s(!0);const m=b=>{const v=u-b.clientY;a(f+v)},h=()=>{s(!1),document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",h),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",m),document.addEventListener("mouseup",h),document.body.style.cursor="row-resize",document.body.style.userSelect="none"},[a]);return p.useEffect(()=>{const d=()=>{a(o.current)};return window.addEventListener("resize",d),()=>{window.removeEventListener("resize",d),document.body.style.cursor="",document.body.style.userSelect=""}},[a]),{height:n,isResizing:i,onResizeStart:l}}function _l({children:e}){const[t]=p.useState(()=>new hm({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}}));return c.jsx(mm,{client:t,children:e})}function wl({containerRef:e,onCreateNewOrder:t,tradeDataEnabled:n=!1}){const{t:r}=Te(),[i,s]=p.useState(!1),{height:o,isResizing:a,onResizeStart:l}=Wp({containerRef:e,isOpen:i}),d=le(_=>_.selectedLogin),u=le(_=>_.orders),f=le(_=>_.positions),m=p.useMemo(()=>d?u.filter(_=>_.login===d):u,[d,u]),h=p.useMemo(()=>d?f.filter(_=>_.login===d):f,[d,f]),b=m.length+h.length,v=()=>{s(!1),t==null||t()};return c.jsxs("div",{className:"web-trading-widget-news-orders-overlay-root",children:[c.jsxs("button",{type:"button",className:"web-trading-widget-news-orders-overlay__trigger","aria-label":r("WebTrading.openTerminal"),"aria-expanded":i,onClick:()=>s(!0),children:[c.jsx(pd,{className:"web-trading-widget-icon web-trading-widget-icon--sm"}),c.jsx("span",{children:r("WebTrading.orders")}),b>0?c.jsx("span",{className:"web-trading-widget-news-orders-overlay__badge",children:b}):null]}),i?c.jsx(c.Fragment,{children:c.jsxs("div",{className:"web-trading-widget-news-orders__panel",style:{height:o},children:[a?c.jsx("div",{className:"web-trading-widget-terminal-resize-overlay","aria-hidden":!0}):null,c.jsx("div",{className:"web-trading-widget-news-orders__panel-resize-bar-wrap",children:c.jsx("div",{role:"separator","aria-orientation":"horizontal","aria-label":r("WebTrading.resizeTerminalPanel"),"aria-valuenow":o,className:"web-trading-widget-terminal__resize-bar",onMouseDown:_=>{_.preventDefault(),l(_.clientY)},children:c.jsx(Xa,{className:"web-trading-widget-icon web-trading-widget-icon--sm web-trading-widget-terminal__resize-icon"})})}),c.jsxs("div",{className:"web-trading-widget-news-orders__panel-header",children:[c.jsx("h2",{className:"web-trading-widget-news-orders__panel-title",children:r("WebTrading.terminal")}),c.jsx("button",{type:"button",className:"web-trading-widget-news-orders__panel-close","aria-label":r("WebTrading.closeTerminalPanel"),onClick:()=>s(!1),children:c.jsx(Bt,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})})]}),c.jsx("div",{className:"web-trading-widget-news-orders__panel-body",children:c.jsx(bl,{embedded:!0,onCreateNewOrder:t?v:void 0,tradeDataEnabled:n})})]})}):null]})}function $p({baseUrl:e,language:t,containerRef:n,onCreateNewOrder:r}){const i=p.useMemo(()=>ri(t),[t]);return c.jsx(Ya,{language:i,children:c.jsx(_l,{children:c.jsx(Vc,{baseUrl:e,children:c.jsx(wl,{containerRef:n,onCreateNewOrder:r})})})})}function ut({title:e,isOpen:t,onToggle:n,children:r,className:i}){return c.jsxs("div",{className:ht("web-trading-widget-market-panel__accordion-item",i),children:[c.jsxs("button",{type:"button",className:ht("web-trading-widget-market-panel__accordion-trigger",t&&"web-trading-widget-market-panel__accordion-trigger--open"),"aria-expanded":t,onClick:n,children:[e,c.jsx(Br,{className:"web-trading-widget-icon web-trading-widget-icon--md web-trading-widget-text-muted"})]}),t?c.jsx("div",{className:"web-trading-widget-market-panel__accordion-content",children:r}):null]})}const tn=p.forwardRef(({className:e,...t},n)=>c.jsx("input",{ref:n,className:ht("web-trading-widget-market-panel__input",e),...t}));tn.displayName="WidgetInput";function ca(e){const t=e.trim().replace(/,/g,"");if(!t||t===".")return null;const n=Number(t);return Number.isFinite(n)?n:null}function la(e,t){return t<=0?String(Math.round(e)):e.toFixed(t)}function Vp(e,t){const n=e.replace(/,/g,"").replace(/[^\d.]/g,""),r=n.indexOf(".");if(r===-1)return n;const i=n.slice(0,r),s=n.slice(r+1).replace(/\./g,""),o=t>0?s.slice(0,t):"";return`${i}.${o}`}function Hp(e){const t=e.trim();return!t||t==="."?"":t.endsWith(".")?t.slice(0,-1):t}function ke({label:e,value:t,onChange:n,step:r=.01,min:i,decimals:s=2,placeholder:o,basePrice:a,disabled:l=!1,clearable:d=!1}){const[u,f]=p.useState(t),[m,h]=p.useState(!1),b=m?u:t,v=b.trim()!=="",_=!d;p.useEffect(()=>{m||f(t)},[m,t]);const g=()=>a!=null&&Number.isFinite(a)?a:i??0,T=k=>{f(k),n(k)},x=k=>{if(l)return;const U=g(),F=ca(b),H=b.trim()!=="";let L;!H||F===null?L=k===1?U:U-r:L=F+k*r;const Q=i!==void 0?Math.max(i,L):L;if(Q<=0)return;const K=la(Q,s);h(!1),T(K)},y=()=>{h(!0),f(t)},O=()=>{h(!1);const k=Hp(u);if(!k){u.trim()!==""&&T("");return}const U=ca(k);if(U===null||U<=0){T("");return}if(_){T(la(U,s));return}T(k)},C=k=>{f(Vp(k,s))},E=()=>{l||(h(!1),T(""))};return c.jsxs("div",{className:"web-trading-widget-stepper",children:[c.jsxs("div",{className:"web-trading-widget-stepper__header",children:[c.jsx("span",{className:"web-trading-widget-stepper__label",children:e}),d&&v?c.jsx("button",{type:"button","aria-label":`Clear ${e}`,className:"web-trading-widget-stepper__clear",disabled:l,onClick:E,children:c.jsx(Bt,{className:"web-trading-widget-icon web-trading-widget-icon--xs"})}):null]}),c.jsxs("div",{className:`web-trading-widget-stepper__control${l?" web-trading-widget-stepper__control--disabled":""}`,children:[c.jsx("button",{type:"button","aria-label":`Decrease ${e}`,className:"web-trading-widget-stepper__btn web-trading-widget-stepper__btn--minus",disabled:l||a===null&&b.trim()==="",onClick:()=>x(-1),children:c.jsx(yd,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})}),c.jsx("input",{type:"text",inputMode:"decimal",pattern:"[0-9]*[.]?[0-9]*",value:b,placeholder:o,disabled:l,onFocus:y,onChange:k=>C(k.target.value),onBlur:O,className:"web-trading-widget-stepper__input"}),c.jsx("button",{type:"button","aria-label":`Increase ${e}`,className:"web-trading-widget-stepper__btn web-trading-widget-stepper__btn--plus",disabled:l||a===null&&b.trim()==="",onClick:()=>x(1),children:c.jsx(bd,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})})]})]})}const zp=new Set(["volume-setting","risk-management"]);function qp({symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:i,minVolumeLots:s,isSubmitting:o,isAccountsLoading:a,selectedLogin:l,embedded:d=!1,onMinimize:u,onClose:f,onPlaceOrder:m}){const{t:h}=Te(),[b,v]=p.useState("market"),[_,g]=p.useState(String(r)),[T,x]=p.useState(""),[y,O]=p.useState(""),C=ne(J=>J.stopLoss),E=ne(J=>J.takeProfit),k=ne(J=>J.setStopLoss),U=ne(J=>J.setTakeProfit),F=ne(J=>J.setVolumeLots),H=ne(J=>J.setOrderSide),[L,Q]=p.useState(""),[K,re]=p.useState(We.GTC),[P,D]=p.useState(""),[j,A]=p.useState(""),[W,R]=p.useState(()=>new Set(zp)),G=Number(wt(vt(e))),ae=Dn(G),ce=Rs(t,n),ie=t!==null?pe(t,G):"—",N=n!==null?pe(n,G):"—",Z=ai(b),te=ic(b),ve=oi(b),Re=h(Vr[b]),be=!Z&&ve.orderType!==null&&ve.orderType%2===1,Pe=p.useMemo(()=>ce!==null?ce:t??n,[n,t,ce]),Ce=J=>{R(Ye=>{const St=new Set(Ye);return St.has(J)?St.delete(J):St.add(J),St})},V=J=>{g(J);const Ye=Number(J);Number.isFinite(Ye)&&Ye>0&&F(Ye)},we=J=>t===null||n===null?null:Z?J==="buy"?n:t:Le(T)??(J==="buy"?n:t),Y=J=>{const Ye=we(J);Ye!==null&&H({side:J,entryPrice:Ye})},_e=J=>{if(t===null||n===null||!l)return;const Ye=Math.max(s,Number(_)||s),St=Vi(b,J),br=we(J);br!==null&&H({side:J,entryPrice:br}),m({login:l,executionMode:b,side:J,orderType:St,volumeLots:Ye,stopLoss:C,takeProfit:E,priceOrder:T,priceTrigger:y,comment:L,typeTime:K,expirationDateTime:P,expirationDay:j,bid:t,ask:n})},je=t!==null&&n!==null,Ze=Z||Le(T)!==void 0,an=!te||Le(y)!==void 0,Un=Z||li(K,P,j),it=!o&&!a&&l!==""&&je&&Ze&&an&&Un,yi=!Z&&Ls(K),bi=!Z&&Ns(K);return c.jsxs("div",{className:"web-trading-widget-market-panel",children:[c.jsxs("div",{className:"web-trading-widget-market-panel__header",children:[c.jsx("select",{value:b,className:"web-trading-widget-market-panel__select-trigger","aria-label":h("WebTrading.orderExecutionType"),onChange:J=>v(J.target.value),children:Wr.map(J=>c.jsx("option",{value:J.mode,children:h(Vr[J.mode])},J.mode))}),d?null:c.jsxs("div",{className:"web-trading-widget-market-panel__header-actions",children:[c.jsx("button",{type:"button","aria-label":h("WebTrading.minimizeToQuickOrder"),className:"web-trading-widget-market-panel__header-btn",onClick:u,children:c.jsx(gd,{className:"web-trading-widget-icon web-trading-widget-icon--md"})}),c.jsx("button",{type:"button","aria-label":h("WebTrading.closeOrderPanel"),className:"web-trading-widget-market-panel__header-btn",onClick:f,children:c.jsx(Bt,{className:"web-trading-widget-icon web-trading-widget-icon--md"})})]})]}),c.jsxs("div",{className:"web-trading-widget-market-panel__accordion",children:[c.jsx(ut,{title:h("WebTrading.volumeSetting"),isOpen:W.has("volume-setting"),onToggle:()=>Ce("volume-setting"),children:c.jsx(ke,{label:h("WebTrading.lots"),value:_,onChange:V,step:i,min:s,decimals:2})}),Z?null:c.jsx(ut,{title:h("WebTrading.orderPrice"),isOpen:W.has("order-price"),onToggle:()=>Ce("order-price"),children:te?c.jsxs(c.Fragment,{children:[c.jsx(ke,{label:h("WebTrading.stopPrice"),value:y,onChange:O,step:ae,decimals:G,basePrice:Pe,placeholder:ce!==null?pe(ce,G):"—"}),c.jsx(ke,{label:h("WebTrading.limitPrice"),value:T,onChange:x,step:ae,decimals:G,basePrice:Pe,placeholder:ce!==null?pe(ce,G):"—"})]}):c.jsx(ke,{label:h("WebTrading.price"),value:T,onChange:x,step:ae,decimals:G,basePrice:Pe,placeholder:ce!==null?pe(ce,G):"—"})}),c.jsx(ut,{title:h("WebTrading.riskManagement"),isOpen:W.has("risk-management"),onToggle:()=>Ce("risk-management"),children:c.jsxs("div",{className:"web-trading-widget-market-panel__grid-2",children:[c.jsx(ke,{label:h("WebTrading.stopLoss"),value:C,onChange:k,step:ae,decimals:G,basePrice:t,placeholder:t!==null?ie:"—",clearable:!0}),c.jsx(ke,{label:h("WebTrading.takeProfit"),value:E,onChange:U,step:ae,decimals:G,basePrice:n,placeholder:n!==null?N:"—",clearable:!0})]})}),Z?null:c.jsxs(ut,{title:h("WebTrading.expiration"),isOpen:W.has("expiration"),onToggle:()=>Ce("expiration"),children:[c.jsx("select",{value:String(K),className:"web-trading-widget-market-panel__select-full","aria-label":h("WebTrading.orderExpirationType"),onChange:J=>re(Number(J.target.value)),children:sc.map(J=>c.jsx("option",{value:String(J.value),children:h(oc[J.value])},J.value))}),yi?c.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[c.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:h("WebTrading.expirationTime")}),c.jsx(tn,{type:"datetime-local",value:P,onChange:J=>D(J.target.value)})]}):null,bi?c.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[c.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:h("WebTrading.expirationDay")}),c.jsx(tn,{type:"date",value:j,onChange:J=>A(J.target.value)})]}):null]}),c.jsx(ut,{title:h("WebTrading.comment"),isOpen:W.has("comment"),onToggle:()=>Ce("comment"),children:c.jsx(tn,{value:L,onChange:J=>Q(J.target.value),placeholder:""})})]}),c.jsxs("div",{className:"web-trading-widget-market-panel__footer",children:[c.jsxs("div",{className:"web-trading-widget-market-panel__quotes",children:[c.jsx("span",{children:ie}),c.jsx("span",{className:"web-trading-widget-market-panel__quotes-ask",children:N})]}),Z?c.jsxs("div",{className:"web-trading-widget-market-panel__actions",children:[c.jsx("button",{type:"button",className:"web-trading-widget-market-panel__sell-btn",disabled:!it,onMouseDown:()=>Y("sell"),onClick:()=>_e("sell"),children:h("WebTrading.sellByMarket")}),c.jsx("button",{type:"button",className:"web-trading-widget-market-panel__buy-btn",disabled:!it,onMouseDown:()=>Y("buy"),onClick:()=>_e("buy"),children:h("WebTrading.buyByMarket")})]}):c.jsx("button",{type:"button",className:`web-trading-widget-market-panel__place-btn${be?" web-trading-widget-market-panel__place-btn--sell":" web-trading-widget-market-panel__place-btn--buy"}`,disabled:!it,onMouseDown:()=>{const J=ve.orderType!==null&&ve.orderType%2===1?"sell":"buy";Y(J)},onClick:()=>{const J=ve.orderType!==null&&ve.orderType%2===1?"sell":"buy";_e(J)},children:h("WebTrading.placeOrder",{label:Re})})]})]})}function vl({confirmation:e,symbolTicker:t,onDismiss:n}){const{t:r}=Te(),i=Number(wt(vt(t))),s=pe(e.price,i),o=e.side==="sell"?r("WebTrading.sell"):r("WebTrading.buy"),a=si(e.symbol||ci(t));return c.jsxs("div",{className:"web-trading-widget-confirmation",children:[c.jsx("div",{className:"web-trading-widget-confirmation__close-row",children:c.jsx("button",{type:"button","aria-label":r("WebTrading.closeConfirmation"),className:"web-trading-widget-confirmation__close-btn",onClick:n,children:c.jsx(Bt,{className:"web-trading-widget-icon web-trading-widget-icon--md"})})}),c.jsxs("div",{className:"web-trading-widget-confirmation__body",children:[c.jsxs("p",{className:"web-trading-widget-confirmation__summary",children:[c.jsxs("span",{className:"web-trading-widget-confirmation__ticket",children:["#",e.ticket]})," ",c.jsx("span",{className:`web-trading-widget-confirmation__side web-trading-widget-confirmation__side--${e.side}`,children:o})," ",e.volumeLots.toFixed(2)," ",a]}),c.jsx("p",{className:"web-trading-widget-confirmation__price",children:r("WebTrading.orderAtPrice",{price:s})}),c.jsx("p",{className:"web-trading-widget-confirmation__status",children:r("WebTrading.placed")}),c.jsx("button",{type:"button",className:"web-trading-widget-confirmation__ok-btn",onClick:n,children:r("WebTrading.ok")})]})]})}function Pr(e,t){return e.toLocaleString(void 0,{minimumFractionDigits:t,maximumFractionDigits:t})}function Hn(e){if(!(e===void 0||e===0))return e}function da(e,t){return e===void 0||e===0?"":pe(e,t)}function ua(e,t){const n=Le(e);if(n!==void 0)return n;if(Hn(t)!==void 0)return 0}function Sl({order:e,onClose:t}){const{t:n}=Te(),{deleteOrder:r,modifyOrder:i}=gi(),s=le(N=>N.removeOrder),o=le(N=>N.liveQuotes),[a,l]=p.useState(String(e.volumeLots)),[d,u]=p.useState(String(e.orderPrice)),[f,m]=p.useState(e.priceTrigger!==void 0?String(e.priceTrigger):""),h=ne(N=>N.stopLoss),b=ne(N=>N.takeProfit),v=ne(N=>N.setStopLoss),_=ne(N=>N.setTakeProfit),g=ne(N=>N.setDraft),[T,x]=p.useState(e.comment),[y,O]=p.useState(!1),[C,E]=p.useState(!1),k=Dn(e.digits),U=Ne(e.symbol).toUpperCase(),F=o[U],H=(F==null?void 0:F.bid)??e.marketBid??null,L=(F==null?void 0:F.ask)??e.marketAsk??null,Q=H!==null?pe(H,e.digits):"—",K=L!==null?pe(L,e.digits):"—",re=p.useMemo(()=>e.orderPrice>0?e.orderPrice:Rs(H,L)??H??L,[L,H,e.orderPrice]);p.useEffect(()=>{g({source:"order",symbolKey:Ne(e.symbol).toUpperCase(),entryPrice:e.orderPrice,stopLoss:da(e.stopLoss,e.digits),takeProfit:da(e.takeProfit,e.digits),side:e.side,showEntryLine:!0,volumeLots:e.volumeLots,digits:e.digits,priceStep:k})},[e.digits,e.orderPrice,e.side,e.stopLoss,e.symbol,e.takeProfit,e.volumeLots,k,g]);const P=As(e.orderType),D=e.volumeLots,j=Number(d)||e.orderPrice,A=Le(f),W=y||C,G=(j!==e.orderPrice||(P?A!==e.priceTrigger:!1)||Hn(Le(h))!==Hn(e.stopLoss)||Hn(Le(b))!==Hn(e.takeProfit)||T.trim()!==e.comment.trim())&&(!P||A!==void 0&&Number.isFinite(j)&&j>0),ae=p.useMemo(()=>n("WebTrading.deleteOrderDetail",{ticket:e.ticket,typeLabel:e.typeLabel,volume:D.toFixed(2),symbol:e.displaySymbol,price:Pr(j,e.digits)}),[e,j,n,D]),ce=async()=>{if(!G){ge({variant:"destructive",description:n(P?"WebTrading.pleaseSetStopAndLimitPrices":"WebTrading.pleaseSetOrderPrice")});return}O(!0);try{const N=await i(e,{volumeLots:D,priceOrder:j,priceTrigger:P?A:void 0,stopLoss:ua(h,e.stopLoss),takeProfit:ua(b,e.takeProfit),comment:T.trim()||"order modify"});if(!N.success){ge({variant:"destructive",description:N.message||n("WebTrading.failedModifyOrder")});return}t(),ge({description:n("WebTrading.orderUpdated",{ticket:e.ticket})})}catch(N){const Z=N instanceof Error?N.message:n("WebTrading.failedModifyOrder");ge({variant:"destructive",description:Z})}finally{O(!1)}},ie=async()=>{E(!0);try{const N=await r(e);if(!N.success){ge({variant:"destructive",description:N.message||n("WebTrading.failedDeleteOrder")});return}s(e.ticket),t(),ge({description:n("WebTrading.orderDeleted",{ticket:e.ticket})})}catch(N){const Z=N instanceof Error?N.message:n("WebTrading.failedDeleteOrder");ge({variant:"destructive",description:Z})}finally{E(!1)}};return c.jsxs("div",{className:"web-trading-widget-detail-panel",children:[c.jsxs("div",{className:"web-trading-widget-detail-panel__header",children:[c.jsxs("p",{className:`web-trading-widget-detail-panel__title web-trading-widget-detail-panel__title--${e.side}`,children:["#",e.ticket," ",e.typeLabel," ",D.toFixed(2)," / ",e.volumeFilledLots.toFixed(2)," ",e.displaySymbol," ",P&&A!==void 0?`${Pr(A,e.digits)} / ${Pr(j,e.digits)}`:Pr(j,e.digits)]}),c.jsx("button",{type:"button","aria-label":n("WebTrading.closeOrderPanel"),className:"web-trading-widget-icon-btn",onClick:t,children:c.jsx(Bt,{className:"web-trading-widget-icon web-trading-widget-icon--md"})})]}),c.jsxs("div",{className:"web-trading-widget-detail-panel__body",children:[c.jsx(ke,{label:n("WebTrading.lots"),value:a,onChange:l,step:.01,min:.01,decimals:2,disabled:!0}),P?c.jsxs(c.Fragment,{children:[c.jsx(ke,{label:n("WebTrading.stopPrice"),value:f,onChange:m,step:k,decimals:e.digits,basePrice:re}),c.jsx(ke,{label:n("WebTrading.limitPrice"),value:d,onChange:u,step:k,decimals:e.digits,basePrice:re})]}):c.jsx(ke,{label:n("WebTrading.price"),value:d,onChange:u,step:k,decimals:e.digits,basePrice:re}),c.jsxs("div",{className:"web-trading-widget-market-panel__grid-2",children:[c.jsx(ke,{label:n("WebTrading.stopLoss"),value:h,onChange:v,step:k,decimals:e.digits,basePrice:H,placeholder:Q,clearable:!0}),c.jsx(ke,{label:n("WebTrading.takeProfit"),value:b,onChange:_,step:k,decimals:e.digits,basePrice:L,placeholder:K,clearable:!0})]}),c.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[c.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:n("WebTrading.comment")}),c.jsx(tn,{value:T,onChange:N=>x(N.target.value)})]}),c.jsx("button",{type:"button",className:"web-trading-widget-detail-panel__btn-full",disabled:W||!G,onClick:()=>void ce(),children:n("WebTrading.modify")}),c.jsx("button",{type:"button",className:"web-trading-widget-detail-panel__action-btn",disabled:W,onClick:()=>void ie(),children:ae})]})]})}function Cr(e,t){return e.toLocaleString(void 0,{minimumFractionDigits:t,maximumFractionDigits:t})}function zn(e){if(!(e===void 0||e===0))return e}function fa(e,t){return e===void 0||e===0?"":pe(e,t)}function ha(e,t){const n=Le(e);if(n!==void 0)return n;if(zn(t)!==void 0)return 0}function Kp(e,t,n){return e.type==="buy"?t??e.marketBid??e.currentPrice:n??e.marketAsk??e.currentPrice}function Tl({position:e,onClose:t}){const{t:n}=Te(),{closePosition:r,modifyPosition:i}=gi(),s=le(P=>P.removePosition),o=le(P=>P.liveQuotes),[a,l]=p.useState(String(e.volumeLots)),d=ne(P=>P.stopLoss),u=ne(P=>P.takeProfit),f=ne(P=>P.setStopLoss),m=ne(P=>P.setTakeProfit),h=ne(P=>P.setDraft),[b,v]=p.useState(!1),[_,g]=p.useState(!1),T=Dn(e.digits),x=Ne(e.symbol).toUpperCase(),y=o[x],O=(y==null?void 0:y.bid)??e.marketBid??null,C=(y==null?void 0:y.ask)??e.marketAsk??null,E=O!==null?pe(O,e.digits):"—",k=C!==null?pe(C,e.digits):"—";p.useEffect(()=>{h({source:"position",symbolKey:Ne(e.symbol).toUpperCase(),entryPrice:e.openPrice,stopLoss:fa(e.stopLoss,e.digits),takeProfit:fa(e.takeProfit,e.digits),side:e.type,showEntryLine:!1,volumeLots:e.volumeLots,digits:e.digits,priceStep:T})},[e.digits,e.openPrice,e.stopLoss,e.symbol,e.takeProfit,e.type,e.volumeLots,T,h]);const U=Kp(e,O,C),F=e.volumeLots,H=b||_,L=zn(Le(d))!==zn(e.stopLoss)||zn(Le(u))!==zn(e.takeProfit),Q=async()=>{if(L){g(!0);try{const P=await i(e,{stopLoss:ha(d,e.stopLoss),takeProfit:ha(u,e.takeProfit),comment:e.comment});if(!P.success){ge({variant:"destructive",description:P.message||n("WebTrading.failedModifyPosition")});return}t(),ge({description:n("WebTrading.positionUpdated",{ticket:e.ticket})})}catch(P){const D=P instanceof Error?P.message:n("WebTrading.failedModifyPosition");ge({variant:"destructive",description:D})}finally{g(!1)}}},K=p.useMemo(()=>{const P=e.profit.toFixed(2),D=e.type==="buy"?n("WebTrading.buy"):n("WebTrading.sell");return n("WebTrading.closePositionDetail",{ticket:e.ticket,type:D,volume:F.toFixed(2),symbol:e.displaySymbol,openPrice:Cr(e.openPrice,e.digits),closePrice:Cr(U,e.digits),profit:P})},[U,e,n,F]),re=async()=>{v(!0);try{const P=await r(e);if(!P.success){ge({variant:"destructive",description:P.message||n("WebTrading.failedClosePosition")});return}s(e.ticket),t(),ge({description:n("WebTrading.positionClosedSimple",{ticket:e.ticket})})}catch(P){const D=P instanceof Error?P.message:n("WebTrading.failedClosePosition");ge({variant:"destructive",description:D})}finally{v(!1)}};return c.jsxs("div",{className:"web-trading-widget-detail-panel",children:[c.jsxs("div",{className:"web-trading-widget-detail-panel__header",children:[c.jsxs("p",{className:"web-trading-widget-detail-panel__title web-trading-widget-detail-panel__title--position",children:["#",e.ticket," ",e.type," ",F.toFixed(2)," ",e.displaySymbol," ",Cr(e.openPrice,e.digits)]}),c.jsx("button",{type:"button","aria-label":n("WebTrading.closePositionPanel"),className:"web-trading-widget-icon-btn",onClick:t,children:c.jsx(Bt,{className:"web-trading-widget-icon web-trading-widget-icon--md"})})]}),c.jsxs("div",{className:"web-trading-widget-detail-panel__body",children:[c.jsx(ke,{label:n("WebTrading.lots"),value:a,onChange:l,step:.01,min:.01,decimals:2,disabled:!0}),c.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[c.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:n("WebTrading.price")}),c.jsx(tn,{readOnly:!0,disabled:!0,value:Cr(e.openPrice,e.digits),className:"web-trading-widget-detail-panel__input-muted"})]}),c.jsxs("div",{className:"web-trading-widget-market-panel__grid-2",children:[c.jsx(ke,{label:n("WebTrading.stopLoss"),value:d,onChange:f,step:T,decimals:e.digits,basePrice:O,placeholder:E,clearable:!0}),c.jsx(ke,{label:n("WebTrading.takeProfit"),value:u,onChange:m,step:T,decimals:e.digits,basePrice:C,placeholder:k,clearable:!0})]}),c.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[c.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:n("WebTrading.comment")}),c.jsx(tn,{readOnly:!0,disabled:!0,value:e.comment,className:"web-trading-widget-detail-panel__input-muted"})]}),c.jsx("button",{type:"button",className:"web-trading-widget-detail-panel__btn-full",disabled:H||!L,onClick:()=>void Q(),children:n("WebTrading.modify")}),c.jsx("button",{type:"button",className:"web-trading-widget-detail-panel__action-btn",disabled:H,onClick:()=>void re(),children:K})]})]})}function ma({symbolTicker:e,orderState:t}){const{t:n}=Te(),r=Vs(e),{confirmation:i,isSubmitting:s,defaultVolumeLots:o,volumeStep:a,minVolumeLots:l,selectedLogin:d,isAccountsLoading:u,hasConfirmedAccount:f,dismissConfirmation:m,placeMarketOrder:h}=t,b=le(k=>k.positions),v=le(k=>k.orders),_=le(k=>k.selectedPositionTicket),g=le(k=>k.selectedOrderTicket),T=le(k=>k.setSelectedPositionTicket),x=le(k=>k.setSelectedOrderTicket),y=_!==null?b.find(k=>k.ticket===_)??null:null,O=g!==null?v.find(k=>k.ticket===g)??null:null,C=i!==null,E=p.useCallback(k=>{h({symbolTicker:e,login:k.login,executionMode:k.executionMode,side:k.side,orderType:k.orderType,volumeLots:k.volumeLots,stopLoss:k.stopLoss,takeProfit:k.takeProfit,priceOrder:k.priceOrder,priceTrigger:k.priceTrigger,comment:k.comment,typeTime:k.typeTime,expirationDateTime:k.expirationDateTime,expirationDay:k.expirationDay,bid:k.bid,ask:k.ask})},[h,e]);return y!==null?c.jsx(Tl,{position:y,onClose:()=>T(null)}):O!==null?c.jsx(Sl,{order:O,onClose:()=>x(null)}):C&&i!==null?c.jsx(vl,{confirmation:i,symbolTicker:e,onDismiss:m}):f?c.jsx(qp,{embedded:!0,symbolTicker:e,bid:(r==null?void 0:r.bid)??null,ask:(r==null?void 0:r.ask)??null,defaultVolumeLots:o,volumeStep:a,minVolumeLots:l,isSubmitting:s,isAccountsLoading:u,selectedLogin:d,onPlaceOrder:E}):c.jsx("div",{className:"web-trading-widget-side-panel__empty",children:n("WebTrading.selectAccountToTrade")})}function pa({label:e,isActive:t,onClick:n}){return c.jsx("button",{type:"button",role:"tab","aria-selected":t,className:`web-trading-widget-side-panel__tab${t?" web-trading-widget-side-panel__tab--active":""}`,onClick:n,children:e})}function Gp({symbolTicker:e,orderState:t,scanResultUrl:n,onScanResultLoad:r,initialTab:i="trade",activeTab:s,onTabChange:o}){const{t:a}=Te(),l=!!n,[d,u]=p.useState(i),f=s!==void 0,m=f?s:d,h=p.useCallback(b=>{f?o==null||o(b):u(b)},[f,o]);return c.jsx("aside",{className:`web-trading-widget-side-panel${l?" web-trading-widget-side-panel--with-scan":""}`,children:l?c.jsxs("div",{className:"web-trading-widget-side-panel__scan-layout",children:[c.jsxs("div",{role:"tablist","aria-label":a("WebTrading.chartSidePanel"),className:"web-trading-widget-side-panel__tablist",children:[c.jsx(pa,{label:a("WebTrading.trade"),isActive:m==="trade",onClick:()=>h("trade")}),c.jsx(pa,{label:a("WebTrading.scanResult"),isActive:m==="scan",onClick:()=>h("scan")})]}),c.jsxs("div",{className:"web-trading-widget-side-panel__panels",children:[c.jsx("div",{role:"tabpanel",hidden:m!=="trade",className:"web-trading-widget-side-panel__tabpanel",children:c.jsx(ma,{symbolTicker:e,orderState:t})}),c.jsx("div",{role:"tabpanel",hidden:m!=="scan",className:"web-trading-widget-side-panel__tabpanel web-trading-widget-side-panel__tabpanel--scan",children:c.jsx("iframe",{src:n??void 0,title:a("WebTrading.scanResult"),className:"web-trading-widget-side-panel__iframe",onLoad:r},n)})]})]}):c.jsx("div",{className:"web-trading-widget-side-panel__scroll",children:c.jsx(ma,{symbolTicker:e,orderState:t})})})}const Qp=.01,Zp=.01,ga=.01;function Yp({symbols:e,defaultPanelAfterConfirm:t="mini"}){const{t:n}=Te(),[r,i]=p.useState("closed"),[s,o]=p.useState(null),[a,l]=p.useState(!1),[d,u]=p.useState("pending"),[f,m]=p.useState(null),h=le(L=>L.setSelectedLogin),{accounts:b,isLoading:v}=fl(),{submitOrder:_}=gi(),g=p.useMemo(()=>Nd(b),[b]),T=p.useMemo(()=>Rd(b,f),[b,f]),x=d==="confirmed",y=d==="needs-selection";p.useEffect(()=>{if(v)return;if(d==="confirmed"){f&&!g.some(Q=>Q.login===f)&&u("needs-selection");return}if(d==="needs-selection")return;const L=Dd();if(L&&g.some(Q=>Q.login===L)){m(L),u("confirmed"),i(t);return}u("needs-selection")},[d,g,t,v,f]),p.useEffect(()=>{T&&h(T)},[T,h]);const O=p.useCallback(L=>{m(L),h(L),oo(L)},[h]),C=p.useCallback(L=>{L&&(oo(L),O(L),u("confirmed"),o(null),i(t))},[t,O]),E=p.useCallback(()=>{o(null),i("market")},[]),k=p.useCallback(()=>{o(null),i("mini")},[]),U=p.useCallback(()=>{o(null),i("mini")},[]),F=p.useCallback(()=>{o(null),i("mini")},[]),H=p.useCallback(async L=>{const Q=ne.getState().clearEntryLinePreview,K=L.login.trim();if(!K){Q(),ge({variant:"destructive",description:n("WebTrading.pleaseSelectTradingAccount")});return}const re=Math.max(ga,L.volumeLots),P=ci(L.symbolTicker,e);Number(wt(vt(L.symbolTicker,e)));const D=ai(L.executionMode),j=As(L.orderType),A=Le(L.priceOrder),W=Le(L.priceTrigger);if(!D&&A===void 0){Q(),ge({variant:"destructive",description:n(j?"WebTrading.pleaseSetLimitPrice":"WebTrading.pleaseSetOrderPrice")});return}if(j&&W===void 0){Q(),ge({variant:"destructive",description:n("WebTrading.pleaseSetStopPrice")});return}if(!D&&!li(L.typeTime,L.expirationDateTime,L.expirationDay)){Q(),ge({variant:"destructive",description:n("WebTrading.pleaseSetExpirationDate")});return}const R=D?L.side==="buy"?L.ask:L.bid:A??(L.side==="buy"?L.ask:L.bid);l(!0);try{const G=await _({login:K,symbolTicker:L.symbolTicker,executionMode:L.executionMode,side:$r(L.orderType),orderType:L.orderType,volumeLots:re,stopLoss:Le(L.stopLoss),takeProfit:Le(L.takeProfit),priceOrder:Es(L.orderType)?A:void 0,priceTrigger:j?W:void 0,comment:L.comment.trim(),typeTime:L.typeTime,expirationDateTime:L.expirationDateTime,expirationDay:L.expirationDay,bid:L.bid,ask:L.ask});if(!G.success){Q(),ge({variant:"destructive",description:G.message||n("WebTrading.orderNotAccepted")});return}o({ticket:G.ticket??"",side:G.side??$r(L.orderType),volumeLots:G.volumeLots??re,symbol:G.displaySymbol??P,price:G.price??R}),i("confirmation")}catch(G){Q();const ae=G instanceof Error?G.message:n("WebTrading.failedPlaceOrder");ge({variant:"destructive",description:ae})}finally{l(!1)}},[_,e,n]);return{panel:r,confirmation:s,isSubmitting:a,defaultVolumeLots:Qp,volumeStep:Zp,minVolumeLots:ga,accountOptions:g,selectedLogin:T,setSelectedLogin:O,isAccountsLoading:v,hasConfirmedAccount:x,needsAccountSelection:y,confirmAccountSelection:C,openMarketPanel:E,openMiniPanel:k,closePanels:U,dismissConfirmation:F,placeMarketOrder:H}}function Yr(e){var t;if(typeof window<"u"){const n=localStorage.getItem(un);if(n&&e.some(r=>r.ticker===n))return n}return((t=e[0])==null?void 0:t.ticker)??"XAU_USD"}function ps(e,t,n){var r;return((r=t.find(i=>i.display_name===e||i.ticker===e))==null?void 0:r.ticker)??n}function Jp({chartWidget:e,symbols:t,chartSlotElement:n,onSymbolTickerChange:r,onScanResultUrlChange:i,selectSymbolTickerRef:s}){const o=p.useMemo(()=>Yr(t),[t]),a=p.useRef(o),l=p.useRef(e),[d,u]=p.useState(null);p.useEffect(()=>{l.current=e},[e]),p.useEffect(()=>{if(!n){u(null);return}const m=()=>{const b=n.querySelector(":scope > div");u(b)};m();const h=new MutationObserver(m);return h.observe(n,{childList:!0}),()=>{h.disconnect()}},[n]);const f=p.useCallback(m=>{if(m===a.current)return;const h=t.find(v=>v.ticker===m);if(!h)return;a.current=m,localStorage.setItem(un,m),r(m),i(null);const b=l.current;if(b)try{b.onChartReady(()=>{b.activeChart().setSymbol(h.ticker)})}catch{}},[i,r,t]);return p.useEffect(()=>(s.current=f,()=>{s.current=null}),[f,s]),p.useEffect(()=>{if(!e)return;let m=!1,h=null;try{e.onChartReady(()=>{if(m)return;let b;try{b=e.activeChart()}catch{return}const v=T=>{const x=b.symbol(),y=ps(x,t,o);y!==a.current&&i(null);try{e.resetCache()}catch{}a.current=y,localStorage.setItem(un,y),r(y)},_=b.symbol(),g=ps(_,t,o);g!==a.current&&(a.current=g,localStorage.setItem(un,g),r(g)),b.onSymbolChanged().subscribe(null,v),h=()=>{try{b.onSymbolChanged().unsubscribe(null,v)}catch{}}})}catch{}return()=>{m=!0,h==null||h()}},[e,i,r,o,t]),{chartContainer:d}}function Xp({className:e,variant:t="default",...n}){return c.jsx("span",{className:ht("web-trading-widget-badge",t!=="default"&&`web-trading-widget-badge--${t}`,e),...n})}function xl(){var t;const e=(t=window.TradingView)==null?void 0:t.widget;return typeof e=="function"?e:null}function Mr(){return xl()!==null}const ya="/charting_library/charting_library.js";function eg({onLoad:e}){return p.useEffect(()=>{if(Mr()){e();return}const t=document.querySelector(`script[src="${ya}"]`);if(t){const r=()=>{Mr()&&e()};return t.addEventListener("load",r),()=>t.removeEventListener("load",r)}const n=document.createElement("script");return n.src=ya,n.async=!1,n.onload=()=>{Mr()&&e()},n.onerror=()=>{console.error("Failed to load TradingView charting library")},document.head.appendChild(n),()=>{n.onload=null,n.onerror=null}},[e]),null}const ba=di(e=>({playEndTimestamp:null,setPlayEndTimestamp:t=>e({playEndTimestamp:t})})),kl=di(e=>({newsSelectedCandles:null,newsPlayEndTimestamp:null,gapCount:0,isReplayMode:!1,setNewsSelectedCandles:t=>e({newsSelectedCandles:t}),setNewsPlayEndTimestamp:t=>e({newsPlayEndTimestamp:t}),setGapCount:t=>e({gapCount:t}),setReplayMode:t=>e({isReplayMode:t})})),gs=8,Pl=4,ys=5,bs=e=>e==="1"?60:e==="5"?300:e==="1D"?1440*3600:parseInt(e,10)*60,tg=e=>{const t=new Date(e+gs*60*60*1e3),n=t.getUTCDay(),r=t.getUTCHours();return n===0?!1:n===1?r>=ys:n===6?r<=Pl:!0},ng=e=>{const t=new Date(e+gs*60*60*1e3),n=t.getUTCDay(),r=t.getUTCHours();if(n===0||n===1&&r<ys||n===6&&r>=Pl){const i=(8-n)%7;return t.setUTCDate(t.getUTCDate()+i),t.setUTCHours(ys,0,0,0),t.getTime()-gs*60*60*1e3}return e},rg=(e,t,n)=>{const r=bs(t)*1e3,i=[];let s=e;for(let o=0;o<n;o++)s+=r,tg(s)||(s=ng(s)),i.push(s);return i},ig=(e,t,n,r)=>{if(n<=0)return[];if(r==="24x7"){const s=bs(t)*1e3;return Array.from({length:n},(o,a)=>e+(a+1)*s)}if(r==="1700-1700")return rg(e,t,n);const i=bs(t)*1e3;return Array.from({length:n},(s,o)=>e+(o+1)*i)},sg=(e,t)=>{if(t==="1D"||t==="D"||t==="1440"){const n=new Date(e*1e3);return n.setUTCHours(0,0,0,0),n.getTime()}return e.toString().length>11?e:e*1e3},_a="wss://ticks.opheleo.com";function og(e){return{1:6e4,5:3e5,15:9e5,30:18e5,60:36e5,240:144e5}[e]??6e4}function wa(e){return e.trim().toUpperCase()}function ag(e,t){return Math.floor(e/t)*t}let Wn;async function cg(e){const t=new URLSearchParams({symbol:e.symbol,timeframe:e.timeframe,...e.endTimestamp&&{endTimestamp:e.endTimestamp.toString()}});return e.last_evaluated_key&&t.append("last_evaluated_key",e.last_evaluated_key),Se({baseURL:"https://corprate-widget.iccandle.ai",url:`/chart/endTimestamp?${t.toString()}`,method:"GET"})}class lg{constructor(t,n,r=_t,i=_a){Je(this,"futureBarsRef");Je(this,"type");Je(this,"symbols");Je(this,"tickWebSocketUrl");Je(this,"configuration",{supported_resolutions:["1","5","15","30","60"],supports_marks:!1,supports_timescale_marks:!0,supports_time:!1});Je(this,"ws",null);Je(this,"isWsConnecting",!1);Je(this,"wsSelectedSymbol",null);Je(this,"subscriptions",new Map);Je(this,"lastBarsCache",new Map);Je(this,"pushFutureBar",t=>{for(const[,n]of this.subscriptions.entries())return n.onTick(t),!0;return!1});this.futureBarsRef=t,this.type=n,this.symbols=r,this.tickWebSocketUrl=i||_a}onReady(t){setTimeout(()=>t(this.configuration),0)}resolveSymbol(t,n,r){const i=this.symbols.find(o=>o.ticker===t),s=this.symbols.find(o=>o.display_name===t);try{setTimeout(()=>{const o={name:(i==null?void 0:i.display_name)||(s==null?void 0:s.display_name)||localStorage.getItem("tv:latest-symbol")||"XAU_USD",timezone:"America/New_York",minmov:1,session:(i==null?void 0:i.session)||(s==null?void 0:s.session)||"24x7",has_intraday:!0,visible_plots_set:"ohlc",library_custom_fields:{ticker:(i==null?void 0:i.ticker)||(s==null?void 0:s.ticker)||localStorage.getItem("tv:latest-symbol")||"XAU_USD"},description:(i==null?void 0:i.description)||(s==null?void 0:s.description)||"",type:(i==null?void 0:i.type)||(s==null?void 0:s.type)||"",pricescale:(i==null?void 0:i.pricescale)||(s==null?void 0:s.pricescale)||1e5,ticker:(i==null?void 0:i.display_name)||(s==null?void 0:s.display_name)||localStorage.getItem("tv:latest-symbol")||"XAU_USD",exchange:"FX",format:"price",listed_exchange:"FX",logo_urls:(i==null?void 0:i.logo_urls.map(a=>a.replace("https://cdn.iccandle.ai/web-assets","/images/symbols")))||(s==null?void 0:s.logo_urls.map(a=>a.replace("https://cdn.iccandle.ai/web-assets","/images/symbols")))};n(o)},0)}catch{r("Symbol not found")}}getBars(t,n,r,i,s){var f;const o=(f=t.library_custom_fields)==null?void 0:f.ticker,a=this.symbols.find(m=>o!==void 0&&m.ticker===o||m.ticker===t.ticker||m.display_name===t.name||m.display_name===t.ticker),l={symbol:(a==null?void 0:a.ticker)||"",timeframe:n};if(r.firstDataRequest&&(Wn=void 0),!r.firstDataRequest)if(Wn)l.last_evaluated_key=Wn;else{i([],{noData:!0});return}const u=ba.getState().playEndTimestamp;u&&(l.endTimestamp=u,ba.getState().setPlayEndTimestamp(null),Wn=void 0),(async()=>{var m;try{const{data:h}=await cg(l);if(h.data_status==="threshold_limited"){i([],{noData:!0});return}if(h.data_status==="end_of_data"){i([],{noData:!0});return}if(!((m=h.items)!=null&&m.length)){i([],{noData:!0});return}Wn=h.last_evaluated_key;const v=[...h.items].map(x=>({open:x.o,high:x.h,low:x.l,close:x.c,time:sg(x.timestamp,n)})),_=kl.getState(),{gapCount:g,isReplayMode:T}=_;if(T&&event){const x=ig(v[v.length-1].time,n,g||0,t.session);if(x.length>0){const y=v[v.length-1].close;for(const O of x)v.push({open:y,high:y,low:y,close:y,time:O})}}i(v)}catch(h){s(h),i([],{noData:!0})}})()}searchSymbols(t,n,r,i){if(r==="all"||r===""){const s=this.symbols.filter(o=>{var a;return(a=o.display_name)==null?void 0:a.toUpperCase().includes(t.toUpperCase())}).map(o=>({...o,symbol:o.display_name,exchange:"FX",logo_urls:o.logo_urls.map(a=>a.replace("https://cdn.iccandle.ai/web-assets","/images/symbols"))}));i(s)}else{const s=this.symbols.filter(o=>{var a;return((a=o.display_name)==null?void 0:a.toUpperCase().includes(t.toUpperCase()))&&o.type.includes(r)}).map(o=>({...o,symbol:o.display_name,exchange:"FX",logo_urls:o.logo_urls.map(a=>a.replace("https://cdn.iccandle.ai/web-assets","/images/symbols"))}));i(s)}}subscribeBars(t,n,r,i,s){var f;const o=(f=t.library_custom_fields)==null?void 0:f.ticker,a=this.symbols.find(m=>o!==void 0&&m.ticker===o||m.display_name===t.ticker||m.display_name===t.name),l=a!=null&&a.resolve_symbol?wa(a.resolve_symbol):wa(t.ticker||t.name||""),d=og(n),u=`${l}|${n}`;this.subscriptions.set(i,{symbol:l,resolution:n,periodMs:d,onTick:r,onResetCacheNeededCallback:s,liveCandle:this.lastBarsCache.get(u)??null}),this.ensureWebSocket(l)}unsubscribeBars(t){this.subscriptions.delete(t),this.subscriptions.size===0&&this.ws&&(this.ws.close(1e3,"No more subscriptions"),this.ws=null)}ensureWebSocket(t){var i;const n=t??((i=this.subscriptions.values().next().value)==null?void 0:i.symbol);if(this.ws&&this.ws.readyState===WebSocket.OPEN&&this.wsSelectedSymbol===n||(this.ws&&this.wsSelectedSymbol!==n&&(this.ws.close(1e3,"Symbol change"),this.ws=null,this.wsSelectedSymbol=null),this.isWsConnecting))return;this.isWsConnecting=!0;const r=new WebSocket(this.tickWebSocketUrl);this.ws=r,this.wsSelectedSymbol=n??null,r.onopen=()=>{this.isWsConnecting=!1,n&&r.send(JSON.stringify({action:"select_symbol",symbol:n}))},r.onmessage=s=>this.handleMessage(s),r.onerror=()=>{this.isWsConnecting=!1},r.onclose=()=>{this.ws=null,this.wsSelectedSymbol=null,this.isWsConnecting=!1,this.subscriptions.size>0&&setTimeout(()=>this.ensureWebSocket(),3e3)}}handleMessage(t){try{const n=JSON.parse(t.data);this.processTick(n)}catch{}}processTick(t){const n=t.symbol,r=Number(t.updatedAtMs),i=(Number(t.bid)+Number(t.ask))/2;if(!(!Number.isFinite(r)||!Number.isFinite(i)))for(const[s,o]of this.subscriptions.entries()){if(o.symbol!==n)continue;const a=`${o.symbol}|${o.resolution}`,l=ag(r,o.periodMs);let d=o.liveCandle;d?l>d.time?d={time:l,open:i,high:i,low:i,close:i,volume:0}:d={...d,high:Math.max(d.high,i),low:Math.min(d.low,i),close:i}:d={time:l,open:i,high:i,low:i,close:i,volume:0},o.liveCandle=d,this.lastBarsCache.set(a,d),this.subscriptions.set(s,o),(f=>{var m,h;(h=(m=this.futureBarsRef)==null?void 0:m.current)!=null&&h.length||o.onTick(f)})(d)}}extractErrorMessage(t){if(t instanceof Error)return t.message;if(typeof t=="string")return t;try{return JSON.stringify(t)}catch{return String(t)}}getTimescaleMarks(t,n,r,i){const s=[];if(this.type&&this.type=="selector")try{const o=JSON.parse(localStorage.getItem("tv:selected-news-events")||"[]");o==null||o.forEach(({id:a,timestamp:l,event_name:d,currency:u})=>{!a||!Number.isFinite(l)||l<=0||s.some(f=>String(f.id)===String(a))||s.push({id:a,time:l/1e3,color:"green",label:d.slice(0,1)||"N",tooltip:[d],...u?{imageUrl:`/images/symbols/${u}.svg`}:{},showLabelWhenImageLoaded:!0})})}catch{}if(this.type&&this.type=="news")try{const o=JSON.parse(localStorage.getItem("iccandle:current-news-event")||"{}"),{id:a,timestamp:l,event_name:d,currency:u,forecast:f,previous:m,actual:h}=o;if(!a||!Number.isFinite(l)||l<=0||s.some(v=>String(v.id)==="news:"+a))return;s.push({id:"news:"+a,time:l/1e3,color:"green",label:d.slice(0,1),tooltip:[d,`Current Forecast: ${f||"-"}`,`Previous Forecast: ${m||"-"}`,`Previous Actual: ${h||"-"}`],...u?{imageUrl:`https://cdn.iccandle.ai/web-assets/${u??"USD"}.svg`}:{}})}catch{}i(s)}}const dg=e=>{const t={name:"Generated Candles - By iC Candle",metainfo:{_metainfoVersion:51,id:"Generated Candles - By iC Candle@tv-basicstudies-1",description:"Generated Candles - By iC Candle",shortDescription:"Generated Candles",isCustomIndicator:!0,is_hidden_study:!1,is_price_study:!0,linkedToSeries:!0,format:{type:"price",precision:2},inputs:[],palettes:{palette_bar:{colors:{0:{name:"Bullish"},1:{name:"Bearish"}},valToIndex:{0:0,1:1}},palette_wick:{colors:{0:{name:"Bullish Wick"},1:{name:"Bearish Wick"}},valToIndex:{0:0,1:1}},palette_border:{colors:{0:{name:"Bullish Border"},1:{name:"Bearish Border"}},valToIndex:{0:0,1:1}}},plots:[{id:"plot_open",type:"ohlc_open",target:"plot_candle"},{id:"plot_high",type:"ohlc_high",target:"plot_candle"},{id:"plot_low",type:"ohlc_low",target:"plot_candle"},{id:"plot_close",type:"ohlc_close",target:"plot_candle"},{id:"plot_bar_color",type:"ohlc_colorer",palette:"palette_bar",target:"plot_candle"},{id:"plot_wick_color",type:"wick_colorer",palette:"palette_wick",target:"plot_candle"},{id:"plot_border_color",type:"border_colorer",palette:"palette_border",target:"plot_candle"}],ohlcPlots:{plot_candle:{title:"Generated Candles"}},styles:{},defaults:{styles:{},ohlcPlots:{plot_candle:{borderColor:"#000000",color:"#000000",drawBorder:!0,drawWick:!0,plottype:"ohlc_candles",visible:!0,wickColor:"#000000"}},palettes:{palette_bar:{colors:{0:{color:"#00dfb9",width:1,style:0},1:{color:"#ffb84d",width:1,style:0}}},palette_wick:{colors:{0:{color:"#00dfb9",width:1,style:0},1:{color:"#ffb84d",width:1,style:0}}},palette_border:{colors:{0:{color:"#00dfb9",width:1,style:0},1:{color:"#ffb84d",width:1,style:0}}}},precision:2,inputs:{}}},constructor:function(){this.init=function(n){this._context=n},this.main=function(n){this._context=n;const r=n.symbol.time,i=e.current,s=n.symbol.open,o=n.symbol.high,a=n.symbol.low,l=n.symbol.close;if(!Number.isFinite(r)||!i||i.length===0)return[s,o,a,l,Number.NaN,Number.NaN,Number.NaN];if(!i.some(m=>m.time===r))return[s,o,a,l,Number.NaN,Number.NaN,Number.NaN];const f=l<s?1:0;return[s,o,a,l,f,f,f]}}};return Promise.resolve([t])},ug=2e4;let Ui=0;function fg(){return Ui=(Ui+1)%Number.MAX_VALUE,Ui.toString()}const Ii=new Map,va=(e,t)=>{if(Ii.has(e))return;const n=setTimeout(()=>{Ii.delete(e),Ur({type:"REMOVE_TOAST",toastId:e})},t||ug);Ii.set(e,n)},hg=(e,t)=>{var n;switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,((n=t==null?void 0:t.toast)==null?void 0:n.limit)??1)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(r=>r.id===t.toast.id?{...r,...t.toast}:r)};case"DISMISS_TOAST":{const{toastId:r}=t;if(r){const i=e.toasts.find(s=>s.id===r);va(r,i==null?void 0:i.duration)}else e.toasts.forEach(i=>{va(i.id,i.duration)});return{...e,toasts:e.toasts.map(i=>i.id===r||r===void 0?{...i,open:!1}:i)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(r=>r.id!==t.toastId)}}},mg=[];let Fi={toasts:[]};function Ur(e){Fi=hg(Fi,e),mg.forEach(t=>{t(Fi)})}function pg({duration:e=2e4,description:t,...n}){const r=fg(),i=typeof t=="string"?gl(t):t,s=a=>Ur({type:"UPDATE_TOAST",toast:{...a,description:i,id:r}}),o=()=>{Ur({type:"DISMISS_TOAST",toastId:r})};return Ur({type:"ADD_TOAST",toast:{...n,description:i,id:r,open:!0,duration:e,onOpenChange:a=>{a||o()}}}),e&&setTimeout(o,e),{id:r,dismiss:o,update:s}}const _s="An unknown error occurred",Ir=e=>{if(typeof e=="string")return e;if(typeof e!="object"||e===null)return _s;if(typeof e.message=="string")return e.message;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const n=Ir(e[t]);if(n)return n}return _s},gg=e=>{var t;if(Bc(e)){const n=(t=e.response)!=null&&t.data?Ir(e.response.data):void 0;return n&&n!==_s?n:Ir(e)}return Ir(e)},yg=({queryKey:e,queryFn:t,...n})=>Mn({queryKey:e,queryFn:async r=>{var i;try{const s=r.queryKey[1];return await t(s)}catch(s){throw pg({variant:"destructive",title:"Error",description:gg(Bc(s)?(i=s.response)==null?void 0:i.data:s)}),null}},...n});var me;(function(e){e.assertEqual=i=>{};function t(i){}e.assertIs=t;function n(i){throw new Error}e.assertNever=n,e.arrayToEnum=i=>{const s={};for(const o of i)s[o]=o;return s},e.getValidEnumValues=i=>{const s=e.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),o={};for(const a of s)o[a]=i[a];return e.objectValues(o)},e.objectValues=i=>e.objectKeys(i).map(function(s){return i[s]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const s=[];for(const o in i)Object.prototype.hasOwnProperty.call(i,o)&&s.push(o);return s},e.find=(i,s)=>{for(const o of i)if(s(o))return o},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,s=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(s)}e.joinValues=r,e.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(me||(me={}));var Sa;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(Sa||(Sa={}));const z=me.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ct=e=>{switch(typeof e){case"undefined":return z.undefined;case"string":return z.string;case"number":return Number.isNaN(e)?z.nan:z.number;case"boolean":return z.boolean;case"function":return z.function;case"bigint":return z.bigint;case"symbol":return z.symbol;case"object":return Array.isArray(e)?z.array:e===null?z.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?z.promise:typeof Map<"u"&&e instanceof Map?z.map:typeof Set<"u"&&e instanceof Set?z.set:typeof Date<"u"&&e instanceof Date?z.date:z.object;default:return z.unknown}},M=me.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class bt extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){const n=t||function(s){return s.message},r={_errors:[]},i=s=>{for(const o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let a=r,l=0;for(;l<o.path.length;){const d=o.path[l];l===o.path.length-1?(a[d]=a[d]||{_errors:[]},a[d]._errors.push(n(o))):a[d]=a[d]||{_errors:[]},a=a[d],l++}}};return i(this),r}static assert(t){if(!(t instanceof bt))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,me.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const i of this.issues)if(i.path.length>0){const s=i.path[0];n[s]=n[s]||[],n[s].push(t(i))}else r.push(t(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}bt.create=e=>new bt(e);const ws=(e,t)=>{let n;switch(e.code){case M.invalid_type:e.received===z.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case M.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,me.jsonStringifyReplacer)}`;break;case M.unrecognized_keys:n=`Unrecognized key(s) in object: ${me.joinValues(e.keys,", ")}`;break;case M.invalid_union:n="Invalid input";break;case M.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${me.joinValues(e.options)}`;break;case M.invalid_enum_value:n=`Invalid enum value. Expected ${me.joinValues(e.options)}, received '${e.received}'`;break;case M.invalid_arguments:n="Invalid function arguments";break;case M.invalid_return_type:n="Invalid function return type";break;case M.invalid_date:n="Invalid date";break;case M.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:me.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case M.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case M.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case M.custom:n="Invalid input";break;case M.invalid_intersection_types:n="Intersection results could not be merged";break;case M.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case M.not_finite:n="Number must be finite";break;default:n=t.defaultError,me.assertNever(e)}return{message:n}};let bg=ws;function _g(){return bg}const wg=e=>{const{data:t,path:n,errorMaps:r,issueData:i}=e,s=[...n,...i.path||[]],o={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let a="";const l=r.filter(d=>!!d).slice().reverse();for(const d of l)a=d(o,{data:t,defaultError:a}).message;return{...i,path:s,message:a}};function $(e,t){const n=_g(),r=wg({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===ws?void 0:ws].filter(i=>!!i)});e.common.issues.push(r)}class Qe{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const i of n){if(i.status==="aborted")return se;i.status==="dirty"&&t.dirty(),r.push(i.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const i of n){const s=await i.key,o=await i.value;r.push({key:s,value:o})}return Qe.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const i of n){const{key:s,value:o}=i;if(s.status==="aborted"||o.status==="aborted")return se;s.status==="dirty"&&t.dirty(),o.status==="dirty"&&t.dirty(),s.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(r[s.value]=o.value)}return{status:t.value,value:r}}}const se=Object.freeze({status:"aborted"}),qn=e=>({status:"dirty",value:e}),rt=e=>({status:"valid",value:e}),Ta=e=>e.status==="aborted",xa=e=>e.status==="dirty",On=e=>e.status==="valid",Jr=e=>typeof Promise<"u"&&e instanceof Promise;var q;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(q||(q={}));class It{constructor(t,n,r,i){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const ka=(e,t)=>{if(On(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new bt(e.common.issues);return this._error=n,this._error}}};function de(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(o,a)=>{const{message:l}=e;return o.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??r??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:l??n??a.defaultError}},description:i}}class he{get description(){return this._def.description}_getType(t){return Ct(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Ct(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Qe,ctx:{common:t.parent.common,data:t.data,parsedType:Ct(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(Jr(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){const r={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Ct(t)},i=this._parseSync({data:t,path:r.path,parent:r});return ka(r,i)}"~validate"(t){var r,i;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Ct(t)};if(!this["~standard"].async)try{const s=this._parseSync({data:t,path:[],parent:n});return On(s)?{value:s.value}:{issues:n.common.issues}}catch(s){(i=(r=s==null?void 0:s.message)==null?void 0:r.toLowerCase())!=null&&i.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(s=>On(s)?{value:s.value}:{issues:n.common.issues})}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Ct(t)},i=this._parse({data:t,path:r.path,parent:r}),s=await(Jr(i)?i:Promise.resolve(i));return ka(r,s)}refine(t,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,s)=>{const o=t(i),a=()=>s.addIssue({code:M.custom,...r(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(t,n){return this._refinement((r,i)=>t(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(t){return new Ln({schema:this,typeName:oe.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return Ut.create(this,this._def)}nullable(){return Nn.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ft.create(this)}promise(){return ni.create(this,this._def)}or(t){return ei.create([this,t],this._def)}and(t){return ti.create(this,t,this._def)}transform(t){return new Ln({...de(this._def),schema:this,typeName:oe.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new Ts({...de(this._def),innerType:this,defaultValue:n,typeName:oe.ZodDefault})}brand(){return new Vg({typeName:oe.ZodBranded,type:this,...de(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new xs({...de(this._def),innerType:this,catchValue:n,typeName:oe.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Xs.create(this,t)}readonly(){return ks.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const vg=/^c[^\s-]{8,}$/i,Sg=/^[0-9a-z]+$/,Tg=/^[0-9A-HJKMNP-TV-Z]{26}$/i,xg=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,kg=/^[a-z0-9_-]{21}$/i,Pg=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Cg=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Og=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Eg="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Bi;const Ag=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Lg=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Ng=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Dg=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Rg=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,jg=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Cl="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Mg=new RegExp(`^${Cl}$`);function Ol(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function Ug(e){return new RegExp(`^${Ol(e)}$`)}function Ig(e){let t=`${Cl}T${Ol(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function Fg(e,t){return!!((t==="v4"||!t)&&Ag.test(e)||(t==="v6"||!t)&&Ng.test(e))}function Bg(e,t){if(!Pg.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(atob(r));return!(typeof i!="object"||i===null||"typ"in i&&(i==null?void 0:i.typ)!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}function Wg(e,t){return!!((t==="v4"||!t)&&Lg.test(e)||(t==="v6"||!t)&&Dg.test(e))}class jt extends he{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==z.string){const s=this._getOrReturnCtx(t);return $(s,{code:M.invalid_type,expected:z.string,received:s.parsedType}),se}const r=new Qe;let i;for(const s of this._def.checks)if(s.kind==="min")t.data.length<s.value&&(i=this._getOrReturnCtx(t,i),$(i,{code:M.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")t.data.length>s.value&&(i=this._getOrReturnCtx(t,i),$(i,{code:M.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){const o=t.data.length>s.value,a=t.data.length<s.value;(o||a)&&(i=this._getOrReturnCtx(t,i),o?$(i,{code:M.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&$(i,{code:M.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")Og.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"email",code:M.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")Bi||(Bi=new RegExp(Eg,"u")),Bi.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"emoji",code:M.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")xg.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"uuid",code:M.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")kg.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"nanoid",code:M.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")vg.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"cuid",code:M.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")Sg.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"cuid2",code:M.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")Tg.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"ulid",code:M.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),$(i,{validation:"url",code:M.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"regex",code:M.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?t.data=t.data.trim():s.kind==="includes"?t.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(t,i),$(i,{code:M.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?t.data=t.data.toLowerCase():s.kind==="toUpperCase"?t.data=t.data.toUpperCase():s.kind==="startsWith"?t.data.startsWith(s.value)||(i=this._getOrReturnCtx(t,i),$(i,{code:M.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?t.data.endsWith(s.value)||(i=this._getOrReturnCtx(t,i),$(i,{code:M.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?Ig(s).test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{code:M.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?Mg.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{code:M.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?Ug(s).test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{code:M.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?Cg.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"duration",code:M.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?Fg(t.data,s.version)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"ip",code:M.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?Bg(t.data,s.alg)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"jwt",code:M.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?Wg(t.data,s.version)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"cidr",code:M.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?Rg.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"base64",code:M.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?jg.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"base64url",code:M.invalid_string,message:s.message}),r.dirty()):me.assertNever(s);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(i=>t.test(i),{validation:n,code:M.invalid_string,...q.errToObj(r)})}_addCheck(t){return new jt({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...q.errToObj(t)})}url(t){return this._addCheck({kind:"url",...q.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...q.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...q.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...q.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...q.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...q.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...q.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...q.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...q.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...q.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...q.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...q.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(t==null?void 0:t.offset)??!1,local:(t==null?void 0:t.local)??!1,...q.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...q.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...q.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...q.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...q.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...q.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...q.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...q.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...q.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...q.errToObj(n)})}nonempty(t){return this.min(1,q.errToObj(t))}trim(){return new jt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new jt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new jt({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}jt.create=e=>new jt({checks:[],typeName:oe.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...de(e)});function $g(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,i=n>r?n:r,s=Number.parseInt(e.toFixed(i).replace(".","")),o=Number.parseInt(t.toFixed(i).replace(".",""));return s%o/10**i}class En extends he{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==z.number){const s=this._getOrReturnCtx(t);return $(s,{code:M.invalid_type,expected:z.number,received:s.parsedType}),se}let r;const i=new Qe;for(const s of this._def.checks)s.kind==="int"?me.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),$(r,{code:M.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(r=this._getOrReturnCtx(t,r),$(r,{code:M.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),$(r,{code:M.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?$g(t.data,s.value)!==0&&(r=this._getOrReturnCtx(t,r),$(r,{code:M.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),$(r,{code:M.not_finite,message:s.message}),i.dirty()):me.assertNever(s);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,q.toString(n))}gt(t,n){return this.setLimit("min",t,!1,q.toString(n))}lte(t,n){return this.setLimit("max",t,!0,q.toString(n))}lt(t,n){return this.setLimit("max",t,!1,q.toString(n))}setLimit(t,n,r,i){return new En({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:q.toString(i)}]})}_addCheck(t){return new En({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:q.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:q.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:q.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:q.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:q.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:q.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:q.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:q.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:q.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&me.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}}En.create=e=>new En({checks:[],typeName:oe.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...de(e)});class Xn extends he{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==z.bigint)return this._getInvalidInput(t);let r;const i=new Qe;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(r=this._getOrReturnCtx(t,r),$(r,{code:M.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),$(r,{code:M.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?t.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),$(r,{code:M.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):me.assertNever(s);return{status:i.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return $(n,{code:M.invalid_type,expected:z.bigint,received:n.parsedType}),se}gte(t,n){return this.setLimit("min",t,!0,q.toString(n))}gt(t,n){return this.setLimit("min",t,!1,q.toString(n))}lte(t,n){return this.setLimit("max",t,!0,q.toString(n))}lt(t,n){return this.setLimit("max",t,!1,q.toString(n))}setLimit(t,n,r,i){return new Xn({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:q.toString(i)}]})}_addCheck(t){return new Xn({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:q.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:q.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:q.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:q.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:q.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Xn.create=e=>new Xn({checks:[],typeName:oe.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...de(e)});class vs extends he{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==z.boolean){const r=this._getOrReturnCtx(t);return $(r,{code:M.invalid_type,expected:z.boolean,received:r.parsedType}),se}return rt(t.data)}}vs.create=e=>new vs({typeName:oe.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...de(e)});class Xr extends he{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==z.date){const s=this._getOrReturnCtx(t);return $(s,{code:M.invalid_type,expected:z.date,received:s.parsedType}),se}if(Number.isNaN(t.data.getTime())){const s=this._getOrReturnCtx(t);return $(s,{code:M.invalid_date}),se}const r=new Qe;let i;for(const s of this._def.checks)s.kind==="min"?t.data.getTime()<s.value&&(i=this._getOrReturnCtx(t,i),$(i,{code:M.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?t.data.getTime()>s.value&&(i=this._getOrReturnCtx(t,i),$(i,{code:M.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):me.assertNever(s);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Xr({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:q.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:q.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}}Xr.create=e=>new Xr({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:oe.ZodDate,...de(e)});class Pa extends he{_parse(t){if(this._getType(t)!==z.symbol){const r=this._getOrReturnCtx(t);return $(r,{code:M.invalid_type,expected:z.symbol,received:r.parsedType}),se}return rt(t.data)}}Pa.create=e=>new Pa({typeName:oe.ZodSymbol,...de(e)});class Ca extends he{_parse(t){if(this._getType(t)!==z.undefined){const r=this._getOrReturnCtx(t);return $(r,{code:M.invalid_type,expected:z.undefined,received:r.parsedType}),se}return rt(t.data)}}Ca.create=e=>new Ca({typeName:oe.ZodUndefined,...de(e)});class Oa extends he{_parse(t){if(this._getType(t)!==z.null){const r=this._getOrReturnCtx(t);return $(r,{code:M.invalid_type,expected:z.null,received:r.parsedType}),se}return rt(t.data)}}Oa.create=e=>new Oa({typeName:oe.ZodNull,...de(e)});class Ea extends he{constructor(){super(...arguments),this._any=!0}_parse(t){return rt(t.data)}}Ea.create=e=>new Ea({typeName:oe.ZodAny,...de(e)});class Aa extends he{constructor(){super(...arguments),this._unknown=!0}_parse(t){return rt(t.data)}}Aa.create=e=>new Aa({typeName:oe.ZodUnknown,...de(e)});class Ft extends he{_parse(t){const n=this._getOrReturnCtx(t);return $(n,{code:M.invalid_type,expected:z.never,received:n.parsedType}),se}}Ft.create=e=>new Ft({typeName:oe.ZodNever,...de(e)});class La extends he{_parse(t){if(this._getType(t)!==z.undefined){const r=this._getOrReturnCtx(t);return $(r,{code:M.invalid_type,expected:z.void,received:r.parsedType}),se}return rt(t.data)}}La.create=e=>new La({typeName:oe.ZodVoid,...de(e)});class ft extends he{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),i=this._def;if(n.parsedType!==z.array)return $(n,{code:M.invalid_type,expected:z.array,received:n.parsedType}),se;if(i.exactLength!==null){const o=n.data.length>i.exactLength.value,a=n.data.length<i.exactLength.value;(o||a)&&($(n,{code:o?M.too_big:M.too_small,minimum:a?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&($(n,{code:M.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&($(n,{code:M.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,a)=>i.type._parseAsync(new It(n,o,n.path,a)))).then(o=>Qe.mergeArray(r,o));const s=[...n.data].map((o,a)=>i.type._parseSync(new It(n,o,n.path,a)));return Qe.mergeArray(r,s)}get element(){return this._def.type}min(t,n){return new ft({...this._def,minLength:{value:t,message:q.toString(n)}})}max(t,n){return new ft({...this._def,maxLength:{value:t,message:q.toString(n)}})}length(t,n){return new ft({...this._def,exactLength:{value:t,message:q.toString(n)}})}nonempty(t){return this.min(1,t)}}ft.create=(e,t)=>new ft({type:e,minLength:null,maxLength:null,exactLength:null,typeName:oe.ZodArray,...de(t)});function dn(e){if(e instanceof Oe){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Ut.create(dn(r))}return new Oe({...e._def,shape:()=>t})}else return e instanceof ft?new ft({...e._def,type:dn(e.element)}):e instanceof Ut?Ut.create(dn(e.unwrap())):e instanceof Nn?Nn.create(dn(e.unwrap())):e instanceof on?on.create(e.items.map(t=>dn(t))):e}class Oe extends he{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=me.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==z.object){const d=this._getOrReturnCtx(t);return $(d,{code:M.invalid_type,expected:z.object,received:d.parsedType}),se}const{status:r,ctx:i}=this._processInputParams(t),{shape:s,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof Ft&&this._def.unknownKeys==="strip"))for(const d in i.data)o.includes(d)||a.push(d);const l=[];for(const d of o){const u=s[d],f=i.data[d];l.push({key:{status:"valid",value:d},value:u._parse(new It(i,f,i.path,d)),alwaysSet:d in i.data})}if(this._def.catchall instanceof Ft){const d=this._def.unknownKeys;if(d==="passthrough")for(const u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(d==="strict")a.length>0&&($(i,{code:M.unrecognized_keys,keys:a}),r.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const d=this._def.catchall;for(const u of a){const f=i.data[u];l.push({key:{status:"valid",value:u},value:d._parse(new It(i,f,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const d=[];for(const u of l){const f=await u.key,m=await u.value;d.push({key:f,value:m,alwaysSet:u.alwaysSet})}return d}).then(d=>Qe.mergeObjectSync(r,d)):Qe.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return q.errToObj,new Oe({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var s,o;const i=((o=(s=this._def).errorMap)==null?void 0:o.call(s,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:q.errToObj(t).message??i}:{message:i}}}:{}})}strip(){return new Oe({...this._def,unknownKeys:"strip"})}passthrough(){return new Oe({...this._def,unknownKeys:"passthrough"})}extend(t){return new Oe({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Oe({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:oe.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new Oe({...this._def,catchall:t})}pick(t){const n={};for(const r of me.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new Oe({...this._def,shape:()=>n})}omit(t){const n={};for(const r of me.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new Oe({...this._def,shape:()=>n})}deepPartial(){return dn(this)}partial(t){const n={};for(const r of me.objectKeys(this.shape)){const i=this.shape[r];t&&!t[r]?n[r]=i:n[r]=i.optional()}return new Oe({...this._def,shape:()=>n})}required(t){const n={};for(const r of me.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof Ut;)s=s._def.innerType;n[r]=s}return new Oe({...this._def,shape:()=>n})}keyof(){return El(me.objectKeys(this.shape))}}Oe.create=(e,t)=>new Oe({shape:()=>e,unknownKeys:"strip",catchall:Ft.create(),typeName:oe.ZodObject,...de(t)});Oe.strictCreate=(e,t)=>new Oe({shape:()=>e,unknownKeys:"strict",catchall:Ft.create(),typeName:oe.ZodObject,...de(t)});Oe.lazycreate=(e,t)=>new Oe({shape:e,unknownKeys:"strip",catchall:Ft.create(),typeName:oe.ZodObject,...de(t)});class ei extends he{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function i(s){for(const a of s)if(a.result.status==="valid")return a.result;for(const a of s)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const o=s.map(a=>new bt(a.ctx.common.issues));return $(n,{code:M.invalid_union,unionErrors:o}),se}if(n.common.async)return Promise.all(r.map(async s=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(i);{let s;const o=[];for(const l of r){const d={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:d});if(u.status==="valid")return u;u.status==="dirty"&&!s&&(s={result:u,ctx:d}),d.common.issues.length&&o.push(d.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;const a=o.map(l=>new bt(l));return $(n,{code:M.invalid_union,unionErrors:a}),se}}get options(){return this._def.options}}ei.create=(e,t)=>new ei({options:e,typeName:oe.ZodUnion,...de(t)});function Ss(e,t){const n=Ct(e),r=Ct(t);if(e===t)return{valid:!0,data:e};if(n===z.object&&r===z.object){const i=me.objectKeys(t),s=me.objectKeys(e).filter(a=>i.indexOf(a)!==-1),o={...e,...t};for(const a of s){const l=Ss(e[a],t[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}else if(n===z.array&&r===z.array){if(e.length!==t.length)return{valid:!1};const i=[];for(let s=0;s<e.length;s++){const o=e[s],a=t[s],l=Ss(o,a);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return n===z.date&&r===z.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class ti extends he{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=(s,o)=>{if(Ta(s)||Ta(o))return se;const a=Ss(s.value,o.value);return a.valid?((xa(s)||xa(o))&&n.dirty(),{status:n.value,value:a.data}):($(r,{code:M.invalid_intersection_types}),se)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,o])=>i(s,o)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}ti.create=(e,t,n)=>new ti({left:e,right:t,typeName:oe.ZodIntersection,...de(n)});class on extends he{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==z.array)return $(r,{code:M.invalid_type,expected:z.array,received:r.parsedType}),se;if(r.data.length<this._def.items.length)return $(r,{code:M.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),se;!this._def.rest&&r.data.length>this._def.items.length&&($(r,{code:M.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...r.data].map((o,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new It(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(s).then(o=>Qe.mergeArray(n,o)):Qe.mergeArray(n,s)}get items(){return this._def.items}rest(t){return new on({...this._def,rest:t})}}on.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new on({items:e,typeName:oe.ZodTuple,rest:null,...de(t)})};class Na extends he{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==z.map)return $(r,{code:M.invalid_type,expected:z.map,received:r.parsedType}),se;const i=this._def.keyType,s=this._def.valueType,o=[...r.data.entries()].map(([a,l],d)=>({key:i._parse(new It(r,a,r.path,[d,"key"])),value:s._parse(new It(r,l,r.path,[d,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of o){const d=await l.key,u=await l.value;if(d.status==="aborted"||u.status==="aborted")return se;(d.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(d.value,u.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of o){const d=l.key,u=l.value;if(d.status==="aborted"||u.status==="aborted")return se;(d.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(d.value,u.value)}return{status:n.value,value:a}}}}Na.create=(e,t,n)=>new Na({valueType:t,keyType:e,typeName:oe.ZodMap,...de(n)});class er extends he{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==z.set)return $(r,{code:M.invalid_type,expected:z.set,received:r.parsedType}),se;const i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&($(r,{code:M.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&($(r,{code:M.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const s=this._def.valueType;function o(l){const d=new Set;for(const u of l){if(u.status==="aborted")return se;u.status==="dirty"&&n.dirty(),d.add(u.value)}return{status:n.value,value:d}}const a=[...r.data.values()].map((l,d)=>s._parse(new It(r,l,r.path,d)));return r.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(t,n){return new er({...this._def,minSize:{value:t,message:q.toString(n)}})}max(t,n){return new er({...this._def,maxSize:{value:t,message:q.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}er.create=(e,t)=>new er({valueType:e,minSize:null,maxSize:null,typeName:oe.ZodSet,...de(t)});class Da extends he{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}Da.create=(e,t)=>new Da({getter:e,typeName:oe.ZodLazy,...de(t)});class Ra extends he{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return $(n,{received:n.data,code:M.invalid_literal,expected:this._def.value}),se}return{status:"valid",value:t.data}}get value(){return this._def.value}}Ra.create=(e,t)=>new Ra({value:e,typeName:oe.ZodLiteral,...de(t)});function El(e,t){return new An({values:e,typeName:oe.ZodEnum,...de(t)})}class An extends he{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return $(n,{expected:me.joinValues(r),received:n.parsedType,code:M.invalid_type}),se}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return $(n,{received:n.data,code:M.invalid_enum_value,options:r}),se}return rt(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return An.create(t,{...this._def,...n})}exclude(t,n=this._def){return An.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}An.create=El;class ja extends he{_parse(t){const n=me.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==z.string&&r.parsedType!==z.number){const i=me.objectValues(n);return $(r,{expected:me.joinValues(i),received:r.parsedType,code:M.invalid_type}),se}if(this._cache||(this._cache=new Set(me.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const i=me.objectValues(n);return $(r,{received:r.data,code:M.invalid_enum_value,options:i}),se}return rt(t.data)}get enum(){return this._def.values}}ja.create=(e,t)=>new ja({values:e,typeName:oe.ZodNativeEnum,...de(t)});class ni extends he{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==z.promise&&n.common.async===!1)return $(n,{code:M.invalid_type,expected:z.promise,received:n.parsedType}),se;const r=n.parsedType===z.promise?n.data:Promise.resolve(n.data);return rt(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}ni.create=(e,t)=>new ni({type:e,typeName:oe.ZodPromise,...de(t)});class Ln extends he{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===oe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=this._def.effect||null,s={addIssue:o=>{$(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){const o=i.transform(r.data,s);if(r.common.async)return Promise.resolve(o).then(async a=>{if(n.value==="aborted")return se;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?se:l.status==="dirty"||n.value==="dirty"?qn(l.value):l});{if(n.value==="aborted")return se;const a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?se:a.status==="dirty"||n.value==="dirty"?qn(a.value):a}}if(i.type==="refinement"){const o=a=>{const l=i.refinement(a,s);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?se:(a.status==="dirty"&&n.dirty(),o(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?se:(a.status==="dirty"&&n.dirty(),o(a.value).then(()=>({status:n.value,value:a.value}))))}if(i.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!On(o))return se;const a=i.transform(o.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>On(o)?Promise.resolve(i.transform(o.value,s)).then(a=>({status:n.value,value:a})):se);me.assertNever(i)}}Ln.create=(e,t,n)=>new Ln({schema:e,typeName:oe.ZodEffects,effect:t,...de(n)});Ln.createWithPreprocess=(e,t,n)=>new Ln({schema:t,effect:{type:"preprocess",transform:e},typeName:oe.ZodEffects,...de(n)});class Ut extends he{_parse(t){return this._getType(t)===z.undefined?rt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Ut.create=(e,t)=>new Ut({innerType:e,typeName:oe.ZodOptional,...de(t)});class Nn extends he{_parse(t){return this._getType(t)===z.null?rt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Nn.create=(e,t)=>new Nn({innerType:e,typeName:oe.ZodNullable,...de(t)});class Ts extends he{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===z.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Ts.create=(e,t)=>new Ts({innerType:e,typeName:oe.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...de(t)});class xs extends he{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Jr(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new bt(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new bt(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}xs.create=(e,t)=>new xs({innerType:e,typeName:oe.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...de(t)});class Ma extends he{_parse(t){if(this._getType(t)!==z.nan){const r=this._getOrReturnCtx(t);return $(r,{code:M.invalid_type,expected:z.nan,received:r.parsedType}),se}return{status:"valid",value:t.data}}}Ma.create=e=>new Ma({typeName:oe.ZodNaN,...de(e)});class Vg extends he{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class Xs extends he{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?se:s.status==="dirty"?(n.dirty(),qn(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?se:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(t,n){return new Xs({in:t,out:n,typeName:oe.ZodPipeline})}}class ks extends he{_parse(t){const n=this._def.innerType._parse(t),r=i=>(On(i)&&(i.value=Object.freeze(i.value)),i);return Jr(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}}ks.create=(e,t)=>new ks({innerType:e,typeName:oe.ZodReadonly,...de(t)});var oe;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(oe||(oe={}));const Wi=jt.create,Or=En.create,Hg=vs.create;Ft.create;ft.create;const zg=Oe.create;ei.create;ti.create;on.create;An.create;ni.create;Ut.create;Nn.create;const qg="https://api.opheleo.com",Kg="Bearer ",Gg="Authorization";zg({id:Wi(),userId:Wi(),createdAt:Or(),updatedAt:Or(),active:Hg(),perDayUsage:Or(),userEmail:Wi().email(),maxPerDayUsage:Or()});async function Qg(e,t,n){const r=typeof window<"u"?localStorage.getItem("session_token"):null;return(await Se({baseURL:Cn(n??qg),url:e,method:t,headers:r?{[Gg]:`${Kg}${r}`}:void 0})).data}async function Zg(e){return Qg("/iccandle/v1/iccandle-user-usage/me","get",e)}const Yg=e=>{const t=e==null?void 0:e.platformApiBase;return yg({queryKey:["iccandle-user-usage",t],queryFn:()=>Zg(t),...e})},Jg=p.createContext(null);function Xg(){const e=p.useContext(Jg);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function ey({controlsRef:e,onSymbolTickerChange:t,onScanResultUrlChange:n,onChartWidgetChange:r,onChartContainerChange:i,selectSymbolTickerRef:s,headerSlot:o}){const{resolvedTheme:a}=Xg(),l=nt(),d=yr(),u=p.useRef([]),f=p.useRef(null),m=p.useRef(a),h=p.useRef(null),b=p.useRef(null),v=p.useMemo(()=>Yr(d),[d]),_=p.useRef(v),g=p.useRef("60"),{setGapCount:T,setReplayMode:x}=kl();p.useEffect(()=>{T(0),x(!1)},[T,x]),p.useEffect(()=>{Mr()&&E(!0)},[]);const[y,O]=p.useState(null),[C,E]=p.useState(!1),[k,U]=p.useState(null),F=p.useCallback(j=>{if(j===_.current)return;const A=d.find(R=>R.ticker===j);if(!A)return;_.current=j,localStorage.setItem(un,j),t(j);const W=f.current;if(W)try{W.onChartReady(()=>{W.activeChart().setSymbol(A.ticker)})}catch{}},[t,d]);p.useEffect(()=>(s.current=F,()=>{s.current=null}),[F,s]);const H=p.useRef([]),L=p.useMemo(()=>new lg(H,"selector",d,l.tickWebSocketUrl),[l.tickWebSocketUrl,d]),{data:Q,isLoading:K}=Yg({enabled:!0,platformApiBase:l.platformApiBase}),re=!K&&Q?Q.perDayUsage>=Q.maxPerDayUsage:!1;p.useEffect(()=>{i(y)},[y,i]),p.useEffect(()=>{r(k)},[k,r]),p.useEffect(()=>{if(!C||!y)return;if(f.current){U(null),r(null);try{f.current.remove()}catch{}f.current=null}const j=Yr(d);_.current=j,g.current="60";const A=xl();if(!A)return;const W=new A({container:y,library_path:"/charting_library/",datafeed:L,symbol:j,interval:"60",autosize:!0,theme:m.current,disabled_features:["symbol_info","legend_inplace_edit","header_quick_search","header_compare"],enabled_features:["header_chart_type","show_symbol_logos","show_symbol_logo_in_legend"],custom_indicators_getter:()=>dg(u),drawings_access:{type:"black",tools:[{name:"Date Range"}]},locale:"en",timezone:vd(),overrides:{priceScaleSelectionStrategyName:"right","scalesProperties.showSeriesLastValue":!0}});let R=!1;return f.current=W,W.onChartReady(()=>{R||f.current!==W||U(W)}),()=>{if(R=!0,U(null),r(null),f.current){try{f.current.remove()}catch{}f.current=null}}},[y,L,r,C]),p.useEffect(()=>{if(!k)return;let j=!1;try{k.onChartReady(()=>{j||(async()=>{try{const A=k.activeChart(),W=await A.createStudy("Generated Candles - By iC Candle",!0,!0);if(j||(W&&A.bringToFront([W]),await k.headerReady(),j)||(await new Promise(ae=>{setTimeout(()=>{if(!j)try{A.clearMarks(2)}catch{}ae(!0)},150)}),j))return;localStorage.setItem("tv:selected-news-events","[]"),A.refreshMarks();const R=ae=>{const ce=A.symbol(),ie=ps(ce,d,v);ie!==_.current&&(n(null),u.current=[]);try{k.resetCache()}catch{}_.current=ie,localStorage.setItem(un,ie),t(ie)},G=ae=>{ae!==g.current&&(n(null),u.current=[]);try{k.resetCache()}catch{}g.current=ae};h.current=R,b.current=G,A.onSymbolChanged().subscribe(null,R),A.onIntervalChanged().subscribe(null,G)}catch{}})()})}catch{}return()=>{j=!0,h.current=null,b.current=null}},[k,e,n,t,v,d]),p.useEffect(()=>{if(!k||!a)return;let j=!1;try{k.onChartReady(()=>{j||k.changeTheme(a).catch(()=>{})})}catch{}return()=>{j=!0}},[k,a]);const P=p.useCallback(()=>{E(!0)},[]),D=re?c.jsx("div",{className:"web-trading-widget-advanced__scan-limit-wrap",children:c.jsxs(Xp,{variant:"destructive",className:"web-trading-widget-advanced__scan-limit-badge",children:[c.jsx("span",{className:"web-trading-widget-advanced__scan-limit-badge-title",children:"Daily scan limit reached"}),Q&&c.jsxs("span",{className:"web-trading-widget-advanced__scan-limit-badge-count",children:[Q.perDayUsage," of ",Q.maxPerDayUsage," scans used today"]})]})}):null;return c.jsxs(c.Fragment,{children:[o??D,c.jsx(eg,{onLoad:P}),c.jsx("div",{ref:O,className:"web-trading-widget-advanced__container"})]})}const Al=p.createContext(null);function Ua({value:e,children:t}){return c.jsx(Al.Provider,{value:e,children:t})}function ty(){const e=p.useContext(Al);if(!e)throw new Error("useWidgetChartSlot must be used within WidgetChartSlotProvider");return e}function Er(e,t){return e.toFixed(t)}function ny({symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:i,minVolumeLots:s,isSubmitting:o,isAccountsLoading:a,selectedLogin:l,isDragging:d,isCollapsed:u,onToggleCollapsed:f,onDragHandlePointerDown:m,onPlaceOrder:h}){const{t:b}=Te(),[v,_]=p.useState(!0),g=u??v,T=()=>{f==null||f(),u===void 0&&_(D=>!D)},x=ne(D=>D.setOrderSide),y=ne(D=>D.setVolumeLots),O=ne(D=>D.volumeLots),[C,E]=p.useState(String(O||r));p.useEffect(()=>{g||E(Er(O,2))},[g,O]);const k=Number(wt(vt(e))),U=t!==null?pe(t,k):"—",F=n!==null?pe(n,k):"—",L=!o&&!a&&l!==""&&(t!==null&&n!==null),Q=D=>{const j=Number(C),A=Number.isFinite(j)&&j>0?j:r,W=Math.max(s,A+D*i),R=Er(W,2);E(R),y(W)},K=()=>{const D=Number(C);if(!Number.isFinite(D)||D<=0){E(Er(r,2)),y(r);return}const j=Math.max(s,D),A=Er(j,2);E(A),y(j)},re=D=>{t===null||n===null||x({side:D,entryPrice:D==="buy"?n:t})},P=D=>{if(t===null||n===null||!l)return;const j=Number(C),A=Math.max(s,Number.isFinite(j)&&j>0?j:r);x({side:D,entryPrice:D==="buy"?n:t}),h({login:l,side:D,volumeLots:A,bid:t,ask:n})};return c.jsx("div",{className:"web-trading-widget-mini-order web-trading-widget-mini-order--expanded",children:c.jsxs("div",{className:"web-trading-widget-mini-order__row",children:[c.jsx("button",{type:"button","aria-label":b("WebTrading.moveQuickOrderPanel"),onPointerDown:m,className:`web-trading-widget-mini-order__drag-handle${d?" web-trading-widget-mini-order__drag-handle--grabbing":""}`,children:c.jsx(ec,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2})}),c.jsxs(c.Fragment,{children:[c.jsxs("button",{type:"button",disabled:!L,className:"web-trading-widget-mini-order__side-btn web-trading-widget-mini-order__side-btn--sell",onMouseDown:()=>re("sell"),onClick:()=>P("sell"),children:[c.jsx("span",{className:"web-trading-widget-mini-order__price",children:U}),c.jsx("span",{className:"web-trading-widget-mini-order__label web-trading-widget-mini-order__label--sell",children:b("WebTrading.sell").toUpperCase()})]}),c.jsxs("div",{className:"web-trading-widget-mini-order__volume",children:[c.jsx("button",{type:"button","aria-label":b("WebTrading.decreaseVolume"),disabled:!L,className:"web-trading-widget-mini-order__volume-btn",onClick:()=>Q(-1),children:c.jsx(Br,{className:"web-trading-widget-icon web-trading-widget-icon--xs",strokeWidth:2.5})}),c.jsx("input",{type:"text",inputMode:"decimal",value:C,disabled:!L,onChange:D=>E(D.target.value),onBlur:K,className:"web-trading-widget-mini-order__volume-input"}),c.jsx("button",{type:"button","aria-label":b("WebTrading.increaseVolume"),disabled:!L,className:"web-trading-widget-mini-order__volume-btn",onClick:()=>Q(1),children:c.jsx($i,{className:"web-trading-widget-icon web-trading-widget-icon--xs",strokeWidth:2.5})})]}),c.jsxs("button",{type:"button",disabled:!L,className:"web-trading-widget-mini-order__side-btn web-trading-widget-mini-order__side-btn--buy",onMouseDown:()=>re("buy"),onClick:()=>P("buy"),children:[c.jsx("span",{className:"web-trading-widget-mini-order__label web-trading-widget-mini-order__label--buy",children:b("WebTrading.buy").toUpperCase()}),c.jsx("span",{className:"web-trading-widget-mini-order__price",children:F})]})]}),c.jsx("button",{type:"button","aria-label":b(g?"WebTrading.expandQuickOrderPanel":"WebTrading.collapseQuickOrderPanel"),"aria-expanded":!g,className:"web-trading-widget-mini-order__toggle",onClick:T,children:g?c.jsx(Br,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2.5}):c.jsx($i,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2.5})})]})})}const ry=new Set(["volume-setting","risk-management"]);function iy({symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:i,minVolumeLots:s,isSubmitting:o,isAccountsLoading:a,selectedLogin:l,isDragging:d,onDragHandlePointerDown:u,onLayoutChange:f,onClose:m,onPlaceOrder:h}){const{t:b}=Te(),[v,_]=p.useState(!0),[g,T]=p.useState("market"),x=ne(X=>X.volumeLots),[y,O]=p.useState(String(x||r)),[C,E]=p.useState(""),[k,U]=p.useState(""),F=ne(X=>X.stopLoss),H=ne(X=>X.takeProfit),L=ne(X=>X.setStopLoss),Q=ne(X=>X.setTakeProfit),K=ne(X=>X.setVolumeLots),re=ne(X=>X.setOrderSide),[P,D]=p.useState(""),[j,A]=p.useState(We.GTC),[W,R]=p.useState(""),[G,ae]=p.useState(""),[ce,ie]=p.useState(()=>new Set(ry));p.useEffect(()=>{f()},[v,f]);const N=Number(wt(vt(e))),Z=Dn(N),te=Rs(t,n),ve=t!==null?pe(t,N):"—",Re=n!==null?pe(n,N):"—",be=ai(g),Pe=ic(g),Ce=oi(g),V=b(Vr[g]),we=!be&&Ce.orderType!==null&&Ce.orderType%2===1,Y=p.useMemo(()=>te!==null?te:t??n,[n,t,te]),_e=X=>{ie(qe=>{const Tt=new Set(qe);return Tt.has(X)?Tt.delete(X):Tt.add(X),Tt})},je=X=>{O(X);const qe=Number(X);Number.isFinite(qe)&&qe>0&&K(qe)},Ze=X=>t===null||n===null?null:be?X==="buy"?n:t:Le(C)??(X==="buy"?n:t),an=X=>{const qe=Ze(X);qe!==null&&re({side:X,entryPrice:qe})},Un=X=>{if(t===null||n===null||!l)return;const qe=Math.max(s,Number(y)||s),Tt=Vi(g,X),In=Ze(X);In!==null&&re({side:X,entryPrice:In}),h({login:l,executionMode:g,side:X,orderType:Tt,volumeLots:qe,stopLoss:F,takeProfit:H,priceOrder:C,priceTrigger:k,comment:P,typeTime:j,expirationDateTime:W,expirationDay:G,bid:t,ask:n})},it=t!==null&&n!==null,yi=be||Le(C)!==void 0,bi=!Pe||Le(k)!==void 0,J=be||li(j,W,G),Ye=!o&&!a&&l!==""&&it&&yi&&bi&&J,St=!be&&Ls(j),br=!be&&Ns(j),to=()=>Ce.orderType!==null&&Ce.orderType%2===1?"sell":"buy";return c.jsxs("div",{className:`web-trading-widget-market-panel web-trading-widget-market-panel--modal${v?" web-trading-widget-market-panel--collapsed":""}`,children:[c.jsx(ny,{symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:i,minVolumeLots:s,isSubmitting:o,isAccountsLoading:a,selectedLogin:l,isDragging:d,isCollapsed:v,onToggleCollapsed:()=>_(X=>!X),onDragHandlePointerDown:u,onPlaceOrder:({login:X,side:qe,volumeLots:Tt,bid:In,ask:no})=>{In===null||no===null||h({login:X,executionMode:"market",side:qe,orderType:Vi("market",qe),volumeLots:Tt,stopLoss:F,takeProfit:H,priceOrder:"",priceTrigger:"",comment:P,typeTime:j,expirationDateTime:"",expirationDay:"",bid:In,ask:no})}}),v?null:c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"web-trading-widget-market-panel__header",children:c.jsx("select",{value:g,className:"web-trading-widget-market-panel__select-trigger","aria-label":b("WebTrading.orderExecutionType"),onChange:X=>T(X.target.value),children:Wr.map(X=>c.jsx("option",{value:X.mode,children:b(Vr[X.mode])},X.mode))})}),c.jsxs("div",{className:"web-trading-widget-market-panel__accordion",children:[c.jsx(ut,{title:b("WebTrading.volumeSetting"),isOpen:ce.has("volume-setting"),onToggle:()=>_e("volume-setting"),children:c.jsx(ke,{label:b("WebTrading.lots"),value:y,onChange:je,step:i,min:s,decimals:2})}),be?null:c.jsx(ut,{title:b("WebTrading.orderPrice"),isOpen:ce.has("order-price"),onToggle:()=>_e("order-price"),children:Pe?c.jsxs(c.Fragment,{children:[c.jsx(ke,{label:b("WebTrading.stopPrice"),value:k,onChange:U,step:Z,decimals:N,basePrice:Y,placeholder:te!==null?pe(te,N):"—"}),c.jsx(ke,{label:b("WebTrading.limitPrice"),value:C,onChange:E,step:Z,decimals:N,basePrice:Y,placeholder:te!==null?pe(te,N):"—"})]}):c.jsx(ke,{label:b("WebTrading.price"),value:C,onChange:E,step:Z,decimals:N,basePrice:Y,placeholder:te!==null?pe(te,N):"—"})}),c.jsx(ut,{title:b("WebTrading.riskManagement"),isOpen:ce.has("risk-management"),onToggle:()=>_e("risk-management"),children:c.jsxs("div",{className:"web-trading-widget-market-panel__grid-2",children:[c.jsx(ke,{label:b("WebTrading.stopLoss"),value:F,onChange:L,step:Z,decimals:N,basePrice:t,placeholder:t!==null?ve:"—",clearable:!0}),c.jsx(ke,{label:b("WebTrading.takeProfit"),value:H,onChange:Q,step:Z,decimals:N,basePrice:n,placeholder:n!==null?Re:"—",clearable:!0})]})}),be?null:c.jsxs(ut,{title:b("WebTrading.expiration"),isOpen:ce.has("expiration"),onToggle:()=>_e("expiration"),children:[c.jsx("select",{value:String(j),className:"web-trading-widget-market-panel__select-full","aria-label":b("WebTrading.orderExpirationType"),onChange:X=>A(Number(X.target.value)),children:sc.map(X=>c.jsx("option",{value:String(X.value),children:b(oc[X.value])},X.value))}),St?c.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[c.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:b("WebTrading.expirationTime")}),c.jsx("input",{type:"datetime-local",value:W,className:"web-trading-widget-market-panel__input",onChange:X=>R(X.target.value)})]}):null,br?c.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[c.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:b("WebTrading.expirationDay")}),c.jsx("input",{type:"date",value:G,className:"web-trading-widget-market-panel__input",onChange:X=>ae(X.target.value)})]}):null]}),c.jsx(ut,{title:b("WebTrading.comment"),isOpen:ce.has("comment"),onToggle:()=>_e("comment"),children:c.jsx("input",{type:"text",value:P,className:"web-trading-widget-market-panel__input",placeholder:"",onChange:X=>D(X.target.value)})})]}),c.jsx("div",{className:"web-trading-widget-market-panel__footer",children:c.jsxs("div",{className:"web-trading-widget-market-panel__quotes",children:[c.jsx("span",{children:ve}),c.jsx("span",{className:"web-trading-widget-market-panel__quotes-ask",children:Re})]})}),!be&&c.jsx("button",{type:"button",className:`web-trading-widget-market-panel__place-btn${we?" web-trading-widget-market-panel__place-btn--sell":" web-trading-widget-market-panel__place-btn--buy"}`,disabled:!Ye,onMouseDown:()=>an(to()),onClick:()=>Un(to()),children:b("WebTrading.placeOrder",{label:V})})]})]})}function sy({symbolTicker:e,chartWidget:t,orderState:n}){const r=yr(),i=Vs(e),{panel:s,confirmation:o,isSubmitting:a,defaultVolumeLots:l,volumeStep:d,minVolumeLots:u,selectedLogin:f,isAccountsLoading:m,hasConfirmedAccount:h,closePanels:b,dismissConfirmation:v,placeMarketOrder:_}=n,g=le(R=>R.positions),T=le(R=>R.orders),x=le(R=>R.selectedPositionTicket),y=le(R=>R.selectedOrderTicket),O=le(R=>R.setSelectedPositionTicket),C=le(R=>R.setSelectedOrderTicket),E=x!==null?g.find(R=>R.ticket===x)??null:null,k=y!==null?T.find(R=>R.ticket===y)??null:null,U=E!==null||k!==null,F=h&&s==="confirmation"&&o!==null,H=h&&s!=="confirmation"&&s!=="closed"&&E===null&&k===null,{panelRef:L,position:Q,isDragging:K,onDragStart:re,reclamp:P}=uc({storageKey:"web-trading-widget-modal-exec-panel-position",defaultAlign:"top-right",isActive:H}),D=ne(R=>R.setDraft),j=ne(R=>R.clearDraft),A=Number(wt(vt(e))),W=Dn(A);return p.useEffect(()=>{if(h&&!U){if(s==="closed"||s==="confirmation"){j();return}D({source:"new-order",symbolKey:ar(e,r),entryPrice:null,side:null,showEntryLine:!1,stopLoss:"",takeProfit:"",volumeLots:l,digits:A,priceStep:W})}},[j,l,A,h,s,W,D,U,e,r]),!h&&!U?null:c.jsxs("div",{className:"web-trading-widget-new-order-overlay-layer",children:[c.jsx(Yc,{chartWidget:t,symbolTicker:e,symbols:r}),U&&E!==null?c.jsx("div",{className:"web-trading-widget-new-order-overlay web-trading-widget-new-order-overlay--news web-trading-widget-new-order-overlay--side-panel",children:c.jsx(Tl,{position:E,onClose:()=>O(null)})}):null,U&&k!==null?c.jsx("div",{className:"web-trading-widget-new-order-overlay web-trading-widget-new-order-overlay--news web-trading-widget-new-order-overlay--side-panel",children:c.jsx(Sl,{order:k,onClose:()=>C(null)})}):null,F&&o!==null?c.jsx("div",{className:"web-trading-widget-new-order-overlay web-trading-widget-new-order-overlay--news",children:c.jsx(vl,{confirmation:o,symbolTicker:e,onDismiss:v})}):null,H?c.jsx("div",{ref:L,style:{left:Q.x,top:Q.y},className:`web-trading-widget-new-order-overlay web-trading-widget-new-order-overlay--news web-trading-widget-new-order-overlay--draggable web-trading-widget-new-order-overlay--exec-panel${K?" web-trading-widget-new-order-overlay--dragging":""}`,children:c.jsx(iy,{symbolTicker:e,bid:(i==null?void 0:i.bid)??null,ask:(i==null?void 0:i.ask)??null,defaultVolumeLots:l,volumeStep:d,minVolumeLots:u,isSubmitting:a,isAccountsLoading:m,selectedLogin:f,isDragging:K,onDragHandlePointerDown:re,onLayoutChange:P,onClose:b,onPlaceOrder:R=>void _({symbolTicker:e,login:R.login,executionMode:R.executionMode,side:R.side,orderType:R.orderType,volumeLots:R.volumeLots,stopLoss:R.stopLoss,takeProfit:R.takeProfit,priceOrder:R.priceOrder,priceTrigger:R.priceTrigger,comment:R.comment,typeTime:R.typeTime,expirationDateTime:R.expirationDateTime,expirationDay:R.expirationDay,bid:R.bid,ask:R.ask})})}):null]})}const oy=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" aria-hidden="true">
|
|
82
42
|
<rect x="1" y="1" width="16" height="16" rx="5" fill="#3B82F6" fill-opacity="0.18" stroke="#3B82F6" stroke-width="1"/>
|
|
83
43
|
<circle cx="9" cy="6.5" r="2.5" fill="none" stroke="#3B82F6" stroke-width="1.5"/>
|
|
84
44
|
<path d="M4 14.5c0-2.8 2.2-5 5-5s5 2.2 5 5" fill="none" stroke="#3B82F6" stroke-width="1.5" stroke-linecap="round"/>
|
|
85
|
-
</svg>`,
|
|
45
|
+
</svg>`,Ll=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" aria-hidden="true">
|
|
86
46
|
<circle cx="9" cy="9" r="6.5" fill="none" stroke="currentColor" stroke-width="1.5" stroke-opacity="0.25"/>
|
|
87
47
|
<path d="M9 2.5a6.5 6.5 0 0 1 6.5 6.5" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
|
88
|
-
</svg>`,
|
|
48
|
+
</svg>`,ay=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" aria-hidden="true">
|
|
89
49
|
<path d="M4.5 9.25 7.5 12.25 13.5 6.25" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/>
|
|
90
|
-
</svg>`,ah="data-opheleo-account-dropdown",PP="148px",EP=640,kP="MT5",hu=new WeakMap,ch=new WeakMap;function Dn(e,t){return Yr(e.language??"en",t)}function AP(e){e.classList.add("apply-common-tooltip"),e.style.display="inline-flex",e.style.alignItems="center",e.style.gap="6px",e.style.padding="0 8px",e.style.height="34px",e.style.cursor="pointer",e.style.border="none",e.style.background="transparent",e.style.color="inherit",e.style.fontSize="13px",e.style.fontWeight="400",e.style.whiteSpace="nowrap"}function OP(e){const t=new Set([document,e.ownerDocument]),n=e.querySelector("iframe");return n instanceof HTMLIFrameElement&&n.contentDocument&&t.add(n.contentDocument),[...t]}function lh(e){if(!e)return!1;const t=e.querySelector("iframe");return(t instanceof HTMLIFrameElement?t.clientWidth:e.clientWidth)<EP}function NP(e){e.classList.forEach(t=>{t.includes("iconOnly")&&e.classList.remove(t)})}function RP(e,t){e.querySelectorAll("svg").forEach(n=>{n.style.display=t?"none":""})}function LP(e,t){NP(e),e.style.flexShrink="0",e.style.minWidth=t?"auto":PP,e.style.width="auto",e.style.maxWidth="none",e.style.overflow="visible",e.querySelectorAll("span, div").forEach(n=>{!(n instanceof HTMLElement)||n.querySelector("svg")||(n.style.display="",n.style.visibility="visible",n.style.opacity="1",n.style.maxWidth="none",n.style.overflow="visible",n.style.textOverflow="clip")}),RP(e,t)}function DP(e){const[t]=e.label.split(" · ");return t??e.label}function jP(e){return`${kP} ${e.login}`}function MP(e){return`${e.label} — ${e.balance.toFixed(2)} ${e.currency}`}function IP(e,t,n){const r=DP(t),i=`${t.balance.toFixed(2)} ${t.currency}`;return`${t.login} · ${r} (${i})${n?` · ${Dn(e,"WebTrading.activeAccount")}`:""}`}function Zc(e){return e.accountOptions.length===0?null:e.accountOptions.find(t=>t.login===e.selectedLogin)??e.accountOptions[0]}function dh(e){return e.isAccountsLoading||e.isAccountDataLoading}function FP(e){if(e.isAccountsLoading||e.accountOptions.length===0)return"";const t=Zc(e);return t?jP(t):""}function UP(e){if(e.isAccountsLoading)return Dn(e,"WebTrading.loadingAccounts");if(e.isAccountDataLoading)return Dn(e,"WebTrading.switchingAccount");const t=Zc(e);return t?MP(t):Dn(e,"WebTrading.selectYourTradingAccount")}function BP(e,t){if(!t)return dh(e)?oh:TP}function WP(e,t){return e.isAccountsLoading?[{title:Dn(e,"WebTrading.loadingAccounts"),onSelect:()=>{}}]:e.isAccountDataLoading?[{title:Dn(e,"WebTrading.switchingAccount"),onSelect:()=>{}}]:e.accountOptions.length===0?[{title:Dn(e,"WebTrading.noTradingAccounts"),onSelect:()=>{}}]:e.accountOptions.map(n=>{const r=n.login===e.selectedLogin;return{title:IP(e,n,r),icon:r?CP:void 0,onSelect:()=>{r||t(n.login)}}})}function $P(e){for(const t of OP(e)){const n=t.querySelector(`[${ah}="true"]`);if(n instanceof HTMLElement)return n;for(const r of t.querySelectorAll("svg")){if(!(r.querySelector('rect[rx="5"]')instanceof SVGRectElement))continue;let i=r.parentElement;for(;i&&i!==t.body;){if(i.tagName==="BUTTON"||i.getAttribute("role")==="button")return i;i=i.parentElement}}}return null}function VP(e){e.style.removeProperty("background"),e.style.removeProperty("border"),e.style.removeProperty("border-radius"),e.style.removeProperty("padding"),e.style.removeProperty("font-weight"),e.style.removeProperty("color"),e.style.removeProperty("box-shadow")}function HP(e,t,n){e.setAttribute(ah,"true"),AP(e),LP(e,n);const r=Zc(t);if(!dh(t)&&r!==null){e.style.background="rgba(59, 130, 246, 0.14)",e.style.border="1px solid rgba(59, 130, 246, 0.5)",e.style.borderRadius="6px",e.style.padding="0 10px",e.style.fontWeight="600",e.style.color="#3B82F6",e.style.boxShadow="0 0 0 1px rgba(59, 130, 246, 0.08)";return}VP(e),e.style.border="1px solid transparent",e.style.borderRadius="6px",e.style.padding="0 10px"}function zP(e,t){if(!(e!=null&&e.isConnected))return;const n=lh(e),r=()=>{const i=$P(e);i&&HP(i,t,n)};r(),requestAnimationFrame(r)}function KP(e){if(hu.has(e))return;const t=new ResizeObserver(()=>{const r=ch.get(e);r&&uh(r.dropdown,r.state,r.onLoginChange,e)});t.observe(e);const n=e.querySelector("iframe");n instanceof HTMLIFrameElement&&t.observe(n),hu.set(e,t)}function uh(e,t,n,r){const i=lh(r);try{e.applyOptions({title:FP(t),tooltip:UP(t),icon:BP(t,i),items:WP(t,n)})}catch{return}zP(r,t)}async function GP(e,t=()=>!0,n="en"){try{await e.headerReady()}catch{return null}if(!t())return null;try{return await e.createDropdown({title:"",tooltip:Yr(n,"WebTrading.selectYourTradingAccount"),align:"left",icon:oh,items:[{title:Yr(n,"WebTrading.loadingAccounts"),onSelect:()=>{}}]})}catch{return null}}function gu(e,t,n,r){!e||(r==null?void 0:r.isConnected)===!1||(r&&(ch.set(r,{dropdown:e,state:t,onLoginChange:n}),KP(r)),uh(e,t,n,r??null))}var Xc="ToastProvider",[Jc,qP,QP]=Za("Toast"),[fh]=$n("Toast",[QP]),[YP,ao]=fh(Xc),ph=e=>{const{__scopeToast:t,label:n="Notification",duration:r=5e3,swipeDirection:i="right",swipeThreshold:s=50,announcerContainer:o,children:a}=e,[l,d]=w.useState(null),[u,f]=w.useState(0),m=w.useRef(!1),p=w.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${Xc}\`. Expected non-empty \`string\`.`),c.jsx(Jc.Provider,{scope:t,children:c.jsx(YP,{scope:t,label:n,duration:r,swipeDirection:i,swipeThreshold:s,toastCount:u,viewport:l,onViewportChange:d,onToastAdd:w.useCallback(()=>f(b=>b+1),[]),onToastRemove:w.useCallback(()=>f(b=>b-1),[]),isFocusedToastEscapeKeyDownRef:m,isClosePausedRef:p,announcerContainer:o,children:a})})};ph.displayName=Xc;var mh="ToastViewport",ZP=["F8"],Ia="toast.viewportPause",Fa="toast.viewportResume",hh=w.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=ZP,label:i="Notifications ({hotkey})",...s}=e,o=ao(mh,n),a=qP(n),l=w.useRef(null),d=w.useRef(null),u=w.useRef(null),f=w.useRef(null),m=Ne(t,f,o.onViewportChange),p=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),b=o.toastCount>0;w.useEffect(()=>{const g=y=>{var _;r.length!==0&&r.every(x=>y[x]||y.code===x)&&((_=f.current)==null||_.focus())};return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[r]),w.useEffect(()=>{const g=l.current,y=f.current;if(b&&g&&y){const v=()=>{if(!o.isClosePausedRef.current){const C=new CustomEvent(Ia);y.dispatchEvent(C),o.isClosePausedRef.current=!0}},_=()=>{if(o.isClosePausedRef.current){const C=new CustomEvent(Fa);y.dispatchEvent(C),o.isClosePausedRef.current=!1}},x=C=>{!g.contains(C.relatedTarget)&&_()},T=()=>{g.contains(document.activeElement)||_()};return g.addEventListener("focusin",v),g.addEventListener("focusout",x),g.addEventListener("pointermove",v),g.addEventListener("pointerleave",T),window.addEventListener("blur",v),window.addEventListener("focus",_),()=>{g.removeEventListener("focusin",v),g.removeEventListener("focusout",x),g.removeEventListener("pointermove",v),g.removeEventListener("pointerleave",T),window.removeEventListener("blur",v),window.removeEventListener("focus",_)}}},[b,o.isClosePausedRef]);const h=w.useCallback(({tabbingDirection:g})=>{const v=a().map(_=>{const x=_.ref.current,T=[x,...dE(x)];return g==="forwards"?T:T.reverse()});return(g==="forwards"?v.reverse():v).flat()},[a]);return w.useEffect(()=>{const g=f.current;if(g){const y=v=>{var T,C,O;const _=v.altKey||v.ctrlKey||v.metaKey;if(v.key==="Tab"&&!_){const P=document.activeElement,L=v.shiftKey;if(v.target===g&&L){(T=d.current)==null||T.focus();return}const N=h({tabbingDirection:L?"backwards":"forwards"}),V=N.findIndex(M=>M===P);Bo(N.slice(V+1))?v.preventDefault():L?(C=d.current)==null||C.focus():(O=u.current)==null||O.focus()}};return g.addEventListener("keydown",y),()=>g.removeEventListener("keydown",y)}},[a,h]),c.jsxs(uy,{ref:l,role:"region","aria-label":i.replace("{hotkey}",p),tabIndex:-1,style:{pointerEvents:b?void 0:"none"},children:[b&&c.jsx(Ua,{ref:d,onFocusFromOutsideViewport:()=>{const g=h({tabbingDirection:"forwards"});Bo(g)}}),c.jsx(Jc.Slot,{scope:n,children:c.jsx(ge.ol,{tabIndex:-1,...s,ref:m})}),b&&c.jsx(Ua,{ref:u,onFocusFromOutsideViewport:()=>{const g=h({tabbingDirection:"backwards"});Bo(g)}})]})});hh.displayName=mh;var gh="ToastFocusProxy",Ua=w.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...i}=e,s=ao(gh,n);return c.jsx(ac,{tabIndex:0,...i,ref:t,style:{position:"fixed"},onFocus:o=>{var d;const a=o.relatedTarget;!((d=s.viewport)!=null&&d.contains(a))&&r()}})});Ua.displayName=gh;var Ci="Toast",XP="toast.swipeStart",JP="toast.swipeMove",eE="toast.swipeCancel",tE="toast.swipeEnd",yh=w.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:i,onOpenChange:s,...o}=e,[a,l]=jn({prop:r,defaultProp:i??!0,onChange:s,caller:Ci});return c.jsx(Vn,{present:n||a,children:c.jsx(iE,{open:a,...o,ref:t,onClose:()=>l(!1),onPause:yt(e.onPause),onResume:yt(e.onResume),onSwipeStart:he(e.onSwipeStart,d=>{d.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:he(e.onSwipeMove,d=>{const{x:u,y:f}=d.detail.delta;d.currentTarget.setAttribute("data-swipe","move"),d.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${u}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${f}px`)}),onSwipeCancel:he(e.onSwipeCancel,d=>{d.currentTarget.setAttribute("data-swipe","cancel"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),d.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:he(e.onSwipeEnd,d=>{const{x:u,y:f}=d.detail.delta;d.currentTarget.setAttribute("data-swipe","end"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),d.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${u}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${f}px`),l(!1)})})})});yh.displayName=Ci;var[nE,rE]=fh(Ci,{onClose(){}}),iE=w.forwardRef((e,t)=>{const{__scopeToast:n,type:r="foreground",duration:i,open:s,onClose:o,onEscapeKeyDown:a,onPause:l,onResume:d,onSwipeStart:u,onSwipeMove:f,onSwipeCancel:m,onSwipeEnd:p,...b}=e,h=ao(Ci,n),[g,y]=w.useState(null),v=Ne(t,M=>y(M)),_=w.useRef(null),x=w.useRef(null),T=i||h.duration,C=w.useRef(0),O=w.useRef(T),P=w.useRef(0),{onToastAdd:L,onToastRemove:I}=h,U=yt(()=>{var z;(g==null?void 0:g.contains(document.activeElement))&&((z=h.viewport)==null||z.focus()),o()}),N=w.useCallback(M=>{!M||M===1/0||(window.clearTimeout(P.current),C.current=new Date().getTime(),P.current=window.setTimeout(U,M))},[U]);w.useEffect(()=>{const M=h.viewport;if(M){const z=()=>{N(O.current),d==null||d()},k=()=>{const j=new Date().getTime()-C.current;O.current=O.current-j,window.clearTimeout(P.current),l==null||l()};return M.addEventListener(Ia,k),M.addEventListener(Fa,z),()=>{M.removeEventListener(Ia,k),M.removeEventListener(Fa,z)}}},[h.viewport,T,l,d,N]),w.useEffect(()=>{s&&!h.isClosePausedRef.current&&N(T)},[s,T,h.isClosePausedRef,N]),w.useEffect(()=>(L(),()=>I()),[L,I]);const V=w.useMemo(()=>g?Th(g):null,[g]);return h.viewport?c.jsxs(c.Fragment,{children:[V&&c.jsx(sE,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:V}),c.jsx(nE,{scope:n,onClose:U,children:Er.createPortal(c.jsx(Jc.ItemSlot,{scope:n,children:c.jsx(dy,{asChild:!0,onEscapeKeyDown:he(a,()=>{h.isFocusedToastEscapeKeyDownRef.current||U(),h.isFocusedToastEscapeKeyDownRef.current=!1}),children:c.jsx(ge.li,{tabIndex:0,"data-state":s?"open":"closed","data-swipe-direction":h.swipeDirection,...b,ref:v,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:he(e.onKeyDown,M=>{M.key==="Escape"&&(a==null||a(M.nativeEvent),M.nativeEvent.defaultPrevented||(h.isFocusedToastEscapeKeyDownRef.current=!0,U()))}),onPointerDown:he(e.onPointerDown,M=>{M.button===0&&(_.current={x:M.clientX,y:M.clientY})}),onPointerMove:he(e.onPointerMove,M=>{if(!_.current)return;const z=M.clientX-_.current.x,k=M.clientY-_.current.y,j=!!x.current,D=["left","right"].includes(h.swipeDirection),R=["left","up"].includes(h.swipeDirection)?Math.min:Math.max,W=D?R(0,z):0,F=D?0:R(0,k),G=M.pointerType==="touch"?10:2,X={x:W,y:F},de={originalEvent:M,delta:X};j?(x.current=X,Gi(JP,f,de,{discrete:!1})):yu(X,h.swipeDirection,G)?(x.current=X,Gi(XP,u,de,{discrete:!1}),M.target.setPointerCapture(M.pointerId)):(Math.abs(z)>G||Math.abs(k)>G)&&(_.current=null)}),onPointerUp:he(e.onPointerUp,M=>{const z=x.current,k=M.target;if(k.hasPointerCapture(M.pointerId)&&k.releasePointerCapture(M.pointerId),x.current=null,_.current=null,z){const j=M.currentTarget,D={originalEvent:M,delta:z};yu(z,h.swipeDirection,h.swipeThreshold)?Gi(tE,p,D,{discrete:!0}):Gi(eE,m,D,{discrete:!0}),j.addEventListener("click",R=>R.preventDefault(),{once:!0})}})})})}),h.viewport)})]}):null}),sE=e=>{const{__scopeToast:t,children:n,...r}=e,i=ao(Ci,t),[s,o]=w.useState(!1),[a,l]=w.useState(!1);return cE(()=>o(!0)),w.useEffect(()=>{const d=window.setTimeout(()=>l(!0),1e3);return()=>window.clearTimeout(d)},[]),a?null:c.jsx(Ls,{asChild:!0,container:i.announcerContainer||void 0,children:c.jsx(ac,{...r,children:s&&c.jsxs(c.Fragment,{children:[i.label," ",n]})})})},oE="ToastTitle",bh=w.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return c.jsx(ge.div,{...r,ref:t})});bh.displayName=oE;var aE="ToastDescription",vh=w.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return c.jsx(ge.div,{...r,ref:t})});vh.displayName=aE;var wh="ToastAction",xh=w.forwardRef((e,t)=>{const{altText:n,...r}=e;return n.trim()?c.jsx(Sh,{altText:n,asChild:!0,children:c.jsx(el,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${wh}\`. Expected non-empty \`string\`.`),null)});xh.displayName=wh;var _h="ToastClose",el=w.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,i=rE(_h,n);return c.jsx(Sh,{asChild:!0,children:c.jsx(ge.button,{type:"button",...r,ref:t,onClick:he(e.onClick,i.onClose)})})});el.displayName=_h;var Sh=w.forwardRef((e,t)=>{const{__scopeToast:n,altText:r,...i}=e;return c.jsx(ge.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...i,ref:t})});function Th(e){const t=[];return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),lE(r)){const i=r.ariaHidden||r.hidden||r.style.display==="none",s=r.dataset.radixToastAnnounceExclude==="";if(!i)if(s){const o=r.dataset.radixToastAnnounceAlt;o&&t.push(o)}else t.push(...Th(r))}}),t}function Gi(e,t,n,{discrete:r}){const i=n.originalEvent.currentTarget,s=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?Uu(i,s):i.dispatchEvent(s)}var yu=(e,t,n=0)=>{const r=Math.abs(e.x),i=Math.abs(e.y),s=r>i;return t==="left"||t==="right"?s&&r>n:!s&&i>n};function cE(e=()=>{}){const t=yt(e);Ie(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}function lE(e){return e.nodeType===e.ELEMENT_NODE}function dE(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Bo(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var uE=ph,Ch=hh,Ph=yh,Eh=bh,kh=vh,Ah=xh,co=el;const fE=uE,Oh=w.forwardRef(({className:e,...t},n)=>c.jsx(Ch,{ref:n,className:Ae("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse gap-2 p-4 sm:right-0 sm:top-[66px] sm:flex-col md:w-[520px]",e),...t}));Oh.displayName=Ch.displayName;const pE=Ba("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground",warning:"bg-yellow-600 group border-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),Nh=w.forwardRef(({className:e,variant:t,...n},r)=>c.jsx(Ph,{ref:r,className:Ae(pE({variant:t}),e),...n}));Nh.displayName=Ph.displayName;const mE=w.forwardRef(({className:e,...t},n)=>c.jsx(Ah,{ref:n,className:Ae("group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",e),...t}));mE.displayName=Ah.displayName;const Rh=w.forwardRef(({className:e,...t},n)=>c.jsx(co,{ref:n,className:Ae("text-foreground/50 rounded-md p-1 opacity-100 transition-opacity focus:opacity-100 focus:outline-none focus:ring-1",e),onClick:r=>{r.stopPropagation()},"toast-close":"",...t,children:c.jsx(mw,{className:"h-4 min-h-4 w-4 min-w-4 text-black dark:text-white"})}));Rh.displayName=co.displayName;const hE=w.forwardRef(({className:e,children:t,...n},r)=>c.jsx(co,{ref:r,className:Ae("text-foreground/50 rounded-md p-1 opacity-100 transition-opacity focus:opacity-100 focus:outline-none focus:ring-1",e),onClick:i=>{i.stopPropagation()},"toast-close":"",...n,children:t}));hE.displayName=co.displayName;const Lh=w.forwardRef(({className:e,...t},n)=>c.jsx(Eh,{ref:n,className:Ae("text-sm font-semibold [&+div]:text-base",e),...t}));Lh.displayName=Eh.displayName;const Dh=w.forwardRef(({className:e,...t},n)=>c.jsx(kh,{ref:n,className:Ae("text-lg opacity-90 ",e),...t}));Dh.displayName=kh.displayName;function gE(){const{toasts:e}=LC();return c.jsxs(fE,{children:[e.map(({id:t,title:n,description:r,action:i,...s})=>c.jsxs(Nh,{...s,children:[c.jsxs("div",{className:"grid gap-1",children:[n?c.jsx(Lh,{children:n}):null,r?c.jsx(Dh,{children:r}):null]}),i,c.jsx(Rh,{})]},t)),c.jsx(Oh,{})]})}function yE(){const e=vP();return c.jsx(bP,{...e})}function bE({children:e,variant:t="chart",scanResultUrl:n,onScanResultUrlChange:r,onScanResultLoad:i,chartWidget:s,backUrl:o,createAccountUrl:a,dealDetailUrl:l}){const{language:d}=Le(),u=s!==void 0,f=Ti(),m=v0({symbols:f,defaultPanelAfterConfirm:t==="news"?"market":"mini"}),p=S.useRef(null),b=S.useRef(null),[h,g]=S.useState(null),y=S.useCallback(Q=>{g(Q)},[]),[v,_]=S.useState(null),[x,T]=S.useState(null),C=u?s??null:v,[O,P]=S.useState(()=>Cs(f)),[L,I]=S.useState(n??null),[U,N]=S.useState(()=>n?"scan":"trade"),V=S.useRef(null);S.useEffect(()=>{I(n??null)},[n]),S.useEffect(()=>{N(L?"scan":"trade")},[L]);const M=S.useCallback(()=>{var Q;N("trade"),(Q=p.current)==null||Q.open()},[]),{isLoading:z}=Pm(m.selectedLogin,m.hasConfirmedAccount),k=S.useRef(null),[j,D]=S.useState(m.selectedLogin),R=S.useCallback(Q=>{Q!==m.selectedLogin&&m.setSelectedLogin(Q)},[m.selectedLogin,m.setSelectedLogin]),W=z&&m.selectedLogin!==j,F=S.useCallback(Q=>{P(Q)},[]),G=S.useCallback(Q=>{I(Q),r==null||r(Q)},[r]),{chartContainer:X}=w0({chartWidget:u?C:null,symbols:f,chartSlotElement:u?h:null,onSymbolTickerChange:F,onScanResultUrlChange:G,selectSymbolTickerRef:b}),de=u?X:x,ne=S.useCallback(Q=>{var ye;(ye=b.current)==null||ye.call(b,Q)},[]),B=S.useMemo(()=>({controlsRef:p,onSymbolTickerChange:F,onScanResultUrlChange:G,onChartWidgetChange:u?()=>{}:_,onChartContainerChange:u?()=>{}:T,selectSymbolTickerRef:b}),[G,F,u]);S.useEffect(()=>{if(t!=="news"){p.current=null;return}return p.current={open:m.openMarketPanel,setSelectedLogin:m.setSelectedLogin},()=>{p.current=null}},[m.openMarketPanel,m.setSelectedLogin,t]),S.useEffect(()=>{!z&&m.selectedLogin!==j&&D(m.selectedLogin)},[z,j,m.selectedLogin]),S.useEffect(()=>{var ce;if(!C||!m.hasConfirmedAccount){(ce=k.current)==null||ce.remove(),k.current=null;return}let Q=!1;return(async()=>{try{const ee=await GP(C,()=>!Q,d);if(Q){ee==null||ee.remove();return}k.current=ee,gu(k.current,{accountOptions:m.accountOptions,selectedLogin:m.selectedLogin,isAccountsLoading:m.isAccountsLoading,isAccountDataLoading:W,language:d},R,de)}catch{}})(),()=>{var ee;Q=!0,(ee=k.current)==null||ee.remove(),k.current=null}},[de,C,d,m.hasConfirmedAccount]),S.useEffect(()=>{m.hasConfirmedAccount&&gu(k.current,{accountOptions:m.accountOptions,selectedLogin:m.selectedLogin,isAccountsLoading:m.isAccountsLoading,isAccountDataLoading:W,language:d},R,de)},[de,R,W,d,m.accountOptions,m.hasConfirmedAccount,m.isAccountsLoading,m.selectedLogin]);const $=e??(u?null:c.jsx(yE,{}));return t==="news"?c.jsx(mu,{value:B,children:c.jsxs("div",{ref:V,className:"web-trading-widget-trading-layout web-trading-widget-trading-layout--news",children:[c.jsxs("div",{className:"web-trading-widget-trading-layout__chart-slot",children:[c.jsx(rm,{}),c.jsx(up,{open:m.needsAccountSelection,isAccountsLoading:m.isAccountsLoading,accountOptions:m.accountOptions,onConfirm:m.confirmAccountSelection,backUrl:o,createAccountUrl:a}),c.jsxs("div",{className:"web-trading-widget-trading-layout__news-body",children:[u?c.jsx("div",{ref:y,className:"web-trading-widget-trading-layout__host-chart-slot",children:$}):$,c.jsx(SP,{symbolTicker:O,chartWidget:C,orderState:m})]})]}),c.jsx(Nm,{containerRef:V,onCreateNewOrder:()=>{var Q;return(Q=p.current)==null?void 0:Q.open()},tradeDataEnabled:m.hasConfirmedAccount})]})}):c.jsx(mu,{value:B,children:c.jsxs("div",{className:"web-trading-widget-trading-layout",children:[c.jsxs("div",{className:"web-trading-widget-trading-layout__body",children:[c.jsxs("div",{className:"web-trading-widget-trading-layout__chart-area",children:[c.jsx(cC,{controlsRef:p,symbolTicker:O,chartWidget:C,sidePanelTab:U,orderState:m,backUrl:o,createAccountUrl:a}),c.jsx("div",{ref:u?y:void 0,className:"web-trading-widget-trading-layout__chart-slot",children:$})]}),c.jsx(g0,{symbolTicker:O,orderState:m,scanResultUrl:L,activeTab:U,onTabChange:N,onScanResultLoad:i})]}),c.jsx(Am,{symbolTicker:O,onSymbolChange:ne,onCreateNewOrder:M,dealDetailUrl:l,tradeDataEnabled:m.hasConfirmedAccount})]})})}function vE({baseUrl:e,token:t,language:n,variant:r="chart",scanResultUrl:i,onScanResultLoad:s,onScanResultUrlChange:o,children:a,chartWidget:l,backUrl:d,createAccountUrl:u,dealDetailUrl:f}){const m=S.useMemo(()=>Ns(n),[n]);return c.jsx(Ou,{language:m,children:c.jsx("div",{className:"web-trading-widget-root",children:c.jsx(NT,{token:t,children:c.jsx(Om,{children:c.jsxs(tm,{baseUrl:e,children:[c.jsx(bE,{variant:r,scanResultUrl:i,onScanResultUrlChange:o,chartWidget:l,onScanResultLoad:s,backUrl:d,createAccountUrl:u,dealDetailUrl:f,children:a}),c.jsx(gE,{})]})})})})})}exports.ChartNewsOrdersOverlay=KC;exports.WebTradingWidget=vE;exports.normalizeWidgetLanguage=Ns;exports.toTradingViewLocale=Vh;
|
|
50
|
+
</svg>`,Nl="data-opheleo-account-dropdown",cy="148px",ly=640,dy="MT5",Ia=new WeakMap,Dl=new WeakMap;function nn(e,t){return Gn(e.language??"en",t)}function uy(e){e.classList.add("apply-common-tooltip"),e.style.display="inline-flex",e.style.alignItems="center",e.style.gap="6px",e.style.padding="0 8px",e.style.height="34px",e.style.cursor="pointer",e.style.border="none",e.style.background="transparent",e.style.color="inherit",e.style.fontSize="13px",e.style.fontWeight="400",e.style.whiteSpace="nowrap"}function fy(e){const t=new Set([document,e.ownerDocument]),n=e.querySelector("iframe");return n instanceof HTMLIFrameElement&&n.contentDocument&&t.add(n.contentDocument),[...t]}function Rl(e){if(!e)return!1;const t=e.querySelector("iframe");return(t instanceof HTMLIFrameElement?t.clientWidth:e.clientWidth)<ly}function hy(e){e.classList.forEach(t=>{t.includes("iconOnly")&&e.classList.remove(t)})}function my(e,t){e.querySelectorAll("svg").forEach(n=>{n.style.display=t?"none":""})}function py(e,t){hy(e),e.style.flexShrink="0",e.style.minWidth=t?"auto":cy,e.style.width="auto",e.style.maxWidth="none",e.style.overflow="visible",e.querySelectorAll("span, div").forEach(n=>{!(n instanceof HTMLElement)||n.querySelector("svg")||(n.style.display="",n.style.visibility="visible",n.style.opacity="1",n.style.maxWidth="none",n.style.overflow="visible",n.style.textOverflow="clip")}),my(e,t)}function gy(e){const[t]=e.label.split(" · ");return t??e.label}function yy(e){return`${dy} ${e.login}`}function by(e){return`${e.label} — ${e.balance.toFixed(2)} ${e.currency}`}function _y(e,t,n){const r=gy(t),i=`${t.balance.toFixed(2)} ${t.currency}`;return`${t.login} · ${r} (${i})${n?` · ${nn(e,"WebTrading.activeAccount")}`:""}`}function eo(e){return e.accountOptions.length===0?null:e.accountOptions.find(t=>t.login===e.selectedLogin)??e.accountOptions[0]}function jl(e){return e.isAccountsLoading||e.isAccountDataLoading}function wy(e){if(e.isAccountsLoading||e.accountOptions.length===0)return"";const t=eo(e);return t?yy(t):""}function vy(e){if(e.isAccountsLoading)return nn(e,"WebTrading.loadingAccounts");if(e.isAccountDataLoading)return nn(e,"WebTrading.switchingAccount");const t=eo(e);return t?by(t):nn(e,"WebTrading.selectYourTradingAccount")}function Sy(e,t){if(!t)return jl(e)?Ll:oy}function Ty(e,t){return e.isAccountsLoading?[{title:nn(e,"WebTrading.loadingAccounts"),onSelect:()=>{}}]:e.isAccountDataLoading?[{title:nn(e,"WebTrading.switchingAccount"),onSelect:()=>{}}]:e.accountOptions.length===0?[{title:nn(e,"WebTrading.noTradingAccounts"),onSelect:()=>{}}]:e.accountOptions.map(n=>{const r=n.login===e.selectedLogin;return{title:_y(e,n,r),icon:r?ay:void 0,onSelect:()=>{r||t(n.login)}}})}function xy(e){for(const t of fy(e)){const n=t.querySelector(`[${Nl}="true"]`);if(n instanceof HTMLElement)return n;for(const r of t.querySelectorAll("svg")){if(!(r.querySelector('rect[rx="5"]')instanceof SVGRectElement))continue;let i=r.parentElement;for(;i&&i!==t.body;){if(i.tagName==="BUTTON"||i.getAttribute("role")==="button")return i;i=i.parentElement}}}return null}function ky(e){e.style.removeProperty("background"),e.style.removeProperty("border"),e.style.removeProperty("border-radius"),e.style.removeProperty("padding"),e.style.removeProperty("font-weight"),e.style.removeProperty("color"),e.style.removeProperty("box-shadow")}function Py(e,t,n){e.setAttribute(Nl,"true"),uy(e),py(e,n);const r=eo(t);if(!jl(t)&&r!==null){e.style.background="rgba(59, 130, 246, 0.14)",e.style.border="1px solid rgba(59, 130, 246, 0.5)",e.style.borderRadius="6px",e.style.padding="0 10px",e.style.fontWeight="600",e.style.color="#3B82F6",e.style.boxShadow="0 0 0 1px rgba(59, 130, 246, 0.08)";return}ky(e),e.style.border="1px solid transparent",e.style.borderRadius="6px",e.style.padding="0 10px"}function Cy(e,t){if(!(e!=null&&e.isConnected))return;const n=Rl(e),r=()=>{const i=xy(e);i&&Py(i,t,n)};r(),requestAnimationFrame(r)}function Oy(e){if(Ia.has(e))return;const t=new ResizeObserver(()=>{const r=Dl.get(e);r&&Ml(r.dropdown,r.state,r.onLoginChange,e)});t.observe(e);const n=e.querySelector("iframe");n instanceof HTMLIFrameElement&&t.observe(n),Ia.set(e,t)}function Ml(e,t,n,r){const i=Rl(r);try{e.applyOptions({title:wy(t),tooltip:vy(t),icon:Sy(t,i),items:Ty(t,n)})}catch{return}Cy(r,t)}async function Ey(e,t=()=>!0,n="en"){try{await e.headerReady()}catch{return null}if(!t())return null;try{return await e.createDropdown({title:"",tooltip:Gn(n,"WebTrading.selectYourTradingAccount"),align:"left",icon:Ll,items:[{title:Gn(n,"WebTrading.loadingAccounts"),onSelect:()=>{}}]})}catch{return null}}function Fa(e,t,n,r){!e||(r==null?void 0:r.isConnected)===!1||(r&&(Dl.set(r,{dropdown:e,state:t,onLoginChange:n}),Oy(r)),Ml(e,t,n,r??null))}function Ay(){const{toasts:e}=Ep();return c.jsx("div",{className:"web-trading-widget-toast-viewport","aria-live":"polite","aria-relevant":"additions",children:e.map(({id:t,title:n,description:r,variant:i,open:s})=>s?c.jsxs("div",{className:ht("web-trading-widget-toast",i==="destructive"&&"web-trading-widget-toast--destructive"),role:"status",children:[n?c.jsx("p",{className:"web-trading-widget-toast__title",children:n}):null,r?c.jsx("p",{className:"web-trading-widget-toast__description",children:r}):null]},t):null)})}function Ly(){const e=ty();return c.jsx(ey,{...e})}function Ny({children:e,variant:t="chart",scanResultUrl:n,onScanResultUrlChange:r,onScanResultLoad:i,chartWidget:s,backUrl:o,createAccountUrl:a,dealDetailUrl:l}){const{language:d}=Te(),u=s!==void 0,f=yr(),m=Yp({symbols:f,defaultPanelAfterConfirm:t==="news"?"market":"mini"}),h=p.useRef(null),b=p.useRef(null),[v,_]=p.useState(null),g=p.useCallback(te=>{_(te)},[]),[T,x]=p.useState(null),[y,O]=p.useState(null),C=u?s??null:T,[E,k]=p.useState(()=>Yr(f)),[U,F]=p.useState(n??null),[H,L]=p.useState(()=>n?"scan":"trade"),Q=p.useRef(null);p.useEffect(()=>{F(n??null)},[n]),p.useEffect(()=>{L(U?"scan":"trade")},[U]);const K=p.useCallback(()=>{var te;L("trade"),(te=h.current)==null||te.open()},[]),{isLoading:re}=ml(m.selectedLogin,m.hasConfirmedAccount),P=p.useRef(null),[D,j]=p.useState(m.selectedLogin),A=p.useCallback(te=>{te!==m.selectedLogin&&m.setSelectedLogin(te)},[m.selectedLogin,m.setSelectedLogin]),W=re&&m.selectedLogin!==D,R=p.useCallback(te=>{k(te)},[]),G=p.useCallback(te=>{F(te),r==null||r(te)},[r]),{chartContainer:ae}=Jp({chartWidget:u?C:null,symbols:f,chartSlotElement:u?v:null,onSymbolTickerChange:R,onScanResultUrlChange:G,selectSymbolTickerRef:b}),ce=u?ae:y,ie=p.useCallback(te=>{var ve;(ve=b.current)==null||ve.call(b,te)},[]),N=p.useMemo(()=>({controlsRef:h,onSymbolTickerChange:R,onScanResultUrlChange:G,onChartWidgetChange:u?()=>{}:x,onChartContainerChange:u?()=>{}:O,selectSymbolTickerRef:b}),[G,R,u]);p.useEffect(()=>{if(t!=="news"){h.current=null;return}return h.current={open:m.openMarketPanel,setSelectedLogin:m.setSelectedLogin},()=>{h.current=null}},[m.openMarketPanel,m.setSelectedLogin,t]),p.useEffect(()=>{!re&&m.selectedLogin!==D&&j(m.selectedLogin)},[re,D,m.selectedLogin]),p.useEffect(()=>{var Re;if(!C||!m.hasConfirmedAccount){(Re=P.current)==null||Re.remove(),P.current=null;return}let te=!1;return(async()=>{try{const be=await Ey(C,()=>!te,d);if(te){be==null||be.remove();return}P.current=be,Fa(P.current,{accountOptions:m.accountOptions,selectedLogin:m.selectedLogin,isAccountsLoading:m.isAccountsLoading,isAccountDataLoading:W,language:d},A,ce)}catch{}})(),()=>{var be;te=!0,(be=P.current)==null||be.remove(),P.current=null}},[ce,C,d,m.hasConfirmedAccount]),p.useEffect(()=>{m.hasConfirmedAccount&&Fa(P.current,{accountOptions:m.accountOptions,selectedLogin:m.selectedLogin,isAccountsLoading:m.isAccountsLoading,isAccountDataLoading:W,language:d},A,ce)},[ce,A,W,d,m.accountOptions,m.hasConfirmedAccount,m.isAccountsLoading,m.selectedLogin]);const Z=e??(u?null:c.jsx(Ly,{}));return t==="news"?c.jsx(Ua,{value:N,children:c.jsxs("div",{ref:Q,className:"web-trading-widget-trading-layout web-trading-widget-trading-layout--news",children:[c.jsxs("div",{className:"web-trading-widget-trading-layout__chart-slot",children:[c.jsx(zc,{}),c.jsx(Ja,{open:m.needsAccountSelection,isAccountsLoading:m.isAccountsLoading,accountOptions:m.accountOptions,onConfirm:m.confirmAccountSelection,backUrl:o,createAccountUrl:a}),c.jsxs("div",{className:"web-trading-widget-trading-layout__news-body",children:[u?c.jsx("div",{ref:g,className:"web-trading-widget-trading-layout__host-chart-slot",children:Z}):Z,c.jsx(sy,{symbolTicker:E,chartWidget:C,orderState:m})]})]}),c.jsx(wl,{containerRef:Q,onCreateNewOrder:()=>{var te;return(te=h.current)==null?void 0:te.open()},tradeDataEnabled:m.hasConfirmedAccount})]})}):c.jsx(Ua,{value:N,children:c.jsxs("div",{className:"web-trading-widget-trading-layout",children:[c.jsxs("div",{className:"web-trading-widget-trading-layout__body",children:[c.jsxs("div",{className:"web-trading-widget-trading-layout__chart-area",children:[c.jsx(sp,{controlsRef:h,symbolTicker:E,chartWidget:C,sidePanelTab:H,orderState:m,backUrl:o,createAccountUrl:a}),c.jsx("div",{ref:u?g:void 0,className:"web-trading-widget-trading-layout__chart-slot",children:Z})]}),c.jsx(Gp,{symbolTicker:E,orderState:m,scanResultUrl:U,activeTab:H,onTabChange:L,onScanResultLoad:i})]}),c.jsx(bl,{symbolTicker:E,onSymbolChange:ie,onCreateNewOrder:K,dealDetailUrl:l,tradeDataEnabled:m.hasConfirmedAccount})]})})}function Dy({baseUrl:e,token:t,language:n,variant:r="chart",scanResultUrl:i,onScanResultLoad:s,onScanResultUrlChange:o,children:a,chartWidget:l,backUrl:d,createAccountUrl:u,dealDetailUrl:f}){const m=p.useMemo(()=>ri(n),[n]);return c.jsx(Ya,{language:m,children:c.jsx("div",{className:"web-trading-widget-root",children:c.jsx(Om,{token:t,children:c.jsx(_l,{children:c.jsxs(Vc,{baseUrl:e,children:[c.jsx(Ny,{variant:r,scanResultUrl:i,onScanResultUrlChange:o,chartWidget:l,onScanResultLoad:s,backUrl:d,createAccountUrl:u,dealDetailUrl:f,children:a}),c.jsx(Ay,{})]})})})})})}exports.ChartNewsOrdersOverlay=$p;exports.WebTradingWidget=Dy;exports.normalizeWidgetLanguage=ri;exports.toTradingViewLocale=$l;
|