@iccandle/widget-web-trading 0.1.5 → 0.1.6
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 +17 -17
- package/dist/web-trading-widget.js +5101 -5039
- package/package.json +8 -8
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";var _h=Object.defineProperty;var Hc=e=>{throw TypeError(e)};var xh=(e,t,n)=>t in e?_h(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var it=(e,t,n)=>xh(e,typeof t!="symbol"?t+"":t,n),eo=(e,t,n)=>t.has(e)||Hc("Cannot "+n);var T=(e,t,n)=>(eo(e,t,"read from private field"),n?n.call(e):t.get(e)),ne=(e,t,n)=>t.has(e)?Hc("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),q=(e,t,n,r)=>(eo(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),ye=(e,t,n)=>(eo(e,t,"access private method"),n);var ws=(e,t,n,r)=>({set _(s){q(e,t,s,n)},get _(){return T(e,t,r)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),S=require("react"),Sh=require("react-dom");function fu(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=fu(S),Cr=fu(Sh);function zc(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Ch(...e){return t=>{let n=!1;const r=e.map(s=>{const i=zc(s,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let s=0;s<r.length;s++){const i=r[s];typeof i=="function"?i():zc(e[s],null)}}}}function Oe(...e){return w.useCallback(Ch(...e),e)}function mr(e){const t=w.forwardRef((n,r)=>{let{children:s,...i}=n,o=null,a=!1;const l=[];Wc(s)&&typeof _s=="function"&&(s=_s(s._payload)),w.Children.forEach(s,y=>{var p;if(Oh(y)){a=!0;const g=y;let m="child"in g.props?g.props.child:g.props.children;Wc(m)&&typeof _s=="function"&&(m=_s(m._payload)),o=Ph(g,m),l.push((p=o==null?void 0:o.props)==null?void 0:p.children)}else l.push(y)}),o?o=w.cloneElement(o,void 0,l):!a&&w.Children.count(s)===1&&w.isValidElement(s)&&(o=s);const d=o?Ah(o):void 0,f=Oe(r,d);if(!o){if(s||s===0)throw new Error(a?Dh(e):Lh(e));return s}const u=kh(i,o.props??{});return o.type!==w.Fragment&&(u.ref=r?f:d),w.cloneElement(o,u)});return t.displayName=`${e}.Slot`,t}var Th=mr("Slot"),Eh=Symbol.for("radix.slottable"),Ph=(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 kh(e,t){const n={...t};for(const r in t){const s=e[r],i=t[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...a)=>{const l=i(...a);return s(...a),l}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...e,...n}}function Ah(e){var r,s;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=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Oh(e){return w.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Eh}var Nh=Symbol.for("react.lazy");function Wc(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Nh&&"_payload"in e&&Rh(e._payload)}function Rh(e){return typeof e=="object"&&e!==null&&"then"in e}var Lh=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,Dh=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,_s=w[" use ".trim().toString()];function mu(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=mu(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function pu(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=mu(e))&&(r&&(r+=" "),r+=t);return r}const Kc=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,qc=pu,Pa=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return qc(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:i}=t,o=Object.keys(s).map(d=>{const f=n==null?void 0:n[d],u=i==null?void 0:i[d];if(f===null)return null;const y=Kc(f)||Kc(u);return s[d][y]}),a=n&&Object.entries(n).reduce((d,f)=>{let[u,y]=f;return y===void 0||(d[u]=y),d},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((d,f)=>{let{class:u,className:y,...p}=f;return Object.entries(p).every(g=>{let[m,h]=g;return Array.isArray(h)?h.includes({...i,...a}[m]):{...i,...a}[m]===h})?[...d,u,y]:d},[]);return qc(e,o,l,n==null?void 0:n.class,n==null?void 0:n.className)},Bt=[{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"}],jh={[-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 Ih(){const e=-new Date().getTimezoneOffset()/60,t=jh[e];return t&&t.length>0?t[0]:"Etc/UTC"}const Qn="tv:latest-symbol",hu="web-trading-last-account-login";function Mh(){for(var e=0,t,n,r="";e<arguments.length;)(t=arguments[e++])&&(n=gu(t))&&(r&&(r+=" "),r+=n);return r}function gu(e){if(typeof e=="string")return e;for(var t,n="",r=0;r<e.length;r++)e[r]&&(t=gu(e[r]))&&(n&&(n+=" "),n+=t);return n}var ka="-";function Fh(e){var t=Bh(e),n=e.conflictingClassGroups,r=e.conflictingClassGroupModifiers,s=r===void 0?{}:r;function i(a){var l=a.split(ka);return l[0]===""&&l.length!==1&&l.shift(),yu(l,t)||Uh(a)}function o(a,l){var d=n[a]||[];return l&&s[a]?[].concat(d,s[a]):d}return{getClassGroupId:i,getConflictingClassGroupIds:o}}function yu(e,t){var o;if(e.length===0)return t.classGroupId;var n=e[0],r=t.nextPart.get(n),s=r?yu(e.slice(1),r):void 0;if(s)return s;if(t.validators.length!==0){var i=e.join(ka);return(o=t.validators.find(function(a){var l=a.validator;return l(i)}))==null?void 0:o.classGroupId}}var Gc=/^\[(.+)\]$/;function Uh(e){if(Gc.test(e)){var t=Gc.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}}function Bh(e){var t=e.theme,n=e.prefix,r={nextPart:new Map,validators:[]},s=Vh(Object.entries(e.classGroups),n);return s.forEach(function(i){var o=i[0],a=i[1];Oo(a,r,o,t)}),r}function Oo(e,t,n,r){e.forEach(function(s){if(typeof s=="string"){var i=s===""?t:Zc(t,s);i.classGroupId=n;return}if(typeof s=="function"){if($h(s)){Oo(s(r),t,n,r);return}t.validators.push({validator:s,classGroupId:n});return}Object.entries(s).forEach(function(o){var a=o[0],l=o[1];Oo(l,Zc(t,a),n,r)})})}function Zc(e,t){var n=e;return t.split(ka).forEach(function(r){n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n}function $h(e){return e.isThemeGetter}function Vh(e,t){return t?e.map(function(n){var r=n[0],s=n[1],i=s.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,i]}):e}function Hh(e){if(e<1)return{get:function(){},set:function(){}};var t=0,n=new Map,r=new Map;function s(i,o){n.set(i,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 s(o,a),a},set:function(o,a){n.has(o)?n.set(o,a):s(o,a)}}}var bu="!";function zh(e){var t=e.separator||":",n=t.length===1,r=t[0],s=t.length;return function(o){for(var a=[],l=0,d=0,f,u=0;u<o.length;u++){var y=o[u];if(l===0){if(y===r&&(n||o.slice(u,u+s)===t)){a.push(o.slice(d,u)),d=u+s;continue}if(y==="/"){f=u;continue}}y==="["?l++:y==="]"&&l--}var p=a.length===0?o:o.substring(d),g=p.startsWith(bu),m=g?p.substring(1):p,h=f&&f>d?f-d:void 0;return{modifiers:a,hasImportantModifier:g,baseClassName:m,maybePostfixModifierPosition:h}}}function Wh(e){if(e.length<=1)return e;var t=[],n=[];return e.forEach(function(r){var s=r[0]==="[";s?(t.push.apply(t,n.sort().concat([r])),n=[]):n.push(r)}),t.push.apply(t,n.sort()),t}function Kh(e){return{cache:Hh(e.cacheSize),splitModifiers:zh(e),...Fh(e)}}var qh=/\s+/;function Gh(e,t){var n=t.splitModifiers,r=t.getClassGroupId,s=t.getConflictingClassGroupIds,i=new Set;return e.trim().split(qh).map(function(o){var a=n(o),l=a.modifiers,d=a.hasImportantModifier,f=a.baseClassName,u=a.maybePostfixModifierPosition,y=r(u?f.substring(0,u):f),p=!!u;if(!y){if(!u)return{isTailwindClass:!1,originalClassName:o};if(y=r(f),!y)return{isTailwindClass:!1,originalClassName:o};p=!1}var g=Wh(l).join(":"),m=d?g+bu:g;return{isTailwindClass:!0,modifierId:m,classGroupId:y,originalClassName:o,hasPostfixModifier:p}}).reverse().filter(function(o){if(!o.isTailwindClass)return!0;var a=o.modifierId,l=o.classGroupId,d=o.hasPostfixModifier,f=a+l;return i.has(f)?!1:(i.add(f),s(l,d).forEach(function(u){return i.add(a+u)}),!0)}).reverse().map(function(o){return o.originalClassName}).join(" ")}function Zh(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r,s,i,o=a;function a(d){var f=t[0],u=t.slice(1),y=u.reduce(function(p,g){return g(p)},f());return r=Kh(y),s=r.cache.get,i=r.cache.set,o=l,l(d)}function l(d){var f=s(d);if(f)return f;var u=Gh(d,r);return i(d,u),u}return function(){return o(Mh.apply(null,arguments))}}function Ae(e){var t=function(r){return r[e]||[]};return t.isThemeGetter=!0,t}var vu=/^\[(?:([a-z-]+):)?(.+)\]$/i,Yh=/^\d+\/\d+$/,Qh=new Set(["px","full","screen"]),Xh=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Jh=/\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$/,eg=/^-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/;function mt(e){return bn(e)||Qh.has(e)||Yh.test(e)||No(e)}function No(e){return Un(e,"length",og)}function tg(e){return Un(e,"size",wu)}function ng(e){return Un(e,"position",wu)}function rg(e){return Un(e,"url",ag)}function xs(e){return Un(e,"number",bn)}function bn(e){return!Number.isNaN(Number(e))}function sg(e){return e.endsWith("%")&&bn(e.slice(0,-1))}function Rr(e){return Yc(e)||Un(e,"number",Yc)}function be(e){return vu.test(e)}function Lr(){return!0}function Wt(e){return Xh.test(e)}function ig(e){return Un(e,"",cg)}function Un(e,t,n){var r=vu.exec(e);return r?r[1]?r[1]===t:n(r[2]):!1}function og(e){return Jh.test(e)}function wu(){return!1}function ag(e){return e.startsWith("url(")}function Yc(e){return Number.isInteger(Number(e))}function cg(e){return eg.test(e)}function lg(){var e=Ae("colors"),t=Ae("spacing"),n=Ae("blur"),r=Ae("brightness"),s=Ae("borderColor"),i=Ae("borderRadius"),o=Ae("borderSpacing"),a=Ae("borderWidth"),l=Ae("contrast"),d=Ae("grayscale"),f=Ae("hueRotate"),u=Ae("invert"),y=Ae("gap"),p=Ae("gradientColorStops"),g=Ae("gradientColorStopPositions"),m=Ae("inset"),h=Ae("margin"),v=Ae("opacity"),b=Ae("padding"),_=Ae("saturate"),x=Ae("scale"),P=Ae("sepia"),C=Ae("skew"),E=Ae("space"),A=Ae("translate"),R=function(){return["auto","contain","none"]},M=function(){return["auto","hidden","clip","visible","scroll"]},N=function(){return["auto",be,t]},L=function(){return[be,t]},H=function(){return["",mt]},D=function(){return["auto",bn,be]},F=function(){return["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"]},I=function(){return["solid","dashed","dotted","double","none"]},U=function(){return["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-lighter"]},O=function(){return["start","end","center","between","around","evenly","stretch"]},B=function(){return["","0",be]},W=function(){return["auto","avoid","all","avoid-page","page","left","right","column"]},j=function(){return[bn,xs]},ee=function(){return[bn,be]};return{cacheSize:500,theme:{colors:[Lr],spacing:[mt],blur:["none","",Wt,be],brightness:j(),borderColor:[e],borderRadius:["none","","full",Wt,be],borderSpacing:L(),borderWidth:H(),contrast:j(),grayscale:B(),hueRotate:ee(),invert:B(),gap:L(),gradientColorStops:[e],gradientColorStopPositions:[sg,No],inset:N(),margin:N(),opacity:j(),padding:L(),saturate:j(),scale:j(),sepia:B(),skew:ee(),space:L(),translate:L()},classGroups:{aspect:[{aspect:["auto","square","video",be]}],container:["container"],columns:[{columns:[Wt]}],"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(F(),[be])}],overflow:[{overflow:M()}],"overflow-x":[{"overflow-x":M()}],"overflow-y":[{"overflow-y":M()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[m]}],"inset-x":[{"inset-x":[m]}],"inset-y":[{"inset-y":[m]}],start:[{start:[m]}],end:[{end:[m]}],top:[{top:[m]}],right:[{right:[m]}],bottom:[{bottom:[m]}],left:[{left:[m]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Rr]}],basis:[{basis:N()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",be]}],grow:[{grow:B()}],shrink:[{shrink:B()}],order:[{order:["first","last","none",Rr]}],"grid-cols":[{"grid-cols":[Lr]}],"col-start-end":[{col:["auto",{span:["full",Rr]},be]}],"col-start":[{"col-start":D()}],"col-end":[{"col-end":D()}],"grid-rows":[{"grid-rows":[Lr]}],"row-start-end":[{row:["auto",{span:[Rr]},be]}],"row-start":[{"row-start":D()}],"row-end":[{"row-end":D()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",be]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",be]}],gap:[{gap:[y]}],"gap-x":[{"gap-x":[y]}],"gap-y":[{"gap-y":[y]}],"justify-content":[{justify:["normal"].concat(O())}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal"].concat(O(),["baseline"])}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[].concat(O(),["baseline"])}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[b]}],px:[{px:[b]}],py:[{py:[b]}],ps:[{ps:[b]}],pe:[{pe:[b]}],pt:[{pt:[b]}],pr:[{pr:[b]}],pb:[{pb:[b]}],pl:[{pl:[b]}],m:[{m:[h]}],mx:[{mx:[h]}],my:[{my:[h]}],ms:[{ms:[h]}],me:[{me:[h]}],mt:[{mt:[h]}],mr:[{mr:[h]}],mb:[{mb:[h]}],ml:[{ml:[h]}],"space-x":[{"space-x":[E]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[E]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit",be,t]}],"min-w":[{"min-w":["min","max","fit",be,mt]}],"max-w":[{"max-w":["0","none","full","min","max","fit","prose",{screen:[Wt]},Wt,be]}],h:[{h:[be,t,"auto","min","max","fit"]}],"min-h":[{"min-h":["min","max","fit",be,mt]}],"max-h":[{"max-h":[be,t,"min","max","fit"]}],"font-size":[{text:["base",Wt,No]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",xs]}],"font-family":[{font:[Lr]}],"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",be]}],"line-clamp":[{"line-clamp":["none",bn,xs]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",be,mt]}],"list-image":[{"list-image":["none",be]}],"list-style-type":[{list:["none","disc","decimal",be]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[v]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[v]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[].concat(I(),["wavy"])}],"text-decoration-thickness":[{decoration:["auto","from-font",mt]}],"underline-offset":[{"underline-offset":["auto",be,mt]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],indent:[{indent:L()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",be]}],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",be]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[v]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[].concat(F(),[ng])}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",tg]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},rg]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[g]}],"gradient-via-pos":[{via:[g]}],"gradient-to-pos":[{to:[g]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"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":[v]}],"border-style":[{border:[].concat(I(),["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":[v]}],"divide-style":[{divide:I()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:[""].concat(I())}],"outline-offset":[{"outline-offset":[be,mt]}],"outline-w":[{outline:[mt]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:H()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[v]}],"ring-offset-w":[{"ring-offset":[mt]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Wt,ig]}],"shadow-color":[{shadow:[Lr]}],opacity:[{opacity:[v]}],"mix-blend":[{"mix-blend":U()}],"bg-blend":[{"bg-blend":U()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Wt,be]}],grayscale:[{grayscale:[d]}],"hue-rotate":[{"hue-rotate":[f]}],invert:[{invert:[u]}],saturate:[{saturate:[_]}],sepia:[{sepia:[P]}],"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":[f]}],"backdrop-invert":[{"backdrop-invert":[u]}],"backdrop-opacity":[{"backdrop-opacity":[v]}],"backdrop-saturate":[{"backdrop-saturate":[_]}],"backdrop-sepia":[{"backdrop-sepia":[P]}],"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",be]}],duration:[{duration:ee()}],ease:[{ease:["linear","in","out","in-out",be]}],delay:[{delay:ee()}],animate:[{animate:["none","spin","ping","pulse","bounce",be]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[x]}],"scale-x":[{"scale-x":[x]}],"scale-y":[{"scale-y":[x]}],rotate:[{rotate:[Rr,be]}],"translate-x":[{"translate-x":[A]}],"translate-y":[{"translate-y":[A]}],"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",be]}],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",be]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":L()}],"scroll-mx":[{"scroll-mx":L()}],"scroll-my":[{"scroll-my":L()}],"scroll-ms":[{"scroll-ms":L()}],"scroll-me":[{"scroll-me":L()}],"scroll-mt":[{"scroll-mt":L()}],"scroll-mr":[{"scroll-mr":L()}],"scroll-mb":[{"scroll-mb":L()}],"scroll-ml":[{"scroll-ml":L()}],"scroll-p":[{"scroll-p":L()}],"scroll-px":[{"scroll-px":L()}],"scroll-py":[{"scroll-py":L()}],"scroll-ps":[{"scroll-ps":L()}],"scroll-pe":[{"scroll-pe":L()}],"scroll-pt":[{"scroll-pt":L()}],"scroll-pr":[{"scroll-pr":L()}],"scroll-pb":[{"scroll-pb":L()}],"scroll-pl":[{"scroll-pl":L()}],"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",be]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[mt,xs]}],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 dg=Zh(lg);function Ee(...e){return dg(pu(e))}const ug=({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})}),Qc=Pa("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"}}),ct=w.forwardRef(({children:e,className:t,variant:n,size:r,loading:s,asChild:i=!1,disabled:o,loaderClassName:a="",loaderParentClassName:l="",...d},f)=>{const u=i?Th:"button";return i?c.jsx(u,{className:Ee(Qc({variant:n,size:r,className:t}),o&&"cursor-default","relative"),ref:f,...d,children:e}):c.jsxs(u,{className:Ee(Qc({variant:n,size:r,className:t}),o&&"cursor-default","relative"),ref:f,disabled:s||o,...d,children:[s&&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:Ee("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(ug,{className:a})})]}),e]})});ct.displayName="Button";function me(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e==null||e(s),n===!1||!s.defaultPrevented)return t==null?void 0:t(s)}}function Bn(e,t=[]){let n=[];function r(i,o){const a=w.createContext(o);a.displayName=i+"Context";const l=n.length;n=[...n,o];const d=u=>{var v;const{scope:y,children:p,...g}=u,m=((v=y==null?void 0:y[e])==null?void 0:v[l])||a,h=w.useMemo(()=>g,Object.values(g));return c.jsx(m.Provider,{value:h,children:p})};d.displayName=i+"Provider";function f(u,y){var m;const p=((m=y==null?void 0:y[e])==null?void 0:m[l])||a,g=w.useContext(p);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${u}\` must be used within \`${i}\``)}return[d,f]}const s=()=>{const i=n.map(o=>w.createContext(o));return function(a){const l=(a==null?void 0:a[e])||i;return w.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return s.scopeName=e,[r,fg(s,...t)]}function fg(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const o=r.reduce((a,{useScope:l,scopeName:d})=>{const u=l(i)[`__scope${d}`];return{...a,...u}},{});return w.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}var Ie=globalThis!=null&&globalThis.document?w.useLayoutEffect:()=>{},mg=w[" useId ".trim().toString()]||(()=>{}),pg=0;function on(e){const[t,n]=w.useState(mg());return Ie(()=>{n(r=>r??String(pg++))},[e]),e||(t?`radix-${t}`:"")}var hg=w[" useInsertionEffect ".trim().toString()]||Ie;function Ln({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[s,i,o]=gg({defaultProp:t,onChange:n}),a=e!==void 0,l=a?e:s;{const f=w.useRef(e!==void 0);w.useEffect(()=>{const u=f.current;u!==a&&console.warn(`${r} is changing from ${u?"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.`),f.current=a},[a,r])}const d=w.useCallback(f=>{var u;if(a){const y=yg(f)?f(e):f;y!==e&&((u=o.current)==null||u.call(o,y))}else i(f)},[a,e,i,o]);return[l,d]}function gg({defaultProp:e,onChange:t}){const[n,r]=w.useState(e),s=w.useRef(n),i=w.useRef(t);return hg(()=>{i.current=t},[t]),w.useEffect(()=>{var o;s.current!==n&&((o=i.current)==null||o.call(i,n),s.current=n)},[n,s]),[n,r,i]}function yg(e){return typeof e=="function"}var bg=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],he=bg.reduce((e,t)=>{const n=mr(`Primitive.${t}`),r=w.forwardRef((s,i)=>{const{asChild:o,...a}=s,l=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(l,{...a,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function _u(e,t){e&&Cr.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 vg(e,t=globalThis==null?void 0:globalThis.document){const n=yt(e);w.useEffect(()=>{const r=s=>{s.key==="Escape"&&n(s)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var wg="DismissableLayer",Ro="dismissableLayer.update",_g="dismissableLayer.pointerDownOutside",xg="dismissableLayer.focusOutside",Xc,Aa=w.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),xi=w.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:a,onDismiss:l,...d}=e,f=w.useContext(Aa),[u,y]=w.useState(null),p=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,g]=w.useState({}),m=Oe(t,R=>y(R)),h=Array.from(f.layers),[v]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),b=h.indexOf(v),_=u?h.indexOf(u):-1,x=f.layersWithOutsidePointerEventsDisabled.size>0,P=_>=b,C=w.useRef(!1),E=Tg(R=>{const M=R.target;if(!(M instanceof Node))return;const N=[...f.branches].some(L=>L.contains(M));!P||N||(i==null||i(R),a==null||a(R),R.defaultPrevented||l==null||l())},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:C,dismissableSurfaces:f.dismissableSurfaces}),A=Eg(R=>{if(r&&C.current)return;const M=R.target;[...f.branches].some(L=>L.contains(M))||(o==null||o(R),a==null||a(R),R.defaultPrevented||l==null||l())},p);return vg(R=>{_===f.layers.size-1&&(s==null||s(R),!R.defaultPrevented&&l&&(R.preventDefault(),l()))},p),w.useEffect(()=>{if(u)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(Xc=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(u)),f.layers.add(u),Jc(),()=>{n&&(f.layersWithOutsidePointerEventsDisabled.delete(u),f.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=Xc))}},[u,p,n,f]),w.useEffect(()=>()=>{u&&(f.layers.delete(u),f.layersWithOutsidePointerEventsDisabled.delete(u),Jc())},[u,f]),w.useEffect(()=>{const R=()=>g({});return document.addEventListener(Ro,R),()=>document.removeEventListener(Ro,R)},[]),c.jsx(he.div,{...d,ref:m,style:{pointerEvents:x?P?"auto":"none":void 0,...e.style},onFocusCapture:me(e.onFocusCapture,A.onFocusCapture),onBlurCapture:me(e.onBlurCapture,A.onBlurCapture),onPointerDownCapture:me(e.onPointerDownCapture,E.onPointerDownCapture)})});xi.displayName=wg;var Sg="DismissableLayerBranch",xu=w.forwardRef((e,t)=>{const n=w.useContext(Aa),r=w.useRef(null),s=Oe(t,r);return w.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),c.jsx(he.div,{...e,ref:s})});xu.displayName=Sg;function Cg(){const e=w.useContext(Aa),[t,n]=w.useState(null);return w.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}function Tg(e,t){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:s,dismissableSurfaces:i}=t,o=yt(e),a=w.useRef(!1),l=w.useRef(!1),d=w.useRef(new Map),f=w.useRef(()=>{});return w.useEffect(()=>{function u(){l.current=!1,s.current=!1,d.current.clear()}function y(){return Array.from(d.current.values()).some(Boolean)}function p(b){if(!l.current)return;const _=b.target;_ instanceof Node&&[...i].some(P=>P.contains(_))||d.current.set(b.type,!0),b.type==="click"&&window.setTimeout(()=>{l.current&&f.current()},0)}function g(b){l.current&&d.current.set(b.type,!1)}const m=b=>{if(b.target&&!a.current){let _=function(){n.removeEventListener("click",f.current);const P=y();u(),P||Su(_g,o,x,{discrete:!0})};const x={originalEvent:b};l.current=!0,s.current=r&&b.button===0,d.current.clear(),!r||b.button!==0?_():(n.removeEventListener("click",f.current),f.current=_,n.addEventListener("click",f.current,{once:!0}))}else n.removeEventListener("click",f.current),u();a.current=!1},h=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const b of h)n.addEventListener(b,p,!0),n.addEventListener(b,g);const v=window.setTimeout(()=>{n.addEventListener("pointerdown",m)},0);return()=>{window.clearTimeout(v),n.removeEventListener("pointerdown",m),n.removeEventListener("click",f.current);for(const b of h)n.removeEventListener(b,p,!0),n.removeEventListener(b,g)}},[n,o,r,s,i]),{onPointerDownCapture:()=>a.current=!0}}function Eg(e,t=globalThis==null?void 0:globalThis.document){const n=yt(e),r=w.useRef(!1);return w.useEffect(()=>{const s=i=>{i.target&&!r.current&&Su(xg,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Jc(){const e=new CustomEvent(Ro);document.dispatchEvent(e)}function Su(e,t,n,{discrete:r}){const s=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?_u(s,i):s.dispatchEvent(i)}var Pg=xi,kg=xu,to="focusScope.autoFocusOnMount",no="focusScope.autoFocusOnUnmount",el={bubbles:!1,cancelable:!0},Ag="FocusScope",Oa=w.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:i,...o}=e,[a,l]=w.useState(null),d=yt(s),f=yt(i),u=w.useRef(null),y=Oe(t,m=>l(m)),p=w.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;w.useEffect(()=>{if(r){let m=function(_){if(p.paused||!a)return;const x=_.target;a.contains(x)?u.current=x:Kt(u.current,{select:!0})},h=function(_){if(p.paused||!a)return;const x=_.relatedTarget;x!==null&&(a.contains(x)||Kt(u.current,{select:!0}))},v=function(_){if(document.activeElement===document.body)for(const P of _)P.removedNodes.length>0&&Kt(a)};document.addEventListener("focusin",m),document.addEventListener("focusout",h);const b=new MutationObserver(v);return a&&b.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",h),b.disconnect()}}},[r,a,p.paused]),w.useEffect(()=>{if(a){nl.add(p);const m=document.activeElement;if(!a.contains(m)){const v=new CustomEvent(to,el);a.addEventListener(to,d),a.dispatchEvent(v),v.defaultPrevented||(Og(jg(Cu(a)),{select:!0}),document.activeElement===m&&Kt(a))}return()=>{a.removeEventListener(to,d),setTimeout(()=>{const v=new CustomEvent(no,el);a.addEventListener(no,f),a.dispatchEvent(v),v.defaultPrevented||Kt(m??document.body,{select:!0}),a.removeEventListener(no,f),nl.remove(p)},0)}}},[a,d,f,p]);const g=w.useCallback(m=>{if(!n&&!r||p.paused)return;const h=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,v=document.activeElement;if(h&&v){const b=m.currentTarget,[_,x]=Ng(b);_&&x?!m.shiftKey&&v===x?(m.preventDefault(),n&&Kt(_,{select:!0})):m.shiftKey&&v===_&&(m.preventDefault(),n&&Kt(x,{select:!0})):v===b&&m.preventDefault()}},[n,r,p.paused]);return c.jsx(he.div,{tabIndex:-1,...o,ref:y,onKeyDown:g})});Oa.displayName=Ag;function Og(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Kt(r,{select:t}),document.activeElement!==n)return}function Ng(e){const t=Cu(e),n=tl(t,e),r=tl(t.reverse(),e);return[n,r]}function Cu(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function tl(e,t){for(const n of e)if(!Rg(n,{upTo:t}))return n}function Rg(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 Lg(e){return e instanceof HTMLInputElement&&"select"in e}function Kt(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Lg(e)&&t&&e.select()}}var nl=Dg();function Dg(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=rl(e,t),e.unshift(t)},remove(t){var n;e=rl(e,t),(n=e[0])==null||n.resume()}}}function rl(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function jg(e){return e.filter(t=>t.tagName!=="A")}var Ig="Portal",Si=w.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[s,i]=w.useState(!1);Ie(()=>i(!0),[]);const o=n||s&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?Cr.createPortal(c.jsx(he.div,{...r,ref:t}),o):null});Si.displayName=Ig;function Mg(e,t){return w.useReducer((n,r)=>t[n][r]??n,e)}var $n=e=>{const{present:t,children:n}=e,r=Fg(t),s=typeof n=="function"?n({present:r.isPresent}):w.Children.only(n),i=Ug(r.ref,Bg(s));return typeof n=="function"||r.isPresent?w.cloneElement(s,{ref:i}):null};$n.displayName="Presence";function Fg(e){const[t,n]=w.useState(),r=w.useRef(null),s=w.useRef(e),i=w.useRef("none"),o=e?"mounted":"unmounted",[a,l]=Mg(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{const d=Ss(r.current);i.current=a==="mounted"?d:"none"},[a]),Ie(()=>{const d=r.current,f=s.current;if(f!==e){const y=i.current,p=Ss(d);e?l("MOUNT"):p==="none"||(d==null?void 0:d.display)==="none"?l("UNMOUNT"):l(f&&y!==p?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,l]),Ie(()=>{if(t){let d;const f=t.ownerDocument.defaultView??window,u=p=>{const m=Ss(r.current).includes(CSS.escape(p.animationName));if(p.target===t&&m&&(l("ANIMATION_END"),!s.current)){const h=t.style.animationFillMode;t.style.animationFillMode="forwards",d=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=h)})}},y=p=>{p.target===t&&(i.current=Ss(r.current))};return t.addEventListener("animationstart",y),t.addEventListener("animationcancel",u),t.addEventListener("animationend",u),()=>{f.clearTimeout(d),t.removeEventListener("animationstart",y),t.removeEventListener("animationcancel",u),t.removeEventListener("animationend",u)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:w.useCallback(d=>{r.current=d?getComputedStyle(d):null,n(d)},[])}}function sl(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Ug(...e){const t=w.useRef(e);return t.current=e,w.useCallback(n=>{const r=t.current;let s=!1;const i=r.map(o=>{const a=sl(o,n);return!s&&typeof a=="function"&&(s=!0),a});if(s)return()=>{for(let o=0;o<i.length;o++){const a=i[o];typeof a=="function"?a():sl(r[o],null)}}},[])}function Ss(e){return(e==null?void 0:e.animationName)||"none"}function Bg(e){var r,s;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=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Cs=0,St=null;function Tu(){w.useEffect(()=>{St||(St={start:il(),end:il()});const{start:e,end:t}=St;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),Cs++,()=>{Cs===1&&(St==null||St.start.remove(),St==null||St.end.remove(),St=null),Cs=Math.max(0,Cs-1)}},[])}function il(){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 kt=function(){return kt=Object.assign||function(t){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},kt.apply(this,arguments)};function Eu(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 s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n}function $g(e,t,n){if(n||arguments.length===2)for(var r=0,s=t.length,i;r<s;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var $s="right-scroll-bar-position",Vs="width-before-scroll-bar",Vg="with-scroll-bars-hidden",Hg="--removed-body-scroll-bar-size";function ro(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function zg(e,t){var n=S.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var s=n.value;s!==r&&(n.value=r,n.callback(r,s))}}}})[0];return n.callback=t,n.facade}var Wg=typeof window<"u"?w.useLayoutEffect:w.useEffect,ol=new WeakMap;function Kg(e,t){var n=zg(null,function(r){return e.forEach(function(s){return ro(s,r)})});return Wg(function(){var r=ol.get(n);if(r){var s=new Set(r),i=new Set(e),o=n.current;s.forEach(function(a){i.has(a)||ro(a,null)}),i.forEach(function(a){s.has(a)||ro(a,o)})}ol.set(n,e)},[e]),n}function qg(e){return e}function Gg(e,t){t===void 0&&(t=qg);var n=[],r=!1,s={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(i){var o=t(i,r);return n.push(o),function(){n=n.filter(function(a){return a!==o})}},assignSyncMedium:function(i){for(r=!0;n.length;){var o=n;n=[],o.forEach(i)}n={push:function(a){return i(a)},filter:function(){return n}}},assignMedium:function(i){r=!0;var o=[];if(n.length){var a=n;n=[],a.forEach(i),o=n}var l=function(){var f=o;o=[],f.forEach(i)},d=function(){return Promise.resolve().then(l)};d(),n={push:function(f){o.push(f),d()},filter:function(f){return o=o.filter(f),n}}}};return s}function Zg(e){e===void 0&&(e={});var t=Gg(null);return t.options=kt({async:!0,ssr:!1},e),t}var Pu=function(e){var t=e.sideCar,n=Eu(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,kt({},n))};Pu.isSideCarExport=!0;function Yg(e,t){return e.useMedium(t),Pu}var ku=Zg(),so=function(){},Ci=w.forwardRef(function(e,t){var n=w.useRef(null),r=w.useState({onScrollCapture:so,onWheelCapture:so,onTouchMoveCapture:so}),s=r[0],i=r[1],o=e.forwardProps,a=e.children,l=e.className,d=e.removeScrollBar,f=e.enabled,u=e.shards,y=e.sideCar,p=e.noRelative,g=e.noIsolation,m=e.inert,h=e.allowPinchZoom,v=e.as,b=v===void 0?"div":v,_=e.gapMode,x=Eu(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),P=y,C=Kg([n,t]),E=kt(kt({},x),s);return w.createElement(w.Fragment,null,f&&w.createElement(P,{sideCar:ku,removeScrollBar:d,shards:u,noRelative:p,noIsolation:g,inert:m,setCallbacks:i,allowPinchZoom:!!h,lockRef:n,gapMode:_}),o?w.cloneElement(w.Children.only(a),kt(kt({},E),{ref:C})):w.createElement(b,kt({},E,{className:l,ref:C}),a))});Ci.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Ci.classNames={fullWidth:Vs,zeroRight:$s};var Qg=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Xg(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Qg();return t&&e.setAttribute("nonce",t),e}function Jg(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function ey(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var ty=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Xg())&&(Jg(t,n),ey(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},ny=function(){var e=ty();return function(t,n){w.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Au=function(){var e=ny(),t=function(n){var r=n.styles,s=n.dynamic;return e(r,s),null};return t},ry={left:0,top:0,right:0,gap:0},io=function(e){return parseInt(e||"",10)||0},sy=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[io(n),io(r),io(s)]},iy=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return ry;var t=sy(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])}},oy=Au(),Xn="data-scroll-locked",ay=function(e,t,n,r){var s=e.left,i=e.top,o=e.right,a=e.gap;return n===void 0&&(n="margin"),`
|
|
2
|
-
.`.concat(
|
|
1
|
+
"use strict";var Sh=Object.defineProperty;var Kc=e=>{throw TypeError(e)};var Ch=(e,t,n)=>t in e?Sh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var it=(e,t,n)=>Ch(e,typeof t!="symbol"?t+"":t,n),eo=(e,t,n)=>t.has(e)||Kc("Cannot "+n);var P=(e,t,n)=>(eo(e,t,"read from private field"),n?n.call(e):t.get(e)),re=(e,t,n)=>t.has(e)?Kc("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),q=(e,t,n,r)=>(eo(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),be=(e,t,n)=>(eo(e,t,"access private method"),n);var ws=(e,t,n,r)=>({set _(s){q(e,t,s,n)},get _(){return P(e,t,r)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),C=require("react"),Th=require("react-dom");function hu(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=hu(C),Cr=hu(Th);function qc(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Eh(...e){return t=>{let n=!1;const r=e.map(s=>{const i=qc(s,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let s=0;s<r.length;s++){const i=r[s];typeof i=="function"?i():qc(e[s],null)}}}}function Ne(...e){return w.useCallback(Eh(...e),e)}function mr(e){const t=w.forwardRef((n,r)=>{let{children:s,...i}=n,o=null,a=!1;const l=[];Gc(s)&&typeof _s=="function"&&(s=_s(s._payload)),w.Children.forEach(s,g=>{var h;if(Rh(g)){a=!0;const v=g;let p="child"in v.props?v.props.child:v.props.children;Gc(p)&&typeof _s=="function"&&(p=_s(p._payload)),o=Ah(v,p),l.push((h=o==null?void 0:o.props)==null?void 0:h.children)}else l.push(g)}),o?o=w.cloneElement(o,void 0,l):!a&&w.Children.count(s)===1&&w.isValidElement(s)&&(o=s);const d=o?Nh(o):void 0,f=Ne(r,d);if(!o){if(s||s===0)throw new Error(a?Ih(e):jh(e));return s}const u=Oh(i,o.props??{});return o.type!==w.Fragment&&(u.ref=r?f:d),w.cloneElement(o,u)});return t.displayName=`${e}.Slot`,t}var Ph=mr("Slot"),kh=Symbol.for("radix.slottable"),Ah=(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 Oh(e,t){const n={...t};for(const r in t){const s=e[r],i=t[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...a)=>{const l=i(...a);return s(...a),l}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...e,...n}}function Nh(e){var r,s;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=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Rh(e){return w.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===kh}var Lh=Symbol.for("react.lazy");function Gc(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Lh&&"_payload"in e&&Dh(e._payload)}function Dh(e){return typeof e=="object"&&e!==null&&"then"in e}var jh=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,Ih=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,_s=w[" use ".trim().toString()];function gu(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=gu(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function yu(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=gu(e))&&(r&&(r+=" "),r+=t);return r}const Zc=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Yc=yu,Oa=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return Yc(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:i}=t,o=Object.keys(s).map(d=>{const f=n==null?void 0:n[d],u=i==null?void 0:i[d];if(f===null)return null;const g=Zc(f)||Zc(u);return s[d][g]}),a=n&&Object.entries(n).reduce((d,f)=>{let[u,g]=f;return g===void 0||(d[u]=g),d},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((d,f)=>{let{class:u,className:g,...h}=f;return Object.entries(h).every(v=>{let[p,m]=v;return Array.isArray(m)?m.includes({...i,...a}[p]):{...i,...a}[p]===m})?[...d,u,g]:d},[]);return Yc(e,o,l,n==null?void 0:n.class,n==null?void 0:n.className)},Bt=[{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"}],Mh={[-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 Fh(){const e=-new Date().getTimezoneOffset()/60,t=Mh[e];return t&&t.length>0?t[0]:"Etc/UTC"}const Qn="tv:latest-symbol",bu="web-trading-last-account-login";function Uh(){for(var e=0,t,n,r="";e<arguments.length;)(t=arguments[e++])&&(n=vu(t))&&(r&&(r+=" "),r+=n);return r}function vu(e){if(typeof e=="string")return e;for(var t,n="",r=0;r<e.length;r++)e[r]&&(t=vu(e[r]))&&(n&&(n+=" "),n+=t);return n}var Na="-";function Bh(e){var t=Vh(e),n=e.conflictingClassGroups,r=e.conflictingClassGroupModifiers,s=r===void 0?{}:r;function i(a){var l=a.split(Na);return l[0]===""&&l.length!==1&&l.shift(),wu(l,t)||$h(a)}function o(a,l){var d=n[a]||[];return l&&s[a]?[].concat(d,s[a]):d}return{getClassGroupId:i,getConflictingClassGroupIds:o}}function wu(e,t){var o;if(e.length===0)return t.classGroupId;var n=e[0],r=t.nextPart.get(n),s=r?wu(e.slice(1),r):void 0;if(s)return s;if(t.validators.length!==0){var i=e.join(Na);return(o=t.validators.find(function(a){var l=a.validator;return l(i)}))==null?void 0:o.classGroupId}}var Qc=/^\[(.+)\]$/;function $h(e){if(Qc.test(e)){var t=Qc.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}}function Vh(e){var t=e.theme,n=e.prefix,r={nextPart:new Map,validators:[]},s=zh(Object.entries(e.classGroups),n);return s.forEach(function(i){var o=i[0],a=i[1];Ro(a,r,o,t)}),r}function Ro(e,t,n,r){e.forEach(function(s){if(typeof s=="string"){var i=s===""?t:Xc(t,s);i.classGroupId=n;return}if(typeof s=="function"){if(Hh(s)){Ro(s(r),t,n,r);return}t.validators.push({validator:s,classGroupId:n});return}Object.entries(s).forEach(function(o){var a=o[0],l=o[1];Ro(l,Xc(t,a),n,r)})})}function Xc(e,t){var n=e;return t.split(Na).forEach(function(r){n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n}function Hh(e){return e.isThemeGetter}function zh(e,t){return t?e.map(function(n){var r=n[0],s=n[1],i=s.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,i]}):e}function Wh(e){if(e<1)return{get:function(){},set:function(){}};var t=0,n=new Map,r=new Map;function s(i,o){n.set(i,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 s(o,a),a},set:function(o,a){n.has(o)?n.set(o,a):s(o,a)}}}var _u="!";function Kh(e){var t=e.separator||":",n=t.length===1,r=t[0],s=t.length;return function(o){for(var a=[],l=0,d=0,f,u=0;u<o.length;u++){var g=o[u];if(l===0){if(g===r&&(n||o.slice(u,u+s)===t)){a.push(o.slice(d,u)),d=u+s;continue}if(g==="/"){f=u;continue}}g==="["?l++:g==="]"&&l--}var h=a.length===0?o:o.substring(d),v=h.startsWith(_u),p=v?h.substring(1):h,m=f&&f>d?f-d:void 0;return{modifiers:a,hasImportantModifier:v,baseClassName:p,maybePostfixModifierPosition:m}}}function qh(e){if(e.length<=1)return e;var t=[],n=[];return e.forEach(function(r){var s=r[0]==="[";s?(t.push.apply(t,n.sort().concat([r])),n=[]):n.push(r)}),t.push.apply(t,n.sort()),t}function Gh(e){return{cache:Wh(e.cacheSize),splitModifiers:Kh(e),...Bh(e)}}var Zh=/\s+/;function Yh(e,t){var n=t.splitModifiers,r=t.getClassGroupId,s=t.getConflictingClassGroupIds,i=new Set;return e.trim().split(Zh).map(function(o){var a=n(o),l=a.modifiers,d=a.hasImportantModifier,f=a.baseClassName,u=a.maybePostfixModifierPosition,g=r(u?f.substring(0,u):f),h=!!u;if(!g){if(!u)return{isTailwindClass:!1,originalClassName:o};if(g=r(f),!g)return{isTailwindClass:!1,originalClassName:o};h=!1}var v=qh(l).join(":"),p=d?v+_u:v;return{isTailwindClass:!0,modifierId:p,classGroupId:g,originalClassName:o,hasPostfixModifier:h}}).reverse().filter(function(o){if(!o.isTailwindClass)return!0;var a=o.modifierId,l=o.classGroupId,d=o.hasPostfixModifier,f=a+l;return i.has(f)?!1:(i.add(f),s(l,d).forEach(function(u){return i.add(a+u)}),!0)}).reverse().map(function(o){return o.originalClassName}).join(" ")}function Qh(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r,s,i,o=a;function a(d){var f=t[0],u=t.slice(1),g=u.reduce(function(h,v){return v(h)},f());return r=Gh(g),s=r.cache.get,i=r.cache.set,o=l,l(d)}function l(d){var f=s(d);if(f)return f;var u=Yh(d,r);return i(d,u),u}return function(){return o(Uh.apply(null,arguments))}}function Oe(e){var t=function(r){return r[e]||[]};return t.isThemeGetter=!0,t}var xu=/^\[(?:([a-z-]+):)?(.+)\]$/i,Xh=/^\d+\/\d+$/,Jh=new Set(["px","full","screen"]),eg=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,tg=/\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$/,ng=/^-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/;function mt(e){return bn(e)||Jh.has(e)||Xh.test(e)||Lo(e)}function Lo(e){return Un(e,"length",cg)}function rg(e){return Un(e,"size",Su)}function sg(e){return Un(e,"position",Su)}function ig(e){return Un(e,"url",lg)}function xs(e){return Un(e,"number",bn)}function bn(e){return!Number.isNaN(Number(e))}function og(e){return e.endsWith("%")&&bn(e.slice(0,-1))}function Rr(e){return Jc(e)||Un(e,"number",Jc)}function ve(e){return xu.test(e)}function Lr(){return!0}function Wt(e){return eg.test(e)}function ag(e){return Un(e,"",dg)}function Un(e,t,n){var r=xu.exec(e);return r?r[1]?r[1]===t:n(r[2]):!1}function cg(e){return tg.test(e)}function Su(){return!1}function lg(e){return e.startsWith("url(")}function Jc(e){return Number.isInteger(Number(e))}function dg(e){return ng.test(e)}function ug(){var e=Oe("colors"),t=Oe("spacing"),n=Oe("blur"),r=Oe("brightness"),s=Oe("borderColor"),i=Oe("borderRadius"),o=Oe("borderSpacing"),a=Oe("borderWidth"),l=Oe("contrast"),d=Oe("grayscale"),f=Oe("hueRotate"),u=Oe("invert"),g=Oe("gap"),h=Oe("gradientColorStops"),v=Oe("gradientColorStopPositions"),p=Oe("inset"),m=Oe("margin"),y=Oe("opacity"),b=Oe("padding"),_=Oe("saturate"),x=Oe("scale"),T=Oe("sepia"),S=Oe("skew"),E=Oe("space"),O=Oe("translate"),R=function(){return["auto","contain","none"]},M=function(){return["auto","hidden","clip","visible","scroll"]},N=function(){return["auto",ve,t]},L=function(){return[ve,t]},V=function(){return["",mt]},j=function(){return["auto",bn,ve]},U=function(){return["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"]},D=function(){return["solid","dashed","dotted","double","none"]},$=function(){return["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-lighter"]},A=function(){return["start","end","center","between","around","evenly","stretch"]},F=function(){return["","0",ve]},W=function(){return["auto","avoid","all","avoid-page","page","left","right","column"]},I=function(){return[bn,xs]},ee=function(){return[bn,ve]};return{cacheSize:500,theme:{colors:[Lr],spacing:[mt],blur:["none","",Wt,ve],brightness:I(),borderColor:[e],borderRadius:["none","","full",Wt,ve],borderSpacing:L(),borderWidth:V(),contrast:I(),grayscale:F(),hueRotate:ee(),invert:F(),gap:L(),gradientColorStops:[e],gradientColorStopPositions:[og,Lo],inset:N(),margin:N(),opacity:I(),padding:L(),saturate:I(),scale:I(),sepia:F(),skew:ee(),space:L(),translate:L()},classGroups:{aspect:[{aspect:["auto","square","video",ve]}],container:["container"],columns:[{columns:[Wt]}],"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(U(),[ve])}],overflow:[{overflow:M()}],"overflow-x":[{"overflow-x":M()}],"overflow-y":[{"overflow-y":M()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[p]}],"inset-x":[{"inset-x":[p]}],"inset-y":[{"inset-y":[p]}],start:[{start:[p]}],end:[{end:[p]}],top:[{top:[p]}],right:[{right:[p]}],bottom:[{bottom:[p]}],left:[{left:[p]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Rr]}],basis:[{basis:N()}],"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:F()}],shrink:[{shrink:F()}],order:[{order:["first","last","none",Rr]}],"grid-cols":[{"grid-cols":[Lr]}],"col-start-end":[{col:["auto",{span:["full",Rr]},ve]}],"col-start":[{"col-start":j()}],"col-end":[{"col-end":j()}],"grid-rows":[{"grid-rows":[Lr]}],"row-start-end":[{row:["auto",{span:[Rr]},ve]}],"row-start":[{"row-start":j()}],"row-end":[{"row-end":j()}],"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:[g]}],"gap-x":[{"gap-x":[g]}],"gap-y":[{"gap-y":[g]}],"justify-content":[{justify:["normal"].concat(A())}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal"].concat(A(),["baseline"])}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[].concat(A(),["baseline"])}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[b]}],px:[{px:[b]}],py:[{py:[b]}],ps:[{ps:[b]}],pe:[{pe:[b]}],pt:[{pt:[b]}],pr:[{pr:[b]}],pb:[{pb:[b]}],pl:[{pl:[b]}],m:[{m:[m]}],mx:[{mx:[m]}],my:[{my:[m]}],ms:[{ms:[m]}],me:[{me:[m]}],mt:[{mt:[m]}],mr:[{mr:[m]}],mb:[{mb:[m]}],ml:[{ml:[m]}],"space-x":[{"space-x":[E]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[E]}],"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:[Wt]},Wt,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",Wt,Lo]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",xs]}],"font-family":[{font:[Lr]}],"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",bn,xs]}],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(D(),["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:L()}],"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(U(),[sg])}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",rg]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},ig]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[v]}],"gradient-via-pos":[{via:[v]}],"gradient-to-pos":[{to:[v]}],"gradient-from":[{from:[h]}],"gradient-via":[{via:[h]}],"gradient-to":[{to:[h]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"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(D(),["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:D()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:[""].concat(D())}],"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",Wt,ag]}],"shadow-color":[{shadow:[Lr]}],opacity:[{opacity:[y]}],"mix-blend":[{"mix-blend":$()}],"bg-blend":[{"bg-blend":$()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Wt,ve]}],grayscale:[{grayscale:[d]}],"hue-rotate":[{"hue-rotate":[f]}],invert:[{invert:[u]}],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":[f]}],"backdrop-invert":[{"backdrop-invert":[u]}],"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:ee()}],ease:[{ease:["linear","in","out","in-out",ve]}],delay:[{delay:ee()}],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:[Rr,ve]}],"translate-x":[{"translate-x":[O]}],"translate-y":[{"translate-y":[O]}],"skew-x":[{"skew-x":[S]}],"skew-y":[{"skew-y":[S]}],"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":L()}],"scroll-mx":[{"scroll-mx":L()}],"scroll-my":[{"scroll-my":L()}],"scroll-ms":[{"scroll-ms":L()}],"scroll-me":[{"scroll-me":L()}],"scroll-mt":[{"scroll-mt":L()}],"scroll-mr":[{"scroll-mr":L()}],"scroll-mb":[{"scroll-mb":L()}],"scroll-ml":[{"scroll-ml":L()}],"scroll-p":[{"scroll-p":L()}],"scroll-px":[{"scroll-px":L()}],"scroll-py":[{"scroll-py":L()}],"scroll-ps":[{"scroll-ps":L()}],"scroll-pe":[{"scroll-pe":L()}],"scroll-pt":[{"scroll-pt":L()}],"scroll-pr":[{"scroll-pr":L()}],"scroll-pb":[{"scroll-pb":L()}],"scroll-pl":[{"scroll-pl":L()}],"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,xs]}],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 fg=Qh(ug);function Pe(...e){return fg(yu(e))}const mg=({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})}),el=Oa("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"}}),ct=w.forwardRef(({children:e,className:t,variant:n,size:r,loading:s,asChild:i=!1,disabled:o,loaderClassName:a="",loaderParentClassName:l="",...d},f)=>{const u=i?Ph:"button";return i?c.jsx(u,{className:Pe(el({variant:n,size:r,className:t}),o&&"cursor-default","relative"),ref:f,...d,children:e}):c.jsxs(u,{className:Pe(el({variant:n,size:r,className:t}),o&&"cursor-default","relative"),ref:f,disabled:s||o,...d,children:[s&&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:Pe("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(mg,{className:a})})]}),e]})});ct.displayName="Button";function he(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e==null||e(s),n===!1||!s.defaultPrevented)return t==null?void 0:t(s)}}function Bn(e,t=[]){let n=[];function r(i,o){const a=w.createContext(o);a.displayName=i+"Context";const l=n.length;n=[...n,o];const d=u=>{var y;const{scope:g,children:h,...v}=u,p=((y=g==null?void 0:g[e])==null?void 0:y[l])||a,m=w.useMemo(()=>v,Object.values(v));return c.jsx(p.Provider,{value:m,children:h})};d.displayName=i+"Provider";function f(u,g){var p;const h=((p=g==null?void 0:g[e])==null?void 0:p[l])||a,v=w.useContext(h);if(v)return v;if(o!==void 0)return o;throw new Error(`\`${u}\` must be used within \`${i}\``)}return[d,f]}const s=()=>{const i=n.map(o=>w.createContext(o));return function(a){const l=(a==null?void 0:a[e])||i;return w.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return s.scopeName=e,[r,pg(s,...t)]}function pg(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const o=r.reduce((a,{useScope:l,scopeName:d})=>{const u=l(i)[`__scope${d}`];return{...a,...u}},{});return w.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}var Ie=globalThis!=null&&globalThis.document?w.useLayoutEffect:()=>{},hg=w[" useId ".trim().toString()]||(()=>{}),gg=0;function on(e){const[t,n]=w.useState(hg());return Ie(()=>{n(r=>r??String(gg++))},[e]),e||(t?`radix-${t}`:"")}var yg=w[" useInsertionEffect ".trim().toString()]||Ie;function Ln({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[s,i,o]=bg({defaultProp:t,onChange:n}),a=e!==void 0,l=a?e:s;{const f=w.useRef(e!==void 0);w.useEffect(()=>{const u=f.current;u!==a&&console.warn(`${r} is changing from ${u?"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.`),f.current=a},[a,r])}const d=w.useCallback(f=>{var u;if(a){const g=vg(f)?f(e):f;g!==e&&((u=o.current)==null||u.call(o,g))}else i(f)},[a,e,i,o]);return[l,d]}function bg({defaultProp:e,onChange:t}){const[n,r]=w.useState(e),s=w.useRef(n),i=w.useRef(t);return yg(()=>{i.current=t},[t]),w.useEffect(()=>{var o;s.current!==n&&((o=i.current)==null||o.call(i,n),s.current=n)},[n,s]),[n,r,i]}function vg(e){return typeof e=="function"}var wg=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ye=wg.reduce((e,t)=>{const n=mr(`Primitive.${t}`),r=w.forwardRef((s,i)=>{const{asChild:o,...a}=s,l=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(l,{...a,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Cu(e,t){e&&Cr.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 _g(e,t=globalThis==null?void 0:globalThis.document){const n=yt(e);w.useEffect(()=>{const r=s=>{s.key==="Escape"&&n(s)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var xg="DismissableLayer",Do="dismissableLayer.update",Sg="dismissableLayer.pointerDownOutside",Cg="dismissableLayer.focusOutside",tl,Ra=w.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),xi=w.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:a,onDismiss:l,...d}=e,f=w.useContext(Ra),[u,g]=w.useState(null),h=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,v]=w.useState({}),p=Ne(t,R=>g(R)),m=Array.from(f.layers),[y]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),b=m.indexOf(y),_=u?m.indexOf(u):-1,x=f.layersWithOutsidePointerEventsDisabled.size>0,T=_>=b,S=w.useRef(!1),E=Pg(R=>{const M=R.target;if(!(M instanceof Node))return;const N=[...f.branches].some(L=>L.contains(M));!T||N||(i==null||i(R),a==null||a(R),R.defaultPrevented||l==null||l())},{ownerDocument:h,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:S,dismissableSurfaces:f.dismissableSurfaces}),O=kg(R=>{if(r&&S.current)return;const M=R.target;[...f.branches].some(L=>L.contains(M))||(o==null||o(R),a==null||a(R),R.defaultPrevented||l==null||l())},h);return _g(R=>{_===f.layers.size-1&&(s==null||s(R),!R.defaultPrevented&&l&&(R.preventDefault(),l()))},h),w.useEffect(()=>{if(u)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(tl=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(u)),f.layers.add(u),nl(),()=>{n&&(f.layersWithOutsidePointerEventsDisabled.delete(u),f.layersWithOutsidePointerEventsDisabled.size===0&&(h.body.style.pointerEvents=tl))}},[u,h,n,f]),w.useEffect(()=>()=>{u&&(f.layers.delete(u),f.layersWithOutsidePointerEventsDisabled.delete(u),nl())},[u,f]),w.useEffect(()=>{const R=()=>v({});return document.addEventListener(Do,R),()=>document.removeEventListener(Do,R)},[]),c.jsx(ye.div,{...d,ref:p,style:{pointerEvents:x?T?"auto":"none":void 0,...e.style},onFocusCapture:he(e.onFocusCapture,O.onFocusCapture),onBlurCapture:he(e.onBlurCapture,O.onBlurCapture),onPointerDownCapture:he(e.onPointerDownCapture,E.onPointerDownCapture)})});xi.displayName=xg;var Tg="DismissableLayerBranch",Tu=w.forwardRef((e,t)=>{const n=w.useContext(Ra),r=w.useRef(null),s=Ne(t,r);return w.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),c.jsx(ye.div,{...e,ref:s})});Tu.displayName=Tg;function Eg(){const e=w.useContext(Ra),[t,n]=w.useState(null);return w.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}function Pg(e,t){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:s,dismissableSurfaces:i}=t,o=yt(e),a=w.useRef(!1),l=w.useRef(!1),d=w.useRef(new Map),f=w.useRef(()=>{});return w.useEffect(()=>{function u(){l.current=!1,s.current=!1,d.current.clear()}function g(){return Array.from(d.current.values()).some(Boolean)}function h(b){if(!l.current)return;const _=b.target;_ instanceof Node&&[...i].some(T=>T.contains(_))||d.current.set(b.type,!0),b.type==="click"&&window.setTimeout(()=>{l.current&&f.current()},0)}function v(b){l.current&&d.current.set(b.type,!1)}const p=b=>{if(b.target&&!a.current){let _=function(){n.removeEventListener("click",f.current);const T=g();u(),T||Eu(Sg,o,x,{discrete:!0})};const x={originalEvent:b};l.current=!0,s.current=r&&b.button===0,d.current.clear(),!r||b.button!==0?_():(n.removeEventListener("click",f.current),f.current=_,n.addEventListener("click",f.current,{once:!0}))}else n.removeEventListener("click",f.current),u();a.current=!1},m=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const b of m)n.addEventListener(b,h,!0),n.addEventListener(b,v);const y=window.setTimeout(()=>{n.addEventListener("pointerdown",p)},0);return()=>{window.clearTimeout(y),n.removeEventListener("pointerdown",p),n.removeEventListener("click",f.current);for(const b of m)n.removeEventListener(b,h,!0),n.removeEventListener(b,v)}},[n,o,r,s,i]),{onPointerDownCapture:()=>a.current=!0}}function kg(e,t=globalThis==null?void 0:globalThis.document){const n=yt(e),r=w.useRef(!1);return w.useEffect(()=>{const s=i=>{i.target&&!r.current&&Eu(Cg,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function nl(){const e=new CustomEvent(Do);document.dispatchEvent(e)}function Eu(e,t,n,{discrete:r}){const s=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?Cu(s,i):s.dispatchEvent(i)}var Ag=xi,Og=Tu,to="focusScope.autoFocusOnMount",no="focusScope.autoFocusOnUnmount",rl={bubbles:!1,cancelable:!0},Ng="FocusScope",La=w.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:i,...o}=e,[a,l]=w.useState(null),d=yt(s),f=yt(i),u=w.useRef(null),g=Ne(t,p=>l(p)),h=w.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;w.useEffect(()=>{if(r){let p=function(_){if(h.paused||!a)return;const x=_.target;a.contains(x)?u.current=x:Kt(u.current,{select:!0})},m=function(_){if(h.paused||!a)return;const x=_.relatedTarget;x!==null&&(a.contains(x)||Kt(u.current,{select:!0}))},y=function(_){if(document.activeElement===document.body)for(const T of _)T.removedNodes.length>0&&Kt(a)};document.addEventListener("focusin",p),document.addEventListener("focusout",m);const b=new MutationObserver(y);return a&&b.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",m),b.disconnect()}}},[r,a,h.paused]),w.useEffect(()=>{if(a){il.add(h);const p=document.activeElement;if(!a.contains(p)){const y=new CustomEvent(to,rl);a.addEventListener(to,d),a.dispatchEvent(y),y.defaultPrevented||(Rg(Mg(Pu(a)),{select:!0}),document.activeElement===p&&Kt(a))}return()=>{a.removeEventListener(to,d),setTimeout(()=>{const y=new CustomEvent(no,rl);a.addEventListener(no,f),a.dispatchEvent(y),y.defaultPrevented||Kt(p??document.body,{select:!0}),a.removeEventListener(no,f),il.remove(h)},0)}}},[a,d,f,h]);const v=w.useCallback(p=>{if(!n&&!r||h.paused)return;const m=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,y=document.activeElement;if(m&&y){const b=p.currentTarget,[_,x]=Lg(b);_&&x?!p.shiftKey&&y===x?(p.preventDefault(),n&&Kt(_,{select:!0})):p.shiftKey&&y===_&&(p.preventDefault(),n&&Kt(x,{select:!0})):y===b&&p.preventDefault()}},[n,r,h.paused]);return c.jsx(ye.div,{tabIndex:-1,...o,ref:g,onKeyDown:v})});La.displayName=Ng;function Rg(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Kt(r,{select:t}),document.activeElement!==n)return}function Lg(e){const t=Pu(e),n=sl(t,e),r=sl(t.reverse(),e);return[n,r]}function Pu(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function sl(e,t){for(const n of e)if(!Dg(n,{upTo:t}))return n}function Dg(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 jg(e){return e instanceof HTMLInputElement&&"select"in e}function Kt(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&jg(e)&&t&&e.select()}}var il=Ig();function Ig(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=ol(e,t),e.unshift(t)},remove(t){var n;e=ol(e,t),(n=e[0])==null||n.resume()}}}function ol(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Mg(e){return e.filter(t=>t.tagName!=="A")}var Fg="Portal",Si=w.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[s,i]=w.useState(!1);Ie(()=>i(!0),[]);const o=n||s&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?Cr.createPortal(c.jsx(ye.div,{...r,ref:t}),o):null});Si.displayName=Fg;function Ug(e,t){return w.useReducer((n,r)=>t[n][r]??n,e)}var $n=e=>{const{present:t,children:n}=e,r=Bg(t),s=typeof n=="function"?n({present:r.isPresent}):w.Children.only(n),i=$g(r.ref,Vg(s));return typeof n=="function"||r.isPresent?w.cloneElement(s,{ref:i}):null};$n.displayName="Presence";function Bg(e){const[t,n]=w.useState(),r=w.useRef(null),s=w.useRef(e),i=w.useRef("none"),o=e?"mounted":"unmounted",[a,l]=Ug(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{const d=Ss(r.current);i.current=a==="mounted"?d:"none"},[a]),Ie(()=>{const d=r.current,f=s.current;if(f!==e){const g=i.current,h=Ss(d);e?l("MOUNT"):h==="none"||(d==null?void 0:d.display)==="none"?l("UNMOUNT"):l(f&&g!==h?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,l]),Ie(()=>{if(t){let d;const f=t.ownerDocument.defaultView??window,u=h=>{const p=Ss(r.current).includes(CSS.escape(h.animationName));if(h.target===t&&p&&(l("ANIMATION_END"),!s.current)){const m=t.style.animationFillMode;t.style.animationFillMode="forwards",d=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=m)})}},g=h=>{h.target===t&&(i.current=Ss(r.current))};return t.addEventListener("animationstart",g),t.addEventListener("animationcancel",u),t.addEventListener("animationend",u),()=>{f.clearTimeout(d),t.removeEventListener("animationstart",g),t.removeEventListener("animationcancel",u),t.removeEventListener("animationend",u)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:w.useCallback(d=>{r.current=d?getComputedStyle(d):null,n(d)},[])}}function al(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function $g(...e){const t=w.useRef(e);return t.current=e,w.useCallback(n=>{const r=t.current;let s=!1;const i=r.map(o=>{const a=al(o,n);return!s&&typeof a=="function"&&(s=!0),a});if(s)return()=>{for(let o=0;o<i.length;o++){const a=i[o];typeof a=="function"?a():al(r[o],null)}}},[])}function Ss(e){return(e==null?void 0:e.animationName)||"none"}function Vg(e){var r,s;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=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Cs=0,St=null;function ku(){w.useEffect(()=>{St||(St={start:cl(),end:cl()});const{start:e,end:t}=St;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),Cs++,()=>{Cs===1&&(St==null||St.start.remove(),St==null||St.end.remove(),St=null),Cs=Math.max(0,Cs-1)}},[])}function cl(){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 kt=function(){return kt=Object.assign||function(t){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},kt.apply(this,arguments)};function Au(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 s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n}function Hg(e,t,n){if(n||arguments.length===2)for(var r=0,s=t.length,i;r<s;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var $s="right-scroll-bar-position",Vs="width-before-scroll-bar",zg="with-scroll-bars-hidden",Wg="--removed-body-scroll-bar-size";function ro(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Kg(e,t){var n=C.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var s=n.value;s!==r&&(n.value=r,n.callback(r,s))}}}})[0];return n.callback=t,n.facade}var qg=typeof window<"u"?w.useLayoutEffect:w.useEffect,ll=new WeakMap;function Gg(e,t){var n=Kg(null,function(r){return e.forEach(function(s){return ro(s,r)})});return qg(function(){var r=ll.get(n);if(r){var s=new Set(r),i=new Set(e),o=n.current;s.forEach(function(a){i.has(a)||ro(a,null)}),i.forEach(function(a){s.has(a)||ro(a,o)})}ll.set(n,e)},[e]),n}function Zg(e){return e}function Yg(e,t){t===void 0&&(t=Zg);var n=[],r=!1,s={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(i){var o=t(i,r);return n.push(o),function(){n=n.filter(function(a){return a!==o})}},assignSyncMedium:function(i){for(r=!0;n.length;){var o=n;n=[],o.forEach(i)}n={push:function(a){return i(a)},filter:function(){return n}}},assignMedium:function(i){r=!0;var o=[];if(n.length){var a=n;n=[],a.forEach(i),o=n}var l=function(){var f=o;o=[],f.forEach(i)},d=function(){return Promise.resolve().then(l)};d(),n={push:function(f){o.push(f),d()},filter:function(f){return o=o.filter(f),n}}}};return s}function Qg(e){e===void 0&&(e={});var t=Yg(null);return t.options=kt({async:!0,ssr:!1},e),t}var Ou=function(e){var t=e.sideCar,n=Au(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,kt({},n))};Ou.isSideCarExport=!0;function Xg(e,t){return e.useMedium(t),Ou}var Nu=Qg(),so=function(){},Ci=w.forwardRef(function(e,t){var n=w.useRef(null),r=w.useState({onScrollCapture:so,onWheelCapture:so,onTouchMoveCapture:so}),s=r[0],i=r[1],o=e.forwardProps,a=e.children,l=e.className,d=e.removeScrollBar,f=e.enabled,u=e.shards,g=e.sideCar,h=e.noRelative,v=e.noIsolation,p=e.inert,m=e.allowPinchZoom,y=e.as,b=y===void 0?"div":y,_=e.gapMode,x=Au(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),T=g,S=Gg([n,t]),E=kt(kt({},x),s);return w.createElement(w.Fragment,null,f&&w.createElement(T,{sideCar:Nu,removeScrollBar:d,shards:u,noRelative:h,noIsolation:v,inert:p,setCallbacks:i,allowPinchZoom:!!m,lockRef:n,gapMode:_}),o?w.cloneElement(w.Children.only(a),kt(kt({},E),{ref:S})):w.createElement(b,kt({},E,{className:l,ref:S}),a))});Ci.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Ci.classNames={fullWidth:Vs,zeroRight:$s};var Jg=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function ey(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Jg();return t&&e.setAttribute("nonce",t),e}function ty(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function ny(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var ry=function(){var e=0,t=null;return{add:function(n){e==0&&(t=ey())&&(ty(t,n),ny(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},sy=function(){var e=ry();return function(t,n){w.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Ru=function(){var e=sy(),t=function(n){var r=n.styles,s=n.dynamic;return e(r,s),null};return t},iy={left:0,top:0,right:0,gap:0},io=function(e){return parseInt(e||"",10)||0},oy=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[io(n),io(r),io(s)]},ay=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return iy;var t=oy(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])}},cy=Ru(),Xn="data-scroll-locked",ly=function(e,t,n,r){var s=e.left,i=e.top,o=e.right,a=e.gap;return n===void 0&&(n="margin"),`
|
|
2
|
+
.`.concat(zg,` {
|
|
3
3
|
overflow: hidden `).concat(r,`;
|
|
4
4
|
padding-right: `).concat(a,"px ").concat(r,`;
|
|
5
5
|
}
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
body[`).concat(Xn,`] {
|
|
36
|
-
`).concat(
|
|
36
|
+
`).concat(Wg,": ").concat(a,`px;
|
|
37
37
|
}
|
|
38
|
-
`)},
|
|
38
|
+
`)},dl=function(){var e=parseInt(document.body.getAttribute(Xn)||"0",10);return isFinite(e)?e:0},dy=function(){w.useEffect(function(){return document.body.setAttribute(Xn,(dl()+1).toString()),function(){var e=dl()-1;e<=0?document.body.removeAttribute(Xn):document.body.setAttribute(Xn,e.toString())}},[])},uy=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,s=r===void 0?"margin":r;dy();var i=w.useMemo(function(){return ay(s)},[s]);return w.createElement(cy,{styles:ly(i,!t,s,n?"":"!important")})},jo=!1;if(typeof window<"u")try{var Ts=Object.defineProperty({},"passive",{get:function(){return jo=!0,!0}});window.addEventListener("test",Ts,Ts),window.removeEventListener("test",Ts,Ts)}catch{jo=!1}var Hn=jo?{passive:!1}:!1,fy=function(e){return e.tagName==="TEXTAREA"},Lu=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!fy(e)&&n[t]==="visible")},my=function(e){return Lu(e,"overflowY")},py=function(e){return Lu(e,"overflowX")},ul=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=Du(e,r);if(s){var i=ju(e,r),o=i[1],a=i[2];if(o>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},hy=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},gy=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Du=function(e,t){return e==="v"?my(t):py(t)},ju=function(e,t){return e==="v"?hy(t):gy(t)},yy=function(e,t){return e==="h"&&t==="rtl"?-1:1},by=function(e,t,n,r,s){var i=yy(e,window.getComputedStyle(t).direction),o=i*r,a=n.target,l=t.contains(a),d=!1,f=o>0,u=0,g=0;do{if(!a)break;var h=ju(e,a),v=h[0],p=h[1],m=h[2],y=p-m-i*v;(v||y)&&Du(e,a)&&(u+=y,g+=v);var b=a.parentNode;a=b&&b.nodeType===Node.DOCUMENT_FRAGMENT_NODE?b.host:b}while(!l&&a!==document.body||l&&(t.contains(a)||t===a));return(f&&Math.abs(u)<1||!f&&Math.abs(g)<1)&&(d=!0),d},Es=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},fl=function(e){return[e.deltaX,e.deltaY]},ml=function(e){return e&&"current"in e?e.current:e},vy=function(e,t){return e[0]===t[0]&&e[1]===t[1]},wy=function(e){return`
|
|
39
39
|
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
40
40
|
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
41
|
-
`)},vy=0,zn=[];function wy(e){var t=w.useRef([]),n=w.useRef([0,0]),r=w.useRef(),s=w.useState(vy++)[0],i=w.useState(Au)[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(s));var m=$g([e.lockRef.current],(e.shards||[]).map(dl),!0).filter(Boolean);return m.forEach(function(h){return h.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),m.forEach(function(h){return h.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var a=w.useCallback(function(m,h){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!o.current.allowPinchZoom;var v=Es(m),b=n.current,_="deltaX"in m?m.deltaX:b[0]-v[0],x="deltaY"in m?m.deltaY:b[1]-v[1],P,C=m.target,E=Math.abs(_)>Math.abs(x)?"h":"v";if("touches"in m&&E==="h"&&C.type==="range")return!1;var A=window.getSelection(),R=A&&A.anchorNode,M=R?R===C||R.contains(C):!1;if(M)return!1;var N=cl(E,C);if(!N)return!0;if(N?P=E:(P=E==="v"?"h":"v",N=cl(E,C)),!N)return!1;if(!r.current&&"changedTouches"in m&&(_||x)&&(r.current=P),!P)return!0;var L=r.current||P;return gy(L,h,m,L==="h"?_:x)},[]),l=w.useCallback(function(m){var h=m;if(!(!zn.length||zn[zn.length-1]!==i)){var v="deltaY"in h?ll(h):Es(h),b=t.current.filter(function(P){return P.name===h.type&&(P.target===h.target||h.target===P.shadowParent)&&yy(P.delta,v)})[0];if(b&&b.should){h.cancelable&&h.preventDefault();return}if(!b){var _=(o.current.shards||[]).map(dl).filter(Boolean).filter(function(P){return P.contains(h.target)}),x=_.length>0?a(h,_[0]):!o.current.noIsolation;x&&h.cancelable&&h.preventDefault()}}},[]),d=w.useCallback(function(m,h,v,b){var _={name:m,delta:h,target:v,should:b,shadowParent:_y(v)};t.current.push(_),setTimeout(function(){t.current=t.current.filter(function(x){return x!==_})},1)},[]),f=w.useCallback(function(m){n.current=Es(m),r.current=void 0},[]),u=w.useCallback(function(m){d(m.type,ll(m),m.target,a(m,e.lockRef.current))},[]),y=w.useCallback(function(m){d(m.type,Es(m),m.target,a(m,e.lockRef.current))},[]);w.useEffect(function(){return zn.push(i),e.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:y}),document.addEventListener("wheel",l,Hn),document.addEventListener("touchmove",l,Hn),document.addEventListener("touchstart",f,Hn),function(){zn=zn.filter(function(m){return m!==i}),document.removeEventListener("wheel",l,Hn),document.removeEventListener("touchmove",l,Hn),document.removeEventListener("touchstart",f,Hn)}},[]);var p=e.removeScrollBar,g=e.inert;return w.createElement(w.Fragment,null,g?w.createElement(i,{styles:by(s)}):null,p?w.createElement(ly,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function _y(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const xy=Yg(ku,wy);var Na=w.forwardRef(function(e,t){return w.createElement(Ci,kt({},e,{ref:t,sideCar:xy}))});Na.classNames=Ci.classNames;var Sy=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Wn=new WeakMap,Ps=new WeakMap,ks={},oo=0,Lu=function(e){return e&&(e.host||Lu(e.parentNode))},Cy=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Lu(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})},Ty=function(e,t,n,r){var s=Cy(t,Array.isArray(e)?e:[e]);ks[n]||(ks[n]=new WeakMap);var i=ks[n],o=[],a=new Set,l=new Set(s),d=function(u){!u||a.has(u)||(a.add(u),d(u.parentNode))};s.forEach(d);var f=function(u){!u||l.has(u)||Array.prototype.forEach.call(u.children,function(y){if(a.has(y))f(y);else try{var p=y.getAttribute(r),g=p!==null&&p!=="false",m=(Wn.get(y)||0)+1,h=(i.get(y)||0)+1;Wn.set(y,m),i.set(y,h),o.push(y),m===1&&g&&Ps.set(y,!0),h===1&&y.setAttribute(n,"true"),g||y.setAttribute(r,"true")}catch(v){console.error("aria-hidden: cannot operate on ",y,v)}})};return f(t),a.clear(),oo++,function(){o.forEach(function(u){var y=Wn.get(u)-1,p=i.get(u)-1;Wn.set(u,y),i.set(u,p),y||(Ps.has(u)||u.removeAttribute(r),Ps.delete(u)),p||u.removeAttribute(n)}),oo--,oo||(Wn=new WeakMap,Wn=new WeakMap,Ps=new WeakMap,ks={})}},Du=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=Sy(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),Ty(r,s,n,"aria-hidden")):function(){return null}},Ti="Dialog",[ju]=Bn(Ti),[Ey,wt]=ju(Ti),Iu=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:o=!0}=e,a=w.useRef(null),l=w.useRef(null),[d,f]=Ln({prop:r,defaultProp:s??!1,onChange:i,caller:Ti});return c.jsx(Ey,{scope:t,triggerRef:a,contentRef:l,contentId:on(),titleId:on(),descriptionId:on(),open:d,onOpenChange:f,onOpenToggle:w.useCallback(()=>f(u=>!u),[f]),modal:o,children:n})};Iu.displayName=Ti;var Mu="DialogTrigger",Py=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=wt(Mu,n),i=Oe(t,s.triggerRef);return c.jsx(he.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":Ma(s.open),...r,ref:i,onClick:me(e.onClick,s.onOpenToggle)})});Py.displayName=Mu;var Ra="DialogPortal",[ky,Fu]=ju(Ra,{forceMount:void 0}),Uu=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:s}=e,i=wt(Ra,t);return c.jsx(ky,{scope:t,forceMount:n,children:w.Children.map(r,o=>c.jsx($n,{present:n||i.open,children:c.jsx(Si,{asChild:!0,container:s,children:o})}))})};Uu.displayName=Ra;var Xs="DialogOverlay",La=w.forwardRef((e,t)=>{const n=Fu(Xs,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,i=wt(Xs,e.__scopeDialog);return i.modal?c.jsx($n,{present:r||i.open,children:c.jsx(Oy,{...s,ref:t})}):null});La.displayName=Xs;var Ay=mr("DialogOverlay.RemoveScroll"),Oy=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=wt(Xs,n),i=Cg(),o=Oe(t,i);return c.jsx(Na,{as:Ay,allowPinchZoom:!0,shards:[s.contentRef],children:c.jsx(he.div,{"data-state":Ma(s.open),...r,ref:o,style:{pointerEvents:"auto",...r.style}})})}),pr="DialogContent",Da=w.forwardRef((e,t)=>{const n=Fu(pr,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,i=wt(pr,e.__scopeDialog);return c.jsx($n,{present:r||i.open,children:i.modal?c.jsx(Ny,{...s,ref:t}):c.jsx(Ry,{...s,ref:t})})});Da.displayName=pr;var Ny=w.forwardRef((e,t)=>{const n=wt(pr,e.__scopeDialog),r=w.useRef(null),s=Oe(t,n.contentRef,r);return w.useEffect(()=>{const i=r.current;if(i)return Du(i)},[]),c.jsx(Bu,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:me(e.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:me(e.onPointerDownOutside,i=>{const o=i.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&i.preventDefault()}),onFocusOutside:me(e.onFocusOutside,i=>i.preventDefault())})}),Ry=w.forwardRef((e,t)=>{const n=wt(pr,e.__scopeDialog),r=w.useRef(!1),s=w.useRef(!1);return c.jsx(Bu,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,a;(o=e.onCloseAutoFocus)==null||o.call(e,i),i.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{var l,d;(l=e.onInteractOutside)==null||l.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=i.target;((d=n.triggerRef.current)==null?void 0:d.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),Bu=w.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,...o}=e,a=wt(pr,n);return Tu(),c.jsx(c.Fragment,{children:c.jsx(Oa,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:c.jsx(xi,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":Ma(a.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>a.onOpenChange(!1)})})})}),$u="DialogTitle",ja=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=wt($u,n);return c.jsx(he.h2,{id:s.titleId,...r,ref:t})});ja.displayName=$u;var Vu="DialogDescription",Ia=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=wt(Vu,n);return c.jsx(he.p,{id:s.descriptionId,...r,ref:t})});Ia.displayName=Vu;var Hu="DialogClose",Ly=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=wt(Hu,n);return c.jsx(he.button,{type:"button",...r,ref:t,onClick:me(e.onClick,()=>s.onOpenChange(!1))})});Ly.displayName=Hu;function Ma(e){return e?"open":"closed"}const Dy=Iu,jy=Uu,zu=w.forwardRef(({className:e,...t},n)=>c.jsx(La,{ref:n,className:Ee("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}));zu.displayName=La.displayName;const Wu=w.forwardRef(({className:e,overlayClass:t,children:n,...r},s)=>c.jsxs(jy,{children:[c.jsx(zu,{className:t}),c.jsx(Da,{ref:s,className:Ee("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})]}));Wu.displayName=Da.displayName;const Ku=({className:e,...t})=>c.jsx("div",{className:Ee("flex flex-col space-y-1.5 border-b text-center sm:text-left",e),...t});Ku.displayName="DialogHeader";const qu=({className:e,...t})=>c.jsx("div",{className:Ee("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});qu.displayName="DialogFooter";const Gu=w.forwardRef(({className:e,...t},n)=>c.jsx(ja,{ref:n,className:Ee("text-lg font-semibold leading-none tracking-tight",e),...t}));Gu.displayName=ja.displayName;const Zu=w.forwardRef(({className:e,...t},n)=>c.jsx(Ia,{ref:n,className:Ee("text-sm text-muted-foreground",e),...t}));Zu.displayName=Ia.displayName;function ul(e,[t,n]){return Math.min(n,Math.max(t,e))}function Fa(e){const t=e+"CollectionProvider",[n,r]=Bn(t),[s,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=m=>{const{scope:h,children:v}=m,b=w.useRef(null),_=w.useRef(new Map).current;return c.jsx(s,{scope:h,itemMap:_,collectionRef:b,children:v})};o.displayName=t;const a=e+"CollectionSlot",l=mr(a),d=w.forwardRef((m,h)=>{const{scope:v,children:b}=m,_=i(a,v),x=Oe(h,_.collectionRef);return c.jsx(l,{ref:x,children:b})});d.displayName=a;const f=e+"CollectionItemSlot",u="data-radix-collection-item",y=mr(f),p=w.forwardRef((m,h)=>{const{scope:v,children:b,..._}=m,x=w.useRef(null),P=Oe(h,x),C=i(f,v);return w.useEffect(()=>(C.itemMap.set(x,{ref:x,..._}),()=>void C.itemMap.delete(x))),c.jsx(y,{[u]:"",ref:P,children:b})});p.displayName=f;function g(m){const h=i(e+"CollectionConsumer",m);return w.useCallback(()=>{const b=h.collectionRef.current;if(!b)return[];const _=Array.from(b.querySelectorAll(`[${u}]`));return Array.from(h.itemMap.values()).sort((C,E)=>_.indexOf(C.ref.current)-_.indexOf(E.ref.current))},[h.collectionRef,h.itemMap])}return[{Provider:o,Slot:d,ItemSlot:p},g,r]}var Iy=w.createContext(void 0);function Yu(e){const t=w.useContext(Iy);return e||t||"ltr"}const My=["top","right","bottom","left"],ln=Math.min,nt=Math.max,Js=Math.round,As=Math.floor,Ot=e=>({x:e,y:e}),Fy={left:"right",right:"left",bottom:"top",top:"bottom"};function Do(e,t,n){return nt(e,ln(t,n))}function Mt(e,t){return typeof e=="function"?e(t):e}function Ft(e){return e.split("-")[0]}function Tr(e){return e.split("-")[1]}function Ua(e){return e==="x"?"y":"x"}function Ba(e){return e==="y"?"height":"width"}function At(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function $a(e){return Ua(At(e))}function Uy(e,t,n){n===void 0&&(n=!1);const r=Tr(e),s=$a(e),i=Ba(s);let o=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(o=ei(o)),[o,ei(o)]}function By(e){const t=ei(e);return[jo(e),t,jo(t)]}function jo(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const fl=["left","right"],ml=["right","left"],$y=["top","bottom"],Vy=["bottom","top"];function Hy(e,t,n){switch(e){case"top":case"bottom":return n?t?ml:fl:t?fl:ml;case"left":case"right":return t?$y:Vy;default:return[]}}function zy(e,t,n,r){const s=Tr(e);let i=Hy(Ft(e),n==="start",r);return s&&(i=i.map(o=>o+"-"+s),t&&(i=i.concat(i.map(jo)))),i}function ei(e){const t=Ft(e);return Fy[t]+e.slice(t.length)}function Wy(e){return{top:0,right:0,bottom:0,left:0,...e}}function Qu(e){return typeof e!="number"?Wy(e):{top:e,right:e,bottom:e,left:e}}function ti(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function pl(e,t,n){let{reference:r,floating:s}=e;const i=At(t),o=$a(t),a=Ba(o),l=Ft(t),d=i==="y",f=r.x+r.width/2-s.width/2,u=r.y+r.height/2-s.height/2,y=r[a]/2-s[a]/2;let p;switch(l){case"top":p={x:f,y:r.y-s.height};break;case"bottom":p={x:f,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:u};break;case"left":p={x:r.x-s.width,y:u};break;default:p={x:r.x,y:r.y}}switch(Tr(t)){case"start":p[o]-=y*(n&&d?-1:1);break;case"end":p[o]+=y*(n&&d?-1:1);break}return p}async function Ky(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:i,rects:o,elements:a,strategy:l}=e,{boundary:d="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:y=!1,padding:p=0}=Mt(t,e),g=Qu(p),h=a[y?u==="floating"?"reference":"floating":u],v=ti(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(h)))==null||n?h:h.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:d,rootBoundary:f,strategy:l})),b=u==="floating"?{x:r,y:s,width:o.floating.width,height:o.floating.height}:o.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),x=await(i.isElement==null?void 0:i.isElement(_))?await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1}:{x:1,y:1},P=ti(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:b,offsetParent:_,strategy:l}):b);return{top:(v.top-P.top+g.top)/x.y,bottom:(P.bottom-v.bottom+g.bottom)/x.y,left:(v.left-P.left+g.left)/x.x,right:(P.right-v.right+g.right)/x.x}}const qy=50,Gy=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:o}=n,a=o.detectOverflow?o:{...o,detectOverflow:Ky},l=await(o.isRTL==null?void 0:o.isRTL(t));let d=await o.getElementRects({reference:e,floating:t,strategy:s}),{x:f,y:u}=pl(d,r,l),y=r,p=0;const g={};for(let m=0;m<i.length;m++){const h=i[m];if(!h)continue;const{name:v,fn:b}=h,{x:_,y:x,data:P,reset:C}=await b({x:f,y:u,initialPlacement:r,placement:y,strategy:s,middlewareData:g,rects:d,platform:a,elements:{reference:e,floating:t}});f=_??f,u=x??u,g[v]={...g[v],...P},C&&p<qy&&(p++,typeof C=="object"&&(C.placement&&(y=C.placement),C.rects&&(d=C.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:s}):C.rects),{x:f,y:u}=pl(d,y,l)),m=-1)}return{x:f,y:u,placement:y,strategy:s,middlewareData:g}},Zy=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:i,platform:o,elements:a,middlewareData:l}=t,{element:d,padding:f=0}=Mt(e,t)||{};if(d==null)return{};const u=Qu(f),y={x:n,y:r},p=$a(s),g=Ba(p),m=await o.getDimensions(d),h=p==="y",v=h?"top":"left",b=h?"bottom":"right",_=h?"clientHeight":"clientWidth",x=i.reference[g]+i.reference[p]-y[p]-i.floating[g],P=y[p]-i.reference[p],C=await(o.getOffsetParent==null?void 0:o.getOffsetParent(d));let E=C?C[_]:0;(!E||!await(o.isElement==null?void 0:o.isElement(C)))&&(E=a.floating[_]||i.floating[g]);const A=x/2-P/2,R=E/2-m[g]/2-1,M=ln(u[v],R),N=ln(u[b],R),L=M,H=E-m[g]-N,D=E/2-m[g]/2+A,F=Do(L,D,H),I=!l.arrow&&Tr(s)!=null&&D!==F&&i.reference[g]/2-(D<L?M:N)-m[g]/2<0,U=I?D<L?D-L:D-H:0;return{[p]:y[p]+U,data:{[p]:F,centerOffset:D-F-U,...I&&{alignmentOffset:U}},reset:I}}}),Yy=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:i,rects:o,initialPlacement:a,platform:l,elements:d}=t,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:y,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:m=!0,...h}=Mt(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const v=Ft(s),b=At(a),_=Ft(a)===a,x=await(l.isRTL==null?void 0:l.isRTL(d.floating)),P=y||(_||!m?[ei(a)]:By(a)),C=g!=="none";!y&&C&&P.push(...zy(a,m,g,x));const E=[a,...P],A=await l.detectOverflow(t,h),R=[];let M=((r=i.flip)==null?void 0:r.overflows)||[];if(f&&R.push(A[v]),u){const D=Uy(s,o,x);R.push(A[D[0]],A[D[1]])}if(M=[...M,{placement:s,overflows:R}],!R.every(D=>D<=0)){var N,L;const D=(((N=i.flip)==null?void 0:N.index)||0)+1,F=E[D];if(F&&(!(u==="alignment"?b!==At(F):!1)||M.every(O=>At(O.placement)===b?O.overflows[0]>0:!0)))return{data:{index:D,overflows:M},reset:{placement:F}};let I=(L=M.filter(U=>U.overflows[0]<=0).sort((U,O)=>U.overflows[1]-O.overflows[1])[0])==null?void 0:L.placement;if(!I)switch(p){case"bestFit":{var H;const U=(H=M.filter(O=>{if(C){const B=At(O.placement);return B===b||B==="y"}return!0}).map(O=>[O.placement,O.overflows.filter(B=>B>0).reduce((B,W)=>B+W,0)]).sort((O,B)=>O[1]-B[1])[0])==null?void 0:H[0];U&&(I=U);break}case"initialPlacement":I=a;break}if(s!==I)return{reset:{placement:I}}}return{}}}};function hl(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function gl(e){return My.some(t=>e[t]>=0)}const Qy=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:s="referenceHidden",...i}=Mt(e,t);switch(s){case"referenceHidden":{const o=await r.detectOverflow(t,{...i,elementContext:"reference"}),a=hl(o,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:gl(a)}}}case"escaped":{const o=await r.detectOverflow(t,{...i,altBoundary:!0}),a=hl(o,n.floating);return{data:{escapedOffsets:a,escaped:gl(a)}}}default:return{}}}}},Xu=new Set(["left","top"]);async function Xy(e,t){const{placement:n,platform:r,elements:s}=e,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),o=Ft(n),a=Tr(n),l=At(n)==="y",d=Xu.has(o)?-1:1,f=i&&l?-1:1,u=Mt(t,e);let{mainAxis:y,crossAxis:p,alignmentAxis:g}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return a&&typeof g=="number"&&(p=a==="end"?g*-1:g),l?{x:p*f,y:y*d}:{x:y*d,y:p*f}}const Jy=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:i,placement:o,middlewareData:a}=t,l=await Xy(t,e);return o===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:s+l.x,y:i+l.y,data:{...l,placement:o}}}}},eb=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s,platform:i}=t,{mainAxis:o=!0,crossAxis:a=!1,limiter:l={fn:v=>{let{x:b,y:_}=v;return{x:b,y:_}}},...d}=Mt(e,t),f={x:n,y:r},u=await i.detectOverflow(t,d),y=At(Ft(s)),p=Ua(y);let g=f[p],m=f[y];if(o){const v=p==="y"?"top":"left",b=p==="y"?"bottom":"right",_=g+u[v],x=g-u[b];g=Do(_,g,x)}if(a){const v=y==="y"?"top":"left",b=y==="y"?"bottom":"right",_=m+u[v],x=m-u[b];m=Do(_,m,x)}const h=l.fn({...t,[p]:g,[y]:m});return{...h,data:{x:h.x-n,y:h.y-r,enabled:{[p]:o,[y]:a}}}}}},tb=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:s,rects:i,middlewareData:o}=t,{offset:a=0,mainAxis:l=!0,crossAxis:d=!0}=Mt(e,t),f={x:n,y:r},u=At(s),y=Ua(u);let p=f[y],g=f[u];const m=Mt(a,t),h=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const _=y==="y"?"height":"width",x=i.reference[y]-i.floating[_]+h.mainAxis,P=i.reference[y]+i.reference[_]-h.mainAxis;p<x?p=x:p>P&&(p=P)}if(d){var v,b;const _=y==="y"?"width":"height",x=Xu.has(Ft(s)),P=i.reference[u]-i.floating[_]+(x&&((v=o.offset)==null?void 0:v[u])||0)+(x?0:h.crossAxis),C=i.reference[u]+i.reference[_]+(x?0:((b=o.offset)==null?void 0:b[u])||0)-(x?h.crossAxis:0);g<P?g=P:g>C&&(g=C)}return{[y]:p,[u]:g}}}},nb=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:s,rects:i,platform:o,elements:a}=t,{apply:l=()=>{},...d}=Mt(e,t),f=await o.detectOverflow(t,d),u=Ft(s),y=Tr(s),p=At(s)==="y",{width:g,height:m}=i.floating;let h,v;u==="top"||u==="bottom"?(h=u,v=y===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(v=u,h=y==="end"?"top":"bottom");const b=m-f.top-f.bottom,_=g-f.left-f.right,x=ln(m-f[h],b),P=ln(g-f[v],_),C=!t.middlewareData.shift;let E=x,A=P;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(A=_),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(E=b),C&&!y){const M=nt(f.left,0),N=nt(f.right,0),L=nt(f.top,0),H=nt(f.bottom,0);p?A=g-2*(M!==0||N!==0?M+N:nt(f.left,f.right)):E=m-2*(L!==0||H!==0?L+H:nt(f.top,f.bottom))}await l({...t,availableWidth:A,availableHeight:E});const R=await o.getDimensions(a.floating);return g!==R.width||m!==R.height?{reset:{rects:!0}}:{}}}};function Ei(){return typeof window<"u"}function Er(e){return Ju(e)?(e.nodeName||"").toLowerCase():"#document"}function rt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Rt(e){var t;return(t=(Ju(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Ju(e){return Ei()?e instanceof Node||e instanceof rt(e).Node:!1}function bt(e){return Ei()?e instanceof Element||e instanceof rt(e).Element:!1}function $t(e){return Ei()?e instanceof HTMLElement||e instanceof rt(e).HTMLElement:!1}function yl(e){return!Ei()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof rt(e).ShadowRoot}function os(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=vt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&s!=="inline"&&s!=="contents"}function rb(e){return/^(table|td|th)$/.test(Er(e))}function Pi(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const sb=/transform|translate|scale|rotate|perspective|filter/,ib=/paint|layout|strict|content/,yn=e=>!!e&&e!=="none";let ao;function Va(e){const t=bt(e)?vt(e):e;return yn(t.transform)||yn(t.translate)||yn(t.scale)||yn(t.rotate)||yn(t.perspective)||!Ha()&&(yn(t.backdropFilter)||yn(t.filter))||sb.test(t.willChange||"")||ib.test(t.contain||"")}function ob(e){let t=dn(e);for(;$t(t)&&!hr(t);){if(Va(t))return t;if(Pi(t))return null;t=dn(t)}return null}function Ha(){return ao==null&&(ao=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),ao}function hr(e){return/^(html|body|#document)$/.test(Er(e))}function vt(e){return rt(e).getComputedStyle(e)}function ki(e){return bt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function dn(e){if(Er(e)==="html")return e;const t=e.assignedSlot||e.parentNode||yl(e)&&e.host||Rt(e);return yl(t)?t.host:t}function ef(e){const t=dn(e);return hr(t)?e.ownerDocument?e.ownerDocument.body:e.body:$t(t)&&os(t)?t:ef(t)}function Wr(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=ef(e),i=s===((r=e.ownerDocument)==null?void 0:r.body),o=rt(s);if(i){const a=Io(o);return t.concat(o,o.visualViewport||[],os(s)?s:[],a&&n?Wr(a):[])}else return t.concat(s,Wr(s,[],n))}function Io(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function tf(e){const t=vt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=$t(e),i=s?e.offsetWidth:n,o=s?e.offsetHeight:r,a=Js(n)!==i||Js(r)!==o;return a&&(n=i,r=o),{width:n,height:r,$:a}}function za(e){return bt(e)?e:e.contextElement}function Jn(e){const t=za(e);if(!$t(t))return Ot(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:i}=tf(t);let o=(i?Js(n.width):n.width)/r,a=(i?Js(n.height):n.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const ab=Ot(0);function nf(e){const t=rt(e);return!Ha()||!t.visualViewport?ab:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function cb(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==rt(e)?!1:t}function Dn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),i=za(e);let o=Ot(1);t&&(r?bt(r)&&(o=Jn(r)):o=Jn(e));const a=cb(i,n,r)?nf(i):Ot(0);let l=(s.left+a.x)/o.x,d=(s.top+a.y)/o.y,f=s.width/o.x,u=s.height/o.y;if(i){const y=rt(i),p=r&&bt(r)?rt(r):r;let g=y,m=Io(g);for(;m&&r&&p!==g;){const h=Jn(m),v=m.getBoundingClientRect(),b=vt(m),_=v.left+(m.clientLeft+parseFloat(b.paddingLeft))*h.x,x=v.top+(m.clientTop+parseFloat(b.paddingTop))*h.y;l*=h.x,d*=h.y,f*=h.x,u*=h.y,l+=_,d+=x,g=rt(m),m=Io(g)}}return ti({width:f,height:u,x:l,y:d})}function Ai(e,t){const n=ki(e).scrollLeft;return t?t.left+n:Dn(Rt(e)).left+n}function rf(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Ai(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function lb(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const i=s==="fixed",o=Rt(r),a=t?Pi(t.floating):!1;if(r===o||a&&i)return n;let l={scrollLeft:0,scrollTop:0},d=Ot(1);const f=Ot(0),u=$t(r);if((u||!u&&!i)&&((Er(r)!=="body"||os(o))&&(l=ki(r)),u)){const p=Dn(r);d=Jn(r),f.x=p.x+r.clientLeft,f.y=p.y+r.clientTop}const y=o&&!u&&!i?rf(o,l):Ot(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-l.scrollLeft*d.x+f.x+y.x,y:n.y*d.y-l.scrollTop*d.y+f.y+y.y}}function db(e){return Array.from(e.getClientRects())}function ub(e){const t=Rt(e),n=ki(e),r=e.ownerDocument.body,s=nt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=nt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+Ai(e);const a=-n.scrollTop;return vt(r).direction==="rtl"&&(o+=nt(t.clientWidth,r.clientWidth)-s),{width:s,height:i,x:o,y:a}}const bl=25;function fb(e,t){const n=rt(e),r=Rt(e),s=n.visualViewport;let i=r.clientWidth,o=r.clientHeight,a=0,l=0;if(s){i=s.width,o=s.height;const f=Ha();(!f||f&&t==="fixed")&&(a=s.offsetLeft,l=s.offsetTop)}const d=Ai(r);if(d<=0){const f=r.ownerDocument,u=f.body,y=getComputedStyle(u),p=f.compatMode==="CSS1Compat"&&parseFloat(y.marginLeft)+parseFloat(y.marginRight)||0,g=Math.abs(r.clientWidth-u.clientWidth-p);g<=bl&&(i-=g)}else d<=bl&&(i+=d);return{width:i,height:o,x:a,y:l}}function mb(e,t){const n=Dn(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,i=$t(e)?Jn(e):Ot(1),o=e.clientWidth*i.x,a=e.clientHeight*i.y,l=s*i.x,d=r*i.y;return{width:o,height:a,x:l,y:d}}function vl(e,t,n){let r;if(t==="viewport")r=fb(e,n);else if(t==="document")r=ub(Rt(e));else if(bt(t))r=mb(t,n);else{const s=nf(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return ti(r)}function sf(e,t){const n=dn(e);return n===t||!bt(n)||hr(n)?!1:vt(n).position==="fixed"||sf(n,t)}function pb(e,t){const n=t.get(e);if(n)return n;let r=Wr(e,[],!1).filter(a=>bt(a)&&Er(a)!=="body"),s=null;const i=vt(e).position==="fixed";let o=i?dn(e):e;for(;bt(o)&&!hr(o);){const a=vt(o),l=Va(o);!l&&a.position==="fixed"&&(s=null),(i?!l&&!s:!l&&a.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||os(o)&&!l&&sf(e,o))?r=r.filter(f=>f!==o):s=a,o=dn(o)}return t.set(e,r),r}function hb(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const o=[...n==="clippingAncestors"?Pi(t)?[]:pb(t,this._c):[].concat(n),r],a=vl(t,o[0],s);let l=a.top,d=a.right,f=a.bottom,u=a.left;for(let y=1;y<o.length;y++){const p=vl(t,o[y],s);l=nt(p.top,l),d=ln(p.right,d),f=ln(p.bottom,f),u=nt(p.left,u)}return{width:d-u,height:f-l,x:u,y:l}}function gb(e){const{width:t,height:n}=tf(e);return{width:t,height:n}}function yb(e,t,n){const r=$t(t),s=Rt(t),i=n==="fixed",o=Dn(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=Ot(0);function d(){l.x=Ai(s)}if(r||!r&&!i)if((Er(t)!=="body"||os(s))&&(a=ki(t)),r){const p=Dn(t,!0,i,t);l.x=p.x+t.clientLeft,l.y=p.y+t.clientTop}else s&&d();i&&!r&&s&&d();const f=s&&!r&&!i?rf(s,a):Ot(0),u=o.left+a.scrollLeft-l.x-f.x,y=o.top+a.scrollTop-l.y-f.y;return{x:u,y,width:o.width,height:o.height}}function co(e){return vt(e).position==="static"}function wl(e,t){if(!$t(e)||vt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Rt(e)===n&&(n=n.ownerDocument.body),n}function of(e,t){const n=rt(e);if(Pi(e))return n;if(!$t(e)){let s=dn(e);for(;s&&!hr(s);){if(bt(s)&&!co(s))return s;s=dn(s)}return n}let r=wl(e,t);for(;r&&rb(r)&&co(r);)r=wl(r,t);return r&&hr(r)&&co(r)&&!Va(r)?n:r||ob(e)||n}const bb=async function(e){const t=this.getOffsetParent||of,n=this.getDimensions,r=await n(e.floating);return{reference:yb(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function vb(e){return vt(e).direction==="rtl"}const wb={convertOffsetParentRelativeRectToViewportRelativeRect:lb,getDocumentElement:Rt,getClippingRect:hb,getOffsetParent:of,getElementRects:bb,getClientRects:db,getDimensions:gb,getScale:Jn,isElement:bt,isRTL:vb};function af(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function _b(e,t){let n=null,r;const s=Rt(e);function i(){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),i();const d=e.getBoundingClientRect(),{left:f,top:u,width:y,height:p}=d;if(a||t(),!y||!p)return;const g=As(u),m=As(s.clientWidth-(f+y)),h=As(s.clientHeight-(u+p)),v=As(f),_={rootMargin:-g+"px "+-m+"px "+-h+"px "+-v+"px",threshold:nt(0,ln(1,l))||1};let x=!0;function P(C){const E=C[0].intersectionRatio;if(E!==l){if(!x)return o();E?o(!1,E):r=setTimeout(()=>{o(!1,1e-7)},1e3)}E===1&&!af(d,e.getBoundingClientRect())&&o(),x=!1}try{n=new IntersectionObserver(P,{..._,root:s.ownerDocument})}catch{n=new IntersectionObserver(P,_)}n.observe(e)}return o(!0),i}function xb(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,d=za(e),f=s||i?[...d?Wr(d):[],...t?Wr(t):[]]:[];f.forEach(v=>{s&&v.addEventListener("scroll",n,{passive:!0}),i&&v.addEventListener("resize",n)});const u=d&&a?_b(d,n):null;let y=-1,p=null;o&&(p=new ResizeObserver(v=>{let[b]=v;b&&b.target===d&&p&&t&&(p.unobserve(t),cancelAnimationFrame(y),y=requestAnimationFrame(()=>{var _;(_=p)==null||_.observe(t)})),n()}),d&&!l&&p.observe(d),t&&p.observe(t));let g,m=l?Dn(e):null;l&&h();function h(){const v=Dn(e);m&&!af(m,v)&&n(),m=v,g=requestAnimationFrame(h)}return n(),()=>{var v;f.forEach(b=>{s&&b.removeEventListener("scroll",n),i&&b.removeEventListener("resize",n)}),u==null||u(),(v=p)==null||v.disconnect(),p=null,l&&cancelAnimationFrame(g)}}const Sb=Jy,Cb=eb,Tb=Yy,Eb=nb,Pb=Qy,_l=Zy,kb=tb,Ab=(e,t,n)=>{const r=new Map,s={platform:wb,...n},i={...s.platform,_c:r};return Gy(e,t,{...s,platform:i})};var Ob=typeof document<"u",Nb=function(){},Hs=Ob?S.useLayoutEffect:Nb;function ni(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,s;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(!ni(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const i=s[r];if(!(i==="_owner"&&e.$$typeof)&&!ni(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function cf(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function xl(e,t){const n=cf(e);return Math.round(t*n)/n}function lo(e){const t=w.useRef(e);return Hs(()=>{t.current=e}),t}function Rb(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:i,floating:o}={},transform:a=!0,whileElementsMounted:l,open:d}=e,[f,u]=w.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[y,p]=w.useState(r);ni(y,r)||p(r);const[g,m]=w.useState(null),[h,v]=w.useState(null),b=w.useCallback(O=>{O!==C.current&&(C.current=O,m(O))},[]),_=w.useCallback(O=>{O!==E.current&&(E.current=O,v(O))},[]),x=i||g,P=o||h,C=w.useRef(null),E=w.useRef(null),A=w.useRef(f),R=l!=null,M=lo(l),N=lo(s),L=lo(d),H=w.useCallback(()=>{if(!C.current||!E.current)return;const O={placement:t,strategy:n,middleware:y};N.current&&(O.platform=N.current),Ab(C.current,E.current,O).then(B=>{const W={...B,isPositioned:L.current!==!1};D.current&&!ni(A.current,W)&&(A.current=W,Cr.flushSync(()=>{u(W)}))})},[y,t,n,N,L]);Hs(()=>{d===!1&&A.current.isPositioned&&(A.current.isPositioned=!1,u(O=>({...O,isPositioned:!1})))},[d]);const D=w.useRef(!1);Hs(()=>(D.current=!0,()=>{D.current=!1}),[]),Hs(()=>{if(x&&(C.current=x),P&&(E.current=P),x&&P){if(M.current)return M.current(x,P,H);H()}},[x,P,H,M,R]);const F=w.useMemo(()=>({reference:C,floating:E,setReference:b,setFloating:_}),[b,_]),I=w.useMemo(()=>({reference:x,floating:P}),[x,P]),U=w.useMemo(()=>{const O={position:n,left:0,top:0};if(!I.floating)return O;const B=xl(I.floating,f.x),W=xl(I.floating,f.y);return a?{...O,transform:"translate("+B+"px, "+W+"px)",...cf(I.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:B,top:W}},[n,a,I.floating,f.x,f.y]);return w.useMemo(()=>({...f,update:H,refs:F,elements:I,floatingStyles:U}),[f,H,F,I,U])}const Lb=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:s}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?_l({element:r.current,padding:s}).fn(n):{}:r?_l({element:r,padding:s}).fn(n):{}}}},Db=(e,t)=>{const n=Sb(e);return{name:n.name,fn:n.fn,options:[e,t]}},jb=(e,t)=>{const n=Cb(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ib=(e,t)=>({fn:kb(e).fn,options:[e,t]}),Mb=(e,t)=>{const n=Tb(e);return{name:n.name,fn:n.fn,options:[e,t]}},Fb=(e,t)=>{const n=Eb(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ub=(e,t)=>{const n=Pb(e);return{name:n.name,fn:n.fn,options:[e,t]}},Bb=(e,t)=>{const n=Lb(e);return{name:n.name,fn:n.fn,options:[e,t]}};var $b="Arrow",lf=w.forwardRef((e,t)=>{const{children:n,width:r=10,height:s=5,...i}=e;return c.jsx(he.svg,{...i,ref:t,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:c.jsx("polygon",{points:"0,0 30,0 15,10"})})});lf.displayName=$b;var Vb=lf;function Hb(e){const[t,n]=w.useState(void 0);return Ie(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const i=s[0];let o,a;if("borderBoxSize"in i){const l=i.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 Wa="Popper",[df,uf]=Bn(Wa),[zb,ff]=df(Wa),mf=e=>{const{__scopePopper:t,children:n}=e,[r,s]=w.useState(null),[i,o]=w.useState(void 0);return c.jsx(zb,{scope:t,anchor:r,onAnchorChange:s,placementState:i,setPlacementState:o,children:n})};mf.displayName=Wa;var pf="PopperAnchor",hf=w.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,i=ff(pf,n),o=w.useRef(null),a=i.onAnchorChange,l=w.useCallback(g=>{o.current=g,g&&a(g)},[a]),d=Oe(t,l),f=w.useRef(null);w.useEffect(()=>{if(!r)return;const g=f.current;f.current=r.current,g!==f.current&&a(f.current)});const u=i.placementState&&qa(i.placementState),y=u==null?void 0:u[0],p=u==null?void 0:u[1];return r?null:c.jsx(he.div,{"data-radix-popper-side":y,"data-radix-popper-align":p,...s,ref:d})});hf.displayName=pf;var Ka="PopperContent",[Wb,Kb]=df(Ka),gf=w.forwardRef((e,t)=>{var ie,ge,le,oe,$,we;const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:i="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:d=[],collisionPadding:f=0,sticky:u="partial",hideWhenDetached:y=!1,updatePositionStrategy:p="optimized",onPlaced:g,...m}=e,h=ff(Ka,n),[v,b]=w.useState(null),_=Oe(t,ke=>b(ke)),[x,P]=w.useState(null),C=Hb(x),E=(C==null?void 0:C.width)??0,A=(C==null?void 0:C.height)??0,R=r+(i!=="center"?"-"+i:""),M=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},N=Array.isArray(d)?d:[d],L=N.length>0,H={padding:M,boundary:N.filter(Gb),altBoundary:L},{refs:D,floatingStyles:F,placement:I,isPositioned:U,middlewareData:O}=Rb({strategy:"fixed",placement:R,whileElementsMounted:(...ke)=>xb(...ke,{animationFrame:p==="always"}),elements:{reference:h.anchor},middleware:[Db({mainAxis:s+A,alignmentAxis:o}),l&&jb({mainAxis:!0,crossAxis:!1,limiter:u==="partial"?Ib():void 0,...H}),l&&Mb({...H}),Fb({...H,apply:({elements:ke,rects:Pe,availableWidth:J,availableHeight:Ne})=>{const{width:Be,height:Xe}=Pe.reference,ft=ke.floating.style;ft.setProperty("--radix-popper-available-width",`${J}px`),ft.setProperty("--radix-popper-available-height",`${Ne}px`),ft.setProperty("--radix-popper-anchor-width",`${Be}px`),ft.setProperty("--radix-popper-anchor-height",`${Xe}px`)}}),x&&Bb({element:x,padding:a}),Zb({arrowWidth:E,arrowHeight:A}),y&&Ub({strategy:"referenceHidden",...H,boundary:L?H.boundary:void 0})]}),B=h.setPlacementState;Ie(()=>(B(I),()=>{B(void 0)}),[I,B]);const[W,j]=qa(I),ee=yt(g);Ie(()=>{U&&(ee==null||ee())},[U,ee]);const X=(ie=O.arrow)==null?void 0:ie.x,de=(ge=O.arrow)==null?void 0:ge.y,ue=((le=O.arrow)==null?void 0:le.centerOffset)!==0,[V,K]=w.useState();return Ie(()=>{v&&K(window.getComputedStyle(v).zIndex)},[v]),c.jsx("div",{ref:D.setFloating,"data-radix-popper-content-wrapper":"",style:{...F,transform:U?F.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:V,"--radix-popper-transform-origin":[(oe=O.transformOrigin)==null?void 0:oe.x,($=O.transformOrigin)==null?void 0:$.y].join(" "),...((we=O.hide)==null?void 0:we.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:c.jsx(Wb,{scope:n,placedSide:W,placedAlign:j,onArrowChange:P,arrowX:X,arrowY:de,shouldHideArrow:ue,children:c.jsx(he.div,{"data-side":W,"data-align":j,...m,ref:_,style:{...m.style,animation:U?void 0:"none"}})})})});gf.displayName=Ka;var yf="PopperArrow",qb={top:"bottom",right:"left",bottom:"top",left:"right"},bf=w.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,i=Kb(yf,r),o=qb[i.placedSide];return c.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:c.jsx(Vb,{...s,ref:n,style:{...s.style,display:"block"}})})});bf.displayName=yf;function Gb(e){return e!==null}var Zb=e=>({name:"transformOrigin",options:e,fn(t){var h,v,b;const{placement:n,rects:r,middlewareData:s}=t,o=((h=s.arrow)==null?void 0:h.centerOffset)!==0,a=o?0:e.arrowWidth,l=o?0:e.arrowHeight,[d,f]=qa(n),u={start:"0%",center:"50%",end:"100%"}[f],y=(((v=s.arrow)==null?void 0:v.x)??0)+a/2,p=(((b=s.arrow)==null?void 0:b.y)??0)+l/2;let g="",m="";return d==="bottom"?(g=o?u:`${y}px`,m=`${-l}px`):d==="top"?(g=o?u:`${y}px`,m=`${r.floating.height+l}px`):d==="right"?(g=`${-l}px`,m=o?u:`${p}px`):d==="left"&&(g=`${r.floating.width+l}px`,m=o?u:`${p}px`),{data:{x:g,y:m}}}});function qa(e){const[t,n="center"]=e.split("-");return[t,n]}var Yb=mf,Qb=hf,Xb=gf,Jb=bf;function ev(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 vf=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"}),tv="VisuallyHidden",Ga=w.forwardRef((e,t)=>c.jsx(he.span,{...e,ref:t,style:{...vf,...e.style}}));Ga.displayName=tv;var nv=[" ","Enter","ArrowUp","ArrowDown"],rv=[" ","Enter"],jn="Select",[Oi,Ni,sv]=Fa(jn),[Vn]=Bn(jn,[sv,uf]),Ri=uf(),[iv,pn]=Vn(jn),[ov,av]=Vn(jn),cv="SelectProvider";function wf(e){const{__scopeSelect:t,children:n,open:r,defaultOpen:s,onOpenChange:i,value:o,defaultValue:a,onValueChange:l,dir:d,name:f,autoComplete:u,disabled:y,required:p,form:g,internal_do_not_use_render:m}=e,h=Ri(t),[v,b]=w.useState(null),[_,x]=w.useState(null),[P,C]=w.useState(!1),E=Yu(d),[A,R]=Ln({prop:r,defaultProp:s??!1,onChange:i,caller:jn}),[M,N]=Ln({prop:o,defaultProp:a,onChange:l,caller:jn}),L=w.useRef(null),H=v?!!g||!!v.closest("form"):!0,[D,F]=w.useState(new Set),I=on(),U=Array.from(D).map(j=>j.props.value).join(";"),O=w.useCallback(j=>{F(ee=>new Set(ee).add(j))},[]),B=w.useCallback(j=>{F(ee=>{const X=new Set(ee);return X.delete(j),X})},[]),W={required:p,trigger:v,onTriggerChange:b,valueNode:_,onValueNodeChange:x,valueNodeHasChildren:P,onValueNodeHasChildrenChange:C,contentId:I,value:M,onValueChange:N,open:A,onOpenChange:R,dir:E,triggerPointerDownPosRef:L,disabled:y,name:f,autoComplete:u,form:g,nativeOptions:D,nativeSelectKey:U,isFormControl:H};return c.jsx(Yb,{...h,children:c.jsx(iv,{scope:t,...W,children:c.jsx(Oi.Provider,{scope:t,children:c.jsx(ov,{scope:t,onNativeOptionAdd:O,onNativeOptionRemove:B,children:Sv(m)?m(W):n})})})})}wf.displayName=cv;var _f=e=>{const{__scopeSelect:t,children:n,...r}=e;return c.jsx(wf,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:s})=>c.jsxs(c.Fragment,{children:[n,s?c.jsx(Vf,{__scopeSelect:t}):null]})})};_f.displayName=jn;var xf="SelectTrigger",Za=w.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...s}=e,i=Ri(n),o=pn(xf,n),a=o.disabled||r,l=Oe(t,o.onTriggerChange),d=Ni(n),f=w.useRef("touch"),[u,y,p]=Hf(m=>{const h=d().filter(_=>!_.disabled),v=h.find(_=>_.value===o.value),b=zf(h,m,v);b!==void 0&&o.onValueChange(b.value)}),g=m=>{a||(o.onOpenChange(!0),p()),m&&(o.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})};return c.jsx(Qb,{asChild:!0,...i,children:c.jsx(he.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":Li(o.value)?"":void 0,...s,ref:l,onClick:me(s.onClick,m=>{m.currentTarget.focus(),f.current!=="mouse"&&g(m)}),onPointerDown:me(s.onPointerDown,m=>{f.current=m.pointerType;const h=m.target;h.hasPointerCapture(m.pointerId)&&h.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&m.pointerType==="mouse"&&(g(m),m.preventDefault())}),onKeyDown:me(s.onKeyDown,m=>{const h=u.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&y(m.key),!(h&&m.key===" ")&&nv.includes(m.key)&&(g(),m.preventDefault())})})})});Za.displayName=xf;var Sf="SelectValue",Cf=w.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,children:i,placeholder:o="",...a}=e,l=pn(Sf,n),{onValueNodeHasChildrenChange:d}=l,f=i!==void 0,u=Oe(t,l.onValueNodeChange);Ie(()=>{d(f)},[d,f]);const y=Li(l.value);return c.jsx(he.span,{...a,asChild:y?!1:a.asChild,ref:u,style:{pointerEvents:"none"},children:c.jsx(w.Fragment,{children:y?o:i},y?"placeholder":"value")})});Cf.displayName=Sf;var lv="SelectIcon",Tf=w.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...s}=e;return c.jsx(he.span,{"aria-hidden":!0,...s,ref:t,children:r||"▼"})});Tf.displayName=lv;var Ef="SelectPortal",[dv,uv]=Vn(Ef,{forceMount:void 0}),Pf=e=>{const{__scopeSelect:t,forceMount:n,...r}=e;return c.jsx(dv,{scope:e.__scopeSelect,forceMount:n,children:c.jsx(Si,{asChild:!0,...r})})};Pf.displayName=Ef;var un="SelectContent",Ya=w.forwardRef((e,t)=>{const n=uv(un,e.__scopeSelect),{forceMount:r=n.forceMount,...s}=e,i=pn(un,e.__scopeSelect),[o,a]=w.useState();return Ie(()=>{a(new DocumentFragment)},[]),c.jsx($n,{present:r||i.open,children:({present:l})=>l?c.jsx(Of,{...s,ref:t}):c.jsx(kf,{...s,fragment:o})})});Ya.displayName=un;var kf=w.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,fragment:s}=e;return s?Cr.createPortal(c.jsx(Af,{scope:n,children:c.jsx(Oi.Slot,{scope:n,children:c.jsx("div",{ref:t,children:r})})}),s):null});kf.displayName="SelectContentFragment";var pt=10,[Af,hn]=Vn(un),fv="SelectContentImpl",mv=mr("SelectContent.RemoveScroll"),Of=w.forwardRef((e,t)=>{const{__scopeSelect:n}=e,{position:r="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:i,onPointerDownOutside:o,side:a,sideOffset:l,align:d,alignOffset:f,arrowPadding:u,collisionBoundary:y,collisionPadding:p,sticky:g,hideWhenDetached:m,avoidCollisions:h,...v}=e,b=pn(un,n),[_,x]=w.useState(null),[P,C]=w.useState(null),E=Oe(t,K=>x(K)),[A,R]=w.useState(null),[M,N]=w.useState(null),L=Ni(n),[H,D]=w.useState(!1),F=w.useRef(!1);w.useEffect(()=>{if(_)return Du(_)},[_]),Tu();const I=w.useCallback(K=>{const[ie,...ge]=L().map($=>$.ref.current),[le]=ge.slice(-1),oe=document.activeElement;for(const $ of K)if($===oe||($==null||$.scrollIntoView({block:"nearest"}),$===ie&&P&&(P.scrollTop=0),$===le&&P&&(P.scrollTop=P.scrollHeight),$==null||$.focus(),document.activeElement!==oe))return},[L,P]),U=w.useCallback(()=>I([A,_]),[I,A,_]);w.useEffect(()=>{H&&U()},[H,U]);const{onOpenChange:O,triggerPointerDownPosRef:B}=b;w.useEffect(()=>{if(_){let K={x:0,y:0};const ie=le=>{var oe,$;K={x:Math.abs(Math.round(le.pageX)-(((oe=B.current)==null?void 0:oe.x)??0)),y:Math.abs(Math.round(le.pageY)-((($=B.current)==null?void 0:$.y)??0))}},ge=le=>{K.x<=10&&K.y<=10?le.preventDefault():le.composedPath().includes(_)||O(!1),document.removeEventListener("pointermove",ie),B.current=null};return B.current!==null&&(document.addEventListener("pointermove",ie),document.addEventListener("pointerup",ge,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ie),document.removeEventListener("pointerup",ge,{capture:!0})}}},[_,O,B]),w.useEffect(()=>{const K=()=>O(!1);return window.addEventListener("blur",K),window.addEventListener("resize",K),()=>{window.removeEventListener("blur",K),window.removeEventListener("resize",K)}},[O]);const[W,j]=Hf(K=>{const ie=L().filter(oe=>!oe.disabled),ge=ie.find(oe=>oe.ref.current===document.activeElement),le=zf(ie,K,ge);le&&setTimeout(()=>{var oe;return(oe=le.ref.current)==null?void 0:oe.focus()})}),ee=w.useCallback((K,ie,ge)=>{const le=!F.current&&!ge;(b.value!==void 0&&b.value===ie||le)&&(R(K),le&&(F.current=!0))},[b.value]),X=w.useCallback(()=>_==null?void 0:_.focus(),[_]),de=w.useCallback((K,ie,ge)=>{const le=!F.current&&!ge;(b.value!==void 0&&b.value===ie||le)&&N(K)},[b.value]),ue=r==="popper"?Mo:Nf,V=ue===Mo?{side:a,sideOffset:l,align:d,alignOffset:f,arrowPadding:u,collisionBoundary:y,collisionPadding:p,sticky:g,hideWhenDetached:m,avoidCollisions:h}:{};return c.jsx(Af,{scope:n,content:_,viewport:P,onViewportChange:C,itemRefCallback:ee,selectedItem:A,onItemLeave:X,itemTextRefCallback:de,focusSelectedItem:U,selectedItemText:M,position:r,isPositioned:H,searchRef:W,children:c.jsx(Na,{as:mv,allowPinchZoom:!0,children:c.jsx(Oa,{asChild:!0,trapped:b.open,onMountAutoFocus:K=>{K.preventDefault()},onUnmountAutoFocus:me(s,K=>{var ie;(ie=b.trigger)==null||ie.focus({preventScroll:!0}),K.preventDefault()}),children:c.jsx(xi,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:K=>K.preventDefault(),onDismiss:()=>b.onOpenChange(!1),children:c.jsx(ue,{role:"listbox",id:b.contentId,"data-state":b.open?"open":"closed",dir:b.dir,onContextMenu:K=>K.preventDefault(),...v,...V,onPlaced:()=>D(!0),ref:E,style:{display:"flex",flexDirection:"column",outline:"none",...v.style},onKeyDown:me(v.onKeyDown,K=>{const ie=K.ctrlKey||K.altKey||K.metaKey;if(K.key==="Tab"&&K.preventDefault(),!ie&&K.key.length===1&&j(K.key),["ArrowUp","ArrowDown","Home","End"].includes(K.key)){let le=L().filter(oe=>!oe.disabled).map(oe=>oe.ref.current);if(["ArrowUp","End"].includes(K.key)&&(le=le.slice().reverse()),["ArrowUp","ArrowDown"].includes(K.key)){const oe=K.target,$=le.indexOf(oe);le=le.slice($+1)}setTimeout(()=>I(le)),K.preventDefault()}})})})})})})});Of.displayName=fv;var pv="SelectItemAlignedPosition",Nf=w.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...s}=e,i=pn(un,n),o=hn(un,n),[a,l]=w.useState(null),[d,f]=w.useState(null),u=Oe(t,E=>f(E)),y=Ni(n),p=w.useRef(!1),g=w.useRef(!0),{viewport:m,selectedItem:h,selectedItemText:v,focusSelectedItem:b}=o,_=w.useCallback(()=>{if(i.trigger&&i.valueNode&&a&&d&&m&&h&&v){const E=i.trigger.getBoundingClientRect(),A=d.getBoundingClientRect(),R=i.valueNode.getBoundingClientRect(),M=v.getBoundingClientRect();if(i.dir!=="rtl"){const oe=M.left-A.left,$=R.left-oe,we=E.left-$,ke=E.width+we,Pe=Math.max(ke,A.width),J=window.innerWidth-pt,Ne=ul($,[pt,Math.max(pt,J-Pe)]);a.style.minWidth=ke+"px",a.style.left=Ne+"px"}else{const oe=A.right-M.right,$=window.innerWidth-R.right-oe,we=window.innerWidth-E.right-$,ke=E.width+we,Pe=Math.max(ke,A.width),J=window.innerWidth-pt,Ne=ul($,[pt,Math.max(pt,J-Pe)]);a.style.minWidth=ke+"px",a.style.right=Ne+"px"}const N=y(),L=window.innerHeight-pt*2,H=m.scrollHeight,D=window.getComputedStyle(d),F=parseInt(D.borderTopWidth,10),I=parseInt(D.paddingTop,10),U=parseInt(D.borderBottomWidth,10),O=parseInt(D.paddingBottom,10),B=F+I+H+O+U,W=Math.min(h.offsetHeight*5,B),j=window.getComputedStyle(m),ee=parseInt(j.paddingTop,10),X=parseInt(j.paddingBottom,10),de=E.top+E.height/2-pt,ue=L-de,V=h.offsetHeight/2,K=h.offsetTop+V,ie=F+I+K,ge=B-ie;if(ie<=de){const oe=N.length>0&&h===N[N.length-1].ref.current;a.style.bottom="0px";const $=d.clientHeight-m.offsetTop-m.offsetHeight,we=Math.max(ue,V+(oe?X:0)+$+U),ke=ie+we;a.style.height=ke+"px"}else{const oe=N.length>0&&h===N[0].ref.current;a.style.top="0px";const we=Math.max(de,F+m.offsetTop+(oe?ee:0)+V)+ge;a.style.height=we+"px",m.scrollTop=ie-de+m.offsetTop}a.style.margin=`${pt}px 0`,a.style.minHeight=W+"px",a.style.maxHeight=L+"px",r==null||r(),requestAnimationFrame(()=>p.current=!0)}},[y,i.trigger,i.valueNode,a,d,m,h,v,i.dir,r]);Ie(()=>_(),[_]);const[x,P]=w.useState();Ie(()=>{d&&P(window.getComputedStyle(d).zIndex)},[d]);const C=w.useCallback(E=>{E&&g.current===!0&&(_(),b==null||b(),g.current=!1)},[_,b]);return c.jsx(gv,{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(he.div,{...s,ref:u,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});Nf.displayName=pv;var hv="SelectPopperPosition",Mo=w.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=pt,...i}=e,o=Ri(n);return c.jsx(Xb,{...o,...i,ref:t,align:r,collisionPadding:s,style:{boxSizing:"border-box",...i.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)"}})});Mo.displayName=hv;var[gv,Qa]=Vn(un,{}),Fo="SelectViewport",Rf=w.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...s}=e,i=hn(Fo,n),o=Qa(Fo,n),a=Oe(t,i.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(Oi.Slot,{scope:n,children:c.jsx(he.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:me(s.onScroll,d=>{const f=d.currentTarget,{contentWrapper:u,shouldExpandOnScrollRef:y}=o;if(y!=null&&y.current&&u){const p=Math.abs(l.current-f.scrollTop);if(p>0){const g=window.innerHeight-pt*2,m=parseFloat(u.style.minHeight),h=parseFloat(u.style.height),v=Math.max(m,h);if(v<g){const b=v+p,_=Math.min(g,b),x=b-_;u.style.height=_+"px",u.style.bottom==="0px"&&(f.scrollTop=x>0?x:0,u.style.justifyContent="flex-end")}}}l.current=f.scrollTop})})})]})});Rf.displayName=Fo;var Lf="SelectGroup",[yv,bv]=Vn(Lf),vv=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=on();return c.jsx(yv,{scope:n,id:s,children:c.jsx(he.div,{role:"group","aria-labelledby":s,...r,ref:t})})});vv.displayName=Lf;var Df="SelectLabel",Xa=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=bv(Df,n);return c.jsx(he.div,{id:s.id,...r,ref:t})});Xa.displayName=Df;var ri="SelectItem",[wv,jf]=Vn(ri),Ja=w.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:s=!1,textValue:i,...o}=e,a=pn(ri,n),l=hn(ri,n),d=a.value===r,[f,u]=w.useState(i??""),[y,p]=w.useState(!1),g=Oe(t,b=>{var _;return(_=l.itemRefCallback)==null?void 0:_.call(l,b,r,s)}),m=on(),h=w.useRef("touch"),v=()=>{s||(a.onValueChange(r),a.onOpenChange(!1))};return c.jsx(wv,{scope:n,value:r,disabled:s,textId:m,isSelected:d,onItemTextChange:w.useCallback(b=>{u(_=>_||((b==null?void 0:b.textContent)??"").trim())},[]),children:c.jsx(Oi.ItemSlot,{scope:n,value:r,disabled:s,textValue:f,children:c.jsx(he.div,{role:"option","aria-labelledby":m,"data-highlighted":y?"":void 0,"aria-selected":d&&y,"data-state":d?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...o,ref:g,onFocus:me(o.onFocus,()=>p(!0)),onBlur:me(o.onBlur,()=>p(!1)),onClick:me(o.onClick,()=>{h.current!=="mouse"&&v()}),onPointerUp:me(o.onPointerUp,()=>{h.current==="mouse"&&v()}),onPointerDown:me(o.onPointerDown,b=>{h.current=b.pointerType}),onPointerMove:me(o.onPointerMove,b=>{var _;h.current=b.pointerType,s?(_=l.onItemLeave)==null||_.call(l):h.current==="mouse"&&b.currentTarget.focus({preventScroll:!0})}),onPointerLeave:me(o.onPointerLeave,b=>{var _;b.currentTarget===document.activeElement&&((_=l.onItemLeave)==null||_.call(l))}),onKeyDown:me(o.onKeyDown,b=>{var x;((x=l.searchRef)==null?void 0:x.current)!==""&&b.key===" "||(rv.includes(b.key)&&v(),b.key===" "&&b.preventDefault())})})})})});Ja.displayName=ri;var Fr="SelectItemText",If=w.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,...i}=e,o=pn(Fr,n),a=hn(Fr,n),l=jf(Fr,n),d=av(Fr,n),[f,u]=w.useState(null),y=Oe(t,v=>u(v),l.onItemTextChange,v=>{var b;return(b=a.itemTextRefCallback)==null?void 0:b.call(a,v,l.value,l.disabled)}),p=f==null?void 0:f.textContent,g=w.useMemo(()=>c.jsx("option",{value:l.value,disabled:l.disabled,children:p},l.value),[l.disabled,l.value,p]),{onNativeOptionAdd:m,onNativeOptionRemove:h}=d;return Ie(()=>(m(g),()=>h(g)),[m,h,g]),c.jsxs(c.Fragment,{children:[c.jsx(he.span,{id:l.textId,...i,ref:y}),l.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!Li(o.value)?Cr.createPortal(i.children,o.valueNode):null]})});If.displayName=Fr;var Mf="SelectItemIndicator",Ff=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return jf(Mf,n).isSelected?c.jsx(he.span,{"aria-hidden":!0,...r,ref:t}):null});Ff.displayName=Mf;var Uo="SelectScrollUpButton",ec=w.forwardRef((e,t)=>{const n=hn(Uo,e.__scopeSelect),r=Qa(Uo,e.__scopeSelect),[s,i]=w.useState(!1),o=Oe(t,r.onScrollButtonChange);return Ie(()=>{if(n.viewport&&n.isPositioned){let a=function(){const d=l.scrollTop>0;i(d)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),s?c.jsx(Uf,{...e,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});ec.displayName=Uo;var Bo="SelectScrollDownButton",tc=w.forwardRef((e,t)=>{const n=hn(Bo,e.__scopeSelect),r=Qa(Bo,e.__scopeSelect),[s,i]=w.useState(!1),o=Oe(t,r.onScrollButtonChange);return Ie(()=>{if(n.viewport&&n.isPositioned){let a=function(){const d=l.scrollHeight-l.clientHeight,f=Math.ceil(l.scrollTop)<d;i(f)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),s?c.jsx(Uf,{...e,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});tc.displayName=Bo;var Uf=w.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...s}=e,i=hn("SelectScrollButton",n),o=w.useRef(null),a=Ni(n),l=w.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return w.useEffect(()=>()=>l(),[l]),Ie(()=>{var f;const d=a().find(u=>u.ref.current===document.activeElement);(f=d==null?void 0:d.ref.current)==null||f.scrollIntoView({block:"nearest"})},[a]),c.jsx(he.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:me(s.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:me(s.onPointerMove,()=>{var d;(d=i.onItemLeave)==null||d.call(i),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:me(s.onPointerLeave,()=>{l()})})}),_v="SelectSeparator",nc=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return c.jsx(he.div,{"aria-hidden":!0,...r,ref:t})});nc.displayName=_v;var Bf="SelectArrow",xv=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=Ri(n);return hn(Bf,n).position==="popper"?c.jsx(Jb,{...s,...r,ref:t}):null});xv.displayName=Bf;var $f="SelectBubbleInput",Vf=w.forwardRef(({__scopeSelect:e,...t},n)=>{const r=pn($f,e),{value:s,onValueChange:i,required:o,disabled:a,name:l,autoComplete:d,form:f}=r,{nativeOptions:u,nativeSelectKey:y}=r,p=w.useRef(null),g=Oe(n,p),m=s??"",h=ev(m),v=Array.from(u).some(b=>(b.props.value??"")==="");return w.useEffect(()=>{const b=p.current;if(!b)return;const _=window.HTMLSelectElement.prototype,P=Object.getOwnPropertyDescriptor(_,"value").set;if(h!==m&&P){const C=new Event("change",{bubbles:!0});P.call(b,m),b.dispatchEvent(C)}},[h,m]),c.jsxs(he.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:l,autoComplete:d,disabled:a,form:f,onChange:b=>i(b.target.value),...t,style:{...vf,...t.style},ref:g,defaultValue:m,children:[Li(s)&&!v?c.jsx("option",{value:""}):null,Array.from(u)]},y)});Vf.displayName=$f;function Sv(e){return typeof e=="function"}function Li(e){return e===""||e===void 0}function Hf(e){const t=yt(e),n=w.useRef(""),r=w.useRef(0),s=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]),i=w.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return w.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,s,i]}function zf(e,t,n){const s=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let o=Cv(e,Math.max(i,0));s.length===1&&(o=o.filter(d=>d!==n));const l=o.find(d=>d.textValue.toLowerCase().startsWith(s.toLowerCase()));return l!==n?l:void 0}function Cv(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Di(e,t){if(e==null)return{};var n={},r=Object.keys(e),s,i;for(i=0;i<r.length;i++)s=r[i],!(t.indexOf(s)>=0)&&(n[s]=e[s]);return n}var Tv=["color"],Ev=S.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,s=Di(e,Tv);return S.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{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"}))}),Pv=["color"],rc=S.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,s=Di(e,Pv);return S.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{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"}))}),kv=["color"],Av=S.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,s=Di(e,kv);return S.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{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"}))}),Ov=["color"],Nv=S.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,s=Di(e,Ov);return S.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{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 si=_f,ii=Cf,Kr=w.forwardRef(({className:e,children:t,...n},r)=>c.jsxs(Za,{ref:r,className:Ee("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(Tf,{asChild:!0,children:c.jsx(rc,{className:"h-4 w-4 opacity-50"})})]}));Kr.displayName=Za.displayName;const Wf=w.forwardRef(({className:e,...t},n)=>c.jsx(ec,{ref:n,className:Ee("flex cursor-default items-center justify-center py-1",e),...t,children:c.jsx(Av,{className:"h-4 w-4"})}));Wf.displayName=ec.displayName;const Kf=w.forwardRef(({className:e,...t},n)=>c.jsx(tc,{ref:n,className:Ee("flex cursor-default items-center justify-center py-1",e),...t,children:c.jsx(rc,{className:"h-4 w-4"})}));Kf.displayName=tc.displayName;const qr=w.forwardRef(({className:e,children:t,position:n="popper",...r},s)=>c.jsx(Pf,{children:c.jsxs(Ya,{ref:s,className:Ee("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(Wf,{}),c.jsx(Rf,{className:Ee("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),c.jsx(Kf,{})]})}));qr.displayName=Ya.displayName;const Rv=w.forwardRef(({className:e,...t},n)=>c.jsx(Xa,{ref:n,className:Ee("px-2 py-1.5 text-sm font-semibold",e),...t}));Rv.displayName=Xa.displayName;const Gr=w.forwardRef(({className:e,children:t,...n},r)=>c.jsxs(Ja,{ref:r,className:Ee("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(Ff,{children:c.jsx(Ev,{className:"h-4 w-4"})})}),c.jsx(If,{children:t})]}));Gr.displayName=Ja.displayName;const Lv=w.forwardRef(({className:e,...t},n)=>c.jsx(nc,{ref:n,className:Ee("-mx-1 my-1 h-px bg-muted",e),...t}));Lv.displayName=nc.displayName;function qf({open:e,isAccountsLoading:t,accountOptions:n,onConfirm:r,backUrl:s,createAccountUrl:i}){var u;const[o,a]=S.useState(""),l=o||((u=n[0])==null?void 0:u.login)||"",d=!t&&n.length>0&&l!=="",f=!t&&n.length===0;return c.jsx(Dy,{open:e,children:c.jsxs(Wu,{className:"web-trading-widget-account-modal",onPointerDownOutside:y=>y.preventDefault(),onEscapeKeyDown:y=>y.preventDefault(),children:[c.jsxs(Ku,{children:[c.jsx(Gu,{children:"Select trading account"}),c.jsx(Zu,{children:"Choose an account to continue trading on the chart."})]}),t?c.jsx("p",{className:"web-trading-widget-account-modal__loading",children:"Loading accounts…"}):n.length===0?c.jsx("p",{className:"web-trading-widget-account-modal__error",children:"No trading accounts available."}):c.jsxs(si,{value:l,onValueChange:a,children:[c.jsx(Kr,{className:"web-trading-widget-account-modal__select",children:c.jsx(ii,{placeholder:"Select account"})}),c.jsx(qr,{children:n.map(y=>c.jsxs(Gr,{value:y.login,children:[y.label," (",y.balance.toFixed(2)," ",y.currency,")"]},y.login))})]}),c.jsx(qu,{children:f?c.jsxs(c.Fragment,{children:[s?c.jsx(ct,{asChild:!0,variant:"outline",children:c.jsx("a",{href:s,children:"Just back"})}):null,i?c.jsx(ct,{asChild:!0,children:c.jsx("a",{href:i,children:"Create account"})}):null]}):c.jsx(ct,{type:"button",disabled:!d,onClick:()=>r(l),children:"Continue"})})]})})}var Dv={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 jv=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),lt=(e,t)=>{const n=S.forwardRef(({color:r="currentColor",size:s=24,strokeWidth:i=2,absoluteStrokeWidth:o,children:a,...l},d)=>S.createElement("svg",{ref:d,...Dv,width:s,height:s,stroke:r,strokeWidth:o?Number(i)*24/Number(s):i,className:`lucide lucide-${jv(e)}`,...l},[...t.map(([f,u])=>S.createElement(f,u)),...(Array.isArray(a)?a:[a])||[]]));return n.displayName=`${e}`,n},oi=lt("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),Iv=lt("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),Mv=lt("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),$o=lt("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),Gf=lt("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"}]]),Zf=lt("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"}]]),Fv=lt("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"}]]),Uv=lt("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"}]]),Bv=lt("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]),$v=lt("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),Vv=lt("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"}]]),gn=lt("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function Hv(e){const t=Math.round(Math.log10(e));return Number.isFinite(t)&&t>0?t:5}function sc(e){const t=Ke(e).toUpperCase();if(t)return Bt.find(n=>{var r,s;return((r=n.resolve_symbol)==null?void 0:r.toUpperCase())===t||((s=n.display_name)==null?void 0:s.toUpperCase())===t||n.ticker.replace(/_/g,"").toUpperCase()===t})}function zv(e){const t=sc(e);return t!=null&&t.pricescale?Hv(t.pricescale):5}function Yf(e,t){if(t)for(const r of["digits","Digits"]){const s=t[r];if(s!=null&&s!==""){const i=Number(s);if(Number.isFinite(i))return Math.round(i)}}const n=Ke(e).toUpperCase();return n.includes("XAU")||n.includes("GOLD")?2:n.includes("JPY")?3:5}function Wv(e){const t=sc(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 ic="USD";function as(e){return Ke(e).toUpperCase()}function ji(e){const t=as(e);return t.length>=6?t.slice(3):ic}function oc(e){if(e!==ic&&e==="JPY")return"USDJPY"}function Kv(e,t,n,r,s){const i=ji(e),o=oc(i);if(!o)return;if(as(e)===o){const d=t==="buy"?n:r;return d>0?d:void 0}const a=s[o];if(!a)return;const l=(a.bid+a.ask)/2;return l>0?l:void 0}function qv(e,t,n,r,s,i,o={}){const a=e==="buy"?n:r;let d=(e==="buy"?a-t:t-a)*s*Wv(i);const f=ji(i),u=Kv(i,e,n,r,o);if(u!==void 0)d/=u;else if(f!==ic)return null;return Math.round(d*100)/100}function Gv(e){const t=new Set;for(const n of e){const r=oc(ji(n));r&&as(n)!==r&&t.add(r)}return[...t]}function Zv(e,t){const n=as(e);if(n===t)return!0;const r=oc(ji(e));return r===t&&n!==r}function Yv(e,t,n,r,s){if(!Zv(e.symbol,t))return e;const i=as(e.symbol)===t,o=i?n:e.marketBid??e.currentPrice,a=i?r:e.marketAsk??e.currentPrice,l=e.type==="buy"?o:a,d=qv(e.type,e.openPrice,o,a,e.volumeLots,e.symbol,s);return{...e,currentPrice:l,marketBid:o,marketAsk:a,profit:d??e.profit}}function Ke(e){const t=e.trim();return t?t.replace(/m$/i,""):""}function Ii(e){return Ke(e)||"—"}const Ye={BUY:0,SELL:1,BUY_LIMIT:2,SELL_LIMIT:3,BUY_STOP:4,SELL_STOP:5,BUY_STOP_LIMIT:6,SELL_STOP_LIMIT:7},ai=[{mode:"market",label:"Market Execution",orderType:null,isMarket:!0},{mode:"buy_limit",label:"Buy Limit",orderType:Ye.BUY_LIMIT,isMarket:!1},{mode:"sell_limit",label:"Sell Limit",orderType:Ye.SELL_LIMIT,isMarket:!1},{mode:"buy_stop",label:"Buy Stop",orderType:Ye.BUY_STOP,isMarket:!1},{mode:"sell_stop",label:"Sell Stop",orderType:Ye.SELL_STOP,isMarket:!1},{mode:"buy_stop_limit",label:"Buy Stop Limit",orderType:Ye.BUY_STOP_LIMIT,isMarket:!1},{mode:"sell_stop_limit",label:"Sell Stop Limit",orderType:Ye.SELL_STOP_LIMIT,isMarket:!1}];function Mi(e){return ai.find(t=>t.mode===e)??ai[0]}function Fi(e){return Mi(e).isMarket}function Vo(e,t){const n=Mi(e);return n.orderType!==null?n.orderType:t==="buy"?Ye.BUY:Ye.SELL}function ci(e){return e%2===1?"sell":"buy"}function ac(e){return e>=Ye.BUY_LIMIT&&e<=Ye.SELL_STOP_LIMIT}function cc(e){return e===Ye.BUY_STOP_LIMIT||e===Ye.SELL_STOP_LIMIT}function Qf(e){return e==="buy_stop_limit"||e==="sell_stop_limit"}const gt={GTC:0,TODAY:1,SPECIFIED:2,SPECIFIED_DAY:3},Xf=[{value:gt.GTC,label:"GTC"},{value:gt.TODAY,label:"Today"},{value:gt.SPECIFIED,label:"Specified"},{value:gt.SPECIFIED_DAY,label:"Specified Day"}];function lc(e){return e===gt.SPECIFIED}function dc(e){return e===gt.SPECIFIED_DAY}function Qv(e){return e.map(t=>({login:t.login,label:t.label,balance:t.tradeStat.balance,currency:t.currency}))}function Xv(){if(typeof window>"u")return null;const e=localStorage.getItem(hu);return(e==null?void 0:e.trim())||null}function Sl(e){if(typeof window>"u")return;const t=e.trim();t&&localStorage.setItem(hu,t)}function Jv(e,t){var n;return t&&e.some(r=>r.login===t)?t:((n=e[0])==null?void 0:n.login)??""}function uc(e,t=Bt){return t.find(n=>n.ticker===e)}function ew(e,t=Bt){var s;const n=Ke(e).toUpperCase();if(!n)return null;const r=t.find(i=>{var o;return Ke(i.resolve_symbol??"").toUpperCase()===n||((o=i.display_name)==null?void 0:o.toUpperCase())===n||i.ticker.replace(/_/g,"").toUpperCase()===n||i.ticker.toUpperCase()===n});return r?r.ticker:((s=sc(e))==null?void 0:s.ticker)??null}function Jf(e,t=Bt){const n=uc(e,t),r=(n==null?void 0:n.resolve_symbol)??e.replace(/_/g,"");return Ke(r).toUpperCase()}function Ui(e,t=Bt){const n=uc(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=Bt){const n=uc(e,t);return(n==null?void 0:n.pricescale)??1e5}function Se(e,t){return e.toFixed(t)}function Pr(e){return 1/10**e}function fc(e,t){return e===null||t===null?null:(e+t)/2}function Ue(e){const t=e.trim();if(!t)return;const n=Number(t);if(!(!Number.isFinite(n)||n<=0))return n}function em(e,t,n){if(lc(e)){if(!t.trim())return;const r=Date.parse(t);return Number.isFinite(r)?Math.floor(r/1e3):void 0}if(dc(e)){if(!n.trim())return;const r=Date.parse(`${n}T23:59:59`);return Number.isFinite(r)?Math.floor(r/1e3):void 0}}function Bi(e,t,n){return e===gt.GTC||e===gt.TODAY?!0:em(e,t,n)!==void 0}const tw={},Cl=e=>{let t;const n=new Set,r=(f,u)=>{const y=typeof f=="function"?f(t):f;if(!Object.is(y,t)){const p=t;t=u??(typeof y!="object"||y===null)?y:Object.assign({},t,y),n.forEach(g=>g(t,p))}},s=()=>t,l={setState:r,getState:s,getInitialState:()=>d,subscribe:f=>(n.add(f),()=>n.delete(f)),destroy:()=>{(tw?"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,s,l);return l},nw=e=>e?Cl(e):Cl;function rw(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Os={exports:{}},uo={},Ns={exports:{}},fo={};/**
|
|
41
|
+
`)},_y=0,zn=[];function xy(e){var t=w.useRef([]),n=w.useRef([0,0]),r=w.useRef(),s=w.useState(_y++)[0],i=w.useState(Ru)[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(s));var p=Hg([e.lockRef.current],(e.shards||[]).map(ml),!0).filter(Boolean);return p.forEach(function(m){return m.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),p.forEach(function(m){return m.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var a=w.useCallback(function(p,m){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!o.current.allowPinchZoom;var y=Es(p),b=n.current,_="deltaX"in p?p.deltaX:b[0]-y[0],x="deltaY"in p?p.deltaY:b[1]-y[1],T,S=p.target,E=Math.abs(_)>Math.abs(x)?"h":"v";if("touches"in p&&E==="h"&&S.type==="range")return!1;var O=window.getSelection(),R=O&&O.anchorNode,M=R?R===S||R.contains(S):!1;if(M)return!1;var N=ul(E,S);if(!N)return!0;if(N?T=E:(T=E==="v"?"h":"v",N=ul(E,S)),!N)return!1;if(!r.current&&"changedTouches"in p&&(_||x)&&(r.current=T),!T)return!0;var L=r.current||T;return by(L,m,p,L==="h"?_:x)},[]),l=w.useCallback(function(p){var m=p;if(!(!zn.length||zn[zn.length-1]!==i)){var y="deltaY"in m?fl(m):Es(m),b=t.current.filter(function(T){return T.name===m.type&&(T.target===m.target||m.target===T.shadowParent)&&vy(T.delta,y)})[0];if(b&&b.should){m.cancelable&&m.preventDefault();return}if(!b){var _=(o.current.shards||[]).map(ml).filter(Boolean).filter(function(T){return T.contains(m.target)}),x=_.length>0?a(m,_[0]):!o.current.noIsolation;x&&m.cancelable&&m.preventDefault()}}},[]),d=w.useCallback(function(p,m,y,b){var _={name:p,delta:m,target:y,should:b,shadowParent:Sy(y)};t.current.push(_),setTimeout(function(){t.current=t.current.filter(function(x){return x!==_})},1)},[]),f=w.useCallback(function(p){n.current=Es(p),r.current=void 0},[]),u=w.useCallback(function(p){d(p.type,fl(p),p.target,a(p,e.lockRef.current))},[]),g=w.useCallback(function(p){d(p.type,Es(p),p.target,a(p,e.lockRef.current))},[]);w.useEffect(function(){return zn.push(i),e.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:g}),document.addEventListener("wheel",l,Hn),document.addEventListener("touchmove",l,Hn),document.addEventListener("touchstart",f,Hn),function(){zn=zn.filter(function(p){return p!==i}),document.removeEventListener("wheel",l,Hn),document.removeEventListener("touchmove",l,Hn),document.removeEventListener("touchstart",f,Hn)}},[]);var h=e.removeScrollBar,v=e.inert;return w.createElement(w.Fragment,null,v?w.createElement(i,{styles:wy(s)}):null,h?w.createElement(uy,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Sy(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Cy=Xg(Nu,xy);var Da=w.forwardRef(function(e,t){return w.createElement(Ci,kt({},e,{ref:t,sideCar:Cy}))});Da.classNames=Ci.classNames;var Ty=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Wn=new WeakMap,Ps=new WeakMap,ks={},oo=0,Iu=function(e){return e&&(e.host||Iu(e.parentNode))},Ey=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Iu(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})},Py=function(e,t,n,r){var s=Ey(t,Array.isArray(e)?e:[e]);ks[n]||(ks[n]=new WeakMap);var i=ks[n],o=[],a=new Set,l=new Set(s),d=function(u){!u||a.has(u)||(a.add(u),d(u.parentNode))};s.forEach(d);var f=function(u){!u||l.has(u)||Array.prototype.forEach.call(u.children,function(g){if(a.has(g))f(g);else try{var h=g.getAttribute(r),v=h!==null&&h!=="false",p=(Wn.get(g)||0)+1,m=(i.get(g)||0)+1;Wn.set(g,p),i.set(g,m),o.push(g),p===1&&v&&Ps.set(g,!0),m===1&&g.setAttribute(n,"true"),v||g.setAttribute(r,"true")}catch(y){console.error("aria-hidden: cannot operate on ",g,y)}})};return f(t),a.clear(),oo++,function(){o.forEach(function(u){var g=Wn.get(u)-1,h=i.get(u)-1;Wn.set(u,g),i.set(u,h),g||(Ps.has(u)||u.removeAttribute(r),Ps.delete(u)),h||u.removeAttribute(n)}),oo--,oo||(Wn=new WeakMap,Wn=new WeakMap,Ps=new WeakMap,ks={})}},Mu=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=Ty(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),Py(r,s,n,"aria-hidden")):function(){return null}},Ti="Dialog",[Fu]=Bn(Ti),[ky,wt]=Fu(Ti),Uu=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:o=!0}=e,a=w.useRef(null),l=w.useRef(null),[d,f]=Ln({prop:r,defaultProp:s??!1,onChange:i,caller:Ti});return c.jsx(ky,{scope:t,triggerRef:a,contentRef:l,contentId:on(),titleId:on(),descriptionId:on(),open:d,onOpenChange:f,onOpenToggle:w.useCallback(()=>f(u=>!u),[f]),modal:o,children:n})};Uu.displayName=Ti;var Bu="DialogTrigger",Ay=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=wt(Bu,n),i=Ne(t,s.triggerRef);return c.jsx(ye.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":Ba(s.open),...r,ref:i,onClick:he(e.onClick,s.onOpenToggle)})});Ay.displayName=Bu;var ja="DialogPortal",[Oy,$u]=Fu(ja,{forceMount:void 0}),Vu=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:s}=e,i=wt(ja,t);return c.jsx(Oy,{scope:t,forceMount:n,children:w.Children.map(r,o=>c.jsx($n,{present:n||i.open,children:c.jsx(Si,{asChild:!0,container:s,children:o})}))})};Vu.displayName=ja;var Xs="DialogOverlay",Ia=w.forwardRef((e,t)=>{const n=$u(Xs,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,i=wt(Xs,e.__scopeDialog);return i.modal?c.jsx($n,{present:r||i.open,children:c.jsx(Ry,{...s,ref:t})}):null});Ia.displayName=Xs;var Ny=mr("DialogOverlay.RemoveScroll"),Ry=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=wt(Xs,n),i=Eg(),o=Ne(t,i);return c.jsx(Da,{as:Ny,allowPinchZoom:!0,shards:[s.contentRef],children:c.jsx(ye.div,{"data-state":Ba(s.open),...r,ref:o,style:{pointerEvents:"auto",...r.style}})})}),pr="DialogContent",Ma=w.forwardRef((e,t)=>{const n=$u(pr,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,i=wt(pr,e.__scopeDialog);return c.jsx($n,{present:r||i.open,children:i.modal?c.jsx(Ly,{...s,ref:t}):c.jsx(Dy,{...s,ref:t})})});Ma.displayName=pr;var Ly=w.forwardRef((e,t)=>{const n=wt(pr,e.__scopeDialog),r=w.useRef(null),s=Ne(t,n.contentRef,r);return w.useEffect(()=>{const i=r.current;if(i)return Mu(i)},[]),c.jsx(Hu,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:he(e.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:he(e.onPointerDownOutside,i=>{const o=i.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&i.preventDefault()}),onFocusOutside:he(e.onFocusOutside,i=>i.preventDefault())})}),Dy=w.forwardRef((e,t)=>{const n=wt(pr,e.__scopeDialog),r=w.useRef(!1),s=w.useRef(!1);return c.jsx(Hu,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,a;(o=e.onCloseAutoFocus)==null||o.call(e,i),i.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{var l,d;(l=e.onInteractOutside)==null||l.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=i.target;((d=n.triggerRef.current)==null?void 0:d.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),Hu=w.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,...o}=e,a=wt(pr,n);return ku(),c.jsx(c.Fragment,{children:c.jsx(La,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:c.jsx(xi,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":Ba(a.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>a.onOpenChange(!1)})})})}),zu="DialogTitle",Fa=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=wt(zu,n);return c.jsx(ye.h2,{id:s.titleId,...r,ref:t})});Fa.displayName=zu;var Wu="DialogDescription",Ua=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=wt(Wu,n);return c.jsx(ye.p,{id:s.descriptionId,...r,ref:t})});Ua.displayName=Wu;var Ku="DialogClose",jy=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=wt(Ku,n);return c.jsx(ye.button,{type:"button",...r,ref:t,onClick:he(e.onClick,()=>s.onOpenChange(!1))})});jy.displayName=Ku;function Ba(e){return e?"open":"closed"}const Iy=Uu,My=Vu,qu=w.forwardRef(({className:e,...t},n)=>c.jsx(Ia,{ref:n,className:Pe("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}));qu.displayName=Ia.displayName;const Gu=w.forwardRef(({className:e,overlayClass:t,children:n,...r},s)=>c.jsxs(My,{children:[c.jsx(qu,{className:t}),c.jsx(Ma,{ref:s,className:Pe("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})]}));Gu.displayName=Ma.displayName;const Zu=({className:e,...t})=>c.jsx("div",{className:Pe("flex flex-col space-y-1.5 border-b text-center sm:text-left",e),...t});Zu.displayName="DialogHeader";const Yu=({className:e,...t})=>c.jsx("div",{className:Pe("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Yu.displayName="DialogFooter";const Qu=w.forwardRef(({className:e,...t},n)=>c.jsx(Fa,{ref:n,className:Pe("text-lg font-semibold leading-none tracking-tight",e),...t}));Qu.displayName=Fa.displayName;const Xu=w.forwardRef(({className:e,...t},n)=>c.jsx(Ua,{ref:n,className:Pe("text-sm text-muted-foreground",e),...t}));Xu.displayName=Ua.displayName;function pl(e,[t,n]){return Math.min(n,Math.max(t,e))}function $a(e){const t=e+"CollectionProvider",[n,r]=Bn(t),[s,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=p=>{const{scope:m,children:y}=p,b=w.useRef(null),_=w.useRef(new Map).current;return c.jsx(s,{scope:m,itemMap:_,collectionRef:b,children:y})};o.displayName=t;const a=e+"CollectionSlot",l=mr(a),d=w.forwardRef((p,m)=>{const{scope:y,children:b}=p,_=i(a,y),x=Ne(m,_.collectionRef);return c.jsx(l,{ref:x,children:b})});d.displayName=a;const f=e+"CollectionItemSlot",u="data-radix-collection-item",g=mr(f),h=w.forwardRef((p,m)=>{const{scope:y,children:b,..._}=p,x=w.useRef(null),T=Ne(m,x),S=i(f,y);return w.useEffect(()=>(S.itemMap.set(x,{ref:x,..._}),()=>void S.itemMap.delete(x))),c.jsx(g,{[u]:"",ref:T,children:b})});h.displayName=f;function v(p){const m=i(e+"CollectionConsumer",p);return w.useCallback(()=>{const b=m.collectionRef.current;if(!b)return[];const _=Array.from(b.querySelectorAll(`[${u}]`));return Array.from(m.itemMap.values()).sort((S,E)=>_.indexOf(S.ref.current)-_.indexOf(E.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:o,Slot:d,ItemSlot:h},v,r]}var Fy=w.createContext(void 0);function Ju(e){const t=w.useContext(Fy);return e||t||"ltr"}const Uy=["top","right","bottom","left"],ln=Math.min,nt=Math.max,Js=Math.round,As=Math.floor,Ot=e=>({x:e,y:e}),By={left:"right",right:"left",bottom:"top",top:"bottom"};function Io(e,t,n){return nt(e,ln(t,n))}function Mt(e,t){return typeof e=="function"?e(t):e}function Ft(e){return e.split("-")[0]}function Tr(e){return e.split("-")[1]}function Va(e){return e==="x"?"y":"x"}function Ha(e){return e==="y"?"height":"width"}function At(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function za(e){return Va(At(e))}function $y(e,t,n){n===void 0&&(n=!1);const r=Tr(e),s=za(e),i=Ha(s);let o=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(o=ei(o)),[o,ei(o)]}function Vy(e){const t=ei(e);return[Mo(e),t,Mo(t)]}function Mo(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const hl=["left","right"],gl=["right","left"],Hy=["top","bottom"],zy=["bottom","top"];function Wy(e,t,n){switch(e){case"top":case"bottom":return n?t?gl:hl:t?hl:gl;case"left":case"right":return t?Hy:zy;default:return[]}}function Ky(e,t,n,r){const s=Tr(e);let i=Wy(Ft(e),n==="start",r);return s&&(i=i.map(o=>o+"-"+s),t&&(i=i.concat(i.map(Mo)))),i}function ei(e){const t=Ft(e);return By[t]+e.slice(t.length)}function qy(e){return{top:0,right:0,bottom:0,left:0,...e}}function ef(e){return typeof e!="number"?qy(e):{top:e,right:e,bottom:e,left:e}}function ti(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function yl(e,t,n){let{reference:r,floating:s}=e;const i=At(t),o=za(t),a=Ha(o),l=Ft(t),d=i==="y",f=r.x+r.width/2-s.width/2,u=r.y+r.height/2-s.height/2,g=r[a]/2-s[a]/2;let h;switch(l){case"top":h={x:f,y:r.y-s.height};break;case"bottom":h={x:f,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:u};break;case"left":h={x:r.x-s.width,y:u};break;default:h={x:r.x,y:r.y}}switch(Tr(t)){case"start":h[o]-=g*(n&&d?-1:1);break;case"end":h[o]+=g*(n&&d?-1:1);break}return h}async function Gy(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:i,rects:o,elements:a,strategy:l}=e,{boundary:d="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:g=!1,padding:h=0}=Mt(t,e),v=ef(h),m=a[g?u==="floating"?"reference":"floating":u],y=ti(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(m)))==null||n?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:d,rootBoundary:f,strategy:l})),b=u==="floating"?{x:r,y:s,width:o.floating.width,height:o.floating.height}:o.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),x=await(i.isElement==null?void 0:i.isElement(_))?await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1}:{x:1,y:1},T=ti(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:b,offsetParent:_,strategy:l}):b);return{top:(y.top-T.top+v.top)/x.y,bottom:(T.bottom-y.bottom+v.bottom)/x.y,left:(y.left-T.left+v.left)/x.x,right:(T.right-y.right+v.right)/x.x}}const Zy=50,Yy=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:o}=n,a=o.detectOverflow?o:{...o,detectOverflow:Gy},l=await(o.isRTL==null?void 0:o.isRTL(t));let d=await o.getElementRects({reference:e,floating:t,strategy:s}),{x:f,y:u}=yl(d,r,l),g=r,h=0;const v={};for(let p=0;p<i.length;p++){const m=i[p];if(!m)continue;const{name:y,fn:b}=m,{x:_,y:x,data:T,reset:S}=await b({x:f,y:u,initialPlacement:r,placement:g,strategy:s,middlewareData:v,rects:d,platform:a,elements:{reference:e,floating:t}});f=_??f,u=x??u,v[y]={...v[y],...T},S&&h<Zy&&(h++,typeof S=="object"&&(S.placement&&(g=S.placement),S.rects&&(d=S.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:s}):S.rects),{x:f,y:u}=yl(d,g,l)),p=-1)}return{x:f,y:u,placement:g,strategy:s,middlewareData:v}},Qy=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:i,platform:o,elements:a,middlewareData:l}=t,{element:d,padding:f=0}=Mt(e,t)||{};if(d==null)return{};const u=ef(f),g={x:n,y:r},h=za(s),v=Ha(h),p=await o.getDimensions(d),m=h==="y",y=m?"top":"left",b=m?"bottom":"right",_=m?"clientHeight":"clientWidth",x=i.reference[v]+i.reference[h]-g[h]-i.floating[v],T=g[h]-i.reference[h],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(d));let E=S?S[_]:0;(!E||!await(o.isElement==null?void 0:o.isElement(S)))&&(E=a.floating[_]||i.floating[v]);const O=x/2-T/2,R=E/2-p[v]/2-1,M=ln(u[y],R),N=ln(u[b],R),L=M,V=E-p[v]-N,j=E/2-p[v]/2+O,U=Io(L,j,V),D=!l.arrow&&Tr(s)!=null&&j!==U&&i.reference[v]/2-(j<L?M:N)-p[v]/2<0,$=D?j<L?j-L:j-V:0;return{[h]:g[h]+$,data:{[h]:U,centerOffset:j-U-$,...D&&{alignmentOffset:$}},reset:D}}}),Xy=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:i,rects:o,initialPlacement:a,platform:l,elements:d}=t,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:g,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:p=!0,...m}=Mt(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const y=Ft(s),b=At(a),_=Ft(a)===a,x=await(l.isRTL==null?void 0:l.isRTL(d.floating)),T=g||(_||!p?[ei(a)]:Vy(a)),S=v!=="none";!g&&S&&T.push(...Ky(a,p,v,x));const E=[a,...T],O=await l.detectOverflow(t,m),R=[];let M=((r=i.flip)==null?void 0:r.overflows)||[];if(f&&R.push(O[y]),u){const j=$y(s,o,x);R.push(O[j[0]],O[j[1]])}if(M=[...M,{placement:s,overflows:R}],!R.every(j=>j<=0)){var N,L;const j=(((N=i.flip)==null?void 0:N.index)||0)+1,U=E[j];if(U&&(!(u==="alignment"?b!==At(U):!1)||M.every(A=>At(A.placement)===b?A.overflows[0]>0:!0)))return{data:{index:j,overflows:M},reset:{placement:U}};let D=(L=M.filter($=>$.overflows[0]<=0).sort(($,A)=>$.overflows[1]-A.overflows[1])[0])==null?void 0:L.placement;if(!D)switch(h){case"bestFit":{var V;const $=(V=M.filter(A=>{if(S){const F=At(A.placement);return F===b||F==="y"}return!0}).map(A=>[A.placement,A.overflows.filter(F=>F>0).reduce((F,W)=>F+W,0)]).sort((A,F)=>A[1]-F[1])[0])==null?void 0:V[0];$&&(D=$);break}case"initialPlacement":D=a;break}if(s!==D)return{reset:{placement:D}}}return{}}}};function bl(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function vl(e){return Uy.some(t=>e[t]>=0)}const Jy=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:s="referenceHidden",...i}=Mt(e,t);switch(s){case"referenceHidden":{const o=await r.detectOverflow(t,{...i,elementContext:"reference"}),a=bl(o,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:vl(a)}}}case"escaped":{const o=await r.detectOverflow(t,{...i,altBoundary:!0}),a=bl(o,n.floating);return{data:{escapedOffsets:a,escaped:vl(a)}}}default:return{}}}}},tf=new Set(["left","top"]);async function eb(e,t){const{placement:n,platform:r,elements:s}=e,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),o=Ft(n),a=Tr(n),l=At(n)==="y",d=tf.has(o)?-1:1,f=i&&l?-1:1,u=Mt(t,e);let{mainAxis:g,crossAxis:h,alignmentAxis:v}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return a&&typeof v=="number"&&(h=a==="end"?v*-1:v),l?{x:h*f,y:g*d}:{x:g*d,y:h*f}}const tb=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:i,placement:o,middlewareData:a}=t,l=await eb(t,e);return o===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:s+l.x,y:i+l.y,data:{...l,placement:o}}}}},nb=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s,platform:i}=t,{mainAxis:o=!0,crossAxis:a=!1,limiter:l={fn:y=>{let{x:b,y:_}=y;return{x:b,y:_}}},...d}=Mt(e,t),f={x:n,y:r},u=await i.detectOverflow(t,d),g=At(Ft(s)),h=Va(g);let v=f[h],p=f[g];if(o){const y=h==="y"?"top":"left",b=h==="y"?"bottom":"right",_=v+u[y],x=v-u[b];v=Io(_,v,x)}if(a){const y=g==="y"?"top":"left",b=g==="y"?"bottom":"right",_=p+u[y],x=p-u[b];p=Io(_,p,x)}const m=l.fn({...t,[h]:v,[g]:p});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[h]:o,[g]:a}}}}}},rb=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:s,rects:i,middlewareData:o}=t,{offset:a=0,mainAxis:l=!0,crossAxis:d=!0}=Mt(e,t),f={x:n,y:r},u=At(s),g=Va(u);let h=f[g],v=f[u];const p=Mt(a,t),m=typeof p=="number"?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(l){const _=g==="y"?"height":"width",x=i.reference[g]-i.floating[_]+m.mainAxis,T=i.reference[g]+i.reference[_]-m.mainAxis;h<x?h=x:h>T&&(h=T)}if(d){var y,b;const _=g==="y"?"width":"height",x=tf.has(Ft(s)),T=i.reference[u]-i.floating[_]+(x&&((y=o.offset)==null?void 0:y[u])||0)+(x?0:m.crossAxis),S=i.reference[u]+i.reference[_]+(x?0:((b=o.offset)==null?void 0:b[u])||0)-(x?m.crossAxis:0);v<T?v=T:v>S&&(v=S)}return{[g]:h,[u]:v}}}},sb=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:s,rects:i,platform:o,elements:a}=t,{apply:l=()=>{},...d}=Mt(e,t),f=await o.detectOverflow(t,d),u=Ft(s),g=Tr(s),h=At(s)==="y",{width:v,height:p}=i.floating;let m,y;u==="top"||u==="bottom"?(m=u,y=g===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(y=u,m=g==="end"?"top":"bottom");const b=p-f.top-f.bottom,_=v-f.left-f.right,x=ln(p-f[m],b),T=ln(v-f[y],_),S=!t.middlewareData.shift;let E=x,O=T;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(O=_),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(E=b),S&&!g){const M=nt(f.left,0),N=nt(f.right,0),L=nt(f.top,0),V=nt(f.bottom,0);h?O=v-2*(M!==0||N!==0?M+N:nt(f.left,f.right)):E=p-2*(L!==0||V!==0?L+V:nt(f.top,f.bottom))}await l({...t,availableWidth:O,availableHeight:E});const R=await o.getDimensions(a.floating);return v!==R.width||p!==R.height?{reset:{rects:!0}}:{}}}};function Ei(){return typeof window<"u"}function Er(e){return nf(e)?(e.nodeName||"").toLowerCase():"#document"}function rt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Rt(e){var t;return(t=(nf(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function nf(e){return Ei()?e instanceof Node||e instanceof rt(e).Node:!1}function bt(e){return Ei()?e instanceof Element||e instanceof rt(e).Element:!1}function $t(e){return Ei()?e instanceof HTMLElement||e instanceof rt(e).HTMLElement:!1}function wl(e){return!Ei()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof rt(e).ShadowRoot}function os(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=vt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&s!=="inline"&&s!=="contents"}function ib(e){return/^(table|td|th)$/.test(Er(e))}function Pi(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const ob=/transform|translate|scale|rotate|perspective|filter/,ab=/paint|layout|strict|content/,yn=e=>!!e&&e!=="none";let ao;function Wa(e){const t=bt(e)?vt(e):e;return yn(t.transform)||yn(t.translate)||yn(t.scale)||yn(t.rotate)||yn(t.perspective)||!Ka()&&(yn(t.backdropFilter)||yn(t.filter))||ob.test(t.willChange||"")||ab.test(t.contain||"")}function cb(e){let t=dn(e);for(;$t(t)&&!hr(t);){if(Wa(t))return t;if(Pi(t))return null;t=dn(t)}return null}function Ka(){return ao==null&&(ao=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),ao}function hr(e){return/^(html|body|#document)$/.test(Er(e))}function vt(e){return rt(e).getComputedStyle(e)}function ki(e){return bt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function dn(e){if(Er(e)==="html")return e;const t=e.assignedSlot||e.parentNode||wl(e)&&e.host||Rt(e);return wl(t)?t.host:t}function rf(e){const t=dn(e);return hr(t)?e.ownerDocument?e.ownerDocument.body:e.body:$t(t)&&os(t)?t:rf(t)}function Wr(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=rf(e),i=s===((r=e.ownerDocument)==null?void 0:r.body),o=rt(s);if(i){const a=Fo(o);return t.concat(o,o.visualViewport||[],os(s)?s:[],a&&n?Wr(a):[])}else return t.concat(s,Wr(s,[],n))}function Fo(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function sf(e){const t=vt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=$t(e),i=s?e.offsetWidth:n,o=s?e.offsetHeight:r,a=Js(n)!==i||Js(r)!==o;return a&&(n=i,r=o),{width:n,height:r,$:a}}function qa(e){return bt(e)?e:e.contextElement}function Jn(e){const t=qa(e);if(!$t(t))return Ot(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:i}=sf(t);let o=(i?Js(n.width):n.width)/r,a=(i?Js(n.height):n.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const lb=Ot(0);function of(e){const t=rt(e);return!Ka()||!t.visualViewport?lb:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function db(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==rt(e)?!1:t}function Dn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),i=qa(e);let o=Ot(1);t&&(r?bt(r)&&(o=Jn(r)):o=Jn(e));const a=db(i,n,r)?of(i):Ot(0);let l=(s.left+a.x)/o.x,d=(s.top+a.y)/o.y,f=s.width/o.x,u=s.height/o.y;if(i){const g=rt(i),h=r&&bt(r)?rt(r):r;let v=g,p=Fo(v);for(;p&&r&&h!==v;){const m=Jn(p),y=p.getBoundingClientRect(),b=vt(p),_=y.left+(p.clientLeft+parseFloat(b.paddingLeft))*m.x,x=y.top+(p.clientTop+parseFloat(b.paddingTop))*m.y;l*=m.x,d*=m.y,f*=m.x,u*=m.y,l+=_,d+=x,v=rt(p),p=Fo(v)}}return ti({width:f,height:u,x:l,y:d})}function Ai(e,t){const n=ki(e).scrollLeft;return t?t.left+n:Dn(Rt(e)).left+n}function af(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Ai(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function ub(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const i=s==="fixed",o=Rt(r),a=t?Pi(t.floating):!1;if(r===o||a&&i)return n;let l={scrollLeft:0,scrollTop:0},d=Ot(1);const f=Ot(0),u=$t(r);if((u||!u&&!i)&&((Er(r)!=="body"||os(o))&&(l=ki(r)),u)){const h=Dn(r);d=Jn(r),f.x=h.x+r.clientLeft,f.y=h.y+r.clientTop}const g=o&&!u&&!i?af(o,l):Ot(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-l.scrollLeft*d.x+f.x+g.x,y:n.y*d.y-l.scrollTop*d.y+f.y+g.y}}function fb(e){return Array.from(e.getClientRects())}function mb(e){const t=Rt(e),n=ki(e),r=e.ownerDocument.body,s=nt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=nt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+Ai(e);const a=-n.scrollTop;return vt(r).direction==="rtl"&&(o+=nt(t.clientWidth,r.clientWidth)-s),{width:s,height:i,x:o,y:a}}const _l=25;function pb(e,t){const n=rt(e),r=Rt(e),s=n.visualViewport;let i=r.clientWidth,o=r.clientHeight,a=0,l=0;if(s){i=s.width,o=s.height;const f=Ka();(!f||f&&t==="fixed")&&(a=s.offsetLeft,l=s.offsetTop)}const d=Ai(r);if(d<=0){const f=r.ownerDocument,u=f.body,g=getComputedStyle(u),h=f.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,v=Math.abs(r.clientWidth-u.clientWidth-h);v<=_l&&(i-=v)}else d<=_l&&(i+=d);return{width:i,height:o,x:a,y:l}}function hb(e,t){const n=Dn(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,i=$t(e)?Jn(e):Ot(1),o=e.clientWidth*i.x,a=e.clientHeight*i.y,l=s*i.x,d=r*i.y;return{width:o,height:a,x:l,y:d}}function xl(e,t,n){let r;if(t==="viewport")r=pb(e,n);else if(t==="document")r=mb(Rt(e));else if(bt(t))r=hb(t,n);else{const s=of(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return ti(r)}function cf(e,t){const n=dn(e);return n===t||!bt(n)||hr(n)?!1:vt(n).position==="fixed"||cf(n,t)}function gb(e,t){const n=t.get(e);if(n)return n;let r=Wr(e,[],!1).filter(a=>bt(a)&&Er(a)!=="body"),s=null;const i=vt(e).position==="fixed";let o=i?dn(e):e;for(;bt(o)&&!hr(o);){const a=vt(o),l=Wa(o);!l&&a.position==="fixed"&&(s=null),(i?!l&&!s:!l&&a.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||os(o)&&!l&&cf(e,o))?r=r.filter(f=>f!==o):s=a,o=dn(o)}return t.set(e,r),r}function yb(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const o=[...n==="clippingAncestors"?Pi(t)?[]:gb(t,this._c):[].concat(n),r],a=xl(t,o[0],s);let l=a.top,d=a.right,f=a.bottom,u=a.left;for(let g=1;g<o.length;g++){const h=xl(t,o[g],s);l=nt(h.top,l),d=ln(h.right,d),f=ln(h.bottom,f),u=nt(h.left,u)}return{width:d-u,height:f-l,x:u,y:l}}function bb(e){const{width:t,height:n}=sf(e);return{width:t,height:n}}function vb(e,t,n){const r=$t(t),s=Rt(t),i=n==="fixed",o=Dn(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=Ot(0);function d(){l.x=Ai(s)}if(r||!r&&!i)if((Er(t)!=="body"||os(s))&&(a=ki(t)),r){const h=Dn(t,!0,i,t);l.x=h.x+t.clientLeft,l.y=h.y+t.clientTop}else s&&d();i&&!r&&s&&d();const f=s&&!r&&!i?af(s,a):Ot(0),u=o.left+a.scrollLeft-l.x-f.x,g=o.top+a.scrollTop-l.y-f.y;return{x:u,y:g,width:o.width,height:o.height}}function co(e){return vt(e).position==="static"}function Sl(e,t){if(!$t(e)||vt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Rt(e)===n&&(n=n.ownerDocument.body),n}function lf(e,t){const n=rt(e);if(Pi(e))return n;if(!$t(e)){let s=dn(e);for(;s&&!hr(s);){if(bt(s)&&!co(s))return s;s=dn(s)}return n}let r=Sl(e,t);for(;r&&ib(r)&&co(r);)r=Sl(r,t);return r&&hr(r)&&co(r)&&!Wa(r)?n:r||cb(e)||n}const wb=async function(e){const t=this.getOffsetParent||lf,n=this.getDimensions,r=await n(e.floating);return{reference:vb(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function _b(e){return vt(e).direction==="rtl"}const xb={convertOffsetParentRelativeRectToViewportRelativeRect:ub,getDocumentElement:Rt,getClippingRect:yb,getOffsetParent:lf,getElementRects:wb,getClientRects:fb,getDimensions:bb,getScale:Jn,isElement:bt,isRTL:_b};function df(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Sb(e,t){let n=null,r;const s=Rt(e);function i(){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),i();const d=e.getBoundingClientRect(),{left:f,top:u,width:g,height:h}=d;if(a||t(),!g||!h)return;const v=As(u),p=As(s.clientWidth-(f+g)),m=As(s.clientHeight-(u+h)),y=As(f),_={rootMargin:-v+"px "+-p+"px "+-m+"px "+-y+"px",threshold:nt(0,ln(1,l))||1};let x=!0;function T(S){const E=S[0].intersectionRatio;if(E!==l){if(!x)return o();E?o(!1,E):r=setTimeout(()=>{o(!1,1e-7)},1e3)}E===1&&!df(d,e.getBoundingClientRect())&&o(),x=!1}try{n=new IntersectionObserver(T,{..._,root:s.ownerDocument})}catch{n=new IntersectionObserver(T,_)}n.observe(e)}return o(!0),i}function Cb(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,d=qa(e),f=s||i?[...d?Wr(d):[],...t?Wr(t):[]]:[];f.forEach(y=>{s&&y.addEventListener("scroll",n,{passive:!0}),i&&y.addEventListener("resize",n)});const u=d&&a?Sb(d,n):null;let g=-1,h=null;o&&(h=new ResizeObserver(y=>{let[b]=y;b&&b.target===d&&h&&t&&(h.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var _;(_=h)==null||_.observe(t)})),n()}),d&&!l&&h.observe(d),t&&h.observe(t));let v,p=l?Dn(e):null;l&&m();function m(){const y=Dn(e);p&&!df(p,y)&&n(),p=y,v=requestAnimationFrame(m)}return n(),()=>{var y;f.forEach(b=>{s&&b.removeEventListener("scroll",n),i&&b.removeEventListener("resize",n)}),u==null||u(),(y=h)==null||y.disconnect(),h=null,l&&cancelAnimationFrame(v)}}const Tb=tb,Eb=nb,Pb=Xy,kb=sb,Ab=Jy,Cl=Qy,Ob=rb,Nb=(e,t,n)=>{const r=new Map,s={platform:xb,...n},i={...s.platform,_c:r};return Yy(e,t,{...s,platform:i})};var Rb=typeof document<"u",Lb=function(){},Hs=Rb?C.useLayoutEffect:Lb;function ni(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,s;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(!ni(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const i=s[r];if(!(i==="_owner"&&e.$$typeof)&&!ni(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function uf(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Tl(e,t){const n=uf(e);return Math.round(t*n)/n}function lo(e){const t=w.useRef(e);return Hs(()=>{t.current=e}),t}function Db(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:i,floating:o}={},transform:a=!0,whileElementsMounted:l,open:d}=e,[f,u]=w.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[g,h]=w.useState(r);ni(g,r)||h(r);const[v,p]=w.useState(null),[m,y]=w.useState(null),b=w.useCallback(A=>{A!==S.current&&(S.current=A,p(A))},[]),_=w.useCallback(A=>{A!==E.current&&(E.current=A,y(A))},[]),x=i||v,T=o||m,S=w.useRef(null),E=w.useRef(null),O=w.useRef(f),R=l!=null,M=lo(l),N=lo(s),L=lo(d),V=w.useCallback(()=>{if(!S.current||!E.current)return;const A={placement:t,strategy:n,middleware:g};N.current&&(A.platform=N.current),Nb(S.current,E.current,A).then(F=>{const W={...F,isPositioned:L.current!==!1};j.current&&!ni(O.current,W)&&(O.current=W,Cr.flushSync(()=>{u(W)}))})},[g,t,n,N,L]);Hs(()=>{d===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,u(A=>({...A,isPositioned:!1})))},[d]);const j=w.useRef(!1);Hs(()=>(j.current=!0,()=>{j.current=!1}),[]),Hs(()=>{if(x&&(S.current=x),T&&(E.current=T),x&&T){if(M.current)return M.current(x,T,V);V()}},[x,T,V,M,R]);const U=w.useMemo(()=>({reference:S,floating:E,setReference:b,setFloating:_}),[b,_]),D=w.useMemo(()=>({reference:x,floating:T}),[x,T]),$=w.useMemo(()=>{const A={position:n,left:0,top:0};if(!D.floating)return A;const F=Tl(D.floating,f.x),W=Tl(D.floating,f.y);return a?{...A,transform:"translate("+F+"px, "+W+"px)",...uf(D.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:F,top:W}},[n,a,D.floating,f.x,f.y]);return w.useMemo(()=>({...f,update:V,refs:U,elements:D,floatingStyles:$}),[f,V,U,D,$])}const jb=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:s}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?Cl({element:r.current,padding:s}).fn(n):{}:r?Cl({element:r,padding:s}).fn(n):{}}}},Ib=(e,t)=>{const n=Tb(e);return{name:n.name,fn:n.fn,options:[e,t]}},Mb=(e,t)=>{const n=Eb(e);return{name:n.name,fn:n.fn,options:[e,t]}},Fb=(e,t)=>({fn:Ob(e).fn,options:[e,t]}),Ub=(e,t)=>{const n=Pb(e);return{name:n.name,fn:n.fn,options:[e,t]}},Bb=(e,t)=>{const n=kb(e);return{name:n.name,fn:n.fn,options:[e,t]}},$b=(e,t)=>{const n=Ab(e);return{name:n.name,fn:n.fn,options:[e,t]}},Vb=(e,t)=>{const n=jb(e);return{name:n.name,fn:n.fn,options:[e,t]}};var Hb="Arrow",ff=w.forwardRef((e,t)=>{const{children:n,width:r=10,height:s=5,...i}=e;return c.jsx(ye.svg,{...i,ref:t,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:c.jsx("polygon",{points:"0,0 30,0 15,10"})})});ff.displayName=Hb;var zb=ff;function Wb(e){const[t,n]=w.useState(void 0);return Ie(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const i=s[0];let o,a;if("borderBoxSize"in i){const l=i.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 Ga="Popper",[mf,pf]=Bn(Ga),[Kb,hf]=mf(Ga),gf=e=>{const{__scopePopper:t,children:n}=e,[r,s]=w.useState(null),[i,o]=w.useState(void 0);return c.jsx(Kb,{scope:t,anchor:r,onAnchorChange:s,placementState:i,setPlacementState:o,children:n})};gf.displayName=Ga;var yf="PopperAnchor",bf=w.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,i=hf(yf,n),o=w.useRef(null),a=i.onAnchorChange,l=w.useCallback(v=>{o.current=v,v&&a(v)},[a]),d=Ne(t,l),f=w.useRef(null);w.useEffect(()=>{if(!r)return;const v=f.current;f.current=r.current,v!==f.current&&a(f.current)});const u=i.placementState&&Ya(i.placementState),g=u==null?void 0:u[0],h=u==null?void 0:u[1];return r?null:c.jsx(ye.div,{"data-radix-popper-side":g,"data-radix-popper-align":h,...s,ref:d})});bf.displayName=yf;var Za="PopperContent",[qb,Gb]=mf(Za),vf=w.forwardRef((e,t)=>{var de,fe,ce,le,ne,z;const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:i="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:d=[],collisionPadding:f=0,sticky:u="partial",hideWhenDetached:g=!1,updatePositionStrategy:h="optimized",onPlaced:v,...p}=e,m=hf(Za,n),[y,b]=w.useState(null),_=Ne(t,we=>b(we)),[x,T]=w.useState(null),S=Wb(x),E=(S==null?void 0:S.width)??0,O=(S==null?void 0:S.height)??0,R=r+(i!=="center"?"-"+i:""),M=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},N=Array.isArray(d)?d:[d],L=N.length>0,V={padding:M,boundary:N.filter(Yb),altBoundary:L},{refs:j,floatingStyles:U,placement:D,isPositioned:$,middlewareData:A}=Db({strategy:"fixed",placement:R,whileElementsMounted:(...we)=>Cb(...we,{animationFrame:h==="always"}),elements:{reference:m.anchor},middleware:[Ib({mainAxis:s+O,alignmentAxis:o}),l&&Mb({mainAxis:!0,crossAxis:!1,limiter:u==="partial"?Fb():void 0,...V}),l&&Ub({...V}),Bb({...V,apply:({elements:we,rects:Ae,availableWidth:Q,availableHeight:ke})=>{const{width:Be,height:Xe}=Ae.reference,ft=we.floating.style;ft.setProperty("--radix-popper-available-width",`${Q}px`),ft.setProperty("--radix-popper-available-height",`${ke}px`),ft.setProperty("--radix-popper-anchor-width",`${Be}px`),ft.setProperty("--radix-popper-anchor-height",`${Xe}px`)}}),x&&Vb({element:x,padding:a}),Qb({arrowWidth:E,arrowHeight:O}),g&&$b({strategy:"referenceHidden",...V,boundary:L?V.boundary:void 0})]}),F=m.setPlacementState;Ie(()=>(F(D),()=>{F(void 0)}),[D,F]);const[W,I]=Ya(D),ee=yt(v);Ie(()=>{$&&(ee==null||ee())},[$,ee]);const J=(de=A.arrow)==null?void 0:de.x,ue=(fe=A.arrow)==null?void 0:fe.y,me=((ce=A.arrow)==null?void 0:ce.centerOffset)!==0,[B,K]=w.useState();return Ie(()=>{y&&K(window.getComputedStyle(y).zIndex)},[y]),c.jsx("div",{ref:j.setFloating,"data-radix-popper-content-wrapper":"",style:{...U,transform:$?U.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:B,"--radix-popper-transform-origin":[(le=A.transformOrigin)==null?void 0:le.x,(ne=A.transformOrigin)==null?void 0:ne.y].join(" "),...((z=A.hide)==null?void 0:z.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:c.jsx(qb,{scope:n,placedSide:W,placedAlign:I,onArrowChange:T,arrowX:J,arrowY:ue,shouldHideArrow:me,children:c.jsx(ye.div,{"data-side":W,"data-align":I,...p,ref:_,style:{...p.style,animation:$?void 0:"none"}})})})});vf.displayName=Za;var wf="PopperArrow",Zb={top:"bottom",right:"left",bottom:"top",left:"right"},_f=w.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,i=Gb(wf,r),o=Zb[i.placedSide];return c.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:c.jsx(zb,{...s,ref:n,style:{...s.style,display:"block"}})})});_f.displayName=wf;function Yb(e){return e!==null}var Qb=e=>({name:"transformOrigin",options:e,fn(t){var m,y,b;const{placement:n,rects:r,middlewareData:s}=t,o=((m=s.arrow)==null?void 0:m.centerOffset)!==0,a=o?0:e.arrowWidth,l=o?0:e.arrowHeight,[d,f]=Ya(n),u={start:"0%",center:"50%",end:"100%"}[f],g=(((y=s.arrow)==null?void 0:y.x)??0)+a/2,h=(((b=s.arrow)==null?void 0:b.y)??0)+l/2;let v="",p="";return d==="bottom"?(v=o?u:`${g}px`,p=`${-l}px`):d==="top"?(v=o?u:`${g}px`,p=`${r.floating.height+l}px`):d==="right"?(v=`${-l}px`,p=o?u:`${h}px`):d==="left"&&(v=`${r.floating.width+l}px`,p=o?u:`${h}px`),{data:{x:v,y:p}}}});function Ya(e){const[t,n="center"]=e.split("-");return[t,n]}var Xb=gf,Jb=bf,ev=vf,tv=_f;function nv(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 xf=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"}),rv="VisuallyHidden",Qa=w.forwardRef((e,t)=>c.jsx(ye.span,{...e,ref:t,style:{...xf,...e.style}}));Qa.displayName=rv;var sv=[" ","Enter","ArrowUp","ArrowDown"],iv=[" ","Enter"],jn="Select",[Oi,Ni,ov]=$a(jn),[Vn]=Bn(jn,[ov,pf]),Ri=pf(),[av,pn]=Vn(jn),[cv,lv]=Vn(jn),dv="SelectProvider";function Sf(e){const{__scopeSelect:t,children:n,open:r,defaultOpen:s,onOpenChange:i,value:o,defaultValue:a,onValueChange:l,dir:d,name:f,autoComplete:u,disabled:g,required:h,form:v,internal_do_not_use_render:p}=e,m=Ri(t),[y,b]=w.useState(null),[_,x]=w.useState(null),[T,S]=w.useState(!1),E=Ju(d),[O,R]=Ln({prop:r,defaultProp:s??!1,onChange:i,caller:jn}),[M,N]=Ln({prop:o,defaultProp:a,onChange:l,caller:jn}),L=w.useRef(null),V=y?!!v||!!y.closest("form"):!0,[j,U]=w.useState(new Set),D=on(),$=Array.from(j).map(I=>I.props.value).join(";"),A=w.useCallback(I=>{U(ee=>new Set(ee).add(I))},[]),F=w.useCallback(I=>{U(ee=>{const J=new Set(ee);return J.delete(I),J})},[]),W={required:h,trigger:y,onTriggerChange:b,valueNode:_,onValueNodeChange:x,valueNodeHasChildren:T,onValueNodeHasChildrenChange:S,contentId:D,value:M,onValueChange:N,open:O,onOpenChange:R,dir:E,triggerPointerDownPosRef:L,disabled:g,name:f,autoComplete:u,form:v,nativeOptions:j,nativeSelectKey:$,isFormControl:V};return c.jsx(Xb,{...m,children:c.jsx(av,{scope:t,...W,children:c.jsx(Oi.Provider,{scope:t,children:c.jsx(cv,{scope:t,onNativeOptionAdd:A,onNativeOptionRemove:F,children:Tv(p)?p(W):n})})})})}Sf.displayName=dv;var Cf=e=>{const{__scopeSelect:t,children:n,...r}=e;return c.jsx(Sf,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:s})=>c.jsxs(c.Fragment,{children:[n,s?c.jsx(Wf,{__scopeSelect:t}):null]})})};Cf.displayName=jn;var Tf="SelectTrigger",Xa=w.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...s}=e,i=Ri(n),o=pn(Tf,n),a=o.disabled||r,l=Ne(t,o.onTriggerChange),d=Ni(n),f=w.useRef("touch"),[u,g,h]=Kf(p=>{const m=d().filter(_=>!_.disabled),y=m.find(_=>_.value===o.value),b=qf(m,p,y);b!==void 0&&o.onValueChange(b.value)}),v=p=>{a||(o.onOpenChange(!0),h()),p&&(o.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return c.jsx(Jb,{asChild:!0,...i,children:c.jsx(ye.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":Li(o.value)?"":void 0,...s,ref:l,onClick:he(s.onClick,p=>{p.currentTarget.focus(),f.current!=="mouse"&&v(p)}),onPointerDown:he(s.onPointerDown,p=>{f.current=p.pointerType;const m=p.target;m.hasPointerCapture(p.pointerId)&&m.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(v(p),p.preventDefault())}),onKeyDown:he(s.onKeyDown,p=>{const m=u.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&g(p.key),!(m&&p.key===" ")&&sv.includes(p.key)&&(v(),p.preventDefault())})})})});Xa.displayName=Tf;var Ef="SelectValue",Pf=w.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,children:i,placeholder:o="",...a}=e,l=pn(Ef,n),{onValueNodeHasChildrenChange:d}=l,f=i!==void 0,u=Ne(t,l.onValueNodeChange);Ie(()=>{d(f)},[d,f]);const g=Li(l.value);return c.jsx(ye.span,{...a,asChild:g?!1:a.asChild,ref:u,style:{pointerEvents:"none"},children:c.jsx(w.Fragment,{children:g?o:i},g?"placeholder":"value")})});Pf.displayName=Ef;var uv="SelectIcon",kf=w.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...s}=e;return c.jsx(ye.span,{"aria-hidden":!0,...s,ref:t,children:r||"▼"})});kf.displayName=uv;var Af="SelectPortal",[fv,mv]=Vn(Af,{forceMount:void 0}),Of=e=>{const{__scopeSelect:t,forceMount:n,...r}=e;return c.jsx(fv,{scope:e.__scopeSelect,forceMount:n,children:c.jsx(Si,{asChild:!0,...r})})};Of.displayName=Af;var un="SelectContent",Ja=w.forwardRef((e,t)=>{const n=mv(un,e.__scopeSelect),{forceMount:r=n.forceMount,...s}=e,i=pn(un,e.__scopeSelect),[o,a]=w.useState();return Ie(()=>{a(new DocumentFragment)},[]),c.jsx($n,{present:r||i.open,children:({present:l})=>l?c.jsx(Lf,{...s,ref:t}):c.jsx(Nf,{...s,fragment:o})})});Ja.displayName=un;var Nf=w.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,fragment:s}=e;return s?Cr.createPortal(c.jsx(Rf,{scope:n,children:c.jsx(Oi.Slot,{scope:n,children:c.jsx("div",{ref:t,children:r})})}),s):null});Nf.displayName="SelectContentFragment";var pt=10,[Rf,hn]=Vn(un),pv="SelectContentImpl",hv=mr("SelectContent.RemoveScroll"),Lf=w.forwardRef((e,t)=>{const{__scopeSelect:n}=e,{position:r="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:i,onPointerDownOutside:o,side:a,sideOffset:l,align:d,alignOffset:f,arrowPadding:u,collisionBoundary:g,collisionPadding:h,sticky:v,hideWhenDetached:p,avoidCollisions:m,...y}=e,b=pn(un,n),[_,x]=w.useState(null),[T,S]=w.useState(null),E=Ne(t,K=>x(K)),[O,R]=w.useState(null),[M,N]=w.useState(null),L=Ni(n),[V,j]=w.useState(!1),U=w.useRef(!1);w.useEffect(()=>{if(_)return Mu(_)},[_]),ku();const D=w.useCallback(K=>{const[de,...fe]=L().map(ne=>ne.ref.current),[ce]=fe.slice(-1),le=document.activeElement;for(const ne of K)if(ne===le||(ne==null||ne.scrollIntoView({block:"nearest"}),ne===de&&T&&(T.scrollTop=0),ne===ce&&T&&(T.scrollTop=T.scrollHeight),ne==null||ne.focus(),document.activeElement!==le))return},[L,T]),$=w.useCallback(()=>D([O,_]),[D,O,_]);w.useEffect(()=>{V&&$()},[V,$]);const{onOpenChange:A,triggerPointerDownPosRef:F}=b;w.useEffect(()=>{if(_){let K={x:0,y:0};const de=ce=>{var le,ne;K={x:Math.abs(Math.round(ce.pageX)-(((le=F.current)==null?void 0:le.x)??0)),y:Math.abs(Math.round(ce.pageY)-(((ne=F.current)==null?void 0:ne.y)??0))}},fe=ce=>{K.x<=10&&K.y<=10?ce.preventDefault():ce.composedPath().includes(_)||A(!1),document.removeEventListener("pointermove",de),F.current=null};return F.current!==null&&(document.addEventListener("pointermove",de),document.addEventListener("pointerup",fe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",de),document.removeEventListener("pointerup",fe,{capture:!0})}}},[_,A,F]),w.useEffect(()=>{const K=()=>A(!1);return window.addEventListener("blur",K),window.addEventListener("resize",K),()=>{window.removeEventListener("blur",K),window.removeEventListener("resize",K)}},[A]);const[W,I]=Kf(K=>{const de=L().filter(le=>!le.disabled),fe=de.find(le=>le.ref.current===document.activeElement),ce=qf(de,K,fe);ce&&setTimeout(()=>{var le;return(le=ce.ref.current)==null?void 0:le.focus()})}),ee=w.useCallback((K,de,fe)=>{const ce=!U.current&&!fe;(b.value!==void 0&&b.value===de||ce)&&(R(K),ce&&(U.current=!0))},[b.value]),J=w.useCallback(()=>_==null?void 0:_.focus(),[_]),ue=w.useCallback((K,de,fe)=>{const ce=!U.current&&!fe;(b.value!==void 0&&b.value===de||ce)&&N(K)},[b.value]),me=r==="popper"?Uo:Df,B=me===Uo?{side:a,sideOffset:l,align:d,alignOffset:f,arrowPadding:u,collisionBoundary:g,collisionPadding:h,sticky:v,hideWhenDetached:p,avoidCollisions:m}:{};return c.jsx(Rf,{scope:n,content:_,viewport:T,onViewportChange:S,itemRefCallback:ee,selectedItem:O,onItemLeave:J,itemTextRefCallback:ue,focusSelectedItem:$,selectedItemText:M,position:r,isPositioned:V,searchRef:W,children:c.jsx(Da,{as:hv,allowPinchZoom:!0,children:c.jsx(La,{asChild:!0,trapped:b.open,onMountAutoFocus:K=>{K.preventDefault()},onUnmountAutoFocus:he(s,K=>{var de;(de=b.trigger)==null||de.focus({preventScroll:!0}),K.preventDefault()}),children:c.jsx(xi,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:K=>K.preventDefault(),onDismiss:()=>b.onOpenChange(!1),children:c.jsx(me,{role:"listbox",id:b.contentId,"data-state":b.open?"open":"closed",dir:b.dir,onContextMenu:K=>K.preventDefault(),...y,...B,onPlaced:()=>j(!0),ref:E,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:he(y.onKeyDown,K=>{const de=K.ctrlKey||K.altKey||K.metaKey;if(K.key==="Tab"&&K.preventDefault(),!de&&K.key.length===1&&I(K.key),["ArrowUp","ArrowDown","Home","End"].includes(K.key)){let ce=L().filter(le=>!le.disabled).map(le=>le.ref.current);if(["ArrowUp","End"].includes(K.key)&&(ce=ce.slice().reverse()),["ArrowUp","ArrowDown"].includes(K.key)){const le=K.target,ne=ce.indexOf(le);ce=ce.slice(ne+1)}setTimeout(()=>D(ce)),K.preventDefault()}})})})})})})});Lf.displayName=pv;var gv="SelectItemAlignedPosition",Df=w.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...s}=e,i=pn(un,n),o=hn(un,n),[a,l]=w.useState(null),[d,f]=w.useState(null),u=Ne(t,E=>f(E)),g=Ni(n),h=w.useRef(!1),v=w.useRef(!0),{viewport:p,selectedItem:m,selectedItemText:y,focusSelectedItem:b}=o,_=w.useCallback(()=>{if(i.trigger&&i.valueNode&&a&&d&&p&&m&&y){const E=i.trigger.getBoundingClientRect(),O=d.getBoundingClientRect(),R=i.valueNode.getBoundingClientRect(),M=y.getBoundingClientRect();if(i.dir!=="rtl"){const le=M.left-O.left,ne=R.left-le,z=E.left-ne,we=E.width+z,Ae=Math.max(we,O.width),Q=window.innerWidth-pt,ke=pl(ne,[pt,Math.max(pt,Q-Ae)]);a.style.minWidth=we+"px",a.style.left=ke+"px"}else{const le=O.right-M.right,ne=window.innerWidth-R.right-le,z=window.innerWidth-E.right-ne,we=E.width+z,Ae=Math.max(we,O.width),Q=window.innerWidth-pt,ke=pl(ne,[pt,Math.max(pt,Q-Ae)]);a.style.minWidth=we+"px",a.style.right=ke+"px"}const N=g(),L=window.innerHeight-pt*2,V=p.scrollHeight,j=window.getComputedStyle(d),U=parseInt(j.borderTopWidth,10),D=parseInt(j.paddingTop,10),$=parseInt(j.borderBottomWidth,10),A=parseInt(j.paddingBottom,10),F=U+D+V+A+$,W=Math.min(m.offsetHeight*5,F),I=window.getComputedStyle(p),ee=parseInt(I.paddingTop,10),J=parseInt(I.paddingBottom,10),ue=E.top+E.height/2-pt,me=L-ue,B=m.offsetHeight/2,K=m.offsetTop+B,de=U+D+K,fe=F-de;if(de<=ue){const le=N.length>0&&m===N[N.length-1].ref.current;a.style.bottom="0px";const ne=d.clientHeight-p.offsetTop-p.offsetHeight,z=Math.max(me,B+(le?J:0)+ne+$),we=de+z;a.style.height=we+"px"}else{const le=N.length>0&&m===N[0].ref.current;a.style.top="0px";const z=Math.max(ue,U+p.offsetTop+(le?ee:0)+B)+fe;a.style.height=z+"px",p.scrollTop=de-ue+p.offsetTop}a.style.margin=`${pt}px 0`,a.style.minHeight=W+"px",a.style.maxHeight=L+"px",r==null||r(),requestAnimationFrame(()=>h.current=!0)}},[g,i.trigger,i.valueNode,a,d,p,m,y,i.dir,r]);Ie(()=>_(),[_]);const[x,T]=w.useState();Ie(()=>{d&&T(window.getComputedStyle(d).zIndex)},[d]);const S=w.useCallback(E=>{E&&v.current===!0&&(_(),b==null||b(),v.current=!1)},[_,b]);return c.jsx(bv,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:h,onScrollButtonChange:S,children:c.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:x},children:c.jsx(ye.div,{...s,ref:u,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});Df.displayName=gv;var yv="SelectPopperPosition",Uo=w.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=pt,...i}=e,o=Ri(n);return c.jsx(ev,{...o,...i,ref:t,align:r,collisionPadding:s,style:{boxSizing:"border-box",...i.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)"}})});Uo.displayName=yv;var[bv,ec]=Vn(un,{}),Bo="SelectViewport",jf=w.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...s}=e,i=hn(Bo,n),o=ec(Bo,n),a=Ne(t,i.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(Oi.Slot,{scope:n,children:c.jsx(ye.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:he(s.onScroll,d=>{const f=d.currentTarget,{contentWrapper:u,shouldExpandOnScrollRef:g}=o;if(g!=null&&g.current&&u){const h=Math.abs(l.current-f.scrollTop);if(h>0){const v=window.innerHeight-pt*2,p=parseFloat(u.style.minHeight),m=parseFloat(u.style.height),y=Math.max(p,m);if(y<v){const b=y+h,_=Math.min(v,b),x=b-_;u.style.height=_+"px",u.style.bottom==="0px"&&(f.scrollTop=x>0?x:0,u.style.justifyContent="flex-end")}}}l.current=f.scrollTop})})})]})});jf.displayName=Bo;var If="SelectGroup",[vv,wv]=Vn(If),_v=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=on();return c.jsx(vv,{scope:n,id:s,children:c.jsx(ye.div,{role:"group","aria-labelledby":s,...r,ref:t})})});_v.displayName=If;var Mf="SelectLabel",tc=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=wv(Mf,n);return c.jsx(ye.div,{id:s.id,...r,ref:t})});tc.displayName=Mf;var ri="SelectItem",[xv,Ff]=Vn(ri),nc=w.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:s=!1,textValue:i,...o}=e,a=pn(ri,n),l=hn(ri,n),d=a.value===r,[f,u]=w.useState(i??""),[g,h]=w.useState(!1),v=Ne(t,b=>{var _;return(_=l.itemRefCallback)==null?void 0:_.call(l,b,r,s)}),p=on(),m=w.useRef("touch"),y=()=>{s||(a.onValueChange(r),a.onOpenChange(!1))};return c.jsx(xv,{scope:n,value:r,disabled:s,textId:p,isSelected:d,onItemTextChange:w.useCallback(b=>{u(_=>_||((b==null?void 0:b.textContent)??"").trim())},[]),children:c.jsx(Oi.ItemSlot,{scope:n,value:r,disabled:s,textValue:f,children:c.jsx(ye.div,{role:"option","aria-labelledby":p,"data-highlighted":g?"":void 0,"aria-selected":d&&g,"data-state":d?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...o,ref:v,onFocus:he(o.onFocus,()=>h(!0)),onBlur:he(o.onBlur,()=>h(!1)),onClick:he(o.onClick,()=>{m.current!=="mouse"&&y()}),onPointerUp:he(o.onPointerUp,()=>{m.current==="mouse"&&y()}),onPointerDown:he(o.onPointerDown,b=>{m.current=b.pointerType}),onPointerMove:he(o.onPointerMove,b=>{var _;m.current=b.pointerType,s?(_=l.onItemLeave)==null||_.call(l):m.current==="mouse"&&b.currentTarget.focus({preventScroll:!0})}),onPointerLeave:he(o.onPointerLeave,b=>{var _;b.currentTarget===document.activeElement&&((_=l.onItemLeave)==null||_.call(l))}),onKeyDown:he(o.onKeyDown,b=>{var x;((x=l.searchRef)==null?void 0:x.current)!==""&&b.key===" "||(iv.includes(b.key)&&y(),b.key===" "&&b.preventDefault())})})})})});nc.displayName=ri;var Fr="SelectItemText",Uf=w.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,...i}=e,o=pn(Fr,n),a=hn(Fr,n),l=Ff(Fr,n),d=lv(Fr,n),[f,u]=w.useState(null),g=Ne(t,y=>u(y),l.onItemTextChange,y=>{var b;return(b=a.itemTextRefCallback)==null?void 0:b.call(a,y,l.value,l.disabled)}),h=f==null?void 0:f.textContent,v=w.useMemo(()=>c.jsx("option",{value:l.value,disabled:l.disabled,children:h},l.value),[l.disabled,l.value,h]),{onNativeOptionAdd:p,onNativeOptionRemove:m}=d;return Ie(()=>(p(v),()=>m(v)),[p,m,v]),c.jsxs(c.Fragment,{children:[c.jsx(ye.span,{id:l.textId,...i,ref:g}),l.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!Li(o.value)?Cr.createPortal(i.children,o.valueNode):null]})});Uf.displayName=Fr;var Bf="SelectItemIndicator",$f=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return Ff(Bf,n).isSelected?c.jsx(ye.span,{"aria-hidden":!0,...r,ref:t}):null});$f.displayName=Bf;var $o="SelectScrollUpButton",rc=w.forwardRef((e,t)=>{const n=hn($o,e.__scopeSelect),r=ec($o,e.__scopeSelect),[s,i]=w.useState(!1),o=Ne(t,r.onScrollButtonChange);return Ie(()=>{if(n.viewport&&n.isPositioned){let a=function(){const d=l.scrollTop>0;i(d)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),s?c.jsx(Vf,{...e,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});rc.displayName=$o;var Vo="SelectScrollDownButton",sc=w.forwardRef((e,t)=>{const n=hn(Vo,e.__scopeSelect),r=ec(Vo,e.__scopeSelect),[s,i]=w.useState(!1),o=Ne(t,r.onScrollButtonChange);return Ie(()=>{if(n.viewport&&n.isPositioned){let a=function(){const d=l.scrollHeight-l.clientHeight,f=Math.ceil(l.scrollTop)<d;i(f)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),s?c.jsx(Vf,{...e,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});sc.displayName=Vo;var Vf=w.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...s}=e,i=hn("SelectScrollButton",n),o=w.useRef(null),a=Ni(n),l=w.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return w.useEffect(()=>()=>l(),[l]),Ie(()=>{var f;const d=a().find(u=>u.ref.current===document.activeElement);(f=d==null?void 0:d.ref.current)==null||f.scrollIntoView({block:"nearest"})},[a]),c.jsx(ye.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:he(s.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:he(s.onPointerMove,()=>{var d;(d=i.onItemLeave)==null||d.call(i),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:he(s.onPointerLeave,()=>{l()})})}),Sv="SelectSeparator",ic=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return c.jsx(ye.div,{"aria-hidden":!0,...r,ref:t})});ic.displayName=Sv;var Hf="SelectArrow",Cv=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=Ri(n);return hn(Hf,n).position==="popper"?c.jsx(tv,{...s,...r,ref:t}):null});Cv.displayName=Hf;var zf="SelectBubbleInput",Wf=w.forwardRef(({__scopeSelect:e,...t},n)=>{const r=pn(zf,e),{value:s,onValueChange:i,required:o,disabled:a,name:l,autoComplete:d,form:f}=r,{nativeOptions:u,nativeSelectKey:g}=r,h=w.useRef(null),v=Ne(n,h),p=s??"",m=nv(p),y=Array.from(u).some(b=>(b.props.value??"")==="");return w.useEffect(()=>{const b=h.current;if(!b)return;const _=window.HTMLSelectElement.prototype,T=Object.getOwnPropertyDescriptor(_,"value").set;if(m!==p&&T){const S=new Event("change",{bubbles:!0});T.call(b,p),b.dispatchEvent(S)}},[m,p]),c.jsxs(ye.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:l,autoComplete:d,disabled:a,form:f,onChange:b=>i(b.target.value),...t,style:{...xf,...t.style},ref:v,defaultValue:p,children:[Li(s)&&!y?c.jsx("option",{value:""}):null,Array.from(u)]},g)});Wf.displayName=zf;function Tv(e){return typeof e=="function"}function Li(e){return e===""||e===void 0}function Kf(e){const t=yt(e),n=w.useRef(""),r=w.useRef(0),s=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]),i=w.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return w.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,s,i]}function qf(e,t,n){const s=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let o=Ev(e,Math.max(i,0));s.length===1&&(o=o.filter(d=>d!==n));const l=o.find(d=>d.textValue.toLowerCase().startsWith(s.toLowerCase()));return l!==n?l:void 0}function Ev(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Di(e,t){if(e==null)return{};var n={},r=Object.keys(e),s,i;for(i=0;i<r.length;i++)s=r[i],!(t.indexOf(s)>=0)&&(n[s]=e[s]);return n}var Pv=["color"],kv=C.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,s=Di(e,Pv);return C.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:t}),C.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"}))}),Av=["color"],oc=C.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,s=Di(e,Av);return C.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:t}),C.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"}))}),Ov=["color"],Nv=C.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,s=Di(e,Ov);return C.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:t}),C.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"}))}),Rv=["color"],Lv=C.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,s=Di(e,Rv);return C.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:t}),C.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 si=Cf,ii=Pf,Kr=w.forwardRef(({className:e,children:t,...n},r)=>c.jsxs(Xa,{ref:r,className:Pe("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(kf,{asChild:!0,children:c.jsx(oc,{className:"h-4 w-4 opacity-50"})})]}));Kr.displayName=Xa.displayName;const Gf=w.forwardRef(({className:e,...t},n)=>c.jsx(rc,{ref:n,className:Pe("flex cursor-default items-center justify-center py-1",e),...t,children:c.jsx(Nv,{className:"h-4 w-4"})}));Gf.displayName=rc.displayName;const Zf=w.forwardRef(({className:e,...t},n)=>c.jsx(sc,{ref:n,className:Pe("flex cursor-default items-center justify-center py-1",e),...t,children:c.jsx(oc,{className:"h-4 w-4"})}));Zf.displayName=sc.displayName;const qr=w.forwardRef(({className:e,children:t,position:n="popper",...r},s)=>c.jsx(Of,{children:c.jsxs(Ja,{ref:s,className:Pe("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(Gf,{}),c.jsx(jf,{className:Pe("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),c.jsx(Zf,{})]})}));qr.displayName=Ja.displayName;const Dv=w.forwardRef(({className:e,...t},n)=>c.jsx(tc,{ref:n,className:Pe("px-2 py-1.5 text-sm font-semibold",e),...t}));Dv.displayName=tc.displayName;const Gr=w.forwardRef(({className:e,children:t,...n},r)=>c.jsxs(nc,{ref:r,className:Pe("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($f,{children:c.jsx(kv,{className:"h-4 w-4"})})}),c.jsx(Uf,{children:t})]}));Gr.displayName=nc.displayName;const jv=w.forwardRef(({className:e,...t},n)=>c.jsx(ic,{ref:n,className:Pe("-mx-1 my-1 h-px bg-muted",e),...t}));jv.displayName=ic.displayName;function Yf({open:e,isAccountsLoading:t,accountOptions:n,onConfirm:r,backUrl:s,createAccountUrl:i}){var u;const[o,a]=C.useState(""),l=o||((u=n[0])==null?void 0:u.login)||"",d=!t&&n.length>0&&l!=="",f=!t&&n.length===0;return c.jsx(Iy,{open:e,children:c.jsxs(Gu,{className:"web-trading-widget-account-modal",onPointerDownOutside:g=>g.preventDefault(),onEscapeKeyDown:g=>g.preventDefault(),children:[c.jsxs(Zu,{children:[c.jsx(Qu,{children:"Select trading account"}),c.jsx(Xu,{children:"Choose an account to continue trading on the chart."})]}),t?c.jsx("p",{className:"web-trading-widget-account-modal__loading",children:"Loading accounts…"}):n.length===0?c.jsx("p",{className:"web-trading-widget-account-modal__error",children:"No trading accounts available."}):c.jsxs(si,{value:l,onValueChange:a,children:[c.jsx(Kr,{className:"web-trading-widget-account-modal__select",children:c.jsx(ii,{placeholder:"Select account"})}),c.jsx(qr,{children:n.map(g=>c.jsxs(Gr,{value:g.login,children:[g.label," (",g.balance.toFixed(2)," ",g.currency,")"]},g.login))})]}),c.jsx(Yu,{children:f?c.jsxs(c.Fragment,{children:[s?c.jsx(ct,{asChild:!0,variant:"outline",children:c.jsx("a",{href:s,children:"Just back"})}):null,i?c.jsx(ct,{asChild:!0,children:c.jsx("a",{href:i,children:"Create account"})}):null]}):c.jsx(ct,{type:"button",disabled:!d,onClick:()=>r(l),children:"Continue"})})]})})}var Iv={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 Mv=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),lt=(e,t)=>{const n=C.forwardRef(({color:r="currentColor",size:s=24,strokeWidth:i=2,absoluteStrokeWidth:o,children:a,...l},d)=>C.createElement("svg",{ref:d,...Iv,width:s,height:s,stroke:r,strokeWidth:o?Number(i)*24/Number(s):i,className:`lucide lucide-${Mv(e)}`,...l},[...t.map(([f,u])=>C.createElement(f,u)),...(Array.isArray(a)?a:[a])||[]]));return n.displayName=`${e}`,n},oi=lt("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),Fv=lt("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),Uv=lt("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),Ho=lt("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),Qf=lt("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"}]]),Xf=lt("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"}]]),Bv=lt("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"}]]),$v=lt("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"}]]),Vv=lt("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]),Hv=lt("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),zv=lt("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"}]]),gn=lt("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function Wv(e){const t=Math.round(Math.log10(e));return Number.isFinite(t)&&t>0?t:5}function ac(e){const t=Ke(e).toUpperCase();if(t)return Bt.find(n=>{var r,s;return((r=n.resolve_symbol)==null?void 0:r.toUpperCase())===t||((s=n.display_name)==null?void 0:s.toUpperCase())===t||n.ticker.replace(/_/g,"").toUpperCase()===t})}function Kv(e){const t=ac(e);return t!=null&&t.pricescale?Wv(t.pricescale):5}function Jf(e,t){if(t)for(const r of["digits","Digits"]){const s=t[r];if(s!=null&&s!==""){const i=Number(s);if(Number.isFinite(i))return Math.round(i)}}const n=Ke(e).toUpperCase();return n.includes("XAU")||n.includes("GOLD")?2:n.includes("JPY")?3:5}function qv(e){const t=ac(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 cc="USD";function as(e){return Ke(e).toUpperCase()}function ji(e){const t=as(e);return t.length>=6?t.slice(3):cc}function lc(e){if(e!==cc&&e==="JPY")return"USDJPY"}function Gv(e,t,n,r,s){const i=ji(e),o=lc(i);if(!o)return;if(as(e)===o){const d=t==="buy"?n:r;return d>0?d:void 0}const a=s[o];if(!a)return;const l=(a.bid+a.ask)/2;return l>0?l:void 0}function Zv(e,t,n,r,s,i,o={}){const a=e==="buy"?n:r;let d=(e==="buy"?a-t:t-a)*s*qv(i);const f=ji(i),u=Gv(i,e,n,r,o);if(u!==void 0)d/=u;else if(f!==cc)return null;return Math.round(d*100)/100}function Yv(e){const t=new Set;for(const n of e){const r=lc(ji(n));r&&as(n)!==r&&t.add(r)}return[...t]}function Qv(e,t){const n=as(e);if(n===t)return!0;const r=lc(ji(e));return r===t&&n!==r}function Xv(e,t,n,r,s){if(!Qv(e.symbol,t))return e;const i=as(e.symbol)===t,o=i?n:e.marketBid??e.currentPrice,a=i?r:e.marketAsk??e.currentPrice,l=e.type==="buy"?o:a,d=Zv(e.type,e.openPrice,o,a,e.volumeLots,e.symbol,s);return{...e,currentPrice:l,marketBid:o,marketAsk:a,profit:d??e.profit}}function Ke(e){const t=e.trim();return t?t.replace(/m$/i,""):""}function Ii(e){return Ke(e)||"—"}const Ye={BUY:0,SELL:1,BUY_LIMIT:2,SELL_LIMIT:3,BUY_STOP:4,SELL_STOP:5,BUY_STOP_LIMIT:6,SELL_STOP_LIMIT:7},ai=[{mode:"market",label:"Market Execution",orderType:null,isMarket:!0},{mode:"buy_limit",label:"Buy Limit",orderType:Ye.BUY_LIMIT,isMarket:!1},{mode:"sell_limit",label:"Sell Limit",orderType:Ye.SELL_LIMIT,isMarket:!1},{mode:"buy_stop",label:"Buy Stop",orderType:Ye.BUY_STOP,isMarket:!1},{mode:"sell_stop",label:"Sell Stop",orderType:Ye.SELL_STOP,isMarket:!1},{mode:"buy_stop_limit",label:"Buy Stop Limit",orderType:Ye.BUY_STOP_LIMIT,isMarket:!1},{mode:"sell_stop_limit",label:"Sell Stop Limit",orderType:Ye.SELL_STOP_LIMIT,isMarket:!1}];function Mi(e){return ai.find(t=>t.mode===e)??ai[0]}function Fi(e){return Mi(e).isMarket}function zo(e,t){const n=Mi(e);return n.orderType!==null?n.orderType:t==="buy"?Ye.BUY:Ye.SELL}function ci(e){return e%2===1?"sell":"buy"}function dc(e){return e>=Ye.BUY_LIMIT&&e<=Ye.SELL_STOP_LIMIT}function uc(e){return e===Ye.BUY_STOP_LIMIT||e===Ye.SELL_STOP_LIMIT}function em(e){return e==="buy_stop_limit"||e==="sell_stop_limit"}const gt={GTC:0,TODAY:1,SPECIFIED:2,SPECIFIED_DAY:3},tm=[{value:gt.GTC,label:"GTC"},{value:gt.TODAY,label:"Today"},{value:gt.SPECIFIED,label:"Specified"},{value:gt.SPECIFIED_DAY,label:"Specified Day"}];function fc(e){return e===gt.SPECIFIED}function mc(e){return e===gt.SPECIFIED_DAY}function Jv(e){return e.map(t=>({login:t.login,label:t.label,balance:t.tradeStat.balance,currency:t.currency}))}function ew(){if(typeof window>"u")return null;const e=localStorage.getItem(bu);return(e==null?void 0:e.trim())||null}function El(e){if(typeof window>"u")return;const t=e.trim();t&&localStorage.setItem(bu,t)}function tw(e,t){var n;return t&&e.some(r=>r.login===t)?t:((n=e[0])==null?void 0:n.login)??""}function pc(e,t=Bt){return t.find(n=>n.ticker===e)}function nw(e,t=Bt){var s;const n=Ke(e).toUpperCase();if(!n)return null;const r=t.find(i=>{var o;return Ke(i.resolve_symbol??"").toUpperCase()===n||((o=i.display_name)==null?void 0:o.toUpperCase())===n||i.ticker.replace(/_/g,"").toUpperCase()===n||i.ticker.toUpperCase()===n});return r?r.ticker:((s=ac(e))==null?void 0:s.ticker)??null}function nm(e,t=Bt){const n=pc(e,t),r=(n==null?void 0:n.resolve_symbol)??e.replace(/_/g,"");return Ke(r).toUpperCase()}function Ui(e,t=Bt){const n=pc(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=Bt){const n=pc(e,t);return(n==null?void 0:n.pricescale)??1e5}function Ce(e,t){return e.toFixed(t)}function Pr(e){return 1/10**e}function hc(e,t){return e===null||t===null?null:(e+t)/2}function Ue(e){const t=e.trim();if(!t)return;const n=Number(t);if(!(!Number.isFinite(n)||n<=0))return n}function rm(e,t,n){if(fc(e)){if(!t.trim())return;const r=Date.parse(t);return Number.isFinite(r)?Math.floor(r/1e3):void 0}if(mc(e)){if(!n.trim())return;const r=Date.parse(`${n}T23:59:59`);return Number.isFinite(r)?Math.floor(r/1e3):void 0}}function Bi(e,t,n){return e===gt.GTC||e===gt.TODAY?!0:rm(e,t,n)!==void 0}const rw={},Pl=e=>{let t;const n=new Set,r=(f,u)=>{const g=typeof f=="function"?f(t):f;if(!Object.is(g,t)){const h=t;t=u??(typeof g!="object"||g===null)?g:Object.assign({},t,g),n.forEach(v=>v(t,h))}},s=()=>t,l={setState:r,getState:s,getInitialState:()=>d,subscribe:f=>(n.add(f),()=>n.delete(f)),destroy:()=>{(rw?"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,s,l);return l},sw=e=>e?Pl(e):Pl;function iw(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Os={exports:{}},uo={},Ns={exports:{}},fo={};/**
|
|
42
42
|
* @license React
|
|
43
43
|
* use-sync-external-store-shim.production.js
|
|
44
44
|
*
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
*
|
|
47
47
|
* This source code is licensed under the MIT license found in the
|
|
48
48
|
* LICENSE file in the root directory of this source tree.
|
|
49
|
-
*/var
|
|
49
|
+
*/var kl;function ow(){if(kl)return fo;kl=1;var e=C;function t(u,g){return u===g&&(u!==0||1/u===1/g)||u!==u&&g!==g}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,s=e.useEffect,i=e.useLayoutEffect,o=e.useDebugValue;function a(u,g){var h=g(),v=r({inst:{value:h,getSnapshot:g}}),p=v[0].inst,m=v[1];return i(function(){p.value=h,p.getSnapshot=g,l(p)&&m({inst:p})},[u,h,g]),s(function(){return l(p)&&m({inst:p}),u(function(){l(p)&&m({inst:p})})},[u]),o(h),h}function l(u){var g=u.getSnapshot;u=u.value;try{var h=g();return!n(u,h)}catch{return!0}}function d(u,g){return g()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:a;return fo.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:f,fo}var mo={};/**
|
|
50
50
|
* @license React
|
|
51
51
|
* use-sync-external-store-shim.development.js
|
|
52
52
|
*
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
*
|
|
55
55
|
* This source code is licensed under the MIT license found in the
|
|
56
56
|
* LICENSE file in the root directory of this source tree.
|
|
57
|
-
*/var
|
|
57
|
+
*/var Al;function aw(){return Al||(Al=1,process.env.NODE_ENV!=="production"&&(function(){function e(h,v){return h===v&&(h!==0||1/h===1/v)||h!==h&&v!==v}function t(h,v){f||s.startTransition===void 0||(f=!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 p=v();if(!u){var m=v();i(p,m)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),u=!0)}m=o({inst:{value:p,getSnapshot:v}});var y=m[0].inst,b=m[1];return l(function(){y.value=p,y.getSnapshot=v,n(y)&&b({inst:y})},[h,p,v]),a(function(){return n(y)&&b({inst:y}),h(function(){n(y)&&b({inst:y})})},[h]),d(p),p}function n(h){var v=h.getSnapshot;h=h.value;try{var p=v();return!i(h,p)}catch{return!0}}function r(h,v){return v()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var s=C,i=typeof Object.is=="function"?Object.is:e,o=s.useState,a=s.useEffect,l=s.useLayoutEffect,d=s.useDebugValue,f=!1,u=!1,g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;mo.useSyncExternalStore=s.useSyncExternalStore!==void 0?s.useSyncExternalStore:g,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),mo}var Ol;function sm(){return Ol||(Ol=1,process.env.NODE_ENV==="production"?Ns.exports=ow():Ns.exports=aw()),Ns.exports}/**
|
|
58
58
|
* @license React
|
|
59
59
|
* use-sync-external-store-shim/with-selector.production.js
|
|
60
60
|
*
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
*
|
|
63
63
|
* This source code is licensed under the MIT license found in the
|
|
64
64
|
* LICENSE file in the root directory of this source tree.
|
|
65
|
-
*/var
|
|
65
|
+
*/var Nl;function cw(){if(Nl)return uo;Nl=1;var e=C,t=sm();function n(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var r=typeof Object.is=="function"?Object.is:n,s=t.useSyncExternalStore,i=e.useRef,o=e.useEffect,a=e.useMemo,l=e.useDebugValue;return uo.useSyncExternalStoreWithSelector=function(d,f,u,g,h){var v=i(null);if(v.current===null){var p={hasValue:!1,value:null};v.current=p}else p=v.current;v=a(function(){function y(S){if(!b){if(b=!0,_=S,S=g(S),h!==void 0&&p.hasValue){var E=p.value;if(h(E,S))return x=E}return x=S}if(E=x,r(_,S))return E;var O=g(S);return h!==void 0&&h(E,O)?(_=S,E):(_=S,x=O)}var b=!1,_,x,T=u===void 0?null:u;return[function(){return y(f())},T===null?void 0:function(){return y(T())}]},[f,u,g,h]);var m=s(d,v[0],v[1]);return o(function(){p.hasValue=!0,p.value=m},[m]),l(m),m},uo}var po={};/**
|
|
66
66
|
* @license React
|
|
67
67
|
* use-sync-external-store-shim/with-selector.development.js
|
|
68
68
|
*
|
|
@@ -70,21 +70,21 @@
|
|
|
70
70
|
*
|
|
71
71
|
* This source code is licensed under the MIT license found in the
|
|
72
72
|
* LICENSE file in the root directory of this source tree.
|
|
73
|
-
*/var Al;function aw(){return Al||(Al=1,process.env.NODE_ENV!=="production"&&(function(){function e(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=S,n=tm(),r=typeof Object.is=="function"?Object.is:e,s=n.useSyncExternalStore,i=t.useRef,o=t.useEffect,a=t.useMemo,l=t.useDebugValue;po.useSyncExternalStoreWithSelector=function(d,f,u,y,p){var g=i(null);if(g.current===null){var m={hasValue:!1,value:null};g.current=m}else m=g.current;g=a(function(){function v(C){if(!b){if(b=!0,_=C,C=y(C),p!==void 0&&m.hasValue){var E=m.value;if(p(E,C))return x=E}return x=C}if(E=x,r(_,C))return E;var A=y(C);return p!==void 0&&p(E,A)?(_=C,E):(_=C,x=A)}var b=!1,_,x,P=u===void 0?null:u;return[function(){return v(f())},P===null?void 0:function(){return v(P())}]},[f,u,y,p]);var h=s(d,g[0],g[1]);return o(function(){m.hasValue=!0,m.value=h},[h]),l(h),h},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),po}var Ol;function cw(){return Ol||(Ol=1,process.env.NODE_ENV==="production"?Os.exports=ow():Os.exports=aw()),Os.exports}var lw=cw();const dw=rw(lw),nm={},{useDebugValue:uw}=S,{useSyncExternalStoreWithSelector:fw}=dw;let Nl=!1;const mw=e=>e;function pw(e,t=mw,n){(nm?"production":void 0)!=="production"&&n&&!Nl&&(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"),Nl=!0);const r=fw(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return uw(r),r}const Rl=e=>{(nm?"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"?nw(e):e,n=(r,s)=>pw(t,r,s);return Object.assign(n,t),n},$i=e=>e?Rl(e):Rl,Ll={source:null,entryPrice:null,stopLoss:"",takeProfit:"",side:null,showEntryLine:!1,volumeLots:.01,digits:2,priceStep:.01},se=$i(e=>({...Ll,setDraft:t=>e(n=>({source:t.source,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({...Ll})}));function ho(e,t){return e.toFixed(t)}function hw({symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:s,minVolumeLots:i,isSubmitting:o,isAccountsLoading:a,selectedLogin:l,isDragging:d,sidePanelTab:f="trade",onDragHandlePointerDown:u,onExpandedChange:y,onExpand:p,onPlaceOrder:g}){const[m,h]=S.useState(String(r)),[v,b]=S.useState(null),[_,x]=S.useState(f),P=se(O=>O.setOrderSide),C=se(O=>O.setVolumeLots);f!==_&&(x(f),b(null));const E=v??f==="scan";S.useEffect(()=>{y()},[E,y]);const A=()=>{const O=!E;O&&p(),b(O)},R=Number(Vt(Ht(e))),M=t!==null?Se(t,R):"—",N=n!==null?Se(n,R):"—",H=!o&&!a&&l!==""&&(t!==null&&n!==null),D=O=>{const B=Number(m),W=Number.isFinite(B)&&B>0?B:r,j=Math.max(i,W+O*s),ee=ho(j,2);h(ee),C(j)},F=()=>{const O=Number(m);if(!Number.isFinite(O)||O<=0){h(ho(r,2)),C(r);return}const B=Math.max(i,O),W=ho(B,2);h(W),C(B)},I=O=>{t===null||n===null||P({side:O,entryPrice:O==="buy"?n:t})},U=O=>{if(t===null||n===null||!l)return;const B=Number(m),W=Math.max(i,Number.isFinite(B)&&B>0?B:r);P({side:O,entryPrice:O==="buy"?n:t}),g({login:l,side:O,volumeLots:W,bid:t,ask:n})};return c.jsx("div",{className:`web-trading-widget-mini-order${E?" 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":"Move quick order panel",onPointerDown:u,className:`web-trading-widget-mini-order__drag-handle${d?" web-trading-widget-mini-order__drag-handle--grabbing":""}`,children:c.jsx(Zf,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2})}),E?c.jsxs(c.Fragment,{children:[c.jsxs("button",{type:"button",disabled:!H,className:"web-trading-widget-mini-order__side-btn web-trading-widget-mini-order__side-btn--sell",onMouseDown:()=>I("sell"),onClick:()=>U("sell"),children:[c.jsx("span",{className:"web-trading-widget-mini-order__price",children:M}),c.jsx("span",{className:"web-trading-widget-mini-order__label web-trading-widget-mini-order__label--sell",children:"SELL"})]}),c.jsxs("div",{className:"web-trading-widget-mini-order__volume",children:[c.jsx("button",{type:"button","aria-label":"Decrease volume",disabled:!H,className:"web-trading-widget-mini-order__volume-btn",onClick:()=>D(-1),children:c.jsx(oi,{className:"web-trading-widget-icon web-trading-widget-icon--xs",strokeWidth:2.5})}),c.jsx("input",{type:"text",inputMode:"decimal",value:m,disabled:!H,onChange:O=>h(O.target.value),onBlur:F,className:"web-trading-widget-mini-order__volume-input"}),c.jsx("button",{type:"button","aria-label":"Increase volume",disabled:!H,className:"web-trading-widget-mini-order__volume-btn",onClick:()=>D(1),children:c.jsx($o,{className:"web-trading-widget-icon web-trading-widget-icon--xs",strokeWidth:2.5})})]}),c.jsxs("button",{type:"button",disabled:!H,className:"web-trading-widget-mini-order__side-btn web-trading-widget-mini-order__side-btn--buy",onMouseDown:()=>I("buy"),onClick:()=>U("buy"),children:[c.jsx("span",{className:"web-trading-widget-mini-order__label web-trading-widget-mini-order__label--buy",children:"BUY"}),c.jsx("span",{className:"web-trading-widget-mini-order__price",children:N})]})]}):null,c.jsx("button",{type:"button","aria-label":E?"Collapse quick order panel":"Expand quick order panel","aria-expanded":E,className:"web-trading-widget-mini-order__toggle",onClick:A,children:E?c.jsx(Iv,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2.5}):c.jsx(Mv,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2.5})})]})})}const gw="web-trading-widget-mini-exec-panel-position",rm={x:56,y:96};function Dl(e,t){const n=t==null?void 0:t.offsetParent;if(!t||!n)return e;const r=Math.max(0,n.clientWidth-t.offsetWidth),s=Math.max(0,n.clientHeight-t.offsetHeight);return{x:Math.min(r,Math.max(0,e.x)),y:Math.min(s,Math.max(0,e.y))}}function jl(e,t){e.style.left=`${t.x}px`,e.style.top=`${t.y}px`}function yw(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):rm.x,y:16}}function bw(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 Il(e,t){try{e.hasPointerCapture(t)&&e.releasePointerCapture(t)}catch{}}function sm(e){const t=(e==null?void 0:e.storageKey)??gw,n=(e==null?void 0:e.defaultPosition)??rm,r=e==null?void 0:e.defaultAlign,s=(e==null?void 0:e.isActive)??!0,i=S.useRef(null),[o,a]=S.useState(n),[l,d]=S.useState(!1),f=S.useRef(n),u=S.useRef(null);S.useEffect(()=>{f.current=o},[o]);const y=S.useCallback(m=>{const h=i.current,v=Dl(m,h);f.current=v,a(v),h&&jl(h,v)},[]),p=S.useCallback(()=>{y(f.current)},[y]);S.useEffect(()=>{if(!s)return;const m=bw(t);if(m){y(m);return}const h=r?yw(r,i.current):null;y(h??f.current)},[y,r,s,t]);const g=S.useCallback(m=>{m.preventDefault(),m.stopPropagation();const h=m.currentTarget,v=i.current;if(!v)return;const b=m.pointerId;h.setPointerCapture(b);const _=m.clientX,x=m.clientY,P=f.current;d(!0),document.body.style.cursor="grabbing",document.body.style.userSelect="none";const C=(R,M)=>{const N=Dl({x:P.x+(R-_),y:P.y+(M-x)},v);f.current=N,jl(v,N)},E=R=>{if(R.pointerId===b){Il(h,b),h.removeEventListener("pointermove",A),h.removeEventListener("pointerup",E),h.removeEventListener("pointercancel",E),u.current=null,d(!1),a(f.current),document.body.style.cursor="",document.body.style.userSelect="";try{window.localStorage.setItem(t,JSON.stringify(f.current))}catch{}}},A=R=>{R.pointerId===b&&(R.preventDefault(),C(R.clientX,R.clientY))};h.addEventListener("pointermove",A),h.addEventListener("pointerup",E),h.addEventListener("pointercancel",E),u.current=()=>{Il(h,b),h.removeEventListener("pointermove",A),h.removeEventListener("pointerup",E),h.removeEventListener("pointercancel",E),document.body.style.cursor="",document.body.style.userSelect="",d(!1)}},[t]);return S.useEffect(()=>{const m=()=>{y(f.current)};return window.addEventListener("resize",m),()=>{var h;window.removeEventListener("resize",m),(h=u.current)==null||h.call(u),u.current=null,document.body.style.cursor="",document.body.style.userSelect=""}},[y]),{panelRef:i,position:o,isDragging:l,onDragStart:g,reclamp:p}}const im=200,vw=201,ww=202,_w=203,xw=204,om=0,Sw=2,am=0;function cs(e){const t=Number(e.trim());if(!Number.isFinite(t))throw new Error("Invalid trading account login.");return t}function mc(e){return Math.round(e*1e4)}function Cw(e){return e>=2&&e<=7}function Tw(e){return{Action:xw,Order:Number(e.orderTicket),Login:cs(e.login),Symbol:e.symbol.replace(/m$/i,""),Type:e.orderType}}function Ew(e){return{Action:ww,Login:cs(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 Pw(e){return{Action:_w,Order:Number(e.orderTicket),Login:cs(e.login),Symbol:e.symbol.replace(/m$/i,""),Type:e.orderType,Volume:mc(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 kw(e){const t=e.positionSide==="buy"?1:0;return{Action:im,Login:cs(e.login),Symbol:e.symbol.replace(/m$/i,""),Type:t,TypeFill:om,Volume:mc(e.volumeLots),Digits:e.digits,TypeTime:am,Comment:e.comment??"",Position:Number(e.positionTicket)}}function Aw(e){const t=!Cw(e.orderType);return{Action:t?im:vw,Login:cs(e.login),Symbol:e.symbol,Type:e.orderType,TypeFill:t?om:Sw,Volume:mc(e.volumeLots),Digits:e.digits,TypeTime:e.typeTime??am,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 Ow(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,s,i){return t.trim()?e.get(`/api/trade/deal/page?login=${encodeURIComponent(t)}&from=${n}&to=${r}&offset=${s}&total=${i}`):null}}}const Nw=new Set(["10009","10008"]);function Dt(e){if(e===void 0||e==="")return;const t=Number(e);return Number.isFinite(t)?t:void 0}function Rw(e){const t=Dt(e);return t===void 0?.01:t/1e4}function Lw(e){var t;return(t=e.find(n=>n.answer))==null?void 0:t.answer}function Dw(e){var t,n,r,s;for(const i of e){const o=((t=i.result)==null?void 0:t.Retcode)??((n=i.answer)==null?void 0:n.ResultRetcode);if(o)return{retcode:String(o),price:Dt(((r=i.result)==null?void 0:r.Price)??((s=i.answer)==null?void 0:s.ResultPrice))}}return{retcode:""}}function Ur(e){return Nw.has(e)}function Dr(e,t){var b,_,x;if(!e||typeof e!="object")return null;const r=e.data;if(!(r!=null&&r.length))return null;const s=Lw(r),{retcode:i,price:o}=Dw(r),a=Ur(i),l=(s==null?void 0:s.ResultDeal)||(s==null?void 0:s.ResultOrder)||(s==null?void 0:s.Order),d=((b=s==null?void 0:s.Symbol)==null?void 0:b.trim())||t.symbol,f=Ke(d),u=Dt(s==null?void 0:s.Type),y=u!==void 0?u%2===0?"buy":"sell":t.side,p=Dt(s==null?void 0:s.ResultPrice)??Dt(s==null?void 0:s.PriceOrder)??o??t.openPrice,g=Dt(s==null?void 0:s.ResultMarketBid),m=Dt(s==null?void 0:s.ResultMarketAsk),h=y==="buy"?g??p:m??p,v=zv(f);return{ticket:String(l||Math.floor(Date.now()/1e3)),login:((_=s==null?void 0:s.Login)==null?void 0:_.trim())||t.login,symbol:f,displaySymbol:Ii(f),side:y,volumeLots:Rw(s==null?void 0:s.Volume)||t.volumeLots,openPrice:p,currentPrice:h,stopLoss:Dt(s==null?void 0:s.PriceSL),takeProfit:Dt(s==null?void 0:s.PriceTP),comment:((x=s==null?void 0:s.Comment)==null?void 0:x.trim())||t.comment,digits:Math.round(v),retcode:i,isSuccess:a,marketBid:g,marketAsk:m}}function jw(e){return e.type==="buy"?e.marketBid??e.currentPrice:e.marketAsk??e.currentPrice}function Iw(e,t){return{async submitOrder(n){const r=n.login.trim();if(!r)return{success:!1,message:"Please select a trading account."};const s=Math.max(.01,n.volumeLots),i=Ui(n.symbolTicker,t),o=Number(Vt(Ht(n.symbolTicker,t))),a=Fi(n.executionMode),l=cc(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&&!Bi(d,n.expirationDateTime??"",n.expirationDay??""))return{success:!1,message:"Please set an expiration date for this order."};const f=a?n.side==="buy"?n.ask:n.bid:n.priceOrder??(n.side==="buy"?n.ask:n.bid),u=a?void 0:em(d,n.expirationDateTime??"",n.expirationDay??"");try{const y=Aw({login:r,symbol:i,volumeLots:s,orderType:n.orderType,digits:o,comment:n.comment.trim(),priceOrder:ac(n.orderType)?n.priceOrder:void 0,priceTrigger:l?n.priceTrigger:void 0,priceSL:n.stopLoss,priceTP:n.takeProfit,typeTime:a?void 0:d,timeExpiration:u}),p=await e.sendRequest(y),g=Dr(p,{login:r,symbol:i,side:ci(n.orderType),volumeLots:s,openPrice:f,digits:o,comment:n.comment.trim()});return g!=null&&g.isSuccess?{success:!0,ticket:g.ticket,side:g.side,volumeLots:g.volumeLots,displaySymbol:g.displaySymbol,price:g.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(y){return{success:!1,message:y instanceof Error?y.message:"Failed to place order."}}},async closePosition(n){try{const r=jw(n),s=kw({login:n.login,symbol:n.symbol,positionTicket:n.ticket,volumeLots:n.volumeLots,positionSide:n.type,digits:n.digits,comment:n.comment.trim()}),i=await e.sendRequest(s),o=Dr(i,{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&&!Ur(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=Tw({login:n.login,orderTicket:n.ticket,symbol:n.symbol,orderType:n.orderType}),s=await e.sendRequest(r),i=Dr(s,{login:n.login,symbol:n.symbol,side:n.side,volumeLots:n.volumeLots,openPrice:n.orderPrice,digits:n.digits,comment:n.comment});return i&&!Ur(i.retcode)?{success:!1,message:`Delete failed (retcode ${i.retcode}).`}:{success:!0}}catch(r){return{success:!1,message:r instanceof Error?r.message:"Failed to delete order."}}},async modifyOrder(n,r){try{const s=Pw({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"}),i=await e.sendRequest(s),o=Dr(i,{login:n.login,symbol:n.symbol,side:n.side,volumeLots:r.volumeLots,openPrice:r.priceOrder,digits:n.digits,comment:r.comment.trim()});return o&&!Ur(o.retcode)?{success:!1,message:`Modify failed (retcode ${o.retcode}).`}:{success:!0}}catch(s){return{success:!1,message:s instanceof Error?s.message:"Failed to modify order."}}},async modifyPosition(n,r){try{const s=Ew({login:n.login,positionTicket:n.ticket,symbol:n.symbol,digits:n.digits,priceSL:r.stopLoss,priceTP:r.takeProfit,comment:r.comment.trim()}),i=await e.sendRequest(s),o=Dr(i,{login:n.login,symbol:n.symbol,side:n.type,volumeLots:n.volumeLots,openPrice:n.openPrice,digits:n.digits,comment:r.comment.trim()});return o&&!Ur(o.retcode)?{success:!1,message:`Modify failed (retcode ${o.retcode}).`}:{success:!0}}catch(s){return{success:!1,message:s instanceof Error?s.message:"Failed to modify position."}}}}}function cm(e,t){return function(){return e.apply(t,arguments)}}const{toString:Mw}=Object.prototype,{getPrototypeOf:gr}=Object,{iterator:ls,toStringTag:lm}=Symbol,li=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Zr=(e,t)=>{let n=e;const r=[];for(;n!=null&&n!==Object.prototype;){if(r.indexOf(n)!==-1)return!1;if(r.push(n),li(n,t))return!0;n=gr(n)}return!1},Fw=(e,t)=>e!=null&&Zr(e,t)?e[t]:void 0,pc=(e=>t=>{const n=Mw.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),_t=e=>(e=e.toLowerCase(),t=>pc(t)===e),Vi=e=>t=>typeof t===e,{isArray:In}=Array,yr=Vi("undefined");function kr(e){return e!==null&&!yr(e)&&e.constructor!==null&&!yr(e.constructor)&&Qe(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const dm=_t("ArrayBuffer");function Uw(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&dm(e.buffer),t}const Bw=Vi("string"),Qe=Vi("function"),um=Vi("number"),Ar=e=>e!==null&&typeof e=="object",$w=e=>e===!0||e===!1,zs=e=>{if(!Ar(e))return!1;const t=gr(e);return(t===null||t===Object.prototype||gr(t)===null)&&!Zr(e,lm)&&!Zr(e,ls)},Vw=e=>{if(!Ar(e)||kr(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Hw=_t("Date"),zw=_t("File"),Ww=e=>!!(e&&typeof e.uri<"u"),Kw=e=>e&&typeof e.getParts<"u",qw=_t("Blob"),Gw=_t("FileList"),Zw=e=>Ar(e)&&Qe(e.pipe);function Yw(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const Ml=Yw(),Fl=typeof Ml.FormData<"u"?Ml.FormData:void 0,Qw=e=>{if(!e)return!1;if(Fl&&e instanceof Fl)return!0;const t=gr(e);if(!t||t===Object.prototype||!Qe(e.append))return!1;const n=pc(e);return n==="formdata"||n==="object"&&Qe(e.toString)&&e.toString()==="[object FormData]"},Xw=_t("URLSearchParams"),[Jw,e_,t_,n_]=["ReadableStream","Request","Response","Headers"].map(_t),r_=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ds(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),In(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(kr(e))return;const i=n?Object.getOwnPropertyNames(e):Object.keys(e),o=i.length;let a;for(r=0;r<o;r++)a=i[r],t.call(null,e[a],a,e)}}function fm(e,t){if(kr(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r=n.length,s;for(;r-- >0;)if(s=n[r],t===s.toLowerCase())return s;return null}const vn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,mm=e=>!yr(e)&&e!==vn;function Ho(...e){const{caseless:t,skipUndefined:n}=mm(this)&&this||{},r={},s=(i,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const a=t&&typeof o=="string"&&fm(r,o)||o,l=li(r,a)?r[a]:void 0;zs(l)&&zs(i)?r[a]=Ho(l,i):zs(i)?r[a]=Ho({},i):In(i)?r[a]=i.slice():(!n||!yr(i))&&(r[a]=i)};for(let i=0,o=e.length;i<o;i++){const a=e[i];if(!a||kr(a)||(ds(a,s),typeof a!="object"||In(a)))continue;const l=Object.getOwnPropertySymbols(a);for(let d=0;d<l.length;d++){const f=l[d];h_.call(a,f)&&s(a[f],f)}}return r}const s_=(e,t,n,{allOwnKeys:r}={})=>(ds(t,(s,i)=>{n&&Qe(s)?Object.defineProperty(e,i,{__proto__:null,value:cm(s,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,i,{__proto__:null,value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),i_=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),o_=(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)},a_=(e,t,n,r)=>{let s,i,o;const a={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)o=s[i],(!r||r(o,e,t))&&!a[o]&&(t[o]=e[o],a[o]=!0);e=n!==!1&&gr(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},c_=(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},l_=e=>{if(!e)return null;if(In(e))return e;let t=e.length;if(!um(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},d_=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&gr(Uint8Array)),u_=(e,t)=>{const r=(e&&e[ls]).call(e);let s;for(;(s=r.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},f_=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},m_=_t("HTMLFormElement"),p_=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),{propertyIsEnumerable:h_}=Object.prototype,g_=_t("RegExp"),pm=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};ds(n,(s,i)=>{let o;(o=t(s,i,e))!==!1&&(r[i]=o||s)}),Object.defineProperties(e,r)},y_=e=>{pm(e,(t,n)=>{if(Qe(e)&&["arguments","caller","callee"].includes(n))return!1;const r=e[n];if(Qe(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+"'")})}})},b_=(e,t)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return In(e)?r(e):r(String(e).split(t)),n},v_=()=>{},w_=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function __(e){return!!(e&&Qe(e.append)&&e[lm]==="FormData"&&e[ls])}const x_=e=>{const t=new WeakSet,n=r=>{if(Ar(r)){if(t.has(r))return;if(kr(r))return r;if(!("toJSON"in r)){t.add(r);const s=In(r)?[]:{};return ds(r,(i,o)=>{const a=n(i);!yr(a)&&(s[o]=a)}),t.delete(r),s}}return r};return n(e)},S_=_t("AsyncFunction"),C_=e=>e&&(Ar(e)||Qe(e))&&Qe(e.then)&&Qe(e.catch),hm=((e,t)=>e?setImmediate:t?((n,r)=>(vn.addEventListener("message",({source:s,data:i})=>{s===vn&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),vn.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Qe(vn.postMessage)),T_=typeof queueMicrotask<"u"?queueMicrotask.bind(vn):typeof process<"u"&&process.nextTick||hm,gm=e=>e!=null&&Qe(e[ls]),E_=e=>e!=null&&Zr(e,ls)&&gm(e),k={isArray:In,isArrayBuffer:dm,isBuffer:kr,isFormData:Qw,isArrayBufferView:Uw,isString:Bw,isNumber:um,isBoolean:$w,isObject:Ar,isPlainObject:zs,isEmptyObject:Vw,isReadableStream:Jw,isRequest:e_,isResponse:t_,isHeaders:n_,isUndefined:yr,isDate:Hw,isFile:zw,isReactNativeBlob:Ww,isReactNative:Kw,isBlob:qw,isRegExp:g_,isFunction:Qe,isStream:Zw,isURLSearchParams:Xw,isTypedArray:d_,isFileList:Gw,forEach:ds,merge:Ho,extend:s_,trim:r_,stripBOM:i_,inherits:o_,toFlatObject:a_,kindOf:pc,kindOfTest:_t,endsWith:c_,toArray:l_,forEachEntry:u_,matchAll:f_,isHTMLForm:m_,hasOwnProperty:li,hasOwnProp:li,hasOwnInPrototypeChain:Zr,getSafeProp:Fw,reduceDescriptors:pm,freezeMethods:y_,toObjectSet:b_,toCamelCase:p_,noop:v_,toFiniteNumber:w_,findKey:fm,global:vn,isContextDefined:mm,isSpecCompliantForm:__,toJSONObject:x_,isAsyncFn:S_,isThenable:C_,setImmediate:hm,asap:T_,isIterable:gm,isSafeIterable:E_},P_=k.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"]),k_=e=>{const t={};let n,r,s;return e&&e.split(`
|
|
74
|
-
`).forEach(function(o){s=o.indexOf(":"),n=o.substring(0,s).trim().toLowerCase(),r=o.substring(s+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(s=>r.set(s)),r}static accessor(t){const r=(this[Ul]=this[Ul]={accessors:{}}).accessors,s=this.prototype;function i(o){const a=jr(o);r[a]||(M_(s,o),r[a]=!0)}return k.isArray(t)?t.forEach(i):i(t),this}};We.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);k.reduceDescriptors(We.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});k.freezeMethods(We);const F_="[REDACTED ****]";function U_(e){if(k.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(k.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}function B_(e,t){const n=new Set(t.map(i=>String(i).toLowerCase())),r=[],s=i=>{if(i===null||typeof i!="object"||k.isBuffer(i))return i;if(r.indexOf(i)!==-1)return;i instanceof We&&(i=i.toJSON()),r.push(i);let o;if(k.isArray(i))o=[],i.forEach((a,l)=>{const d=s(a);k.isUndefined(d)||(o[l]=d)});else{if(!k.isPlainObject(i)&&U_(i))return r.pop(),i;o=Object.create(null);for(const[a,l]of Object.entries(i)){const d=n.has(a.toLowerCase())?F_:s(l);k.isUndefined(d)||(o[a]=d)}}return r.pop(),o};return s(e)}let Z=class bm extends Error{static from(t,n,r,s,i,o){const a=new bm(t.message,n||t.code,r,s,i);return a.cause=t,a.name=t.name,t.status!=null&&a.status==null&&(a.status=t.status),o&&Object.assign(a,o),a}constructor(t,n,r,s,i){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),s&&(this.request=s),i&&(this.response=i,this.status=i.status)}toJSON(){const t=this.config,n=t&&k.hasOwnProp(t,"redact")?t.redact:void 0,r=k.isArray(n)&&n.length>0?B_(t,n):k.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}}};Z.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";Z.ERR_BAD_OPTION="ERR_BAD_OPTION";Z.ECONNABORTED="ECONNABORTED";Z.ETIMEDOUT="ETIMEDOUT";Z.ECONNREFUSED="ECONNREFUSED";Z.ERR_NETWORK="ERR_NETWORK";Z.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";Z.ERR_DEPRECATED="ERR_DEPRECATED";Z.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";Z.ERR_BAD_REQUEST="ERR_BAD_REQUEST";Z.ERR_CANCELED="ERR_CANCELED";Z.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";Z.ERR_INVALID_URL="ERR_INVALID_URL";Z.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const $_=null,vm=100;function zo(e){return k.isPlainObject(e)||k.isArray(e)}function wm(e){return k.endsWith(e,"[]")?e.slice(0,-2):e}function yo(e,t,n){return e?e.concat(t).map(function(s,i){return s=wm(s),!n&&i?"["+s+"]":s}).join(n?".":""):t}function V_(e){return k.isArray(e)&&!e.some(zo)}const H_=k.toFlatObject(k,{},null,function(t){return/^is[A-Z]/.test(t)});function Hi(e,t,n){if(!k.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=k.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(b,_){return!k.isUndefined(_[b])});const r=n.metaTokens,s=n.visitor||g,i=n.dots,o=n.indexes,a=n.Blob||typeof Blob<"u"&&Blob,l=n.maxDepth===void 0?vm:n.maxDepth,d=a&&k.isSpecCompliantForm(t),f=[];if(!k.isFunction(s))throw new TypeError("visitor must be a function");function u(v){if(v===null)return"";if(k.isDate(v))return v.toISOString();if(k.isBoolean(v))return v.toString();if(!d&&k.isBlob(v))throw new Z("Blob is not supported. Use a Buffer instead.");return k.isArrayBuffer(v)||k.isTypedArray(v)?d&&typeof Blob=="function"?new Blob([v]):Buffer.from(v):v}function y(v){if(v>l)throw new Z("Object is too deeply nested ("+v+" levels). Max depth: "+l,Z.ERR_FORM_DATA_DEPTH_EXCEEDED)}function p(v,b){if(l===1/0)return JSON.stringify(v);const _=[];return JSON.stringify(v,function(P,C){if(!k.isObject(C))return C;for(;_.length&&_[_.length-1]!==this;)_.pop();return _.push(C),y(b+_.length-1),C})}function g(v,b,_){let x=v;if(k.isReactNative(t)&&k.isReactNativeBlob(v))return t.append(yo(_,b,i),u(v)),!1;if(v&&!_&&typeof v=="object"){if(k.endsWith(b,"{}"))b=r?b:b.slice(0,-2),v=p(v,1);else if(k.isArray(v)&&V_(v)||(k.isFileList(v)||k.endsWith(b,"[]"))&&(x=k.toArray(v)))return b=wm(b),x.forEach(function(C,E){!(k.isUndefined(C)||C===null)&&t.append(o===!0?yo([b],E,i):o===null?b:b+"[]",u(C))}),!1}return zo(v)?!0:(t.append(yo(_,b,i),u(v)),!1)}const m=Object.assign(H_,{defaultVisitor:g,convertValue:u,isVisitable:zo});function h(v,b,_=0){if(!k.isUndefined(v)){if(y(_),f.indexOf(v)!==-1)throw new Error("Circular reference detected in "+b.join("."));f.push(v),k.forEach(v,function(P,C){(!(k.isUndefined(P)||P===null)&&s.call(t,P,k.isString(C)?C.trim():C,b,m))===!0&&h(P,b?b.concat(C):[C],_+1)}),f.pop()}}if(!k.isObject(e))throw new TypeError("data must be an object");return h(e),t}function Bl(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(r){return t[r]})}function gc(e,t){this._pairs=[],e&&Hi(e,this,t)}const _m=gc.prototype;_m.append=function(t,n){this._pairs.push([t,n])};_m.toString=function(t){const n=t?function(r){return t.call(this,r,Bl)}:Bl;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function z_(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function xm(e,t,n){if(!t)return e;const r=k.isFunction(n)?{serialize:n}:n,s=k.getSafeProp(r,"encode")||z_,i=k.getSafeProp(r,"serialize");let o;if(i?o=i(t,r):o=k.isURLSearchParams(t)?t.toString():new gc(t,r).toString(s),o){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class $l{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){k.forEach(this.handlers,function(r){r!==null&&t(r)})}}const yc={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},W_=typeof URLSearchParams<"u"?URLSearchParams:gc,K_=typeof FormData<"u"?FormData:null,q_=typeof Blob<"u"?Blob:null,G_={isBrowser:!0,classes:{URLSearchParams:W_,FormData:K_,Blob:q_},protocols:["http","https","file","blob","url","data"]},bc=typeof window<"u"&&typeof document<"u",Wo=typeof navigator=="object"&&navigator||void 0,Z_=bc&&(!Wo||["ReactNative","NativeScript","NS"].indexOf(Wo.product)<0),Y_=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Q_=bc&&window.location.href||"http://localhost",X_=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:bc,hasStandardBrowserEnv:Z_,hasStandardBrowserWebWorkerEnv:Y_,navigator:Wo,origin:Q_},Symbol.toStringTag,{value:"Module"})),$e={...X_,...G_};function J_(e,t){return Hi(e,new $e.classes.URLSearchParams,{visitor:function(n,r,s,i){return $e.isNode&&k.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}const Vl=vm;function Sm(e){if(e>Vl)throw new Z("FormData field is too deeply nested ("+e+" levels). Max depth: "+Vl,Z.ERR_FORM_DATA_DEPTH_EXCEEDED)}function ex(e){const t=[],n=/\w+|\[(\w*)]/g;let r;for(;(r=n.exec(e))!==null;)Sm(t.length),t.push(r[0]==="[]"?"":r[1]||r[0]);return t}function tx(e){const t={},n=Object.keys(e);let r;const s=n.length;let i;for(r=0;r<s;r++)i=n[r],t[i]=e[i];return t}function Cm(e){function t(n,r,s,i){Sm(i);let o=n[i++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),l=i>=n.length;return o=!o&&k.isArray(s)?s.length:o,l?(k.hasOwnProp(s,o)?s[o]=k.isArray(s[o])?s[o].concat(r):[s[o],r]:s[o]=r,!a):((!k.hasOwnProp(s,o)||!k.isObject(s[o]))&&(s[o]=[]),t(n,r,s[o],i)&&k.isArray(s[o])&&(s[o]=tx(s[o])),!a)}if(k.isFormData(e)&&k.isFunction(e.entries)){const n={};return k.forEachEntry(e,(r,s)=>{t(ex(r),s,n,0)}),n}return null}const Kn=(e,t)=>e!=null&&k.hasOwnProp(e,t)?e[t]:void 0;function nx(e,t,n){if(k.isString(e))try{return(t||JSON.parse)(e),k.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const us={transitional:yc,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=k.isObject(t);if(i&&k.isHTMLForm(t)&&(t=new FormData(t)),k.isFormData(t))return s?JSON.stringify(Cm(t)):t;if(k.isArrayBuffer(t)||k.isBuffer(t)||k.isStream(t)||k.isFile(t)||k.isBlob(t)||k.isReadableStream(t))return t;if(k.isArrayBufferView(t))return t.buffer;if(k.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(i){const l=Kn(this,"formSerializer");if(r.indexOf("application/x-www-form-urlencoded")>-1)return J_(t,l).toString();if((a=k.isFileList(t))||r.indexOf("multipart/form-data")>-1){const d=Kn(this,"env"),f=d&&d.FormData;return Hi(a?{"files[]":t}:t,f&&new f,l)}}return i||s?(n.setContentType("application/json",!1),nx(t)):t}],transformResponse:[function(t){const n=Kn(this,"transitional")||us.transitional,r=n&&n.forcedJSONParsing,s=Kn(this,"responseType"),i=s==="json";if(k.isResponse(t)||k.isReadableStream(t))return t;if(t&&k.isString(t)&&(r&&!s||i)){const a=!(n&&n.silentJSONParsing)&&i;try{return JSON.parse(t,Kn(this,"parseReviver"))}catch(l){if(a)throw l.name==="SyntaxError"?Z.from(l,Z.ERR_BAD_RESPONSE,this,null,Kn(this,"response")):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:$e.classes.FormData,Blob:$e.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};k.forEach(["delete","get","head","post","put","patch","query"],e=>{us.headers[e]={}});function bo(e,t){const n=this||us,r=t||n,s=We.from(r.headers);let i=r.data;return k.forEach(e,function(a){i=a.call(n,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function Tm(e){return!!(e&&e.__CANCEL__)}let fs=class extends Z{constructor(t,n,r){super(t??"canceled",Z.ERR_CANCELED,n,r),this.name="CanceledError",this.__CANCEL__=!0}};function Em(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new Z("Request failed with status code "+n.status,n.status>=400&&n.status<500?Z.ERR_BAD_REQUEST:Z.ERR_BAD_RESPONSE,n.config,n.request,n))}function rx(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}function sx(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,i=0,o;return t=t!==void 0?t:1e3,function(l){const d=Date.now(),f=r[i];o||(o=d),n[s]=l,r[s]=d;let u=i,y=0;for(;u!==s;)y+=n[u++],u=u%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),d-o<t)return;const p=f&&d-f;return p?Math.round(y*1e3/p):void 0}}function ix(e,t){let n=0,r=1e3/t,s,i;const o=(d,f=Date.now())=>{n=f,s=null,i&&(clearTimeout(i),i=null),e(...d)};return[(...d)=>{const f=Date.now(),u=f-n;u>=r?o(d,f):(s=d,i||(i=setTimeout(()=>{i=null,o(s)},r-u)))},()=>s&&o(s)]}const di=(e,t,n=3)=>{let r=0;const s=sx(50,250);return ix(i=>{if(!i||typeof i.loaded!="number")return;const o=i.loaded,a=i.lengthComputable?i.total:void 0,l=a!=null?Math.min(o,a):o,d=Math.max(0,l-r),f=s(d);r=Math.max(r,l);const u={loaded:l,total:a,progress:a?l/a:void 0,bytes:d,rate:f||void 0,estimated:f&&a?(a-l)/f:void 0,event:i,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(u)},n)},Hl=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},zl=e=>(...t)=>k.asap(()=>e(...t)),ox=$e.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,$e.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL($e.origin),$e.navigator&&/(msie|trident)/i.test($e.navigator.userAgent)):()=>!0,ax=$e.hasStandardBrowserEnv?{write(e,t,n,r,s,i,o){if(typeof document>"u")return;const a=[`${e}=${encodeURIComponent(t)}`];k.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),k.isString(r)&&a.push(`path=${r}`),k.isString(s)&&a.push(`domain=${s}`),i===!0&&a.push("secure"),k.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+/,""),s=r.indexOf("=");if(s!==-1&&r.slice(0,s)===e)return decodeURIComponent(r.slice(s+1))}return null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function cx(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function lx(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}const dx=/^https?:(?!\/\/)/i,ux=/[\t\n\r]/g;function fx(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}function mx(e){return fx(e).replace(ux,"")}function Wl(e,t){if(typeof e=="string"&&dx.test(mx(e)))throw new Z('Invalid URL: missing "//" after protocol',Z.ERR_INVALID_URL,t)}function Pm(e,t,n,r){Wl(t,r);let s=!cx(t);return e&&(s||n===!1)?(Wl(e,r),lx(e,t)):t}const Kl=e=>e instanceof We?{...e}:e;function Mn(e,t){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(f,u,y,p){return k.isPlainObject(f)&&k.isPlainObject(u)?k.merge.call({caseless:p},f,u):k.isPlainObject(u)?k.merge({},u):k.isArray(u)?u.slice():u}function s(f,u,y,p){if(k.isUndefined(u)){if(!k.isUndefined(f))return r(void 0,f,y,p)}else return r(f,u,y,p)}function i(f,u){if(!k.isUndefined(u))return r(void 0,u)}function o(f,u){if(k.isUndefined(u)){if(!k.isUndefined(f))return r(void 0,f)}else return r(void 0,u)}function a(f){const u=k.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!k.isUndefined(u))if(k.isPlainObject(u)){if(k.hasOwnProp(u,f))return u[f]}else return;const y=k.hasOwnProp(e,"transitional")?e.transitional:void 0;if(k.isPlainObject(y)&&k.hasOwnProp(y,f))return y[f]}function l(f,u,y){if(k.hasOwnProp(t,y))return r(f,u);if(k.hasOwnProp(e,y))return r(void 0,f)}const d={url:i,method:i,data:i,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:(f,u,y)=>s(Kl(f),Kl(u),y,!0)};return k.forEach(Object.keys({...e,...t}),function(u){if(u==="__proto__"||u==="constructor"||u==="prototype")return;const y=k.hasOwnProp(d,u)?d[u]:s,p=k.hasOwnProp(e,u)?e[u]:void 0,g=k.hasOwnProp(t,u)?t[u]:void 0,m=y(p,g,u);k.isUndefined(m)&&y!==l||(n[u]=m)}),k.hasOwnProp(t,"validateStatus")&&k.isUndefined(t.validateStatus)&&a("validateStatusUndefinedResolves")===!1&&(k.hasOwnProp(e,"validateStatus")?n.validateStatus=r(void 0,e.validateStatus):delete n.validateStatus),n}const px=["content-type","content-length"];function hx(e,t,n){if(n!=="content-only"){e.set(t);return}Object.entries(t).forEach(([r,s])=>{px.includes(r.toLowerCase())&&e.set(r,s)})}const gx=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,n)=>String.fromCharCode(parseInt(n,16)));function km(e){const t=Mn({},e),n=y=>k.hasOwnProp(t,y)?t[y]:void 0,r=n("data");let s=n("withXSRFToken");const i=n("xsrfHeaderName"),o=n("xsrfCookieName");let a=n("headers");const l=n("auth"),d=n("baseURL"),f=n("allowAbsoluteUrls"),u=n("url");if(t.headers=a=We.from(a),t.url=xm(Pm(d,u,f,t),n("params"),n("paramsSerializer")),l){const y=k.getSafeProp(l,"username")||"",p=k.getSafeProp(l,"password")||"";a.set("Authorization","Basic "+btoa(y+":"+(p?gx(p):"")))}if(k.isFormData(r)&&($e.hasStandardBrowserEnv||$e.hasStandardBrowserWebWorkerEnv||k.isReactNative(r)?a.setContentType(void 0):k.isFunction(r.getHeaders)&&hx(a,r.getHeaders(),n("formDataHeaderPolicy"))),$e.hasStandardBrowserEnv&&(k.isFunction(s)&&(s=s(t)),s===!0||s==null&&ox(t.url))){const p=i&&o&&ax.read(o);p&&a.set(i,p)}return t}const yx=typeof XMLHttpRequest<"u",bx=yx&&function(e){return new Promise(function(n,r){const s=km(e);let i=s.data;const o=We.from(s.headers).normalize();let{responseType:a,onUploadProgress:l,onDownloadProgress:d}=s,f,u,y,p,g;function m(){p&&p(),g&&g(),s.cancelToken&&s.cancelToken.unsubscribe(f),s.signal&&s.signal.removeEventListener("abort",f)}let h=new XMLHttpRequest;h.open(s.method.toUpperCase(),s.url,!0),h.timeout=s.timeout;function v(){if(!h)return;const _=We.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),P={data:!a||a==="text"||a==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:_,config:e,request:h};Em(function(E){n(E),m()},function(E){r(E),m()},P),h=null}"onloadend"in h?h.onloadend=v:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.startsWith("file:"))||setTimeout(v)},h.onabort=function(){h&&(r(new Z("Request aborted",Z.ECONNABORTED,e,h)),m(),h=null)},h.onerror=function(x){const P=x&&x.message?x.message:"Network Error",C=new Z(P,Z.ERR_NETWORK,e,h);C.event=x||null,r(C),m(),h=null},h.ontimeout=function(){let x=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const P=s.transitional||yc;s.timeoutErrorMessage&&(x=s.timeoutErrorMessage),r(new Z(x,P.clarifyTimeoutError?Z.ETIMEDOUT:Z.ECONNABORTED,e,h)),m(),h=null},i===void 0&&o.setContentType(null),"setRequestHeader"in h&&k.forEach(ym(o),function(x,P){h.setRequestHeader(P,x)}),k.isUndefined(s.withCredentials)||(h.withCredentials=!!s.withCredentials),a&&a!=="json"&&(h.responseType=s.responseType),d&&([y,g]=di(d,!0),h.addEventListener("progress",y)),l&&h.upload&&([u,p]=di(l),h.upload.addEventListener("progress",u),h.upload.addEventListener("loadend",p)),(s.cancelToken||s.signal)&&(f=_=>{h&&(r(!_||_.type?new fs(null,e,h):_),h.abort(),m(),h=null)},s.cancelToken&&s.cancelToken.subscribe(f),s.signal&&(s.signal.aborted?f():s.signal.addEventListener("abort",f)));const b=rx(s.url);if(b&&!$e.protocols.includes(b)){r(new Z("Unsupported protocol "+b+":",Z.ERR_BAD_REQUEST,e));return}h.send(i||null)})},vx=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const n=new AbortController;let r=!1;const s=function(l){if(!r){r=!0,o();const d=l instanceof Error?l:this.reason;n.abort(d instanceof Z?d:new fs(d instanceof Error?d.message:d))}};let i=t&&setTimeout(()=>{i=null,s(new Z(`timeout of ${t}ms exceeded`,Z.ETIMEDOUT))},t);const o=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(l=>{l.unsubscribe?l.unsubscribe(s):l.removeEventListener("abort",s)}),e=null)};e.forEach(l=>l.addEventListener("abort",s));const{signal:a}=n;return a.unsubscribe=()=>k.asap(o),a},wx=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,s;for(;r<n;)s=r+t,yield e.slice(r,s),r=s},_x=async function*(e,t){for await(const n of xx(e))yield*wx(n,t)},xx=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()}},ql=(e,t,n,r)=>{const s=_x(e,t);let i=0,o,a=l=>{o||(o=!0,r&&r(l))};return new ReadableStream({async pull(l){try{const{done:d,value:f}=await s.next();if(d){a(),l.close();return}let u=f.byteLength;if(n){let y=i+=u;n(y)}l.enqueue(new Uint8Array(f))}catch(d){throw a(d),d}},cancel(l){return a(l),s.return()}},{highWaterMark:2})},ui=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,Sx=(e,t,n)=>t+2<n&&ui(e.charCodeAt(t+1))&&ui(e.charCodeAt(t+2));function Cx(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 g=r.charCodeAt(p+1),m=r.charCodeAt(p+2);ui(g)&&ui(m)&&(o-=2,p+=2)}let l=0,d=a-1;const f=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--):f(d)&&(l++,d-=3)),l===1&&d>=0&&(r.charCodeAt(d)===61||f(d))&&l++;const y=Math.floor(o/4)*3-(l||0);return y>0?y:0}let i=0;for(let o=0,a=r.length;o<a;o++){const l=r.charCodeAt(o);if(l===37&&Sx(r,o,a))i+=1,o+=2;else if(l<128)i+=1;else if(l<2048)i+=2;else if(l>=55296&&l<=56319&&o+1<a){const d=r.charCodeAt(o+1);d>=56320&&d<=57343?(i+=4,o++):i+=3}else i+=3}return i}const vc="1.18.0",Gl=64*1024,{isFunction:Rs}=k,Tx=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,n)=>String.fromCharCode(parseInt(n,16))),Zl=e=>{if(!k.isString(e))return e;try{return decodeURIComponent(e)}catch{return e}},Yl=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Ex=e=>{const t=e.indexOf("://");let n=e;return t!==-1&&(n=n.slice(t+3)),n.includes("@")||n.includes(":")},Px=e=>{const t=k.global!==void 0&&k.global!==null?k.global:globalThis,{ReadableStream:n,TextEncoder:r}=t;e=k.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:s,Request:i,Response:o}=e,a=s?Rs(s):typeof fetch=="function",l=Rs(i),d=Rs(o);if(!a)return!1;const f=a&&Rs(n),u=a&&(typeof r=="function"?(v=>b=>v.encode(b))(new r):async v=>new Uint8Array(await new i(v).arrayBuffer())),y=l&&f&&Yl(()=>{let v=!1;const b=new i($e.origin,{body:new n,method:"POST",get duplex(){return v=!0,"half"}}),_=b.headers.has("Content-Type");return b.body!=null&&b.body.cancel(),v&&!_}),p=d&&f&&Yl(()=>k.isReadableStream(new o("").body)),g={stream:p&&(v=>v.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(v=>{!g[v]&&(g[v]=(b,_)=>{let x=b&&b[v];if(x)return x.call(b);throw new Z(`Response type '${v}' is not supported`,Z.ERR_NOT_SUPPORT,_)})});const m=async v=>{if(v==null)return 0;if(k.isBlob(v))return v.size;if(k.isSpecCompliantForm(v))return(await new i($e.origin,{method:"POST",body:v}).arrayBuffer()).byteLength;if(k.isArrayBufferView(v)||k.isArrayBuffer(v))return v.byteLength;if(k.isURLSearchParams(v)&&(v=v+""),k.isString(v))return(await u(v)).byteLength},h=async(v,b)=>{const _=k.toFiniteNumber(v.getContentLength());return _??m(b)};return async v=>{let{url:b,method:_,data:x,signal:P,cancelToken:C,timeout:E,onDownloadProgress:A,onUploadProgress:R,responseType:M,headers:N,withCredentials:L="same-origin",fetchOptions:H,maxContentLength:D,maxBodyLength:F}=km(v);const I=k.isNumber(D)&&D>-1,U=k.isNumber(F)&&F>-1,O=V=>k.hasOwnProp(v,V)?v[V]:void 0;let B=s||fetch;M=M?(M+"").toLowerCase():"text";let W=vx([P,C&&C.toAbortSignal()],E),j=null;const ee=W&&W.unsubscribe&&(()=>{W.unsubscribe()});let X,de=null;const ue=()=>new Z("Request body larger than maxBodyLength limit",Z.ERR_BAD_REQUEST,v,j);try{let V;const K=O("auth");if(K){const J=k.getSafeProp(K,"username")||"",Ne=k.getSafeProp(K,"password")||"";V={username:J,password:Ne}}if(Ex(b)){const J=new URL(b,$e.origin);if(!V&&(J.username||J.password)){const Ne=Zl(J.username),Be=Zl(J.password);V={username:Ne,password:Be}}(J.username||J.password)&&(J.username="",J.password="",b=J.href)}if(V&&(N.delete("authorization"),N.set("Authorization","Basic "+btoa(Tx((V.username||"")+":"+(V.password||""))))),I&&typeof b=="string"&&b.startsWith("data:")&&Cx(b)>D)throw new Z("maxContentLength size of "+D+" exceeded",Z.ERR_BAD_RESPONSE,v,j);if(U&&_!=="get"&&_!=="head"){const J=await m(x);if(typeof J=="number"&&isFinite(J)&&(X=J,J>F))throw ue()}const ie=U&&(k.isReadableStream(x)||k.isStream(x)),ge=(J,Ne,Be)=>ql(J,Gl,Xe=>{if(U&&Xe>F)throw de=ue();Ne&&Ne(Xe)},Be);if(y&&_!=="get"&&_!=="head"&&(R||ie)){if(X=X??await h(N,x),X!==0||ie){let J=new i(b,{method:"POST",body:x,duplex:"half"}),Ne;if(k.isFormData(x)&&(Ne=J.headers.get("content-type"))&&N.setContentType(Ne),J.body){const[Be,Xe]=R&&Hl(X,di(zl(R)))||[];x=ge(J.body,Be,Xe)}}}else if(ie&&!l&&f&&_!=="get"&&_!=="head")x=ge(x);else if(ie&&l&&!y&&_!=="get"&&_!=="head")throw new Z("Stream request bodies are not supported by the current fetch implementation",Z.ERR_NOT_SUPPORT,v,j);k.isString(L)||(L=L?"include":"omit");const le=l&&"credentials"in i.prototype;if(k.isFormData(x)){const J=N.getContentType();J&&/^multipart\/form-data/i.test(J)&&!/boundary=/i.test(J)&&N.delete("content-type")}N.set("User-Agent","axios/"+vc,!1);const oe={...H,signal:W,method:_.toUpperCase(),headers:ym(N.normalize()),body:x,duplex:"half",credentials:le?L:void 0};j=l&&new i(b,oe);let $=await(l?B(j,H):B(b,oe));const we=We.from($.headers);if(I){const J=k.toFiniteNumber(we.getContentLength());if(J!=null&&J>D)throw new Z("maxContentLength size of "+D+" exceeded",Z.ERR_BAD_RESPONSE,v,j)}const ke=p&&(M==="stream"||M==="response");if(p&&$.body&&(A||I||ke&&ee)){const J={};["status","statusText","headers"].forEach(Ve=>{J[Ve]=$[Ve]});const Ne=k.toFiniteNumber(we.getContentLength()),[Be,Xe]=A&&Hl(Ne,di(zl(A),!0))||[];let ft=0;const re=Ve=>{if(I&&(ft=Ve,ft>D))throw new Z("maxContentLength size of "+D+" exceeded",Z.ERR_BAD_RESPONSE,v,j);Be&&Be(Ve)};$=new o(ql($.body,Gl,re,()=>{Xe&&Xe(),ee&&ee()}),J)}M=M||"text";let Pe=await g[k.findKey(g,M)||"text"]($,v);if(I&&!p&&!ke){let J;if(Pe!=null&&(typeof Pe.byteLength=="number"?J=Pe.byteLength:typeof Pe.size=="number"?J=Pe.size:typeof Pe=="string"&&(J=typeof r=="function"?new r().encode(Pe).byteLength:Pe.length)),typeof J=="number"&&J>D)throw new Z("maxContentLength size of "+D+" exceeded",Z.ERR_BAD_RESPONSE,v,j)}return!ke&&ee&&ee(),await new Promise((J,Ne)=>{Em(J,Ne,{data:Pe,headers:We.from($.headers),status:$.status,statusText:$.statusText,config:v,request:j})})}catch(V){if(ee&&ee(),W&&W.aborted&&W.reason instanceof Z){const K=W.reason;throw K.config=v,j&&(K.request=j),V!==K&&(K.cause=V),K}throw de?(j&&!de.request&&(de.request=j),de):V instanceof Z?(j&&!V.request&&(V.request=j),V):V&&V.name==="TypeError"&&/Load failed|fetch/i.test(V.message)?Object.assign(new Z("Network Error",Z.ERR_NETWORK,v,j,V&&V.response),{cause:V.cause||V}):Z.from(V,V&&V.code,v,j,V&&V.response)}}},kx=new Map,Am=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,i=[r,s,n];let o=i.length,a=o,l,d,f=kx;for(;a--;)l=i[a],d=f.get(l),d===void 0&&f.set(l,d=a?new Map:Px(t)),f=d;return d};Am();const wc={http:$_,xhr:bx,fetch:{get:Am}};k.forEach(wc,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const Ql=e=>`- ${e}`,Ax=e=>k.isFunction(e)||e===null||e===!1;function Ox(e,t){e=k.isArray(e)?e:[e];const{length:n}=e;let r,s;const i={};for(let o=0;o<n;o++){r=e[o];let a;if(s=r,!Ax(r)&&(s=wc[(a=String(r)).toLowerCase()],s===void 0))throw new Z(`Unknown adapter '${a}'`);if(s&&(k.isFunction(s)||(s=s.get(t))))break;i[a||"#"+o]=s}if(!s){const o=Object.entries(i).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
|
-
`):" "+
|
|
73
|
+
*/var Rl;function lw(){return Rl||(Rl=1,process.env.NODE_ENV!=="production"&&(function(){function e(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=C,n=sm(),r=typeof Object.is=="function"?Object.is:e,s=n.useSyncExternalStore,i=t.useRef,o=t.useEffect,a=t.useMemo,l=t.useDebugValue;po.useSyncExternalStoreWithSelector=function(d,f,u,g,h){var v=i(null);if(v.current===null){var p={hasValue:!1,value:null};v.current=p}else p=v.current;v=a(function(){function y(S){if(!b){if(b=!0,_=S,S=g(S),h!==void 0&&p.hasValue){var E=p.value;if(h(E,S))return x=E}return x=S}if(E=x,r(_,S))return E;var O=g(S);return h!==void 0&&h(E,O)?(_=S,E):(_=S,x=O)}var b=!1,_,x,T=u===void 0?null:u;return[function(){return y(f())},T===null?void 0:function(){return y(T())}]},[f,u,g,h]);var m=s(d,v[0],v[1]);return o(function(){p.hasValue=!0,p.value=m},[m]),l(m),m},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),po}var Ll;function dw(){return Ll||(Ll=1,process.env.NODE_ENV==="production"?Os.exports=cw():Os.exports=lw()),Os.exports}var uw=dw();const fw=iw(uw),im={},{useDebugValue:mw}=C,{useSyncExternalStoreWithSelector:pw}=fw;let Dl=!1;const hw=e=>e;function gw(e,t=hw,n){(im?"production":void 0)!=="production"&&n&&!Dl&&(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"),Dl=!0);const r=pw(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return mw(r),r}const jl=e=>{(im?"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"?sw(e):e,n=(r,s)=>gw(t,r,s);return Object.assign(n,t),n},$i=e=>e?jl(e):jl,Il={source:null,entryPrice:null,stopLoss:"",takeProfit:"",side:null,showEntryLine:!1,volumeLots:.01,digits:2,priceStep:.01},ie=$i(e=>({...Il,setDraft:t=>e(n=>({source:t.source,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({...Il})}));function ho(e,t){return e.toFixed(t)}function yw({symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:s,minVolumeLots:i,isSubmitting:o,isAccountsLoading:a,selectedLogin:l,isDragging:d,sidePanelTab:f="trade",onDragHandlePointerDown:u,onExpandedChange:g,onExpand:h,onPlaceOrder:v}){const[p,m]=C.useState(String(r)),[y,b]=C.useState(null),[_,x]=C.useState(f),T=ie(A=>A.setOrderSide),S=ie(A=>A.setVolumeLots);f!==_&&(x(f),b(null));const E=y??f==="scan";C.useEffect(()=>{g()},[E,g]);const O=()=>{const A=!E;A&&h(),b(A)},R=Number(Vt(Ht(e))),M=t!==null?Ce(t,R):"—",N=n!==null?Ce(n,R):"—",V=!o&&!a&&l!==""&&(t!==null&&n!==null),j=A=>{const F=Number(p),W=Number.isFinite(F)&&F>0?F:r,I=Math.max(i,W+A*s),ee=ho(I,2);m(ee),S(I)},U=()=>{const A=Number(p);if(!Number.isFinite(A)||A<=0){m(ho(r,2)),S(r);return}const F=Math.max(i,A),W=ho(F,2);m(W),S(F)},D=A=>{t===null||n===null||T({side:A,entryPrice:A==="buy"?n:t})},$=A=>{if(t===null||n===null||!l)return;const F=Number(p),W=Math.max(i,Number.isFinite(F)&&F>0?F:r);T({side:A,entryPrice:A==="buy"?n:t}),v({login:l,side:A,volumeLots:W,bid:t,ask:n})};return c.jsx("div",{className:`web-trading-widget-mini-order${E?" 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":"Move quick order panel",onPointerDown:u,className:`web-trading-widget-mini-order__drag-handle${d?" web-trading-widget-mini-order__drag-handle--grabbing":""}`,children:c.jsx(Xf,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2})}),E?c.jsxs(c.Fragment,{children:[c.jsxs("button",{type:"button",disabled:!V,className:"web-trading-widget-mini-order__side-btn web-trading-widget-mini-order__side-btn--sell",onMouseDown:()=>D("sell"),onClick:()=>$("sell"),children:[c.jsx("span",{className:"web-trading-widget-mini-order__price",children:M}),c.jsx("span",{className:"web-trading-widget-mini-order__label web-trading-widget-mini-order__label--sell",children:"SELL"})]}),c.jsxs("div",{className:"web-trading-widget-mini-order__volume",children:[c.jsx("button",{type:"button","aria-label":"Decrease volume",disabled:!V,className:"web-trading-widget-mini-order__volume-btn",onClick:()=>j(-1),children:c.jsx(oi,{className:"web-trading-widget-icon web-trading-widget-icon--xs",strokeWidth:2.5})}),c.jsx("input",{type:"text",inputMode:"decimal",value:p,disabled:!V,onChange:A=>m(A.target.value),onBlur:U,className:"web-trading-widget-mini-order__volume-input"}),c.jsx("button",{type:"button","aria-label":"Increase volume",disabled:!V,className:"web-trading-widget-mini-order__volume-btn",onClick:()=>j(1),children:c.jsx(Ho,{className:"web-trading-widget-icon web-trading-widget-icon--xs",strokeWidth:2.5})})]}),c.jsxs("button",{type:"button",disabled:!V,className:"web-trading-widget-mini-order__side-btn web-trading-widget-mini-order__side-btn--buy",onMouseDown:()=>D("buy"),onClick:()=>$("buy"),children:[c.jsx("span",{className:"web-trading-widget-mini-order__label web-trading-widget-mini-order__label--buy",children:"BUY"}),c.jsx("span",{className:"web-trading-widget-mini-order__price",children:N})]})]}):null,c.jsx("button",{type:"button","aria-label":E?"Collapse quick order panel":"Expand quick order panel","aria-expanded":E,className:"web-trading-widget-mini-order__toggle",onClick:O,children:E?c.jsx(Fv,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2.5}):c.jsx(Uv,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2.5})})]})})}const bw="web-trading-widget-mini-exec-panel-position",om={x:56,y:96};function Ml(e,t){const n=t==null?void 0:t.offsetParent;if(!t||!n)return e;const r=Math.max(0,n.clientWidth-t.offsetWidth),s=Math.max(0,n.clientHeight-t.offsetHeight);return{x:Math.min(r,Math.max(0,e.x)),y:Math.min(s,Math.max(0,e.y))}}function Fl(e,t){e.style.left=`${t.x}px`,e.style.top=`${t.y}px`}function vw(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):om.x,y:16}}function ww(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 Ul(e,t){try{e.hasPointerCapture(t)&&e.releasePointerCapture(t)}catch{}}function am(e){const t=(e==null?void 0:e.storageKey)??bw,n=(e==null?void 0:e.defaultPosition)??om,r=e==null?void 0:e.defaultAlign,s=(e==null?void 0:e.isActive)??!0,i=C.useRef(null),[o,a]=C.useState(n),[l,d]=C.useState(!1),f=C.useRef(n),u=C.useRef(null);C.useEffect(()=>{f.current=o},[o]);const g=C.useCallback(p=>{const m=i.current,y=Ml(p,m);f.current=y,a(y),m&&Fl(m,y)},[]),h=C.useCallback(()=>{g(f.current)},[g]);C.useEffect(()=>{if(!s)return;const p=ww(t);if(p){g(p);return}const m=r?vw(r,i.current):null;g(m??f.current)},[g,r,s,t]);const v=C.useCallback(p=>{p.preventDefault(),p.stopPropagation();const m=p.currentTarget,y=i.current;if(!y)return;const b=p.pointerId;m.setPointerCapture(b);const _=p.clientX,x=p.clientY,T=f.current;d(!0),document.body.style.cursor="grabbing",document.body.style.userSelect="none";const S=(R,M)=>{const N=Ml({x:T.x+(R-_),y:T.y+(M-x)},y);f.current=N,Fl(y,N)},E=R=>{if(R.pointerId===b){Ul(m,b),m.removeEventListener("pointermove",O),m.removeEventListener("pointerup",E),m.removeEventListener("pointercancel",E),u.current=null,d(!1),a(f.current),document.body.style.cursor="",document.body.style.userSelect="";try{window.localStorage.setItem(t,JSON.stringify(f.current))}catch{}}},O=R=>{R.pointerId===b&&(R.preventDefault(),S(R.clientX,R.clientY))};m.addEventListener("pointermove",O),m.addEventListener("pointerup",E),m.addEventListener("pointercancel",E),u.current=()=>{Ul(m,b),m.removeEventListener("pointermove",O),m.removeEventListener("pointerup",E),m.removeEventListener("pointercancel",E),document.body.style.cursor="",document.body.style.userSelect="",d(!1)}},[t]);return C.useEffect(()=>{const p=()=>{g(f.current)};return window.addEventListener("resize",p),()=>{var m;window.removeEventListener("resize",p),(m=u.current)==null||m.call(u),u.current=null,document.body.style.cursor="",document.body.style.userSelect=""}},[g]),{panelRef:i,position:o,isDragging:l,onDragStart:v,reclamp:h}}const cm=200,_w=201,xw=202,Sw=203,Cw=204,lm=0,Tw=2,dm=0;function cs(e){const t=Number(e.trim());if(!Number.isFinite(t))throw new Error("Invalid trading account login.");return t}function gc(e){return Math.round(e*1e4)}function Ew(e){return e>=2&&e<=7}function Pw(e){return{Action:Cw,Order:Number(e.orderTicket),Login:cs(e.login),Symbol:e.symbol.replace(/m$/i,""),Type:e.orderType}}function kw(e){return{Action:xw,Login:cs(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 Aw(e){return{Action:Sw,Order:Number(e.orderTicket),Login:cs(e.login),Symbol:e.symbol.replace(/m$/i,""),Type:e.orderType,Volume:gc(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 Ow(e){const t=e.positionSide==="buy"?1:0;return{Action:cm,Login:cs(e.login),Symbol:e.symbol.replace(/m$/i,""),Type:t,TypeFill:lm,Volume:gc(e.volumeLots),Digits:e.digits,TypeTime:dm,Comment:e.comment??"",Position:Number(e.positionTicket)}}function Nw(e){const t=!Ew(e.orderType);return{Action:t?cm:_w,Login:cs(e.login),Symbol:e.symbol,Type:e.orderType,TypeFill:t?lm:Tw,Volume:gc(e.volumeLots),Digits:e.digits,TypeTime:e.typeTime??dm,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 Rw(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,s,i){return t.trim()?e.get(`/api/trade/deal/page?login=${encodeURIComponent(t)}&from=${n}&to=${r}&offset=${s}&total=${i}`):null}}}const Lw=new Set(["10009","10008"]);function Dt(e){if(e===void 0||e==="")return;const t=Number(e);return Number.isFinite(t)?t:void 0}function Dw(e){const t=Dt(e);return t===void 0?.01:t/1e4}function jw(e){var t;return(t=e.find(n=>n.answer))==null?void 0:t.answer}function Iw(e){var t,n,r,s;for(const i of e){const o=((t=i.result)==null?void 0:t.Retcode)??((n=i.answer)==null?void 0:n.ResultRetcode);if(o)return{retcode:String(o),price:Dt(((r=i.result)==null?void 0:r.Price)??((s=i.answer)==null?void 0:s.ResultPrice))}}return{retcode:""}}function Ur(e){return Lw.has(e)}function Dr(e,t){var b,_,x;if(!e||typeof e!="object")return null;const r=e.data;if(!(r!=null&&r.length))return null;const s=jw(r),{retcode:i,price:o}=Iw(r),a=Ur(i),l=(s==null?void 0:s.ResultDeal)||(s==null?void 0:s.ResultOrder)||(s==null?void 0:s.Order),d=((b=s==null?void 0:s.Symbol)==null?void 0:b.trim())||t.symbol,f=Ke(d),u=Dt(s==null?void 0:s.Type),g=u!==void 0?u%2===0?"buy":"sell":t.side,h=Dt(s==null?void 0:s.ResultPrice)??Dt(s==null?void 0:s.PriceOrder)??o??t.openPrice,v=Dt(s==null?void 0:s.ResultMarketBid),p=Dt(s==null?void 0:s.ResultMarketAsk),m=g==="buy"?v??h:p??h,y=Kv(f);return{ticket:String(l||Math.floor(Date.now()/1e3)),login:((_=s==null?void 0:s.Login)==null?void 0:_.trim())||t.login,symbol:f,displaySymbol:Ii(f),side:g,volumeLots:Dw(s==null?void 0:s.Volume)||t.volumeLots,openPrice:h,currentPrice:m,stopLoss:Dt(s==null?void 0:s.PriceSL),takeProfit:Dt(s==null?void 0:s.PriceTP),comment:((x=s==null?void 0:s.Comment)==null?void 0:x.trim())||t.comment,digits:Math.round(y),retcode:i,isSuccess:a,marketBid:v,marketAsk:p}}function Mw(e){return e.type==="buy"?e.marketBid??e.currentPrice:e.marketAsk??e.currentPrice}function Fw(e,t){return{async submitOrder(n){const r=n.login.trim();if(!r)return{success:!1,message:"Please select a trading account."};const s=Math.max(.01,n.volumeLots),i=Ui(n.symbolTicker,t),o=Number(Vt(Ht(n.symbolTicker,t))),a=Fi(n.executionMode),l=uc(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&&!Bi(d,n.expirationDateTime??"",n.expirationDay??""))return{success:!1,message:"Please set an expiration date for this order."};const f=a?n.side==="buy"?n.ask:n.bid:n.priceOrder??(n.side==="buy"?n.ask:n.bid),u=a?void 0:rm(d,n.expirationDateTime??"",n.expirationDay??"");try{const g=Nw({login:r,symbol:i,volumeLots:s,orderType:n.orderType,digits:o,comment:n.comment.trim(),priceOrder:dc(n.orderType)?n.priceOrder:void 0,priceTrigger:l?n.priceTrigger:void 0,priceSL:n.stopLoss,priceTP:n.takeProfit,typeTime:a?void 0:d,timeExpiration:u}),h=await e.sendRequest(g),v=Dr(h,{login:r,symbol:i,side:ci(n.orderType),volumeLots:s,openPrice:f,digits:o,comment:n.comment.trim()});return v!=null&&v.isSuccess?{success:!0,ticket:v.ticket,side:v.side,volumeLots:v.volumeLots,displaySymbol:v.displaySymbol,price:v.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(g){return{success:!1,message:g instanceof Error?g.message:"Failed to place order."}}},async closePosition(n){try{const r=Mw(n),s=Ow({login:n.login,symbol:n.symbol,positionTicket:n.ticket,volumeLots:n.volumeLots,positionSide:n.type,digits:n.digits,comment:n.comment.trim()}),i=await e.sendRequest(s),o=Dr(i,{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&&!Ur(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=Pw({login:n.login,orderTicket:n.ticket,symbol:n.symbol,orderType:n.orderType}),s=await e.sendRequest(r),i=Dr(s,{login:n.login,symbol:n.symbol,side:n.side,volumeLots:n.volumeLots,openPrice:n.orderPrice,digits:n.digits,comment:n.comment});return i&&!Ur(i.retcode)?{success:!1,message:`Delete failed (retcode ${i.retcode}).`}:{success:!0}}catch(r){return{success:!1,message:r instanceof Error?r.message:"Failed to delete order."}}},async modifyOrder(n,r){try{const s=Aw({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"}),i=await e.sendRequest(s),o=Dr(i,{login:n.login,symbol:n.symbol,side:n.side,volumeLots:r.volumeLots,openPrice:r.priceOrder,digits:n.digits,comment:r.comment.trim()});return o&&!Ur(o.retcode)?{success:!1,message:`Modify failed (retcode ${o.retcode}).`}:{success:!0}}catch(s){return{success:!1,message:s instanceof Error?s.message:"Failed to modify order."}}},async modifyPosition(n,r){try{const s=kw({login:n.login,positionTicket:n.ticket,symbol:n.symbol,digits:n.digits,priceSL:r.stopLoss,priceTP:r.takeProfit,comment:r.comment.trim()}),i=await e.sendRequest(s),o=Dr(i,{login:n.login,symbol:n.symbol,side:n.type,volumeLots:n.volumeLots,openPrice:n.openPrice,digits:n.digits,comment:r.comment.trim()});return o&&!Ur(o.retcode)?{success:!1,message:`Modify failed (retcode ${o.retcode}).`}:{success:!0}}catch(s){return{success:!1,message:s instanceof Error?s.message:"Failed to modify position."}}}}}function um(e,t){return function(){return e.apply(t,arguments)}}const{toString:Uw}=Object.prototype,{getPrototypeOf:gr}=Object,{iterator:ls,toStringTag:fm}=Symbol,li=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Zr=(e,t)=>{let n=e;const r=[];for(;n!=null&&n!==Object.prototype;){if(r.indexOf(n)!==-1)return!1;if(r.push(n),li(n,t))return!0;n=gr(n)}return!1},Bw=(e,t)=>e!=null&&Zr(e,t)?e[t]:void 0,yc=(e=>t=>{const n=Uw.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),_t=e=>(e=e.toLowerCase(),t=>yc(t)===e),Vi=e=>t=>typeof t===e,{isArray:In}=Array,yr=Vi("undefined");function kr(e){return e!==null&&!yr(e)&&e.constructor!==null&&!yr(e.constructor)&&Qe(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const mm=_t("ArrayBuffer");function $w(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&mm(e.buffer),t}const Vw=Vi("string"),Qe=Vi("function"),pm=Vi("number"),Ar=e=>e!==null&&typeof e=="object",Hw=e=>e===!0||e===!1,zs=e=>{if(!Ar(e))return!1;const t=gr(e);return(t===null||t===Object.prototype||gr(t)===null)&&!Zr(e,fm)&&!Zr(e,ls)},zw=e=>{if(!Ar(e)||kr(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Ww=_t("Date"),Kw=_t("File"),qw=e=>!!(e&&typeof e.uri<"u"),Gw=e=>e&&typeof e.getParts<"u",Zw=_t("Blob"),Yw=_t("FileList"),Qw=e=>Ar(e)&&Qe(e.pipe);function Xw(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const Bl=Xw(),$l=typeof Bl.FormData<"u"?Bl.FormData:void 0,Jw=e=>{if(!e)return!1;if($l&&e instanceof $l)return!0;const t=gr(e);if(!t||t===Object.prototype||!Qe(e.append))return!1;const n=yc(e);return n==="formdata"||n==="object"&&Qe(e.toString)&&e.toString()==="[object FormData]"},e_=_t("URLSearchParams"),[t_,n_,r_,s_]=["ReadableStream","Request","Response","Headers"].map(_t),i_=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ds(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),In(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(kr(e))return;const i=n?Object.getOwnPropertyNames(e):Object.keys(e),o=i.length;let a;for(r=0;r<o;r++)a=i[r],t.call(null,e[a],a,e)}}function hm(e,t){if(kr(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r=n.length,s;for(;r-- >0;)if(s=n[r],t===s.toLowerCase())return s;return null}const vn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,gm=e=>!yr(e)&&e!==vn;function Wo(...e){const{caseless:t,skipUndefined:n}=gm(this)&&this||{},r={},s=(i,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const a=t&&typeof o=="string"&&hm(r,o)||o,l=li(r,a)?r[a]:void 0;zs(l)&&zs(i)?r[a]=Wo(l,i):zs(i)?r[a]=Wo({},i):In(i)?r[a]=i.slice():(!n||!yr(i))&&(r[a]=i)};for(let i=0,o=e.length;i<o;i++){const a=e[i];if(!a||kr(a)||(ds(a,s),typeof a!="object"||In(a)))continue;const l=Object.getOwnPropertySymbols(a);for(let d=0;d<l.length;d++){const f=l[d];y_.call(a,f)&&s(a[f],f)}}return r}const o_=(e,t,n,{allOwnKeys:r}={})=>(ds(t,(s,i)=>{n&&Qe(s)?Object.defineProperty(e,i,{__proto__:null,value:um(s,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,i,{__proto__:null,value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),a_=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),c_=(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)},l_=(e,t,n,r)=>{let s,i,o;const a={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)o=s[i],(!r||r(o,e,t))&&!a[o]&&(t[o]=e[o],a[o]=!0);e=n!==!1&&gr(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},d_=(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},u_=e=>{if(!e)return null;if(In(e))return e;let t=e.length;if(!pm(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},f_=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&gr(Uint8Array)),m_=(e,t)=>{const r=(e&&e[ls]).call(e);let s;for(;(s=r.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},p_=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},h_=_t("HTMLFormElement"),g_=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),{propertyIsEnumerable:y_}=Object.prototype,b_=_t("RegExp"),ym=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};ds(n,(s,i)=>{let o;(o=t(s,i,e))!==!1&&(r[i]=o||s)}),Object.defineProperties(e,r)},v_=e=>{ym(e,(t,n)=>{if(Qe(e)&&["arguments","caller","callee"].includes(n))return!1;const r=e[n];if(Qe(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+"'")})}})},w_=(e,t)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return In(e)?r(e):r(String(e).split(t)),n},__=()=>{},x_=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function S_(e){return!!(e&&Qe(e.append)&&e[fm]==="FormData"&&e[ls])}const C_=e=>{const t=new WeakSet,n=r=>{if(Ar(r)){if(t.has(r))return;if(kr(r))return r;if(!("toJSON"in r)){t.add(r);const s=In(r)?[]:{};return ds(r,(i,o)=>{const a=n(i);!yr(a)&&(s[o]=a)}),t.delete(r),s}}return r};return n(e)},T_=_t("AsyncFunction"),E_=e=>e&&(Ar(e)||Qe(e))&&Qe(e.then)&&Qe(e.catch),bm=((e,t)=>e?setImmediate:t?((n,r)=>(vn.addEventListener("message",({source:s,data:i})=>{s===vn&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),vn.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Qe(vn.postMessage)),P_=typeof queueMicrotask<"u"?queueMicrotask.bind(vn):typeof process<"u"&&process.nextTick||bm,vm=e=>e!=null&&Qe(e[ls]),k_=e=>e!=null&&Zr(e,ls)&&vm(e),k={isArray:In,isArrayBuffer:mm,isBuffer:kr,isFormData:Jw,isArrayBufferView:$w,isString:Vw,isNumber:pm,isBoolean:Hw,isObject:Ar,isPlainObject:zs,isEmptyObject:zw,isReadableStream:t_,isRequest:n_,isResponse:r_,isHeaders:s_,isUndefined:yr,isDate:Ww,isFile:Kw,isReactNativeBlob:qw,isReactNative:Gw,isBlob:Zw,isRegExp:b_,isFunction:Qe,isStream:Qw,isURLSearchParams:e_,isTypedArray:f_,isFileList:Yw,forEach:ds,merge:Wo,extend:o_,trim:i_,stripBOM:a_,inherits:c_,toFlatObject:l_,kindOf:yc,kindOfTest:_t,endsWith:d_,toArray:u_,forEachEntry:m_,matchAll:p_,isHTMLForm:h_,hasOwnProperty:li,hasOwnProp:li,hasOwnInPrototypeChain:Zr,getSafeProp:Bw,reduceDescriptors:ym,freezeMethods:v_,toObjectSet:w_,toCamelCase:g_,noop:__,toFiniteNumber:x_,findKey:hm,global:vn,isContextDefined:gm,isSpecCompliantForm:S_,toJSONObject:C_,isAsyncFn:T_,isThenable:E_,setImmediate:bm,asap:P_,isIterable:vm,isSafeIterable:k_},A_=k.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"]),O_=e=>{const t={};let n,r,s;return e&&e.split(`
|
|
74
|
+
`).forEach(function(o){s=o.indexOf(":"),n=o.substring(0,s).trim().toLowerCase(),r=o.substring(s+1).trim(),!(!n||t[n]&&A_[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t};function N_(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 R_=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),L_=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function bc(e,t){return k.isArray(e)?e.map(n=>bc(n,t)):N_(String(e).replace(t,""))}const D_=e=>bc(e,R_),j_=e=>bc(e,L_);function wm(e){const t=Object.create(null);return k.forEach(e.toJSON(),(n,r)=>{t[r]=j_(n)}),t}const Vl=Symbol("internals");function jr(e){return e&&String(e).trim().toLowerCase()}function Ws(e){return e===!1||e==null?e:k.isArray(e)?e.map(Ws):D_(String(e))}function I_(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 M_=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function go(e,t,n,r,s){if(k.isFunction(r))return r.call(this,t,n);if(s&&(t=n),!!k.isString(t)){if(k.isString(r))return t.indexOf(r)!==-1;if(k.isRegExp(r))return r.test(t)}}function F_(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function U_(e,t){const n=k.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{__proto__:null,value:function(s,i,o){return this[r].call(this,t,s,i,o)},configurable:!0})})}let We=class{constructor(t){t&&this.set(t)}set(t,n,r){const s=this;function i(a,l,d){const f=jr(l);if(!f)return;const u=k.findKey(s,f);(!u||s[u]===void 0||d===!0||d===void 0&&s[u]!==!1)&&(s[u||l]=Ws(a))}const o=(a,l)=>k.forEach(a,(d,f)=>i(d,f,l));if(k.isPlainObject(t)||t instanceof this.constructor)o(t,n);else if(k.isString(t)&&(t=t.trim())&&!M_(t))o(O_(t),n);else if(k.isObject(t)&&k.isSafeIterable(t)){let a=Object.create(null),l,d;for(const f of t){if(!k.isArray(f))throw new TypeError("Object iterator must return a key-value pair");d=f[0],k.hasOwnProp(a,d)?(l=a[d],a[d]=k.isArray(l)?[...l,f[1]]:[l,f[1]]):a[d]=f[1]}o(a,n)}else t!=null&&i(n,t,r);return this}get(t,n){if(t=jr(t),t){const r=k.findKey(this,t);if(r){const s=this[r];if(!n)return s;if(n===!0)return I_(s);if(k.isFunction(n))return n.call(this,s,r);if(k.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=jr(t),t){const r=k.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||go(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let s=!1;function i(o){if(o=jr(o),o){const a=k.findKey(r,o);a&&(!n||go(r,r[a],a,n))&&(delete r[a],s=!0)}}return k.isArray(t)?t.forEach(i):i(t),s}clear(t){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const i=n[r];(!t||go(this,this[i],i,t,!0))&&(delete this[i],s=!0)}return s}normalize(t){const n=this,r={};return k.forEach(this,(s,i)=>{const o=k.findKey(r,i);if(o){n[o]=Ws(s),delete n[i];return}const a=t?F_(i):String(i).trim();a!==i&&delete n[i],n[a]=Ws(s),r[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return k.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=t&&k.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(`
|
|
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(s=>r.set(s)),r}static accessor(t){const r=(this[Vl]=this[Vl]={accessors:{}}).accessors,s=this.prototype;function i(o){const a=jr(o);r[a]||(U_(s,o),r[a]=!0)}return k.isArray(t)?t.forEach(i):i(t),this}};We.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);k.reduceDescriptors(We.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});k.freezeMethods(We);const B_="[REDACTED ****]";function $_(e){if(k.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(k.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}function V_(e,t){const n=new Set(t.map(i=>String(i).toLowerCase())),r=[],s=i=>{if(i===null||typeof i!="object"||k.isBuffer(i))return i;if(r.indexOf(i)!==-1)return;i instanceof We&&(i=i.toJSON()),r.push(i);let o;if(k.isArray(i))o=[],i.forEach((a,l)=>{const d=s(a);k.isUndefined(d)||(o[l]=d)});else{if(!k.isPlainObject(i)&&$_(i))return r.pop(),i;o=Object.create(null);for(const[a,l]of Object.entries(i)){const d=n.has(a.toLowerCase())?B_:s(l);k.isUndefined(d)||(o[a]=d)}}return r.pop(),o};return s(e)}let Z=class _m extends Error{static from(t,n,r,s,i,o){const a=new _m(t.message,n||t.code,r,s,i);return a.cause=t,a.name=t.name,t.status!=null&&a.status==null&&(a.status=t.status),o&&Object.assign(a,o),a}constructor(t,n,r,s,i){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),s&&(this.request=s),i&&(this.response=i,this.status=i.status)}toJSON(){const t=this.config,n=t&&k.hasOwnProp(t,"redact")?t.redact:void 0,r=k.isArray(n)&&n.length>0?V_(t,n):k.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}}};Z.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";Z.ERR_BAD_OPTION="ERR_BAD_OPTION";Z.ECONNABORTED="ECONNABORTED";Z.ETIMEDOUT="ETIMEDOUT";Z.ECONNREFUSED="ECONNREFUSED";Z.ERR_NETWORK="ERR_NETWORK";Z.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";Z.ERR_DEPRECATED="ERR_DEPRECATED";Z.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";Z.ERR_BAD_REQUEST="ERR_BAD_REQUEST";Z.ERR_CANCELED="ERR_CANCELED";Z.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";Z.ERR_INVALID_URL="ERR_INVALID_URL";Z.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const H_=null,xm=100;function Ko(e){return k.isPlainObject(e)||k.isArray(e)}function Sm(e){return k.endsWith(e,"[]")?e.slice(0,-2):e}function yo(e,t,n){return e?e.concat(t).map(function(s,i){return s=Sm(s),!n&&i?"["+s+"]":s}).join(n?".":""):t}function z_(e){return k.isArray(e)&&!e.some(Ko)}const W_=k.toFlatObject(k,{},null,function(t){return/^is[A-Z]/.test(t)});function Hi(e,t,n){if(!k.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=k.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(b,_){return!k.isUndefined(_[b])});const r=n.metaTokens,s=n.visitor||v,i=n.dots,o=n.indexes,a=n.Blob||typeof Blob<"u"&&Blob,l=n.maxDepth===void 0?xm:n.maxDepth,d=a&&k.isSpecCompliantForm(t),f=[];if(!k.isFunction(s))throw new TypeError("visitor must be a function");function u(y){if(y===null)return"";if(k.isDate(y))return y.toISOString();if(k.isBoolean(y))return y.toString();if(!d&&k.isBlob(y))throw new Z("Blob is not supported. Use a Buffer instead.");return k.isArrayBuffer(y)||k.isTypedArray(y)?d&&typeof Blob=="function"?new Blob([y]):Buffer.from(y):y}function g(y){if(y>l)throw new Z("Object is too deeply nested ("+y+" levels). Max depth: "+l,Z.ERR_FORM_DATA_DEPTH_EXCEEDED)}function h(y,b){if(l===1/0)return JSON.stringify(y);const _=[];return JSON.stringify(y,function(T,S){if(!k.isObject(S))return S;for(;_.length&&_[_.length-1]!==this;)_.pop();return _.push(S),g(b+_.length-1),S})}function v(y,b,_){let x=y;if(k.isReactNative(t)&&k.isReactNativeBlob(y))return t.append(yo(_,b,i),u(y)),!1;if(y&&!_&&typeof y=="object"){if(k.endsWith(b,"{}"))b=r?b:b.slice(0,-2),y=h(y,1);else if(k.isArray(y)&&z_(y)||(k.isFileList(y)||k.endsWith(b,"[]"))&&(x=k.toArray(y)))return b=Sm(b),x.forEach(function(S,E){!(k.isUndefined(S)||S===null)&&t.append(o===!0?yo([b],E,i):o===null?b:b+"[]",u(S))}),!1}return Ko(y)?!0:(t.append(yo(_,b,i),u(y)),!1)}const p=Object.assign(W_,{defaultVisitor:v,convertValue:u,isVisitable:Ko});function m(y,b,_=0){if(!k.isUndefined(y)){if(g(_),f.indexOf(y)!==-1)throw new Error("Circular reference detected in "+b.join("."));f.push(y),k.forEach(y,function(T,S){(!(k.isUndefined(T)||T===null)&&s.call(t,T,k.isString(S)?S.trim():S,b,p))===!0&&m(T,b?b.concat(S):[S],_+1)}),f.pop()}}if(!k.isObject(e))throw new TypeError("data must be an object");return m(e),t}function Hl(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(r){return t[r]})}function vc(e,t){this._pairs=[],e&&Hi(e,this,t)}const Cm=vc.prototype;Cm.append=function(t,n){this._pairs.push([t,n])};Cm.toString=function(t){const n=t?function(r){return t.call(this,r,Hl)}:Hl;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function K_(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Tm(e,t,n){if(!t)return e;const r=k.isFunction(n)?{serialize:n}:n,s=k.getSafeProp(r,"encode")||K_,i=k.getSafeProp(r,"serialize");let o;if(i?o=i(t,r):o=k.isURLSearchParams(t)?t.toString():new vc(t,r).toString(s),o){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class zl{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){k.forEach(this.handlers,function(r){r!==null&&t(r)})}}const wc={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},q_=typeof URLSearchParams<"u"?URLSearchParams:vc,G_=typeof FormData<"u"?FormData:null,Z_=typeof Blob<"u"?Blob:null,Y_={isBrowser:!0,classes:{URLSearchParams:q_,FormData:G_,Blob:Z_},protocols:["http","https","file","blob","url","data"]},_c=typeof window<"u"&&typeof document<"u",qo=typeof navigator=="object"&&navigator||void 0,Q_=_c&&(!qo||["ReactNative","NativeScript","NS"].indexOf(qo.product)<0),X_=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",J_=_c&&window.location.href||"http://localhost",ex=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:_c,hasStandardBrowserEnv:Q_,hasStandardBrowserWebWorkerEnv:X_,navigator:qo,origin:J_},Symbol.toStringTag,{value:"Module"})),$e={...ex,...Y_};function tx(e,t){return Hi(e,new $e.classes.URLSearchParams,{visitor:function(n,r,s,i){return $e.isNode&&k.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}const Wl=xm;function Em(e){if(e>Wl)throw new Z("FormData field is too deeply nested ("+e+" levels). Max depth: "+Wl,Z.ERR_FORM_DATA_DEPTH_EXCEEDED)}function nx(e){const t=[],n=/\w+|\[(\w*)]/g;let r;for(;(r=n.exec(e))!==null;)Em(t.length),t.push(r[0]==="[]"?"":r[1]||r[0]);return t}function rx(e){const t={},n=Object.keys(e);let r;const s=n.length;let i;for(r=0;r<s;r++)i=n[r],t[i]=e[i];return t}function Pm(e){function t(n,r,s,i){Em(i);let o=n[i++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),l=i>=n.length;return o=!o&&k.isArray(s)?s.length:o,l?(k.hasOwnProp(s,o)?s[o]=k.isArray(s[o])?s[o].concat(r):[s[o],r]:s[o]=r,!a):((!k.hasOwnProp(s,o)||!k.isObject(s[o]))&&(s[o]=[]),t(n,r,s[o],i)&&k.isArray(s[o])&&(s[o]=rx(s[o])),!a)}if(k.isFormData(e)&&k.isFunction(e.entries)){const n={};return k.forEachEntry(e,(r,s)=>{t(nx(r),s,n,0)}),n}return null}const Kn=(e,t)=>e!=null&&k.hasOwnProp(e,t)?e[t]:void 0;function sx(e,t,n){if(k.isString(e))try{return(t||JSON.parse)(e),k.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const us={transitional:wc,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=k.isObject(t);if(i&&k.isHTMLForm(t)&&(t=new FormData(t)),k.isFormData(t))return s?JSON.stringify(Pm(t)):t;if(k.isArrayBuffer(t)||k.isBuffer(t)||k.isStream(t)||k.isFile(t)||k.isBlob(t)||k.isReadableStream(t))return t;if(k.isArrayBufferView(t))return t.buffer;if(k.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(i){const l=Kn(this,"formSerializer");if(r.indexOf("application/x-www-form-urlencoded")>-1)return tx(t,l).toString();if((a=k.isFileList(t))||r.indexOf("multipart/form-data")>-1){const d=Kn(this,"env"),f=d&&d.FormData;return Hi(a?{"files[]":t}:t,f&&new f,l)}}return i||s?(n.setContentType("application/json",!1),sx(t)):t}],transformResponse:[function(t){const n=Kn(this,"transitional")||us.transitional,r=n&&n.forcedJSONParsing,s=Kn(this,"responseType"),i=s==="json";if(k.isResponse(t)||k.isReadableStream(t))return t;if(t&&k.isString(t)&&(r&&!s||i)){const a=!(n&&n.silentJSONParsing)&&i;try{return JSON.parse(t,Kn(this,"parseReviver"))}catch(l){if(a)throw l.name==="SyntaxError"?Z.from(l,Z.ERR_BAD_RESPONSE,this,null,Kn(this,"response")):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:$e.classes.FormData,Blob:$e.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};k.forEach(["delete","get","head","post","put","patch","query"],e=>{us.headers[e]={}});function bo(e,t){const n=this||us,r=t||n,s=We.from(r.headers);let i=r.data;return k.forEach(e,function(a){i=a.call(n,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function km(e){return!!(e&&e.__CANCEL__)}let fs=class extends Z{constructor(t,n,r){super(t??"canceled",Z.ERR_CANCELED,n,r),this.name="CanceledError",this.__CANCEL__=!0}};function Am(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new Z("Request failed with status code "+n.status,n.status>=400&&n.status<500?Z.ERR_BAD_REQUEST:Z.ERR_BAD_RESPONSE,n.config,n.request,n))}function ix(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}function ox(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,i=0,o;return t=t!==void 0?t:1e3,function(l){const d=Date.now(),f=r[i];o||(o=d),n[s]=l,r[s]=d;let u=i,g=0;for(;u!==s;)g+=n[u++],u=u%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),d-o<t)return;const h=f&&d-f;return h?Math.round(g*1e3/h):void 0}}function ax(e,t){let n=0,r=1e3/t,s,i;const o=(d,f=Date.now())=>{n=f,s=null,i&&(clearTimeout(i),i=null),e(...d)};return[(...d)=>{const f=Date.now(),u=f-n;u>=r?o(d,f):(s=d,i||(i=setTimeout(()=>{i=null,o(s)},r-u)))},()=>s&&o(s)]}const di=(e,t,n=3)=>{let r=0;const s=ox(50,250);return ax(i=>{if(!i||typeof i.loaded!="number")return;const o=i.loaded,a=i.lengthComputable?i.total:void 0,l=a!=null?Math.min(o,a):o,d=Math.max(0,l-r),f=s(d);r=Math.max(r,l);const u={loaded:l,total:a,progress:a?l/a:void 0,bytes:d,rate:f||void 0,estimated:f&&a?(a-l)/f:void 0,event:i,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(u)},n)},Kl=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},ql=e=>(...t)=>k.asap(()=>e(...t)),cx=$e.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,$e.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL($e.origin),$e.navigator&&/(msie|trident)/i.test($e.navigator.userAgent)):()=>!0,lx=$e.hasStandardBrowserEnv?{write(e,t,n,r,s,i,o){if(typeof document>"u")return;const a=[`${e}=${encodeURIComponent(t)}`];k.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),k.isString(r)&&a.push(`path=${r}`),k.isString(s)&&a.push(`domain=${s}`),i===!0&&a.push("secure"),k.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+/,""),s=r.indexOf("=");if(s!==-1&&r.slice(0,s)===e)return decodeURIComponent(r.slice(s+1))}return null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function dx(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function ux(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}const fx=/^https?:(?!\/\/)/i,mx=/[\t\n\r]/g;function px(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}function hx(e){return px(e).replace(mx,"")}function Gl(e,t){if(typeof e=="string"&&fx.test(hx(e)))throw new Z('Invalid URL: missing "//" after protocol',Z.ERR_INVALID_URL,t)}function Om(e,t,n,r){Gl(t,r);let s=!dx(t);return e&&(s||n===!1)?(Gl(e,r),ux(e,t)):t}const Zl=e=>e instanceof We?{...e}:e;function Mn(e,t){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(f,u,g,h){return k.isPlainObject(f)&&k.isPlainObject(u)?k.merge.call({caseless:h},f,u):k.isPlainObject(u)?k.merge({},u):k.isArray(u)?u.slice():u}function s(f,u,g,h){if(k.isUndefined(u)){if(!k.isUndefined(f))return r(void 0,f,g,h)}else return r(f,u,g,h)}function i(f,u){if(!k.isUndefined(u))return r(void 0,u)}function o(f,u){if(k.isUndefined(u)){if(!k.isUndefined(f))return r(void 0,f)}else return r(void 0,u)}function a(f){const u=k.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!k.isUndefined(u))if(k.isPlainObject(u)){if(k.hasOwnProp(u,f))return u[f]}else return;const g=k.hasOwnProp(e,"transitional")?e.transitional:void 0;if(k.isPlainObject(g)&&k.hasOwnProp(g,f))return g[f]}function l(f,u,g){if(k.hasOwnProp(t,g))return r(f,u);if(k.hasOwnProp(e,g))return r(void 0,f)}const d={url:i,method:i,data:i,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:(f,u,g)=>s(Zl(f),Zl(u),g,!0)};return k.forEach(Object.keys({...e,...t}),function(u){if(u==="__proto__"||u==="constructor"||u==="prototype")return;const g=k.hasOwnProp(d,u)?d[u]:s,h=k.hasOwnProp(e,u)?e[u]:void 0,v=k.hasOwnProp(t,u)?t[u]:void 0,p=g(h,v,u);k.isUndefined(p)&&g!==l||(n[u]=p)}),k.hasOwnProp(t,"validateStatus")&&k.isUndefined(t.validateStatus)&&a("validateStatusUndefinedResolves")===!1&&(k.hasOwnProp(e,"validateStatus")?n.validateStatus=r(void 0,e.validateStatus):delete n.validateStatus),n}const gx=["content-type","content-length"];function yx(e,t,n){if(n!=="content-only"){e.set(t);return}Object.entries(t).forEach(([r,s])=>{gx.includes(r.toLowerCase())&&e.set(r,s)})}const bx=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,n)=>String.fromCharCode(parseInt(n,16)));function Nm(e){const t=Mn({},e),n=g=>k.hasOwnProp(t,g)?t[g]:void 0,r=n("data");let s=n("withXSRFToken");const i=n("xsrfHeaderName"),o=n("xsrfCookieName");let a=n("headers");const l=n("auth"),d=n("baseURL"),f=n("allowAbsoluteUrls"),u=n("url");if(t.headers=a=We.from(a),t.url=Tm(Om(d,u,f,t),n("params"),n("paramsSerializer")),l){const g=k.getSafeProp(l,"username")||"",h=k.getSafeProp(l,"password")||"";a.set("Authorization","Basic "+btoa(g+":"+(h?bx(h):"")))}if(k.isFormData(r)&&($e.hasStandardBrowserEnv||$e.hasStandardBrowserWebWorkerEnv||k.isReactNative(r)?a.setContentType(void 0):k.isFunction(r.getHeaders)&&yx(a,r.getHeaders(),n("formDataHeaderPolicy"))),$e.hasStandardBrowserEnv&&(k.isFunction(s)&&(s=s(t)),s===!0||s==null&&cx(t.url))){const h=i&&o&&lx.read(o);h&&a.set(i,h)}return t}const vx=typeof XMLHttpRequest<"u",wx=vx&&function(e){return new Promise(function(n,r){const s=Nm(e);let i=s.data;const o=We.from(s.headers).normalize();let{responseType:a,onUploadProgress:l,onDownloadProgress:d}=s,f,u,g,h,v;function p(){h&&h(),v&&v(),s.cancelToken&&s.cancelToken.unsubscribe(f),s.signal&&s.signal.removeEventListener("abort",f)}let m=new XMLHttpRequest;m.open(s.method.toUpperCase(),s.url,!0),m.timeout=s.timeout;function y(){if(!m)return;const _=We.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders()),T={data:!a||a==="text"||a==="json"?m.responseText:m.response,status:m.status,statusText:m.statusText,headers:_,config:e,request:m};Am(function(E){n(E),p()},function(E){r(E),p()},T),m=null}"onloadend"in m?m.onloadend=y:m.onreadystatechange=function(){!m||m.readyState!==4||m.status===0&&!(m.responseURL&&m.responseURL.startsWith("file:"))||setTimeout(y)},m.onabort=function(){m&&(r(new Z("Request aborted",Z.ECONNABORTED,e,m)),p(),m=null)},m.onerror=function(x){const T=x&&x.message?x.message:"Network Error",S=new Z(T,Z.ERR_NETWORK,e,m);S.event=x||null,r(S),p(),m=null},m.ontimeout=function(){let x=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const T=s.transitional||wc;s.timeoutErrorMessage&&(x=s.timeoutErrorMessage),r(new Z(x,T.clarifyTimeoutError?Z.ETIMEDOUT:Z.ECONNABORTED,e,m)),p(),m=null},i===void 0&&o.setContentType(null),"setRequestHeader"in m&&k.forEach(wm(o),function(x,T){m.setRequestHeader(T,x)}),k.isUndefined(s.withCredentials)||(m.withCredentials=!!s.withCredentials),a&&a!=="json"&&(m.responseType=s.responseType),d&&([g,v]=di(d,!0),m.addEventListener("progress",g)),l&&m.upload&&([u,h]=di(l),m.upload.addEventListener("progress",u),m.upload.addEventListener("loadend",h)),(s.cancelToken||s.signal)&&(f=_=>{m&&(r(!_||_.type?new fs(null,e,m):_),m.abort(),p(),m=null)},s.cancelToken&&s.cancelToken.subscribe(f),s.signal&&(s.signal.aborted?f():s.signal.addEventListener("abort",f)));const b=ix(s.url);if(b&&!$e.protocols.includes(b)){r(new Z("Unsupported protocol "+b+":",Z.ERR_BAD_REQUEST,e));return}m.send(i||null)})},_x=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const n=new AbortController;let r=!1;const s=function(l){if(!r){r=!0,o();const d=l instanceof Error?l:this.reason;n.abort(d instanceof Z?d:new fs(d instanceof Error?d.message:d))}};let i=t&&setTimeout(()=>{i=null,s(new Z(`timeout of ${t}ms exceeded`,Z.ETIMEDOUT))},t);const o=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(l=>{l.unsubscribe?l.unsubscribe(s):l.removeEventListener("abort",s)}),e=null)};e.forEach(l=>l.addEventListener("abort",s));const{signal:a}=n;return a.unsubscribe=()=>k.asap(o),a},xx=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,s;for(;r<n;)s=r+t,yield e.slice(r,s),r=s},Sx=async function*(e,t){for await(const n of Cx(e))yield*xx(n,t)},Cx=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()}},Yl=(e,t,n,r)=>{const s=Sx(e,t);let i=0,o,a=l=>{o||(o=!0,r&&r(l))};return new ReadableStream({async pull(l){try{const{done:d,value:f}=await s.next();if(d){a(),l.close();return}let u=f.byteLength;if(n){let g=i+=u;n(g)}l.enqueue(new Uint8Array(f))}catch(d){throw a(d),d}},cancel(l){return a(l),s.return()}},{highWaterMark:2})},ui=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,Tx=(e,t,n)=>t+2<n&&ui(e.charCodeAt(t+1))&&ui(e.charCodeAt(t+2));function Ex(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 v=r.charCodeAt(h+1),p=r.charCodeAt(h+2);ui(v)&&ui(p)&&(o-=2,h+=2)}let l=0,d=a-1;const f=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--):f(d)&&(l++,d-=3)),l===1&&d>=0&&(r.charCodeAt(d)===61||f(d))&&l++;const g=Math.floor(o/4)*3-(l||0);return g>0?g:0}let i=0;for(let o=0,a=r.length;o<a;o++){const l=r.charCodeAt(o);if(l===37&&Tx(r,o,a))i+=1,o+=2;else if(l<128)i+=1;else if(l<2048)i+=2;else if(l>=55296&&l<=56319&&o+1<a){const d=r.charCodeAt(o+1);d>=56320&&d<=57343?(i+=4,o++):i+=3}else i+=3}return i}const xc="1.18.0",Ql=64*1024,{isFunction:Rs}=k,Px=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,n)=>String.fromCharCode(parseInt(n,16))),Xl=e=>{if(!k.isString(e))return e;try{return decodeURIComponent(e)}catch{return e}},Jl=(e,...t)=>{try{return!!e(...t)}catch{return!1}},kx=e=>{const t=e.indexOf("://");let n=e;return t!==-1&&(n=n.slice(t+3)),n.includes("@")||n.includes(":")},Ax=e=>{const t=k.global!==void 0&&k.global!==null?k.global:globalThis,{ReadableStream:n,TextEncoder:r}=t;e=k.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:s,Request:i,Response:o}=e,a=s?Rs(s):typeof fetch=="function",l=Rs(i),d=Rs(o);if(!a)return!1;const f=a&&Rs(n),u=a&&(typeof r=="function"?(y=>b=>y.encode(b))(new r):async y=>new Uint8Array(await new i(y).arrayBuffer())),g=l&&f&&Jl(()=>{let y=!1;const b=new i($e.origin,{body:new n,method:"POST",get duplex(){return y=!0,"half"}}),_=b.headers.has("Content-Type");return b.body!=null&&b.body.cancel(),y&&!_}),h=d&&f&&Jl(()=>k.isReadableStream(new o("").body)),v={stream:h&&(y=>y.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(y=>{!v[y]&&(v[y]=(b,_)=>{let x=b&&b[y];if(x)return x.call(b);throw new Z(`Response type '${y}' is not supported`,Z.ERR_NOT_SUPPORT,_)})});const p=async y=>{if(y==null)return 0;if(k.isBlob(y))return y.size;if(k.isSpecCompliantForm(y))return(await new i($e.origin,{method:"POST",body:y}).arrayBuffer()).byteLength;if(k.isArrayBufferView(y)||k.isArrayBuffer(y))return y.byteLength;if(k.isURLSearchParams(y)&&(y=y+""),k.isString(y))return(await u(y)).byteLength},m=async(y,b)=>{const _=k.toFiniteNumber(y.getContentLength());return _??p(b)};return async y=>{let{url:b,method:_,data:x,signal:T,cancelToken:S,timeout:E,onDownloadProgress:O,onUploadProgress:R,responseType:M,headers:N,withCredentials:L="same-origin",fetchOptions:V,maxContentLength:j,maxBodyLength:U}=Nm(y);const D=k.isNumber(j)&&j>-1,$=k.isNumber(U)&&U>-1,A=B=>k.hasOwnProp(y,B)?y[B]:void 0;let F=s||fetch;M=M?(M+"").toLowerCase():"text";let W=_x([T,S&&S.toAbortSignal()],E),I=null;const ee=W&&W.unsubscribe&&(()=>{W.unsubscribe()});let J,ue=null;const me=()=>new Z("Request body larger than maxBodyLength limit",Z.ERR_BAD_REQUEST,y,I);try{let B;const K=A("auth");if(K){const Q=k.getSafeProp(K,"username")||"",ke=k.getSafeProp(K,"password")||"";B={username:Q,password:ke}}if(kx(b)){const Q=new URL(b,$e.origin);if(!B&&(Q.username||Q.password)){const ke=Xl(Q.username),Be=Xl(Q.password);B={username:ke,password:Be}}(Q.username||Q.password)&&(Q.username="",Q.password="",b=Q.href)}if(B&&(N.delete("authorization"),N.set("Authorization","Basic "+btoa(Px((B.username||"")+":"+(B.password||""))))),D&&typeof b=="string"&&b.startsWith("data:")&&Ex(b)>j)throw new Z("maxContentLength size of "+j+" exceeded",Z.ERR_BAD_RESPONSE,y,I);if($&&_!=="get"&&_!=="head"){const Q=await p(x);if(typeof Q=="number"&&isFinite(Q)&&(J=Q,Q>U))throw me()}const de=$&&(k.isReadableStream(x)||k.isStream(x)),fe=(Q,ke,Be)=>Yl(Q,Ql,Xe=>{if($&&Xe>U)throw ue=me();ke&&ke(Xe)},Be);if(g&&_!=="get"&&_!=="head"&&(R||de)){if(J=J??await m(N,x),J!==0||de){let Q=new i(b,{method:"POST",body:x,duplex:"half"}),ke;if(k.isFormData(x)&&(ke=Q.headers.get("content-type"))&&N.setContentType(ke),Q.body){const[Be,Xe]=R&&Kl(J,di(ql(R)))||[];x=fe(Q.body,Be,Xe)}}}else if(de&&!l&&f&&_!=="get"&&_!=="head")x=fe(x);else if(de&&l&&!g&&_!=="get"&&_!=="head")throw new Z("Stream request bodies are not supported by the current fetch implementation",Z.ERR_NOT_SUPPORT,y,I);k.isString(L)||(L=L?"include":"omit");const ce=l&&"credentials"in i.prototype;if(k.isFormData(x)){const Q=N.getContentType();Q&&/^multipart\/form-data/i.test(Q)&&!/boundary=/i.test(Q)&&N.delete("content-type")}N.set("User-Agent","axios/"+xc,!1);const le={...V,signal:W,method:_.toUpperCase(),headers:wm(N.normalize()),body:x,duplex:"half",credentials:ce?L:void 0};I=l&&new i(b,le);let ne=await(l?F(I,V):F(b,le));const z=We.from(ne.headers);if(D){const Q=k.toFiniteNumber(z.getContentLength());if(Q!=null&&Q>j)throw new Z("maxContentLength size of "+j+" exceeded",Z.ERR_BAD_RESPONSE,y,I)}const we=h&&(M==="stream"||M==="response");if(h&&ne.body&&(O||D||we&&ee)){const Q={};["status","statusText","headers"].forEach(Ve=>{Q[Ve]=ne[Ve]});const ke=k.toFiniteNumber(z.getContentLength()),[Be,Xe]=O&&Kl(ke,di(ql(O),!0))||[];let ft=0;const se=Ve=>{if(D&&(ft=Ve,ft>j))throw new Z("maxContentLength size of "+j+" exceeded",Z.ERR_BAD_RESPONSE,y,I);Be&&Be(Ve)};ne=new o(Yl(ne.body,Ql,se,()=>{Xe&&Xe(),ee&&ee()}),Q)}M=M||"text";let Ae=await v[k.findKey(v,M)||"text"](ne,y);if(D&&!h&&!we){let Q;if(Ae!=null&&(typeof Ae.byteLength=="number"?Q=Ae.byteLength:typeof Ae.size=="number"?Q=Ae.size:typeof Ae=="string"&&(Q=typeof r=="function"?new r().encode(Ae).byteLength:Ae.length)),typeof Q=="number"&&Q>j)throw new Z("maxContentLength size of "+j+" exceeded",Z.ERR_BAD_RESPONSE,y,I)}return!we&&ee&&ee(),await new Promise((Q,ke)=>{Am(Q,ke,{data:Ae,headers:We.from(ne.headers),status:ne.status,statusText:ne.statusText,config:y,request:I})})}catch(B){if(ee&&ee(),W&&W.aborted&&W.reason instanceof Z){const K=W.reason;throw K.config=y,I&&(K.request=I),B!==K&&(K.cause=B),K}throw ue?(I&&!ue.request&&(ue.request=I),ue):B instanceof Z?(I&&!B.request&&(B.request=I),B):B&&B.name==="TypeError"&&/Load failed|fetch/i.test(B.message)?Object.assign(new Z("Network Error",Z.ERR_NETWORK,y,I,B&&B.response),{cause:B.cause||B}):Z.from(B,B&&B.code,y,I,B&&B.response)}}},Ox=new Map,Rm=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,i=[r,s,n];let o=i.length,a=o,l,d,f=Ox;for(;a--;)l=i[a],d=f.get(l),d===void 0&&f.set(l,d=a?new Map:Ax(t)),f=d;return d};Rm();const Sc={http:H_,xhr:wx,fetch:{get:Rm}};k.forEach(Sc,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const ed=e=>`- ${e}`,Nx=e=>k.isFunction(e)||e===null||e===!1;function Rx(e,t){e=k.isArray(e)?e:[e];const{length:n}=e;let r,s;const i={};for(let o=0;o<n;o++){r=e[o];let a;if(s=r,!Nx(r)&&(s=Sc[(a=String(r)).toLowerCase()],s===void 0))throw new Z(`Unknown adapter '${a}'`);if(s&&(k.isFunction(s)||(s=s.get(t))))break;i[a||"#"+o]=s}if(!s){const o=Object.entries(i).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(ed).join(`
|
|
77
|
+
`):" "+ed(o[0]):"as no adapter specified";throw new Z("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return s}const Lm={getAdapter:Rx,adapters:Sc};function vo(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new fs(null,e)}function td(e){return vo(e),e.headers=We.from(e.headers),e.data=bo.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Lm.getAdapter(e.adapter||us.adapter,e)(e).then(function(r){vo(e),e.response=r;try{r.data=bo.call(e,e.transformResponse,r)}finally{delete e.response}return r.headers=We.from(r.headers),r},function(r){if(!km(r)&&(vo(e),r&&r.response)){e.response=r.response;try{r.response.data=bo.call(e,e.transformResponse,r.response)}finally{delete e.response}r.response.headers=We.from(r.response.headers)}return Promise.reject(r)})}const zi={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{zi[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const nd={};zi.transitional=function(t,n,r){function s(i,o){return"[Axios v"+xc+"] Transitional option '"+i+"'"+o+(r?". "+r:"")}return(i,o,a)=>{if(t===!1)throw new Z(s(o," has been removed"+(n?" in "+n:"")),Z.ERR_DEPRECATED);return n&&!nd[o]&&(nd[o]=!0,console.warn(s(o," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(i,o,a):!0}};zi.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function Lx(e,t,n){if(typeof e!="object")throw new Z("options must be an object",Z.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const i=r[s],o=Object.prototype.hasOwnProperty.call(t,i)?t[i]:void 0;if(o){const a=e[i],l=a===void 0||o(a,i,e);if(l!==!0)throw new Z("option "+i+" must be "+l,Z.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Z("Unknown option "+i,Z.ERR_BAD_OPTION)}}const Ks={assertOptions:Lx,validators:zi},He=Ks.validators;let Nn=class{constructor(t){this.defaults=t||{},this.interceptors={request:new zl,response:new zl}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=(()=>{if(!s.stack)return"";const o=s.stack.indexOf(`
|
|
78
78
|
`);return o===-1?"":s.stack.slice(o+1)})();try{if(!r.stack)r.stack=i;else if(i){const o=i.indexOf(`
|
|
79
79
|
`),a=o===-1?-1:i.indexOf(`
|
|
80
80
|
`,o+1),l=a===-1?"":i.slice(a+1);String(r.stack).endsWith(l)||(r.stack+=`
|
|
81
|
-
`+i)}}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Mn(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&Ks.assertOptions(r,{silentJSONParsing:He.transitional(He.boolean),forcedJSONParsing:He.transitional(He.boolean),clarifyTimeoutError:He.transitional(He.boolean),legacyInterceptorReqResOrdering:He.transitional(He.boolean),advertiseZstdAcceptEncoding:He.transitional(He.boolean),validateStatusUndefinedResolves:He.transitional(He.boolean)},!1),s!=null&&(k.isFunction(s)?n.paramsSerializer={serialize:s}:Ks.assertOptions(s,{encode:He.function,serialize:He.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Ks.assertOptions(n,{baseUrl:He.spelling("baseURL"),withXsrfToken:He.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=i&&k.merge(i.common,i[n.method]);i&&k.forEach(["delete","get","head","post","put","patch","query","common"],g=>{delete i[g]}),n.headers=We.concat(o,i);const a=[];let l=!0;this.interceptors.request.forEach(function(m){if(typeof m.runWhen=="function"&&m.runWhen(n)===!1)return;l=l&&m.synchronous;const h=n.transitional||yc;h&&h.legacyInterceptorReqResOrdering?a.unshift(m.fulfilled,m.rejected):a.push(m.fulfilled,m.rejected)});const d=[];this.interceptors.response.forEach(function(m){d.push(m.fulfilled,m.rejected)});let f,u=0,y;if(!l){const g=[Xl.bind(this),void 0];for(g.unshift(...a),g.push(...d),y=g.length,f=Promise.resolve(n);u<y;)f=f.then(g[u++],g[u++]);return f}y=a.length;let p=n;for(;u<y;){const g=a[u++],m=a[u++];try{p=g(p)}catch(h){m.call(this,h);break}}try{f=Xl.call(this,p)}catch(g){return Promise.reject(g)}for(u=0,y=d.length;u<y;)f=f.then(d[u++],d[u++]);return f}getUri(t){t=Mn(this.defaults,t);const n=Pm(t.baseURL,t.url,t.allowAbsoluteUrls,t);return xm(n,t.params,t.paramsSerializer)}};k.forEach(["delete","get","head","options"],function(t){Nn.prototype[t]=function(n,r){return this.request(Mn(r||{},{method:t,url:n,data:r&&k.hasOwnProp(r,"data")?r.data:void 0}))}});k.forEach(["post","put","patch","query"],function(t){function n(r){return function(i,o,a){return this.request(Mn(a||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}Nn.prototype[t]=n(),t!=="query"&&(Nn.prototype[t+"Form"]=n(!0))});let Rx=class Nm{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(s=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(a=>{r.subscribe(a),i=a}).then(s);return o.cancel=function(){r.unsubscribe(i)},o},t(function(i,o,a){r.reason||(r.reason=new fs(i,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 Nm(function(s){t=s}),cancel:t}}};function Lx(e){return function(n){return e.apply(null,n)}}function Dx(e){return k.isObject(e)&&e.isAxiosError===!0}const Ko={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(Ko).forEach(([e,t])=>{Ko[t]=e});function Rm(e){const t=new Nn(e),n=cm(Nn.prototype.request,t);return k.extend(n,Nn.prototype,t,{allOwnKeys:!0}),k.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return Rm(Mn(e,s))},n}const Re=Rm(us);Re.Axios=Nn;Re.CanceledError=fs;Re.CancelToken=Rx;Re.isCancel=Tm;Re.VERSION=vc;Re.toFormData=Hi;Re.AxiosError=Z;Re.Cancel=Re.CanceledError;Re.all=function(t){return Promise.all(t)};Re.spread=Lx;Re.isAxiosError=Dx;Re.mergeConfig=Mn;Re.AxiosHeaders=We;Re.formToJSON=e=>Cm(k.isHTMLForm(e)?new FormData(e):e);Re.getAdapter=Om.getAdapter;Re.HttpStatusCode=Ko;Re.default=Re;const{Axios:FE,AxiosError:UE,CanceledError:BE,isCancel:$E,CancelToken:VE,VERSION:HE,all:zE,Cancel:WE,isAxiosError:Lm,spread:KE,toFormData:qE,AxiosHeaders:GE,HttpStatusCode:ZE,formToJSON:YE,getAdapter:QE,mergeConfig:XE,create:JE}=Re,jx="Bearer ",Dm="web-trading-token";function Ix(){return typeof window>"u"?null:localStorage.getItem(Dm)}function br(e){return e.replace(/\/$/,"")}function ed(e){const t=br(e);async function n(r){const s=Ix();return(await Re({...r,baseURL:t,headers:{...r.headers??{},...s?{Authorization:`${jx}${s}`}:{}}})).data}return{get(r,s){return n({...s,url:r,method:"get"})},post(r,s,i){return n({...i,url:r,method:"post",data:s})}}}function td(e){return!e.isDemo&&!e.isArchive&&!!e.tradeStat}function Mx(e){const t=e.filter(n=>td(n)&&n.platformType==="mt5");return t.length>0?t:e.filter(td)}function Fx(e){const t=e,n=(t==null?void 0:t.accounts)??[];return Mx(n).map(r=>{var s,i,o,a,l;return{id:r.id,login:String(r.login),label:`${r.displayTitle} · ${r.login}`,currency:r.currency,tradeStat:{balance:((s=r.tradeStat)==null?void 0:s.balance)??0,equity:((i=r.tradeStat)==null?void 0:i.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 Ux(e){try{const t=new URL(br(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 br(e)}}function Bx(e){try{const t=new URL(br(e));return t.hostname.includes("opheleo")?"wss://symbols.opheleo.com":(t.protocol=t.protocol==="https:"?"wss:":"ws:",t.origin)}catch{return"wss://symbols.opheleo.com"}}function $x(e){const t=br(e),n=ed(t),r=Ux(t),s=ed(r),i=Ow(n),o=Bt;return{baseUrl:t,platformApiBase:r,tickWebSocketUrl:Bx(t),dealer:i,trading:Iw(i,o),async getAccounts(){const a=await s.get("/account-config/api/v1");return Fx(a)}}}const jm=S.createContext(null);function Im({baseUrl:e,children:t}){const n=S.useMemo(()=>$x(e),[e]);return c.jsx(jm.Provider,{value:n,children:t})}function dt(){const e=S.useContext(jm);if(!e)throw new Error("useWidgetApiClient must be used within WidgetApiProvider");return e}function Mm(){return dt().tickWebSocketUrl}const Vx="wss://symbols.opheleo.com";function _c(e){const[t,n]=S.useState(null),r=Mm();return S.useEffect(()=>{n(null);const s=Ui(e).toUpperCase();let i=null,o=!1;const a=r||Vx,l=()=>{i=new WebSocket(a),i.onopen=()=>{if(o){i==null||i.close(1e3,"Unmounted");return}i==null||i.send(JSON.stringify({action:"select_symbol",symbol:s}))},i.onmessage=d=>{var f;try{const u=JSON.parse(d.data);if(((f=u.symbol)==null?void 0:f.trim().toUpperCase())!==s)return;const p=Number(u.bid),g=Number(u.ask);if(!Number.isFinite(p)||!Number.isFinite(g))return;n({bid:p,ask:g})}catch{}},i.onclose=()=>{o||setTimeout(l,3e3)}};return l(),()=>{o=!0,i==null||i.close(1e3,"Unmounted")}},[e,r]),t}function Hx({symbolTicker:e,sidePanelTab:t,orderState:n,backUrl:r,createAccountUrl:s}){const i=_c(e),{panelRef:o,position:a,isDragging:l,onDragStart:d,reclamp:f}=sm(),{panel:u,isSubmitting:y,defaultVolumeLots:p,volumeStep:g,minVolumeLots:m,accountOptions:h,selectedLogin:v,isAccountsLoading:b,hasConfirmedAccount:_,needsAccountSelection:x,confirmAccountSelection:P,placeMarketOrder:C}=n,E=se(L=>L.setDraft),A=se(L=>L.clearDraft),R=Number(Vt(Ht(e))),M=Pr(R);S.useEffect(()=>{_&&E({source:"new-order",entryPrice:null,side:null,showEntryLine:!1,volumeLots:p,digits:R,priceStep:M})},[p,R,_,M,E]),S.useEffect(()=>{(u==="closed"||u==="confirmation")&&A()},[A,u]);const N=L=>{C({symbolTicker:e,login:L.login,executionMode:"market",side:L.side,orderType:L.side==="buy"?Ye.BUY:Ye.SELL,volumeLots:L.volumeLots,stopLoss:"",takeProfit:"",priceOrder:"",priceTrigger:"",comment:"",typeTime:gt.GTC,expirationDateTime:"",expirationDay:"",bid:L.bid,ask:L.ask})};return c.jsxs(c.Fragment,{children:[c.jsx(qf,{open:x,isAccountsLoading:b,accountOptions:h,onConfirm:P,backUrl:r,createAccountUrl:s}),_&&c.jsx("div",{ref:o,style:{left:a.x,top:a.y},className:`web-trading-widget-new-order-overlay${l?" web-trading-widget-new-order-overlay--dragging":""}`,children:c.jsx(hw,{symbolTicker:e,bid:(i==null?void 0:i.bid)??null,ask:(i==null?void 0:i.ask)??null,defaultVolumeLots:p,volumeStep:g,minVolumeLots:m,isSubmitting:y,isAccountsLoading:b,selectedLogin:v,isDragging:l,sidePanelTab:t,onDragHandlePointerDown:d,onExpandedChange:f,onExpand:f,onPlaceOrder:N})})]})}function zx(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 Wx(e,t){return e.openTimeMs!==t.openTimeMs?e.openTimeMs-t.openTimeMs:zx(e.ticket,t.ticket)}function nd(e){return[...e].sort(Wx)}function rd(e){return Ke(e).toUpperCase()}const pe=$i(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:nd(t)})},setOrders:t=>{e({orders:nd(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 s=rd(t);e(i=>{const o={...i.liveQuotes,[s]:{bid:n,ask:r}};return{liveQuotes:o,positions:i.positions.map(a=>Yv(a,s,n,r,o)),orders:i.orders.map(a=>{if(rd(a.symbol)!==s)return a;const l=a.side==="buy"?n:r;return{...a,currentPrice:l,marketBid:n,marketAsk:r}})}})},clearPositions:()=>{e({positions:[],orders:[],liveQuotes:{}})}})),Kx="wss://symbols.opheleo.com";function qx(e,t){const n=new Set;for(const r of e){const s=Ke(r.symbol).toUpperCase();s&&n.add(s)}for(const r of t){const s=Ke(r.symbol).toUpperCase();s&&n.add(s)}for(const r of Gv([...n]))n.add(r);return[...n].sort().join("|")}function Gx(e){return qx(e.positions,e.orders)}function Zx(){const e=pe(Gx),t=pe(r=>r.updateQuotes),n=Mm();S.useEffect(()=>{if(!e)return;const r=e.split("|"),s=new Map;let i=!1;const o=n||Kx,a=l=>{const d=new WebSocket(o);s.set(l,d),d.onopen=()=>{if(i){d.close(1e3,"Unmounted");return}d.send(JSON.stringify({action:"select_symbol",symbol:l}))},d.onmessage=f=>{var u;try{const y=JSON.parse(f.data),p=(u=y.symbol)==null?void 0:u.trim().toUpperCase();if(!p||p!==l)return;const g=Number(y.bid),m=Number(y.ask);if(!Number.isFinite(g)||!Number.isFinite(m))return;t(p,g,m)}catch{}},d.onclose=()=>{s.delete(l),i||setTimeout(()=>a(l),3e3)}};for(const l of r)a(l);return()=>{i=!0;for(const l of s.values())l.close(1e3,"Unmounted");s.clear()}},[e,n,t])}function Fm(){return Zx(),null}const Um={buy:"#2563eb",sell:"#dc2626"},wo={positive:"#2563eb",negative:"#dc2626",neutral:"#94a3b8"},_o={linewidth:1,linestyle:2,fontsize:11},Bm={stopLoss:"#f97316",takeProfit:"#22c55e"},$m=e=>Um[e],qo=(e,t)=>e==="entry"?t!=null?$m(t):Um.sell:Bm[e],sd=(e,t)=>{if(e==="entry")return qo(e,t.side);const{side:n,entryPrice:r,linePrice:s,volumeLots:i}=t;if(n!=null&&r!==null&&r!==void 0&&s!==void 0&&i!==void 0){const o=Vm(n,r,s,i);return Hm(o)}return Bm[e]},Vm=(e,t,n,r)=>(e==="buy"?n-t:t-n)*r*100,Yx=(e,t)=>!Number.isFinite(t)||t<=0?0:Math.round(e/t),Qx=e=>{const t=Vm(e.side,e.entryPrice,e.linePrice,e.volumeLots),n=e.side==="buy"?e.linePrice-e.entryPrice:e.entryPrice-e.linePrice,r=Yx(n,e.priceStep),s=e.kind==="takeProfit"?"TP":"SL",i=`${t.toFixed(2)} USD`,o=`${r} points`;return`${s} ${i}, ${o}`},Xx=(e,t)=>e.toFixed(t),Hm=e=>e>0?wo.positive:e<0?wo.negative:wo.neutral,Jx=e=>{const t=`${e.side.toUpperCase()} ${e.volumeLots.toFixed(2)}, `,n=`${e.profit.toFixed(2)} USD`;return`${t}${n}`},id=e=>{const t=$m(e.side),n=Hm(e.profit);return{text:Jx(e),linecolor:t,textcolor:n,linewidth:_o.linewidth,linestyle:_o.linestyle,fontsize:_o.fontsize,showPrice:!0,horzLabelsAlign:"left"}},xo=e=>Ue(e),eS=e=>e==="entry"||e==="stopLoss"||e==="takeProfit",So=e=>{e.setUserEditEnabled(!1),e.setSelectionEnabled(!1)},od=(e,t,n)=>{if(e==="entry")return Xx(t,n.digits);const{entryPrice:r,side:s}=n;return s!==null&&r!==null?Qx({kind:e,side:s,entryPrice:r,linePrice:t,volumeLots:n.volumeLots,priceStep:n.priceStep}):`${e==="takeProfit"?"TP":"SL"} ${Se(t,n.digits)}`},tS=({chartWidget:e})=>{const t=se(C=>C.source),n=se(C=>C.entryPrice),r=se(C=>C.stopLoss),s=se(C=>C.takeProfit),i=se(C=>C.side),o=se(C=>C.showEntryLine),a=se(C=>C.volumeLots),l=se(C=>C.digits),d=se(C=>C.priceStep),f=se(C=>C.setStopLoss),u=se(C=>C.setTakeProfit),y=S.useRef({}),p=S.useRef(null),g=S.useRef(null),m=S.useRef(!1),h=S.useRef({entryPrice:n,stopLoss:r,takeProfit:s,side:i,showEntryLine:o,volumeLots:a,digits:l,priceStep:d});S.useEffect(()=>{h.current={entryPrice:n,stopLoss:r,takeProfit:s,side:i,showEntryLine:o,volumeLots:a,digits:l,priceStep:d}},[l,n,d,o,i,r,s,a]);const v=S.useCallback(C=>{if(!e)return;const E=y.current[C];if(E){try{e.activeChart().removeEntity(E)}catch{}delete y.current[C]}},[e]),b=S.useCallback((C,E,A,R)=>{const M=qo(E,R.side),N=sd(E,{side:R.side,entryPrice:R.entryPrice,linePrice:A,volumeLots:R.volumeLots});C.setProperties({text:od(E,A,R),linecolor:M,textcolor:N,showPrice:!0,horzLabelsAlign:"left"})},[]),_=S.useCallback(async(C,E,A)=>{var D;if(!e)return;if(E===void 0){v(C);return}if(p.current===C)return;const R=e.activeChart(),M=qo(C,A.side),N=sd(C,{side:A.side,entryPrice:A.entryPrice,linePrice:E,volumeLots:A.volumeLots}),L=od(C,E,A),H=y.current[C];if(H)try{const F=R.getShapeById(H);C==="entry"&&So(F);const I=(D=F.getPoints()[0])==null?void 0:D.price;if(I!==void 0&&Math.abs(I-E)<A.priceStep/2){F.setProperties({text:L,linecolor:M,textcolor:N,showPrice:!0,horzLabelsAlign:"left"});return}const U=F.getPoints();if(U.length>0){m.current=!0,F.setPoints(U.map(O=>({...O,price:E}))),m.current=!1,F.setProperties({text:L,linecolor:M,textcolor:N,showPrice:!0,horzLabelsAlign:"left"});return}}catch{delete y.current[C]}try{const F=R.getVisibleRange(),I=await R.createShape({time:F.from,price:E},{shape:"horizontal_line",text:L,disableSave:!0,lock:C==="entry",disableSelection:C==="entry",overrides:{linecolor:M,textcolor:N,linewidth:2,showPrice:!0,horzLabelsAlign:"left"}});if(C==="entry"&&!h.current.showEntryLine){try{R.removeEntity(I)}catch{}return}if(C==="entry")try{So(R.getShapeById(I))}catch{}y.current[C]=I}catch{}},[e,v]),x=S.useCallback(async C=>{const E=xo(C.stopLoss),A=xo(C.takeProfit);C.showEntryLine&&C.entryPrice!==null?await _("entry",C.entryPrice,C):await _("entry",void 0,C),await _("stopLoss",E,C),await _("takeProfit",A,C)},[_]),P=t!==null&&(o||r.trim()!==""||s.trim()!=="");S.useEffect(()=>{if(!e||!P)return;const C=(E,A)=>{var L,H,D;const R=(L=Object.entries(y.current).find(([,F])=>F===E))==null?void 0:L[0];if(!R||!eS(R))return;const N=e.activeChart().getAllShapes().filter(F=>F.name==="horizontal_line").some(F=>F.id===E);if(R==="entry"){if((A==="move"||A==="points_changed")&&N){const F=h.current;if(F.entryPrice!==null)try{const I=e.activeChart().getShapeById(E),U=(H=I.getPoints()[0])==null?void 0:H.price;if(U!==void 0&&Math.abs(U-F.entryPrice)>=F.priceStep/2){const O=I.getPoints();O.length>0&&I.setPoints(O.map(B=>({...B,price:F.entryPrice})))}So(I)}catch{}}return}if(A==="remove"&&N){p.current=null,R==="stopLoss"&&f(""),R==="takeProfit"&&u(""),delete y.current[R];return}if(!(A!=="move"&&A!=="points_changed"&&!N)&&!m.current)try{const F=e.activeChart().getShapeById(E),I=(D=F.getPoints()[0])==null?void 0:D.price;if(!Number.isFinite(I)||I<=0)return;const U=h.current,O=R==="stopLoss"?U.stopLoss:U.takeProfit,B=xo(O),W=B!==void 0&&Math.abs(B-I)<U.priceStep/2;if(A==="points_changed"&&N){p.current=R,b(F,R,I,U),g.current!==null&&clearTimeout(g.current),g.current=setTimeout(()=>{p.current=null;const X=Se(I,h.current.digits);R==="stopLoss"?f(X):u(X)},120);return}if(g.current!==null&&(clearTimeout(g.current),g.current=null),p.current=null,W){b(F,R,I,U);return}const j=Se(I,U.digits),ee=R==="stopLoss"?{...U,stopLoss:j}:{...U,takeProfit:j};R==="stopLoss"?f(j):u(j),b(F,R,I,ee)}catch{p.current=null}};try{e.subscribe("drawing_event",C)}catch{}return()=>{p.current=null,g.current!==null&&(clearTimeout(g.current),g.current=null);try{e.unsubscribe("drawing_event",C)}catch{}}},[e,P,f,u,b]),S.useEffect(()=>{if(!e||t===null)return;let C=!1;try{e.onChartReady(()=>{C||x(h.current)})}catch{}return()=>{C=!0}},[e,t,n,r,s,i,o,a,l,d,x])},ad=e=>{e.setUserEditEnabled(!1),e.setSelectionEnabled(!1)},zm=(e,t)=>Ke(e.symbol).toUpperCase()===t,nS=e=>pe.getState().positions.filter(t=>zm(t,e)).map(t=>({ticket:t.ticket,openPrice:t.openPrice,type:t.type,digits:t.digits,volumeLots:t.volumeLots,profit:t.profit})),cd=(e,t,n)=>{try{const r=e.activeChart().symbol(),s=n.find(i=>i.display_name===r||i.ticker===r);if(s)return Jf(s.ticker,n)}catch{}return t},rS=(e,t,n)=>{var i;const r=(i=e.getPoints()[0])==null?void 0:i.price;if(r!==void 0&&Math.abs(r-t)<Number.EPSILON){e.setProperties(n);return}const s=e.getPoints();s.length>0&&e.setPoints(s.map(o=>({...o,price:t}))),e.setProperties(n)},sS=({chartWidget:e,symbolTicker:t,symbols:n})=>{const r=pe(g=>g.positions),s=S.useRef(new Map),i=S.useRef(0),o=S.useMemo(()=>Jf(t,n),[t,n]),a=S.useMemo(()=>r.filter(g=>zm(g,o)).map(g=>`${g.ticket}:${g.openPrice}:${g.type}:${g.digits}:${g.volumeLots}:${g.profit.toFixed(2)}`).sort().join("|"),[o,r]),l=S.useCallback(g=>{if(!e)return;const m=s.current.get(g);if(m){try{e.activeChart().removeEntity(m)}catch{}s.current.delete(g)}},[e]),d=S.useCallback(()=>{for(const g of[...s.current.keys()])l(g);s.current.clear()},[l]),f=S.useCallback(async(g,m,h)=>{const v=id({side:m.type,volumeLots:m.volumeLots,profit:m.profit}),_={time:g.getVisibleRange().from,price:m.openPrice},x=await g.createShape(_,{shape:"horizontal_line",text:String(v.text),disableSave:!0,lock:!0,disableSelection:!0,overrides:v});if(h!==i.current){try{g.removeEntity(x)}catch{}return null}try{ad(g.getShapeById(x))}catch{}return x},[]),u=S.useCallback(async(g,m)=>{if(!e||m!==i.current)return;const h=e.activeChart(),v=id({side:g.type,volumeLots:g.volumeLots,profit:g.profit}),b=s.current.get(g.ticket);if(b)try{rS(h.getShapeById(b),g.openPrice,v),ad(h.getShapeById(b));return}catch{s.current.delete(g.ticket)}if(m===i.current)try{const _=await f(h,g,m);if(!_)return;s.current.set(g.ticket,_)}catch{}},[e,f]),y=S.useCallback(async(g,m)=>{if(!e||g!==i.current)return;const h=nS(m),v=new Set(h.map(b=>b.ticket));for(const b of s.current.keys())v.has(b)||l(b);for(const b of h){if(g!==i.current)return;await u(b,g)}},[e,l,u]),p=S.useCallback(g=>{if(!e)return;const m=i.current+1;i.current=m,g!=null&&g.resetLineIds&&d();const h=(g==null?void 0:g.symbolKey)??cd(e,o,n);y(m,h)},[o,e,d,n,y]);S.useEffect(()=>{if(!e)return;let g=!1,m=null;const h=()=>{g||p({resetLineIds:!0,symbolKey:cd(e,o,n)})};let v=!1;const b=()=>{v=!0,h()},_=()=>{g||!v||(v=!1,p({symbolKey:o}))};try{e.onChartReady(()=>{if(!g)try{m=e.activeChart(),p({resetLineIds:!0,symbolKey:o}),m.onSymbolChanged().subscribe(null,b),m.onDataLoaded().subscribe(null,_)}catch{}})}catch{}return()=>{if(g=!0,i.current+=1,m)try{m.onSymbolChanged().unsubscribe(null,b),m.onDataLoaded().unsubscribe(null,_)}catch{}d()}},[o,e,d,p,n]),S.useEffect(()=>{if(!e)return;let g=!1;try{e.onChartReady(()=>{g||p({symbolKey:o})})}catch{}return()=>{g=!0}},[o,e,a,p])},Wm=({chartWidget:e,symbolTicker:t,symbols:n})=>(sS({chartWidget:e,symbolTicker:t,symbols:n}),tS({chartWidget:e}),null);var ms=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,Qt,er,nu,iS=(nu=class extends ms{constructor(){super();ne(this,_n);ne(this,Qt);ne(this,er);q(this,er,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){T(this,Qt)||this.setEventListener(T(this,er))}onUnsubscribe(){var t;this.hasListeners()||((t=T(this,Qt))==null||t.call(this),q(this,Qt,void 0))}setEventListener(t){var n;q(this,er,t),(n=T(this,Qt))==null||n.call(this),q(this,Qt,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){T(this,_n)!==t&&(q(this,_n,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof T(this,_n)=="boolean"?T(this,_n):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},_n=new WeakMap,Qt=new WeakMap,er=new WeakMap,nu),xc=new iS,oS={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Ct,xn,ru,aS=(ru=class{constructor(){ne(this,Ct,oS);ne(this,xn,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&T(this,xn)&&e!==T(this,Ct)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:T(this,Ct),provider:e}),q(this,Ct,e),process.env.NODE_ENV!=="production"&&q(this,xn,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&q(this,xn,!0),T(this,Ct).setTimeout(e,t)}clearTimeout(e){T(this,Ct).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&q(this,xn,!0),T(this,Ct).setInterval(e,t)}clearInterval(e){T(this,Ct).clearInterval(e)}},Ct=new WeakMap,xn=new WeakMap,ru),wn=new aS;function cS(e){setTimeout(e,0)}var lS=typeof window>"u"||"Deno"in globalThis;function Ze(){}function dS(e,t){return typeof e=="function"?e(t):e}function Go(e){return typeof e=="number"&&e>=0&&e!==1/0}function Km(e,t){return Math.max(e+(t||0)-Date.now(),0)}function an(e,t){return typeof e=="function"?e(t):e}function tt(e,t){return typeof e=="function"?e(t):e}function ld(e,t){const{type:n="all",exact:r,fetchStatus:s,predicate:i,queryKey:o,stale:a}=e;if(o){if(r){if(t.queryHash!==Sc(o,t.options))return!1}else if(!Qr(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||s&&s!==t.state.fetchStatus||i&&!i(t))}function dd(e,t){const{exact:n,status:r,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(Yr(t.options.mutationKey)!==Yr(i))return!1}else if(!Qr(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function Sc(e,t){return((t==null?void 0:t.queryKeyHashFn)||Yr)(e)}function Yr(e){return JSON.stringify(e,(t,n)=>Qo(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function Qr(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Qr(e[n],t[n])):!1}var uS=Object.prototype.hasOwnProperty;function Zo(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=ud(e)&&ud(t);if(!r&&!(Qo(e)&&Qo(t)))return t;const i=(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 f=0;f<a;f++){const u=r?f:o[f],y=e[u],p=t[u];if(y===p){l[u]=y,(r?f<i:uS.call(e,u))&&d++;continue}if(y===null||p===null||typeof y!="object"||typeof p!="object"){l[u]=p;continue}const g=Zo(y,p,n+1);l[u]=g,g===y&&d++}return i===a&&d===i?e:l}function Yo(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 ud(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Qo(e){if(!fd(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!fd(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function fd(e){return Object.prototype.toString.call(e)==="[object Object]"}function fS(e){return new Promise(t=>{wn.setTimeout(t,e)})}function Xo(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 Zo(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 Zo(e,t)}return t}function mS(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function pS(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var fi=Symbol();function qm(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===fi&&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===fi?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Gm(e,t){return typeof e=="function"?e(...t):!!e}function hS(e,t,n){let r=!1,s;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??(s=t()),r||(r=!0,s.aborted?n():s.addEventListener("abort",n,{once:!0})),s)}),e}var Xr=(()=>{let e=()=>lS;return{isServer(){return e()},setIsServer(t){e=t}}})();function Jo(){let e,t;const n=new Promise((s,i)=>{e=s,t=i});n.status="pending",n.catch(()=>{});function r(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{r({status:"fulfilled",value:s}),e(s)},n.reject=s=>{r({status:"rejected",reason:s}),t(s)},n}var gS=cS;function yS(){let e=[],t=0,n=a=>{a()},r=a=>{a()},s=gS;const i=a=>{t?e.push(a):s(()=>{n(a)})},o=()=>{const a=e;e=[],a.length&&s(()=>{r(()=>{a.forEach(l=>{n(l)})})})};return{batch:a=>{let l;t++;try{l=a()}finally{t--,t||o()}return l},batchCalls:a=>(...l)=>{i(()=>{a(...l)})},schedule:i,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{s=a}}}var Fe=yS(),tr,Xt,nr,su,bS=(su=class extends ms{constructor(){super();ne(this,tr,!0);ne(this,Xt);ne(this,nr);q(this,nr,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(){T(this,Xt)||this.setEventListener(T(this,nr))}onUnsubscribe(){var t;this.hasListeners()||((t=T(this,Xt))==null||t.call(this),q(this,Xt,void 0))}setEventListener(t){var n;q(this,nr,t),(n=T(this,Xt))==null||n.call(this),q(this,Xt,t(this.setOnline.bind(this)))}setOnline(t){T(this,tr)!==t&&(q(this,tr,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return T(this,tr)}},tr=new WeakMap,Xt=new WeakMap,nr=new WeakMap,su),mi=new bS;function vS(e){return Math.min(1e3*2**e,3e4)}function Zm(e){return(e??"online")==="online"?mi.isOnline():!0}var ea=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Ym(e){let t=!1,n=0,r;const s=Jo(),i=()=>s.status!=="pending",o=m=>{var h;if(!i()){const v=new ea(m);y(v),(h=e.onCancel)==null||h.call(e,v)}},a=()=>{t=!0},l=()=>{t=!1},d=()=>xc.isFocused()&&(e.networkMode==="always"||mi.isOnline())&&e.canRun(),f=()=>Zm(e.networkMode)&&e.canRun(),u=m=>{i()||(r==null||r(),s.resolve(m))},y=m=>{i()||(r==null||r(),s.reject(m))},p=()=>new Promise(m=>{var h;r=v=>{(i()||d())&&m(v)},(h=e.onPause)==null||h.call(e)}).then(()=>{var m;r=void 0,i()||(m=e.onContinue)==null||m.call(e)}),g=()=>{if(i())return;let m;const h=n===0?e.initialPromise:void 0;try{m=h??e.fn()}catch(v){m=Promise.reject(v)}Promise.resolve(m).then(u).catch(v=>{var C;if(i())return;const b=e.retry??(Xr.isServer()?0:3),_=e.retryDelay??vS,x=typeof _=="function"?_(n,v):_,P=b===!0||typeof b=="number"&&n<b||typeof b=="function"&&b(n,v);if(t||!P){y(v);return}n++,(C=e.onFail)==null||C.call(e,n,v),fS(x).then(()=>d()?void 0:p()).then(()=>{t?y(v):g()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(r==null||r(),s),cancelRetry:a,continueRetry:l,canStart:f,start:()=>(f()?g():p().then(g),s)}}var Sn,iu,Qm=(iu=class{constructor(){ne(this,Sn)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Go(this.gcTime)&&q(this,Sn,wn.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Xr.isServer()?1/0:300*1e3))}clearGcTimeout(){T(this,Sn)!==void 0&&(wn.clearTimeout(T(this,Sn)),q(this,Sn,void 0))}},Sn=new WeakMap,iu);function wS(e){return{onFetch:(t,n)=>{var f,u,y,p,g;const r=t.options,s=(y=(u=(f=t.fetchOptions)==null?void 0:f.meta)==null?void 0:u.fetchMore)==null?void 0:y.direction,i=((p=t.state.data)==null?void 0:p.pages)||[],o=((g=t.state.data)==null?void 0:g.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const d=async()=>{let m=!1;const h=_=>{hS(_,()=>t.signal,()=>m=!0)},v=qm(t.options,t.fetchOptions),b=async(_,x,P)=>{if(m)return Promise.reject(t.signal.reason);if(x==null&&_.pages.length)return Promise.resolve(_);const E=(()=>{const N={client:t.client,queryKey:t.queryKey,pageParam:x,direction:P?"backward":"forward",meta:t.options.meta};return h(N),N})(),A=await v(E),{maxPages:R}=t.options,M=P?pS:mS;return{pages:M(_.pages,A,R),pageParams:M(_.pageParams,x,R)}};if(s&&i.length){const _=s==="backward",x=_?_S:md,P={pages:i,pageParams:o},C=x(r,P);a=await b(P,C,_)}else{const _=e??i.length;do{const x=l===0?o[0]??r.initialPageParam:md(r,a);if(l>0&&x==null)break;a=await b(a,x),l++}while(l<_)}return a};t.options.persister?t.fetchFn=()=>{var m,h;return(h=(m=t.options).persister)==null?void 0:h.call(m,d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=d}}}function md(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 _S(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 rr,Cn,sr,at,Tn,Me,ts,En,et,Xm,Lt,ou,xS=(ou=class extends Qm{constructor(t){super();ne(this,et);ne(this,rr);ne(this,Cn);ne(this,sr);ne(this,at);ne(this,Tn);ne(this,Me);ne(this,ts);ne(this,En);q(this,En,!1),q(this,ts,t.defaultOptions),this.setOptions(t.options),this.observers=[],q(this,Tn,t.client),q(this,at,T(this,Tn).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,q(this,Cn,hd(this.options)),this.state=t.state??T(this,Cn),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return T(this,rr)}get promise(){var t;return(t=T(this,Me))==null?void 0:t.promise}setOptions(t){if(this.options={...T(this,ts),...t},t!=null&&t._type&&q(this,rr,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=hd(this.options);n.data!==void 0&&(this.setState(pd(n.data,n.dataUpdatedAt)),q(this,Cn,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&T(this,at).remove(this)}setData(t,n){const r=Xo(this.state.data,t,this.options);return ye(this,et,Lt).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t){ye(this,et,Lt).call(this,{type:"setState",state:t})}cancel(t){var r,s;const n=(r=T(this,Me))==null?void 0:r.promise;return(s=T(this,Me))==null||s.cancel(t),n?n.then(Ze).catch(Ze):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return T(this,Cn)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>tt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===fi||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>an(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:!Km(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=T(this,Me))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=T(this,Me))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),T(this,at).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(T(this,Me)&&(T(this,En)||ye(this,et,Xm).call(this)?T(this,Me).cancel({revert:!0}):T(this,Me).cancelRetry()),this.scheduleGc()),T(this,at).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||ye(this,et,Lt).call(this,{type:"invalidate"})}async fetch(t,n){var d,f,u,y,p,g,m,h,v,b,_;if(this.state.fetchStatus!=="idle"&&((d=T(this,Me))==null?void 0:d.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(T(this,Me))return T(this,Me).continueRetry(),T(this,Me).promise}if(t&&this.setOptions(t),!this.options.queryFn){const x=this.observers.find(P=>P.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,s=x=>{Object.defineProperty(x,"signal",{enumerable:!0,get:()=>(q(this,En,!0),r.signal)})},i=()=>{const x=qm(this.options,n),C=(()=>{const E={client:T(this,Tn),queryKey:this.queryKey,meta:this.meta};return s(E),E})();return q(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:T(this,Tn),state:this.state,fetchFn:i};return s(x),x})(),l=T(this,rr)==="infinite"?wS(this.options.pages):this.options.behavior;l==null||l.onFetch(a,this),q(this,sr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((f=a.fetchOptions)==null?void 0:f.meta))&&ye(this,et,Lt).call(this,{type:"fetch",meta:(u=a.fetchOptions)==null?void 0:u.meta}),q(this,Me,Ym({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:x=>{x instanceof ea&&x.revert&&this.setState({...T(this,sr),fetchStatus:"idle"}),r.abort()},onFail:(x,P)=>{ye(this,et,Lt).call(this,{type:"failed",failureCount:x,error:P})},onPause:()=>{ye(this,et,Lt).call(this,{type:"pause"})},onContinue:()=>{ye(this,et,Lt).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const x=await T(this,Me).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=(y=T(this,at).config).onSuccess)==null||p.call(y,x,this),(m=(g=T(this,at).config).onSettled)==null||m.call(g,x,this.state.error,this),x}catch(x){if(x instanceof ea){if(x.silent)return T(this,Me).promise;if(x.revert){if(this.state.data===void 0)throw x;return this.state.data}}throw ye(this,et,Lt).call(this,{type:"error",error:x}),(v=(h=T(this,at).config).onError)==null||v.call(h,x,this),(_=(b=T(this,at).config).onSettled)==null||_.call(b,this.state.data,x,this),x}finally{this.scheduleGc()}}},rr=new WeakMap,Cn=new WeakMap,sr=new WeakMap,at=new WeakMap,Tn=new WeakMap,Me=new WeakMap,ts=new WeakMap,En=new WeakMap,et=new WeakSet,Xm=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Lt=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,...Jm(r.data,this.options),fetchMeta:t.meta??null};case"success":const s={...r,...pd(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return q(this,sr,t.manual?s:void 0),s;case"error":const i=t.error;return{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),Fe.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),T(this,at).notify({query:this,type:"updated",action:t})})},ou);function Jm(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Zm(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function pd(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function hd(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 Ge,ve,ns,qe,Pn,ir,jt,Jt,rs,or,ar,kn,An,en,cr,Te,Br,ta,na,ra,sa,ia,oa,aa,ep,au,SS=(au=class extends ms{constructor(t,n){super();ne(this,Te);ne(this,Ge);ne(this,ve);ne(this,ns);ne(this,qe);ne(this,Pn);ne(this,ir);ne(this,jt);ne(this,Jt);ne(this,rs);ne(this,or);ne(this,ar);ne(this,kn);ne(this,An);ne(this,en);ne(this,cr,new Set);this.options=n,q(this,Ge,t),q(this,Jt,null),q(this,jt,Jo()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(T(this,ve).addObserver(this),gd(T(this,ve),this.options)?ye(this,Te,Br).call(this):this.updateResult(),ye(this,Te,sa).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ca(T(this,ve),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ca(T(this,ve),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,ye(this,Te,ia).call(this),ye(this,Te,oa).call(this),T(this,ve).removeObserver(this)}setOptions(t){const n=this.options,r=T(this,ve);if(this.options=T(this,Ge).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof tt(this.options.enabled,T(this,ve))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");ye(this,Te,aa).call(this),T(this,ve).setOptions(this.options),n._defaulted&&!Yo(this.options,n)&&T(this,Ge).getQueryCache().notify({type:"observerOptionsUpdated",query:T(this,ve),observer:this});const s=this.hasListeners();s&&yd(T(this,ve),r,this.options,n)&&ye(this,Te,Br).call(this),this.updateResult(),s&&(T(this,ve)!==r||tt(this.options.enabled,T(this,ve))!==tt(n.enabled,T(this,ve))||an(this.options.staleTime,T(this,ve))!==an(n.staleTime,T(this,ve)))&&ye(this,Te,ta).call(this);const i=ye(this,Te,na).call(this);s&&(T(this,ve)!==r||tt(this.options.enabled,T(this,ve))!==tt(n.enabled,T(this,ve))||i!==T(this,en))&&ye(this,Te,ra).call(this,i)}getOptimisticResult(t){const n=T(this,Ge).getQueryCache().build(T(this,Ge),t),r=this.createResult(n,t);return TS(this,r)&&(q(this,qe,r),q(this,ir,this.options),q(this,Pn,T(this,ve).state)),r}getCurrentResult(){return T(this,qe)}trackResult(t,n){return new Proxy(t,{get:(r,s)=>(this.trackProp(s),n==null||n(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&T(this,jt).status==="pending"&&T(this,jt).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,s))})}trackProp(t){T(this,cr).add(t)}getCurrentQuery(){return T(this,ve)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=T(this,Ge).defaultQueryOptions(t),r=T(this,Ge).getQueryCache().build(T(this,Ge),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return ye(this,Te,Br).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),T(this,qe)))}createResult(t,n){var R;const r=T(this,ve),s=this.options,i=T(this,qe),o=T(this,Pn),a=T(this,ir),d=t!==r?t.state:T(this,ns),{state:f}=t;let u={...f},y=!1,p;if(n._optimisticResults){const M=this.hasListeners(),N=!M&&gd(t,n),L=M&&yd(t,r,n,s);(N||L)&&(u={...u,...Jm(f.data,t.options)}),n._optimisticResults==="isRestoring"&&(u.fetchStatus="idle")}let{error:g,errorUpdatedAt:m,status:h}=u;p=u.data;let v=!1;if(n.placeholderData!==void 0&&p===void 0&&h==="pending"){let M;i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(M=i.data,v=!0):M=typeof n.placeholderData=="function"?n.placeholderData((R=T(this,ar))==null?void 0:R.state.data,T(this,ar)):n.placeholderData,M!==void 0&&(h="success",p=Xo(i==null?void 0:i.data,M,n),y=!0)}if(n.select&&p!==void 0&&!v)if(i&&p===(o==null?void 0:o.data)&&n.select===T(this,rs))p=T(this,or);else try{q(this,rs,n.select),p=n.select(p),p=Xo(i==null?void 0:i.data,p,n),q(this,or,p),q(this,Jt,null)}catch(M){q(this,Jt,M)}T(this,Jt)&&(g=T(this,Jt),p=T(this,or),m=Date.now(),h="error");const b=u.fetchStatus==="fetching",_=h==="pending",x=h==="error",P=_&&b,C=p!==void 0,A={status:h,fetchStatus:u.fetchStatus,isPending:_,isSuccess:h==="success",isError:x,isInitialLoading:P,isLoading:P,data:p,dataUpdatedAt:u.dataUpdatedAt,error:g,errorUpdatedAt:m,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:u.dataUpdateCount>d.dataUpdateCount||u.errorUpdateCount>d.errorUpdateCount,isFetching:b,isRefetching:b&&!_,isLoadingError:x&&!C,isPaused:u.fetchStatus==="paused",isPlaceholderData:y,isRefetchError:x&&C,isStale:Cc(t,n),refetch:this.refetch,promise:T(this,jt),isEnabled:tt(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const M=A.data!==void 0,N=A.status==="error"&&!M,L=F=>{N?F.reject(A.error):M&&F.resolve(A.data)},H=()=>{const F=q(this,jt,A.promise=Jo());L(F)},D=T(this,jt);switch(D.status){case"pending":t.queryHash===r.queryHash&&L(D);break;case"fulfilled":(N||A.data!==D.value)&&H();break;case"rejected":(!N||A.error!==D.reason)&&H();break}}return A}updateResult(){const t=T(this,qe),n=this.createResult(T(this,ve),this.options);if(q(this,Pn,T(this,ve).state),q(this,ir,this.options),T(this,Pn).data!==void 0&&q(this,ar,T(this,ve)),Yo(n,t))return;q(this,qe,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,i=typeof s=="function"?s():s;if(i==="all"||!i&&!T(this,cr).size)return!0;const o=new Set(i??T(this,cr));return this.options.throwOnError&&o.add("error"),Object.keys(T(this,qe)).some(a=>{const l=a;return T(this,qe)[l]!==t[l]&&o.has(l)})};ye(this,Te,ep).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&ye(this,Te,sa).call(this)}},Ge=new WeakMap,ve=new WeakMap,ns=new WeakMap,qe=new WeakMap,Pn=new WeakMap,ir=new WeakMap,jt=new WeakMap,Jt=new WeakMap,rs=new WeakMap,or=new WeakMap,ar=new WeakMap,kn=new WeakMap,An=new WeakMap,en=new WeakMap,cr=new WeakMap,Te=new WeakSet,Br=function(t){ye(this,Te,aa).call(this);let n=T(this,ve).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Ze)),n},ta=function(){ye(this,Te,ia).call(this);const t=an(this.options.staleTime,T(this,ve));if(Xr.isServer()||T(this,qe).isStale||!Go(t))return;const r=Km(T(this,qe).dataUpdatedAt,t)+1;q(this,kn,wn.setTimeout(()=>{T(this,qe).isStale||this.updateResult()},r))},na=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(T(this,ve)):this.options.refetchInterval)??!1},ra=function(t){ye(this,Te,oa).call(this),q(this,en,t),!(Xr.isServer()||tt(this.options.enabled,T(this,ve))===!1||!Go(T(this,en))||T(this,en)===0)&&q(this,An,wn.setInterval(()=>{(this.options.refetchIntervalInBackground||xc.isFocused())&&ye(this,Te,Br).call(this)},T(this,en)))},sa=function(){ye(this,Te,ta).call(this),ye(this,Te,ra).call(this,ye(this,Te,na).call(this))},ia=function(){T(this,kn)!==void 0&&(wn.clearTimeout(T(this,kn)),q(this,kn,void 0))},oa=function(){T(this,An)!==void 0&&(wn.clearInterval(T(this,An)),q(this,An,void 0))},aa=function(){const t=T(this,Ge).getQueryCache().build(T(this,Ge),this.options);if(t===T(this,ve))return;const n=T(this,ve);q(this,ve,t),q(this,ns,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},ep=function(t){Fe.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(T(this,qe))}),T(this,Ge).getQueryCache().notify({query:T(this,ve),type:"observerResultsUpdated"})})},au);function CS(e,t){return tt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&tt(t.retryOnMount,e)===!1)}function gd(e,t){return CS(e,t)||e.state.data!==void 0&&ca(e,t,t.refetchOnMount)}function ca(e,t,n){if(tt(t.enabled,e)!==!1&&an(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Cc(e,t)}return!1}function yd(e,t,n,r){return(e!==t||tt(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Cc(e,n)}function Cc(e,t){return tt(t.enabled,e)!==!1&&e.isStaleByTime(an(t.staleTime,e))}function TS(e,t){return!Yo(e.getCurrentResult(),t)}var ss,Tt,ze,On,Et,qt,cu,ES=(cu=class extends Qm{constructor(t){super();ne(this,Et);ne(this,ss);ne(this,Tt);ne(this,ze);ne(this,On);q(this,ss,t.client),this.mutationId=t.mutationId,q(this,ze,t.mutationCache),q(this,Tt,[]),this.state=t.state||PS(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){T(this,Tt).includes(t)||(T(this,Tt).push(t),this.clearGcTimeout(),T(this,ze).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){q(this,Tt,T(this,Tt).filter(n=>n!==t)),this.scheduleGc(),T(this,ze).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){T(this,Tt).length||(this.state.status==="pending"?this.scheduleGc():T(this,ze).remove(this))}continue(){var t;return((t=T(this,On))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,a,l,d,f,u,y,p,g,m,h,v,b,_,x,P,C,E;const n=()=>{ye(this,Et,qt).call(this,{type:"continue"})},r={client:T(this,ss),meta:this.options.meta,mutationKey:this.options.mutationKey};q(this,On,Ym({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(A,R)=>{ye(this,Et,qt).call(this,{type:"failed",failureCount:A,error:R})},onPause:()=>{ye(this,Et,qt).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>T(this,ze).canRun(this)}));const s=this.state.status==="pending",i=!T(this,On).canStart();try{if(s)n();else{ye(this,Et,qt).call(this,{type:"pending",variables:t,isPaused:i}),T(this,ze).config.onMutate&&await T(this,ze).config.onMutate(t,this,r);const R=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,t,r));R!==this.state.context&&ye(this,Et,qt).call(this,{type:"pending",context:R,variables:t,isPaused:i})}const A=await T(this,On).start();return await((d=(l=T(this,ze).config).onSuccess)==null?void 0:d.call(l,A,t,this.state.context,this,r)),await((u=(f=this.options).onSuccess)==null?void 0:u.call(f,A,t,this.state.context,r)),await((p=(y=T(this,ze).config).onSettled)==null?void 0:p.call(y,A,null,this.state.variables,this.state.context,this,r)),await((m=(g=this.options).onSettled)==null?void 0:m.call(g,A,null,t,this.state.context,r)),ye(this,Et,qt).call(this,{type:"success",data:A}),A}catch(A){try{await((v=(h=T(this,ze).config).onError)==null?void 0:v.call(h,A,t,this.state.context,this,r))}catch(R){Promise.reject(R)}try{await((_=(b=this.options).onError)==null?void 0:_.call(b,A,t,this.state.context,r))}catch(R){Promise.reject(R)}try{await((P=(x=T(this,ze).config).onSettled)==null?void 0:P.call(x,void 0,A,this.state.variables,this.state.context,this,r))}catch(R){Promise.reject(R)}try{await((E=(C=this.options).onSettled)==null?void 0:E.call(C,void 0,A,t,this.state.context,r))}catch(R){Promise.reject(R)}throw ye(this,Et,qt).call(this,{type:"error",error:A}),A}finally{T(this,ze).runNext(this)}}},ss=new WeakMap,Tt=new WeakMap,ze=new WeakMap,On=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),Fe.batch(()=>{T(this,Tt).forEach(r=>{r.onMutationUpdate(t)}),T(this,ze).notify({mutation:this,type:"updated",action:t})})},cu);function PS(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var It,ht,is,lu,kS=(lu=class extends ms{constructor(t={}){super();ne(this,It);ne(this,ht);ne(this,is);this.config=t,q(this,It,new Set),q(this,ht,new Map),q(this,is,0)}build(t,n,r){const s=new ES({client:t,mutationCache:this,mutationId:++ws(this,is)._,options:t.defaultMutationOptions(n),state:r});return this.add(s),s}add(t){T(this,It).add(t);const n=Ls(t);if(typeof n=="string"){const r=T(this,ht).get(n);r?r.push(t):T(this,ht).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(T(this,It).delete(t)){const n=Ls(t);if(typeof n=="string"){const r=T(this,ht).get(n);if(r)if(r.length>1){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}else r[0]===t&&T(this,ht).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=Ls(t);if(typeof n=="string"){const r=T(this,ht).get(n),s=r==null?void 0:r.find(i=>i.state.status==="pending");return!s||s===t}else return!0}runNext(t){var r;const n=Ls(t);if(typeof n=="string"){const s=(r=T(this,ht).get(n))==null?void 0:r.find(i=>i!==t&&i.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Fe.batch(()=>{T(this,It).forEach(t=>{this.notify({type:"removed",mutation:t})}),T(this,It).clear(),T(this,ht).clear()})}getAll(){return Array.from(T(this,It))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>dd(n,r))}findAll(t={}){return this.getAll().filter(n=>dd(t,n))}notify(t){Fe.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Fe.batch(()=>Promise.all(t.map(n=>n.continue().catch(Ze))))}},It=new WeakMap,ht=new WeakMap,is=new WeakMap,lu);function Ls(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Pt,du,AS=(du=class extends ms{constructor(t={}){super();ne(this,Pt);this.config=t,q(this,Pt,new Map)}build(t,n,r){const s=n.queryKey,i=n.queryHash??Sc(s,n);let o=this.get(i);return o||(o=new xS({client:t,queryKey:s,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){T(this,Pt).has(t.queryHash)||(T(this,Pt).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=T(this,Pt).get(t.queryHash);n&&(t.destroy(),n===t&&T(this,Pt).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Fe.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return T(this,Pt).get(t)}getAll(){return[...T(this,Pt).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>ld(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>ld(t,r)):n}notify(t){Fe.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Fe.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Fe.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Pt=new WeakMap,du),Le,tn,nn,lr,dr,rn,ur,fr,uu,OS=(uu=class{constructor(e={}){ne(this,Le);ne(this,tn);ne(this,nn);ne(this,lr);ne(this,dr);ne(this,rn);ne(this,ur);ne(this,fr);q(this,Le,e.queryCache||new AS),q(this,tn,e.mutationCache||new kS),q(this,nn,e.defaultOptions||{}),q(this,lr,new Map),q(this,dr,new Map),q(this,rn,0)}mount(){ws(this,rn)._++,T(this,rn)===1&&(q(this,ur,xc.subscribe(async e=>{e&&(await this.resumePausedMutations(),T(this,Le).onFocus())})),q(this,fr,mi.subscribe(async e=>{e&&(await this.resumePausedMutations(),T(this,Le).onOnline())})))}unmount(){var e,t;ws(this,rn)._--,T(this,rn)===0&&((e=T(this,ur))==null||e.call(this),q(this,ur,void 0),(t=T(this,fr))==null||t.call(this),q(this,fr,void 0))}isFetching(e){return T(this,Le).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return T(this,tn).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=T(this,Le).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=T(this,Le).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(an(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return T(this,Le).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),s=T(this,Le).get(r.queryHash),i=s==null?void 0:s.state.data,o=dS(t,i);if(o!==void 0)return T(this,Le).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return Fe.batch(()=>T(this,Le).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=T(this,Le).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=T(this,Le);Fe.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=T(this,Le);return Fe.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Fe.batch(()=>T(this,Le).findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(Ze).catch(Ze)}invalidateQueries(e,t={}){return Fe.batch(()=>(T(this,Le).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=Fe.batch(()=>T(this,Le).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,n);return n.throwOnError||(i=i.catch(Ze)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(Ze)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=T(this,Le).build(this,t);return n.isStaleByTime(an(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 mi.isOnline()?T(this,tn).resumePausedMutations():Promise.resolve()}getQueryCache(){return T(this,Le)}getMutationCache(){return T(this,tn)}getDefaultOptions(){return T(this,nn)}setDefaultOptions(e){q(this,nn,e)}setQueryDefaults(e,t){T(this,lr).set(Yr(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...T(this,lr).values()],n={};return t.forEach(r=>{Qr(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){T(this,dr).set(Yr(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...T(this,dr).values()],n={};return t.forEach(r=>{Qr(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...T(this,nn).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Sc(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===fi&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...T(this,nn).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){T(this,Le).clear(),T(this,tn).clear()}},Le=new WeakMap,tn=new WeakMap,nn=new WeakMap,lr=new WeakMap,dr=new WeakMap,rn=new WeakMap,ur=new WeakMap,fr=new WeakMap,uu),tp=w.createContext(void 0),ps=e=>{const t=w.useContext(tp);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},NS=({client:e,children:t})=>(w.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),c.jsx(tp.Provider,{value:e,children:t})),np=w.createContext(!1),RS=()=>w.useContext(np);np.Provider;function LS(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var DS=w.createContext(LS()),jS=()=>w.useContext(DS),IS=(e,t,n)=>{const r=n!=null&&n.state.error&&typeof e.throwOnError=="function"?Gm(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},MS=e=>{w.useEffect(()=>{e.clearReset()},[e])},FS=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(s&&e.data===void 0||Gm(n,[e.error,r])),US=e=>{if(e.suspense){const n=s=>s==="static"?s:Math.max(s??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...s)=>n(r(...s)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},BS=(e,t)=>e.isLoading&&e.isFetching&&!t,$S=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,bd=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function VS(e,t,n){var p,g,m,h;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=RS(),s=jS(),i=ps(),o=i.defaultQueryOptions(e);(g=(p=i.getDefaultOptions().queries)==null?void 0:p._experimental_beforeQuery)==null||g.call(p,o);const a=i.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,US(o),IS(o,s,a),MS(s);const d=!i.getQueryCache().get(o.queryHash),[f]=w.useState(()=>new t(i,o)),u=f.getOptimisticResult(o),y=!r&&l;if(w.useSyncExternalStore(w.useCallback(v=>{const b=y?f.subscribe(Fe.batchCalls(v)):Ze;return f.updateResult(),b},[f,y]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),w.useEffect(()=>{f.setOptions(o)},[o,f]),$S(o,u))throw bd(o,f,s);if(FS({result:u,errorResetBoundary:s,throwOnError:o.throwOnError,query:a,suspense:o.suspense}))throw u.error;if((h=(m=i.getDefaultOptions().queries)==null?void 0:m._experimental_afterQuery)==null||h.call(m,o,u),o.experimental_prefetchInRender&&!Xr.isServer()&&BS(u,r)){const v=d?bd(o,f,s):a==null?void 0:a.promise;v==null||v.catch(Ze).finally(()=>{f.updateResult()})}return o.notifyOnChangeProps?u:f.trackResult(u)}function Or(e,t){return VS(e,SS)}function HS(e,t){const n=ps(),r=n.getQueryCache();return w.useSyncExternalStore(w.useCallback(s=>r.subscribe(Fe.batchCalls(s)),[r]),()=>n.isFetching(e),()=>n.isFetching(e))}const rp=S.createContext(null);function zS(e){return typeof window>"u"?e??null:e?(localStorage.setItem(Dm,e),e):null}function WS({token:e,children:t}){const n=zS(e);return c.jsx(rp.Provider,{value:n,children:t})}function KS(){return S.useContext(rp)}const Tc="widget-accounts",Ec="widget-positions",Pc="widget-orders",hs="widget-deals",gs="widget-deals-total",qS=2e4,GS=3e4;function qs(e){const t=String(e.getUTCDate()).padStart(2,"0"),n=String(e.getUTCMonth()+1).padStart(2,"0"),r=String(e.getUTCHours()).padStart(2,"0"),s=String(e.getUTCMinutes()).padStart(2,"0"),i=String(e.getUTCSeconds()).padStart(2,"0");return`${n}.${t} ${r}:${s}:${i}`}function sp(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 ip(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=sp(e);if(n!==void 0)return ip(n)}return 0}function kc(e){if(e==null||e==="")return"—";if(typeof e=="number"&&Number.isFinite(e)){const t=e>1e12?e:e*1e3;return qs(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 s=r>1e12?r:r*1e3;return qs(new Date(s))}}const n=Date.parse(t);return Number.isFinite(n)?qs(new Date(n)):t}if(typeof e=="object"&&e!==null){const n=sp(e);if(n!==void 0)return kc(n)}return"—"}const op=["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 ZS(e){return qs(e)}const YS={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 Wi(e,t){for(const n of t)if(e[n]!==void 0&&e[n]!==null&&e[n]!=="")return e[n]}function ot(e,t){const n=Wi(e,t);if(n===void 0)return;const r=Number(n);return Number.isFinite(r)?r:void 0}function Ds(e,t){const n=Wi(e,t);if(n!==void 0)return String(n)}function QS(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 s=t[r];if(Array.isArray(s))return s.filter(i=>typeof i=="object"&&i!==null);if(s&&typeof s=="object"){const i=s,o=["list","items","records","orders","content","data"];for(const a of o){const l=i[a];if(Array.isArray(l))return l.filter(d=>typeof d=="object"&&d!==null)}}}return[]}function la(e){return e===void 0?.01:e>=100?e/1e4:e}function XS(e,t){return Yf(t,e)}function JS(e){const t=Wi(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=ot(e,["type","Type","orderType","OrderType"])??2;return{label:YS[n]??(n%2===1?"sell":"buy"),side:ci(n),typeNum:n}}function e0(e,t){const n=ot(e,["volumeFilled","volume_filled","VolumeFilled","filledVolume","FilledVolume"]);if(n!==void 0)return la(n);const r=ot(e,["volumeCurrent","volume_current","VolumeCurrent"]);return r!==void 0?la(r):0}function t0(e,t){const n=Ds(e,["ticket","Ticket","order","Order","id","ID"]),r=Ds(e,["symbol","Symbol"])??"";if(!n||!r)return null;const s=Ke(r),{label:i,side:o,typeNum:a}=JS(e),l=ot(e,["typeTime","TypeTime"])??0,d=la(ot(e,["volumeLots","volume_lots","VolumeLots","volume","Volume"])),f=e0(e),u=ot(e,["priceOrder","price_order","PriceOrder","openPrice","open_price","price","Price"])??0,y=ot(e,["priceTrigger","price_trigger","PriceTrigger","triggerPrice","TriggerPrice"]),p=ot(e,["currentPrice","current_price","PriceCurrent","priceCurrent","marketPrice","MarketPrice"])??u,g=ot(e,["stopLoss","stop_loss","PriceSL","sl","SL"]),m=ot(e,["takeProfit","take_profit","PriceTP","tp","TP"]),h=ot(e,["marketBid","MarketBid","bid","Bid"])??p,v=ot(e,["marketAsk","MarketAsk","ask","Ask"])??p,b=Ds(e,["comment","Comment"])??"",_=XS(e,s),x=Wi(e,op),P=ip(x),C=kc(x);return{ticket:n,login:Ds(e,["login","Login"])??t,symbol:s,displaySymbol:Ii(s),openTimeMs:P,time:C,typeLabel:i,orderType:a,typeTime:l,side:o,volumeLots:d,volumeFilledLots:f,orderPrice:u,priceTrigger:y,stopLoss:g,takeProfit:m,currentPrice:p,marketBid:h,marketAsk:v,comment:b,digits:_}}function n0(e,t){return QS(e).map(n=>t0(n,t)).filter(n=>n!==null)}function Ki(e,t){for(const n of t)if(e[n]!==void 0&&e[n]!==null&&e[n]!=="")return e[n]}function Gt(e,t){const n=Ki(e,t);if(n===void 0)return;const r=Number(n);return Number.isFinite(r)?r:void 0}function js(e,t){const n=Ki(e,t);if(n!==void 0)return String(n)}function r0(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 s=t[r];if(Array.isArray(s))return s.filter(i=>typeof i=="object"&&i!==null);if(s&&typeof s=="object"){const i=s,o=["list","items","records","positions","orders","content","data"];for(const a of o){const l=i[a];if(Array.isArray(l))return l.filter(d=>typeof d=="object"&&d!==null)}}}return[]}function s0(e){return e===void 0?.01:e>=100?e/1e4:e}function i0(e){const t=Ki(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=Gt(e,["type","Type","action","Action"]);return n!==void 0&&n%2===1?"sell":"buy"}function o0(e,t){return Yf(t,e)}function a0(e,t){const n=js(e,["ticket","Ticket","position","Position","order","Order","id","ID"]),r=js(e,["symbol","Symbol"])??"";if(!n||!r)return null;const s=Ke(r),i=i0(e),o=s0(Gt(e,["volumeLots","volume_lots","VolumeLots","volume","Volume"])),a=Gt(e,["openPrice","open_price","PriceOpen","priceOpen","price","Price"])??0,l=Gt(e,["currentPrice","current_price","PriceCurrent","priceCurrent"])??a,d=Gt(e,["stopLoss","stop_loss","PriceSL","sl","SL"]),f=Gt(e,["takeProfit","take_profit","PriceTP","tp","TP"]),u=Gt(e,["profit","Profit","floating","Floating","pnl","PnL"])??0,y=Gt(e,["swap","Swap"])??0,p=js(e,["comment","Comment"])??"",g=o0(e,s),m=kc(Ki(e,op));return{ticket:n,login:js(e,["login","Login"])??t,symbol:s,displaySymbol:Ii(s),time:m,type:i,volumeLots:o,openPrice:a,stopLoss:d,takeProfit:f,currentPrice:l,marketBid:l,marketAsk:l,swap:y,profit:u,comment:p,digits:g}}function c0(e,t){return r0(e).map(n=>a0(n,t)).filter(n=>n!==null)}function ys(){return Bt}function ap(){const e=dt(),t=KS(),{data:n,isLoading:r,isError:s}=Or({queryKey:[Tc,e.baseUrl,t],queryFn:()=>e.getAccounts(),enabled:!!t,refetchInterval:GS});return{accounts:n??[],isLoading:r,isError:s}}function l0(e){const t=dt();return Or({queryKey:[Ec,t.baseUrl,e],queryFn:()=>t.dealer.getPositions(e),enabled:!!e,refetchInterval:qS})}function d0(e){const t=dt();return Or({queryKey:[Pc,t.baseUrl,e],queryFn:()=>t.dealer.getOrders(e),enabled:!!e})}function u0(e,t){e.invalidateQueries({queryKey:[Tc,t]})}function f0(e,t,n){e.invalidateQueries({queryKey:[gs,t,n]}),e.invalidateQueries({queryKey:[hs,t,n]})}function m0(){const e=ps(),t=dt();return S.useCallback(async n=>{await Promise.all([e.invalidateQueries({queryKey:[gs,t.baseUrl,n]}),e.invalidateQueries({queryKey:[hs,t.baseUrl,n]})])},[t.baseUrl,e])}function p0(){const e=ps(),t=dt();return S.useCallback(async n=>{await Promise.all([e.invalidateQueries({queryKey:[Tc,t.baseUrl]}),e.invalidateQueries({queryKey:[Ec,t.baseUrl,n]}),e.invalidateQueries({queryKey:[Pc,t.baseUrl,n]}),e.invalidateQueries({queryKey:[gs,t.baseUrl,n]}),e.invalidateQueries({queryKey:[hs,t.baseUrl,n]})])},[t.baseUrl,e])}function h0(){const e=ps(),t=dt();return S.useCallback((n,r,s)=>{u0(e,t.baseUrl),e.invalidateQueries({queryKey:[Ec,t.baseUrl,n]}),(r===void 0||ac(r))&&e.invalidateQueries({queryKey:[Pc,t.baseUrl,n]}),(s==null?void 0:s.invalidateDeals)!==!1&&f0(e,t.baseUrl,n)},[t.baseUrl,e])}function qi(){const e=dt(),t=h0();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 s=await e.trading.closePosition(n);return s.success&&!(r!=null&&r.skipInvalidation)&&t(n.login),s},async deleteOrder(n){const r=await e.trading.deleteOrder(n);return r.success&&t(n.login,n.orderType),r},async modifyOrder(n,r){const s=await e.trading.modifyOrder(n,r);return s.success&&t(n.login,n.orderType),s},async modifyPosition(n,r){const s=await e.trading.modifyPosition(n,r);return s.success&&t(n.login),s}}}function g0(e){if(e===null||typeof e!="object")return{deals:[],offset:0,count:0};const t=e,n=t.data??t,s=(Array.isArray(n.deals)?n.deals:[]).map(i=>{const o=i??{};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:s,offset:Number(n.offset??0),count:Number(n.count??s.length)}}function y0(e){if(e===null||typeof e!="object")return{total:0};const t=e,n=t.data??t;return{total:Number(n.total??0)}}function b0(e,t,n,r={}){const s=dt();return Or({queryKey:[gs,s.baseUrl,e,t,n],queryFn:async()=>{const i=await s.dealer.getDealsTotal(e,t,n);return y0(i)},enabled:r.enabled??!0})}function v0(e,t,n,r,s,i={}){const o=dt();return Or({queryKey:[hs,o.baseUrl,e,t,n,r,s],queryFn:async()=>{const a=await o.dealer.getDeals(e,t,n,r,s);return g0(a)},enabled:i.enabled??!0})}function w0(e,t){return e!=null?c0(e,t):[]}function _0(e,t){return e!=null?n0(e,t):[]}function x0({symbolTicker:e,controlsRef:t,chartWidget:n,sidePanelTab:r,orderState:s,backUrl:i,createAccountUrl:o}){const{openMarketPanel:a,setSelectedLogin:l,hasConfirmedAccount:d}=s,f=ys();return S.useEffect(()=>(t.current={open:a,setSelectedLogin:l},()=>{t.current=null}),[t,a,l]),c.jsxs(c.Fragment,{children:[d?c.jsx(Wm,{chartWidget:n,symbolTicker:e,symbols:f}):null,c.jsx(Fm,{}),c.jsx(Hx,{symbolTicker:e,sidePanelTab:r,orderState:s,backUrl:i,createAccountUrl:o})]})}const S0=8,vd=11;function C0({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 T0(){return c.jsx(c.Fragment,{children:Array.from({length:S0},(e,t)=>c.jsx("tr",{className:"web-trading-widget-terminal__skeleton-row",children:Array.from({length:vd},(n,r)=>c.jsx(C0,{wide:r===vd-1},r))},t))})}const E0={0:"Buy",1:"Sell",2:"Balance",3:"Credit",5:"-"},P0="web-trading-widget-text-buy",k0="web-trading-widget-text-sell",A0="web-trading-widget-terminal__head-row",Co=50;function O0(e){return e===0?P0:e===1?k0:A0}const wd=e=>e.toISOString().split("T")[0],cp=e=>Math.floor(new Date(e).getTime()/1e3),N0=e=>cp(e),R0=e=>cp(e)+86399;function L0(){const e=new Date,t=new Date;return t.setDate(t.getDate()-7),{fromTs:N0(wd(t)),toTs:R0(wd(e))}}const D0=e=>new Date(e*1e3).toLocaleString(void 0,{year:"numeric",month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"});function j0(e){try{return decodeURIComponent(e)}catch{return e}}function I0(){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 M0(){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:"Deal"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Login"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Symbol"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Action"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Volume"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Price"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Profit"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Entry"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Time"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Local time"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Comment"})]})})}function F0({deal:e}){const t=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 ${O0(e.action)}`,children:E0[e.action]??`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 ${t}`,children:[e.profit>0?"+":"",e.profit.toFixed(2)]}),c.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.entry===1?"OUT":"IN"}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--nowrap",children:ZS(new Date(e.time*1e3))}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--nowrap",children:D0(e.time)}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--truncate",children:e.comment?j0(e.comment):"—"})]})}function U0({login:e,detailUrl:t}){const{fromTs:n,toTs:r}=S.useMemo(()=>L0(),[]),s=e!=="",{data:i,isLoading:o}=b0(e,n,r,{enabled:s}),a=(i==null?void 0:i.total)??0,l=Math.max(0,a-Co),d=a>0?Math.min(Co,a):Co,{data:f,isLoading:u}=v0(e,n,r,l,d,{enabled:s}),y=s&&(o||u),p=S.useMemo(()=>[...(f==null?void 0:f.deals)??[]].sort((g,m)=>m.time-g.time),[f==null?void 0:f.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(I0,{}),c.jsx(M0,{}),c.jsxs("tbody",{children:[y?c.jsx(T0,{}):null,!y&&p.length===0?c.jsx("tr",{children:c.jsx("td",{colSpan:11,className:"web-trading-widget-terminal__empty-cell",children:"No deals found"})}):null,y?null:p.map(g=>c.jsx(F0,{deal:g},g.deal))]})]}),t?c.jsx("div",{className:"web-trading-widget-terminal__deals-footer",children:c.jsx("a",{href:t,className:"web-trading-widget-terminal__deals-detail-btn",children:"See full deal history"})}):null]})}):c.jsx("div",{className:"web-trading-widget-terminal__empty-cell",children:"Select an account to view deal history"})}function lp(e){const t=pe(d=>d.setPositions),n=pe(d=>d.setOrders),{data:r,isLoading:s,isError:i}=l0(e),{data:o,isLoading:a,isError:l}=d0(e);return S.useEffect(()=>{if(!e.trim()){t([]),n([]);return}r!=null&&t(w0(r,e)),o!=null&&n(_0(o,e))},[e,o,r,n,t]),{isLoading:s||a,isError:!!(i||l)}}const _d=224,xd=32,Ac=120;function dp(){return typeof window>"u"?560:Math.max(Ac,Math.floor(window.innerHeight*.7))}function B0(e){return Math.min(dp(),Math.max(Ac,e))}function $0(){const[e,t]=S.useState(_d),[n,r]=S.useState(!1),s=S.useRef(_d);S.useEffect(()=>{s.current=e},[e]);const i=S.useCallback(f=>{t(B0(f))},[]),o=S.useCallback(()=>{i(s.current+xd)},[i]),a=S.useCallback(()=>{i(s.current-xd)},[i]),l=S.useCallback(f=>{const u=f,y=s.current;r(!0);const p=m=>{const h=u-m.clientY;i(y+h)},g=()=>{r(!1),document.removeEventListener("mousemove",p),document.removeEventListener("mouseup",g),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",p),document.addEventListener("mouseup",g),document.body.style.cursor="row-resize",document.body.style.userSelect="none"},[i]);S.useEffect(()=>{const f=()=>{i(s.current)};return window.addEventListener("resize",f),()=>{window.removeEventListener("resize",f),document.body.style.cursor="",document.body.style.userSelect=""}},[i]);const d=dp();return{height:e,isResizing:n,canIncrement:e<d,canDecrement:e>Ac,onResizeStart:l,incrementHeight:o,decrementHeight:a}}const V0=e=>e==null?void 0:e.replace(/(\d+)\.0{18}/g,"$1"),H0=2e4;let To=0;function z0(){return To=(To+1)%Number.MAX_VALUE,To.toString()}const Eo=new Map,Sd=(e,t)=>{if(Eo.has(e))return;const n=setTimeout(()=>{Eo.delete(e),zr({type:"REMOVE_TOAST",toastId:e})},t||H0);Eo.set(e,n)},W0=(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 s=e.toasts.find(i=>i.id===r);Sd(r,s==null?void 0:s.duration)}else e.toasts.forEach(s=>{Sd(s.id,s.duration)});return{...e,toasts:e.toasts.map(s=>s.id===r||r===void 0?{...s,open:!1}:s)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(r=>r.id!==t.toastId)}}},Gs=[];let Zs={toasts:[]};function zr(e){Zs=W0(Zs,e),Gs.forEach(t=>{t(Zs)})}function Ce({duration:e=2e4,description:t,...n}){const r=z0(),s=typeof t=="string"?V0(t):t,i=a=>zr({type:"UPDATE_TOAST",toast:{...a,description:s,id:r}}),o=()=>{zr({type:"DISMISS_TOAST",toastId:r})};return zr({type:"ADD_TOAST",toast:{...n,description:s,id:r,open:!0,duration:e,onOpenChange:a=>{a||o()}}}),e&&setTimeout(o,e),{id:r,dismiss:o,update:i}}function K0(){const[e,t]=w.useState(Zs);return w.useEffect(()=>(Gs.push(t),()=>{const n=Gs.indexOf(t);n>-1&&Gs.splice(n,1)}),[e]),{...e,toast:Ce,dismiss:n=>zr({type:"DISMISS_TOAST",toastId:n})}}function q0(e){return e.type==="buy"?e.marketBid??e.currentPrice:e.marketAsk??e.currentPrice}function G0(){const{closePosition:e,deleteOrder:t}=qi(),n=p0(),r=pe(h=>h.removePosition),s=pe(h=>h.removeOrder),i=pe(h=>h.setSelectedPositionTicket),o=pe(h=>h.setSelectedOrderTicket),[a,l]=S.useState(new Set),[d,f]=S.useState(!1),u=S.useCallback((h,v)=>{l(b=>{const _=new Set(b);return v?_.add(h):_.delete(h),_})},[]),y=S.useCallback(h=>a.has(h),[a]),p=S.useCallback(async h=>{const v=`position-${h.ticket}`;u(v,!0);try{const b=await e(h);if(!b.success){Ce({variant:"destructive",description:b.message||"Failed to close position."});return}r(h.ticket),i(null),Ce({description:`Position #${h.ticket} closed at ${q0(h).toFixed(h.digits)}.`})}catch(b){const _=b instanceof Error?b.message:"Failed to close position.";Ce({variant:"destructive",description:_})}finally{u(v,!1)}},[e,r,u,i]),g=S.useCallback(async h=>{var x;if(h.length===0||d)return;if(!e){Ce({variant:"destructive",description:"Close position is not configured."});return}f(!0);let v=0,b=0;const _=((x=h[0])==null?void 0:x.login)??"";for(const P of h){const C=`position-${P.ticket}`;u(C,!0);try{if(!(await e(P,{skipInvalidation:!0})).success){b+=1;continue}r(P.ticket),v+=1}catch{b+=1}finally{u(C,!1)}}i(null),v>0&&_&&await n(_),Ce(b===0?{description:v===1?"1 position closed.":`${v} positions closed.`}:v===0?{variant:"destructive",description:"Failed to close positions."}:{variant:"destructive",description:`Closed ${v}, failed ${b}.`}),f(!1)},[d,e,n,r,u,i]),m=S.useCallback(async h=>{const v=`order-${h.ticket}`;u(v,!0);try{const b=await t(h);if(!b.success){Ce({variant:"destructive",description:b.message||"Failed to delete order."});return}s(h.ticket),o(null),Ce({description:`Order #${h.ticket} deleted.`})}catch(b){const _=b instanceof Error?b.message:"Failed to delete order.";Ce({variant:"destructive",description:_})}finally{u(v,!1)}},[t,s,u,o]);return{closePosition:p,closeAllPositions:g,deleteOrder:m,isClosingAll:d,isRowBusy:y}}function Zt(e,t=2){return e.toFixed(t)}function up(e){return e.reduce((t,n)=>t+n.profit+n.swap,0)}function Z0(e,t,n){const r=(e==null?void 0:e.balance)??0,s=(e==null?void 0:e.credit)??0,i=(e==null?void 0:e.margin)??0;if(!e||t.length===0)return{balance:r,equity:(e==null?void 0:e.equity)??r+s,margin:i,marginFree:(e==null?void 0:e.marginFree)??0,marginLevel:e==null?void 0:e.marginLevel,totalProfit:0};const o=up(t),a=r+s+o+n,l=a-i,d=i>0?a/i*100:void 0;return{balance:r,equity:a,margin:i,marginFree:l,marginLevel:d,totalProfit:o}}function da(){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 Y0(){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:"Symbol"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Ticket"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Server time"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Type"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Volume"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Price"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"S / L"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"T / P"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Price"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Swap"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Profit"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Comment"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--close","aria-label":"Close"})]})})}function Q0({balance:e,equity:t,margin:n,marginFree:r,marginLevel:s,totalPnL:i,scrollRef:o,onScroll:a}){const l=i>0?"web-trading-widget-text-profit-positive":i<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(da,{}),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:["Balance: ",Zt(e)]}),c.jsxs("span",{children:["Equity: ",Zt(t)]}),c.jsxs("span",{children:["Margin: ",Zt(n)]}),c.jsxs("span",{children:["Free margin: ",Zt(r)]}),c.jsxs("span",{children:["Level: ",s!==void 0?`${Zt(s,2)}%`:"0.00%"]})]})}),c.jsx("td",{className:`web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right ${l}`,children:Zt(i)}),c.jsx("td",{className:"web-trading-widget-terminal__cell"}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--close"})]})})]})})})}const X0=[{id:"trade",label:"Trade"},{id:"history",label:"History"}];function J0({activeTab:e,onTabChange:t,positionCount:n,isClosingAll:r,onCloseAllPositions:s,isRefetchingDeals:i,onRefetchDeals:o}){const a=e==="trade"&&(n>0||r),l=e==="history";return c.jsxs("div",{role:"tablist","aria-label":"Terminal panel tabs",className:"web-trading-widget-terminal__tab-bar",children:[X0.map(d=>{const f=e===d.id;return c.jsx("button",{type:"button",role:"tab","aria-selected":f,onClick:()=>t(d.id),className:`web-trading-widget-terminal__tab-btn${f?" web-trading-widget-terminal__tab-btn--active":""}`,children:d.label},d.id)}),c.jsxs("div",{className:"web-trading-widget-terminal__toolbar-actions",children:[a?c.jsx("button",{type:"button",disabled:r,onClick:s,className:"web-trading-widget-terminal__close-all-btn",children:r?"Closing…":"Close all"}):null,l?c.jsxs("button",{type:"button",disabled:i,onClick:o,className:"web-trading-widget-terminal__refetch-btn","aria-label":"Refresh deal history",children:[c.jsx(Vv,{className:`web-trading-widget-icon web-trading-widget-icon--sm${i?" web-trading-widget-terminal__refetch-icon--spinning":""}`}),i?"Refreshing…":"Refresh"]}):null]})]})}function eC({position:e,isSelected:t,isClosing:n,onSelect:r,onClose:s}){const i=e.type==="buy"?"web-trading-widget-text-buy":"web-trading-widget-text-sell",o=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 ${i}`,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:Se(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?Se(e.stopLoss,e.digits):"N/A"}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.takeProfit!==void 0&&e.takeProfit!==0?Se(e.takeProfit,e.digits):"N/A"}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:Se(e.currentPrice,e.digits)}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.swap!==0?Zt(e.swap):""}),c.jsx("td",{className:`web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right ${o}`,children:Zt(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":`Close position #${e.ticket}`,title:"Close position",disabled:n,className:"web-trading-widget-terminal__row-close-btn",onClick:a=>{a.stopPropagation(),s()},children:c.jsx(gn,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})})})]})}function tC({order:e,isSelected:t,isDeleting:n,onSelect:r,onDelete:s}){const i=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 ${i}`,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:Se(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?Se(e.stopLoss,e.digits):"N/A"}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.takeProfit!==void 0&&e.takeProfit!==0?Se(e.takeProfit,e.digits):"N/A"}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:Se(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":`Delete order #${e.ticket}`,title:"Delete order",disabled:n,className:"web-trading-widget-terminal__row-close-btn",onClick:o=>{o.stopPropagation(),s()},children:c.jsx(gn,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})})})]})}function fp({embedded:e=!1,symbolTicker:t="",onSymbolChange:n,onCreateNewOrder:r,dealDetailUrl:s}){const[i,o]=S.useState("trade"),a=ys(),{accounts:l,isLoading:d}=ap(),f=$0(),{height:u,isResizing:y,onResizeStart:p}=e?{height:0,isResizing:!1,onResizeStart:()=>{}}:f,g=pe($=>$.selectedLogin),m=pe($=>$.selectedPositionTicket),h=pe($=>$.selectedOrderTicket),v=pe($=>$.setSelectedPositionTicket),b=pe($=>$.setSelectedOrderTicket),{isLoading:_}=lp(g),x=pe($=>$.positions),P=pe($=>$.orders),{closePosition:C,closeAllPositions:E,deleteOrder:A,isClosingAll:R,isRowBusy:M}=G0(),N=m0(),L=dt(),H=HS({predicate:$=>{const we=$.queryKey;return g?(we[0]===hs||we[0]===gs)&&we[1]===L.baseUrl&&we[2]===g:!1}})>0,D=d||_,F=S.useMemo(()=>g?x.filter($=>$.login===g):x,[x,g]),I=S.useMemo(()=>g?P.filter($=>$.login===g):P,[P,g]),U=S.useMemo(()=>{const $=l.find(we=>we.login===g);return($==null?void 0:$.tradeStat)??null},[l,g]),O=S.useMemo(()=>F.map($=>$.ticket).sort().join("|"),[F]),B=S.useMemo(()=>U?`${U.balance}:${U.credit??0}:${U.equity}:${U.margin}|${O}`:"",[U,O]),W=S.useMemo(()=>{if(!U||F.length===0)return 0;const $=up(F);return U.equity-U.balance-(U.credit??0)-$},[B]),j=S.useMemo(()=>Z0(U,F,W),[U,F,W]),ee=F.length===0&&I.length===0,X=S.useRef(null),de=S.useRef(null),ue=S.useRef(null),V=S.useCallback(()=>{E(F)},[E,F]),K=S.useCallback(()=>{g&&N(g)},[N,g]),ie=S.useCallback($=>{const we=ew($,a);we&&(n==null||n(we))},[n,a]),ge=S.useCallback($=>{v($.ticket),ie($.symbol)},[v,ie]),le=S.useCallback($=>{b($.ticket),ie($.symbol)},[b,ie]),oe=S.useCallback($=>{const we=X.current,ke=de.current,Pe=ue.current;if(!we||!ke)return;const J=$==="header"?we.scrollLeft:$==="body"?ke.scrollLeft:(Pe==null?void 0:Pe.scrollLeft)??0;$!=="header"&&(we.scrollLeft=J),$!=="body"&&(ke.scrollLeft=J),Pe&&$!=="footer"&&(Pe.scrollLeft=J)},[]);return c.jsxs(c.Fragment,{children:[!e&&y?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:u},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":"Resize terminal panel","aria-valuenow":u,className:"web-trading-widget-terminal__resize-bar",onMouseDown:$=>{$.preventDefault(),p($.clientY)},children:c.jsx(Gf,{className:"web-trading-widget-icon web-trading-widget-icon--sm web-trading-widget-terminal__resize-icon"})})}),c.jsx(J0,{activeTab:i,onTabChange:o,positionCount:F.length,isClosingAll:R,onCloseAllPositions:V,isRefetchingDeals:H,onRefetchDeals:K}),i==="trade"?c.jsxs(c.Fragment,{children:[c.jsx("div",{ref:X,className:"web-trading-widget-terminal__header-scroll",onScroll:()=>oe("header"),children:c.jsxs("table",{className:"web-trading-widget-terminal__table",children:[c.jsx(da,{}),c.jsx(Y0,{})]})}),c.jsx("div",{ref:de,className:"web-trading-widget-terminal__body-scroll",onScroll:()=>oe("body"),children:c.jsxs("table",{className:"web-trading-widget-terminal__table",children:[c.jsx(da,{}),c.jsxs("tbody",{children:[D&&ee?c.jsx("tr",{children:c.jsx("td",{colSpan:13,className:"web-trading-widget-terminal__empty-cell",children:"Loading…"})}):null,!D&&ee?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:"You don't have any positions"}),r?c.jsx("button",{type:"button",onClick:r,className:"web-trading-widget-terminal__create-btn",children:"Create New Order"}):null]})})}):null,F.map($=>c.jsx(eC,{position:$,isSelected:m===$.ticket,isClosing:M(`position-${$.ticket}`),onSelect:()=>ge($),onClose:()=>void C($)},`position-${$.ticket}`)),I.map($=>c.jsx(tC,{order:$,isSelected:h===$.ticket,isDeleting:M(`order-${$.ticket}`),onSelect:()=>le($),onDelete:()=>void A($)},`order-${$.ticket}`))]})]})})]}):c.jsx(U0,{login:g??"",detailUrl:s}),c.jsx(Q0,{balance:j.balance,equity:j.equity,margin:j.margin,marginFree:j.marginFree,marginLevel:j.marginLevel,totalPnL:j.totalProfit,scrollRef:i==="trade"?ue:void 0,onScroll:i==="trade"?()=>oe("footer"):void 0})]})]})}const ua=224,pi=120;function nC(e){var n;const t=(n=e==null?void 0:e.current)==null?void 0:n.clientHeight;return t&&t>0?Math.max(pi,Math.floor(t*.35)):ua}function rC(e){var n;const t=(n=e==null?void 0:e.current)==null?void 0:n.clientHeight;return t&&t>0?Math.max(pi,Math.floor(t*.85)):typeof window>"u"?560:Math.max(pi,Math.floor(window.innerHeight*.7))}function sC(e,t){return Math.min(rC(t),Math.max(pi,e))}function iC({containerRef:e,isOpen:t=!1}={}){const[n,r]=S.useState(ua),[s,i]=S.useState(!1),o=S.useRef(ua);S.useEffect(()=>{o.current=n},[n]);const a=S.useCallback(d=>{r(sC(d,e))},[e]);S.useEffect(()=>{if(!t)return;const d=Math.max(o.current,nC(e));a(d)},[e,t,a]);const l=S.useCallback(d=>{const f=d,u=o.current;i(!0);const y=g=>{const m=f-g.clientY;a(u+m)},p=()=>{i(!1),document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",p),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",y),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:s,onResizeStart:l}}function mp({children:e}){const[t]=S.useState(()=>new OS({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}}));return c.jsx(NS,{client:t,children:e})}function pp({containerRef:e,onCreateNewOrder:t}){const[n,r]=S.useState(!1),{height:s,isResizing:i,onResizeStart:o}=iC({containerRef:e,isOpen:n}),a=pe(g=>g.selectedLogin),l=pe(g=>g.orders),d=pe(g=>g.positions),f=S.useMemo(()=>a?l.filter(g=>g.login===a):l,[a,l]),u=S.useMemo(()=>a?d.filter(g=>g.login===a):d,[a,d]),y=f.length+u.length,p=()=>{r(!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":"Open terminal","aria-expanded":n,onClick:()=>r(!0),children:[c.jsx(Fv,{className:"web-trading-widget-icon web-trading-widget-icon--sm"}),c.jsx("span",{children:"Orders"}),y>0?c.jsx("span",{className:"web-trading-widget-news-orders-overlay__badge",children:y}):null]}),n?c.jsx(c.Fragment,{children:c.jsxs("div",{className:"web-trading-widget-news-orders__panel",style:{height:s},children:[i?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":"Resize terminal panel","aria-valuenow":s,className:"web-trading-widget-terminal__resize-bar",onMouseDown:g=>{g.preventDefault(),o(g.clientY)},children:c.jsx(Gf,{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:"Terminal"}),c.jsx("button",{type:"button",className:"web-trading-widget-news-orders__panel-close","aria-label":"Close terminal panel",onClick:()=>r(!1),children:c.jsx(gn,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})})]}),c.jsx("div",{className:"web-trading-widget-news-orders__panel-body",children:c.jsx(fp,{embedded:!0,onCreateNewOrder:t?p:void 0})})]})}):null]})}function oC({baseUrl:e,containerRef:t,onCreateNewOrder:n}){return c.jsx(mp,{children:c.jsx(Im,{baseUrl:e,children:c.jsx(pp,{containerRef:t,onCreateNewOrder:n})})})}const Rn=S.forwardRef(({className:e,type:t,...n},r)=>c.jsx("input",{type:t,className:Ee("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}));Rn.displayName="Input";var Gi="Collapsible",[aC,hp]=Bn(Gi),[cC,Oc]=aC(Gi),gp=w.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:s,disabled:i,onOpenChange:o,...a}=e,[l,d]=Ln({prop:r,defaultProp:s??!1,onChange:o,caller:Gi});return c.jsx(cC,{scope:n,disabled:i,contentId:on(),open:l,onOpenToggle:w.useCallback(()=>d(f=>!f),[d]),children:c.jsx(he.div,{"data-state":Rc(l),"data-disabled":i?"":void 0,...a,ref:t})})});gp.displayName=Gi;var yp="CollapsibleTrigger",bp=w.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,s=Oc(yp,n);return c.jsx(he.button,{type:"button","aria-controls":s.open?s.contentId:void 0,"aria-expanded":s.open||!1,"data-state":Rc(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...r,ref:t,onClick:me(e.onClick,s.onOpenToggle)})});bp.displayName=yp;var Nc="CollapsibleContent",vp=w.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=Oc(Nc,e.__scopeCollapsible);return c.jsx($n,{present:n||s.open,children:({present:i})=>c.jsx(lC,{...r,ref:t,present:i})})});vp.displayName=Nc;var lC=w.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:s,...i}=e,o=Oc(Nc,n),[a,l]=w.useState(r),d=w.useRef(null),f=Oe(t,d),u=w.useRef(0),y=u.current,p=w.useRef(0),g=p.current,m=o.open||a,h=w.useRef(m),v=w.useRef(void 0);return w.useEffect(()=>{const b=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(b)},[]),Ie(()=>{const b=d.current;if(b){v.current=v.current||{transitionDuration:b.style.transitionDuration,animationName:b.style.animationName},b.style.transitionDuration="0s",b.style.animationName="none";const _=b.getBoundingClientRect();u.current=_.height,p.current=_.width,h.current||(b.style.transitionDuration=v.current.transitionDuration,b.style.animationName=v.current.animationName),l(r)}},[o.open,r]),c.jsx(he.div,{"data-state":Rc(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!m,...i,ref:f,style:{"--radix-collapsible-content-height":y?`${y}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...e.style},children:m&&s})});function Rc(e){return e?"open":"closed"}var dC=gp,uC=bp,fC=vp,xt="Accordion",mC=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[Lc,pC,hC]=Fa(xt),[Zi]=Bn(xt,[hC,hp]),Dc=hp(),wp=w.forwardRef((e,t)=>{const{type:n,...r}=e,s=r,i=r;return c.jsx(Lc.Provider,{scope:e.__scopeAccordion,children:n==="multiple"?c.jsx(vC,{...i,ref:t}):c.jsx(bC,{...s,ref:t})})});wp.displayName=xt;var[_p,gC]=Zi(xt),[xp,yC]=Zi(xt,{collapsible:!1}),bC=w.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},collapsible:i=!1,...o}=e,[a,l]=Ln({prop:n,defaultProp:r??"",onChange:s,caller:xt});return c.jsx(_p,{scope:e.__scopeAccordion,value:w.useMemo(()=>a?[a]:[],[a]),onItemOpen:l,onItemClose:w.useCallback(()=>i&&l(""),[i,l]),children:c.jsx(xp,{scope:e.__scopeAccordion,collapsible:i,children:c.jsx(Sp,{...o,ref:t})})})}),vC=w.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},...i}=e,[o,a]=Ln({prop:n,defaultProp:r??[],onChange:s,caller:xt}),l=w.useCallback(f=>a((u=[])=>[...u,f]),[a]),d=w.useCallback(f=>a((u=[])=>u.filter(y=>y!==f)),[a]);return c.jsx(_p,{scope:e.__scopeAccordion,value:o,onItemOpen:l,onItemClose:d,children:c.jsx(xp,{scope:e.__scopeAccordion,collapsible:!0,children:c.jsx(Sp,{...i,ref:t})})})}),[wC,Yi]=Zi(xt),Sp=w.forwardRef((e,t)=>{const{__scopeAccordion:n,disabled:r,dir:s,orientation:i="vertical",...o}=e,a=w.useRef(null),l=Oe(a,t),d=pC(n),u=Yu(s)==="ltr",y=me(e.onKeyDown,p=>{var A;if(!mC.includes(p.key))return;const g=p.target,m=d().filter(R=>{var M;return!((M=R.ref.current)!=null&&M.disabled)}),h=m.findIndex(R=>R.ref.current===g),v=m.length;if(h===-1)return;p.preventDefault();let b=h;const _=0,x=v-1,P=()=>{b=h+1,b>x&&(b=_)},C=()=>{b=h-1,b<_&&(b=x)};switch(p.key){case"Home":b=_;break;case"End":b=x;break;case"ArrowRight":i==="horizontal"&&(u?P():C());break;case"ArrowDown":i==="vertical"&&P();break;case"ArrowLeft":i==="horizontal"&&(u?C():P());break;case"ArrowUp":i==="vertical"&&C();break}const E=b%v;(A=m[E].ref.current)==null||A.focus()});return c.jsx(wC,{scope:n,disabled:r,direction:s,orientation:i,children:c.jsx(Lc.Slot,{scope:n,children:c.jsx(he.div,{...o,"data-orientation":i,ref:l,onKeyDown:r?void 0:y})})})}),hi="AccordionItem",[_C,jc]=Zi(hi),Cp=w.forwardRef((e,t)=>{const{__scopeAccordion:n,value:r,...s}=e,i=Yi(hi,n),o=gC(hi,n),a=Dc(n),l=on(),d=r&&o.value.includes(r)||!1,f=i.disabled||e.disabled;return c.jsx(_C,{scope:n,open:d,disabled:f,triggerId:l,children:c.jsx(dC,{"data-orientation":i.orientation,"data-state":Op(d),...a,...s,ref:t,disabled:f,open:d,onOpenChange:u=>{u?o.onItemOpen(r):o.onItemClose(r)}})})});Cp.displayName=hi;var Tp="AccordionHeader",Ep=w.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=Yi(xt,n),i=jc(Tp,n);return c.jsx(he.h3,{"data-orientation":s.orientation,"data-state":Op(i.open),"data-disabled":i.disabled?"":void 0,...r,ref:t})});Ep.displayName=Tp;var fa="AccordionTrigger",Pp=w.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=Yi(xt,n),i=jc(fa,n),o=yC(fa,n),a=Dc(n);return c.jsx(Lc.ItemSlot,{scope:n,children:c.jsx(uC,{"aria-disabled":i.open&&!o.collapsible||void 0,"data-orientation":s.orientation,id:i.triggerId,...a,...r,ref:t})})});Pp.displayName=fa;var kp="AccordionContent",Ap=w.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=Yi(xt,n),i=jc(kp,n),o=Dc(n);return c.jsx(fC,{role:"region","aria-labelledby":i.triggerId,"data-orientation":s.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}})});Ap.displayName=kp;function Op(e){return e?"open":"closed"}var xC=wp,SC=Cp,CC=Ep,Np=Pp,Rp=Ap;const TC=xC,qn=w.forwardRef(({className:e,...t},n)=>c.jsx(SC,{ref:n,className:Ee("border-b",e),...t}));qn.displayName="AccordionItem";const Gn=w.forwardRef(({className:e,children:t,...n},r)=>c.jsx(CC,{className:"flex",children:c.jsxs(Np,{ref:r,className:Ee("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(rc,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"})]})}));Gn.displayName=Np.displayName;const Zn=w.forwardRef(({className:e,children:t,...n},r)=>c.jsx(Rp,{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:Ee("pb-4 pt-0",e),children:t})}));Zn.displayName=Rp.displayName;function Cd(e){const t=e.trim().replace(/,/g,"");if(!t||t===".")return null;const n=Number(t);return Number.isFinite(n)?n:null}function Td(e,t){return t<=0?String(Math.round(e)):e.toFixed(t)}function EC(e,t){const n=e.replace(/,/g,"").replace(/[^\d.]/g,""),r=n.indexOf(".");if(r===-1)return n;const s=n.slice(0,r),i=n.slice(r+1).replace(/\./g,""),o=t>0?i.slice(0,t):"";return`${s}.${o}`}function PC(e){const t=e.trim();return!t||t==="."?"":t.endsWith(".")?t.slice(0,-1):t}function De({label:e,value:t,onChange:n,step:r=.01,min:s,decimals:i=2,placeholder:o,basePrice:a,disabled:l=!1,clearable:d=!1}){const[f,u]=S.useState(t),[y,p]=S.useState(!1),g=y?f:t,m=g.trim()!=="",h=!d;S.useEffect(()=>{y||u(t)},[y,t]);const v=()=>a!=null&&Number.isFinite(a)?a:s??0,b=A=>{u(A),n(A)},_=A=>{if(l)return;const R=v(),M=Cd(g),N=g.trim()!=="";let L;!N||M===null?L=A===1?R:R-r:L=M+A*r;const H=s!==void 0?Math.max(s,L):L;if(H<=0)return;const D=Td(H,i);p(!1),b(D)},x=()=>{p(!0),u(t)},P=()=>{p(!1);const A=PC(f);if(!A){f.trim()!==""&&b("");return}const R=Cd(A);if(R===null||R<=0){b("");return}if(h){b(Td(R,i));return}b(A)},C=A=>{u(EC(A,i))},E=()=>{l||(p(!1),b(""))};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&&m?c.jsx("button",{type:"button","aria-label":`Clear ${e}`,className:"web-trading-widget-stepper__clear",disabled:l,onClick:E,children:c.jsx(gn,{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&&g.trim()==="",onClick:()=>_(-1),children:c.jsx(Bv,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})}),c.jsx("input",{type:"text",inputMode:"decimal",pattern:"[0-9]*[.]?[0-9]*",value:g,placeholder:o,disabled:l,onFocus:x,onChange:A=>C(A.target.value),onBlur:P,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&&g.trim()==="",onClick:()=>_(1),children:c.jsx($v,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})})]})]})}function kC({symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:s,minVolumeLots:i,isSubmitting:o,isAccountsLoading:a,selectedLogin:l,embedded:d=!1,onMinimize:f,onClose:u,onPlaceOrder:y}){const[p,g]=S.useState("market"),[m,h]=S.useState(String(r)),[v,b]=S.useState(""),[_,x]=S.useState(""),P=se(re=>re.stopLoss),C=se(re=>re.takeProfit),E=se(re=>re.setStopLoss),A=se(re=>re.setTakeProfit),R=se(re=>re.setVolumeLots),M=se(re=>re.setOrderSide),[N,L]=S.useState(""),[H,D]=S.useState(gt.GTC),[F,I]=S.useState(""),[U,O]=S.useState(""),B=Number(Vt(Ht(e))),W=Pr(B),j=fc(t,n),ee=t!==null?Se(t,B):"—",X=n!==null?Se(n,B):"—",de=Fi(p),ue=Qf(p),V=Mi(p),K=V.label,ie=!de&&V.orderType!==null&&V.orderType%2===1,ge=S.useMemo(()=>j!==null?j:t??n,[n,t,j]),le=re=>{h(re);const Ve=Number(re);Number.isFinite(Ve)&&Ve>0&&R(Ve)},oe=re=>t===null||n===null?null:de?re==="buy"?n:t:Ue(v)??(re==="buy"?n:t),$=re=>{const Ve=oe(re);Ve!==null&&M({side:re,entryPrice:Ve})},we=re=>{if(t===null||n===null||!l)return;const Ve=Math.max(i,Number(m)||i),Ji=Vo(p,re),vs=oe(re);vs!==null&&M({side:re,entryPrice:vs}),y({login:l,executionMode:p,side:re,orderType:Ji,volumeLots:Ve,stopLoss:P,takeProfit:C,priceOrder:v,priceTrigger:_,comment:N,typeTime:H,expirationDateTime:F,expirationDay:U,bid:t,ask:n})},ke=t!==null&&n!==null,Pe=de||Ue(v)!==void 0,J=!ue||Ue(_)!==void 0,Ne=de||Bi(H,F,U),Be=!o&&!a&&l!==""&&ke&&Pe&&J&&Ne,Xe=!de&&lc(H),ft=!de&&dc(H);return c.jsxs("div",{className:"web-trading-widget-market-panel",children:[c.jsxs("div",{className:"web-trading-widget-market-panel__header",children:[c.jsxs(si,{value:p,onValueChange:re=>g(re),children:[c.jsx(Kr,{className:"web-trading-widget-market-panel__select-trigger",children:c.jsx(ii,{})}),c.jsx(qr,{children:ai.map(re=>c.jsx(Gr,{value:re.mode,children:re.label},re.mode))})]}),d?null:c.jsxs("div",{className:"web-trading-widget-market-panel__header-actions",children:[c.jsx("button",{type:"button","aria-label":"Minimize to quick order panel",className:"web-trading-widget-market-panel__header-btn",onClick:f,children:c.jsx(Uv,{className:"web-trading-widget-icon web-trading-widget-icon--md"})}),c.jsx("button",{type:"button","aria-label":"Close order panel",className:"web-trading-widget-market-panel__header-btn",onClick:u,children:c.jsx(gn,{className:"web-trading-widget-icon web-trading-widget-icon--md"})})]})]}),c.jsxs(TC,{type:"multiple",defaultValue:["volume-setting","risk-management"],className:"web-trading-widget-market-panel__accordion",children:[c.jsxs(qn,{value:"volume-setting",className:"web-trading-widget-market-panel__accordion-item",children:[c.jsx(Gn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Volume Setting"}),c.jsx(Zn,{className:"web-trading-widget-market-panel__accordion-content",children:c.jsx(De,{label:"Lots",value:m,onChange:le,step:s,min:i,decimals:2})})]}),de?null:c.jsxs(qn,{value:"order-price",className:"web-trading-widget-market-panel__accordion-item",children:[c.jsx(Gn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Order Price"}),c.jsx(Zn,{className:"web-trading-widget-market-panel__accordion-content",children:ue?c.jsxs(c.Fragment,{children:[c.jsx(De,{label:"Stop Price",value:_,onChange:x,step:W,decimals:B,basePrice:ge,placeholder:j!==null?Se(j,B):"—"}),c.jsx(De,{label:"Limit Price",value:v,onChange:b,step:W,decimals:B,basePrice:ge,placeholder:j!==null?Se(j,B):"—"})]}):c.jsx(De,{label:"Price",value:v,onChange:b,step:W,decimals:B,basePrice:ge,placeholder:j!==null?Se(j,B):"—"})})]}),c.jsxs(qn,{value:"risk-management",className:"web-trading-widget-market-panel__accordion-item",children:[c.jsx(Gn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Risk Management"}),c.jsx(Zn,{className:"web-trading-widget-market-panel__accordion-content",children:c.jsxs("div",{className:"web-trading-widget-market-panel__grid-2",children:[c.jsx(De,{label:"Stop Loss",value:P,onChange:E,step:W,decimals:B,basePrice:t,placeholder:t!==null?ee:"—",clearable:!0}),c.jsx(De,{label:"Take Profit",value:C,onChange:A,step:W,decimals:B,basePrice:n,placeholder:n!==null?X:"—",clearable:!0})]})})]}),de?null:c.jsxs(qn,{value:"expiration",className:"web-trading-widget-market-panel__accordion-item",children:[c.jsx(Gn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Expiration"}),c.jsxs(Zn,{className:"web-trading-widget-market-panel__accordion-content",children:[c.jsxs(si,{value:String(H),onValueChange:re=>D(Number(re)),children:[c.jsx(Kr,{className:"web-trading-widget-market-panel__select-full",children:c.jsx(ii,{})}),c.jsx(qr,{children:Xf.map(re=>c.jsx(Gr,{value:String(re.value),children:re.label},re.value))})]}),Xe?c.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[c.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Expiration time"}),c.jsx(Rn,{type:"datetime-local",value:F,onChange:re=>I(re.target.value)})]}):null,ft?c.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[c.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Expiration day"}),c.jsx(Rn,{type:"date",value:U,onChange:re=>O(re.target.value)})]}):null]})]}),c.jsxs(qn,{value:"comment",className:"web-trading-widget-market-panel__accordion-item",children:[c.jsx(Gn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Comment"}),c.jsx(Zn,{className:"web-trading-widget-market-panel__accordion-content",children:c.jsx(Rn,{value:N,onChange:re=>L(re.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:ee}),c.jsx("span",{className:"web-trading-widget-market-panel__quotes-ask",children:X})]}),de?c.jsxs("div",{className:"web-trading-widget-market-panel__actions",children:[c.jsx(ct,{type:"button",variant:"destructive",className:"web-trading-widget-market-panel__sell-btn",disabled:!Be,onMouseDown:()=>$("sell"),onClick:()=>we("sell"),children:"Sell by Market"}),c.jsx(ct,{type:"button",className:"web-trading-widget-market-panel__buy-btn",disabled:!Be,onMouseDown:()=>$("buy"),onClick:()=>we("buy"),children:"Buy by Market"})]}):c.jsxs(ct,{type:"button",variant:ie?"destructive":"default",className:`web-trading-widget-market-panel__place-btn${ie?"":" web-trading-widget-market-panel__place-btn--buy"}`,disabled:!Be,onMouseDown:()=>{const re=V.orderType!==null&&V.orderType%2===1?"sell":"buy";$(re)},onClick:()=>{const re=V.orderType!==null&&V.orderType%2===1?"sell":"buy";we(re)},children:["Place ",K]})]})]})}function Lp({confirmation:e,symbolTicker:t,onDismiss:n}){const r=Number(Vt(Ht(t))),s=Se(e.price,r),i=e.side==="sell"?"sell":"buy",o=Ii(e.symbol||Ui(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":"Close confirmation",className:"web-trading-widget-confirmation__close-btn",onClick:n,children:c.jsx(gn,{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:i})," ",e.volumeLots.toFixed(2)," ",o]}),c.jsxs("p",{className:"web-trading-widget-confirmation__price",children:["at ",s]}),c.jsx("p",{className:"web-trading-widget-confirmation__status",children:"Placed"}),c.jsx(ct,{type:"button",className:"web-trading-widget-confirmation__ok-btn",onClick:n,children:"OK"})]})]})}function Is(e,t){return e.toLocaleString(void 0,{minimumFractionDigits:t,maximumFractionDigits:t})}function $r(e){if(!(e===void 0||e===0))return e}function Ed(e,t){return e===void 0||e===0?"":Se(e,t)}function Pd(e,t){const n=Ue(e);if(n!==void 0)return n;if($r(t)!==void 0)return 0}function Dp({order:e,onClose:t}){const{deleteOrder:n,modifyOrder:r}=qi(),s=pe(V=>V.removeOrder),i=pe(V=>V.liveQuotes),[o,a]=S.useState(String(e.volumeLots)),[l,d]=S.useState(String(e.orderPrice)),[f,u]=S.useState(e.priceTrigger!==void 0?String(e.priceTrigger):""),y=se(V=>V.stopLoss),p=se(V=>V.takeProfit),g=se(V=>V.setStopLoss),m=se(V=>V.setTakeProfit),h=se(V=>V.setDraft),v=se(V=>V.clearDraft),[b,_]=S.useState(e.comment),[x,P]=S.useState(!1),[C,E]=S.useState(!1),A=Pr(e.digits),R=Ke(e.symbol).toUpperCase(),M=i[R],N=(M==null?void 0:M.bid)??e.marketBid??null,L=(M==null?void 0:M.ask)??e.marketAsk??null,H=N!==null?Se(N,e.digits):"—",D=L!==null?Se(L,e.digits):"—",F=S.useMemo(()=>e.orderPrice>0?e.orderPrice:fc(N,L)??N??L,[L,N,e.orderPrice]);S.useEffect(()=>(h({source:"order",entryPrice:e.orderPrice,stopLoss:Ed(e.stopLoss,e.digits),takeProfit:Ed(e.takeProfit,e.digits),side:e.side,showEntryLine:!0,volumeLots:e.volumeLots,digits:e.digits,priceStep:A}),()=>{v()}),[v,e.digits,e.orderPrice,e.side,e.stopLoss,e.takeProfit,e.volumeLots,A,h]);const I=cc(e.orderType),U=e.volumeLots,O=Number(l)||e.orderPrice,B=Ue(f),W=x||C,ee=(O!==e.orderPrice||(I?B!==e.priceTrigger:!1)||$r(Ue(y))!==$r(e.stopLoss)||$r(Ue(p))!==$r(e.takeProfit)||b.trim()!==e.comment.trim())&&(!I||B!==void 0&&Number.isFinite(O)&&O>0),X=S.useMemo(()=>`Delete #${e.ticket} ${e.typeLabel} ${U.toFixed(2)} ${e.displaySymbol} at ${Is(O,e.digits)}`,[e,O,U]),de=async()=>{if(!ee){Ce({variant:"destructive",description:I?"Please set both stop and limit prices.":"Please set an order price."});return}P(!0);try{const V=await r(e,{volumeLots:U,priceOrder:O,priceTrigger:I?B:void 0,stopLoss:Pd(y,e.stopLoss),takeProfit:Pd(p,e.takeProfit),comment:b.trim()||"order modify"});if(!V.success){Ce({variant:"destructive",description:V.message||"Failed to modify order."});return}t(),Ce({description:`Order #${e.ticket} updated.`})}catch(V){const K=V instanceof Error?V.message:"Failed to modify order.";Ce({variant:"destructive",description:K})}finally{P(!1)}},ue=async()=>{E(!0);try{const V=await n(e);if(!V.success){Ce({variant:"destructive",description:V.message||"Failed to delete order."});return}s(e.ticket),t(),Ce({description:`Order #${e.ticket} deleted.`})}catch(V){const K=V instanceof Error?V.message:"Failed to delete order.";Ce({variant:"destructive",description:K})}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," ",U.toFixed(2)," / ",e.volumeFilledLots.toFixed(2)," ",e.displaySymbol," ",I&&B!==void 0?`${Is(B,e.digits)} / ${Is(O,e.digits)}`:Is(O,e.digits)]}),c.jsx("button",{type:"button","aria-label":"Close order panel",className:"web-trading-widget-icon-btn",onClick:t,children:c.jsx(gn,{className:"web-trading-widget-icon web-trading-widget-icon--md"})})]}),c.jsxs("div",{className:"web-trading-widget-detail-panel__body",children:[c.jsx(De,{label:"Lots",value:o,onChange:a,step:.01,min:.01,decimals:2,disabled:!0}),I?c.jsxs(c.Fragment,{children:[c.jsx(De,{label:"Stop Price",value:f,onChange:u,step:A,decimals:e.digits,basePrice:F}),c.jsx(De,{label:"Limit Price",value:l,onChange:d,step:A,decimals:e.digits,basePrice:F})]}):c.jsx(De,{label:"Price",value:l,onChange:d,step:A,decimals:e.digits,basePrice:F}),c.jsxs("div",{className:"web-trading-widget-market-panel__grid-2",children:[c.jsx(De,{label:"Stop Loss",value:y,onChange:g,step:A,decimals:e.digits,basePrice:N,placeholder:H,clearable:!0}),c.jsx(De,{label:"Take Profit",value:p,onChange:m,step:A,decimals:e.digits,basePrice:L,placeholder:D,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:"Comment"}),c.jsx(Rn,{value:b,onChange:V=>_(V.target.value)})]}),c.jsx(ct,{type:"button",variant:"secondary",className:"web-trading-widget-detail-panel__btn-full",disabled:W||!ee,onClick:()=>void de(),children:"Modify"}),c.jsx(ct,{type:"button",className:"web-trading-widget-detail-panel__action-btn",disabled:W,onClick:()=>void ue(),children:X})]})]})}function Ms(e,t){return e.toLocaleString(void 0,{minimumFractionDigits:t,maximumFractionDigits:t})}function Vr(e){if(!(e===void 0||e===0))return e}function kd(e,t){return e===void 0||e===0?"":Se(e,t)}function Ad(e,t){const n=Ue(e);if(n!==void 0)return n;if(Vr(t)!==void 0)return 0}function AC(e,t,n){return e.type==="buy"?t??e.marketBid??e.currentPrice:n??e.marketAsk??e.currentPrice}function jp({position:e,onClose:t}){const{closePosition:n,modifyPosition:r}=qi(),s=pe(O=>O.removePosition),i=pe(O=>O.liveQuotes),[o,a]=S.useState(String(e.volumeLots)),l=se(O=>O.stopLoss),d=se(O=>O.takeProfit),f=se(O=>O.setStopLoss),u=se(O=>O.setTakeProfit),y=se(O=>O.setDraft),p=se(O=>O.clearDraft),[g,m]=S.useState(e.comment),[h,v]=S.useState(!1),[b,_]=S.useState(!1),x=Pr(e.digits),P=Ke(e.symbol).toUpperCase(),C=i[P],E=(C==null?void 0:C.bid)??e.marketBid??null,A=(C==null?void 0:C.ask)??e.marketAsk??null,R=E!==null?Se(E,e.digits):"—",M=A!==null?Se(A,e.digits):"—";S.useEffect(()=>(y({source:"position",entryPrice:e.openPrice,stopLoss:kd(e.stopLoss,e.digits),takeProfit:kd(e.takeProfit,e.digits),side:e.type,showEntryLine:!0,volumeLots:e.volumeLots,digits:e.digits,priceStep:x}),()=>{p()}),[p,e.digits,e.openPrice,e.stopLoss,e.takeProfit,e.type,e.volumeLots,x,y]);const N=AC(e,E,A),L=e.volumeLots,H=h||b,D=Vr(Ue(l))!==Vr(e.stopLoss)||Vr(Ue(d))!==Vr(e.takeProfit)||g.trim()!==e.comment.trim(),F=async()=>{if(D){_(!0);try{const O=await r(e,{stopLoss:Ad(l,e.stopLoss),takeProfit:Ad(d,e.takeProfit),comment:g.trim()});if(!O.success){Ce({variant:"destructive",description:O.message||"Failed to modify position."});return}t(),Ce({description:`Position #${e.ticket} updated.`})}catch(O){const B=O instanceof Error?O.message:"Failed to modify position.";Ce({variant:"destructive",description:B})}finally{_(!1)}}},I=S.useMemo(()=>{const O=e.profit.toFixed(2);return`Close #${e.ticket} ${e.type} ${L.toFixed(2)} ${e.displaySymbol} ${Ms(e.openPrice,e.digits)} at ${Ms(N,e.digits)} with Profit ${O}`},[N,e,L]),U=async()=>{v(!0);try{const O=await n(e);if(!O.success){Ce({variant:"destructive",description:O.message||"Failed to close position."});return}s(e.ticket),t(),Ce({description:`Position #${e.ticket} closed.`})}catch(O){const B=O instanceof Error?O.message:"Failed to close position.";Ce({variant:"destructive",description:B})}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," ",L.toFixed(2)," ",e.displaySymbol," ",Ms(e.openPrice,e.digits)]}),c.jsx("button",{type:"button","aria-label":"Close position panel",className:"web-trading-widget-icon-btn",onClick:t,children:c.jsx(gn,{className:"web-trading-widget-icon web-trading-widget-icon--md"})})]}),c.jsxs("div",{className:"web-trading-widget-detail-panel__body",children:[c.jsx(De,{label:"Lots",value:o,onChange:a,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:"Price"}),c.jsx(Rn,{readOnly:!0,disabled:!0,value:Ms(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(De,{label:"Stop Loss",value:l,onChange:f,step:x,decimals:e.digits,basePrice:E,placeholder:R,clearable:!0}),c.jsx(De,{label:"Take Profit",value:d,onChange:u,step:x,decimals:e.digits,basePrice:A,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:"Comment"}),c.jsx(Rn,{value:g,onChange:O=>m(O.target.value)})]}),c.jsx(ct,{type:"button",variant:"secondary",className:"web-trading-widget-detail-panel__btn-full",disabled:H||!D,onClick:()=>void F(),children:"Modify"}),c.jsx(ct,{type:"button",className:"web-trading-widget-detail-panel__action-btn",disabled:H,onClick:()=>void U(),children:I})]})]})}function Od({symbolTicker:e,orderState:t}){const n=_c(e),{confirmation:r,isSubmitting:s,defaultVolumeLots:i,volumeStep:o,minVolumeLots:a,selectedLogin:l,isAccountsLoading:d,hasConfirmedAccount:f,dismissConfirmation:u,placeMarketOrder:y}=t,p=pe(E=>E.positions),g=pe(E=>E.orders),m=pe(E=>E.selectedPositionTicket),h=pe(E=>E.selectedOrderTicket),v=pe(E=>E.setSelectedPositionTicket),b=pe(E=>E.setSelectedOrderTicket),_=m!==null?p.find(E=>E.ticket===m)??null:null,x=h!==null?g.find(E=>E.ticket===h)??null:null,P=r!==null,C=S.useCallback(E=>{y({symbolTicker:e,login:E.login,executionMode:E.executionMode,side:E.side,orderType:E.orderType,volumeLots:E.volumeLots,stopLoss:E.stopLoss,takeProfit:E.takeProfit,priceOrder:E.priceOrder,priceTrigger:E.priceTrigger,comment:E.comment,typeTime:E.typeTime,expirationDateTime:E.expirationDateTime,expirationDay:E.expirationDay,bid:E.bid,ask:E.ask})},[y,e]);return _!==null?c.jsx(jp,{position:_,onClose:()=>v(null)}):x!==null?c.jsx(Dp,{order:x,onClose:()=>b(null)}):P&&r!==null?c.jsx(Lp,{confirmation:r,symbolTicker:e,onDismiss:u}):f?c.jsx(kC,{embedded:!0,symbolTicker:e,bid:(n==null?void 0:n.bid)??null,ask:(n==null?void 0:n.ask)??null,defaultVolumeLots:i,volumeStep:o,minVolumeLots:a,isSubmitting:s,isAccountsLoading:d,selectedLogin:l,onPlaceOrder:C}):c.jsx("div",{className:"web-trading-widget-side-panel__empty",children:"Select a trading account to start placing orders."})}function Nd({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 OC({symbolTicker:e,orderState:t,scanResultUrl:n,onScanResultLoad:r,initialTab:s="trade",activeTab:i,onTabChange:o}){const a=!!n,[l,d]=S.useState(s),f=i!==void 0,u=f?i:l,y=S.useCallback(p=>{f?o==null||o(p):d(p)},[f,o]);return c.jsx("aside",{className:`web-trading-widget-side-panel${a?" web-trading-widget-side-panel--with-scan":""}`,children:a?c.jsxs("div",{className:"web-trading-widget-side-panel__scan-layout",children:[c.jsxs("div",{role:"tablist","aria-label":"Chart side panel",className:"web-trading-widget-side-panel__tablist",children:[c.jsx(Nd,{label:"Trade",isActive:u==="trade",onClick:()=>y("trade")}),c.jsx(Nd,{label:"Scan Result",isActive:u==="scan",onClick:()=>y("scan")})]}),c.jsxs("div",{className:"web-trading-widget-side-panel__panels",children:[c.jsx("div",{role:"tabpanel",hidden:u!=="trade",className:"web-trading-widget-side-panel__tabpanel",children:c.jsx(Od,{symbolTicker:e,orderState:t})}),c.jsx("div",{role:"tabpanel",hidden:u!=="scan",className:"web-trading-widget-side-panel__tabpanel web-trading-widget-side-panel__tabpanel--scan",children:c.jsx("iframe",{src:n??void 0,title:"Scan result",className:"web-trading-widget-side-panel__iframe",onLoad:r},n)})]})]}):c.jsx("div",{className:"web-trading-widget-side-panel__scroll",children:c.jsx(Od,{symbolTicker:e,orderState:t})})})}const NC=.01,RC=.01,Rd=.01;function LC({symbols:e,defaultPanelAfterConfirm:t="mini"}){const[n,r]=S.useState("closed"),[s,i]=S.useState(null),[o,a]=S.useState(!1),[l,d]=S.useState("pending"),[f,u]=S.useState(null),y=pe(N=>N.setSelectedLogin),{accounts:p,isLoading:g}=ap(),{submitOrder:m}=qi(),h=S.useMemo(()=>Qv(p),[p]),v=S.useMemo(()=>Jv(p,f),[p,f]),b=l==="confirmed",_=l==="needs-selection";S.useEffect(()=>{if(g)return;if(l==="confirmed"){f&&!h.some(L=>L.login===f)&&d("needs-selection");return}if(l==="needs-selection")return;const N=Xv();if(N&&h.some(L=>L.login===N)){u(N),d("confirmed"),r(t);return}d("needs-selection")},[l,h,t,g,f]),S.useEffect(()=>{v&&y(v)},[v,y]);const x=S.useCallback(N=>{u(N),y(N),Sl(N)},[y]),P=S.useCallback(N=>{N&&(Sl(N),x(N),d("confirmed"),i(null),r(t))},[t,x]),C=S.useCallback(()=>{i(null),r("market")},[]),E=S.useCallback(()=>{i(null),r("mini")},[]),A=S.useCallback(()=>{i(null),r("mini")},[]),R=S.useCallback(()=>{i(null),r("mini")},[]),M=S.useCallback(async N=>{const L=se.getState().clearEntryLinePreview,H=N.login.trim();if(!H){L(),Ce({variant:"destructive",description:"Please select a trading account."});return}const D=Math.max(Rd,N.volumeLots),F=Ui(N.symbolTicker,e);Number(Vt(Ht(N.symbolTicker,e)));const I=Fi(N.executionMode),U=cc(N.orderType),O=Ue(N.priceOrder),B=Ue(N.priceTrigger);if(!I&&O===void 0){L(),Ce({variant:"destructive",description:U?"Please set a limit price for this order.":"Please set an order price for pending orders."});return}if(U&&B===void 0){L(),Ce({variant:"destructive",description:"Please set a stop price for stop limit orders."});return}if(!I&&!Bi(N.typeTime,N.expirationDateTime,N.expirationDay)){L(),Ce({variant:"destructive",description:"Please set an expiration date for this order."});return}const W=I?N.side==="buy"?N.ask:N.bid:O??(N.side==="buy"?N.ask:N.bid);a(!0);try{const j=await m({login:H,symbolTicker:N.symbolTicker,executionMode:N.executionMode,side:ci(N.orderType),orderType:N.orderType,volumeLots:D,stopLoss:Ue(N.stopLoss),takeProfit:Ue(N.takeProfit),priceOrder:ac(N.orderType)?O:void 0,priceTrigger:U?B:void 0,comment:N.comment.trim(),typeTime:N.typeTime,expirationDateTime:N.expirationDateTime,expirationDay:N.expirationDay,bid:N.bid,ask:N.ask});if(!j.success){L(),Ce({variant:"destructive",description:j.message||"Order was not accepted."});return}i({ticket:j.ticket??"",side:j.side??ci(N.orderType),volumeLots:j.volumeLots??D,symbol:j.displaySymbol??F,price:j.price??W}),r("confirmation")}catch(j){L();const ee=j instanceof Error?j.message:"Failed to place order.";Ce({variant:"destructive",description:ee})}finally{a(!1)}},[m,e]);return{panel:n,confirmation:s,isSubmitting:o,defaultVolumeLots:NC,volumeStep:RC,minVolumeLots:Rd,accountOptions:h,selectedLogin:v,setSelectedLogin:x,isAccountsLoading:g,hasConfirmedAccount:b,needsAccountSelection:_,confirmAccountSelection:P,openMarketPanel:C,openMiniPanel:E,closePanels:A,dismissConfirmation:R,placeMarketOrder:M}}function gi(e){var t;if(typeof window<"u"){const n=localStorage.getItem(Qn);if(n&&e.some(r=>r.ticker===n))return n}return((t=e[0])==null?void 0:t.ticker)??"XAU_USD"}function ma(e,t,n){var r;return((r=t.find(s=>s.display_name===e||s.ticker===e))==null?void 0:r.ticker)??n}function DC({chartWidget:e,symbols:t,chartSlotElement:n,onSymbolTickerChange:r,onScanResultUrlChange:s,selectSymbolTickerRef:i}){const o=S.useMemo(()=>gi(t),[t]),a=S.useRef(o),l=S.useRef(e),[d,f]=S.useState(null);S.useEffect(()=>{l.current=e},[e]),S.useEffect(()=>{if(!n){f(null);return}const y=()=>{const g=n.querySelector(":scope > div");f(g)};y();const p=new MutationObserver(y);return p.observe(n,{childList:!0}),()=>{p.disconnect()}},[n]);const u=S.useCallback(y=>{if(y===a.current)return;const p=t.find(m=>m.ticker===y);if(!p)return;a.current=y,localStorage.setItem(Qn,y),r(y),s(null);const g=l.current;if(g)try{g.onChartReady(()=>{g.activeChart().setSymbol(p.ticker)})}catch{}},[s,r,t]);return S.useEffect(()=>(i.current=u,()=>{i.current=null}),[u,i]),S.useEffect(()=>{if(!e)return;let y=!1,p=null;try{e.onChartReady(()=>{if(y)return;let g;try{g=e.activeChart()}catch{return}const m=b=>{const _=g.symbol(),x=ma(_,t,o);x!==a.current&&s(null);try{e.resetCache()}catch{}a.current=x,localStorage.setItem(Qn,x),r(x)},h=g.symbol(),v=ma(h,t,o);v!==a.current&&(a.current=v,localStorage.setItem(Qn,v),r(v)),g.onSymbolChanged().subscribe(null,m),p=()=>{try{g.onSymbolChanged().unsubscribe(null,m)}catch{}}})}catch{}return()=>{y=!0,p==null||p()}},[e,s,r,o,t]),{chartContainer:d}}const jC=Pa("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 IC({className:e,variant:t,...n}){return c.jsx("div",{className:Ee(jC({variant:t}),e),...n})}function Ip(){var t;const e=(t=window.TradingView)==null?void 0:t.widget;return typeof e=="function"?e:null}function Ys(){return Ip()!==null}const Ld="/charting_library/charting_library.js";function MC({onLoad:e}){return S.useEffect(()=>{if(Ys()){e();return}const t=document.querySelector(`script[src="${Ld}"]`);if(t){const r=()=>{Ys()&&e()};return t.addEventListener("load",r),()=>t.removeEventListener("load",r)}const n=document.createElement("script");return n.src=Ld,n.async=!1,n.onload=()=>{Ys()&&e()},n.onerror=()=>{console.error("Failed to load TradingView charting library")},document.head.appendChild(n),()=>{n.onload=null,n.onerror=null}},[e]),null}const Dd=$i(e=>({playEndTimestamp:null,setPlayEndTimestamp:t=>e({playEndTimestamp:t})})),Mp=$i(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})})),pa=8,Fp=4,ha=5,ga=e=>e==="1"?60:e==="5"?300:e==="1D"?1440*3600:parseInt(e,10)*60,FC=e=>{const t=new Date(e+pa*60*60*1e3),n=t.getUTCDay(),r=t.getUTCHours();return n===0?!1:n===1?r>=ha:n===6?r<=Fp:!0},UC=e=>{const t=new Date(e+pa*60*60*1e3),n=t.getUTCDay(),r=t.getUTCHours();if(n===0||n===1&&r<ha||n===6&&r>=Fp){const s=(8-n)%7;return t.setUTCDate(t.getUTCDate()+s),t.setUTCHours(ha,0,0,0),t.getTime()-pa*60*60*1e3}return e},BC=(e,t,n)=>{const r=ga(t)*1e3,s=[];let i=e;for(let o=0;o<n;o++)i+=r,FC(i)||(i=UC(i)),s.push(i);return s},$C=(e,t,n,r)=>{if(n<=0)return[];if(r==="24x7"){const i=ga(t)*1e3;return Array.from({length:n},(o,a)=>e+(a+1)*i)}if(r==="1700-1700")return BC(e,t,n);const s=ga(t)*1e3;return Array.from({length:n},(i,o)=>e+(o+1)*s)},VC=(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},jd="wss://symbols.opheleo.com";function HC(e){return{1:6e4,5:3e5,15:9e5,30:18e5,60:36e5,240:144e5}[e]??6e4}function Id(e){return e.trim().toUpperCase()}function zC(e,t){return Math.floor(e/t)*t}let Ir;async function WC(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 KC{constructor(t,n,r=Bt,s=jd){it(this,"futureBarsRef");it(this,"type");it(this,"symbols");it(this,"tickWebSocketUrl");it(this,"configuration",{supported_resolutions:["1","5","15","30","60"],supports_marks:!1,supports_timescale_marks:!0,supports_time:!1});it(this,"ws",null);it(this,"isWsConnecting",!1);it(this,"wsSelectedSymbol",null);it(this,"subscriptions",new Map);it(this,"lastBarsCache",new Map);it(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=s||jd}onReady(t){setTimeout(()=>t(this.configuration),0)}resolveSymbol(t,n,r){const s=this.symbols.find(o=>o.ticker===t),i=this.symbols.find(o=>o.display_name===t);try{setTimeout(()=>{const o={name:(s==null?void 0:s.display_name)||(i==null?void 0:i.display_name)||localStorage.getItem("tv:latest-symbol")||"XAU_USD",timezone:"America/New_York",minmov:1,session:(s==null?void 0:s.session)||(i==null?void 0:i.session)||"24x7",has_intraday:!0,visible_plots_set:"ohlc",library_custom_fields:{ticker:(s==null?void 0:s.ticker)||(i==null?void 0:i.ticker)||localStorage.getItem("tv:latest-symbol")||"XAU_USD"},description:(s==null?void 0:s.description)||(i==null?void 0:i.description)||"",type:(s==null?void 0:s.type)||(i==null?void 0:i.type)||"",pricescale:(s==null?void 0:s.pricescale)||(i==null?void 0:i.pricescale)||1e5,ticker:(s==null?void 0:s.display_name)||(i==null?void 0:i.display_name)||localStorage.getItem("tv:latest-symbol")||"XAU_USD",exchange:"FX",format:"price",listed_exchange:"FX",logo_urls:(s==null?void 0:s.logo_urls.map(a=>a.replace("https://cdn.iccandle.ai/web-assets","/images/symbols")))||(i==null?void 0:i.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,s,i){var u;const o=(u=t.library_custom_fields)==null?void 0:u.ticker,a=this.symbols.find(y=>o!==void 0&&y.ticker===o||y.ticker===t.ticker||y.display_name===t.name||y.display_name===t.ticker),l={symbol:(a==null?void 0:a.ticker)||"",timeframe:n};if(r.firstDataRequest&&(Ir=void 0),!r.firstDataRequest)if(Ir)l.last_evaluated_key=Ir;else{s([],{noData:!0});return}const f=Dd.getState().playEndTimestamp;f&&(l.endTimestamp=f,Dd.getState().setPlayEndTimestamp(null),Ir=void 0),(async()=>{var y;try{const{data:p}=await WC(l);if(p.data_status==="threshold_limited"){s([],{noData:!0});return}if(p.data_status==="end_of_data"){s([],{noData:!0});return}if(!((y=p.items)!=null&&y.length)){s([],{noData:!0});return}Ir=p.last_evaluated_key;const m=[...p.items].map(_=>({open:_.o,high:_.h,low:_.l,close:_.c,time:VC(_.timestamp,n)})),h=Mp.getState(),{gapCount:v,isReplayMode:b}=h;if(b&&event){const _=$C(m[m.length-1].time,n,v||0,t.session);if(_.length>0){const x=m[m.length-1].close;for(const P of _)m.push({open:x,high:x,low:x,close:x,time:P})}}s(m)}catch(p){i(p),s([],{noData:!0})}})()}searchSymbols(t,n,r,s){if(r==="all"||r===""){const i=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"))}));s(i)}else{const i=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"))}));s(i)}}subscribeBars(t,n,r,s,i){var u;const o=(u=t.library_custom_fields)==null?void 0:u.ticker,a=this.symbols.find(y=>o!==void 0&&y.ticker===o||y.display_name===t.ticker||y.display_name===t.name),l=a!=null&&a.resolve_symbol?Id(a.resolve_symbol):Id(t.ticker||t.name||""),d=HC(n),f=`${l}|${n}`;this.subscriptions.set(s,{symbol:l,resolution:n,periodMs:d,onTick:r,onResetCacheNeededCallback:i,liveCandle:this.lastBarsCache.get(f)??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 s;const n=t??((s=this.subscriptions.values().next().value)==null?void 0:s.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=i=>this.handleMessage(i),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),s=(Number(t.bid)+Number(t.ask))/2;if(!(!Number.isFinite(r)||!Number.isFinite(s)))for(const[i,o]of this.subscriptions.entries()){if(o.symbol!==n)continue;const a=`${o.symbol}|${o.resolution}`,l=zC(r,o.periodMs);let d=o.liveCandle;d?l>d.time?d={time:l,open:s,high:s,low:s,close:s,volume:0}:d={...d,high:Math.max(d.high,s),low:Math.min(d.low,s),close:s}:d={time:l,open:s,high:s,low:s,close:s,volume:0},o.liveCandle=d,this.lastBarsCache.set(a,d),this.subscriptions.set(i,o),(u=>{var y,p;(p=(y=this.futureBarsRef)==null?void 0:y.current)!=null&&p.length||o.onTick(u)})(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,s){const i=[];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:f})=>{!a||!Number.isFinite(l)||l<=0||i.some(u=>String(u.id)===String(a))||i.push({id:a,time:l/1e3,color:"green",label:d.slice(0,1)||"N",tooltip:[d],...f?{imageUrl:`/images/symbols/${f}.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:f,forecast:u,previous:y,actual:p}=o;if(!a||!Number.isFinite(l)||l<=0||i.some(m=>String(m.id)==="news:"+a))return;i.push({id:"news:"+a,time:l/1e3,color:"green",label:d.slice(0,1),tooltip:[d,`Current Forecast: ${u||"-"}`,`Previous Forecast: ${y||"-"}`,`Previous Actual: ${p||"-"}`],...f?{imageUrl:`https://cdn.iccandle.ai/web-assets/${f??"USD"}.svg`}:{}})}catch{}s(i)}}const qC=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,s=e.current,i=n.symbol.open,o=n.symbol.high,a=n.symbol.low,l=n.symbol.close;if(!Number.isFinite(r)||!s||s.length===0)return[i,o,a,l,Number.NaN,Number.NaN,Number.NaN];if(!s.some(y=>y.time===r))return[i,o,a,l,Number.NaN,Number.NaN,Number.NaN];const u=l<i?1:0;return[i,o,a,l,u,u,u]}}};return Promise.resolve([t])},ya="An unknown error occurred",Qs=e=>{if(typeof e=="string")return e;if(typeof e!="object"||e===null)return ya;if(typeof e.message=="string")return e.message;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const n=Qs(e[t]);if(n)return n}return ya},GC=e=>{var t;if(Lm(e)){const n=(t=e.response)!=null&&t.data?Qs(e.response.data):void 0;return n&&n!==ya?n:Qs(e)}return Qs(e)},ZC=({queryKey:e,queryFn:t,...n})=>Or({queryKey:e,queryFn:async r=>{var s;try{const i=r.queryKey[1];return await t(i)}catch(i){throw Ce({variant:"destructive",title:"Error",description:GC(Lm(i)?(s=i.response)==null?void 0:s.data:i)}),null}},...n});var xe;(function(e){e.assertEqual=s=>{};function t(s){}e.assertIs=t;function n(s){throw new Error}e.assertNever=n,e.arrayToEnum=s=>{const i={};for(const o of s)i[o]=o;return i},e.getValidEnumValues=s=>{const i=e.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),o={};for(const a of i)o[a]=s[a];return e.objectValues(o)},e.objectValues=s=>e.objectKeys(s).map(function(i){return s[i]}),e.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const i=[];for(const o in s)Object.prototype.hasOwnProperty.call(s,o)&&i.push(o);return i},e.find=(s,i)=>{for(const o of s)if(i(o))return o},e.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,i=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}e.joinValues=r,e.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(xe||(xe={}));var Md;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(Md||(Md={}));const Y=xe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Yt=e=>{switch(typeof e){case"undefined":return Y.undefined;case"string":return Y.string;case"number":return Number.isNaN(e)?Y.nan:Y.number;case"boolean":return Y.boolean;case"function":return Y.function;case"bigint":return Y.bigint;case"symbol":return Y.symbol;case"object":return Array.isArray(e)?Y.array:e===null?Y.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Y.promise:typeof Map<"u"&&e instanceof Map?Y.map:typeof Set<"u"&&e instanceof Set?Y.set:typeof Date<"u"&&e instanceof Date?Y.date:Y.object;default:return Y.unknown}},z=xe.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 Ut 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(i){return i.message},r={_errors:[]},s=i=>{for(const o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(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 s(this),r}static assert(t){if(!(t instanceof Ut))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,xe.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const s of this.issues)if(s.path.length>0){const i=s.path[0];n[i]=n[i]||[],n[i].push(t(s))}else r.push(t(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Ut.create=e=>new Ut(e);const ba=(e,t)=>{let n;switch(e.code){case z.invalid_type:e.received===Y.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case z.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,xe.jsonStringifyReplacer)}`;break;case z.unrecognized_keys:n=`Unrecognized key(s) in object: ${xe.joinValues(e.keys,", ")}`;break;case z.invalid_union:n="Invalid input";break;case z.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${xe.joinValues(e.options)}`;break;case z.invalid_enum_value:n=`Invalid enum value. Expected ${xe.joinValues(e.options)}, received '${e.received}'`;break;case z.invalid_arguments:n="Invalid function arguments";break;case z.invalid_return_type:n="Invalid function return type";break;case z.invalid_date:n="Invalid date";break;case z.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}"`:xe.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case z.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 z.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 z.custom:n="Invalid input";break;case z.invalid_intersection_types:n="Intersection results could not be merged";break;case z.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case z.not_finite:n="Number must be finite";break;default:n=t.defaultError,xe.assertNever(e)}return{message:n}};let YC=ba;function QC(){return YC}const XC=e=>{const{data:t,path:n,errorMaps:r,issueData:s}=e,i=[...n,...s.path||[]],o={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.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{...s,path:i,message:a}};function G(e,t){const n=QC(),r=XC({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===ba?void 0:ba].filter(s=>!!s)});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 s of n){if(s.status==="aborted")return ae;s.status==="dirty"&&t.dirty(),r.push(s.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const s of n){const i=await s.key,o=await s.value;r.push({key:i,value:o})}return st.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const s of n){const{key:i,value:o}=s;if(i.status==="aborted"||o.status==="aborted")return ae;i.status==="dirty"&&t.dirty(),o.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(r[i.value]=o.value)}return{status:t.value,value:r}}}const ae=Object.freeze({status:"aborted"}),Hr=e=>({status:"dirty",value:e}),ut=e=>({status:"valid",value:e}),Fd=e=>e.status==="aborted",Ud=e=>e.status==="dirty",vr=e=>e.status==="valid",yi=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 fn{constructor(t,n,r,s){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=s}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 Bd=(e,t)=>{if(vr(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 Ut(e.common.issues);return this._error=n,this._error}}};function fe(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:s}=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:s}:{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:s}}class _e{get description(){return this._def.description}_getType(t){return Yt(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Yt(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:Yt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(yi(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:Yt(t)},s=this._parseSync({data:t,path:r.path,parent:r});return Bd(r,s)}"~validate"(t){var r,s;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Yt(t)};if(!this["~standard"].async)try{const i=this._parseSync({data:t,path:[],parent:n});return vr(i)?{value:i.value}:{issues:n.common.issues}}catch(i){(s=(r=i==null?void 0:i.message)==null?void 0:r.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(i=>vr(i)?{value:i.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:Yt(t)},s=this._parse({data:t,path:r.path,parent:r}),i=await(yi(s)?s:Promise.resolve(s));return Bd(r,i)}refine(t,n){const r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,i)=>{const o=t(s),a=()=>i.addIssue({code:z.custom,...r(s)});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,s)=>t(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(t){return new xr({schema:this,typeName:ce.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 cn.create(this,this._def)}nullable(){return Sr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Nt.create(this)}promise(){return _i.create(this,this._def)}or(t){return vi.create([this,t],this._def)}and(t){return wi.create(this,t,this._def)}transform(t){return new xr({...fe(this._def),schema:this,typeName:ce.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new _a({...fe(this._def),innerType:this,defaultValue:n,typeName:ce.ZodDefault})}brand(){return new _T({typeName:ce.ZodBranded,type:this,...fe(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new xa({...fe(this._def),innerType:this,catchValue:n,typeName:ce.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Ic.create(this,t)}readonly(){return Sa.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const JC=/^c[^\s-]{8,}$/i,eT=/^[0-9a-z]+$/,tT=/^[0-9A-HJKMNP-TV-Z]{26}$/i,nT=/^[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,rT=/^[a-z0-9_-]{21}$/i,sT=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,iT=/^[-+]?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)?)??$/,oT=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,aT="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Po;const cT=/^(?:(?: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])$/,lT=/^(?:(?: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])$/,dT=/^(([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]))$/,uT=/^(([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])$/,fT=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,mT=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Up="((\\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])))",pT=new RegExp(`^${Up}$`);function Bp(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 hT(e){return new RegExp(`^${Bp(e)}$`)}function gT(e){let t=`${Up}T${Bp(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 yT(e,t){return!!((t==="v4"||!t)&&cT.test(e)||(t==="v6"||!t)&&dT.test(e))}function bT(e,t){if(!sT.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,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||"typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||t&&s.alg!==t)}catch{return!1}}function vT(e,t){return!!((t==="v4"||!t)&&lT.test(e)||(t==="v6"||!t)&&uT.test(e))}class sn extends _e{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Y.string){const i=this._getOrReturnCtx(t);return G(i,{code:z.invalid_type,expected:Y.string,received:i.parsedType}),ae}const r=new st;let s;for(const i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(s=this._getOrReturnCtx(t,s),G(s,{code:z.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")t.data.length>i.value&&(s=this._getOrReturnCtx(t,s),G(s,{code:z.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const o=t.data.length>i.value,a=t.data.length<i.value;(o||a)&&(s=this._getOrReturnCtx(t,s),o?G(s,{code:z.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&G(s,{code:z.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")oT.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"email",code:z.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")Po||(Po=new RegExp(aT,"u")),Po.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"emoji",code:z.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")nT.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"uuid",code:z.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")rT.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"nanoid",code:z.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")JC.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"cuid",code:z.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")eT.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"cuid2",code:z.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")tT.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"ulid",code:z.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{s=this._getOrReturnCtx(t,s),G(s,{validation:"url",code:z.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"regex",code:z.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(t,s),G(s,{code:z.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(s=this._getOrReturnCtx(t,s),G(s,{code:z.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(s=this._getOrReturnCtx(t,s),G(s,{code:z.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?gT(i).test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{code:z.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?pT.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{code:z.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?hT(i).test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{code:z.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?iT.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"duration",code:z.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?yT(t.data,i.version)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"ip",code:z.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?bT(t.data,i.alg)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"jwt",code:z.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?vT(t.data,i.version)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"cidr",code:z.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?fT.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"base64",code:z.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?mT.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"base64url",code:z.invalid_string,message:i.message}),r.dirty()):xe.assertNever(i);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(s=>t.test(s),{validation:n,code:z.invalid_string,...Q.errToObj(r)})}_addCheck(t){return new sn({...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 sn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new sn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new sn({...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}}sn.create=e=>new sn({checks:[],typeName:ce.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...fe(e)});function wT(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,s=n>r?n:r,i=Number.parseInt(e.toFixed(s).replace(".","")),o=Number.parseInt(t.toFixed(s).replace(".",""));return i%o/10**s}class wr extends _e{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)!==Y.number){const i=this._getOrReturnCtx(t);return G(i,{code:z.invalid_type,expected:Y.number,received:i.parsedType}),ae}let r;const s=new st;for(const i of this._def.checks)i.kind==="int"?xe.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),G(r,{code:z.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),G(r,{code:z.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),G(r,{code:z.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?wT(t.data,i.value)!==0&&(r=this._getOrReturnCtx(t,r),G(r,{code:z.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),G(r,{code:z.not_finite,message:i.message}),s.dirty()):xe.assertNever(i);return{status:s.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,s){return new wr({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Q.toString(s)}]})}_addCheck(t){return new wr({...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"&&xe.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)}}wr.create=e=>new wr({checks:[],typeName:ce.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...fe(e)});class Jr extends _e{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)!==Y.bigint)return this._getInvalidInput(t);let r;const s=new st;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),G(r,{code:z.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),G(r,{code:z.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),G(r,{code:z.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):xe.assertNever(i);return{status:s.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return G(n,{code:z.invalid_type,expected:Y.bigint,received:n.parsedType}),ae}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,s){return new Jr({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Q.toString(s)}]})}_addCheck(t){return new Jr({...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}}Jr.create=e=>new Jr({checks:[],typeName:ce.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...fe(e)});class va extends _e{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Y.boolean){const r=this._getOrReturnCtx(t);return G(r,{code:z.invalid_type,expected:Y.boolean,received:r.parsedType}),ae}return ut(t.data)}}va.create=e=>new va({typeName:ce.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...fe(e)});class bi extends _e{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Y.date){const i=this._getOrReturnCtx(t);return G(i,{code:z.invalid_type,expected:Y.date,received:i.parsedType}),ae}if(Number.isNaN(t.data.getTime())){const i=this._getOrReturnCtx(t);return G(i,{code:z.invalid_date}),ae}const r=new st;let s;for(const i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(s=this._getOrReturnCtx(t,s),G(s,{code:z.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(s=this._getOrReturnCtx(t,s),G(s,{code:z.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):xe.assertNever(i);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new bi({...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}}bi.create=e=>new bi({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:ce.ZodDate,...fe(e)});class $d extends _e{_parse(t){if(this._getType(t)!==Y.symbol){const r=this._getOrReturnCtx(t);return G(r,{code:z.invalid_type,expected:Y.symbol,received:r.parsedType}),ae}return ut(t.data)}}$d.create=e=>new $d({typeName:ce.ZodSymbol,...fe(e)});class Vd extends _e{_parse(t){if(this._getType(t)!==Y.undefined){const r=this._getOrReturnCtx(t);return G(r,{code:z.invalid_type,expected:Y.undefined,received:r.parsedType}),ae}return ut(t.data)}}Vd.create=e=>new Vd({typeName:ce.ZodUndefined,...fe(e)});class Hd extends _e{_parse(t){if(this._getType(t)!==Y.null){const r=this._getOrReturnCtx(t);return G(r,{code:z.invalid_type,expected:Y.null,received:r.parsedType}),ae}return ut(t.data)}}Hd.create=e=>new Hd({typeName:ce.ZodNull,...fe(e)});class zd extends _e{constructor(){super(...arguments),this._any=!0}_parse(t){return ut(t.data)}}zd.create=e=>new zd({typeName:ce.ZodAny,...fe(e)});class Wd extends _e{constructor(){super(...arguments),this._unknown=!0}_parse(t){return ut(t.data)}}Wd.create=e=>new Wd({typeName:ce.ZodUnknown,...fe(e)});class mn extends _e{_parse(t){const n=this._getOrReturnCtx(t);return G(n,{code:z.invalid_type,expected:Y.never,received:n.parsedType}),ae}}mn.create=e=>new mn({typeName:ce.ZodNever,...fe(e)});class Kd extends _e{_parse(t){if(this._getType(t)!==Y.undefined){const r=this._getOrReturnCtx(t);return G(r,{code:z.invalid_type,expected:Y.void,received:r.parsedType}),ae}return ut(t.data)}}Kd.create=e=>new Kd({typeName:ce.ZodVoid,...fe(e)});class Nt extends _e{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),s=this._def;if(n.parsedType!==Y.array)return G(n,{code:z.invalid_type,expected:Y.array,received:n.parsedType}),ae;if(s.exactLength!==null){const o=n.data.length>s.exactLength.value,a=n.data.length<s.exactLength.value;(o||a)&&(G(n,{code:o?z.too_big:z.too_small,minimum:a?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(G(n,{code:z.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(G(n,{code:z.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,a)=>s.type._parseAsync(new fn(n,o,n.path,a)))).then(o=>st.mergeArray(r,o));const i=[...n.data].map((o,a)=>s.type._parseSync(new fn(n,o,n.path,a)));return st.mergeArray(r,i)}get element(){return this._def.type}min(t,n){return new Nt({...this._def,minLength:{value:t,message:Q.toString(n)}})}max(t,n){return new Nt({...this._def,maxLength:{value:t,message:Q.toString(n)}})}length(t,n){return new Nt({...this._def,exactLength:{value:t,message:Q.toString(n)}})}nonempty(t){return this.min(1,t)}}Nt.create=(e,t)=>new Nt({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ce.ZodArray,...fe(t)});function Yn(e){if(e instanceof je){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=cn.create(Yn(r))}return new je({...e._def,shape:()=>t})}else return e instanceof Nt?new Nt({...e._def,type:Yn(e.element)}):e instanceof cn?cn.create(Yn(e.unwrap())):e instanceof Sr?Sr.create(Yn(e.unwrap())):e instanceof Fn?Fn.create(e.items.map(t=>Yn(t))):e}class je extends _e{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=xe.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==Y.object){const d=this._getOrReturnCtx(t);return G(d,{code:z.invalid_type,expected:Y.object,received:d.parsedType}),ae}const{status:r,ctx:s}=this._processInputParams(t),{shape:i,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof mn&&this._def.unknownKeys==="strip"))for(const d in s.data)o.includes(d)||a.push(d);const l=[];for(const d of o){const f=i[d],u=s.data[d];l.push({key:{status:"valid",value:d},value:f._parse(new fn(s,u,s.path,d)),alwaysSet:d in s.data})}if(this._def.catchall instanceof mn){const d=this._def.unknownKeys;if(d==="passthrough")for(const f of a)l.push({key:{status:"valid",value:f},value:{status:"valid",value:s.data[f]}});else if(d==="strict")a.length>0&&(G(s,{code:z.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 f of a){const u=s.data[f];l.push({key:{status:"valid",value:f},value:d._parse(new fn(s,u,s.path,f)),alwaysSet:f in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const d=[];for(const f of l){const u=await f.key,y=await f.value;d.push({key:u,value:y,alwaysSet:f.alwaysSet})}return d}).then(d=>st.mergeObjectSync(r,d)):st.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return Q.errToObj,new je({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var i,o;const s=((o=(i=this._def).errorMap)==null?void 0:o.call(i,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:Q.errToObj(t).message??s}:{message:s}}}:{}})}strip(){return new je({...this._def,unknownKeys:"strip"})}passthrough(){return new je({...this._def,unknownKeys:"passthrough"})}extend(t){return new je({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new je({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:ce.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new je({...this._def,catchall:t})}pick(t){const n={};for(const r of xe.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new je({...this._def,shape:()=>n})}omit(t){const n={};for(const r of xe.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new je({...this._def,shape:()=>n})}deepPartial(){return Yn(this)}partial(t){const n={};for(const r of xe.objectKeys(this.shape)){const s=this.shape[r];t&&!t[r]?n[r]=s:n[r]=s.optional()}return new je({...this._def,shape:()=>n})}required(t){const n={};for(const r of xe.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof cn;)i=i._def.innerType;n[r]=i}return new je({...this._def,shape:()=>n})}keyof(){return $p(xe.objectKeys(this.shape))}}je.create=(e,t)=>new je({shape:()=>e,unknownKeys:"strip",catchall:mn.create(),typeName:ce.ZodObject,...fe(t)});je.strictCreate=(e,t)=>new je({shape:()=>e,unknownKeys:"strict",catchall:mn.create(),typeName:ce.ZodObject,...fe(t)});je.lazycreate=(e,t)=>new je({shape:e,unknownKeys:"strip",catchall:mn.create(),typeName:ce.ZodObject,...fe(t)});class vi extends _e{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function s(i){for(const a of i)if(a.result.status==="valid")return a.result;for(const a of i)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(a=>new Ut(a.ctx.common.issues));return G(n,{code:z.invalid_union,unionErrors:o}),ae}if(n.common.async)return Promise.all(r.map(async i=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(s);{let i;const o=[];for(const l of r){const d={...n,common:{...n.common,issues:[]},parent:null},f=l._parseSync({data:n.data,path:n.path,parent:d});if(f.status==="valid")return f;f.status==="dirty"&&!i&&(i={result:f,ctx:d}),d.common.issues.length&&o.push(d.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const a=o.map(l=>new Ut(l));return G(n,{code:z.invalid_union,unionErrors:a}),ae}}get options(){return this._def.options}}vi.create=(e,t)=>new vi({options:e,typeName:ce.ZodUnion,...fe(t)});function wa(e,t){const n=Yt(e),r=Yt(t);if(e===t)return{valid:!0,data:e};if(n===Y.object&&r===Y.object){const s=xe.objectKeys(t),i=xe.objectKeys(e).filter(a=>s.indexOf(a)!==-1),o={...e,...t};for(const a of i){const l=wa(e[a],t[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}else if(n===Y.array&&r===Y.array){if(e.length!==t.length)return{valid:!1};const s=[];for(let i=0;i<e.length;i++){const o=e[i],a=t[i],l=wa(o,a);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return n===Y.date&&r===Y.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class wi extends _e{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),s=(i,o)=>{if(Fd(i)||Fd(o))return ae;const a=wa(i.value,o.value);return a.valid?((Ud(i)||Ud(o))&&n.dirty(),{status:n.value,value:a.data}):(G(r,{code:z.invalid_intersection_types}),ae)};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(([i,o])=>s(i,o)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}wi.create=(e,t,n)=>new wi({left:e,right:t,typeName:ce.ZodIntersection,...fe(n)});class Fn extends _e{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Y.array)return G(r,{code:z.invalid_type,expected:Y.array,received:r.parsedType}),ae;if(r.data.length<this._def.items.length)return G(r,{code:z.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ae;!this._def.rest&&r.data.length>this._def.items.length&&(G(r,{code:z.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...r.data].map((o,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new fn(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(i).then(o=>st.mergeArray(n,o)):st.mergeArray(n,i)}get items(){return this._def.items}rest(t){return new Fn({...this._def,rest:t})}}Fn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Fn({items:e,typeName:ce.ZodTuple,rest:null,...fe(t)})};class qd extends _e{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!==Y.map)return G(r,{code:z.invalid_type,expected:Y.map,received:r.parsedType}),ae;const s=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([a,l],d)=>({key:s._parse(new fn(r,a,r.path,[d,"key"])),value:i._parse(new fn(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,f=await l.value;if(d.status==="aborted"||f.status==="aborted")return ae;(d.status==="dirty"||f.status==="dirty")&&n.dirty(),a.set(d.value,f.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of o){const d=l.key,f=l.value;if(d.status==="aborted"||f.status==="aborted")return ae;(d.status==="dirty"||f.status==="dirty")&&n.dirty(),a.set(d.value,f.value)}return{status:n.value,value:a}}}}qd.create=(e,t,n)=>new qd({valueType:t,keyType:e,typeName:ce.ZodMap,...fe(n)});class es extends _e{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Y.set)return G(r,{code:z.invalid_type,expected:Y.set,received:r.parsedType}),ae;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(G(r,{code:z.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(G(r,{code:z.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());const i=this._def.valueType;function o(l){const d=new Set;for(const f of l){if(f.status==="aborted")return ae;f.status==="dirty"&&n.dirty(),d.add(f.value)}return{status:n.value,value:d}}const a=[...r.data.values()].map((l,d)=>i._parse(new fn(r,l,r.path,d)));return r.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(t,n){return new es({...this._def,minSize:{value:t,message:Q.toString(n)}})}max(t,n){return new es({...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)}}es.create=(e,t)=>new es({valueType:e,minSize:null,maxSize:null,typeName:ce.ZodSet,...fe(t)});class Gd extends _e{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})}}Gd.create=(e,t)=>new Gd({getter:e,typeName:ce.ZodLazy,...fe(t)});class Zd extends _e{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return G(n,{received:n.data,code:z.invalid_literal,expected:this._def.value}),ae}return{status:"valid",value:t.data}}get value(){return this._def.value}}Zd.create=(e,t)=>new Zd({value:e,typeName:ce.ZodLiteral,...fe(t)});function $p(e,t){return new _r({values:e,typeName:ce.ZodEnum,...fe(t)})}class _r extends _e{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return G(n,{expected:xe.joinValues(r),received:n.parsedType,code:z.invalid_type}),ae}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 G(n,{received:n.data,code:z.invalid_enum_value,options:r}),ae}return ut(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 _r.create(t,{...this._def,...n})}exclude(t,n=this._def){return _r.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}_r.create=$p;class Yd extends _e{_parse(t){const n=xe.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==Y.string&&r.parsedType!==Y.number){const s=xe.objectValues(n);return G(r,{expected:xe.joinValues(s),received:r.parsedType,code:z.invalid_type}),ae}if(this._cache||(this._cache=new Set(xe.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const s=xe.objectValues(n);return G(r,{received:r.data,code:z.invalid_enum_value,options:s}),ae}return ut(t.data)}get enum(){return this._def.values}}Yd.create=(e,t)=>new Yd({values:e,typeName:ce.ZodNativeEnum,...fe(t)});class _i extends _e{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Y.promise&&n.common.async===!1)return G(n,{code:z.invalid_type,expected:Y.promise,received:n.parsedType}),ae;const r=n.parsedType===Y.promise?n.data:Promise.resolve(n.data);return ut(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}_i.create=(e,t)=>new _i({type:e,typeName:ce.ZodPromise,...fe(t)});class xr extends _e{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ce.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),s=this._def.effect||null,i={addIssue:o=>{G(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){const o=s.transform(r.data,i);if(r.common.async)return Promise.resolve(o).then(async a=>{if(n.value==="aborted")return ae;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?ae:l.status==="dirty"||n.value==="dirty"?Hr(l.value):l});{if(n.value==="aborted")return ae;const a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?ae:a.status==="dirty"||n.value==="dirty"?Hr(a.value):a}}if(s.type==="refinement"){const o=a=>{const l=s.refinement(a,i);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"?ae:(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"?ae:(a.status==="dirty"&&n.dirty(),o(a.value).then(()=>({status:n.value,value:a.value}))))}if(s.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!vr(o))return ae;const a=s.transform(o.value,i);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=>vr(o)?Promise.resolve(s.transform(o.value,i)).then(a=>({status:n.value,value:a})):ae);xe.assertNever(s)}}xr.create=(e,t,n)=>new xr({schema:e,typeName:ce.ZodEffects,effect:t,...fe(n)});xr.createWithPreprocess=(e,t,n)=>new xr({schema:t,effect:{type:"preprocess",transform:e},typeName:ce.ZodEffects,...fe(n)});class cn extends _e{_parse(t){return this._getType(t)===Y.undefined?ut(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}cn.create=(e,t)=>new cn({innerType:e,typeName:ce.ZodOptional,...fe(t)});class Sr extends _e{_parse(t){return this._getType(t)===Y.null?ut(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Sr.create=(e,t)=>new Sr({innerType:e,typeName:ce.ZodNullable,...fe(t)});class _a extends _e{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===Y.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}_a.create=(e,t)=>new _a({innerType:e,typeName:ce.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...fe(t)});class xa extends _e{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return yi(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Ut(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Ut(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}xa.create=(e,t)=>new xa({innerType:e,typeName:ce.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...fe(t)});class Qd extends _e{_parse(t){if(this._getType(t)!==Y.nan){const r=this._getOrReturnCtx(t);return G(r,{code:z.invalid_type,expected:Y.nan,received:r.parsedType}),ae}return{status:"valid",value:t.data}}}Qd.create=e=>new Qd({typeName:ce.ZodNaN,...fe(e)});class _T extends _e{_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 Ic extends _e{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?ae:i.status==="dirty"?(n.dirty(),Hr(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?ae:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(t,n){return new Ic({in:t,out:n,typeName:ce.ZodPipeline})}}class Sa extends _e{_parse(t){const n=this._def.innerType._parse(t),r=s=>(vr(s)&&(s.value=Object.freeze(s.value)),s);return yi(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}}Sa.create=(e,t)=>new Sa({innerType:e,typeName:ce.ZodReadonly,...fe(t)});var ce;(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"})(ce||(ce={}));const ko=sn.create,Fs=wr.create,xT=va.create;mn.create;Nt.create;const ST=je.create;vi.create;wi.create;Fn.create;_r.create;_i.create;cn.create;Sr.create;const CT="https://api.opheleo.com",TT="Bearer ",ET="Authorization";ST({id:ko(),userId:ko(),createdAt:Fs(),updatedAt:Fs(),active:xT(),perDayUsage:Fs(),userEmail:ko().email(),maxPerDayUsage:Fs()});async function PT(e,t,n){const r=typeof window<"u"?localStorage.getItem("session_token"):null;return(await Re({baseURL:br(n??CT),url:e,method:t,headers:r?{[ET]:`${TT}${r}`}:void 0})).data}async function kT(e){return PT("/iccandle/v1/iccandle-user-usage/me","get",e)}const AT=e=>{const t=e==null?void 0:e.platformApiBase;return ZC({queryKey:["iccandle-user-usage",t],queryFn:()=>kT(t),...e})},OT=S.createContext(null);function NT(){const e=S.useContext(OT);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function RT({controlsRef:e,onSymbolTickerChange:t,onScanResultUrlChange:n,onChartWidgetChange:r,onChartContainerChange:s,selectSymbolTickerRef:i,headerSlot:o}){const{resolvedTheme:a}=NT(),l=dt(),d=ys(),f=S.useRef([]),u=S.useRef(null),y=S.useRef(a),p=S.useRef(null),g=S.useRef(null),m=S.useMemo(()=>gi(d),[d]),h=S.useRef(m),v=S.useRef("60"),{setGapCount:b,setReplayMode:_}=Mp();S.useEffect(()=>{b(0),_(!1)},[b,_]),S.useEffect(()=>{Ys()&&E(!0)},[]);const[x,P]=S.useState(null),[C,E]=S.useState(!1),[A,R]=S.useState(null),M=S.useCallback(O=>{if(O===h.current)return;const B=d.find(j=>j.ticker===O);if(!B)return;h.current=O,localStorage.setItem(Qn,O),t(O);const W=u.current;if(W)try{W.onChartReady(()=>{W.activeChart().setSymbol(B.ticker)})}catch{}},[t,d]);S.useEffect(()=>(i.current=M,()=>{i.current=null}),[M,i]);const N=S.useRef([]),L=S.useMemo(()=>new KC(N,"selector",d,l.tickWebSocketUrl),[l.tickWebSocketUrl,d]),{data:H,isLoading:D}=AT({enabled:!0,platformApiBase:l.platformApiBase}),F=!D&&H?H.perDayUsage>=H.maxPerDayUsage:!1;S.useEffect(()=>{s(x)},[x,s]),S.useEffect(()=>{r(A)},[A,r]),S.useEffect(()=>{if(!C||!x)return;if(u.current){R(null),r(null);try{u.current.remove()}catch{}u.current=null}const O=gi(d);h.current=O,v.current="60";const B=Ip();if(!B)return;const W=new B({container:x,library_path:"/charting_library/",datafeed:L,symbol:O,interval:"60",autosize:!0,theme:y.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:()=>qC(f),drawings_access:{type:"black",tools:[{name:"Date Range"}]},locale:"en",timezone:Ih(),overrides:{priceScaleSelectionStrategyName:"right","scalesProperties.showSeriesLastValue":!0}});let j=!1;return u.current=W,W.onChartReady(()=>{j||u.current!==W||R(W)}),()=>{if(j=!0,R(null),r(null),u.current){try{u.current.remove()}catch{}u.current=null}}},[x,L,r,C]),S.useEffect(()=>{if(!A)return;let O=!1;try{A.onChartReady(()=>{O||(async()=>{try{const B=A.activeChart(),W=await B.createStudy("Generated Candles - By iC Candle",!0,!0);if(O||(W&&B.bringToFront([W]),await A.headerReady(),O)||(await new Promise(X=>{setTimeout(()=>{if(!O)try{B.clearMarks(2)}catch{}X(!0)},150)}),O))return;localStorage.setItem("tv:selected-news-events","[]"),B.refreshMarks();const j=X=>{const de=B.symbol(),ue=ma(de,d,m);ue!==h.current&&(n(null),f.current=[]);try{A.resetCache()}catch{}h.current=ue,localStorage.setItem(Qn,ue),t(ue)},ee=X=>{X!==v.current&&(n(null),f.current=[]);try{A.resetCache()}catch{}v.current=X};p.current=j,g.current=ee,B.onSymbolChanged().subscribe(null,j),B.onIntervalChanged().subscribe(null,ee)}catch{}})()})}catch{}return()=>{O=!0,p.current=null,g.current=null}},[A,e,n,t,m,d]),S.useEffect(()=>{if(!A||!a)return;let O=!1;try{A.onChartReady(()=>{O||A.changeTheme(a).catch(()=>{})})}catch{}return()=>{O=!0}},[A,a]);const I=S.useCallback(()=>{E(!0)},[]),U=F?c.jsx("div",{className:"web-trading-widget-advanced__scan-limit-wrap",children:c.jsxs(IC,{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"}),H&&c.jsxs("span",{className:"web-trading-widget-advanced__scan-limit-badge-count",children:[H.perDayUsage," of ",H.maxPerDayUsage," scans used today"]})]})}):null;return c.jsxs(c.Fragment,{children:[o??U,c.jsx(MC,{onLoad:I}),c.jsx("div",{ref:P,className:"web-trading-widget-advanced__container"})]})}const Vp=S.createContext(null);function Xd({value:e,children:t}){return c.jsx(Vp.Provider,{value:e,children:t})}function LT(){const e=S.useContext(Vp);if(!e)throw new Error("useWidgetChartSlot must be used within WidgetChartSlotProvider");return e}function Us(e,t){return e.toFixed(t)}function DT({symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:s,minVolumeLots:i,isSubmitting:o,isAccountsLoading:a,selectedLogin:l,isDragging:d,isCollapsed:f,onToggleCollapsed:u,onDragHandlePointerDown:y,onPlaceOrder:p}){const[g,m]=S.useState(!0),h=f??g,v=()=>{u==null||u(),f===void 0&&m(I=>!I)},b=se(I=>I.setOrderSide),_=se(I=>I.setVolumeLots),x=se(I=>I.volumeLots),[P,C]=S.useState(String(x||r));S.useEffect(()=>{h||C(Us(x,2))},[h,x]);const E=Number(Vt(Ht(e))),A=t!==null?Se(t,E):"—",R=n!==null?Se(n,E):"—",N=!o&&!a&&l!==""&&(t!==null&&n!==null),L=I=>{const U=Number(P),O=Number.isFinite(U)&&U>0?U:r,B=Math.max(i,O+I*s),W=Us(B,2);C(W),_(B)},H=()=>{const I=Number(P);if(!Number.isFinite(I)||I<=0){C(Us(r,2)),_(r);return}const U=Math.max(i,I),O=Us(U,2);C(O),_(U)},D=I=>{t===null||n===null||b({side:I,entryPrice:I==="buy"?n:t})},F=I=>{if(t===null||n===null||!l)return;const U=Number(P),O=Math.max(i,Number.isFinite(U)&&U>0?U:r);b({side:I,entryPrice:I==="buy"?n:t}),p({login:l,side:I,volumeLots:O,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":"Move quick order panel",onPointerDown:y,className:`web-trading-widget-mini-order__drag-handle${d?" web-trading-widget-mini-order__drag-handle--grabbing":""}`,children:c.jsx(Zf,{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:()=>D("sell"),onClick:()=>F("sell"),children:[c.jsx("span",{className:"web-trading-widget-mini-order__price",children:A}),c.jsx("span",{className:"web-trading-widget-mini-order__label web-trading-widget-mini-order__label--sell",children:"SELL"})]}),c.jsxs("div",{className:"web-trading-widget-mini-order__volume",children:[c.jsx("button",{type:"button","aria-label":"Decrease volume",disabled:!N,className:"web-trading-widget-mini-order__volume-btn",onClick:()=>L(-1),children:c.jsx(oi,{className:"web-trading-widget-icon web-trading-widget-icon--xs",strokeWidth:2.5})}),c.jsx("input",{type:"text",inputMode:"decimal",value:P,disabled:!N,onChange:I=>C(I.target.value),onBlur:H,className:"web-trading-widget-mini-order__volume-input"}),c.jsx("button",{type:"button","aria-label":"Increase volume",disabled:!N,className:"web-trading-widget-mini-order__volume-btn",onClick:()=>L(1),children:c.jsx($o,{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:()=>D("buy"),onClick:()=>F("buy"),children:[c.jsx("span",{className:"web-trading-widget-mini-order__label web-trading-widget-mini-order__label--buy",children:"BUY"}),c.jsx("span",{className:"web-trading-widget-mini-order__price",children:R})]})]}),c.jsx("button",{type:"button","aria-label":h?"Expand quick order panel":"Collapse quick order panel","aria-expanded":!h,className:"web-trading-widget-mini-order__toggle",onClick:v,children:h?c.jsx(oi,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2.5}):c.jsx($o,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2.5})})]})})}function Mr({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(oi,{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 jT=new Set(["volume-setting","risk-management"]);function IT({symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:s,minVolumeLots:i,isSubmitting:o,isAccountsLoading:a,selectedLogin:l,isDragging:d,onDragHandlePointerDown:f,onLayoutChange:u,onClose:y,onPlaceOrder:p}){const[g,m]=S.useState(!0),[h,v]=S.useState("market"),b=se(te=>te.volumeLots),[_,x]=S.useState(String(b||r)),[P,C]=S.useState(""),[E,A]=S.useState(""),R=se(te=>te.stopLoss),M=se(te=>te.takeProfit),N=se(te=>te.setStopLoss),L=se(te=>te.setTakeProfit),H=se(te=>te.setVolumeLots),D=se(te=>te.setOrderSide),[F,I]=S.useState(""),[U,O]=S.useState(gt.GTC),[B,W]=S.useState(""),[j,ee]=S.useState(""),[X,de]=S.useState(()=>new Set(jT));S.useEffect(()=>{u()},[g,u]);const ue=Number(Vt(Ht(e))),V=Pr(ue),K=fc(t,n),ie=t!==null?Se(t,ue):"—",ge=n!==null?Se(n,ue):"—",le=Fi(h),oe=Qf(h),$=Mi(h),we=$.label,ke=!le&&$.orderType!==null&&$.orderType%2===1,Pe=S.useMemo(()=>K!==null?K:t??n,[n,t,K]),J=te=>{de(Je=>{const zt=new Set(Je);return zt.has(te)?zt.delete(te):zt.add(te),zt})},Ne=te=>{x(te);const Je=Number(te);Number.isFinite(Je)&&Je>0&&H(Je)},Be=te=>t===null||n===null?null:le?te==="buy"?n:t:Ue(P)??(te==="buy"?n:t),Xe=te=>{const Je=Be(te);Je!==null&&D({side:te,entryPrice:Je})},ft=te=>{if(t===null||n===null||!l)return;const Je=Math.max(i,Number(_)||i),zt=Vo(h,te),Nr=Be(te);Nr!==null&&D({side:te,entryPrice:Nr}),p({login:l,executionMode:h,side:te,orderType:zt,volumeLots:Je,stopLoss:R,takeProfit:M,priceOrder:P,priceTrigger:E,comment:F,typeTime:U,expirationDateTime:B,expirationDay:j,bid:t,ask:n})},re=t!==null&&n!==null,Ve=le||Ue(P)!==void 0,Ji=!oe||Ue(E)!==void 0,vs=le||Bi(U,B,j),bh=!o&&!a&&l!==""&&re&&Ve&&Ji&&vs,vh=!le&&lc(U),wh=!le&&dc(U),$c=()=>$.orderType!==null&&$.orderType%2===1?"sell":"buy";return c.jsxs("div",{className:`web-trading-widget-market-panel web-trading-widget-market-panel--modal${g?" web-trading-widget-market-panel--collapsed":""}`,children:[c.jsx(DT,{symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:s,minVolumeLots:i,isSubmitting:o,isAccountsLoading:a,selectedLogin:l,isDragging:d,isCollapsed:g,onToggleCollapsed:()=>m(te=>!te),onDragHandlePointerDown:f,onPlaceOrder:({login:te,side:Je,volumeLots:zt,bid:Nr,ask:Vc})=>{Nr===null||Vc===null||p({login:te,executionMode:"market",side:Je,orderType:Vo("market",Je),volumeLots:zt,stopLoss:R,takeProfit:M,priceOrder:"",priceTrigger:"",comment:F,typeTime:U,expirationDateTime:"",expirationDay:"",bid:Nr,ask:Vc})}}),g?null:c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"web-trading-widget-market-panel__header",children:c.jsxs(si,{value:h,onValueChange:te=>v(te),children:[c.jsx(Kr,{className:"web-trading-widget-market-panel__select-trigger","aria-label":"Order execution type",children:c.jsx(ii,{})}),c.jsx(qr,{children:ai.map(te=>c.jsx(Gr,{value:te.mode,children:te.label},te.mode))})]})}),c.jsxs("div",{className:"web-trading-widget-market-panel__accordion",children:[c.jsx(Mr,{id:"volume-setting",title:"Volume Setting",isOpen:X.has("volume-setting"),onToggle:()=>J("volume-setting"),children:c.jsx(De,{label:"Lots",value:_,onChange:Ne,step:s,min:i,decimals:2})}),le?null:c.jsx(Mr,{id:"order-price",title:"Order Price",isOpen:X.has("order-price"),onToggle:()=>J("order-price"),children:oe?c.jsxs(c.Fragment,{children:[c.jsx(De,{label:"Stop Price",value:E,onChange:A,step:V,decimals:ue,basePrice:Pe,placeholder:K!==null?Se(K,ue):"—"}),c.jsx(De,{label:"Limit Price",value:P,onChange:C,step:V,decimals:ue,basePrice:Pe,placeholder:K!==null?Se(K,ue):"—"})]}):c.jsx(De,{label:"Price",value:P,onChange:C,step:V,decimals:ue,basePrice:Pe,placeholder:K!==null?Se(K,ue):"—"})}),c.jsx(Mr,{id:"risk-management",title:"Risk Management",isOpen:X.has("risk-management"),onToggle:()=>J("risk-management"),children:c.jsxs("div",{className:"web-trading-widget-market-panel__grid-2",children:[c.jsx(De,{label:"Stop Loss",value:R,onChange:N,step:V,decimals:ue,basePrice:t,placeholder:t!==null?ie:"—",clearable:!0}),c.jsx(De,{label:"Take Profit",value:M,onChange:L,step:V,decimals:ue,basePrice:n,placeholder:n!==null?ge:"—",clearable:!0})]})}),le?null:c.jsxs(Mr,{id:"expiration",title:"Expiration",isOpen:X.has("expiration"),onToggle:()=>J("expiration"),children:[c.jsx("select",{value:String(U),className:"web-trading-widget-market-panel__select-full","aria-label":"Order expiration type",onChange:te=>O(Number(te.target.value)),children:Xf.map(te=>c.jsx("option",{value:String(te.value),children:te.label},te.value))}),vh?c.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[c.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Expiration time"}),c.jsx("input",{type:"datetime-local",value:B,className:"web-trading-widget-market-panel__input",onChange:te=>W(te.target.value)})]}):null,wh?c.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[c.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Expiration day"}),c.jsx("input",{type:"date",value:j,className:"web-trading-widget-market-panel__input",onChange:te=>ee(te.target.value)})]}):null]}),c.jsx(Mr,{id:"comment",title:"Comment",isOpen:X.has("comment"),onToggle:()=>J("comment"),children:c.jsx("input",{type:"text",value:F,className:"web-trading-widget-market-panel__input",placeholder:"",onChange:te=>I(te.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:ie}),c.jsx("span",{className:"web-trading-widget-market-panel__quotes-ask",children:ge})]})}),!le&&c.jsxs("button",{type:"button",className:`web-trading-widget-market-panel__place-btn${ke?" web-trading-widget-market-panel__place-btn--sell":" web-trading-widget-market-panel__place-btn--buy"}`,disabled:!bh,onMouseDown:()=>Xe($c()),onClick:()=>ft($c()),children:["Place ",we]})]})]})}function MT({symbolTicker:e,chartWidget:t,orderState:n}){const r=ys(),s=_c(e),{panel:i,confirmation:o,isSubmitting:a,defaultVolumeLots:l,volumeStep:d,minVolumeLots:f,selectedLogin:u,isAccountsLoading:y,hasConfirmedAccount:p,closePanels:g,dismissConfirmation:m,placeMarketOrder:h}=n,v=pe(j=>j.positions),b=pe(j=>j.orders),_=pe(j=>j.selectedPositionTicket),x=pe(j=>j.selectedOrderTicket),P=pe(j=>j.setSelectedPositionTicket),C=pe(j=>j.setSelectedOrderTicket),E=_!==null?v.find(j=>j.ticket===_)??null:null,A=x!==null?b.find(j=>j.ticket===x)??null:null,R=p&&i==="confirmation"&&o!==null,M=p&&i!=="confirmation"&&i!=="closed"&&E===null&&A===null,{panelRef:N,position:L,isDragging:H,onDragStart:D,reclamp:F}=sm({storageKey:"web-trading-widget-modal-exec-panel-position",defaultAlign:"top-right",isActive:M}),I=se(j=>j.setDraft),U=se(j=>j.clearDraft),O=Number(Vt(Ht(e))),B=Pr(O);S.useEffect(()=>{p&&I({source:"new-order",entryPrice:null,side:null,showEntryLine:!1,volumeLots:l,digits:O,priceStep:B})},[l,O,p,B,I]),S.useEffect(()=>{(i==="closed"||i==="confirmation")&&U()},[U,i]);const W=E!==null||A!==null;return!p&&!W?null:c.jsxs("div",{className:"web-trading-widget-new-order-overlay-layer",children:[c.jsx(Wm,{chartWidget:t,symbolTicker:e,symbols:r}),W&&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(jp,{position:E,onClose:()=>P(null)})}):null,W&&A!==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(Dp,{order:A,onClose:()=>C(null)})}):null,R&&o!==null?c.jsx("div",{className:"web-trading-widget-new-order-overlay web-trading-widget-new-order-overlay--news",children:c.jsx(Lp,{confirmation:o,symbolTicker:e,onDismiss:m})}):null,M?c.jsx("div",{ref:N,style:{left:L.x,top:L.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${H?" web-trading-widget-new-order-overlay--dragging":""}`,children:c.jsx(IT,{symbolTicker:e,bid:(s==null?void 0:s.bid)??null,ask:(s==null?void 0:s.ask)??null,defaultVolumeLots:l,volumeStep:d,minVolumeLots:f,isSubmitting:a,isAccountsLoading:y,selectedLogin:u,isDragging:H,onDragHandlePointerDown:D,onLayoutChange:F,onClose:g,onPlaceOrder:j=>void h({symbolTicker:e,login:j.login,executionMode:j.executionMode,side:j.side,orderType:j.orderType,volumeLots:j.volumeLots,stopLoss:j.stopLoss,takeProfit:j.takeProfit,priceOrder:j.priceOrder,priceTrigger:j.priceTrigger,comment:j.comment,typeTime:j.typeTime,expirationDateTime:j.expirationDateTime,expirationDay:j.expirationDay,bid:j.bid,ask:j.ask})})}):null]})}const FT=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" aria-hidden="true">
|
|
81
|
+
`+i)}}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Mn(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&Ks.assertOptions(r,{silentJSONParsing:He.transitional(He.boolean),forcedJSONParsing:He.transitional(He.boolean),clarifyTimeoutError:He.transitional(He.boolean),legacyInterceptorReqResOrdering:He.transitional(He.boolean),advertiseZstdAcceptEncoding:He.transitional(He.boolean),validateStatusUndefinedResolves:He.transitional(He.boolean)},!1),s!=null&&(k.isFunction(s)?n.paramsSerializer={serialize:s}:Ks.assertOptions(s,{encode:He.function,serialize:He.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Ks.assertOptions(n,{baseUrl:He.spelling("baseURL"),withXsrfToken:He.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=i&&k.merge(i.common,i[n.method]);i&&k.forEach(["delete","get","head","post","put","patch","query","common"],v=>{delete i[v]}),n.headers=We.concat(o,i);const a=[];let l=!0;this.interceptors.request.forEach(function(p){if(typeof p.runWhen=="function"&&p.runWhen(n)===!1)return;l=l&&p.synchronous;const m=n.transitional||wc;m&&m.legacyInterceptorReqResOrdering?a.unshift(p.fulfilled,p.rejected):a.push(p.fulfilled,p.rejected)});const d=[];this.interceptors.response.forEach(function(p){d.push(p.fulfilled,p.rejected)});let f,u=0,g;if(!l){const v=[td.bind(this),void 0];for(v.unshift(...a),v.push(...d),g=v.length,f=Promise.resolve(n);u<g;)f=f.then(v[u++],v[u++]);return f}g=a.length;let h=n;for(;u<g;){const v=a[u++],p=a[u++];try{h=v(h)}catch(m){p.call(this,m);break}}try{f=td.call(this,h)}catch(v){return Promise.reject(v)}for(u=0,g=d.length;u<g;)f=f.then(d[u++],d[u++]);return f}getUri(t){t=Mn(this.defaults,t);const n=Om(t.baseURL,t.url,t.allowAbsoluteUrls,t);return Tm(n,t.params,t.paramsSerializer)}};k.forEach(["delete","get","head","options"],function(t){Nn.prototype[t]=function(n,r){return this.request(Mn(r||{},{method:t,url:n,data:r&&k.hasOwnProp(r,"data")?r.data:void 0}))}});k.forEach(["post","put","patch","query"],function(t){function n(r){return function(i,o,a){return this.request(Mn(a||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}Nn.prototype[t]=n(),t!=="query"&&(Nn.prototype[t+"Form"]=n(!0))});let Dx=class Dm{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(s=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(a=>{r.subscribe(a),i=a}).then(s);return o.cancel=function(){r.unsubscribe(i)},o},t(function(i,o,a){r.reason||(r.reason=new fs(i,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 Dm(function(s){t=s}),cancel:t}}};function jx(e){return function(n){return e.apply(null,n)}}function Ix(e){return k.isObject(e)&&e.isAxiosError===!0}const Go={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(Go).forEach(([e,t])=>{Go[t]=e});function jm(e){const t=new Nn(e),n=um(Nn.prototype.request,t);return k.extend(n,Nn.prototype,t,{allOwnKeys:!0}),k.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return jm(Mn(e,s))},n}const Re=jm(us);Re.Axios=Nn;Re.CanceledError=fs;Re.CancelToken=Dx;Re.isCancel=km;Re.VERSION=xc;Re.toFormData=Hi;Re.AxiosError=Z;Re.Cancel=Re.CanceledError;Re.all=function(t){return Promise.all(t)};Re.spread=jx;Re.isAxiosError=Ix;Re.mergeConfig=Mn;Re.AxiosHeaders=We;Re.formToJSON=e=>Pm(k.isHTMLForm(e)?new FormData(e):e);Re.getAdapter=Lm.getAdapter;Re.HttpStatusCode=Go;Re.default=Re;const{Axios:UE,AxiosError:BE,CanceledError:$E,isCancel:VE,CancelToken:HE,VERSION:zE,all:WE,Cancel:KE,isAxiosError:Im,spread:qE,toFormData:GE,AxiosHeaders:ZE,HttpStatusCode:YE,formToJSON:QE,getAdapter:XE,mergeConfig:JE,create:eP}=Re,Mx="Bearer ",Mm="web-trading-token";function Fx(){return typeof window>"u"?null:localStorage.getItem(Mm)}function br(e){return e.replace(/\/$/,"")}function rd(e){const t=br(e);async function n(r){const s=Fx();return(await Re({...r,baseURL:t,headers:{...r.headers??{},...s?{Authorization:`${Mx}${s}`}:{}}})).data}return{get(r,s){return n({...s,url:r,method:"get"})},post(r,s,i){return n({...i,url:r,method:"post",data:s})}}}function sd(e){return!e.isDemo&&!e.isArchive&&!!e.tradeStat}function Ux(e){const t=e.filter(n=>sd(n)&&n.platformType==="mt5");return t.length>0?t:e.filter(sd)}function Bx(e){const t=e,n=(t==null?void 0:t.accounts)??[];return Ux(n).map(r=>{var s,i,o,a,l;return{id:r.id,login:String(r.login),label:`${r.displayTitle} · ${r.login}`,currency:r.currency,tradeStat:{balance:((s=r.tradeStat)==null?void 0:s.balance)??0,equity:((i=r.tradeStat)==null?void 0:i.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 $x(e){try{const t=new URL(br(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 br(e)}}function Vx(e){try{const t=new URL(br(e));return t.hostname.includes("opheleo")?"wss://symbols.opheleo.com":(t.protocol=t.protocol==="https:"?"wss:":"ws:",t.origin)}catch{return"wss://symbols.opheleo.com"}}function Hx(e){const t=br(e),n=rd(t),r=$x(t),s=rd(r),i=Rw(n),o=Bt;return{baseUrl:t,platformApiBase:r,tickWebSocketUrl:Vx(t),dealer:i,trading:Fw(i,o),async getAccounts(){const a=await s.get("/account-config/api/v1");return Bx(a)}}}const Fm=C.createContext(null);function Um({baseUrl:e,children:t}){const n=C.useMemo(()=>Hx(e),[e]);return c.jsx(Fm.Provider,{value:n,children:t})}function dt(){const e=C.useContext(Fm);if(!e)throw new Error("useWidgetApiClient must be used within WidgetApiProvider");return e}function Bm(){return dt().tickWebSocketUrl}const zx="wss://symbols.opheleo.com";function Cc(e){const[t,n]=C.useState(null),r=Bm();return C.useEffect(()=>{n(null);const s=Ui(e).toUpperCase();let i=null,o=!1;const a=r||zx,l=()=>{i=new WebSocket(a),i.onopen=()=>{if(o){i==null||i.close(1e3,"Unmounted");return}i==null||i.send(JSON.stringify({action:"select_symbol",symbol:s}))},i.onmessage=d=>{var f;try{const u=JSON.parse(d.data);if(((f=u.symbol)==null?void 0:f.trim().toUpperCase())!==s)return;const h=Number(u.bid),v=Number(u.ask);if(!Number.isFinite(h)||!Number.isFinite(v))return;n({bid:h,ask:v})}catch{}},i.onclose=()=>{o||setTimeout(l,3e3)}};return l(),()=>{o=!0,i==null||i.close(1e3,"Unmounted")}},[e,r]),t}function Wx({symbolTicker:e,sidePanelTab:t,orderState:n,backUrl:r,createAccountUrl:s}){const i=Cc(e),{panelRef:o,position:a,isDragging:l,onDragStart:d,reclamp:f}=am(),{panel:u,isSubmitting:g,defaultVolumeLots:h,volumeStep:v,minVolumeLots:p,accountOptions:m,selectedLogin:y,isAccountsLoading:b,hasConfirmedAccount:_,needsAccountSelection:x,confirmAccountSelection:T,placeMarketOrder:S}=n,E=ie(L=>L.setDraft),O=ie(L=>L.clearDraft),R=Number(Vt(Ht(e))),M=Pr(R);C.useEffect(()=>{_&&E({source:"new-order",entryPrice:null,side:null,showEntryLine:!1,volumeLots:h,digits:R,priceStep:M})},[h,R,_,M,E]),C.useEffect(()=>{(u==="closed"||u==="confirmation")&&O()},[O,u]);const N=L=>{S({symbolTicker:e,login:L.login,executionMode:"market",side:L.side,orderType:L.side==="buy"?Ye.BUY:Ye.SELL,volumeLots:L.volumeLots,stopLoss:"",takeProfit:"",priceOrder:"",priceTrigger:"",comment:"",typeTime:gt.GTC,expirationDateTime:"",expirationDay:"",bid:L.bid,ask:L.ask})};return c.jsxs(c.Fragment,{children:[c.jsx(Yf,{open:x,isAccountsLoading:b,accountOptions:m,onConfirm:T,backUrl:r,createAccountUrl:s}),_&&c.jsx("div",{ref:o,style:{left:a.x,top:a.y},className:`web-trading-widget-new-order-overlay${l?" web-trading-widget-new-order-overlay--dragging":""}`,children:c.jsx(yw,{symbolTicker:e,bid:(i==null?void 0:i.bid)??null,ask:(i==null?void 0:i.ask)??null,defaultVolumeLots:h,volumeStep:v,minVolumeLots:p,isSubmitting:g,isAccountsLoading:b,selectedLogin:y,isDragging:l,sidePanelTab:t,onDragHandlePointerDown:d,onExpandedChange:f,onExpand:f,onPlaceOrder:N})})]})}function Kx(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 qx(e,t){return e.openTimeMs!==t.openTimeMs?e.openTimeMs-t.openTimeMs:Kx(e.ticket,t.ticket)}function id(e){return[...e].sort(qx)}function od(e){return Ke(e).toUpperCase()}const ge=$i(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:id(t)})},setOrders:t=>{e({orders:id(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 s=od(t);e(i=>{const o={...i.liveQuotes,[s]:{bid:n,ask:r}};return{liveQuotes:o,positions:i.positions.map(a=>Xv(a,s,n,r,o)),orders:i.orders.map(a=>{if(od(a.symbol)!==s)return a;const l=a.side==="buy"?n:r;return{...a,currentPrice:l,marketBid:n,marketAsk:r}})}})},clearPositions:()=>{e({positions:[],orders:[],liveQuotes:{}})}})),Gx="wss://symbols.opheleo.com";function Zx(e,t){const n=new Set;for(const r of e){const s=Ke(r.symbol).toUpperCase();s&&n.add(s)}for(const r of t){const s=Ke(r.symbol).toUpperCase();s&&n.add(s)}for(const r of Yv([...n]))n.add(r);return[...n].sort().join("|")}function Yx(e){return Zx(e.positions,e.orders)}function Qx(){const e=ge(Yx),t=ge(r=>r.updateQuotes),n=Bm();C.useEffect(()=>{if(!e)return;const r=e.split("|"),s=new Map;let i=!1;const o=n||Gx,a=l=>{const d=new WebSocket(o);s.set(l,d),d.onopen=()=>{if(i){d.close(1e3,"Unmounted");return}d.send(JSON.stringify({action:"select_symbol",symbol:l}))},d.onmessage=f=>{var u;try{const g=JSON.parse(f.data),h=(u=g.symbol)==null?void 0:u.trim().toUpperCase();if(!h||h!==l)return;const v=Number(g.bid),p=Number(g.ask);if(!Number.isFinite(v)||!Number.isFinite(p))return;t(h,v,p)}catch{}},d.onclose=()=>{s.delete(l),i||setTimeout(()=>a(l),3e3)}};for(const l of r)a(l);return()=>{i=!0;for(const l of s.values())l.close(1e3,"Unmounted");s.clear()}},[e,n,t])}function $m(){return Qx(),null}const Vm={buy:"#2563eb",sell:"#dc2626"},wo={positive:"#2563eb",negative:"#dc2626",neutral:"#94a3b8"},_o={linewidth:1,linestyle:2,fontsize:11},Hm={stopLoss:"#f97316",takeProfit:"#22c55e"},zm=e=>Vm[e],Zo=(e,t)=>e==="entry"?t!=null?zm(t):Vm.sell:Hm[e],ad=(e,t)=>{if(e==="entry")return Zo(e,t.side);const{side:n,entryPrice:r,linePrice:s,volumeLots:i}=t;if(n!=null&&r!==null&&r!==void 0&&s!==void 0&&i!==void 0){const o=Wm(n,r,s,i);return Km(o)}return Hm[e]},Wm=(e,t,n,r)=>(e==="buy"?n-t:t-n)*r*100,Xx=(e,t)=>!Number.isFinite(t)||t<=0?0:Math.round(e/t),Jx=e=>{const t=Wm(e.side,e.entryPrice,e.linePrice,e.volumeLots),n=e.side==="buy"?e.linePrice-e.entryPrice:e.entryPrice-e.linePrice,r=Xx(n,e.priceStep),s=e.kind==="takeProfit"?"TP":"SL",i=`${t.toFixed(2)} USD`,o=`${r} points`;return`${s} ${i}, ${o}`},eS=(e,t)=>e.toFixed(t),Km=e=>e>0?wo.positive:e<0?wo.negative:wo.neutral,tS=e=>{const t=`${e.side.toUpperCase()} ${e.volumeLots.toFixed(2)}, `,n=`${e.profit.toFixed(2)} USD`;return`${t}${n}`},xo=e=>{const t=zm(e.side),n=Km(e.profit);return{text:tS(e),linecolor:t,textcolor:n,linewidth:_o.linewidth,linestyle:_o.linestyle,fontsize:_o.fontsize,showPrice:!0,horzLabelsAlign:"left"}},So=e=>Ue(e),nS=e=>e==="entry"||e==="stopLoss"||e==="takeProfit",Co=e=>{e.setUserEditEnabled(!1),e.setSelectionEnabled(!1)},cd=(e,t,n)=>{if(e==="entry")return eS(t,n.digits);const{entryPrice:r,side:s}=n;return s!==null&&r!==null?Jx({kind:e,side:s,entryPrice:r,linePrice:t,volumeLots:n.volumeLots,priceStep:n.priceStep}):`${e==="takeProfit"?"TP":"SL"} ${Ce(t,n.digits)}`},rS=({chartWidget:e})=>{const t=ie(S=>S.source),n=ie(S=>S.entryPrice),r=ie(S=>S.stopLoss),s=ie(S=>S.takeProfit),i=ie(S=>S.side),o=ie(S=>S.showEntryLine),a=ie(S=>S.volumeLots),l=ie(S=>S.digits),d=ie(S=>S.priceStep),f=ie(S=>S.setStopLoss),u=ie(S=>S.setTakeProfit),g=C.useRef({}),h=C.useRef(null),v=C.useRef(null),p=C.useRef(!1),m=C.useRef({entryPrice:n,stopLoss:r,takeProfit:s,side:i,showEntryLine:o,volumeLots:a,digits:l,priceStep:d});C.useEffect(()=>{m.current={entryPrice:n,stopLoss:r,takeProfit:s,side:i,showEntryLine:o,volumeLots:a,digits:l,priceStep:d}},[l,n,d,o,i,r,s,a]);const y=C.useCallback(S=>{if(!e)return;const E=g.current[S];if(E){try{e.activeChart().removeEntity(E)}catch{}delete g.current[S]}},[e]),b=C.useCallback((S,E,O,R)=>{const M=Zo(E,R.side),N=ad(E,{side:R.side,entryPrice:R.entryPrice,linePrice:O,volumeLots:R.volumeLots});S.setProperties({text:cd(E,O,R),linecolor:M,textcolor:N,showPrice:!0,horzLabelsAlign:"left"})},[]),_=C.useCallback(async(S,E,O)=>{var j;if(!e)return;if(E===void 0){y(S);return}if(h.current===S)return;const R=e.activeChart(),M=Zo(S,O.side),N=ad(S,{side:O.side,entryPrice:O.entryPrice,linePrice:E,volumeLots:O.volumeLots}),L=cd(S,E,O),V=g.current[S];if(V)try{const U=R.getShapeById(V);S==="entry"&&Co(U);const D=(j=U.getPoints()[0])==null?void 0:j.price;if(D!==void 0&&Math.abs(D-E)<O.priceStep/2){U.setProperties({text:L,linecolor:M,textcolor:N,showPrice:!0,horzLabelsAlign:"left"});return}const $=U.getPoints();if($.length>0){p.current=!0,U.setPoints($.map(A=>({...A,price:E}))),p.current=!1,U.setProperties({text:L,linecolor:M,textcolor:N,showPrice:!0,horzLabelsAlign:"left"});return}}catch{delete g.current[S]}try{const U=R.getVisibleRange(),D=await R.createShape({time:U.from,price:E},{shape:"horizontal_line",text:L,disableSave:!0,lock:S==="entry",disableSelection:S==="entry",overrides:{linecolor:M,textcolor:N,linewidth:2,showPrice:!0,horzLabelsAlign:"left"}});if(S==="entry"&&!m.current.showEntryLine){try{R.removeEntity(D)}catch{}return}if(S==="entry")try{Co(R.getShapeById(D))}catch{}g.current[S]=D}catch{}},[e,y]),x=C.useCallback(async S=>{const E=So(S.stopLoss),O=So(S.takeProfit);S.showEntryLine&&S.entryPrice!==null?await _("entry",S.entryPrice,S):await _("entry",void 0,S),await _("stopLoss",E,S),await _("takeProfit",O,S)},[_]),T=t!==null&&(o||r.trim()!==""||s.trim()!=="");C.useEffect(()=>{if(!e||!T)return;const S=(E,O)=>{var L,V,j;const R=(L=Object.entries(g.current).find(([,U])=>U===E))==null?void 0:L[0];if(!R||!nS(R))return;const N=e.activeChart().getAllShapes().filter(U=>U.name==="horizontal_line").some(U=>U.id===E);if(R==="entry"){if((O==="move"||O==="points_changed")&&N){const U=m.current;if(U.entryPrice!==null)try{const D=e.activeChart().getShapeById(E),$=(V=D.getPoints()[0])==null?void 0:V.price;if($!==void 0&&Math.abs($-U.entryPrice)>=U.priceStep/2){const A=D.getPoints();A.length>0&&D.setPoints(A.map(F=>({...F,price:U.entryPrice})))}Co(D)}catch{}}return}if(O==="remove"&&N){h.current=null,R==="stopLoss"&&f(""),R==="takeProfit"&&u(""),delete g.current[R];return}if(!(O!=="move"&&O!=="points_changed"&&!N)&&!p.current)try{const U=e.activeChart().getShapeById(E),D=(j=U.getPoints()[0])==null?void 0:j.price;if(!Number.isFinite(D)||D<=0)return;const $=m.current,A=R==="stopLoss"?$.stopLoss:$.takeProfit,F=So(A),W=F!==void 0&&Math.abs(F-D)<$.priceStep/2;if(O==="points_changed"&&N){h.current=R,b(U,R,D,$),v.current!==null&&clearTimeout(v.current),v.current=setTimeout(()=>{h.current=null;const J=Ce(D,m.current.digits);R==="stopLoss"?f(J):u(J)},120);return}if(v.current!==null&&(clearTimeout(v.current),v.current=null),h.current=null,W){b(U,R,D,$);return}const I=Ce(D,$.digits),ee=R==="stopLoss"?{...$,stopLoss:I}:{...$,takeProfit:I};R==="stopLoss"?f(I):u(I),b(U,R,D,ee)}catch{h.current=null}};try{e.subscribe("drawing_event",S)}catch{}return()=>{h.current=null,v.current!==null&&(clearTimeout(v.current),v.current=null);try{e.unsubscribe("drawing_event",S)}catch{}}},[e,T,f,u,b]),C.useEffect(()=>{if(!e)return;if(t===null){Object.keys(g.current).forEach(E=>{y(E)}),g.current={};return}let S=!1;try{e.onChartReady(()=>{S||x(m.current)})}catch{}return()=>{S=!0}},[e,y,t,n,r,s,i,o,a,l,d,x])},To=e=>{e.setUserEditEnabled(!1),e.setSelectionEnabled(!1)},Yo=(e,t)=>Ke(e.symbol).toUpperCase()===t,ld=e=>ge.getState().positions.filter(t=>Yo(t,e)).map(t=>({ticket:t.ticket,openPrice:t.openPrice,type:t.type,digits:t.digits,volumeLots:t.volumeLots,profit:t.profit})),dd=(e,t,n)=>{try{const r=e.activeChart().symbol(),s=n.find(i=>i.display_name===r||i.ticker===r);if(s)return nm(s.ticker,n)}catch{}return t},ud=(e,t,n)=>{var i;const r=(i=e.getPoints()[0])==null?void 0:i.price;if(r!==void 0&&Math.abs(r-t)<Number.EPSILON){e.setProperties(n);return}const s=e.getPoints();s.length>0&&e.setPoints(s.map(o=>({...o,price:t}))),e.setProperties(n)},sS=500,iS=({chartWidget:e,symbolTicker:t,symbols:n})=>{const r=ge(m=>m.positions),s=C.useRef(new Map),i=C.useRef(0),o=C.useMemo(()=>nm(t,n),[t,n]),a=C.useMemo(()=>r.filter(m=>Yo(m,o)).map(m=>`${m.ticket}:${m.openPrice}:${m.type}:${m.digits}:${m.volumeLots}`).sort().join("|"),[o,r]),l=C.useMemo(()=>r.filter(m=>Yo(m,o)).map(m=>`${m.ticket}:${m.profit.toFixed(2)}`).sort().join("|"),[o,r]),d=C.useCallback(m=>{if(!e)return;const y=s.current.get(m);if(y){try{e.activeChart().removeEntity(y)}catch{}s.current.delete(m)}},[e]),f=C.useCallback(()=>{for(const m of[...s.current.keys()])d(m);s.current.clear()},[d]),u=C.useCallback(async(m,y,b)=>{const _=xo({side:y.type,volumeLots:y.volumeLots,profit:y.profit}),T={time:m.getVisibleRange().from,price:y.openPrice},S=await m.createShape(T,{shape:"horizontal_line",text:String(_.text),disableSave:!0,lock:!0,disableSelection:!0,overrides:_});if(b!==i.current){try{m.removeEntity(S)}catch{}return null}try{To(m.getShapeById(S))}catch{}return S},[]),g=C.useCallback(async(m,y)=>{if(!e||y!==i.current)return;const b=e.activeChart(),_=xo({side:m.type,volumeLots:m.volumeLots,profit:m.profit}),x=s.current.get(m.ticket);if(x)try{ud(b.getShapeById(x),m.openPrice,_),To(b.getShapeById(x));return}catch{s.current.delete(m.ticket)}if(y===i.current)try{const T=await u(b,m,y);if(!T)return;s.current.set(m.ticket,T)}catch{}},[e,u]),h=C.useCallback(async(m,y)=>{if(!e||m!==i.current)return;const b=ld(y),_=new Set(b.map(x=>x.ticket));for(const x of s.current.keys())_.has(x)||d(x);for(const x of b){if(m!==i.current)return;await g(x,m)}},[e,d,g]),v=C.useCallback(()=>{if(!e)return;let m;try{m=e.activeChart()}catch{return}const y=ld(o);for(const b of y){const _=s.current.get(b.ticket);if(_)try{const x=xo({side:b.type,volumeLots:b.volumeLots,profit:b.profit});ud(m.getShapeById(_),b.openPrice,x),To(m.getShapeById(_))}catch{s.current.delete(b.ticket)}}},[o,e]),p=C.useCallback(m=>{if(!e)return;const y=i.current+1;i.current=y,m!=null&&m.resetLineIds&&f();const b=(m==null?void 0:m.symbolKey)??dd(e,o,n);h(y,b)},[o,e,f,n,h]);C.useEffect(()=>{if(!e)return;let m=!1,y=null;const b=()=>{m||p({resetLineIds:!0,symbolKey:dd(e,o,n)})};let _=!1;const x=()=>{_=!0,b()},T=()=>{m||!_||(_=!1,p({symbolKey:o}))};try{e.onChartReady(()=>{if(!m)try{y=e.activeChart(),p({resetLineIds:!0,symbolKey:o}),y.onSymbolChanged().subscribe(null,x),y.onDataLoaded().subscribe(null,T)}catch{}})}catch{}return()=>{if(m=!0,i.current+=1,y)try{y.onSymbolChanged().unsubscribe(null,x),y.onDataLoaded().unsubscribe(null,T)}catch{}f()}},[o,e,f,p,n]),C.useEffect(()=>{if(!e||!a)return;let m=!1;try{e.onChartReady(()=>{m||p({symbolKey:o})})}catch{}return()=>{m=!0}},[o,e,a,p]),C.useEffect(()=>{if(!e||!l)return;let m=!1,y=null;return y=setTimeout(()=>{if(!m)try{e.onChartReady(()=>{m||v()})}catch{}},sS),()=>{m=!0,y!==null&&clearTimeout(y)}},[e,l,v])},qm=({chartWidget:e,symbolTicker:t,symbols:n})=>(iS({chartWidget:e,symbolTicker:t,symbols:n}),rS({chartWidget:e}),null);var ms=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,Qt,er,iu,oS=(iu=class extends ms{constructor(){super();re(this,_n);re(this,Qt);re(this,er);q(this,er,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){P(this,Qt)||this.setEventListener(P(this,er))}onUnsubscribe(){var t;this.hasListeners()||((t=P(this,Qt))==null||t.call(this),q(this,Qt,void 0))}setEventListener(t){var n;q(this,er,t),(n=P(this,Qt))==null||n.call(this),q(this,Qt,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){P(this,_n)!==t&&(q(this,_n,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof P(this,_n)=="boolean"?P(this,_n):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},_n=new WeakMap,Qt=new WeakMap,er=new WeakMap,iu),Tc=new oS,aS={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Ct,xn,ou,cS=(ou=class{constructor(){re(this,Ct,aS);re(this,xn,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&P(this,xn)&&e!==P(this,Ct)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:P(this,Ct),provider:e}),q(this,Ct,e),process.env.NODE_ENV!=="production"&&q(this,xn,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&q(this,xn,!0),P(this,Ct).setTimeout(e,t)}clearTimeout(e){P(this,Ct).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&q(this,xn,!0),P(this,Ct).setInterval(e,t)}clearInterval(e){P(this,Ct).clearInterval(e)}},Ct=new WeakMap,xn=new WeakMap,ou),wn=new cS;function lS(e){setTimeout(e,0)}var dS=typeof window>"u"||"Deno"in globalThis;function Ze(){}function uS(e,t){return typeof e=="function"?e(t):e}function Qo(e){return typeof e=="number"&&e>=0&&e!==1/0}function Gm(e,t){return Math.max(e+(t||0)-Date.now(),0)}function an(e,t){return typeof e=="function"?e(t):e}function tt(e,t){return typeof e=="function"?e(t):e}function fd(e,t){const{type:n="all",exact:r,fetchStatus:s,predicate:i,queryKey:o,stale:a}=e;if(o){if(r){if(t.queryHash!==Ec(o,t.options))return!1}else if(!Qr(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||s&&s!==t.state.fetchStatus||i&&!i(t))}function md(e,t){const{exact:n,status:r,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(Yr(t.options.mutationKey)!==Yr(i))return!1}else if(!Qr(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function Ec(e,t){return((t==null?void 0:t.queryKeyHashFn)||Yr)(e)}function Yr(e){return JSON.stringify(e,(t,n)=>ea(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function Qr(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Qr(e[n],t[n])):!1}var fS=Object.prototype.hasOwnProperty;function Xo(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=pd(e)&&pd(t);if(!r&&!(ea(e)&&ea(t)))return t;const i=(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 f=0;f<a;f++){const u=r?f:o[f],g=e[u],h=t[u];if(g===h){l[u]=g,(r?f<i:fS.call(e,u))&&d++;continue}if(g===null||h===null||typeof g!="object"||typeof h!="object"){l[u]=h;continue}const v=Xo(g,h,n+1);l[u]=v,v===g&&d++}return i===a&&d===i?e:l}function Jo(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 pd(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function ea(e){if(!hd(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!hd(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function hd(e){return Object.prototype.toString.call(e)==="[object Object]"}function mS(e){return new Promise(t=>{wn.setTimeout(t,e)})}function ta(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 Xo(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 Xo(e,t)}return t}function pS(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function hS(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var fi=Symbol();function Zm(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===fi&&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===fi?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Ym(e,t){return typeof e=="function"?e(...t):!!e}function gS(e,t,n){let r=!1,s;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??(s=t()),r||(r=!0,s.aborted?n():s.addEventListener("abort",n,{once:!0})),s)}),e}var Xr=(()=>{let e=()=>dS;return{isServer(){return e()},setIsServer(t){e=t}}})();function na(){let e,t;const n=new Promise((s,i)=>{e=s,t=i});n.status="pending",n.catch(()=>{});function r(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{r({status:"fulfilled",value:s}),e(s)},n.reject=s=>{r({status:"rejected",reason:s}),t(s)},n}var yS=lS;function bS(){let e=[],t=0,n=a=>{a()},r=a=>{a()},s=yS;const i=a=>{t?e.push(a):s(()=>{n(a)})},o=()=>{const a=e;e=[],a.length&&s(()=>{r(()=>{a.forEach(l=>{n(l)})})})};return{batch:a=>{let l;t++;try{l=a()}finally{t--,t||o()}return l},batchCalls:a=>(...l)=>{i(()=>{a(...l)})},schedule:i,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{s=a}}}var Fe=bS(),tr,Xt,nr,au,vS=(au=class extends ms{constructor(){super();re(this,tr,!0);re(this,Xt);re(this,nr);q(this,nr,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(){P(this,Xt)||this.setEventListener(P(this,nr))}onUnsubscribe(){var t;this.hasListeners()||((t=P(this,Xt))==null||t.call(this),q(this,Xt,void 0))}setEventListener(t){var n;q(this,nr,t),(n=P(this,Xt))==null||n.call(this),q(this,Xt,t(this.setOnline.bind(this)))}setOnline(t){P(this,tr)!==t&&(q(this,tr,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return P(this,tr)}},tr=new WeakMap,Xt=new WeakMap,nr=new WeakMap,au),mi=new vS;function wS(e){return Math.min(1e3*2**e,3e4)}function Qm(e){return(e??"online")==="online"?mi.isOnline():!0}var ra=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Xm(e){let t=!1,n=0,r;const s=na(),i=()=>s.status!=="pending",o=p=>{var m;if(!i()){const y=new ra(p);g(y),(m=e.onCancel)==null||m.call(e,y)}},a=()=>{t=!0},l=()=>{t=!1},d=()=>Tc.isFocused()&&(e.networkMode==="always"||mi.isOnline())&&e.canRun(),f=()=>Qm(e.networkMode)&&e.canRun(),u=p=>{i()||(r==null||r(),s.resolve(p))},g=p=>{i()||(r==null||r(),s.reject(p))},h=()=>new Promise(p=>{var m;r=y=>{(i()||d())&&p(y)},(m=e.onPause)==null||m.call(e)}).then(()=>{var p;r=void 0,i()||(p=e.onContinue)==null||p.call(e)}),v=()=>{if(i())return;let p;const m=n===0?e.initialPromise:void 0;try{p=m??e.fn()}catch(y){p=Promise.reject(y)}Promise.resolve(p).then(u).catch(y=>{var S;if(i())return;const b=e.retry??(Xr.isServer()?0:3),_=e.retryDelay??wS,x=typeof _=="function"?_(n,y):_,T=b===!0||typeof b=="number"&&n<b||typeof b=="function"&&b(n,y);if(t||!T){g(y);return}n++,(S=e.onFail)==null||S.call(e,n,y),mS(x).then(()=>d()?void 0:h()).then(()=>{t?g(y):v()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(r==null||r(),s),cancelRetry:a,continueRetry:l,canStart:f,start:()=>(f()?v():h().then(v),s)}}var Sn,cu,Jm=(cu=class{constructor(){re(this,Sn)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Qo(this.gcTime)&&q(this,Sn,wn.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Xr.isServer()?1/0:300*1e3))}clearGcTimeout(){P(this,Sn)!==void 0&&(wn.clearTimeout(P(this,Sn)),q(this,Sn,void 0))}},Sn=new WeakMap,cu);function _S(e){return{onFetch:(t,n)=>{var f,u,g,h,v;const r=t.options,s=(g=(u=(f=t.fetchOptions)==null?void 0:f.meta)==null?void 0:u.fetchMore)==null?void 0:g.direction,i=((h=t.state.data)==null?void 0:h.pages)||[],o=((v=t.state.data)==null?void 0:v.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const d=async()=>{let p=!1;const m=_=>{gS(_,()=>t.signal,()=>p=!0)},y=Zm(t.options,t.fetchOptions),b=async(_,x,T)=>{if(p)return Promise.reject(t.signal.reason);if(x==null&&_.pages.length)return Promise.resolve(_);const E=(()=>{const N={client:t.client,queryKey:t.queryKey,pageParam:x,direction:T?"backward":"forward",meta:t.options.meta};return m(N),N})(),O=await y(E),{maxPages:R}=t.options,M=T?hS:pS;return{pages:M(_.pages,O,R),pageParams:M(_.pageParams,x,R)}};if(s&&i.length){const _=s==="backward",x=_?xS:gd,T={pages:i,pageParams:o},S=x(r,T);a=await b(T,S,_)}else{const _=e??i.length;do{const x=l===0?o[0]??r.initialPageParam:gd(r,a);if(l>0&&x==null)break;a=await b(a,x),l++}while(l<_)}return a};t.options.persister?t.fetchFn=()=>{var p,m;return(m=(p=t.options).persister)==null?void 0:m.call(p,d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=d}}}function gd(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 xS(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 rr,Cn,sr,at,Tn,Me,ts,En,et,ep,Lt,lu,SS=(lu=class extends Jm{constructor(t){super();re(this,et);re(this,rr);re(this,Cn);re(this,sr);re(this,at);re(this,Tn);re(this,Me);re(this,ts);re(this,En);q(this,En,!1),q(this,ts,t.defaultOptions),this.setOptions(t.options),this.observers=[],q(this,Tn,t.client),q(this,at,P(this,Tn).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,q(this,Cn,bd(this.options)),this.state=t.state??P(this,Cn),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return P(this,rr)}get promise(){var t;return(t=P(this,Me))==null?void 0:t.promise}setOptions(t){if(this.options={...P(this,ts),...t},t!=null&&t._type&&q(this,rr,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=bd(this.options);n.data!==void 0&&(this.setState(yd(n.data,n.dataUpdatedAt)),q(this,Cn,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&P(this,at).remove(this)}setData(t,n){const r=ta(this.state.data,t,this.options);return be(this,et,Lt).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,et,Lt).call(this,{type:"setState",state:t})}cancel(t){var r,s;const n=(r=P(this,Me))==null?void 0:r.promise;return(s=P(this,Me))==null||s.cancel(t),n?n.then(Ze).catch(Ze):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return P(this,Cn)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>tt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===fi||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>an(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:!Gm(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=P(this,Me))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=P(this,Me))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),P(this,at).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(P(this,Me)&&(P(this,En)||be(this,et,ep).call(this)?P(this,Me).cancel({revert:!0}):P(this,Me).cancelRetry()),this.scheduleGc()),P(this,at).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||be(this,et,Lt).call(this,{type:"invalidate"})}async fetch(t,n){var d,f,u,g,h,v,p,m,y,b,_;if(this.state.fetchStatus!=="idle"&&((d=P(this,Me))==null?void 0:d.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(P(this,Me))return P(this,Me).continueRetry(),P(this,Me).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,s=x=>{Object.defineProperty(x,"signal",{enumerable:!0,get:()=>(q(this,En,!0),r.signal)})},i=()=>{const x=Zm(this.options,n),S=(()=>{const E={client:P(this,Tn),queryKey:this.queryKey,meta:this.meta};return s(E),E})();return q(this,En,!1),this.options.persister?this.options.persister(x,S,this):x(S)},a=(()=>{const x={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:P(this,Tn),state:this.state,fetchFn:i};return s(x),x})(),l=P(this,rr)==="infinite"?_S(this.options.pages):this.options.behavior;l==null||l.onFetch(a,this),q(this,sr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((f=a.fetchOptions)==null?void 0:f.meta))&&be(this,et,Lt).call(this,{type:"fetch",meta:(u=a.fetchOptions)==null?void 0:u.meta}),q(this,Me,Xm({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:x=>{x instanceof ra&&x.revert&&this.setState({...P(this,sr),fetchStatus:"idle"}),r.abort()},onFail:(x,T)=>{be(this,et,Lt).call(this,{type:"failed",failureCount:x,error:T})},onPause:()=>{be(this,et,Lt).call(this,{type:"pause"})},onContinue:()=>{be(this,et,Lt).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const x=await P(this,Me).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),(h=(g=P(this,at).config).onSuccess)==null||h.call(g,x,this),(p=(v=P(this,at).config).onSettled)==null||p.call(v,x,this.state.error,this),x}catch(x){if(x instanceof ra){if(x.silent)return P(this,Me).promise;if(x.revert){if(this.state.data===void 0)throw x;return this.state.data}}throw be(this,et,Lt).call(this,{type:"error",error:x}),(y=(m=P(this,at).config).onError)==null||y.call(m,x,this),(_=(b=P(this,at).config).onSettled)==null||_.call(b,this.state.data,x,this),x}finally{this.scheduleGc()}}},rr=new WeakMap,Cn=new WeakMap,sr=new WeakMap,at=new WeakMap,Tn=new WeakMap,Me=new WeakMap,ts=new WeakMap,En=new WeakMap,et=new WeakSet,ep=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Lt=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,...tp(r.data,this.options),fetchMeta:t.meta??null};case"success":const s={...r,...yd(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return q(this,sr,t.manual?s:void 0),s;case"error":const i=t.error;return{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),Fe.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),P(this,at).notify({query:this,type:"updated",action:t})})},lu);function tp(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Qm(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function yd(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function bd(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 Ge,_e,ns,qe,Pn,ir,jt,Jt,rs,or,ar,kn,An,en,cr,Ee,Br,sa,ia,oa,aa,ca,la,da,np,du,CS=(du=class extends ms{constructor(t,n){super();re(this,Ee);re(this,Ge);re(this,_e);re(this,ns);re(this,qe);re(this,Pn);re(this,ir);re(this,jt);re(this,Jt);re(this,rs);re(this,or);re(this,ar);re(this,kn);re(this,An);re(this,en);re(this,cr,new Set);this.options=n,q(this,Ge,t),q(this,Jt,null),q(this,jt,na()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(P(this,_e).addObserver(this),vd(P(this,_e),this.options)?be(this,Ee,Br).call(this):this.updateResult(),be(this,Ee,aa).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ua(P(this,_e),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ua(P(this,_e),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,be(this,Ee,ca).call(this),be(this,Ee,la).call(this),P(this,_e).removeObserver(this)}setOptions(t){const n=this.options,r=P(this,_e);if(this.options=P(this,Ge).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof tt(this.options.enabled,P(this,_e))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");be(this,Ee,da).call(this),P(this,_e).setOptions(this.options),n._defaulted&&!Jo(this.options,n)&&P(this,Ge).getQueryCache().notify({type:"observerOptionsUpdated",query:P(this,_e),observer:this});const s=this.hasListeners();s&&wd(P(this,_e),r,this.options,n)&&be(this,Ee,Br).call(this),this.updateResult(),s&&(P(this,_e)!==r||tt(this.options.enabled,P(this,_e))!==tt(n.enabled,P(this,_e))||an(this.options.staleTime,P(this,_e))!==an(n.staleTime,P(this,_e)))&&be(this,Ee,sa).call(this);const i=be(this,Ee,ia).call(this);s&&(P(this,_e)!==r||tt(this.options.enabled,P(this,_e))!==tt(n.enabled,P(this,_e))||i!==P(this,en))&&be(this,Ee,oa).call(this,i)}getOptimisticResult(t){const n=P(this,Ge).getQueryCache().build(P(this,Ge),t),r=this.createResult(n,t);return ES(this,r)&&(q(this,qe,r),q(this,ir,this.options),q(this,Pn,P(this,_e).state)),r}getCurrentResult(){return P(this,qe)}trackResult(t,n){return new Proxy(t,{get:(r,s)=>(this.trackProp(s),n==null||n(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&P(this,jt).status==="pending"&&P(this,jt).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,s))})}trackProp(t){P(this,cr).add(t)}getCurrentQuery(){return P(this,_e)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=P(this,Ge).defaultQueryOptions(t),r=P(this,Ge).getQueryCache().build(P(this,Ge),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return be(this,Ee,Br).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),P(this,qe)))}createResult(t,n){var R;const r=P(this,_e),s=this.options,i=P(this,qe),o=P(this,Pn),a=P(this,ir),d=t!==r?t.state:P(this,ns),{state:f}=t;let u={...f},g=!1,h;if(n._optimisticResults){const M=this.hasListeners(),N=!M&&vd(t,n),L=M&&wd(t,r,n,s);(N||L)&&(u={...u,...tp(f.data,t.options)}),n._optimisticResults==="isRestoring"&&(u.fetchStatus="idle")}let{error:v,errorUpdatedAt:p,status:m}=u;h=u.data;let y=!1;if(n.placeholderData!==void 0&&h===void 0&&m==="pending"){let M;i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(M=i.data,y=!0):M=typeof n.placeholderData=="function"?n.placeholderData((R=P(this,ar))==null?void 0:R.state.data,P(this,ar)):n.placeholderData,M!==void 0&&(m="success",h=ta(i==null?void 0:i.data,M,n),g=!0)}if(n.select&&h!==void 0&&!y)if(i&&h===(o==null?void 0:o.data)&&n.select===P(this,rs))h=P(this,or);else try{q(this,rs,n.select),h=n.select(h),h=ta(i==null?void 0:i.data,h,n),q(this,or,h),q(this,Jt,null)}catch(M){q(this,Jt,M)}P(this,Jt)&&(v=P(this,Jt),h=P(this,or),p=Date.now(),m="error");const b=u.fetchStatus==="fetching",_=m==="pending",x=m==="error",T=_&&b,S=h!==void 0,O={status:m,fetchStatus:u.fetchStatus,isPending:_,isSuccess:m==="success",isError:x,isInitialLoading:T,isLoading:T,data:h,dataUpdatedAt:u.dataUpdatedAt,error:v,errorUpdatedAt:p,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:u.dataUpdateCount>d.dataUpdateCount||u.errorUpdateCount>d.errorUpdateCount,isFetching:b,isRefetching:b&&!_,isLoadingError:x&&!S,isPaused:u.fetchStatus==="paused",isPlaceholderData:g,isRefetchError:x&&S,isStale:Pc(t,n),refetch:this.refetch,promise:P(this,jt),isEnabled:tt(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const M=O.data!==void 0,N=O.status==="error"&&!M,L=U=>{N?U.reject(O.error):M&&U.resolve(O.data)},V=()=>{const U=q(this,jt,O.promise=na());L(U)},j=P(this,jt);switch(j.status){case"pending":t.queryHash===r.queryHash&&L(j);break;case"fulfilled":(N||O.data!==j.value)&&V();break;case"rejected":(!N||O.error!==j.reason)&&V();break}}return O}updateResult(){const t=P(this,qe),n=this.createResult(P(this,_e),this.options);if(q(this,Pn,P(this,_e).state),q(this,ir,this.options),P(this,Pn).data!==void 0&&q(this,ar,P(this,_e)),Jo(n,t))return;q(this,qe,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,i=typeof s=="function"?s():s;if(i==="all"||!i&&!P(this,cr).size)return!0;const o=new Set(i??P(this,cr));return this.options.throwOnError&&o.add("error"),Object.keys(P(this,qe)).some(a=>{const l=a;return P(this,qe)[l]!==t[l]&&o.has(l)})};be(this,Ee,np).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&be(this,Ee,aa).call(this)}},Ge=new WeakMap,_e=new WeakMap,ns=new WeakMap,qe=new WeakMap,Pn=new WeakMap,ir=new WeakMap,jt=new WeakMap,Jt=new WeakMap,rs=new WeakMap,or=new WeakMap,ar=new WeakMap,kn=new WeakMap,An=new WeakMap,en=new WeakMap,cr=new WeakMap,Ee=new WeakSet,Br=function(t){be(this,Ee,da).call(this);let n=P(this,_e).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Ze)),n},sa=function(){be(this,Ee,ca).call(this);const t=an(this.options.staleTime,P(this,_e));if(Xr.isServer()||P(this,qe).isStale||!Qo(t))return;const r=Gm(P(this,qe).dataUpdatedAt,t)+1;q(this,kn,wn.setTimeout(()=>{P(this,qe).isStale||this.updateResult()},r))},ia=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(P(this,_e)):this.options.refetchInterval)??!1},oa=function(t){be(this,Ee,la).call(this),q(this,en,t),!(Xr.isServer()||tt(this.options.enabled,P(this,_e))===!1||!Qo(P(this,en))||P(this,en)===0)&&q(this,An,wn.setInterval(()=>{(this.options.refetchIntervalInBackground||Tc.isFocused())&&be(this,Ee,Br).call(this)},P(this,en)))},aa=function(){be(this,Ee,sa).call(this),be(this,Ee,oa).call(this,be(this,Ee,ia).call(this))},ca=function(){P(this,kn)!==void 0&&(wn.clearTimeout(P(this,kn)),q(this,kn,void 0))},la=function(){P(this,An)!==void 0&&(wn.clearInterval(P(this,An)),q(this,An,void 0))},da=function(){const t=P(this,Ge).getQueryCache().build(P(this,Ge),this.options);if(t===P(this,_e))return;const n=P(this,_e);q(this,_e,t),q(this,ns,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},np=function(t){Fe.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(P(this,qe))}),P(this,Ge).getQueryCache().notify({query:P(this,_e),type:"observerResultsUpdated"})})},du);function TS(e,t){return tt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&tt(t.retryOnMount,e)===!1)}function vd(e,t){return TS(e,t)||e.state.data!==void 0&&ua(e,t,t.refetchOnMount)}function ua(e,t,n){if(tt(t.enabled,e)!==!1&&an(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Pc(e,t)}return!1}function wd(e,t,n,r){return(e!==t||tt(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Pc(e,n)}function Pc(e,t){return tt(t.enabled,e)!==!1&&e.isStaleByTime(an(t.staleTime,e))}function ES(e,t){return!Jo(e.getCurrentResult(),t)}var ss,Tt,ze,On,Et,qt,uu,PS=(uu=class extends Jm{constructor(t){super();re(this,Et);re(this,ss);re(this,Tt);re(this,ze);re(this,On);q(this,ss,t.client),this.mutationId=t.mutationId,q(this,ze,t.mutationCache),q(this,Tt,[]),this.state=t.state||kS(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){P(this,Tt).includes(t)||(P(this,Tt).push(t),this.clearGcTimeout(),P(this,ze).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){q(this,Tt,P(this,Tt).filter(n=>n!==t)),this.scheduleGc(),P(this,ze).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){P(this,Tt).length||(this.state.status==="pending"?this.scheduleGc():P(this,ze).remove(this))}continue(){var t;return((t=P(this,On))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,a,l,d,f,u,g,h,v,p,m,y,b,_,x,T,S,E;const n=()=>{be(this,Et,qt).call(this,{type:"continue"})},r={client:P(this,ss),meta:this.options.meta,mutationKey:this.options.mutationKey};q(this,On,Xm({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(O,R)=>{be(this,Et,qt).call(this,{type:"failed",failureCount:O,error:R})},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:()=>P(this,ze).canRun(this)}));const s=this.state.status==="pending",i=!P(this,On).canStart();try{if(s)n();else{be(this,Et,qt).call(this,{type:"pending",variables:t,isPaused:i}),P(this,ze).config.onMutate&&await P(this,ze).config.onMutate(t,this,r);const R=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,t,r));R!==this.state.context&&be(this,Et,qt).call(this,{type:"pending",context:R,variables:t,isPaused:i})}const O=await P(this,On).start();return await((d=(l=P(this,ze).config).onSuccess)==null?void 0:d.call(l,O,t,this.state.context,this,r)),await((u=(f=this.options).onSuccess)==null?void 0:u.call(f,O,t,this.state.context,r)),await((h=(g=P(this,ze).config).onSettled)==null?void 0:h.call(g,O,null,this.state.variables,this.state.context,this,r)),await((p=(v=this.options).onSettled)==null?void 0:p.call(v,O,null,t,this.state.context,r)),be(this,Et,qt).call(this,{type:"success",data:O}),O}catch(O){try{await((y=(m=P(this,ze).config).onError)==null?void 0:y.call(m,O,t,this.state.context,this,r))}catch(R){Promise.reject(R)}try{await((_=(b=this.options).onError)==null?void 0:_.call(b,O,t,this.state.context,r))}catch(R){Promise.reject(R)}try{await((T=(x=P(this,ze).config).onSettled)==null?void 0:T.call(x,void 0,O,this.state.variables,this.state.context,this,r))}catch(R){Promise.reject(R)}try{await((E=(S=this.options).onSettled)==null?void 0:E.call(S,void 0,O,t,this.state.context,r))}catch(R){Promise.reject(R)}throw be(this,Et,qt).call(this,{type:"error",error:O}),O}finally{P(this,ze).runNext(this)}}},ss=new WeakMap,Tt=new WeakMap,ze=new WeakMap,On=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),Fe.batch(()=>{P(this,Tt).forEach(r=>{r.onMutationUpdate(t)}),P(this,ze).notify({mutation:this,type:"updated",action:t})})},uu);function kS(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var It,ht,is,fu,AS=(fu=class extends ms{constructor(t={}){super();re(this,It);re(this,ht);re(this,is);this.config=t,q(this,It,new Set),q(this,ht,new Map),q(this,is,0)}build(t,n,r){const s=new PS({client:t,mutationCache:this,mutationId:++ws(this,is)._,options:t.defaultMutationOptions(n),state:r});return this.add(s),s}add(t){P(this,It).add(t);const n=Ls(t);if(typeof n=="string"){const r=P(this,ht).get(n);r?r.push(t):P(this,ht).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(P(this,It).delete(t)){const n=Ls(t);if(typeof n=="string"){const r=P(this,ht).get(n);if(r)if(r.length>1){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}else r[0]===t&&P(this,ht).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=Ls(t);if(typeof n=="string"){const r=P(this,ht).get(n),s=r==null?void 0:r.find(i=>i.state.status==="pending");return!s||s===t}else return!0}runNext(t){var r;const n=Ls(t);if(typeof n=="string"){const s=(r=P(this,ht).get(n))==null?void 0:r.find(i=>i!==t&&i.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Fe.batch(()=>{P(this,It).forEach(t=>{this.notify({type:"removed",mutation:t})}),P(this,It).clear(),P(this,ht).clear()})}getAll(){return Array.from(P(this,It))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>md(n,r))}findAll(t={}){return this.getAll().filter(n=>md(t,n))}notify(t){Fe.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Fe.batch(()=>Promise.all(t.map(n=>n.continue().catch(Ze))))}},It=new WeakMap,ht=new WeakMap,is=new WeakMap,fu);function Ls(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Pt,mu,OS=(mu=class extends ms{constructor(t={}){super();re(this,Pt);this.config=t,q(this,Pt,new Map)}build(t,n,r){const s=n.queryKey,i=n.queryHash??Ec(s,n);let o=this.get(i);return o||(o=new SS({client:t,queryKey:s,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){P(this,Pt).has(t.queryHash)||(P(this,Pt).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=P(this,Pt).get(t.queryHash);n&&(t.destroy(),n===t&&P(this,Pt).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Fe.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return P(this,Pt).get(t)}getAll(){return[...P(this,Pt).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>fd(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>fd(t,r)):n}notify(t){Fe.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Fe.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Fe.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Pt=new WeakMap,mu),Le,tn,nn,lr,dr,rn,ur,fr,pu,NS=(pu=class{constructor(e={}){re(this,Le);re(this,tn);re(this,nn);re(this,lr);re(this,dr);re(this,rn);re(this,ur);re(this,fr);q(this,Le,e.queryCache||new OS),q(this,tn,e.mutationCache||new AS),q(this,nn,e.defaultOptions||{}),q(this,lr,new Map),q(this,dr,new Map),q(this,rn,0)}mount(){ws(this,rn)._++,P(this,rn)===1&&(q(this,ur,Tc.subscribe(async e=>{e&&(await this.resumePausedMutations(),P(this,Le).onFocus())})),q(this,fr,mi.subscribe(async e=>{e&&(await this.resumePausedMutations(),P(this,Le).onOnline())})))}unmount(){var e,t;ws(this,rn)._--,P(this,rn)===0&&((e=P(this,ur))==null||e.call(this),q(this,ur,void 0),(t=P(this,fr))==null||t.call(this),q(this,fr,void 0))}isFetching(e){return P(this,Le).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return P(this,tn).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=P(this,Le).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=P(this,Le).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(an(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return P(this,Le).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),s=P(this,Le).get(r.queryHash),i=s==null?void 0:s.state.data,o=uS(t,i);if(o!==void 0)return P(this,Le).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return Fe.batch(()=>P(this,Le).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=P(this,Le).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=P(this,Le);Fe.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=P(this,Le);return Fe.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Fe.batch(()=>P(this,Le).findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(Ze).catch(Ze)}invalidateQueries(e,t={}){return Fe.batch(()=>(P(this,Le).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=Fe.batch(()=>P(this,Le).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,n);return n.throwOnError||(i=i.catch(Ze)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(Ze)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=P(this,Le).build(this,t);return n.isStaleByTime(an(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 mi.isOnline()?P(this,tn).resumePausedMutations():Promise.resolve()}getQueryCache(){return P(this,Le)}getMutationCache(){return P(this,tn)}getDefaultOptions(){return P(this,nn)}setDefaultOptions(e){q(this,nn,e)}setQueryDefaults(e,t){P(this,lr).set(Yr(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...P(this,lr).values()],n={};return t.forEach(r=>{Qr(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){P(this,dr).set(Yr(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...P(this,dr).values()],n={};return t.forEach(r=>{Qr(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...P(this,nn).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Ec(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===fi&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...P(this,nn).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){P(this,Le).clear(),P(this,tn).clear()}},Le=new WeakMap,tn=new WeakMap,nn=new WeakMap,lr=new WeakMap,dr=new WeakMap,rn=new WeakMap,ur=new WeakMap,fr=new WeakMap,pu),rp=w.createContext(void 0),ps=e=>{const t=w.useContext(rp);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},RS=({client:e,children:t})=>(w.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),c.jsx(rp.Provider,{value:e,children:t})),sp=w.createContext(!1),LS=()=>w.useContext(sp);sp.Provider;function DS(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var jS=w.createContext(DS()),IS=()=>w.useContext(jS),MS=(e,t,n)=>{const r=n!=null&&n.state.error&&typeof e.throwOnError=="function"?Ym(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},FS=e=>{w.useEffect(()=>{e.clearReset()},[e])},US=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(s&&e.data===void 0||Ym(n,[e.error,r])),BS=e=>{if(e.suspense){const n=s=>s==="static"?s:Math.max(s??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...s)=>n(r(...s)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},$S=(e,t)=>e.isLoading&&e.isFetching&&!t,VS=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,_d=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function HS(e,t,n){var h,v,p,m;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=LS(),s=IS(),i=ps(),o=i.defaultQueryOptions(e);(v=(h=i.getDefaultOptions().queries)==null?void 0:h._experimental_beforeQuery)==null||v.call(h,o);const a=i.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,BS(o),MS(o,s,a),FS(s);const d=!i.getQueryCache().get(o.queryHash),[f]=w.useState(()=>new t(i,o)),u=f.getOptimisticResult(o),g=!r&&l;if(w.useSyncExternalStore(w.useCallback(y=>{const b=g?f.subscribe(Fe.batchCalls(y)):Ze;return f.updateResult(),b},[f,g]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),w.useEffect(()=>{f.setOptions(o)},[o,f]),VS(o,u))throw _d(o,f,s);if(US({result:u,errorResetBoundary:s,throwOnError:o.throwOnError,query:a,suspense:o.suspense}))throw u.error;if((m=(p=i.getDefaultOptions().queries)==null?void 0:p._experimental_afterQuery)==null||m.call(p,o,u),o.experimental_prefetchInRender&&!Xr.isServer()&&$S(u,r)){const y=d?_d(o,f,s):a==null?void 0:a.promise;y==null||y.catch(Ze).finally(()=>{f.updateResult()})}return o.notifyOnChangeProps?u:f.trackResult(u)}function Or(e,t){return HS(e,CS)}function zS(e,t){const n=ps(),r=n.getQueryCache();return w.useSyncExternalStore(w.useCallback(s=>r.subscribe(Fe.batchCalls(s)),[r]),()=>n.isFetching(e),()=>n.isFetching(e))}const ip=C.createContext(null);function WS(e){return typeof window>"u"?e??null:e?(localStorage.setItem(Mm,e),e):null}function KS({token:e,children:t}){const n=WS(e);return c.jsx(ip.Provider,{value:n,children:t})}function qS(){return C.useContext(ip)}const kc="widget-accounts",Ac="widget-positions",Oc="widget-orders",hs="widget-deals",gs="widget-deals-total",GS=2e4,ZS=3e4;function qs(e){const t=String(e.getUTCDate()).padStart(2,"0"),n=String(e.getUTCMonth()+1).padStart(2,"0"),r=String(e.getUTCHours()).padStart(2,"0"),s=String(e.getUTCMinutes()).padStart(2,"0"),i=String(e.getUTCSeconds()).padStart(2,"0");return`${n}.${t} ${r}:${s}:${i}`}function op(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 ap(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=op(e);if(n!==void 0)return ap(n)}return 0}function Nc(e){if(e==null||e==="")return"—";if(typeof e=="number"&&Number.isFinite(e)){const t=e>1e12?e:e*1e3;return qs(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 s=r>1e12?r:r*1e3;return qs(new Date(s))}}const n=Date.parse(t);return Number.isFinite(n)?qs(new Date(n)):t}if(typeof e=="object"&&e!==null){const n=op(e);if(n!==void 0)return Nc(n)}return"—"}const cp=["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 YS(e){return qs(e)}const QS={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 Wi(e,t){for(const n of t)if(e[n]!==void 0&&e[n]!==null&&e[n]!=="")return e[n]}function ot(e,t){const n=Wi(e,t);if(n===void 0)return;const r=Number(n);return Number.isFinite(r)?r:void 0}function Ds(e,t){const n=Wi(e,t);if(n!==void 0)return String(n)}function XS(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 s=t[r];if(Array.isArray(s))return s.filter(i=>typeof i=="object"&&i!==null);if(s&&typeof s=="object"){const i=s,o=["list","items","records","orders","content","data"];for(const a of o){const l=i[a];if(Array.isArray(l))return l.filter(d=>typeof d=="object"&&d!==null)}}}return[]}function fa(e){return e===void 0?.01:e>=100?e/1e4:e}function JS(e,t){return Jf(t,e)}function e0(e){const t=Wi(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=ot(e,["type","Type","orderType","OrderType"])??2;return{label:QS[n]??(n%2===1?"sell":"buy"),side:ci(n),typeNum:n}}function t0(e,t){const n=ot(e,["volumeFilled","volume_filled","VolumeFilled","filledVolume","FilledVolume"]);if(n!==void 0)return fa(n);const r=ot(e,["volumeCurrent","volume_current","VolumeCurrent"]);return r!==void 0?fa(r):0}function n0(e,t){const n=Ds(e,["ticket","Ticket","order","Order","id","ID"]),r=Ds(e,["symbol","Symbol"])??"";if(!n||!r)return null;const s=Ke(r),{label:i,side:o,typeNum:a}=e0(e),l=ot(e,["typeTime","TypeTime"])??0,d=fa(ot(e,["volumeLots","volume_lots","VolumeLots","volume","Volume"])),f=t0(e),u=ot(e,["priceOrder","price_order","PriceOrder","openPrice","open_price","price","Price"])??0,g=ot(e,["priceTrigger","price_trigger","PriceTrigger","triggerPrice","TriggerPrice"]),h=ot(e,["currentPrice","current_price","PriceCurrent","priceCurrent","marketPrice","MarketPrice"])??u,v=ot(e,["stopLoss","stop_loss","PriceSL","sl","SL"]),p=ot(e,["takeProfit","take_profit","PriceTP","tp","TP"]),m=ot(e,["marketBid","MarketBid","bid","Bid"])??h,y=ot(e,["marketAsk","MarketAsk","ask","Ask"])??h,b=Ds(e,["comment","Comment"])??"",_=JS(e,s),x=Wi(e,cp),T=ap(x),S=Nc(x);return{ticket:n,login:Ds(e,["login","Login"])??t,symbol:s,displaySymbol:Ii(s),openTimeMs:T,time:S,typeLabel:i,orderType:a,typeTime:l,side:o,volumeLots:d,volumeFilledLots:f,orderPrice:u,priceTrigger:g,stopLoss:v,takeProfit:p,currentPrice:h,marketBid:m,marketAsk:y,comment:b,digits:_}}function r0(e,t){return XS(e).map(n=>n0(n,t)).filter(n=>n!==null)}function Ki(e,t){for(const n of t)if(e[n]!==void 0&&e[n]!==null&&e[n]!=="")return e[n]}function Gt(e,t){const n=Ki(e,t);if(n===void 0)return;const r=Number(n);return Number.isFinite(r)?r:void 0}function js(e,t){const n=Ki(e,t);if(n!==void 0)return String(n)}function s0(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 s=t[r];if(Array.isArray(s))return s.filter(i=>typeof i=="object"&&i!==null);if(s&&typeof s=="object"){const i=s,o=["list","items","records","positions","orders","content","data"];for(const a of o){const l=i[a];if(Array.isArray(l))return l.filter(d=>typeof d=="object"&&d!==null)}}}return[]}function i0(e){return e===void 0?.01:e>=100?e/1e4:e}function o0(e){const t=Ki(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=Gt(e,["type","Type","action","Action"]);return n!==void 0&&n%2===1?"sell":"buy"}function a0(e,t){return Jf(t,e)}function c0(e,t){const n=js(e,["ticket","Ticket","position","Position","order","Order","id","ID"]),r=js(e,["symbol","Symbol"])??"";if(!n||!r)return null;const s=Ke(r),i=o0(e),o=i0(Gt(e,["volumeLots","volume_lots","VolumeLots","volume","Volume"])),a=Gt(e,["openPrice","open_price","PriceOpen","priceOpen","price","Price"])??0,l=Gt(e,["currentPrice","current_price","PriceCurrent","priceCurrent"])??a,d=Gt(e,["stopLoss","stop_loss","PriceSL","sl","SL"]),f=Gt(e,["takeProfit","take_profit","PriceTP","tp","TP"]),u=Gt(e,["profit","Profit","floating","Floating","pnl","PnL"])??0,g=Gt(e,["swap","Swap"])??0,h=js(e,["comment","Comment"])??"",v=a0(e,s),p=Nc(Ki(e,cp));return{ticket:n,login:js(e,["login","Login"])??t,symbol:s,displaySymbol:Ii(s),time:p,type:i,volumeLots:o,openPrice:a,stopLoss:d,takeProfit:f,currentPrice:l,marketBid:l,marketAsk:l,swap:g,profit:u,comment:h,digits:v}}function l0(e,t){return s0(e).map(n=>c0(n,t)).filter(n=>n!==null)}function ys(){return Bt}function lp(){const e=dt(),t=qS(),{data:n,isLoading:r,isError:s}=Or({queryKey:[kc,e.baseUrl,t],queryFn:()=>e.getAccounts(),enabled:!!t,refetchInterval:ZS});return{accounts:n??[],isLoading:r,isError:s}}function d0(e){const t=dt();return Or({queryKey:[Ac,t.baseUrl,e],queryFn:()=>t.dealer.getPositions(e),enabled:!!e,refetchInterval:GS})}function u0(e){const t=dt();return Or({queryKey:[Oc,t.baseUrl,e],queryFn:()=>t.dealer.getOrders(e),enabled:!!e})}function f0(e,t){e.invalidateQueries({queryKey:[kc,t]})}function m0(e,t,n){e.invalidateQueries({queryKey:[gs,t,n]}),e.invalidateQueries({queryKey:[hs,t,n]})}function p0(){const e=ps(),t=dt();return C.useCallback(async n=>{await Promise.all([e.invalidateQueries({queryKey:[gs,t.baseUrl,n]}),e.invalidateQueries({queryKey:[hs,t.baseUrl,n]})])},[t.baseUrl,e])}function h0(){const e=ps(),t=dt();return C.useCallback(async n=>{await Promise.all([e.invalidateQueries({queryKey:[kc,t.baseUrl]}),e.invalidateQueries({queryKey:[Ac,t.baseUrl,n]}),e.invalidateQueries({queryKey:[Oc,t.baseUrl,n]}),e.invalidateQueries({queryKey:[gs,t.baseUrl,n]}),e.invalidateQueries({queryKey:[hs,t.baseUrl,n]})])},[t.baseUrl,e])}function g0(){const e=ps(),t=dt();return C.useCallback((n,r,s)=>{f0(e,t.baseUrl),e.invalidateQueries({queryKey:[Ac,t.baseUrl,n]}),(r===void 0||dc(r))&&e.invalidateQueries({queryKey:[Oc,t.baseUrl,n]}),(s==null?void 0:s.invalidateDeals)!==!1&&m0(e,t.baseUrl,n)},[t.baseUrl,e])}function qi(){const e=dt(),t=g0();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 s=await e.trading.closePosition(n);return s.success&&!(r!=null&&r.skipInvalidation)&&t(n.login),s},async deleteOrder(n){const r=await e.trading.deleteOrder(n);return r.success&&t(n.login,n.orderType),r},async modifyOrder(n,r){const s=await e.trading.modifyOrder(n,r);return s.success&&t(n.login,n.orderType),s},async modifyPosition(n,r){const s=await e.trading.modifyPosition(n,r);return s.success&&t(n.login),s}}}function y0(e){if(e===null||typeof e!="object")return{deals:[],offset:0,count:0};const t=e,n=t.data??t,s=(Array.isArray(n.deals)?n.deals:[]).map(i=>{const o=i??{};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:s,offset:Number(n.offset??0),count:Number(n.count??s.length)}}function b0(e){if(e===null||typeof e!="object")return{total:0};const t=e,n=t.data??t;return{total:Number(n.total??0)}}function v0(e,t,n,r={}){const s=dt();return Or({queryKey:[gs,s.baseUrl,e,t,n],queryFn:async()=>{const i=await s.dealer.getDealsTotal(e,t,n);return b0(i)},enabled:r.enabled??!0})}function w0(e,t,n,r,s,i={}){const o=dt();return Or({queryKey:[hs,o.baseUrl,e,t,n,r,s],queryFn:async()=>{const a=await o.dealer.getDeals(e,t,n,r,s);return y0(a)},enabled:i.enabled??!0})}function _0(e,t){return e!=null?l0(e,t):[]}function x0(e,t){return e!=null?r0(e,t):[]}function S0({symbolTicker:e,controlsRef:t,chartWidget:n,sidePanelTab:r,orderState:s,backUrl:i,createAccountUrl:o}){const{openMarketPanel:a,setSelectedLogin:l,hasConfirmedAccount:d}=s,f=ys();return C.useEffect(()=>(t.current={open:a,setSelectedLogin:l},()=>{t.current=null}),[t,a,l]),c.jsxs(c.Fragment,{children:[d?c.jsx(qm,{chartWidget:n,symbolTicker:e,symbols:f}):null,d?c.jsx($m,{}):null,c.jsx(Wx,{symbolTicker:e,sidePanelTab:r,orderState:s,backUrl:i,createAccountUrl:o})]})}const C0=8,xd=11;function T0({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 E0(){return c.jsx(c.Fragment,{children:Array.from({length:C0},(e,t)=>c.jsx("tr",{className:"web-trading-widget-terminal__skeleton-row",children:Array.from({length:xd},(n,r)=>c.jsx(T0,{wide:r===xd-1},r))},t))})}const P0={0:"Buy",1:"Sell",2:"Balance",3:"Credit",5:"-"},k0="web-trading-widget-text-buy",A0="web-trading-widget-text-sell",O0="web-trading-widget-terminal__head-row",Eo=50;function N0(e){return e===0?k0:e===1?A0:O0}const Sd=e=>e.toISOString().split("T")[0],dp=e=>Math.floor(new Date(e).getTime()/1e3),R0=e=>dp(e),L0=e=>dp(e)+86399;function D0(){const e=new Date,t=new Date;return t.setDate(t.getDate()-7),{fromTs:R0(Sd(t)),toTs:L0(Sd(e))}}const j0=e=>new Date(e*1e3).toLocaleString(void 0,{year:"numeric",month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"});function I0(e){try{return decodeURIComponent(e)}catch{return e}}function M0(){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 F0(){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:"Deal"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Login"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Symbol"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Action"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Volume"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Price"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Profit"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Entry"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Time"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Local time"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Comment"})]})})}function U0({deal:e}){const t=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 ${N0(e.action)}`,children:P0[e.action]??`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 ${t}`,children:[e.profit>0?"+":"",e.profit.toFixed(2)]}),c.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.entry===1?"OUT":"IN"}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--nowrap",children:YS(new Date(e.time*1e3))}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--nowrap",children:j0(e.time)}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--truncate",children:e.comment?I0(e.comment):"—"})]})}function B0({login:e,detailUrl:t}){const{fromTs:n,toTs:r}=C.useMemo(()=>D0(),[]),s=e!=="",{data:i,isLoading:o}=v0(e,n,r,{enabled:s}),a=(i==null?void 0:i.total)??0,l=Math.max(0,a-Eo),d=a>0?Math.min(Eo,a):Eo,{data:f,isLoading:u}=w0(e,n,r,l,d,{enabled:s}),g=s&&(o||u),h=C.useMemo(()=>[...(f==null?void 0:f.deals)??[]].sort((v,p)=>p.time-v.time),[f==null?void 0:f.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(M0,{}),c.jsx(F0,{}),c.jsxs("tbody",{children:[g?c.jsx(E0,{}):null,!g&&h.length===0?c.jsx("tr",{children:c.jsx("td",{colSpan:11,className:"web-trading-widget-terminal__empty-cell",children:"No deals found"})}):null,g?null:h.map(v=>c.jsx(U0,{deal:v},v.deal))]})]}),t?c.jsx("div",{className:"web-trading-widget-terminal__deals-footer",children:c.jsx("a",{href:t,className:"web-trading-widget-terminal__deals-detail-btn",children:"See full deal history"})}):null]})}):c.jsx("div",{className:"web-trading-widget-terminal__empty-cell",children:"Select an account to view deal history"})}function up(e,t=!0){const n=t&&e.trim()?e.trim():"",r=ge(u=>u.setPositions),s=ge(u=>u.setOrders),{data:i,isLoading:o,isError:a}=d0(n),{data:l,isLoading:d,isError:f}=u0(n);return C.useEffect(()=>{if(!n){r([]),s([]);return}i!=null&&r(_0(i,n)),l!=null&&s(x0(l,n))},[n,l,i,s,r]),{isLoading:t&&(o||d),isError:t&&!!(a||f)}}const Cd=224,Td=32,Rc=120;function fp(){return typeof window>"u"?560:Math.max(Rc,Math.floor(window.innerHeight*.7))}function $0(e){return Math.min(fp(),Math.max(Rc,e))}function V0(){const[e,t]=C.useState(Cd),[n,r]=C.useState(!1),s=C.useRef(Cd);C.useEffect(()=>{s.current=e},[e]);const i=C.useCallback(f=>{t($0(f))},[]),o=C.useCallback(()=>{i(s.current+Td)},[i]),a=C.useCallback(()=>{i(s.current-Td)},[i]),l=C.useCallback(f=>{const u=f,g=s.current;r(!0);const h=p=>{const m=u-p.clientY;i(g+m)},v=()=>{r(!1),document.removeEventListener("mousemove",h),document.removeEventListener("mouseup",v),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",h),document.addEventListener("mouseup",v),document.body.style.cursor="row-resize",document.body.style.userSelect="none"},[i]);C.useEffect(()=>{const f=()=>{i(s.current)};return window.addEventListener("resize",f),()=>{window.removeEventListener("resize",f),document.body.style.cursor="",document.body.style.userSelect=""}},[i]);const d=fp();return{height:e,isResizing:n,canIncrement:e<d,canDecrement:e>Rc,onResizeStart:l,incrementHeight:o,decrementHeight:a}}const H0=e=>e==null?void 0:e.replace(/(\d+)\.0{18}/g,"$1"),z0=2e4;let Po=0;function W0(){return Po=(Po+1)%Number.MAX_VALUE,Po.toString()}const ko=new Map,Ed=(e,t)=>{if(ko.has(e))return;const n=setTimeout(()=>{ko.delete(e),zr({type:"REMOVE_TOAST",toastId:e})},t||z0);ko.set(e,n)},K0=(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 s=e.toasts.find(i=>i.id===r);Ed(r,s==null?void 0:s.duration)}else e.toasts.forEach(s=>{Ed(s.id,s.duration)});return{...e,toasts:e.toasts.map(s=>s.id===r||r===void 0?{...s,open:!1}:s)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(r=>r.id!==t.toastId)}}},Gs=[];let Zs={toasts:[]};function zr(e){Zs=K0(Zs,e),Gs.forEach(t=>{t(Zs)})}function Te({duration:e=2e4,description:t,...n}){const r=W0(),s=typeof t=="string"?H0(t):t,i=a=>zr({type:"UPDATE_TOAST",toast:{...a,description:s,id:r}}),o=()=>{zr({type:"DISMISS_TOAST",toastId:r})};return zr({type:"ADD_TOAST",toast:{...n,description:s,id:r,open:!0,duration:e,onOpenChange:a=>{a||o()}}}),e&&setTimeout(o,e),{id:r,dismiss:o,update:i}}function q0(){const[e,t]=w.useState(Zs);return w.useEffect(()=>(Gs.push(t),()=>{const n=Gs.indexOf(t);n>-1&&Gs.splice(n,1)}),[e]),{...e,toast:Te,dismiss:n=>zr({type:"DISMISS_TOAST",toastId:n})}}function G0(e){return e.type==="buy"?e.marketBid??e.currentPrice:e.marketAsk??e.currentPrice}function Z0(){const{closePosition:e,deleteOrder:t}=qi(),n=h0(),r=ge(m=>m.removePosition),s=ge(m=>m.removeOrder),i=ge(m=>m.setSelectedPositionTicket),o=ge(m=>m.setSelectedOrderTicket),[a,l]=C.useState(new Set),[d,f]=C.useState(!1),u=C.useCallback((m,y)=>{l(b=>{const _=new Set(b);return y?_.add(m):_.delete(m),_})},[]),g=C.useCallback(m=>a.has(m),[a]),h=C.useCallback(async m=>{const y=`position-${m.ticket}`;u(y,!0);try{const b=await e(m);if(!b.success){Te({variant:"destructive",description:b.message||"Failed to close position."});return}r(m.ticket),i(null),Te({description:`Position #${m.ticket} closed at ${G0(m).toFixed(m.digits)}.`})}catch(b){const _=b instanceof Error?b.message:"Failed to close position.";Te({variant:"destructive",description:_})}finally{u(y,!1)}},[e,r,u,i]),v=C.useCallback(async m=>{var x;if(m.length===0||d)return;if(!e){Te({variant:"destructive",description:"Close position is not configured."});return}f(!0);let y=0,b=0;const _=((x=m[0])==null?void 0:x.login)??"";for(const T of m){const S=`position-${T.ticket}`;u(S,!0);try{if(!(await e(T,{skipInvalidation:!0})).success){b+=1;continue}r(T.ticket),y+=1}catch{b+=1}finally{u(S,!1)}}i(null),y>0&&_&&await n(_),Te(b===0?{description:y===1?"1 position closed.":`${y} positions closed.`}:y===0?{variant:"destructive",description:"Failed to close positions."}:{variant:"destructive",description:`Closed ${y}, failed ${b}.`}),f(!1)},[d,e,n,r,u,i]),p=C.useCallback(async m=>{const y=`order-${m.ticket}`;u(y,!0);try{const b=await t(m);if(!b.success){Te({variant:"destructive",description:b.message||"Failed to delete order."});return}s(m.ticket),o(null),Te({description:`Order #${m.ticket} deleted.`})}catch(b){const _=b instanceof Error?b.message:"Failed to delete order.";Te({variant:"destructive",description:_})}finally{u(y,!1)}},[t,s,u,o]);return{closePosition:h,closeAllPositions:v,deleteOrder:p,isClosingAll:d,isRowBusy:g}}function Zt(e,t=2){return e.toFixed(t)}function mp(e){return e.reduce((t,n)=>t+n.profit+n.swap,0)}function Y0(e,t,n){const r=(e==null?void 0:e.balance)??0,s=(e==null?void 0:e.credit)??0,i=(e==null?void 0:e.margin)??0;if(!e||t.length===0)return{balance:r,equity:(e==null?void 0:e.equity)??r+s,margin:i,marginFree:(e==null?void 0:e.marginFree)??0,marginLevel:e==null?void 0:e.marginLevel,totalProfit:0};const o=mp(t),a=r+s+o+n,l=a-i,d=i>0?a/i*100:void 0;return{balance:r,equity:a,margin:i,marginFree:l,marginLevel:d,totalProfit:o}}function ma(){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 Q0(){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:"Symbol"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Ticket"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Server time"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Type"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Volume"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Price"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"S / L"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"T / P"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Price"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Swap"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Profit"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Comment"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--close","aria-label":"Close"})]})})}function X0({balance:e,equity:t,margin:n,marginFree:r,marginLevel:s,totalPnL:i,scrollRef:o,onScroll:a}){const l=i>0?"web-trading-widget-text-profit-positive":i<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(ma,{}),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:["Balance: ",Zt(e)]}),c.jsxs("span",{children:["Equity: ",Zt(t)]}),c.jsxs("span",{children:["Margin: ",Zt(n)]}),c.jsxs("span",{children:["Free margin: ",Zt(r)]}),c.jsxs("span",{children:["Level: ",s!==void 0?`${Zt(s,2)}%`:"0.00%"]})]})}),c.jsx("td",{className:`web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right ${l}`,children:Zt(i)}),c.jsx("td",{className:"web-trading-widget-terminal__cell"}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--close"})]})})]})})})}const J0=[{id:"trade",label:"Trade"},{id:"history",label:"History"}];function eC({activeTab:e,onTabChange:t,positionCount:n,isClosingAll:r,onCloseAllPositions:s,isRefetchingDeals:i,onRefetchDeals:o}){const a=e==="trade"&&(n>0||r),l=e==="history";return c.jsxs("div",{role:"tablist","aria-label":"Terminal panel tabs",className:"web-trading-widget-terminal__tab-bar",children:[J0.map(d=>{const f=e===d.id;return c.jsx("button",{type:"button",role:"tab","aria-selected":f,onClick:()=>t(d.id),className:`web-trading-widget-terminal__tab-btn${f?" web-trading-widget-terminal__tab-btn--active":""}`,children:d.label},d.id)}),c.jsxs("div",{className:"web-trading-widget-terminal__toolbar-actions",children:[a?c.jsx("button",{type:"button",disabled:r,onClick:s,className:"web-trading-widget-terminal__close-all-btn",children:r?"Closing…":"Close all"}):null,l?c.jsxs("button",{type:"button",disabled:i,onClick:o,className:"web-trading-widget-terminal__refetch-btn","aria-label":"Refresh deal history",children:[c.jsx(zv,{className:`web-trading-widget-icon web-trading-widget-icon--sm${i?" web-trading-widget-terminal__refetch-icon--spinning":""}`}),i?"Refreshing…":"Refresh"]}):null]})]})}function tC({position:e,isSelected:t,isClosing:n,onSelect:r,onClose:s}){const i=e.type==="buy"?"web-trading-widget-text-buy":"web-trading-widget-text-sell",o=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 ${i}`,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):"N/A"}),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):"N/A"}),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?Zt(e.swap):""}),c.jsx("td",{className:`web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right ${o}`,children:Zt(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":`Close position #${e.ticket}`,title:"Close position",disabled:n,className:"web-trading-widget-terminal__row-close-btn",onClick:a=>{a.stopPropagation(),s()},children:c.jsx(gn,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})})})]})}function nC({order:e,isSelected:t,isDeleting:n,onSelect:r,onDelete:s}){const i=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 ${i}`,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):"N/A"}),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):"N/A"}),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":`Delete order #${e.ticket}`,title:"Delete order",disabled:n,className:"web-trading-widget-terminal__row-close-btn",onClick:o=>{o.stopPropagation(),s()},children:c.jsx(gn,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})})})]})}function pp({embedded:e=!1,symbolTicker:t="",onSymbolChange:n,onCreateNewOrder:r,dealDetailUrl:s,tradeDataEnabled:i=!1}){const[o,a]=C.useState("trade"),l=ys(),{accounts:d,isLoading:f}=lp(),u=V0(),{height:g,isResizing:h,onResizeStart:v}=e?{height:0,isResizing:!1,onResizeStart:()=>{}}:u,p=ge(z=>z.selectedLogin),m=ge(z=>z.selectedPositionTicket),y=ge(z=>z.selectedOrderTicket),b=ge(z=>z.setSelectedPositionTicket),_=ge(z=>z.setSelectedOrderTicket),{isLoading:x}=up(p,i),T=ge(z=>z.positions),S=ge(z=>z.orders),{closePosition:E,closeAllPositions:O,deleteOrder:R,isClosingAll:M,isRowBusy:N}=Z0(),L=p0(),V=dt(),j=zS({predicate:z=>{const we=z.queryKey;return p?(we[0]===hs||we[0]===gs)&&we[1]===V.baseUrl&&we[2]===p:!1}})>0,U=f||x,D=C.useMemo(()=>p?T.filter(z=>z.login===p):T,[T,p]),$=C.useMemo(()=>p?S.filter(z=>z.login===p):S,[S,p]),A=C.useMemo(()=>{const z=d.find(we=>we.login===p);return(z==null?void 0:z.tradeStat)??null},[d,p]),F=C.useMemo(()=>D.map(z=>z.ticket).sort().join("|"),[D]),W=C.useMemo(()=>A?`${A.balance}:${A.credit??0}:${A.equity}:${A.margin}|${F}`:"",[A,F]),I=C.useMemo(()=>{if(!A||D.length===0)return 0;const z=mp(D);return A.equity-A.balance-(A.credit??0)-z},[W]),ee=C.useMemo(()=>Y0(A,D,I),[A,D,I]),J=D.length===0&&$.length===0,ue=C.useRef(null),me=C.useRef(null),B=C.useRef(null),K=C.useCallback(()=>{O(D)},[O,D]),de=C.useCallback(()=>{p&&L(p)},[L,p]),fe=C.useCallback(z=>{const we=nw(z,l);we&&(n==null||n(we))},[n,l]),ce=C.useCallback(z=>{b(z.ticket),fe(z.symbol)},[b,fe]),le=C.useCallback(z=>{_(z.ticket),fe(z.symbol)},[_,fe]),ne=C.useCallback(z=>{const we=ue.current,Ae=me.current,Q=B.current;if(!we||!Ae)return;const ke=z==="header"?we.scrollLeft:z==="body"?Ae.scrollLeft:(Q==null?void 0:Q.scrollLeft)??0;z!=="header"&&(we.scrollLeft=ke),z!=="body"&&(Ae.scrollLeft=ke),Q&&z!=="footer"&&(Q.scrollLeft=ke)},[]);return c.jsxs(c.Fragment,{children:[!e&&h?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:g},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":"Resize terminal panel","aria-valuenow":g,className:"web-trading-widget-terminal__resize-bar",onMouseDown:z=>{z.preventDefault(),v(z.clientY)},children:c.jsx(Qf,{className:"web-trading-widget-icon web-trading-widget-icon--sm web-trading-widget-terminal__resize-icon"})})}),c.jsx(eC,{activeTab:o,onTabChange:a,positionCount:D.length,isClosingAll:M,onCloseAllPositions:K,isRefetchingDeals:j,onRefetchDeals:de}),o==="trade"?c.jsxs(c.Fragment,{children:[c.jsx("div",{ref:ue,className:"web-trading-widget-terminal__header-scroll",onScroll:()=>ne("header"),children:c.jsxs("table",{className:"web-trading-widget-terminal__table",children:[c.jsx(ma,{}),c.jsx(Q0,{})]})}),c.jsx("div",{ref:me,className:"web-trading-widget-terminal__body-scroll",onScroll:()=>ne("body"),children:c.jsxs("table",{className:"web-trading-widget-terminal__table",children:[c.jsx(ma,{}),c.jsxs("tbody",{children:[U&&J?c.jsx("tr",{children:c.jsx("td",{colSpan:13,className:"web-trading-widget-terminal__empty-cell",children:"Loading…"})}):null,!U&&J?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:"You don't have any positions"}),r?c.jsx("button",{type:"button",onClick:r,className:"web-trading-widget-terminal__create-btn",children:"Create New Order"}):null]})})}):null,D.map(z=>c.jsx(tC,{position:z,isSelected:m===z.ticket,isClosing:N(`position-${z.ticket}`),onSelect:()=>ce(z),onClose:()=>void E(z)},`position-${z.ticket}`)),$.map(z=>c.jsx(nC,{order:z,isSelected:y===z.ticket,isDeleting:N(`order-${z.ticket}`),onSelect:()=>le(z),onDelete:()=>void R(z)},`order-${z.ticket}`))]})]})})]}):c.jsx(B0,{login:p??"",detailUrl:s}),c.jsx(X0,{balance:ee.balance,equity:ee.equity,margin:ee.margin,marginFree:ee.marginFree,marginLevel:ee.marginLevel,totalPnL:ee.totalProfit,scrollRef:o==="trade"?B:void 0,onScroll:o==="trade"?()=>ne("footer"):void 0})]})]})}const pa=224,pi=120;function rC(e){var n;const t=(n=e==null?void 0:e.current)==null?void 0:n.clientHeight;return t&&t>0?Math.max(pi,Math.floor(t*.35)):pa}function sC(e){var n;const t=(n=e==null?void 0:e.current)==null?void 0:n.clientHeight;return t&&t>0?Math.max(pi,Math.floor(t*.85)):typeof window>"u"?560:Math.max(pi,Math.floor(window.innerHeight*.7))}function iC(e,t){return Math.min(sC(t),Math.max(pi,e))}function oC({containerRef:e,isOpen:t=!1}={}){const[n,r]=C.useState(pa),[s,i]=C.useState(!1),o=C.useRef(pa);C.useEffect(()=>{o.current=n},[n]);const a=C.useCallback(d=>{r(iC(d,e))},[e]);C.useEffect(()=>{if(!t)return;const d=Math.max(o.current,rC(e));a(d)},[e,t,a]);const l=C.useCallback(d=>{const f=d,u=o.current;i(!0);const g=v=>{const p=f-v.clientY;a(u+p)},h=()=>{i(!1),document.removeEventListener("mousemove",g),document.removeEventListener("mouseup",h),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",g),document.addEventListener("mouseup",h),document.body.style.cursor="row-resize",document.body.style.userSelect="none"},[a]);return C.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:s,onResizeStart:l}}function hp({children:e}){const[t]=C.useState(()=>new NS({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}}));return c.jsx(RS,{client:t,children:e})}function gp({containerRef:e,onCreateNewOrder:t,tradeDataEnabled:n=!1}){const[r,s]=C.useState(!1),{height:i,isResizing:o,onResizeStart:a}=oC({containerRef:e,isOpen:r}),l=ge(p=>p.selectedLogin),d=ge(p=>p.orders),f=ge(p=>p.positions),u=C.useMemo(()=>l?d.filter(p=>p.login===l):d,[l,d]),g=C.useMemo(()=>l?f.filter(p=>p.login===l):f,[l,f]),h=u.length+g.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":"Open terminal","aria-expanded":r,onClick:()=>s(!0),children:[c.jsx(Bv,{className:"web-trading-widget-icon web-trading-widget-icon--sm"}),c.jsx("span",{children:"Orders"}),h>0?c.jsx("span",{className:"web-trading-widget-news-orders-overlay__badge",children:h}):null]}),r?c.jsx(c.Fragment,{children:c.jsxs("div",{className:"web-trading-widget-news-orders__panel",style:{height:i},children:[o?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":"Resize terminal panel","aria-valuenow":i,className:"web-trading-widget-terminal__resize-bar",onMouseDown:p=>{p.preventDefault(),a(p.clientY)},children:c.jsx(Qf,{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:"Terminal"}),c.jsx("button",{type:"button",className:"web-trading-widget-news-orders__panel-close","aria-label":"Close terminal panel",onClick:()=>s(!1),children:c.jsx(gn,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})})]}),c.jsx("div",{className:"web-trading-widget-news-orders__panel-body",children:c.jsx(pp,{embedded:!0,onCreateNewOrder:t?v:void 0,tradeDataEnabled:n})})]})}):null]})}function aC({baseUrl:e,containerRef:t,onCreateNewOrder:n}){return c.jsx(hp,{children:c.jsx(Um,{baseUrl:e,children:c.jsx(gp,{containerRef:t,onCreateNewOrder:n})})})}const Rn=C.forwardRef(({className:e,type:t,...n},r)=>c.jsx("input",{type:t,className:Pe("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}));Rn.displayName="Input";var Gi="Collapsible",[cC,yp]=Bn(Gi),[lC,Lc]=cC(Gi),bp=w.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:s,disabled:i,onOpenChange:o,...a}=e,[l,d]=Ln({prop:r,defaultProp:s??!1,onChange:o,caller:Gi});return c.jsx(lC,{scope:n,disabled:i,contentId:on(),open:l,onOpenToggle:w.useCallback(()=>d(f=>!f),[d]),children:c.jsx(ye.div,{"data-state":jc(l),"data-disabled":i?"":void 0,...a,ref:t})})});bp.displayName=Gi;var vp="CollapsibleTrigger",wp=w.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,s=Lc(vp,n);return c.jsx(ye.button,{type:"button","aria-controls":s.open?s.contentId:void 0,"aria-expanded":s.open||!1,"data-state":jc(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...r,ref:t,onClick:he(e.onClick,s.onOpenToggle)})});wp.displayName=vp;var Dc="CollapsibleContent",_p=w.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=Lc(Dc,e.__scopeCollapsible);return c.jsx($n,{present:n||s.open,children:({present:i})=>c.jsx(dC,{...r,ref:t,present:i})})});_p.displayName=Dc;var dC=w.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:s,...i}=e,o=Lc(Dc,n),[a,l]=w.useState(r),d=w.useRef(null),f=Ne(t,d),u=w.useRef(0),g=u.current,h=w.useRef(0),v=h.current,p=o.open||a,m=w.useRef(p),y=w.useRef(void 0);return w.useEffect(()=>{const b=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(b)},[]),Ie(()=>{const b=d.current;if(b){y.current=y.current||{transitionDuration:b.style.transitionDuration,animationName:b.style.animationName},b.style.transitionDuration="0s",b.style.animationName="none";const _=b.getBoundingClientRect();u.current=_.height,h.current=_.width,m.current||(b.style.transitionDuration=y.current.transitionDuration,b.style.animationName=y.current.animationName),l(r)}},[o.open,r]),c.jsx(ye.div,{"data-state":jc(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!p,...i,ref:f,style:{"--radix-collapsible-content-height":g?`${g}px`:void 0,"--radix-collapsible-content-width":v?`${v}px`:void 0,...e.style},children:p&&s})});function jc(e){return e?"open":"closed"}var uC=bp,fC=wp,mC=_p,xt="Accordion",pC=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[Ic,hC,gC]=$a(xt),[Zi]=Bn(xt,[gC,yp]),Mc=yp(),xp=w.forwardRef((e,t)=>{const{type:n,...r}=e,s=r,i=r;return c.jsx(Ic.Provider,{scope:e.__scopeAccordion,children:n==="multiple"?c.jsx(wC,{...i,ref:t}):c.jsx(vC,{...s,ref:t})})});xp.displayName=xt;var[Sp,yC]=Zi(xt),[Cp,bC]=Zi(xt,{collapsible:!1}),vC=w.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},collapsible:i=!1,...o}=e,[a,l]=Ln({prop:n,defaultProp:r??"",onChange:s,caller:xt});return c.jsx(Sp,{scope:e.__scopeAccordion,value:w.useMemo(()=>a?[a]:[],[a]),onItemOpen:l,onItemClose:w.useCallback(()=>i&&l(""),[i,l]),children:c.jsx(Cp,{scope:e.__scopeAccordion,collapsible:i,children:c.jsx(Tp,{...o,ref:t})})})}),wC=w.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},...i}=e,[o,a]=Ln({prop:n,defaultProp:r??[],onChange:s,caller:xt}),l=w.useCallback(f=>a((u=[])=>[...u,f]),[a]),d=w.useCallback(f=>a((u=[])=>u.filter(g=>g!==f)),[a]);return c.jsx(Sp,{scope:e.__scopeAccordion,value:o,onItemOpen:l,onItemClose:d,children:c.jsx(Cp,{scope:e.__scopeAccordion,collapsible:!0,children:c.jsx(Tp,{...i,ref:t})})})}),[_C,Yi]=Zi(xt),Tp=w.forwardRef((e,t)=>{const{__scopeAccordion:n,disabled:r,dir:s,orientation:i="vertical",...o}=e,a=w.useRef(null),l=Ne(a,t),d=hC(n),u=Ju(s)==="ltr",g=he(e.onKeyDown,h=>{var O;if(!pC.includes(h.key))return;const v=h.target,p=d().filter(R=>{var M;return!((M=R.ref.current)!=null&&M.disabled)}),m=p.findIndex(R=>R.ref.current===v),y=p.length;if(m===-1)return;h.preventDefault();let b=m;const _=0,x=y-1,T=()=>{b=m+1,b>x&&(b=_)},S=()=>{b=m-1,b<_&&(b=x)};switch(h.key){case"Home":b=_;break;case"End":b=x;break;case"ArrowRight":i==="horizontal"&&(u?T():S());break;case"ArrowDown":i==="vertical"&&T();break;case"ArrowLeft":i==="horizontal"&&(u?S():T());break;case"ArrowUp":i==="vertical"&&S();break}const E=b%y;(O=p[E].ref.current)==null||O.focus()});return c.jsx(_C,{scope:n,disabled:r,direction:s,orientation:i,children:c.jsx(Ic.Slot,{scope:n,children:c.jsx(ye.div,{...o,"data-orientation":i,ref:l,onKeyDown:r?void 0:g})})})}),hi="AccordionItem",[xC,Fc]=Zi(hi),Ep=w.forwardRef((e,t)=>{const{__scopeAccordion:n,value:r,...s}=e,i=Yi(hi,n),o=yC(hi,n),a=Mc(n),l=on(),d=r&&o.value.includes(r)||!1,f=i.disabled||e.disabled;return c.jsx(xC,{scope:n,open:d,disabled:f,triggerId:l,children:c.jsx(uC,{"data-orientation":i.orientation,"data-state":Rp(d),...a,...s,ref:t,disabled:f,open:d,onOpenChange:u=>{u?o.onItemOpen(r):o.onItemClose(r)}})})});Ep.displayName=hi;var Pp="AccordionHeader",kp=w.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=Yi(xt,n),i=Fc(Pp,n);return c.jsx(ye.h3,{"data-orientation":s.orientation,"data-state":Rp(i.open),"data-disabled":i.disabled?"":void 0,...r,ref:t})});kp.displayName=Pp;var ha="AccordionTrigger",Ap=w.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=Yi(xt,n),i=Fc(ha,n),o=bC(ha,n),a=Mc(n);return c.jsx(Ic.ItemSlot,{scope:n,children:c.jsx(fC,{"aria-disabled":i.open&&!o.collapsible||void 0,"data-orientation":s.orientation,id:i.triggerId,...a,...r,ref:t})})});Ap.displayName=ha;var Op="AccordionContent",Np=w.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=Yi(xt,n),i=Fc(Op,n),o=Mc(n);return c.jsx(mC,{role:"region","aria-labelledby":i.triggerId,"data-orientation":s.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}})});Np.displayName=Op;function Rp(e){return e?"open":"closed"}var SC=xp,CC=Ep,TC=kp,Lp=Ap,Dp=Np;const EC=SC,qn=w.forwardRef(({className:e,...t},n)=>c.jsx(CC,{ref:n,className:Pe("border-b",e),...t}));qn.displayName="AccordionItem";const Gn=w.forwardRef(({className:e,children:t,...n},r)=>c.jsx(TC,{className:"flex",children:c.jsxs(Lp,{ref:r,className:Pe("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(oc,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"})]})}));Gn.displayName=Lp.displayName;const Zn=w.forwardRef(({className:e,children:t,...n},r)=>c.jsx(Dp,{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:Pe("pb-4 pt-0",e),children:t})}));Zn.displayName=Dp.displayName;function Pd(e){const t=e.trim().replace(/,/g,"");if(!t||t===".")return null;const n=Number(t);return Number.isFinite(n)?n:null}function kd(e,t){return t<=0?String(Math.round(e)):e.toFixed(t)}function PC(e,t){const n=e.replace(/,/g,"").replace(/[^\d.]/g,""),r=n.indexOf(".");if(r===-1)return n;const s=n.slice(0,r),i=n.slice(r+1).replace(/\./g,""),o=t>0?i.slice(0,t):"";return`${s}.${o}`}function kC(e){const t=e.trim();return!t||t==="."?"":t.endsWith(".")?t.slice(0,-1):t}function De({label:e,value:t,onChange:n,step:r=.01,min:s,decimals:i=2,placeholder:o,basePrice:a,disabled:l=!1,clearable:d=!1}){const[f,u]=C.useState(t),[g,h]=C.useState(!1),v=g?f:t,p=v.trim()!=="",m=!d;C.useEffect(()=>{g||u(t)},[g,t]);const y=()=>a!=null&&Number.isFinite(a)?a:s??0,b=O=>{u(O),n(O)},_=O=>{if(l)return;const R=y(),M=Pd(v),N=v.trim()!=="";let L;!N||M===null?L=O===1?R:R-r:L=M+O*r;const V=s!==void 0?Math.max(s,L):L;if(V<=0)return;const j=kd(V,i);h(!1),b(j)},x=()=>{h(!0),u(t)},T=()=>{h(!1);const O=kC(f);if(!O){f.trim()!==""&&b("");return}const R=Pd(O);if(R===null||R<=0){b("");return}if(m){b(kd(R,i));return}b(O)},S=O=>{u(PC(O,i))},E=()=>{l||(h(!1),b(""))};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&&p?c.jsx("button",{type:"button","aria-label":`Clear ${e}`,className:"web-trading-widget-stepper__clear",disabled:l,onClick:E,children:c.jsx(gn,{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&&v.trim()==="",onClick:()=>_(-1),children:c.jsx(Vv,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})}),c.jsx("input",{type:"text",inputMode:"decimal",pattern:"[0-9]*[.]?[0-9]*",value:v,placeholder:o,disabled:l,onFocus:x,onChange:O=>S(O.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&&v.trim()==="",onClick:()=>_(1),children:c.jsx(Hv,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})})]})]})}function AC({symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:s,minVolumeLots:i,isSubmitting:o,isAccountsLoading:a,selectedLogin:l,embedded:d=!1,onMinimize:f,onClose:u,onPlaceOrder:g}){const[h,v]=C.useState("market"),[p,m]=C.useState(String(r)),[y,b]=C.useState(""),[_,x]=C.useState(""),T=ie(se=>se.stopLoss),S=ie(se=>se.takeProfit),E=ie(se=>se.setStopLoss),O=ie(se=>se.setTakeProfit),R=ie(se=>se.setVolumeLots),M=ie(se=>se.setOrderSide),[N,L]=C.useState(""),[V,j]=C.useState(gt.GTC),[U,D]=C.useState(""),[$,A]=C.useState(""),F=Number(Vt(Ht(e))),W=Pr(F),I=hc(t,n),ee=t!==null?Ce(t,F):"—",J=n!==null?Ce(n,F):"—",ue=Fi(h),me=em(h),B=Mi(h),K=B.label,de=!ue&&B.orderType!==null&&B.orderType%2===1,fe=C.useMemo(()=>I!==null?I:t??n,[n,t,I]),ce=se=>{m(se);const Ve=Number(se);Number.isFinite(Ve)&&Ve>0&&R(Ve)},le=se=>t===null||n===null?null:ue?se==="buy"?n:t:Ue(y)??(se==="buy"?n:t),ne=se=>{const Ve=le(se);Ve!==null&&M({side:se,entryPrice:Ve})},z=se=>{if(t===null||n===null||!l)return;const Ve=Math.max(i,Number(p)||i),Ji=zo(h,se),vs=le(se);vs!==null&&M({side:se,entryPrice:vs}),g({login:l,executionMode:h,side:se,orderType:Ji,volumeLots:Ve,stopLoss:T,takeProfit:S,priceOrder:y,priceTrigger:_,comment:N,typeTime:V,expirationDateTime:U,expirationDay:$,bid:t,ask:n})},we=t!==null&&n!==null,Ae=ue||Ue(y)!==void 0,Q=!me||Ue(_)!==void 0,ke=ue||Bi(V,U,$),Be=!o&&!a&&l!==""&&we&&Ae&&Q&&ke,Xe=!ue&&fc(V),ft=!ue&&mc(V);return c.jsxs("div",{className:"web-trading-widget-market-panel",children:[c.jsxs("div",{className:"web-trading-widget-market-panel__header",children:[c.jsxs(si,{value:h,onValueChange:se=>v(se),children:[c.jsx(Kr,{className:"web-trading-widget-market-panel__select-trigger",children:c.jsx(ii,{})}),c.jsx(qr,{children:ai.map(se=>c.jsx(Gr,{value:se.mode,children:se.label},se.mode))})]}),d?null:c.jsxs("div",{className:"web-trading-widget-market-panel__header-actions",children:[c.jsx("button",{type:"button","aria-label":"Minimize to quick order panel",className:"web-trading-widget-market-panel__header-btn",onClick:f,children:c.jsx($v,{className:"web-trading-widget-icon web-trading-widget-icon--md"})}),c.jsx("button",{type:"button","aria-label":"Close order panel",className:"web-trading-widget-market-panel__header-btn",onClick:u,children:c.jsx(gn,{className:"web-trading-widget-icon web-trading-widget-icon--md"})})]})]}),c.jsxs(EC,{type:"multiple",defaultValue:["volume-setting","risk-management"],className:"web-trading-widget-market-panel__accordion",children:[c.jsxs(qn,{value:"volume-setting",className:"web-trading-widget-market-panel__accordion-item",children:[c.jsx(Gn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Volume Setting"}),c.jsx(Zn,{className:"web-trading-widget-market-panel__accordion-content",children:c.jsx(De,{label:"Lots",value:p,onChange:ce,step:s,min:i,decimals:2})})]}),ue?null:c.jsxs(qn,{value:"order-price",className:"web-trading-widget-market-panel__accordion-item",children:[c.jsx(Gn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Order Price"}),c.jsx(Zn,{className:"web-trading-widget-market-panel__accordion-content",children:me?c.jsxs(c.Fragment,{children:[c.jsx(De,{label:"Stop Price",value:_,onChange:x,step:W,decimals:F,basePrice:fe,placeholder:I!==null?Ce(I,F):"—"}),c.jsx(De,{label:"Limit Price",value:y,onChange:b,step:W,decimals:F,basePrice:fe,placeholder:I!==null?Ce(I,F):"—"})]}):c.jsx(De,{label:"Price",value:y,onChange:b,step:W,decimals:F,basePrice:fe,placeholder:I!==null?Ce(I,F):"—"})})]}),c.jsxs(qn,{value:"risk-management",className:"web-trading-widget-market-panel__accordion-item",children:[c.jsx(Gn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Risk Management"}),c.jsx(Zn,{className:"web-trading-widget-market-panel__accordion-content",children:c.jsxs("div",{className:"web-trading-widget-market-panel__grid-2",children:[c.jsx(De,{label:"Stop Loss",value:T,onChange:E,step:W,decimals:F,basePrice:t,placeholder:t!==null?ee:"—",clearable:!0}),c.jsx(De,{label:"Take Profit",value:S,onChange:O,step:W,decimals:F,basePrice:n,placeholder:n!==null?J:"—",clearable:!0})]})})]}),ue?null:c.jsxs(qn,{value:"expiration",className:"web-trading-widget-market-panel__accordion-item",children:[c.jsx(Gn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Expiration"}),c.jsxs(Zn,{className:"web-trading-widget-market-panel__accordion-content",children:[c.jsxs(si,{value:String(V),onValueChange:se=>j(Number(se)),children:[c.jsx(Kr,{className:"web-trading-widget-market-panel__select-full",children:c.jsx(ii,{})}),c.jsx(qr,{children:tm.map(se=>c.jsx(Gr,{value:String(se.value),children:se.label},se.value))})]}),Xe?c.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[c.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Expiration time"}),c.jsx(Rn,{type:"datetime-local",value:U,onChange:se=>D(se.target.value)})]}):null,ft?c.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[c.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Expiration day"}),c.jsx(Rn,{type:"date",value:$,onChange:se=>A(se.target.value)})]}):null]})]}),c.jsxs(qn,{value:"comment",className:"web-trading-widget-market-panel__accordion-item",children:[c.jsx(Gn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Comment"}),c.jsx(Zn,{className:"web-trading-widget-market-panel__accordion-content",children:c.jsx(Rn,{value:N,onChange:se=>L(se.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:ee}),c.jsx("span",{className:"web-trading-widget-market-panel__quotes-ask",children:J})]}),ue?c.jsxs("div",{className:"web-trading-widget-market-panel__actions",children:[c.jsx(ct,{type:"button",variant:"destructive",className:"web-trading-widget-market-panel__sell-btn",disabled:!Be,onMouseDown:()=>ne("sell"),onClick:()=>z("sell"),children:"Sell by Market"}),c.jsx(ct,{type:"button",className:"web-trading-widget-market-panel__buy-btn",disabled:!Be,onMouseDown:()=>ne("buy"),onClick:()=>z("buy"),children:"Buy by Market"})]}):c.jsxs(ct,{type:"button",variant:de?"destructive":"default",className:`web-trading-widget-market-panel__place-btn${de?"":" web-trading-widget-market-panel__place-btn--buy"}`,disabled:!Be,onMouseDown:()=>{const se=B.orderType!==null&&B.orderType%2===1?"sell":"buy";ne(se)},onClick:()=>{const se=B.orderType!==null&&B.orderType%2===1?"sell":"buy";z(se)},children:["Place ",K]})]})]})}function jp({confirmation:e,symbolTicker:t,onDismiss:n}){const r=Number(Vt(Ht(t))),s=Ce(e.price,r),i=e.side==="sell"?"sell":"buy",o=Ii(e.symbol||Ui(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":"Close confirmation",className:"web-trading-widget-confirmation__close-btn",onClick:n,children:c.jsx(gn,{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:i})," ",e.volumeLots.toFixed(2)," ",o]}),c.jsxs("p",{className:"web-trading-widget-confirmation__price",children:["at ",s]}),c.jsx("p",{className:"web-trading-widget-confirmation__status",children:"Placed"}),c.jsx(ct,{type:"button",className:"web-trading-widget-confirmation__ok-btn",onClick:n,children:"OK"})]})]})}function Is(e,t){return e.toLocaleString(void 0,{minimumFractionDigits:t,maximumFractionDigits:t})}function $r(e){if(!(e===void 0||e===0))return e}function Ad(e,t){return e===void 0||e===0?"":Ce(e,t)}function Od(e,t){const n=Ue(e);if(n!==void 0)return n;if($r(t)!==void 0)return 0}function Ip({order:e,onClose:t}){const{deleteOrder:n,modifyOrder:r}=qi(),s=ge(B=>B.removeOrder),i=ge(B=>B.liveQuotes),[o,a]=C.useState(String(e.volumeLots)),[l,d]=C.useState(String(e.orderPrice)),[f,u]=C.useState(e.priceTrigger!==void 0?String(e.priceTrigger):""),g=ie(B=>B.stopLoss),h=ie(B=>B.takeProfit),v=ie(B=>B.setStopLoss),p=ie(B=>B.setTakeProfit),m=ie(B=>B.setDraft),y=ie(B=>B.clearDraft),[b,_]=C.useState(e.comment),[x,T]=C.useState(!1),[S,E]=C.useState(!1),O=Pr(e.digits),R=Ke(e.symbol).toUpperCase(),M=i[R],N=(M==null?void 0:M.bid)??e.marketBid??null,L=(M==null?void 0:M.ask)??e.marketAsk??null,V=N!==null?Ce(N,e.digits):"—",j=L!==null?Ce(L,e.digits):"—",U=C.useMemo(()=>e.orderPrice>0?e.orderPrice:hc(N,L)??N??L,[L,N,e.orderPrice]);C.useEffect(()=>(m({source:"order",entryPrice:e.orderPrice,stopLoss:Ad(e.stopLoss,e.digits),takeProfit:Ad(e.takeProfit,e.digits),side:e.side,showEntryLine:!0,volumeLots:e.volumeLots,digits:e.digits,priceStep:O}),()=>{y()}),[y,e.digits,e.orderPrice,e.side,e.stopLoss,e.takeProfit,e.volumeLots,O,m]);const D=uc(e.orderType),$=e.volumeLots,A=Number(l)||e.orderPrice,F=Ue(f),W=x||S,ee=(A!==e.orderPrice||(D?F!==e.priceTrigger:!1)||$r(Ue(g))!==$r(e.stopLoss)||$r(Ue(h))!==$r(e.takeProfit)||b.trim()!==e.comment.trim())&&(!D||F!==void 0&&Number.isFinite(A)&&A>0),J=C.useMemo(()=>`Delete #${e.ticket} ${e.typeLabel} ${$.toFixed(2)} ${e.displaySymbol} at ${Is(A,e.digits)}`,[e,A,$]),ue=async()=>{if(!ee){Te({variant:"destructive",description:D?"Please set both stop and limit prices.":"Please set an order price."});return}T(!0);try{const B=await r(e,{volumeLots:$,priceOrder:A,priceTrigger:D?F:void 0,stopLoss:Od(g,e.stopLoss),takeProfit:Od(h,e.takeProfit),comment:b.trim()||"order modify"});if(!B.success){Te({variant:"destructive",description:B.message||"Failed to modify order."});return}t(),Te({description:`Order #${e.ticket} updated.`})}catch(B){const K=B instanceof Error?B.message:"Failed to modify order.";Te({variant:"destructive",description:K})}finally{T(!1)}},me=async()=>{E(!0);try{const B=await n(e);if(!B.success){Te({variant:"destructive",description:B.message||"Failed to delete order."});return}s(e.ticket),t(),Te({description:`Order #${e.ticket} deleted.`})}catch(B){const K=B instanceof Error?B.message:"Failed to delete order.";Te({variant:"destructive",description:K})}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," ",$.toFixed(2)," / ",e.volumeFilledLots.toFixed(2)," ",e.displaySymbol," ",D&&F!==void 0?`${Is(F,e.digits)} / ${Is(A,e.digits)}`:Is(A,e.digits)]}),c.jsx("button",{type:"button","aria-label":"Close order panel",className:"web-trading-widget-icon-btn",onClick:t,children:c.jsx(gn,{className:"web-trading-widget-icon web-trading-widget-icon--md"})})]}),c.jsxs("div",{className:"web-trading-widget-detail-panel__body",children:[c.jsx(De,{label:"Lots",value:o,onChange:a,step:.01,min:.01,decimals:2,disabled:!0}),D?c.jsxs(c.Fragment,{children:[c.jsx(De,{label:"Stop Price",value:f,onChange:u,step:O,decimals:e.digits,basePrice:U}),c.jsx(De,{label:"Limit Price",value:l,onChange:d,step:O,decimals:e.digits,basePrice:U})]}):c.jsx(De,{label:"Price",value:l,onChange:d,step:O,decimals:e.digits,basePrice:U}),c.jsxs("div",{className:"web-trading-widget-market-panel__grid-2",children:[c.jsx(De,{label:"Stop Loss",value:g,onChange:v,step:O,decimals:e.digits,basePrice:N,placeholder:V,clearable:!0}),c.jsx(De,{label:"Take Profit",value:h,onChange:p,step:O,decimals:e.digits,basePrice:L,placeholder:j,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:"Comment"}),c.jsx(Rn,{value:b,onChange:B=>_(B.target.value)})]}),c.jsx(ct,{type:"button",variant:"secondary",className:"web-trading-widget-detail-panel__btn-full",disabled:W||!ee,onClick:()=>void ue(),children:"Modify"}),c.jsx(ct,{type:"button",className:"web-trading-widget-detail-panel__action-btn",disabled:W,onClick:()=>void me(),children:J})]})]})}function Ms(e,t){return e.toLocaleString(void 0,{minimumFractionDigits:t,maximumFractionDigits:t})}function Vr(e){if(!(e===void 0||e===0))return e}function Nd(e,t){return e===void 0||e===0?"":Ce(e,t)}function Rd(e,t){const n=Ue(e);if(n!==void 0)return n;if(Vr(t)!==void 0)return 0}function OC(e,t,n){return e.type==="buy"?t??e.marketBid??e.currentPrice:n??e.marketAsk??e.currentPrice}function Mp({position:e,onClose:t}){const{closePosition:n,modifyPosition:r}=qi(),s=ge(A=>A.removePosition),i=ge(A=>A.liveQuotes),[o,a]=C.useState(String(e.volumeLots)),l=ie(A=>A.stopLoss),d=ie(A=>A.takeProfit),f=ie(A=>A.setStopLoss),u=ie(A=>A.setTakeProfit),g=ie(A=>A.setDraft),h=ie(A=>A.clearDraft),[v,p]=C.useState(e.comment),[m,y]=C.useState(!1),[b,_]=C.useState(!1),x=Pr(e.digits),T=Ke(e.symbol).toUpperCase(),S=i[T],E=(S==null?void 0:S.bid)??e.marketBid??null,O=(S==null?void 0:S.ask)??e.marketAsk??null,R=E!==null?Ce(E,e.digits):"—",M=O!==null?Ce(O,e.digits):"—";C.useEffect(()=>(g({source:"position",entryPrice:e.openPrice,stopLoss:Nd(e.stopLoss,e.digits),takeProfit:Nd(e.takeProfit,e.digits),side:e.type,showEntryLine:!1,volumeLots:e.volumeLots,digits:e.digits,priceStep:x}),()=>{h()}),[h,e.digits,e.openPrice,e.stopLoss,e.takeProfit,e.type,e.volumeLots,x,g]);const N=OC(e,E,O),L=e.volumeLots,V=m||b,j=Vr(Ue(l))!==Vr(e.stopLoss)||Vr(Ue(d))!==Vr(e.takeProfit)||v.trim()!==e.comment.trim(),U=async()=>{if(j){_(!0);try{const A=await r(e,{stopLoss:Rd(l,e.stopLoss),takeProfit:Rd(d,e.takeProfit),comment:v.trim()});if(!A.success){Te({variant:"destructive",description:A.message||"Failed to modify position."});return}t(),Te({description:`Position #${e.ticket} updated.`})}catch(A){const F=A instanceof Error?A.message:"Failed to modify position.";Te({variant:"destructive",description:F})}finally{_(!1)}}},D=C.useMemo(()=>{const A=e.profit.toFixed(2);return`Close #${e.ticket} ${e.type} ${L.toFixed(2)} ${e.displaySymbol} ${Ms(e.openPrice,e.digits)} at ${Ms(N,e.digits)} with Profit ${A}`},[N,e,L]),$=async()=>{y(!0);try{const A=await n(e);if(!A.success){Te({variant:"destructive",description:A.message||"Failed to close position."});return}s(e.ticket),t(),Te({description:`Position #${e.ticket} closed.`})}catch(A){const F=A instanceof Error?A.message:"Failed to close position.";Te({variant:"destructive",description:F})}finally{y(!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," ",L.toFixed(2)," ",e.displaySymbol," ",Ms(e.openPrice,e.digits)]}),c.jsx("button",{type:"button","aria-label":"Close position panel",className:"web-trading-widget-icon-btn",onClick:t,children:c.jsx(gn,{className:"web-trading-widget-icon web-trading-widget-icon--md"})})]}),c.jsxs("div",{className:"web-trading-widget-detail-panel__body",children:[c.jsx(De,{label:"Lots",value:o,onChange:a,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:"Price"}),c.jsx(Rn,{readOnly:!0,disabled:!0,value:Ms(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(De,{label:"Stop Loss",value:l,onChange:f,step:x,decimals:e.digits,basePrice:E,placeholder:R,clearable:!0}),c.jsx(De,{label:"Take Profit",value:d,onChange:u,step:x,decimals:e.digits,basePrice:O,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:"Comment"}),c.jsx(Rn,{value:v,onChange:A=>p(A.target.value)})]}),c.jsx(ct,{type:"button",variant:"secondary",className:"web-trading-widget-detail-panel__btn-full",disabled:V||!j,onClick:()=>void U(),children:"Modify"}),c.jsx(ct,{type:"button",className:"web-trading-widget-detail-panel__action-btn",disabled:V,onClick:()=>void $(),children:D})]})]})}function Ld({symbolTicker:e,orderState:t}){const n=Cc(e),{confirmation:r,isSubmitting:s,defaultVolumeLots:i,volumeStep:o,minVolumeLots:a,selectedLogin:l,isAccountsLoading:d,hasConfirmedAccount:f,dismissConfirmation:u,placeMarketOrder:g}=t,h=ge(E=>E.positions),v=ge(E=>E.orders),p=ge(E=>E.selectedPositionTicket),m=ge(E=>E.selectedOrderTicket),y=ge(E=>E.setSelectedPositionTicket),b=ge(E=>E.setSelectedOrderTicket),_=p!==null?h.find(E=>E.ticket===p)??null:null,x=m!==null?v.find(E=>E.ticket===m)??null:null,T=r!==null,S=C.useCallback(E=>{g({symbolTicker:e,login:E.login,executionMode:E.executionMode,side:E.side,orderType:E.orderType,volumeLots:E.volumeLots,stopLoss:E.stopLoss,takeProfit:E.takeProfit,priceOrder:E.priceOrder,priceTrigger:E.priceTrigger,comment:E.comment,typeTime:E.typeTime,expirationDateTime:E.expirationDateTime,expirationDay:E.expirationDay,bid:E.bid,ask:E.ask})},[g,e]);return _!==null?c.jsx(Mp,{position:_,onClose:()=>y(null)}):x!==null?c.jsx(Ip,{order:x,onClose:()=>b(null)}):T&&r!==null?c.jsx(jp,{confirmation:r,symbolTicker:e,onDismiss:u}):f?c.jsx(AC,{embedded:!0,symbolTicker:e,bid:(n==null?void 0:n.bid)??null,ask:(n==null?void 0:n.ask)??null,defaultVolumeLots:i,volumeStep:o,minVolumeLots:a,isSubmitting:s,isAccountsLoading:d,selectedLogin:l,onPlaceOrder:S}):c.jsx("div",{className:"web-trading-widget-side-panel__empty",children:"Select a trading account to start placing orders."})}function Dd({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 NC({symbolTicker:e,orderState:t,scanResultUrl:n,onScanResultLoad:r,initialTab:s="trade",activeTab:i,onTabChange:o}){const a=!!n,[l,d]=C.useState(s),f=i!==void 0,u=f?i:l,g=C.useCallback(h=>{f?o==null||o(h):d(h)},[f,o]);return c.jsx("aside",{className:`web-trading-widget-side-panel${a?" web-trading-widget-side-panel--with-scan":""}`,children:a?c.jsxs("div",{className:"web-trading-widget-side-panel__scan-layout",children:[c.jsxs("div",{role:"tablist","aria-label":"Chart side panel",className:"web-trading-widget-side-panel__tablist",children:[c.jsx(Dd,{label:"Trade",isActive:u==="trade",onClick:()=>g("trade")}),c.jsx(Dd,{label:"Scan Result",isActive:u==="scan",onClick:()=>g("scan")})]}),c.jsxs("div",{className:"web-trading-widget-side-panel__panels",children:[c.jsx("div",{role:"tabpanel",hidden:u!=="trade",className:"web-trading-widget-side-panel__tabpanel",children:c.jsx(Ld,{symbolTicker:e,orderState:t})}),c.jsx("div",{role:"tabpanel",hidden:u!=="scan",className:"web-trading-widget-side-panel__tabpanel web-trading-widget-side-panel__tabpanel--scan",children:c.jsx("iframe",{src:n??void 0,title:"Scan result",className:"web-trading-widget-side-panel__iframe",onLoad:r},n)})]})]}):c.jsx("div",{className:"web-trading-widget-side-panel__scroll",children:c.jsx(Ld,{symbolTicker:e,orderState:t})})})}const RC=.01,LC=.01,jd=.01;function DC({symbols:e,defaultPanelAfterConfirm:t="mini"}){const[n,r]=C.useState("closed"),[s,i]=C.useState(null),[o,a]=C.useState(!1),[l,d]=C.useState("pending"),[f,u]=C.useState(null),g=ge(N=>N.setSelectedLogin),{accounts:h,isLoading:v}=lp(),{submitOrder:p}=qi(),m=C.useMemo(()=>Jv(h),[h]),y=C.useMemo(()=>tw(h,f),[h,f]),b=l==="confirmed",_=l==="needs-selection";C.useEffect(()=>{if(v)return;if(l==="confirmed"){f&&!m.some(L=>L.login===f)&&d("needs-selection");return}if(l==="needs-selection")return;const N=ew();if(N&&m.some(L=>L.login===N)){u(N),d("confirmed"),r(t);return}d("needs-selection")},[l,m,t,v,f]),C.useEffect(()=>{y&&g(y)},[y,g]);const x=C.useCallback(N=>{u(N),g(N),El(N)},[g]),T=C.useCallback(N=>{N&&(El(N),x(N),d("confirmed"),i(null),r(t))},[t,x]),S=C.useCallback(()=>{i(null),r("market")},[]),E=C.useCallback(()=>{i(null),r("mini")},[]),O=C.useCallback(()=>{i(null),r("mini")},[]),R=C.useCallback(()=>{i(null),r("mini")},[]),M=C.useCallback(async N=>{const L=ie.getState().clearEntryLinePreview,V=N.login.trim();if(!V){L(),Te({variant:"destructive",description:"Please select a trading account."});return}const j=Math.max(jd,N.volumeLots),U=Ui(N.symbolTicker,e);Number(Vt(Ht(N.symbolTicker,e)));const D=Fi(N.executionMode),$=uc(N.orderType),A=Ue(N.priceOrder),F=Ue(N.priceTrigger);if(!D&&A===void 0){L(),Te({variant:"destructive",description:$?"Please set a limit price for this order.":"Please set an order price for pending orders."});return}if($&&F===void 0){L(),Te({variant:"destructive",description:"Please set a stop price for stop limit orders."});return}if(!D&&!Bi(N.typeTime,N.expirationDateTime,N.expirationDay)){L(),Te({variant:"destructive",description:"Please set an expiration date for this order."});return}const W=D?N.side==="buy"?N.ask:N.bid:A??(N.side==="buy"?N.ask:N.bid);a(!0);try{const I=await p({login:V,symbolTicker:N.symbolTicker,executionMode:N.executionMode,side:ci(N.orderType),orderType:N.orderType,volumeLots:j,stopLoss:Ue(N.stopLoss),takeProfit:Ue(N.takeProfit),priceOrder:dc(N.orderType)?A:void 0,priceTrigger:$?F:void 0,comment:N.comment.trim(),typeTime:N.typeTime,expirationDateTime:N.expirationDateTime,expirationDay:N.expirationDay,bid:N.bid,ask:N.ask});if(!I.success){L(),Te({variant:"destructive",description:I.message||"Order was not accepted."});return}i({ticket:I.ticket??"",side:I.side??ci(N.orderType),volumeLots:I.volumeLots??j,symbol:I.displaySymbol??U,price:I.price??W}),r("confirmation")}catch(I){L();const ee=I instanceof Error?I.message:"Failed to place order.";Te({variant:"destructive",description:ee})}finally{a(!1)}},[p,e]);return{panel:n,confirmation:s,isSubmitting:o,defaultVolumeLots:RC,volumeStep:LC,minVolumeLots:jd,accountOptions:m,selectedLogin:y,setSelectedLogin:x,isAccountsLoading:v,hasConfirmedAccount:b,needsAccountSelection:_,confirmAccountSelection:T,openMarketPanel:S,openMiniPanel:E,closePanels:O,dismissConfirmation:R,placeMarketOrder:M}}function gi(e){var t;if(typeof window<"u"){const n=localStorage.getItem(Qn);if(n&&e.some(r=>r.ticker===n))return n}return((t=e[0])==null?void 0:t.ticker)??"XAU_USD"}function ga(e,t,n){var r;return((r=t.find(s=>s.display_name===e||s.ticker===e))==null?void 0:r.ticker)??n}function jC({chartWidget:e,symbols:t,chartSlotElement:n,onSymbolTickerChange:r,onScanResultUrlChange:s,selectSymbolTickerRef:i}){const o=C.useMemo(()=>gi(t),[t]),a=C.useRef(o),l=C.useRef(e),[d,f]=C.useState(null);C.useEffect(()=>{l.current=e},[e]),C.useEffect(()=>{if(!n){f(null);return}const g=()=>{const v=n.querySelector(":scope > div");f(v)};g();const h=new MutationObserver(g);return h.observe(n,{childList:!0}),()=>{h.disconnect()}},[n]);const u=C.useCallback(g=>{if(g===a.current)return;const h=t.find(p=>p.ticker===g);if(!h)return;a.current=g,localStorage.setItem(Qn,g),r(g),s(null);const v=l.current;if(v)try{v.onChartReady(()=>{v.activeChart().setSymbol(h.ticker)})}catch{}},[s,r,t]);return C.useEffect(()=>(i.current=u,()=>{i.current=null}),[u,i]),C.useEffect(()=>{if(!e)return;let g=!1,h=null;try{e.onChartReady(()=>{if(g)return;let v;try{v=e.activeChart()}catch{return}const p=b=>{const _=v.symbol(),x=ga(_,t,o);x!==a.current&&s(null);try{e.resetCache()}catch{}a.current=x,localStorage.setItem(Qn,x),r(x)},m=v.symbol(),y=ga(m,t,o);y!==a.current&&(a.current=y,localStorage.setItem(Qn,y),r(y)),v.onSymbolChanged().subscribe(null,p),h=()=>{try{v.onSymbolChanged().unsubscribe(null,p)}catch{}}})}catch{}return()=>{g=!0,h==null||h()}},[e,s,r,o,t]),{chartContainer:d}}const IC=Oa("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 MC({className:e,variant:t,...n}){return c.jsx("div",{className:Pe(IC({variant:t}),e),...n})}function Fp(){var t;const e=(t=window.TradingView)==null?void 0:t.widget;return typeof e=="function"?e:null}function Ys(){return Fp()!==null}const Id="/charting_library/charting_library.js";function FC({onLoad:e}){return C.useEffect(()=>{if(Ys()){e();return}const t=document.querySelector(`script[src="${Id}"]`);if(t){const r=()=>{Ys()&&e()};return t.addEventListener("load",r),()=>t.removeEventListener("load",r)}const n=document.createElement("script");return n.src=Id,n.async=!1,n.onload=()=>{Ys()&&e()},n.onerror=()=>{console.error("Failed to load TradingView charting library")},document.head.appendChild(n),()=>{n.onload=null,n.onerror=null}},[e]),null}const Md=$i(e=>({playEndTimestamp:null,setPlayEndTimestamp:t=>e({playEndTimestamp:t})})),Up=$i(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})})),ya=8,Bp=4,ba=5,va=e=>e==="1"?60:e==="5"?300:e==="1D"?1440*3600:parseInt(e,10)*60,UC=e=>{const t=new Date(e+ya*60*60*1e3),n=t.getUTCDay(),r=t.getUTCHours();return n===0?!1:n===1?r>=ba:n===6?r<=Bp:!0},BC=e=>{const t=new Date(e+ya*60*60*1e3),n=t.getUTCDay(),r=t.getUTCHours();if(n===0||n===1&&r<ba||n===6&&r>=Bp){const s=(8-n)%7;return t.setUTCDate(t.getUTCDate()+s),t.setUTCHours(ba,0,0,0),t.getTime()-ya*60*60*1e3}return e},$C=(e,t,n)=>{const r=va(t)*1e3,s=[];let i=e;for(let o=0;o<n;o++)i+=r,UC(i)||(i=BC(i)),s.push(i);return s},VC=(e,t,n,r)=>{if(n<=0)return[];if(r==="24x7"){const i=va(t)*1e3;return Array.from({length:n},(o,a)=>e+(a+1)*i)}if(r==="1700-1700")return $C(e,t,n);const s=va(t)*1e3;return Array.from({length:n},(i,o)=>e+(o+1)*s)},HC=(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},Fd="wss://symbols.opheleo.com";function zC(e){return{1:6e4,5:3e5,15:9e5,30:18e5,60:36e5,240:144e5}[e]??6e4}function Ud(e){return e.trim().toUpperCase()}function WC(e,t){return Math.floor(e/t)*t}let Ir;async function KC(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 qC{constructor(t,n,r=Bt,s=Fd){it(this,"futureBarsRef");it(this,"type");it(this,"symbols");it(this,"tickWebSocketUrl");it(this,"configuration",{supported_resolutions:["1","5","15","30","60"],supports_marks:!1,supports_timescale_marks:!0,supports_time:!1});it(this,"ws",null);it(this,"isWsConnecting",!1);it(this,"wsSelectedSymbol",null);it(this,"subscriptions",new Map);it(this,"lastBarsCache",new Map);it(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=s||Fd}onReady(t){setTimeout(()=>t(this.configuration),0)}resolveSymbol(t,n,r){const s=this.symbols.find(o=>o.ticker===t),i=this.symbols.find(o=>o.display_name===t);try{setTimeout(()=>{const o={name:(s==null?void 0:s.display_name)||(i==null?void 0:i.display_name)||localStorage.getItem("tv:latest-symbol")||"XAU_USD",timezone:"America/New_York",minmov:1,session:(s==null?void 0:s.session)||(i==null?void 0:i.session)||"24x7",has_intraday:!0,visible_plots_set:"ohlc",library_custom_fields:{ticker:(s==null?void 0:s.ticker)||(i==null?void 0:i.ticker)||localStorage.getItem("tv:latest-symbol")||"XAU_USD"},description:(s==null?void 0:s.description)||(i==null?void 0:i.description)||"",type:(s==null?void 0:s.type)||(i==null?void 0:i.type)||"",pricescale:(s==null?void 0:s.pricescale)||(i==null?void 0:i.pricescale)||1e5,ticker:(s==null?void 0:s.display_name)||(i==null?void 0:i.display_name)||localStorage.getItem("tv:latest-symbol")||"XAU_USD",exchange:"FX",format:"price",listed_exchange:"FX",logo_urls:(s==null?void 0:s.logo_urls.map(a=>a.replace("https://cdn.iccandle.ai/web-assets","/images/symbols")))||(i==null?void 0:i.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,s,i){var u;const o=(u=t.library_custom_fields)==null?void 0:u.ticker,a=this.symbols.find(g=>o!==void 0&&g.ticker===o||g.ticker===t.ticker||g.display_name===t.name||g.display_name===t.ticker),l={symbol:(a==null?void 0:a.ticker)||"",timeframe:n};if(r.firstDataRequest&&(Ir=void 0),!r.firstDataRequest)if(Ir)l.last_evaluated_key=Ir;else{s([],{noData:!0});return}const f=Md.getState().playEndTimestamp;f&&(l.endTimestamp=f,Md.getState().setPlayEndTimestamp(null),Ir=void 0),(async()=>{var g;try{const{data:h}=await KC(l);if(h.data_status==="threshold_limited"){s([],{noData:!0});return}if(h.data_status==="end_of_data"){s([],{noData:!0});return}if(!((g=h.items)!=null&&g.length)){s([],{noData:!0});return}Ir=h.last_evaluated_key;const p=[...h.items].map(_=>({open:_.o,high:_.h,low:_.l,close:_.c,time:HC(_.timestamp,n)})),m=Up.getState(),{gapCount:y,isReplayMode:b}=m;if(b&&event){const _=VC(p[p.length-1].time,n,y||0,t.session);if(_.length>0){const x=p[p.length-1].close;for(const T of _)p.push({open:x,high:x,low:x,close:x,time:T})}}s(p)}catch(h){i(h),s([],{noData:!0})}})()}searchSymbols(t,n,r,s){if(r==="all"||r===""){const i=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"))}));s(i)}else{const i=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"))}));s(i)}}subscribeBars(t,n,r,s,i){var u;const o=(u=t.library_custom_fields)==null?void 0:u.ticker,a=this.symbols.find(g=>o!==void 0&&g.ticker===o||g.display_name===t.ticker||g.display_name===t.name),l=a!=null&&a.resolve_symbol?Ud(a.resolve_symbol):Ud(t.ticker||t.name||""),d=zC(n),f=`${l}|${n}`;this.subscriptions.set(s,{symbol:l,resolution:n,periodMs:d,onTick:r,onResetCacheNeededCallback:i,liveCandle:this.lastBarsCache.get(f)??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 s;const n=t??((s=this.subscriptions.values().next().value)==null?void 0:s.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=i=>this.handleMessage(i),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),s=(Number(t.bid)+Number(t.ask))/2;if(!(!Number.isFinite(r)||!Number.isFinite(s)))for(const[i,o]of this.subscriptions.entries()){if(o.symbol!==n)continue;const a=`${o.symbol}|${o.resolution}`,l=WC(r,o.periodMs);let d=o.liveCandle;d?l>d.time?d={time:l,open:s,high:s,low:s,close:s,volume:0}:d={...d,high:Math.max(d.high,s),low:Math.min(d.low,s),close:s}:d={time:l,open:s,high:s,low:s,close:s,volume:0},o.liveCandle=d,this.lastBarsCache.set(a,d),this.subscriptions.set(i,o),(u=>{var g,h;(h=(g=this.futureBarsRef)==null?void 0:g.current)!=null&&h.length||o.onTick(u)})(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,s){const i=[];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:f})=>{!a||!Number.isFinite(l)||l<=0||i.some(u=>String(u.id)===String(a))||i.push({id:a,time:l/1e3,color:"green",label:d.slice(0,1)||"N",tooltip:[d],...f?{imageUrl:`/images/symbols/${f}.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:f,forecast:u,previous:g,actual:h}=o;if(!a||!Number.isFinite(l)||l<=0||i.some(p=>String(p.id)==="news:"+a))return;i.push({id:"news:"+a,time:l/1e3,color:"green",label:d.slice(0,1),tooltip:[d,`Current Forecast: ${u||"-"}`,`Previous Forecast: ${g||"-"}`,`Previous Actual: ${h||"-"}`],...f?{imageUrl:`https://cdn.iccandle.ai/web-assets/${f??"USD"}.svg`}:{}})}catch{}s(i)}}const GC=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,s=e.current,i=n.symbol.open,o=n.symbol.high,a=n.symbol.low,l=n.symbol.close;if(!Number.isFinite(r)||!s||s.length===0)return[i,o,a,l,Number.NaN,Number.NaN,Number.NaN];if(!s.some(g=>g.time===r))return[i,o,a,l,Number.NaN,Number.NaN,Number.NaN];const u=l<i?1:0;return[i,o,a,l,u,u,u]}}};return Promise.resolve([t])},wa="An unknown error occurred",Qs=e=>{if(typeof e=="string")return e;if(typeof e!="object"||e===null)return wa;if(typeof e.message=="string")return e.message;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const n=Qs(e[t]);if(n)return n}return wa},ZC=e=>{var t;if(Im(e)){const n=(t=e.response)!=null&&t.data?Qs(e.response.data):void 0;return n&&n!==wa?n:Qs(e)}return Qs(e)},YC=({queryKey:e,queryFn:t,...n})=>Or({queryKey:e,queryFn:async r=>{var s;try{const i=r.queryKey[1];return await t(i)}catch(i){throw Te({variant:"destructive",title:"Error",description:ZC(Im(i)?(s=i.response)==null?void 0:s.data:i)}),null}},...n});var Se;(function(e){e.assertEqual=s=>{};function t(s){}e.assertIs=t;function n(s){throw new Error}e.assertNever=n,e.arrayToEnum=s=>{const i={};for(const o of s)i[o]=o;return i},e.getValidEnumValues=s=>{const i=e.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),o={};for(const a of i)o[a]=s[a];return e.objectValues(o)},e.objectValues=s=>e.objectKeys(s).map(function(i){return s[i]}),e.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const i=[];for(const o in s)Object.prototype.hasOwnProperty.call(s,o)&&i.push(o);return i},e.find=(s,i)=>{for(const o of s)if(i(o))return o},e.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,i=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}e.joinValues=r,e.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(Se||(Se={}));var Bd;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(Bd||(Bd={}));const Y=Se.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Yt=e=>{switch(typeof e){case"undefined":return Y.undefined;case"string":return Y.string;case"number":return Number.isNaN(e)?Y.nan:Y.number;case"boolean":return Y.boolean;case"function":return Y.function;case"bigint":return Y.bigint;case"symbol":return Y.symbol;case"object":return Array.isArray(e)?Y.array:e===null?Y.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Y.promise:typeof Map<"u"&&e instanceof Map?Y.map:typeof Set<"u"&&e instanceof Set?Y.set:typeof Date<"u"&&e instanceof Date?Y.date:Y.object;default:return Y.unknown}},H=Se.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 Ut 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(i){return i.message},r={_errors:[]},s=i=>{for(const o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(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 s(this),r}static assert(t){if(!(t instanceof Ut))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Se.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const s of this.issues)if(s.path.length>0){const i=s.path[0];n[i]=n[i]||[],n[i].push(t(s))}else r.push(t(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Ut.create=e=>new Ut(e);const _a=(e,t)=>{let n;switch(e.code){case H.invalid_type:e.received===Y.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case H.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Se.jsonStringifyReplacer)}`;break;case H.unrecognized_keys:n=`Unrecognized key(s) in object: ${Se.joinValues(e.keys,", ")}`;break;case H.invalid_union:n="Invalid input";break;case H.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Se.joinValues(e.options)}`;break;case H.invalid_enum_value:n=`Invalid enum value. Expected ${Se.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}"`:Se.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,Se.assertNever(e)}return{message:n}};let QC=_a;function XC(){return QC}const JC=e=>{const{data:t,path:n,errorMaps:r,issueData:s}=e,i=[...n,...s.path||[]],o={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.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{...s,path:i,message:a}};function G(e,t){const n=XC(),r=JC({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===_a?void 0:_a].filter(s=>!!s)});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 s of n){if(s.status==="aborted")return oe;s.status==="dirty"&&t.dirty(),r.push(s.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const s of n){const i=await s.key,o=await s.value;r.push({key:i,value:o})}return st.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const s of n){const{key:i,value:o}=s;if(i.status==="aborted"||o.status==="aborted")return oe;i.status==="dirty"&&t.dirty(),o.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(r[i.value]=o.value)}return{status:t.value,value:r}}}const oe=Object.freeze({status:"aborted"}),Hr=e=>({status:"dirty",value:e}),ut=e=>({status:"valid",value:e}),$d=e=>e.status==="aborted",Vd=e=>e.status==="dirty",vr=e=>e.status==="valid",yi=e=>typeof Promise<"u"&&e instanceof Promise;var X;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(X||(X={}));class fn{constructor(t,n,r,s){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=s}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 Hd=(e,t)=>{if(vr(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 Ut(e.common.issues);return this._error=n,this._error}}};function pe(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:s}=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:s}:{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:s}}class xe{get description(){return this._def.description}_getType(t){return Yt(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Yt(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:Yt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(yi(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:Yt(t)},s=this._parseSync({data:t,path:r.path,parent:r});return Hd(r,s)}"~validate"(t){var r,s;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Yt(t)};if(!this["~standard"].async)try{const i=this._parseSync({data:t,path:[],parent:n});return vr(i)?{value:i.value}:{issues:n.common.issues}}catch(i){(s=(r=i==null?void 0:i.message)==null?void 0:r.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(i=>vr(i)?{value:i.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:Yt(t)},s=this._parse({data:t,path:r.path,parent:r}),i=await(yi(s)?s:Promise.resolve(s));return Hd(r,i)}refine(t,n){const r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,i)=>{const o=t(s),a=()=>i.addIssue({code:H.custom,...r(s)});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,s)=>t(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(t){return new xr({schema:this,typeName:ae.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 cn.create(this,this._def)}nullable(){return Sr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Nt.create(this)}promise(){return _i.create(this,this._def)}or(t){return vi.create([this,t],this._def)}and(t){return wi.create(this,t,this._def)}transform(t){return new xr({...pe(this._def),schema:this,typeName:ae.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new Ca({...pe(this._def),innerType:this,defaultValue:n,typeName:ae.ZodDefault})}brand(){return new xT({typeName:ae.ZodBranded,type:this,...pe(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new Ta({...pe(this._def),innerType:this,catchValue:n,typeName:ae.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Uc.create(this,t)}readonly(){return Ea.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const eT=/^c[^\s-]{8,}$/i,tT=/^[0-9a-z]+$/,nT=/^[0-9A-HJKMNP-TV-Z]{26}$/i,rT=/^[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,sT=/^[a-z0-9_-]{21}$/i,iT=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,oT=/^[-+]?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)?)??$/,aT=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,cT="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Ao;const lT=/^(?:(?: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])$/,dT=/^(?:(?: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])$/,uT=/^(([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]))$/,fT=/^(([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])$/,mT=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,pT=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,$p="((\\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])))",hT=new RegExp(`^${$p}$`);function Vp(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 gT(e){return new RegExp(`^${Vp(e)}$`)}function yT(e){let t=`${$p}T${Vp(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 bT(e,t){return!!((t==="v4"||!t)&&lT.test(e)||(t==="v6"||!t)&&uT.test(e))}function vT(e,t){if(!iT.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,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||"typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||t&&s.alg!==t)}catch{return!1}}function wT(e,t){return!!((t==="v4"||!t)&&dT.test(e)||(t==="v6"||!t)&&fT.test(e))}class sn extends xe{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Y.string){const i=this._getOrReturnCtx(t);return G(i,{code:H.invalid_type,expected:Y.string,received:i.parsedType}),oe}const r=new st;let s;for(const i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(s=this._getOrReturnCtx(t,s),G(s,{code:H.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")t.data.length>i.value&&(s=this._getOrReturnCtx(t,s),G(s,{code:H.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const o=t.data.length>i.value,a=t.data.length<i.value;(o||a)&&(s=this._getOrReturnCtx(t,s),o?G(s,{code:H.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&G(s,{code:H.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")aT.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"email",code:H.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")Ao||(Ao=new RegExp(cT,"u")),Ao.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"emoji",code:H.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")rT.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"uuid",code:H.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")sT.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"nanoid",code:H.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")eT.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"cuid",code:H.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")tT.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"cuid2",code:H.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")nT.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"ulid",code:H.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{s=this._getOrReturnCtx(t,s),G(s,{validation:"url",code:H.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"regex",code:H.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(t,s),G(s,{code:H.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(s=this._getOrReturnCtx(t,s),G(s,{code:H.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(s=this._getOrReturnCtx(t,s),G(s,{code:H.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?yT(i).test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{code:H.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?hT.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{code:H.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?gT(i).test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{code:H.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?oT.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"duration",code:H.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?bT(t.data,i.version)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"ip",code:H.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?vT(t.data,i.alg)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"jwt",code:H.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?wT(t.data,i.version)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"cidr",code:H.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?mT.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"base64",code:H.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?pT.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"base64url",code:H.invalid_string,message:i.message}),r.dirty()):Se.assertNever(i);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(s=>t.test(s),{validation:n,code:H.invalid_string,...X.errToObj(r)})}_addCheck(t){return new sn({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...X.errToObj(t)})}url(t){return this._addCheck({kind:"url",...X.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...X.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...X.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...X.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...X.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...X.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...X.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...X.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...X.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...X.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...X.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...X.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,...X.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,...X.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...X.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...X.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...X.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...X.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...X.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...X.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...X.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...X.errToObj(n)})}nonempty(t){return this.min(1,X.errToObj(t))}trim(){return new sn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new sn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new sn({...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}}sn.create=e=>new sn({checks:[],typeName:ae.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...pe(e)});function _T(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,s=n>r?n:r,i=Number.parseInt(e.toFixed(s).replace(".","")),o=Number.parseInt(t.toFixed(s).replace(".",""));return i%o/10**s}class wr extends xe{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)!==Y.number){const i=this._getOrReturnCtx(t);return G(i,{code:H.invalid_type,expected:Y.number,received:i.parsedType}),oe}let r;const s=new st;for(const i of this._def.checks)i.kind==="int"?Se.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),G(r,{code:H.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),G(r,{code:H.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),G(r,{code:H.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?_T(t.data,i.value)!==0&&(r=this._getOrReturnCtx(t,r),G(r,{code:H.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),G(r,{code:H.not_finite,message:i.message}),s.dirty()):Se.assertNever(i);return{status:s.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,X.toString(n))}gt(t,n){return this.setLimit("min",t,!1,X.toString(n))}lte(t,n){return this.setLimit("max",t,!0,X.toString(n))}lt(t,n){return this.setLimit("max",t,!1,X.toString(n))}setLimit(t,n,r,s){return new wr({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:X.toString(s)}]})}_addCheck(t){return new wr({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:X.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:X.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:X.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:X.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:X.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:X.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:X.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:X.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:X.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"&&Se.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)}}wr.create=e=>new wr({checks:[],typeName:ae.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...pe(e)});class Jr extends xe{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)!==Y.bigint)return this._getInvalidInput(t);let r;const s=new st;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),G(r,{code:H.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),G(r,{code:H.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),G(r,{code:H.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):Se.assertNever(i);return{status:s.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return G(n,{code:H.invalid_type,expected:Y.bigint,received:n.parsedType}),oe}gte(t,n){return this.setLimit("min",t,!0,X.toString(n))}gt(t,n){return this.setLimit("min",t,!1,X.toString(n))}lte(t,n){return this.setLimit("max",t,!0,X.toString(n))}lt(t,n){return this.setLimit("max",t,!1,X.toString(n))}setLimit(t,n,r,s){return new Jr({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:X.toString(s)}]})}_addCheck(t){return new Jr({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:X.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:X.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:X.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:X.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:X.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}}Jr.create=e=>new Jr({checks:[],typeName:ae.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...pe(e)});class xa extends xe{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Y.boolean){const r=this._getOrReturnCtx(t);return G(r,{code:H.invalid_type,expected:Y.boolean,received:r.parsedType}),oe}return ut(t.data)}}xa.create=e=>new xa({typeName:ae.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...pe(e)});class bi extends xe{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Y.date){const i=this._getOrReturnCtx(t);return G(i,{code:H.invalid_type,expected:Y.date,received:i.parsedType}),oe}if(Number.isNaN(t.data.getTime())){const i=this._getOrReturnCtx(t);return G(i,{code:H.invalid_date}),oe}const r=new st;let s;for(const i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(s=this._getOrReturnCtx(t,s),G(s,{code:H.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(s=this._getOrReturnCtx(t,s),G(s,{code:H.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):Se.assertNever(i);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new bi({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:X.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:X.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}}bi.create=e=>new bi({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:ae.ZodDate,...pe(e)});class zd extends xe{_parse(t){if(this._getType(t)!==Y.symbol){const r=this._getOrReturnCtx(t);return G(r,{code:H.invalid_type,expected:Y.symbol,received:r.parsedType}),oe}return ut(t.data)}}zd.create=e=>new zd({typeName:ae.ZodSymbol,...pe(e)});class Wd extends xe{_parse(t){if(this._getType(t)!==Y.undefined){const r=this._getOrReturnCtx(t);return G(r,{code:H.invalid_type,expected:Y.undefined,received:r.parsedType}),oe}return ut(t.data)}}Wd.create=e=>new Wd({typeName:ae.ZodUndefined,...pe(e)});class Kd extends xe{_parse(t){if(this._getType(t)!==Y.null){const r=this._getOrReturnCtx(t);return G(r,{code:H.invalid_type,expected:Y.null,received:r.parsedType}),oe}return ut(t.data)}}Kd.create=e=>new Kd({typeName:ae.ZodNull,...pe(e)});class qd extends xe{constructor(){super(...arguments),this._any=!0}_parse(t){return ut(t.data)}}qd.create=e=>new qd({typeName:ae.ZodAny,...pe(e)});class Gd extends xe{constructor(){super(...arguments),this._unknown=!0}_parse(t){return ut(t.data)}}Gd.create=e=>new Gd({typeName:ae.ZodUnknown,...pe(e)});class mn extends xe{_parse(t){const n=this._getOrReturnCtx(t);return G(n,{code:H.invalid_type,expected:Y.never,received:n.parsedType}),oe}}mn.create=e=>new mn({typeName:ae.ZodNever,...pe(e)});class Zd extends xe{_parse(t){if(this._getType(t)!==Y.undefined){const r=this._getOrReturnCtx(t);return G(r,{code:H.invalid_type,expected:Y.void,received:r.parsedType}),oe}return ut(t.data)}}Zd.create=e=>new Zd({typeName:ae.ZodVoid,...pe(e)});class Nt extends xe{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),s=this._def;if(n.parsedType!==Y.array)return G(n,{code:H.invalid_type,expected:Y.array,received:n.parsedType}),oe;if(s.exactLength!==null){const o=n.data.length>s.exactLength.value,a=n.data.length<s.exactLength.value;(o||a)&&(G(n,{code:o?H.too_big:H.too_small,minimum:a?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(G(n,{code:H.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(G(n,{code:H.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,a)=>s.type._parseAsync(new fn(n,o,n.path,a)))).then(o=>st.mergeArray(r,o));const i=[...n.data].map((o,a)=>s.type._parseSync(new fn(n,o,n.path,a)));return st.mergeArray(r,i)}get element(){return this._def.type}min(t,n){return new Nt({...this._def,minLength:{value:t,message:X.toString(n)}})}max(t,n){return new Nt({...this._def,maxLength:{value:t,message:X.toString(n)}})}length(t,n){return new Nt({...this._def,exactLength:{value:t,message:X.toString(n)}})}nonempty(t){return this.min(1,t)}}Nt.create=(e,t)=>new Nt({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ae.ZodArray,...pe(t)});function Yn(e){if(e instanceof je){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=cn.create(Yn(r))}return new je({...e._def,shape:()=>t})}else return e instanceof Nt?new Nt({...e._def,type:Yn(e.element)}):e instanceof cn?cn.create(Yn(e.unwrap())):e instanceof Sr?Sr.create(Yn(e.unwrap())):e instanceof Fn?Fn.create(e.items.map(t=>Yn(t))):e}class je extends xe{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=Se.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==Y.object){const d=this._getOrReturnCtx(t);return G(d,{code:H.invalid_type,expected:Y.object,received:d.parsedType}),oe}const{status:r,ctx:s}=this._processInputParams(t),{shape:i,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof mn&&this._def.unknownKeys==="strip"))for(const d in s.data)o.includes(d)||a.push(d);const l=[];for(const d of o){const f=i[d],u=s.data[d];l.push({key:{status:"valid",value:d},value:f._parse(new fn(s,u,s.path,d)),alwaysSet:d in s.data})}if(this._def.catchall instanceof mn){const d=this._def.unknownKeys;if(d==="passthrough")for(const f of a)l.push({key:{status:"valid",value:f},value:{status:"valid",value:s.data[f]}});else if(d==="strict")a.length>0&&(G(s,{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 f of a){const u=s.data[f];l.push({key:{status:"valid",value:f},value:d._parse(new fn(s,u,s.path,f)),alwaysSet:f in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const d=[];for(const f of l){const u=await f.key,g=await f.value;d.push({key:u,value:g,alwaysSet:f.alwaysSet})}return d}).then(d=>st.mergeObjectSync(r,d)):st.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return X.errToObj,new je({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var i,o;const s=((o=(i=this._def).errorMap)==null?void 0:o.call(i,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:X.errToObj(t).message??s}:{message:s}}}:{}})}strip(){return new je({...this._def,unknownKeys:"strip"})}passthrough(){return new je({...this._def,unknownKeys:"passthrough"})}extend(t){return new je({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new je({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:ae.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new je({...this._def,catchall:t})}pick(t){const n={};for(const r of Se.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new je({...this._def,shape:()=>n})}omit(t){const n={};for(const r of Se.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new je({...this._def,shape:()=>n})}deepPartial(){return Yn(this)}partial(t){const n={};for(const r of Se.objectKeys(this.shape)){const s=this.shape[r];t&&!t[r]?n[r]=s:n[r]=s.optional()}return new je({...this._def,shape:()=>n})}required(t){const n={};for(const r of Se.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof cn;)i=i._def.innerType;n[r]=i}return new je({...this._def,shape:()=>n})}keyof(){return Hp(Se.objectKeys(this.shape))}}je.create=(e,t)=>new je({shape:()=>e,unknownKeys:"strip",catchall:mn.create(),typeName:ae.ZodObject,...pe(t)});je.strictCreate=(e,t)=>new je({shape:()=>e,unknownKeys:"strict",catchall:mn.create(),typeName:ae.ZodObject,...pe(t)});je.lazycreate=(e,t)=>new je({shape:e,unknownKeys:"strip",catchall:mn.create(),typeName:ae.ZodObject,...pe(t)});class vi extends xe{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function s(i){for(const a of i)if(a.result.status==="valid")return a.result;for(const a of i)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(a=>new Ut(a.ctx.common.issues));return G(n,{code:H.invalid_union,unionErrors:o}),oe}if(n.common.async)return Promise.all(r.map(async i=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(s);{let i;const o=[];for(const l of r){const d={...n,common:{...n.common,issues:[]},parent:null},f=l._parseSync({data:n.data,path:n.path,parent:d});if(f.status==="valid")return f;f.status==="dirty"&&!i&&(i={result:f,ctx:d}),d.common.issues.length&&o.push(d.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const a=o.map(l=>new Ut(l));return G(n,{code:H.invalid_union,unionErrors:a}),oe}}get options(){return this._def.options}}vi.create=(e,t)=>new vi({options:e,typeName:ae.ZodUnion,...pe(t)});function Sa(e,t){const n=Yt(e),r=Yt(t);if(e===t)return{valid:!0,data:e};if(n===Y.object&&r===Y.object){const s=Se.objectKeys(t),i=Se.objectKeys(e).filter(a=>s.indexOf(a)!==-1),o={...e,...t};for(const a of i){const l=Sa(e[a],t[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}else if(n===Y.array&&r===Y.array){if(e.length!==t.length)return{valid:!1};const s=[];for(let i=0;i<e.length;i++){const o=e[i],a=t[i],l=Sa(o,a);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return n===Y.date&&r===Y.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class wi extends xe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),s=(i,o)=>{if($d(i)||$d(o))return oe;const a=Sa(i.value,o.value);return a.valid?((Vd(i)||Vd(o))&&n.dirty(),{status:n.value,value:a.data}):(G(r,{code:H.invalid_intersection_types}),oe)};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(([i,o])=>s(i,o)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}wi.create=(e,t,n)=>new wi({left:e,right:t,typeName:ae.ZodIntersection,...pe(n)});class Fn extends xe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Y.array)return G(r,{code:H.invalid_type,expected:Y.array,received:r.parsedType}),oe;if(r.data.length<this._def.items.length)return G(r,{code:H.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),oe;!this._def.rest&&r.data.length>this._def.items.length&&(G(r,{code:H.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...r.data].map((o,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new fn(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(i).then(o=>st.mergeArray(n,o)):st.mergeArray(n,i)}get items(){return this._def.items}rest(t){return new Fn({...this._def,rest:t})}}Fn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Fn({items:e,typeName:ae.ZodTuple,rest:null,...pe(t)})};class Yd extends xe{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!==Y.map)return G(r,{code:H.invalid_type,expected:Y.map,received:r.parsedType}),oe;const s=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([a,l],d)=>({key:s._parse(new fn(r,a,r.path,[d,"key"])),value:i._parse(new fn(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,f=await l.value;if(d.status==="aborted"||f.status==="aborted")return oe;(d.status==="dirty"||f.status==="dirty")&&n.dirty(),a.set(d.value,f.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of o){const d=l.key,f=l.value;if(d.status==="aborted"||f.status==="aborted")return oe;(d.status==="dirty"||f.status==="dirty")&&n.dirty(),a.set(d.value,f.value)}return{status:n.value,value:a}}}}Yd.create=(e,t,n)=>new Yd({valueType:t,keyType:e,typeName:ae.ZodMap,...pe(n)});class es extends xe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Y.set)return G(r,{code:H.invalid_type,expected:Y.set,received:r.parsedType}),oe;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(G(r,{code:H.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(G(r,{code:H.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());const i=this._def.valueType;function o(l){const d=new Set;for(const f of l){if(f.status==="aborted")return oe;f.status==="dirty"&&n.dirty(),d.add(f.value)}return{status:n.value,value:d}}const a=[...r.data.values()].map((l,d)=>i._parse(new fn(r,l,r.path,d)));return r.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(t,n){return new es({...this._def,minSize:{value:t,message:X.toString(n)}})}max(t,n){return new es({...this._def,maxSize:{value:t,message:X.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}es.create=(e,t)=>new es({valueType:e,minSize:null,maxSize:null,typeName:ae.ZodSet,...pe(t)});class Qd extends xe{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})}}Qd.create=(e,t)=>new Qd({getter:e,typeName:ae.ZodLazy,...pe(t)});class Xd extends xe{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return G(n,{received:n.data,code:H.invalid_literal,expected:this._def.value}),oe}return{status:"valid",value:t.data}}get value(){return this._def.value}}Xd.create=(e,t)=>new Xd({value:e,typeName:ae.ZodLiteral,...pe(t)});function Hp(e,t){return new _r({values:e,typeName:ae.ZodEnum,...pe(t)})}class _r extends xe{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return G(n,{expected:Se.joinValues(r),received:n.parsedType,code:H.invalid_type}),oe}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 G(n,{received:n.data,code:H.invalid_enum_value,options:r}),oe}return ut(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 _r.create(t,{...this._def,...n})}exclude(t,n=this._def){return _r.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}_r.create=Hp;class Jd extends xe{_parse(t){const n=Se.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==Y.string&&r.parsedType!==Y.number){const s=Se.objectValues(n);return G(r,{expected:Se.joinValues(s),received:r.parsedType,code:H.invalid_type}),oe}if(this._cache||(this._cache=new Set(Se.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const s=Se.objectValues(n);return G(r,{received:r.data,code:H.invalid_enum_value,options:s}),oe}return ut(t.data)}get enum(){return this._def.values}}Jd.create=(e,t)=>new Jd({values:e,typeName:ae.ZodNativeEnum,...pe(t)});class _i extends xe{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Y.promise&&n.common.async===!1)return G(n,{code:H.invalid_type,expected:Y.promise,received:n.parsedType}),oe;const r=n.parsedType===Y.promise?n.data:Promise.resolve(n.data);return ut(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}_i.create=(e,t)=>new _i({type:e,typeName:ae.ZodPromise,...pe(t)});class xr extends xe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ae.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),s=this._def.effect||null,i={addIssue:o=>{G(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){const o=s.transform(r.data,i);if(r.common.async)return Promise.resolve(o).then(async a=>{if(n.value==="aborted")return oe;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?oe:l.status==="dirty"||n.value==="dirty"?Hr(l.value):l});{if(n.value==="aborted")return oe;const a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?oe:a.status==="dirty"||n.value==="dirty"?Hr(a.value):a}}if(s.type==="refinement"){const o=a=>{const l=s.refinement(a,i);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"?oe:(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"?oe:(a.status==="dirty"&&n.dirty(),o(a.value).then(()=>({status:n.value,value:a.value}))))}if(s.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!vr(o))return oe;const a=s.transform(o.value,i);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=>vr(o)?Promise.resolve(s.transform(o.value,i)).then(a=>({status:n.value,value:a})):oe);Se.assertNever(s)}}xr.create=(e,t,n)=>new xr({schema:e,typeName:ae.ZodEffects,effect:t,...pe(n)});xr.createWithPreprocess=(e,t,n)=>new xr({schema:t,effect:{type:"preprocess",transform:e},typeName:ae.ZodEffects,...pe(n)});class cn extends xe{_parse(t){return this._getType(t)===Y.undefined?ut(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}cn.create=(e,t)=>new cn({innerType:e,typeName:ae.ZodOptional,...pe(t)});class Sr extends xe{_parse(t){return this._getType(t)===Y.null?ut(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Sr.create=(e,t)=>new Sr({innerType:e,typeName:ae.ZodNullable,...pe(t)});class Ca extends xe{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===Y.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Ca.create=(e,t)=>new Ca({innerType:e,typeName:ae.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...pe(t)});class Ta extends xe{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return yi(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Ut(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Ut(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Ta.create=(e,t)=>new Ta({innerType:e,typeName:ae.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...pe(t)});class eu extends xe{_parse(t){if(this._getType(t)!==Y.nan){const r=this._getOrReturnCtx(t);return G(r,{code:H.invalid_type,expected:Y.nan,received:r.parsedType}),oe}return{status:"valid",value:t.data}}}eu.create=e=>new eu({typeName:ae.ZodNaN,...pe(e)});class xT extends xe{_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 Uc extends xe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?oe:i.status==="dirty"?(n.dirty(),Hr(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?oe:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(t,n){return new Uc({in:t,out:n,typeName:ae.ZodPipeline})}}class Ea extends xe{_parse(t){const n=this._def.innerType._parse(t),r=s=>(vr(s)&&(s.value=Object.freeze(s.value)),s);return yi(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}}Ea.create=(e,t)=>new Ea({innerType:e,typeName:ae.ZodReadonly,...pe(t)});var ae;(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"})(ae||(ae={}));const Oo=sn.create,Fs=wr.create,ST=xa.create;mn.create;Nt.create;const CT=je.create;vi.create;wi.create;Fn.create;_r.create;_i.create;cn.create;Sr.create;const TT="https://api.opheleo.com",ET="Bearer ",PT="Authorization";CT({id:Oo(),userId:Oo(),createdAt:Fs(),updatedAt:Fs(),active:ST(),perDayUsage:Fs(),userEmail:Oo().email(),maxPerDayUsage:Fs()});async function kT(e,t,n){const r=typeof window<"u"?localStorage.getItem("session_token"):null;return(await Re({baseURL:br(n??TT),url:e,method:t,headers:r?{[PT]:`${ET}${r}`}:void 0})).data}async function AT(e){return kT("/iccandle/v1/iccandle-user-usage/me","get",e)}const OT=e=>{const t=e==null?void 0:e.platformApiBase;return YC({queryKey:["iccandle-user-usage",t],queryFn:()=>AT(t),...e})},NT=C.createContext(null);function RT(){const e=C.useContext(NT);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function LT({controlsRef:e,onSymbolTickerChange:t,onScanResultUrlChange:n,onChartWidgetChange:r,onChartContainerChange:s,selectSymbolTickerRef:i,headerSlot:o}){const{resolvedTheme:a}=RT(),l=dt(),d=ys(),f=C.useRef([]),u=C.useRef(null),g=C.useRef(a),h=C.useRef(null),v=C.useRef(null),p=C.useMemo(()=>gi(d),[d]),m=C.useRef(p),y=C.useRef("60"),{setGapCount:b,setReplayMode:_}=Up();C.useEffect(()=>{b(0),_(!1)},[b,_]),C.useEffect(()=>{Ys()&&E(!0)},[]);const[x,T]=C.useState(null),[S,E]=C.useState(!1),[O,R]=C.useState(null),M=C.useCallback(A=>{if(A===m.current)return;const F=d.find(I=>I.ticker===A);if(!F)return;m.current=A,localStorage.setItem(Qn,A),t(A);const W=u.current;if(W)try{W.onChartReady(()=>{W.activeChart().setSymbol(F.ticker)})}catch{}},[t,d]);C.useEffect(()=>(i.current=M,()=>{i.current=null}),[M,i]);const N=C.useRef([]),L=C.useMemo(()=>new qC(N,"selector",d,l.tickWebSocketUrl),[l.tickWebSocketUrl,d]),{data:V,isLoading:j}=OT({enabled:!0,platformApiBase:l.platformApiBase}),U=!j&&V?V.perDayUsage>=V.maxPerDayUsage:!1;C.useEffect(()=>{s(x)},[x,s]),C.useEffect(()=>{r(O)},[O,r]),C.useEffect(()=>{if(!S||!x)return;if(u.current){R(null),r(null);try{u.current.remove()}catch{}u.current=null}const A=gi(d);m.current=A,y.current="60";const F=Fp();if(!F)return;const W=new F({container:x,library_path:"/charting_library/",datafeed:L,symbol:A,interval:"60",autosize:!0,theme:g.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:()=>GC(f),drawings_access:{type:"black",tools:[{name:"Date Range"}]},locale:"en",timezone:Fh(),overrides:{priceScaleSelectionStrategyName:"right","scalesProperties.showSeriesLastValue":!0}});let I=!1;return u.current=W,W.onChartReady(()=>{I||u.current!==W||R(W)}),()=>{if(I=!0,R(null),r(null),u.current){try{u.current.remove()}catch{}u.current=null}}},[x,L,r,S]),C.useEffect(()=>{if(!O)return;let A=!1;try{O.onChartReady(()=>{A||(async()=>{try{const F=O.activeChart(),W=await F.createStudy("Generated Candles - By iC Candle",!0,!0);if(A||(W&&F.bringToFront([W]),await O.headerReady(),A)||(await new Promise(J=>{setTimeout(()=>{if(!A)try{F.clearMarks(2)}catch{}J(!0)},150)}),A))return;localStorage.setItem("tv:selected-news-events","[]"),F.refreshMarks();const I=J=>{const ue=F.symbol(),me=ga(ue,d,p);me!==m.current&&(n(null),f.current=[]);try{O.resetCache()}catch{}m.current=me,localStorage.setItem(Qn,me),t(me)},ee=J=>{J!==y.current&&(n(null),f.current=[]);try{O.resetCache()}catch{}y.current=J};h.current=I,v.current=ee,F.onSymbolChanged().subscribe(null,I),F.onIntervalChanged().subscribe(null,ee)}catch{}})()})}catch{}return()=>{A=!0,h.current=null,v.current=null}},[O,e,n,t,p,d]),C.useEffect(()=>{if(!O||!a)return;let A=!1;try{O.onChartReady(()=>{A||O.changeTheme(a).catch(()=>{})})}catch{}return()=>{A=!0}},[O,a]);const D=C.useCallback(()=>{E(!0)},[]),$=U?c.jsx("div",{className:"web-trading-widget-advanced__scan-limit-wrap",children:c.jsxs(MC,{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??$,c.jsx(FC,{onLoad:D}),c.jsx("div",{ref:T,className:"web-trading-widget-advanced__container"})]})}const zp=C.createContext(null);function tu({value:e,children:t}){return c.jsx(zp.Provider,{value:e,children:t})}function DT(){const e=C.useContext(zp);if(!e)throw new Error("useWidgetChartSlot must be used within WidgetChartSlotProvider");return e}function Us(e,t){return e.toFixed(t)}function jT({symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:s,minVolumeLots:i,isSubmitting:o,isAccountsLoading:a,selectedLogin:l,isDragging:d,isCollapsed:f,onToggleCollapsed:u,onDragHandlePointerDown:g,onPlaceOrder:h}){const[v,p]=C.useState(!0),m=f??v,y=()=>{u==null||u(),f===void 0&&p(D=>!D)},b=ie(D=>D.setOrderSide),_=ie(D=>D.setVolumeLots),x=ie(D=>D.volumeLots),[T,S]=C.useState(String(x||r));C.useEffect(()=>{m||S(Us(x,2))},[m,x]);const E=Number(Vt(Ht(e))),O=t!==null?Ce(t,E):"—",R=n!==null?Ce(n,E):"—",N=!o&&!a&&l!==""&&(t!==null&&n!==null),L=D=>{const $=Number(T),A=Number.isFinite($)&&$>0?$:r,F=Math.max(i,A+D*s),W=Us(F,2);S(W),_(F)},V=()=>{const D=Number(T);if(!Number.isFinite(D)||D<=0){S(Us(r,2)),_(r);return}const $=Math.max(i,D),A=Us($,2);S(A),_($)},j=D=>{t===null||n===null||b({side:D,entryPrice:D==="buy"?n:t})},U=D=>{if(t===null||n===null||!l)return;const $=Number(T),A=Math.max(i,Number.isFinite($)&&$>0?$:r);b({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":"Move quick order panel",onPointerDown:g,className:`web-trading-widget-mini-order__drag-handle${d?" web-trading-widget-mini-order__drag-handle--grabbing":""}`,children:c.jsx(Xf,{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:()=>j("sell"),onClick:()=>U("sell"),children:[c.jsx("span",{className:"web-trading-widget-mini-order__price",children:O}),c.jsx("span",{className:"web-trading-widget-mini-order__label web-trading-widget-mini-order__label--sell",children:"SELL"})]}),c.jsxs("div",{className:"web-trading-widget-mini-order__volume",children:[c.jsx("button",{type:"button","aria-label":"Decrease volume",disabled:!N,className:"web-trading-widget-mini-order__volume-btn",onClick:()=>L(-1),children:c.jsx(oi,{className:"web-trading-widget-icon web-trading-widget-icon--xs",strokeWidth:2.5})}),c.jsx("input",{type:"text",inputMode:"decimal",value:T,disabled:!N,onChange:D=>S(D.target.value),onBlur:V,className:"web-trading-widget-mini-order__volume-input"}),c.jsx("button",{type:"button","aria-label":"Increase volume",disabled:!N,className:"web-trading-widget-mini-order__volume-btn",onClick:()=>L(1),children:c.jsx(Ho,{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:()=>j("buy"),onClick:()=>U("buy"),children:[c.jsx("span",{className:"web-trading-widget-mini-order__label web-trading-widget-mini-order__label--buy",children:"BUY"}),c.jsx("span",{className:"web-trading-widget-mini-order__price",children:R})]})]}),c.jsx("button",{type:"button","aria-label":m?"Expand quick order panel":"Collapse quick order panel","aria-expanded":!m,className:"web-trading-widget-mini-order__toggle",onClick:y,children:m?c.jsx(oi,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2.5}):c.jsx(Ho,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2.5})})]})})}function Mr({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(oi,{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 IT=new Set(["volume-setting","risk-management"]);function MT({symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:s,minVolumeLots:i,isSubmitting:o,isAccountsLoading:a,selectedLogin:l,isDragging:d,onDragHandlePointerDown:f,onLayoutChange:u,onClose:g,onPlaceOrder:h}){const[v,p]=C.useState(!0),[m,y]=C.useState("market"),b=ie(te=>te.volumeLots),[_,x]=C.useState(String(b||r)),[T,S]=C.useState(""),[E,O]=C.useState(""),R=ie(te=>te.stopLoss),M=ie(te=>te.takeProfit),N=ie(te=>te.setStopLoss),L=ie(te=>te.setTakeProfit),V=ie(te=>te.setVolumeLots),j=ie(te=>te.setOrderSide),[U,D]=C.useState(""),[$,A]=C.useState(gt.GTC),[F,W]=C.useState(""),[I,ee]=C.useState(""),[J,ue]=C.useState(()=>new Set(IT));C.useEffect(()=>{u()},[v,u]);const me=Number(Vt(Ht(e))),B=Pr(me),K=hc(t,n),de=t!==null?Ce(t,me):"—",fe=n!==null?Ce(n,me):"—",ce=Fi(m),le=em(m),ne=Mi(m),z=ne.label,we=!ce&&ne.orderType!==null&&ne.orderType%2===1,Ae=C.useMemo(()=>K!==null?K:t??n,[n,t,K]),Q=te=>{ue(Je=>{const zt=new Set(Je);return zt.has(te)?zt.delete(te):zt.add(te),zt})},ke=te=>{x(te);const Je=Number(te);Number.isFinite(Je)&&Je>0&&V(Je)},Be=te=>t===null||n===null?null:ce?te==="buy"?n:t:Ue(T)??(te==="buy"?n:t),Xe=te=>{const Je=Be(te);Je!==null&&j({side:te,entryPrice:Je})},ft=te=>{if(t===null||n===null||!l)return;const Je=Math.max(i,Number(_)||i),zt=zo(m,te),Nr=Be(te);Nr!==null&&j({side:te,entryPrice:Nr}),h({login:l,executionMode:m,side:te,orderType:zt,volumeLots:Je,stopLoss:R,takeProfit:M,priceOrder:T,priceTrigger:E,comment:U,typeTime:$,expirationDateTime:F,expirationDay:I,bid:t,ask:n})},se=t!==null&&n!==null,Ve=ce||Ue(T)!==void 0,Ji=!le||Ue(E)!==void 0,vs=ce||Bi($,F,I),wh=!o&&!a&&l!==""&&se&&Ve&&Ji&&vs,_h=!ce&&fc($),xh=!ce&&mc($),zc=()=>ne.orderType!==null&&ne.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(jT,{symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:s,minVolumeLots:i,isSubmitting:o,isAccountsLoading:a,selectedLogin:l,isDragging:d,isCollapsed:v,onToggleCollapsed:()=>p(te=>!te),onDragHandlePointerDown:f,onPlaceOrder:({login:te,side:Je,volumeLots:zt,bid:Nr,ask:Wc})=>{Nr===null||Wc===null||h({login:te,executionMode:"market",side:Je,orderType:zo("market",Je),volumeLots:zt,stopLoss:R,takeProfit:M,priceOrder:"",priceTrigger:"",comment:U,typeTime:$,expirationDateTime:"",expirationDay:"",bid:Nr,ask:Wc})}}),v?null:c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"web-trading-widget-market-panel__header",children:c.jsxs(si,{value:m,onValueChange:te=>y(te),children:[c.jsx(Kr,{className:"web-trading-widget-market-panel__select-trigger","aria-label":"Order execution type",children:c.jsx(ii,{})}),c.jsx(qr,{children:ai.map(te=>c.jsx(Gr,{value:te.mode,children:te.label},te.mode))})]})}),c.jsxs("div",{className:"web-trading-widget-market-panel__accordion",children:[c.jsx(Mr,{id:"volume-setting",title:"Volume Setting",isOpen:J.has("volume-setting"),onToggle:()=>Q("volume-setting"),children:c.jsx(De,{label:"Lots",value:_,onChange:ke,step:s,min:i,decimals:2})}),ce?null:c.jsx(Mr,{id:"order-price",title:"Order Price",isOpen:J.has("order-price"),onToggle:()=>Q("order-price"),children:le?c.jsxs(c.Fragment,{children:[c.jsx(De,{label:"Stop Price",value:E,onChange:O,step:B,decimals:me,basePrice:Ae,placeholder:K!==null?Ce(K,me):"—"}),c.jsx(De,{label:"Limit Price",value:T,onChange:S,step:B,decimals:me,basePrice:Ae,placeholder:K!==null?Ce(K,me):"—"})]}):c.jsx(De,{label:"Price",value:T,onChange:S,step:B,decimals:me,basePrice:Ae,placeholder:K!==null?Ce(K,me):"—"})}),c.jsx(Mr,{id:"risk-management",title:"Risk Management",isOpen:J.has("risk-management"),onToggle:()=>Q("risk-management"),children:c.jsxs("div",{className:"web-trading-widget-market-panel__grid-2",children:[c.jsx(De,{label:"Stop Loss",value:R,onChange:N,step:B,decimals:me,basePrice:t,placeholder:t!==null?de:"—",clearable:!0}),c.jsx(De,{label:"Take Profit",value:M,onChange:L,step:B,decimals:me,basePrice:n,placeholder:n!==null?fe:"—",clearable:!0})]})}),ce?null:c.jsxs(Mr,{id:"expiration",title:"Expiration",isOpen:J.has("expiration"),onToggle:()=>Q("expiration"),children:[c.jsx("select",{value:String($),className:"web-trading-widget-market-panel__select-full","aria-label":"Order expiration type",onChange:te=>A(Number(te.target.value)),children:tm.map(te=>c.jsx("option",{value:String(te.value),children:te.label},te.value))}),_h?c.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[c.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Expiration time"}),c.jsx("input",{type:"datetime-local",value:F,className:"web-trading-widget-market-panel__input",onChange:te=>W(te.target.value)})]}):null,xh?c.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[c.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Expiration day"}),c.jsx("input",{type:"date",value:I,className:"web-trading-widget-market-panel__input",onChange:te=>ee(te.target.value)})]}):null]}),c.jsx(Mr,{id:"comment",title:"Comment",isOpen:J.has("comment"),onToggle:()=>Q("comment"),children:c.jsx("input",{type:"text",value:U,className:"web-trading-widget-market-panel__input",placeholder:"",onChange:te=>D(te.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:de}),c.jsx("span",{className:"web-trading-widget-market-panel__quotes-ask",children:fe})]})}),!ce&&c.jsxs("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:!wh,onMouseDown:()=>Xe(zc()),onClick:()=>ft(zc()),children:["Place ",z]})]})]})}function FT({symbolTicker:e,chartWidget:t,orderState:n}){const r=ys(),s=Cc(e),{panel:i,confirmation:o,isSubmitting:a,defaultVolumeLots:l,volumeStep:d,minVolumeLots:f,selectedLogin:u,isAccountsLoading:g,hasConfirmedAccount:h,closePanels:v,dismissConfirmation:p,placeMarketOrder:m}=n,y=ge(I=>I.positions),b=ge(I=>I.orders),_=ge(I=>I.selectedPositionTicket),x=ge(I=>I.selectedOrderTicket),T=ge(I=>I.setSelectedPositionTicket),S=ge(I=>I.setSelectedOrderTicket),E=_!==null?y.find(I=>I.ticket===_)??null:null,O=x!==null?b.find(I=>I.ticket===x)??null:null,R=h&&i==="confirmation"&&o!==null,M=h&&i!=="confirmation"&&i!=="closed"&&E===null&&O===null,{panelRef:N,position:L,isDragging:V,onDragStart:j,reclamp:U}=am({storageKey:"web-trading-widget-modal-exec-panel-position",defaultAlign:"top-right",isActive:M}),D=ie(I=>I.setDraft),$=ie(I=>I.clearDraft),A=Number(Vt(Ht(e))),F=Pr(A);C.useEffect(()=>{h&&D({source:"new-order",entryPrice:null,side:null,showEntryLine:!1,volumeLots:l,digits:A,priceStep:F})},[l,A,h,F,D]),C.useEffect(()=>{(i==="closed"||i==="confirmation")&&$()},[$,i]);const W=E!==null||O!==null;return!h&&!W?null:c.jsxs("div",{className:"web-trading-widget-new-order-overlay-layer",children:[c.jsx(qm,{chartWidget:t,symbolTicker:e,symbols:r}),W&&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(Mp,{position:E,onClose:()=>T(null)})}):null,W&&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(Ip,{order:O,onClose:()=>S(null)})}):null,R&&o!==null?c.jsx("div",{className:"web-trading-widget-new-order-overlay web-trading-widget-new-order-overlay--news",children:c.jsx(jp,{confirmation:o,symbolTicker:e,onDismiss:p})}):null,M?c.jsx("div",{ref:N,style:{left:L.x,top:L.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${V?" web-trading-widget-new-order-overlay--dragging":""}`,children:c.jsx(MT,{symbolTicker:e,bid:(s==null?void 0:s.bid)??null,ask:(s==null?void 0:s.ask)??null,defaultVolumeLots:l,volumeStep:d,minVolumeLots:f,isSubmitting:a,isAccountsLoading:g,selectedLogin:u,isDragging:V,onDragHandlePointerDown:j,onLayoutChange:U,onClose:v,onPlaceOrder:I=>void m({symbolTicker:e,login:I.login,executionMode:I.executionMode,side:I.side,orderType:I.orderType,volumeLots:I.volumeLots,stopLoss:I.stopLoss,takeProfit:I.takeProfit,priceOrder:I.priceOrder,priceTrigger:I.priceTrigger,comment:I.comment,typeTime:I.typeTime,expirationDateTime:I.expirationDateTime,expirationDay:I.expirationDay,bid:I.bid,ask:I.ask})})}):null]})}const UT=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" aria-hidden="true">
|
|
82
82
|
<rect x="1" y="1" width="16" height="16" rx="5" fill="#3B82F6" fill-opacity="0.18" stroke="#3B82F6" stroke-width="1"/>
|
|
83
83
|
<circle cx="9" cy="6.5" r="2.5" fill="none" stroke="#3B82F6" stroke-width="1.5"/>
|
|
84
84
|
<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>`,
|
|
85
|
+
</svg>`,Wp=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" aria-hidden="true">
|
|
86
86
|
<circle cx="9" cy="9" r="6.5" fill="none" stroke="currentColor" stroke-width="1.5" stroke-opacity="0.25"/>
|
|
87
87
|
<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>`,
|
|
88
|
+
</svg>`,BT=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" aria-hidden="true">
|
|
89
89
|
<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>`,zp="data-opheleo-account-dropdown",BT="148px",$T=640,VT="MT5",Jd=new WeakMap,Wp=new WeakMap;function HT(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 zT(e){const t=new Set([document,e.ownerDocument]),n=e.querySelector("iframe");return n instanceof HTMLIFrameElement&&n.contentDocument&&t.add(n.contentDocument),[...t]}function Kp(e){if(!e)return!1;const t=e.querySelector("iframe");return(t instanceof HTMLIFrameElement?t.clientWidth:e.clientWidth)<$T}function WT(e){e.classList.forEach(t=>{t.includes("iconOnly")&&e.classList.remove(t)})}function KT(e,t){e.querySelectorAll("svg").forEach(n=>{n.style.display=t?"none":""})}function qT(e,t){WT(e),e.style.flexShrink="0",e.style.minWidth=t?"auto":BT,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")}),KT(e,t)}function GT(e){const[t]=e.label.split(" · ");return t??e.label}function ZT(e){return`${VT} ${e.login}`}function YT(e){return`${e.label} — ${e.balance.toFixed(2)} ${e.currency}`}function QT(e,t){const n=GT(e),r=`${e.balance.toFixed(2)} ${e.currency}`;return`${e.login} · ${n} (${r})${t?" · Active":""}`}function Mc(e){return e.accountOptions.length===0?null:e.accountOptions.find(t=>t.login===e.selectedLogin)??e.accountOptions[0]}function qp(e){return e.isAccountsLoading||e.isAccountDataLoading}function XT(e){if(e.isAccountsLoading||e.accountOptions.length===0)return"";const t=Mc(e);return t?ZT(t):""}function JT(e){if(e.isAccountsLoading)return"Loading accounts…";if(e.isAccountDataLoading)return"Switching account…";const t=Mc(e);return t?YT(t):"Select your trading account"}function eE(e,t){if(!t)return qp(e)?Hp:FT}function tE(e,t){return e.isAccountsLoading?[{title:"Loading accounts…",onSelect:()=>{}}]:e.isAccountDataLoading?[{title:"Switching account…",onSelect:()=>{}}]:e.accountOptions.length===0?[{title:"No trading accounts",onSelect:()=>{}}]:e.accountOptions.map(n=>{const r=n.login===e.selectedLogin;return{title:QT(n,r),icon:r?UT:void 0,onSelect:()=>{r||t(n.login)}}})}function nE(e){for(const t of zT(e)){const n=t.querySelector(`[${zp}="true"]`);if(n instanceof HTMLElement)return n;for(const r of t.querySelectorAll("svg")){if(!(r.querySelector('rect[rx="5"]')instanceof SVGRectElement))continue;let s=r.parentElement;for(;s&&s!==t.body;){if(s.tagName==="BUTTON"||s.getAttribute("role")==="button")return s;s=s.parentElement}}}return null}function rE(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 sE(e,t,n){e.setAttribute(zp,"true"),HT(e),qT(e,n);const r=Mc(t);if(!qp(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}rE(e),e.style.border="1px solid transparent",e.style.borderRadius="6px",e.style.padding="0 10px"}function iE(e,t){if(!(e!=null&&e.isConnected))return;const n=Kp(e),r=()=>{const s=nE(e);s&&sE(s,t,n)};r(),requestAnimationFrame(r)}function oE(e){if(Jd.has(e))return;const t=new ResizeObserver(()=>{const r=Wp.get(e);r&&Gp(r.dropdown,r.state,r.onLoginChange,e)});t.observe(e);const n=e.querySelector("iframe");n instanceof HTMLIFrameElement&&t.observe(n),Jd.set(e,t)}function Gp(e,t,n,r){const s=Kp(r);try{e.applyOptions({title:XT(t),tooltip:JT(t),icon:eE(t,s),items:tE(t,n)})}catch{return}iE(r,t)}async function aE(e,t=()=>!0){try{await e.headerReady()}catch{return null}if(!t())return null;try{return await e.createDropdown({title:"",tooltip:"Select your trading account",align:"left",icon:Hp,items:[{title:"Loading accounts…",onSelect:()=>{}}]})}catch{return null}}function eu(e,t,n,r){!e||(r==null?void 0:r.isConnected)===!1||(r&&(Wp.set(r,{dropdown:e,state:t,onLoginChange:n}),oE(r)),Gp(e,t,n,r??null))}var Fc="ToastProvider",[Uc,cE,lE]=Fa("Toast"),[Zp]=Bn("Toast",[lE]),[dE,Qi]=Zp(Fc),Yp=e=>{const{__scopeToast:t,label:n="Notification",duration:r=5e3,swipeDirection:s="right",swipeThreshold:i=50,announcerContainer:o,children:a}=e,[l,d]=w.useState(null),[f,u]=w.useState(0),y=w.useRef(!1),p=w.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${Fc}\`. Expected non-empty \`string\`.`),c.jsx(Uc.Provider,{scope:t,children:c.jsx(dE,{scope:t,label:n,duration:r,swipeDirection:s,swipeThreshold:i,toastCount:f,viewport:l,onViewportChange:d,onToastAdd:w.useCallback(()=>u(g=>g+1),[]),onToastRemove:w.useCallback(()=>u(g=>g-1),[]),isFocusedToastEscapeKeyDownRef:y,isClosePausedRef:p,announcerContainer:o,children:a})})};Yp.displayName=Fc;var Qp="ToastViewport",uE=["F8"],Ca="toast.viewportPause",Ta="toast.viewportResume",Xp=w.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=uE,label:s="Notifications ({hotkey})",...i}=e,o=Qi(Qp,n),a=cE(n),l=w.useRef(null),d=w.useRef(null),f=w.useRef(null),u=w.useRef(null),y=Oe(t,u,o.onViewportChange),p=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),g=o.toastCount>0;w.useEffect(()=>{const h=v=>{var _;r.length!==0&&r.every(x=>v[x]||v.code===x)&&((_=u.current)==null||_.focus())};return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[r]),w.useEffect(()=>{const h=l.current,v=u.current;if(g&&h&&v){const b=()=>{if(!o.isClosePausedRef.current){const C=new CustomEvent(Ca);v.dispatchEvent(C),o.isClosePausedRef.current=!0}},_=()=>{if(o.isClosePausedRef.current){const C=new CustomEvent(Ta);v.dispatchEvent(C),o.isClosePausedRef.current=!1}},x=C=>{!h.contains(C.relatedTarget)&&_()},P=()=>{h.contains(document.activeElement)||_()};return h.addEventListener("focusin",b),h.addEventListener("focusout",x),h.addEventListener("pointermove",b),h.addEventListener("pointerleave",P),window.addEventListener("blur",b),window.addEventListener("focus",_),()=>{h.removeEventListener("focusin",b),h.removeEventListener("focusout",x),h.removeEventListener("pointermove",b),h.removeEventListener("pointerleave",P),window.removeEventListener("blur",b),window.removeEventListener("focus",_)}}},[g,o.isClosePausedRef]);const m=w.useCallback(({tabbingDirection:h})=>{const b=a().map(_=>{const x=_.ref.current,P=[x,...CE(x)];return h==="forwards"?P:P.reverse()});return(h==="forwards"?b.reverse():b).flat()},[a]);return w.useEffect(()=>{const h=u.current;if(h){const v=b=>{var P,C,E;const _=b.altKey||b.ctrlKey||b.metaKey;if(b.key==="Tab"&&!_){const A=document.activeElement,R=b.shiftKey;if(b.target===h&&R){(P=d.current)==null||P.focus();return}const L=m({tabbingDirection:R?"backwards":"forwards"}),H=L.findIndex(D=>D===A);Ao(L.slice(H+1))?b.preventDefault():R?(C=d.current)==null||C.focus():(E=f.current)==null||E.focus()}};return h.addEventListener("keydown",v),()=>h.removeEventListener("keydown",v)}},[a,m]),c.jsxs(kg,{ref:l,role:"region","aria-label":s.replace("{hotkey}",p),tabIndex:-1,style:{pointerEvents:g?void 0:"none"},children:[g&&c.jsx(Ea,{ref:d,onFocusFromOutsideViewport:()=>{const h=m({tabbingDirection:"forwards"});Ao(h)}}),c.jsx(Uc.Slot,{scope:n,children:c.jsx(he.ol,{tabIndex:-1,...i,ref:y})}),g&&c.jsx(Ea,{ref:f,onFocusFromOutsideViewport:()=>{const h=m({tabbingDirection:"backwards"});Ao(h)}})]})});Xp.displayName=Qp;var Jp="ToastFocusProxy",Ea=w.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...s}=e,i=Qi(Jp,n);return c.jsx(Ga,{tabIndex:0,...s,ref:t,style:{position:"fixed"},onFocus:o=>{var d;const a=o.relatedTarget;!((d=i.viewport)!=null&&d.contains(a))&&r()}})});Ea.displayName=Jp;var bs="Toast",fE="toast.swipeStart",mE="toast.swipeMove",pE="toast.swipeCancel",hE="toast.swipeEnd",eh=w.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:s,onOpenChange:i,...o}=e,[a,l]=Ln({prop:r,defaultProp:s??!0,onChange:i,caller:bs});return c.jsx($n,{present:n||a,children:c.jsx(bE,{open:a,...o,ref:t,onClose:()=>l(!1),onPause:yt(e.onPause),onResume:yt(e.onResume),onSwipeStart:me(e.onSwipeStart,d=>{d.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:me(e.onSwipeMove,d=>{const{x:f,y:u}=d.detail.delta;d.currentTarget.setAttribute("data-swipe","move"),d.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${f}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${u}px`)}),onSwipeCancel:me(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:me(e.onSwipeEnd,d=>{const{x:f,y:u}=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",`${f}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${u}px`),l(!1)})})})});eh.displayName=bs;var[gE,yE]=Zp(bs,{onClose(){}}),bE=w.forwardRef((e,t)=>{const{__scopeToast:n,type:r="foreground",duration:s,open:i,onClose:o,onEscapeKeyDown:a,onPause:l,onResume:d,onSwipeStart:f,onSwipeMove:u,onSwipeCancel:y,onSwipeEnd:p,...g}=e,m=Qi(bs,n),[h,v]=w.useState(null),b=Oe(t,D=>v(D)),_=w.useRef(null),x=w.useRef(null),P=s||m.duration,C=w.useRef(0),E=w.useRef(P),A=w.useRef(0),{onToastAdd:R,onToastRemove:M}=m,N=yt(()=>{var F;(h==null?void 0:h.contains(document.activeElement))&&((F=m.viewport)==null||F.focus()),o()}),L=w.useCallback(D=>{!D||D===1/0||(window.clearTimeout(A.current),C.current=new Date().getTime(),A.current=window.setTimeout(N,D))},[N]);w.useEffect(()=>{const D=m.viewport;if(D){const F=()=>{L(E.current),d==null||d()},I=()=>{const U=new Date().getTime()-C.current;E.current=E.current-U,window.clearTimeout(A.current),l==null||l()};return D.addEventListener(Ca,I),D.addEventListener(Ta,F),()=>{D.removeEventListener(Ca,I),D.removeEventListener(Ta,F)}}},[m.viewport,P,l,d,L]),w.useEffect(()=>{i&&!m.isClosePausedRef.current&&L(P)},[i,P,m.isClosePausedRef,L]),w.useEffect(()=>(R(),()=>M()),[R,M]);const H=w.useMemo(()=>h?ah(h):null,[h]);return m.viewport?c.jsxs(c.Fragment,{children:[H&&c.jsx(vE,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:H}),c.jsx(gE,{scope:n,onClose:N,children:Cr.createPortal(c.jsx(Uc.ItemSlot,{scope:n,children:c.jsx(Pg,{asChild:!0,onEscapeKeyDown:me(a,()=>{m.isFocusedToastEscapeKeyDownRef.current||N(),m.isFocusedToastEscapeKeyDownRef.current=!1}),children:c.jsx(he.li,{tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":m.swipeDirection,...g,ref:b,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:me(e.onKeyDown,D=>{D.key==="Escape"&&(a==null||a(D.nativeEvent),D.nativeEvent.defaultPrevented||(m.isFocusedToastEscapeKeyDownRef.current=!0,N()))}),onPointerDown:me(e.onPointerDown,D=>{D.button===0&&(_.current={x:D.clientX,y:D.clientY})}),onPointerMove:me(e.onPointerMove,D=>{if(!_.current)return;const F=D.clientX-_.current.x,I=D.clientY-_.current.y,U=!!x.current,O=["left","right"].includes(m.swipeDirection),B=["left","up"].includes(m.swipeDirection)?Math.min:Math.max,W=O?B(0,F):0,j=O?0:B(0,I),ee=D.pointerType==="touch"?10:2,X={x:W,y:j},de={originalEvent:D,delta:X};U?(x.current=X,Bs(mE,u,de,{discrete:!1})):tu(X,m.swipeDirection,ee)?(x.current=X,Bs(fE,f,de,{discrete:!1}),D.target.setPointerCapture(D.pointerId)):(Math.abs(F)>ee||Math.abs(I)>ee)&&(_.current=null)}),onPointerUp:me(e.onPointerUp,D=>{const F=x.current,I=D.target;if(I.hasPointerCapture(D.pointerId)&&I.releasePointerCapture(D.pointerId),x.current=null,_.current=null,F){const U=D.currentTarget,O={originalEvent:D,delta:F};tu(F,m.swipeDirection,m.swipeThreshold)?Bs(hE,p,O,{discrete:!0}):Bs(pE,y,O,{discrete:!0}),U.addEventListener("click",B=>B.preventDefault(),{once:!0})}})})})}),m.viewport)})]}):null}),vE=e=>{const{__scopeToast:t,children:n,...r}=e,s=Qi(bs,t),[i,o]=w.useState(!1),[a,l]=w.useState(!1);return xE(()=>o(!0)),w.useEffect(()=>{const d=window.setTimeout(()=>l(!0),1e3);return()=>window.clearTimeout(d)},[]),a?null:c.jsx(Si,{asChild:!0,container:s.announcerContainer||void 0,children:c.jsx(Ga,{...r,children:i&&c.jsxs(c.Fragment,{children:[s.label," ",n]})})})},wE="ToastTitle",th=w.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return c.jsx(he.div,{...r,ref:t})});th.displayName=wE;var _E="ToastDescription",nh=w.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return c.jsx(he.div,{...r,ref:t})});nh.displayName=_E;var rh="ToastAction",sh=w.forwardRef((e,t)=>{const{altText:n,...r}=e;return n.trim()?c.jsx(oh,{altText:n,asChild:!0,children:c.jsx(Bc,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${rh}\`. Expected non-empty \`string\`.`),null)});sh.displayName=rh;var ih="ToastClose",Bc=w.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,s=yE(ih,n);return c.jsx(oh,{asChild:!0,children:c.jsx(he.button,{type:"button",...r,ref:t,onClick:me(e.onClick,s.onClose)})})});Bc.displayName=ih;var oh=w.forwardRef((e,t)=>{const{__scopeToast:n,altText:r,...s}=e;return c.jsx(he.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...s,ref:t})});function ah(e){const t=[];return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),SE(r)){const s=r.ariaHidden||r.hidden||r.style.display==="none",i=r.dataset.radixToastAnnounceExclude==="";if(!s)if(i){const o=r.dataset.radixToastAnnounceAlt;o&&t.push(o)}else t.push(...ah(r))}}),t}function Bs(e,t,n,{discrete:r}){const s=n.originalEvent.currentTarget,i=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?_u(s,i):s.dispatchEvent(i)}var tu=(e,t,n=0)=>{const r=Math.abs(e.x),s=Math.abs(e.y),i=r>s;return t==="left"||t==="right"?i&&r>n:!i&&s>n};function xE(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 SE(e){return e.nodeType===e.ELEMENT_NODE}function CE(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Ao(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var TE=Yp,ch=Xp,lh=eh,dh=th,uh=nh,fh=sh,Xi=Bc;const EE=TE,mh=w.forwardRef(({className:e,...t},n)=>c.jsx(ch,{ref:n,className:Ee("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}));mh.displayName=ch.displayName;const PE=Pa("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"}}),ph=w.forwardRef(({className:e,variant:t,...n},r)=>c.jsx(lh,{ref:r,className:Ee(PE({variant:t}),e),...n}));ph.displayName=lh.displayName;const kE=w.forwardRef(({className:e,...t},n)=>c.jsx(fh,{ref:n,className:Ee("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}));kE.displayName=fh.displayName;const hh=w.forwardRef(({className:e,...t},n)=>c.jsx(Xi,{ref:n,className:Ee("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(Nv,{className:"h-4 min-h-4 w-4 min-w-4 text-black dark:text-white"})}));hh.displayName=Xi.displayName;const AE=w.forwardRef(({className:e,children:t,...n},r)=>c.jsx(Xi,{ref:r,className:Ee("text-foreground/50 rounded-md p-1 opacity-100 transition-opacity focus:opacity-100 focus:outline-none focus:ring-1",e),onClick:s=>{s.stopPropagation()},"toast-close":"",...n,children:t}));AE.displayName=Xi.displayName;const gh=w.forwardRef(({className:e,...t},n)=>c.jsx(dh,{ref:n,className:Ee("text-sm font-semibold [&+div]:text-base",e),...t}));gh.displayName=dh.displayName;const yh=w.forwardRef(({className:e,...t},n)=>c.jsx(uh,{ref:n,className:Ee("text-lg opacity-90 ",e),...t}));yh.displayName=uh.displayName;function OE(){const{toasts:e}=K0();return c.jsxs(EE,{children:[e.map(({id:t,title:n,description:r,action:s,...i})=>c.jsxs(ph,{...i,children:[c.jsxs("div",{className:"grid gap-1",children:[n?c.jsx(gh,{children:n}):null,r?c.jsx(yh,{children:r}):null]}),s,c.jsx(hh,{})]},t)),c.jsx(mh,{})]})}function NE(){const e=LT();return c.jsx(RT,{...e})}function RE({children:e,variant:t="chart",scanResultUrl:n,onScanResultUrlChange:r,onScanResultLoad:s,chartWidget:i,backUrl:o,createAccountUrl:a,dealDetailUrl:l}){const d=i!==void 0,f=ys(),u=LC({symbols:f,defaultPanelAfterConfirm:t==="news"?"market":"mini"}),y=S.useRef(null),p=S.useRef(null),[g,m]=S.useState(null),h=S.useCallback(V=>{m(V)},[]),[v,b]=S.useState(null),[_,x]=S.useState(null),P=d?i??null:v,[C,E]=S.useState(()=>gi(f)),[A,R]=S.useState(n??null),[M,N]=S.useState(()=>n?"scan":"trade");S.useEffect(()=>{R(n??null)},[n]),S.useEffect(()=>{N(A?"scan":"trade")},[A]);const L=S.useCallback(()=>{var V;N("trade"),(V=y.current)==null||V.open()},[]),{isLoading:H}=lp(u.selectedLogin),D=S.useRef(null),[F,I]=S.useState(u.selectedLogin),U=S.useCallback(V=>{V!==u.selectedLogin&&u.setSelectedLogin(V)},[u.selectedLogin,u.setSelectedLogin]),O=H&&u.selectedLogin!==F,B=S.useCallback(V=>{E(V)},[]),W=S.useCallback(V=>{R(V),r==null||r(V)},[r]),{chartContainer:j}=DC({chartWidget:d?P:null,symbols:f,chartSlotElement:d?g:null,onSymbolTickerChange:B,onScanResultUrlChange:W,selectSymbolTickerRef:p}),ee=d?j:_,X=S.useCallback(V=>{var K;(K=p.current)==null||K.call(p,V)},[]),de=S.useMemo(()=>({controlsRef:y,onSymbolTickerChange:B,onScanResultUrlChange:W,onChartWidgetChange:d?()=>{}:b,onChartContainerChange:d?()=>{}:x,selectSymbolTickerRef:p}),[W,B,d]);S.useEffect(()=>{if(t!=="news"){y.current=null;return}return y.current={open:u.openMarketPanel,setSelectedLogin:u.setSelectedLogin},()=>{y.current=null}},[u.openMarketPanel,u.setSelectedLogin,t]),S.useEffect(()=>{!H&&u.selectedLogin!==F&&I(u.selectedLogin)},[H,F,u.selectedLogin]),S.useEffect(()=>{var ie;if(!P||!u.hasConfirmedAccount){(ie=D.current)==null||ie.remove(),D.current=null;return}let V=!1;return(async()=>{try{const ge=await aE(P,()=>!V);if(V){ge==null||ge.remove();return}D.current=ge,eu(D.current,{accountOptions:u.accountOptions,selectedLogin:u.selectedLogin,isAccountsLoading:u.isAccountsLoading,isAccountDataLoading:O},U,ee)}catch{}})(),()=>{var ge;V=!0,(ge=D.current)==null||ge.remove(),D.current=null}},[ee,P,u.hasConfirmedAccount]),S.useEffect(()=>{u.hasConfirmedAccount&&eu(D.current,{accountOptions:u.accountOptions,selectedLogin:u.selectedLogin,isAccountsLoading:u.isAccountsLoading,isAccountDataLoading:O},U,ee)},[ee,U,O,u.accountOptions,u.hasConfirmedAccount,u.isAccountsLoading,u.selectedLogin]);const ue=e??(d?null:c.jsx(NE,{}));return t==="news"?c.jsx(Xd,{value:de,children:c.jsxs("div",{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(Fm,{}),c.jsx(qf,{open:u.needsAccountSelection,isAccountsLoading:u.isAccountsLoading,accountOptions:u.accountOptions,onConfirm:u.confirmAccountSelection,backUrl:o,createAccountUrl:a}),c.jsxs("div",{className:"web-trading-widget-trading-layout__news-body",children:[d?c.jsx("div",{ref:h,className:"web-trading-widget-trading-layout__host-chart-slot",children:ue}):ue,c.jsx(MT,{symbolTicker:C,chartWidget:P,orderState:u})]})]}),c.jsx(pp,{onCreateNewOrder:()=>{var V;return(V=y.current)==null?void 0:V.open()}})]})}):c.jsx(Xd,{value:de,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(x0,{controlsRef:y,symbolTicker:C,chartWidget:P,sidePanelTab:M,orderState:u,backUrl:o,createAccountUrl:a}),c.jsx("div",{ref:d?h:void 0,className:"web-trading-widget-trading-layout__chart-slot",children:ue})]}),c.jsx(OC,{symbolTicker:C,orderState:u,scanResultUrl:A,activeTab:M,onTabChange:N,onScanResultLoad:s})]}),c.jsx(fp,{symbolTicker:C,onSymbolChange:X,onCreateNewOrder:L,dealDetailUrl:l})]})})}function LE({baseUrl:e,token:t,variant:n="chart",scanResultUrl:r,onScanResultLoad:s,onScanResultUrlChange:i,children:o,chartWidget:a,backUrl:l,createAccountUrl:d,dealDetailUrl:f}){return c.jsx(WS,{token:t,children:c.jsx(mp,{children:c.jsxs(Im,{baseUrl:e,children:[c.jsx(RE,{variant:n,scanResultUrl:r,onScanResultUrlChange:i,chartWidget:a,onScanResultLoad:s,backUrl:l,createAccountUrl:d,dealDetailUrl:f,children:o}),c.jsx(OE,{})]})})})}exports.ChartNewsOrdersOverlay=oC;exports.WebTradingWidget=LE;
|
|
90
|
+
</svg>`,Kp="data-opheleo-account-dropdown",$T="148px",VT=640,HT="MT5",nu=new WeakMap,qp=new WeakMap;function zT(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 WT(e){const t=new Set([document,e.ownerDocument]),n=e.querySelector("iframe");return n instanceof HTMLIFrameElement&&n.contentDocument&&t.add(n.contentDocument),[...t]}function Gp(e){if(!e)return!1;const t=e.querySelector("iframe");return(t instanceof HTMLIFrameElement?t.clientWidth:e.clientWidth)<VT}function KT(e){e.classList.forEach(t=>{t.includes("iconOnly")&&e.classList.remove(t)})}function qT(e,t){e.querySelectorAll("svg").forEach(n=>{n.style.display=t?"none":""})}function GT(e,t){KT(e),e.style.flexShrink="0",e.style.minWidth=t?"auto":$T,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")}),qT(e,t)}function ZT(e){const[t]=e.label.split(" · ");return t??e.label}function YT(e){return`${HT} ${e.login}`}function QT(e){return`${e.label} — ${e.balance.toFixed(2)} ${e.currency}`}function XT(e,t){const n=ZT(e),r=`${e.balance.toFixed(2)} ${e.currency}`;return`${e.login} · ${n} (${r})${t?" · Active":""}`}function Bc(e){return e.accountOptions.length===0?null:e.accountOptions.find(t=>t.login===e.selectedLogin)??e.accountOptions[0]}function Zp(e){return e.isAccountsLoading||e.isAccountDataLoading}function JT(e){if(e.isAccountsLoading||e.accountOptions.length===0)return"";const t=Bc(e);return t?YT(t):""}function eE(e){if(e.isAccountsLoading)return"Loading accounts…";if(e.isAccountDataLoading)return"Switching account…";const t=Bc(e);return t?QT(t):"Select your trading account"}function tE(e,t){if(!t)return Zp(e)?Wp:UT}function nE(e,t){return e.isAccountsLoading?[{title:"Loading accounts…",onSelect:()=>{}}]:e.isAccountDataLoading?[{title:"Switching account…",onSelect:()=>{}}]:e.accountOptions.length===0?[{title:"No trading accounts",onSelect:()=>{}}]:e.accountOptions.map(n=>{const r=n.login===e.selectedLogin;return{title:XT(n,r),icon:r?BT:void 0,onSelect:()=>{r||t(n.login)}}})}function rE(e){for(const t of WT(e)){const n=t.querySelector(`[${Kp}="true"]`);if(n instanceof HTMLElement)return n;for(const r of t.querySelectorAll("svg")){if(!(r.querySelector('rect[rx="5"]')instanceof SVGRectElement))continue;let s=r.parentElement;for(;s&&s!==t.body;){if(s.tagName==="BUTTON"||s.getAttribute("role")==="button")return s;s=s.parentElement}}}return null}function sE(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 iE(e,t,n){e.setAttribute(Kp,"true"),zT(e),GT(e,n);const r=Bc(t);if(!Zp(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}sE(e),e.style.border="1px solid transparent",e.style.borderRadius="6px",e.style.padding="0 10px"}function oE(e,t){if(!(e!=null&&e.isConnected))return;const n=Gp(e),r=()=>{const s=rE(e);s&&iE(s,t,n)};r(),requestAnimationFrame(r)}function aE(e){if(nu.has(e))return;const t=new ResizeObserver(()=>{const r=qp.get(e);r&&Yp(r.dropdown,r.state,r.onLoginChange,e)});t.observe(e);const n=e.querySelector("iframe");n instanceof HTMLIFrameElement&&t.observe(n),nu.set(e,t)}function Yp(e,t,n,r){const s=Gp(r);try{e.applyOptions({title:JT(t),tooltip:eE(t),icon:tE(t,s),items:nE(t,n)})}catch{return}oE(r,t)}async function cE(e,t=()=>!0){try{await e.headerReady()}catch{return null}if(!t())return null;try{return await e.createDropdown({title:"",tooltip:"Select your trading account",align:"left",icon:Wp,items:[{title:"Loading accounts…",onSelect:()=>{}}]})}catch{return null}}function ru(e,t,n,r){!e||(r==null?void 0:r.isConnected)===!1||(r&&(qp.set(r,{dropdown:e,state:t,onLoginChange:n}),aE(r)),Yp(e,t,n,r??null))}var $c="ToastProvider",[Vc,lE,dE]=$a("Toast"),[Qp]=Bn("Toast",[dE]),[uE,Qi]=Qp($c),Xp=e=>{const{__scopeToast:t,label:n="Notification",duration:r=5e3,swipeDirection:s="right",swipeThreshold:i=50,announcerContainer:o,children:a}=e,[l,d]=w.useState(null),[f,u]=w.useState(0),g=w.useRef(!1),h=w.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${$c}\`. Expected non-empty \`string\`.`),c.jsx(Vc.Provider,{scope:t,children:c.jsx(uE,{scope:t,label:n,duration:r,swipeDirection:s,swipeThreshold:i,toastCount:f,viewport:l,onViewportChange:d,onToastAdd:w.useCallback(()=>u(v=>v+1),[]),onToastRemove:w.useCallback(()=>u(v=>v-1),[]),isFocusedToastEscapeKeyDownRef:g,isClosePausedRef:h,announcerContainer:o,children:a})})};Xp.displayName=$c;var Jp="ToastViewport",fE=["F8"],Pa="toast.viewportPause",ka="toast.viewportResume",eh=w.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=fE,label:s="Notifications ({hotkey})",...i}=e,o=Qi(Jp,n),a=lE(n),l=w.useRef(null),d=w.useRef(null),f=w.useRef(null),u=w.useRef(null),g=Ne(t,u,o.onViewportChange),h=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),v=o.toastCount>0;w.useEffect(()=>{const m=y=>{var _;r.length!==0&&r.every(x=>y[x]||y.code===x)&&((_=u.current)==null||_.focus())};return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[r]),w.useEffect(()=>{const m=l.current,y=u.current;if(v&&m&&y){const b=()=>{if(!o.isClosePausedRef.current){const S=new CustomEvent(Pa);y.dispatchEvent(S),o.isClosePausedRef.current=!0}},_=()=>{if(o.isClosePausedRef.current){const S=new CustomEvent(ka);y.dispatchEvent(S),o.isClosePausedRef.current=!1}},x=S=>{!m.contains(S.relatedTarget)&&_()},T=()=>{m.contains(document.activeElement)||_()};return m.addEventListener("focusin",b),m.addEventListener("focusout",x),m.addEventListener("pointermove",b),m.addEventListener("pointerleave",T),window.addEventListener("blur",b),window.addEventListener("focus",_),()=>{m.removeEventListener("focusin",b),m.removeEventListener("focusout",x),m.removeEventListener("pointermove",b),m.removeEventListener("pointerleave",T),window.removeEventListener("blur",b),window.removeEventListener("focus",_)}}},[v,o.isClosePausedRef]);const p=w.useCallback(({tabbingDirection:m})=>{const b=a().map(_=>{const x=_.ref.current,T=[x,...TE(x)];return m==="forwards"?T:T.reverse()});return(m==="forwards"?b.reverse():b).flat()},[a]);return w.useEffect(()=>{const m=u.current;if(m){const y=b=>{var T,S,E;const _=b.altKey||b.ctrlKey||b.metaKey;if(b.key==="Tab"&&!_){const O=document.activeElement,R=b.shiftKey;if(b.target===m&&R){(T=d.current)==null||T.focus();return}const L=p({tabbingDirection:R?"backwards":"forwards"}),V=L.findIndex(j=>j===O);No(L.slice(V+1))?b.preventDefault():R?(S=d.current)==null||S.focus():(E=f.current)==null||E.focus()}};return m.addEventListener("keydown",y),()=>m.removeEventListener("keydown",y)}},[a,p]),c.jsxs(Og,{ref:l,role:"region","aria-label":s.replace("{hotkey}",h),tabIndex:-1,style:{pointerEvents:v?void 0:"none"},children:[v&&c.jsx(Aa,{ref:d,onFocusFromOutsideViewport:()=>{const m=p({tabbingDirection:"forwards"});No(m)}}),c.jsx(Vc.Slot,{scope:n,children:c.jsx(ye.ol,{tabIndex:-1,...i,ref:g})}),v&&c.jsx(Aa,{ref:f,onFocusFromOutsideViewport:()=>{const m=p({tabbingDirection:"backwards"});No(m)}})]})});eh.displayName=Jp;var th="ToastFocusProxy",Aa=w.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...s}=e,i=Qi(th,n);return c.jsx(Qa,{tabIndex:0,...s,ref:t,style:{position:"fixed"},onFocus:o=>{var d;const a=o.relatedTarget;!((d=i.viewport)!=null&&d.contains(a))&&r()}})});Aa.displayName=th;var bs="Toast",mE="toast.swipeStart",pE="toast.swipeMove",hE="toast.swipeCancel",gE="toast.swipeEnd",nh=w.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:s,onOpenChange:i,...o}=e,[a,l]=Ln({prop:r,defaultProp:s??!0,onChange:i,caller:bs});return c.jsx($n,{present:n||a,children:c.jsx(vE,{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:f,y:u}=d.detail.delta;d.currentTarget.setAttribute("data-swipe","move"),d.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${f}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${u}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:f,y:u}=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",`${f}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${u}px`),l(!1)})})})});nh.displayName=bs;var[yE,bE]=Qp(bs,{onClose(){}}),vE=w.forwardRef((e,t)=>{const{__scopeToast:n,type:r="foreground",duration:s,open:i,onClose:o,onEscapeKeyDown:a,onPause:l,onResume:d,onSwipeStart:f,onSwipeMove:u,onSwipeCancel:g,onSwipeEnd:h,...v}=e,p=Qi(bs,n),[m,y]=w.useState(null),b=Ne(t,j=>y(j)),_=w.useRef(null),x=w.useRef(null),T=s||p.duration,S=w.useRef(0),E=w.useRef(T),O=w.useRef(0),{onToastAdd:R,onToastRemove:M}=p,N=yt(()=>{var U;(m==null?void 0:m.contains(document.activeElement))&&((U=p.viewport)==null||U.focus()),o()}),L=w.useCallback(j=>{!j||j===1/0||(window.clearTimeout(O.current),S.current=new Date().getTime(),O.current=window.setTimeout(N,j))},[N]);w.useEffect(()=>{const j=p.viewport;if(j){const U=()=>{L(E.current),d==null||d()},D=()=>{const $=new Date().getTime()-S.current;E.current=E.current-$,window.clearTimeout(O.current),l==null||l()};return j.addEventListener(Pa,D),j.addEventListener(ka,U),()=>{j.removeEventListener(Pa,D),j.removeEventListener(ka,U)}}},[p.viewport,T,l,d,L]),w.useEffect(()=>{i&&!p.isClosePausedRef.current&&L(T)},[i,T,p.isClosePausedRef,L]),w.useEffect(()=>(R(),()=>M()),[R,M]);const V=w.useMemo(()=>m?lh(m):null,[m]);return p.viewport?c.jsxs(c.Fragment,{children:[V&&c.jsx(wE,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:V}),c.jsx(yE,{scope:n,onClose:N,children:Cr.createPortal(c.jsx(Vc.ItemSlot,{scope:n,children:c.jsx(Ag,{asChild:!0,onEscapeKeyDown:he(a,()=>{p.isFocusedToastEscapeKeyDownRef.current||N(),p.isFocusedToastEscapeKeyDownRef.current=!1}),children:c.jsx(ye.li,{tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":p.swipeDirection,...v,ref:b,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:he(e.onKeyDown,j=>{j.key==="Escape"&&(a==null||a(j.nativeEvent),j.nativeEvent.defaultPrevented||(p.isFocusedToastEscapeKeyDownRef.current=!0,N()))}),onPointerDown:he(e.onPointerDown,j=>{j.button===0&&(_.current={x:j.clientX,y:j.clientY})}),onPointerMove:he(e.onPointerMove,j=>{if(!_.current)return;const U=j.clientX-_.current.x,D=j.clientY-_.current.y,$=!!x.current,A=["left","right"].includes(p.swipeDirection),F=["left","up"].includes(p.swipeDirection)?Math.min:Math.max,W=A?F(0,U):0,I=A?0:F(0,D),ee=j.pointerType==="touch"?10:2,J={x:W,y:I},ue={originalEvent:j,delta:J};$?(x.current=J,Bs(pE,u,ue,{discrete:!1})):su(J,p.swipeDirection,ee)?(x.current=J,Bs(mE,f,ue,{discrete:!1}),j.target.setPointerCapture(j.pointerId)):(Math.abs(U)>ee||Math.abs(D)>ee)&&(_.current=null)}),onPointerUp:he(e.onPointerUp,j=>{const U=x.current,D=j.target;if(D.hasPointerCapture(j.pointerId)&&D.releasePointerCapture(j.pointerId),x.current=null,_.current=null,U){const $=j.currentTarget,A={originalEvent:j,delta:U};su(U,p.swipeDirection,p.swipeThreshold)?Bs(gE,h,A,{discrete:!0}):Bs(hE,g,A,{discrete:!0}),$.addEventListener("click",F=>F.preventDefault(),{once:!0})}})})})}),p.viewport)})]}):null}),wE=e=>{const{__scopeToast:t,children:n,...r}=e,s=Qi(bs,t),[i,o]=w.useState(!1),[a,l]=w.useState(!1);return SE(()=>o(!0)),w.useEffect(()=>{const d=window.setTimeout(()=>l(!0),1e3);return()=>window.clearTimeout(d)},[]),a?null:c.jsx(Si,{asChild:!0,container:s.announcerContainer||void 0,children:c.jsx(Qa,{...r,children:i&&c.jsxs(c.Fragment,{children:[s.label," ",n]})})})},_E="ToastTitle",rh=w.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return c.jsx(ye.div,{...r,ref:t})});rh.displayName=_E;var xE="ToastDescription",sh=w.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return c.jsx(ye.div,{...r,ref:t})});sh.displayName=xE;var ih="ToastAction",oh=w.forwardRef((e,t)=>{const{altText:n,...r}=e;return n.trim()?c.jsx(ch,{altText:n,asChild:!0,children:c.jsx(Hc,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${ih}\`. Expected non-empty \`string\`.`),null)});oh.displayName=ih;var ah="ToastClose",Hc=w.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,s=bE(ah,n);return c.jsx(ch,{asChild:!0,children:c.jsx(ye.button,{type:"button",...r,ref:t,onClick:he(e.onClick,s.onClose)})})});Hc.displayName=ah;var ch=w.forwardRef((e,t)=>{const{__scopeToast:n,altText:r,...s}=e;return c.jsx(ye.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...s,ref:t})});function lh(e){const t=[];return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),CE(r)){const s=r.ariaHidden||r.hidden||r.style.display==="none",i=r.dataset.radixToastAnnounceExclude==="";if(!s)if(i){const o=r.dataset.radixToastAnnounceAlt;o&&t.push(o)}else t.push(...lh(r))}}),t}function Bs(e,t,n,{discrete:r}){const s=n.originalEvent.currentTarget,i=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?Cu(s,i):s.dispatchEvent(i)}var su=(e,t,n=0)=>{const r=Math.abs(e.x),s=Math.abs(e.y),i=r>s;return t==="left"||t==="right"?i&&r>n:!i&&s>n};function SE(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 CE(e){return e.nodeType===e.ELEMENT_NODE}function TE(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function No(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var EE=Xp,dh=eh,uh=nh,fh=rh,mh=sh,ph=oh,Xi=Hc;const PE=EE,hh=w.forwardRef(({className:e,...t},n)=>c.jsx(dh,{ref:n,className:Pe("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}));hh.displayName=dh.displayName;const kE=Oa("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"}}),gh=w.forwardRef(({className:e,variant:t,...n},r)=>c.jsx(uh,{ref:r,className:Pe(kE({variant:t}),e),...n}));gh.displayName=uh.displayName;const AE=w.forwardRef(({className:e,...t},n)=>c.jsx(ph,{ref:n,className:Pe("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}));AE.displayName=ph.displayName;const yh=w.forwardRef(({className:e,...t},n)=>c.jsx(Xi,{ref:n,className:Pe("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(Lv,{className:"h-4 min-h-4 w-4 min-w-4 text-black dark:text-white"})}));yh.displayName=Xi.displayName;const OE=w.forwardRef(({className:e,children:t,...n},r)=>c.jsx(Xi,{ref:r,className:Pe("text-foreground/50 rounded-md p-1 opacity-100 transition-opacity focus:opacity-100 focus:outline-none focus:ring-1",e),onClick:s=>{s.stopPropagation()},"toast-close":"",...n,children:t}));OE.displayName=Xi.displayName;const bh=w.forwardRef(({className:e,...t},n)=>c.jsx(fh,{ref:n,className:Pe("text-sm font-semibold [&+div]:text-base",e),...t}));bh.displayName=fh.displayName;const vh=w.forwardRef(({className:e,...t},n)=>c.jsx(mh,{ref:n,className:Pe("text-lg opacity-90 ",e),...t}));vh.displayName=mh.displayName;function NE(){const{toasts:e}=q0();return c.jsxs(PE,{children:[e.map(({id:t,title:n,description:r,action:s,...i})=>c.jsxs(gh,{...i,children:[c.jsxs("div",{className:"grid gap-1",children:[n?c.jsx(bh,{children:n}):null,r?c.jsx(vh,{children:r}):null]}),s,c.jsx(yh,{})]},t)),c.jsx(hh,{})]})}function RE(){const e=DT();return c.jsx(LT,{...e})}function LE({children:e,variant:t="chart",scanResultUrl:n,onScanResultUrlChange:r,onScanResultLoad:s,chartWidget:i,backUrl:o,createAccountUrl:a,dealDetailUrl:l}){const d=i!==void 0,f=ys(),u=DC({symbols:f,defaultPanelAfterConfirm:t==="news"?"market":"mini"}),g=C.useRef(null),h=C.useRef(null),[v,p]=C.useState(null),m=C.useCallback(B=>{p(B)},[]),[y,b]=C.useState(null),[_,x]=C.useState(null),T=d?i??null:y,[S,E]=C.useState(()=>gi(f)),[O,R]=C.useState(n??null),[M,N]=C.useState(()=>n?"scan":"trade");C.useEffect(()=>{R(n??null)},[n]),C.useEffect(()=>{N(O?"scan":"trade")},[O]);const L=C.useCallback(()=>{var B;N("trade"),(B=g.current)==null||B.open()},[]),{isLoading:V}=up(u.selectedLogin,u.hasConfirmedAccount),j=C.useRef(null),[U,D]=C.useState(u.selectedLogin),$=C.useCallback(B=>{B!==u.selectedLogin&&u.setSelectedLogin(B)},[u.selectedLogin,u.setSelectedLogin]),A=V&&u.selectedLogin!==U,F=C.useCallback(B=>{E(B)},[]),W=C.useCallback(B=>{R(B),r==null||r(B)},[r]),{chartContainer:I}=jC({chartWidget:d?T:null,symbols:f,chartSlotElement:d?v:null,onSymbolTickerChange:F,onScanResultUrlChange:W,selectSymbolTickerRef:h}),ee=d?I:_,J=C.useCallback(B=>{var K;(K=h.current)==null||K.call(h,B)},[]),ue=C.useMemo(()=>({controlsRef:g,onSymbolTickerChange:F,onScanResultUrlChange:W,onChartWidgetChange:d?()=>{}:b,onChartContainerChange:d?()=>{}:x,selectSymbolTickerRef:h}),[W,F,d]);C.useEffect(()=>{if(t!=="news"){g.current=null;return}return g.current={open:u.openMarketPanel,setSelectedLogin:u.setSelectedLogin},()=>{g.current=null}},[u.openMarketPanel,u.setSelectedLogin,t]),C.useEffect(()=>{!V&&u.selectedLogin!==U&&D(u.selectedLogin)},[V,U,u.selectedLogin]),C.useEffect(()=>{var de;if(!T||!u.hasConfirmedAccount){(de=j.current)==null||de.remove(),j.current=null;return}let B=!1;return(async()=>{try{const fe=await cE(T,()=>!B);if(B){fe==null||fe.remove();return}j.current=fe,ru(j.current,{accountOptions:u.accountOptions,selectedLogin:u.selectedLogin,isAccountsLoading:u.isAccountsLoading,isAccountDataLoading:A},$,ee)}catch{}})(),()=>{var fe;B=!0,(fe=j.current)==null||fe.remove(),j.current=null}},[ee,T,u.hasConfirmedAccount]),C.useEffect(()=>{u.hasConfirmedAccount&&ru(j.current,{accountOptions:u.accountOptions,selectedLogin:u.selectedLogin,isAccountsLoading:u.isAccountsLoading,isAccountDataLoading:A},$,ee)},[ee,$,A,u.accountOptions,u.hasConfirmedAccount,u.isAccountsLoading,u.selectedLogin]);const me=e??(d?null:c.jsx(RE,{}));return t==="news"?c.jsx(tu,{value:ue,children:c.jsxs("div",{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($m,{}),c.jsx(Yf,{open:u.needsAccountSelection,isAccountsLoading:u.isAccountsLoading,accountOptions:u.accountOptions,onConfirm:u.confirmAccountSelection,backUrl:o,createAccountUrl:a}),c.jsxs("div",{className:"web-trading-widget-trading-layout__news-body",children:[d?c.jsx("div",{ref:m,className:"web-trading-widget-trading-layout__host-chart-slot",children:me}):me,c.jsx(FT,{symbolTicker:S,chartWidget:T,orderState:u})]})]}),c.jsx(gp,{onCreateNewOrder:()=>{var B;return(B=g.current)==null?void 0:B.open()},tradeDataEnabled:u.hasConfirmedAccount})]})}):c.jsx(tu,{value:ue,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(S0,{controlsRef:g,symbolTicker:S,chartWidget:T,sidePanelTab:M,orderState:u,backUrl:o,createAccountUrl:a}),c.jsx("div",{ref:d?m:void 0,className:"web-trading-widget-trading-layout__chart-slot",children:me})]}),c.jsx(NC,{symbolTicker:S,orderState:u,scanResultUrl:O,activeTab:M,onTabChange:N,onScanResultLoad:s})]}),c.jsx(pp,{symbolTicker:S,onSymbolChange:J,onCreateNewOrder:L,dealDetailUrl:l,tradeDataEnabled:u.hasConfirmedAccount})]})})}function DE({baseUrl:e,token:t,variant:n="chart",scanResultUrl:r,onScanResultLoad:s,onScanResultUrlChange:i,children:o,chartWidget:a,backUrl:l,createAccountUrl:d,dealDetailUrl:f}){return c.jsx(KS,{token:t,children:c.jsx(hp,{children:c.jsxs(Um,{baseUrl:e,children:[c.jsx(LE,{variant:n,scanResultUrl:r,onScanResultUrlChange:i,chartWidget:a,onScanResultLoad:s,backUrl:l,createAccountUrl:d,dealDetailUrl:f,children:o}),c.jsx(NE,{})]})})})}exports.ChartNewsOrdersOverlay=aC;exports.WebTradingWidget=DE;
|