@iccandle/widget-web-trading 0.0.6 → 0.0.7

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.
@@ -1,5 +1,5 @@
1
- "use strict";var yh=Object.defineProperty;var yc=e=>{throw TypeError(e)};var bh=(e,t,n)=>t in e?yh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var st=(e,t,n)=>bh(e,typeof t!="symbol"?t+"":t,n),Ui=(e,t,n)=>t.has(e)||yc("Cannot "+n);var E=(e,t,n)=>(Ui(e,t,"read from private field"),n?n.call(e):t.get(e)),ee=(e,t,n)=>t.has(e)?yc("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),W=(e,t,n,r)=>(Ui(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),fe=(e,t,n)=>(Ui(e,t,"access private method"),n);var ls=(e,t,n,r)=>({set _(s){W(e,t,s,n)},get _(){return E(e,t,r)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),S=require("react"),vh=require("react-dom");function Rd(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=Rd(S),Jr=Rd(vh);function bc(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function wh(...e){return t=>{let n=!1;const r=e.map(s=>{const i=bc(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():bc(e[s],null)}}}}function Pe(...e){return w.useCallback(wh(...e),e)}function dr(e){const t=w.forwardRef((n,r)=>{let{children:s,...i}=n,o=null,a=!1;const c=[];vc(s)&&typeof ds=="function"&&(s=ds(s._payload)),w.Children.forEach(s,m=>{var h;if(Th(m)){a=!0;const g=m;let p="child"in g.props?g.props.child:g.props.children;vc(p)&&typeof ds=="function"&&(p=ds(p._payload)),o=Sh(g,p),c.push((h=o==null?void 0:o.props)==null?void 0:h.children)}else c.push(m)}),o?o=w.cloneElement(o,void 0,c):!a&&w.Children.count(s)===1&&w.isValidElement(s)&&(o=s);const d=o?Eh(o):void 0,u=Pe(r,d);if(!o){if(s||s===0)throw new Error(a?Ah(e):Oh(e));return s}const f=Ch(i,o.props??{});return o.type!==w.Fragment&&(f.ref=r?u:d),w.cloneElement(o,f)});return t.displayName=`${e}.Slot`,t}var _h=dr("Slot"),xh=Symbol.for("radix.slottable"),Sh=(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 Ch(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 c=i(...a);return s(...a),c}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...e,...n}}function Eh(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 Th(e){return w.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===xh}var Ph=Symbol.for("react.lazy");function vc(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Ph&&"_payload"in e&&kh(e._payload)}function kh(e){return typeof e=="object"&&e!==null&&"then"in e}var Oh=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,Ah=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,ds=w[" use ".trim().toString()];function Nd(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=Nd(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Dd(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=Nd(e))&&(r&&(r+=" "),r+=t);return r}const wc=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,_c=Dd,Ld=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return _c(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 u=n==null?void 0:n[d],f=i==null?void 0:i[d];if(u===null)return null;const m=wc(u)||wc(f);return s[d][m]}),a=n&&Object.entries(n).reduce((d,u)=>{let[f,m]=u;return m===void 0||(d[f]=m),d},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((d,u)=>{let{class:f,className:m,...h}=u;return Object.entries(h).every(g=>{let[p,y]=g;return Array.isArray(y)?y.includes({...i,...a}[p]):{...i,...a}[p]===y})?[...d,f,m]:d},[]);return _c(e,o,c,n==null?void 0:n.class,n==null?void 0:n.className)},un=[{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"}],Rh={[-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 Nh(){const e=-new Date().getTimezoneOffset()/60,t=Rh[e];return t&&t.length>0?t[0]:"Etc/UTC"}const Ir="tv:latest-symbol";function Dh(){for(var e=0,t,n,r="";e<arguments.length;)(t=arguments[e++])&&(n=jd(t))&&(r&&(r+=" "),r+=n);return r}function jd(e){if(typeof e=="string")return e;for(var t,n="",r=0;r<e.length;r++)e[r]&&(t=jd(e[r]))&&(n&&(n+=" "),n+=t);return n}var ca="-";function Lh(e){var t=Mh(e),n=e.conflictingClassGroups,r=e.conflictingClassGroupModifiers,s=r===void 0?{}:r;function i(a){var c=a.split(ca);return c[0]===""&&c.length!==1&&c.shift(),Md(c,t)||jh(a)}function o(a,c){var d=n[a]||[];return c&&s[a]?[].concat(d,s[a]):d}return{getClassGroupId:i,getConflictingClassGroupIds:o}}function Md(e,t){var o;if(e.length===0)return t.classGroupId;var n=e[0],r=t.nextPart.get(n),s=r?Md(e.slice(1),r):void 0;if(s)return s;if(t.validators.length!==0){var i=e.join(ca);return(o=t.validators.find(function(a){var c=a.validator;return c(i)}))==null?void 0:o.classGroupId}}var xc=/^\[(.+)\]$/;function jh(e){if(xc.test(e)){var t=xc.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}}function Mh(e){var t=e.theme,n=e.prefix,r={nextPart:new Map,validators:[]},s=Fh(Object.entries(e.classGroups),n);return s.forEach(function(i){var o=i[0],a=i[1];mo(a,r,o,t)}),r}function mo(e,t,n,r){e.forEach(function(s){if(typeof s=="string"){var i=s===""?t:Sc(t,s);i.classGroupId=n;return}if(typeof s=="function"){if(Ih(s)){mo(s(r),t,n,r);return}t.validators.push({validator:s,classGroupId:n});return}Object.entries(s).forEach(function(o){var a=o[0],c=o[1];mo(c,Sc(t,a),n,r)})})}function Sc(e,t){var n=e;return t.split(ca).forEach(function(r){n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n}function Ih(e){return e.isThemeGetter}function Fh(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 c=a[0],d=a[1];return[t+c,d]})):o});return[r,i]}):e}function Uh(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 Id="!";function Bh(e){var t=e.separator||":",n=t.length===1,r=t[0],s=t.length;return function(o){for(var a=[],c=0,d=0,u,f=0;f<o.length;f++){var m=o[f];if(c===0){if(m===r&&(n||o.slice(f,f+s)===t)){a.push(o.slice(d,f)),d=f+s;continue}if(m==="/"){u=f;continue}}m==="["?c++:m==="]"&&c--}var h=a.length===0?o:o.substring(d),g=h.startsWith(Id),p=g?h.substring(1):h,y=u&&u>d?u-d:void 0;return{modifiers:a,hasImportantModifier:g,baseClassName:p,maybePostfixModifierPosition:y}}}function $h(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 Vh(e){return{cache:Uh(e.cacheSize),splitModifiers:Bh(e),...Lh(e)}}var Hh=/\s+/;function zh(e,t){var n=t.splitModifiers,r=t.getClassGroupId,s=t.getConflictingClassGroupIds,i=new Set;return e.trim().split(Hh).map(function(o){var a=n(o),c=a.modifiers,d=a.hasImportantModifier,u=a.baseClassName,f=a.maybePostfixModifierPosition,m=r(f?u.substring(0,f):u),h=!!f;if(!m){if(!f)return{isTailwindClass:!1,originalClassName:o};if(m=r(u),!m)return{isTailwindClass:!1,originalClassName:o};h=!1}var g=$h(c).join(":"),p=d?g+Id:g;return{isTailwindClass:!0,modifierId:p,classGroupId:m,originalClassName:o,hasPostfixModifier:h}}).reverse().filter(function(o){if(!o.isTailwindClass)return!0;var a=o.modifierId,c=o.classGroupId,d=o.hasPostfixModifier,u=a+c;return i.has(u)?!1:(i.add(u),s(c,d).forEach(function(f){return i.add(a+f)}),!0)}).reverse().map(function(o){return o.originalClassName}).join(" ")}function Wh(){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 u=t[0],f=t.slice(1),m=f.reduce(function(h,g){return g(h)},u());return r=Vh(m),s=r.cache.get,i=r.cache.set,o=c,c(d)}function c(d){var u=s(d);if(u)return u;var f=zh(d,r);return i(d,f),f}return function(){return o(Dh.apply(null,arguments))}}function Ee(e){var t=function(r){return r[e]||[]};return t.isThemeGetter=!0,t}var Fd=/^\[(?:([a-z-]+):)?(.+)\]$/i,Gh=/^\d+\/\d+$/,qh=new Set(["px","full","screen"]),Kh=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Zh=/\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$/,Yh=/^-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/;function lt(e){return yn(e)||qh.has(e)||Gh.test(e)||go(e)}function go(e){return Un(e,"length",nm)}function Qh(e){return Un(e,"size",Ud)}function Xh(e){return Un(e,"position",Ud)}function Jh(e){return Un(e,"url",rm)}function us(e){return Un(e,"number",yn)}function yn(e){return!Number.isNaN(Number(e))}function em(e){return e.endsWith("%")&&yn(e.slice(0,-1))}function Or(e){return Cc(e)||Un(e,"number",Cc)}function pe(e){return Fd.test(e)}function Ar(){return!0}function Vt(e){return Kh.test(e)}function tm(e){return Un(e,"",sm)}function Un(e,t,n){var r=Fd.exec(e);return r?r[1]?r[1]===t:n(r[2]):!1}function nm(e){return Zh.test(e)}function Ud(){return!1}function rm(e){return e.startsWith("url(")}function Cc(e){return Number.isInteger(Number(e))}function sm(e){return Yh.test(e)}function im(){var e=Ee("colors"),t=Ee("spacing"),n=Ee("blur"),r=Ee("brightness"),s=Ee("borderColor"),i=Ee("borderRadius"),o=Ee("borderSpacing"),a=Ee("borderWidth"),c=Ee("contrast"),d=Ee("grayscale"),u=Ee("hueRotate"),f=Ee("invert"),m=Ee("gap"),h=Ee("gradientColorStops"),g=Ee("gradientColorStopPositions"),p=Ee("inset"),y=Ee("margin"),b=Ee("opacity"),v=Ee("padding"),x=Ee("saturate"),_=Ee("scale"),C=Ee("sepia"),k=Ee("skew"),T=Ee("space"),R=Ee("translate"),A=function(){return["auto","contain","none"]},O=function(){return["auto","hidden","clip","visible","scroll"]},D=function(){return["auto",pe,t]},L=function(){return[pe,t]},B=function(){return["",lt]},U=function(){return["auto",yn,pe]},z=function(){return["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"]},F=function(){return["solid","dashed","dotted","double","none"]},I=function(){return["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-lighter"]},N=function(){return["start","end","center","between","around","evenly","stretch"]},M=function(){return["","0",pe]},$=function(){return["auto","avoid","all","avoid-page","page","left","right","column"]},j=function(){return[yn,us]},se=function(){return[yn,pe]};return{cacheSize:500,theme:{colors:[Ar],spacing:[lt],blur:["none","",Vt,pe],brightness:j(),borderColor:[e],borderRadius:["none","","full",Vt,pe],borderSpacing:L(),borderWidth:B(),contrast:j(),grayscale:M(),hueRotate:se(),invert:M(),gap:L(),gradientColorStops:[e],gradientColorStopPositions:[em,go],inset:D(),margin:D(),opacity:j(),padding:L(),saturate:j(),scale:j(),sepia:M(),skew:se(),space:L(),translate:L()},classGroups:{aspect:[{aspect:["auto","square","video",pe]}],container:["container"],columns:[{columns:[Vt]}],"break-after":[{"break-after":$()}],"break-before":[{"break-before":$()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none"]}],clear:[{clear:["left","right","both","none"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[].concat(z(),[pe])}],overflow:[{overflow:O()}],"overflow-x":[{"overflow-x":O()}],"overflow-y":[{"overflow-y":O()}],overscroll:[{overscroll:A()}],"overscroll-x":[{"overscroll-x":A()}],"overscroll-y":[{"overscroll-y":A()}],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",Or]}],basis:[{basis:D()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",pe]}],grow:[{grow:M()}],shrink:[{shrink:M()}],order:[{order:["first","last","none",Or]}],"grid-cols":[{"grid-cols":[Ar]}],"col-start-end":[{col:["auto",{span:["full",Or]},pe]}],"col-start":[{"col-start":U()}],"col-end":[{"col-end":U()}],"grid-rows":[{"grid-rows":[Ar]}],"row-start-end":[{row:["auto",{span:[Or]},pe]}],"row-start":[{"row-start":U()}],"row-end":[{"row-end":U()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",pe]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",pe]}],gap:[{gap:[m]}],"gap-x":[{"gap-x":[m]}],"gap-y":[{"gap-y":[m]}],"justify-content":[{justify:["normal"].concat(N())}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal"].concat(N(),["baseline"])}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[].concat(N(),["baseline"])}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[v]}],px:[{px:[v]}],py:[{py:[v]}],ps:[{ps:[v]}],pe:[{pe:[v]}],pt:[{pt:[v]}],pr:[{pr:[v]}],pb:[{pb:[v]}],pl:[{pl:[v]}],m:[{m:[y]}],mx:[{mx:[y]}],my:[{my:[y]}],ms:[{ms:[y]}],me:[{me:[y]}],mt:[{mt:[y]}],mr:[{mr:[y]}],mb:[{mb:[y]}],ml:[{ml:[y]}],"space-x":[{"space-x":[T]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[T]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit",pe,t]}],"min-w":[{"min-w":["min","max","fit",pe,lt]}],"max-w":[{"max-w":["0","none","full","min","max","fit","prose",{screen:[Vt]},Vt,pe]}],h:[{h:[pe,t,"auto","min","max","fit"]}],"min-h":[{"min-h":["min","max","fit",pe,lt]}],"max-h":[{"max-h":[pe,t,"min","max","fit"]}],"font-size":[{text:["base",Vt,go]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",us]}],"font-family":[{font:[Ar]}],"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",pe]}],"line-clamp":[{"line-clamp":["none",yn,us]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",pe,lt]}],"list-image":[{"list-image":["none",pe]}],"list-style-type":[{list:["none","disc","decimal",pe]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[].concat(F(),["wavy"])}],"text-decoration-thickness":[{decoration:["auto","from-font",lt]}],"underline-offset":[{"underline-offset":["auto",pe,lt]}],"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",pe]}],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",pe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[b]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[].concat(z(),[Xh])}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Qh]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Jh]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[g]}],"gradient-via-pos":[{via:[g]}],"gradient-to-pos":[{to:[g]}],"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":[b]}],"border-style":[{border:[].concat(F(),["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":[b]}],"divide-style":[{divide:F()}],"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(F())}],"outline-offset":[{"outline-offset":[pe,lt]}],"outline-w":[{outline:[lt]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:B()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[lt]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Vt,tm]}],"shadow-color":[{shadow:[Ar]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":I()}],"bg-blend":[{"bg-blend":I()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",Vt,pe]}],grayscale:[{grayscale:[d]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[f]}],saturate:[{saturate:[x]}],sepia:[{sepia:[C]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[d]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[x]}],"backdrop-sepia":[{"backdrop-sepia":[C]}],"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",pe]}],duration:[{duration:se()}],ease:[{ease:["linear","in","out","in-out",pe]}],delay:[{delay:se()}],animate:[{animate:["none","spin","ping","pulse","bounce",pe]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[_]}],"scale-x":[{"scale-x":[_]}],"scale-y":[{"scale-y":[_]}],rotate:[{rotate:[Or,pe]}],"translate-x":[{"translate-x":[R]}],"translate-y":[{"translate-y":[R]}],"skew-x":[{"skew-x":[k]}],"skew-y":[{"skew-y":[k]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",pe]}],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",pe]}],"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",pe]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[lt,us]}],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 om=Wh(im);function De(...e){return om(Dd(e))}const am=({className:e=""})=>l.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:l.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56",className:e})}),cm=Ld("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"}}),ot=w.forwardRef(({children:e,className:t,variant:n,size:r,loading:s,asChild:i=!1,disabled:o,loaderClassName:a="",loaderParentClassName:c="",...d},u)=>{const f=i?_h:"button";return l.jsxs(f,{className:De(cm({variant:n,size:r,className:t}),o&&"cursor-default","relative"),ref:u,disabled:s||o,...d,children:[s&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"absolute left-0 z-10 h-full w-full rounded-md bg-white"}),l.jsx("span",{className:De("absolute left-0 z-20 flex h-full w-full items-center justify-center rounded-md bg-inherit text-orange-300",c),children:l.jsx(am,{className:a})})]}),e]})});ot.displayName="Button";function Se(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 _r(e,t=[]){let n=[];function r(i,o){const a=w.createContext(o);a.displayName=i+"Context";const c=n.length;n=[...n,o];const d=f=>{var b;const{scope:m,children:h,...g}=f,p=((b=m==null?void 0:m[e])==null?void 0:b[c])||a,y=w.useMemo(()=>g,Object.values(g));return l.jsx(p.Provider,{value:y,children:h})};d.displayName=i+"Provider";function u(f,m){var p;const h=((p=m==null?void 0:m[e])==null?void 0:p[c])||a,g=w.useContext(h);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${i}\``)}return[d,u]}const s=()=>{const i=n.map(o=>w.createContext(o));return function(a){const c=(a==null?void 0:a[e])||i;return w.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return s.scopeName=e,[r,lm(s,...t)]}function lm(...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:c,scopeName:d})=>{const f=c(i)[`__scope${d}`];return{...a,...f}},{});return w.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}var Ie=globalThis!=null&&globalThis.document?w.useLayoutEffect:()=>{},dm=w[" useId ".trim().toString()]||(()=>{}),um=0;function nn(e){const[t,n]=w.useState(dm());return Ie(()=>{n(r=>r??String(um++))},[e]),e||(t?`radix-${t}`:"")}var fm=w[" useInsertionEffect ".trim().toString()]||Ie;function ur({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[s,i,o]=pm({defaultProp:t,onChange:n}),a=e!==void 0,c=a?e:s;{const u=w.useRef(e!==void 0);w.useEffect(()=>{const f=u.current;f!==a&&console.warn(`${r} is changing from ${f?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=a},[a,r])}const d=w.useCallback(u=>{var f;if(a){const m=hm(u)?u(e):u;m!==e&&((f=o.current)==null||f.call(o,m))}else i(u)},[a,e,i,o]);return[c,d]}function pm({defaultProp:e,onChange:t}){const[n,r]=w.useState(e),s=w.useRef(n),i=w.useRef(t);return fm(()=>{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 hm(e){return typeof e=="function"}var mm=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ve=mm.reduce((e,t)=>{const n=dr(`Primitive.${t}`),r=w.forwardRef((s,i)=>{const{asChild:o,...a}=s,c=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(c,{...a,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function gm(e,t){e&&Jr.flushSync(()=>e.dispatchEvent(t))}function Nn(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 ym(e,t=globalThis==null?void 0:globalThis.document){const n=Nn(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 bm="DismissableLayer",yo="dismissableLayer.update",vm="dismissableLayer.pointerDownOutside",wm="dismissableLayer.focusOutside",Ec,la=w.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),da=w.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:a,onDismiss:c,...d}=e,u=w.useContext(la),[f,m]=w.useState(null),h=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,g]=w.useState({}),p=Pe(t,A=>m(A)),y=Array.from(u.layers),[b]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=y.indexOf(b),x=f?y.indexOf(f):-1,_=u.layersWithOutsidePointerEventsDisabled.size>0,C=x>=v,k=w.useRef(!1),T=Cm(A=>{const O=A.target;if(!(O instanceof Node))return;const D=[...u.branches].some(L=>L.contains(O));!C||D||(i==null||i(A),a==null||a(A),A.defaultPrevented||c==null||c())},{ownerDocument:h,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:k,dismissableSurfaces:u.dismissableSurfaces}),R=Em(A=>{if(r&&k.current)return;const O=A.target;[...u.branches].some(L=>L.contains(O))||(o==null||o(A),a==null||a(A),A.defaultPrevented||c==null||c())},h);return ym(A=>{x===u.layers.size-1&&(s==null||s(A),!A.defaultPrevented&&c&&(A.preventDefault(),c()))},h),w.useEffect(()=>{if(f)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Ec=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),Tc(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(f),u.layersWithOutsidePointerEventsDisabled.size===0&&(h.body.style.pointerEvents=Ec))}},[f,h,n,u]),w.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),Tc())},[f,u]),w.useEffect(()=>{const A=()=>g({});return document.addEventListener(yo,A),()=>document.removeEventListener(yo,A)},[]),l.jsx(ve.div,{...d,ref:p,style:{pointerEvents:_?C?"auto":"none":void 0,...e.style},onFocusCapture:Se(e.onFocusCapture,R.onFocusCapture),onBlurCapture:Se(e.onBlurCapture,R.onBlurCapture),onPointerDownCapture:Se(e.onPointerDownCapture,T.onPointerDownCapture)})});da.displayName=bm;var _m="DismissableLayerBranch",xm=w.forwardRef((e,t)=>{const n=w.useContext(la),r=w.useRef(null),s=Pe(t,r);return w.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),l.jsx(ve.div,{...e,ref:s})});xm.displayName=_m;function Sm(){const e=w.useContext(la),[t,n]=w.useState(null);return w.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}function Cm(e,t){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:s,dismissableSurfaces:i}=t,o=Nn(e),a=w.useRef(!1),c=w.useRef(!1),d=w.useRef(new Map),u=w.useRef(()=>{});return w.useEffect(()=>{function f(){c.current=!1,s.current=!1,d.current.clear()}function m(){return Array.from(d.current.values()).some(Boolean)}function h(v){if(!c.current)return;const x=v.target;x instanceof Node&&[...i].some(C=>C.contains(x))||d.current.set(v.type,!0),v.type==="click"&&window.setTimeout(()=>{c.current&&u.current()},0)}function g(v){c.current&&d.current.set(v.type,!1)}const p=v=>{if(v.target&&!a.current){let x=function(){n.removeEventListener("click",u.current);const C=m();f(),C||Bd(vm,o,_,{discrete:!0})};const _={originalEvent:v};c.current=!0,s.current=r&&v.button===0,d.current.clear(),!r||v.button!==0?x():(n.removeEventListener("click",u.current),u.current=x,n.addEventListener("click",u.current,{once:!0}))}else n.removeEventListener("click",u.current),f();a.current=!1},y=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const v of y)n.addEventListener(v,h,!0),n.addEventListener(v,g);const b=window.setTimeout(()=>{n.addEventListener("pointerdown",p)},0);return()=>{window.clearTimeout(b),n.removeEventListener("pointerdown",p),n.removeEventListener("click",u.current);for(const v of y)n.removeEventListener(v,h,!0),n.removeEventListener(v,g)}},[n,o,r,s,i]),{onPointerDownCapture:()=>a.current=!0}}function Em(e,t=globalThis==null?void 0:globalThis.document){const n=Nn(e),r=w.useRef(!1);return w.useEffect(()=>{const s=i=>{i.target&&!r.current&&Bd(wm,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 Tc(){const e=new CustomEvent(yo);document.dispatchEvent(e)}function Bd(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?gm(s,i):s.dispatchEvent(i)}var Bi="focusScope.autoFocusOnMount",$i="focusScope.autoFocusOnUnmount",Pc={bubbles:!1,cancelable:!0},Tm="FocusScope",ua=w.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:i,...o}=e,[a,c]=w.useState(null),d=Nn(s),u=Nn(i),f=w.useRef(null),m=Pe(t,p=>c(p)),h=w.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;w.useEffect(()=>{if(r){let p=function(x){if(h.paused||!a)return;const _=x.target;a.contains(_)?f.current=_:Ht(f.current,{select:!0})},y=function(x){if(h.paused||!a)return;const _=x.relatedTarget;_!==null&&(a.contains(_)||Ht(f.current,{select:!0}))},b=function(x){if(document.activeElement===document.body)for(const C of x)C.removedNodes.length>0&&Ht(a)};document.addEventListener("focusin",p),document.addEventListener("focusout",y);const v=new MutationObserver(b);return a&&v.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",y),v.disconnect()}}},[r,a,h.paused]),w.useEffect(()=>{if(a){Oc.add(h);const p=document.activeElement;if(!a.contains(p)){const b=new CustomEvent(Bi,Pc);a.addEventListener(Bi,d),a.dispatchEvent(b),b.defaultPrevented||(Pm(Nm($d(a)),{select:!0}),document.activeElement===p&&Ht(a))}return()=>{a.removeEventListener(Bi,d),setTimeout(()=>{const b=new CustomEvent($i,Pc);a.addEventListener($i,u),a.dispatchEvent(b),b.defaultPrevented||Ht(p??document.body,{select:!0}),a.removeEventListener($i,u),Oc.remove(h)},0)}}},[a,d,u,h]);const g=w.useCallback(p=>{if(!n&&!r||h.paused)return;const y=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,b=document.activeElement;if(y&&b){const v=p.currentTarget,[x,_]=km(v);x&&_?!p.shiftKey&&b===_?(p.preventDefault(),n&&Ht(x,{select:!0})):p.shiftKey&&b===x&&(p.preventDefault(),n&&Ht(_,{select:!0})):b===v&&p.preventDefault()}},[n,r,h.paused]);return l.jsx(ve.div,{tabIndex:-1,...o,ref:m,onKeyDown:g})});ua.displayName=Tm;function Pm(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Ht(r,{select:t}),document.activeElement!==n)return}function km(e){const t=$d(e),n=kc(t,e),r=kc(t.reverse(),e);return[n,r]}function $d(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 kc(e,t){for(const n of e)if(!Om(n,{upTo:t}))return n}function Om(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 Am(e){return e instanceof HTMLInputElement&&"select"in e}function Ht(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Am(e)&&t&&e.select()}}var Oc=Rm();function Rm(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Ac(e,t),e.unshift(t)},remove(t){var n;e=Ac(e,t),(n=e[0])==null||n.resume()}}}function Ac(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Nm(e){return e.filter(t=>t.tagName!=="A")}var Dm="Portal",fa=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?Jr.createPortal(l.jsx(ve.div,{...r,ref:t}),o):null});fa.displayName=Dm;function Lm(e,t){return w.useReducer((n,r)=>t[n][r]??n,e)}var xr=e=>{const{present:t,children:n}=e,r=jm(t),s=typeof n=="function"?n({present:r.isPresent}):w.Children.only(n),i=Mm(r.ref,Im(s));return typeof n=="function"||r.isPresent?w.cloneElement(s,{ref:i}):null};xr.displayName="Presence";function jm(e){const[t,n]=w.useState(),r=w.useRef(null),s=w.useRef(e),i=w.useRef("none"),o=e?"mounted":"unmounted",[a,c]=Lm(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{const d=fs(r.current);i.current=a==="mounted"?d:"none"},[a]),Ie(()=>{const d=r.current,u=s.current;if(u!==e){const m=i.current,h=fs(d);e?c("MOUNT"):h==="none"||(d==null?void 0:d.display)==="none"?c("UNMOUNT"):c(u&&m!==h?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,c]),Ie(()=>{if(t){let d;const u=t.ownerDocument.defaultView??window,f=h=>{const p=fs(r.current).includes(CSS.escape(h.animationName));if(h.target===t&&p&&(c("ANIMATION_END"),!s.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",d=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},m=h=>{h.target===t&&(i.current=fs(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{u.clearTimeout(d),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:w.useCallback(d=>{r.current=d?getComputedStyle(d):null,n(d)},[])}}function Rc(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Mm(...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=Rc(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():Rc(r[o],null)}}},[])}function fs(e){return(e==null?void 0:e.animationName)||"none"}function Im(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 ps=0,wt=null;function Vd(){w.useEffect(()=>{wt||(wt={start:Nc(),end:Nc()});const{start:e,end:t}=wt;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),ps++,()=>{ps===1&&(wt==null||wt.start.remove(),wt==null||wt.end.remove(),wt=null),ps=Math.max(0,ps-1)}},[])}function Nc(){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 Tt=function(){return Tt=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},Tt.apply(this,arguments)};function Hd(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 Fm(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 As="right-scroll-bar-position",Rs="width-before-scroll-bar",Um="with-scroll-bars-hidden",Bm="--removed-body-scroll-bar-size";function Vi(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function $m(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 Vm=typeof window<"u"?w.useLayoutEffect:w.useEffect,Dc=new WeakMap;function Hm(e,t){var n=$m(null,function(r){return e.forEach(function(s){return Vi(s,r)})});return Vm(function(){var r=Dc.get(n);if(r){var s=new Set(r),i=new Set(e),o=n.current;s.forEach(function(a){i.has(a)||Vi(a,null)}),i.forEach(function(a){s.has(a)||Vi(a,o)})}Dc.set(n,e)},[e]),n}function zm(e){return e}function Wm(e,t){t===void 0&&(t=zm);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 c=function(){var u=o;o=[],u.forEach(i)},d=function(){return Promise.resolve().then(c)};d(),n={push:function(u){o.push(u),d()},filter:function(u){return o=o.filter(u),n}}}};return s}function Gm(e){e===void 0&&(e={});var t=Wm(null);return t.options=Tt({async:!0,ssr:!1},e),t}var zd=function(e){var t=e.sideCar,n=Hd(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,Tt({},n))};zd.isSideCarExport=!0;function qm(e,t){return e.useMedium(t),zd}var Wd=Gm(),Hi=function(){},di=w.forwardRef(function(e,t){var n=w.useRef(null),r=w.useState({onScrollCapture:Hi,onWheelCapture:Hi,onTouchMoveCapture:Hi}),s=r[0],i=r[1],o=e.forwardProps,a=e.children,c=e.className,d=e.removeScrollBar,u=e.enabled,f=e.shards,m=e.sideCar,h=e.noRelative,g=e.noIsolation,p=e.inert,y=e.allowPinchZoom,b=e.as,v=b===void 0?"div":b,x=e.gapMode,_=Hd(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=m,k=Hm([n,t]),T=Tt(Tt({},_),s);return w.createElement(w.Fragment,null,u&&w.createElement(C,{sideCar:Wd,removeScrollBar:d,shards:f,noRelative:h,noIsolation:g,inert:p,setCallbacks:i,allowPinchZoom:!!y,lockRef:n,gapMode:x}),o?w.cloneElement(w.Children.only(a),Tt(Tt({},T),{ref:k})):w.createElement(v,Tt({},T,{className:c,ref:k}),a))});di.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};di.classNames={fullWidth:Rs,zeroRight:As};var Km=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Zm(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Km();return t&&e.setAttribute("nonce",t),e}function Ym(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Qm(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Xm=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Zm())&&(Ym(t,n),Qm(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Jm=function(){var e=Xm();return function(t,n){w.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Gd=function(){var e=Jm(),t=function(n){var r=n.styles,s=n.dynamic;return e(r,s),null};return t},eg={left:0,top:0,right:0,gap:0},zi=function(e){return parseInt(e||"",10)||0},tg=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[zi(n),zi(r),zi(s)]},ng=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return eg;var t=tg(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])}},rg=Gd(),Zn="data-scroll-locked",sg=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(Um,` {
1
+ "use strict";var _p=Object.defineProperty;var bc=e=>{throw TypeError(e)};var xp=(e,t,n)=>t in e?_p(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var st=(e,t,n)=>xp(e,typeof t!="symbol"?t+"":t,n),Bi=(e,t,n)=>t.has(e)||bc("Cannot "+n);var E=(e,t,n)=>(Bi(e,t,"read from private field"),n?n.call(e):t.get(e)),ne=(e,t,n)=>t.has(e)?bc("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),z=(e,t,n,r)=>(Bi(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),he=(e,t,n)=>(Bi(e,t,"access private method"),n);var ds=(e,t,n,r)=>({set _(s){z(e,t,s,n)},get _(){return E(e,t,r)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),S=require("react"),Sp=require("react-dom");function Ld(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=Ld(S),es=Ld(Sp);function vc(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Cp(...e){return t=>{let n=!1;const r=e.map(s=>{const i=vc(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():vc(e[s],null)}}}}function Pe(...e){return w.useCallback(Cp(...e),e)}function dr(e){const t=w.forwardRef((n,r)=>{let{children:s,...i}=n,o=null,a=!1;const c=[];wc(s)&&typeof us=="function"&&(s=us(s._payload)),w.Children.forEach(s,m=>{var p;if(Ap(m)){a=!0;const g=m;let h="child"in g.props?g.props.child:g.props.children;wc(h)&&typeof us=="function"&&(h=us(h._payload)),o=Pp(g,h),c.push((p=o==null?void 0:o.props)==null?void 0:p.children)}else c.push(m)}),o?o=w.cloneElement(o,void 0,c):!a&&w.Children.count(s)===1&&w.isValidElement(s)&&(o=s);const d=o?Op(o):void 0,u=Pe(r,d);if(!o){if(s||s===0)throw new Error(a?Lp(e):Dp(e));return s}const f=kp(i,o.props??{});return o.type!==w.Fragment&&(f.ref=r?u:d),w.cloneElement(o,f)});return t.displayName=`${e}.Slot`,t}var Ep=dr("Slot"),Tp=Symbol.for("radix.slottable"),Pp=(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 kp(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 c=i(...a);return s(...a),c}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...e,...n}}function Op(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 Ap(e){return w.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Tp}var Np=Symbol.for("react.lazy");function wc(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Np&&"_payload"in e&&Rp(e._payload)}function Rp(e){return typeof e=="object"&&e!==null&&"then"in e}var Dp=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,Lp=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,us=w[" use ".trim().toString()];function jd(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=jd(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Md(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=jd(e))&&(r&&(r+=" "),r+=t);return r}const _c=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,xc=Md,Id=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return xc(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 u=n==null?void 0:n[d],f=i==null?void 0:i[d];if(u===null)return null;const m=_c(u)||_c(f);return s[d][m]}),a=n&&Object.entries(n).reduce((d,u)=>{let[f,m]=u;return m===void 0||(d[f]=m),d},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((d,u)=>{let{class:f,className:m,...p}=u;return Object.entries(p).every(g=>{let[h,y]=g;return Array.isArray(y)?y.includes({...i,...a}[h]):{...i,...a}[h]===y})?[...d,f,m]:d},[]);return xc(e,o,c,n==null?void 0:n.class,n==null?void 0:n.className)},fn=[{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"}],jp={[-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 Mp(){const e=-new Date().getTimezoneOffset()/60,t=jp[e];return t&&t.length>0?t[0]:"Etc/UTC"}const Ur="tv:latest-symbol";function Ip(){for(var e=0,t,n,r="";e<arguments.length;)(t=arguments[e++])&&(n=Ud(t))&&(r&&(r+=" "),r+=n);return r}function Ud(e){if(typeof e=="string")return e;for(var t,n="",r=0;r<e.length;r++)e[r]&&(t=Ud(e[r]))&&(n&&(n+=" "),n+=t);return n}var la="-";function Up(e){var t=Bp(e),n=e.conflictingClassGroups,r=e.conflictingClassGroupModifiers,s=r===void 0?{}:r;function i(a){var c=a.split(la);return c[0]===""&&c.length!==1&&c.shift(),Fd(c,t)||Fp(a)}function o(a,c){var d=n[a]||[];return c&&s[a]?[].concat(d,s[a]):d}return{getClassGroupId:i,getConflictingClassGroupIds:o}}function Fd(e,t){var o;if(e.length===0)return t.classGroupId;var n=e[0],r=t.nextPart.get(n),s=r?Fd(e.slice(1),r):void 0;if(s)return s;if(t.validators.length!==0){var i=e.join(la);return(o=t.validators.find(function(a){var c=a.validator;return c(i)}))==null?void 0:o.classGroupId}}var Sc=/^\[(.+)\]$/;function Fp(e){if(Sc.test(e)){var t=Sc.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}}function Bp(e){var t=e.theme,n=e.prefix,r={nextPart:new Map,validators:[]},s=Vp(Object.entries(e.classGroups),n);return s.forEach(function(i){var o=i[0],a=i[1];go(a,r,o,t)}),r}function go(e,t,n,r){e.forEach(function(s){if(typeof s=="string"){var i=s===""?t:Cc(t,s);i.classGroupId=n;return}if(typeof s=="function"){if($p(s)){go(s(r),t,n,r);return}t.validators.push({validator:s,classGroupId:n});return}Object.entries(s).forEach(function(o){var a=o[0],c=o[1];go(c,Cc(t,a),n,r)})})}function Cc(e,t){var n=e;return t.split(la).forEach(function(r){n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n}function $p(e){return e.isThemeGetter}function Vp(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 c=a[0],d=a[1];return[t+c,d]})):o});return[r,i]}):e}function Hp(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 Bd="!";function zp(e){var t=e.separator||":",n=t.length===1,r=t[0],s=t.length;return function(o){for(var a=[],c=0,d=0,u,f=0;f<o.length;f++){var m=o[f];if(c===0){if(m===r&&(n||o.slice(f,f+s)===t)){a.push(o.slice(d,f)),d=f+s;continue}if(m==="/"){u=f;continue}}m==="["?c++:m==="]"&&c--}var p=a.length===0?o:o.substring(d),g=p.startsWith(Bd),h=g?p.substring(1):p,y=u&&u>d?u-d:void 0;return{modifiers:a,hasImportantModifier:g,baseClassName:h,maybePostfixModifierPosition:y}}}function Wp(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 Gp(e){return{cache:Hp(e.cacheSize),splitModifiers:zp(e),...Up(e)}}var Kp=/\s+/;function qp(e,t){var n=t.splitModifiers,r=t.getClassGroupId,s=t.getConflictingClassGroupIds,i=new Set;return e.trim().split(Kp).map(function(o){var a=n(o),c=a.modifiers,d=a.hasImportantModifier,u=a.baseClassName,f=a.maybePostfixModifierPosition,m=r(f?u.substring(0,f):u),p=!!f;if(!m){if(!f)return{isTailwindClass:!1,originalClassName:o};if(m=r(u),!m)return{isTailwindClass:!1,originalClassName:o};p=!1}var g=Wp(c).join(":"),h=d?g+Bd:g;return{isTailwindClass:!0,modifierId:h,classGroupId:m,originalClassName:o,hasPostfixModifier:p}}).reverse().filter(function(o){if(!o.isTailwindClass)return!0;var a=o.modifierId,c=o.classGroupId,d=o.hasPostfixModifier,u=a+c;return i.has(u)?!1:(i.add(u),s(c,d).forEach(function(f){return i.add(a+f)}),!0)}).reverse().map(function(o){return o.originalClassName}).join(" ")}function Zp(){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 u=t[0],f=t.slice(1),m=f.reduce(function(p,g){return g(p)},u());return r=Gp(m),s=r.cache.get,i=r.cache.set,o=c,c(d)}function c(d){var u=s(d);if(u)return u;var f=qp(d,r);return i(d,f),f}return function(){return o(Ip.apply(null,arguments))}}function Ee(e){var t=function(r){return r[e]||[]};return t.isThemeGetter=!0,t}var $d=/^\[(?:([a-z-]+):)?(.+)\]$/i,Yp=/^\d+\/\d+$/,Qp=new Set(["px","full","screen"]),Xp=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Jp=/\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$/,em=/^-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/;function lt(e){return yn(e)||Qp.has(e)||Yp.test(e)||yo(e)}function yo(e){return Fn(e,"length",om)}function tm(e){return Fn(e,"size",Vd)}function nm(e){return Fn(e,"position",Vd)}function rm(e){return Fn(e,"url",am)}function fs(e){return Fn(e,"number",yn)}function yn(e){return!Number.isNaN(Number(e))}function sm(e){return e.endsWith("%")&&yn(e.slice(0,-1))}function Ar(e){return Ec(e)||Fn(e,"number",Ec)}function pe(e){return $d.test(e)}function Nr(){return!0}function Ht(e){return Xp.test(e)}function im(e){return Fn(e,"",cm)}function Fn(e,t,n){var r=$d.exec(e);return r?r[1]?r[1]===t:n(r[2]):!1}function om(e){return Jp.test(e)}function Vd(){return!1}function am(e){return e.startsWith("url(")}function Ec(e){return Number.isInteger(Number(e))}function cm(e){return em.test(e)}function lm(){var e=Ee("colors"),t=Ee("spacing"),n=Ee("blur"),r=Ee("brightness"),s=Ee("borderColor"),i=Ee("borderRadius"),o=Ee("borderSpacing"),a=Ee("borderWidth"),c=Ee("contrast"),d=Ee("grayscale"),u=Ee("hueRotate"),f=Ee("invert"),m=Ee("gap"),p=Ee("gradientColorStops"),g=Ee("gradientColorStopPositions"),h=Ee("inset"),y=Ee("margin"),b=Ee("opacity"),v=Ee("padding"),x=Ee("saturate"),_=Ee("scale"),C=Ee("sepia"),k=Ee("skew"),T=Ee("space"),A=Ee("translate"),N=function(){return["auto","contain","none"]},O=function(){return["auto","hidden","clip","visible","scroll"]},L=function(){return["auto",pe,t]},R=function(){return[pe,t]},$=function(){return["",lt]},j=function(){return["auto",yn,pe]},H=function(){return["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"]},F=function(){return["solid","dashed","dotted","double","none"]},I=function(){return["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-lighter"]},D=function(){return["start","end","center","between","around","evenly","stretch"]},U=function(){return["","0",pe]},K=function(){return["auto","avoid","all","avoid-page","page","left","right","column"]},M=function(){return[yn,fs]},le=function(){return[yn,pe]};return{cacheSize:500,theme:{colors:[Nr],spacing:[lt],blur:["none","",Ht,pe],brightness:M(),borderColor:[e],borderRadius:["none","","full",Ht,pe],borderSpacing:R(),borderWidth:$(),contrast:M(),grayscale:U(),hueRotate:le(),invert:U(),gap:R(),gradientColorStops:[e],gradientColorStopPositions:[sm,yo],inset:L(),margin:L(),opacity:M(),padding:R(),saturate:M(),scale:M(),sepia:U(),skew:le(),space:R(),translate:R()},classGroups:{aspect:[{aspect:["auto","square","video",pe]}],container:["container"],columns:[{columns:[Ht]}],"break-after":[{"break-after":K()}],"break-before":[{"break-before":K()}],"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(H(),[pe])}],overflow:[{overflow:O()}],"overflow-x":[{"overflow-x":O()}],"overflow-y":[{"overflow-y":O()}],overscroll:[{overscroll:N()}],"overscroll-x":[{"overscroll-x":N()}],"overscroll-y":[{"overscroll-y":N()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[h]}],"inset-x":[{"inset-x":[h]}],"inset-y":[{"inset-y":[h]}],start:[{start:[h]}],end:[{end:[h]}],top:[{top:[h]}],right:[{right:[h]}],bottom:[{bottom:[h]}],left:[{left:[h]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Ar]}],basis:[{basis:L()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",pe]}],grow:[{grow:U()}],shrink:[{shrink:U()}],order:[{order:["first","last","none",Ar]}],"grid-cols":[{"grid-cols":[Nr]}],"col-start-end":[{col:["auto",{span:["full",Ar]},pe]}],"col-start":[{"col-start":j()}],"col-end":[{"col-end":j()}],"grid-rows":[{"grid-rows":[Nr]}],"row-start-end":[{row:["auto",{span:[Ar]},pe]}],"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",pe]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",pe]}],gap:[{gap:[m]}],"gap-x":[{"gap-x":[m]}],"gap-y":[{"gap-y":[m]}],"justify-content":[{justify:["normal"].concat(D())}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal"].concat(D(),["baseline"])}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[].concat(D(),["baseline"])}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[v]}],px:[{px:[v]}],py:[{py:[v]}],ps:[{ps:[v]}],pe:[{pe:[v]}],pt:[{pt:[v]}],pr:[{pr:[v]}],pb:[{pb:[v]}],pl:[{pl:[v]}],m:[{m:[y]}],mx:[{mx:[y]}],my:[{my:[y]}],ms:[{ms:[y]}],me:[{me:[y]}],mt:[{mt:[y]}],mr:[{mr:[y]}],mb:[{mb:[y]}],ml:[{ml:[y]}],"space-x":[{"space-x":[T]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[T]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit",pe,t]}],"min-w":[{"min-w":["min","max","fit",pe,lt]}],"max-w":[{"max-w":["0","none","full","min","max","fit","prose",{screen:[Ht]},Ht,pe]}],h:[{h:[pe,t,"auto","min","max","fit"]}],"min-h":[{"min-h":["min","max","fit",pe,lt]}],"max-h":[{"max-h":[pe,t,"min","max","fit"]}],"font-size":[{text:["base",Ht,yo]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",fs]}],"font-family":[{font:[Nr]}],"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",pe]}],"line-clamp":[{"line-clamp":["none",yn,fs]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",pe,lt]}],"list-image":[{"list-image":["none",pe]}],"list-style-type":[{list:["none","disc","decimal",pe]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[].concat(F(),["wavy"])}],"text-decoration-thickness":[{decoration:["auto","from-font",lt]}],"underline-offset":[{"underline-offset":["auto",pe,lt]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],indent:[{indent:R()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",pe]}],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",pe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[b]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[].concat(H(),[nm])}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",tm]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},rm]}],"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":[b]}],"border-style":[{border:[].concat(F(),["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":[b]}],"divide-style":[{divide:F()}],"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(F())}],"outline-offset":[{"outline-offset":[pe,lt]}],"outline-w":[{outline:[lt]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:$()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[lt]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Ht,im]}],"shadow-color":[{shadow:[Nr]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":I()}],"bg-blend":[{"bg-blend":I()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",Ht,pe]}],grayscale:[{grayscale:[d]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[f]}],saturate:[{saturate:[x]}],sepia:[{sepia:[C]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[d]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[x]}],"backdrop-sepia":[{"backdrop-sepia":[C]}],"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",pe]}],duration:[{duration:le()}],ease:[{ease:["linear","in","out","in-out",pe]}],delay:[{delay:le()}],animate:[{animate:["none","spin","ping","pulse","bounce",pe]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[_]}],"scale-x":[{"scale-x":[_]}],"scale-y":[{"scale-y":[_]}],rotate:[{rotate:[Ar,pe]}],"translate-x":[{"translate-x":[A]}],"translate-y":[{"translate-y":[A]}],"skew-x":[{"skew-x":[k]}],"skew-y":[{"skew-y":[k]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",pe]}],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",pe]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":R()}],"scroll-mx":[{"scroll-mx":R()}],"scroll-my":[{"scroll-my":R()}],"scroll-ms":[{"scroll-ms":R()}],"scroll-me":[{"scroll-me":R()}],"scroll-mt":[{"scroll-mt":R()}],"scroll-mr":[{"scroll-mr":R()}],"scroll-mb":[{"scroll-mb":R()}],"scroll-ml":[{"scroll-ml":R()}],"scroll-p":[{"scroll-p":R()}],"scroll-px":[{"scroll-px":R()}],"scroll-py":[{"scroll-py":R()}],"scroll-ps":[{"scroll-ps":R()}],"scroll-pe":[{"scroll-pe":R()}],"scroll-pt":[{"scroll-pt":R()}],"scroll-pr":[{"scroll-pr":R()}],"scroll-pb":[{"scroll-pb":R()}],"scroll-pl":[{"scroll-pl":R()}],"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",pe]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[lt,fs]}],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 dm=Zp(lm);function De(...e){return dm(Md(e))}const um=({className:e=""})=>l.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:l.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56",className:e})}),fm=Id("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"}}),ot=w.forwardRef(({children:e,className:t,variant:n,size:r,loading:s,asChild:i=!1,disabled:o,loaderClassName:a="",loaderParentClassName:c="",...d},u)=>{const f=i?Ep:"button";return l.jsxs(f,{className:De(fm({variant:n,size:r,className:t}),o&&"cursor-default","relative"),ref:u,disabled:s||o,...d,children:[s&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"absolute left-0 z-10 h-full w-full rounded-md bg-white"}),l.jsx("span",{className:De("absolute left-0 z-20 flex h-full w-full items-center justify-center rounded-md bg-inherit text-orange-300",c),children:l.jsx(um,{className:a})})]}),e]})});ot.displayName="Button";function Se(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 _r(e,t=[]){let n=[];function r(i,o){const a=w.createContext(o);a.displayName=i+"Context";const c=n.length;n=[...n,o];const d=f=>{var b;const{scope:m,children:p,...g}=f,h=((b=m==null?void 0:m[e])==null?void 0:b[c])||a,y=w.useMemo(()=>g,Object.values(g));return l.jsx(h.Provider,{value:y,children:p})};d.displayName=i+"Provider";function u(f,m){var h;const p=((h=m==null?void 0:m[e])==null?void 0:h[c])||a,g=w.useContext(p);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${i}\``)}return[d,u]}const s=()=>{const i=n.map(o=>w.createContext(o));return function(a){const c=(a==null?void 0:a[e])||i;return w.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return s.scopeName=e,[r,hm(s,...t)]}function hm(...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:c,scopeName:d})=>{const f=c(i)[`__scope${d}`];return{...a,...f}},{});return w.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}var Ie=globalThis!=null&&globalThis.document?w.useLayoutEffect:()=>{},pm=w[" useId ".trim().toString()]||(()=>{}),mm=0;function rn(e){const[t,n]=w.useState(pm());return Ie(()=>{n(r=>r??String(mm++))},[e]),e||(t?`radix-${t}`:"")}var gm=w[" useInsertionEffect ".trim().toString()]||Ie;function ur({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[s,i,o]=ym({defaultProp:t,onChange:n}),a=e!==void 0,c=a?e:s;{const u=w.useRef(e!==void 0);w.useEffect(()=>{const f=u.current;f!==a&&console.warn(`${r} is changing from ${f?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=a},[a,r])}const d=w.useCallback(u=>{var f;if(a){const m=bm(u)?u(e):u;m!==e&&((f=o.current)==null||f.call(o,m))}else i(u)},[a,e,i,o]);return[c,d]}function ym({defaultProp:e,onChange:t}){const[n,r]=w.useState(e),s=w.useRef(n),i=w.useRef(t);return gm(()=>{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 bm(e){return typeof e=="function"}var vm=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],we=vm.reduce((e,t)=>{const n=dr(`Primitive.${t}`),r=w.forwardRef((s,i)=>{const{asChild:o,...a}=s,c=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(c,{...a,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function wm(e,t){e&&es.flushSync(()=>e.dispatchEvent(t))}function Rn(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 _m(e,t=globalThis==null?void 0:globalThis.document){const n=Rn(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 xm="DismissableLayer",bo="dismissableLayer.update",Sm="dismissableLayer.pointerDownOutside",Cm="dismissableLayer.focusOutside",Tc,da=w.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),ua=w.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:a,onDismiss:c,...d}=e,u=w.useContext(da),[f,m]=w.useState(null),p=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,g]=w.useState({}),h=Pe(t,N=>m(N)),y=Array.from(u.layers),[b]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=y.indexOf(b),x=f?y.indexOf(f):-1,_=u.layersWithOutsidePointerEventsDisabled.size>0,C=x>=v,k=w.useRef(!1),T=km(N=>{const O=N.target;if(!(O instanceof Node))return;const L=[...u.branches].some(R=>R.contains(O));!C||L||(i==null||i(N),a==null||a(N),N.defaultPrevented||c==null||c())},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:k,dismissableSurfaces:u.dismissableSurfaces}),A=Om(N=>{if(r&&k.current)return;const O=N.target;[...u.branches].some(R=>R.contains(O))||(o==null||o(N),a==null||a(N),N.defaultPrevented||c==null||c())},p);return _m(N=>{x===u.layers.size-1&&(s==null||s(N),!N.defaultPrevented&&c&&(N.preventDefault(),c()))},p),w.useEffect(()=>{if(f)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Tc=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),Pc(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(f),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=Tc))}},[f,p,n,u]),w.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),Pc())},[f,u]),w.useEffect(()=>{const N=()=>g({});return document.addEventListener(bo,N),()=>document.removeEventListener(bo,N)},[]),l.jsx(we.div,{...d,ref:h,style:{pointerEvents:_?C?"auto":"none":void 0,...e.style},onFocusCapture:Se(e.onFocusCapture,A.onFocusCapture),onBlurCapture:Se(e.onBlurCapture,A.onBlurCapture),onPointerDownCapture:Se(e.onPointerDownCapture,T.onPointerDownCapture)})});ua.displayName=xm;var Em="DismissableLayerBranch",Tm=w.forwardRef((e,t)=>{const n=w.useContext(da),r=w.useRef(null),s=Pe(t,r);return w.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),l.jsx(we.div,{...e,ref:s})});Tm.displayName=Em;function Pm(){const e=w.useContext(da),[t,n]=w.useState(null);return w.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}function km(e,t){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:s,dismissableSurfaces:i}=t,o=Rn(e),a=w.useRef(!1),c=w.useRef(!1),d=w.useRef(new Map),u=w.useRef(()=>{});return w.useEffect(()=>{function f(){c.current=!1,s.current=!1,d.current.clear()}function m(){return Array.from(d.current.values()).some(Boolean)}function p(v){if(!c.current)return;const x=v.target;x instanceof Node&&[...i].some(C=>C.contains(x))||d.current.set(v.type,!0),v.type==="click"&&window.setTimeout(()=>{c.current&&u.current()},0)}function g(v){c.current&&d.current.set(v.type,!1)}const h=v=>{if(v.target&&!a.current){let x=function(){n.removeEventListener("click",u.current);const C=m();f(),C||Hd(Sm,o,_,{discrete:!0})};const _={originalEvent:v};c.current=!0,s.current=r&&v.button===0,d.current.clear(),!r||v.button!==0?x():(n.removeEventListener("click",u.current),u.current=x,n.addEventListener("click",u.current,{once:!0}))}else n.removeEventListener("click",u.current),f();a.current=!1},y=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const v of y)n.addEventListener(v,p,!0),n.addEventListener(v,g);const b=window.setTimeout(()=>{n.addEventListener("pointerdown",h)},0);return()=>{window.clearTimeout(b),n.removeEventListener("pointerdown",h),n.removeEventListener("click",u.current);for(const v of y)n.removeEventListener(v,p,!0),n.removeEventListener(v,g)}},[n,o,r,s,i]),{onPointerDownCapture:()=>a.current=!0}}function Om(e,t=globalThis==null?void 0:globalThis.document){const n=Rn(e),r=w.useRef(!1);return w.useEffect(()=>{const s=i=>{i.target&&!r.current&&Hd(Cm,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 Pc(){const e=new CustomEvent(bo);document.dispatchEvent(e)}function Hd(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?wm(s,i):s.dispatchEvent(i)}var $i="focusScope.autoFocusOnMount",Vi="focusScope.autoFocusOnUnmount",kc={bubbles:!1,cancelable:!0},Am="FocusScope",fa=w.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:i,...o}=e,[a,c]=w.useState(null),d=Rn(s),u=Rn(i),f=w.useRef(null),m=Pe(t,h=>c(h)),p=w.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;w.useEffect(()=>{if(r){let h=function(x){if(p.paused||!a)return;const _=x.target;a.contains(_)?f.current=_:zt(f.current,{select:!0})},y=function(x){if(p.paused||!a)return;const _=x.relatedTarget;_!==null&&(a.contains(_)||zt(f.current,{select:!0}))},b=function(x){if(document.activeElement===document.body)for(const C of x)C.removedNodes.length>0&&zt(a)};document.addEventListener("focusin",h),document.addEventListener("focusout",y);const v=new MutationObserver(b);return a&&v.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",h),document.removeEventListener("focusout",y),v.disconnect()}}},[r,a,p.paused]),w.useEffect(()=>{if(a){Ac.add(p);const h=document.activeElement;if(!a.contains(h)){const b=new CustomEvent($i,kc);a.addEventListener($i,d),a.dispatchEvent(b),b.defaultPrevented||(Nm(Mm(zd(a)),{select:!0}),document.activeElement===h&&zt(a))}return()=>{a.removeEventListener($i,d),setTimeout(()=>{const b=new CustomEvent(Vi,kc);a.addEventListener(Vi,u),a.dispatchEvent(b),b.defaultPrevented||zt(h??document.body,{select:!0}),a.removeEventListener(Vi,u),Ac.remove(p)},0)}}},[a,d,u,p]);const g=w.useCallback(h=>{if(!n&&!r||p.paused)return;const y=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,b=document.activeElement;if(y&&b){const v=h.currentTarget,[x,_]=Rm(v);x&&_?!h.shiftKey&&b===_?(h.preventDefault(),n&&zt(x,{select:!0})):h.shiftKey&&b===x&&(h.preventDefault(),n&&zt(_,{select:!0})):b===v&&h.preventDefault()}},[n,r,p.paused]);return l.jsx(we.div,{tabIndex:-1,...o,ref:m,onKeyDown:g})});fa.displayName=Am;function Nm(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(zt(r,{select:t}),document.activeElement!==n)return}function Rm(e){const t=zd(e),n=Oc(t,e),r=Oc(t.reverse(),e);return[n,r]}function zd(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 Oc(e,t){for(const n of e)if(!Dm(n,{upTo:t}))return n}function Dm(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 Lm(e){return e instanceof HTMLInputElement&&"select"in e}function zt(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Lm(e)&&t&&e.select()}}var Ac=jm();function jm(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Nc(e,t),e.unshift(t)},remove(t){var n;e=Nc(e,t),(n=e[0])==null||n.resume()}}}function Nc(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Mm(e){return e.filter(t=>t.tagName!=="A")}var Im="Portal",ha=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?es.createPortal(l.jsx(we.div,{...r,ref:t}),o):null});ha.displayName=Im;function Um(e,t){return w.useReducer((n,r)=>t[n][r]??n,e)}var xr=e=>{const{present:t,children:n}=e,r=Fm(t),s=typeof n=="function"?n({present:r.isPresent}):w.Children.only(n),i=Bm(r.ref,$m(s));return typeof n=="function"||r.isPresent?w.cloneElement(s,{ref:i}):null};xr.displayName="Presence";function Fm(e){const[t,n]=w.useState(),r=w.useRef(null),s=w.useRef(e),i=w.useRef("none"),o=e?"mounted":"unmounted",[a,c]=Um(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{const d=hs(r.current);i.current=a==="mounted"?d:"none"},[a]),Ie(()=>{const d=r.current,u=s.current;if(u!==e){const m=i.current,p=hs(d);e?c("MOUNT"):p==="none"||(d==null?void 0:d.display)==="none"?c("UNMOUNT"):c(u&&m!==p?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,c]),Ie(()=>{if(t){let d;const u=t.ownerDocument.defaultView??window,f=p=>{const h=hs(r.current).includes(CSS.escape(p.animationName));if(p.target===t&&h&&(c("ANIMATION_END"),!s.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",d=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},m=p=>{p.target===t&&(i.current=hs(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{u.clearTimeout(d),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:w.useCallback(d=>{r.current=d?getComputedStyle(d):null,n(d)},[])}}function Rc(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Bm(...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=Rc(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():Rc(r[o],null)}}},[])}function hs(e){return(e==null?void 0:e.animationName)||"none"}function $m(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 ps=0,wt=null;function Wd(){w.useEffect(()=>{wt||(wt={start:Dc(),end:Dc()});const{start:e,end:t}=wt;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),ps++,()=>{ps===1&&(wt==null||wt.start.remove(),wt==null||wt.end.remove(),wt=null),ps=Math.max(0,ps-1)}},[])}function Dc(){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 Tt=function(){return Tt=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},Tt.apply(this,arguments)};function Gd(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 Vm(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 Ns="right-scroll-bar-position",Rs="width-before-scroll-bar",Hm="with-scroll-bars-hidden",zm="--removed-body-scroll-bar-size";function Hi(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Wm(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 Gm=typeof window<"u"?w.useLayoutEffect:w.useEffect,Lc=new WeakMap;function Km(e,t){var n=Wm(null,function(r){return e.forEach(function(s){return Hi(s,r)})});return Gm(function(){var r=Lc.get(n);if(r){var s=new Set(r),i=new Set(e),o=n.current;s.forEach(function(a){i.has(a)||Hi(a,null)}),i.forEach(function(a){s.has(a)||Hi(a,o)})}Lc.set(n,e)},[e]),n}function qm(e){return e}function Zm(e,t){t===void 0&&(t=qm);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 c=function(){var u=o;o=[],u.forEach(i)},d=function(){return Promise.resolve().then(c)};d(),n={push:function(u){o.push(u),d()},filter:function(u){return o=o.filter(u),n}}}};return s}function Ym(e){e===void 0&&(e={});var t=Zm(null);return t.options=Tt({async:!0,ssr:!1},e),t}var Kd=function(e){var t=e.sideCar,n=Gd(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,Tt({},n))};Kd.isSideCarExport=!0;function Qm(e,t){return e.useMedium(t),Kd}var qd=Ym(),zi=function(){},fi=w.forwardRef(function(e,t){var n=w.useRef(null),r=w.useState({onScrollCapture:zi,onWheelCapture:zi,onTouchMoveCapture:zi}),s=r[0],i=r[1],o=e.forwardProps,a=e.children,c=e.className,d=e.removeScrollBar,u=e.enabled,f=e.shards,m=e.sideCar,p=e.noRelative,g=e.noIsolation,h=e.inert,y=e.allowPinchZoom,b=e.as,v=b===void 0?"div":b,x=e.gapMode,_=Gd(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=m,k=Km([n,t]),T=Tt(Tt({},_),s);return w.createElement(w.Fragment,null,u&&w.createElement(C,{sideCar:qd,removeScrollBar:d,shards:f,noRelative:p,noIsolation:g,inert:h,setCallbacks:i,allowPinchZoom:!!y,lockRef:n,gapMode:x}),o?w.cloneElement(w.Children.only(a),Tt(Tt({},T),{ref:k})):w.createElement(v,Tt({},T,{className:c,ref:k}),a))});fi.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};fi.classNames={fullWidth:Rs,zeroRight:Ns};var Xm=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Jm(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Xm();return t&&e.setAttribute("nonce",t),e}function eg(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function tg(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var ng=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Jm())&&(eg(t,n),tg(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},rg=function(){var e=ng();return function(t,n){w.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Zd=function(){var e=rg(),t=function(n){var r=n.styles,s=n.dynamic;return e(r,s),null};return t},sg={left:0,top:0,right:0,gap:0},Wi=function(e){return parseInt(e||"",10)||0},ig=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[Wi(n),Wi(r),Wi(s)]},og=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return sg;var t=ig(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])}},ag=Zd(),Zn="data-scroll-locked",cg=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(Hm,` {
3
3
  overflow: hidden `).concat(r,`;
4
4
  padding-right: `).concat(a,"px ").concat(r,`;
5
5
  }
@@ -16,7 +16,7 @@
16
16
  `),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),`
17
17
  }
18
18
 
19
- .`).concat(As,` {
19
+ .`).concat(Ns,` {
20
20
  right: `).concat(a,"px ").concat(r,`;
21
21
  }
22
22
 
@@ -24,7 +24,7 @@
24
24
  margin-right: `).concat(a,"px ").concat(r,`;
25
25
  }
26
26
 
27
- .`).concat(As," .").concat(As,` {
27
+ .`).concat(Ns," .").concat(Ns,` {
28
28
  right: 0 `).concat(r,`;
29
29
  }
30
30
 
@@ -33,12 +33,12 @@
33
33
  }
34
34
 
35
35
  body[`).concat(Zn,`] {
36
- `).concat(Bm,": ").concat(a,`px;
36
+ `).concat(zm,": ").concat(a,`px;
37
37
  }
38
- `)},Lc=function(){var e=parseInt(document.body.getAttribute(Zn)||"0",10);return isFinite(e)?e:0},ig=function(){w.useEffect(function(){return document.body.setAttribute(Zn,(Lc()+1).toString()),function(){var e=Lc()-1;e<=0?document.body.removeAttribute(Zn):document.body.setAttribute(Zn,e.toString())}},[])},og=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,s=r===void 0?"margin":r;ig();var i=w.useMemo(function(){return ng(s)},[s]);return w.createElement(rg,{styles:sg(i,!t,s,n?"":"!important")})},bo=!1;if(typeof window<"u")try{var hs=Object.defineProperty({},"passive",{get:function(){return bo=!0,!0}});window.addEventListener("test",hs,hs),window.removeEventListener("test",hs,hs)}catch{bo=!1}var $n=bo?{passive:!1}:!1,ag=function(e){return e.tagName==="TEXTAREA"},qd=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!ag(e)&&n[t]==="visible")},cg=function(e){return qd(e,"overflowY")},lg=function(e){return qd(e,"overflowX")},jc=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=Kd(e,r);if(s){var i=Zd(e,r),o=i[1],a=i[2];if(o>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},dg=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},ug=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Kd=function(e,t){return e==="v"?cg(t):lg(t)},Zd=function(e,t){return e==="v"?dg(t):ug(t)},fg=function(e,t){return e==="h"&&t==="rtl"?-1:1},pg=function(e,t,n,r,s){var i=fg(e,window.getComputedStyle(t).direction),o=i*r,a=n.target,c=t.contains(a),d=!1,u=o>0,f=0,m=0;do{if(!a)break;var h=Zd(e,a),g=h[0],p=h[1],y=h[2],b=p-y-i*g;(g||b)&&Kd(e,a)&&(f+=b,m+=g);var v=a.parentNode;a=v&&v.nodeType===Node.DOCUMENT_FRAGMENT_NODE?v.host:v}while(!c&&a!==document.body||c&&(t.contains(a)||t===a));return(u&&Math.abs(f)<1||!u&&Math.abs(m)<1)&&(d=!0),d},ms=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Mc=function(e){return[e.deltaX,e.deltaY]},Ic=function(e){return e&&"current"in e?e.current:e},hg=function(e,t){return e[0]===t[0]&&e[1]===t[1]},mg=function(e){return`
38
+ `)},jc=function(){var e=parseInt(document.body.getAttribute(Zn)||"0",10);return isFinite(e)?e:0},lg=function(){w.useEffect(function(){return document.body.setAttribute(Zn,(jc()+1).toString()),function(){var e=jc()-1;e<=0?document.body.removeAttribute(Zn):document.body.setAttribute(Zn,e.toString())}},[])},dg=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,s=r===void 0?"margin":r;lg();var i=w.useMemo(function(){return og(s)},[s]);return w.createElement(ag,{styles:cg(i,!t,s,n?"":"!important")})},vo=!1;if(typeof window<"u")try{var ms=Object.defineProperty({},"passive",{get:function(){return vo=!0,!0}});window.addEventListener("test",ms,ms),window.removeEventListener("test",ms,ms)}catch{vo=!1}var $n=vo?{passive:!1}:!1,ug=function(e){return e.tagName==="TEXTAREA"},Yd=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!ug(e)&&n[t]==="visible")},fg=function(e){return Yd(e,"overflowY")},hg=function(e){return Yd(e,"overflowX")},Mc=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=Qd(e,r);if(s){var i=Xd(e,r),o=i[1],a=i[2];if(o>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},pg=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},mg=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Qd=function(e,t){return e==="v"?fg(t):hg(t)},Xd=function(e,t){return e==="v"?pg(t):mg(t)},gg=function(e,t){return e==="h"&&t==="rtl"?-1:1},yg=function(e,t,n,r,s){var i=gg(e,window.getComputedStyle(t).direction),o=i*r,a=n.target,c=t.contains(a),d=!1,u=o>0,f=0,m=0;do{if(!a)break;var p=Xd(e,a),g=p[0],h=p[1],y=p[2],b=h-y-i*g;(g||b)&&Qd(e,a)&&(f+=b,m+=g);var v=a.parentNode;a=v&&v.nodeType===Node.DOCUMENT_FRAGMENT_NODE?v.host:v}while(!c&&a!==document.body||c&&(t.contains(a)||t===a));return(u&&Math.abs(f)<1||!u&&Math.abs(m)<1)&&(d=!0),d},gs=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Ic=function(e){return[e.deltaX,e.deltaY]},Uc=function(e){return e&&"current"in e?e.current:e},bg=function(e,t){return e[0]===t[0]&&e[1]===t[1]},vg=function(e){return`
39
39
  .block-interactivity-`.concat(e,` {pointer-events: none;}
40
40
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
41
- `)},gg=0,Vn=[];function yg(e){var t=w.useRef([]),n=w.useRef([0,0]),r=w.useRef(),s=w.useState(gg++)[0],i=w.useState(Gd)[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=Fm([e.lockRef.current],(e.shards||[]).map(Ic),!0).filter(Boolean);return p.forEach(function(y){return y.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),p.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var a=w.useCallback(function(p,y){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!o.current.allowPinchZoom;var b=ms(p),v=n.current,x="deltaX"in p?p.deltaX:v[0]-b[0],_="deltaY"in p?p.deltaY:v[1]-b[1],C,k=p.target,T=Math.abs(x)>Math.abs(_)?"h":"v";if("touches"in p&&T==="h"&&k.type==="range")return!1;var R=window.getSelection(),A=R&&R.anchorNode,O=A?A===k||A.contains(k):!1;if(O)return!1;var D=jc(T,k);if(!D)return!0;if(D?C=T:(C=T==="v"?"h":"v",D=jc(T,k)),!D)return!1;if(!r.current&&"changedTouches"in p&&(x||_)&&(r.current=C),!C)return!0;var L=r.current||C;return pg(L,y,p,L==="h"?x:_)},[]),c=w.useCallback(function(p){var y=p;if(!(!Vn.length||Vn[Vn.length-1]!==i)){var b="deltaY"in y?Mc(y):ms(y),v=t.current.filter(function(C){return C.name===y.type&&(C.target===y.target||y.target===C.shadowParent)&&hg(C.delta,b)})[0];if(v&&v.should){y.cancelable&&y.preventDefault();return}if(!v){var x=(o.current.shards||[]).map(Ic).filter(Boolean).filter(function(C){return C.contains(y.target)}),_=x.length>0?a(y,x[0]):!o.current.noIsolation;_&&y.cancelable&&y.preventDefault()}}},[]),d=w.useCallback(function(p,y,b,v){var x={name:p,delta:y,target:b,should:v,shadowParent:bg(b)};t.current.push(x),setTimeout(function(){t.current=t.current.filter(function(_){return _!==x})},1)},[]),u=w.useCallback(function(p){n.current=ms(p),r.current=void 0},[]),f=w.useCallback(function(p){d(p.type,Mc(p),p.target,a(p,e.lockRef.current))},[]),m=w.useCallback(function(p){d(p.type,ms(p),p.target,a(p,e.lockRef.current))},[]);w.useEffect(function(){return Vn.push(i),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:m}),document.addEventListener("wheel",c,$n),document.addEventListener("touchmove",c,$n),document.addEventListener("touchstart",u,$n),function(){Vn=Vn.filter(function(p){return p!==i}),document.removeEventListener("wheel",c,$n),document.removeEventListener("touchmove",c,$n),document.removeEventListener("touchstart",u,$n)}},[]);var h=e.removeScrollBar,g=e.inert;return w.createElement(w.Fragment,null,g?w.createElement(i,{styles:mg(s)}):null,h?w.createElement(og,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function bg(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const vg=qm(Wd,yg);var pa=w.forwardRef(function(e,t){return w.createElement(di,Tt({},e,{ref:t,sideCar:vg}))});pa.classNames=di.classNames;var wg=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Hn=new WeakMap,gs=new WeakMap,ys={},Wi=0,Yd=function(e){return e&&(e.host||Yd(e.parentNode))},_g=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Yd(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})},xg=function(e,t,n,r){var s=_g(t,Array.isArray(e)?e:[e]);ys[n]||(ys[n]=new WeakMap);var i=ys[n],o=[],a=new Set,c=new Set(s),d=function(f){!f||a.has(f)||(a.add(f),d(f.parentNode))};s.forEach(d);var u=function(f){!f||c.has(f)||Array.prototype.forEach.call(f.children,function(m){if(a.has(m))u(m);else try{var h=m.getAttribute(r),g=h!==null&&h!=="false",p=(Hn.get(m)||0)+1,y=(i.get(m)||0)+1;Hn.set(m,p),i.set(m,y),o.push(m),p===1&&g&&gs.set(m,!0),y===1&&m.setAttribute(n,"true"),g||m.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",m,b)}})};return u(t),a.clear(),Wi++,function(){o.forEach(function(f){var m=Hn.get(f)-1,h=i.get(f)-1;Hn.set(f,m),i.set(f,h),m||(gs.has(f)||f.removeAttribute(r),gs.delete(f)),h||f.removeAttribute(n)}),Wi--,Wi||(Hn=new WeakMap,Hn=new WeakMap,gs=new WeakMap,ys={})}},Qd=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=wg(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),xg(r,s,n,"aria-hidden")):function(){return null}},ui="Dialog",[Xd]=_r(ui),[Sg,gt]=Xd(ui),Jd=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:o=!0}=e,a=w.useRef(null),c=w.useRef(null),[d,u]=ur({prop:r,defaultProp:s??!1,onChange:i,caller:ui});return l.jsx(Sg,{scope:t,triggerRef:a,contentRef:c,contentId:nn(),titleId:nn(),descriptionId:nn(),open:d,onOpenChange:u,onOpenToggle:w.useCallback(()=>u(f=>!f),[u]),modal:o,children:n})};Jd.displayName=ui;var eu="DialogTrigger",Cg=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=gt(eu,n),i=Pe(t,s.triggerRef);return l.jsx(ve.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":va(s.open),...r,ref:i,onClick:Se(e.onClick,s.onOpenToggle)})});Cg.displayName=eu;var ha="DialogPortal",[Eg,tu]=Xd(ha,{forceMount:void 0}),nu=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:s}=e,i=gt(ha,t);return l.jsx(Eg,{scope:t,forceMount:n,children:w.Children.map(r,o=>l.jsx(xr,{present:n||i.open,children:l.jsx(fa,{asChild:!0,container:s,children:o})}))})};nu.displayName=ha;var Bs="DialogOverlay",ma=w.forwardRef((e,t)=>{const n=tu(Bs,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,i=gt(Bs,e.__scopeDialog);return i.modal?l.jsx(xr,{present:r||i.open,children:l.jsx(Pg,{...s,ref:t})}):null});ma.displayName=Bs;var Tg=dr("DialogOverlay.RemoveScroll"),Pg=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=gt(Bs,n),i=Sm(),o=Pe(t,i);return l.jsx(pa,{as:Tg,allowPinchZoom:!0,shards:[s.contentRef],children:l.jsx(ve.div,{"data-state":va(s.open),...r,ref:o,style:{pointerEvents:"auto",...r.style}})})}),fr="DialogContent",ga=w.forwardRef((e,t)=>{const n=tu(fr,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,i=gt(fr,e.__scopeDialog);return l.jsx(xr,{present:r||i.open,children:i.modal?l.jsx(kg,{...s,ref:t}):l.jsx(Og,{...s,ref:t})})});ga.displayName=fr;var kg=w.forwardRef((e,t)=>{const n=gt(fr,e.__scopeDialog),r=w.useRef(null),s=Pe(t,n.contentRef,r);return w.useEffect(()=>{const i=r.current;if(i)return Qd(i)},[]),l.jsx(ru,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:Se(e.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:Se(e.onPointerDownOutside,i=>{const o=i.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&i.preventDefault()}),onFocusOutside:Se(e.onFocusOutside,i=>i.preventDefault())})}),Og=w.forwardRef((e,t)=>{const n=gt(fr,e.__scopeDialog),r=w.useRef(!1),s=w.useRef(!1);return l.jsx(ru,{...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 c,d;(c=e.onInteractOutside)==null||c.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()}})}),ru=w.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,...o}=e,a=gt(fr,n);return Vd(),l.jsx(l.Fragment,{children:l.jsx(ua,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:l.jsx(da,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":va(a.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>a.onOpenChange(!1)})})})}),su="DialogTitle",ya=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=gt(su,n);return l.jsx(ve.h2,{id:s.titleId,...r,ref:t})});ya.displayName=su;var iu="DialogDescription",ba=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=gt(iu,n);return l.jsx(ve.p,{id:s.descriptionId,...r,ref:t})});ba.displayName=iu;var ou="DialogClose",Ag=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=gt(ou,n);return l.jsx(ve.button,{type:"button",...r,ref:t,onClick:Se(e.onClick,()=>s.onOpenChange(!1))})});Ag.displayName=ou;function va(e){return e?"open":"closed"}const Rg=Jd,Ng=nu,au=w.forwardRef(({className:e,...t},n)=>l.jsx(ma,{ref:n,className:De("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}));au.displayName=ma.displayName;const cu=w.forwardRef(({className:e,overlayClass:t,children:n,...r},s)=>l.jsxs(Ng,{children:[l.jsx(au,{className:t}),l.jsx(ga,{ref:s,className:De("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})]}));cu.displayName=ga.displayName;const lu=({className:e,...t})=>l.jsx("div",{className:De("flex flex-col space-y-1.5 border-b text-center sm:text-left",e),...t});lu.displayName="DialogHeader";const du=({className:e,...t})=>l.jsx("div",{className:De("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});du.displayName="DialogFooter";const uu=w.forwardRef(({className:e,...t},n)=>l.jsx(ya,{ref:n,className:De("text-lg font-semibold leading-none tracking-tight",e),...t}));uu.displayName=ya.displayName;const fu=w.forwardRef(({className:e,...t},n)=>l.jsx(ba,{ref:n,className:De("text-sm text-muted-foreground",e),...t}));fu.displayName=ba.displayName;function Fc(e,[t,n]){return Math.min(n,Math.max(t,e))}function pu(e){const t=e+"CollectionProvider",[n,r]=_r(t),[s,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=p=>{const{scope:y,children:b}=p,v=w.useRef(null),x=w.useRef(new Map).current;return l.jsx(s,{scope:y,itemMap:x,collectionRef:v,children:b})};o.displayName=t;const a=e+"CollectionSlot",c=dr(a),d=w.forwardRef((p,y)=>{const{scope:b,children:v}=p,x=i(a,b),_=Pe(y,x.collectionRef);return l.jsx(c,{ref:_,children:v})});d.displayName=a;const u=e+"CollectionItemSlot",f="data-radix-collection-item",m=dr(u),h=w.forwardRef((p,y)=>{const{scope:b,children:v,...x}=p,_=w.useRef(null),C=Pe(y,_),k=i(u,b);return w.useEffect(()=>(k.itemMap.set(_,{ref:_,...x}),()=>void k.itemMap.delete(_))),l.jsx(m,{[f]:"",ref:C,children:v})});h.displayName=u;function g(p){const y=i(e+"CollectionConsumer",p);return w.useCallback(()=>{const v=y.collectionRef.current;if(!v)return[];const x=Array.from(v.querySelectorAll(`[${f}]`));return Array.from(y.itemMap.values()).sort((k,T)=>x.indexOf(k.ref.current)-x.indexOf(T.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:o,Slot:d,ItemSlot:h},g,r]}var Dg=w.createContext(void 0);function hu(e){const t=w.useContext(Dg);return e||t||"ltr"}const Lg=["top","right","bottom","left"],on=Math.min,tt=Math.max,$s=Math.round,bs=Math.floor,kt=e=>({x:e,y:e}),jg={left:"right",right:"left",bottom:"top",top:"bottom"};function vo(e,t,n){return tt(e,on(t,n))}function jt(e,t){return typeof e=="function"?e(t):e}function Mt(e){return e.split("-")[0]}function Sr(e){return e.split("-")[1]}function wa(e){return e==="x"?"y":"x"}function _a(e){return e==="y"?"height":"width"}function Pt(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function xa(e){return wa(Pt(e))}function Mg(e,t,n){n===void 0&&(n=!1);const r=Sr(e),s=xa(e),i=_a(s);let o=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(o=Vs(o)),[o,Vs(o)]}function Ig(e){const t=Vs(e);return[wo(e),t,wo(t)]}function wo(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Uc=["left","right"],Bc=["right","left"],Fg=["top","bottom"],Ug=["bottom","top"];function Bg(e,t,n){switch(e){case"top":case"bottom":return n?t?Bc:Uc:t?Uc:Bc;case"left":case"right":return t?Fg:Ug;default:return[]}}function $g(e,t,n,r){const s=Sr(e);let i=Bg(Mt(e),n==="start",r);return s&&(i=i.map(o=>o+"-"+s),t&&(i=i.concat(i.map(wo)))),i}function Vs(e){const t=Mt(e);return jg[t]+e.slice(t.length)}function Vg(e){return{top:0,right:0,bottom:0,left:0,...e}}function mu(e){return typeof e!="number"?Vg(e):{top:e,right:e,bottom:e,left:e}}function Hs(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 $c(e,t,n){let{reference:r,floating:s}=e;const i=Pt(t),o=xa(t),a=_a(o),c=Mt(t),d=i==="y",u=r.x+r.width/2-s.width/2,f=r.y+r.height/2-s.height/2,m=r[a]/2-s[a]/2;let h;switch(c){case"top":h={x:u,y:r.y-s.height};break;case"bottom":h={x:u,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:f};break;case"left":h={x:r.x-s.width,y:f};break;default:h={x:r.x,y:r.y}}switch(Sr(t)){case"start":h[o]-=m*(n&&d?-1:1);break;case"end":h[o]+=m*(n&&d?-1:1);break}return h}async function Hg(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:i,rects:o,elements:a,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:m=!1,padding:h=0}=jt(t,e),g=mu(h),y=a[m?f==="floating"?"reference":"floating":f],b=Hs(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(y)))==null||n?y:y.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:d,rootBoundary:u,strategy:c})),v=f==="floating"?{x:r,y:s,width:o.floating.width,height:o.floating.height}:o.reference,x=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),_=await(i.isElement==null?void 0:i.isElement(x))?await(i.getScale==null?void 0:i.getScale(x))||{x:1,y:1}:{x:1,y:1},C=Hs(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:x,strategy:c}):v);return{top:(b.top-C.top+g.top)/_.y,bottom:(C.bottom-b.bottom+g.bottom)/_.y,left:(b.left-C.left+g.left)/_.x,right:(C.right-b.right+g.right)/_.x}}const zg=50,Wg=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:o}=n,a=o.detectOverflow?o:{...o,detectOverflow:Hg},c=await(o.isRTL==null?void 0:o.isRTL(t));let d=await o.getElementRects({reference:e,floating:t,strategy:s}),{x:u,y:f}=$c(d,r,c),m=r,h=0;const g={};for(let p=0;p<i.length;p++){const y=i[p];if(!y)continue;const{name:b,fn:v}=y,{x,y:_,data:C,reset:k}=await v({x:u,y:f,initialPlacement:r,placement:m,strategy:s,middlewareData:g,rects:d,platform:a,elements:{reference:e,floating:t}});u=x??u,f=_??f,g[b]={...g[b],...C},k&&h<zg&&(h++,typeof k=="object"&&(k.placement&&(m=k.placement),k.rects&&(d=k.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:s}):k.rects),{x:u,y:f}=$c(d,m,c)),p=-1)}return{x:u,y:f,placement:m,strategy:s,middlewareData:g}},Gg=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:i,platform:o,elements:a,middlewareData:c}=t,{element:d,padding:u=0}=jt(e,t)||{};if(d==null)return{};const f=mu(u),m={x:n,y:r},h=xa(s),g=_a(h),p=await o.getDimensions(d),y=h==="y",b=y?"top":"left",v=y?"bottom":"right",x=y?"clientHeight":"clientWidth",_=i.reference[g]+i.reference[h]-m[h]-i.floating[g],C=m[h]-i.reference[h],k=await(o.getOffsetParent==null?void 0:o.getOffsetParent(d));let T=k?k[x]:0;(!T||!await(o.isElement==null?void 0:o.isElement(k)))&&(T=a.floating[x]||i.floating[g]);const R=_/2-C/2,A=T/2-p[g]/2-1,O=on(f[b],A),D=on(f[v],A),L=O,B=T-p[g]-D,U=T/2-p[g]/2+R,z=vo(L,U,B),F=!c.arrow&&Sr(s)!=null&&U!==z&&i.reference[g]/2-(U<L?O:D)-p[g]/2<0,I=F?U<L?U-L:U-B:0;return{[h]:m[h]+I,data:{[h]:z,centerOffset:U-z-I,...F&&{alignmentOffset:I}},reset:F}}}),qg=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:c,elements:d}=t,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:m,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:p=!0,...y}=jt(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const b=Mt(s),v=Pt(a),x=Mt(a)===a,_=await(c.isRTL==null?void 0:c.isRTL(d.floating)),C=m||(x||!p?[Vs(a)]:Ig(a)),k=g!=="none";!m&&k&&C.push(...$g(a,p,g,_));const T=[a,...C],R=await c.detectOverflow(t,y),A=[];let O=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&A.push(R[b]),f){const U=Mg(s,o,_);A.push(R[U[0]],R[U[1]])}if(O=[...O,{placement:s,overflows:A}],!A.every(U=>U<=0)){var D,L;const U=(((D=i.flip)==null?void 0:D.index)||0)+1,z=T[U];if(z&&(!(f==="alignment"?v!==Pt(z):!1)||O.every(N=>Pt(N.placement)===v?N.overflows[0]>0:!0)))return{data:{index:U,overflows:O},reset:{placement:z}};let F=(L=O.filter(I=>I.overflows[0]<=0).sort((I,N)=>I.overflows[1]-N.overflows[1])[0])==null?void 0:L.placement;if(!F)switch(h){case"bestFit":{var B;const I=(B=O.filter(N=>{if(k){const M=Pt(N.placement);return M===v||M==="y"}return!0}).map(N=>[N.placement,N.overflows.filter(M=>M>0).reduce((M,$)=>M+$,0)]).sort((N,M)=>N[1]-M[1])[0])==null?void 0:B[0];I&&(F=I);break}case"initialPlacement":F=a;break}if(s!==F)return{reset:{placement:F}}}return{}}}};function Vc(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Hc(e){return Lg.some(t=>e[t]>=0)}const Kg=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:s="referenceHidden",...i}=jt(e,t);switch(s){case"referenceHidden":{const o=await r.detectOverflow(t,{...i,elementContext:"reference"}),a=Vc(o,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:Hc(a)}}}case"escaped":{const o=await r.detectOverflow(t,{...i,altBoundary:!0}),a=Vc(o,n.floating);return{data:{escapedOffsets:a,escaped:Hc(a)}}}default:return{}}}}},gu=new Set(["left","top"]);async function Zg(e,t){const{placement:n,platform:r,elements:s}=e,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),o=Mt(n),a=Sr(n),c=Pt(n)==="y",d=gu.has(o)?-1:1,u=i&&c?-1:1,f=jt(t,e);let{mainAxis:m,crossAxis:h,alignmentAxis:g}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof g=="number"&&(h=a==="end"?g*-1:g),c?{x:h*u,y:m*d}:{x:m*d,y:h*u}}const Yg=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,c=await Zg(t,e);return o===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:s+c.x,y:i+c.y,data:{...c,placement:o}}}}},Qg=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:c={fn:b=>{let{x:v,y:x}=b;return{x:v,y:x}}},...d}=jt(e,t),u={x:n,y:r},f=await i.detectOverflow(t,d),m=Pt(Mt(s)),h=wa(m);let g=u[h],p=u[m];if(o){const b=h==="y"?"top":"left",v=h==="y"?"bottom":"right",x=g+f[b],_=g-f[v];g=vo(x,g,_)}if(a){const b=m==="y"?"top":"left",v=m==="y"?"bottom":"right",x=p+f[b],_=p-f[v];p=vo(x,p,_)}const y=c.fn({...t,[h]:g,[m]:p});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[h]:o,[m]:a}}}}}},Xg=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:c=!0,crossAxis:d=!0}=jt(e,t),u={x:n,y:r},f=Pt(s),m=wa(f);let h=u[m],g=u[f];const p=jt(a,t),y=typeof p=="number"?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(c){const x=m==="y"?"height":"width",_=i.reference[m]-i.floating[x]+y.mainAxis,C=i.reference[m]+i.reference[x]-y.mainAxis;h<_?h=_:h>C&&(h=C)}if(d){var b,v;const x=m==="y"?"width":"height",_=gu.has(Mt(s)),C=i.reference[f]-i.floating[x]+(_&&((b=o.offset)==null?void 0:b[f])||0)+(_?0:y.crossAxis),k=i.reference[f]+i.reference[x]+(_?0:((v=o.offset)==null?void 0:v[f])||0)-(_?y.crossAxis:0);g<C?g=C:g>k&&(g=k)}return{[m]:h,[f]:g}}}},Jg=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:c=()=>{},...d}=jt(e,t),u=await o.detectOverflow(t,d),f=Mt(s),m=Sr(s),h=Pt(s)==="y",{width:g,height:p}=i.floating;let y,b;f==="top"||f==="bottom"?(y=f,b=m===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(b=f,y=m==="end"?"top":"bottom");const v=p-u.top-u.bottom,x=g-u.left-u.right,_=on(p-u[y],v),C=on(g-u[b],x),k=!t.middlewareData.shift;let T=_,R=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(R=x),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(T=v),k&&!m){const O=tt(u.left,0),D=tt(u.right,0),L=tt(u.top,0),B=tt(u.bottom,0);h?R=g-2*(O!==0||D!==0?O+D:tt(u.left,u.right)):T=p-2*(L!==0||B!==0?L+B:tt(u.top,u.bottom))}await c({...t,availableWidth:R,availableHeight:T});const A=await o.getDimensions(a.floating);return g!==A.width||p!==A.height?{reset:{rects:!0}}:{}}}};function fi(){return typeof window<"u"}function Cr(e){return yu(e)?(e.nodeName||"").toLowerCase():"#document"}function nt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function At(e){var t;return(t=(yu(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function yu(e){return fi()?e instanceof Node||e instanceof nt(e).Node:!1}function ht(e){return fi()?e instanceof Element||e instanceof nt(e).Element:!1}function Ft(e){return fi()?e instanceof HTMLElement||e instanceof nt(e).HTMLElement:!1}function zc(e){return!fi()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof nt(e).ShadowRoot}function es(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=mt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&s!=="inline"&&s!=="contents"}function ey(e){return/^(table|td|th)$/.test(Cr(e))}function pi(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const ty=/transform|translate|scale|rotate|perspective|filter/,ny=/paint|layout|strict|content/,gn=e=>!!e&&e!=="none";let Gi;function Sa(e){const t=ht(e)?mt(e):e;return gn(t.transform)||gn(t.translate)||gn(t.scale)||gn(t.rotate)||gn(t.perspective)||!Ca()&&(gn(t.backdropFilter)||gn(t.filter))||ty.test(t.willChange||"")||ny.test(t.contain||"")}function ry(e){let t=an(e);for(;Ft(t)&&!pr(t);){if(Sa(t))return t;if(pi(t))return null;t=an(t)}return null}function Ca(){return Gi==null&&(Gi=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Gi}function pr(e){return/^(html|body|#document)$/.test(Cr(e))}function mt(e){return nt(e).getComputedStyle(e)}function hi(e){return ht(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function an(e){if(Cr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||zc(e)&&e.host||At(e);return zc(t)?t.host:t}function bu(e){const t=an(e);return pr(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ft(t)&&es(t)?t:bu(t)}function Fr(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=bu(e),i=s===((r=e.ownerDocument)==null?void 0:r.body),o=nt(s);if(i){const a=_o(o);return t.concat(o,o.visualViewport||[],es(s)?s:[],a&&n?Fr(a):[])}else return t.concat(s,Fr(s,[],n))}function _o(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function vu(e){const t=mt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=Ft(e),i=s?e.offsetWidth:n,o=s?e.offsetHeight:r,a=$s(n)!==i||$s(r)!==o;return a&&(n=i,r=o),{width:n,height:r,$:a}}function Ea(e){return ht(e)?e:e.contextElement}function Yn(e){const t=Ea(e);if(!Ft(t))return kt(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:i}=vu(t);let o=(i?$s(n.width):n.width)/r,a=(i?$s(n.height):n.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const sy=kt(0);function wu(e){const t=nt(e);return!Ca()||!t.visualViewport?sy:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function iy(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==nt(e)?!1:t}function Dn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),i=Ea(e);let o=kt(1);t&&(r?ht(r)&&(o=Yn(r)):o=Yn(e));const a=iy(i,n,r)?wu(i):kt(0);let c=(s.left+a.x)/o.x,d=(s.top+a.y)/o.y,u=s.width/o.x,f=s.height/o.y;if(i){const m=nt(i),h=r&&ht(r)?nt(r):r;let g=m,p=_o(g);for(;p&&r&&h!==g;){const y=Yn(p),b=p.getBoundingClientRect(),v=mt(p),x=b.left+(p.clientLeft+parseFloat(v.paddingLeft))*y.x,_=b.top+(p.clientTop+parseFloat(v.paddingTop))*y.y;c*=y.x,d*=y.y,u*=y.x,f*=y.y,c+=x,d+=_,g=nt(p),p=_o(g)}}return Hs({width:u,height:f,x:c,y:d})}function mi(e,t){const n=hi(e).scrollLeft;return t?t.left+n:Dn(At(e)).left+n}function _u(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-mi(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function oy(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const i=s==="fixed",o=At(r),a=t?pi(t.floating):!1;if(r===o||a&&i)return n;let c={scrollLeft:0,scrollTop:0},d=kt(1);const u=kt(0),f=Ft(r);if((f||!f&&!i)&&((Cr(r)!=="body"||es(o))&&(c=hi(r)),f)){const h=Dn(r);d=Yn(r),u.x=h.x+r.clientLeft,u.y=h.y+r.clientTop}const m=o&&!f&&!i?_u(o,c):kt(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+u.x+m.x,y:n.y*d.y-c.scrollTop*d.y+u.y+m.y}}function ay(e){return Array.from(e.getClientRects())}function cy(e){const t=At(e),n=hi(e),r=e.ownerDocument.body,s=tt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=tt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+mi(e);const a=-n.scrollTop;return mt(r).direction==="rtl"&&(o+=tt(t.clientWidth,r.clientWidth)-s),{width:s,height:i,x:o,y:a}}const Wc=25;function ly(e,t){const n=nt(e),r=At(e),s=n.visualViewport;let i=r.clientWidth,o=r.clientHeight,a=0,c=0;if(s){i=s.width,o=s.height;const u=Ca();(!u||u&&t==="fixed")&&(a=s.offsetLeft,c=s.offsetTop)}const d=mi(r);if(d<=0){const u=r.ownerDocument,f=u.body,m=getComputedStyle(f),h=u.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,g=Math.abs(r.clientWidth-f.clientWidth-h);g<=Wc&&(i-=g)}else d<=Wc&&(i+=d);return{width:i,height:o,x:a,y:c}}function dy(e,t){const n=Dn(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,i=Ft(e)?Yn(e):kt(1),o=e.clientWidth*i.x,a=e.clientHeight*i.y,c=s*i.x,d=r*i.y;return{width:o,height:a,x:c,y:d}}function Gc(e,t,n){let r;if(t==="viewport")r=ly(e,n);else if(t==="document")r=cy(At(e));else if(ht(t))r=dy(t,n);else{const s=wu(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return Hs(r)}function xu(e,t){const n=an(e);return n===t||!ht(n)||pr(n)?!1:mt(n).position==="fixed"||xu(n,t)}function uy(e,t){const n=t.get(e);if(n)return n;let r=Fr(e,[],!1).filter(a=>ht(a)&&Cr(a)!=="body"),s=null;const i=mt(e).position==="fixed";let o=i?an(e):e;for(;ht(o)&&!pr(o);){const a=mt(o),c=Sa(o);!c&&a.position==="fixed"&&(s=null),(i?!c&&!s:!c&&a.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||es(o)&&!c&&xu(e,o))?r=r.filter(u=>u!==o):s=a,o=an(o)}return t.set(e,r),r}function fy(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const o=[...n==="clippingAncestors"?pi(t)?[]:uy(t,this._c):[].concat(n),r],a=Gc(t,o[0],s);let c=a.top,d=a.right,u=a.bottom,f=a.left;for(let m=1;m<o.length;m++){const h=Gc(t,o[m],s);c=tt(h.top,c),d=on(h.right,d),u=on(h.bottom,u),f=tt(h.left,f)}return{width:d-f,height:u-c,x:f,y:c}}function py(e){const{width:t,height:n}=vu(e);return{width:t,height:n}}function hy(e,t,n){const r=Ft(t),s=At(t),i=n==="fixed",o=Dn(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const c=kt(0);function d(){c.x=mi(s)}if(r||!r&&!i)if((Cr(t)!=="body"||es(s))&&(a=hi(t)),r){const h=Dn(t,!0,i,t);c.x=h.x+t.clientLeft,c.y=h.y+t.clientTop}else s&&d();i&&!r&&s&&d();const u=s&&!r&&!i?_u(s,a):kt(0),f=o.left+a.scrollLeft-c.x-u.x,m=o.top+a.scrollTop-c.y-u.y;return{x:f,y:m,width:o.width,height:o.height}}function qi(e){return mt(e).position==="static"}function qc(e,t){if(!Ft(e)||mt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return At(e)===n&&(n=n.ownerDocument.body),n}function Su(e,t){const n=nt(e);if(pi(e))return n;if(!Ft(e)){let s=an(e);for(;s&&!pr(s);){if(ht(s)&&!qi(s))return s;s=an(s)}return n}let r=qc(e,t);for(;r&&ey(r)&&qi(r);)r=qc(r,t);return r&&pr(r)&&qi(r)&&!Sa(r)?n:r||ry(e)||n}const my=async function(e){const t=this.getOffsetParent||Su,n=this.getDimensions,r=await n(e.floating);return{reference:hy(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function gy(e){return mt(e).direction==="rtl"}const yy={convertOffsetParentRelativeRectToViewportRelativeRect:oy,getDocumentElement:At,getClippingRect:fy,getOffsetParent:Su,getElementRects:my,getClientRects:ay,getDimensions:py,getScale:Yn,isElement:ht,isRTL:gy};function Cu(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function by(e,t){let n=null,r;const s=At(e);function i(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function o(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),i();const d=e.getBoundingClientRect(),{left:u,top:f,width:m,height:h}=d;if(a||t(),!m||!h)return;const g=bs(f),p=bs(s.clientWidth-(u+m)),y=bs(s.clientHeight-(f+h)),b=bs(u),x={rootMargin:-g+"px "+-p+"px "+-y+"px "+-b+"px",threshold:tt(0,on(1,c))||1};let _=!0;function C(k){const T=k[0].intersectionRatio;if(T!==c){if(!_)return o();T?o(!1,T):r=setTimeout(()=>{o(!1,1e-7)},1e3)}T===1&&!Cu(d,e.getBoundingClientRect())&&o(),_=!1}try{n=new IntersectionObserver(C,{...x,root:s.ownerDocument})}catch{n=new IntersectionObserver(C,x)}n.observe(e)}return o(!0),i}function vy(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:c=!1}=r,d=Ea(e),u=s||i?[...d?Fr(d):[],...t?Fr(t):[]]:[];u.forEach(b=>{s&&b.addEventListener("scroll",n,{passive:!0}),i&&b.addEventListener("resize",n)});const f=d&&a?by(d,n):null;let m=-1,h=null;o&&(h=new ResizeObserver(b=>{let[v]=b;v&&v.target===d&&h&&t&&(h.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var x;(x=h)==null||x.observe(t)})),n()}),d&&!c&&h.observe(d),t&&h.observe(t));let g,p=c?Dn(e):null;c&&y();function y(){const b=Dn(e);p&&!Cu(p,b)&&n(),p=b,g=requestAnimationFrame(y)}return n(),()=>{var b;u.forEach(v=>{s&&v.removeEventListener("scroll",n),i&&v.removeEventListener("resize",n)}),f==null||f(),(b=h)==null||b.disconnect(),h=null,c&&cancelAnimationFrame(g)}}const wy=Yg,_y=Qg,xy=qg,Sy=Jg,Cy=Kg,Kc=Gg,Ey=Xg,Ty=(e,t,n)=>{const r=new Map,s={platform:yy,...n},i={...s.platform,_c:r};return Wg(e,t,{...s,platform:i})};var Py=typeof document<"u",ky=function(){},Ns=Py?S.useLayoutEffect:ky;function zs(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(!zs(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)&&!zs(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function Eu(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Zc(e,t){const n=Eu(e);return Math.round(t*n)/n}function Ki(e){const t=w.useRef(e);return Ns(()=>{t.current=e}),t}function Oy(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:c,open:d}=e,[u,f]=w.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,h]=w.useState(r);zs(m,r)||h(r);const[g,p]=w.useState(null),[y,b]=w.useState(null),v=w.useCallback(N=>{N!==k.current&&(k.current=N,p(N))},[]),x=w.useCallback(N=>{N!==T.current&&(T.current=N,b(N))},[]),_=i||g,C=o||y,k=w.useRef(null),T=w.useRef(null),R=w.useRef(u),A=c!=null,O=Ki(c),D=Ki(s),L=Ki(d),B=w.useCallback(()=>{if(!k.current||!T.current)return;const N={placement:t,strategy:n,middleware:m};D.current&&(N.platform=D.current),Ty(k.current,T.current,N).then(M=>{const $={...M,isPositioned:L.current!==!1};U.current&&!zs(R.current,$)&&(R.current=$,Jr.flushSync(()=>{f($)}))})},[m,t,n,D,L]);Ns(()=>{d===!1&&R.current.isPositioned&&(R.current.isPositioned=!1,f(N=>({...N,isPositioned:!1})))},[d]);const U=w.useRef(!1);Ns(()=>(U.current=!0,()=>{U.current=!1}),[]),Ns(()=>{if(_&&(k.current=_),C&&(T.current=C),_&&C){if(O.current)return O.current(_,C,B);B()}},[_,C,B,O,A]);const z=w.useMemo(()=>({reference:k,floating:T,setReference:v,setFloating:x}),[v,x]),F=w.useMemo(()=>({reference:_,floating:C}),[_,C]),I=w.useMemo(()=>{const N={position:n,left:0,top:0};if(!F.floating)return N;const M=Zc(F.floating,u.x),$=Zc(F.floating,u.y);return a?{...N,transform:"translate("+M+"px, "+$+"px)",...Eu(F.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:M,top:$}},[n,a,F.floating,u.x,u.y]);return w.useMemo(()=>({...u,update:B,refs:z,elements:F,floatingStyles:I}),[u,B,z,F,I])}const Ay=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?Kc({element:r.current,padding:s}).fn(n):{}:r?Kc({element:r,padding:s}).fn(n):{}}}},Ry=(e,t)=>{const n=wy(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ny=(e,t)=>{const n=_y(e);return{name:n.name,fn:n.fn,options:[e,t]}},Dy=(e,t)=>({fn:Ey(e).fn,options:[e,t]}),Ly=(e,t)=>{const n=xy(e);return{name:n.name,fn:n.fn,options:[e,t]}},jy=(e,t)=>{const n=Sy(e);return{name:n.name,fn:n.fn,options:[e,t]}},My=(e,t)=>{const n=Cy(e);return{name:n.name,fn:n.fn,options:[e,t]}},Iy=(e,t)=>{const n=Ay(e);return{name:n.name,fn:n.fn,options:[e,t]}};var Fy="Arrow",Tu=w.forwardRef((e,t)=>{const{children:n,width:r=10,height:s=5,...i}=e;return l.jsx(ve.svg,{...i,ref:t,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:l.jsx("polygon",{points:"0,0 30,0 15,10"})})});Tu.displayName=Fy;var Uy=Tu;function By(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 c=i.borderBoxSize,d=Array.isArray(c)?c[0]:c;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 Ta="Popper",[Pu,ku]=_r(Ta),[$y,Ou]=Pu(Ta),Au=e=>{const{__scopePopper:t,children:n}=e,[r,s]=w.useState(null),[i,o]=w.useState(void 0);return l.jsx($y,{scope:t,anchor:r,onAnchorChange:s,placementState:i,setPlacementState:o,children:n})};Au.displayName=Ta;var Ru="PopperAnchor",Nu=w.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,i=Ou(Ru,n),o=w.useRef(null),a=i.onAnchorChange,c=w.useCallback(g=>{o.current=g,g&&a(g)},[a]),d=Pe(t,c),u=w.useRef(null);w.useEffect(()=>{if(!r)return;const g=u.current;u.current=r.current,g!==u.current&&a(u.current)});const f=i.placementState&&ka(i.placementState),m=f==null?void 0:f[0],h=f==null?void 0:f[1];return r?null:l.jsx(ve.div,{"data-radix-popper-side":m,"data-radix-popper-align":h,...s,ref:d})});Nu.displayName=Ru;var Pa="PopperContent",[Vy,Hy]=Pu(Pa),Du=w.forwardRef((e,t)=>{var ce,we,le,de,ne,je;const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:i="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:c=!0,collisionBoundary:d=[],collisionPadding:u=0,sticky:f="partial",hideWhenDetached:m=!1,updatePositionStrategy:h="optimized",onPlaced:g,...p}=e,y=Ou(Pa,n),[b,v]=w.useState(null),x=Pe(t,Re=>v(Re)),[_,C]=w.useState(null),k=By(_),T=(k==null?void 0:k.width)??0,R=(k==null?void 0:k.height)??0,A=r+(i!=="center"?"-"+i:""),O=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},D=Array.isArray(d)?d:[d],L=D.length>0,B={padding:O,boundary:D.filter(Wy),altBoundary:L},{refs:U,floatingStyles:z,placement:F,isPositioned:I,middlewareData:N}=Oy({strategy:"fixed",placement:A,whileElementsMounted:(...Re)=>vy(...Re,{animationFrame:h==="always"}),elements:{reference:y.anchor},middleware:[Ry({mainAxis:s+R,alignmentAxis:o}),c&&Ny({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?Dy():void 0,...B}),c&&Ly({...B}),jy({...B,apply:({elements:Re,rects:Oe,availableWidth:X,availableHeight:Te})=>{const{width:Fe,height:Qe}=Oe.reference,ct=Re.floating.style;ct.setProperty("--radix-popper-available-width",`${X}px`),ct.setProperty("--radix-popper-available-height",`${Te}px`),ct.setProperty("--radix-popper-anchor-width",`${Fe}px`),ct.setProperty("--radix-popper-anchor-height",`${Qe}px`)}}),_&&Iy({element:_,padding:a}),Gy({arrowWidth:T,arrowHeight:R}),m&&My({strategy:"referenceHidden",...B,boundary:L?B.boundary:void 0})]}),M=y.setPlacementState;Ie(()=>(M(F),()=>{M(void 0)}),[F,M]);const[$,j]=ka(F),se=Nn(g);Ie(()=>{I&&(se==null||se())},[I,se]);const re=(ce=N.arrow)==null?void 0:ce.x,ye=(we=N.arrow)==null?void 0:we.y,H=((le=N.arrow)==null?void 0:le.centerOffset)!==0,[Q,K]=w.useState();return Ie(()=>{b&&K(window.getComputedStyle(b).zIndex)},[b]),l.jsx("div",{ref:U.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:I?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Q,"--radix-popper-transform-origin":[(de=N.transformOrigin)==null?void 0:de.x,(ne=N.transformOrigin)==null?void 0:ne.y].join(" "),...((je=N.hide)==null?void 0:je.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:l.jsx(Vy,{scope:n,placedSide:$,placedAlign:j,onArrowChange:C,arrowX:re,arrowY:ye,shouldHideArrow:H,children:l.jsx(ve.div,{"data-side":$,"data-align":j,...p,ref:x,style:{...p.style,animation:I?void 0:"none"}})})})});Du.displayName=Pa;var Lu="PopperArrow",zy={top:"bottom",right:"left",bottom:"top",left:"right"},ju=w.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,i=Hy(Lu,r),o=zy[i.placedSide];return l.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:l.jsx(Uy,{...s,ref:n,style:{...s.style,display:"block"}})})});ju.displayName=Lu;function Wy(e){return e!==null}var Gy=e=>({name:"transformOrigin",options:e,fn(t){var y,b,v;const{placement:n,rects:r,middlewareData:s}=t,o=((y=s.arrow)==null?void 0:y.centerOffset)!==0,a=o?0:e.arrowWidth,c=o?0:e.arrowHeight,[d,u]=ka(n),f={start:"0%",center:"50%",end:"100%"}[u],m=(((b=s.arrow)==null?void 0:b.x)??0)+a/2,h=(((v=s.arrow)==null?void 0:v.y)??0)+c/2;let g="",p="";return d==="bottom"?(g=o?f:`${m}px`,p=`${-c}px`):d==="top"?(g=o?f:`${m}px`,p=`${r.floating.height+c}px`):d==="right"?(g=`${-c}px`,p=o?f:`${h}px`):d==="left"&&(g=`${r.floating.width+c}px`,p=o?f:`${h}px`),{data:{x:g,y:p}}}});function ka(e){const[t,n="center"]=e.split("-");return[t,n]}var qy=Au,Ky=Nu,Zy=Du,Yy=ju;function Qy(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 Mu=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"}),Xy="VisuallyHidden",Jy=w.forwardRef((e,t)=>l.jsx(ve.span,{...e,ref:t,style:{...Mu,...e.style}}));Jy.displayName=Xy;var eb=[" ","Enter","ArrowUp","ArrowDown"],tb=[" ","Enter"],Ln="Select",[gi,yi,nb]=pu(Ln),[Bn]=_r(Ln,[nb,ku]),bi=ku(),[rb,fn]=Bn(Ln),[sb,ib]=Bn(Ln),ob="SelectProvider";function Iu(e){const{__scopeSelect:t,children:n,open:r,defaultOpen:s,onOpenChange:i,value:o,defaultValue:a,onValueChange:c,dir:d,name:u,autoComplete:f,disabled:m,required:h,form:g,internal_do_not_use_render:p}=e,y=bi(t),[b,v]=w.useState(null),[x,_]=w.useState(null),[C,k]=w.useState(!1),T=hu(d),[R,A]=ur({prop:r,defaultProp:s??!1,onChange:i,caller:Ln}),[O,D]=ur({prop:o,defaultProp:a,onChange:c,caller:Ln}),L=w.useRef(null),B=b?!!g||!!b.closest("form"):!0,[U,z]=w.useState(new Set),F=nn(),I=Array.from(U).map(j=>j.props.value).join(";"),N=w.useCallback(j=>{z(se=>new Set(se).add(j))},[]),M=w.useCallback(j=>{z(se=>{const re=new Set(se);return re.delete(j),re})},[]),$={required:h,trigger:b,onTriggerChange:v,valueNode:x,onValueNodeChange:_,valueNodeHasChildren:C,onValueNodeHasChildrenChange:k,contentId:F,value:O,onValueChange:D,open:R,onOpenChange:A,dir:T,triggerPointerDownPosRef:L,disabled:m,name:u,autoComplete:f,form:g,nativeOptions:U,nativeSelectKey:I,isFormControl:B};return l.jsx(qy,{...y,children:l.jsx(rb,{scope:t,...$,children:l.jsx(gi.Provider,{scope:t,children:l.jsx(sb,{scope:t,onNativeOptionAdd:N,onNativeOptionRemove:M,children:_b(p)?p($):n})})})})}Iu.displayName=ob;var Fu=e=>{const{__scopeSelect:t,children:n,...r}=e;return l.jsx(Iu,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:s})=>l.jsxs(l.Fragment,{children:[n,s?l.jsx(of,{__scopeSelect:t}):null]})})};Fu.displayName=Ln;var Uu="SelectTrigger",Oa=w.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...s}=e,i=bi(n),o=fn(Uu,n),a=o.disabled||r,c=Pe(t,o.onTriggerChange),d=yi(n),u=w.useRef("touch"),[f,m,h]=af(p=>{const y=d().filter(x=>!x.disabled),b=y.find(x=>x.value===o.value),v=cf(y,p,b);v!==void 0&&o.onValueChange(v.value)}),g=p=>{a||(o.onOpenChange(!0),h()),p&&(o.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return l.jsx(Ky,{asChild:!0,...i,children:l.jsx(ve.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":vi(o.value)?"":void 0,...s,ref:c,onClick:Se(s.onClick,p=>{p.currentTarget.focus(),u.current!=="mouse"&&g(p)}),onPointerDown:Se(s.onPointerDown,p=>{u.current=p.pointerType;const y=p.target;y.hasPointerCapture(p.pointerId)&&y.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(g(p),p.preventDefault())}),onKeyDown:Se(s.onKeyDown,p=>{const y=f.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&m(p.key),!(y&&p.key===" ")&&eb.includes(p.key)&&(g(),p.preventDefault())})})})});Oa.displayName=Uu;var Bu="SelectValue",$u=w.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,children:i,placeholder:o="",...a}=e,c=fn(Bu,n),{onValueNodeHasChildrenChange:d}=c,u=i!==void 0,f=Pe(t,c.onValueNodeChange);Ie(()=>{d(u)},[d,u]);const m=vi(c.value);return l.jsx(ve.span,{...a,asChild:m?!1:a.asChild,ref:f,style:{pointerEvents:"none"},children:l.jsx(w.Fragment,{children:m?o:i},m?"placeholder":"value")})});$u.displayName=Bu;var ab="SelectIcon",Vu=w.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...s}=e;return l.jsx(ve.span,{"aria-hidden":!0,...s,ref:t,children:r||"▼"})});Vu.displayName=ab;var Hu="SelectPortal",[cb,lb]=Bn(Hu,{forceMount:void 0}),zu=e=>{const{__scopeSelect:t,forceMount:n,...r}=e;return l.jsx(cb,{scope:e.__scopeSelect,forceMount:n,children:l.jsx(fa,{asChild:!0,...r})})};zu.displayName=Hu;var cn="SelectContent",Aa=w.forwardRef((e,t)=>{const n=lb(cn,e.__scopeSelect),{forceMount:r=n.forceMount,...s}=e,i=fn(cn,e.__scopeSelect),[o,a]=w.useState();return Ie(()=>{a(new DocumentFragment)},[]),l.jsx(xr,{present:r||i.open,children:({present:c})=>c?l.jsx(qu,{...s,ref:t}):l.jsx(Wu,{...s,fragment:o})})});Aa.displayName=cn;var Wu=w.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,fragment:s}=e;return s?Jr.createPortal(l.jsx(Gu,{scope:n,children:l.jsx(gi.Slot,{scope:n,children:l.jsx("div",{ref:t,children:r})})}),s):null});Wu.displayName="SelectContentFragment";var dt=10,[Gu,pn]=Bn(cn),db="SelectContentImpl",ub=dr("SelectContent.RemoveScroll"),qu=w.forwardRef((e,t)=>{const{__scopeSelect:n}=e,{position:r="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:i,onPointerDownOutside:o,side:a,sideOffset:c,align:d,alignOffset:u,arrowPadding:f,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:p,avoidCollisions:y,...b}=e,v=fn(cn,n),[x,_]=w.useState(null),[C,k]=w.useState(null),T=Pe(t,K=>_(K)),[R,A]=w.useState(null),[O,D]=w.useState(null),L=yi(n),[B,U]=w.useState(!1),z=w.useRef(!1);w.useEffect(()=>{if(x)return Qd(x)},[x]),Vd();const F=w.useCallback(K=>{const[ce,...we]=L().map(ne=>ne.ref.current),[le]=we.slice(-1),de=document.activeElement;for(const ne of K)if(ne===de||(ne==null||ne.scrollIntoView({block:"nearest"}),ne===ce&&C&&(C.scrollTop=0),ne===le&&C&&(C.scrollTop=C.scrollHeight),ne==null||ne.focus(),document.activeElement!==de))return},[L,C]),I=w.useCallback(()=>F([R,x]),[F,R,x]);w.useEffect(()=>{B&&I()},[B,I]);const{onOpenChange:N,triggerPointerDownPosRef:M}=v;w.useEffect(()=>{if(x){let K={x:0,y:0};const ce=le=>{var de,ne;K={x:Math.abs(Math.round(le.pageX)-(((de=M.current)==null?void 0:de.x)??0)),y:Math.abs(Math.round(le.pageY)-(((ne=M.current)==null?void 0:ne.y)??0))}},we=le=>{K.x<=10&&K.y<=10?le.preventDefault():le.composedPath().includes(x)||N(!1),document.removeEventListener("pointermove",ce),M.current=null};return M.current!==null&&(document.addEventListener("pointermove",ce),document.addEventListener("pointerup",we,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ce),document.removeEventListener("pointerup",we,{capture:!0})}}},[x,N,M]),w.useEffect(()=>{const K=()=>N(!1);return window.addEventListener("blur",K),window.addEventListener("resize",K),()=>{window.removeEventListener("blur",K),window.removeEventListener("resize",K)}},[N]);const[$,j]=af(K=>{const ce=L().filter(de=>!de.disabled),we=ce.find(de=>de.ref.current===document.activeElement),le=cf(ce,K,we);le&&setTimeout(()=>{var de;return(de=le.ref.current)==null?void 0:de.focus()})}),se=w.useCallback((K,ce,we)=>{const le=!z.current&&!we;(v.value!==void 0&&v.value===ce||le)&&(A(K),le&&(z.current=!0))},[v.value]),re=w.useCallback(()=>x==null?void 0:x.focus(),[x]),ye=w.useCallback((K,ce,we)=>{const le=!z.current&&!we;(v.value!==void 0&&v.value===ce||le)&&D(K)},[v.value]),H=r==="popper"?xo:Ku,Q=H===xo?{side:a,sideOffset:c,align:d,alignOffset:u,arrowPadding:f,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:p,avoidCollisions:y}:{};return l.jsx(Gu,{scope:n,content:x,viewport:C,onViewportChange:k,itemRefCallback:se,selectedItem:R,onItemLeave:re,itemTextRefCallback:ye,focusSelectedItem:I,selectedItemText:O,position:r,isPositioned:B,searchRef:$,children:l.jsx(pa,{as:ub,allowPinchZoom:!0,children:l.jsx(ua,{asChild:!0,trapped:v.open,onMountAutoFocus:K=>{K.preventDefault()},onUnmountAutoFocus:Se(s,K=>{var ce;(ce=v.trigger)==null||ce.focus({preventScroll:!0}),K.preventDefault()}),children:l.jsx(da,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:K=>K.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:l.jsx(H,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:K=>K.preventDefault(),...b,...Q,onPlaced:()=>U(!0),ref:T,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:Se(b.onKeyDown,K=>{const ce=K.ctrlKey||K.altKey||K.metaKey;if(K.key==="Tab"&&K.preventDefault(),!ce&&K.key.length===1&&j(K.key),["ArrowUp","ArrowDown","Home","End"].includes(K.key)){let le=L().filter(de=>!de.disabled).map(de=>de.ref.current);if(["ArrowUp","End"].includes(K.key)&&(le=le.slice().reverse()),["ArrowUp","ArrowDown"].includes(K.key)){const de=K.target,ne=le.indexOf(de);le=le.slice(ne+1)}setTimeout(()=>F(le)),K.preventDefault()}})})})})})})});qu.displayName=db;var fb="SelectItemAlignedPosition",Ku=w.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...s}=e,i=fn(cn,n),o=pn(cn,n),[a,c]=w.useState(null),[d,u]=w.useState(null),f=Pe(t,T=>u(T)),m=yi(n),h=w.useRef(!1),g=w.useRef(!0),{viewport:p,selectedItem:y,selectedItemText:b,focusSelectedItem:v}=o,x=w.useCallback(()=>{if(i.trigger&&i.valueNode&&a&&d&&p&&y&&b){const T=i.trigger.getBoundingClientRect(),R=d.getBoundingClientRect(),A=i.valueNode.getBoundingClientRect(),O=b.getBoundingClientRect();if(i.dir!=="rtl"){const de=O.left-R.left,ne=A.left-de,je=T.left-ne,Re=T.width+je,Oe=Math.max(Re,R.width),X=window.innerWidth-dt,Te=Fc(ne,[dt,Math.max(dt,X-Oe)]);a.style.minWidth=Re+"px",a.style.left=Te+"px"}else{const de=R.right-O.right,ne=window.innerWidth-A.right-de,je=window.innerWidth-T.right-ne,Re=T.width+je,Oe=Math.max(Re,R.width),X=window.innerWidth-dt,Te=Fc(ne,[dt,Math.max(dt,X-Oe)]);a.style.minWidth=Re+"px",a.style.right=Te+"px"}const D=m(),L=window.innerHeight-dt*2,B=p.scrollHeight,U=window.getComputedStyle(d),z=parseInt(U.borderTopWidth,10),F=parseInt(U.paddingTop,10),I=parseInt(U.borderBottomWidth,10),N=parseInt(U.paddingBottom,10),M=z+F+B+N+I,$=Math.min(y.offsetHeight*5,M),j=window.getComputedStyle(p),se=parseInt(j.paddingTop,10),re=parseInt(j.paddingBottom,10),ye=T.top+T.height/2-dt,H=L-ye,Q=y.offsetHeight/2,K=y.offsetTop+Q,ce=z+F+K,we=M-ce;if(ce<=ye){const de=D.length>0&&y===D[D.length-1].ref.current;a.style.bottom="0px";const ne=d.clientHeight-p.offsetTop-p.offsetHeight,je=Math.max(H,Q+(de?re:0)+ne+I),Re=ce+je;a.style.height=Re+"px"}else{const de=D.length>0&&y===D[0].ref.current;a.style.top="0px";const je=Math.max(ye,z+p.offsetTop+(de?se:0)+Q)+we;a.style.height=je+"px",p.scrollTop=ce-ye+p.offsetTop}a.style.margin=`${dt}px 0`,a.style.minHeight=$+"px",a.style.maxHeight=L+"px",r==null||r(),requestAnimationFrame(()=>h.current=!0)}},[m,i.trigger,i.valueNode,a,d,p,y,b,i.dir,r]);Ie(()=>x(),[x]);const[_,C]=w.useState();Ie(()=>{d&&C(window.getComputedStyle(d).zIndex)},[d]);const k=w.useCallback(T=>{T&&g.current===!0&&(x(),v==null||v(),g.current=!1)},[x,v]);return l.jsx(hb,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:h,onScrollButtonChange:k,children:l.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:_},children:l.jsx(ve.div,{...s,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});Ku.displayName=fb;var pb="SelectPopperPosition",xo=w.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=dt,...i}=e,o=bi(n);return l.jsx(Zy,{...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)"}})});xo.displayName=pb;var[hb,Ra]=Bn(cn,{}),So="SelectViewport",Zu=w.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...s}=e,i=pn(So,n),o=Ra(So,n),a=Pe(t,i.onViewportChange),c=w.useRef(0);return l.jsxs(l.Fragment,{children:[l.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}),l.jsx(gi.Slot,{scope:n,children:l.jsx(ve.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:Se(s.onScroll,d=>{const u=d.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:m}=o;if(m!=null&&m.current&&f){const h=Math.abs(c.current-u.scrollTop);if(h>0){const g=window.innerHeight-dt*2,p=parseFloat(f.style.minHeight),y=parseFloat(f.style.height),b=Math.max(p,y);if(b<g){const v=b+h,x=Math.min(g,v),_=v-x;f.style.height=x+"px",f.style.bottom==="0px"&&(u.scrollTop=_>0?_:0,f.style.justifyContent="flex-end")}}}c.current=u.scrollTop})})})]})});Zu.displayName=So;var Yu="SelectGroup",[mb,gb]=Bn(Yu),yb=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=nn();return l.jsx(mb,{scope:n,id:s,children:l.jsx(ve.div,{role:"group","aria-labelledby":s,...r,ref:t})})});yb.displayName=Yu;var Qu="SelectLabel",Na=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=gb(Qu,n);return l.jsx(ve.div,{id:s.id,...r,ref:t})});Na.displayName=Qu;var Ws="SelectItem",[bb,Xu]=Bn(Ws),Da=w.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:s=!1,textValue:i,...o}=e,a=fn(Ws,n),c=pn(Ws,n),d=a.value===r,[u,f]=w.useState(i??""),[m,h]=w.useState(!1),g=Pe(t,v=>{var x;return(x=c.itemRefCallback)==null?void 0:x.call(c,v,r,s)}),p=nn(),y=w.useRef("touch"),b=()=>{s||(a.onValueChange(r),a.onOpenChange(!1))};return l.jsx(bb,{scope:n,value:r,disabled:s,textId:p,isSelected:d,onItemTextChange:w.useCallback(v=>{f(x=>x||((v==null?void 0:v.textContent)??"").trim())},[]),children:l.jsx(gi.ItemSlot,{scope:n,value:r,disabled:s,textValue:u,children:l.jsx(ve.div,{role:"option","aria-labelledby":p,"data-highlighted":m?"":void 0,"aria-selected":d&&m,"data-state":d?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...o,ref:g,onFocus:Se(o.onFocus,()=>h(!0)),onBlur:Se(o.onBlur,()=>h(!1)),onClick:Se(o.onClick,()=>{y.current!=="mouse"&&b()}),onPointerUp:Se(o.onPointerUp,()=>{y.current==="mouse"&&b()}),onPointerDown:Se(o.onPointerDown,v=>{y.current=v.pointerType}),onPointerMove:Se(o.onPointerMove,v=>{var x;y.current=v.pointerType,s?(x=c.onItemLeave)==null||x.call(c):y.current==="mouse"&&v.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Se(o.onPointerLeave,v=>{var x;v.currentTarget===document.activeElement&&((x=c.onItemLeave)==null||x.call(c))}),onKeyDown:Se(o.onKeyDown,v=>{var _;((_=c.searchRef)==null?void 0:_.current)!==""&&v.key===" "||(tb.includes(v.key)&&b(),v.key===" "&&v.preventDefault())})})})})});Da.displayName=Ws;var Lr="SelectItemText",Ju=w.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,...i}=e,o=fn(Lr,n),a=pn(Lr,n),c=Xu(Lr,n),d=ib(Lr,n),[u,f]=w.useState(null),m=Pe(t,b=>f(b),c.onItemTextChange,b=>{var v;return(v=a.itemTextRefCallback)==null?void 0:v.call(a,b,c.value,c.disabled)}),h=u==null?void 0:u.textContent,g=w.useMemo(()=>l.jsx("option",{value:c.value,disabled:c.disabled,children:h},c.value),[c.disabled,c.value,h]),{onNativeOptionAdd:p,onNativeOptionRemove:y}=d;return Ie(()=>(p(g),()=>y(g)),[p,y,g]),l.jsxs(l.Fragment,{children:[l.jsx(ve.span,{id:c.textId,...i,ref:m}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!vi(o.value)?Jr.createPortal(i.children,o.valueNode):null]})});Ju.displayName=Lr;var ef="SelectItemIndicator",tf=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return Xu(ef,n).isSelected?l.jsx(ve.span,{"aria-hidden":!0,...r,ref:t}):null});tf.displayName=ef;var Co="SelectScrollUpButton",La=w.forwardRef((e,t)=>{const n=pn(Co,e.__scopeSelect),r=Ra(Co,e.__scopeSelect),[s,i]=w.useState(!1),o=Pe(t,r.onScrollButtonChange);return Ie(()=>{if(n.viewport&&n.isPositioned){let a=function(){const d=c.scrollTop>0;i(d)};const c=n.viewport;return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),s?l.jsx(nf,{...e,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=n;a&&c&&(a.scrollTop=a.scrollTop-c.offsetHeight)}}):null});La.displayName=Co;var Eo="SelectScrollDownButton",ja=w.forwardRef((e,t)=>{const n=pn(Eo,e.__scopeSelect),r=Ra(Eo,e.__scopeSelect),[s,i]=w.useState(!1),o=Pe(t,r.onScrollButtonChange);return Ie(()=>{if(n.viewport&&n.isPositioned){let a=function(){const d=c.scrollHeight-c.clientHeight,u=Math.ceil(c.scrollTop)<d;i(u)};const c=n.viewport;return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),s?l.jsx(nf,{...e,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=n;a&&c&&(a.scrollTop=a.scrollTop+c.offsetHeight)}}):null});ja.displayName=Eo;var nf=w.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...s}=e,i=pn("SelectScrollButton",n),o=w.useRef(null),a=yi(n),c=w.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return w.useEffect(()=>()=>c(),[c]),Ie(()=>{var u;const d=a().find(f=>f.ref.current===document.activeElement);(u=d==null?void 0:d.ref.current)==null||u.scrollIntoView({block:"nearest"})},[a]),l.jsx(ve.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:Se(s.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:Se(s.onPointerMove,()=>{var d;(d=i.onItemLeave)==null||d.call(i),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:Se(s.onPointerLeave,()=>{c()})})}),vb="SelectSeparator",Ma=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return l.jsx(ve.div,{"aria-hidden":!0,...r,ref:t})});Ma.displayName=vb;var rf="SelectArrow",wb=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=bi(n);return pn(rf,n).position==="popper"?l.jsx(Yy,{...s,...r,ref:t}):null});wb.displayName=rf;var sf="SelectBubbleInput",of=w.forwardRef(({__scopeSelect:e,...t},n)=>{const r=fn(sf,e),{value:s,onValueChange:i,required:o,disabled:a,name:c,autoComplete:d,form:u}=r,{nativeOptions:f,nativeSelectKey:m}=r,h=w.useRef(null),g=Pe(n,h),p=s??"",y=Qy(p),b=Array.from(f).some(v=>(v.props.value??"")==="");return w.useEffect(()=>{const v=h.current;if(!v)return;const x=window.HTMLSelectElement.prototype,C=Object.getOwnPropertyDescriptor(x,"value").set;if(y!==p&&C){const k=new Event("change",{bubbles:!0});C.call(v,p),v.dispatchEvent(k)}},[y,p]),l.jsxs(ve.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:d,disabled:a,form:u,onChange:v=>i(v.target.value),...t,style:{...Mu,...t.style},ref:g,defaultValue:p,children:[vi(s)&&!b?l.jsx("option",{value:""}):null,Array.from(f)]},m)});of.displayName=sf;function _b(e){return typeof e=="function"}function vi(e){return e===""||e===void 0}function af(e){const t=Nn(e),n=w.useRef(""),r=w.useRef(0),s=w.useCallback(o=>{const a=n.current+o;t(a),(function c(d){n.current=d,window.clearTimeout(r.current),d!==""&&(r.current=window.setTimeout(()=>c(""),1e3))})(a)},[t]),i=w.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return w.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,s,i]}function cf(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=xb(e,Math.max(i,0));s.length===1&&(o=o.filter(d=>d!==n));const c=o.find(d=>d.textValue.toLowerCase().startsWith(s.toLowerCase()));return c!==n?c:void 0}function xb(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Ia(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 Sb=["color"],Cb=S.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,s=Ia(e,Sb);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"}))}),Eb=["color"],Fa=S.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,s=Ia(e,Eb);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"}))}),Tb=["color"],Pb=S.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,s=Ia(e,Tb);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"}))});const Gs=Fu,qs=$u,Ur=w.forwardRef(({className:e,children:t,...n},r)=>l.jsxs(Oa,{ref:r,className:De("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,l.jsx(Vu,{asChild:!0,children:l.jsx(Fa,{className:"h-4 w-4 opacity-50"})})]}));Ur.displayName=Oa.displayName;const lf=w.forwardRef(({className:e,...t},n)=>l.jsx(La,{ref:n,className:De("flex cursor-default items-center justify-center py-1",e),...t,children:l.jsx(Pb,{className:"h-4 w-4"})}));lf.displayName=La.displayName;const df=w.forwardRef(({className:e,...t},n)=>l.jsx(ja,{ref:n,className:De("flex cursor-default items-center justify-center py-1",e),...t,children:l.jsx(Fa,{className:"h-4 w-4"})}));df.displayName=ja.displayName;const Br=w.forwardRef(({className:e,children:t,position:n="popper",...r},s)=>l.jsx(zu,{children:l.jsxs(Aa,{ref:s,className:De("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:[l.jsx(lf,{}),l.jsx(Zu,{className:De("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),l.jsx(df,{})]})}));Br.displayName=Aa.displayName;const kb=w.forwardRef(({className:e,...t},n)=>l.jsx(Na,{ref:n,className:De("px-2 py-1.5 text-sm font-semibold",e),...t}));kb.displayName=Na.displayName;const $r=w.forwardRef(({className:e,children:t,...n},r)=>l.jsxs(Da,{ref:r,className:De("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:[l.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:l.jsx(tf,{children:l.jsx(Cb,{className:"h-4 w-4"})})}),l.jsx(Ju,{children:t})]}));$r.displayName=Da.displayName;const Ob=w.forwardRef(({className:e,...t},n)=>l.jsx(Ma,{ref:n,className:De("-mx-1 my-1 h-px bg-muted",e),...t}));Ob.displayName=Ma.displayName;function uf({open:e,isAccountsLoading:t,accountOptions:n,onConfirm:r}){var d;const[s,i]=S.useState(""),o=s||((d=n[0])==null?void 0:d.login)||"",a=!t&&n.length>0&&o!=="",c=!t&&n.length===0;return l.jsx(Rg,{open:e,children:l.jsxs(cu,{className:"web-trading-widget-account-modal",onPointerDownOutside:u=>u.preventDefault(),onEscapeKeyDown:u=>u.preventDefault(),children:[l.jsxs(lu,{children:[l.jsx(uu,{children:"Select trading account"}),l.jsx(fu,{children:"Choose an account to continue trading on the chart."})]}),t?l.jsx("p",{className:"web-trading-widget-account-modal__loading",children:"Loading accounts…"}):n.length===0?l.jsx("p",{className:"web-trading-widget-account-modal__error",children:"No trading accounts available."}):l.jsxs(Gs,{value:o,onValueChange:i,children:[l.jsx(Ur,{className:"web-trading-widget-account-modal__select",children:l.jsx(qs,{placeholder:"Select account"})}),l.jsx(Br,{children:n.map(u=>l.jsxs($r,{value:u.login,children:[u.label," (",u.balance.toFixed(2)," ",u.currency,")"]},u.login))})]}),l.jsx(du,{children:c?l.jsxs(l.Fragment,{children:[l.jsx("div",{children:l.jsx(ot,{type:"button",variant:"outline",children:"Just back"})}),l.jsx("div",{children:l.jsx(ot,{type:"button",children:"Create account"})})]}):l.jsx(ot,{type:"button",disabled:!a,onClick:()=>r(o),children:"Continue"})})]})})}var Ab={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 Rb=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),yt=(e,t)=>{const n=S.forwardRef(({color:r="currentColor",size:s=24,strokeWidth:i=2,absoluteStrokeWidth:o,children:a,...c},d)=>S.createElement("svg",{ref:d,...Ab,width:s,height:s,stroke:r,strokeWidth:o?Number(i)*24/Number(s):i,className:`lucide lucide-${Rb(e)}`,...c},[...t.map(([u,f])=>S.createElement(u,f)),...(Array.isArray(a)?a:[a])||[]]));return n.displayName=`${e}`,n},Ks=yt("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),Nb=yt("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),Db=yt("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),To=yt("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),ff=yt("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"}]]),pf=yt("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"}]]),Lb=yt("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"}]]),jb=yt("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"}]]),Mb=yt("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]),Ib=yt("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),hn=yt("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function Fb(e){const t=Math.round(Math.log10(e));return Number.isFinite(t)&&t>0?t:5}function Ua(e){const t=Ye(e).toUpperCase();if(t)return un.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 Ub(e){const t=Ua(e);return t!=null&&t.pricescale?Fb(t.pricescale):5}function hf(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=Ye(e).toUpperCase();return n.includes("XAU")||n.includes("GOLD")?2:n.includes("JPY")?3:5}function Bb(e){const t=Ua(e);return(t==null?void 0:t.type)==="commodity"?100:1e5}const Ba="USD";function ts(e){return Ye(e).toUpperCase()}function wi(e){const t=ts(e);return t.length>=6?t.slice(3):Ba}function $a(e){if(e!==Ba&&e==="JPY")return"USDJPY"}function $b(e,t,n,r,s){const i=wi(e),o=$a(i);if(!o)return;if(ts(e)===o){const d=t==="buy"?n:r;return d>0?d:void 0}const a=s[o];if(!a)return;const c=(a.bid+a.ask)/2;return c>0?c:void 0}function Vb(e,t,n,r,s,i,o={}){const a=e==="buy"?n:r;let d=(e==="buy"?a-t:t-a)*s*Bb(i);const u=wi(i),f=$b(i,e,n,r,o);if(f!==void 0)d/=f;else if(u!==Ba)return null;return Math.round(d*100)/100}function Hb(e){const t=new Set;for(const n of e){const r=$a(wi(n));r&&ts(n)!==r&&t.add(r)}return[...t]}function zb(e,t){const n=ts(e);if(n===t)return!0;const r=$a(wi(e));return r===t&&n!==r}function Wb(e,t,n,r,s){if(!zb(e.symbol,t))return e;const i=ts(e.symbol)===t,o=i?n:e.marketBid??e.currentPrice,a=i?r:e.marketAsk??e.currentPrice,c=e.type==="buy"?o:a,d=Vb(e.type,e.openPrice,o,a,e.volumeLots,e.symbol,s);return{...e,currentPrice:c,marketBid:o,marketAsk:a,profit:d??e.profit}}function Ye(e){const t=e.trim();return t?t.replace(/m$/i,""):""}function _i(e){return Ye(e)||"—"}const Ke={BUY:0,SELL:1,BUY_LIMIT:2,SELL_LIMIT:3,BUY_STOP:4,SELL_STOP:5,BUY_STOP_LIMIT:6,SELL_STOP_LIMIT:7},Zs=[{mode:"market",label:"Market Execution",orderType:null,isMarket:!0},{mode:"buy_limit",label:"Buy Limit",orderType:Ke.BUY_LIMIT,isMarket:!1},{mode:"sell_limit",label:"Sell Limit",orderType:Ke.SELL_LIMIT,isMarket:!1},{mode:"buy_stop",label:"Buy Stop",orderType:Ke.BUY_STOP,isMarket:!1},{mode:"sell_stop",label:"Sell Stop",orderType:Ke.SELL_STOP,isMarket:!1},{mode:"buy_stop_limit",label:"Buy Stop Limit",orderType:Ke.BUY_STOP_LIMIT,isMarket:!1},{mode:"sell_stop_limit",label:"Sell Stop Limit",orderType:Ke.SELL_STOP_LIMIT,isMarket:!1}];function xi(e){return Zs.find(t=>t.mode===e)??Zs[0]}function Si(e){return xi(e).isMarket}function Po(e,t){const n=xi(e);return n.orderType!==null?n.orderType:t==="buy"?Ke.BUY:Ke.SELL}function Ys(e){return e%2===1?"sell":"buy"}function Va(e){return e>=Ke.BUY_LIMIT&&e<=Ke.SELL_STOP_LIMIT}function Ha(e){return e===Ke.BUY_STOP_LIMIT||e===Ke.SELL_STOP_LIMIT}function mf(e){return e==="buy_stop_limit"||e==="sell_stop_limit"}const ft={GTC:0,TODAY:1,SPECIFIED:2,SPECIFIED_DAY:3},gf=[{value:ft.GTC,label:"GTC"},{value:ft.TODAY,label:"Today"},{value:ft.SPECIFIED,label:"Specified"},{value:ft.SPECIFIED_DAY,label:"Specified Day"}];function za(e){return e===ft.SPECIFIED}function Wa(e){return e===ft.SPECIFIED_DAY}function Gb(e){return e.map(t=>({login:t.login,label:t.label,balance:t.tradeStat.balance,currency:t.currency}))}function qb(e,t){var n;return((n=e[0])==null?void 0:n.login)??""}function Ga(e,t=un){return t.find(n=>n.ticker===e)}function Kb(e,t=un){var s;const n=Ye(e).toUpperCase();if(!n)return null;const r=t.find(i=>{var o;return Ye(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=Ua(e))==null?void 0:s.ticker)??null}function yf(e,t=un){const n=Ga(e,t),r=(n==null?void 0:n.resolve_symbol)??e.replace(/_/g,"");return Ye(r).toUpperCase()}function Ci(e,t=un){const n=Ga(e,t);return n!=null&&n.resolve_symbol?n.resolve_symbol:e.replace(/_/g,"")}function Ut(e){const t=Math.round(Math.log10(e));return String(Number.isFinite(t)&&t>0?t:5)}function Bt(e,t=un){const n=Ga(e,t);return(n==null?void 0:n.pricescale)??1e5}function Ce(e,t){return e.toFixed(t)}function Er(e){return 1/10**e}function bf(e,t){return e===null||t===null?null:(e+t)/2}function pt(e){const t=e.trim();if(!t)return;const n=Number(t);if(!(!Number.isFinite(n)||n<=0))return n}function vf(e,t,n){if(za(e)){if(!t.trim())return;const r=Date.parse(t);return Number.isFinite(r)?Math.floor(r/1e3):void 0}if(Wa(e)){if(!n.trim())return;const r=Date.parse(`${n}T23:59:59`);return Number.isFinite(r)?Math.floor(r/1e3):void 0}}function Ei(e,t,n){return e===ft.GTC||e===ft.TODAY?!0:vf(e,t,n)!==void 0}const Zb={},Yc=e=>{let t;const n=new Set,r=(u,f)=>{const m=typeof u=="function"?u(t):u;if(!Object.is(m,t)){const h=t;t=f??(typeof m!="object"||m===null)?m:Object.assign({},t,m),n.forEach(g=>g(t,h))}},s=()=>t,c={setState:r,getState:s,getInitialState:()=>d,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(Zb?"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,c);return c},Yb=e=>e?Yc(e):Yc;function Qb(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var vs={exports:{}},Zi={},ws={exports:{}},Yi={};/**
41
+ `)},wg=0,Vn=[];function _g(e){var t=w.useRef([]),n=w.useRef([0,0]),r=w.useRef(),s=w.useState(wg++)[0],i=w.useState(Zd)[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 h=Vm([e.lockRef.current],(e.shards||[]).map(Uc),!0).filter(Boolean);return h.forEach(function(y){return y.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),h.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var a=w.useCallback(function(h,y){if("touches"in h&&h.touches.length===2||h.type==="wheel"&&h.ctrlKey)return!o.current.allowPinchZoom;var b=gs(h),v=n.current,x="deltaX"in h?h.deltaX:v[0]-b[0],_="deltaY"in h?h.deltaY:v[1]-b[1],C,k=h.target,T=Math.abs(x)>Math.abs(_)?"h":"v";if("touches"in h&&T==="h"&&k.type==="range")return!1;var A=window.getSelection(),N=A&&A.anchorNode,O=N?N===k||N.contains(k):!1;if(O)return!1;var L=Mc(T,k);if(!L)return!0;if(L?C=T:(C=T==="v"?"h":"v",L=Mc(T,k)),!L)return!1;if(!r.current&&"changedTouches"in h&&(x||_)&&(r.current=C),!C)return!0;var R=r.current||C;return yg(R,y,h,R==="h"?x:_)},[]),c=w.useCallback(function(h){var y=h;if(!(!Vn.length||Vn[Vn.length-1]!==i)){var b="deltaY"in y?Ic(y):gs(y),v=t.current.filter(function(C){return C.name===y.type&&(C.target===y.target||y.target===C.shadowParent)&&bg(C.delta,b)})[0];if(v&&v.should){y.cancelable&&y.preventDefault();return}if(!v){var x=(o.current.shards||[]).map(Uc).filter(Boolean).filter(function(C){return C.contains(y.target)}),_=x.length>0?a(y,x[0]):!o.current.noIsolation;_&&y.cancelable&&y.preventDefault()}}},[]),d=w.useCallback(function(h,y,b,v){var x={name:h,delta:y,target:b,should:v,shadowParent:xg(b)};t.current.push(x),setTimeout(function(){t.current=t.current.filter(function(_){return _!==x})},1)},[]),u=w.useCallback(function(h){n.current=gs(h),r.current=void 0},[]),f=w.useCallback(function(h){d(h.type,Ic(h),h.target,a(h,e.lockRef.current))},[]),m=w.useCallback(function(h){d(h.type,gs(h),h.target,a(h,e.lockRef.current))},[]);w.useEffect(function(){return Vn.push(i),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:m}),document.addEventListener("wheel",c,$n),document.addEventListener("touchmove",c,$n),document.addEventListener("touchstart",u,$n),function(){Vn=Vn.filter(function(h){return h!==i}),document.removeEventListener("wheel",c,$n),document.removeEventListener("touchmove",c,$n),document.removeEventListener("touchstart",u,$n)}},[]);var p=e.removeScrollBar,g=e.inert;return w.createElement(w.Fragment,null,g?w.createElement(i,{styles:vg(s)}):null,p?w.createElement(dg,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function xg(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Sg=Qm(qd,_g);var pa=w.forwardRef(function(e,t){return w.createElement(fi,Tt({},e,{ref:t,sideCar:Sg}))});pa.classNames=fi.classNames;var Cg=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Hn=new WeakMap,ys=new WeakMap,bs={},Gi=0,Jd=function(e){return e&&(e.host||Jd(e.parentNode))},Eg=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Jd(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})},Tg=function(e,t,n,r){var s=Eg(t,Array.isArray(e)?e:[e]);bs[n]||(bs[n]=new WeakMap);var i=bs[n],o=[],a=new Set,c=new Set(s),d=function(f){!f||a.has(f)||(a.add(f),d(f.parentNode))};s.forEach(d);var u=function(f){!f||c.has(f)||Array.prototype.forEach.call(f.children,function(m){if(a.has(m))u(m);else try{var p=m.getAttribute(r),g=p!==null&&p!=="false",h=(Hn.get(m)||0)+1,y=(i.get(m)||0)+1;Hn.set(m,h),i.set(m,y),o.push(m),h===1&&g&&ys.set(m,!0),y===1&&m.setAttribute(n,"true"),g||m.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",m,b)}})};return u(t),a.clear(),Gi++,function(){o.forEach(function(f){var m=Hn.get(f)-1,p=i.get(f)-1;Hn.set(f,m),i.set(f,p),m||(ys.has(f)||f.removeAttribute(r),ys.delete(f)),p||f.removeAttribute(n)}),Gi--,Gi||(Hn=new WeakMap,Hn=new WeakMap,ys=new WeakMap,bs={})}},eu=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=Cg(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),Tg(r,s,n,"aria-hidden")):function(){return null}},hi="Dialog",[tu]=_r(hi),[Pg,gt]=tu(hi),nu=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:o=!0}=e,a=w.useRef(null),c=w.useRef(null),[d,u]=ur({prop:r,defaultProp:s??!1,onChange:i,caller:hi});return l.jsx(Pg,{scope:t,triggerRef:a,contentRef:c,contentId:rn(),titleId:rn(),descriptionId:rn(),open:d,onOpenChange:u,onOpenToggle:w.useCallback(()=>u(f=>!f),[u]),modal:o,children:n})};nu.displayName=hi;var ru="DialogTrigger",kg=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=gt(ru,n),i=Pe(t,s.triggerRef);return l.jsx(we.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":wa(s.open),...r,ref:i,onClick:Se(e.onClick,s.onOpenToggle)})});kg.displayName=ru;var ma="DialogPortal",[Og,su]=tu(ma,{forceMount:void 0}),iu=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:s}=e,i=gt(ma,t);return l.jsx(Og,{scope:t,forceMount:n,children:w.Children.map(r,o=>l.jsx(xr,{present:n||i.open,children:l.jsx(ha,{asChild:!0,container:s,children:o})}))})};iu.displayName=ma;var Vs="DialogOverlay",ga=w.forwardRef((e,t)=>{const n=su(Vs,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,i=gt(Vs,e.__scopeDialog);return i.modal?l.jsx(xr,{present:r||i.open,children:l.jsx(Ng,{...s,ref:t})}):null});ga.displayName=Vs;var Ag=dr("DialogOverlay.RemoveScroll"),Ng=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=gt(Vs,n),i=Pm(),o=Pe(t,i);return l.jsx(pa,{as:Ag,allowPinchZoom:!0,shards:[s.contentRef],children:l.jsx(we.div,{"data-state":wa(s.open),...r,ref:o,style:{pointerEvents:"auto",...r.style}})})}),fr="DialogContent",ya=w.forwardRef((e,t)=>{const n=su(fr,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,i=gt(fr,e.__scopeDialog);return l.jsx(xr,{present:r||i.open,children:i.modal?l.jsx(Rg,{...s,ref:t}):l.jsx(Dg,{...s,ref:t})})});ya.displayName=fr;var Rg=w.forwardRef((e,t)=>{const n=gt(fr,e.__scopeDialog),r=w.useRef(null),s=Pe(t,n.contentRef,r);return w.useEffect(()=>{const i=r.current;if(i)return eu(i)},[]),l.jsx(ou,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:Se(e.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:Se(e.onPointerDownOutside,i=>{const o=i.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&i.preventDefault()}),onFocusOutside:Se(e.onFocusOutside,i=>i.preventDefault())})}),Dg=w.forwardRef((e,t)=>{const n=gt(fr,e.__scopeDialog),r=w.useRef(!1),s=w.useRef(!1);return l.jsx(ou,{...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 c,d;(c=e.onInteractOutside)==null||c.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()}})}),ou=w.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,...o}=e,a=gt(fr,n);return Wd(),l.jsx(l.Fragment,{children:l.jsx(fa,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:l.jsx(ua,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":wa(a.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>a.onOpenChange(!1)})})})}),au="DialogTitle",ba=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=gt(au,n);return l.jsx(we.h2,{id:s.titleId,...r,ref:t})});ba.displayName=au;var cu="DialogDescription",va=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=gt(cu,n);return l.jsx(we.p,{id:s.descriptionId,...r,ref:t})});va.displayName=cu;var lu="DialogClose",Lg=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=gt(lu,n);return l.jsx(we.button,{type:"button",...r,ref:t,onClick:Se(e.onClick,()=>s.onOpenChange(!1))})});Lg.displayName=lu;function wa(e){return e?"open":"closed"}const jg=nu,Mg=iu,du=w.forwardRef(({className:e,...t},n)=>l.jsx(ga,{ref:n,className:De("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}));du.displayName=ga.displayName;const uu=w.forwardRef(({className:e,overlayClass:t,children:n,...r},s)=>l.jsxs(Mg,{children:[l.jsx(du,{className:t}),l.jsx(ya,{ref:s,className:De("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})]}));uu.displayName=ya.displayName;const fu=({className:e,...t})=>l.jsx("div",{className:De("flex flex-col space-y-1.5 border-b text-center sm:text-left",e),...t});fu.displayName="DialogHeader";const hu=({className:e,...t})=>l.jsx("div",{className:De("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});hu.displayName="DialogFooter";const pu=w.forwardRef(({className:e,...t},n)=>l.jsx(ba,{ref:n,className:De("text-lg font-semibold leading-none tracking-tight",e),...t}));pu.displayName=ba.displayName;const mu=w.forwardRef(({className:e,...t},n)=>l.jsx(va,{ref:n,className:De("text-sm text-muted-foreground",e),...t}));mu.displayName=va.displayName;function Fc(e,[t,n]){return Math.min(n,Math.max(t,e))}function gu(e){const t=e+"CollectionProvider",[n,r]=_r(t),[s,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=h=>{const{scope:y,children:b}=h,v=w.useRef(null),x=w.useRef(new Map).current;return l.jsx(s,{scope:y,itemMap:x,collectionRef:v,children:b})};o.displayName=t;const a=e+"CollectionSlot",c=dr(a),d=w.forwardRef((h,y)=>{const{scope:b,children:v}=h,x=i(a,b),_=Pe(y,x.collectionRef);return l.jsx(c,{ref:_,children:v})});d.displayName=a;const u=e+"CollectionItemSlot",f="data-radix-collection-item",m=dr(u),p=w.forwardRef((h,y)=>{const{scope:b,children:v,...x}=h,_=w.useRef(null),C=Pe(y,_),k=i(u,b);return w.useEffect(()=>(k.itemMap.set(_,{ref:_,...x}),()=>void k.itemMap.delete(_))),l.jsx(m,{[f]:"",ref:C,children:v})});p.displayName=u;function g(h){const y=i(e+"CollectionConsumer",h);return w.useCallback(()=>{const v=y.collectionRef.current;if(!v)return[];const x=Array.from(v.querySelectorAll(`[${f}]`));return Array.from(y.itemMap.values()).sort((k,T)=>x.indexOf(k.ref.current)-x.indexOf(T.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:o,Slot:d,ItemSlot:p},g,r]}var Ig=w.createContext(void 0);function yu(e){const t=w.useContext(Ig);return e||t||"ltr"}const Ug=["top","right","bottom","left"],an=Math.min,tt=Math.max,Hs=Math.round,vs=Math.floor,kt=e=>({x:e,y:e}),Fg={left:"right",right:"left",bottom:"top",top:"bottom"};function wo(e,t,n){return tt(e,an(t,n))}function Mt(e,t){return typeof e=="function"?e(t):e}function It(e){return e.split("-")[0]}function Sr(e){return e.split("-")[1]}function _a(e){return e==="x"?"y":"x"}function xa(e){return e==="y"?"height":"width"}function Pt(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Sa(e){return _a(Pt(e))}function Bg(e,t,n){n===void 0&&(n=!1);const r=Sr(e),s=Sa(e),i=xa(s);let o=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(o=zs(o)),[o,zs(o)]}function $g(e){const t=zs(e);return[_o(e),t,_o(t)]}function _o(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Bc=["left","right"],$c=["right","left"],Vg=["top","bottom"],Hg=["bottom","top"];function zg(e,t,n){switch(e){case"top":case"bottom":return n?t?$c:Bc:t?Bc:$c;case"left":case"right":return t?Vg:Hg;default:return[]}}function Wg(e,t,n,r){const s=Sr(e);let i=zg(It(e),n==="start",r);return s&&(i=i.map(o=>o+"-"+s),t&&(i=i.concat(i.map(_o)))),i}function zs(e){const t=It(e);return Fg[t]+e.slice(t.length)}function Gg(e){return{top:0,right:0,bottom:0,left:0,...e}}function bu(e){return typeof e!="number"?Gg(e):{top:e,right:e,bottom:e,left:e}}function Ws(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 Vc(e,t,n){let{reference:r,floating:s}=e;const i=Pt(t),o=Sa(t),a=xa(o),c=It(t),d=i==="y",u=r.x+r.width/2-s.width/2,f=r.y+r.height/2-s.height/2,m=r[a]/2-s[a]/2;let p;switch(c){case"top":p={x:u,y:r.y-s.height};break;case"bottom":p={x:u,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-s.width,y:f};break;default:p={x:r.x,y:r.y}}switch(Sr(t)){case"start":p[o]-=m*(n&&d?-1:1);break;case"end":p[o]+=m*(n&&d?-1:1);break}return p}async function Kg(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:i,rects:o,elements:a,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:m=!1,padding:p=0}=Mt(t,e),g=bu(p),y=a[m?f==="floating"?"reference":"floating":f],b=Ws(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(y)))==null||n?y:y.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:d,rootBoundary:u,strategy:c})),v=f==="floating"?{x:r,y:s,width:o.floating.width,height:o.floating.height}:o.reference,x=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),_=await(i.isElement==null?void 0:i.isElement(x))?await(i.getScale==null?void 0:i.getScale(x))||{x:1,y:1}:{x:1,y:1},C=Ws(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:x,strategy:c}):v);return{top:(b.top-C.top+g.top)/_.y,bottom:(C.bottom-b.bottom+g.bottom)/_.y,left:(b.left-C.left+g.left)/_.x,right:(C.right-b.right+g.right)/_.x}}const qg=50,Zg=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:o}=n,a=o.detectOverflow?o:{...o,detectOverflow:Kg},c=await(o.isRTL==null?void 0:o.isRTL(t));let d=await o.getElementRects({reference:e,floating:t,strategy:s}),{x:u,y:f}=Vc(d,r,c),m=r,p=0;const g={};for(let h=0;h<i.length;h++){const y=i[h];if(!y)continue;const{name:b,fn:v}=y,{x,y:_,data:C,reset:k}=await v({x:u,y:f,initialPlacement:r,placement:m,strategy:s,middlewareData:g,rects:d,platform:a,elements:{reference:e,floating:t}});u=x??u,f=_??f,g[b]={...g[b],...C},k&&p<qg&&(p++,typeof k=="object"&&(k.placement&&(m=k.placement),k.rects&&(d=k.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:s}):k.rects),{x:u,y:f}=Vc(d,m,c)),h=-1)}return{x:u,y:f,placement:m,strategy:s,middlewareData:g}},Yg=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:i,platform:o,elements:a,middlewareData:c}=t,{element:d,padding:u=0}=Mt(e,t)||{};if(d==null)return{};const f=bu(u),m={x:n,y:r},p=Sa(s),g=xa(p),h=await o.getDimensions(d),y=p==="y",b=y?"top":"left",v=y?"bottom":"right",x=y?"clientHeight":"clientWidth",_=i.reference[g]+i.reference[p]-m[p]-i.floating[g],C=m[p]-i.reference[p],k=await(o.getOffsetParent==null?void 0:o.getOffsetParent(d));let T=k?k[x]:0;(!T||!await(o.isElement==null?void 0:o.isElement(k)))&&(T=a.floating[x]||i.floating[g]);const A=_/2-C/2,N=T/2-h[g]/2-1,O=an(f[b],N),L=an(f[v],N),R=O,$=T-h[g]-L,j=T/2-h[g]/2+A,H=wo(R,j,$),F=!c.arrow&&Sr(s)!=null&&j!==H&&i.reference[g]/2-(j<R?O:L)-h[g]/2<0,I=F?j<R?j-R:j-$:0;return{[p]:m[p]+I,data:{[p]:H,centerOffset:j-H-I,...F&&{alignmentOffset:I}},reset:F}}}),Qg=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:c,elements:d}=t,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:m,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:h=!0,...y}=Mt(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const b=It(s),v=Pt(a),x=It(a)===a,_=await(c.isRTL==null?void 0:c.isRTL(d.floating)),C=m||(x||!h?[zs(a)]:$g(a)),k=g!=="none";!m&&k&&C.push(...Wg(a,h,g,_));const T=[a,...C],A=await c.detectOverflow(t,y),N=[];let O=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&N.push(A[b]),f){const j=Bg(s,o,_);N.push(A[j[0]],A[j[1]])}if(O=[...O,{placement:s,overflows:N}],!N.every(j=>j<=0)){var L,R;const j=(((L=i.flip)==null?void 0:L.index)||0)+1,H=T[j];if(H&&(!(f==="alignment"?v!==Pt(H):!1)||O.every(D=>Pt(D.placement)===v?D.overflows[0]>0:!0)))return{data:{index:j,overflows:O},reset:{placement:H}};let F=(R=O.filter(I=>I.overflows[0]<=0).sort((I,D)=>I.overflows[1]-D.overflows[1])[0])==null?void 0:R.placement;if(!F)switch(p){case"bestFit":{var $;const I=($=O.filter(D=>{if(k){const U=Pt(D.placement);return U===v||U==="y"}return!0}).map(D=>[D.placement,D.overflows.filter(U=>U>0).reduce((U,K)=>U+K,0)]).sort((D,U)=>D[1]-U[1])[0])==null?void 0:$[0];I&&(F=I);break}case"initialPlacement":F=a;break}if(s!==F)return{reset:{placement:F}}}return{}}}};function Hc(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function zc(e){return Ug.some(t=>e[t]>=0)}const Xg=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=Hc(o,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:zc(a)}}}case"escaped":{const o=await r.detectOverflow(t,{...i,altBoundary:!0}),a=Hc(o,n.floating);return{data:{escapedOffsets:a,escaped:zc(a)}}}default:return{}}}}},vu=new Set(["left","top"]);async function Jg(e,t){const{placement:n,platform:r,elements:s}=e,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),o=It(n),a=Sr(n),c=Pt(n)==="y",d=vu.has(o)?-1:1,u=i&&c?-1:1,f=Mt(t,e);let{mainAxis:m,crossAxis:p,alignmentAxis:g}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof g=="number"&&(p=a==="end"?g*-1:g),c?{x:p*u,y:m*d}:{x:m*d,y:p*u}}const ey=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,c=await Jg(t,e);return o===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:s+c.x,y:i+c.y,data:{...c,placement:o}}}}},ty=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:c={fn:b=>{let{x:v,y:x}=b;return{x:v,y:x}}},...d}=Mt(e,t),u={x:n,y:r},f=await i.detectOverflow(t,d),m=Pt(It(s)),p=_a(m);let g=u[p],h=u[m];if(o){const b=p==="y"?"top":"left",v=p==="y"?"bottom":"right",x=g+f[b],_=g-f[v];g=wo(x,g,_)}if(a){const b=m==="y"?"top":"left",v=m==="y"?"bottom":"right",x=h+f[b],_=h-f[v];h=wo(x,h,_)}const y=c.fn({...t,[p]:g,[m]:h});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[p]:o,[m]:a}}}}}},ny=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:c=!0,crossAxis:d=!0}=Mt(e,t),u={x:n,y:r},f=Pt(s),m=_a(f);let p=u[m],g=u[f];const h=Mt(a,t),y=typeof h=="number"?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){const x=m==="y"?"height":"width",_=i.reference[m]-i.floating[x]+y.mainAxis,C=i.reference[m]+i.reference[x]-y.mainAxis;p<_?p=_:p>C&&(p=C)}if(d){var b,v;const x=m==="y"?"width":"height",_=vu.has(It(s)),C=i.reference[f]-i.floating[x]+(_&&((b=o.offset)==null?void 0:b[f])||0)+(_?0:y.crossAxis),k=i.reference[f]+i.reference[x]+(_?0:((v=o.offset)==null?void 0:v[f])||0)-(_?y.crossAxis:0);g<C?g=C:g>k&&(g=k)}return{[m]:p,[f]:g}}}},ry=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:c=()=>{},...d}=Mt(e,t),u=await o.detectOverflow(t,d),f=It(s),m=Sr(s),p=Pt(s)==="y",{width:g,height:h}=i.floating;let y,b;f==="top"||f==="bottom"?(y=f,b=m===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(b=f,y=m==="end"?"top":"bottom");const v=h-u.top-u.bottom,x=g-u.left-u.right,_=an(h-u[y],v),C=an(g-u[b],x),k=!t.middlewareData.shift;let T=_,A=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(A=x),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(T=v),k&&!m){const O=tt(u.left,0),L=tt(u.right,0),R=tt(u.top,0),$=tt(u.bottom,0);p?A=g-2*(O!==0||L!==0?O+L:tt(u.left,u.right)):T=h-2*(R!==0||$!==0?R+$:tt(u.top,u.bottom))}await c({...t,availableWidth:A,availableHeight:T});const N=await o.getDimensions(a.floating);return g!==N.width||h!==N.height?{reset:{rects:!0}}:{}}}};function pi(){return typeof window<"u"}function Cr(e){return wu(e)?(e.nodeName||"").toLowerCase():"#document"}function nt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function At(e){var t;return(t=(wu(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function wu(e){return pi()?e instanceof Node||e instanceof nt(e).Node:!1}function pt(e){return pi()?e instanceof Element||e instanceof nt(e).Element:!1}function Ft(e){return pi()?e instanceof HTMLElement||e instanceof nt(e).HTMLElement:!1}function Wc(e){return!pi()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof nt(e).ShadowRoot}function ts(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=mt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&s!=="inline"&&s!=="contents"}function sy(e){return/^(table|td|th)$/.test(Cr(e))}function mi(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const iy=/transform|translate|scale|rotate|perspective|filter/,oy=/paint|layout|strict|content/,gn=e=>!!e&&e!=="none";let Ki;function Ca(e){const t=pt(e)?mt(e):e;return gn(t.transform)||gn(t.translate)||gn(t.scale)||gn(t.rotate)||gn(t.perspective)||!Ea()&&(gn(t.backdropFilter)||gn(t.filter))||iy.test(t.willChange||"")||oy.test(t.contain||"")}function ay(e){let t=cn(e);for(;Ft(t)&&!hr(t);){if(Ca(t))return t;if(mi(t))return null;t=cn(t)}return null}function Ea(){return Ki==null&&(Ki=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Ki}function hr(e){return/^(html|body|#document)$/.test(Cr(e))}function mt(e){return nt(e).getComputedStyle(e)}function gi(e){return pt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function cn(e){if(Cr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Wc(e)&&e.host||At(e);return Wc(t)?t.host:t}function _u(e){const t=cn(e);return hr(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ft(t)&&ts(t)?t:_u(t)}function Fr(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=_u(e),i=s===((r=e.ownerDocument)==null?void 0:r.body),o=nt(s);if(i){const a=xo(o);return t.concat(o,o.visualViewport||[],ts(s)?s:[],a&&n?Fr(a):[])}else return t.concat(s,Fr(s,[],n))}function xo(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function xu(e){const t=mt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=Ft(e),i=s?e.offsetWidth:n,o=s?e.offsetHeight:r,a=Hs(n)!==i||Hs(r)!==o;return a&&(n=i,r=o),{width:n,height:r,$:a}}function Ta(e){return pt(e)?e:e.contextElement}function Yn(e){const t=Ta(e);if(!Ft(t))return kt(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:i}=xu(t);let o=(i?Hs(n.width):n.width)/r,a=(i?Hs(n.height):n.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const cy=kt(0);function Su(e){const t=nt(e);return!Ea()||!t.visualViewport?cy:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function ly(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==nt(e)?!1:t}function Dn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),i=Ta(e);let o=kt(1);t&&(r?pt(r)&&(o=Yn(r)):o=Yn(e));const a=ly(i,n,r)?Su(i):kt(0);let c=(s.left+a.x)/o.x,d=(s.top+a.y)/o.y,u=s.width/o.x,f=s.height/o.y;if(i){const m=nt(i),p=r&&pt(r)?nt(r):r;let g=m,h=xo(g);for(;h&&r&&p!==g;){const y=Yn(h),b=h.getBoundingClientRect(),v=mt(h),x=b.left+(h.clientLeft+parseFloat(v.paddingLeft))*y.x,_=b.top+(h.clientTop+parseFloat(v.paddingTop))*y.y;c*=y.x,d*=y.y,u*=y.x,f*=y.y,c+=x,d+=_,g=nt(h),h=xo(g)}}return Ws({width:u,height:f,x:c,y:d})}function yi(e,t){const n=gi(e).scrollLeft;return t?t.left+n:Dn(At(e)).left+n}function Cu(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-yi(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function dy(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const i=s==="fixed",o=At(r),a=t?mi(t.floating):!1;if(r===o||a&&i)return n;let c={scrollLeft:0,scrollTop:0},d=kt(1);const u=kt(0),f=Ft(r);if((f||!f&&!i)&&((Cr(r)!=="body"||ts(o))&&(c=gi(r)),f)){const p=Dn(r);d=Yn(r),u.x=p.x+r.clientLeft,u.y=p.y+r.clientTop}const m=o&&!f&&!i?Cu(o,c):kt(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+u.x+m.x,y:n.y*d.y-c.scrollTop*d.y+u.y+m.y}}function uy(e){return Array.from(e.getClientRects())}function fy(e){const t=At(e),n=gi(e),r=e.ownerDocument.body,s=tt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=tt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+yi(e);const a=-n.scrollTop;return mt(r).direction==="rtl"&&(o+=tt(t.clientWidth,r.clientWidth)-s),{width:s,height:i,x:o,y:a}}const Gc=25;function hy(e,t){const n=nt(e),r=At(e),s=n.visualViewport;let i=r.clientWidth,o=r.clientHeight,a=0,c=0;if(s){i=s.width,o=s.height;const u=Ea();(!u||u&&t==="fixed")&&(a=s.offsetLeft,c=s.offsetTop)}const d=yi(r);if(d<=0){const u=r.ownerDocument,f=u.body,m=getComputedStyle(f),p=u.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,g=Math.abs(r.clientWidth-f.clientWidth-p);g<=Gc&&(i-=g)}else d<=Gc&&(i+=d);return{width:i,height:o,x:a,y:c}}function py(e,t){const n=Dn(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,i=Ft(e)?Yn(e):kt(1),o=e.clientWidth*i.x,a=e.clientHeight*i.y,c=s*i.x,d=r*i.y;return{width:o,height:a,x:c,y:d}}function Kc(e,t,n){let r;if(t==="viewport")r=hy(e,n);else if(t==="document")r=fy(At(e));else if(pt(t))r=py(t,n);else{const s=Su(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return Ws(r)}function Eu(e,t){const n=cn(e);return n===t||!pt(n)||hr(n)?!1:mt(n).position==="fixed"||Eu(n,t)}function my(e,t){const n=t.get(e);if(n)return n;let r=Fr(e,[],!1).filter(a=>pt(a)&&Cr(a)!=="body"),s=null;const i=mt(e).position==="fixed";let o=i?cn(e):e;for(;pt(o)&&!hr(o);){const a=mt(o),c=Ca(o);!c&&a.position==="fixed"&&(s=null),(i?!c&&!s:!c&&a.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||ts(o)&&!c&&Eu(e,o))?r=r.filter(u=>u!==o):s=a,o=cn(o)}return t.set(e,r),r}function gy(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const o=[...n==="clippingAncestors"?mi(t)?[]:my(t,this._c):[].concat(n),r],a=Kc(t,o[0],s);let c=a.top,d=a.right,u=a.bottom,f=a.left;for(let m=1;m<o.length;m++){const p=Kc(t,o[m],s);c=tt(p.top,c),d=an(p.right,d),u=an(p.bottom,u),f=tt(p.left,f)}return{width:d-f,height:u-c,x:f,y:c}}function yy(e){const{width:t,height:n}=xu(e);return{width:t,height:n}}function by(e,t,n){const r=Ft(t),s=At(t),i=n==="fixed",o=Dn(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const c=kt(0);function d(){c.x=yi(s)}if(r||!r&&!i)if((Cr(t)!=="body"||ts(s))&&(a=gi(t)),r){const p=Dn(t,!0,i,t);c.x=p.x+t.clientLeft,c.y=p.y+t.clientTop}else s&&d();i&&!r&&s&&d();const u=s&&!r&&!i?Cu(s,a):kt(0),f=o.left+a.scrollLeft-c.x-u.x,m=o.top+a.scrollTop-c.y-u.y;return{x:f,y:m,width:o.width,height:o.height}}function qi(e){return mt(e).position==="static"}function qc(e,t){if(!Ft(e)||mt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return At(e)===n&&(n=n.ownerDocument.body),n}function Tu(e,t){const n=nt(e);if(mi(e))return n;if(!Ft(e)){let s=cn(e);for(;s&&!hr(s);){if(pt(s)&&!qi(s))return s;s=cn(s)}return n}let r=qc(e,t);for(;r&&sy(r)&&qi(r);)r=qc(r,t);return r&&hr(r)&&qi(r)&&!Ca(r)?n:r||ay(e)||n}const vy=async function(e){const t=this.getOffsetParent||Tu,n=this.getDimensions,r=await n(e.floating);return{reference:by(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function wy(e){return mt(e).direction==="rtl"}const _y={convertOffsetParentRelativeRectToViewportRelativeRect:dy,getDocumentElement:At,getClippingRect:gy,getOffsetParent:Tu,getElementRects:vy,getClientRects:uy,getDimensions:yy,getScale:Yn,isElement:pt,isRTL:wy};function Pu(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function xy(e,t){let n=null,r;const s=At(e);function i(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function o(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),i();const d=e.getBoundingClientRect(),{left:u,top:f,width:m,height:p}=d;if(a||t(),!m||!p)return;const g=vs(f),h=vs(s.clientWidth-(u+m)),y=vs(s.clientHeight-(f+p)),b=vs(u),x={rootMargin:-g+"px "+-h+"px "+-y+"px "+-b+"px",threshold:tt(0,an(1,c))||1};let _=!0;function C(k){const T=k[0].intersectionRatio;if(T!==c){if(!_)return o();T?o(!1,T):r=setTimeout(()=>{o(!1,1e-7)},1e3)}T===1&&!Pu(d,e.getBoundingClientRect())&&o(),_=!1}try{n=new IntersectionObserver(C,{...x,root:s.ownerDocument})}catch{n=new IntersectionObserver(C,x)}n.observe(e)}return o(!0),i}function Sy(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:c=!1}=r,d=Ta(e),u=s||i?[...d?Fr(d):[],...t?Fr(t):[]]:[];u.forEach(b=>{s&&b.addEventListener("scroll",n,{passive:!0}),i&&b.addEventListener("resize",n)});const f=d&&a?xy(d,n):null;let m=-1,p=null;o&&(p=new ResizeObserver(b=>{let[v]=b;v&&v.target===d&&p&&t&&(p.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var x;(x=p)==null||x.observe(t)})),n()}),d&&!c&&p.observe(d),t&&p.observe(t));let g,h=c?Dn(e):null;c&&y();function y(){const b=Dn(e);h&&!Pu(h,b)&&n(),h=b,g=requestAnimationFrame(y)}return n(),()=>{var b;u.forEach(v=>{s&&v.removeEventListener("scroll",n),i&&v.removeEventListener("resize",n)}),f==null||f(),(b=p)==null||b.disconnect(),p=null,c&&cancelAnimationFrame(g)}}const Cy=ey,Ey=ty,Ty=Qg,Py=ry,ky=Xg,Zc=Yg,Oy=ny,Ay=(e,t,n)=>{const r=new Map,s={platform:_y,...n},i={...s.platform,_c:r};return Zg(e,t,{...s,platform:i})};var Ny=typeof document<"u",Ry=function(){},Ds=Ny?S.useLayoutEffect:Ry;function Gs(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(!Gs(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)&&!Gs(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function ku(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Yc(e,t){const n=ku(e);return Math.round(t*n)/n}function Zi(e){const t=w.useRef(e);return Ds(()=>{t.current=e}),t}function Dy(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:c,open:d}=e,[u,f]=w.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,p]=w.useState(r);Gs(m,r)||p(r);const[g,h]=w.useState(null),[y,b]=w.useState(null),v=w.useCallback(D=>{D!==k.current&&(k.current=D,h(D))},[]),x=w.useCallback(D=>{D!==T.current&&(T.current=D,b(D))},[]),_=i||g,C=o||y,k=w.useRef(null),T=w.useRef(null),A=w.useRef(u),N=c!=null,O=Zi(c),L=Zi(s),R=Zi(d),$=w.useCallback(()=>{if(!k.current||!T.current)return;const D={placement:t,strategy:n,middleware:m};L.current&&(D.platform=L.current),Ay(k.current,T.current,D).then(U=>{const K={...U,isPositioned:R.current!==!1};j.current&&!Gs(A.current,K)&&(A.current=K,es.flushSync(()=>{f(K)}))})},[m,t,n,L,R]);Ds(()=>{d===!1&&A.current.isPositioned&&(A.current.isPositioned=!1,f(D=>({...D,isPositioned:!1})))},[d]);const j=w.useRef(!1);Ds(()=>(j.current=!0,()=>{j.current=!1}),[]),Ds(()=>{if(_&&(k.current=_),C&&(T.current=C),_&&C){if(O.current)return O.current(_,C,$);$()}},[_,C,$,O,N]);const H=w.useMemo(()=>({reference:k,floating:T,setReference:v,setFloating:x}),[v,x]),F=w.useMemo(()=>({reference:_,floating:C}),[_,C]),I=w.useMemo(()=>{const D={position:n,left:0,top:0};if(!F.floating)return D;const U=Yc(F.floating,u.x),K=Yc(F.floating,u.y);return a?{...D,transform:"translate("+U+"px, "+K+"px)",...ku(F.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:U,top:K}},[n,a,F.floating,u.x,u.y]);return w.useMemo(()=>({...u,update:$,refs:H,elements:F,floatingStyles:I}),[u,$,H,F,I])}const Ly=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?Zc({element:r.current,padding:s}).fn(n):{}:r?Zc({element:r,padding:s}).fn(n):{}}}},jy=(e,t)=>{const n=Cy(e);return{name:n.name,fn:n.fn,options:[e,t]}},My=(e,t)=>{const n=Ey(e);return{name:n.name,fn:n.fn,options:[e,t]}},Iy=(e,t)=>({fn:Oy(e).fn,options:[e,t]}),Uy=(e,t)=>{const n=Ty(e);return{name:n.name,fn:n.fn,options:[e,t]}},Fy=(e,t)=>{const n=Py(e);return{name:n.name,fn:n.fn,options:[e,t]}},By=(e,t)=>{const n=ky(e);return{name:n.name,fn:n.fn,options:[e,t]}},$y=(e,t)=>{const n=Ly(e);return{name:n.name,fn:n.fn,options:[e,t]}};var Vy="Arrow",Ou=w.forwardRef((e,t)=>{const{children:n,width:r=10,height:s=5,...i}=e;return l.jsx(we.svg,{...i,ref:t,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:l.jsx("polygon",{points:"0,0 30,0 15,10"})})});Ou.displayName=Vy;var Hy=Ou;function zy(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 c=i.borderBoxSize,d=Array.isArray(c)?c[0]:c;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 Pa="Popper",[Au,Nu]=_r(Pa),[Wy,Ru]=Au(Pa),Du=e=>{const{__scopePopper:t,children:n}=e,[r,s]=w.useState(null),[i,o]=w.useState(void 0);return l.jsx(Wy,{scope:t,anchor:r,onAnchorChange:s,placementState:i,setPlacementState:o,children:n})};Du.displayName=Pa;var Lu="PopperAnchor",ju=w.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,i=Ru(Lu,n),o=w.useRef(null),a=i.onAnchorChange,c=w.useCallback(g=>{o.current=g,g&&a(g)},[a]),d=Pe(t,c),u=w.useRef(null);w.useEffect(()=>{if(!r)return;const g=u.current;u.current=r.current,g!==u.current&&a(u.current)});const f=i.placementState&&Oa(i.placementState),m=f==null?void 0:f[0],p=f==null?void 0:f[1];return r?null:l.jsx(we.div,{"data-radix-popper-side":m,"data-radix-popper-align":p,...s,ref:d})});ju.displayName=Lu;var ka="PopperContent",[Gy,Ky]=Au(ka),Mu=w.forwardRef((e,t)=>{var B,me,oe,se,te,je;const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:i="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:c=!0,collisionBoundary:d=[],collisionPadding:u=0,sticky:f="partial",hideWhenDetached:m=!1,updatePositionStrategy:p="optimized",onPlaced:g,...h}=e,y=Ru(ka,n),[b,v]=w.useState(null),x=Pe(t,Ne=>v(Ne)),[_,C]=w.useState(null),k=zy(_),T=(k==null?void 0:k.width)??0,A=(k==null?void 0:k.height)??0,N=r+(i!=="center"?"-"+i:""),O=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},L=Array.isArray(d)?d:[d],R=L.length>0,$={padding:O,boundary:L.filter(Zy),altBoundary:R},{refs:j,floatingStyles:H,placement:F,isPositioned:I,middlewareData:D}=Dy({strategy:"fixed",placement:N,whileElementsMounted:(...Ne)=>Sy(...Ne,{animationFrame:p==="always"}),elements:{reference:y.anchor},middleware:[jy({mainAxis:s+A,alignmentAxis:o}),c&&My({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?Iy():void 0,...$}),c&&Uy({...$}),Fy({...$,apply:({elements:Ne,rects:Oe,availableWidth:X,availableHeight:Te})=>{const{width:Ue,height:Qe}=Oe.reference,ct=Ne.floating.style;ct.setProperty("--radix-popper-available-width",`${X}px`),ct.setProperty("--radix-popper-available-height",`${Te}px`),ct.setProperty("--radix-popper-anchor-width",`${Ue}px`),ct.setProperty("--radix-popper-anchor-height",`${Qe}px`)}}),_&&$y({element:_,padding:a}),Yy({arrowWidth:T,arrowHeight:A}),m&&By({strategy:"referenceHidden",...$,boundary:R?$.boundary:void 0})]}),U=y.setPlacementState;Ie(()=>(U(F),()=>{U(void 0)}),[F,U]);const[K,M]=Oa(F),le=Rn(g);Ie(()=>{I&&(le==null||le())},[I,le]);const Z=(B=D.arrow)==null?void 0:B.x,fe=(me=D.arrow)==null?void 0:me.y,de=((oe=D.arrow)==null?void 0:oe.centerOffset)!==0,[ee,q]=w.useState();return Ie(()=>{b&&q(window.getComputedStyle(b).zIndex)},[b]),l.jsx("div",{ref:j.setFloating,"data-radix-popper-content-wrapper":"",style:{...H,transform:I?H.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ee,"--radix-popper-transform-origin":[(se=D.transformOrigin)==null?void 0:se.x,(te=D.transformOrigin)==null?void 0:te.y].join(" "),...((je=D.hide)==null?void 0:je.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:l.jsx(Gy,{scope:n,placedSide:K,placedAlign:M,onArrowChange:C,arrowX:Z,arrowY:fe,shouldHideArrow:de,children:l.jsx(we.div,{"data-side":K,"data-align":M,...h,ref:x,style:{...h.style,animation:I?void 0:"none"}})})})});Mu.displayName=ka;var Iu="PopperArrow",qy={top:"bottom",right:"left",bottom:"top",left:"right"},Uu=w.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,i=Ky(Iu,r),o=qy[i.placedSide];return l.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:l.jsx(Hy,{...s,ref:n,style:{...s.style,display:"block"}})})});Uu.displayName=Iu;function Zy(e){return e!==null}var Yy=e=>({name:"transformOrigin",options:e,fn(t){var y,b,v;const{placement:n,rects:r,middlewareData:s}=t,o=((y=s.arrow)==null?void 0:y.centerOffset)!==0,a=o?0:e.arrowWidth,c=o?0:e.arrowHeight,[d,u]=Oa(n),f={start:"0%",center:"50%",end:"100%"}[u],m=(((b=s.arrow)==null?void 0:b.x)??0)+a/2,p=(((v=s.arrow)==null?void 0:v.y)??0)+c/2;let g="",h="";return d==="bottom"?(g=o?f:`${m}px`,h=`${-c}px`):d==="top"?(g=o?f:`${m}px`,h=`${r.floating.height+c}px`):d==="right"?(g=`${-c}px`,h=o?f:`${p}px`):d==="left"&&(g=`${r.floating.width+c}px`,h=o?f:`${p}px`),{data:{x:g,y:h}}}});function Oa(e){const[t,n="center"]=e.split("-");return[t,n]}var Qy=Du,Xy=ju,Jy=Mu,eb=Uu;function tb(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 Fu=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"}),nb="VisuallyHidden",rb=w.forwardRef((e,t)=>l.jsx(we.span,{...e,ref:t,style:{...Fu,...e.style}}));rb.displayName=nb;var sb=[" ","Enter","ArrowUp","ArrowDown"],ib=[" ","Enter"],Ln="Select",[bi,vi,ob]=gu(Ln),[Bn]=_r(Ln,[ob,Nu]),wi=Nu(),[ab,hn]=Bn(Ln),[cb,lb]=Bn(Ln),db="SelectProvider";function Bu(e){const{__scopeSelect:t,children:n,open:r,defaultOpen:s,onOpenChange:i,value:o,defaultValue:a,onValueChange:c,dir:d,name:u,autoComplete:f,disabled:m,required:p,form:g,internal_do_not_use_render:h}=e,y=wi(t),[b,v]=w.useState(null),[x,_]=w.useState(null),[C,k]=w.useState(!1),T=yu(d),[A,N]=ur({prop:r,defaultProp:s??!1,onChange:i,caller:Ln}),[O,L]=ur({prop:o,defaultProp:a,onChange:c,caller:Ln}),R=w.useRef(null),$=b?!!g||!!b.closest("form"):!0,[j,H]=w.useState(new Set),F=rn(),I=Array.from(j).map(M=>M.props.value).join(";"),D=w.useCallback(M=>{H(le=>new Set(le).add(M))},[]),U=w.useCallback(M=>{H(le=>{const Z=new Set(le);return Z.delete(M),Z})},[]),K={required:p,trigger:b,onTriggerChange:v,valueNode:x,onValueNodeChange:_,valueNodeHasChildren:C,onValueNodeHasChildrenChange:k,contentId:F,value:O,onValueChange:L,open:A,onOpenChange:N,dir:T,triggerPointerDownPosRef:R,disabled:m,name:u,autoComplete:f,form:g,nativeOptions:j,nativeSelectKey:I,isFormControl:$};return l.jsx(Qy,{...y,children:l.jsx(ab,{scope:t,...K,children:l.jsx(bi.Provider,{scope:t,children:l.jsx(cb,{scope:t,onNativeOptionAdd:D,onNativeOptionRemove:U,children:Eb(h)?h(K):n})})})})}Bu.displayName=db;var $u=e=>{const{__scopeSelect:t,children:n,...r}=e;return l.jsx(Bu,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:s})=>l.jsxs(l.Fragment,{children:[n,s?l.jsx(lf,{__scopeSelect:t}):null]})})};$u.displayName=Ln;var Vu="SelectTrigger",Aa=w.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...s}=e,i=wi(n),o=hn(Vu,n),a=o.disabled||r,c=Pe(t,o.onTriggerChange),d=vi(n),u=w.useRef("touch"),[f,m,p]=df(h=>{const y=d().filter(x=>!x.disabled),b=y.find(x=>x.value===o.value),v=uf(y,h,b);v!==void 0&&o.onValueChange(v.value)}),g=h=>{a||(o.onOpenChange(!0),p()),h&&(o.triggerPointerDownPosRef.current={x:Math.round(h.pageX),y:Math.round(h.pageY)})};return l.jsx(Xy,{asChild:!0,...i,children:l.jsx(we.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":_i(o.value)?"":void 0,...s,ref:c,onClick:Se(s.onClick,h=>{h.currentTarget.focus(),u.current!=="mouse"&&g(h)}),onPointerDown:Se(s.onPointerDown,h=>{u.current=h.pointerType;const y=h.target;y.hasPointerCapture(h.pointerId)&&y.releasePointerCapture(h.pointerId),h.button===0&&h.ctrlKey===!1&&h.pointerType==="mouse"&&(g(h),h.preventDefault())}),onKeyDown:Se(s.onKeyDown,h=>{const y=f.current!=="";!(h.ctrlKey||h.altKey||h.metaKey)&&h.key.length===1&&m(h.key),!(y&&h.key===" ")&&sb.includes(h.key)&&(g(),h.preventDefault())})})})});Aa.displayName=Vu;var Hu="SelectValue",zu=w.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,children:i,placeholder:o="",...a}=e,c=hn(Hu,n),{onValueNodeHasChildrenChange:d}=c,u=i!==void 0,f=Pe(t,c.onValueNodeChange);Ie(()=>{d(u)},[d,u]);const m=_i(c.value);return l.jsx(we.span,{...a,asChild:m?!1:a.asChild,ref:f,style:{pointerEvents:"none"},children:l.jsx(w.Fragment,{children:m?o:i},m?"placeholder":"value")})});zu.displayName=Hu;var ub="SelectIcon",Wu=w.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...s}=e;return l.jsx(we.span,{"aria-hidden":!0,...s,ref:t,children:r||"▼"})});Wu.displayName=ub;var Gu="SelectPortal",[fb,hb]=Bn(Gu,{forceMount:void 0}),Ku=e=>{const{__scopeSelect:t,forceMount:n,...r}=e;return l.jsx(fb,{scope:e.__scopeSelect,forceMount:n,children:l.jsx(ha,{asChild:!0,...r})})};Ku.displayName=Gu;var ln="SelectContent",Na=w.forwardRef((e,t)=>{const n=hb(ln,e.__scopeSelect),{forceMount:r=n.forceMount,...s}=e,i=hn(ln,e.__scopeSelect),[o,a]=w.useState();return Ie(()=>{a(new DocumentFragment)},[]),l.jsx(xr,{present:r||i.open,children:({present:c})=>c?l.jsx(Yu,{...s,ref:t}):l.jsx(qu,{...s,fragment:o})})});Na.displayName=ln;var qu=w.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,fragment:s}=e;return s?es.createPortal(l.jsx(Zu,{scope:n,children:l.jsx(bi.Slot,{scope:n,children:l.jsx("div",{ref:t,children:r})})}),s):null});qu.displayName="SelectContentFragment";var dt=10,[Zu,pn]=Bn(ln),pb="SelectContentImpl",mb=dr("SelectContent.RemoveScroll"),Yu=w.forwardRef((e,t)=>{const{__scopeSelect:n}=e,{position:r="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:i,onPointerDownOutside:o,side:a,sideOffset:c,align:d,alignOffset:u,arrowPadding:f,collisionBoundary:m,collisionPadding:p,sticky:g,hideWhenDetached:h,avoidCollisions:y,...b}=e,v=hn(ln,n),[x,_]=w.useState(null),[C,k]=w.useState(null),T=Pe(t,q=>_(q)),[A,N]=w.useState(null),[O,L]=w.useState(null),R=vi(n),[$,j]=w.useState(!1),H=w.useRef(!1);w.useEffect(()=>{if(x)return eu(x)},[x]),Wd();const F=w.useCallback(q=>{const[B,...me]=R().map(te=>te.ref.current),[oe]=me.slice(-1),se=document.activeElement;for(const te of q)if(te===se||(te==null||te.scrollIntoView({block:"nearest"}),te===B&&C&&(C.scrollTop=0),te===oe&&C&&(C.scrollTop=C.scrollHeight),te==null||te.focus(),document.activeElement!==se))return},[R,C]),I=w.useCallback(()=>F([A,x]),[F,A,x]);w.useEffect(()=>{$&&I()},[$,I]);const{onOpenChange:D,triggerPointerDownPosRef:U}=v;w.useEffect(()=>{if(x){let q={x:0,y:0};const B=oe=>{var se,te;q={x:Math.abs(Math.round(oe.pageX)-(((se=U.current)==null?void 0:se.x)??0)),y:Math.abs(Math.round(oe.pageY)-(((te=U.current)==null?void 0:te.y)??0))}},me=oe=>{q.x<=10&&q.y<=10?oe.preventDefault():oe.composedPath().includes(x)||D(!1),document.removeEventListener("pointermove",B),U.current=null};return U.current!==null&&(document.addEventListener("pointermove",B),document.addEventListener("pointerup",me,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",B),document.removeEventListener("pointerup",me,{capture:!0})}}},[x,D,U]),w.useEffect(()=>{const q=()=>D(!1);return window.addEventListener("blur",q),window.addEventListener("resize",q),()=>{window.removeEventListener("blur",q),window.removeEventListener("resize",q)}},[D]);const[K,M]=df(q=>{const B=R().filter(se=>!se.disabled),me=B.find(se=>se.ref.current===document.activeElement),oe=uf(B,q,me);oe&&setTimeout(()=>{var se;return(se=oe.ref.current)==null?void 0:se.focus()})}),le=w.useCallback((q,B,me)=>{const oe=!H.current&&!me;(v.value!==void 0&&v.value===B||oe)&&(N(q),oe&&(H.current=!0))},[v.value]),Z=w.useCallback(()=>x==null?void 0:x.focus(),[x]),fe=w.useCallback((q,B,me)=>{const oe=!H.current&&!me;(v.value!==void 0&&v.value===B||oe)&&L(q)},[v.value]),de=r==="popper"?So:Qu,ee=de===So?{side:a,sideOffset:c,align:d,alignOffset:u,arrowPadding:f,collisionBoundary:m,collisionPadding:p,sticky:g,hideWhenDetached:h,avoidCollisions:y}:{};return l.jsx(Zu,{scope:n,content:x,viewport:C,onViewportChange:k,itemRefCallback:le,selectedItem:A,onItemLeave:Z,itemTextRefCallback:fe,focusSelectedItem:I,selectedItemText:O,position:r,isPositioned:$,searchRef:K,children:l.jsx(pa,{as:mb,allowPinchZoom:!0,children:l.jsx(fa,{asChild:!0,trapped:v.open,onMountAutoFocus:q=>{q.preventDefault()},onUnmountAutoFocus:Se(s,q=>{var B;(B=v.trigger)==null||B.focus({preventScroll:!0}),q.preventDefault()}),children:l.jsx(ua,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:q=>q.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:l.jsx(de,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:q=>q.preventDefault(),...b,...ee,onPlaced:()=>j(!0),ref:T,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:Se(b.onKeyDown,q=>{const B=q.ctrlKey||q.altKey||q.metaKey;if(q.key==="Tab"&&q.preventDefault(),!B&&q.key.length===1&&M(q.key),["ArrowUp","ArrowDown","Home","End"].includes(q.key)){let oe=R().filter(se=>!se.disabled).map(se=>se.ref.current);if(["ArrowUp","End"].includes(q.key)&&(oe=oe.slice().reverse()),["ArrowUp","ArrowDown"].includes(q.key)){const se=q.target,te=oe.indexOf(se);oe=oe.slice(te+1)}setTimeout(()=>F(oe)),q.preventDefault()}})})})})})})});Yu.displayName=pb;var gb="SelectItemAlignedPosition",Qu=w.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...s}=e,i=hn(ln,n),o=pn(ln,n),[a,c]=w.useState(null),[d,u]=w.useState(null),f=Pe(t,T=>u(T)),m=vi(n),p=w.useRef(!1),g=w.useRef(!0),{viewport:h,selectedItem:y,selectedItemText:b,focusSelectedItem:v}=o,x=w.useCallback(()=>{if(i.trigger&&i.valueNode&&a&&d&&h&&y&&b){const T=i.trigger.getBoundingClientRect(),A=d.getBoundingClientRect(),N=i.valueNode.getBoundingClientRect(),O=b.getBoundingClientRect();if(i.dir!=="rtl"){const se=O.left-A.left,te=N.left-se,je=T.left-te,Ne=T.width+je,Oe=Math.max(Ne,A.width),X=window.innerWidth-dt,Te=Fc(te,[dt,Math.max(dt,X-Oe)]);a.style.minWidth=Ne+"px",a.style.left=Te+"px"}else{const se=A.right-O.right,te=window.innerWidth-N.right-se,je=window.innerWidth-T.right-te,Ne=T.width+je,Oe=Math.max(Ne,A.width),X=window.innerWidth-dt,Te=Fc(te,[dt,Math.max(dt,X-Oe)]);a.style.minWidth=Ne+"px",a.style.right=Te+"px"}const L=m(),R=window.innerHeight-dt*2,$=h.scrollHeight,j=window.getComputedStyle(d),H=parseInt(j.borderTopWidth,10),F=parseInt(j.paddingTop,10),I=parseInt(j.borderBottomWidth,10),D=parseInt(j.paddingBottom,10),U=H+F+$+D+I,K=Math.min(y.offsetHeight*5,U),M=window.getComputedStyle(h),le=parseInt(M.paddingTop,10),Z=parseInt(M.paddingBottom,10),fe=T.top+T.height/2-dt,de=R-fe,ee=y.offsetHeight/2,q=y.offsetTop+ee,B=H+F+q,me=U-B;if(B<=fe){const se=L.length>0&&y===L[L.length-1].ref.current;a.style.bottom="0px";const te=d.clientHeight-h.offsetTop-h.offsetHeight,je=Math.max(de,ee+(se?Z:0)+te+I),Ne=B+je;a.style.height=Ne+"px"}else{const se=L.length>0&&y===L[0].ref.current;a.style.top="0px";const je=Math.max(fe,H+h.offsetTop+(se?le:0)+ee)+me;a.style.height=je+"px",h.scrollTop=B-fe+h.offsetTop}a.style.margin=`${dt}px 0`,a.style.minHeight=K+"px",a.style.maxHeight=R+"px",r==null||r(),requestAnimationFrame(()=>p.current=!0)}},[m,i.trigger,i.valueNode,a,d,h,y,b,i.dir,r]);Ie(()=>x(),[x]);const[_,C]=w.useState();Ie(()=>{d&&C(window.getComputedStyle(d).zIndex)},[d]);const k=w.useCallback(T=>{T&&g.current===!0&&(x(),v==null||v(),g.current=!1)},[x,v]);return l.jsx(bb,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:p,onScrollButtonChange:k,children:l.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:_},children:l.jsx(we.div,{...s,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});Qu.displayName=gb;var yb="SelectPopperPosition",So=w.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=dt,...i}=e,o=wi(n);return l.jsx(Jy,{...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)"}})});So.displayName=yb;var[bb,Ra]=Bn(ln,{}),Co="SelectViewport",Xu=w.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...s}=e,i=pn(Co,n),o=Ra(Co,n),a=Pe(t,i.onViewportChange),c=w.useRef(0);return l.jsxs(l.Fragment,{children:[l.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}),l.jsx(bi.Slot,{scope:n,children:l.jsx(we.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:Se(s.onScroll,d=>{const u=d.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:m}=o;if(m!=null&&m.current&&f){const p=Math.abs(c.current-u.scrollTop);if(p>0){const g=window.innerHeight-dt*2,h=parseFloat(f.style.minHeight),y=parseFloat(f.style.height),b=Math.max(h,y);if(b<g){const v=b+p,x=Math.min(g,v),_=v-x;f.style.height=x+"px",f.style.bottom==="0px"&&(u.scrollTop=_>0?_:0,f.style.justifyContent="flex-end")}}}c.current=u.scrollTop})})})]})});Xu.displayName=Co;var Ju="SelectGroup",[vb,wb]=Bn(Ju),_b=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=rn();return l.jsx(vb,{scope:n,id:s,children:l.jsx(we.div,{role:"group","aria-labelledby":s,...r,ref:t})})});_b.displayName=Ju;var ef="SelectLabel",Da=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=wb(ef,n);return l.jsx(we.div,{id:s.id,...r,ref:t})});Da.displayName=ef;var Ks="SelectItem",[xb,tf]=Bn(Ks),La=w.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:s=!1,textValue:i,...o}=e,a=hn(Ks,n),c=pn(Ks,n),d=a.value===r,[u,f]=w.useState(i??""),[m,p]=w.useState(!1),g=Pe(t,v=>{var x;return(x=c.itemRefCallback)==null?void 0:x.call(c,v,r,s)}),h=rn(),y=w.useRef("touch"),b=()=>{s||(a.onValueChange(r),a.onOpenChange(!1))};return l.jsx(xb,{scope:n,value:r,disabled:s,textId:h,isSelected:d,onItemTextChange:w.useCallback(v=>{f(x=>x||((v==null?void 0:v.textContent)??"").trim())},[]),children:l.jsx(bi.ItemSlot,{scope:n,value:r,disabled:s,textValue:u,children:l.jsx(we.div,{role:"option","aria-labelledby":h,"data-highlighted":m?"":void 0,"aria-selected":d&&m,"data-state":d?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...o,ref:g,onFocus:Se(o.onFocus,()=>p(!0)),onBlur:Se(o.onBlur,()=>p(!1)),onClick:Se(o.onClick,()=>{y.current!=="mouse"&&b()}),onPointerUp:Se(o.onPointerUp,()=>{y.current==="mouse"&&b()}),onPointerDown:Se(o.onPointerDown,v=>{y.current=v.pointerType}),onPointerMove:Se(o.onPointerMove,v=>{var x;y.current=v.pointerType,s?(x=c.onItemLeave)==null||x.call(c):y.current==="mouse"&&v.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Se(o.onPointerLeave,v=>{var x;v.currentTarget===document.activeElement&&((x=c.onItemLeave)==null||x.call(c))}),onKeyDown:Se(o.onKeyDown,v=>{var _;((_=c.searchRef)==null?void 0:_.current)!==""&&v.key===" "||(ib.includes(v.key)&&b(),v.key===" "&&v.preventDefault())})})})})});La.displayName=Ks;var jr="SelectItemText",nf=w.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,...i}=e,o=hn(jr,n),a=pn(jr,n),c=tf(jr,n),d=lb(jr,n),[u,f]=w.useState(null),m=Pe(t,b=>f(b),c.onItemTextChange,b=>{var v;return(v=a.itemTextRefCallback)==null?void 0:v.call(a,b,c.value,c.disabled)}),p=u==null?void 0:u.textContent,g=w.useMemo(()=>l.jsx("option",{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:y}=d;return Ie(()=>(h(g),()=>y(g)),[h,y,g]),l.jsxs(l.Fragment,{children:[l.jsx(we.span,{id:c.textId,...i,ref:m}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!_i(o.value)?es.createPortal(i.children,o.valueNode):null]})});nf.displayName=jr;var rf="SelectItemIndicator",sf=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return tf(rf,n).isSelected?l.jsx(we.span,{"aria-hidden":!0,...r,ref:t}):null});sf.displayName=rf;var Eo="SelectScrollUpButton",ja=w.forwardRef((e,t)=>{const n=pn(Eo,e.__scopeSelect),r=Ra(Eo,e.__scopeSelect),[s,i]=w.useState(!1),o=Pe(t,r.onScrollButtonChange);return Ie(()=>{if(n.viewport&&n.isPositioned){let a=function(){const d=c.scrollTop>0;i(d)};const c=n.viewport;return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),s?l.jsx(of,{...e,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=n;a&&c&&(a.scrollTop=a.scrollTop-c.offsetHeight)}}):null});ja.displayName=Eo;var To="SelectScrollDownButton",Ma=w.forwardRef((e,t)=>{const n=pn(To,e.__scopeSelect),r=Ra(To,e.__scopeSelect),[s,i]=w.useState(!1),o=Pe(t,r.onScrollButtonChange);return Ie(()=>{if(n.viewport&&n.isPositioned){let a=function(){const d=c.scrollHeight-c.clientHeight,u=Math.ceil(c.scrollTop)<d;i(u)};const c=n.viewport;return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),s?l.jsx(of,{...e,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=n;a&&c&&(a.scrollTop=a.scrollTop+c.offsetHeight)}}):null});Ma.displayName=To;var of=w.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...s}=e,i=pn("SelectScrollButton",n),o=w.useRef(null),a=vi(n),c=w.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return w.useEffect(()=>()=>c(),[c]),Ie(()=>{var u;const d=a().find(f=>f.ref.current===document.activeElement);(u=d==null?void 0:d.ref.current)==null||u.scrollIntoView({block:"nearest"})},[a]),l.jsx(we.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:Se(s.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:Se(s.onPointerMove,()=>{var d;(d=i.onItemLeave)==null||d.call(i),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:Se(s.onPointerLeave,()=>{c()})})}),Sb="SelectSeparator",Ia=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return l.jsx(we.div,{"aria-hidden":!0,...r,ref:t})});Ia.displayName=Sb;var af="SelectArrow",Cb=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=wi(n);return pn(af,n).position==="popper"?l.jsx(eb,{...s,...r,ref:t}):null});Cb.displayName=af;var cf="SelectBubbleInput",lf=w.forwardRef(({__scopeSelect:e,...t},n)=>{const r=hn(cf,e),{value:s,onValueChange:i,required:o,disabled:a,name:c,autoComplete:d,form:u}=r,{nativeOptions:f,nativeSelectKey:m}=r,p=w.useRef(null),g=Pe(n,p),h=s??"",y=tb(h),b=Array.from(f).some(v=>(v.props.value??"")==="");return w.useEffect(()=>{const v=p.current;if(!v)return;const x=window.HTMLSelectElement.prototype,C=Object.getOwnPropertyDescriptor(x,"value").set;if(y!==h&&C){const k=new Event("change",{bubbles:!0});C.call(v,h),v.dispatchEvent(k)}},[y,h]),l.jsxs(we.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:d,disabled:a,form:u,onChange:v=>i(v.target.value),...t,style:{...Fu,...t.style},ref:g,defaultValue:h,children:[_i(s)&&!b?l.jsx("option",{value:""}):null,Array.from(f)]},m)});lf.displayName=cf;function Eb(e){return typeof e=="function"}function _i(e){return e===""||e===void 0}function df(e){const t=Rn(e),n=w.useRef(""),r=w.useRef(0),s=w.useCallback(o=>{const a=n.current+o;t(a),(function c(d){n.current=d,window.clearTimeout(r.current),d!==""&&(r.current=window.setTimeout(()=>c(""),1e3))})(a)},[t]),i=w.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return w.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,s,i]}function uf(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=Tb(e,Math.max(i,0));s.length===1&&(o=o.filter(d=>d!==n));const c=o.find(d=>d.textValue.toLowerCase().startsWith(s.toLowerCase()));return c!==n?c:void 0}function Tb(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Ua(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 Pb=["color"],kb=S.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,s=Ua(e,Pb);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"}))}),Ob=["color"],Fa=S.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,s=Ua(e,Ob);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"}))}),Ab=["color"],Nb=S.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,s=Ua(e,Ab);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"}))});const qs=$u,Zs=zu,Br=w.forwardRef(({className:e,children:t,...n},r)=>l.jsxs(Aa,{ref:r,className:De("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,l.jsx(Wu,{asChild:!0,children:l.jsx(Fa,{className:"h-4 w-4 opacity-50"})})]}));Br.displayName=Aa.displayName;const ff=w.forwardRef(({className:e,...t},n)=>l.jsx(ja,{ref:n,className:De("flex cursor-default items-center justify-center py-1",e),...t,children:l.jsx(Nb,{className:"h-4 w-4"})}));ff.displayName=ja.displayName;const hf=w.forwardRef(({className:e,...t},n)=>l.jsx(Ma,{ref:n,className:De("flex cursor-default items-center justify-center py-1",e),...t,children:l.jsx(Fa,{className:"h-4 w-4"})}));hf.displayName=Ma.displayName;const $r=w.forwardRef(({className:e,children:t,position:n="popper",...r},s)=>l.jsx(Ku,{children:l.jsxs(Na,{ref:s,className:De("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:[l.jsx(ff,{}),l.jsx(Xu,{className:De("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),l.jsx(hf,{})]})}));$r.displayName=Na.displayName;const Rb=w.forwardRef(({className:e,...t},n)=>l.jsx(Da,{ref:n,className:De("px-2 py-1.5 text-sm font-semibold",e),...t}));Rb.displayName=Da.displayName;const Vr=w.forwardRef(({className:e,children:t,...n},r)=>l.jsxs(La,{ref:r,className:De("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:[l.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:l.jsx(sf,{children:l.jsx(kb,{className:"h-4 w-4"})})}),l.jsx(nf,{children:t})]}));Vr.displayName=La.displayName;const Db=w.forwardRef(({className:e,...t},n)=>l.jsx(Ia,{ref:n,className:De("-mx-1 my-1 h-px bg-muted",e),...t}));Db.displayName=Ia.displayName;function pf({open:e,isAccountsLoading:t,accountOptions:n,onConfirm:r,backUrl:s,createAccountUrl:i}){var f;const[o,a]=S.useState(""),c=o||((f=n[0])==null?void 0:f.login)||"",d=!t&&n.length>0&&c!=="",u=!t&&n.length===0;return l.jsx(jg,{open:e,children:l.jsxs(uu,{className:"web-trading-widget-account-modal",onPointerDownOutside:m=>m.preventDefault(),onEscapeKeyDown:m=>m.preventDefault(),children:[l.jsxs(fu,{children:[l.jsx(pu,{children:"Select trading account"}),l.jsx(mu,{children:"Choose an account to continue trading on the chart."})]}),t?l.jsx("p",{className:"web-trading-widget-account-modal__loading",children:"Loading accounts…"}):n.length===0?l.jsx("p",{className:"web-trading-widget-account-modal__error",children:"No trading accounts available."}):l.jsxs(qs,{value:c,onValueChange:a,children:[l.jsx(Br,{className:"web-trading-widget-account-modal__select",children:l.jsx(Zs,{placeholder:"Select account"})}),l.jsx($r,{children:n.map(m=>l.jsxs(Vr,{value:m.login,children:[m.label," (",m.balance.toFixed(2)," ",m.currency,")"]},m.login))})]}),l.jsx(hu,{children:u?l.jsxs(l.Fragment,{children:[s?l.jsx(ot,{asChild:!0,variant:"outline",children:l.jsx("a",{href:s,children:"Just back"})}):null,i?l.jsx(ot,{asChild:!0,children:l.jsx("a",{href:i,children:"Create account"})}):null]}):l.jsx(ot,{type:"button",disabled:!d,onClick:()=>r(c),children:"Continue"})})]})})}var Lb={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 jb=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),yt=(e,t)=>{const n=S.forwardRef(({color:r="currentColor",size:s=24,strokeWidth:i=2,absoluteStrokeWidth:o,children:a,...c},d)=>S.createElement("svg",{ref:d,...Lb,width:s,height:s,stroke:r,strokeWidth:o?Number(i)*24/Number(s):i,className:`lucide lucide-${jb(e)}`,...c},[...t.map(([u,f])=>S.createElement(u,f)),...(Array.isArray(a)?a:[a])||[]]));return n.displayName=`${e}`,n},Ys=yt("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),Mb=yt("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),Ib=yt("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),Po=yt("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),mf=yt("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"}]]),gf=yt("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"}]]),Ub=yt("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"}]]),Fb=yt("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"}]]),Bb=yt("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]),$b=yt("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),mn=yt("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function Vb(e){const t=Math.round(Math.log10(e));return Number.isFinite(t)&&t>0?t:5}function Ba(e){const t=Ye(e).toUpperCase();if(t)return fn.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 Hb(e){const t=Ba(e);return t!=null&&t.pricescale?Vb(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=Ye(e).toUpperCase();return n.includes("XAU")||n.includes("GOLD")?2:n.includes("JPY")?3:5}function zb(e){const t=Ba(e);return(t==null?void 0:t.type)==="commodity"?100:1e5}const $a="USD";function ns(e){return Ye(e).toUpperCase()}function xi(e){const t=ns(e);return t.length>=6?t.slice(3):$a}function Va(e){if(e!==$a&&e==="JPY")return"USDJPY"}function Wb(e,t,n,r,s){const i=xi(e),o=Va(i);if(!o)return;if(ns(e)===o){const d=t==="buy"?n:r;return d>0?d:void 0}const a=s[o];if(!a)return;const c=(a.bid+a.ask)/2;return c>0?c:void 0}function Gb(e,t,n,r,s,i,o={}){const a=e==="buy"?n:r;let d=(e==="buy"?a-t:t-a)*s*zb(i);const u=xi(i),f=Wb(i,e,n,r,o);if(f!==void 0)d/=f;else if(u!==$a)return null;return Math.round(d*100)/100}function Kb(e){const t=new Set;for(const n of e){const r=Va(xi(n));r&&ns(n)!==r&&t.add(r)}return[...t]}function qb(e,t){const n=ns(e);if(n===t)return!0;const r=Va(xi(e));return r===t&&n!==r}function Zb(e,t,n,r,s){if(!qb(e.symbol,t))return e;const i=ns(e.symbol)===t,o=i?n:e.marketBid??e.currentPrice,a=i?r:e.marketAsk??e.currentPrice,c=e.type==="buy"?o:a,d=Gb(e.type,e.openPrice,o,a,e.volumeLots,e.symbol,s);return{...e,currentPrice:c,marketBid:o,marketAsk:a,profit:d??e.profit}}function Ye(e){const t=e.trim();return t?t.replace(/m$/i,""):""}function Si(e){return Ye(e)||"—"}const qe={BUY:0,SELL:1,BUY_LIMIT:2,SELL_LIMIT:3,BUY_STOP:4,SELL_STOP:5,BUY_STOP_LIMIT:6,SELL_STOP_LIMIT:7},Qs=[{mode:"market",label:"Market Execution",orderType:null,isMarket:!0},{mode:"buy_limit",label:"Buy Limit",orderType:qe.BUY_LIMIT,isMarket:!1},{mode:"sell_limit",label:"Sell Limit",orderType:qe.SELL_LIMIT,isMarket:!1},{mode:"buy_stop",label:"Buy Stop",orderType:qe.BUY_STOP,isMarket:!1},{mode:"sell_stop",label:"Sell Stop",orderType:qe.SELL_STOP,isMarket:!1},{mode:"buy_stop_limit",label:"Buy Stop Limit",orderType:qe.BUY_STOP_LIMIT,isMarket:!1},{mode:"sell_stop_limit",label:"Sell Stop Limit",orderType:qe.SELL_STOP_LIMIT,isMarket:!1}];function Ci(e){return Qs.find(t=>t.mode===e)??Qs[0]}function Ei(e){return Ci(e).isMarket}function ko(e,t){const n=Ci(e);return n.orderType!==null?n.orderType:t==="buy"?qe.BUY:qe.SELL}function Xs(e){return e%2===1?"sell":"buy"}function Ha(e){return e>=qe.BUY_LIMIT&&e<=qe.SELL_STOP_LIMIT}function za(e){return e===qe.BUY_STOP_LIMIT||e===qe.SELL_STOP_LIMIT}function bf(e){return e==="buy_stop_limit"||e==="sell_stop_limit"}const ft={GTC:0,TODAY:1,SPECIFIED:2,SPECIFIED_DAY:3},vf=[{value:ft.GTC,label:"GTC"},{value:ft.TODAY,label:"Today"},{value:ft.SPECIFIED,label:"Specified"},{value:ft.SPECIFIED_DAY,label:"Specified Day"}];function Wa(e){return e===ft.SPECIFIED}function Ga(e){return e===ft.SPECIFIED_DAY}function Yb(e){return e.map(t=>({login:t.login,label:t.label,balance:t.tradeStat.balance,currency:t.currency}))}function Qb(e,t){var n;return((n=e[0])==null?void 0:n.login)??""}function Ka(e,t=fn){return t.find(n=>n.ticker===e)}function Xb(e,t=fn){var s;const n=Ye(e).toUpperCase();if(!n)return null;const r=t.find(i=>{var o;return Ye(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=Ba(e))==null?void 0:s.ticker)??null}function wf(e,t=fn){const n=Ka(e,t),r=(n==null?void 0:n.resolve_symbol)??e.replace(/_/g,"");return Ye(r).toUpperCase()}function Ti(e,t=fn){const n=Ka(e,t);return n!=null&&n.resolve_symbol?n.resolve_symbol:e.replace(/_/g,"")}function Bt(e){const t=Math.round(Math.log10(e));return String(Number.isFinite(t)&&t>0?t:5)}function $t(e,t=fn){const n=Ka(e,t);return(n==null?void 0:n.pricescale)??1e5}function Ce(e,t){return e.toFixed(t)}function Er(e){return 1/10**e}function _f(e,t){return e===null||t===null?null:(e+t)/2}function ht(e){const t=e.trim();if(!t)return;const n=Number(t);if(!(!Number.isFinite(n)||n<=0))return n}function xf(e,t,n){if(Wa(e)){if(!t.trim())return;const r=Date.parse(t);return Number.isFinite(r)?Math.floor(r/1e3):void 0}if(Ga(e)){if(!n.trim())return;const r=Date.parse(`${n}T23:59:59`);return Number.isFinite(r)?Math.floor(r/1e3):void 0}}function Pi(e,t,n){return e===ft.GTC||e===ft.TODAY?!0:xf(e,t,n)!==void 0}const Jb={},Qc=e=>{let t;const n=new Set,r=(u,f)=>{const m=typeof u=="function"?u(t):u;if(!Object.is(m,t)){const p=t;t=f??(typeof m!="object"||m===null)?m:Object.assign({},t,m),n.forEach(g=>g(t,p))}},s=()=>t,c={setState:r,getState:s,getInitialState:()=>d,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(Jb?"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,c);return c},ev=e=>e?Qc(e):Qc;function tv(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ws={exports:{}},Yi={},_s={exports:{}},Qi={};/**
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 Qc;function Xb(){if(Qc)return Yi;Qc=1;var e=S;function t(f,m){return f===m&&(f!==0||1/f===1/m)||f!==f&&m!==m}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,s=e.useEffect,i=e.useLayoutEffect,o=e.useDebugValue;function a(f,m){var h=m(),g=r({inst:{value:h,getSnapshot:m}}),p=g[0].inst,y=g[1];return i(function(){p.value=h,p.getSnapshot=m,c(p)&&y({inst:p})},[f,h,m]),s(function(){return c(p)&&y({inst:p}),f(function(){c(p)&&y({inst:p})})},[f]),o(h),h}function c(f){var m=f.getSnapshot;f=f.value;try{var h=m();return!n(f,h)}catch{return!0}}function d(f,m){return m()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:a;return Yi.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,Yi}var Qi={};/**
49
+ */var Xc;function nv(){if(Xc)return Qi;Xc=1;var e=S;function t(f,m){return f===m&&(f!==0||1/f===1/m)||f!==f&&m!==m}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,s=e.useEffect,i=e.useLayoutEffect,o=e.useDebugValue;function a(f,m){var p=m(),g=r({inst:{value:p,getSnapshot:m}}),h=g[0].inst,y=g[1];return i(function(){h.value=p,h.getSnapshot=m,c(h)&&y({inst:h})},[f,p,m]),s(function(){return c(h)&&y({inst:h}),f(function(){c(h)&&y({inst:h})})},[f]),o(p),p}function c(f){var m=f.getSnapshot;f=f.value;try{var p=m();return!n(f,p)}catch{return!0}}function d(f,m){return m()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:a;return Qi.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,Qi}var Xi={};/**
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 Xc;function Jb(){return Xc||(Xc=1,process.env.NODE_ENV!=="production"&&(function(){function e(h,g){return h===g&&(h!==0||1/h===1/g)||h!==h&&g!==g}function t(h,g){u||s.startTransition===void 0||(u=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var p=g();if(!f){var y=g();i(p,y)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),f=!0)}y=o({inst:{value:p,getSnapshot:g}});var b=y[0].inst,v=y[1];return c(function(){b.value=p,b.getSnapshot=g,n(b)&&v({inst:b})},[h,p,g]),a(function(){return n(b)&&v({inst:b}),h(function(){n(b)&&v({inst:b})})},[h]),d(p),p}function n(h){var g=h.getSnapshot;h=h.value;try{var p=g();return!i(h,p)}catch{return!0}}function r(h,g){return g()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var s=S,i=typeof Object.is=="function"?Object.is:e,o=s.useState,a=s.useEffect,c=s.useLayoutEffect,d=s.useDebugValue,u=!1,f=!1,m=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;Qi.useSyncExternalStore=s.useSyncExternalStore!==void 0?s.useSyncExternalStore:m,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Qi}var Jc;function wf(){return Jc||(Jc=1,process.env.NODE_ENV==="production"?ws.exports=Xb():ws.exports=Jb()),ws.exports}/**
57
+ */var Jc;function rv(){return Jc||(Jc=1,process.env.NODE_ENV!=="production"&&(function(){function e(p,g){return p===g&&(p!==0||1/p===1/g)||p!==p&&g!==g}function t(p,g){u||s.startTransition===void 0||(u=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var h=g();if(!f){var y=g();i(h,y)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),f=!0)}y=o({inst:{value:h,getSnapshot:g}});var b=y[0].inst,v=y[1];return c(function(){b.value=h,b.getSnapshot=g,n(b)&&v({inst:b})},[p,h,g]),a(function(){return n(b)&&v({inst:b}),p(function(){n(b)&&v({inst:b})})},[p]),d(h),h}function n(p){var g=p.getSnapshot;p=p.value;try{var h=g();return!i(p,h)}catch{return!0}}function r(p,g){return g()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var s=S,i=typeof Object.is=="function"?Object.is:e,o=s.useState,a=s.useEffect,c=s.useLayoutEffect,d=s.useDebugValue,u=!1,f=!1,m=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;Xi.useSyncExternalStore=s.useSyncExternalStore!==void 0?s.useSyncExternalStore:m,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Xi}var el;function Sf(){return el||(el=1,process.env.NODE_ENV==="production"?_s.exports=nv():_s.exports=rv()),_s.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 el;function ev(){if(el)return Zi;el=1;var e=S,t=wf();function n(d,u){return d===u&&(d!==0||1/d===1/u)||d!==d&&u!==u}var r=typeof Object.is=="function"?Object.is:n,s=t.useSyncExternalStore,i=e.useRef,o=e.useEffect,a=e.useMemo,c=e.useDebugValue;return Zi.useSyncExternalStoreWithSelector=function(d,u,f,m,h){var g=i(null);if(g.current===null){var p={hasValue:!1,value:null};g.current=p}else p=g.current;g=a(function(){function b(k){if(!v){if(v=!0,x=k,k=m(k),h!==void 0&&p.hasValue){var T=p.value;if(h(T,k))return _=T}return _=k}if(T=_,r(x,k))return T;var R=m(k);return h!==void 0&&h(T,R)?(x=k,T):(x=k,_=R)}var v=!1,x,_,C=f===void 0?null:f;return[function(){return b(u())},C===null?void 0:function(){return b(C())}]},[u,f,m,h]);var y=s(d,g[0],g[1]);return o(function(){p.hasValue=!0,p.value=y},[y]),c(y),y},Zi}var Xi={};/**
65
+ */var tl;function sv(){if(tl)return Yi;tl=1;var e=S,t=Sf();function n(d,u){return d===u&&(d!==0||1/d===1/u)||d!==d&&u!==u}var r=typeof Object.is=="function"?Object.is:n,s=t.useSyncExternalStore,i=e.useRef,o=e.useEffect,a=e.useMemo,c=e.useDebugValue;return Yi.useSyncExternalStoreWithSelector=function(d,u,f,m,p){var g=i(null);if(g.current===null){var h={hasValue:!1,value:null};g.current=h}else h=g.current;g=a(function(){function b(k){if(!v){if(v=!0,x=k,k=m(k),p!==void 0&&h.hasValue){var T=h.value;if(p(T,k))return _=T}return _=k}if(T=_,r(x,k))return T;var A=m(k);return p!==void 0&&p(T,A)?(x=k,T):(x=k,_=A)}var v=!1,x,_,C=f===void 0?null:f;return[function(){return b(u())},C===null?void 0:function(){return b(C())}]},[u,f,m,p]);var y=s(d,g[0],g[1]);return o(function(){h.hasValue=!0,h.value=y},[y]),c(y),y},Yi}var Ji={};/**
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 tl;function tv(){return tl||(tl=1,process.env.NODE_ENV!=="production"&&(function(){function e(d,u){return d===u&&(d!==0||1/d===1/u)||d!==d&&u!==u}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=S,n=wf(),r=typeof Object.is=="function"?Object.is:e,s=n.useSyncExternalStore,i=t.useRef,o=t.useEffect,a=t.useMemo,c=t.useDebugValue;Xi.useSyncExternalStoreWithSelector=function(d,u,f,m,h){var g=i(null);if(g.current===null){var p={hasValue:!1,value:null};g.current=p}else p=g.current;g=a(function(){function b(k){if(!v){if(v=!0,x=k,k=m(k),h!==void 0&&p.hasValue){var T=p.value;if(h(T,k))return _=T}return _=k}if(T=_,r(x,k))return T;var R=m(k);return h!==void 0&&h(T,R)?(x=k,T):(x=k,_=R)}var v=!1,x,_,C=f===void 0?null:f;return[function(){return b(u())},C===null?void 0:function(){return b(C())}]},[u,f,m,h]);var y=s(d,g[0],g[1]);return o(function(){p.hasValue=!0,p.value=y},[y]),c(y),y},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Xi}var nl;function nv(){return nl||(nl=1,process.env.NODE_ENV==="production"?vs.exports=ev():vs.exports=tv()),vs.exports}var rv=nv();const sv=Qb(rv),_f={},{useDebugValue:iv}=S,{useSyncExternalStoreWithSelector:ov}=sv;let rl=!1;const av=e=>e;function cv(e,t=av,n){(_f?"production":void 0)!=="production"&&n&&!rl&&(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"),rl=!0);const r=ov(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return iv(r),r}const sl=e=>{(_f?"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"?Yb(e):e,n=(r,s)=>cv(t,r,s);return Object.assign(n,t),n},Ti=e=>e?sl(e):sl,il={source:null,entryPrice:null,stopLoss:"",takeProfit:"",side:null,showEntryLine:!1,volumeLots:.01,digits:2,priceStep:.01},ie=Ti(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}),clearDraft:()=>e({...il})}));function Ji(e,t){return e.toFixed(t)}function lv({symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:s,minVolumeLots:i,isSubmitting:o,isAccountsLoading:a,selectedLogin:c,isDragging:d,scanResultUrl:u,onDragHandlePointerDown:f,onExpandedChange:m,onExpand:h,onPlaceOrder:g}){const[p,y]=S.useState(String(r)),[b,v]=S.useState(null),[x,_]=S.useState(u),C=ie(N=>N.setOrderSide),k=ie(N=>N.setVolumeLots);u!==x&&(_(u),v(null));const T=b??!!u;S.useEffect(()=>{m()},[T,m]);const R=()=>{const N=!T;N&&h(),v(N)},A=Number(Ut(Bt(e))),O=t!==null?Ce(t,A):"—",D=n!==null?Ce(n,A):"—",B=!o&&!a&&c!==""&&(t!==null&&n!==null),U=N=>{const M=Number(p),$=Number.isFinite(M)&&M>0?M:r,j=Math.max(i,$+N*s),se=Ji(j,2);y(se),k(j)},z=()=>{const N=Number(p);if(!Number.isFinite(N)||N<=0){y(Ji(r,2)),k(r);return}const M=Math.max(i,N),$=Ji(M,2);y($),k(M)},F=N=>{t===null||n===null||C({side:N,entryPrice:N==="buy"?n:t})},I=N=>{if(t===null||n===null||!c)return;const M=Number(p),$=Math.max(i,Number.isFinite(M)&&M>0?M:r);C({side:N,entryPrice:N==="buy"?n:t}),g({login:c,side:N,volumeLots:$,bid:t,ask:n})};return l.jsx("div",{className:`web-trading-widget-mini-order${T?" web-trading-widget-mini-order--expanded":" web-trading-widget-mini-order--collapsed"}`,children:l.jsxs("div",{className:"web-trading-widget-mini-order__row",children:[l.jsx("button",{type:"button","aria-label":"Move quick order panel",onPointerDown:f,className:`web-trading-widget-mini-order__drag-handle${d?" web-trading-widget-mini-order__drag-handle--grabbing":""}`,children:l.jsx(pf,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2})}),T?l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button",disabled:!B,className:"web-trading-widget-mini-order__side-btn web-trading-widget-mini-order__side-btn--sell",onMouseDown:()=>F("sell"),onClick:()=>I("sell"),children:[l.jsx("span",{className:"web-trading-widget-mini-order__price",children:O}),l.jsx("span",{className:"web-trading-widget-mini-order__label web-trading-widget-mini-order__label--sell",children:"SELL"})]}),l.jsxs("div",{className:"web-trading-widget-mini-order__volume",children:[l.jsx("button",{type:"button","aria-label":"Decrease volume",disabled:!B,className:"web-trading-widget-mini-order__volume-btn",onClick:()=>U(-1),children:l.jsx(Ks,{className:"web-trading-widget-icon web-trading-widget-icon--xs",strokeWidth:2.5})}),l.jsx("input",{type:"text",inputMode:"decimal",value:p,disabled:!B,onChange:N=>y(N.target.value),onBlur:z,className:"web-trading-widget-mini-order__volume-input"}),l.jsx("button",{type:"button","aria-label":"Increase volume",disabled:!B,className:"web-trading-widget-mini-order__volume-btn",onClick:()=>U(1),children:l.jsx(To,{className:"web-trading-widget-icon web-trading-widget-icon--xs",strokeWidth:2.5})})]}),l.jsxs("button",{type:"button",disabled:!B,className:"web-trading-widget-mini-order__side-btn web-trading-widget-mini-order__side-btn--buy",onMouseDown:()=>F("buy"),onClick:()=>I("buy"),children:[l.jsx("span",{className:"web-trading-widget-mini-order__label web-trading-widget-mini-order__label--buy",children:"BUY"}),l.jsx("span",{className:"web-trading-widget-mini-order__price",children:D})]})]}):null,l.jsx("button",{type:"button","aria-label":T?"Collapse quick order panel":"Expand quick order panel","aria-expanded":T,className:"web-trading-widget-mini-order__toggle",onClick:R,children:T?l.jsx(Nb,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2.5}):l.jsx(Db,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2.5})})]})})}const dv="web-trading-widget-mini-exec-panel-position",xf={x:56,y:96};function ol(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 al(e,t){e.style.left=`${t.x}px`,e.style.top=`${t.y}px`}function uv(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):xf.x,y:16}}function fv(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 cl(e,t){try{e.hasPointerCapture(t)&&e.releasePointerCapture(t)}catch{}}function Sf(e){const t=(e==null?void 0:e.storageKey)??dv,n=(e==null?void 0:e.defaultPosition)??xf,r=e==null?void 0:e.defaultAlign,s=(e==null?void 0:e.isActive)??!0,i=S.useRef(null),[o,a]=S.useState(n),[c,d]=S.useState(!1),u=S.useRef(n),f=S.useRef(null);S.useEffect(()=>{u.current=o},[o]);const m=S.useCallback(p=>{const y=i.current,b=ol(p,y);u.current=b,a(b),y&&al(y,b)},[]),h=S.useCallback(()=>{m(u.current)},[m]);S.useEffect(()=>{if(!s)return;const p=fv(t);if(p){m(p);return}const y=r?uv(r,i.current):null;m(y??u.current)},[m,r,s,t]);const g=S.useCallback(p=>{p.preventDefault(),p.stopPropagation();const y=p.currentTarget,b=i.current;if(!b)return;const v=p.pointerId;y.setPointerCapture(v);const x=p.clientX,_=p.clientY,C=u.current;d(!0),document.body.style.cursor="grabbing",document.body.style.userSelect="none";const k=(A,O)=>{const D=ol({x:C.x+(A-x),y:C.y+(O-_)},b);u.current=D,al(b,D)},T=A=>{if(A.pointerId===v){cl(y,v),y.removeEventListener("pointermove",R),y.removeEventListener("pointerup",T),y.removeEventListener("pointercancel",T),f.current=null,d(!1),a(u.current),document.body.style.cursor="",document.body.style.userSelect="";try{window.localStorage.setItem(t,JSON.stringify(u.current))}catch{}}},R=A=>{A.pointerId===v&&(A.preventDefault(),k(A.clientX,A.clientY))};y.addEventListener("pointermove",R),y.addEventListener("pointerup",T),y.addEventListener("pointercancel",T),f.current=()=>{cl(y,v),y.removeEventListener("pointermove",R),y.removeEventListener("pointerup",T),y.removeEventListener("pointercancel",T),document.body.style.cursor="",document.body.style.userSelect="",d(!1)}},[t]);return S.useEffect(()=>{const p=()=>{m(u.current)};return window.addEventListener("resize",p),()=>{var y;window.removeEventListener("resize",p),(y=f.current)==null||y.call(f),f.current=null,document.body.style.cursor="",document.body.style.userSelect=""}},[m]),{panelRef:i,position:o,isDragging:c,onDragStart:g,reclamp:h}}const Cf=200,pv=201,hv=203,mv=204,Ef=0,gv=2,Tf=0;function Pi(e){const t=Number(e.trim());if(!Number.isFinite(t))throw new Error("Invalid trading account login.");return t}function qa(e){return Math.round(e*1e4)}function yv(e){return e>=2&&e<=7}function bv(e){return{Action:mv,Order:Number(e.orderTicket),Login:Pi(e.login),Symbol:e.symbol.replace(/m$/i,""),Type:e.orderType}}function vv(e){return{Action:hv,Order:Number(e.orderTicket),Login:Pi(e.login),Symbol:e.symbol.replace(/m$/i,""),Type:e.orderType,Volume:qa(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 wv(e){const t=e.positionSide==="buy"?1:0;return{Action:Cf,Login:Pi(e.login),Symbol:e.symbol.replace(/m$/i,""),Type:t,TypeFill:Ef,Volume:qa(e.volumeLots),Digits:e.digits,TypeTime:Tf,Comment:e.comment??"",Position:Number(e.positionTicket)}}function _v(e){const t=!yv(e.orderType);return{Action:t?Cf:pv,Login:Pi(e.login),Symbol:e.symbol,Type:e.orderType,TypeFill:t?Ef:gv,Volume:qa(e.volumeLots),Digits:e.digits,TypeTime:e.typeTime??Tf,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 xv(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}}}const Sv=new Set(["10009","10008"]);function Nt(e){if(e===void 0||e==="")return;const t=Number(e);return Number.isFinite(t)?t:void 0}function Cv(e){const t=Nt(e);return t===void 0?.01:t/1e4}function Ev(e){var t;return(t=e.find(n=>n.answer))==null?void 0:t.answer}function Tv(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:Nt(((r=i.result)==null?void 0:r.Price)??((s=i.answer)==null?void 0:s.ResultPrice))}}return{retcode:""}}function Ds(e){return Sv.has(e)}function _s(e,t){var v,x,_;if(!e||typeof e!="object")return null;const r=e.data;if(!(r!=null&&r.length))return null;const s=Ev(r),{retcode:i,price:o}=Tv(r),a=Ds(i),c=(s==null?void 0:s.ResultDeal)||(s==null?void 0:s.ResultOrder)||(s==null?void 0:s.Order),d=((v=s==null?void 0:s.Symbol)==null?void 0:v.trim())||t.symbol,u=Ye(d),f=Nt(s==null?void 0:s.Type),m=f!==void 0?f%2===0?"buy":"sell":t.side,h=Nt(s==null?void 0:s.ResultPrice)??Nt(s==null?void 0:s.PriceOrder)??o??t.openPrice,g=Nt(s==null?void 0:s.ResultMarketBid),p=Nt(s==null?void 0:s.ResultMarketAsk),y=m==="buy"?g??h:p??h,b=Ub(u);return{ticket:String(c||Math.floor(Date.now()/1e3)),login:((x=s==null?void 0:s.Login)==null?void 0:x.trim())||t.login,symbol:u,displaySymbol:_i(u),side:m,volumeLots:Cv(s==null?void 0:s.Volume)||t.volumeLots,openPrice:h,currentPrice:y,stopLoss:Nt(s==null?void 0:s.PriceSL),takeProfit:Nt(s==null?void 0:s.PriceTP),comment:((_=s==null?void 0:s.Comment)==null?void 0:_.trim())||t.comment,digits:Math.round(b),retcode:i,isSuccess:a,marketBid:g,marketAsk:p}}function Pv(e){return e.type==="buy"?e.marketBid??e.currentPrice:e.marketAsk??e.currentPrice}function kv(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=Ci(n.symbolTicker,t),o=Number(Ut(Bt(n.symbolTicker,t))),a=Si(n.executionMode),c=Ha(n.orderType),d=n.typeTime;if(!a&&n.priceOrder===void 0)return{success:!1,message:c?"Please set a limit price for this order.":"Please set an order price for pending orders."};if(c&&n.priceTrigger===void 0)return{success:!1,message:"Please set a stop price for stop limit orders."};if(!a&&!Ei(d,n.expirationDateTime??"",n.expirationDay??""))return{success:!1,message:"Please set an expiration date for this order."};const u=a?n.side==="buy"?n.ask:n.bid:n.priceOrder??(n.side==="buy"?n.ask:n.bid),f=a?void 0:vf(d,n.expirationDateTime??"",n.expirationDay??"");try{const m=_v({login:r,symbol:i,volumeLots:s,orderType:n.orderType,digits:o,comment:n.comment.trim(),priceOrder:Va(n.orderType)?n.priceOrder:void 0,priceTrigger:c?n.priceTrigger:void 0,priceSL:n.stopLoss,priceTP:n.takeProfit,typeTime:a?void 0:d,timeExpiration:f}),h=await e.sendRequest(m),g=_s(h,{login:r,symbol:i,side:Ys(n.orderType),volumeLots:s,openPrice:u,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:h&&typeof h=="object"&&"message"in h&&typeof h.message=="string"?h.message:"Order was not accepted by the dealer."}}catch(m){return{success:!1,message:m instanceof Error?m.message:"Failed to place order."}}},async closePosition(n){try{const r=Pv(n),s=wv({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=_s(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&&!Ds(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=bv({login:n.login,orderTicket:n.ticket,symbol:n.symbol,orderType:n.orderType}),s=await e.sendRequest(r),i=_s(s,{login:n.login,symbol:n.symbol,side:n.side,volumeLots:n.volumeLots,openPrice:n.orderPrice,digits:n.digits,comment:n.comment});return i&&!Ds(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=vv({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=_s(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&&!Ds(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."}}}}}function Pf(e,t){return function(){return e.apply(t,arguments)}}const{toString:Ov}=Object.prototype,{getPrototypeOf:hr}=Object,{iterator:ns,toStringTag:kf}=Symbol,Qs=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Vr=(e,t)=>{let n=e;const r=[];for(;n!=null&&n!==Object.prototype;){if(r.indexOf(n)!==-1)return!1;if(r.push(n),Qs(n,t))return!0;n=hr(n)}return!1},Av=(e,t)=>e!=null&&Vr(e,t)?e[t]:void 0,Ka=(e=>t=>{const n=Ov.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),bt=e=>(e=e.toLowerCase(),t=>Ka(t)===e),ki=e=>t=>typeof t===e,{isArray:jn}=Array,mr=ki("undefined");function Tr(e){return e!==null&&!mr(e)&&e.constructor!==null&&!mr(e.constructor)&&Ze(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Of=bt("ArrayBuffer");function Rv(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Of(e.buffer),t}const Nv=ki("string"),Ze=ki("function"),Af=ki("number"),Pr=e=>e!==null&&typeof e=="object",Dv=e=>e===!0||e===!1,Ls=e=>{if(!Pr(e))return!1;const t=hr(e);return(t===null||t===Object.prototype||hr(t)===null)&&!Vr(e,kf)&&!Vr(e,ns)},Lv=e=>{if(!Pr(e)||Tr(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},jv=bt("Date"),Mv=bt("File"),Iv=e=>!!(e&&typeof e.uri<"u"),Fv=e=>e&&typeof e.getParts<"u",Uv=bt("Blob"),Bv=bt("FileList"),$v=e=>Pr(e)&&Ze(e.pipe);function Vv(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const ll=Vv(),dl=typeof ll.FormData<"u"?ll.FormData:void 0,Hv=e=>{if(!e)return!1;if(dl&&e instanceof dl)return!0;const t=hr(e);if(!t||t===Object.prototype||!Ze(e.append))return!1;const n=Ka(e);return n==="formdata"||n==="object"&&Ze(e.toString)&&e.toString()==="[object FormData]"},zv=bt("URLSearchParams"),[Wv,Gv,qv,Kv]=["ReadableStream","Request","Response","Headers"].map(bt),Zv=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function rs(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),jn(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(Tr(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 Rf(e,t){if(Tr(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 bn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Nf=e=>!mr(e)&&e!==bn;function ko(...e){const{caseless:t,skipUndefined:n}=Nf(this)&&this||{},r={},s=(i,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const a=t&&typeof o=="string"&&Rf(r,o)||o,c=Qs(r,a)?r[a]:void 0;Ls(c)&&Ls(i)?r[a]=ko(c,i):Ls(i)?r[a]=ko({},i):jn(i)?r[a]=i.slice():(!n||!mr(i))&&(r[a]=i)};for(let i=0,o=e.length;i<o;i++){const a=e[i];if(!a||Tr(a)||(rs(a,s),typeof a!="object"||jn(a)))continue;const c=Object.getOwnPropertySymbols(a);for(let d=0;d<c.length;d++){const u=c[d];aw.call(a,u)&&s(a[u],u)}}return r}const Yv=(e,t,n,{allOwnKeys:r}={})=>(rs(t,(s,i)=>{n&&Ze(s)?Object.defineProperty(e,i,{__proto__:null,value:Pf(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),Qv=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Xv=(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)},Jv=(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&&hr(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},ew=(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},tw=e=>{if(!e)return null;if(jn(e))return e;let t=e.length;if(!Af(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},nw=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&hr(Uint8Array)),rw=(e,t)=>{const r=(e&&e[ns]).call(e);let s;for(;(s=r.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},sw=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},iw=bt("HTMLFormElement"),ow=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),{propertyIsEnumerable:aw}=Object.prototype,cw=bt("RegExp"),Df=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};rs(n,(s,i)=>{let o;(o=t(s,i,e))!==!1&&(r[i]=o||s)}),Object.defineProperties(e,r)},lw=e=>{Df(e,(t,n)=>{if(Ze(e)&&["arguments","caller","callee"].includes(n))return!1;const r=e[n];if(Ze(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},dw=(e,t)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return jn(e)?r(e):r(String(e).split(t)),n},uw=()=>{},fw=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function pw(e){return!!(e&&Ze(e.append)&&e[kf]==="FormData"&&e[ns])}const hw=e=>{const t=new WeakSet,n=r=>{if(Pr(r)){if(t.has(r))return;if(Tr(r))return r;if(!("toJSON"in r)){t.add(r);const s=jn(r)?[]:{};return rs(r,(i,o)=>{const a=n(i);!mr(a)&&(s[o]=a)}),t.delete(r),s}}return r};return n(e)},mw=bt("AsyncFunction"),gw=e=>e&&(Pr(e)||Ze(e))&&Ze(e.then)&&Ze(e.catch),Lf=((e,t)=>e?setImmediate:t?((n,r)=>(bn.addEventListener("message",({source:s,data:i})=>{s===bn&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),bn.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Ze(bn.postMessage)),yw=typeof queueMicrotask<"u"?queueMicrotask.bind(bn):typeof process<"u"&&process.nextTick||Lf,jf=e=>e!=null&&Ze(e[ns]),bw=e=>e!=null&&Vr(e,ns)&&jf(e),P={isArray:jn,isArrayBuffer:Of,isBuffer:Tr,isFormData:Hv,isArrayBufferView:Rv,isString:Nv,isNumber:Af,isBoolean:Dv,isObject:Pr,isPlainObject:Ls,isEmptyObject:Lv,isReadableStream:Wv,isRequest:Gv,isResponse:qv,isHeaders:Kv,isUndefined:mr,isDate:jv,isFile:Mv,isReactNativeBlob:Iv,isReactNative:Fv,isBlob:Uv,isRegExp:cw,isFunction:Ze,isStream:$v,isURLSearchParams:zv,isTypedArray:nw,isFileList:Bv,forEach:rs,merge:ko,extend:Yv,trim:Zv,stripBOM:Qv,inherits:Xv,toFlatObject:Jv,kindOf:Ka,kindOfTest:bt,endsWith:ew,toArray:tw,forEachEntry:rw,matchAll:sw,isHTMLForm:iw,hasOwnProperty:Qs,hasOwnProp:Qs,hasOwnInPrototypeChain:Vr,getSafeProp:Av,reduceDescriptors:Df,freezeMethods:lw,toObjectSet:dw,toCamelCase:ow,noop:uw,toFiniteNumber:fw,findKey:Rf,global:bn,isContextDefined:Nf,isSpecCompliantForm:pw,toJSONObject:hw,isAsyncFn:mw,isThenable:gw,setImmediate:Lf,asap:yw,isIterable:jf,isSafeIterable:bw},vw=P.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"]),ww=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]&&vw[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t};function _w(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 xw=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),Sw=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function Za(e,t){return P.isArray(e)?e.map(n=>Za(n,t)):_w(String(e).replace(t,""))}const Cw=e=>Za(e,xw),Ew=e=>Za(e,Sw);function Mf(e){const t=Object.create(null);return P.forEach(e.toJSON(),(n,r)=>{t[r]=Ew(n)}),t}const ul=Symbol("internals");function Rr(e){return e&&String(e).trim().toLowerCase()}function js(e){return e===!1||e==null?e:P.isArray(e)?e.map(js):Cw(String(e))}function Tw(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 Pw=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function eo(e,t,n,r,s){if(P.isFunction(r))return r.call(this,t,n);if(s&&(t=n),!!P.isString(t)){if(P.isString(r))return t.indexOf(r)!==-1;if(P.isRegExp(r))return r.test(t)}}function kw(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function Ow(e,t){const n=P.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 ze=class{constructor(t){t&&this.set(t)}set(t,n,r){const s=this;function i(a,c,d){const u=Rr(c);if(!u)return;const f=P.findKey(s,u);(!f||s[f]===void 0||d===!0||d===void 0&&s[f]!==!1)&&(s[f||c]=js(a))}const o=(a,c)=>P.forEach(a,(d,u)=>i(d,u,c));if(P.isPlainObject(t)||t instanceof this.constructor)o(t,n);else if(P.isString(t)&&(t=t.trim())&&!Pw(t))o(ww(t),n);else if(P.isObject(t)&&P.isSafeIterable(t)){let a=Object.create(null),c,d;for(const u of t){if(!P.isArray(u))throw new TypeError("Object iterator must return a key-value pair");d=u[0],P.hasOwnProp(a,d)?(c=a[d],a[d]=P.isArray(c)?[...c,u[1]]:[c,u[1]]):a[d]=u[1]}o(a,n)}else t!=null&&i(n,t,r);return this}get(t,n){if(t=Rr(t),t){const r=P.findKey(this,t);if(r){const s=this[r];if(!n)return s;if(n===!0)return Tw(s);if(P.isFunction(n))return n.call(this,s,r);if(P.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=Rr(t),t){const r=P.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||eo(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let s=!1;function i(o){if(o=Rr(o),o){const a=P.findKey(r,o);a&&(!n||eo(r,r[a],a,n))&&(delete r[a],s=!0)}}return P.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||eo(this,this[i],i,t,!0))&&(delete this[i],s=!0)}return s}normalize(t){const n=this,r={};return P.forEach(this,(s,i)=>{const o=P.findKey(r,i);if(o){n[o]=js(s),delete n[i];return}const a=t?kw(i):String(i).trim();a!==i&&delete n[i],n[a]=js(s),r[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return P.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=t&&P.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[ul]=this[ul]={accessors:{}}).accessors,s=this.prototype;function i(o){const a=Rr(o);r[a]||(Ow(s,o),r[a]=!0)}return P.isArray(t)?t.forEach(i):i(t),this}};ze.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);P.reduceDescriptors(ze.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});P.freezeMethods(ze);const Aw="[REDACTED ****]";function Rw(e){if(P.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(P.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}function Nw(e,t){const n=new Set(t.map(i=>String(i).toLowerCase())),r=[],s=i=>{if(i===null||typeof i!="object"||P.isBuffer(i))return i;if(r.indexOf(i)!==-1)return;i instanceof ze&&(i=i.toJSON()),r.push(i);let o;if(P.isArray(i))o=[],i.forEach((a,c)=>{const d=s(a);P.isUndefined(d)||(o[c]=d)});else{if(!P.isPlainObject(i)&&Rw(i))return r.pop(),i;o=Object.create(null);for(const[a,c]of Object.entries(i)){const d=n.has(a.toLowerCase())?Aw:s(c);P.isUndefined(d)||(o[a]=d)}}return r.pop(),o};return s(e)}let q=class If extends Error{static from(t,n,r,s,i,o){const a=new If(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&&P.hasOwnProp(t,"redact")?t.redact:void 0,r=P.isArray(n)&&n.length>0?Nw(t,n):P.toJSONObject(t);return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:r,code:this.code,status:this.status}}};q.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";q.ERR_BAD_OPTION="ERR_BAD_OPTION";q.ECONNABORTED="ECONNABORTED";q.ETIMEDOUT="ETIMEDOUT";q.ECONNREFUSED="ECONNREFUSED";q.ERR_NETWORK="ERR_NETWORK";q.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";q.ERR_DEPRECATED="ERR_DEPRECATED";q.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";q.ERR_BAD_REQUEST="ERR_BAD_REQUEST";q.ERR_CANCELED="ERR_CANCELED";q.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";q.ERR_INVALID_URL="ERR_INVALID_URL";q.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const Dw=null,Ff=100;function Oo(e){return P.isPlainObject(e)||P.isArray(e)}function Uf(e){return P.endsWith(e,"[]")?e.slice(0,-2):e}function to(e,t,n){return e?e.concat(t).map(function(s,i){return s=Uf(s),!n&&i?"["+s+"]":s}).join(n?".":""):t}function Lw(e){return P.isArray(e)&&!e.some(Oo)}const jw=P.toFlatObject(P,{},null,function(t){return/^is[A-Z]/.test(t)});function Oi(e,t,n){if(!P.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=P.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(v,x){return!P.isUndefined(x[v])});const r=n.metaTokens,s=n.visitor||g,i=n.dots,o=n.indexes,a=n.Blob||typeof Blob<"u"&&Blob,c=n.maxDepth===void 0?Ff:n.maxDepth,d=a&&P.isSpecCompliantForm(t),u=[];if(!P.isFunction(s))throw new TypeError("visitor must be a function");function f(b){if(b===null)return"";if(P.isDate(b))return b.toISOString();if(P.isBoolean(b))return b.toString();if(!d&&P.isBlob(b))throw new q("Blob is not supported. Use a Buffer instead.");return P.isArrayBuffer(b)||P.isTypedArray(b)?d&&typeof Blob=="function"?new Blob([b]):Buffer.from(b):b}function m(b){if(b>c)throw new q("Object is too deeply nested ("+b+" levels). Max depth: "+c,q.ERR_FORM_DATA_DEPTH_EXCEEDED)}function h(b,v){if(c===1/0)return JSON.stringify(b);const x=[];return JSON.stringify(b,function(C,k){if(!P.isObject(k))return k;for(;x.length&&x[x.length-1]!==this;)x.pop();return x.push(k),m(v+x.length-1),k})}function g(b,v,x){let _=b;if(P.isReactNative(t)&&P.isReactNativeBlob(b))return t.append(to(x,v,i),f(b)),!1;if(b&&!x&&typeof b=="object"){if(P.endsWith(v,"{}"))v=r?v:v.slice(0,-2),b=h(b,1);else if(P.isArray(b)&&Lw(b)||(P.isFileList(b)||P.endsWith(v,"[]"))&&(_=P.toArray(b)))return v=Uf(v),_.forEach(function(k,T){!(P.isUndefined(k)||k===null)&&t.append(o===!0?to([v],T,i):o===null?v:v+"[]",f(k))}),!1}return Oo(b)?!0:(t.append(to(x,v,i),f(b)),!1)}const p=Object.assign(jw,{defaultVisitor:g,convertValue:f,isVisitable:Oo});function y(b,v,x=0){if(!P.isUndefined(b)){if(m(x),u.indexOf(b)!==-1)throw new Error("Circular reference detected in "+v.join("."));u.push(b),P.forEach(b,function(C,k){(!(P.isUndefined(C)||C===null)&&s.call(t,C,P.isString(k)?k.trim():k,v,p))===!0&&y(C,v?v.concat(k):[k],x+1)}),u.pop()}}if(!P.isObject(e))throw new TypeError("data must be an object");return y(e),t}function fl(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(r){return t[r]})}function Ya(e,t){this._pairs=[],e&&Oi(e,this,t)}const Bf=Ya.prototype;Bf.append=function(t,n){this._pairs.push([t,n])};Bf.toString=function(t){const n=t?function(r){return t.call(this,r,fl)}:fl;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function Mw(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function $f(e,t,n){if(!t)return e;const r=P.isFunction(n)?{serialize:n}:n,s=P.getSafeProp(r,"encode")||Mw,i=P.getSafeProp(r,"serialize");let o;if(i?o=i(t,r):o=P.isURLSearchParams(t)?t.toString():new Ya(t,r).toString(s),o){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class pl{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){P.forEach(this.handlers,function(r){r!==null&&t(r)})}}const Qa={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},Iw=typeof URLSearchParams<"u"?URLSearchParams:Ya,Fw=typeof FormData<"u"?FormData:null,Uw=typeof Blob<"u"?Blob:null,Bw={isBrowser:!0,classes:{URLSearchParams:Iw,FormData:Fw,Blob:Uw},protocols:["http","https","file","blob","url","data"]},Xa=typeof window<"u"&&typeof document<"u",Ao=typeof navigator=="object"&&navigator||void 0,$w=Xa&&(!Ao||["ReactNative","NativeScript","NS"].indexOf(Ao.product)<0),Vw=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Hw=Xa&&window.location.href||"http://localhost",zw=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Xa,hasStandardBrowserEnv:$w,hasStandardBrowserWebWorkerEnv:Vw,navigator:Ao,origin:Hw},Symbol.toStringTag,{value:"Module"})),Be={...zw,...Bw};function Ww(e,t){return Oi(e,new Be.classes.URLSearchParams,{visitor:function(n,r,s,i){return Be.isNode&&P.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}const hl=Ff;function Vf(e){if(e>hl)throw new q("FormData field is too deeply nested ("+e+" levels). Max depth: "+hl,q.ERR_FORM_DATA_DEPTH_EXCEEDED)}function Gw(e){const t=[],n=/\w+|\[(\w*)]/g;let r;for(;(r=n.exec(e))!==null;)Vf(t.length),t.push(r[0]==="[]"?"":r[1]||r[0]);return t}function qw(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 Hf(e){function t(n,r,s,i){Vf(i);let o=n[i++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),c=i>=n.length;return o=!o&&P.isArray(s)?s.length:o,c?(P.hasOwnProp(s,o)?s[o]=P.isArray(s[o])?s[o].concat(r):[s[o],r]:s[o]=r,!a):((!P.hasOwnProp(s,o)||!P.isObject(s[o]))&&(s[o]=[]),t(n,r,s[o],i)&&P.isArray(s[o])&&(s[o]=qw(s[o])),!a)}if(P.isFormData(e)&&P.isFunction(e.entries)){const n={};return P.forEachEntry(e,(r,s)=>{t(Gw(r),s,n,0)}),n}return null}const zn=(e,t)=>e!=null&&P.hasOwnProp(e,t)?e[t]:void 0;function Kw(e,t,n){if(P.isString(e))try{return(t||JSON.parse)(e),P.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const ss={transitional:Qa,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=P.isObject(t);if(i&&P.isHTMLForm(t)&&(t=new FormData(t)),P.isFormData(t))return s?JSON.stringify(Hf(t)):t;if(P.isArrayBuffer(t)||P.isBuffer(t)||P.isStream(t)||P.isFile(t)||P.isBlob(t)||P.isReadableStream(t))return t;if(P.isArrayBufferView(t))return t.buffer;if(P.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(i){const c=zn(this,"formSerializer");if(r.indexOf("application/x-www-form-urlencoded")>-1)return Ww(t,c).toString();if((a=P.isFileList(t))||r.indexOf("multipart/form-data")>-1){const d=zn(this,"env"),u=d&&d.FormData;return Oi(a?{"files[]":t}:t,u&&new u,c)}}return i||s?(n.setContentType("application/json",!1),Kw(t)):t}],transformResponse:[function(t){const n=zn(this,"transitional")||ss.transitional,r=n&&n.forcedJSONParsing,s=zn(this,"responseType"),i=s==="json";if(P.isResponse(t)||P.isReadableStream(t))return t;if(t&&P.isString(t)&&(r&&!s||i)){const a=!(n&&n.silentJSONParsing)&&i;try{return JSON.parse(t,zn(this,"parseReviver"))}catch(c){if(a)throw c.name==="SyntaxError"?q.from(c,q.ERR_BAD_RESPONSE,this,null,zn(this,"response")):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Be.classes.FormData,Blob:Be.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};P.forEach(["delete","get","head","post","put","patch","query"],e=>{ss.headers[e]={}});function no(e,t){const n=this||ss,r=t||n,s=ze.from(r.headers);let i=r.data;return P.forEach(e,function(a){i=a.call(n,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function zf(e){return!!(e&&e.__CANCEL__)}let is=class extends q{constructor(t,n,r){super(t??"canceled",q.ERR_CANCELED,n,r),this.name="CanceledError",this.__CANCEL__=!0}};function Wf(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new q("Request failed with status code "+n.status,n.status>=400&&n.status<500?q.ERR_BAD_REQUEST:q.ERR_BAD_RESPONSE,n.config,n.request,n))}function Zw(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}function Yw(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(c){const d=Date.now(),u=r[i];o||(o=d),n[s]=c,r[s]=d;let f=i,m=0;for(;f!==s;)m+=n[f++],f=f%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),d-o<t)return;const h=u&&d-u;return h?Math.round(m*1e3/h):void 0}}function Qw(e,t){let n=0,r=1e3/t,s,i;const o=(d,u=Date.now())=>{n=u,s=null,i&&(clearTimeout(i),i=null),e(...d)};return[(...d)=>{const u=Date.now(),f=u-n;f>=r?o(d,u):(s=d,i||(i=setTimeout(()=>{i=null,o(s)},r-f)))},()=>s&&o(s)]}const Xs=(e,t,n=3)=>{let r=0;const s=Yw(50,250);return Qw(i=>{if(!i||typeof i.loaded!="number")return;const o=i.loaded,a=i.lengthComputable?i.total:void 0,c=a!=null?Math.min(o,a):o,d=Math.max(0,c-r),u=s(d);r=Math.max(r,c);const f={loaded:c,total:a,progress:a?c/a:void 0,bytes:d,rate:u||void 0,estimated:u&&a?(a-c)/u:void 0,event:i,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(f)},n)},ml=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},gl=e=>(...t)=>P.asap(()=>e(...t)),Xw=Be.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,Be.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(Be.origin),Be.navigator&&/(msie|trident)/i.test(Be.navigator.userAgent)):()=>!0,Jw=Be.hasStandardBrowserEnv?{write(e,t,n,r,s,i,o){if(typeof document>"u")return;const a=[`${e}=${encodeURIComponent(t)}`];P.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),P.isString(r)&&a.push(`path=${r}`),P.isString(s)&&a.push(`domain=${s}`),i===!0&&a.push("secure"),P.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 e_(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function t_(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}const n_=/^https?:(?!\/\/)/i,r_=/[\t\n\r]/g;function s_(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}function i_(e){return s_(e).replace(r_,"")}function yl(e,t){if(typeof e=="string"&&n_.test(i_(e)))throw new q('Invalid URL: missing "//" after protocol',q.ERR_INVALID_URL,t)}function Gf(e,t,n,r){yl(t,r);let s=!e_(t);return e&&(s||n===!1)?(yl(e,r),t_(e,t)):t}const bl=e=>e instanceof ze?{...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(u,f,m,h){return P.isPlainObject(u)&&P.isPlainObject(f)?P.merge.call({caseless:h},u,f):P.isPlainObject(f)?P.merge({},f):P.isArray(f)?f.slice():f}function s(u,f,m,h){if(P.isUndefined(f)){if(!P.isUndefined(u))return r(void 0,u,m,h)}else return r(u,f,m,h)}function i(u,f){if(!P.isUndefined(f))return r(void 0,f)}function o(u,f){if(P.isUndefined(f)){if(!P.isUndefined(u))return r(void 0,u)}else return r(void 0,f)}function a(u){const f=P.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!P.isUndefined(f))if(P.isPlainObject(f)){if(P.hasOwnProp(f,u))return f[u]}else return;const m=P.hasOwnProp(e,"transitional")?e.transitional:void 0;if(P.isPlainObject(m)&&P.hasOwnProp(m,u))return m[u]}function c(u,f,m){if(P.hasOwnProp(t,m))return r(u,f);if(P.hasOwnProp(e,m))return r(void 0,u)}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:c,headers:(u,f,m)=>s(bl(u),bl(f),m,!0)};return P.forEach(Object.keys({...e,...t}),function(f){if(f==="__proto__"||f==="constructor"||f==="prototype")return;const m=P.hasOwnProp(d,f)?d[f]:s,h=P.hasOwnProp(e,f)?e[f]:void 0,g=P.hasOwnProp(t,f)?t[f]:void 0,p=m(h,g,f);P.isUndefined(p)&&m!==c||(n[f]=p)}),P.hasOwnProp(t,"validateStatus")&&P.isUndefined(t.validateStatus)&&a("validateStatusUndefinedResolves")===!1&&(P.hasOwnProp(e,"validateStatus")?n.validateStatus=r(void 0,e.validateStatus):delete n.validateStatus),n}const o_=["content-type","content-length"];function a_(e,t,n){if(n!=="content-only"){e.set(t);return}Object.entries(t).forEach(([r,s])=>{o_.includes(r.toLowerCase())&&e.set(r,s)})}const c_=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,n)=>String.fromCharCode(parseInt(n,16)));function qf(e){const t=Mn({},e),n=m=>P.hasOwnProp(t,m)?t[m]:void 0,r=n("data");let s=n("withXSRFToken");const i=n("xsrfHeaderName"),o=n("xsrfCookieName");let a=n("headers");const c=n("auth"),d=n("baseURL"),u=n("allowAbsoluteUrls"),f=n("url");if(t.headers=a=ze.from(a),t.url=$f(Gf(d,f,u,t),n("params"),n("paramsSerializer")),c){const m=P.getSafeProp(c,"username")||"",h=P.getSafeProp(c,"password")||"";a.set("Authorization","Basic "+btoa(m+":"+(h?c_(h):"")))}if(P.isFormData(r)&&(Be.hasStandardBrowserEnv||Be.hasStandardBrowserWebWorkerEnv||P.isReactNative(r)?a.setContentType(void 0):P.isFunction(r.getHeaders)&&a_(a,r.getHeaders(),n("formDataHeaderPolicy"))),Be.hasStandardBrowserEnv&&(P.isFunction(s)&&(s=s(t)),s===!0||s==null&&Xw(t.url))){const h=i&&o&&Jw.read(o);h&&a.set(i,h)}return t}const l_=typeof XMLHttpRequest<"u",d_=l_&&function(e){return new Promise(function(n,r){const s=qf(e);let i=s.data;const o=ze.from(s.headers).normalize();let{responseType:a,onUploadProgress:c,onDownloadProgress:d}=s,u,f,m,h,g;function p(){h&&h(),g&&g(),s.cancelToken&&s.cancelToken.unsubscribe(u),s.signal&&s.signal.removeEventListener("abort",u)}let y=new XMLHttpRequest;y.open(s.method.toUpperCase(),s.url,!0),y.timeout=s.timeout;function b(){if(!y)return;const x=ze.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),C={data:!a||a==="text"||a==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:x,config:e,request:y};Wf(function(T){n(T),p()},function(T){r(T),p()},C),y=null}"onloadend"in y?y.onloadend=b:y.onreadystatechange=function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.startsWith("file:"))||setTimeout(b)},y.onabort=function(){y&&(r(new q("Request aborted",q.ECONNABORTED,e,y)),p(),y=null)},y.onerror=function(_){const C=_&&_.message?_.message:"Network Error",k=new q(C,q.ERR_NETWORK,e,y);k.event=_||null,r(k),p(),y=null},y.ontimeout=function(){let _=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const C=s.transitional||Qa;s.timeoutErrorMessage&&(_=s.timeoutErrorMessage),r(new q(_,C.clarifyTimeoutError?q.ETIMEDOUT:q.ECONNABORTED,e,y)),p(),y=null},i===void 0&&o.setContentType(null),"setRequestHeader"in y&&P.forEach(Mf(o),function(_,C){y.setRequestHeader(C,_)}),P.isUndefined(s.withCredentials)||(y.withCredentials=!!s.withCredentials),a&&a!=="json"&&(y.responseType=s.responseType),d&&([m,g]=Xs(d,!0),y.addEventListener("progress",m)),c&&y.upload&&([f,h]=Xs(c),y.upload.addEventListener("progress",f),y.upload.addEventListener("loadend",h)),(s.cancelToken||s.signal)&&(u=x=>{y&&(r(!x||x.type?new is(null,e,y):x),y.abort(),p(),y=null)},s.cancelToken&&s.cancelToken.subscribe(u),s.signal&&(s.signal.aborted?u():s.signal.addEventListener("abort",u)));const v=Zw(s.url);if(v&&!Be.protocols.includes(v)){r(new q("Unsupported protocol "+v+":",q.ERR_BAD_REQUEST,e));return}y.send(i||null)})},u_=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const n=new AbortController;let r=!1;const s=function(c){if(!r){r=!0,o();const d=c instanceof Error?c:this.reason;n.abort(d instanceof q?d:new is(d instanceof Error?d.message:d))}};let i=t&&setTimeout(()=>{i=null,s(new q(`timeout of ${t}ms exceeded`,q.ETIMEDOUT))},t);const o=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(c=>{c.unsubscribe?c.unsubscribe(s):c.removeEventListener("abort",s)}),e=null)};e.forEach(c=>c.addEventListener("abort",s));const{signal:a}=n;return a.unsubscribe=()=>P.asap(o),a},f_=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},p_=async function*(e,t){for await(const n of h_(e))yield*f_(n,t)},h_=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()}},vl=(e,t,n,r)=>{const s=p_(e,t);let i=0,o,a=c=>{o||(o=!0,r&&r(c))};return new ReadableStream({async pull(c){try{const{done:d,value:u}=await s.next();if(d){a(),c.close();return}let f=u.byteLength;if(n){let m=i+=f;n(m)}c.enqueue(new Uint8Array(u))}catch(d){throw a(d),d}},cancel(c){return a(c),s.return()}},{highWaterMark:2})},Js=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,m_=(e,t,n)=>t+2<n&&Js(e.charCodeAt(t+1))&&Js(e.charCodeAt(t+2));function g_(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 g=r.charCodeAt(h+1),p=r.charCodeAt(h+2);Js(g)&&Js(p)&&(o-=2,h+=2)}let c=0,d=a-1;const u=h=>h>=2&&r.charCodeAt(h-2)===37&&r.charCodeAt(h-1)===51&&(r.charCodeAt(h)===68||r.charCodeAt(h)===100);d>=0&&(r.charCodeAt(d)===61?(c++,d--):u(d)&&(c++,d-=3)),c===1&&d>=0&&(r.charCodeAt(d)===61||u(d))&&c++;const m=Math.floor(o/4)*3-(c||0);return m>0?m:0}let i=0;for(let o=0,a=r.length;o<a;o++){const c=r.charCodeAt(o);if(c===37&&m_(r,o,a))i+=1,o+=2;else if(c<128)i+=1;else if(c<2048)i+=2;else if(c>=55296&&c<=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 Ja="1.18.0",wl=64*1024,{isFunction:xs}=P,y_=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,n)=>String.fromCharCode(parseInt(n,16))),_l=e=>{if(!P.isString(e))return e;try{return decodeURIComponent(e)}catch{return e}},xl=(e,...t)=>{try{return!!e(...t)}catch{return!1}},b_=e=>{const t=e.indexOf("://");let n=e;return t!==-1&&(n=n.slice(t+3)),n.includes("@")||n.includes(":")},v_=e=>{const t=P.global!==void 0&&P.global!==null?P.global:globalThis,{ReadableStream:n,TextEncoder:r}=t;e=P.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:s,Request:i,Response:o}=e,a=s?xs(s):typeof fetch=="function",c=xs(i),d=xs(o);if(!a)return!1;const u=a&&xs(n),f=a&&(typeof r=="function"?(b=>v=>b.encode(v))(new r):async b=>new Uint8Array(await new i(b).arrayBuffer())),m=c&&u&&xl(()=>{let b=!1;const v=new i(Be.origin,{body:new n,method:"POST",get duplex(){return b=!0,"half"}}),x=v.headers.has("Content-Type");return v.body!=null&&v.body.cancel(),b&&!x}),h=d&&u&&xl(()=>P.isReadableStream(new o("").body)),g={stream:h&&(b=>b.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(b=>{!g[b]&&(g[b]=(v,x)=>{let _=v&&v[b];if(_)return _.call(v);throw new q(`Response type '${b}' is not supported`,q.ERR_NOT_SUPPORT,x)})});const p=async b=>{if(b==null)return 0;if(P.isBlob(b))return b.size;if(P.isSpecCompliantForm(b))return(await new i(Be.origin,{method:"POST",body:b}).arrayBuffer()).byteLength;if(P.isArrayBufferView(b)||P.isArrayBuffer(b))return b.byteLength;if(P.isURLSearchParams(b)&&(b=b+""),P.isString(b))return(await f(b)).byteLength},y=async(b,v)=>{const x=P.toFiniteNumber(b.getContentLength());return x??p(v)};return async b=>{let{url:v,method:x,data:_,signal:C,cancelToken:k,timeout:T,onDownloadProgress:R,onUploadProgress:A,responseType:O,headers:D,withCredentials:L="same-origin",fetchOptions:B,maxContentLength:U,maxBodyLength:z}=qf(b);const F=P.isNumber(U)&&U>-1,I=P.isNumber(z)&&z>-1,N=Q=>P.hasOwnProp(b,Q)?b[Q]:void 0;let M=s||fetch;O=O?(O+"").toLowerCase():"text";let $=u_([C,k&&k.toAbortSignal()],T),j=null;const se=$&&$.unsubscribe&&(()=>{$.unsubscribe()});let re,ye=null;const H=()=>new q("Request body larger than maxBodyLength limit",q.ERR_BAD_REQUEST,b,j);try{let Q;const K=N("auth");if(K){const X=P.getSafeProp(K,"username")||"",Te=P.getSafeProp(K,"password")||"";Q={username:X,password:Te}}if(b_(v)){const X=new URL(v,Be.origin);if(!Q&&(X.username||X.password)){const Te=_l(X.username),Fe=_l(X.password);Q={username:Te,password:Fe}}(X.username||X.password)&&(X.username="",X.password="",v=X.href)}if(Q&&(D.delete("authorization"),D.set("Authorization","Basic "+btoa(y_((Q.username||"")+":"+(Q.password||""))))),F&&typeof v=="string"&&v.startsWith("data:")&&g_(v)>U)throw new q("maxContentLength size of "+U+" exceeded",q.ERR_BAD_RESPONSE,b,j);if(I&&x!=="get"&&x!=="head"){const X=await p(_);if(typeof X=="number"&&isFinite(X)&&(re=X,X>z))throw H()}const ce=I&&(P.isReadableStream(_)||P.isStream(_)),we=(X,Te,Fe)=>vl(X,wl,Qe=>{if(I&&Qe>z)throw ye=H();Te&&Te(Qe)},Fe);if(m&&x!=="get"&&x!=="head"&&(A||ce)){if(re=re??await y(D,_),re!==0||ce){let X=new i(v,{method:"POST",body:_,duplex:"half"}),Te;if(P.isFormData(_)&&(Te=X.headers.get("content-type"))&&D.setContentType(Te),X.body){const[Fe,Qe]=A&&ml(re,Xs(gl(A)))||[];_=we(X.body,Fe,Qe)}}}else if(ce&&!c&&u&&x!=="get"&&x!=="head")_=we(_);else if(ce&&c&&!m&&x!=="get"&&x!=="head")throw new q("Stream request bodies are not supported by the current fetch implementation",q.ERR_NOT_SUPPORT,b,j);P.isString(L)||(L=L?"include":"omit");const le=c&&"credentials"in i.prototype;if(P.isFormData(_)){const X=D.getContentType();X&&/^multipart\/form-data/i.test(X)&&!/boundary=/i.test(X)&&D.delete("content-type")}D.set("User-Agent","axios/"+Ja,!1);const de={...B,signal:$,method:x.toUpperCase(),headers:Mf(D.normalize()),body:_,duplex:"half",credentials:le?L:void 0};j=c&&new i(v,de);let ne=await(c?M(j,B):M(v,de));const je=ze.from(ne.headers);if(F){const X=P.toFiniteNumber(je.getContentLength());if(X!=null&&X>U)throw new q("maxContentLength size of "+U+" exceeded",q.ERR_BAD_RESPONSE,b,j)}const Re=h&&(O==="stream"||O==="response");if(h&&ne.body&&(R||F||Re&&se)){const X={};["status","statusText","headers"].forEach($e=>{X[$e]=ne[$e]});const Te=P.toFiniteNumber(je.getContentLength()),[Fe,Qe]=R&&ml(Te,Xs(gl(R),!0))||[];let ct=0;const te=$e=>{if(F&&(ct=$e,ct>U))throw new q("maxContentLength size of "+U+" exceeded",q.ERR_BAD_RESPONSE,b,j);Fe&&Fe($e)};ne=new o(vl(ne.body,wl,te,()=>{Qe&&Qe(),se&&se()}),X)}O=O||"text";let Oe=await g[P.findKey(g,O)||"text"](ne,b);if(F&&!h&&!Re){let X;if(Oe!=null&&(typeof Oe.byteLength=="number"?X=Oe.byteLength:typeof Oe.size=="number"?X=Oe.size:typeof Oe=="string"&&(X=typeof r=="function"?new r().encode(Oe).byteLength:Oe.length)),typeof X=="number"&&X>U)throw new q("maxContentLength size of "+U+" exceeded",q.ERR_BAD_RESPONSE,b,j)}return!Re&&se&&se(),await new Promise((X,Te)=>{Wf(X,Te,{data:Oe,headers:ze.from(ne.headers),status:ne.status,statusText:ne.statusText,config:b,request:j})})}catch(Q){if(se&&se(),$&&$.aborted&&$.reason instanceof q){const K=$.reason;throw K.config=b,j&&(K.request=j),Q!==K&&(K.cause=Q),K}throw ye?(j&&!ye.request&&(ye.request=j),ye):Q instanceof q?(j&&!Q.request&&(Q.request=j),Q):Q&&Q.name==="TypeError"&&/Load failed|fetch/i.test(Q.message)?Object.assign(new q("Network Error",q.ERR_NETWORK,b,j,Q&&Q.response),{cause:Q.cause||Q}):q.from(Q,Q&&Q.code,b,j,Q&&Q.response)}}},w_=new Map,Kf=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,i=[r,s,n];let o=i.length,a=o,c,d,u=w_;for(;a--;)c=i[a],d=u.get(c),d===void 0&&u.set(c,d=a?new Map:v_(t)),u=d;return d};Kf();const ec={http:Dw,xhr:d_,fetch:{get:Kf}};P.forEach(ec,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const Sl=e=>`- ${e}`,__=e=>P.isFunction(e)||e===null||e===!1;function x_(e,t){e=P.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,!__(r)&&(s=ec[(a=String(r)).toLowerCase()],s===void 0))throw new q(`Unknown adapter '${a}'`);if(s&&(P.isFunction(s)||(s=s.get(t))))break;i[a||"#"+o]=s}if(!s){const o=Object.entries(i).map(([c,d])=>`adapter ${c} `+(d===!1?"is not supported by the environment":"is not available in the build"));let a=n?o.length>1?`since :
76
- `+o.map(Sl).join(`
77
- `):" "+Sl(o[0]):"as no adapter specified";throw new q("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return s}const Zf={getAdapter:x_,adapters:ec};function ro(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new is(null,e)}function Cl(e){return ro(e),e.headers=ze.from(e.headers),e.data=no.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Zf.getAdapter(e.adapter||ss.adapter,e)(e).then(function(r){ro(e),e.response=r;try{r.data=no.call(e,e.transformResponse,r)}finally{delete e.response}return r.headers=ze.from(r.headers),r},function(r){if(!zf(r)&&(ro(e),r&&r.response)){e.response=r.response;try{r.response.data=no.call(e,e.transformResponse,r.response)}finally{delete e.response}r.response.headers=ze.from(r.response.headers)}return Promise.reject(r)})}const Ai={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Ai[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const El={};Ai.transitional=function(t,n,r){function s(i,o){return"[Axios v"+Ja+"] Transitional option '"+i+"'"+o+(r?". "+r:"")}return(i,o,a)=>{if(t===!1)throw new q(s(o," has been removed"+(n?" in "+n:"")),q.ERR_DEPRECATED);return n&&!El[o]&&(El[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}};Ai.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function S_(e,t,n){if(typeof e!="object")throw new q("options must be an object",q.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],c=a===void 0||o(a,i,e);if(c!==!0)throw new q("option "+i+" must be "+c,q.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new q("Unknown option "+i,q.ERR_BAD_OPTION)}}const Ms={assertOptions:S_,validators:Ai},Ve=Ms.validators;let An=class{constructor(t){this.defaults=t||{},this.interceptors={request:new pl,response:new pl}}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(`
73
+ */var nl;function iv(){return nl||(nl=1,process.env.NODE_ENV!=="production"&&(function(){function e(d,u){return d===u&&(d!==0||1/d===1/u)||d!==d&&u!==u}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=S,n=Sf(),r=typeof Object.is=="function"?Object.is:e,s=n.useSyncExternalStore,i=t.useRef,o=t.useEffect,a=t.useMemo,c=t.useDebugValue;Ji.useSyncExternalStoreWithSelector=function(d,u,f,m,p){var g=i(null);if(g.current===null){var h={hasValue:!1,value:null};g.current=h}else h=g.current;g=a(function(){function b(k){if(!v){if(v=!0,x=k,k=m(k),p!==void 0&&h.hasValue){var T=h.value;if(p(T,k))return _=T}return _=k}if(T=_,r(x,k))return T;var A=m(k);return p!==void 0&&p(T,A)?(x=k,T):(x=k,_=A)}var v=!1,x,_,C=f===void 0?null:f;return[function(){return b(u())},C===null?void 0:function(){return b(C())}]},[u,f,m,p]);var y=s(d,g[0],g[1]);return o(function(){h.hasValue=!0,h.value=y},[y]),c(y),y},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Ji}var rl;function ov(){return rl||(rl=1,process.env.NODE_ENV==="production"?ws.exports=sv():ws.exports=iv()),ws.exports}var av=ov();const cv=tv(av),Cf={},{useDebugValue:lv}=S,{useSyncExternalStoreWithSelector:dv}=cv;let sl=!1;const uv=e=>e;function fv(e,t=uv,n){(Cf?"production":void 0)!=="production"&&n&&!sl&&(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"),sl=!0);const r=dv(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return lv(r),r}const il=e=>{(Cf?"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"?ev(e):e,n=(r,s)=>fv(t,r,s);return Object.assign(n,t),n},ki=e=>e?il(e):il,ol={source:null,entryPrice:null,stopLoss:"",takeProfit:"",side:null,showEntryLine:!1,volumeLots:.01,digits:2,priceStep:.01},ie=ki(e=>({...ol,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}),clearDraft:()=>e({...ol})}));function eo(e,t){return e.toFixed(t)}function hv({symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:s,minVolumeLots:i,isSubmitting:o,isAccountsLoading:a,selectedLogin:c,isDragging:d,scanResultUrl:u,onDragHandlePointerDown:f,onExpandedChange:m,onExpand:p,onPlaceOrder:g}){const[h,y]=S.useState(String(r)),[b,v]=S.useState(null),[x,_]=S.useState(u),C=ie(D=>D.setOrderSide),k=ie(D=>D.setVolumeLots);u!==x&&(_(u),v(null));const T=b??!!u;S.useEffect(()=>{m()},[T,m]);const A=()=>{const D=!T;D&&p(),v(D)},N=Number(Bt($t(e))),O=t!==null?Ce(t,N):"—",L=n!==null?Ce(n,N):"—",$=!o&&!a&&c!==""&&(t!==null&&n!==null),j=D=>{const U=Number(h),K=Number.isFinite(U)&&U>0?U:r,M=Math.max(i,K+D*s),le=eo(M,2);y(le),k(M)},H=()=>{const D=Number(h);if(!Number.isFinite(D)||D<=0){y(eo(r,2)),k(r);return}const U=Math.max(i,D),K=eo(U,2);y(K),k(U)},F=D=>{t===null||n===null||C({side:D,entryPrice:D==="buy"?n:t})},I=D=>{if(t===null||n===null||!c)return;const U=Number(h),K=Math.max(i,Number.isFinite(U)&&U>0?U:r);C({side:D,entryPrice:D==="buy"?n:t}),g({login:c,side:D,volumeLots:K,bid:t,ask:n})};return l.jsx("div",{className:`web-trading-widget-mini-order${T?" web-trading-widget-mini-order--expanded":" web-trading-widget-mini-order--collapsed"}`,children:l.jsxs("div",{className:"web-trading-widget-mini-order__row",children:[l.jsx("button",{type:"button","aria-label":"Move quick order panel",onPointerDown:f,className:`web-trading-widget-mini-order__drag-handle${d?" web-trading-widget-mini-order__drag-handle--grabbing":""}`,children:l.jsx(gf,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2})}),T?l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button",disabled:!$,className:"web-trading-widget-mini-order__side-btn web-trading-widget-mini-order__side-btn--sell",onMouseDown:()=>F("sell"),onClick:()=>I("sell"),children:[l.jsx("span",{className:"web-trading-widget-mini-order__price",children:O}),l.jsx("span",{className:"web-trading-widget-mini-order__label web-trading-widget-mini-order__label--sell",children:"SELL"})]}),l.jsxs("div",{className:"web-trading-widget-mini-order__volume",children:[l.jsx("button",{type:"button","aria-label":"Decrease volume",disabled:!$,className:"web-trading-widget-mini-order__volume-btn",onClick:()=>j(-1),children:l.jsx(Ys,{className:"web-trading-widget-icon web-trading-widget-icon--xs",strokeWidth:2.5})}),l.jsx("input",{type:"text",inputMode:"decimal",value:h,disabled:!$,onChange:D=>y(D.target.value),onBlur:H,className:"web-trading-widget-mini-order__volume-input"}),l.jsx("button",{type:"button","aria-label":"Increase volume",disabled:!$,className:"web-trading-widget-mini-order__volume-btn",onClick:()=>j(1),children:l.jsx(Po,{className:"web-trading-widget-icon web-trading-widget-icon--xs",strokeWidth:2.5})})]}),l.jsxs("button",{type:"button",disabled:!$,className:"web-trading-widget-mini-order__side-btn web-trading-widget-mini-order__side-btn--buy",onMouseDown:()=>F("buy"),onClick:()=>I("buy"),children:[l.jsx("span",{className:"web-trading-widget-mini-order__label web-trading-widget-mini-order__label--buy",children:"BUY"}),l.jsx("span",{className:"web-trading-widget-mini-order__price",children:L})]})]}):null,l.jsx("button",{type:"button","aria-label":T?"Collapse quick order panel":"Expand quick order panel","aria-expanded":T,className:"web-trading-widget-mini-order__toggle",onClick:A,children:T?l.jsx(Mb,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2.5}):l.jsx(Ib,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2.5})})]})})}const pv="web-trading-widget-mini-exec-panel-position",Ef={x:56,y:96};function al(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 cl(e,t){e.style.left=`${t.x}px`,e.style.top=`${t.y}px`}function mv(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):Ef.x,y:16}}function gv(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 ll(e,t){try{e.hasPointerCapture(t)&&e.releasePointerCapture(t)}catch{}}function Tf(e){const t=(e==null?void 0:e.storageKey)??pv,n=(e==null?void 0:e.defaultPosition)??Ef,r=e==null?void 0:e.defaultAlign,s=(e==null?void 0:e.isActive)??!0,i=S.useRef(null),[o,a]=S.useState(n),[c,d]=S.useState(!1),u=S.useRef(n),f=S.useRef(null);S.useEffect(()=>{u.current=o},[o]);const m=S.useCallback(h=>{const y=i.current,b=al(h,y);u.current=b,a(b),y&&cl(y,b)},[]),p=S.useCallback(()=>{m(u.current)},[m]);S.useEffect(()=>{if(!s)return;const h=gv(t);if(h){m(h);return}const y=r?mv(r,i.current):null;m(y??u.current)},[m,r,s,t]);const g=S.useCallback(h=>{h.preventDefault(),h.stopPropagation();const y=h.currentTarget,b=i.current;if(!b)return;const v=h.pointerId;y.setPointerCapture(v);const x=h.clientX,_=h.clientY,C=u.current;d(!0),document.body.style.cursor="grabbing",document.body.style.userSelect="none";const k=(N,O)=>{const L=al({x:C.x+(N-x),y:C.y+(O-_)},b);u.current=L,cl(b,L)},T=N=>{if(N.pointerId===v){ll(y,v),y.removeEventListener("pointermove",A),y.removeEventListener("pointerup",T),y.removeEventListener("pointercancel",T),f.current=null,d(!1),a(u.current),document.body.style.cursor="",document.body.style.userSelect="";try{window.localStorage.setItem(t,JSON.stringify(u.current))}catch{}}},A=N=>{N.pointerId===v&&(N.preventDefault(),k(N.clientX,N.clientY))};y.addEventListener("pointermove",A),y.addEventListener("pointerup",T),y.addEventListener("pointercancel",T),f.current=()=>{ll(y,v),y.removeEventListener("pointermove",A),y.removeEventListener("pointerup",T),y.removeEventListener("pointercancel",T),document.body.style.cursor="",document.body.style.userSelect="",d(!1)}},[t]);return S.useEffect(()=>{const h=()=>{m(u.current)};return window.addEventListener("resize",h),()=>{var y;window.removeEventListener("resize",h),(y=f.current)==null||y.call(f),f.current=null,document.body.style.cursor="",document.body.style.userSelect=""}},[m]),{panelRef:i,position:o,isDragging:c,onDragStart:g,reclamp:p}}const Pf=200,yv=201,bv=203,vv=204,kf=0,wv=2,Of=0;function Oi(e){const t=Number(e.trim());if(!Number.isFinite(t))throw new Error("Invalid trading account login.");return t}function qa(e){return Math.round(e*1e4)}function _v(e){return e>=2&&e<=7}function xv(e){return{Action:vv,Order:Number(e.orderTicket),Login:Oi(e.login),Symbol:e.symbol.replace(/m$/i,""),Type:e.orderType}}function Sv(e){return{Action:bv,Order:Number(e.orderTicket),Login:Oi(e.login),Symbol:e.symbol.replace(/m$/i,""),Type:e.orderType,Volume:qa(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 Cv(e){const t=e.positionSide==="buy"?1:0;return{Action:Pf,Login:Oi(e.login),Symbol:e.symbol.replace(/m$/i,""),Type:t,TypeFill:kf,Volume:qa(e.volumeLots),Digits:e.digits,TypeTime:Of,Comment:e.comment??"",Position:Number(e.positionTicket)}}function Ev(e){const t=!_v(e.orderType);return{Action:t?Pf:yv,Login:Oi(e.login),Symbol:e.symbol,Type:e.orderType,TypeFill:t?kf:wv,Volume:qa(e.volumeLots),Digits:e.digits,TypeTime:e.typeTime??Of,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 Tv(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 Pv=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 kv(e){const t=Dt(e);return t===void 0?.01:t/1e4}function Ov(e){var t;return(t=e.find(n=>n.answer))==null?void 0:t.answer}function Av(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 Ls(e){return Pv.has(e)}function xs(e,t){var v,x,_;if(!e||typeof e!="object")return null;const r=e.data;if(!(r!=null&&r.length))return null;const s=Ov(r),{retcode:i,price:o}=Av(r),a=Ls(i),c=(s==null?void 0:s.ResultDeal)||(s==null?void 0:s.ResultOrder)||(s==null?void 0:s.Order),d=((v=s==null?void 0:s.Symbol)==null?void 0:v.trim())||t.symbol,u=Ye(d),f=Dt(s==null?void 0:s.Type),m=f!==void 0?f%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),h=Dt(s==null?void 0:s.ResultMarketAsk),y=m==="buy"?g??p:h??p,b=Hb(u);return{ticket:String(c||Math.floor(Date.now()/1e3)),login:((x=s==null?void 0:s.Login)==null?void 0:x.trim())||t.login,symbol:u,displaySymbol:Si(u),side:m,volumeLots:kv(s==null?void 0:s.Volume)||t.volumeLots,openPrice:p,currentPrice:y,stopLoss:Dt(s==null?void 0:s.PriceSL),takeProfit:Dt(s==null?void 0:s.PriceTP),comment:((_=s==null?void 0:s.Comment)==null?void 0:_.trim())||t.comment,digits:Math.round(b),retcode:i,isSuccess:a,marketBid:g,marketAsk:h}}function Nv(e){return e.type==="buy"?e.marketBid??e.currentPrice:e.marketAsk??e.currentPrice}function Rv(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=Ti(n.symbolTicker,t),o=Number(Bt($t(n.symbolTicker,t))),a=Ei(n.executionMode),c=za(n.orderType),d=n.typeTime;if(!a&&n.priceOrder===void 0)return{success:!1,message:c?"Please set a limit price for this order.":"Please set an order price for pending orders."};if(c&&n.priceTrigger===void 0)return{success:!1,message:"Please set a stop price for stop limit orders."};if(!a&&!Pi(d,n.expirationDateTime??"",n.expirationDay??""))return{success:!1,message:"Please set an expiration date for this order."};const u=a?n.side==="buy"?n.ask:n.bid:n.priceOrder??(n.side==="buy"?n.ask:n.bid),f=a?void 0:xf(d,n.expirationDateTime??"",n.expirationDay??"");try{const m=Ev({login:r,symbol:i,volumeLots:s,orderType:n.orderType,digits:o,comment:n.comment.trim(),priceOrder:Ha(n.orderType)?n.priceOrder:void 0,priceTrigger:c?n.priceTrigger:void 0,priceSL:n.stopLoss,priceTP:n.takeProfit,typeTime:a?void 0:d,timeExpiration:f}),p=await e.sendRequest(m),g=xs(p,{login:r,symbol:i,side:Xs(n.orderType),volumeLots:s,openPrice:u,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(m){return{success:!1,message:m instanceof Error?m.message:"Failed to place order."}}},async closePosition(n){try{const r=Nv(n),s=Cv({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=xs(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&&!Ls(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=xv({login:n.login,orderTicket:n.ticket,symbol:n.symbol,orderType:n.orderType}),s=await e.sendRequest(r),i=xs(s,{login:n.login,symbol:n.symbol,side:n.side,volumeLots:n.volumeLots,openPrice:n.orderPrice,digits:n.digits,comment:n.comment});return i&&!Ls(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=Sv({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=xs(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&&!Ls(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."}}}}}function Af(e,t){return function(){return e.apply(t,arguments)}}const{toString:Dv}=Object.prototype,{getPrototypeOf:pr}=Object,{iterator:rs,toStringTag:Nf}=Symbol,Js=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Hr=(e,t)=>{let n=e;const r=[];for(;n!=null&&n!==Object.prototype;){if(r.indexOf(n)!==-1)return!1;if(r.push(n),Js(n,t))return!0;n=pr(n)}return!1},Lv=(e,t)=>e!=null&&Hr(e,t)?e[t]:void 0,Za=(e=>t=>{const n=Dv.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),bt=e=>(e=e.toLowerCase(),t=>Za(t)===e),Ai=e=>t=>typeof t===e,{isArray:jn}=Array,mr=Ai("undefined");function Tr(e){return e!==null&&!mr(e)&&e.constructor!==null&&!mr(e.constructor)&&Ze(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Rf=bt("ArrayBuffer");function jv(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Rf(e.buffer),t}const Mv=Ai("string"),Ze=Ai("function"),Df=Ai("number"),Pr=e=>e!==null&&typeof e=="object",Iv=e=>e===!0||e===!1,js=e=>{if(!Pr(e))return!1;const t=pr(e);return(t===null||t===Object.prototype||pr(t)===null)&&!Hr(e,Nf)&&!Hr(e,rs)},Uv=e=>{if(!Pr(e)||Tr(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Fv=bt("Date"),Bv=bt("File"),$v=e=>!!(e&&typeof e.uri<"u"),Vv=e=>e&&typeof e.getParts<"u",Hv=bt("Blob"),zv=bt("FileList"),Wv=e=>Pr(e)&&Ze(e.pipe);function Gv(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const dl=Gv(),ul=typeof dl.FormData<"u"?dl.FormData:void 0,Kv=e=>{if(!e)return!1;if(ul&&e instanceof ul)return!0;const t=pr(e);if(!t||t===Object.prototype||!Ze(e.append))return!1;const n=Za(e);return n==="formdata"||n==="object"&&Ze(e.toString)&&e.toString()==="[object FormData]"},qv=bt("URLSearchParams"),[Zv,Yv,Qv,Xv]=["ReadableStream","Request","Response","Headers"].map(bt),Jv=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ss(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),jn(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(Tr(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 Lf(e,t){if(Tr(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 bn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,jf=e=>!mr(e)&&e!==bn;function Oo(...e){const{caseless:t,skipUndefined:n}=jf(this)&&this||{},r={},s=(i,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const a=t&&typeof o=="string"&&Lf(r,o)||o,c=Js(r,a)?r[a]:void 0;js(c)&&js(i)?r[a]=Oo(c,i):js(i)?r[a]=Oo({},i):jn(i)?r[a]=i.slice():(!n||!mr(i))&&(r[a]=i)};for(let i=0,o=e.length;i<o;i++){const a=e[i];if(!a||Tr(a)||(ss(a,s),typeof a!="object"||jn(a)))continue;const c=Object.getOwnPropertySymbols(a);for(let d=0;d<c.length;d++){const u=c[d];uw.call(a,u)&&s(a[u],u)}}return r}const ew=(e,t,n,{allOwnKeys:r}={})=>(ss(t,(s,i)=>{n&&Ze(s)?Object.defineProperty(e,i,{__proto__:null,value:Af(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),tw=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),nw=(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)},rw=(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&&pr(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},sw=(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},iw=e=>{if(!e)return null;if(jn(e))return e;let t=e.length;if(!Df(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},ow=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&pr(Uint8Array)),aw=(e,t)=>{const r=(e&&e[rs]).call(e);let s;for(;(s=r.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},cw=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},lw=bt("HTMLFormElement"),dw=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),{propertyIsEnumerable:uw}=Object.prototype,fw=bt("RegExp"),Mf=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};ss(n,(s,i)=>{let o;(o=t(s,i,e))!==!1&&(r[i]=o||s)}),Object.defineProperties(e,r)},hw=e=>{Mf(e,(t,n)=>{if(Ze(e)&&["arguments","caller","callee"].includes(n))return!1;const r=e[n];if(Ze(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},pw=(e,t)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return jn(e)?r(e):r(String(e).split(t)),n},mw=()=>{},gw=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function yw(e){return!!(e&&Ze(e.append)&&e[Nf]==="FormData"&&e[rs])}const bw=e=>{const t=new WeakSet,n=r=>{if(Pr(r)){if(t.has(r))return;if(Tr(r))return r;if(!("toJSON"in r)){t.add(r);const s=jn(r)?[]:{};return ss(r,(i,o)=>{const a=n(i);!mr(a)&&(s[o]=a)}),t.delete(r),s}}return r};return n(e)},vw=bt("AsyncFunction"),ww=e=>e&&(Pr(e)||Ze(e))&&Ze(e.then)&&Ze(e.catch),If=((e,t)=>e?setImmediate:t?((n,r)=>(bn.addEventListener("message",({source:s,data:i})=>{s===bn&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),bn.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Ze(bn.postMessage)),_w=typeof queueMicrotask<"u"?queueMicrotask.bind(bn):typeof process<"u"&&process.nextTick||If,Uf=e=>e!=null&&Ze(e[rs]),xw=e=>e!=null&&Hr(e,rs)&&Uf(e),P={isArray:jn,isArrayBuffer:Rf,isBuffer:Tr,isFormData:Kv,isArrayBufferView:jv,isString:Mv,isNumber:Df,isBoolean:Iv,isObject:Pr,isPlainObject:js,isEmptyObject:Uv,isReadableStream:Zv,isRequest:Yv,isResponse:Qv,isHeaders:Xv,isUndefined:mr,isDate:Fv,isFile:Bv,isReactNativeBlob:$v,isReactNative:Vv,isBlob:Hv,isRegExp:fw,isFunction:Ze,isStream:Wv,isURLSearchParams:qv,isTypedArray:ow,isFileList:zv,forEach:ss,merge:Oo,extend:ew,trim:Jv,stripBOM:tw,inherits:nw,toFlatObject:rw,kindOf:Za,kindOfTest:bt,endsWith:sw,toArray:iw,forEachEntry:aw,matchAll:cw,isHTMLForm:lw,hasOwnProperty:Js,hasOwnProp:Js,hasOwnInPrototypeChain:Hr,getSafeProp:Lv,reduceDescriptors:Mf,freezeMethods:hw,toObjectSet:pw,toCamelCase:dw,noop:mw,toFiniteNumber:gw,findKey:Lf,global:bn,isContextDefined:jf,isSpecCompliantForm:yw,toJSONObject:bw,isAsyncFn:vw,isThenable:ww,setImmediate:If,asap:_w,isIterable:Uf,isSafeIterable:xw},Sw=P.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"]),Cw=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]&&Sw[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t};function Ew(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 Tw=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),Pw=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function Ya(e,t){return P.isArray(e)?e.map(n=>Ya(n,t)):Ew(String(e).replace(t,""))}const kw=e=>Ya(e,Tw),Ow=e=>Ya(e,Pw);function Ff(e){const t=Object.create(null);return P.forEach(e.toJSON(),(n,r)=>{t[r]=Ow(n)}),t}const fl=Symbol("internals");function Rr(e){return e&&String(e).trim().toLowerCase()}function Ms(e){return e===!1||e==null?e:P.isArray(e)?e.map(Ms):kw(String(e))}function Aw(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 Nw=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function to(e,t,n,r,s){if(P.isFunction(r))return r.call(this,t,n);if(s&&(t=n),!!P.isString(t)){if(P.isString(r))return t.indexOf(r)!==-1;if(P.isRegExp(r))return r.test(t)}}function Rw(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function Dw(e,t){const n=P.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 ze=class{constructor(t){t&&this.set(t)}set(t,n,r){const s=this;function i(a,c,d){const u=Rr(c);if(!u)return;const f=P.findKey(s,u);(!f||s[f]===void 0||d===!0||d===void 0&&s[f]!==!1)&&(s[f||c]=Ms(a))}const o=(a,c)=>P.forEach(a,(d,u)=>i(d,u,c));if(P.isPlainObject(t)||t instanceof this.constructor)o(t,n);else if(P.isString(t)&&(t=t.trim())&&!Nw(t))o(Cw(t),n);else if(P.isObject(t)&&P.isSafeIterable(t)){let a=Object.create(null),c,d;for(const u of t){if(!P.isArray(u))throw new TypeError("Object iterator must return a key-value pair");d=u[0],P.hasOwnProp(a,d)?(c=a[d],a[d]=P.isArray(c)?[...c,u[1]]:[c,u[1]]):a[d]=u[1]}o(a,n)}else t!=null&&i(n,t,r);return this}get(t,n){if(t=Rr(t),t){const r=P.findKey(this,t);if(r){const s=this[r];if(!n)return s;if(n===!0)return Aw(s);if(P.isFunction(n))return n.call(this,s,r);if(P.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=Rr(t),t){const r=P.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||to(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let s=!1;function i(o){if(o=Rr(o),o){const a=P.findKey(r,o);a&&(!n||to(r,r[a],a,n))&&(delete r[a],s=!0)}}return P.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||to(this,this[i],i,t,!0))&&(delete this[i],s=!0)}return s}normalize(t){const n=this,r={};return P.forEach(this,(s,i)=>{const o=P.findKey(r,i);if(o){n[o]=Ms(s),delete n[i];return}const a=t?Rw(i):String(i).trim();a!==i&&delete n[i],n[a]=Ms(s),r[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return P.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=t&&P.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[fl]=this[fl]={accessors:{}}).accessors,s=this.prototype;function i(o){const a=Rr(o);r[a]||(Dw(s,o),r[a]=!0)}return P.isArray(t)?t.forEach(i):i(t),this}};ze.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);P.reduceDescriptors(ze.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});P.freezeMethods(ze);const Lw="[REDACTED ****]";function jw(e){if(P.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(P.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}function Mw(e,t){const n=new Set(t.map(i=>String(i).toLowerCase())),r=[],s=i=>{if(i===null||typeof i!="object"||P.isBuffer(i))return i;if(r.indexOf(i)!==-1)return;i instanceof ze&&(i=i.toJSON()),r.push(i);let o;if(P.isArray(i))o=[],i.forEach((a,c)=>{const d=s(a);P.isUndefined(d)||(o[c]=d)});else{if(!P.isPlainObject(i)&&jw(i))return r.pop(),i;o=Object.create(null);for(const[a,c]of Object.entries(i)){const d=n.has(a.toLowerCase())?Lw:s(c);P.isUndefined(d)||(o[a]=d)}}return r.pop(),o};return s(e)}let G=class Bf extends Error{static from(t,n,r,s,i,o){const a=new Bf(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&&P.hasOwnProp(t,"redact")?t.redact:void 0,r=P.isArray(n)&&n.length>0?Mw(t,n):P.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}}};G.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";G.ERR_BAD_OPTION="ERR_BAD_OPTION";G.ECONNABORTED="ECONNABORTED";G.ETIMEDOUT="ETIMEDOUT";G.ECONNREFUSED="ECONNREFUSED";G.ERR_NETWORK="ERR_NETWORK";G.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";G.ERR_DEPRECATED="ERR_DEPRECATED";G.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";G.ERR_BAD_REQUEST="ERR_BAD_REQUEST";G.ERR_CANCELED="ERR_CANCELED";G.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";G.ERR_INVALID_URL="ERR_INVALID_URL";G.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const Iw=null,$f=100;function Ao(e){return P.isPlainObject(e)||P.isArray(e)}function Vf(e){return P.endsWith(e,"[]")?e.slice(0,-2):e}function no(e,t,n){return e?e.concat(t).map(function(s,i){return s=Vf(s),!n&&i?"["+s+"]":s}).join(n?".":""):t}function Uw(e){return P.isArray(e)&&!e.some(Ao)}const Fw=P.toFlatObject(P,{},null,function(t){return/^is[A-Z]/.test(t)});function Ni(e,t,n){if(!P.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=P.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(v,x){return!P.isUndefined(x[v])});const r=n.metaTokens,s=n.visitor||g,i=n.dots,o=n.indexes,a=n.Blob||typeof Blob<"u"&&Blob,c=n.maxDepth===void 0?$f:n.maxDepth,d=a&&P.isSpecCompliantForm(t),u=[];if(!P.isFunction(s))throw new TypeError("visitor must be a function");function f(b){if(b===null)return"";if(P.isDate(b))return b.toISOString();if(P.isBoolean(b))return b.toString();if(!d&&P.isBlob(b))throw new G("Blob is not supported. Use a Buffer instead.");return P.isArrayBuffer(b)||P.isTypedArray(b)?d&&typeof Blob=="function"?new Blob([b]):Buffer.from(b):b}function m(b){if(b>c)throw new G("Object is too deeply nested ("+b+" levels). Max depth: "+c,G.ERR_FORM_DATA_DEPTH_EXCEEDED)}function p(b,v){if(c===1/0)return JSON.stringify(b);const x=[];return JSON.stringify(b,function(C,k){if(!P.isObject(k))return k;for(;x.length&&x[x.length-1]!==this;)x.pop();return x.push(k),m(v+x.length-1),k})}function g(b,v,x){let _=b;if(P.isReactNative(t)&&P.isReactNativeBlob(b))return t.append(no(x,v,i),f(b)),!1;if(b&&!x&&typeof b=="object"){if(P.endsWith(v,"{}"))v=r?v:v.slice(0,-2),b=p(b,1);else if(P.isArray(b)&&Uw(b)||(P.isFileList(b)||P.endsWith(v,"[]"))&&(_=P.toArray(b)))return v=Vf(v),_.forEach(function(k,T){!(P.isUndefined(k)||k===null)&&t.append(o===!0?no([v],T,i):o===null?v:v+"[]",f(k))}),!1}return Ao(b)?!0:(t.append(no(x,v,i),f(b)),!1)}const h=Object.assign(Fw,{defaultVisitor:g,convertValue:f,isVisitable:Ao});function y(b,v,x=0){if(!P.isUndefined(b)){if(m(x),u.indexOf(b)!==-1)throw new Error("Circular reference detected in "+v.join("."));u.push(b),P.forEach(b,function(C,k){(!(P.isUndefined(C)||C===null)&&s.call(t,C,P.isString(k)?k.trim():k,v,h))===!0&&y(C,v?v.concat(k):[k],x+1)}),u.pop()}}if(!P.isObject(e))throw new TypeError("data must be an object");return y(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 Qa(e,t){this._pairs=[],e&&Ni(e,this,t)}const Hf=Qa.prototype;Hf.append=function(t,n){this._pairs.push([t,n])};Hf.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 Bw(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function zf(e,t,n){if(!t)return e;const r=P.isFunction(n)?{serialize:n}:n,s=P.getSafeProp(r,"encode")||Bw,i=P.getSafeProp(r,"serialize");let o;if(i?o=i(t,r):o=P.isURLSearchParams(t)?t.toString():new Qa(t,r).toString(s),o){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class pl{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){P.forEach(this.handlers,function(r){r!==null&&t(r)})}}const Xa={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},$w=typeof URLSearchParams<"u"?URLSearchParams:Qa,Vw=typeof FormData<"u"?FormData:null,Hw=typeof Blob<"u"?Blob:null,zw={isBrowser:!0,classes:{URLSearchParams:$w,FormData:Vw,Blob:Hw},protocols:["http","https","file","blob","url","data"]},Ja=typeof window<"u"&&typeof document<"u",No=typeof navigator=="object"&&navigator||void 0,Ww=Ja&&(!No||["ReactNative","NativeScript","NS"].indexOf(No.product)<0),Gw=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Kw=Ja&&window.location.href||"http://localhost",qw=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Ja,hasStandardBrowserEnv:Ww,hasStandardBrowserWebWorkerEnv:Gw,navigator:No,origin:Kw},Symbol.toStringTag,{value:"Module"})),Be={...qw,...zw};function Zw(e,t){return Ni(e,new Be.classes.URLSearchParams,{visitor:function(n,r,s,i){return Be.isNode&&P.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}const ml=$f;function Wf(e){if(e>ml)throw new G("FormData field is too deeply nested ("+e+" levels). Max depth: "+ml,G.ERR_FORM_DATA_DEPTH_EXCEEDED)}function Yw(e){const t=[],n=/\w+|\[(\w*)]/g;let r;for(;(r=n.exec(e))!==null;)Wf(t.length),t.push(r[0]==="[]"?"":r[1]||r[0]);return t}function Qw(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 Gf(e){function t(n,r,s,i){Wf(i);let o=n[i++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),c=i>=n.length;return o=!o&&P.isArray(s)?s.length:o,c?(P.hasOwnProp(s,o)?s[o]=P.isArray(s[o])?s[o].concat(r):[s[o],r]:s[o]=r,!a):((!P.hasOwnProp(s,o)||!P.isObject(s[o]))&&(s[o]=[]),t(n,r,s[o],i)&&P.isArray(s[o])&&(s[o]=Qw(s[o])),!a)}if(P.isFormData(e)&&P.isFunction(e.entries)){const n={};return P.forEachEntry(e,(r,s)=>{t(Yw(r),s,n,0)}),n}return null}const zn=(e,t)=>e!=null&&P.hasOwnProp(e,t)?e[t]:void 0;function Xw(e,t,n){if(P.isString(e))try{return(t||JSON.parse)(e),P.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const is={transitional:Xa,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=P.isObject(t);if(i&&P.isHTMLForm(t)&&(t=new FormData(t)),P.isFormData(t))return s?JSON.stringify(Gf(t)):t;if(P.isArrayBuffer(t)||P.isBuffer(t)||P.isStream(t)||P.isFile(t)||P.isBlob(t)||P.isReadableStream(t))return t;if(P.isArrayBufferView(t))return t.buffer;if(P.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(i){const c=zn(this,"formSerializer");if(r.indexOf("application/x-www-form-urlencoded")>-1)return Zw(t,c).toString();if((a=P.isFileList(t))||r.indexOf("multipart/form-data")>-1){const d=zn(this,"env"),u=d&&d.FormData;return Ni(a?{"files[]":t}:t,u&&new u,c)}}return i||s?(n.setContentType("application/json",!1),Xw(t)):t}],transformResponse:[function(t){const n=zn(this,"transitional")||is.transitional,r=n&&n.forcedJSONParsing,s=zn(this,"responseType"),i=s==="json";if(P.isResponse(t)||P.isReadableStream(t))return t;if(t&&P.isString(t)&&(r&&!s||i)){const a=!(n&&n.silentJSONParsing)&&i;try{return JSON.parse(t,zn(this,"parseReviver"))}catch(c){if(a)throw c.name==="SyntaxError"?G.from(c,G.ERR_BAD_RESPONSE,this,null,zn(this,"response")):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Be.classes.FormData,Blob:Be.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};P.forEach(["delete","get","head","post","put","patch","query"],e=>{is.headers[e]={}});function ro(e,t){const n=this||is,r=t||n,s=ze.from(r.headers);let i=r.data;return P.forEach(e,function(a){i=a.call(n,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function Kf(e){return!!(e&&e.__CANCEL__)}let os=class extends G{constructor(t,n,r){super(t??"canceled",G.ERR_CANCELED,n,r),this.name="CanceledError",this.__CANCEL__=!0}};function qf(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new G("Request failed with status code "+n.status,n.status>=400&&n.status<500?G.ERR_BAD_REQUEST:G.ERR_BAD_RESPONSE,n.config,n.request,n))}function Jw(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}function e_(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(c){const d=Date.now(),u=r[i];o||(o=d),n[s]=c,r[s]=d;let f=i,m=0;for(;f!==s;)m+=n[f++],f=f%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),d-o<t)return;const p=u&&d-u;return p?Math.round(m*1e3/p):void 0}}function t_(e,t){let n=0,r=1e3/t,s,i;const o=(d,u=Date.now())=>{n=u,s=null,i&&(clearTimeout(i),i=null),e(...d)};return[(...d)=>{const u=Date.now(),f=u-n;f>=r?o(d,u):(s=d,i||(i=setTimeout(()=>{i=null,o(s)},r-f)))},()=>s&&o(s)]}const ei=(e,t,n=3)=>{let r=0;const s=e_(50,250);return t_(i=>{if(!i||typeof i.loaded!="number")return;const o=i.loaded,a=i.lengthComputable?i.total:void 0,c=a!=null?Math.min(o,a):o,d=Math.max(0,c-r),u=s(d);r=Math.max(r,c);const f={loaded:c,total:a,progress:a?c/a:void 0,bytes:d,rate:u||void 0,estimated:u&&a?(a-c)/u:void 0,event:i,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(f)},n)},gl=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},yl=e=>(...t)=>P.asap(()=>e(...t)),n_=Be.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,Be.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(Be.origin),Be.navigator&&/(msie|trident)/i.test(Be.navigator.userAgent)):()=>!0,r_=Be.hasStandardBrowserEnv?{write(e,t,n,r,s,i,o){if(typeof document>"u")return;const a=[`${e}=${encodeURIComponent(t)}`];P.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),P.isString(r)&&a.push(`path=${r}`),P.isString(s)&&a.push(`domain=${s}`),i===!0&&a.push("secure"),P.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 s_(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function i_(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}const o_=/^https?:(?!\/\/)/i,a_=/[\t\n\r]/g;function c_(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}function l_(e){return c_(e).replace(a_,"")}function bl(e,t){if(typeof e=="string"&&o_.test(l_(e)))throw new G('Invalid URL: missing "//" after protocol',G.ERR_INVALID_URL,t)}function Zf(e,t,n,r){bl(t,r);let s=!s_(t);return e&&(s||n===!1)?(bl(e,r),i_(e,t)):t}const vl=e=>e instanceof ze?{...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(u,f,m,p){return P.isPlainObject(u)&&P.isPlainObject(f)?P.merge.call({caseless:p},u,f):P.isPlainObject(f)?P.merge({},f):P.isArray(f)?f.slice():f}function s(u,f,m,p){if(P.isUndefined(f)){if(!P.isUndefined(u))return r(void 0,u,m,p)}else return r(u,f,m,p)}function i(u,f){if(!P.isUndefined(f))return r(void 0,f)}function o(u,f){if(P.isUndefined(f)){if(!P.isUndefined(u))return r(void 0,u)}else return r(void 0,f)}function a(u){const f=P.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!P.isUndefined(f))if(P.isPlainObject(f)){if(P.hasOwnProp(f,u))return f[u]}else return;const m=P.hasOwnProp(e,"transitional")?e.transitional:void 0;if(P.isPlainObject(m)&&P.hasOwnProp(m,u))return m[u]}function c(u,f,m){if(P.hasOwnProp(t,m))return r(u,f);if(P.hasOwnProp(e,m))return r(void 0,u)}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:c,headers:(u,f,m)=>s(vl(u),vl(f),m,!0)};return P.forEach(Object.keys({...e,...t}),function(f){if(f==="__proto__"||f==="constructor"||f==="prototype")return;const m=P.hasOwnProp(d,f)?d[f]:s,p=P.hasOwnProp(e,f)?e[f]:void 0,g=P.hasOwnProp(t,f)?t[f]:void 0,h=m(p,g,f);P.isUndefined(h)&&m!==c||(n[f]=h)}),P.hasOwnProp(t,"validateStatus")&&P.isUndefined(t.validateStatus)&&a("validateStatusUndefinedResolves")===!1&&(P.hasOwnProp(e,"validateStatus")?n.validateStatus=r(void 0,e.validateStatus):delete n.validateStatus),n}const d_=["content-type","content-length"];function u_(e,t,n){if(n!=="content-only"){e.set(t);return}Object.entries(t).forEach(([r,s])=>{d_.includes(r.toLowerCase())&&e.set(r,s)})}const f_=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,n)=>String.fromCharCode(parseInt(n,16)));function Yf(e){const t=Mn({},e),n=m=>P.hasOwnProp(t,m)?t[m]:void 0,r=n("data");let s=n("withXSRFToken");const i=n("xsrfHeaderName"),o=n("xsrfCookieName");let a=n("headers");const c=n("auth"),d=n("baseURL"),u=n("allowAbsoluteUrls"),f=n("url");if(t.headers=a=ze.from(a),t.url=zf(Zf(d,f,u,t),n("params"),n("paramsSerializer")),c){const m=P.getSafeProp(c,"username")||"",p=P.getSafeProp(c,"password")||"";a.set("Authorization","Basic "+btoa(m+":"+(p?f_(p):"")))}if(P.isFormData(r)&&(Be.hasStandardBrowserEnv||Be.hasStandardBrowserWebWorkerEnv||P.isReactNative(r)?a.setContentType(void 0):P.isFunction(r.getHeaders)&&u_(a,r.getHeaders(),n("formDataHeaderPolicy"))),Be.hasStandardBrowserEnv&&(P.isFunction(s)&&(s=s(t)),s===!0||s==null&&n_(t.url))){const p=i&&o&&r_.read(o);p&&a.set(i,p)}return t}const h_=typeof XMLHttpRequest<"u",p_=h_&&function(e){return new Promise(function(n,r){const s=Yf(e);let i=s.data;const o=ze.from(s.headers).normalize();let{responseType:a,onUploadProgress:c,onDownloadProgress:d}=s,u,f,m,p,g;function h(){p&&p(),g&&g(),s.cancelToken&&s.cancelToken.unsubscribe(u),s.signal&&s.signal.removeEventListener("abort",u)}let y=new XMLHttpRequest;y.open(s.method.toUpperCase(),s.url,!0),y.timeout=s.timeout;function b(){if(!y)return;const x=ze.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),C={data:!a||a==="text"||a==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:x,config:e,request:y};qf(function(T){n(T),h()},function(T){r(T),h()},C),y=null}"onloadend"in y?y.onloadend=b:y.onreadystatechange=function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.startsWith("file:"))||setTimeout(b)},y.onabort=function(){y&&(r(new G("Request aborted",G.ECONNABORTED,e,y)),h(),y=null)},y.onerror=function(_){const C=_&&_.message?_.message:"Network Error",k=new G(C,G.ERR_NETWORK,e,y);k.event=_||null,r(k),h(),y=null},y.ontimeout=function(){let _=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const C=s.transitional||Xa;s.timeoutErrorMessage&&(_=s.timeoutErrorMessage),r(new G(_,C.clarifyTimeoutError?G.ETIMEDOUT:G.ECONNABORTED,e,y)),h(),y=null},i===void 0&&o.setContentType(null),"setRequestHeader"in y&&P.forEach(Ff(o),function(_,C){y.setRequestHeader(C,_)}),P.isUndefined(s.withCredentials)||(y.withCredentials=!!s.withCredentials),a&&a!=="json"&&(y.responseType=s.responseType),d&&([m,g]=ei(d,!0),y.addEventListener("progress",m)),c&&y.upload&&([f,p]=ei(c),y.upload.addEventListener("progress",f),y.upload.addEventListener("loadend",p)),(s.cancelToken||s.signal)&&(u=x=>{y&&(r(!x||x.type?new os(null,e,y):x),y.abort(),h(),y=null)},s.cancelToken&&s.cancelToken.subscribe(u),s.signal&&(s.signal.aborted?u():s.signal.addEventListener("abort",u)));const v=Jw(s.url);if(v&&!Be.protocols.includes(v)){r(new G("Unsupported protocol "+v+":",G.ERR_BAD_REQUEST,e));return}y.send(i||null)})},m_=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const n=new AbortController;let r=!1;const s=function(c){if(!r){r=!0,o();const d=c instanceof Error?c:this.reason;n.abort(d instanceof G?d:new os(d instanceof Error?d.message:d))}};let i=t&&setTimeout(()=>{i=null,s(new G(`timeout of ${t}ms exceeded`,G.ETIMEDOUT))},t);const o=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(c=>{c.unsubscribe?c.unsubscribe(s):c.removeEventListener("abort",s)}),e=null)};e.forEach(c=>c.addEventListener("abort",s));const{signal:a}=n;return a.unsubscribe=()=>P.asap(o),a},g_=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},y_=async function*(e,t){for await(const n of b_(e))yield*g_(n,t)},b_=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()}},wl=(e,t,n,r)=>{const s=y_(e,t);let i=0,o,a=c=>{o||(o=!0,r&&r(c))};return new ReadableStream({async pull(c){try{const{done:d,value:u}=await s.next();if(d){a(),c.close();return}let f=u.byteLength;if(n){let m=i+=f;n(m)}c.enqueue(new Uint8Array(u))}catch(d){throw a(d),d}},cancel(c){return a(c),s.return()}},{highWaterMark:2})},ti=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,v_=(e,t,n)=>t+2<n&&ti(e.charCodeAt(t+1))&&ti(e.charCodeAt(t+2));function w_(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),h=r.charCodeAt(p+2);ti(g)&&ti(h)&&(o-=2,p+=2)}let c=0,d=a-1;const u=p=>p>=2&&r.charCodeAt(p-2)===37&&r.charCodeAt(p-1)===51&&(r.charCodeAt(p)===68||r.charCodeAt(p)===100);d>=0&&(r.charCodeAt(d)===61?(c++,d--):u(d)&&(c++,d-=3)),c===1&&d>=0&&(r.charCodeAt(d)===61||u(d))&&c++;const m=Math.floor(o/4)*3-(c||0);return m>0?m:0}let i=0;for(let o=0,a=r.length;o<a;o++){const c=r.charCodeAt(o);if(c===37&&v_(r,o,a))i+=1,o+=2;else if(c<128)i+=1;else if(c<2048)i+=2;else if(c>=55296&&c<=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 ec="1.18.0",_l=64*1024,{isFunction:Ss}=P,__=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,n)=>String.fromCharCode(parseInt(n,16))),xl=e=>{if(!P.isString(e))return e;try{return decodeURIComponent(e)}catch{return e}},Sl=(e,...t)=>{try{return!!e(...t)}catch{return!1}},x_=e=>{const t=e.indexOf("://");let n=e;return t!==-1&&(n=n.slice(t+3)),n.includes("@")||n.includes(":")},S_=e=>{const t=P.global!==void 0&&P.global!==null?P.global:globalThis,{ReadableStream:n,TextEncoder:r}=t;e=P.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:s,Request:i,Response:o}=e,a=s?Ss(s):typeof fetch=="function",c=Ss(i),d=Ss(o);if(!a)return!1;const u=a&&Ss(n),f=a&&(typeof r=="function"?(b=>v=>b.encode(v))(new r):async b=>new Uint8Array(await new i(b).arrayBuffer())),m=c&&u&&Sl(()=>{let b=!1;const v=new i(Be.origin,{body:new n,method:"POST",get duplex(){return b=!0,"half"}}),x=v.headers.has("Content-Type");return v.body!=null&&v.body.cancel(),b&&!x}),p=d&&u&&Sl(()=>P.isReadableStream(new o("").body)),g={stream:p&&(b=>b.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(b=>{!g[b]&&(g[b]=(v,x)=>{let _=v&&v[b];if(_)return _.call(v);throw new G(`Response type '${b}' is not supported`,G.ERR_NOT_SUPPORT,x)})});const h=async b=>{if(b==null)return 0;if(P.isBlob(b))return b.size;if(P.isSpecCompliantForm(b))return(await new i(Be.origin,{method:"POST",body:b}).arrayBuffer()).byteLength;if(P.isArrayBufferView(b)||P.isArrayBuffer(b))return b.byteLength;if(P.isURLSearchParams(b)&&(b=b+""),P.isString(b))return(await f(b)).byteLength},y=async(b,v)=>{const x=P.toFiniteNumber(b.getContentLength());return x??h(v)};return async b=>{let{url:v,method:x,data:_,signal:C,cancelToken:k,timeout:T,onDownloadProgress:A,onUploadProgress:N,responseType:O,headers:L,withCredentials:R="same-origin",fetchOptions:$,maxContentLength:j,maxBodyLength:H}=Yf(b);const F=P.isNumber(j)&&j>-1,I=P.isNumber(H)&&H>-1,D=ee=>P.hasOwnProp(b,ee)?b[ee]:void 0;let U=s||fetch;O=O?(O+"").toLowerCase():"text";let K=m_([C,k&&k.toAbortSignal()],T),M=null;const le=K&&K.unsubscribe&&(()=>{K.unsubscribe()});let Z,fe=null;const de=()=>new G("Request body larger than maxBodyLength limit",G.ERR_BAD_REQUEST,b,M);try{let ee;const q=D("auth");if(q){const X=P.getSafeProp(q,"username")||"",Te=P.getSafeProp(q,"password")||"";ee={username:X,password:Te}}if(x_(v)){const X=new URL(v,Be.origin);if(!ee&&(X.username||X.password)){const Te=xl(X.username),Ue=xl(X.password);ee={username:Te,password:Ue}}(X.username||X.password)&&(X.username="",X.password="",v=X.href)}if(ee&&(L.delete("authorization"),L.set("Authorization","Basic "+btoa(__((ee.username||"")+":"+(ee.password||""))))),F&&typeof v=="string"&&v.startsWith("data:")&&w_(v)>j)throw new G("maxContentLength size of "+j+" exceeded",G.ERR_BAD_RESPONSE,b,M);if(I&&x!=="get"&&x!=="head"){const X=await h(_);if(typeof X=="number"&&isFinite(X)&&(Z=X,X>H))throw de()}const B=I&&(P.isReadableStream(_)||P.isStream(_)),me=(X,Te,Ue)=>wl(X,_l,Qe=>{if(I&&Qe>H)throw fe=de();Te&&Te(Qe)},Ue);if(m&&x!=="get"&&x!=="head"&&(N||B)){if(Z=Z??await y(L,_),Z!==0||B){let X=new i(v,{method:"POST",body:_,duplex:"half"}),Te;if(P.isFormData(_)&&(Te=X.headers.get("content-type"))&&L.setContentType(Te),X.body){const[Ue,Qe]=N&&gl(Z,ei(yl(N)))||[];_=me(X.body,Ue,Qe)}}}else if(B&&!c&&u&&x!=="get"&&x!=="head")_=me(_);else if(B&&c&&!m&&x!=="get"&&x!=="head")throw new G("Stream request bodies are not supported by the current fetch implementation",G.ERR_NOT_SUPPORT,b,M);P.isString(R)||(R=R?"include":"omit");const oe=c&&"credentials"in i.prototype;if(P.isFormData(_)){const X=L.getContentType();X&&/^multipart\/form-data/i.test(X)&&!/boundary=/i.test(X)&&L.delete("content-type")}L.set("User-Agent","axios/"+ec,!1);const se={...$,signal:K,method:x.toUpperCase(),headers:Ff(L.normalize()),body:_,duplex:"half",credentials:oe?R:void 0};M=c&&new i(v,se);let te=await(c?U(M,$):U(v,se));const je=ze.from(te.headers);if(F){const X=P.toFiniteNumber(je.getContentLength());if(X!=null&&X>j)throw new G("maxContentLength size of "+j+" exceeded",G.ERR_BAD_RESPONSE,b,M)}const Ne=p&&(O==="stream"||O==="response");if(p&&te.body&&(A||F||Ne&&le)){const X={};["status","statusText","headers"].forEach($e=>{X[$e]=te[$e]});const Te=P.toFiniteNumber(je.getContentLength()),[Ue,Qe]=A&&gl(Te,ei(yl(A),!0))||[];let ct=0;const re=$e=>{if(F&&(ct=$e,ct>j))throw new G("maxContentLength size of "+j+" exceeded",G.ERR_BAD_RESPONSE,b,M);Ue&&Ue($e)};te=new o(wl(te.body,_l,re,()=>{Qe&&Qe(),le&&le()}),X)}O=O||"text";let Oe=await g[P.findKey(g,O)||"text"](te,b);if(F&&!p&&!Ne){let X;if(Oe!=null&&(typeof Oe.byteLength=="number"?X=Oe.byteLength:typeof Oe.size=="number"?X=Oe.size:typeof Oe=="string"&&(X=typeof r=="function"?new r().encode(Oe).byteLength:Oe.length)),typeof X=="number"&&X>j)throw new G("maxContentLength size of "+j+" exceeded",G.ERR_BAD_RESPONSE,b,M)}return!Ne&&le&&le(),await new Promise((X,Te)=>{qf(X,Te,{data:Oe,headers:ze.from(te.headers),status:te.status,statusText:te.statusText,config:b,request:M})})}catch(ee){if(le&&le(),K&&K.aborted&&K.reason instanceof G){const q=K.reason;throw q.config=b,M&&(q.request=M),ee!==q&&(q.cause=ee),q}throw fe?(M&&!fe.request&&(fe.request=M),fe):ee instanceof G?(M&&!ee.request&&(ee.request=M),ee):ee&&ee.name==="TypeError"&&/Load failed|fetch/i.test(ee.message)?Object.assign(new G("Network Error",G.ERR_NETWORK,b,M,ee&&ee.response),{cause:ee.cause||ee}):G.from(ee,ee&&ee.code,b,M,ee&&ee.response)}}},C_=new Map,Qf=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,i=[r,s,n];let o=i.length,a=o,c,d,u=C_;for(;a--;)c=i[a],d=u.get(c),d===void 0&&u.set(c,d=a?new Map:S_(t)),u=d;return d};Qf();const tc={http:Iw,xhr:p_,fetch:{get:Qf}};P.forEach(tc,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const Cl=e=>`- ${e}`,E_=e=>P.isFunction(e)||e===null||e===!1;function T_(e,t){e=P.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,!E_(r)&&(s=tc[(a=String(r)).toLowerCase()],s===void 0))throw new G(`Unknown adapter '${a}'`);if(s&&(P.isFunction(s)||(s=s.get(t))))break;i[a||"#"+o]=s}if(!s){const o=Object.entries(i).map(([c,d])=>`adapter ${c} `+(d===!1?"is not supported by the environment":"is not available in the build"));let a=n?o.length>1?`since :
76
+ `+o.map(Cl).join(`
77
+ `):" "+Cl(o[0]):"as no adapter specified";throw new G("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return s}const Xf={getAdapter:T_,adapters:tc};function so(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new os(null,e)}function El(e){return so(e),e.headers=ze.from(e.headers),e.data=ro.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Xf.getAdapter(e.adapter||is.adapter,e)(e).then(function(r){so(e),e.response=r;try{r.data=ro.call(e,e.transformResponse,r)}finally{delete e.response}return r.headers=ze.from(r.headers),r},function(r){if(!Kf(r)&&(so(e),r&&r.response)){e.response=r.response;try{r.response.data=ro.call(e,e.transformResponse,r.response)}finally{delete e.response}r.response.headers=ze.from(r.response.headers)}return Promise.reject(r)})}const Ri={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Ri[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const Tl={};Ri.transitional=function(t,n,r){function s(i,o){return"[Axios v"+ec+"] Transitional option '"+i+"'"+o+(r?". "+r:"")}return(i,o,a)=>{if(t===!1)throw new G(s(o," has been removed"+(n?" in "+n:"")),G.ERR_DEPRECATED);return n&&!Tl[o]&&(Tl[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}};Ri.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function P_(e,t,n){if(typeof e!="object")throw new G("options must be an object",G.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],c=a===void 0||o(a,i,e);if(c!==!0)throw new G("option "+i+" must be "+c,G.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new G("Unknown option "+i,G.ERR_BAD_OPTION)}}const Is={assertOptions:P_,validators:Ri},Ve=Is.validators;let An=class{constructor(t){this.defaults=t||{},this.interceptors={request:new pl,response:new pl}}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),c=a===-1?"":i.slice(a+1);String(r.stack).endsWith(c)||(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&&Ms.assertOptions(r,{silentJSONParsing:Ve.transitional(Ve.boolean),forcedJSONParsing:Ve.transitional(Ve.boolean),clarifyTimeoutError:Ve.transitional(Ve.boolean),legacyInterceptorReqResOrdering:Ve.transitional(Ve.boolean),advertiseZstdAcceptEncoding:Ve.transitional(Ve.boolean),validateStatusUndefinedResolves:Ve.transitional(Ve.boolean)},!1),s!=null&&(P.isFunction(s)?n.paramsSerializer={serialize:s}:Ms.assertOptions(s,{encode:Ve.function,serialize:Ve.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Ms.assertOptions(n,{baseUrl:Ve.spelling("baseURL"),withXsrfToken:Ve.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=i&&P.merge(i.common,i[n.method]);i&&P.forEach(["delete","get","head","post","put","patch","query","common"],g=>{delete i[g]}),n.headers=ze.concat(o,i);const a=[];let c=!0;this.interceptors.request.forEach(function(p){if(typeof p.runWhen=="function"&&p.runWhen(n)===!1)return;c=c&&p.synchronous;const y=n.transitional||Qa;y&&y.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 u,f=0,m;if(!c){const g=[Cl.bind(this),void 0];for(g.unshift(...a),g.push(...d),m=g.length,u=Promise.resolve(n);f<m;)u=u.then(g[f++],g[f++]);return u}m=a.length;let h=n;for(;f<m;){const g=a[f++],p=a[f++];try{h=g(h)}catch(y){p.call(this,y);break}}try{u=Cl.call(this,h)}catch(g){return Promise.reject(g)}for(f=0,m=d.length;f<m;)u=u.then(d[f++],d[f++]);return u}getUri(t){t=Mn(this.defaults,t);const n=Gf(t.baseURL,t.url,t.allowAbsoluteUrls,t);return $f(n,t.params,t.paramsSerializer)}};P.forEach(["delete","get","head","options"],function(t){An.prototype[t]=function(n,r){return this.request(Mn(r||{},{method:t,url:n,data:r&&P.hasOwnProp(r,"data")?r.data:void 0}))}});P.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}))}}An.prototype[t]=n(),t!=="query"&&(An.prototype[t+"Form"]=n(!0))});let C_=class Yf{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 is(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 Yf(function(s){t=s}),cancel:t}}};function E_(e){return function(n){return e.apply(null,n)}}function T_(e){return P.isObject(e)&&e.isAxiosError===!0}const Ro={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(Ro).forEach(([e,t])=>{Ro[t]=e});function Qf(e){const t=new An(e),n=Pf(An.prototype.request,t);return P.extend(n,An.prototype,t,{allOwnKeys:!0}),P.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return Qf(Mn(e,s))},n}const ke=Qf(ss);ke.Axios=An;ke.CanceledError=is;ke.CancelToken=C_;ke.isCancel=zf;ke.VERSION=Ja;ke.toFormData=Oi;ke.AxiosError=q;ke.Cancel=ke.CanceledError;ke.all=function(t){return Promise.all(t)};ke.spread=E_;ke.isAxiosError=T_;ke.mergeConfig=Mn;ke.AxiosHeaders=ze;ke.formToJSON=e=>Hf(P.isHTMLForm(e)?new FormData(e):e);ke.getAdapter=Zf.getAdapter;ke.HttpStatusCode=Ro;ke.default=ke;const{Axios:EC,AxiosError:TC,CanceledError:PC,isCancel:kC,CancelToken:OC,VERSION:AC,all:RC,Cancel:NC,isAxiosError:Xf,spread:DC,toFormData:LC,AxiosHeaders:jC,HttpStatusCode:MC,formToJSON:IC,getAdapter:FC,mergeConfig:UC,create:BC}=ke,P_="Bearer ",Jf="web-trading-token";function k_(){return typeof window>"u"?null:localStorage.getItem(Jf)}function In(e){return e.replace(/\/$/,"")}function Tl(e){const t=In(e);async function n(r){const s=k_();return(await ke({...r,baseURL:t,headers:{...r.headers??{},...s?{Authorization:`${P_}${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 Pl(e){return!e.isDemo&&!e.isArchive&&!!e.tradeStat}function O_(e){const t=e.filter(n=>Pl(n)&&n.platformType==="mt5");return t.length>0?t:e.filter(Pl)}function A_(e){const t=e,n=(t==null?void 0:t.accounts)??[];return O_(n).map(r=>{var s,i,o,a,c;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:(c=r.tradeStat)==null?void 0:c.marginLevel}}})}function R_(e){try{const t=new URL(In(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 In(e)}}function N_(e){try{const t=new URL(In(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 D_(e){try{const t=new URL(In(e));return t.hostname.includes("opheleo")?"wss://public-ticks.opheleo.com":(t.protocol=t.protocol==="https:"?"wss:":"ws:",t.origin)}catch{return"wss://public-ticks.opheleo.com"}}const L_=["XAU_USD","EUR_USD","GBP_USD","USD_JPY","BTCUSDT"],j_=un.filter(e=>L_.includes(e.ticker));function ep(){return j_}function M_(e){const t=In(e),n=Tl(t),r=R_(t),s=Tl(r),i=xv(n),o=ep();return{baseUrl:t,platformApiBase:r,tickWebSocketUrl:N_(t),publicTickWebSocketUrl:D_(t),dealer:i,trading:kv(i,o),async getAccounts(){const a=await s.get("/account-config/api/v1");return A_(a)}}}const tp=S.createContext(null);function np({baseUrl:e,children:t}){const n=S.useMemo(()=>M_(e),[e]);return l.jsx(tp.Provider,{value:n,children:t})}function mn(){const e=S.useContext(tp);if(!e)throw new Error("useWidgetApiClient must be used within WidgetApiProvider");return e}function I_(){return mn().tickWebSocketUrl}function F_(){return mn().publicTickWebSocketUrl}const U_="wss://public-ticks.opheleo.com";function tc(e){const[t,n]=S.useState(null),r=F_();return S.useEffect(()=>{const s=Ci(e).toUpperCase();let i=null,o=!1;const a=r||U_,c=()=>{i=new WebSocket(a),i.onmessage=d=>{var u;try{const f=JSON.parse(d.data);if(f.type!=="tick"||!Array.isArray(f.ticks))return;for(const m of f.ticks){if(((u=m.s)==null?void 0:u.trim().toUpperCase())!==s)continue;const g=Number(m.b),p=Number(m.a);if(!(!Number.isFinite(g)||!Number.isFinite(p))){n({bid:g,ask:p});break}}}catch{}},i.onclose=()=>{o||setTimeout(c,3e3)}};return c(),()=>{o=!0,i==null||i.close(1e3,"Unmounted")}},[e,r]),t}function B_({symbolTicker:e,scanResultUrl:t,orderState:n}){const r=tc(e),{panelRef:s,position:i,isDragging:o,onDragStart:a,reclamp:c}=Sf(),{panel:d,isSubmitting:u,defaultVolumeLots:f,volumeStep:m,minVolumeLots:h,accountOptions:g,selectedLogin:p,isAccountsLoading:y,hasConfirmedAccount:b,confirmAccountSelection:v,placeMarketOrder:x}=n,_=ie(A=>A.setDraft),C=ie(A=>A.clearDraft),k=Number(Ut(Bt(e))),T=Er(k);S.useEffect(()=>{b&&_({source:"new-order",entryPrice:null,side:null,showEntryLine:!1,volumeLots:f,digits:k,priceStep:T})},[f,k,b,T,_]),S.useEffect(()=>{(d==="closed"||d==="confirmation")&&C()},[C,d]);const R=A=>{x({symbolTicker:e,login:A.login,executionMode:"market",side:A.side,orderType:A.side==="buy"?Ke.BUY:Ke.SELL,volumeLots:A.volumeLots,stopLoss:"",takeProfit:"",priceOrder:"",priceTrigger:"",comment:"",typeTime:ft.GTC,expirationDateTime:"",expirationDay:"",bid:A.bid,ask:A.ask})};return l.jsxs(l.Fragment,{children:[l.jsx(uf,{open:!b,isAccountsLoading:y,accountOptions:g,onConfirm:v}),b&&l.jsx("div",{ref:s,style:{left:i.x,top:i.y},className:`web-trading-widget-new-order-overlay${o?" web-trading-widget-new-order-overlay--dragging":""}`,children:l.jsx(lv,{symbolTicker:e,bid:(r==null?void 0:r.bid)??null,ask:(r==null?void 0:r.ask)??null,defaultVolumeLots:f,volumeStep:m,minVolumeLots:h,isSubmitting:u,isAccountsLoading:y,selectedLogin:p,isDragging:o,scanResultUrl:t,onDragHandlePointerDown:a,onExpandedChange:c,onExpand:c,onPlaceOrder:R})})]})}function $_(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 V_(e,t){return e.openTimeMs!==t.openTimeMs?e.openTimeMs-t.openTimeMs:$_(e.ticket,t.ticket)}function kl(e){return[...e].sort(V_)}function Ol(e){return Ye(e).toUpperCase()}const me=Ti(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:kl(t)})},setOrders:t=>{e({orders:kl(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=Ol(t);e(i=>{const o={...i.liveQuotes,[s]:{bid:n,ask:r}};return{liveQuotes:o,positions:i.positions.map(a=>Wb(a,s,n,r,o)),orders:i.orders.map(a=>{if(Ol(a.symbol)!==s)return a;const c=a.side==="buy"?n:r;return{...a,currentPrice:c}})}})},clearPositions:()=>{e({positions:[],orders:[],liveQuotes:{}})}})),H_="wss://symbols.opheleo.com";function z_(e,t){const n=new Set;for(const r of e){const s=Ye(r.symbol).toUpperCase();s&&n.add(s)}for(const r of t){const s=Ye(r.symbol).toUpperCase();s&&n.add(s)}for(const r of Hb([...n]))n.add(r);return[...n].sort().join("|")}function W_(e){return z_(e.positions,e.orders)}function G_(){const e=me(W_),t=me(r=>r.updateQuotes),n=I_();S.useEffect(()=>{if(!e)return;const r=e.split("|"),s=new Map;let i=!1;const o=n||H_,a=c=>{const d=new WebSocket(o);s.set(c,d),d.onopen=()=>{if(i){d.close(1e3,"Unmounted");return}d.send(JSON.stringify({action:"select_symbol",symbol:c}))},d.onmessage=u=>{var f;try{const m=JSON.parse(u.data),h=(f=m.symbol)==null?void 0:f.trim().toUpperCase();if(!h||h!==c)return;const g=Number(m.bid),p=Number(m.ask);if(!Number.isFinite(g)||!Number.isFinite(p))return;t(h,g,p)}catch{}},d.onclose=()=>{s.delete(c),i||setTimeout(()=>a(c),3e3)}};for(const c of r)a(c);return()=>{i=!0;for(const c of s.values())c.close(1e3,"Unmounted");s.clear()}},[e,n,t])}function rp(){return G_(),null}const sp={buy:"#2563eb",sell:"#dc2626"},so={positive:"#2563eb",negative:"#dc2626",neutral:"#94a3b8"},io={linewidth:1,linestyle:2,fontsize:11},ip={stopLoss:"#f97316",takeProfit:"#22c55e"},op=e=>sp[e],No=(e,t)=>e==="entry"?t!=null?op(t):sp.sell:ip[e],Al=(e,t)=>{if(e==="entry")return No(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=ap(n,r,s,i);return cp(o)}return ip[e]},ap=(e,t,n,r)=>(e==="buy"?n-t:t-n)*r*100,q_=(e,t)=>!Number.isFinite(t)||t<=0?0:Math.round(e/t),K_=e=>{const t=ap(e.side,e.entryPrice,e.linePrice,e.volumeLots),n=e.side==="buy"?e.linePrice-e.entryPrice:e.entryPrice-e.linePrice,r=q_(n,e.priceStep),s=e.kind==="takeProfit"?"TP":"SL",i=`${t.toFixed(2)} USD`,o=`${r} points`;return`${s} ${i}, ${o}`},Z_=(e,t)=>e.toFixed(t),cp=e=>e>0?so.positive:e<0?so.negative:so.neutral,Y_=e=>{const t=`${e.side.toUpperCase()} ${e.volumeLots.toFixed(2)}, `,n=`${e.profit.toFixed(2)} USD`;return`${t}${n}`},Rl=e=>{const t=op(e.side),n=cp(e.profit);return{text:Y_(e),linecolor:t,textcolor:n,linewidth:io.linewidth,linestyle:io.linestyle,fontsize:io.fontsize,showPrice:!0,horzLabelsAlign:"left"}},Nl=e=>pt(e),Q_=e=>e==="entry"||e==="stopLoss"||e==="takeProfit",oo=e=>{e.setUserEditEnabled(!1),e.setSelectionEnabled(!1)},Dl=(e,t,n)=>{if(e==="entry")return Z_(t,n.digits);const{entryPrice:r,side:s}=n;return s!==null&&r!==null?K_({kind:e,side:s,entryPrice:r,linePrice:t,volumeLots:n.volumeLots,priceStep:n.priceStep}):`${e==="takeProfit"?"TP":"SL"} ${Ce(t,n.digits)}`},X_=({chartWidget:e})=>{const t=ie(_=>_.source),n=ie(_=>_.entryPrice),r=ie(_=>_.stopLoss),s=ie(_=>_.takeProfit),i=ie(_=>_.side),o=ie(_=>_.showEntryLine),a=ie(_=>_.volumeLots),c=ie(_=>_.digits),d=ie(_=>_.priceStep),u=ie(_=>_.setStopLoss),f=ie(_=>_.setTakeProfit),m=S.useRef({}),h=S.useRef(null),g=S.useRef(null),p=S.useRef({entryPrice:n,stopLoss:r,takeProfit:s,side:i,showEntryLine:o,volumeLots:a,digits:c,priceStep:d});S.useEffect(()=>{p.current={entryPrice:n,stopLoss:r,takeProfit:s,side:i,showEntryLine:o,volumeLots:a,digits:c,priceStep:d}},[c,n,d,o,i,r,s,a]);const y=S.useCallback(_=>{if(!e)return;const C=m.current[_];if(C){try{e.activeChart().removeEntity(C)}catch{}delete m.current[_]}},[e]),b=S.useCallback((_,C,k,T)=>{const R=No(C,T.side),A=Al(C,{side:T.side,entryPrice:T.entryPrice,linePrice:k,volumeLots:T.volumeLots});_.setProperties({text:Dl(C,k,T),linecolor:R,textcolor:A,showPrice:!0,horzLabelsAlign:"left"})},[]),v=S.useCallback(async(_,C,k)=>{var L;if(!e)return;if(C===void 0){y(_);return}if(h.current===_)return;const T=e.activeChart(),R=No(_,k.side),A=Al(_,{side:k.side,entryPrice:k.entryPrice,linePrice:C,volumeLots:k.volumeLots}),O=Dl(_,C,k),D=m.current[_];if(D)try{const B=T.getShapeById(D);_==="entry"&&oo(B);const U=(L=B.getPoints()[0])==null?void 0:L.price;if(U!==void 0&&Math.abs(U-C)<k.priceStep/2){B.setProperties({text:O,linecolor:R,textcolor:A,showPrice:!0,horzLabelsAlign:"left"});return}const z=B.getPoints();if(z.length>0){B.setPoints(z.map(F=>({...F,price:C}))),B.setProperties({text:O,linecolor:R,textcolor:A,showPrice:!0,horzLabelsAlign:"left"});return}}catch{delete m.current[_]}try{const B=T.getVisibleRange(),U=await T.createShape({time:B.from,price:C},{shape:"horizontal_line",text:O,disableSave:!0,lock:_==="entry",disableSelection:_==="entry",overrides:{linecolor:R,textcolor:A,linewidth:2,showPrice:!0,horzLabelsAlign:"left"}});if(_==="entry")try{oo(T.getShapeById(U))}catch{}m.current[_]=U}catch{}},[e,y]),x=S.useCallback(async _=>{const C=Nl(_.stopLoss),k=Nl(_.takeProfit);_.showEntryLine&&_.entryPrice!==null?await v("entry",_.entryPrice,_):await v("entry",void 0,_),await v("stopLoss",C,_),await v("takeProfit",k,_)},[v]);S.useEffect(()=>{if(!e||t===null)return;const _=(C,k)=>{var R,A,O;const T=(R=Object.entries(m.current).find(([,D])=>D===C))==null?void 0:R[0];if(!(!T||!Q_(T))){if(T==="entry"){if(k==="move"||k==="points_changed"){const D=p.current;if(D.entryPrice!==null)try{const L=e.activeChart().getShapeById(C),B=(A=L.getPoints()[0])==null?void 0:A.price;if(B!==void 0&&Math.abs(B-D.entryPrice)>=D.priceStep/2){const U=L.getPoints();U.length>0&&L.setPoints(U.map(z=>({...z,price:D.entryPrice})))}oo(L)}catch{}}return}if(k==="remove"){h.current=null,T==="stopLoss"&&u(""),T==="takeProfit"&&f(""),delete m.current[T];return}if(!(k!=="move"&&k!=="points_changed"))try{const D=e.activeChart().getShapeById(C),L=(O=D.getPoints()[0])==null?void 0:O.price;if(!Number.isFinite(L)||L<=0)return;const B=p.current;if(k==="points_changed"){h.current=T,b(D,T,L,B),g.current!==null&&clearTimeout(g.current),g.current=setTimeout(()=>{h.current=null;const F=Ce(L,p.current.digits);T==="stopLoss"?u(F):f(F)},120);return}g.current!==null&&(clearTimeout(g.current),g.current=null),h.current=null;const U=Ce(L,B.digits),z=T==="stopLoss"?{...B,stopLoss:U}:{...B,takeProfit:U};T==="stopLoss"?u(U):f(U),b(D,T,L,z)}catch{h.current=null}}};try{e.subscribe("drawing_event",_)}catch{}return()=>{h.current=null,g.current!==null&&(clearTimeout(g.current),g.current=null);try{e.unsubscribe("drawing_event",_)}catch{}Object.keys(m.current).forEach(C=>{y(C)}),m.current={}}},[e,y,u,f,t,b]),S.useEffect(()=>{if(!e||t===null)return;let _=!1;try{e.onChartReady(()=>{_||x(p.current)})}catch{}return()=>{_=!0}},[e,t,n,r,s,i,o,a,c,d,x])},Ll=e=>{e.setUserEditEnabled(!1),e.setSelectionEnabled(!1)},lp=(e,t)=>Ye(e.symbol).toUpperCase()===t,J_=e=>me.getState().positions.filter(t=>lp(t,e)).map(t=>({ticket:t.ticket,openPrice:t.openPrice,type:t.type,digits:t.digits,volumeLots:t.volumeLots,profit:t.profit})),jl=(e,t,n)=>{try{const r=e.activeChart().symbol(),s=n.find(i=>i.display_name===r||i.ticker===r);if(s)return yf(s.ticker,n)}catch{}return t},ex=(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)},tx=({chartWidget:e,symbolTicker:t,symbols:n})=>{const r=me(g=>g.positions),s=S.useRef(new Map),i=S.useRef(0),o=S.useMemo(()=>yf(t,n),[t,n]),a=S.useMemo(()=>r.filter(g=>lp(g,o)).map(g=>`${g.ticket}:${g.openPrice}:${g.type}:${g.digits}:${g.volumeLots}:${g.profit.toFixed(2)}`).sort().join("|"),[o,r]),c=S.useCallback(g=>{if(!e)return;const p=s.current.get(g);if(p){try{e.activeChart().removeEntity(p)}catch{}s.current.delete(g)}},[e]),d=S.useCallback(()=>{for(const g of[...s.current.keys()])c(g);s.current.clear()},[c]),u=S.useCallback(async(g,p,y)=>{const b=Rl({side:p.type,volumeLots:p.volumeLots,profit:p.profit}),x={time:g.getVisibleRange().from,price:p.openPrice},_=await g.createShape(x,{shape:"horizontal_line",text:String(b.text),disableSave:!0,lock:!0,disableSelection:!0,overrides:b});if(y!==i.current){try{g.removeEntity(_)}catch{}return null}try{Ll(g.getShapeById(_))}catch{}return _},[]),f=S.useCallback(async(g,p)=>{if(!e||p!==i.current)return;const y=e.activeChart(),b=Rl({side:g.type,volumeLots:g.volumeLots,profit:g.profit}),v=s.current.get(g.ticket);if(v)try{ex(y.getShapeById(v),g.openPrice,b),Ll(y.getShapeById(v));return}catch{s.current.delete(g.ticket)}if(p===i.current)try{const x=await u(y,g,p);if(!x)return;s.current.set(g.ticket,x)}catch{}},[e,u]),m=S.useCallback(async(g,p)=>{if(!e||g!==i.current)return;const y=J_(p),b=new Set(y.map(v=>v.ticket));for(const v of s.current.keys())b.has(v)||c(v);for(const v of y){if(g!==i.current)return;await f(v,g)}},[e,c,f]),h=S.useCallback(g=>{if(!e)return;const p=i.current+1;i.current=p,g!=null&&g.resetLineIds&&d();const y=(g==null?void 0:g.symbolKey)??jl(e,o,n);m(p,y)},[o,e,d,n,m]);S.useEffect(()=>{if(!e)return;let g=!1,p=null;const y=()=>{g||h({resetLineIds:!0,symbolKey:jl(e,o,n)})};let b=!1;const v=()=>{b=!0,y()},x=()=>{g||!b||(b=!1,h({symbolKey:o}))};try{e.onChartReady(()=>{if(!g)try{p=e.activeChart(),h({resetLineIds:!0,symbolKey:o}),p.onSymbolChanged().subscribe(null,v),p.onDataLoaded().subscribe(null,x)}catch{}})}catch{}return()=>{if(g=!0,i.current+=1,p)try{p.onSymbolChanged().unsubscribe(null,v),p.onDataLoaded().unsubscribe(null,x)}catch{}d()}},[o,e,d,h,n]),S.useEffect(()=>{if(!e)return;let g=!1;try{e.onChartReady(()=>{g||h({symbolKey:o})})}catch{}return()=>{g=!0}},[o,e,a,h])},dp=({chartWidget:e,symbolTicker:t,symbols:n})=>(tx({chartWidget:e,symbolTicker:t,symbols:n}),X_({chartWidget:e}),null);var os=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(){}},wn,Kt,Qn,_d,nx=(_d=class extends os{constructor(){super();ee(this,wn);ee(this,Kt);ee(this,Qn);W(this,Qn,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){E(this,Kt)||this.setEventListener(E(this,Qn))}onUnsubscribe(){var t;this.hasListeners()||((t=E(this,Kt))==null||t.call(this),W(this,Kt,void 0))}setEventListener(t){var n;W(this,Qn,t),(n=E(this,Kt))==null||n.call(this),W(this,Kt,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){E(this,wn)!==t&&(W(this,wn,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof E(this,wn)=="boolean"?E(this,wn):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},wn=new WeakMap,Kt=new WeakMap,Qn=new WeakMap,_d),nc=new nx,rx={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},xt,_n,xd,sx=(xd=class{constructor(){ee(this,xt,rx);ee(this,_n,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&E(this,_n)&&e!==E(this,xt)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:E(this,xt),provider:e}),W(this,xt,e),process.env.NODE_ENV!=="production"&&W(this,_n,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&W(this,_n,!0),E(this,xt).setTimeout(e,t)}clearTimeout(e){E(this,xt).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&W(this,_n,!0),E(this,xt).setInterval(e,t)}clearInterval(e){E(this,xt).clearInterval(e)}},xt=new WeakMap,_n=new WeakMap,xd),vn=new sx;function ix(e){setTimeout(e,0)}var ox=typeof window>"u"||"Deno"in globalThis;function qe(){}function ax(e,t){return typeof e=="function"?e(t):e}function Do(e){return typeof e=="number"&&e>=0&&e!==1/0}function up(e,t){return Math.max(e+(t||0)-Date.now(),0)}function rn(e,t){return typeof e=="function"?e(t):e}function et(e,t){return typeof e=="function"?e(t):e}function Ml(e,t){const{type:n="all",exact:r,fetchStatus:s,predicate:i,queryKey:o,stale:a}=e;if(o){if(r){if(t.queryHash!==rc(o,t.options))return!1}else if(!zr(t.queryKey,o))return!1}if(n!=="all"){const c=t.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||s&&s!==t.state.fetchStatus||i&&!i(t))}function Il(e,t){const{exact:n,status:r,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(Hr(t.options.mutationKey)!==Hr(i))return!1}else if(!zr(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function rc(e,t){return((t==null?void 0:t.queryKeyHashFn)||Hr)(e)}function Hr(e){return JSON.stringify(e,(t,n)=>Mo(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function zr(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>zr(e[n],t[n])):!1}var cx=Object.prototype.hasOwnProperty;function Lo(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=Fl(e)&&Fl(t);if(!r&&!(Mo(e)&&Mo(t)))return t;const i=(r?e:Object.keys(e)).length,o=r?t:Object.keys(t),a=o.length,c=r?new Array(a):{};let d=0;for(let u=0;u<a;u++){const f=r?u:o[u],m=e[f],h=t[f];if(m===h){c[f]=m,(r?u<i:cx.call(e,f))&&d++;continue}if(m===null||h===null||typeof m!="object"||typeof h!="object"){c[f]=h;continue}const g=Lo(m,h,n+1);c[f]=g,g===m&&d++}return i===a&&d===i?e:c}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 Fl(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Mo(e){if(!Ul(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Ul(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Ul(e){return Object.prototype.toString.call(e)==="[object Object]"}function lx(e){return new Promise(t=>{vn.setTimeout(t,e)})}function Io(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 Lo(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 Lo(e,t)}return t}function dx(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function ux(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var ei=Symbol();function fp(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===ei&&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===ei?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function pp(e,t){return typeof e=="function"?e(...t):!!e}function fx(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 Wr=(()=>{let e=()=>ox;return{isServer(){return e()},setIsServer(t){e=t}}})();function Fo(){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 px=ix;function hx(){let e=[],t=0,n=a=>{a()},r=a=>{a()},s=px;const i=a=>{t?e.push(a):s(()=>{n(a)})},o=()=>{const a=e;e=[],a.length&&s(()=>{r(()=>{a.forEach(c=>{n(c)})})})};return{batch:a=>{let c;t++;try{c=a()}finally{t--,t||o()}return c},batchCalls:a=>(...c)=>{i(()=>{a(...c)})},schedule:i,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{s=a}}}var Ue=hx(),Xn,Zt,Jn,Sd,mx=(Sd=class extends os{constructor(){super();ee(this,Xn,!0);ee(this,Zt);ee(this,Jn);W(this,Jn,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){E(this,Zt)||this.setEventListener(E(this,Jn))}onUnsubscribe(){var t;this.hasListeners()||((t=E(this,Zt))==null||t.call(this),W(this,Zt,void 0))}setEventListener(t){var n;W(this,Jn,t),(n=E(this,Zt))==null||n.call(this),W(this,Zt,t(this.setOnline.bind(this)))}setOnline(t){E(this,Xn)!==t&&(W(this,Xn,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return E(this,Xn)}},Xn=new WeakMap,Zt=new WeakMap,Jn=new WeakMap,Sd),ti=new mx;function gx(e){return Math.min(1e3*2**e,3e4)}function hp(e){return(e??"online")==="online"?ti.isOnline():!0}var Uo=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function mp(e){let t=!1,n=0,r;const s=Fo(),i=()=>s.status!=="pending",o=p=>{var y;if(!i()){const b=new Uo(p);m(b),(y=e.onCancel)==null||y.call(e,b)}},a=()=>{t=!0},c=()=>{t=!1},d=()=>nc.isFocused()&&(e.networkMode==="always"||ti.isOnline())&&e.canRun(),u=()=>hp(e.networkMode)&&e.canRun(),f=p=>{i()||(r==null||r(),s.resolve(p))},m=p=>{i()||(r==null||r(),s.reject(p))},h=()=>new Promise(p=>{var y;r=b=>{(i()||d())&&p(b)},(y=e.onPause)==null||y.call(e)}).then(()=>{var p;r=void 0,i()||(p=e.onContinue)==null||p.call(e)}),g=()=>{if(i())return;let p;const y=n===0?e.initialPromise:void 0;try{p=y??e.fn()}catch(b){p=Promise.reject(b)}Promise.resolve(p).then(f).catch(b=>{var k;if(i())return;const v=e.retry??(Wr.isServer()?0:3),x=e.retryDelay??gx,_=typeof x=="function"?x(n,b):x,C=v===!0||typeof v=="number"&&n<v||typeof v=="function"&&v(n,b);if(t||!C){m(b);return}n++,(k=e.onFail)==null||k.call(e,n,b),lx(_).then(()=>d()?void 0:h()).then(()=>{t?m(b):g()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(r==null||r(),s),cancelRetry:a,continueRetry:c,canStart:u,start:()=>(u()?g():h().then(g),s)}}var xn,Cd,gp=(Cd=class{constructor(){ee(this,xn)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Do(this.gcTime)&&W(this,xn,vn.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Wr.isServer()?1/0:300*1e3))}clearGcTimeout(){E(this,xn)!==void 0&&(vn.clearTimeout(E(this,xn)),W(this,xn,void 0))}},xn=new WeakMap,Cd);function yx(e){return{onFetch:(t,n)=>{var u,f,m,h,g;const r=t.options,s=(m=(f=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:f.fetchMore)==null?void 0:m.direction,i=((h=t.state.data)==null?void 0:h.pages)||[],o=((g=t.state.data)==null?void 0:g.pageParams)||[];let a={pages:[],pageParams:[]},c=0;const d=async()=>{let p=!1;const y=x=>{fx(x,()=>t.signal,()=>p=!0)},b=fp(t.options,t.fetchOptions),v=async(x,_,C)=>{if(p)return Promise.reject(t.signal.reason);if(_==null&&x.pages.length)return Promise.resolve(x);const T=(()=>{const D={client:t.client,queryKey:t.queryKey,pageParam:_,direction:C?"backward":"forward",meta:t.options.meta};return y(D),D})(),R=await b(T),{maxPages:A}=t.options,O=C?ux:dx;return{pages:O(x.pages,R,A),pageParams:O(x.pageParams,_,A)}};if(s&&i.length){const x=s==="backward",_=x?bx:Bl,C={pages:i,pageParams:o},k=_(r,C);a=await v(C,k,x)}else{const x=e??i.length;do{const _=c===0?o[0]??r.initialPageParam:Bl(r,a);if(c>0&&_==null)break;a=await v(a,_),c++}while(c<x)}return a};t.options.persister?t.fetchFn=()=>{var p,y;return(y=(p=t.options).persister)==null?void 0:y.call(p,d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=d}}}function Bl(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 bx(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 er,Sn,tr,it,Cn,Me,Kr,En,Je,yp,Rt,Ed,vx=(Ed=class extends gp{constructor(t){super();ee(this,Je);ee(this,er);ee(this,Sn);ee(this,tr);ee(this,it);ee(this,Cn);ee(this,Me);ee(this,Kr);ee(this,En);W(this,En,!1),W(this,Kr,t.defaultOptions),this.setOptions(t.options),this.observers=[],W(this,Cn,t.client),W(this,it,E(this,Cn).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,W(this,Sn,Vl(this.options)),this.state=t.state??E(this,Sn),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return E(this,er)}get promise(){var t;return(t=E(this,Me))==null?void 0:t.promise}setOptions(t){if(this.options={...E(this,Kr),...t},t!=null&&t._type&&W(this,er,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=Vl(this.options);n.data!==void 0&&(this.setState($l(n.data,n.dataUpdatedAt)),W(this,Sn,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&E(this,it).remove(this)}setData(t,n){const r=Io(this.state.data,t,this.options);return fe(this,Je,Rt).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t){fe(this,Je,Rt).call(this,{type:"setState",state:t})}cancel(t){var r,s;const n=(r=E(this,Me))==null?void 0:r.promise;return(s=E(this,Me))==null||s.cancel(t),n?n.then(qe).catch(qe):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return E(this,Sn)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>et(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ei||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>rn(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:!up(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=E(this,Me))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=E(this,Me))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),E(this,it).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(E(this,Me)&&(E(this,En)||fe(this,Je,yp).call(this)?E(this,Me).cancel({revert:!0}):E(this,Me).cancelRetry()),this.scheduleGc()),E(this,it).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||fe(this,Je,Rt).call(this,{type:"invalidate"})}async fetch(t,n){var d,u,f,m,h,g,p,y,b,v,x;if(this.state.fetchStatus!=="idle"&&((d=E(this,Me))==null?void 0:d.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(E(this,Me))return E(this,Me).continueRetry(),E(this,Me).promise}if(t&&this.setOptions(t),!this.options.queryFn){const _=this.observers.find(C=>C.options.queryFn);_&&this.setOptions(_.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=_=>{Object.defineProperty(_,"signal",{enumerable:!0,get:()=>(W(this,En,!0),r.signal)})},i=()=>{const _=fp(this.options,n),k=(()=>{const T={client:E(this,Cn),queryKey:this.queryKey,meta:this.meta};return s(T),T})();return W(this,En,!1),this.options.persister?this.options.persister(_,k,this):_(k)},a=(()=>{const _={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:E(this,Cn),state:this.state,fetchFn:i};return s(_),_})(),c=E(this,er)==="infinite"?yx(this.options.pages):this.options.behavior;c==null||c.onFetch(a,this),W(this,tr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=a.fetchOptions)==null?void 0:u.meta))&&fe(this,Je,Rt).call(this,{type:"fetch",meta:(f=a.fetchOptions)==null?void 0:f.meta}),W(this,Me,mp({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:_=>{_ instanceof Uo&&_.revert&&this.setState({...E(this,tr),fetchStatus:"idle"}),r.abort()},onFail:(_,C)=>{fe(this,Je,Rt).call(this,{type:"failed",failureCount:_,error:C})},onPause:()=>{fe(this,Je,Rt).call(this,{type:"pause"})},onContinue:()=>{fe(this,Je,Rt).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const _=await E(this,Me).start();if(_===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(_),(h=(m=E(this,it).config).onSuccess)==null||h.call(m,_,this),(p=(g=E(this,it).config).onSettled)==null||p.call(g,_,this.state.error,this),_}catch(_){if(_ instanceof Uo){if(_.silent)return E(this,Me).promise;if(_.revert){if(this.state.data===void 0)throw _;return this.state.data}}throw fe(this,Je,Rt).call(this,{type:"error",error:_}),(b=(y=E(this,it).config).onError)==null||b.call(y,_,this),(x=(v=E(this,it).config).onSettled)==null||x.call(v,this.state.data,_,this),_}finally{this.scheduleGc()}}},er=new WeakMap,Sn=new WeakMap,tr=new WeakMap,it=new WeakMap,Cn=new WeakMap,Me=new WeakMap,Kr=new WeakMap,En=new WeakMap,Je=new WeakSet,yp=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Rt=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,...bp(r.data,this.options),fetchMeta:t.meta??null};case"success":const s={...r,...$l(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return W(this,tr,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),Ue.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),E(this,it).notify({query:this,type:"updated",action:t})})},Ed);function bp(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:hp(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function $l(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Vl(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,he,Zr,We,Tn,nr,Dt,Yt,Yr,rr,sr,Pn,kn,Qt,ir,_e,jr,Bo,$o,Vo,Ho,zo,Wo,Go,vp,Td,wx=(Td=class extends os{constructor(t,n){super();ee(this,_e);ee(this,Ge);ee(this,he);ee(this,Zr);ee(this,We);ee(this,Tn);ee(this,nr);ee(this,Dt);ee(this,Yt);ee(this,Yr);ee(this,rr);ee(this,sr);ee(this,Pn);ee(this,kn);ee(this,Qt);ee(this,ir,new Set);this.options=n,W(this,Ge,t),W(this,Yt,null),W(this,Dt,Fo()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(E(this,he).addObserver(this),Hl(E(this,he),this.options)?fe(this,_e,jr).call(this):this.updateResult(),fe(this,_e,Ho).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return qo(E(this,he),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return qo(E(this,he),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,fe(this,_e,zo).call(this),fe(this,_e,Wo).call(this),E(this,he).removeObserver(this)}setOptions(t){const n=this.options,r=E(this,he);if(this.options=E(this,Ge).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof et(this.options.enabled,E(this,he))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");fe(this,_e,Go).call(this),E(this,he).setOptions(this.options),n._defaulted&&!jo(this.options,n)&&E(this,Ge).getQueryCache().notify({type:"observerOptionsUpdated",query:E(this,he),observer:this});const s=this.hasListeners();s&&zl(E(this,he),r,this.options,n)&&fe(this,_e,jr).call(this),this.updateResult(),s&&(E(this,he)!==r||et(this.options.enabled,E(this,he))!==et(n.enabled,E(this,he))||rn(this.options.staleTime,E(this,he))!==rn(n.staleTime,E(this,he)))&&fe(this,_e,Bo).call(this);const i=fe(this,_e,$o).call(this);s&&(E(this,he)!==r||et(this.options.enabled,E(this,he))!==et(n.enabled,E(this,he))||i!==E(this,Qt))&&fe(this,_e,Vo).call(this,i)}getOptimisticResult(t){const n=E(this,Ge).getQueryCache().build(E(this,Ge),t),r=this.createResult(n,t);return xx(this,r)&&(W(this,We,r),W(this,nr,this.options),W(this,Tn,E(this,he).state)),r}getCurrentResult(){return E(this,We)}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&&E(this,Dt).status==="pending"&&E(this,Dt).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,s))})}trackProp(t){E(this,ir).add(t)}getCurrentQuery(){return E(this,he)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=E(this,Ge).defaultQueryOptions(t),r=E(this,Ge).getQueryCache().build(E(this,Ge),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return fe(this,_e,jr).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),E(this,We)))}createResult(t,n){var A;const r=E(this,he),s=this.options,i=E(this,We),o=E(this,Tn),a=E(this,nr),d=t!==r?t.state:E(this,Zr),{state:u}=t;let f={...u},m=!1,h;if(n._optimisticResults){const O=this.hasListeners(),D=!O&&Hl(t,n),L=O&&zl(t,r,n,s);(D||L)&&(f={...f,...bp(u.data,t.options)}),n._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:g,errorUpdatedAt:p,status:y}=f;h=f.data;let b=!1;if(n.placeholderData!==void 0&&h===void 0&&y==="pending"){let O;i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(O=i.data,b=!0):O=typeof n.placeholderData=="function"?n.placeholderData((A=E(this,sr))==null?void 0:A.state.data,E(this,sr)):n.placeholderData,O!==void 0&&(y="success",h=Io(i==null?void 0:i.data,O,n),m=!0)}if(n.select&&h!==void 0&&!b)if(i&&h===(o==null?void 0:o.data)&&n.select===E(this,Yr))h=E(this,rr);else try{W(this,Yr,n.select),h=n.select(h),h=Io(i==null?void 0:i.data,h,n),W(this,rr,h),W(this,Yt,null)}catch(O){W(this,Yt,O)}E(this,Yt)&&(g=E(this,Yt),h=E(this,rr),p=Date.now(),y="error");const v=f.fetchStatus==="fetching",x=y==="pending",_=y==="error",C=x&&v,k=h!==void 0,R={status:y,fetchStatus:f.fetchStatus,isPending:x,isSuccess:y==="success",isError:_,isInitialLoading:C,isLoading:C,data:h,dataUpdatedAt:f.dataUpdatedAt,error:g,errorUpdatedAt:p,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:f.dataUpdateCount>d.dataUpdateCount||f.errorUpdateCount>d.errorUpdateCount,isFetching:v,isRefetching:v&&!x,isLoadingError:_&&!k,isPaused:f.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:_&&k,isStale:sc(t,n),refetch:this.refetch,promise:E(this,Dt),isEnabled:et(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const O=R.data!==void 0,D=R.status==="error"&&!O,L=z=>{D?z.reject(R.error):O&&z.resolve(R.data)},B=()=>{const z=W(this,Dt,R.promise=Fo());L(z)},U=E(this,Dt);switch(U.status){case"pending":t.queryHash===r.queryHash&&L(U);break;case"fulfilled":(D||R.data!==U.value)&&B();break;case"rejected":(!D||R.error!==U.reason)&&B();break}}return R}updateResult(){const t=E(this,We),n=this.createResult(E(this,he),this.options);if(W(this,Tn,E(this,he).state),W(this,nr,this.options),E(this,Tn).data!==void 0&&W(this,sr,E(this,he)),jo(n,t))return;W(this,We,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,i=typeof s=="function"?s():s;if(i==="all"||!i&&!E(this,ir).size)return!0;const o=new Set(i??E(this,ir));return this.options.throwOnError&&o.add("error"),Object.keys(E(this,We)).some(a=>{const c=a;return E(this,We)[c]!==t[c]&&o.has(c)})};fe(this,_e,vp).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&fe(this,_e,Ho).call(this)}},Ge=new WeakMap,he=new WeakMap,Zr=new WeakMap,We=new WeakMap,Tn=new WeakMap,nr=new WeakMap,Dt=new WeakMap,Yt=new WeakMap,Yr=new WeakMap,rr=new WeakMap,sr=new WeakMap,Pn=new WeakMap,kn=new WeakMap,Qt=new WeakMap,ir=new WeakMap,_e=new WeakSet,jr=function(t){fe(this,_e,Go).call(this);let n=E(this,he).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(qe)),n},Bo=function(){fe(this,_e,zo).call(this);const t=rn(this.options.staleTime,E(this,he));if(Wr.isServer()||E(this,We).isStale||!Do(t))return;const r=up(E(this,We).dataUpdatedAt,t)+1;W(this,Pn,vn.setTimeout(()=>{E(this,We).isStale||this.updateResult()},r))},$o=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(E(this,he)):this.options.refetchInterval)??!1},Vo=function(t){fe(this,_e,Wo).call(this),W(this,Qt,t),!(Wr.isServer()||et(this.options.enabled,E(this,he))===!1||!Do(E(this,Qt))||E(this,Qt)===0)&&W(this,kn,vn.setInterval(()=>{(this.options.refetchIntervalInBackground||nc.isFocused())&&fe(this,_e,jr).call(this)},E(this,Qt)))},Ho=function(){fe(this,_e,Bo).call(this),fe(this,_e,Vo).call(this,fe(this,_e,$o).call(this))},zo=function(){E(this,Pn)!==void 0&&(vn.clearTimeout(E(this,Pn)),W(this,Pn,void 0))},Wo=function(){E(this,kn)!==void 0&&(vn.clearInterval(E(this,kn)),W(this,kn,void 0))},Go=function(){const t=E(this,Ge).getQueryCache().build(E(this,Ge),this.options);if(t===E(this,he))return;const n=E(this,he);W(this,he,t),W(this,Zr,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},vp=function(t){Ue.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(E(this,We))}),E(this,Ge).getQueryCache().notify({query:E(this,he),type:"observerResultsUpdated"})})},Td);function _x(e,t){return et(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&et(t.retryOnMount,e)===!1)}function Hl(e,t){return _x(e,t)||e.state.data!==void 0&&qo(e,t,t.refetchOnMount)}function qo(e,t,n){if(et(t.enabled,e)!==!1&&rn(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&sc(e,t)}return!1}function zl(e,t,n,r){return(e!==t||et(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&sc(e,n)}function sc(e,t){return et(t.enabled,e)!==!1&&e.isStaleByTime(rn(t.staleTime,e))}function xx(e,t){return!jo(e.getCurrentResult(),t)}var Qr,St,He,On,Ct,zt,Pd,Sx=(Pd=class extends gp{constructor(t){super();ee(this,Ct);ee(this,Qr);ee(this,St);ee(this,He);ee(this,On);W(this,Qr,t.client),this.mutationId=t.mutationId,W(this,He,t.mutationCache),W(this,St,[]),this.state=t.state||Cx(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){E(this,St).includes(t)||(E(this,St).push(t),this.clearGcTimeout(),E(this,He).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){W(this,St,E(this,St).filter(n=>n!==t)),this.scheduleGc(),E(this,He).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){E(this,St).length||(this.state.status==="pending"?this.scheduleGc():E(this,He).remove(this))}continue(){var t;return((t=E(this,On))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,a,c,d,u,f,m,h,g,p,y,b,v,x,_,C,k,T;const n=()=>{fe(this,Ct,zt).call(this,{type:"continue"})},r={client:E(this,Qr),meta:this.options.meta,mutationKey:this.options.mutationKey};W(this,On,mp({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(R,A)=>{fe(this,Ct,zt).call(this,{type:"failed",failureCount:R,error:A})},onPause:()=>{fe(this,Ct,zt).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>E(this,He).canRun(this)}));const s=this.state.status==="pending",i=!E(this,On).canStart();try{if(s)n();else{fe(this,Ct,zt).call(this,{type:"pending",variables:t,isPaused:i}),E(this,He).config.onMutate&&await E(this,He).config.onMutate(t,this,r);const A=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,t,r));A!==this.state.context&&fe(this,Ct,zt).call(this,{type:"pending",context:A,variables:t,isPaused:i})}const R=await E(this,On).start();return await((d=(c=E(this,He).config).onSuccess)==null?void 0:d.call(c,R,t,this.state.context,this,r)),await((f=(u=this.options).onSuccess)==null?void 0:f.call(u,R,t,this.state.context,r)),await((h=(m=E(this,He).config).onSettled)==null?void 0:h.call(m,R,null,this.state.variables,this.state.context,this,r)),await((p=(g=this.options).onSettled)==null?void 0:p.call(g,R,null,t,this.state.context,r)),fe(this,Ct,zt).call(this,{type:"success",data:R}),R}catch(R){try{await((b=(y=E(this,He).config).onError)==null?void 0:b.call(y,R,t,this.state.context,this,r))}catch(A){Promise.reject(A)}try{await((x=(v=this.options).onError)==null?void 0:x.call(v,R,t,this.state.context,r))}catch(A){Promise.reject(A)}try{await((C=(_=E(this,He).config).onSettled)==null?void 0:C.call(_,void 0,R,this.state.variables,this.state.context,this,r))}catch(A){Promise.reject(A)}try{await((T=(k=this.options).onSettled)==null?void 0:T.call(k,void 0,R,t,this.state.context,r))}catch(A){Promise.reject(A)}throw fe(this,Ct,zt).call(this,{type:"error",error:R}),R}finally{E(this,He).runNext(this)}}},Qr=new WeakMap,St=new WeakMap,He=new WeakMap,On=new WeakMap,Ct=new WeakSet,zt=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),Ue.batch(()=>{E(this,St).forEach(r=>{r.onMutationUpdate(t)}),E(this,He).notify({mutation:this,type:"updated",action:t})})},Pd);function Cx(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Lt,ut,Xr,kd,Ex=(kd=class extends os{constructor(t={}){super();ee(this,Lt);ee(this,ut);ee(this,Xr);this.config=t,W(this,Lt,new Set),W(this,ut,new Map),W(this,Xr,0)}build(t,n,r){const s=new Sx({client:t,mutationCache:this,mutationId:++ls(this,Xr)._,options:t.defaultMutationOptions(n),state:r});return this.add(s),s}add(t){E(this,Lt).add(t);const n=Ss(t);if(typeof n=="string"){const r=E(this,ut).get(n);r?r.push(t):E(this,ut).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(E(this,Lt).delete(t)){const n=Ss(t);if(typeof n=="string"){const r=E(this,ut).get(n);if(r)if(r.length>1){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}else r[0]===t&&E(this,ut).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=Ss(t);if(typeof n=="string"){const r=E(this,ut).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=Ss(t);if(typeof n=="string"){const s=(r=E(this,ut).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(){Ue.batch(()=>{E(this,Lt).forEach(t=>{this.notify({type:"removed",mutation:t})}),E(this,Lt).clear(),E(this,ut).clear()})}getAll(){return Array.from(E(this,Lt))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Il(n,r))}findAll(t={}){return this.getAll().filter(n=>Il(t,n))}notify(t){Ue.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Ue.batch(()=>Promise.all(t.map(n=>n.continue().catch(qe))))}},Lt=new WeakMap,ut=new WeakMap,Xr=new WeakMap,kd);function Ss(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Et,Od,Tx=(Od=class extends os{constructor(t={}){super();ee(this,Et);this.config=t,W(this,Et,new Map)}build(t,n,r){const s=n.queryKey,i=n.queryHash??rc(s,n);let o=this.get(i);return o||(o=new vx({client:t,queryKey:s,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){E(this,Et).has(t.queryHash)||(E(this,Et).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=E(this,Et).get(t.queryHash);n&&(t.destroy(),n===t&&E(this,Et).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Ue.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return E(this,Et).get(t)}getAll(){return[...E(this,Et).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Ml(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Ml(t,r)):n}notify(t){Ue.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Ue.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Ue.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Et=new WeakMap,Od),Ae,Xt,Jt,or,ar,en,cr,lr,Ad,Px=(Ad=class{constructor(e={}){ee(this,Ae);ee(this,Xt);ee(this,Jt);ee(this,or);ee(this,ar);ee(this,en);ee(this,cr);ee(this,lr);W(this,Ae,e.queryCache||new Tx),W(this,Xt,e.mutationCache||new Ex),W(this,Jt,e.defaultOptions||{}),W(this,or,new Map),W(this,ar,new Map),W(this,en,0)}mount(){ls(this,en)._++,E(this,en)===1&&(W(this,cr,nc.subscribe(async e=>{e&&(await this.resumePausedMutations(),E(this,Ae).onFocus())})),W(this,lr,ti.subscribe(async e=>{e&&(await this.resumePausedMutations(),E(this,Ae).onOnline())})))}unmount(){var e,t;ls(this,en)._--,E(this,en)===0&&((e=E(this,cr))==null||e.call(this),W(this,cr,void 0),(t=E(this,lr))==null||t.call(this),W(this,lr,void 0))}isFetching(e){return E(this,Ae).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return E(this,Xt).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=E(this,Ae).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=E(this,Ae).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(rn(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return E(this,Ae).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=E(this,Ae).get(r.queryHash),i=s==null?void 0:s.state.data,o=ax(t,i);if(o!==void 0)return E(this,Ae).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return Ue.batch(()=>E(this,Ae).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=E(this,Ae).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=E(this,Ae);Ue.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=E(this,Ae);return Ue.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Ue.batch(()=>E(this,Ae).findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(qe).catch(qe)}invalidateQueries(e,t={}){return Ue.batch(()=>(E(this,Ae).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=Ue.batch(()=>E(this,Ae).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,n);return n.throwOnError||(i=i.catch(qe)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(qe)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=E(this,Ae).build(this,t);return n.isStaleByTime(rn(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(qe).catch(qe)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(qe).catch(qe)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return ti.isOnline()?E(this,Xt).resumePausedMutations():Promise.resolve()}getQueryCache(){return E(this,Ae)}getMutationCache(){return E(this,Xt)}getDefaultOptions(){return E(this,Jt)}setDefaultOptions(e){W(this,Jt,e)}setQueryDefaults(e,t){E(this,or).set(Hr(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...E(this,or).values()],n={};return t.forEach(r=>{zr(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){E(this,ar).set(Hr(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...E(this,ar).values()],n={};return t.forEach(r=>{zr(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...E(this,Jt).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=rc(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===ei&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...E(this,Jt).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){E(this,Ae).clear(),E(this,Xt).clear()}},Ae=new WeakMap,Xt=new WeakMap,Jt=new WeakMap,or=new WeakMap,ar=new WeakMap,en=new WeakMap,cr=new WeakMap,lr=new WeakMap,Ad),wp=w.createContext(void 0),_p=e=>{const t=w.useContext(wp);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},kx=({client:e,children:t})=>(w.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(wp.Provider,{value:e,children:t})),xp=w.createContext(!1),Ox=()=>w.useContext(xp);xp.Provider;function Ax(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Rx=w.createContext(Ax()),Nx=()=>w.useContext(Rx),Dx=(e,t,n)=>{const r=n!=null&&n.state.error&&typeof e.throwOnError=="function"?pp(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},Lx=e=>{w.useEffect(()=>{e.clearReset()},[e])},jx=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(s&&e.data===void 0||pp(n,[e.error,r])),Mx=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))}},Ix=(e,t)=>e.isLoading&&e.isFetching&&!t,Fx=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Wl=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Ux(e,t,n){var h,g,p,y;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=Ox(),s=Nx(),i=_p(),o=i.defaultQueryOptions(e);(g=(h=i.getDefaultOptions().queries)==null?void 0:h._experimental_beforeQuery)==null||g.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 c=e.subscribed!==!1;o._optimisticResults=r?"isRestoring":c?"optimistic":void 0,Mx(o),Dx(o,s,a),Lx(s);const d=!i.getQueryCache().get(o.queryHash),[u]=w.useState(()=>new t(i,o)),f=u.getOptimisticResult(o),m=!r&&c;if(w.useSyncExternalStore(w.useCallback(b=>{const v=m?u.subscribe(Ue.batchCalls(b)):qe;return u.updateResult(),v},[u,m]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),w.useEffect(()=>{u.setOptions(o)},[o,u]),Fx(o,f))throw Wl(o,u,s);if(jx({result:f,errorResetBoundary:s,throwOnError:o.throwOnError,query:a,suspense:o.suspense}))throw f.error;if((y=(p=i.getDefaultOptions().queries)==null?void 0:p._experimental_afterQuery)==null||y.call(p,o,f),o.experimental_prefetchInRender&&!Wr.isServer()&&Ix(f,r)){const b=d?Wl(o,u,s):a==null?void 0:a.promise;b==null||b.catch(qe).finally(()=>{u.updateResult()})}return o.notifyOnChangeProps?f:u.trackResult(f)}function Ri(e,t){return Ux(e,wx)}const Sp=S.createContext(null);function Bx(e){return typeof window>"u"?e??null:e?(localStorage.setItem(Jf,e),e):null}function $x({token:e,children:t}){const n=Bx(e);return l.jsx(Sp.Provider,{value:n,children:t})}function Vx(){return S.useContext(Sp)}const Hx="widget-accounts",Cp="widget-positions",Ep="widget-orders",zx=2e4;function ao(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 Wx(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 ic(e){if(e==null||e==="")return"—";if(typeof e=="number"&&Number.isFinite(e)){const t=e>1e12?e:e*1e3;return ao(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 ao(new Date(s))}}const n=Date.parse(t);return Number.isFinite(n)?ao(new Date(n)):t}if(typeof e=="object"&&e!==null){const n=Wx(e);if(n!==void 0)return ic(n)}return"—"}const Tp=["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"],Gx={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 Ni(e,t){for(const n of t)if(e[n]!==void 0&&e[n]!==null&&e[n]!=="")return e[n]}function _t(e,t){const n=Ni(e,t);if(n===void 0)return;const r=Number(n);return Number.isFinite(r)?r:void 0}function Cs(e,t){const n=Ni(e,t);if(n!==void 0)return String(n)}function qx(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 c=i[a];if(Array.isArray(c))return c.filter(d=>typeof d=="object"&&d!==null)}}}return[]}function Ko(e){return e===void 0?.01:e>=100?e/1e4:e}function Kx(e,t){return hf(t,e)}function Zx(e){const t=Ni(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=_t(e,["type","Type","orderType","OrderType"])??2;return{label:Gx[n]??(n%2===1?"sell":"buy"),side:Ys(n),typeNum:n}}function Yx(e,t){const n=_t(e,["volumeFilled","volume_filled","VolumeFilled","filledVolume","FilledVolume"]);if(n!==void 0)return Ko(n);const r=_t(e,["volumeCurrent","volume_current","VolumeCurrent"]);return r!==void 0?Ko(r):0}function Qx(e,t){const n=Cs(e,["ticket","Ticket","order","Order","id","ID"]),r=Cs(e,["symbol","Symbol"])??"";if(!n||!r)return null;const s=Ye(r),{label:i,side:o,typeNum:a}=Zx(e),c=_t(e,["typeTime","TypeTime"])??0,d=Ko(_t(e,["volumeLots","volume_lots","VolumeLots","volume","Volume"])),u=Yx(e),f=_t(e,["priceOrder","price_order","PriceOrder","openPrice","open_price","price","Price"])??0,m=_t(e,["priceTrigger","price_trigger","PriceTrigger","triggerPrice","TriggerPrice"]),h=_t(e,["currentPrice","current_price","PriceCurrent","priceCurrent","marketPrice","MarketPrice"])??f,g=_t(e,["stopLoss","stop_loss","PriceSL","sl","SL"]),p=_t(e,["takeProfit","take_profit","PriceTP","tp","TP"]),y=Cs(e,["comment","Comment"])??"",b=Kx(e,s),v=ic(Ni(e,Tp));return{ticket:n,login:Cs(e,["login","Login"])??t,symbol:s,displaySymbol:_i(s),time:v,typeLabel:i,orderType:a,typeTime:c,side:o,volumeLots:d,volumeFilledLots:u,orderPrice:f,priceTrigger:m,stopLoss:g,takeProfit:p,currentPrice:h,comment:y,digits:b}}function Xx(e,t){return qx(e).map(n=>Qx(n,t)).filter(n=>n!==null)}function Di(e,t){for(const n of t)if(e[n]!==void 0&&e[n]!==null&&e[n]!=="")return e[n]}function Wt(e,t){const n=Di(e,t);if(n===void 0)return;const r=Number(n);return Number.isFinite(r)?r:void 0}function Es(e,t){const n=Di(e,t);if(n!==void 0)return String(n)}function Jx(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 c=i[a];if(Array.isArray(c))return c.filter(d=>typeof d=="object"&&d!==null)}}}return[]}function eS(e){return e===void 0?.01:e>=100?e/1e4:e}function tS(e){const t=Di(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=Wt(e,["type","Type","action","Action"]);return n!==void 0&&n%2===1?"sell":"buy"}function nS(e,t){return hf(t,e)}function rS(e,t){const n=Es(e,["ticket","Ticket","position","Position","order","Order","id","ID"]),r=Es(e,["symbol","Symbol"])??"";if(!n||!r)return null;const s=Ye(r),i=tS(e),o=eS(Wt(e,["volumeLots","volume_lots","VolumeLots","volume","Volume"])),a=Wt(e,["openPrice","open_price","PriceOpen","priceOpen","price","Price"])??0,c=Wt(e,["currentPrice","current_price","PriceCurrent","priceCurrent"])??a,d=Wt(e,["stopLoss","stop_loss","PriceSL","sl","SL"]),u=Wt(e,["takeProfit","take_profit","PriceTP","tp","TP"]),f=Wt(e,["profit","Profit","floating","Floating","pnl","PnL"])??0,m=Wt(e,["swap","Swap"])??0,h=Es(e,["comment","Comment"])??"",g=nS(e,s),p=ic(Di(e,Tp));return{ticket:n,login:Es(e,["login","Login"])??t,symbol:s,displaySymbol:_i(s),time:p,type:i,volumeLots:o,openPrice:a,stopLoss:d,takeProfit:u,currentPrice:c,marketBid:c,marketAsk:c,swap:m,profit:f,comment:h,digits:g}}function sS(e,t){return Jx(e).map(n=>rS(n,t)).filter(n=>n!==null)}function as(){return ep()}function Pp(){const e=mn(),t=Vx(),{data:n,isLoading:r,isError:s}=Ri({queryKey:[Hx,e.baseUrl,t],queryFn:()=>e.getAccounts(),enabled:!!t});return{accounts:n??[],isLoading:r,isError:s}}function iS(e){const t=mn();return Ri({queryKey:[Cp,t.baseUrl,e],queryFn:()=>t.dealer.getPositions(e),enabled:!!e,refetchInterval:zx})}function oS(e){const t=mn();return Ri({queryKey:[Ep,t.baseUrl,e],queryFn:()=>t.dealer.getOrders(e),enabled:!!e})}function aS(){const e=_p(),t=mn();return S.useCallback((n,r)=>{e.invalidateQueries({queryKey:[Cp,t.baseUrl,n]}),(r===void 0||Va(r))&&e.invalidateQueries({queryKey:[Ep,t.baseUrl,n]})},[t.baseUrl,e])}function Li(){const e=mn(),t=aS();return{async submitOrder(n){const r=await e.trading.submitOrder(n);return r.success&&t(n.login,n.orderType),r},async closePosition(n){const r=await e.trading.closePosition(n);return r.success&&t(n.login),r},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}}}function cS(e,t){return e!=null?sS(e,t):[]}function lS(e,t){return e!=null?Xx(e,t):[]}function dS({symbolTicker:e,controlsRef:t,chartWidget:n,scanResultUrl:r,orderState:s}){const{openMarketPanel:i,setSelectedLogin:o}=s,a=as();return S.useEffect(()=>(t.current={open:i,setSelectedLogin:o},()=>{t.current=null}),[t,i,o]),l.jsxs(l.Fragment,{children:[l.jsx(dp,{chartWidget:n,symbolTicker:e,symbols:a}),l.jsx(rp,{}),l.jsx(B_,{symbolTicker:e,scanResultUrl:r,orderState:s})]})}function kp(e){const t=me(d=>d.setPositions),n=me(d=>d.setOrders),{data:r,isLoading:s,isError:i}=iS(e),{data:o,isLoading:a,isError:c}=oS(e);return S.useEffect(()=>{if(!e.trim()){t([]),n([]);return}r!=null&&t(cS(r,e)),o!=null&&n(lS(o,e))},[e,o,r,n,t]),{isLoading:s||a,isError:!!(i||c)}}const Gl=224,ql=32,oc=120;function Op(){return typeof window>"u"?560:Math.max(oc,Math.floor(window.innerHeight*.7))}function uS(e){return Math.min(Op(),Math.max(oc,e))}function fS(){const[e,t]=S.useState(Gl),[n,r]=S.useState(!1),s=S.useRef(Gl);S.useEffect(()=>{s.current=e},[e]);const i=S.useCallback(u=>{t(uS(u))},[]),o=S.useCallback(()=>{i(s.current+ql)},[i]),a=S.useCallback(()=>{i(s.current-ql)},[i]),c=S.useCallback(u=>{const f=u,m=s.current;r(!0);const h=p=>{const y=f-p.clientY;i(m+y)},g=()=>{r(!1),document.removeEventListener("mousemove",h),document.removeEventListener("mouseup",g),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",h),document.addEventListener("mouseup",g),document.body.style.cursor="row-resize",document.body.style.userSelect="none"},[i]);S.useEffect(()=>{const u=()=>{i(s.current)};return window.addEventListener("resize",u),()=>{window.removeEventListener("resize",u),document.body.style.cursor="",document.body.style.userSelect=""}},[i]);const d=Op();return{height:e,isResizing:n,canIncrement:e<d,canDecrement:e>oc,onResizeStart:c,incrementHeight:o,decrementHeight:a}}const pS=e=>e==null?void 0:e.replace(/(\d+)\.0{18}/g,"$1"),hS=2e4;let co=0;function mS(){return co=(co+1)%Number.MAX_VALUE,co.toString()}const lo=new Map,Kl=(e,t)=>{if(lo.has(e))return;const n=setTimeout(()=>{lo.delete(e),Is({type:"REMOVE_TOAST",toastId:e})},t||hS);lo.set(e,n)},gS=(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);Kl(r,s==null?void 0:s.duration)}else e.toasts.forEach(s=>{Kl(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)}}},yS=[];let uo={toasts:[]};function Is(e){uo=gS(uo,e),yS.forEach(t=>{t(uo)})}function xe({duration:e=2e4,description:t,...n}){const r=mS(),s=typeof t=="string"?pS(t):t,i=a=>Is({type:"UPDATE_TOAST",toast:{...a,description:s,id:r}}),o=()=>{Is({type:"DISMISS_TOAST",toastId:r})};return Is({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 bS(e){return e.type==="buy"?e.marketBid??e.currentPrice:e.marketAsk??e.currentPrice}function vS(){const{closePosition:e,deleteOrder:t}=Li(),n=me(p=>p.removePosition),r=me(p=>p.removeOrder),s=me(p=>p.setSelectedPositionTicket),i=me(p=>p.setSelectedOrderTicket),[o,a]=S.useState(new Set),[c,d]=S.useState(!1),u=S.useCallback((p,y)=>{a(b=>{const v=new Set(b);return y?v.add(p):v.delete(p),v})},[]),f=S.useCallback(p=>o.has(p),[o]),m=S.useCallback(async p=>{const y=`position-${p.ticket}`;u(y,!0);try{const b=await e(p);if(!b.success){xe({variant:"destructive",description:b.message||"Failed to close position."});return}n(p.ticket),s(null),xe({description:`Position #${p.ticket} closed at ${bS(p).toFixed(p.digits)}.`})}catch(b){const v=b instanceof Error?b.message:"Failed to close position.";xe({variant:"destructive",description:v})}finally{u(y,!1)}},[e,n,u,s]),h=S.useCallback(async p=>{if(p.length===0||c)return;if(!e){xe({variant:"destructive",description:"Close position is not configured."});return}d(!0);let y=0,b=0;for(const v of p){const x=`position-${v.ticket}`;u(x,!0);try{if(!(await e(v)).success){b+=1;continue}n(v.ticket),y+=1}catch{b+=1}finally{u(x,!1)}}s(null),xe(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}.`}),d(!1)},[c,e,n,u,s]),g=S.useCallback(async p=>{const y=`order-${p.ticket}`;u(y,!0);try{const b=await t(p);if(!b.success){xe({variant:"destructive",description:b.message||"Failed to delete order."});return}r(p.ticket),i(null),xe({description:`Order #${p.ticket} deleted.`})}catch(b){const v=b instanceof Error?b.message:"Failed to delete order.";xe({variant:"destructive",description:v})}finally{u(y,!1)}},[t,r,u,i]);return{closePosition:m,closeAllPositions:h,deleteOrder:g,isClosingAll:c,isRowBusy:f}}function Gt(e,t=2){return e.toFixed(t)}function Ap(e){return e.reduce((t,n)=>t+n.profit+n.swap,0)}function wS(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=Ap(t),a=r+s+o+n,c=a-i,d=i>0?a/i*100:void 0;return{balance:r,equity:a,margin:i,marginFree:c,marginLevel:d,totalProfit:o}}function Zo(){return l.jsxs("colgroup",{children:[l.jsx("col",{className:"web-trading-widget-terminal-col--symbol"}),l.jsx("col",{className:"web-trading-widget-terminal-col--ticket"}),l.jsx("col",{className:"web-trading-widget-terminal-col--time"}),l.jsx("col",{className:"web-trading-widget-terminal-col--type"}),l.jsx("col",{className:"web-trading-widget-terminal-col--volume"}),l.jsx("col",{className:"web-trading-widget-terminal-col--price"}),l.jsx("col",{className:"web-trading-widget-terminal-col--sl"}),l.jsx("col",{className:"web-trading-widget-terminal-col--tp"}),l.jsx("col",{className:"web-trading-widget-terminal-col--price2"}),l.jsx("col",{className:"web-trading-widget-terminal-col--swap"}),l.jsx("col",{className:"web-trading-widget-terminal-col--profit"}),l.jsx("col",{}),l.jsx("col",{className:"web-trading-widget-terminal-col--close"})]})}function _S(){return l.jsx("thead",{children:l.jsxs("tr",{className:"web-trading-widget-terminal__head-row",children:[l.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Symbol"}),l.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Ticket"}),l.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Server time"}),l.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Type"}),l.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Volume"}),l.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Price"}),l.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"S / L"}),l.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"T / P"}),l.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Price"}),l.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Swap"}),l.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Profit"}),l.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Comment"}),l.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--close","aria-label":"Close"})]})})}function xS({balance:e,equity:t,margin:n,marginFree:r,marginLevel:s,totalPnL:i,scrollRef:o,onScroll:a}){const c=i>0?"web-trading-widget-text-profit-positive":i<0?"web-trading-widget-text-profit-negative":"";return l.jsx("div",{className:"web-trading-widget-terminal__stats",children:l.jsx("div",{ref:o,className:"web-trading-widget-terminal__header-scroll",onScroll:a,children:l.jsxs("table",{className:"web-trading-widget-terminal__table",children:[l.jsx(Zo,{}),l.jsx("tbody",{children:l.jsxs("tr",{children:[l.jsx("td",{colSpan:10,className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--nowrap",children:l.jsxs("div",{className:"web-trading-widget-terminal__stats-row web-trading-widget-terminal__stats-row--tabular",children:[l.jsxs("span",{children:["Balance: ",Gt(e)]}),l.jsxs("span",{children:["Equity: ",Gt(t)]}),l.jsxs("span",{children:["Margin: ",Gt(n)]}),l.jsxs("span",{children:["Free margin: ",Gt(r)]}),l.jsxs("span",{children:["Level: ",s!==void 0?`${Gt(s,2)}%`:"0.00%"]})]})}),l.jsx("td",{className:`web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right ${c}`,children:Gt(i)}),l.jsx("td",{className:"web-trading-widget-terminal__cell"}),l.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--close"})]})})]})})})}function SS({positionCount:e,isClosingAll:t,onCloseAllPositions:n}){const r=e>0;return l.jsx("div",{className:"web-trading-widget-terminal__toolbar",children:l.jsx("div",{className:"web-trading-widget-terminal__toolbar-actions",children:r?l.jsx("button",{type:"button",disabled:t,onClick:n,className:"web-trading-widget-terminal__close-all-btn",children:t?"Closing…":"Close all"}):null})})}function CS({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 l.jsxs("tr",{className:`web-trading-widget-terminal__row${t?" web-trading-widget-terminal__row--selected":""}`,onClick:r,children:[l.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.displaySymbol}),l.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.ticket}),l.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--nowrap",children:e.time}),l.jsx("td",{className:`web-trading-widget-terminal__cell web-trading-widget-terminal__cell--capitalize ${i}`,children:e.type}),l.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.volumeLots.toFixed(2)}),l.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:Ce(e.openPrice,e.digits)}),l.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.stopLoss!==void 0?Ce(e.stopLoss,e.digits):""}),l.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.takeProfit!==void 0?Ce(e.takeProfit,e.digits):""}),l.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:Ce(e.currentPrice,e.digits)}),l.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.swap!==0?Gt(e.swap):""}),l.jsx("td",{className:`web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right ${o}`,children:Gt(e.profit)}),l.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--truncate",children:e.comment}),l.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--close",children:l.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:l.jsx(hn,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})})})]})}function ES({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 l.jsxs("tr",{className:`web-trading-widget-terminal__row${t?" web-trading-widget-terminal__row--selected":""}`,onClick:r,children:[l.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.displaySymbol}),l.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.ticket}),l.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--nowrap",children:e.time}),l.jsx("td",{className:`web-trading-widget-terminal__cell web-trading-widget-terminal__cell--capitalize ${i}`,children:e.typeLabel}),l.jsxs("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:[e.volumeLots.toFixed(2)," / ",e.volumeFilledLots.toFixed(2)]}),l.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:Ce(e.orderPrice,e.digits)}),l.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.stopLoss!==void 0?Ce(e.stopLoss,e.digits):""}),l.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.takeProfit!==void 0?Ce(e.takeProfit,e.digits):""}),l.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:Ce(e.currentPrice,e.digits)}),l.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right"}),l.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right"}),l.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--truncate",children:e.comment}),l.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--close",children:l.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:l.jsx(hn,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})})})]})}function Rp({embedded:e=!1,symbolTicker:t="",onSymbolChange:n,onCreateNewOrder:r}){const s=as(),{accounts:i,isLoading:o}=Pp(),a=fS(),{height:c,isResizing:d,onResizeStart:u}=e?{height:0,isResizing:!1,onResizeStart:()=>{}}:a,f=me(H=>H.selectedLogin),m=me(H=>H.selectedPositionTicket),h=me(H=>H.selectedOrderTicket),g=me(H=>H.setSelectedPositionTicket),p=me(H=>H.setSelectedOrderTicket),{isLoading:y}=kp(f),b=me(H=>H.positions),v=me(H=>H.orders),{closePosition:x,closeAllPositions:_,deleteOrder:C,isClosingAll:k,isRowBusy:T}=vS(),R=o||y,A=S.useMemo(()=>f?b.filter(H=>H.login===f):b,[b,f]),O=S.useMemo(()=>f?v.filter(H=>H.login===f):v,[v,f]),D=S.useMemo(()=>{const H=i.find(Q=>Q.login===f);return(H==null?void 0:H.tradeStat)??null},[i,f]),L=S.useMemo(()=>A.map(H=>H.ticket).sort().join("|"),[A]),B=S.useMemo(()=>D?`${D.balance}:${D.credit??0}:${D.equity}:${D.margin}|${L}`:"",[D,L]),U=S.useMemo(()=>{if(!D||A.length===0)return 0;const H=Ap(A);return D.equity-D.balance-(D.credit??0)-H},[B]),z=S.useMemo(()=>wS(D,A,U),[D,A,U]),F=A.length===0&&O.length===0,I=S.useRef(null),N=S.useRef(null),M=S.useRef(null),$=S.useCallback(()=>{_(A)},[_,A]),j=S.useCallback(H=>{const Q=Kb(H,s);Q&&(n==null||n(Q))},[n,s]),se=S.useCallback(H=>{g(H.ticket),j(H.symbol)},[g,j]),re=S.useCallback(H=>{p(H.ticket),j(H.symbol)},[p,j]),ye=S.useCallback(H=>{const Q=I.current,K=N.current,ce=M.current;if(!Q||!K)return;const we=H==="header"?Q.scrollLeft:H==="body"?K.scrollLeft:(ce==null?void 0:ce.scrollLeft)??0;H!=="header"&&(Q.scrollLeft=we),H!=="body"&&(K.scrollLeft=we),ce&&H!=="footer"&&(ce.scrollLeft=we)},[]);return l.jsxs(l.Fragment,{children:[!e&&d?l.jsx("div",{className:"web-trading-widget-terminal-resize-overlay","aria-hidden":!0}):null,l.jsxs("div",{className:`web-trading-widget-terminal${e?" web-trading-widget-terminal--embedded":""}`,style:e?void 0:{height:c},children:[e?null:l.jsx("div",{className:"web-trading-widget-terminal__resize-bar-wrap",children:l.jsx("div",{role:"separator","aria-orientation":"horizontal","aria-label":"Resize terminal panel","aria-valuenow":c,className:"web-trading-widget-terminal__resize-bar",onMouseDown:H=>{H.preventDefault(),u(H.clientY)},children:l.jsx(ff,{className:"web-trading-widget-icon web-trading-widget-icon--sm web-trading-widget-terminal__resize-icon"})})}),l.jsx(SS,{positionCount:A.length,isClosingAll:k,onCloseAllPositions:$}),l.jsx("div",{ref:I,className:"web-trading-widget-terminal__header-scroll",onScroll:()=>ye("header"),children:l.jsxs("table",{className:"web-trading-widget-terminal__table",children:[l.jsx(Zo,{}),l.jsx(_S,{})]})}),l.jsx("div",{ref:N,className:"web-trading-widget-terminal__body-scroll",onScroll:()=>ye("body"),children:l.jsxs("table",{className:"web-trading-widget-terminal__table",children:[l.jsx(Zo,{}),l.jsxs("tbody",{children:[R&&F?l.jsx("tr",{children:l.jsx("td",{colSpan:13,className:"web-trading-widget-terminal__empty-cell",children:"Loading…"})}):null,!R&&F?l.jsx("tr",{children:l.jsx("td",{colSpan:13,className:"web-trading-widget-terminal__empty-cell",children:l.jsxs("div",{className:"web-trading-widget-terminal__empty-inner",children:[l.jsx("p",{className:"web-trading-widget-terminal__empty-text",children:"You don't have any positions"}),r?l.jsx("button",{type:"button",onClick:r,className:"web-trading-widget-terminal__create-btn",children:"Create New Order"}):null]})})}):null,A.map(H=>l.jsx(CS,{position:H,isSelected:m===H.ticket,isClosing:T(`position-${H.ticket}`),onSelect:()=>se(H),onClose:()=>void x(H)},`position-${H.ticket}`)),O.map(H=>l.jsx(ES,{order:H,isSelected:h===H.ticket,isDeleting:T(`order-${H.ticket}`),onSelect:()=>re(H),onDelete:()=>void C(H)},`order-${H.ticket}`))]})]})}),l.jsx(xS,{balance:z.balance,equity:z.equity,margin:z.margin,marginFree:z.marginFree,marginLevel:z.marginLevel,totalPnL:z.totalProfit,scrollRef:M,onScroll:()=>ye("footer")})]})]})}const Yo=224,ni=120;function TS(e){var n;const t=(n=e==null?void 0:e.current)==null?void 0:n.clientHeight;return t&&t>0?Math.max(ni,Math.floor(t*.35)):Yo}function PS(e){var n;const t=(n=e==null?void 0:e.current)==null?void 0:n.clientHeight;return t&&t>0?Math.max(ni,Math.floor(t*.85)):typeof window>"u"?560:Math.max(ni,Math.floor(window.innerHeight*.7))}function kS(e,t){return Math.min(PS(t),Math.max(ni,e))}function OS({containerRef:e,isOpen:t=!1}={}){const[n,r]=S.useState(Yo),[s,i]=S.useState(!1),o=S.useRef(Yo);S.useEffect(()=>{o.current=n},[n]);const a=S.useCallback(d=>{r(kS(d,e))},[e]);S.useEffect(()=>{if(!t)return;const d=Math.max(o.current,TS(e));a(d)},[e,t,a]);const c=S.useCallback(d=>{const u=d,f=o.current;i(!0);const m=g=>{const p=u-g.clientY;a(f+p)},h=()=>{i(!1),document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",h),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",m),document.addEventListener("mouseup",h),document.body.style.cursor="row-resize",document.body.style.userSelect="none"},[a]);return 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:c}}function Np({children:e}){const[t]=S.useState(()=>new Px({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}}));return l.jsx(kx,{client:t,children:e})}function Dp({containerRef:e,onCreateNewOrder:t}){const[n,r]=S.useState(!1),{height:s,isResizing:i,onResizeStart:o}=OS({containerRef:e,isOpen:n}),a=me(g=>g.selectedLogin),c=me(g=>g.orders),d=me(g=>g.positions),u=S.useMemo(()=>a?c.filter(g=>g.login===a):c,[a,c]),f=S.useMemo(()=>a?d.filter(g=>g.login===a):d,[a,d]),m=u.length+f.length,h=()=>{r(!1),t==null||t()};return l.jsxs("div",{className:"web-trading-widget-news-orders-overlay-root",children:[l.jsxs("button",{type:"button",className:"web-trading-widget-news-orders-overlay__trigger","aria-label":"Open terminal","aria-expanded":n,onClick:()=>r(!0),children:[l.jsx(Lb,{className:"web-trading-widget-icon web-trading-widget-icon--sm"}),l.jsx("span",{children:"Orders"}),m>0?l.jsx("span",{className:"web-trading-widget-news-orders-overlay__badge",children:m}):null]}),n?l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:"web-trading-widget-news-orders__backdrop","aria-label":"Close terminal panel",onClick:()=>r(!1)}),l.jsxs("div",{className:"web-trading-widget-news-orders__panel",style:{height:s},children:[i?l.jsx("div",{className:"web-trading-widget-terminal-resize-overlay","aria-hidden":!0}):null,l.jsx("div",{className:"web-trading-widget-news-orders__panel-resize-bar-wrap",children:l.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:l.jsx(ff,{className:"web-trading-widget-icon web-trading-widget-icon--sm web-trading-widget-terminal__resize-icon"})})}),l.jsxs("div",{className:"web-trading-widget-news-orders__panel-header",children:[l.jsx("h2",{className:"web-trading-widget-news-orders__panel-title",children:"Terminal"}),l.jsx("button",{type:"button",className:"web-trading-widget-news-orders__panel-close","aria-label":"Close terminal panel",onClick:()=>r(!1),children:l.jsx(hn,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})})]}),l.jsx("div",{className:"web-trading-widget-news-orders__panel-body",children:l.jsx(Rp,{embedded:!0,onCreateNewOrder:t?h:void 0})})]})]}):null]})}function AS({baseUrl:e,containerRef:t,onCreateNewOrder:n}){return l.jsx(Np,{children:l.jsx(np,{baseUrl:e,children:l.jsx(Dp,{containerRef:t,onCreateNewOrder:n})})})}const Rn=S.forwardRef(({className:e,type:t,...n},r)=>l.jsx("input",{type:t,className:De("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 ji="Collapsible",[RS,Lp]=_r(ji),[NS,ac]=RS(ji),jp=w.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:s,disabled:i,onOpenChange:o,...a}=e,[c,d]=ur({prop:r,defaultProp:s??!1,onChange:o,caller:ji});return l.jsx(NS,{scope:n,disabled:i,contentId:nn(),open:c,onOpenToggle:w.useCallback(()=>d(u=>!u),[d]),children:l.jsx(ve.div,{"data-state":lc(c),"data-disabled":i?"":void 0,...a,ref:t})})});jp.displayName=ji;var Mp="CollapsibleTrigger",Ip=w.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,s=ac(Mp,n);return l.jsx(ve.button,{type:"button","aria-controls":s.open?s.contentId:void 0,"aria-expanded":s.open||!1,"data-state":lc(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...r,ref:t,onClick:Se(e.onClick,s.onOpenToggle)})});Ip.displayName=Mp;var cc="CollapsibleContent",Fp=w.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=ac(cc,e.__scopeCollapsible);return l.jsx(xr,{present:n||s.open,children:({present:i})=>l.jsx(DS,{...r,ref:t,present:i})})});Fp.displayName=cc;var DS=w.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:s,...i}=e,o=ac(cc,n),[a,c]=w.useState(r),d=w.useRef(null),u=Pe(t,d),f=w.useRef(0),m=f.current,h=w.useRef(0),g=h.current,p=o.open||a,y=w.useRef(p),b=w.useRef(void 0);return w.useEffect(()=>{const v=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(v)},[]),Ie(()=>{const v=d.current;if(v){b.current=b.current||{transitionDuration:v.style.transitionDuration,animationName:v.style.animationName},v.style.transitionDuration="0s",v.style.animationName="none";const x=v.getBoundingClientRect();f.current=x.height,h.current=x.width,y.current||(v.style.transitionDuration=b.current.transitionDuration,v.style.animationName=b.current.animationName),c(r)}},[o.open,r]),l.jsx(ve.div,{"data-state":lc(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!p,...i,ref:u,style:{"--radix-collapsible-content-height":m?`${m}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...e.style},children:p&&s})});function lc(e){return e?"open":"closed"}var LS=jp,jS=Ip,MS=Fp,vt="Accordion",IS=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[dc,FS,US]=pu(vt),[Mi]=_r(vt,[US,Lp]),uc=Lp(),Up=w.forwardRef((e,t)=>{const{type:n,...r}=e,s=r,i=r;return l.jsx(dc.Provider,{scope:e.__scopeAccordion,children:n==="multiple"?l.jsx(HS,{...i,ref:t}):l.jsx(VS,{...s,ref:t})})});Up.displayName=vt;var[Bp,BS]=Mi(vt),[$p,$S]=Mi(vt,{collapsible:!1}),VS=w.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},collapsible:i=!1,...o}=e,[a,c]=ur({prop:n,defaultProp:r??"",onChange:s,caller:vt});return l.jsx(Bp,{scope:e.__scopeAccordion,value:w.useMemo(()=>a?[a]:[],[a]),onItemOpen:c,onItemClose:w.useCallback(()=>i&&c(""),[i,c]),children:l.jsx($p,{scope:e.__scopeAccordion,collapsible:i,children:l.jsx(Vp,{...o,ref:t})})})}),HS=w.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},...i}=e,[o,a]=ur({prop:n,defaultProp:r??[],onChange:s,caller:vt}),c=w.useCallback(u=>a((f=[])=>[...f,u]),[a]),d=w.useCallback(u=>a((f=[])=>f.filter(m=>m!==u)),[a]);return l.jsx(Bp,{scope:e.__scopeAccordion,value:o,onItemOpen:c,onItemClose:d,children:l.jsx($p,{scope:e.__scopeAccordion,collapsible:!0,children:l.jsx(Vp,{...i,ref:t})})})}),[zS,Ii]=Mi(vt),Vp=w.forwardRef((e,t)=>{const{__scopeAccordion:n,disabled:r,dir:s,orientation:i="vertical",...o}=e,a=w.useRef(null),c=Pe(a,t),d=FS(n),f=hu(s)==="ltr",m=Se(e.onKeyDown,h=>{var R;if(!IS.includes(h.key))return;const g=h.target,p=d().filter(A=>{var O;return!((O=A.ref.current)!=null&&O.disabled)}),y=p.findIndex(A=>A.ref.current===g),b=p.length;if(y===-1)return;h.preventDefault();let v=y;const x=0,_=b-1,C=()=>{v=y+1,v>_&&(v=x)},k=()=>{v=y-1,v<x&&(v=_)};switch(h.key){case"Home":v=x;break;case"End":v=_;break;case"ArrowRight":i==="horizontal"&&(f?C():k());break;case"ArrowDown":i==="vertical"&&C();break;case"ArrowLeft":i==="horizontal"&&(f?k():C());break;case"ArrowUp":i==="vertical"&&k();break}const T=v%b;(R=p[T].ref.current)==null||R.focus()});return l.jsx(zS,{scope:n,disabled:r,direction:s,orientation:i,children:l.jsx(dc.Slot,{scope:n,children:l.jsx(ve.div,{...o,"data-orientation":i,ref:c,onKeyDown:r?void 0:m})})})}),ri="AccordionItem",[WS,fc]=Mi(ri),Hp=w.forwardRef((e,t)=>{const{__scopeAccordion:n,value:r,...s}=e,i=Ii(ri,n),o=BS(ri,n),a=uc(n),c=nn(),d=r&&o.value.includes(r)||!1,u=i.disabled||e.disabled;return l.jsx(WS,{scope:n,open:d,disabled:u,triggerId:c,children:l.jsx(LS,{"data-orientation":i.orientation,"data-state":Zp(d),...a,...s,ref:t,disabled:u,open:d,onOpenChange:f=>{f?o.onItemOpen(r):o.onItemClose(r)}})})});Hp.displayName=ri;var zp="AccordionHeader",Wp=w.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=Ii(vt,n),i=fc(zp,n);return l.jsx(ve.h3,{"data-orientation":s.orientation,"data-state":Zp(i.open),"data-disabled":i.disabled?"":void 0,...r,ref:t})});Wp.displayName=zp;var Qo="AccordionTrigger",Gp=w.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=Ii(vt,n),i=fc(Qo,n),o=$S(Qo,n),a=uc(n);return l.jsx(dc.ItemSlot,{scope:n,children:l.jsx(jS,{"aria-disabled":i.open&&!o.collapsible||void 0,"data-orientation":s.orientation,id:i.triggerId,...a,...r,ref:t})})});Gp.displayName=Qo;var qp="AccordionContent",Kp=w.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=Ii(vt,n),i=fc(qp,n),o=uc(n);return l.jsx(MS,{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}})});Kp.displayName=qp;function Zp(e){return e?"open":"closed"}var GS=Up,qS=Hp,KS=Wp,Yp=Gp,Qp=Kp;const ZS=GS,Wn=w.forwardRef(({className:e,...t},n)=>l.jsx(qS,{ref:n,className:De("border-b",e),...t}));Wn.displayName="AccordionItem";const Gn=w.forwardRef(({className:e,children:t,...n},r)=>l.jsx(KS,{className:"flex",children:l.jsxs(Yp,{ref:r,className:De("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,l.jsx(Fa,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"})]})}));Gn.displayName=Yp.displayName;const qn=w.forwardRef(({className:e,children:t,...n},r)=>l.jsx(Qp,{ref:r,className:"overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...n,children:l.jsx("div",{className:De("pb-4 pt-0",e),children:t})}));qn.displayName=Qp.displayName;function Zl(e){const t=e.trim().replace(/,/g,"");if(!t)return null;const n=Number(t);return Number.isFinite(n)?n:null}function Yl(e,t){return t<=0?String(Math.round(e)):e.toFixed(t)}function Ne({label:e,value:t,onChange:n,step:r=.01,min:s,decimals:i=2,placeholder:o,basePrice:a,disabled:c=!1,clearable:d=!1}){const u=t.trim()!=="",f=g=>{if(c)return;const p=Zl(t),y=a!=null&&Number.isFinite(a)?a:s??0,v=(p??y)+g*r,x=s!==void 0?Math.max(s,v):v;x<=0||n(Yl(x,i))},m=()=>{const g=Zl(t);if(g===null||g<=0){t.trim()!==""&&n("");return}n(Yl(g,i))},h=()=>{c||n("")};return l.jsxs("div",{className:"web-trading-widget-stepper",children:[l.jsxs("div",{className:"web-trading-widget-stepper__header",children:[l.jsx("span",{className:"web-trading-widget-stepper__label",children:e}),d&&u?l.jsx("button",{type:"button","aria-label":`Clear ${e}`,className:"web-trading-widget-stepper__clear",disabled:c,onClick:h,children:l.jsx(hn,{className:"web-trading-widget-icon web-trading-widget-icon--xs"})}):null]}),l.jsxs("div",{className:`web-trading-widget-stepper__control${c?" web-trading-widget-stepper__control--disabled":""}`,children:[l.jsx("button",{type:"button","aria-label":`Decrease ${e}`,className:"web-trading-widget-stepper__btn web-trading-widget-stepper__btn--minus",disabled:c||a===null&&t.trim()==="",onClick:()=>f(-1),children:l.jsx(Mb,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})}),l.jsx("input",{type:"text",inputMode:"decimal",value:t,placeholder:o,disabled:c,onChange:g=>n(g.target.value),onBlur:m,className:"web-trading-widget-stepper__input"}),l.jsx("button",{type:"button","aria-label":`Increase ${e}`,className:"web-trading-widget-stepper__btn web-trading-widget-stepper__btn--plus",disabled:c||a===null&&t.trim()==="",onClick:()=>f(1),children:l.jsx(Ib,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})})]})]})}function YS({symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:s,minVolumeLots:i,isSubmitting:o,isAccountsLoading:a,selectedLogin:c,embedded:d=!1,onMinimize:u,onClose:f,onPlaceOrder:m}){const[h,g]=S.useState("market"),[p,y]=S.useState(String(r)),[b,v]=S.useState(""),[x,_]=S.useState(""),C=ie(te=>te.stopLoss),k=ie(te=>te.takeProfit),T=ie(te=>te.setStopLoss),R=ie(te=>te.setTakeProfit),A=ie(te=>te.setVolumeLots),O=ie(te=>te.setOrderSide),[D,L]=S.useState(""),[B,U]=S.useState(ft.GTC),[z,F]=S.useState(""),[I,N]=S.useState(""),M=Number(Ut(Bt(e))),$=Er(M),j=bf(t,n),se=t!==null?Ce(t,M):"—",re=n!==null?Ce(n,M):"—",ye=Si(h),H=mf(h),Q=xi(h),K=Q.label,ce=!ye&&Q.orderType!==null&&Q.orderType%2===1,we=S.useMemo(()=>j!==null?j:t??n,[n,t,j]),le=te=>{y(te);const $e=Number(te);Number.isFinite($e)&&$e>0&&A($e)},de=te=>t===null||n===null?null:ye?te==="buy"?n:t:pt(b)??(te==="buy"?n:t),ne=te=>{const $e=de(te);$e!==null&&O({side:te,entryPrice:$e})},je=te=>{if(t===null||n===null||!c)return;const $e=Math.max(i,Number(p)||i),Fi=Po(h,te),cs=de(te);cs!==null&&O({side:te,entryPrice:cs}),m({login:c,executionMode:h,side:te,orderType:Fi,volumeLots:$e,stopLoss:C,takeProfit:k,priceOrder:b,priceTrigger:x,comment:D,typeTime:B,expirationDateTime:z,expirationDay:I,bid:t,ask:n})},Re=t!==null&&n!==null,Oe=ye||pt(b)!==void 0,X=!H||pt(x)!==void 0,Te=ye||Ei(B,z,I),Fe=!o&&!a&&c!==""&&Re&&Oe&&X&&Te,Qe=!ye&&za(B),ct=!ye&&Wa(B);return l.jsxs("div",{className:"web-trading-widget-market-panel",children:[l.jsxs("div",{className:"web-trading-widget-market-panel__header",children:[l.jsxs(Gs,{value:h,onValueChange:te=>g(te),children:[l.jsx(Ur,{className:"web-trading-widget-market-panel__select-trigger",children:l.jsx(qs,{})}),l.jsx(Br,{children:Zs.map(te=>l.jsx($r,{value:te.mode,children:te.label},te.mode))})]}),d?null:l.jsxs("div",{className:"web-trading-widget-market-panel__header-actions",children:[l.jsx("button",{type:"button","aria-label":"Minimize to quick order panel",className:"web-trading-widget-market-panel__header-btn",onClick:u,children:l.jsx(jb,{className:"web-trading-widget-icon web-trading-widget-icon--md"})}),l.jsx("button",{type:"button","aria-label":"Close order panel",className:"web-trading-widget-market-panel__header-btn",onClick:f,children:l.jsx(hn,{className:"web-trading-widget-icon web-trading-widget-icon--md"})})]})]}),l.jsxs(ZS,{type:"multiple",defaultValue:["volume-setting","risk-management"],className:"web-trading-widget-market-panel__accordion",children:[l.jsxs(Wn,{value:"volume-setting",className:"web-trading-widget-market-panel__accordion-item",children:[l.jsx(Gn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Volume Setting"}),l.jsx(qn,{className:"web-trading-widget-market-panel__accordion-content",children:l.jsx(Ne,{label:"Lots",value:p,onChange:le,step:s,min:i,decimals:2})})]}),ye?null:l.jsxs(Wn,{value:"order-price",className:"web-trading-widget-market-panel__accordion-item",children:[l.jsx(Gn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Order Price"}),l.jsx(qn,{className:"web-trading-widget-market-panel__accordion-content",children:H?l.jsxs(l.Fragment,{children:[l.jsx(Ne,{label:"Stop Price",value:x,onChange:_,step:$,decimals:M,basePrice:we,placeholder:j!==null?Ce(j,M):"—"}),l.jsx(Ne,{label:"Limit Price",value:b,onChange:v,step:$,decimals:M,basePrice:we,placeholder:j!==null?Ce(j,M):"—"})]}):l.jsx(Ne,{label:"Price",value:b,onChange:v,step:$,decimals:M,basePrice:we,placeholder:j!==null?Ce(j,M):"—"})})]}),l.jsxs(Wn,{value:"risk-management",className:"web-trading-widget-market-panel__accordion-item",children:[l.jsx(Gn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Risk Management"}),l.jsx(qn,{className:"web-trading-widget-market-panel__accordion-content",children:l.jsxs("div",{className:"web-trading-widget-market-panel__grid-2",children:[l.jsx(Ne,{label:"Stop Loss",value:C,onChange:T,step:$,decimals:M,basePrice:t,placeholder:t!==null?se:"—",clearable:!0}),l.jsx(Ne,{label:"Take Profit",value:k,onChange:R,step:$,decimals:M,basePrice:n,placeholder:n!==null?re:"—",clearable:!0})]})})]}),ye?null:l.jsxs(Wn,{value:"expiration",className:"web-trading-widget-market-panel__accordion-item",children:[l.jsx(Gn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Expiration"}),l.jsxs(qn,{className:"web-trading-widget-market-panel__accordion-content",children:[l.jsxs(Gs,{value:String(B),onValueChange:te=>U(Number(te)),children:[l.jsx(Ur,{className:"web-trading-widget-market-panel__select-full",children:l.jsx(qs,{})}),l.jsx(Br,{children:gf.map(te=>l.jsx($r,{value:String(te.value),children:te.label},te.value))})]}),Qe?l.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[l.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Expiration time"}),l.jsx(Rn,{type:"datetime-local",value:z,onChange:te=>F(te.target.value)})]}):null,ct?l.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[l.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Expiration day"}),l.jsx(Rn,{type:"date",value:I,onChange:te=>N(te.target.value)})]}):null]})]}),l.jsxs(Wn,{value:"comment",className:"web-trading-widget-market-panel__accordion-item",children:[l.jsx(Gn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Comment"}),l.jsx(qn,{className:"web-trading-widget-market-panel__accordion-content",children:l.jsx(Rn,{value:D,onChange:te=>L(te.target.value),placeholder:""})})]})]}),l.jsxs("div",{className:"web-trading-widget-market-panel__footer",children:[l.jsxs("div",{className:"web-trading-widget-market-panel__quotes",children:[l.jsx("span",{children:se}),l.jsx("span",{className:"web-trading-widget-market-panel__quotes-ask",children:re})]}),ye?l.jsxs("div",{className:"web-trading-widget-market-panel__actions",children:[l.jsx(ot,{type:"button",variant:"destructive",className:"web-trading-widget-market-panel__sell-btn",disabled:!Fe,onMouseDown:()=>ne("sell"),onClick:()=>je("sell"),children:"Sell by Market"}),l.jsx(ot,{type:"button",className:"web-trading-widget-market-panel__buy-btn",disabled:!Fe,onMouseDown:()=>ne("buy"),onClick:()=>je("buy"),children:"Buy by Market"})]}):l.jsxs(ot,{type:"button",variant:ce?"destructive":"default",className:`web-trading-widget-market-panel__place-btn${ce?"":" web-trading-widget-market-panel__place-btn--buy"}`,disabled:!Fe,onMouseDown:()=>{const te=Q.orderType!==null&&Q.orderType%2===1?"sell":"buy";ne(te)},onClick:()=>{const te=Q.orderType!==null&&Q.orderType%2===1?"sell":"buy";je(te)},children:["Place ",K]})]})]})}function Xp({confirmation:e,symbolTicker:t,onDismiss:n}){const r=Number(Ut(Bt(t))),s=Ce(e.price,r),i=e.side==="sell"?"sell":"buy",o=_i(e.symbol||Ci(t));return l.jsxs("div",{className:"web-trading-widget-confirmation",children:[l.jsx("div",{className:"web-trading-widget-confirmation__close-row",children:l.jsx("button",{type:"button","aria-label":"Close confirmation",className:"web-trading-widget-confirmation__close-btn",onClick:n,children:l.jsx(hn,{className:"web-trading-widget-icon web-trading-widget-icon--md"})})}),l.jsxs("div",{className:"web-trading-widget-confirmation__body",children:[l.jsxs("p",{className:"web-trading-widget-confirmation__summary",children:[l.jsxs("span",{className:"web-trading-widget-confirmation__ticket",children:["#",e.ticket]})," ",l.jsx("span",{className:`web-trading-widget-confirmation__side web-trading-widget-confirmation__side--${e.side}`,children:i})," ",e.volumeLots.toFixed(2)," ",o]}),l.jsxs("p",{className:"web-trading-widget-confirmation__price",children:["at ",s]}),l.jsx("p",{className:"web-trading-widget-confirmation__status",children:"Placed"}),l.jsx(ot,{type:"button",className:"web-trading-widget-confirmation__ok-btn",onClick:n,children:"OK"})]})]})}function Ts(e,t){return e.toLocaleString(void 0,{minimumFractionDigits:t,maximumFractionDigits:t})}function fo(e){const t=e.trim();if(!t)return;const n=Number(t);return Number.isFinite(n)?n:void 0}function Jp({order:e,onClose:t}){const{deleteOrder:n,modifyOrder:r}=Li(),s=me(I=>I.removeOrder),[i,o]=S.useState(String(e.volumeLots)),[a,c]=S.useState(String(e.orderPrice)),[d,u]=S.useState(e.priceTrigger!==void 0?String(e.priceTrigger):""),f=ie(I=>I.stopLoss),m=ie(I=>I.takeProfit),h=ie(I=>I.setStopLoss),g=ie(I=>I.setTakeProfit),p=ie(I=>I.setDraft),y=ie(I=>I.clearDraft),[b,v]=S.useState(e.comment),[x,_]=S.useState(!1),[C,k]=S.useState(!1),T=Er(e.digits);S.useEffect(()=>(p({source:"order",entryPrice:e.orderPrice,stopLoss:e.stopLoss!==void 0?String(e.stopLoss):"",takeProfit:e.takeProfit!==void 0?String(e.takeProfit):"",side:e.side,showEntryLine:!0,volumeLots:e.volumeLots,digits:e.digits,priceStep:T}),()=>{y()}),[y,e.digits,e.orderPrice,e.side,e.stopLoss,e.takeProfit,e.volumeLots,T,p]);const R=Ha(e.orderType),A=e.volumeLots,O=Number(a)||e.orderPrice,D=fo(d),L=x||C,B=!R||D!==void 0&&Number.isFinite(O)&&O>0,U=S.useMemo(()=>`Delete #${e.ticket} ${e.typeLabel} ${A.toFixed(2)} ${e.displaySymbol} at ${Ts(O,e.digits)}`,[e,O,A]),z=async()=>{if(!B){xe({variant:"destructive",description:R?"Please set both stop and limit prices.":"Please set an order price."});return}_(!0);try{const I=await r(e,{volumeLots:A,priceOrder:O,priceTrigger:R?D:void 0,stopLoss:fo(f),takeProfit:fo(m),comment:b.trim()||"order modify"});if(!I.success){xe({variant:"destructive",description:I.message||"Failed to modify order."});return}t(),xe({description:`Order #${e.ticket} updated.`})}catch(I){const N=I instanceof Error?I.message:"Failed to modify order.";xe({variant:"destructive",description:N})}finally{_(!1)}},F=async()=>{k(!0);try{const I=await n(e);if(!I.success){xe({variant:"destructive",description:I.message||"Failed to delete order."});return}s(e.ticket),t(),xe({description:`Order #${e.ticket} deleted.`})}catch(I){const N=I instanceof Error?I.message:"Failed to delete order.";xe({variant:"destructive",description:N})}finally{k(!1)}};return l.jsxs("div",{className:"web-trading-widget-detail-panel",children:[l.jsxs("div",{className:"web-trading-widget-detail-panel__header",children:[l.jsxs("p",{className:`web-trading-widget-detail-panel__title web-trading-widget-detail-panel__title--${e.side}`,children:["#",e.ticket," ",e.typeLabel," ",A.toFixed(2)," / ",e.volumeFilledLots.toFixed(2)," ",e.displaySymbol," ",R&&D!==void 0?`${Ts(D,e.digits)} / ${Ts(O,e.digits)}`:Ts(O,e.digits)]}),l.jsx("button",{type:"button","aria-label":"Close order panel",className:"web-trading-widget-icon-btn",onClick:t,children:l.jsx(hn,{className:"web-trading-widget-icon web-trading-widget-icon--md"})})]}),l.jsxs("div",{className:"web-trading-widget-detail-panel__body",children:[l.jsx(Ne,{label:"Lots",value:i,onChange:o,step:.01,min:.01,decimals:2,disabled:!0}),R?l.jsxs(l.Fragment,{children:[l.jsx(Ne,{label:"Stop Price",value:d,onChange:u,step:T,decimals:e.digits,basePrice:e.currentPrice}),l.jsx(Ne,{label:"Limit Price",value:a,onChange:c,step:T,decimals:e.digits,basePrice:e.currentPrice})]}):l.jsx(Ne,{label:"Price",value:a,onChange:c,step:T,decimals:e.digits,basePrice:e.currentPrice}),l.jsxs("div",{className:"web-trading-widget-market-panel__grid-2",children:[l.jsx(Ne,{label:"Stop Loss",value:f,onChange:h,step:T,decimals:e.digits,basePrice:e.currentPrice,placeholder:"—"}),l.jsx(Ne,{label:"Take Profit",value:m,onChange:g,step:T,decimals:e.digits,basePrice:e.currentPrice,placeholder:"—"})]}),l.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[l.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Comment"}),l.jsx(Rn,{value:b,onChange:I=>v(I.target.value)})]}),l.jsx(ot,{type:"button",variant:"secondary",className:"web-trading-widget-detail-panel__btn-full",disabled:L||!B,onClick:()=>void z(),children:"Modify"}),l.jsx(ot,{type:"button",className:"web-trading-widget-detail-panel__action-btn",disabled:L,onClick:()=>void F(),children:U})]})]})}function Ps(e,t){return e.toLocaleString(void 0,{minimumFractionDigits:t,maximumFractionDigits:t})}function QS(e){return e.type==="buy"?e.marketBid??e.currentPrice:e.marketAsk??e.currentPrice}function eh({position:e,onClose:t}){const{closePosition:n}=Li(),r=me(C=>C.removePosition),[s,i]=S.useState(String(e.volumeLots)),o=ie(C=>C.stopLoss),a=ie(C=>C.takeProfit),c=ie(C=>C.setStopLoss),d=ie(C=>C.setTakeProfit),u=ie(C=>C.setDraft),f=ie(C=>C.clearDraft),[m,h]=S.useState(e.comment),[g,p]=S.useState(!1),y=Er(e.digits);S.useEffect(()=>(u({source:"position",entryPrice:e.openPrice,stopLoss:e.stopLoss!==void 0?String(e.stopLoss):"",takeProfit:e.takeProfit!==void 0?String(e.takeProfit):"",side:e.type,showEntryLine:!0,volumeLots:e.volumeLots,digits:e.digits,priceStep:y}),()=>{f()}),[f,e.digits,e.openPrice,e.stopLoss,e.takeProfit,e.type,e.volumeLots,y,u]);const b=QS(e),v=e.volumeLots,x=S.useMemo(()=>{const C=e.profit.toFixed(2);return`Close #${e.ticket} ${e.type} ${v.toFixed(2)} ${e.displaySymbol} ${Ps(e.openPrice,e.digits)} at ${Ps(b,e.digits)} with Profit ${C}`},[b,e,v]),_=async()=>{p(!0);try{const C=await n(e);if(!C.success){xe({variant:"destructive",description:C.message||"Failed to close position."});return}r(e.ticket),t(),xe({description:`Position #${e.ticket} closed.`})}catch(C){const k=C instanceof Error?C.message:"Failed to close position.";xe({variant:"destructive",description:k})}finally{p(!1)}};return l.jsxs("div",{className:"web-trading-widget-detail-panel",children:[l.jsxs("div",{className:"web-trading-widget-detail-panel__header",children:[l.jsxs("p",{className:"web-trading-widget-detail-panel__title web-trading-widget-detail-panel__title--position",children:["#",e.ticket," ",e.type," ",v.toFixed(2)," ",e.displaySymbol," ",Ps(e.openPrice,e.digits)]}),l.jsx("button",{type:"button","aria-label":"Close position panel",className:"web-trading-widget-icon-btn",onClick:t,children:l.jsx(hn,{className:"web-trading-widget-icon web-trading-widget-icon--md"})})]}),l.jsxs("div",{className:"web-trading-widget-detail-panel__body",children:[l.jsx(Ne,{label:"Lots",value:s,onChange:i,step:.01,min:.01,decimals:2,disabled:!0}),l.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[l.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Price"}),l.jsx(Rn,{readOnly:!0,disabled:!0,value:Ps(e.openPrice,e.digits),className:"web-trading-widget-detail-panel__input-muted"})]}),l.jsxs("div",{className:"web-trading-widget-market-panel__grid-2",children:[l.jsx(Ne,{label:"Stop Loss",value:o,onChange:c,step:y,decimals:e.digits,basePrice:e.marketBid??e.openPrice,placeholder:"—"}),l.jsx(Ne,{label:"Take Profit",value:a,onChange:d,step:y,decimals:e.digits,basePrice:e.marketAsk??e.openPrice,placeholder:"—"})]}),l.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[l.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Comment"}),l.jsx(Rn,{value:m,onChange:C=>h(C.target.value)})]}),l.jsx(ot,{type:"button",variant:"secondary",className:"web-trading-widget-detail-panel__btn-full",disabled:!0,children:"Modify"}),l.jsx(ot,{type:"button",className:"web-trading-widget-detail-panel__action-btn",disabled:g,onClick:()=>void _(),children:x})]})]})}function Ql({symbolTicker:e,orderState:t}){const n=tc(e),{confirmation:r,isSubmitting:s,defaultVolumeLots:i,volumeStep:o,minVolumeLots:a,selectedLogin:c,isAccountsLoading:d,hasConfirmedAccount:u,dismissConfirmation:f,placeMarketOrder:m}=t,h=me(T=>T.positions),g=me(T=>T.orders),p=me(T=>T.selectedPositionTicket),y=me(T=>T.selectedOrderTicket),b=me(T=>T.setSelectedPositionTicket),v=me(T=>T.setSelectedOrderTicket),x=p!==null?h.find(T=>T.ticket===p)??null:null,_=y!==null?g.find(T=>T.ticket===y)??null:null,C=r!==null,k=S.useCallback(T=>{m({symbolTicker:e,login:T.login,executionMode:T.executionMode,side:T.side,orderType:T.orderType,volumeLots:T.volumeLots,stopLoss:T.stopLoss,takeProfit:T.takeProfit,priceOrder:T.priceOrder,priceTrigger:T.priceTrigger,comment:T.comment,typeTime:T.typeTime,expirationDateTime:T.expirationDateTime,expirationDay:T.expirationDay,bid:T.bid,ask:T.ask})},[m,e]);return x!==null?l.jsx(eh,{position:x,onClose:()=>b(null)}):_!==null?l.jsx(Jp,{order:_,onClose:()=>v(null)}):C&&r!==null?l.jsx(Xp,{confirmation:r,symbolTicker:e,onDismiss:f}):u?l.jsx(YS,{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:c,onPlaceOrder:k}):l.jsx("div",{className:"web-trading-widget-side-panel__empty",children:"Select a trading account to start placing orders."})}function Xl({label:e,isActive:t,onClick:n}){return l.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 XS({symbolTicker:e,orderState:t,scanResultUrl:n,onScanResultLoad:r,initialTab:s="trade"}){const i=!!n,[o,a]=S.useState(s);return l.jsx("aside",{className:`web-trading-widget-side-panel${i?" web-trading-widget-side-panel--with-scan":""}`,children:i?l.jsxs("div",{className:"web-trading-widget-side-panel__scan-layout",children:[l.jsxs("div",{role:"tablist","aria-label":"Chart side panel",className:"web-trading-widget-side-panel__tablist",children:[l.jsx(Xl,{label:"Trade",isActive:o==="trade",onClick:()=>a("trade")}),l.jsx(Xl,{label:"Scan Result",isActive:o==="scan",onClick:()=>a("scan")})]}),l.jsxs("div",{className:"web-trading-widget-side-panel__panels",children:[l.jsx("div",{role:"tabpanel",hidden:o!=="trade",className:"web-trading-widget-side-panel__tabpanel",children:l.jsx(Ql,{symbolTicker:e,orderState:t})}),l.jsx("div",{role:"tabpanel",hidden:o!=="scan",className:"web-trading-widget-side-panel__tabpanel web-trading-widget-side-panel__tabpanel--scan",children:l.jsx("iframe",{src:n??void 0,title:"Scan result",className:"web-trading-widget-side-panel__iframe",onLoad:r},n)})]})]}):l.jsx("div",{className:"web-trading-widget-side-panel__scroll",children:l.jsx(Ql,{symbolTicker:e,orderState:t})})})}const JS=.01,e0=.01,Jl=.01;function t0({symbols:e,defaultPanelAfterConfirm:t="mini"}){const[n,r]=S.useState("closed"),[s,i]=S.useState(null),[o,a]=S.useState(!1),[c,d]=S.useState(!1),[u,f]=S.useState(null),m=me(O=>O.setSelectedLogin),{accounts:h,isLoading:g}=Pp(),{submitOrder:p}=Li(),y=S.useMemo(()=>Gb(h),[h]),b=S.useMemo(()=>qb(h),[h]),v=S.useMemo(()=>u!==null&&y.some(O=>O.login===u)?u:b,[y,b,u]);S.useEffect(()=>{v&&m(v)},[v,m]);const x=S.useCallback(O=>{f(O),m(O)},[m]),_=S.useCallback(O=>{O&&(x(O),d(!0),i(null),r(t))},[t,x]),C=S.useCallback(()=>{i(null),r("market")},[]),k=S.useCallback(()=>{i(null),r("mini")},[]),T=S.useCallback(()=>{i(null),r("mini")},[]),R=S.useCallback(()=>{i(null),r("mini")},[]),A=S.useCallback(async O=>{const D=O.login.trim();if(!D){xe({variant:"destructive",description:"Please select a trading account."});return}const L=Math.max(Jl,O.volumeLots),B=Ci(O.symbolTicker,e);Number(Ut(Bt(O.symbolTicker,e)));const U=Si(O.executionMode),z=Ha(O.orderType),F=pt(O.priceOrder),I=pt(O.priceTrigger);if(!U&&F===void 0){xe({variant:"destructive",description:z?"Please set a limit price for this order.":"Please set an order price for pending orders."});return}if(z&&I===void 0){xe({variant:"destructive",description:"Please set a stop price for stop limit orders."});return}if(!U&&!Ei(O.typeTime,O.expirationDateTime,O.expirationDay)){xe({variant:"destructive",description:"Please set an expiration date for this order."});return}const N=U?O.side==="buy"?O.ask:O.bid:F??(O.side==="buy"?O.ask:O.bid);a(!0);try{const M=await p({login:D,symbolTicker:O.symbolTicker,executionMode:O.executionMode,side:Ys(O.orderType),orderType:O.orderType,volumeLots:L,stopLoss:pt(O.stopLoss),takeProfit:pt(O.takeProfit),priceOrder:Va(O.orderType)?F:void 0,priceTrigger:z?I:void 0,comment:O.comment.trim(),typeTime:O.typeTime,expirationDateTime:O.expirationDateTime,expirationDay:O.expirationDay,bid:O.bid,ask:O.ask});if(!M.success){xe({variant:"destructive",description:M.message||"Order was not accepted."});return}i({ticket:M.ticket??"",side:M.side??Ys(O.orderType),volumeLots:M.volumeLots??L,symbol:M.displaySymbol??B,price:M.price??N}),r("confirmation")}catch(M){const $=M instanceof Error?M.message:"Failed to place order.";xe({variant:"destructive",description:$})}finally{a(!1)}},[p,e]);return{panel:n,confirmation:s,isSubmitting:o,defaultVolumeLots:JS,volumeStep:e0,minVolumeLots:Jl,accountOptions:y,selectedLogin:v,setSelectedLogin:x,isAccountsLoading:g,hasConfirmedAccount:c,confirmAccountSelection:_,openMarketPanel:C,openMiniPanel:k,closePanels:T,dismissConfirmation:R,placeMarketOrder:A}}function si(e){var t;if(typeof window<"u"){const n=localStorage.getItem(Ir);if(n&&e.some(r=>r.ticker===n))return n}return((t=e[0])==null?void 0:t.ticker)??"XAU_USD"}function th(e,t,n){var r;return((r=t.find(s=>s.display_name===e||s.ticker===e))==null?void 0:r.ticker)??n}function n0({chartWidget:e,symbols:t,chartSlotElement:n,onSymbolTickerChange:r,onScanResultUrlChange:s,selectSymbolTickerRef:i}){const o=S.useMemo(()=>si(t),[t]),a=S.useRef(o),c=S.useRef(e),[d,u]=S.useState(null);S.useEffect(()=>{c.current=e},[e]),S.useEffect(()=>{if(!n){u(null);return}const m=()=>{const g=n.querySelector(":scope > div");u(g)};m();const h=new MutationObserver(m);return h.observe(n,{childList:!0}),()=>{h.disconnect()}},[n]);const f=S.useCallback(m=>{if(m===a.current)return;const h=t.find(p=>p.ticker===m);if(!h)return;a.current=m,localStorage.setItem(Ir,m),r(m),s(null);const g=c.current;if(g)try{g.onChartReady(()=>{g.activeChart().setSymbol(h.ticker)})}catch{}},[s,r,t]);return S.useEffect(()=>(i.current=f,()=>{i.current=null}),[f,i]),S.useEffect(()=>{if(!e)return;let m=!1,h=null;try{e.onChartReady(()=>{if(m)return;let g;try{g=e.activeChart()}catch{return}const p=y=>{const b=g.symbol(),v=th(b,t,o);v!==a.current&&s(null);try{e.resetCache()}catch{}a.current=v,localStorage.setItem(Ir,v),r(v)};g.onSymbolChanged().subscribe(null,p),h=()=>{try{g.onSymbolChanged().unsubscribe(null,p)}catch{}}})}catch{}return()=>{m=!0,h==null||h()}},[e,s,r,o,t]),{chartContainer:d}}const r0=Ld("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 s0({className:e,variant:t,...n}){return l.jsx("div",{className:De(r0({variant:t}),e),...n})}function nh(){var t;const e=(t=window.TradingView)==null?void 0:t.widget;return typeof e=="function"?e:null}function Fs(){return nh()!==null}const ed="/charting_library/charting_library.js";function i0({onLoad:e}){return S.useEffect(()=>{if(Fs()){e();return}const t=document.querySelector(`script[src="${ed}"]`);if(t){const r=()=>{Fs()&&e()};return t.addEventListener("load",r),()=>t.removeEventListener("load",r)}const n=document.createElement("script");return n.src=ed,n.async=!1,n.onload=()=>{Fs()&&e()},n.onerror=()=>{console.error("Failed to load TradingView charting library")},document.head.appendChild(n),()=>{n.onload=null,n.onerror=null}},[e]),null}const td=Ti(e=>({playEndTimestamp:null,setPlayEndTimestamp:t=>e({playEndTimestamp:t})})),rh=Ti(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})})),Xo=8,sh=4,Jo=5,ea=e=>e==="1"?60:e==="5"?300:e==="1D"?1440*3600:parseInt(e,10)*60,o0=e=>{const t=new Date(e+Xo*60*60*1e3),n=t.getUTCDay(),r=t.getUTCHours();return n===0?!1:n===1?r>=Jo:n===6?r<=sh:!0},a0=e=>{const t=new Date(e+Xo*60*60*1e3),n=t.getUTCDay(),r=t.getUTCHours();if(n===0||n===1&&r<Jo||n===6&&r>=sh){const s=(8-n)%7;return t.setUTCDate(t.getUTCDate()+s),t.setUTCHours(Jo,0,0,0),t.getTime()-Xo*60*60*1e3}return e},c0=(e,t,n)=>{const r=ea(t)*1e3,s=[];let i=e;for(let o=0;o<n;o++)i+=r,o0(i)||(i=a0(i)),s.push(i);return s},l0=(e,t,n,r)=>{if(n<=0)return[];if(r==="24x7"){const i=ea(t)*1e3;return Array.from({length:n},(o,a)=>e+(a+1)*i)}if(r==="1700-1700")return c0(e,t,n);const s=ea(t)*1e3;return Array.from({length:n},(i,o)=>e+(o+1)*s)},d0=(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},nd="wss://symbols.opheleo.com";function u0(e){return{1:6e4,5:3e5,15:9e5,30:18e5,60:36e5,240:144e5}[e]??6e4}function rd(e){return e.trim().toUpperCase()}function f0(e,t){return Math.floor(e/t)*t}let Nr;async function p0(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),ke({baseURL:"https://corprate-widget.iccandle.ai",url:`/chart/endTimestamp?${t.toString()}`,method:"GET"})}class h0{constructor(t,n,r=un,s=nd){st(this,"futureBarsRef");st(this,"type");st(this,"symbols");st(this,"tickWebSocketUrl");st(this,"configuration",{supported_resolutions:["1","5","15","30","60"],supports_marks:!1,supports_timescale_marks:!0,supports_time:!1});st(this,"ws",null);st(this,"isWsConnecting",!1);st(this,"wsSelectedSymbol",null);st(this,"subscriptions",new Map);st(this,"lastBarsCache",new Map);st(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||nd}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 f;const o=(f=t.library_custom_fields)==null?void 0:f.ticker,a=this.symbols.find(m=>o!==void 0&&m.ticker===o||m.ticker===t.ticker||m.display_name===t.name||m.display_name===t.ticker),c={symbol:(a==null?void 0:a.ticker)||"",timeframe:n};if(r.firstDataRequest&&(Nr=void 0),!r.firstDataRequest)if(Nr)c.last_evaluated_key=Nr;else{s([],{noData:!0});return}const u=td.getState().playEndTimestamp;u&&(c.endTimestamp=u,td.getState().setPlayEndTimestamp(null),Nr=void 0),(async()=>{var m;try{const{data:h}=await p0(c);if(h.data_status==="threshold_limited"){s([],{noData:!0});return}if(h.data_status==="end_of_data"){s([],{noData:!0});return}if(!((m=h.items)!=null&&m.length)){s([],{noData:!0});return}Nr=h.last_evaluated_key;const p=[...h.items].map(x=>({open:x.o,high:x.h,low:x.l,close:x.c,time:d0(x.timestamp,n)})),y=rh.getState(),{gapCount:b,isReplayMode:v}=y;if(v&&event){const x=l0(p[p.length-1].time,n,b||0,t.session);if(x.length>0){const _=p[p.length-1].close;for(const C of x)p.push({open:_,high:_,low:_,close:_,time:C})}}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 f;const o=(f=t.library_custom_fields)==null?void 0:f.ticker,a=this.symbols.find(m=>o!==void 0&&m.ticker===o||m.display_name===t.ticker||m.display_name===t.name),c=a!=null&&a.resolve_symbol?rd(a.resolve_symbol):rd(t.ticker||t.name||""),d=u0(n),u=`${c}|${n}`;this.subscriptions.set(s,{symbol:c,resolution:n,periodMs:d,onTick:r,onResetCacheNeededCallback:i,liveCandle:this.lastBarsCache.get(u)??null}),this.ensureWebSocket(c)}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}`,c=f0(r,o.periodMs);let d=o.liveCandle;d?c>d.time?d={time:c,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:c,open:s,high:s,low:s,close:s,volume:0},o.liveCandle=d,this.lastBarsCache.set(a,d),this.subscriptions.set(i,o),(f=>{var m,h;(h=(m=this.futureBarsRef)==null?void 0:m.current)!=null&&h.length||o.onTick(f)})(d)}}extractErrorMessage(t){if(t instanceof Error)return t.message;if(typeof t=="string")return t;try{return JSON.stringify(t)}catch{return String(t)}}getTimescaleMarks(t,n,r,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:c,event_name:d,currency:u})=>{!a||!Number.isFinite(c)||c<=0||i.some(f=>String(f.id)===String(a))||i.push({id:a,time:c/1e3,color:"green",label:d.slice(0,1)||"N",tooltip:[d],...u?{imageUrl:`/images/symbols/${u}.svg`}:{},showLabelWhenImageLoaded:!0})})}catch{}if(this.type&&this.type=="news")try{const o=JSON.parse(localStorage.getItem("iccandle:current-news-event")||"{}"),{id:a,timestamp:c,event_name:d,currency:u,forecast:f,previous:m,actual:h}=o;if(!a||!Number.isFinite(c)||c<=0||i.some(p=>String(p.id)==="news:"+a))return;i.push({id:"news:"+a,time:c/1e3,color:"green",label:d.slice(0,1),tooltip:[d,`Current Forecast: ${f||"-"}`,`Previous Forecast: ${m||"-"}`,`Previous Actual: ${h||"-"}`],...u?{imageUrl:`https://cdn.iccandle.ai/web-assets/${u??"USD"}.svg`}:{}})}catch{}s(i)}}const m0=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,c=n.symbol.close;if(!Number.isFinite(r)||!s||s.length===0)return[i,o,a,c,Number.NaN,Number.NaN,Number.NaN];if(!s.some(m=>m.time===r))return[i,o,a,c,Number.NaN,Number.NaN,Number.NaN];const f=c<i?1:0;return[i,o,a,c,f,f,f]}}};return Promise.resolve([t])},ta="An unknown error occurred",Us=e=>{if(typeof e=="string")return e;if(typeof e!="object"||e===null)return ta;if(typeof e.message=="string")return e.message;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const n=Us(e[t]);if(n)return n}return ta},g0=e=>{var t;if(Xf(e)){const n=(t=e.response)!=null&&t.data?Us(e.response.data):void 0;return n&&n!==ta?n:Us(e)}return Us(e)},y0=({queryKey:e,queryFn:t,...n})=>Ri({queryKey:e,queryFn:async r=>{var s;try{const i=r.queryKey[1];return await t(i)}catch(i){throw xe({variant:"destructive",title:"Error",description:g0(Xf(i)?(s=i.response)==null?void 0:s.data:i)}),null}},...n});var be;(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})(be||(be={}));var sd;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(sd||(sd={}));const Z=be.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),qt=e=>{switch(typeof e){case"undefined":return Z.undefined;case"string":return Z.string;case"number":return Number.isNaN(e)?Z.nan:Z.number;case"boolean":return Z.boolean;case"function":return Z.function;case"bigint":return Z.bigint;case"symbol":return Z.symbol;case"object":return Array.isArray(e)?Z.array:e===null?Z.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Z.promise:typeof Map<"u"&&e instanceof Map?Z.map:typeof Set<"u"&&e instanceof Set?Z.set:typeof Date<"u"&&e instanceof Date?Z.date:Z.object;default:return Z.unknown}},V=be.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 It 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,c=0;for(;c<o.path.length;){const d=o.path[c];c===o.path.length-1?(a[d]=a[d]||{_errors:[]},a[d]._errors.push(n(o))):a[d]=a[d]||{_errors:[]},a=a[d],c++}}};return s(this),r}static assert(t){if(!(t instanceof It))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,be.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()}}It.create=e=>new It(e);const na=(e,t)=>{let n;switch(e.code){case V.invalid_type:e.received===Z.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case V.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,be.jsonStringifyReplacer)}`;break;case V.unrecognized_keys:n=`Unrecognized key(s) in object: ${be.joinValues(e.keys,", ")}`;break;case V.invalid_union:n="Invalid input";break;case V.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${be.joinValues(e.options)}`;break;case V.invalid_enum_value:n=`Invalid enum value. Expected ${be.joinValues(e.options)}, received '${e.received}'`;break;case V.invalid_arguments:n="Invalid function arguments";break;case V.invalid_return_type:n="Invalid function return type";break;case V.invalid_date:n="Invalid date";break;case V.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}"`:be.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case V.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 V.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 V.custom:n="Invalid input";break;case V.invalid_intersection_types:n="Intersection results could not be merged";break;case V.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case V.not_finite:n="Number must be finite";break;default:n=t.defaultError,be.assertNever(e)}return{message:n}};let b0=na;function v0(){return b0}const w0=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 c=r.filter(d=>!!d).slice().reverse();for(const d of c)a=d(o,{data:t,defaultError:a}).message;return{...s,path:i,message:a}};function G(e,t){const n=v0(),r=w0({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===na?void 0:na].filter(s=>!!s)});e.common.issues.push(r)}class rt{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 rt.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"}),Mr=e=>({status:"dirty",value:e}),at=e=>({status:"valid",value:e}),id=e=>e.status==="aborted",od=e=>e.status==="dirty",gr=e=>e.status==="valid",ii=e=>typeof Promise<"u"&&e instanceof Promise;var Y;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(Y||(Y={}));class ln{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 ad=(e,t)=>{if(gr(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 It(e.common.issues);return this._error=n,this._error}}};function ue(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:c}=e;return o.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??r??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:c??n??a.defaultError}},description:s}}class ge{get description(){return this._def.description}_getType(t){return qt(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:qt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new rt,ctx:{common:t.parent.common,data:t.data,parsedType:qt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(ii(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:qt(t)},s=this._parseSync({data:t,path:r.path,parent:r});return ad(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:qt(t)};if(!this["~standard"].async)try{const i=this._parseSync({data:t,path:[],parent:n});return gr(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=>gr(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:qt(t)},s=this._parse({data:t,path:r.path,parent:r}),i=await(ii(s)?s:Promise.resolve(s));return ad(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:V.custom,...r(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!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 vr({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 sn.create(this,this._def)}nullable(){return wr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ot.create(this)}promise(){return li.create(this,this._def)}or(t){return ai.create([this,t],this._def)}and(t){return ci.create(this,t,this._def)}transform(t){return new vr({...ue(this._def),schema:this,typeName:ae.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new ia({...ue(this._def),innerType:this,defaultValue:n,typeName:ae.ZodDefault})}brand(){return new H0({typeName:ae.ZodBranded,type:this,...ue(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new oa({...ue(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 pc.create(this,t)}readonly(){return aa.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const _0=/^c[^\s-]{8,}$/i,x0=/^[0-9a-z]+$/,S0=/^[0-9A-HJKMNP-TV-Z]{26}$/i,C0=/^[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,E0=/^[a-z0-9_-]{21}$/i,T0=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,P0=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,k0=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,O0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let po;const A0=/^(?:(?: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])$/,R0=/^(?:(?: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])$/,N0=/^(([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]))$/,D0=/^(([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])$/,L0=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,j0=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ih="((\\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])))",M0=new RegExp(`^${ih}$`);function oh(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 I0(e){return new RegExp(`^${oh(e)}$`)}function F0(e){let t=`${ih}T${oh(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 U0(e,t){return!!((t==="v4"||!t)&&A0.test(e)||(t==="v6"||!t)&&N0.test(e))}function B0(e,t){if(!T0.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 $0(e,t){return!!((t==="v4"||!t)&&R0.test(e)||(t==="v6"||!t)&&D0.test(e))}class tn extends ge{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Z.string){const i=this._getOrReturnCtx(t);return G(i,{code:V.invalid_type,expected:Z.string,received:i.parsedType}),oe}const r=new rt;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:V.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:V.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:V.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&G(s,{code:V.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")k0.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"email",code:V.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")po||(po=new RegExp(O0,"u")),po.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"emoji",code:V.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")C0.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"uuid",code:V.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")E0.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"nanoid",code:V.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")_0.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"cuid",code:V.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")x0.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"cuid2",code:V.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")S0.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"ulid",code:V.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:V.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:V.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:V.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:V.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:V.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?F0(i).test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{code:V.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?M0.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{code:V.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?I0(i).test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{code:V.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?P0.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"duration",code:V.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?U0(t.data,i.version)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"ip",code:V.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?B0(t.data,i.alg)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"jwt",code:V.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?$0(t.data,i.version)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"cidr",code:V.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?L0.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"base64",code:V.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?j0.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"base64url",code:V.invalid_string,message:i.message}),r.dirty()):be.assertNever(i);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(s=>t.test(s),{validation:n,code:V.invalid_string,...Y.errToObj(r)})}_addCheck(t){return new tn({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Y.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Y.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Y.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Y.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...Y.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Y.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Y.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Y.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...Y.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...Y.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...Y.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Y.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...Y.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,...Y.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,...Y.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...Y.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...Y.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...Y.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...Y.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...Y.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...Y.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...Y.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...Y.errToObj(n)})}nonempty(t){return this.min(1,Y.errToObj(t))}trim(){return new tn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new tn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new tn({...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}}tn.create=e=>new tn({checks:[],typeName:ae.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...ue(e)});function V0(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 yr extends ge{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==Z.number){const i=this._getOrReturnCtx(t);return G(i,{code:V.invalid_type,expected:Z.number,received:i.parsedType}),oe}let r;const s=new rt;for(const i of this._def.checks)i.kind==="int"?be.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),G(r,{code:V.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:V.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:V.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?V0(t.data,i.value)!==0&&(r=this._getOrReturnCtx(t,r),G(r,{code:V.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:V.not_finite,message:i.message}),s.dirty()):be.assertNever(i);return{status:s.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,Y.toString(n))}gt(t,n){return this.setLimit("min",t,!1,Y.toString(n))}lte(t,n){return this.setLimit("max",t,!0,Y.toString(n))}lt(t,n){return this.setLimit("max",t,!1,Y.toString(n))}setLimit(t,n,r,s){return new yr({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Y.toString(s)}]})}_addCheck(t){return new yr({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Y.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Y.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Y.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Y.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Y.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:Y.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:Y.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Y.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Y.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"&&be.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)}}yr.create=e=>new yr({checks:[],typeName:ae.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...ue(e)});class Gr extends ge{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==Z.bigint)return this._getInvalidInput(t);let r;const s=new rt;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:V.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:V.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:V.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):be.assertNever(i);return{status:s.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return G(n,{code:V.invalid_type,expected:Z.bigint,received:n.parsedType}),oe}gte(t,n){return this.setLimit("min",t,!0,Y.toString(n))}gt(t,n){return this.setLimit("min",t,!1,Y.toString(n))}lte(t,n){return this.setLimit("max",t,!0,Y.toString(n))}lt(t,n){return this.setLimit("max",t,!1,Y.toString(n))}setLimit(t,n,r,s){return new Gr({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Y.toString(s)}]})}_addCheck(t){return new Gr({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Y.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Y.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Y.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Y.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:Y.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}}Gr.create=e=>new Gr({checks:[],typeName:ae.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...ue(e)});class ra extends ge{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Z.boolean){const r=this._getOrReturnCtx(t);return G(r,{code:V.invalid_type,expected:Z.boolean,received:r.parsedType}),oe}return at(t.data)}}ra.create=e=>new ra({typeName:ae.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...ue(e)});class oi extends ge{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Z.date){const i=this._getOrReturnCtx(t);return G(i,{code:V.invalid_type,expected:Z.date,received:i.parsedType}),oe}if(Number.isNaN(t.data.getTime())){const i=this._getOrReturnCtx(t);return G(i,{code:V.invalid_date}),oe}const r=new rt;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:V.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:V.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):be.assertNever(i);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new oi({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:Y.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:Y.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}}oi.create=e=>new oi({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:ae.ZodDate,...ue(e)});class cd extends ge{_parse(t){if(this._getType(t)!==Z.symbol){const r=this._getOrReturnCtx(t);return G(r,{code:V.invalid_type,expected:Z.symbol,received:r.parsedType}),oe}return at(t.data)}}cd.create=e=>new cd({typeName:ae.ZodSymbol,...ue(e)});class ld extends ge{_parse(t){if(this._getType(t)!==Z.undefined){const r=this._getOrReturnCtx(t);return G(r,{code:V.invalid_type,expected:Z.undefined,received:r.parsedType}),oe}return at(t.data)}}ld.create=e=>new ld({typeName:ae.ZodUndefined,...ue(e)});class dd extends ge{_parse(t){if(this._getType(t)!==Z.null){const r=this._getOrReturnCtx(t);return G(r,{code:V.invalid_type,expected:Z.null,received:r.parsedType}),oe}return at(t.data)}}dd.create=e=>new dd({typeName:ae.ZodNull,...ue(e)});class ud extends ge{constructor(){super(...arguments),this._any=!0}_parse(t){return at(t.data)}}ud.create=e=>new ud({typeName:ae.ZodAny,...ue(e)});class fd extends ge{constructor(){super(...arguments),this._unknown=!0}_parse(t){return at(t.data)}}fd.create=e=>new fd({typeName:ae.ZodUnknown,...ue(e)});class dn extends ge{_parse(t){const n=this._getOrReturnCtx(t);return G(n,{code:V.invalid_type,expected:Z.never,received:n.parsedType}),oe}}dn.create=e=>new dn({typeName:ae.ZodNever,...ue(e)});class pd extends ge{_parse(t){if(this._getType(t)!==Z.undefined){const r=this._getOrReturnCtx(t);return G(r,{code:V.invalid_type,expected:Z.void,received:r.parsedType}),oe}return at(t.data)}}pd.create=e=>new pd({typeName:ae.ZodVoid,...ue(e)});class Ot extends ge{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),s=this._def;if(n.parsedType!==Z.array)return G(n,{code:V.invalid_type,expected:Z.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?V.too_big:V.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:V.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:V.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 ln(n,o,n.path,a)))).then(o=>rt.mergeArray(r,o));const i=[...n.data].map((o,a)=>s.type._parseSync(new ln(n,o,n.path,a)));return rt.mergeArray(r,i)}get element(){return this._def.type}min(t,n){return new Ot({...this._def,minLength:{value:t,message:Y.toString(n)}})}max(t,n){return new Ot({...this._def,maxLength:{value:t,message:Y.toString(n)}})}length(t,n){return new Ot({...this._def,exactLength:{value:t,message:Y.toString(n)}})}nonempty(t){return this.min(1,t)}}Ot.create=(e,t)=>new Ot({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ae.ZodArray,...ue(t)});function Kn(e){if(e instanceof Le){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=sn.create(Kn(r))}return new Le({...e._def,shape:()=>t})}else return e instanceof Ot?new Ot({...e._def,type:Kn(e.element)}):e instanceof sn?sn.create(Kn(e.unwrap())):e instanceof wr?wr.create(Kn(e.unwrap())):e instanceof Fn?Fn.create(e.items.map(t=>Kn(t))):e}class Le extends ge{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=be.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==Z.object){const d=this._getOrReturnCtx(t);return G(d,{code:V.invalid_type,expected:Z.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 dn&&this._def.unknownKeys==="strip"))for(const d in s.data)o.includes(d)||a.push(d);const c=[];for(const d of o){const u=i[d],f=s.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new ln(s,f,s.path,d)),alwaysSet:d in s.data})}if(this._def.catchall instanceof dn){const d=this._def.unknownKeys;if(d==="passthrough")for(const u of a)c.push({key:{status:"valid",value:u},value:{status:"valid",value:s.data[u]}});else if(d==="strict")a.length>0&&(G(s,{code:V.unrecognized_keys,keys:a}),r.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const d=this._def.catchall;for(const u of a){const f=s.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new ln(s,f,s.path,u)),alwaysSet:u in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const d=[];for(const u of c){const f=await u.key,m=await u.value;d.push({key:f,value:m,alwaysSet:u.alwaysSet})}return d}).then(d=>rt.mergeObjectSync(r,d)):rt.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(t){return Y.errToObj,new Le({...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:Y.errToObj(t).message??s}:{message:s}}}:{}})}strip(){return new Le({...this._def,unknownKeys:"strip"})}passthrough(){return new Le({...this._def,unknownKeys:"passthrough"})}extend(t){return new Le({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Le({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 Le({...this._def,catchall:t})}pick(t){const n={};for(const r of be.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new Le({...this._def,shape:()=>n})}omit(t){const n={};for(const r of be.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new Le({...this._def,shape:()=>n})}deepPartial(){return Kn(this)}partial(t){const n={};for(const r of be.objectKeys(this.shape)){const s=this.shape[r];t&&!t[r]?n[r]=s:n[r]=s.optional()}return new Le({...this._def,shape:()=>n})}required(t){const n={};for(const r of be.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof sn;)i=i._def.innerType;n[r]=i}return new Le({...this._def,shape:()=>n})}keyof(){return ah(be.objectKeys(this.shape))}}Le.create=(e,t)=>new Le({shape:()=>e,unknownKeys:"strip",catchall:dn.create(),typeName:ae.ZodObject,...ue(t)});Le.strictCreate=(e,t)=>new Le({shape:()=>e,unknownKeys:"strict",catchall:dn.create(),typeName:ae.ZodObject,...ue(t)});Le.lazycreate=(e,t)=>new Le({shape:e,unknownKeys:"strip",catchall:dn.create(),typeName:ae.ZodObject,...ue(t)});class ai extends ge{_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 It(a.ctx.common.issues));return G(n,{code:V.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 c of r){const d={...n,common:{...n.common,issues:[]},parent:null},u=c._parseSync({data:n.data,path:n.path,parent:d});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,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(c=>new It(c));return G(n,{code:V.invalid_union,unionErrors:a}),oe}}get options(){return this._def.options}}ai.create=(e,t)=>new ai({options:e,typeName:ae.ZodUnion,...ue(t)});function sa(e,t){const n=qt(e),r=qt(t);if(e===t)return{valid:!0,data:e};if(n===Z.object&&r===Z.object){const s=be.objectKeys(t),i=be.objectKeys(e).filter(a=>s.indexOf(a)!==-1),o={...e,...t};for(const a of i){const c=sa(e[a],t[a]);if(!c.valid)return{valid:!1};o[a]=c.data}return{valid:!0,data:o}}else if(n===Z.array&&r===Z.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],c=sa(o,a);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return n===Z.date&&r===Z.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class ci extends ge{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),s=(i,o)=>{if(id(i)||id(o))return oe;const a=sa(i.value,o.value);return a.valid?((od(i)||od(o))&&n.dirty(),{status:n.value,value:a.data}):(G(r,{code:V.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}))}}ci.create=(e,t,n)=>new ci({left:e,right:t,typeName:ae.ZodIntersection,...ue(n)});class Fn extends ge{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Z.array)return G(r,{code:V.invalid_type,expected:Z.array,received:r.parsedType}),oe;if(r.data.length<this._def.items.length)return G(r,{code:V.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:V.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...r.data].map((o,a)=>{const c=this._def.items[a]||this._def.rest;return c?c._parse(new ln(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(i).then(o=>rt.mergeArray(n,o)):rt.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,...ue(t)})};class hd extends ge{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Z.map)return G(r,{code:V.invalid_type,expected:Z.map,received:r.parsedType}),oe;const s=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([a,c],d)=>({key:s._parse(new ln(r,a,r.path,[d,"key"])),value:i._parse(new ln(r,c,r.path,[d,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const c of o){const d=await c.key,u=await c.value;if(d.status==="aborted"||u.status==="aborted")return oe;(d.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(d.value,u.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const c of o){const d=c.key,u=c.value;if(d.status==="aborted"||u.status==="aborted")return oe;(d.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(d.value,u.value)}return{status:n.value,value:a}}}}hd.create=(e,t,n)=>new hd({valueType:t,keyType:e,typeName:ae.ZodMap,...ue(n)});class qr extends ge{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Z.set)return G(r,{code:V.invalid_type,expected:Z.set,received:r.parsedType}),oe;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(G(r,{code:V.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:V.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(c){const d=new Set;for(const u of c){if(u.status==="aborted")return oe;u.status==="dirty"&&n.dirty(),d.add(u.value)}return{status:n.value,value:d}}const a=[...r.data.values()].map((c,d)=>i._parse(new ln(r,c,r.path,d)));return r.common.async?Promise.all(a).then(c=>o(c)):o(a)}min(t,n){return new qr({...this._def,minSize:{value:t,message:Y.toString(n)}})}max(t,n){return new qr({...this._def,maxSize:{value:t,message:Y.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}qr.create=(e,t)=>new qr({valueType:e,minSize:null,maxSize:null,typeName:ae.ZodSet,...ue(t)});class md extends ge{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})}}md.create=(e,t)=>new md({getter:e,typeName:ae.ZodLazy,...ue(t)});class gd extends ge{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return G(n,{received:n.data,code:V.invalid_literal,expected:this._def.value}),oe}return{status:"valid",value:t.data}}get value(){return this._def.value}}gd.create=(e,t)=>new gd({value:e,typeName:ae.ZodLiteral,...ue(t)});function ah(e,t){return new br({values:e,typeName:ae.ZodEnum,...ue(t)})}class br extends ge{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return G(n,{expected:be.joinValues(r),received:n.parsedType,code:V.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:V.invalid_enum_value,options:r}),oe}return at(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 br.create(t,{...this._def,...n})}exclude(t,n=this._def){return br.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}br.create=ah;class yd extends ge{_parse(t){const n=be.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==Z.string&&r.parsedType!==Z.number){const s=be.objectValues(n);return G(r,{expected:be.joinValues(s),received:r.parsedType,code:V.invalid_type}),oe}if(this._cache||(this._cache=new Set(be.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const s=be.objectValues(n);return G(r,{received:r.data,code:V.invalid_enum_value,options:s}),oe}return at(t.data)}get enum(){return this._def.values}}yd.create=(e,t)=>new yd({values:e,typeName:ae.ZodNativeEnum,...ue(t)});class li extends ge{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Z.promise&&n.common.async===!1)return G(n,{code:V.invalid_type,expected:Z.promise,received:n.parsedType}),oe;const r=n.parsedType===Z.promise?n.data:Promise.resolve(n.data);return at(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}li.create=(e,t)=>new li({type:e,typeName:ae.ZodPromise,...ue(t)});class vr extends ge{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 c=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return c.status==="aborted"?oe:c.status==="dirty"||n.value==="dirty"?Mr(c.value):c});{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"?Mr(a.value):a}}if(s.type==="refinement"){const o=a=>{const c=s.refinement(a,i);if(r.common.async)return Promise.resolve(c);if(c 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(!gr(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=>gr(o)?Promise.resolve(s.transform(o.value,i)).then(a=>({status:n.value,value:a})):oe);be.assertNever(s)}}vr.create=(e,t,n)=>new vr({schema:e,typeName:ae.ZodEffects,effect:t,...ue(n)});vr.createWithPreprocess=(e,t,n)=>new vr({schema:t,effect:{type:"preprocess",transform:e},typeName:ae.ZodEffects,...ue(n)});class sn extends ge{_parse(t){return this._getType(t)===Z.undefined?at(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}sn.create=(e,t)=>new sn({innerType:e,typeName:ae.ZodOptional,...ue(t)});class wr extends ge{_parse(t){return this._getType(t)===Z.null?at(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}wr.create=(e,t)=>new wr({innerType:e,typeName:ae.ZodNullable,...ue(t)});class ia extends ge{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===Z.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}ia.create=(e,t)=>new ia({innerType:e,typeName:ae.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...ue(t)});class oa extends ge{_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 ii(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new It(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new It(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}oa.create=(e,t)=>new oa({innerType:e,typeName:ae.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...ue(t)});class bd extends ge{_parse(t){if(this._getType(t)!==Z.nan){const r=this._getOrReturnCtx(t);return G(r,{code:V.invalid_type,expected:Z.nan,received:r.parsedType}),oe}return{status:"valid",value:t.data}}}bd.create=e=>new bd({typeName:ae.ZodNaN,...ue(e)});class H0 extends ge{_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 pc extends ge{_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(),Mr(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 pc({in:t,out:n,typeName:ae.ZodPipeline})}}class aa extends ge{_parse(t){const n=this._def.innerType._parse(t),r=s=>(gr(s)&&(s.value=Object.freeze(s.value)),s);return ii(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}}aa.create=(e,t)=>new aa({innerType:e,typeName:ae.ZodReadonly,...ue(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 ho=tn.create,ks=yr.create,z0=ra.create;dn.create;Ot.create;const W0=Le.create;ai.create;ci.create;Fn.create;br.create;li.create;sn.create;wr.create;const G0="https://api.opheleo.com",q0="Bearer ",K0="Authorization";W0({id:ho(),userId:ho(),createdAt:ks(),updatedAt:ks(),active:z0(),perDayUsage:ks(),userEmail:ho().email(),maxPerDayUsage:ks()});async function Z0(e,t,n){const r=typeof window<"u"?localStorage.getItem("session_token"):null;return(await ke({baseURL:In(n??G0),url:e,method:t,headers:r?{[K0]:`${q0}${r}`}:void 0})).data}async function Y0(e){return Z0("/iccandle/v1/iccandle-user-usage/me","get",e)}const Q0=e=>{const t=e==null?void 0:e.platformApiBase;return y0({queryKey:["iccandle-user-usage",t],queryFn:()=>Y0(t),...e})},X0=S.createContext(null);function J0(){const e=S.useContext(X0);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function eC({controlsRef:e,onSymbolTickerChange:t,onScanResultUrlChange:n,onChartWidgetChange:r,onChartContainerChange:s,selectSymbolTickerRef:i,headerSlot:o}){const{resolvedTheme:a}=J0(),c=mn(),d=as(),u=S.useRef([]),f=S.useRef(null),m=S.useRef(a),h=S.useRef(null),g=S.useRef(null),p=S.useMemo(()=>si(d),[d]),y=S.useRef(p),b=S.useRef("60"),{setGapCount:v,setReplayMode:x}=rh();S.useEffect(()=>{v(0),x(!1)},[v,x]),S.useEffect(()=>{Fs()&&T(!0)},[]);const[_,C]=S.useState(null),[k,T]=S.useState(!1),[R,A]=S.useState(null),O=S.useCallback(N=>{if(N===y.current)return;const M=d.find(j=>j.ticker===N);if(!M)return;y.current=N,localStorage.setItem(Ir,N),t(N);const $=f.current;if($)try{$.onChartReady(()=>{$.activeChart().setSymbol(M.ticker)})}catch{}},[t,d]);S.useEffect(()=>(i.current=O,()=>{i.current=null}),[O,i]);const D=S.useRef([]),L=S.useMemo(()=>new h0(D,"selector",d,c.tickWebSocketUrl),[c.tickWebSocketUrl,d]),{data:B,isLoading:U}=Q0({enabled:!0,platformApiBase:c.platformApiBase}),z=!U&&B?B.perDayUsage>=B.maxPerDayUsage:!1;S.useEffect(()=>{s(_)},[_,s]),S.useEffect(()=>{r(R)},[R,r]),S.useEffect(()=>{if(!k||!_)return;if(f.current){A(null),r(null);try{f.current.remove()}catch{}f.current=null}const N=si(d);y.current=N,b.current="60";const M=nh();if(!M)return;const $=new M({container:_,library_path:"/charting_library/",datafeed:L,symbol:N,interval:"60",autosize:!0,theme:m.current,disabled_features:["symbol_info","legend_inplace_edit","header_quick_search","header_compare"],enabled_features:["header_chart_type","show_symbol_logos","show_symbol_logo_in_legend"],custom_indicators_getter:()=>m0(u),drawings_access:{type:"black",tools:[{name:"Date Range"}]},locale:"en",timezone:Nh(),overrides:{priceScaleSelectionStrategyName:"right","scalesProperties.showSeriesLastValue":!0}});let j=!1;return f.current=$,$.onChartReady(()=>{j||f.current!==$||A($)}),()=>{if(j=!0,A(null),r(null),f.current){try{f.current.remove()}catch{}f.current=null}}},[_,L,r,k]),S.useEffect(()=>{if(!R)return;let N=!1;try{R.onChartReady(()=>{N||(async()=>{try{const M=R.activeChart(),$=await M.createStudy("Generated Candles - By iC Candle",!0,!0);if(N||($&&M.bringToFront([$]),await R.headerReady(),N)||(await new Promise(re=>{setTimeout(()=>{if(!N)try{M.clearMarks(2)}catch{}re(!0)},150)}),N))return;localStorage.setItem("tv:selected-news-events","[]"),M.refreshMarks();const j=re=>{const ye=M.symbol(),H=th(ye,d,p);H!==y.current&&(n(null),u.current=[]);try{R.resetCache()}catch{}y.current=H,localStorage.setItem(Ir,H),t(H)},se=re=>{re!==b.current&&(n(null),u.current=[]);try{R.resetCache()}catch{}b.current=re};h.current=j,g.current=se,M.onSymbolChanged().subscribe(null,j),M.onIntervalChanged().subscribe(null,se)}catch{}})()})}catch{}return()=>{N=!0,h.current=null,g.current=null}},[R,e,n,t,p,d]),S.useEffect(()=>{if(!R||!a)return;let N=!1;try{R.onChartReady(()=>{N||R.changeTheme(a).catch(()=>{})})}catch{}return()=>{N=!0}},[R,a]);const F=S.useCallback(()=>{T(!0)},[]),I=z?l.jsx("div",{className:"web-trading-widget-advanced__scan-limit-wrap",children:l.jsxs(s0,{variant:"destructive",className:"web-trading-widget-advanced__scan-limit-badge",children:[l.jsx("span",{className:"web-trading-widget-advanced__scan-limit-badge-title",children:"Daily scan limit reached"}),B&&l.jsxs("span",{className:"web-trading-widget-advanced__scan-limit-badge-count",children:[B.perDayUsage," of ",B.maxPerDayUsage," scans used today"]})]})}):null;return l.jsxs(l.Fragment,{children:[o??I,l.jsx(i0,{onLoad:F}),l.jsx("div",{ref:C,className:"web-trading-widget-advanced__container"})]})}const ch=S.createContext(null);function vd({value:e,children:t}){return l.jsx(ch.Provider,{value:e,children:t})}function tC(){const e=S.useContext(ch);if(!e)throw new Error("useWidgetChartSlot must be used within WidgetChartSlotProvider");return e}function Os(e,t){return e.toFixed(t)}function nC({symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:s,minVolumeLots:i,isSubmitting:o,isAccountsLoading:a,selectedLogin:c,isDragging:d,isCollapsed:u,onToggleCollapsed:f,onDragHandlePointerDown:m,onPlaceOrder:h}){const[g,p]=S.useState(!0),y=u??g,b=()=>{f==null||f(),u===void 0&&p(F=>!F)},v=ie(F=>F.setOrderSide),x=ie(F=>F.setVolumeLots),_=ie(F=>F.volumeLots),[C,k]=S.useState(String(_||r));S.useEffect(()=>{y||k(Os(_,2))},[y,_]);const T=Number(Ut(Bt(e))),R=t!==null?Ce(t,T):"—",A=n!==null?Ce(n,T):"—",D=!o&&!a&&c!==""&&(t!==null&&n!==null),L=F=>{const I=Number(C),N=Number.isFinite(I)&&I>0?I:r,M=Math.max(i,N+F*s),$=Os(M,2);k($),x(M)},B=()=>{const F=Number(C);if(!Number.isFinite(F)||F<=0){k(Os(r,2)),x(r);return}const I=Math.max(i,F),N=Os(I,2);k(N),x(I)},U=F=>{t===null||n===null||v({side:F,entryPrice:F==="buy"?n:t})},z=F=>{if(t===null||n===null||!c)return;const I=Number(C),N=Math.max(i,Number.isFinite(I)&&I>0?I:r);v({side:F,entryPrice:F==="buy"?n:t}),h({login:c,side:F,volumeLots:N,bid:t,ask:n})};return l.jsx("div",{className:"web-trading-widget-mini-order web-trading-widget-mini-order--expanded",children:l.jsxs("div",{className:"web-trading-widget-mini-order__row",children:[l.jsx("button",{type:"button","aria-label":"Move quick order panel",onPointerDown:m,className:`web-trading-widget-mini-order__drag-handle${d?" web-trading-widget-mini-order__drag-handle--grabbing":""}`,children:l.jsx(pf,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2})}),l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button",disabled:!D,className:"web-trading-widget-mini-order__side-btn web-trading-widget-mini-order__side-btn--sell",onMouseDown:()=>U("sell"),onClick:()=>z("sell"),children:[l.jsx("span",{className:"web-trading-widget-mini-order__price",children:R}),l.jsx("span",{className:"web-trading-widget-mini-order__label web-trading-widget-mini-order__label--sell",children:"SELL"})]}),l.jsxs("div",{className:"web-trading-widget-mini-order__volume",children:[l.jsx("button",{type:"button","aria-label":"Decrease volume",disabled:!D,className:"web-trading-widget-mini-order__volume-btn",onClick:()=>L(-1),children:l.jsx(Ks,{className:"web-trading-widget-icon web-trading-widget-icon--xs",strokeWidth:2.5})}),l.jsx("input",{type:"text",inputMode:"decimal",value:C,disabled:!D,onChange:F=>k(F.target.value),onBlur:B,className:"web-trading-widget-mini-order__volume-input"}),l.jsx("button",{type:"button","aria-label":"Increase volume",disabled:!D,className:"web-trading-widget-mini-order__volume-btn",onClick:()=>L(1),children:l.jsx(To,{className:"web-trading-widget-icon web-trading-widget-icon--xs",strokeWidth:2.5})})]}),l.jsxs("button",{type:"button",disabled:!D,className:"web-trading-widget-mini-order__side-btn web-trading-widget-mini-order__side-btn--buy",onMouseDown:()=>U("buy"),onClick:()=>z("buy"),children:[l.jsx("span",{className:"web-trading-widget-mini-order__label web-trading-widget-mini-order__label--buy",children:"BUY"}),l.jsx("span",{className:"web-trading-widget-mini-order__price",children:A})]})]}),l.jsx("button",{type:"button","aria-label":y?"Expand quick order panel":"Collapse quick order panel","aria-expanded":!y,className:"web-trading-widget-mini-order__toggle",onClick:b,children:y?l.jsx(Ks,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2.5}):l.jsx(To,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2.5})})]})})}function Dr({title:e,isOpen:t,onToggle:n,children:r}){return l.jsxs("div",{className:"web-trading-widget-market-panel__accordion-item",children:[l.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,l.jsx(Ks,{className:"web-trading-widget-icon web-trading-widget-icon--md web-trading-widget-text-muted"})]}),t?l.jsx("div",{className:"web-trading-widget-market-panel__accordion-content",children:r}):null]})}const rC=new Set(["volume-setting","risk-management"]);function sC({symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:s,minVolumeLots:i,isSubmitting:o,isAccountsLoading:a,selectedLogin:c,isDragging:d,onDragHandlePointerDown:u,onLayoutChange:f,onClose:m,onPlaceOrder:h}){const[g,p]=S.useState(!0),[y,b]=S.useState("market"),v=ie(J=>J.volumeLots),[x,_]=S.useState(String(v||r)),[C,k]=S.useState(""),[T,R]=S.useState(""),A=ie(J=>J.stopLoss),O=ie(J=>J.takeProfit),D=ie(J=>J.setStopLoss),L=ie(J=>J.setTakeProfit),B=ie(J=>J.setVolumeLots),U=ie(J=>J.setOrderSide),[z,F]=S.useState(""),[I,N]=S.useState(ft.GTC),[M,$]=S.useState(""),[j,se]=S.useState(""),[re,ye]=S.useState(()=>new Set(rC));S.useEffect(()=>{f()},[g,f]);const H=Number(Ut(Bt(e))),Q=Er(H),K=bf(t,n),ce=t!==null?Ce(t,H):"—",we=n!==null?Ce(n,H):"—",le=Si(y),de=mf(y),ne=xi(y),je=ne.label,Re=!le&&ne.orderType!==null&&ne.orderType%2===1,Oe=S.useMemo(()=>K!==null?K:t??n,[n,t,K]),X=J=>{ye(Xe=>{const $t=new Set(Xe);return $t.has(J)?$t.delete(J):$t.add(J),$t})},Te=J=>{_(J);const Xe=Number(J);Number.isFinite(Xe)&&Xe>0&&B(Xe)},Fe=J=>t===null||n===null?null:le?J==="buy"?n:t:pt(C)??(J==="buy"?n:t),Qe=J=>{const Xe=Fe(J);Xe!==null&&U({side:J,entryPrice:Xe})},ct=J=>{if(t===null||n===null||!c)return;const Xe=Math.max(i,Number(x)||i),$t=Po(y,J),kr=Fe(J);kr!==null&&U({side:J,entryPrice:kr}),h({login:c,executionMode:y,side:J,orderType:$t,volumeLots:Xe,stopLoss:A,takeProfit:O,priceOrder:C,priceTrigger:T,comment:z,typeTime:I,expirationDateTime:M,expirationDay:j,bid:t,ask:n})},te=t!==null&&n!==null,$e=le||pt(C)!==void 0,Fi=!de||pt(T)!==void 0,cs=le||Ei(I,M,j),hh=!o&&!a&&c!==""&&te&&$e&&Fi&&cs,mh=!le&&za(I),gh=!le&&Wa(I),mc=()=>ne.orderType!==null&&ne.orderType%2===1?"sell":"buy";return l.jsxs("div",{className:`web-trading-widget-market-panel web-trading-widget-market-panel--modal${g?" web-trading-widget-market-panel--collapsed":""}`,children:[l.jsx(nC,{symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:s,minVolumeLots:i,isSubmitting:o,isAccountsLoading:a,selectedLogin:c,isDragging:d,isCollapsed:g,onToggleCollapsed:()=>p(J=>!J),onDragHandlePointerDown:u,onPlaceOrder:({login:J,side:Xe,volumeLots:$t,bid:kr,ask:gc})=>{kr===null||gc===null||h({login:J,executionMode:"market",side:Xe,orderType:Po("market",Xe),volumeLots:$t,stopLoss:A,takeProfit:O,priceOrder:"",priceTrigger:"",comment:z,typeTime:I,expirationDateTime:"",expirationDay:"",bid:kr,ask:gc})}}),g?null:l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"web-trading-widget-market-panel__header",children:l.jsxs(Gs,{value:y,onValueChange:J=>b(J),children:[l.jsx(Ur,{className:"web-trading-widget-market-panel__select-trigger","aria-label":"Order execution type",children:l.jsx(qs,{})}),l.jsx(Br,{children:Zs.map(J=>l.jsx($r,{value:J.mode,children:J.label},J.mode))})]})}),l.jsxs("div",{className:"web-trading-widget-market-panel__accordion",children:[l.jsx(Dr,{id:"volume-setting",title:"Volume Setting",isOpen:re.has("volume-setting"),onToggle:()=>X("volume-setting"),children:l.jsx(Ne,{label:"Lots",value:x,onChange:Te,step:s,min:i,decimals:2})}),le?null:l.jsx(Dr,{id:"order-price",title:"Order Price",isOpen:re.has("order-price"),onToggle:()=>X("order-price"),children:de?l.jsxs(l.Fragment,{children:[l.jsx(Ne,{label:"Stop Price",value:T,onChange:R,step:Q,decimals:H,basePrice:Oe,placeholder:K!==null?Ce(K,H):"—"}),l.jsx(Ne,{label:"Limit Price",value:C,onChange:k,step:Q,decimals:H,basePrice:Oe,placeholder:K!==null?Ce(K,H):"—"})]}):l.jsx(Ne,{label:"Price",value:C,onChange:k,step:Q,decimals:H,basePrice:Oe,placeholder:K!==null?Ce(K,H):"—"})}),l.jsx(Dr,{id:"risk-management",title:"Risk Management",isOpen:re.has("risk-management"),onToggle:()=>X("risk-management"),children:l.jsxs("div",{className:"web-trading-widget-market-panel__grid-2",children:[l.jsx(Ne,{label:"Stop Loss",value:A,onChange:D,step:Q,decimals:H,basePrice:t,placeholder:t!==null?ce:"—",clearable:!0}),l.jsx(Ne,{label:"Take Profit",value:O,onChange:L,step:Q,decimals:H,basePrice:n,placeholder:n!==null?we:"—",clearable:!0})]})}),le?null:l.jsxs(Dr,{id:"expiration",title:"Expiration",isOpen:re.has("expiration"),onToggle:()=>X("expiration"),children:[l.jsx("select",{value:String(I),className:"web-trading-widget-market-panel__select-full","aria-label":"Order expiration type",onChange:J=>N(Number(J.target.value)),children:gf.map(J=>l.jsx("option",{value:String(J.value),children:J.label},J.value))}),mh?l.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[l.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Expiration time"}),l.jsx("input",{type:"datetime-local",value:M,className:"web-trading-widget-market-panel__input",onChange:J=>$(J.target.value)})]}):null,gh?l.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[l.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Expiration day"}),l.jsx("input",{type:"date",value:j,className:"web-trading-widget-market-panel__input",onChange:J=>se(J.target.value)})]}):null]}),l.jsx(Dr,{id:"comment",title:"Comment",isOpen:re.has("comment"),onToggle:()=>X("comment"),children:l.jsx("input",{type:"text",value:z,className:"web-trading-widget-market-panel__input",placeholder:"",onChange:J=>F(J.target.value)})})]}),l.jsx("div",{className:"web-trading-widget-market-panel__footer",children:l.jsxs("div",{className:"web-trading-widget-market-panel__quotes",children:[l.jsx("span",{children:ce}),l.jsx("span",{className:"web-trading-widget-market-panel__quotes-ask",children:we})]})}),!le&&l.jsxs("button",{type:"button",className:`web-trading-widget-market-panel__place-btn${Re?" web-trading-widget-market-panel__place-btn--sell":" web-trading-widget-market-panel__place-btn--buy"}`,disabled:!hh,onMouseDown:()=>Qe(mc()),onClick:()=>ct(mc()),children:["Place ",je]})]})]})}function iC({symbolTicker:e,chartWidget:t,orderState:n}){const r=as(),s=tc(e),{panel:i,confirmation:o,isSubmitting:a,defaultVolumeLots:c,volumeStep:d,minVolumeLots:u,selectedLogin:f,isAccountsLoading:m,hasConfirmedAccount:h,closePanels:g,dismissConfirmation:p,placeMarketOrder:y}=n,b=me(j=>j.positions),v=me(j=>j.orders),x=me(j=>j.selectedPositionTicket),_=me(j=>j.selectedOrderTicket),C=me(j=>j.setSelectedPositionTicket),k=me(j=>j.setSelectedOrderTicket),T=x!==null?b.find(j=>j.ticket===x)??null:null,R=_!==null?v.find(j=>j.ticket===_)??null:null,A=h&&i==="confirmation"&&o!==null,O=h&&i!=="confirmation"&&i!=="closed"&&T===null&&R===null,{panelRef:D,position:L,isDragging:B,onDragStart:U,reclamp:z}=Sf({storageKey:"web-trading-widget-modal-exec-panel-position",defaultAlign:"top-right",isActive:O}),F=ie(j=>j.setDraft),I=ie(j=>j.clearDraft),N=Number(Ut(Bt(e))),M=Er(N);S.useEffect(()=>{h&&F({source:"new-order",entryPrice:null,side:null,showEntryLine:!1,volumeLots:c,digits:N,priceStep:M})},[c,N,h,M,F]),S.useEffect(()=>{(i==="closed"||i==="confirmation")&&I()},[I,i]);const $=T!==null||R!==null;return!h&&!$?null:l.jsxs("div",{className:"web-trading-widget-new-order-overlay-layer",children:[l.jsx(dp,{chartWidget:t,symbolTicker:e,symbols:r}),$&&T!==null?l.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:l.jsx(eh,{position:T,onClose:()=>C(null)})}):null,$&&R!==null?l.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:l.jsx(Jp,{order:R,onClose:()=>k(null)})}):null,A&&o!==null?l.jsx("div",{className:"web-trading-widget-new-order-overlay web-trading-widget-new-order-overlay--news",children:l.jsx(Xp,{confirmation:o,symbolTicker:e,onDismiss:p})}):null,O?l.jsx("div",{ref:D,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${B?" web-trading-widget-new-order-overlay--dragging":""}`,children:l.jsx(sC,{symbolTicker:e,bid:(s==null?void 0:s.bid)??null,ask:(s==null?void 0:s.ask)??null,defaultVolumeLots:c,volumeStep:d,minVolumeLots:u,isSubmitting:a,isAccountsLoading:m,selectedLogin:f,isDragging:B,onDragHandlePointerDown:U,onLayoutChange:z,onClose:g,onPlaceOrder:j=>void y({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 oC=`<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&&Is.assertOptions(r,{silentJSONParsing:Ve.transitional(Ve.boolean),forcedJSONParsing:Ve.transitional(Ve.boolean),clarifyTimeoutError:Ve.transitional(Ve.boolean),legacyInterceptorReqResOrdering:Ve.transitional(Ve.boolean),advertiseZstdAcceptEncoding:Ve.transitional(Ve.boolean),validateStatusUndefinedResolves:Ve.transitional(Ve.boolean)},!1),s!=null&&(P.isFunction(s)?n.paramsSerializer={serialize:s}:Is.assertOptions(s,{encode:Ve.function,serialize:Ve.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Is.assertOptions(n,{baseUrl:Ve.spelling("baseURL"),withXsrfToken:Ve.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=i&&P.merge(i.common,i[n.method]);i&&P.forEach(["delete","get","head","post","put","patch","query","common"],g=>{delete i[g]}),n.headers=ze.concat(o,i);const a=[];let c=!0;this.interceptors.request.forEach(function(h){if(typeof h.runWhen=="function"&&h.runWhen(n)===!1)return;c=c&&h.synchronous;const y=n.transitional||Xa;y&&y.legacyInterceptorReqResOrdering?a.unshift(h.fulfilled,h.rejected):a.push(h.fulfilled,h.rejected)});const d=[];this.interceptors.response.forEach(function(h){d.push(h.fulfilled,h.rejected)});let u,f=0,m;if(!c){const g=[El.bind(this),void 0];for(g.unshift(...a),g.push(...d),m=g.length,u=Promise.resolve(n);f<m;)u=u.then(g[f++],g[f++]);return u}m=a.length;let p=n;for(;f<m;){const g=a[f++],h=a[f++];try{p=g(p)}catch(y){h.call(this,y);break}}try{u=El.call(this,p)}catch(g){return Promise.reject(g)}for(f=0,m=d.length;f<m;)u=u.then(d[f++],d[f++]);return u}getUri(t){t=Mn(this.defaults,t);const n=Zf(t.baseURL,t.url,t.allowAbsoluteUrls,t);return zf(n,t.params,t.paramsSerializer)}};P.forEach(["delete","get","head","options"],function(t){An.prototype[t]=function(n,r){return this.request(Mn(r||{},{method:t,url:n,data:r&&P.hasOwnProp(r,"data")?r.data:void 0}))}});P.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}))}}An.prototype[t]=n(),t!=="query"&&(An.prototype[t+"Form"]=n(!0))});let k_=class Jf{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 os(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 Jf(function(s){t=s}),cancel:t}}};function O_(e){return function(n){return e.apply(null,n)}}function A_(e){return P.isObject(e)&&e.isAxiosError===!0}const Ro={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(Ro).forEach(([e,t])=>{Ro[t]=e});function eh(e){const t=new An(e),n=Af(An.prototype.request,t);return P.extend(n,An.prototype,t,{allOwnKeys:!0}),P.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return eh(Mn(e,s))},n}const ke=eh(is);ke.Axios=An;ke.CanceledError=os;ke.CancelToken=k_;ke.isCancel=Kf;ke.VERSION=ec;ke.toFormData=Ni;ke.AxiosError=G;ke.Cancel=ke.CanceledError;ke.all=function(t){return Promise.all(t)};ke.spread=O_;ke.isAxiosError=A_;ke.mergeConfig=Mn;ke.AxiosHeaders=ze;ke.formToJSON=e=>Gf(P.isHTMLForm(e)?new FormData(e):e);ke.getAdapter=Xf.getAdapter;ke.HttpStatusCode=Ro;ke.default=ke;const{Axios:eE,AxiosError:tE,CanceledError:nE,isCancel:rE,CancelToken:sE,VERSION:iE,all:oE,Cancel:aE,isAxiosError:th,spread:cE,toFormData:lE,AxiosHeaders:dE,HttpStatusCode:uE,formToJSON:fE,getAdapter:hE,mergeConfig:pE,create:mE}=ke,N_="Bearer ",nh="web-trading-token";function R_(){return typeof window>"u"?null:localStorage.getItem(nh)}function In(e){return e.replace(/\/$/,"")}function Pl(e){const t=In(e);async function n(r){const s=R_();return(await ke({...r,baseURL:t,headers:{...r.headers??{},...s?{Authorization:`${N_}${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 kl(e){return!e.isDemo&&!e.isArchive&&!!e.tradeStat}function D_(e){const t=e.filter(n=>kl(n)&&n.platformType==="mt5");return t.length>0?t:e.filter(kl)}function L_(e){const t=e,n=(t==null?void 0:t.accounts)??[];return D_(n).map(r=>{var s,i,o,a,c;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:(c=r.tradeStat)==null?void 0:c.marginLevel}}})}function j_(e){try{const t=new URL(In(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 In(e)}}function M_(e){try{const t=new URL(In(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 I_(e){try{const t=new URL(In(e));return t.hostname.includes("opheleo")?"wss://public-ticks.opheleo.com":(t.protocol=t.protocol==="https:"?"wss:":"ws:",t.origin)}catch{return"wss://public-ticks.opheleo.com"}}const U_=["XAU_USD","EUR_USD","GBP_USD","USD_JPY","BTCUSDT"],F_=fn.filter(e=>U_.includes(e.ticker));function rh(){return F_}function B_(e){const t=In(e),n=Pl(t),r=j_(t),s=Pl(r),i=Tv(n),o=rh();return{baseUrl:t,platformApiBase:r,tickWebSocketUrl:M_(t),publicTickWebSocketUrl:I_(t),dealer:i,trading:Rv(i,o),async getAccounts(){const a=await s.get("/account-config/api/v1");return L_(a)}}}const sh=S.createContext(null);function ih({baseUrl:e,children:t}){const n=S.useMemo(()=>B_(e),[e]);return l.jsx(sh.Provider,{value:n,children:t})}function Nt(){const e=S.useContext(sh);if(!e)throw new Error("useWidgetApiClient must be used within WidgetApiProvider");return e}function $_(){return Nt().tickWebSocketUrl}function V_(){return Nt().publicTickWebSocketUrl}const H_="wss://public-ticks.opheleo.com";function nc(e){const[t,n]=S.useState(null),r=V_();return S.useEffect(()=>{const s=Ti(e).toUpperCase();let i=null,o=!1;const a=r||H_,c=()=>{i=new WebSocket(a),i.onmessage=d=>{var u;try{const f=JSON.parse(d.data);if(f.type!=="tick"||!Array.isArray(f.ticks))return;for(const m of f.ticks){if(((u=m.s)==null?void 0:u.trim().toUpperCase())!==s)continue;const g=Number(m.b),h=Number(m.a);if(!(!Number.isFinite(g)||!Number.isFinite(h))){n({bid:g,ask:h});break}}}catch{}},i.onclose=()=>{o||setTimeout(c,3e3)}};return c(),()=>{o=!0,i==null||i.close(1e3,"Unmounted")}},[e,r]),t}function z_({symbolTicker:e,scanResultUrl:t,orderState:n,backUrl:r,createAccountUrl:s}){const i=nc(e),{panelRef:o,position:a,isDragging:c,onDragStart:d,reclamp:u}=Tf(),{panel:f,isSubmitting:m,defaultVolumeLots:p,volumeStep:g,minVolumeLots:h,accountOptions:y,selectedLogin:b,isAccountsLoading:v,hasConfirmedAccount:x,confirmAccountSelection:_,placeMarketOrder:C}=n,k=ie(L=>L.setDraft),T=ie(L=>L.clearDraft),A=Number(Bt($t(e))),N=Er(A);S.useEffect(()=>{x&&k({source:"new-order",entryPrice:null,side:null,showEntryLine:!1,volumeLots:p,digits:A,priceStep:N})},[p,A,x,N,k]),S.useEffect(()=>{(f==="closed"||f==="confirmation")&&T()},[T,f]);const O=L=>{C({symbolTicker:e,login:L.login,executionMode:"market",side:L.side,orderType:L.side==="buy"?qe.BUY:qe.SELL,volumeLots:L.volumeLots,stopLoss:"",takeProfit:"",priceOrder:"",priceTrigger:"",comment:"",typeTime:ft.GTC,expirationDateTime:"",expirationDay:"",bid:L.bid,ask:L.ask})};return l.jsxs(l.Fragment,{children:[l.jsx(pf,{open:!x,isAccountsLoading:v,accountOptions:y,onConfirm:_,backUrl:r,createAccountUrl:s}),x&&l.jsx("div",{ref:o,style:{left:a.x,top:a.y},className:`web-trading-widget-new-order-overlay${c?" web-trading-widget-new-order-overlay--dragging":""}`,children:l.jsx(hv,{symbolTicker:e,bid:(i==null?void 0:i.bid)??null,ask:(i==null?void 0:i.ask)??null,defaultVolumeLots:p,volumeStep:g,minVolumeLots:h,isSubmitting:m,isAccountsLoading:v,selectedLogin:b,isDragging:c,scanResultUrl:t,onDragHandlePointerDown:d,onExpandedChange:u,onExpand:u,onPlaceOrder:O})})]})}function W_(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 G_(e,t){return e.openTimeMs!==t.openTimeMs?e.openTimeMs-t.openTimeMs:W_(e.ticket,t.ticket)}function Ol(e){return[...e].sort(G_)}function Al(e){return Ye(e).toUpperCase()}const ye=ki(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:Ol(t)})},setOrders:t=>{e({orders:Ol(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=Al(t);e(i=>{const o={...i.liveQuotes,[s]:{bid:n,ask:r}};return{liveQuotes:o,positions:i.positions.map(a=>Zb(a,s,n,r,o)),orders:i.orders.map(a=>{if(Al(a.symbol)!==s)return a;const c=a.side==="buy"?n:r;return{...a,currentPrice:c}})}})},clearPositions:()=>{e({positions:[],orders:[],liveQuotes:{}})}})),K_="wss://symbols.opheleo.com";function q_(e,t){const n=new Set;for(const r of e){const s=Ye(r.symbol).toUpperCase();s&&n.add(s)}for(const r of t){const s=Ye(r.symbol).toUpperCase();s&&n.add(s)}for(const r of Kb([...n]))n.add(r);return[...n].sort().join("|")}function Z_(e){return q_(e.positions,e.orders)}function Y_(){const e=ye(Z_),t=ye(r=>r.updateQuotes),n=$_();S.useEffect(()=>{if(!e)return;const r=e.split("|"),s=new Map;let i=!1;const o=n||K_,a=c=>{const d=new WebSocket(o);s.set(c,d),d.onopen=()=>{if(i){d.close(1e3,"Unmounted");return}d.send(JSON.stringify({action:"select_symbol",symbol:c}))},d.onmessage=u=>{var f;try{const m=JSON.parse(u.data),p=(f=m.symbol)==null?void 0:f.trim().toUpperCase();if(!p||p!==c)return;const g=Number(m.bid),h=Number(m.ask);if(!Number.isFinite(g)||!Number.isFinite(h))return;t(p,g,h)}catch{}},d.onclose=()=>{s.delete(c),i||setTimeout(()=>a(c),3e3)}};for(const c of r)a(c);return()=>{i=!0;for(const c of s.values())c.close(1e3,"Unmounted");s.clear()}},[e,n,t])}function oh(){return Y_(),null}const ah={buy:"#2563eb",sell:"#dc2626"},io={positive:"#2563eb",negative:"#dc2626",neutral:"#94a3b8"},oo={linewidth:1,linestyle:2,fontsize:11},ch={stopLoss:"#f97316",takeProfit:"#22c55e"},lh=e=>ah[e],Do=(e,t)=>e==="entry"?t!=null?lh(t):ah.sell:ch[e],Nl=(e,t)=>{if(e==="entry")return Do(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=dh(n,r,s,i);return uh(o)}return ch[e]},dh=(e,t,n,r)=>(e==="buy"?n-t:t-n)*r*100,Q_=(e,t)=>!Number.isFinite(t)||t<=0?0:Math.round(e/t),X_=e=>{const t=dh(e.side,e.entryPrice,e.linePrice,e.volumeLots),n=e.side==="buy"?e.linePrice-e.entryPrice:e.entryPrice-e.linePrice,r=Q_(n,e.priceStep),s=e.kind==="takeProfit"?"TP":"SL",i=`${t.toFixed(2)} USD`,o=`${r} points`;return`${s} ${i}, ${o}`},J_=(e,t)=>e.toFixed(t),uh=e=>e>0?io.positive:e<0?io.negative:io.neutral,ex=e=>{const t=`${e.side.toUpperCase()} ${e.volumeLots.toFixed(2)}, `,n=`${e.profit.toFixed(2)} USD`;return`${t}${n}`},Rl=e=>{const t=lh(e.side),n=uh(e.profit);return{text:ex(e),linecolor:t,textcolor:n,linewidth:oo.linewidth,linestyle:oo.linestyle,fontsize:oo.fontsize,showPrice:!0,horzLabelsAlign:"left"}},Dl=e=>ht(e),tx=e=>e==="entry"||e==="stopLoss"||e==="takeProfit",ao=e=>{e.setUserEditEnabled(!1),e.setSelectionEnabled(!1)},Ll=(e,t,n)=>{if(e==="entry")return J_(t,n.digits);const{entryPrice:r,side:s}=n;return s!==null&&r!==null?X_({kind:e,side:s,entryPrice:r,linePrice:t,volumeLots:n.volumeLots,priceStep:n.priceStep}):`${e==="takeProfit"?"TP":"SL"} ${Ce(t,n.digits)}`},nx=({chartWidget:e})=>{const t=ie(_=>_.source),n=ie(_=>_.entryPrice),r=ie(_=>_.stopLoss),s=ie(_=>_.takeProfit),i=ie(_=>_.side),o=ie(_=>_.showEntryLine),a=ie(_=>_.volumeLots),c=ie(_=>_.digits),d=ie(_=>_.priceStep),u=ie(_=>_.setStopLoss),f=ie(_=>_.setTakeProfit),m=S.useRef({}),p=S.useRef(null),g=S.useRef(null),h=S.useRef({entryPrice:n,stopLoss:r,takeProfit:s,side:i,showEntryLine:o,volumeLots:a,digits:c,priceStep:d});S.useEffect(()=>{h.current={entryPrice:n,stopLoss:r,takeProfit:s,side:i,showEntryLine:o,volumeLots:a,digits:c,priceStep:d}},[c,n,d,o,i,r,s,a]);const y=S.useCallback(_=>{if(!e)return;const C=m.current[_];if(C){try{e.activeChart().removeEntity(C)}catch{}delete m.current[_]}},[e]),b=S.useCallback((_,C,k,T)=>{const A=Do(C,T.side),N=Nl(C,{side:T.side,entryPrice:T.entryPrice,linePrice:k,volumeLots:T.volumeLots});_.setProperties({text:Ll(C,k,T),linecolor:A,textcolor:N,showPrice:!0,horzLabelsAlign:"left"})},[]),v=S.useCallback(async(_,C,k)=>{var R;if(!e)return;if(C===void 0){y(_);return}if(p.current===_)return;const T=e.activeChart(),A=Do(_,k.side),N=Nl(_,{side:k.side,entryPrice:k.entryPrice,linePrice:C,volumeLots:k.volumeLots}),O=Ll(_,C,k),L=m.current[_];if(L)try{const $=T.getShapeById(L);_==="entry"&&ao($);const j=(R=$.getPoints()[0])==null?void 0:R.price;if(j!==void 0&&Math.abs(j-C)<k.priceStep/2){$.setProperties({text:O,linecolor:A,textcolor:N,showPrice:!0,horzLabelsAlign:"left"});return}const H=$.getPoints();if(H.length>0){$.setPoints(H.map(F=>({...F,price:C}))),$.setProperties({text:O,linecolor:A,textcolor:N,showPrice:!0,horzLabelsAlign:"left"});return}}catch{delete m.current[_]}try{const $=T.getVisibleRange(),j=await T.createShape({time:$.from,price:C},{shape:"horizontal_line",text:O,disableSave:!0,lock:_==="entry",disableSelection:_==="entry",overrides:{linecolor:A,textcolor:N,linewidth:2,showPrice:!0,horzLabelsAlign:"left"}});if(_==="entry")try{ao(T.getShapeById(j))}catch{}m.current[_]=j}catch{}},[e,y]),x=S.useCallback(async _=>{const C=Dl(_.stopLoss),k=Dl(_.takeProfit);_.showEntryLine&&_.entryPrice!==null?await v("entry",_.entryPrice,_):await v("entry",void 0,_),await v("stopLoss",C,_),await v("takeProfit",k,_)},[v]);S.useEffect(()=>{if(!e||t===null)return;const _=(C,k)=>{var A,N,O;const T=(A=Object.entries(m.current).find(([,L])=>L===C))==null?void 0:A[0];if(!(!T||!tx(T))){if(T==="entry"){if(k==="move"||k==="points_changed"){const L=h.current;if(L.entryPrice!==null)try{const R=e.activeChart().getShapeById(C),$=(N=R.getPoints()[0])==null?void 0:N.price;if($!==void 0&&Math.abs($-L.entryPrice)>=L.priceStep/2){const j=R.getPoints();j.length>0&&R.setPoints(j.map(H=>({...H,price:L.entryPrice})))}ao(R)}catch{}}return}if(k==="remove"){p.current=null,T==="stopLoss"&&u(""),T==="takeProfit"&&f(""),delete m.current[T];return}if(!(k!=="move"&&k!=="points_changed"))try{const L=e.activeChart().getShapeById(C),R=(O=L.getPoints()[0])==null?void 0:O.price;if(!Number.isFinite(R)||R<=0)return;const $=h.current;if(k==="points_changed"){p.current=T,b(L,T,R,$),g.current!==null&&clearTimeout(g.current),g.current=setTimeout(()=>{p.current=null;const F=Ce(R,h.current.digits);T==="stopLoss"?u(F):f(F)},120);return}g.current!==null&&(clearTimeout(g.current),g.current=null),p.current=null;const j=Ce(R,$.digits),H=T==="stopLoss"?{...$,stopLoss:j}:{...$,takeProfit:j};T==="stopLoss"?u(j):f(j),b(L,T,R,H)}catch{p.current=null}}};try{e.subscribe("drawing_event",_)}catch{}return()=>{p.current=null,g.current!==null&&(clearTimeout(g.current),g.current=null);try{e.unsubscribe("drawing_event",_)}catch{}Object.keys(m.current).forEach(C=>{y(C)}),m.current={}}},[e,y,u,f,t,b]),S.useEffect(()=>{if(!e||t===null)return;let _=!1;try{e.onChartReady(()=>{_||x(h.current)})}catch{}return()=>{_=!0}},[e,t,n,r,s,i,o,a,c,d,x])},jl=e=>{e.setUserEditEnabled(!1),e.setSelectionEnabled(!1)},fh=(e,t)=>Ye(e.symbol).toUpperCase()===t,rx=e=>ye.getState().positions.filter(t=>fh(t,e)).map(t=>({ticket:t.ticket,openPrice:t.openPrice,type:t.type,digits:t.digits,volumeLots:t.volumeLots,profit:t.profit})),Ml=(e,t,n)=>{try{const r=e.activeChart().symbol(),s=n.find(i=>i.display_name===r||i.ticker===r);if(s)return wf(s.ticker,n)}catch{}return t},sx=(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)},ix=({chartWidget:e,symbolTicker:t,symbols:n})=>{const r=ye(g=>g.positions),s=S.useRef(new Map),i=S.useRef(0),o=S.useMemo(()=>wf(t,n),[t,n]),a=S.useMemo(()=>r.filter(g=>fh(g,o)).map(g=>`${g.ticket}:${g.openPrice}:${g.type}:${g.digits}:${g.volumeLots}:${g.profit.toFixed(2)}`).sort().join("|"),[o,r]),c=S.useCallback(g=>{if(!e)return;const h=s.current.get(g);if(h){try{e.activeChart().removeEntity(h)}catch{}s.current.delete(g)}},[e]),d=S.useCallback(()=>{for(const g of[...s.current.keys()])c(g);s.current.clear()},[c]),u=S.useCallback(async(g,h,y)=>{const b=Rl({side:h.type,volumeLots:h.volumeLots,profit:h.profit}),x={time:g.getVisibleRange().from,price:h.openPrice},_=await g.createShape(x,{shape:"horizontal_line",text:String(b.text),disableSave:!0,lock:!0,disableSelection:!0,overrides:b});if(y!==i.current){try{g.removeEntity(_)}catch{}return null}try{jl(g.getShapeById(_))}catch{}return _},[]),f=S.useCallback(async(g,h)=>{if(!e||h!==i.current)return;const y=e.activeChart(),b=Rl({side:g.type,volumeLots:g.volumeLots,profit:g.profit}),v=s.current.get(g.ticket);if(v)try{sx(y.getShapeById(v),g.openPrice,b),jl(y.getShapeById(v));return}catch{s.current.delete(g.ticket)}if(h===i.current)try{const x=await u(y,g,h);if(!x)return;s.current.set(g.ticket,x)}catch{}},[e,u]),m=S.useCallback(async(g,h)=>{if(!e||g!==i.current)return;const y=rx(h),b=new Set(y.map(v=>v.ticket));for(const v of s.current.keys())b.has(v)||c(v);for(const v of y){if(g!==i.current)return;await f(v,g)}},[e,c,f]),p=S.useCallback(g=>{if(!e)return;const h=i.current+1;i.current=h,g!=null&&g.resetLineIds&&d();const y=(g==null?void 0:g.symbolKey)??Ml(e,o,n);m(h,y)},[o,e,d,n,m]);S.useEffect(()=>{if(!e)return;let g=!1,h=null;const y=()=>{g||p({resetLineIds:!0,symbolKey:Ml(e,o,n)})};let b=!1;const v=()=>{b=!0,y()},x=()=>{g||!b||(b=!1,p({symbolKey:o}))};try{e.onChartReady(()=>{if(!g)try{h=e.activeChart(),p({resetLineIds:!0,symbolKey:o}),h.onSymbolChanged().subscribe(null,v),h.onDataLoaded().subscribe(null,x)}catch{}})}catch{}return()=>{if(g=!0,i.current+=1,h)try{h.onSymbolChanged().unsubscribe(null,v),h.onDataLoaded().unsubscribe(null,x)}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])},hh=({chartWidget:e,symbolTicker:t,symbols:n})=>(ix({chartWidget:e,symbolTicker:t,symbols:n}),nx({chartWidget:e}),null);var as=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(){}},wn,Zt,Qn,Cd,ox=(Cd=class extends as{constructor(){super();ne(this,wn);ne(this,Zt);ne(this,Qn);z(this,Qn,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){E(this,Zt)||this.setEventListener(E(this,Qn))}onUnsubscribe(){var t;this.hasListeners()||((t=E(this,Zt))==null||t.call(this),z(this,Zt,void 0))}setEventListener(t){var n;z(this,Qn,t),(n=E(this,Zt))==null||n.call(this),z(this,Zt,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){E(this,wn)!==t&&(z(this,wn,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof E(this,wn)=="boolean"?E(this,wn):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},wn=new WeakMap,Zt=new WeakMap,Qn=new WeakMap,Cd),rc=new ox,ax={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},xt,_n,Ed,cx=(Ed=class{constructor(){ne(this,xt,ax);ne(this,_n,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&E(this,_n)&&e!==E(this,xt)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:E(this,xt),provider:e}),z(this,xt,e),process.env.NODE_ENV!=="production"&&z(this,_n,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&z(this,_n,!0),E(this,xt).setTimeout(e,t)}clearTimeout(e){E(this,xt).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&z(this,_n,!0),E(this,xt).setInterval(e,t)}clearInterval(e){E(this,xt).clearInterval(e)}},xt=new WeakMap,_n=new WeakMap,Ed),vn=new cx;function lx(e){setTimeout(e,0)}var dx=typeof window>"u"||"Deno"in globalThis;function Ke(){}function ux(e,t){return typeof e=="function"?e(t):e}function Lo(e){return typeof e=="number"&&e>=0&&e!==1/0}function ph(e,t){return Math.max(e+(t||0)-Date.now(),0)}function sn(e,t){return typeof e=="function"?e(t):e}function et(e,t){return typeof e=="function"?e(t):e}function Il(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(!Wr(t.queryKey,o))return!1}if(n!=="all"){const c=t.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||s&&s!==t.state.fetchStatus||i&&!i(t))}function Ul(e,t){const{exact:n,status:r,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(zr(t.options.mutationKey)!==zr(i))return!1}else if(!Wr(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)||zr)(e)}function zr(e){return JSON.stringify(e,(t,n)=>Io(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function Wr(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Wr(e[n],t[n])):!1}var fx=Object.prototype.hasOwnProperty;function jo(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=Fl(e)&&Fl(t);if(!r&&!(Io(e)&&Io(t)))return t;const i=(r?e:Object.keys(e)).length,o=r?t:Object.keys(t),a=o.length,c=r?new Array(a):{};let d=0;for(let u=0;u<a;u++){const f=r?u:o[u],m=e[f],p=t[f];if(m===p){c[f]=m,(r?u<i:fx.call(e,f))&&d++;continue}if(m===null||p===null||typeof m!="object"||typeof p!="object"){c[f]=p;continue}const g=jo(m,p,n+1);c[f]=g,g===m&&d++}return i===a&&d===i?e:c}function Mo(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 Fl(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Io(e){if(!Bl(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Bl(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Bl(e){return Object.prototype.toString.call(e)==="[object Object]"}function hx(e){return new Promise(t=>{vn.setTimeout(t,e)})}function Uo(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 jo(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 jo(e,t)}return t}function px(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function mx(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var ni=Symbol();function mh(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===ni&&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===ni?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function gh(e,t){return typeof e=="function"?e(...t):!!e}function gx(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 Gr=(()=>{let e=()=>dx;return{isServer(){return e()},setIsServer(t){e=t}}})();function Fo(){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 yx=lx;function bx(){let e=[],t=0,n=a=>{a()},r=a=>{a()},s=yx;const i=a=>{t?e.push(a):s(()=>{n(a)})},o=()=>{const a=e;e=[],a.length&&s(()=>{r(()=>{a.forEach(c=>{n(c)})})})};return{batch:a=>{let c;t++;try{c=a()}finally{t--,t||o()}return c},batchCalls:a=>(...c)=>{i(()=>{a(...c)})},schedule:i,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{s=a}}}var Fe=bx(),Xn,Yt,Jn,Td,vx=(Td=class extends as{constructor(){super();ne(this,Xn,!0);ne(this,Yt);ne(this,Jn);z(this,Jn,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){E(this,Yt)||this.setEventListener(E(this,Jn))}onUnsubscribe(){var t;this.hasListeners()||((t=E(this,Yt))==null||t.call(this),z(this,Yt,void 0))}setEventListener(t){var n;z(this,Jn,t),(n=E(this,Yt))==null||n.call(this),z(this,Yt,t(this.setOnline.bind(this)))}setOnline(t){E(this,Xn)!==t&&(z(this,Xn,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return E(this,Xn)}},Xn=new WeakMap,Yt=new WeakMap,Jn=new WeakMap,Td),ri=new vx;function wx(e){return Math.min(1e3*2**e,3e4)}function yh(e){return(e??"online")==="online"?ri.isOnline():!0}var Bo=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function bh(e){let t=!1,n=0,r;const s=Fo(),i=()=>s.status!=="pending",o=h=>{var y;if(!i()){const b=new Bo(h);m(b),(y=e.onCancel)==null||y.call(e,b)}},a=()=>{t=!0},c=()=>{t=!1},d=()=>rc.isFocused()&&(e.networkMode==="always"||ri.isOnline())&&e.canRun(),u=()=>yh(e.networkMode)&&e.canRun(),f=h=>{i()||(r==null||r(),s.resolve(h))},m=h=>{i()||(r==null||r(),s.reject(h))},p=()=>new Promise(h=>{var y;r=b=>{(i()||d())&&h(b)},(y=e.onPause)==null||y.call(e)}).then(()=>{var h;r=void 0,i()||(h=e.onContinue)==null||h.call(e)}),g=()=>{if(i())return;let h;const y=n===0?e.initialPromise:void 0;try{h=y??e.fn()}catch(b){h=Promise.reject(b)}Promise.resolve(h).then(f).catch(b=>{var k;if(i())return;const v=e.retry??(Gr.isServer()?0:3),x=e.retryDelay??wx,_=typeof x=="function"?x(n,b):x,C=v===!0||typeof v=="number"&&n<v||typeof v=="function"&&v(n,b);if(t||!C){m(b);return}n++,(k=e.onFail)==null||k.call(e,n,b),hx(_).then(()=>d()?void 0:p()).then(()=>{t?m(b):g()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(r==null||r(),s),cancelRetry:a,continueRetry:c,canStart:u,start:()=>(u()?g():p().then(g),s)}}var xn,Pd,vh=(Pd=class{constructor(){ne(this,xn)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Lo(this.gcTime)&&z(this,xn,vn.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Gr.isServer()?1/0:300*1e3))}clearGcTimeout(){E(this,xn)!==void 0&&(vn.clearTimeout(E(this,xn)),z(this,xn,void 0))}},xn=new WeakMap,Pd);function _x(e){return{onFetch:(t,n)=>{var u,f,m,p,g;const r=t.options,s=(m=(f=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:f.fetchMore)==null?void 0:m.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:[]},c=0;const d=async()=>{let h=!1;const y=x=>{gx(x,()=>t.signal,()=>h=!0)},b=mh(t.options,t.fetchOptions),v=async(x,_,C)=>{if(h)return Promise.reject(t.signal.reason);if(_==null&&x.pages.length)return Promise.resolve(x);const T=(()=>{const L={client:t.client,queryKey:t.queryKey,pageParam:_,direction:C?"backward":"forward",meta:t.options.meta};return y(L),L})(),A=await b(T),{maxPages:N}=t.options,O=C?mx:px;return{pages:O(x.pages,A,N),pageParams:O(x.pageParams,_,N)}};if(s&&i.length){const x=s==="backward",_=x?xx:$l,C={pages:i,pageParams:o},k=_(r,C);a=await v(C,k,x)}else{const x=e??i.length;do{const _=c===0?o[0]??r.initialPageParam:$l(r,a);if(c>0&&_==null)break;a=await v(a,_),c++}while(c<x)}return a};t.options.persister?t.fetchFn=()=>{var h,y;return(y=(h=t.options).persister)==null?void 0:y.call(h,d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=d}}}function $l(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 xx(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 er,Sn,tr,it,Cn,Me,Zr,En,Je,wh,Rt,kd,Sx=(kd=class extends vh{constructor(t){super();ne(this,Je);ne(this,er);ne(this,Sn);ne(this,tr);ne(this,it);ne(this,Cn);ne(this,Me);ne(this,Zr);ne(this,En);z(this,En,!1),z(this,Zr,t.defaultOptions),this.setOptions(t.options),this.observers=[],z(this,Cn,t.client),z(this,it,E(this,Cn).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,z(this,Sn,Hl(this.options)),this.state=t.state??E(this,Sn),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return E(this,er)}get promise(){var t;return(t=E(this,Me))==null?void 0:t.promise}setOptions(t){if(this.options={...E(this,Zr),...t},t!=null&&t._type&&z(this,er,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=Hl(this.options);n.data!==void 0&&(this.setState(Vl(n.data,n.dataUpdatedAt)),z(this,Sn,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&E(this,it).remove(this)}setData(t,n){const r=Uo(this.state.data,t,this.options);return he(this,Je,Rt).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t){he(this,Je,Rt).call(this,{type:"setState",state:t})}cancel(t){var r,s;const n=(r=E(this,Me))==null?void 0:r.promise;return(s=E(this,Me))==null||s.cancel(t),n?n.then(Ke).catch(Ke):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return E(this,Sn)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>et(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ni||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>sn(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:!ph(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=E(this,Me))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=E(this,Me))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),E(this,it).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(E(this,Me)&&(E(this,En)||he(this,Je,wh).call(this)?E(this,Me).cancel({revert:!0}):E(this,Me).cancelRetry()),this.scheduleGc()),E(this,it).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||he(this,Je,Rt).call(this,{type:"invalidate"})}async fetch(t,n){var d,u,f,m,p,g,h,y,b,v,x;if(this.state.fetchStatus!=="idle"&&((d=E(this,Me))==null?void 0:d.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(E(this,Me))return E(this,Me).continueRetry(),E(this,Me).promise}if(t&&this.setOptions(t),!this.options.queryFn){const _=this.observers.find(C=>C.options.queryFn);_&&this.setOptions(_.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=_=>{Object.defineProperty(_,"signal",{enumerable:!0,get:()=>(z(this,En,!0),r.signal)})},i=()=>{const _=mh(this.options,n),k=(()=>{const T={client:E(this,Cn),queryKey:this.queryKey,meta:this.meta};return s(T),T})();return z(this,En,!1),this.options.persister?this.options.persister(_,k,this):_(k)},a=(()=>{const _={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:E(this,Cn),state:this.state,fetchFn:i};return s(_),_})(),c=E(this,er)==="infinite"?_x(this.options.pages):this.options.behavior;c==null||c.onFetch(a,this),z(this,tr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=a.fetchOptions)==null?void 0:u.meta))&&he(this,Je,Rt).call(this,{type:"fetch",meta:(f=a.fetchOptions)==null?void 0:f.meta}),z(this,Me,bh({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:_=>{_ instanceof Bo&&_.revert&&this.setState({...E(this,tr),fetchStatus:"idle"}),r.abort()},onFail:(_,C)=>{he(this,Je,Rt).call(this,{type:"failed",failureCount:_,error:C})},onPause:()=>{he(this,Je,Rt).call(this,{type:"pause"})},onContinue:()=>{he(this,Je,Rt).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const _=await E(this,Me).start();if(_===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(_),(p=(m=E(this,it).config).onSuccess)==null||p.call(m,_,this),(h=(g=E(this,it).config).onSettled)==null||h.call(g,_,this.state.error,this),_}catch(_){if(_ instanceof Bo){if(_.silent)return E(this,Me).promise;if(_.revert){if(this.state.data===void 0)throw _;return this.state.data}}throw he(this,Je,Rt).call(this,{type:"error",error:_}),(b=(y=E(this,it).config).onError)==null||b.call(y,_,this),(x=(v=E(this,it).config).onSettled)==null||x.call(v,this.state.data,_,this),_}finally{this.scheduleGc()}}},er=new WeakMap,Sn=new WeakMap,tr=new WeakMap,it=new WeakMap,Cn=new WeakMap,Me=new WeakMap,Zr=new WeakMap,En=new WeakMap,Je=new WeakSet,wh=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Rt=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,..._h(r.data,this.options),fetchMeta:t.meta??null};case"success":const s={...r,...Vl(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return z(this,tr,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()}),E(this,it).notify({query:this,type:"updated",action:t})})},kd);function _h(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:yh(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Vl(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Hl(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,ge,Yr,We,Tn,nr,Lt,Qt,Qr,rr,sr,Pn,kn,Xt,ir,_e,Mr,$o,Vo,Ho,zo,Wo,Go,Ko,xh,Od,Cx=(Od=class extends as{constructor(t,n){super();ne(this,_e);ne(this,Ge);ne(this,ge);ne(this,Yr);ne(this,We);ne(this,Tn);ne(this,nr);ne(this,Lt);ne(this,Qt);ne(this,Qr);ne(this,rr);ne(this,sr);ne(this,Pn);ne(this,kn);ne(this,Xt);ne(this,ir,new Set);this.options=n,z(this,Ge,t),z(this,Qt,null),z(this,Lt,Fo()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(E(this,ge).addObserver(this),zl(E(this,ge),this.options)?he(this,_e,Mr).call(this):this.updateResult(),he(this,_e,zo).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return qo(E(this,ge),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return qo(E(this,ge),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,he(this,_e,Wo).call(this),he(this,_e,Go).call(this),E(this,ge).removeObserver(this)}setOptions(t){const n=this.options,r=E(this,ge);if(this.options=E(this,Ge).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof et(this.options.enabled,E(this,ge))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");he(this,_e,Ko).call(this),E(this,ge).setOptions(this.options),n._defaulted&&!Mo(this.options,n)&&E(this,Ge).getQueryCache().notify({type:"observerOptionsUpdated",query:E(this,ge),observer:this});const s=this.hasListeners();s&&Wl(E(this,ge),r,this.options,n)&&he(this,_e,Mr).call(this),this.updateResult(),s&&(E(this,ge)!==r||et(this.options.enabled,E(this,ge))!==et(n.enabled,E(this,ge))||sn(this.options.staleTime,E(this,ge))!==sn(n.staleTime,E(this,ge)))&&he(this,_e,$o).call(this);const i=he(this,_e,Vo).call(this);s&&(E(this,ge)!==r||et(this.options.enabled,E(this,ge))!==et(n.enabled,E(this,ge))||i!==E(this,Xt))&&he(this,_e,Ho).call(this,i)}getOptimisticResult(t){const n=E(this,Ge).getQueryCache().build(E(this,Ge),t),r=this.createResult(n,t);return Tx(this,r)&&(z(this,We,r),z(this,nr,this.options),z(this,Tn,E(this,ge).state)),r}getCurrentResult(){return E(this,We)}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&&E(this,Lt).status==="pending"&&E(this,Lt).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,s))})}trackProp(t){E(this,ir).add(t)}getCurrentQuery(){return E(this,ge)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=E(this,Ge).defaultQueryOptions(t),r=E(this,Ge).getQueryCache().build(E(this,Ge),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return he(this,_e,Mr).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),E(this,We)))}createResult(t,n){var N;const r=E(this,ge),s=this.options,i=E(this,We),o=E(this,Tn),a=E(this,nr),d=t!==r?t.state:E(this,Yr),{state:u}=t;let f={...u},m=!1,p;if(n._optimisticResults){const O=this.hasListeners(),L=!O&&zl(t,n),R=O&&Wl(t,r,n,s);(L||R)&&(f={...f,..._h(u.data,t.options)}),n._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:g,errorUpdatedAt:h,status:y}=f;p=f.data;let b=!1;if(n.placeholderData!==void 0&&p===void 0&&y==="pending"){let O;i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(O=i.data,b=!0):O=typeof n.placeholderData=="function"?n.placeholderData((N=E(this,sr))==null?void 0:N.state.data,E(this,sr)):n.placeholderData,O!==void 0&&(y="success",p=Uo(i==null?void 0:i.data,O,n),m=!0)}if(n.select&&p!==void 0&&!b)if(i&&p===(o==null?void 0:o.data)&&n.select===E(this,Qr))p=E(this,rr);else try{z(this,Qr,n.select),p=n.select(p),p=Uo(i==null?void 0:i.data,p,n),z(this,rr,p),z(this,Qt,null)}catch(O){z(this,Qt,O)}E(this,Qt)&&(g=E(this,Qt),p=E(this,rr),h=Date.now(),y="error");const v=f.fetchStatus==="fetching",x=y==="pending",_=y==="error",C=x&&v,k=p!==void 0,A={status:y,fetchStatus:f.fetchStatus,isPending:x,isSuccess:y==="success",isError:_,isInitialLoading:C,isLoading:C,data:p,dataUpdatedAt:f.dataUpdatedAt,error:g,errorUpdatedAt:h,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:f.dataUpdateCount>d.dataUpdateCount||f.errorUpdateCount>d.errorUpdateCount,isFetching:v,isRefetching:v&&!x,isLoadingError:_&&!k,isPaused:f.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:_&&k,isStale:ic(t,n),refetch:this.refetch,promise:E(this,Lt),isEnabled:et(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const O=A.data!==void 0,L=A.status==="error"&&!O,R=H=>{L?H.reject(A.error):O&&H.resolve(A.data)},$=()=>{const H=z(this,Lt,A.promise=Fo());R(H)},j=E(this,Lt);switch(j.status){case"pending":t.queryHash===r.queryHash&&R(j);break;case"fulfilled":(L||A.data!==j.value)&&$();break;case"rejected":(!L||A.error!==j.reason)&&$();break}}return A}updateResult(){const t=E(this,We),n=this.createResult(E(this,ge),this.options);if(z(this,Tn,E(this,ge).state),z(this,nr,this.options),E(this,Tn).data!==void 0&&z(this,sr,E(this,ge)),Mo(n,t))return;z(this,We,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,i=typeof s=="function"?s():s;if(i==="all"||!i&&!E(this,ir).size)return!0;const o=new Set(i??E(this,ir));return this.options.throwOnError&&o.add("error"),Object.keys(E(this,We)).some(a=>{const c=a;return E(this,We)[c]!==t[c]&&o.has(c)})};he(this,_e,xh).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&he(this,_e,zo).call(this)}},Ge=new WeakMap,ge=new WeakMap,Yr=new WeakMap,We=new WeakMap,Tn=new WeakMap,nr=new WeakMap,Lt=new WeakMap,Qt=new WeakMap,Qr=new WeakMap,rr=new WeakMap,sr=new WeakMap,Pn=new WeakMap,kn=new WeakMap,Xt=new WeakMap,ir=new WeakMap,_e=new WeakSet,Mr=function(t){he(this,_e,Ko).call(this);let n=E(this,ge).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Ke)),n},$o=function(){he(this,_e,Wo).call(this);const t=sn(this.options.staleTime,E(this,ge));if(Gr.isServer()||E(this,We).isStale||!Lo(t))return;const r=ph(E(this,We).dataUpdatedAt,t)+1;z(this,Pn,vn.setTimeout(()=>{E(this,We).isStale||this.updateResult()},r))},Vo=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(E(this,ge)):this.options.refetchInterval)??!1},Ho=function(t){he(this,_e,Go).call(this),z(this,Xt,t),!(Gr.isServer()||et(this.options.enabled,E(this,ge))===!1||!Lo(E(this,Xt))||E(this,Xt)===0)&&z(this,kn,vn.setInterval(()=>{(this.options.refetchIntervalInBackground||rc.isFocused())&&he(this,_e,Mr).call(this)},E(this,Xt)))},zo=function(){he(this,_e,$o).call(this),he(this,_e,Ho).call(this,he(this,_e,Vo).call(this))},Wo=function(){E(this,Pn)!==void 0&&(vn.clearTimeout(E(this,Pn)),z(this,Pn,void 0))},Go=function(){E(this,kn)!==void 0&&(vn.clearInterval(E(this,kn)),z(this,kn,void 0))},Ko=function(){const t=E(this,Ge).getQueryCache().build(E(this,Ge),this.options);if(t===E(this,ge))return;const n=E(this,ge);z(this,ge,t),z(this,Yr,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},xh=function(t){Fe.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(E(this,We))}),E(this,Ge).getQueryCache().notify({query:E(this,ge),type:"observerResultsUpdated"})})},Od);function Ex(e,t){return et(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&et(t.retryOnMount,e)===!1)}function zl(e,t){return Ex(e,t)||e.state.data!==void 0&&qo(e,t,t.refetchOnMount)}function qo(e,t,n){if(et(t.enabled,e)!==!1&&sn(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&ic(e,t)}return!1}function Wl(e,t,n,r){return(e!==t||et(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&ic(e,n)}function ic(e,t){return et(t.enabled,e)!==!1&&e.isStaleByTime(sn(t.staleTime,e))}function Tx(e,t){return!Mo(e.getCurrentResult(),t)}var Xr,St,He,On,Ct,Wt,Ad,Px=(Ad=class extends vh{constructor(t){super();ne(this,Ct);ne(this,Xr);ne(this,St);ne(this,He);ne(this,On);z(this,Xr,t.client),this.mutationId=t.mutationId,z(this,He,t.mutationCache),z(this,St,[]),this.state=t.state||kx(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){E(this,St).includes(t)||(E(this,St).push(t),this.clearGcTimeout(),E(this,He).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){z(this,St,E(this,St).filter(n=>n!==t)),this.scheduleGc(),E(this,He).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){E(this,St).length||(this.state.status==="pending"?this.scheduleGc():E(this,He).remove(this))}continue(){var t;return((t=E(this,On))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,a,c,d,u,f,m,p,g,h,y,b,v,x,_,C,k,T;const n=()=>{he(this,Ct,Wt).call(this,{type:"continue"})},r={client:E(this,Xr),meta:this.options.meta,mutationKey:this.options.mutationKey};z(this,On,bh({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(A,N)=>{he(this,Ct,Wt).call(this,{type:"failed",failureCount:A,error:N})},onPause:()=>{he(this,Ct,Wt).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>E(this,He).canRun(this)}));const s=this.state.status==="pending",i=!E(this,On).canStart();try{if(s)n();else{he(this,Ct,Wt).call(this,{type:"pending",variables:t,isPaused:i}),E(this,He).config.onMutate&&await E(this,He).config.onMutate(t,this,r);const N=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,t,r));N!==this.state.context&&he(this,Ct,Wt).call(this,{type:"pending",context:N,variables:t,isPaused:i})}const A=await E(this,On).start();return await((d=(c=E(this,He).config).onSuccess)==null?void 0:d.call(c,A,t,this.state.context,this,r)),await((f=(u=this.options).onSuccess)==null?void 0:f.call(u,A,t,this.state.context,r)),await((p=(m=E(this,He).config).onSettled)==null?void 0:p.call(m,A,null,this.state.variables,this.state.context,this,r)),await((h=(g=this.options).onSettled)==null?void 0:h.call(g,A,null,t,this.state.context,r)),he(this,Ct,Wt).call(this,{type:"success",data:A}),A}catch(A){try{await((b=(y=E(this,He).config).onError)==null?void 0:b.call(y,A,t,this.state.context,this,r))}catch(N){Promise.reject(N)}try{await((x=(v=this.options).onError)==null?void 0:x.call(v,A,t,this.state.context,r))}catch(N){Promise.reject(N)}try{await((C=(_=E(this,He).config).onSettled)==null?void 0:C.call(_,void 0,A,this.state.variables,this.state.context,this,r))}catch(N){Promise.reject(N)}try{await((T=(k=this.options).onSettled)==null?void 0:T.call(k,void 0,A,t,this.state.context,r))}catch(N){Promise.reject(N)}throw he(this,Ct,Wt).call(this,{type:"error",error:A}),A}finally{E(this,He).runNext(this)}}},Xr=new WeakMap,St=new WeakMap,He=new WeakMap,On=new WeakMap,Ct=new WeakSet,Wt=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(()=>{E(this,St).forEach(r=>{r.onMutationUpdate(t)}),E(this,He).notify({mutation:this,type:"updated",action:t})})},Ad);function kx(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var jt,ut,Jr,Nd,Ox=(Nd=class extends as{constructor(t={}){super();ne(this,jt);ne(this,ut);ne(this,Jr);this.config=t,z(this,jt,new Set),z(this,ut,new Map),z(this,Jr,0)}build(t,n,r){const s=new Px({client:t,mutationCache:this,mutationId:++ds(this,Jr)._,options:t.defaultMutationOptions(n),state:r});return this.add(s),s}add(t){E(this,jt).add(t);const n=Cs(t);if(typeof n=="string"){const r=E(this,ut).get(n);r?r.push(t):E(this,ut).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(E(this,jt).delete(t)){const n=Cs(t);if(typeof n=="string"){const r=E(this,ut).get(n);if(r)if(r.length>1){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}else r[0]===t&&E(this,ut).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=Cs(t);if(typeof n=="string"){const r=E(this,ut).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=Cs(t);if(typeof n=="string"){const s=(r=E(this,ut).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(()=>{E(this,jt).forEach(t=>{this.notify({type:"removed",mutation:t})}),E(this,jt).clear(),E(this,ut).clear()})}getAll(){return Array.from(E(this,jt))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Ul(n,r))}findAll(t={}){return this.getAll().filter(n=>Ul(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(Ke))))}},jt=new WeakMap,ut=new WeakMap,Jr=new WeakMap,Nd);function Cs(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Et,Rd,Ax=(Rd=class extends as{constructor(t={}){super();ne(this,Et);this.config=t,z(this,Et,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 Sx({client:t,queryKey:s,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){E(this,Et).has(t.queryHash)||(E(this,Et).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=E(this,Et).get(t.queryHash);n&&(t.destroy(),n===t&&E(this,Et).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Fe.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return E(this,Et).get(t)}getAll(){return[...E(this,Et).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Il(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Il(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()})})}},Et=new WeakMap,Rd),Ae,Jt,en,or,ar,tn,cr,lr,Dd,Nx=(Dd=class{constructor(e={}){ne(this,Ae);ne(this,Jt);ne(this,en);ne(this,or);ne(this,ar);ne(this,tn);ne(this,cr);ne(this,lr);z(this,Ae,e.queryCache||new Ax),z(this,Jt,e.mutationCache||new Ox),z(this,en,e.defaultOptions||{}),z(this,or,new Map),z(this,ar,new Map),z(this,tn,0)}mount(){ds(this,tn)._++,E(this,tn)===1&&(z(this,cr,rc.subscribe(async e=>{e&&(await this.resumePausedMutations(),E(this,Ae).onFocus())})),z(this,lr,ri.subscribe(async e=>{e&&(await this.resumePausedMutations(),E(this,Ae).onOnline())})))}unmount(){var e,t;ds(this,tn)._--,E(this,tn)===0&&((e=E(this,cr))==null||e.call(this),z(this,cr,void 0),(t=E(this,lr))==null||t.call(this),z(this,lr,void 0))}isFetching(e){return E(this,Ae).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return E(this,Jt).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=E(this,Ae).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=E(this,Ae).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(sn(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return E(this,Ae).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=E(this,Ae).get(r.queryHash),i=s==null?void 0:s.state.data,o=ux(t,i);if(o!==void 0)return E(this,Ae).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return Fe.batch(()=>E(this,Ae).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=E(this,Ae).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=E(this,Ae);Fe.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=E(this,Ae);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(()=>E(this,Ae).findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(Ke).catch(Ke)}invalidateQueries(e,t={}){return Fe.batch(()=>(E(this,Ae).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(()=>E(this,Ae).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,n);return n.throwOnError||(i=i.catch(Ke)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(Ke)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=E(this,Ae).build(this,t);return n.isStaleByTime(sn(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Ke).catch(Ke)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ke).catch(Ke)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return ri.isOnline()?E(this,Jt).resumePausedMutations():Promise.resolve()}getQueryCache(){return E(this,Ae)}getMutationCache(){return E(this,Jt)}getDefaultOptions(){return E(this,en)}setDefaultOptions(e){z(this,en,e)}setQueryDefaults(e,t){E(this,or).set(zr(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...E(this,or).values()],n={};return t.forEach(r=>{Wr(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){E(this,ar).set(zr(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...E(this,ar).values()],n={};return t.forEach(r=>{Wr(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...E(this,en).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===ni&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...E(this,en).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){E(this,Ae).clear(),E(this,Jt).clear()}},Ae=new WeakMap,Jt=new WeakMap,en=new WeakMap,or=new WeakMap,ar=new WeakMap,tn=new WeakMap,cr=new WeakMap,lr=new WeakMap,Dd),Sh=w.createContext(void 0),Ch=e=>{const t=w.useContext(Sh);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Rx=({client:e,children:t})=>(w.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(Sh.Provider,{value:e,children:t})),Eh=w.createContext(!1),Dx=()=>w.useContext(Eh);Eh.Provider;function Lx(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var jx=w.createContext(Lx()),Mx=()=>w.useContext(jx),Ix=(e,t,n)=>{const r=n!=null&&n.state.error&&typeof e.throwOnError=="function"?gh(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},Ux=e=>{w.useEffect(()=>{e.clearReset()},[e])},Fx=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(s&&e.data===void 0||gh(n,[e.error,r])),Bx=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))}},$x=(e,t)=>e.isLoading&&e.isFetching&&!t,Vx=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Gl=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Hx(e,t,n){var p,g,h,y;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=Dx(),s=Mx(),i=Ch(),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 c=e.subscribed!==!1;o._optimisticResults=r?"isRestoring":c?"optimistic":void 0,Bx(o),Ix(o,s,a),Ux(s);const d=!i.getQueryCache().get(o.queryHash),[u]=w.useState(()=>new t(i,o)),f=u.getOptimisticResult(o),m=!r&&c;if(w.useSyncExternalStore(w.useCallback(b=>{const v=m?u.subscribe(Fe.batchCalls(b)):Ke;return u.updateResult(),v},[u,m]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),w.useEffect(()=>{u.setOptions(o)},[o,u]),Vx(o,f))throw Gl(o,u,s);if(Fx({result:f,errorResetBoundary:s,throwOnError:o.throwOnError,query:a,suspense:o.suspense}))throw f.error;if((y=(h=i.getDefaultOptions().queries)==null?void 0:h._experimental_afterQuery)==null||y.call(h,o,f),o.experimental_prefetchInRender&&!Gr.isServer()&&$x(f,r)){const b=d?Gl(o,u,s):a==null?void 0:a.promise;b==null||b.catch(Ke).finally(()=>{u.updateResult()})}return o.notifyOnChangeProps?f:u.trackResult(f)}function kr(e,t){return Hx(e,Cx)}const Th=S.createContext(null);function zx(e){return typeof window>"u"?e??null:e?(localStorage.setItem(nh,e),e):null}function Wx({token:e,children:t}){const n=zx(e);return l.jsx(Th.Provider,{value:n,children:t})}function Gx(){return S.useContext(Th)}const Kx="widget-accounts",Ph="widget-positions",kh="widget-orders",qx="widget-deals",Zx="widget-deals-total",Yx=2e4;function Us(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 Qx(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 oc(e){if(e==null||e==="")return"—";if(typeof e=="number"&&Number.isFinite(e)){const t=e>1e12?e:e*1e3;return Us(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 Us(new Date(s))}}const n=Date.parse(t);return Number.isFinite(n)?Us(new Date(n)):t}if(typeof e=="object"&&e!==null){const n=Qx(e);if(n!==void 0)return oc(n)}return"—"}const Oh=["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 Xx(e){return Us(e)}const Jx={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 Di(e,t){for(const n of t)if(e[n]!==void 0&&e[n]!==null&&e[n]!=="")return e[n]}function _t(e,t){const n=Di(e,t);if(n===void 0)return;const r=Number(n);return Number.isFinite(r)?r:void 0}function Es(e,t){const n=Di(e,t);if(n!==void 0)return String(n)}function eS(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 c=i[a];if(Array.isArray(c))return c.filter(d=>typeof d=="object"&&d!==null)}}}return[]}function Zo(e){return e===void 0?.01:e>=100?e/1e4:e}function tS(e,t){return yf(t,e)}function nS(e){const t=Di(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=_t(e,["type","Type","orderType","OrderType"])??2;return{label:Jx[n]??(n%2===1?"sell":"buy"),side:Xs(n),typeNum:n}}function rS(e,t){const n=_t(e,["volumeFilled","volume_filled","VolumeFilled","filledVolume","FilledVolume"]);if(n!==void 0)return Zo(n);const r=_t(e,["volumeCurrent","volume_current","VolumeCurrent"]);return r!==void 0?Zo(r):0}function sS(e,t){const n=Es(e,["ticket","Ticket","order","Order","id","ID"]),r=Es(e,["symbol","Symbol"])??"";if(!n||!r)return null;const s=Ye(r),{label:i,side:o,typeNum:a}=nS(e),c=_t(e,["typeTime","TypeTime"])??0,d=Zo(_t(e,["volumeLots","volume_lots","VolumeLots","volume","Volume"])),u=rS(e),f=_t(e,["priceOrder","price_order","PriceOrder","openPrice","open_price","price","Price"])??0,m=_t(e,["priceTrigger","price_trigger","PriceTrigger","triggerPrice","TriggerPrice"]),p=_t(e,["currentPrice","current_price","PriceCurrent","priceCurrent","marketPrice","MarketPrice"])??f,g=_t(e,["stopLoss","stop_loss","PriceSL","sl","SL"]),h=_t(e,["takeProfit","take_profit","PriceTP","tp","TP"]),y=Es(e,["comment","Comment"])??"",b=tS(e,s),v=oc(Di(e,Oh));return{ticket:n,login:Es(e,["login","Login"])??t,symbol:s,displaySymbol:Si(s),time:v,typeLabel:i,orderType:a,typeTime:c,side:o,volumeLots:d,volumeFilledLots:u,orderPrice:f,priceTrigger:m,stopLoss:g,takeProfit:h,currentPrice:p,comment:y,digits:b}}function iS(e,t){return eS(e).map(n=>sS(n,t)).filter(n=>n!==null)}function Li(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=Li(e,t);if(n===void 0)return;const r=Number(n);return Number.isFinite(r)?r:void 0}function Ts(e,t){const n=Li(e,t);if(n!==void 0)return String(n)}function oS(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 c=i[a];if(Array.isArray(c))return c.filter(d=>typeof d=="object"&&d!==null)}}}return[]}function aS(e){return e===void 0?.01:e>=100?e/1e4:e}function cS(e){const t=Li(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 lS(e,t){return yf(t,e)}function dS(e,t){const n=Ts(e,["ticket","Ticket","position","Position","order","Order","id","ID"]),r=Ts(e,["symbol","Symbol"])??"";if(!n||!r)return null;const s=Ye(r),i=cS(e),o=aS(Gt(e,["volumeLots","volume_lots","VolumeLots","volume","Volume"])),a=Gt(e,["openPrice","open_price","PriceOpen","priceOpen","price","Price"])??0,c=Gt(e,["currentPrice","current_price","PriceCurrent","priceCurrent"])??a,d=Gt(e,["stopLoss","stop_loss","PriceSL","sl","SL"]),u=Gt(e,["takeProfit","take_profit","PriceTP","tp","TP"]),f=Gt(e,["profit","Profit","floating","Floating","pnl","PnL"])??0,m=Gt(e,["swap","Swap"])??0,p=Ts(e,["comment","Comment"])??"",g=lS(e,s),h=oc(Li(e,Oh));return{ticket:n,login:Ts(e,["login","Login"])??t,symbol:s,displaySymbol:Si(s),time:h,type:i,volumeLots:o,openPrice:a,stopLoss:d,takeProfit:u,currentPrice:c,marketBid:c,marketAsk:c,swap:m,profit:f,comment:p,digits:g}}function uS(e,t){return oS(e).map(n=>dS(n,t)).filter(n=>n!==null)}function cs(){return rh()}function Ah(){const e=Nt(),t=Gx(),{data:n,isLoading:r,isError:s}=kr({queryKey:[Kx,e.baseUrl,t],queryFn:()=>e.getAccounts(),enabled:!!t});return{accounts:n??[],isLoading:r,isError:s}}function fS(e){const t=Nt();return kr({queryKey:[Ph,t.baseUrl,e],queryFn:()=>t.dealer.getPositions(e),enabled:!!e,refetchInterval:Yx})}function hS(e){const t=Nt();return kr({queryKey:[kh,t.baseUrl,e],queryFn:()=>t.dealer.getOrders(e),enabled:!!e})}function pS(){const e=Ch(),t=Nt();return S.useCallback((n,r)=>{e.invalidateQueries({queryKey:[Ph,t.baseUrl,n]}),(r===void 0||Ha(r))&&e.invalidateQueries({queryKey:[kh,t.baseUrl,n]})},[t.baseUrl,e])}function ji(){const e=Nt(),t=pS();return{async submitOrder(n){const r=await e.trading.submitOrder(n);return r.success&&t(n.login,n.orderType),r},async closePosition(n){const r=await e.trading.closePosition(n);return r.success&&t(n.login),r},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}}}function mS(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 gS(e){if(e===null||typeof e!="object")return{total:0};const t=e,n=t.data??t;return{total:Number(n.total??0)}}function yS(e,t,n,r={}){const s=Nt();return kr({queryKey:[Zx,s.baseUrl,e,t,n],queryFn:async()=>{const i=await s.dealer.getDealsTotal(e,t,n);return gS(i)},enabled:r.enabled??!0})}function bS(e,t,n,r,s,i={}){const o=Nt();return kr({queryKey:[qx,o.baseUrl,e,t,n,r,s],queryFn:async()=>{const a=await o.dealer.getDeals(e,t,n,r,s);return mS(a)},enabled:i.enabled??!0})}function vS(e,t){return e!=null?uS(e,t):[]}function wS(e,t){return e!=null?iS(e,t):[]}function _S({symbolTicker:e,controlsRef:t,chartWidget:n,scanResultUrl:r,orderState:s,backUrl:i,createAccountUrl:o}){const{openMarketPanel:a,setSelectedLogin:c}=s,d=cs();return S.useEffect(()=>(t.current={open:a,setSelectedLogin:c},()=>{t.current=null}),[t,a,c]),l.jsxs(l.Fragment,{children:[l.jsx(hh,{chartWidget:n,symbolTicker:e,symbols:d}),l.jsx(oh,{}),l.jsx(z_,{symbolTicker:e,scanResultUrl:r,orderState:s,backUrl:i,createAccountUrl:o})]})}const xS=8,Kl=11;function SS({wide:e}){return l.jsx("td",{className:"web-trading-widget-terminal__cell",children:l.jsx("div",{className:`web-trading-widget-terminal__skeleton-bar${e?" web-trading-widget-terminal__skeleton-bar--wide":""}`})})}function CS(){return l.jsx(l.Fragment,{children:Array.from({length:xS},(e,t)=>l.jsx("tr",{className:"web-trading-widget-terminal__skeleton-row",children:Array.from({length:Kl},(n,r)=>l.jsx(SS,{wide:r===Kl-1},r))},t))})}const ES={0:"Buy",1:"Sell",2:"Balance",3:"Credit",5:"-"},TS="web-trading-widget-text-buy",PS="web-trading-widget-text-sell",kS="web-trading-widget-terminal__head-row",co=50;function OS(e){return e===0?TS:e===1?PS:kS}const ql=e=>e.toISOString().split("T")[0],Nh=e=>Math.floor(new Date(e).getTime()/1e3),AS=e=>Nh(e),NS=e=>Nh(e)+86399;function RS(){const e=new Date,t=new Date;return t.setDate(t.getDate()-7),{fromTs:AS(ql(t)),toTs:NS(ql(e))}}const DS=e=>new Date(e*1e3).toLocaleString(void 0,{year:"numeric",month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"});function LS(e){try{return decodeURIComponent(e)}catch{return e}}function jS(){return l.jsxs("colgroup",{children:[l.jsx("col",{className:"web-trading-widget-terminal-col--deal"}),l.jsx("col",{className:"web-trading-widget-terminal-col--ticket"}),l.jsx("col",{className:"web-trading-widget-terminal-col--symbol"}),l.jsx("col",{className:"web-trading-widget-terminal-col--type"}),l.jsx("col",{className:"web-trading-widget-terminal-col--volume"}),l.jsx("col",{className:"web-trading-widget-terminal-col--price"}),l.jsx("col",{className:"web-trading-widget-terminal-col--profit"}),l.jsx("col",{className:"web-trading-widget-terminal-col--entry"}),l.jsx("col",{className:"web-trading-widget-terminal-col--time"}),l.jsx("col",{className:"web-trading-widget-terminal-col--local-time"}),l.jsx("col",{})]})}function MS(){return l.jsx("thead",{children:l.jsxs("tr",{className:"web-trading-widget-terminal__head-row",children:[l.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Deal"}),l.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Login"}),l.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Symbol"}),l.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Action"}),l.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Volume"}),l.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Price"}),l.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Profit"}),l.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Entry"}),l.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Time"}),l.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Local time"}),l.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Comment"})]})})}function IS({deal:e}){const t=e.profit>0?"web-trading-widget-text-profit-positive":e.profit<0?"web-trading-widget-text-profit-negative":"";return l.jsxs("tr",{className:"web-trading-widget-terminal__deals-row",children:[l.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.deal}),l.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.login}),l.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.symbol||"—"}),l.jsx("td",{className:`web-trading-widget-terminal__cell web-trading-widget-terminal__cell--capitalize ${OS(e.action)}`,children:ES[e.action]??`Action ${e.action}`}),l.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:(e.volume/1e4).toFixed(2)}),l.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.price.toFixed(5)}),l.jsxs("td",{className:`web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right ${t}`,children:[e.profit>0?"+":"",e.profit.toFixed(2)]}),l.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.entry===1?"OUT":"IN"}),l.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--nowrap",children:Xx(new Date(e.time*1e3))}),l.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--nowrap",children:DS(e.time)}),l.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--truncate",children:e.comment?LS(e.comment):"—"})]})}function US({login:e,detailUrl:t}){const{fromTs:n,toTs:r}=S.useMemo(()=>RS(),[]),s=e!=="",{data:i,isLoading:o}=yS(e,n,r,{enabled:s}),a=(i==null?void 0:i.total)??0,c=Math.max(0,a-co),d=a>0?Math.min(co,a):co,{data:u,isLoading:f}=bS(e,n,r,c,d,{enabled:s}),m=s&&(o||f),p=S.useMemo(()=>[...(u==null?void 0:u.deals)??[]].sort((g,h)=>h.time-g.time),[u==null?void 0:u.deals]);return e?l.jsxs("div",{className:"web-trading-widget-terminal__deals-wrap",children:[l.jsx("div",{className:"web-trading-widget-terminal__body-scroll",children:l.jsxs("table",{className:"web-trading-widget-terminal__deals-table",children:[l.jsx(jS,{}),l.jsx(MS,{}),l.jsxs("tbody",{children:[m?l.jsx(CS,{}):null,!m&&p.length===0?l.jsx("tr",{children:l.jsx("td",{colSpan:11,className:"web-trading-widget-terminal__empty-cell",children:"No deals found"})}):null,m?null:p.map(g=>l.jsx(IS,{deal:g},g.deal))]})]})}),t?l.jsx("div",{className:"web-trading-widget-terminal__deals-footer",children:l.jsx("a",{href:t,className:"web-trading-widget-terminal__deals-detail-btn",children:"More detail"})}):null]}):l.jsx("div",{className:"web-trading-widget-terminal__empty-cell",children:"Select an account to view deal history"})}function Rh(e){const t=ye(d=>d.setPositions),n=ye(d=>d.setOrders),{data:r,isLoading:s,isError:i}=fS(e),{data:o,isLoading:a,isError:c}=hS(e);return S.useEffect(()=>{if(!e.trim()){t([]),n([]);return}r!=null&&t(vS(r,e)),o!=null&&n(wS(o,e))},[e,o,r,n,t]),{isLoading:s||a,isError:!!(i||c)}}const Zl=224,Yl=32,ac=120;function Dh(){return typeof window>"u"?560:Math.max(ac,Math.floor(window.innerHeight*.7))}function FS(e){return Math.min(Dh(),Math.max(ac,e))}function BS(){const[e,t]=S.useState(Zl),[n,r]=S.useState(!1),s=S.useRef(Zl);S.useEffect(()=>{s.current=e},[e]);const i=S.useCallback(u=>{t(FS(u))},[]),o=S.useCallback(()=>{i(s.current+Yl)},[i]),a=S.useCallback(()=>{i(s.current-Yl)},[i]),c=S.useCallback(u=>{const f=u,m=s.current;r(!0);const p=h=>{const y=f-h.clientY;i(m+y)},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 u=()=>{i(s.current)};return window.addEventListener("resize",u),()=>{window.removeEventListener("resize",u),document.body.style.cursor="",document.body.style.userSelect=""}},[i]);const d=Dh();return{height:e,isResizing:n,canIncrement:e<d,canDecrement:e>ac,onResizeStart:c,incrementHeight:o,decrementHeight:a}}const $S=e=>e==null?void 0:e.replace(/(\d+)\.0{18}/g,"$1"),VS=2e4;let lo=0;function HS(){return lo=(lo+1)%Number.MAX_VALUE,lo.toString()}const uo=new Map,Ql=(e,t)=>{if(uo.has(e))return;const n=setTimeout(()=>{uo.delete(e),Fs({type:"REMOVE_TOAST",toastId:e})},t||VS);uo.set(e,n)},zS=(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);Ql(r,s==null?void 0:s.duration)}else e.toasts.forEach(s=>{Ql(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)}}},WS=[];let fo={toasts:[]};function Fs(e){fo=zS(fo,e),WS.forEach(t=>{t(fo)})}function xe({duration:e=2e4,description:t,...n}){const r=HS(),s=typeof t=="string"?$S(t):t,i=a=>Fs({type:"UPDATE_TOAST",toast:{...a,description:s,id:r}}),o=()=>{Fs({type:"DISMISS_TOAST",toastId:r})};return Fs({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 GS(e){return e.type==="buy"?e.marketBid??e.currentPrice:e.marketAsk??e.currentPrice}function KS(){const{closePosition:e,deleteOrder:t}=ji(),n=ye(h=>h.removePosition),r=ye(h=>h.removeOrder),s=ye(h=>h.setSelectedPositionTicket),i=ye(h=>h.setSelectedOrderTicket),[o,a]=S.useState(new Set),[c,d]=S.useState(!1),u=S.useCallback((h,y)=>{a(b=>{const v=new Set(b);return y?v.add(h):v.delete(h),v})},[]),f=S.useCallback(h=>o.has(h),[o]),m=S.useCallback(async h=>{const y=`position-${h.ticket}`;u(y,!0);try{const b=await e(h);if(!b.success){xe({variant:"destructive",description:b.message||"Failed to close position."});return}n(h.ticket),s(null),xe({description:`Position #${h.ticket} closed at ${GS(h).toFixed(h.digits)}.`})}catch(b){const v=b instanceof Error?b.message:"Failed to close position.";xe({variant:"destructive",description:v})}finally{u(y,!1)}},[e,n,u,s]),p=S.useCallback(async h=>{if(h.length===0||c)return;if(!e){xe({variant:"destructive",description:"Close position is not configured."});return}d(!0);let y=0,b=0;for(const v of h){const x=`position-${v.ticket}`;u(x,!0);try{if(!(await e(v)).success){b+=1;continue}n(v.ticket),y+=1}catch{b+=1}finally{u(x,!1)}}s(null),xe(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}.`}),d(!1)},[c,e,n,u,s]),g=S.useCallback(async h=>{const y=`order-${h.ticket}`;u(y,!0);try{const b=await t(h);if(!b.success){xe({variant:"destructive",description:b.message||"Failed to delete order."});return}r(h.ticket),i(null),xe({description:`Order #${h.ticket} deleted.`})}catch(b){const v=b instanceof Error?b.message:"Failed to delete order.";xe({variant:"destructive",description:v})}finally{u(y,!1)}},[t,r,u,i]);return{closePosition:m,closeAllPositions:p,deleteOrder:g,isClosingAll:c,isRowBusy:f}}function Kt(e,t=2){return e.toFixed(t)}function Lh(e){return e.reduce((t,n)=>t+n.profit+n.swap,0)}function qS(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=Lh(t),a=r+s+o+n,c=a-i,d=i>0?a/i*100:void 0;return{balance:r,equity:a,margin:i,marginFree:c,marginLevel:d,totalProfit:o}}function Yo(){return l.jsxs("colgroup",{children:[l.jsx("col",{className:"web-trading-widget-terminal-col--symbol"}),l.jsx("col",{className:"web-trading-widget-terminal-col--ticket"}),l.jsx("col",{className:"web-trading-widget-terminal-col--time"}),l.jsx("col",{className:"web-trading-widget-terminal-col--type"}),l.jsx("col",{className:"web-trading-widget-terminal-col--volume"}),l.jsx("col",{className:"web-trading-widget-terminal-col--price"}),l.jsx("col",{className:"web-trading-widget-terminal-col--sl"}),l.jsx("col",{className:"web-trading-widget-terminal-col--tp"}),l.jsx("col",{className:"web-trading-widget-terminal-col--price2"}),l.jsx("col",{className:"web-trading-widget-terminal-col--swap"}),l.jsx("col",{className:"web-trading-widget-terminal-col--profit"}),l.jsx("col",{}),l.jsx("col",{className:"web-trading-widget-terminal-col--close"})]})}function ZS(){return l.jsx("thead",{children:l.jsxs("tr",{className:"web-trading-widget-terminal__head-row",children:[l.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Symbol"}),l.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Ticket"}),l.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Server time"}),l.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Type"}),l.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Volume"}),l.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Price"}),l.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"S / L"}),l.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"T / P"}),l.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Price"}),l.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Swap"}),l.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Profit"}),l.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Comment"}),l.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--close","aria-label":"Close"})]})})}function YS({balance:e,equity:t,margin:n,marginFree:r,marginLevel:s,totalPnL:i,scrollRef:o,onScroll:a}){const c=i>0?"web-trading-widget-text-profit-positive":i<0?"web-trading-widget-text-profit-negative":"";return l.jsx("div",{className:"web-trading-widget-terminal__stats",children:l.jsx("div",{ref:o,className:"web-trading-widget-terminal__header-scroll",onScroll:a,children:l.jsxs("table",{className:"web-trading-widget-terminal__table",children:[l.jsx(Yo,{}),l.jsx("tbody",{children:l.jsxs("tr",{children:[l.jsx("td",{colSpan:10,className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--nowrap",children:l.jsxs("div",{className:"web-trading-widget-terminal__stats-row web-trading-widget-terminal__stats-row--tabular",children:[l.jsxs("span",{children:["Balance: ",Kt(e)]}),l.jsxs("span",{children:["Equity: ",Kt(t)]}),l.jsxs("span",{children:["Margin: ",Kt(n)]}),l.jsxs("span",{children:["Free margin: ",Kt(r)]}),l.jsxs("span",{children:["Level: ",s!==void 0?`${Kt(s,2)}%`:"0.00%"]})]})}),l.jsx("td",{className:`web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right ${c}`,children:Kt(i)}),l.jsx("td",{className:"web-trading-widget-terminal__cell"}),l.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--close"})]})})]})})})}const QS=[{id:"trade",label:"Trade"},{id:"history",label:"History"}];function XS({activeTab:e,onTabChange:t,positionCount:n,isClosingAll:r,onCloseAllPositions:s}){const i=e==="trade"&&n>0;return l.jsxs("div",{role:"tablist","aria-label":"Terminal panel tabs",className:"web-trading-widget-terminal__tab-bar",children:[QS.map(o=>{const a=e===o.id;return l.jsx("button",{type:"button",role:"tab","aria-selected":a,onClick:()=>t(o.id),className:`web-trading-widget-terminal__tab-btn${a?" web-trading-widget-terminal__tab-btn--active":""}`,children:o.label},o.id)}),l.jsx("div",{className:"web-trading-widget-terminal__toolbar-actions",children:i?l.jsx("button",{type:"button",disabled:r,onClick:s,className:"web-trading-widget-terminal__close-all-btn",children:r?"Closing…":"Close all"}):null})]})}function JS({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 l.jsxs("tr",{className:`web-trading-widget-terminal__row${t?" web-trading-widget-terminal__row--selected":""}`,onClick:r,children:[l.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.displaySymbol}),l.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.ticket}),l.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--nowrap",children:e.time}),l.jsx("td",{className:`web-trading-widget-terminal__cell web-trading-widget-terminal__cell--capitalize ${i}`,children:e.type}),l.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.volumeLots.toFixed(2)}),l.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:Ce(e.openPrice,e.digits)}),l.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.stopLoss!==void 0?Ce(e.stopLoss,e.digits):""}),l.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.takeProfit!==void 0?Ce(e.takeProfit,e.digits):""}),l.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:Ce(e.currentPrice,e.digits)}),l.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.swap!==0?Kt(e.swap):""}),l.jsx("td",{className:`web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right ${o}`,children:Kt(e.profit)}),l.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--truncate",children:e.comment}),l.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--close",children:l.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:l.jsx(mn,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})})})]})}function e0({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 l.jsxs("tr",{className:`web-trading-widget-terminal__row${t?" web-trading-widget-terminal__row--selected":""}`,onClick:r,children:[l.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.displaySymbol}),l.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.ticket}),l.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--nowrap",children:e.time}),l.jsx("td",{className:`web-trading-widget-terminal__cell web-trading-widget-terminal__cell--capitalize ${i}`,children:e.typeLabel}),l.jsxs("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:[e.volumeLots.toFixed(2)," / ",e.volumeFilledLots.toFixed(2)]}),l.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:Ce(e.orderPrice,e.digits)}),l.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.stopLoss!==void 0?Ce(e.stopLoss,e.digits):""}),l.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.takeProfit!==void 0?Ce(e.takeProfit,e.digits):""}),l.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:Ce(e.currentPrice,e.digits)}),l.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right"}),l.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right"}),l.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--truncate",children:e.comment}),l.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--close",children:l.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:l.jsx(mn,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})})})]})}function jh({embedded:e=!1,symbolTicker:t="",onSymbolChange:n,onCreateNewOrder:r,dealDetailUrl:s}){const[i,o]=S.useState("trade"),a=cs(),{accounts:c,isLoading:d}=Ah(),u=BS(),{height:f,isResizing:m,onResizeStart:p}=e?{height:0,isResizing:!1,onResizeStart:()=>{}}:u,g=ye(B=>B.selectedLogin),h=ye(B=>B.selectedPositionTicket),y=ye(B=>B.selectedOrderTicket),b=ye(B=>B.setSelectedPositionTicket),v=ye(B=>B.setSelectedOrderTicket),{isLoading:x}=Rh(g),_=ye(B=>B.positions),C=ye(B=>B.orders),{closePosition:k,closeAllPositions:T,deleteOrder:A,isClosingAll:N,isRowBusy:O}=KS(),L=d||x,R=S.useMemo(()=>g?_.filter(B=>B.login===g):_,[_,g]),$=S.useMemo(()=>g?C.filter(B=>B.login===g):C,[C,g]),j=S.useMemo(()=>{const B=c.find(me=>me.login===g);return(B==null?void 0:B.tradeStat)??null},[c,g]),H=S.useMemo(()=>R.map(B=>B.ticket).sort().join("|"),[R]),F=S.useMemo(()=>j?`${j.balance}:${j.credit??0}:${j.equity}:${j.margin}|${H}`:"",[j,H]),I=S.useMemo(()=>{if(!j||R.length===0)return 0;const B=Lh(R);return j.equity-j.balance-(j.credit??0)-B},[F]),D=S.useMemo(()=>qS(j,R,I),[j,R,I]),U=R.length===0&&$.length===0,K=S.useRef(null),M=S.useRef(null),le=S.useRef(null),Z=S.useCallback(()=>{T(R)},[T,R]),fe=S.useCallback(B=>{const me=Xb(B,a);me&&(n==null||n(me))},[n,a]),de=S.useCallback(B=>{b(B.ticket),fe(B.symbol)},[b,fe]),ee=S.useCallback(B=>{v(B.ticket),fe(B.symbol)},[v,fe]),q=S.useCallback(B=>{const me=K.current,oe=M.current,se=le.current;if(!me||!oe)return;const te=B==="header"?me.scrollLeft:B==="body"?oe.scrollLeft:(se==null?void 0:se.scrollLeft)??0;B!=="header"&&(me.scrollLeft=te),B!=="body"&&(oe.scrollLeft=te),se&&B!=="footer"&&(se.scrollLeft=te)},[]);return l.jsxs(l.Fragment,{children:[!e&&m?l.jsx("div",{className:"web-trading-widget-terminal-resize-overlay","aria-hidden":!0}):null,l.jsxs("div",{className:`web-trading-widget-terminal${e?" web-trading-widget-terminal--embedded":""}`,style:e?void 0:{height:f},children:[e?null:l.jsx("div",{className:"web-trading-widget-terminal__resize-bar-wrap",children:l.jsx("div",{role:"separator","aria-orientation":"horizontal","aria-label":"Resize terminal panel","aria-valuenow":f,className:"web-trading-widget-terminal__resize-bar",onMouseDown:B=>{B.preventDefault(),p(B.clientY)},children:l.jsx(mf,{className:"web-trading-widget-icon web-trading-widget-icon--sm web-trading-widget-terminal__resize-icon"})})}),l.jsx(XS,{activeTab:i,onTabChange:o,positionCount:R.length,isClosingAll:N,onCloseAllPositions:Z}),i==="trade"?l.jsxs(l.Fragment,{children:[l.jsx("div",{ref:K,className:"web-trading-widget-terminal__header-scroll",onScroll:()=>q("header"),children:l.jsxs("table",{className:"web-trading-widget-terminal__table",children:[l.jsx(Yo,{}),l.jsx(ZS,{})]})}),l.jsx("div",{ref:M,className:"web-trading-widget-terminal__body-scroll",onScroll:()=>q("body"),children:l.jsxs("table",{className:"web-trading-widget-terminal__table",children:[l.jsx(Yo,{}),l.jsxs("tbody",{children:[L&&U?l.jsx("tr",{children:l.jsx("td",{colSpan:13,className:"web-trading-widget-terminal__empty-cell",children:"Loading…"})}):null,!L&&U?l.jsx("tr",{children:l.jsx("td",{colSpan:13,className:"web-trading-widget-terminal__empty-cell",children:l.jsxs("div",{className:"web-trading-widget-terminal__empty-inner",children:[l.jsx("p",{className:"web-trading-widget-terminal__empty-text",children:"You don't have any positions"}),r?l.jsx("button",{type:"button",onClick:r,className:"web-trading-widget-terminal__create-btn",children:"Create New Order"}):null]})})}):null,R.map(B=>l.jsx(JS,{position:B,isSelected:h===B.ticket,isClosing:O(`position-${B.ticket}`),onSelect:()=>de(B),onClose:()=>void k(B)},`position-${B.ticket}`)),$.map(B=>l.jsx(e0,{order:B,isSelected:y===B.ticket,isDeleting:O(`order-${B.ticket}`),onSelect:()=>ee(B),onDelete:()=>void A(B)},`order-${B.ticket}`))]})]})})]}):l.jsx(US,{login:g??"",detailUrl:s}),l.jsx(YS,{balance:D.balance,equity:D.equity,margin:D.margin,marginFree:D.marginFree,marginLevel:D.marginLevel,totalPnL:D.totalProfit,scrollRef:i==="trade"?le:void 0,onScroll:i==="trade"?()=>q("footer"):void 0})]})]})}const Qo=224,si=120;function t0(e){var n;const t=(n=e==null?void 0:e.current)==null?void 0:n.clientHeight;return t&&t>0?Math.max(si,Math.floor(t*.35)):Qo}function n0(e){var n;const t=(n=e==null?void 0:e.current)==null?void 0:n.clientHeight;return t&&t>0?Math.max(si,Math.floor(t*.85)):typeof window>"u"?560:Math.max(si,Math.floor(window.innerHeight*.7))}function r0(e,t){return Math.min(n0(t),Math.max(si,e))}function s0({containerRef:e,isOpen:t=!1}={}){const[n,r]=S.useState(Qo),[s,i]=S.useState(!1),o=S.useRef(Qo);S.useEffect(()=>{o.current=n},[n]);const a=S.useCallback(d=>{r(r0(d,e))},[e]);S.useEffect(()=>{if(!t)return;const d=Math.max(o.current,t0(e));a(d)},[e,t,a]);const c=S.useCallback(d=>{const u=d,f=o.current;i(!0);const m=g=>{const h=u-g.clientY;a(f+h)},p=()=>{i(!1),document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",p),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",m),document.addEventListener("mouseup",p),document.body.style.cursor="row-resize",document.body.style.userSelect="none"},[a]);return S.useEffect(()=>{const d=()=>{a(o.current)};return window.addEventListener("resize",d),()=>{window.removeEventListener("resize",d),document.body.style.cursor="",document.body.style.userSelect=""}},[a]),{height:n,isResizing:s,onResizeStart:c}}function Mh({children:e}){const[t]=S.useState(()=>new Nx({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}}));return l.jsx(Rx,{client:t,children:e})}function Ih({containerRef:e,onCreateNewOrder:t}){const[n,r]=S.useState(!1),{height:s,isResizing:i,onResizeStart:o}=s0({containerRef:e,isOpen:n}),a=ye(g=>g.selectedLogin),c=ye(g=>g.orders),d=ye(g=>g.positions),u=S.useMemo(()=>a?c.filter(g=>g.login===a):c,[a,c]),f=S.useMemo(()=>a?d.filter(g=>g.login===a):d,[a,d]),m=u.length+f.length,p=()=>{r(!1),t==null||t()};return l.jsxs("div",{className:"web-trading-widget-news-orders-overlay-root",children:[l.jsxs("button",{type:"button",className:"web-trading-widget-news-orders-overlay__trigger","aria-label":"Open terminal","aria-expanded":n,onClick:()=>r(!0),children:[l.jsx(Ub,{className:"web-trading-widget-icon web-trading-widget-icon--sm"}),l.jsx("span",{children:"Orders"}),m>0?l.jsx("span",{className:"web-trading-widget-news-orders-overlay__badge",children:m}):null]}),n?l.jsx(l.Fragment,{children:l.jsxs("div",{className:"web-trading-widget-news-orders__panel",style:{height:s},children:[i?l.jsx("div",{className:"web-trading-widget-terminal-resize-overlay","aria-hidden":!0}):null,l.jsx("div",{className:"web-trading-widget-news-orders__panel-resize-bar-wrap",children:l.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:l.jsx(mf,{className:"web-trading-widget-icon web-trading-widget-icon--sm web-trading-widget-terminal__resize-icon"})})}),l.jsxs("div",{className:"web-trading-widget-news-orders__panel-header",children:[l.jsx("h2",{className:"web-trading-widget-news-orders__panel-title",children:"Terminal"}),l.jsx("button",{type:"button",className:"web-trading-widget-news-orders__panel-close","aria-label":"Close terminal panel",onClick:()=>r(!1),children:l.jsx(mn,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})})]}),l.jsx("div",{className:"web-trading-widget-news-orders__panel-body",children:l.jsx(jh,{embedded:!0,onCreateNewOrder:t?p:void 0})})]})}):null]})}function i0({baseUrl:e,containerRef:t,onCreateNewOrder:n}){return l.jsx(Mh,{children:l.jsx(ih,{baseUrl:e,children:l.jsx(Ih,{containerRef:t,onCreateNewOrder:n})})})}const Nn=S.forwardRef(({className:e,type:t,...n},r)=>l.jsx("input",{type:t,className:De("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}));Nn.displayName="Input";var Mi="Collapsible",[o0,Uh]=_r(Mi),[a0,cc]=o0(Mi),Fh=w.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:s,disabled:i,onOpenChange:o,...a}=e,[c,d]=ur({prop:r,defaultProp:s??!1,onChange:o,caller:Mi});return l.jsx(a0,{scope:n,disabled:i,contentId:rn(),open:c,onOpenToggle:w.useCallback(()=>d(u=>!u),[d]),children:l.jsx(we.div,{"data-state":dc(c),"data-disabled":i?"":void 0,...a,ref:t})})});Fh.displayName=Mi;var Bh="CollapsibleTrigger",$h=w.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,s=cc(Bh,n);return l.jsx(we.button,{type:"button","aria-controls":s.open?s.contentId:void 0,"aria-expanded":s.open||!1,"data-state":dc(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...r,ref:t,onClick:Se(e.onClick,s.onOpenToggle)})});$h.displayName=Bh;var lc="CollapsibleContent",Vh=w.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=cc(lc,e.__scopeCollapsible);return l.jsx(xr,{present:n||s.open,children:({present:i})=>l.jsx(c0,{...r,ref:t,present:i})})});Vh.displayName=lc;var c0=w.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:s,...i}=e,o=cc(lc,n),[a,c]=w.useState(r),d=w.useRef(null),u=Pe(t,d),f=w.useRef(0),m=f.current,p=w.useRef(0),g=p.current,h=o.open||a,y=w.useRef(h),b=w.useRef(void 0);return w.useEffect(()=>{const v=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(v)},[]),Ie(()=>{const v=d.current;if(v){b.current=b.current||{transitionDuration:v.style.transitionDuration,animationName:v.style.animationName},v.style.transitionDuration="0s",v.style.animationName="none";const x=v.getBoundingClientRect();f.current=x.height,p.current=x.width,y.current||(v.style.transitionDuration=b.current.transitionDuration,v.style.animationName=b.current.animationName),c(r)}},[o.open,r]),l.jsx(we.div,{"data-state":dc(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!h,...i,ref:u,style:{"--radix-collapsible-content-height":m?`${m}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...e.style},children:h&&s})});function dc(e){return e?"open":"closed"}var l0=Fh,d0=$h,u0=Vh,vt="Accordion",f0=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[uc,h0,p0]=gu(vt),[Ii]=_r(vt,[p0,Uh]),fc=Uh(),Hh=w.forwardRef((e,t)=>{const{type:n,...r}=e,s=r,i=r;return l.jsx(uc.Provider,{scope:e.__scopeAccordion,children:n==="multiple"?l.jsx(b0,{...i,ref:t}):l.jsx(y0,{...s,ref:t})})});Hh.displayName=vt;var[zh,m0]=Ii(vt),[Wh,g0]=Ii(vt,{collapsible:!1}),y0=w.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},collapsible:i=!1,...o}=e,[a,c]=ur({prop:n,defaultProp:r??"",onChange:s,caller:vt});return l.jsx(zh,{scope:e.__scopeAccordion,value:w.useMemo(()=>a?[a]:[],[a]),onItemOpen:c,onItemClose:w.useCallback(()=>i&&c(""),[i,c]),children:l.jsx(Wh,{scope:e.__scopeAccordion,collapsible:i,children:l.jsx(Gh,{...o,ref:t})})})}),b0=w.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},...i}=e,[o,a]=ur({prop:n,defaultProp:r??[],onChange:s,caller:vt}),c=w.useCallback(u=>a((f=[])=>[...f,u]),[a]),d=w.useCallback(u=>a((f=[])=>f.filter(m=>m!==u)),[a]);return l.jsx(zh,{scope:e.__scopeAccordion,value:o,onItemOpen:c,onItemClose:d,children:l.jsx(Wh,{scope:e.__scopeAccordion,collapsible:!0,children:l.jsx(Gh,{...i,ref:t})})})}),[v0,Ui]=Ii(vt),Gh=w.forwardRef((e,t)=>{const{__scopeAccordion:n,disabled:r,dir:s,orientation:i="vertical",...o}=e,a=w.useRef(null),c=Pe(a,t),d=h0(n),f=yu(s)==="ltr",m=Se(e.onKeyDown,p=>{var A;if(!f0.includes(p.key))return;const g=p.target,h=d().filter(N=>{var O;return!((O=N.ref.current)!=null&&O.disabled)}),y=h.findIndex(N=>N.ref.current===g),b=h.length;if(y===-1)return;p.preventDefault();let v=y;const x=0,_=b-1,C=()=>{v=y+1,v>_&&(v=x)},k=()=>{v=y-1,v<x&&(v=_)};switch(p.key){case"Home":v=x;break;case"End":v=_;break;case"ArrowRight":i==="horizontal"&&(f?C():k());break;case"ArrowDown":i==="vertical"&&C();break;case"ArrowLeft":i==="horizontal"&&(f?k():C());break;case"ArrowUp":i==="vertical"&&k();break}const T=v%b;(A=h[T].ref.current)==null||A.focus()});return l.jsx(v0,{scope:n,disabled:r,direction:s,orientation:i,children:l.jsx(uc.Slot,{scope:n,children:l.jsx(we.div,{...o,"data-orientation":i,ref:c,onKeyDown:r?void 0:m})})})}),ii="AccordionItem",[w0,hc]=Ii(ii),Kh=w.forwardRef((e,t)=>{const{__scopeAccordion:n,value:r,...s}=e,i=Ui(ii,n),o=m0(ii,n),a=fc(n),c=rn(),d=r&&o.value.includes(r)||!1,u=i.disabled||e.disabled;return l.jsx(w0,{scope:n,open:d,disabled:u,triggerId:c,children:l.jsx(l0,{"data-orientation":i.orientation,"data-state":Jh(d),...a,...s,ref:t,disabled:u,open:d,onOpenChange:f=>{f?o.onItemOpen(r):o.onItemClose(r)}})})});Kh.displayName=ii;var qh="AccordionHeader",Zh=w.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=Ui(vt,n),i=hc(qh,n);return l.jsx(we.h3,{"data-orientation":s.orientation,"data-state":Jh(i.open),"data-disabled":i.disabled?"":void 0,...r,ref:t})});Zh.displayName=qh;var Xo="AccordionTrigger",Yh=w.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=Ui(vt,n),i=hc(Xo,n),o=g0(Xo,n),a=fc(n);return l.jsx(uc.ItemSlot,{scope:n,children:l.jsx(d0,{"aria-disabled":i.open&&!o.collapsible||void 0,"data-orientation":s.orientation,id:i.triggerId,...a,...r,ref:t})})});Yh.displayName=Xo;var Qh="AccordionContent",Xh=w.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=Ui(vt,n),i=hc(Qh,n),o=fc(n);return l.jsx(u0,{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}})});Xh.displayName=Qh;function Jh(e){return e?"open":"closed"}var _0=Hh,x0=Kh,S0=Zh,ep=Yh,tp=Xh;const C0=_0,Wn=w.forwardRef(({className:e,...t},n)=>l.jsx(x0,{ref:n,className:De("border-b",e),...t}));Wn.displayName="AccordionItem";const Gn=w.forwardRef(({className:e,children:t,...n},r)=>l.jsx(S0,{className:"flex",children:l.jsxs(ep,{ref:r,className:De("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,l.jsx(Fa,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"})]})}));Gn.displayName=ep.displayName;const Kn=w.forwardRef(({className:e,children:t,...n},r)=>l.jsx(tp,{ref:r,className:"overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...n,children:l.jsx("div",{className:De("pb-4 pt-0",e),children:t})}));Kn.displayName=tp.displayName;function Xl(e){const t=e.trim().replace(/,/g,"");if(!t)return null;const n=Number(t);return Number.isFinite(n)?n:null}function Jl(e,t){return t<=0?String(Math.round(e)):e.toFixed(t)}function Re({label:e,value:t,onChange:n,step:r=.01,min:s,decimals:i=2,placeholder:o,basePrice:a,disabled:c=!1,clearable:d=!1}){const u=t.trim()!=="",f=g=>{if(c)return;const h=Xl(t),y=a!=null&&Number.isFinite(a)?a:s??0,v=(h??y)+g*r,x=s!==void 0?Math.max(s,v):v;x<=0||n(Jl(x,i))},m=()=>{const g=Xl(t);if(g===null||g<=0){t.trim()!==""&&n("");return}n(Jl(g,i))},p=()=>{c||n("")};return l.jsxs("div",{className:"web-trading-widget-stepper",children:[l.jsxs("div",{className:"web-trading-widget-stepper__header",children:[l.jsx("span",{className:"web-trading-widget-stepper__label",children:e}),d&&u?l.jsx("button",{type:"button","aria-label":`Clear ${e}`,className:"web-trading-widget-stepper__clear",disabled:c,onClick:p,children:l.jsx(mn,{className:"web-trading-widget-icon web-trading-widget-icon--xs"})}):null]}),l.jsxs("div",{className:`web-trading-widget-stepper__control${c?" web-trading-widget-stepper__control--disabled":""}`,children:[l.jsx("button",{type:"button","aria-label":`Decrease ${e}`,className:"web-trading-widget-stepper__btn web-trading-widget-stepper__btn--minus",disabled:c||a===null&&t.trim()==="",onClick:()=>f(-1),children:l.jsx(Bb,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})}),l.jsx("input",{type:"text",inputMode:"decimal",value:t,placeholder:o,disabled:c,onChange:g=>n(g.target.value),onBlur:m,className:"web-trading-widget-stepper__input"}),l.jsx("button",{type:"button","aria-label":`Increase ${e}`,className:"web-trading-widget-stepper__btn web-trading-widget-stepper__btn--plus",disabled:c||a===null&&t.trim()==="",onClick:()=>f(1),children:l.jsx($b,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})})]})]})}function E0({symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:s,minVolumeLots:i,isSubmitting:o,isAccountsLoading:a,selectedLogin:c,embedded:d=!1,onMinimize:u,onClose:f,onPlaceOrder:m}){const[p,g]=S.useState("market"),[h,y]=S.useState(String(r)),[b,v]=S.useState(""),[x,_]=S.useState(""),C=ie(re=>re.stopLoss),k=ie(re=>re.takeProfit),T=ie(re=>re.setStopLoss),A=ie(re=>re.setTakeProfit),N=ie(re=>re.setVolumeLots),O=ie(re=>re.setOrderSide),[L,R]=S.useState(""),[$,j]=S.useState(ft.GTC),[H,F]=S.useState(""),[I,D]=S.useState(""),U=Number(Bt($t(e))),K=Er(U),M=_f(t,n),le=t!==null?Ce(t,U):"—",Z=n!==null?Ce(n,U):"—",fe=Ei(p),de=bf(p),ee=Ci(p),q=ee.label,B=!fe&&ee.orderType!==null&&ee.orderType%2===1,me=S.useMemo(()=>M!==null?M:t??n,[n,t,M]),oe=re=>{y(re);const $e=Number(re);Number.isFinite($e)&&$e>0&&N($e)},se=re=>t===null||n===null?null:fe?re==="buy"?n:t:ht(b)??(re==="buy"?n:t),te=re=>{const $e=se(re);$e!==null&&O({side:re,entryPrice:$e})},je=re=>{if(t===null||n===null||!c)return;const $e=Math.max(i,Number(h)||i),Fi=ko(p,re),ls=se(re);ls!==null&&O({side:re,entryPrice:ls}),m({login:c,executionMode:p,side:re,orderType:Fi,volumeLots:$e,stopLoss:C,takeProfit:k,priceOrder:b,priceTrigger:x,comment:L,typeTime:$,expirationDateTime:H,expirationDay:I,bid:t,ask:n})},Ne=t!==null&&n!==null,Oe=fe||ht(b)!==void 0,X=!de||ht(x)!==void 0,Te=fe||Pi($,H,I),Ue=!o&&!a&&c!==""&&Ne&&Oe&&X&&Te,Qe=!fe&&Wa($),ct=!fe&&Ga($);return l.jsxs("div",{className:"web-trading-widget-market-panel",children:[l.jsxs("div",{className:"web-trading-widget-market-panel__header",children:[l.jsxs(qs,{value:p,onValueChange:re=>g(re),children:[l.jsx(Br,{className:"web-trading-widget-market-panel__select-trigger",children:l.jsx(Zs,{})}),l.jsx($r,{children:Qs.map(re=>l.jsx(Vr,{value:re.mode,children:re.label},re.mode))})]}),d?null:l.jsxs("div",{className:"web-trading-widget-market-panel__header-actions",children:[l.jsx("button",{type:"button","aria-label":"Minimize to quick order panel",className:"web-trading-widget-market-panel__header-btn",onClick:u,children:l.jsx(Fb,{className:"web-trading-widget-icon web-trading-widget-icon--md"})}),l.jsx("button",{type:"button","aria-label":"Close order panel",className:"web-trading-widget-market-panel__header-btn",onClick:f,children:l.jsx(mn,{className:"web-trading-widget-icon web-trading-widget-icon--md"})})]})]}),l.jsxs(C0,{type:"multiple",defaultValue:["volume-setting","risk-management"],className:"web-trading-widget-market-panel__accordion",children:[l.jsxs(Wn,{value:"volume-setting",className:"web-trading-widget-market-panel__accordion-item",children:[l.jsx(Gn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Volume Setting"}),l.jsx(Kn,{className:"web-trading-widget-market-panel__accordion-content",children:l.jsx(Re,{label:"Lots",value:h,onChange:oe,step:s,min:i,decimals:2})})]}),fe?null:l.jsxs(Wn,{value:"order-price",className:"web-trading-widget-market-panel__accordion-item",children:[l.jsx(Gn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Order Price"}),l.jsx(Kn,{className:"web-trading-widget-market-panel__accordion-content",children:de?l.jsxs(l.Fragment,{children:[l.jsx(Re,{label:"Stop Price",value:x,onChange:_,step:K,decimals:U,basePrice:me,placeholder:M!==null?Ce(M,U):"—"}),l.jsx(Re,{label:"Limit Price",value:b,onChange:v,step:K,decimals:U,basePrice:me,placeholder:M!==null?Ce(M,U):"—"})]}):l.jsx(Re,{label:"Price",value:b,onChange:v,step:K,decimals:U,basePrice:me,placeholder:M!==null?Ce(M,U):"—"})})]}),l.jsxs(Wn,{value:"risk-management",className:"web-trading-widget-market-panel__accordion-item",children:[l.jsx(Gn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Risk Management"}),l.jsx(Kn,{className:"web-trading-widget-market-panel__accordion-content",children:l.jsxs("div",{className:"web-trading-widget-market-panel__grid-2",children:[l.jsx(Re,{label:"Stop Loss",value:C,onChange:T,step:K,decimals:U,basePrice:t,placeholder:t!==null?le:"—",clearable:!0}),l.jsx(Re,{label:"Take Profit",value:k,onChange:A,step:K,decimals:U,basePrice:n,placeholder:n!==null?Z:"—",clearable:!0})]})})]}),fe?null:l.jsxs(Wn,{value:"expiration",className:"web-trading-widget-market-panel__accordion-item",children:[l.jsx(Gn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Expiration"}),l.jsxs(Kn,{className:"web-trading-widget-market-panel__accordion-content",children:[l.jsxs(qs,{value:String($),onValueChange:re=>j(Number(re)),children:[l.jsx(Br,{className:"web-trading-widget-market-panel__select-full",children:l.jsx(Zs,{})}),l.jsx($r,{children:vf.map(re=>l.jsx(Vr,{value:String(re.value),children:re.label},re.value))})]}),Qe?l.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[l.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Expiration time"}),l.jsx(Nn,{type:"datetime-local",value:H,onChange:re=>F(re.target.value)})]}):null,ct?l.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[l.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Expiration day"}),l.jsx(Nn,{type:"date",value:I,onChange:re=>D(re.target.value)})]}):null]})]}),l.jsxs(Wn,{value:"comment",className:"web-trading-widget-market-panel__accordion-item",children:[l.jsx(Gn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Comment"}),l.jsx(Kn,{className:"web-trading-widget-market-panel__accordion-content",children:l.jsx(Nn,{value:L,onChange:re=>R(re.target.value),placeholder:""})})]})]}),l.jsxs("div",{className:"web-trading-widget-market-panel__footer",children:[l.jsxs("div",{className:"web-trading-widget-market-panel__quotes",children:[l.jsx("span",{children:le}),l.jsx("span",{className:"web-trading-widget-market-panel__quotes-ask",children:Z})]}),fe?l.jsxs("div",{className:"web-trading-widget-market-panel__actions",children:[l.jsx(ot,{type:"button",variant:"destructive",className:"web-trading-widget-market-panel__sell-btn",disabled:!Ue,onMouseDown:()=>te("sell"),onClick:()=>je("sell"),children:"Sell by Market"}),l.jsx(ot,{type:"button",className:"web-trading-widget-market-panel__buy-btn",disabled:!Ue,onMouseDown:()=>te("buy"),onClick:()=>je("buy"),children:"Buy by Market"})]}):l.jsxs(ot,{type:"button",variant:B?"destructive":"default",className:`web-trading-widget-market-panel__place-btn${B?"":" web-trading-widget-market-panel__place-btn--buy"}`,disabled:!Ue,onMouseDown:()=>{const re=ee.orderType!==null&&ee.orderType%2===1?"sell":"buy";te(re)},onClick:()=>{const re=ee.orderType!==null&&ee.orderType%2===1?"sell":"buy";je(re)},children:["Place ",q]})]})]})}function np({confirmation:e,symbolTicker:t,onDismiss:n}){const r=Number(Bt($t(t))),s=Ce(e.price,r),i=e.side==="sell"?"sell":"buy",o=Si(e.symbol||Ti(t));return l.jsxs("div",{className:"web-trading-widget-confirmation",children:[l.jsx("div",{className:"web-trading-widget-confirmation__close-row",children:l.jsx("button",{type:"button","aria-label":"Close confirmation",className:"web-trading-widget-confirmation__close-btn",onClick:n,children:l.jsx(mn,{className:"web-trading-widget-icon web-trading-widget-icon--md"})})}),l.jsxs("div",{className:"web-trading-widget-confirmation__body",children:[l.jsxs("p",{className:"web-trading-widget-confirmation__summary",children:[l.jsxs("span",{className:"web-trading-widget-confirmation__ticket",children:["#",e.ticket]})," ",l.jsx("span",{className:`web-trading-widget-confirmation__side web-trading-widget-confirmation__side--${e.side}`,children:i})," ",e.volumeLots.toFixed(2)," ",o]}),l.jsxs("p",{className:"web-trading-widget-confirmation__price",children:["at ",s]}),l.jsx("p",{className:"web-trading-widget-confirmation__status",children:"Placed"}),l.jsx(ot,{type:"button",className:"web-trading-widget-confirmation__ok-btn",onClick:n,children:"OK"})]})]})}function Ps(e,t){return e.toLocaleString(void 0,{minimumFractionDigits:t,maximumFractionDigits:t})}function ho(e){const t=e.trim();if(!t)return;const n=Number(t);return Number.isFinite(n)?n:void 0}function rp({order:e,onClose:t}){const{deleteOrder:n,modifyOrder:r}=ji(),s=ye(I=>I.removeOrder),[i,o]=S.useState(String(e.volumeLots)),[a,c]=S.useState(String(e.orderPrice)),[d,u]=S.useState(e.priceTrigger!==void 0?String(e.priceTrigger):""),f=ie(I=>I.stopLoss),m=ie(I=>I.takeProfit),p=ie(I=>I.setStopLoss),g=ie(I=>I.setTakeProfit),h=ie(I=>I.setDraft),y=ie(I=>I.clearDraft),[b,v]=S.useState(e.comment),[x,_]=S.useState(!1),[C,k]=S.useState(!1),T=Er(e.digits);S.useEffect(()=>(h({source:"order",entryPrice:e.orderPrice,stopLoss:e.stopLoss!==void 0?String(e.stopLoss):"",takeProfit:e.takeProfit!==void 0?String(e.takeProfit):"",side:e.side,showEntryLine:!0,volumeLots:e.volumeLots,digits:e.digits,priceStep:T}),()=>{y()}),[y,e.digits,e.orderPrice,e.side,e.stopLoss,e.takeProfit,e.volumeLots,T,h]);const A=za(e.orderType),N=e.volumeLots,O=Number(a)||e.orderPrice,L=ho(d),R=x||C,$=!A||L!==void 0&&Number.isFinite(O)&&O>0,j=S.useMemo(()=>`Delete #${e.ticket} ${e.typeLabel} ${N.toFixed(2)} ${e.displaySymbol} at ${Ps(O,e.digits)}`,[e,O,N]),H=async()=>{if(!$){xe({variant:"destructive",description:A?"Please set both stop and limit prices.":"Please set an order price."});return}_(!0);try{const I=await r(e,{volumeLots:N,priceOrder:O,priceTrigger:A?L:void 0,stopLoss:ho(f),takeProfit:ho(m),comment:b.trim()||"order modify"});if(!I.success){xe({variant:"destructive",description:I.message||"Failed to modify order."});return}t(),xe({description:`Order #${e.ticket} updated.`})}catch(I){const D=I instanceof Error?I.message:"Failed to modify order.";xe({variant:"destructive",description:D})}finally{_(!1)}},F=async()=>{k(!0);try{const I=await n(e);if(!I.success){xe({variant:"destructive",description:I.message||"Failed to delete order."});return}s(e.ticket),t(),xe({description:`Order #${e.ticket} deleted.`})}catch(I){const D=I instanceof Error?I.message:"Failed to delete order.";xe({variant:"destructive",description:D})}finally{k(!1)}};return l.jsxs("div",{className:"web-trading-widget-detail-panel",children:[l.jsxs("div",{className:"web-trading-widget-detail-panel__header",children:[l.jsxs("p",{className:`web-trading-widget-detail-panel__title web-trading-widget-detail-panel__title--${e.side}`,children:["#",e.ticket," ",e.typeLabel," ",N.toFixed(2)," / ",e.volumeFilledLots.toFixed(2)," ",e.displaySymbol," ",A&&L!==void 0?`${Ps(L,e.digits)} / ${Ps(O,e.digits)}`:Ps(O,e.digits)]}),l.jsx("button",{type:"button","aria-label":"Close order panel",className:"web-trading-widget-icon-btn",onClick:t,children:l.jsx(mn,{className:"web-trading-widget-icon web-trading-widget-icon--md"})})]}),l.jsxs("div",{className:"web-trading-widget-detail-panel__body",children:[l.jsx(Re,{label:"Lots",value:i,onChange:o,step:.01,min:.01,decimals:2,disabled:!0}),A?l.jsxs(l.Fragment,{children:[l.jsx(Re,{label:"Stop Price",value:d,onChange:u,step:T,decimals:e.digits,basePrice:e.currentPrice}),l.jsx(Re,{label:"Limit Price",value:a,onChange:c,step:T,decimals:e.digits,basePrice:e.currentPrice})]}):l.jsx(Re,{label:"Price",value:a,onChange:c,step:T,decimals:e.digits,basePrice:e.currentPrice}),l.jsxs("div",{className:"web-trading-widget-market-panel__grid-2",children:[l.jsx(Re,{label:"Stop Loss",value:f,onChange:p,step:T,decimals:e.digits,basePrice:e.currentPrice,placeholder:"—"}),l.jsx(Re,{label:"Take Profit",value:m,onChange:g,step:T,decimals:e.digits,basePrice:e.currentPrice,placeholder:"—"})]}),l.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[l.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Comment"}),l.jsx(Nn,{value:b,onChange:I=>v(I.target.value)})]}),l.jsx(ot,{type:"button",variant:"secondary",className:"web-trading-widget-detail-panel__btn-full",disabled:R||!$,onClick:()=>void H(),children:"Modify"}),l.jsx(ot,{type:"button",className:"web-trading-widget-detail-panel__action-btn",disabled:R,onClick:()=>void F(),children:j})]})]})}function ks(e,t){return e.toLocaleString(void 0,{minimumFractionDigits:t,maximumFractionDigits:t})}function T0(e){return e.type==="buy"?e.marketBid??e.currentPrice:e.marketAsk??e.currentPrice}function sp({position:e,onClose:t}){const{closePosition:n}=ji(),r=ye(C=>C.removePosition),[s,i]=S.useState(String(e.volumeLots)),o=ie(C=>C.stopLoss),a=ie(C=>C.takeProfit),c=ie(C=>C.setStopLoss),d=ie(C=>C.setTakeProfit),u=ie(C=>C.setDraft),f=ie(C=>C.clearDraft),[m,p]=S.useState(e.comment),[g,h]=S.useState(!1),y=Er(e.digits);S.useEffect(()=>(u({source:"position",entryPrice:e.openPrice,stopLoss:e.stopLoss!==void 0?String(e.stopLoss):"",takeProfit:e.takeProfit!==void 0?String(e.takeProfit):"",side:e.type,showEntryLine:!0,volumeLots:e.volumeLots,digits:e.digits,priceStep:y}),()=>{f()}),[f,e.digits,e.openPrice,e.stopLoss,e.takeProfit,e.type,e.volumeLots,y,u]);const b=T0(e),v=e.volumeLots,x=S.useMemo(()=>{const C=e.profit.toFixed(2);return`Close #${e.ticket} ${e.type} ${v.toFixed(2)} ${e.displaySymbol} ${ks(e.openPrice,e.digits)} at ${ks(b,e.digits)} with Profit ${C}`},[b,e,v]),_=async()=>{h(!0);try{const C=await n(e);if(!C.success){xe({variant:"destructive",description:C.message||"Failed to close position."});return}r(e.ticket),t(),xe({description:`Position #${e.ticket} closed.`})}catch(C){const k=C instanceof Error?C.message:"Failed to close position.";xe({variant:"destructive",description:k})}finally{h(!1)}};return l.jsxs("div",{className:"web-trading-widget-detail-panel",children:[l.jsxs("div",{className:"web-trading-widget-detail-panel__header",children:[l.jsxs("p",{className:"web-trading-widget-detail-panel__title web-trading-widget-detail-panel__title--position",children:["#",e.ticket," ",e.type," ",v.toFixed(2)," ",e.displaySymbol," ",ks(e.openPrice,e.digits)]}),l.jsx("button",{type:"button","aria-label":"Close position panel",className:"web-trading-widget-icon-btn",onClick:t,children:l.jsx(mn,{className:"web-trading-widget-icon web-trading-widget-icon--md"})})]}),l.jsxs("div",{className:"web-trading-widget-detail-panel__body",children:[l.jsx(Re,{label:"Lots",value:s,onChange:i,step:.01,min:.01,decimals:2,disabled:!0}),l.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[l.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Price"}),l.jsx(Nn,{readOnly:!0,disabled:!0,value:ks(e.openPrice,e.digits),className:"web-trading-widget-detail-panel__input-muted"})]}),l.jsxs("div",{className:"web-trading-widget-market-panel__grid-2",children:[l.jsx(Re,{label:"Stop Loss",value:o,onChange:c,step:y,decimals:e.digits,basePrice:e.marketBid??e.openPrice,placeholder:"—"}),l.jsx(Re,{label:"Take Profit",value:a,onChange:d,step:y,decimals:e.digits,basePrice:e.marketAsk??e.openPrice,placeholder:"—"})]}),l.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[l.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Comment"}),l.jsx(Nn,{value:m,onChange:C=>p(C.target.value)})]}),l.jsx(ot,{type:"button",variant:"secondary",className:"web-trading-widget-detail-panel__btn-full",disabled:!0,children:"Modify"}),l.jsx(ot,{type:"button",className:"web-trading-widget-detail-panel__action-btn",disabled:g,onClick:()=>void _(),children:x})]})]})}function ed({symbolTicker:e,orderState:t}){const n=nc(e),{confirmation:r,isSubmitting:s,defaultVolumeLots:i,volumeStep:o,minVolumeLots:a,selectedLogin:c,isAccountsLoading:d,hasConfirmedAccount:u,dismissConfirmation:f,placeMarketOrder:m}=t,p=ye(T=>T.positions),g=ye(T=>T.orders),h=ye(T=>T.selectedPositionTicket),y=ye(T=>T.selectedOrderTicket),b=ye(T=>T.setSelectedPositionTicket),v=ye(T=>T.setSelectedOrderTicket),x=h!==null?p.find(T=>T.ticket===h)??null:null,_=y!==null?g.find(T=>T.ticket===y)??null:null,C=r!==null,k=S.useCallback(T=>{m({symbolTicker:e,login:T.login,executionMode:T.executionMode,side:T.side,orderType:T.orderType,volumeLots:T.volumeLots,stopLoss:T.stopLoss,takeProfit:T.takeProfit,priceOrder:T.priceOrder,priceTrigger:T.priceTrigger,comment:T.comment,typeTime:T.typeTime,expirationDateTime:T.expirationDateTime,expirationDay:T.expirationDay,bid:T.bid,ask:T.ask})},[m,e]);return x!==null?l.jsx(sp,{position:x,onClose:()=>b(null)}):_!==null?l.jsx(rp,{order:_,onClose:()=>v(null)}):C&&r!==null?l.jsx(np,{confirmation:r,symbolTicker:e,onDismiss:f}):u?l.jsx(E0,{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:c,onPlaceOrder:k}):l.jsx("div",{className:"web-trading-widget-side-panel__empty",children:"Select a trading account to start placing orders."})}function td({label:e,isActive:t,onClick:n}){return l.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 P0({symbolTicker:e,orderState:t,scanResultUrl:n,onScanResultLoad:r,initialTab:s="trade"}){const i=!!n,[o,a]=S.useState(s);return l.jsx("aside",{className:`web-trading-widget-side-panel${i?" web-trading-widget-side-panel--with-scan":""}`,children:i?l.jsxs("div",{className:"web-trading-widget-side-panel__scan-layout",children:[l.jsxs("div",{role:"tablist","aria-label":"Chart side panel",className:"web-trading-widget-side-panel__tablist",children:[l.jsx(td,{label:"Trade",isActive:o==="trade",onClick:()=>a("trade")}),l.jsx(td,{label:"Scan Result",isActive:o==="scan",onClick:()=>a("scan")})]}),l.jsxs("div",{className:"web-trading-widget-side-panel__panels",children:[l.jsx("div",{role:"tabpanel",hidden:o!=="trade",className:"web-trading-widget-side-panel__tabpanel",children:l.jsx(ed,{symbolTicker:e,orderState:t})}),l.jsx("div",{role:"tabpanel",hidden:o!=="scan",className:"web-trading-widget-side-panel__tabpanel web-trading-widget-side-panel__tabpanel--scan",children:l.jsx("iframe",{src:n??void 0,title:"Scan result",className:"web-trading-widget-side-panel__iframe",onLoad:r},n)})]})]}):l.jsx("div",{className:"web-trading-widget-side-panel__scroll",children:l.jsx(ed,{symbolTicker:e,orderState:t})})})}const k0=.01,O0=.01,nd=.01;function A0({symbols:e,defaultPanelAfterConfirm:t="mini"}){const[n,r]=S.useState("closed"),[s,i]=S.useState(null),[o,a]=S.useState(!1),[c,d]=S.useState(!1),[u,f]=S.useState(null),m=ye(O=>O.setSelectedLogin),{accounts:p,isLoading:g}=Ah(),{submitOrder:h}=ji(),y=S.useMemo(()=>Yb(p),[p]),b=S.useMemo(()=>Qb(p),[p]),v=S.useMemo(()=>u!==null&&y.some(O=>O.login===u)?u:b,[y,b,u]);S.useEffect(()=>{v&&m(v)},[v,m]);const x=S.useCallback(O=>{f(O),m(O)},[m]),_=S.useCallback(O=>{O&&(x(O),d(!0),i(null),r(t))},[t,x]),C=S.useCallback(()=>{i(null),r("market")},[]),k=S.useCallback(()=>{i(null),r("mini")},[]),T=S.useCallback(()=>{i(null),r("mini")},[]),A=S.useCallback(()=>{i(null),r("mini")},[]),N=S.useCallback(async O=>{const L=O.login.trim();if(!L){xe({variant:"destructive",description:"Please select a trading account."});return}const R=Math.max(nd,O.volumeLots),$=Ti(O.symbolTicker,e);Number(Bt($t(O.symbolTicker,e)));const j=Ei(O.executionMode),H=za(O.orderType),F=ht(O.priceOrder),I=ht(O.priceTrigger);if(!j&&F===void 0){xe({variant:"destructive",description:H?"Please set a limit price for this order.":"Please set an order price for pending orders."});return}if(H&&I===void 0){xe({variant:"destructive",description:"Please set a stop price for stop limit orders."});return}if(!j&&!Pi(O.typeTime,O.expirationDateTime,O.expirationDay)){xe({variant:"destructive",description:"Please set an expiration date for this order."});return}const D=j?O.side==="buy"?O.ask:O.bid:F??(O.side==="buy"?O.ask:O.bid);a(!0);try{const U=await h({login:L,symbolTicker:O.symbolTicker,executionMode:O.executionMode,side:Xs(O.orderType),orderType:O.orderType,volumeLots:R,stopLoss:ht(O.stopLoss),takeProfit:ht(O.takeProfit),priceOrder:Ha(O.orderType)?F:void 0,priceTrigger:H?I:void 0,comment:O.comment.trim(),typeTime:O.typeTime,expirationDateTime:O.expirationDateTime,expirationDay:O.expirationDay,bid:O.bid,ask:O.ask});if(!U.success){xe({variant:"destructive",description:U.message||"Order was not accepted."});return}i({ticket:U.ticket??"",side:U.side??Xs(O.orderType),volumeLots:U.volumeLots??R,symbol:U.displaySymbol??$,price:U.price??D}),r("confirmation")}catch(U){const K=U instanceof Error?U.message:"Failed to place order.";xe({variant:"destructive",description:K})}finally{a(!1)}},[h,e]);return{panel:n,confirmation:s,isSubmitting:o,defaultVolumeLots:k0,volumeStep:O0,minVolumeLots:nd,accountOptions:y,selectedLogin:v,setSelectedLogin:x,isAccountsLoading:g,hasConfirmedAccount:c,confirmAccountSelection:_,openMarketPanel:C,openMiniPanel:k,closePanels:T,dismissConfirmation:A,placeMarketOrder:N}}function oi(e){var t;if(typeof window<"u"){const n=localStorage.getItem(Ur);if(n&&e.some(r=>r.ticker===n))return n}return((t=e[0])==null?void 0:t.ticker)??"XAU_USD"}function ip(e,t,n){var r;return((r=t.find(s=>s.display_name===e||s.ticker===e))==null?void 0:r.ticker)??n}function N0({chartWidget:e,symbols:t,chartSlotElement:n,onSymbolTickerChange:r,onScanResultUrlChange:s,selectSymbolTickerRef:i}){const o=S.useMemo(()=>oi(t),[t]),a=S.useRef(o),c=S.useRef(e),[d,u]=S.useState(null);S.useEffect(()=>{c.current=e},[e]),S.useEffect(()=>{if(!n){u(null);return}const m=()=>{const g=n.querySelector(":scope > div");u(g)};m();const p=new MutationObserver(m);return p.observe(n,{childList:!0}),()=>{p.disconnect()}},[n]);const f=S.useCallback(m=>{if(m===a.current)return;const p=t.find(h=>h.ticker===m);if(!p)return;a.current=m,localStorage.setItem(Ur,m),r(m),s(null);const g=c.current;if(g)try{g.onChartReady(()=>{g.activeChart().setSymbol(p.ticker)})}catch{}},[s,r,t]);return S.useEffect(()=>(i.current=f,()=>{i.current=null}),[f,i]),S.useEffect(()=>{if(!e)return;let m=!1,p=null;try{e.onChartReady(()=>{if(m)return;let g;try{g=e.activeChart()}catch{return}const h=y=>{const b=g.symbol(),v=ip(b,t,o);v!==a.current&&s(null);try{e.resetCache()}catch{}a.current=v,localStorage.setItem(Ur,v),r(v)};g.onSymbolChanged().subscribe(null,h),p=()=>{try{g.onSymbolChanged().unsubscribe(null,h)}catch{}}})}catch{}return()=>{m=!0,p==null||p()}},[e,s,r,o,t]),{chartContainer:d}}const R0=Id("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 D0({className:e,variant:t,...n}){return l.jsx("div",{className:De(R0({variant:t}),e),...n})}function op(){var t;const e=(t=window.TradingView)==null?void 0:t.widget;return typeof e=="function"?e:null}function Bs(){return op()!==null}const rd="/charting_library/charting_library.js";function L0({onLoad:e}){return S.useEffect(()=>{if(Bs()){e();return}const t=document.querySelector(`script[src="${rd}"]`);if(t){const r=()=>{Bs()&&e()};return t.addEventListener("load",r),()=>t.removeEventListener("load",r)}const n=document.createElement("script");return n.src=rd,n.async=!1,n.onload=()=>{Bs()&&e()},n.onerror=()=>{console.error("Failed to load TradingView charting library")},document.head.appendChild(n),()=>{n.onload=null,n.onerror=null}},[e]),null}const sd=ki(e=>({playEndTimestamp:null,setPlayEndTimestamp:t=>e({playEndTimestamp:t})})),ap=ki(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})})),Jo=8,cp=4,ea=5,ta=e=>e==="1"?60:e==="5"?300:e==="1D"?1440*3600:parseInt(e,10)*60,j0=e=>{const t=new Date(e+Jo*60*60*1e3),n=t.getUTCDay(),r=t.getUTCHours();return n===0?!1:n===1?r>=ea:n===6?r<=cp:!0},M0=e=>{const t=new Date(e+Jo*60*60*1e3),n=t.getUTCDay(),r=t.getUTCHours();if(n===0||n===1&&r<ea||n===6&&r>=cp){const s=(8-n)%7;return t.setUTCDate(t.getUTCDate()+s),t.setUTCHours(ea,0,0,0),t.getTime()-Jo*60*60*1e3}return e},I0=(e,t,n)=>{const r=ta(t)*1e3,s=[];let i=e;for(let o=0;o<n;o++)i+=r,j0(i)||(i=M0(i)),s.push(i);return s},U0=(e,t,n,r)=>{if(n<=0)return[];if(r==="24x7"){const i=ta(t)*1e3;return Array.from({length:n},(o,a)=>e+(a+1)*i)}if(r==="1700-1700")return I0(e,t,n);const s=ta(t)*1e3;return Array.from({length:n},(i,o)=>e+(o+1)*s)},F0=(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},id="wss://symbols.opheleo.com";function B0(e){return{1:6e4,5:3e5,15:9e5,30:18e5,60:36e5,240:144e5}[e]??6e4}function od(e){return e.trim().toUpperCase()}function $0(e,t){return Math.floor(e/t)*t}let Dr;async function V0(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),ke({baseURL:"https://corprate-widget.iccandle.ai",url:`/chart/endTimestamp?${t.toString()}`,method:"GET"})}class H0{constructor(t,n,r=fn,s=id){st(this,"futureBarsRef");st(this,"type");st(this,"symbols");st(this,"tickWebSocketUrl");st(this,"configuration",{supported_resolutions:["1","5","15","30","60"],supports_marks:!1,supports_timescale_marks:!0,supports_time:!1});st(this,"ws",null);st(this,"isWsConnecting",!1);st(this,"wsSelectedSymbol",null);st(this,"subscriptions",new Map);st(this,"lastBarsCache",new Map);st(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||id}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 f;const o=(f=t.library_custom_fields)==null?void 0:f.ticker,a=this.symbols.find(m=>o!==void 0&&m.ticker===o||m.ticker===t.ticker||m.display_name===t.name||m.display_name===t.ticker),c={symbol:(a==null?void 0:a.ticker)||"",timeframe:n};if(r.firstDataRequest&&(Dr=void 0),!r.firstDataRequest)if(Dr)c.last_evaluated_key=Dr;else{s([],{noData:!0});return}const u=sd.getState().playEndTimestamp;u&&(c.endTimestamp=u,sd.getState().setPlayEndTimestamp(null),Dr=void 0),(async()=>{var m;try{const{data:p}=await V0(c);if(p.data_status==="threshold_limited"){s([],{noData:!0});return}if(p.data_status==="end_of_data"){s([],{noData:!0});return}if(!((m=p.items)!=null&&m.length)){s([],{noData:!0});return}Dr=p.last_evaluated_key;const h=[...p.items].map(x=>({open:x.o,high:x.h,low:x.l,close:x.c,time:F0(x.timestamp,n)})),y=ap.getState(),{gapCount:b,isReplayMode:v}=y;if(v&&event){const x=U0(h[h.length-1].time,n,b||0,t.session);if(x.length>0){const _=h[h.length-1].close;for(const C of x)h.push({open:_,high:_,low:_,close:_,time:C})}}s(h)}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 f;const o=(f=t.library_custom_fields)==null?void 0:f.ticker,a=this.symbols.find(m=>o!==void 0&&m.ticker===o||m.display_name===t.ticker||m.display_name===t.name),c=a!=null&&a.resolve_symbol?od(a.resolve_symbol):od(t.ticker||t.name||""),d=B0(n),u=`${c}|${n}`;this.subscriptions.set(s,{symbol:c,resolution:n,periodMs:d,onTick:r,onResetCacheNeededCallback:i,liveCandle:this.lastBarsCache.get(u)??null}),this.ensureWebSocket(c)}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}`,c=$0(r,o.periodMs);let d=o.liveCandle;d?c>d.time?d={time:c,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:c,open:s,high:s,low:s,close:s,volume:0},o.liveCandle=d,this.lastBarsCache.set(a,d),this.subscriptions.set(i,o),(f=>{var m,p;(p=(m=this.futureBarsRef)==null?void 0:m.current)!=null&&p.length||o.onTick(f)})(d)}}extractErrorMessage(t){if(t instanceof Error)return t.message;if(typeof t=="string")return t;try{return JSON.stringify(t)}catch{return String(t)}}getTimescaleMarks(t,n,r,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:c,event_name:d,currency:u})=>{!a||!Number.isFinite(c)||c<=0||i.some(f=>String(f.id)===String(a))||i.push({id:a,time:c/1e3,color:"green",label:d.slice(0,1)||"N",tooltip:[d],...u?{imageUrl:`/images/symbols/${u}.svg`}:{},showLabelWhenImageLoaded:!0})})}catch{}if(this.type&&this.type=="news")try{const o=JSON.parse(localStorage.getItem("iccandle:current-news-event")||"{}"),{id:a,timestamp:c,event_name:d,currency:u,forecast:f,previous:m,actual:p}=o;if(!a||!Number.isFinite(c)||c<=0||i.some(h=>String(h.id)==="news:"+a))return;i.push({id:"news:"+a,time:c/1e3,color:"green",label:d.slice(0,1),tooltip:[d,`Current Forecast: ${f||"-"}`,`Previous Forecast: ${m||"-"}`,`Previous Actual: ${p||"-"}`],...u?{imageUrl:`https://cdn.iccandle.ai/web-assets/${u??"USD"}.svg`}:{}})}catch{}s(i)}}const z0=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,c=n.symbol.close;if(!Number.isFinite(r)||!s||s.length===0)return[i,o,a,c,Number.NaN,Number.NaN,Number.NaN];if(!s.some(m=>m.time===r))return[i,o,a,c,Number.NaN,Number.NaN,Number.NaN];const f=c<i?1:0;return[i,o,a,c,f,f,f]}}};return Promise.resolve([t])},na="An unknown error occurred",$s=e=>{if(typeof e=="string")return e;if(typeof e!="object"||e===null)return na;if(typeof e.message=="string")return e.message;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const n=$s(e[t]);if(n)return n}return na},W0=e=>{var t;if(th(e)){const n=(t=e.response)!=null&&t.data?$s(e.response.data):void 0;return n&&n!==na?n:$s(e)}return $s(e)},G0=({queryKey:e,queryFn:t,...n})=>kr({queryKey:e,queryFn:async r=>{var s;try{const i=r.queryKey[1];return await t(i)}catch(i){throw xe({variant:"destructive",title:"Error",description:W0(th(i)?(s=i.response)==null?void 0:s.data:i)}),null}},...n});var ve;(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})(ve||(ve={}));var ad;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(ad||(ad={}));const Y=ve.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),qt=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}},V=ve.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,c=0;for(;c<o.path.length;){const d=o.path[c];c===o.path.length-1?(a[d]=a[d]||{_errors:[]},a[d]._errors.push(n(o))):a[d]=a[d]||{_errors:[]},a=a[d],c++}}};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,ve.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 ra=(e,t)=>{let n;switch(e.code){case V.invalid_type:e.received===Y.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case V.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,ve.jsonStringifyReplacer)}`;break;case V.unrecognized_keys:n=`Unrecognized key(s) in object: ${ve.joinValues(e.keys,", ")}`;break;case V.invalid_union:n="Invalid input";break;case V.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${ve.joinValues(e.options)}`;break;case V.invalid_enum_value:n=`Invalid enum value. Expected ${ve.joinValues(e.options)}, received '${e.received}'`;break;case V.invalid_arguments:n="Invalid function arguments";break;case V.invalid_return_type:n="Invalid function return type";break;case V.invalid_date:n="Invalid date";break;case V.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}"`:ve.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case V.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 V.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 V.custom:n="Invalid input";break;case V.invalid_intersection_types:n="Intersection results could not be merged";break;case V.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case V.not_finite:n="Number must be finite";break;default:n=t.defaultError,ve.assertNever(e)}return{message:n}};let K0=ra;function q0(){return K0}const Z0=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 c=r.filter(d=>!!d).slice().reverse();for(const d of c)a=d(o,{data:t,defaultError:a}).message;return{...s,path:i,message:a}};function W(e,t){const n=q0(),r=Z0({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===ra?void 0:ra].filter(s=>!!s)});e.common.issues.push(r)}class rt{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 rt.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"}),Ir=e=>({status:"dirty",value:e}),at=e=>({status:"valid",value:e}),cd=e=>e.status==="aborted",ld=e=>e.status==="dirty",gr=e=>e.status==="valid",ai=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 dn{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 dd=(e,t)=>{if(gr(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 ue(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:c}=e;return o.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??r??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:c??n??a.defaultError}},description:s}}class be{get description(){return this._def.description}_getType(t){return qt(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:qt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new rt,ctx:{common:t.parent.common,data:t.data,parsedType:qt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(ai(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:qt(t)},s=this._parseSync({data:t,path:r.path,parent:r});return dd(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:qt(t)};if(!this["~standard"].async)try{const i=this._parseSync({data:t,path:[],parent:n});return gr(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=>gr(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:qt(t)},s=this._parse({data:t,path:r.path,parent:r}),i=await(ai(s)?s:Promise.resolve(s));return dd(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:V.custom,...r(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!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 vr({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 on.create(this,this._def)}nullable(){return wr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ot.create(this)}promise(){return ui.create(this,this._def)}or(t){return li.create([this,t],this._def)}and(t){return di.create(this,t,this._def)}transform(t){return new vr({...ue(this._def),schema:this,typeName:ce.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new oa({...ue(this._def),innerType:this,defaultValue:n,typeName:ce.ZodDefault})}brand(){return new bC({typeName:ce.ZodBranded,type:this,...ue(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new aa({...ue(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 pc.create(this,t)}readonly(){return ca.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Y0=/^c[^\s-]{8,}$/i,Q0=/^[0-9a-z]+$/,X0=/^[0-9A-HJKMNP-TV-Z]{26}$/i,J0=/^[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,eC=/^[a-z0-9_-]{21}$/i,tC=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,nC=/^[-+]?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)?)??$/,rC=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,sC="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let po;const iC=/^(?:(?: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])$/,oC=/^(?:(?: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])$/,aC=/^(([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]))$/,cC=/^(([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])$/,lC=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,dC=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,lp="((\\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])))",uC=new RegExp(`^${lp}$`);function dp(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 fC(e){return new RegExp(`^${dp(e)}$`)}function hC(e){let t=`${lp}T${dp(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 pC(e,t){return!!((t==="v4"||!t)&&iC.test(e)||(t==="v6"||!t)&&aC.test(e))}function mC(e,t){if(!tC.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 gC(e,t){return!!((t==="v4"||!t)&&oC.test(e)||(t==="v6"||!t)&&cC.test(e))}class nn extends be{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Y.string){const i=this._getOrReturnCtx(t);return W(i,{code:V.invalid_type,expected:Y.string,received:i.parsedType}),ae}const r=new rt;let s;for(const i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(s=this._getOrReturnCtx(t,s),W(s,{code:V.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),W(s,{code:V.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?W(s,{code:V.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&W(s,{code:V.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")rC.test(t.data)||(s=this._getOrReturnCtx(t,s),W(s,{validation:"email",code:V.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")po||(po=new RegExp(sC,"u")),po.test(t.data)||(s=this._getOrReturnCtx(t,s),W(s,{validation:"emoji",code:V.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")J0.test(t.data)||(s=this._getOrReturnCtx(t,s),W(s,{validation:"uuid",code:V.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")eC.test(t.data)||(s=this._getOrReturnCtx(t,s),W(s,{validation:"nanoid",code:V.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")Y0.test(t.data)||(s=this._getOrReturnCtx(t,s),W(s,{validation:"cuid",code:V.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")Q0.test(t.data)||(s=this._getOrReturnCtx(t,s),W(s,{validation:"cuid2",code:V.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")X0.test(t.data)||(s=this._getOrReturnCtx(t,s),W(s,{validation:"ulid",code:V.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{s=this._getOrReturnCtx(t,s),W(s,{validation:"url",code:V.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),W(s,{validation:"regex",code:V.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),W(s,{code:V.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),W(s,{code:V.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(s=this._getOrReturnCtx(t,s),W(s,{code:V.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?hC(i).test(t.data)||(s=this._getOrReturnCtx(t,s),W(s,{code:V.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?uC.test(t.data)||(s=this._getOrReturnCtx(t,s),W(s,{code:V.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?fC(i).test(t.data)||(s=this._getOrReturnCtx(t,s),W(s,{code:V.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?nC.test(t.data)||(s=this._getOrReturnCtx(t,s),W(s,{validation:"duration",code:V.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?pC(t.data,i.version)||(s=this._getOrReturnCtx(t,s),W(s,{validation:"ip",code:V.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?mC(t.data,i.alg)||(s=this._getOrReturnCtx(t,s),W(s,{validation:"jwt",code:V.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?gC(t.data,i.version)||(s=this._getOrReturnCtx(t,s),W(s,{validation:"cidr",code:V.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?lC.test(t.data)||(s=this._getOrReturnCtx(t,s),W(s,{validation:"base64",code:V.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?dC.test(t.data)||(s=this._getOrReturnCtx(t,s),W(s,{validation:"base64url",code:V.invalid_string,message:i.message}),r.dirty()):ve.assertNever(i);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(s=>t.test(s),{validation:n,code:V.invalid_string,...Q.errToObj(r)})}_addCheck(t){return new nn({...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 nn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new nn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new nn({...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}}nn.create=e=>new nn({checks:[],typeName:ce.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...ue(e)});function yC(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 yr extends be{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 W(i,{code:V.invalid_type,expected:Y.number,received:i.parsedType}),ae}let r;const s=new rt;for(const i of this._def.checks)i.kind==="int"?ve.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),W(r,{code:V.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),W(r,{code:V.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),W(r,{code:V.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?yC(t.data,i.value)!==0&&(r=this._getOrReturnCtx(t,r),W(r,{code:V.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),W(r,{code:V.not_finite,message:i.message}),s.dirty()):ve.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 yr({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Q.toString(s)}]})}_addCheck(t){return new yr({...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"&&ve.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)}}yr.create=e=>new yr({checks:[],typeName:ce.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...ue(e)});class Kr extends be{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 rt;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),W(r,{code:V.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),W(r,{code:V.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),W(r,{code:V.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):ve.assertNever(i);return{status:s.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return W(n,{code:V.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 Kr({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Q.toString(s)}]})}_addCheck(t){return new Kr({...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}}Kr.create=e=>new Kr({checks:[],typeName:ce.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...ue(e)});class sa extends be{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Y.boolean){const r=this._getOrReturnCtx(t);return W(r,{code:V.invalid_type,expected:Y.boolean,received:r.parsedType}),ae}return at(t.data)}}sa.create=e=>new sa({typeName:ce.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...ue(e)});class ci extends be{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Y.date){const i=this._getOrReturnCtx(t);return W(i,{code:V.invalid_type,expected:Y.date,received:i.parsedType}),ae}if(Number.isNaN(t.data.getTime())){const i=this._getOrReturnCtx(t);return W(i,{code:V.invalid_date}),ae}const r=new rt;let s;for(const i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(s=this._getOrReturnCtx(t,s),W(s,{code:V.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),W(s,{code:V.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):ve.assertNever(i);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new ci({...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}}ci.create=e=>new ci({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:ce.ZodDate,...ue(e)});class ud extends be{_parse(t){if(this._getType(t)!==Y.symbol){const r=this._getOrReturnCtx(t);return W(r,{code:V.invalid_type,expected:Y.symbol,received:r.parsedType}),ae}return at(t.data)}}ud.create=e=>new ud({typeName:ce.ZodSymbol,...ue(e)});class fd extends be{_parse(t){if(this._getType(t)!==Y.undefined){const r=this._getOrReturnCtx(t);return W(r,{code:V.invalid_type,expected:Y.undefined,received:r.parsedType}),ae}return at(t.data)}}fd.create=e=>new fd({typeName:ce.ZodUndefined,...ue(e)});class hd extends be{_parse(t){if(this._getType(t)!==Y.null){const r=this._getOrReturnCtx(t);return W(r,{code:V.invalid_type,expected:Y.null,received:r.parsedType}),ae}return at(t.data)}}hd.create=e=>new hd({typeName:ce.ZodNull,...ue(e)});class pd extends be{constructor(){super(...arguments),this._any=!0}_parse(t){return at(t.data)}}pd.create=e=>new pd({typeName:ce.ZodAny,...ue(e)});class md extends be{constructor(){super(...arguments),this._unknown=!0}_parse(t){return at(t.data)}}md.create=e=>new md({typeName:ce.ZodUnknown,...ue(e)});class un extends be{_parse(t){const n=this._getOrReturnCtx(t);return W(n,{code:V.invalid_type,expected:Y.never,received:n.parsedType}),ae}}un.create=e=>new un({typeName:ce.ZodNever,...ue(e)});class gd extends be{_parse(t){if(this._getType(t)!==Y.undefined){const r=this._getOrReturnCtx(t);return W(r,{code:V.invalid_type,expected:Y.void,received:r.parsedType}),ae}return at(t.data)}}gd.create=e=>new gd({typeName:ce.ZodVoid,...ue(e)});class Ot extends be{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),s=this._def;if(n.parsedType!==Y.array)return W(n,{code:V.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)&&(W(n,{code:o?V.too_big:V.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&&(W(n,{code:V.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&&(W(n,{code:V.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 dn(n,o,n.path,a)))).then(o=>rt.mergeArray(r,o));const i=[...n.data].map((o,a)=>s.type._parseSync(new dn(n,o,n.path,a)));return rt.mergeArray(r,i)}get element(){return this._def.type}min(t,n){return new Ot({...this._def,minLength:{value:t,message:Q.toString(n)}})}max(t,n){return new Ot({...this._def,maxLength:{value:t,message:Q.toString(n)}})}length(t,n){return new Ot({...this._def,exactLength:{value:t,message:Q.toString(n)}})}nonempty(t){return this.min(1,t)}}Ot.create=(e,t)=>new Ot({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ce.ZodArray,...ue(t)});function qn(e){if(e instanceof Le){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=on.create(qn(r))}return new Le({...e._def,shape:()=>t})}else return e instanceof Ot?new Ot({...e._def,type:qn(e.element)}):e instanceof on?on.create(qn(e.unwrap())):e instanceof wr?wr.create(qn(e.unwrap())):e instanceof Un?Un.create(e.items.map(t=>qn(t))):e}class Le extends be{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=ve.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 W(d,{code:V.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 un&&this._def.unknownKeys==="strip"))for(const d in s.data)o.includes(d)||a.push(d);const c=[];for(const d of o){const u=i[d],f=s.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new dn(s,f,s.path,d)),alwaysSet:d in s.data})}if(this._def.catchall instanceof un){const d=this._def.unknownKeys;if(d==="passthrough")for(const u of a)c.push({key:{status:"valid",value:u},value:{status:"valid",value:s.data[u]}});else if(d==="strict")a.length>0&&(W(s,{code:V.unrecognized_keys,keys:a}),r.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const d=this._def.catchall;for(const u of a){const f=s.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new dn(s,f,s.path,u)),alwaysSet:u in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const d=[];for(const u of c){const f=await u.key,m=await u.value;d.push({key:f,value:m,alwaysSet:u.alwaysSet})}return d}).then(d=>rt.mergeObjectSync(r,d)):rt.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(t){return Q.errToObj,new Le({...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 Le({...this._def,unknownKeys:"strip"})}passthrough(){return new Le({...this._def,unknownKeys:"passthrough"})}extend(t){return new Le({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Le({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 Le({...this._def,catchall:t})}pick(t){const n={};for(const r of ve.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new Le({...this._def,shape:()=>n})}omit(t){const n={};for(const r of ve.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new Le({...this._def,shape:()=>n})}deepPartial(){return qn(this)}partial(t){const n={};for(const r of ve.objectKeys(this.shape)){const s=this.shape[r];t&&!t[r]?n[r]=s:n[r]=s.optional()}return new Le({...this._def,shape:()=>n})}required(t){const n={};for(const r of ve.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof on;)i=i._def.innerType;n[r]=i}return new Le({...this._def,shape:()=>n})}keyof(){return up(ve.objectKeys(this.shape))}}Le.create=(e,t)=>new Le({shape:()=>e,unknownKeys:"strip",catchall:un.create(),typeName:ce.ZodObject,...ue(t)});Le.strictCreate=(e,t)=>new Le({shape:()=>e,unknownKeys:"strict",catchall:un.create(),typeName:ce.ZodObject,...ue(t)});Le.lazycreate=(e,t)=>new Le({shape:e,unknownKeys:"strip",catchall:un.create(),typeName:ce.ZodObject,...ue(t)});class li extends be{_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 W(n,{code:V.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 c of r){const d={...n,common:{...n.common,issues:[]},parent:null},u=c._parseSync({data:n.data,path:n.path,parent:d});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,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(c=>new Ut(c));return W(n,{code:V.invalid_union,unionErrors:a}),ae}}get options(){return this._def.options}}li.create=(e,t)=>new li({options:e,typeName:ce.ZodUnion,...ue(t)});function ia(e,t){const n=qt(e),r=qt(t);if(e===t)return{valid:!0,data:e};if(n===Y.object&&r===Y.object){const s=ve.objectKeys(t),i=ve.objectKeys(e).filter(a=>s.indexOf(a)!==-1),o={...e,...t};for(const a of i){const c=ia(e[a],t[a]);if(!c.valid)return{valid:!1};o[a]=c.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],c=ia(o,a);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return n===Y.date&&r===Y.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class di extends be{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),s=(i,o)=>{if(cd(i)||cd(o))return ae;const a=ia(i.value,o.value);return a.valid?((ld(i)||ld(o))&&n.dirty(),{status:n.value,value:a.data}):(W(r,{code:V.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}))}}di.create=(e,t,n)=>new di({left:e,right:t,typeName:ce.ZodIntersection,...ue(n)});class Un extends be{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Y.array)return W(r,{code:V.invalid_type,expected:Y.array,received:r.parsedType}),ae;if(r.data.length<this._def.items.length)return W(r,{code:V.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ae;!this._def.rest&&r.data.length>this._def.items.length&&(W(r,{code:V.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...r.data].map((o,a)=>{const c=this._def.items[a]||this._def.rest;return c?c._parse(new dn(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(i).then(o=>rt.mergeArray(n,o)):rt.mergeArray(n,i)}get items(){return this._def.items}rest(t){return new Un({...this._def,rest:t})}}Un.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Un({items:e,typeName:ce.ZodTuple,rest:null,...ue(t)})};class yd extends be{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 W(r,{code:V.invalid_type,expected:Y.map,received:r.parsedType}),ae;const s=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([a,c],d)=>({key:s._parse(new dn(r,a,r.path,[d,"key"])),value:i._parse(new dn(r,c,r.path,[d,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const c of o){const d=await c.key,u=await c.value;if(d.status==="aborted"||u.status==="aborted")return ae;(d.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(d.value,u.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const c of o){const d=c.key,u=c.value;if(d.status==="aborted"||u.status==="aborted")return ae;(d.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(d.value,u.value)}return{status:n.value,value:a}}}}yd.create=(e,t,n)=>new yd({valueType:t,keyType:e,typeName:ce.ZodMap,...ue(n)});class qr extends be{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Y.set)return W(r,{code:V.invalid_type,expected:Y.set,received:r.parsedType}),ae;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(W(r,{code:V.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&&(W(r,{code:V.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(c){const d=new Set;for(const u of c){if(u.status==="aborted")return ae;u.status==="dirty"&&n.dirty(),d.add(u.value)}return{status:n.value,value:d}}const a=[...r.data.values()].map((c,d)=>i._parse(new dn(r,c,r.path,d)));return r.common.async?Promise.all(a).then(c=>o(c)):o(a)}min(t,n){return new qr({...this._def,minSize:{value:t,message:Q.toString(n)}})}max(t,n){return new qr({...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)}}qr.create=(e,t)=>new qr({valueType:e,minSize:null,maxSize:null,typeName:ce.ZodSet,...ue(t)});class bd extends be{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})}}bd.create=(e,t)=>new bd({getter:e,typeName:ce.ZodLazy,...ue(t)});class vd extends be{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return W(n,{received:n.data,code:V.invalid_literal,expected:this._def.value}),ae}return{status:"valid",value:t.data}}get value(){return this._def.value}}vd.create=(e,t)=>new vd({value:e,typeName:ce.ZodLiteral,...ue(t)});function up(e,t){return new br({values:e,typeName:ce.ZodEnum,...ue(t)})}class br extends be{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return W(n,{expected:ve.joinValues(r),received:n.parsedType,code:V.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 W(n,{received:n.data,code:V.invalid_enum_value,options:r}),ae}return at(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 br.create(t,{...this._def,...n})}exclude(t,n=this._def){return br.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}br.create=up;class wd extends be{_parse(t){const n=ve.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==Y.string&&r.parsedType!==Y.number){const s=ve.objectValues(n);return W(r,{expected:ve.joinValues(s),received:r.parsedType,code:V.invalid_type}),ae}if(this._cache||(this._cache=new Set(ve.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const s=ve.objectValues(n);return W(r,{received:r.data,code:V.invalid_enum_value,options:s}),ae}return at(t.data)}get enum(){return this._def.values}}wd.create=(e,t)=>new wd({values:e,typeName:ce.ZodNativeEnum,...ue(t)});class ui extends be{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Y.promise&&n.common.async===!1)return W(n,{code:V.invalid_type,expected:Y.promise,received:n.parsedType}),ae;const r=n.parsedType===Y.promise?n.data:Promise.resolve(n.data);return at(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}ui.create=(e,t)=>new ui({type:e,typeName:ce.ZodPromise,...ue(t)});class vr extends be{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=>{W(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 c=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return c.status==="aborted"?ae:c.status==="dirty"||n.value==="dirty"?Ir(c.value):c});{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"?Ir(a.value):a}}if(s.type==="refinement"){const o=a=>{const c=s.refinement(a,i);if(r.common.async)return Promise.resolve(c);if(c 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(!gr(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=>gr(o)?Promise.resolve(s.transform(o.value,i)).then(a=>({status:n.value,value:a})):ae);ve.assertNever(s)}}vr.create=(e,t,n)=>new vr({schema:e,typeName:ce.ZodEffects,effect:t,...ue(n)});vr.createWithPreprocess=(e,t,n)=>new vr({schema:t,effect:{type:"preprocess",transform:e},typeName:ce.ZodEffects,...ue(n)});class on extends be{_parse(t){return this._getType(t)===Y.undefined?at(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}on.create=(e,t)=>new on({innerType:e,typeName:ce.ZodOptional,...ue(t)});class wr extends be{_parse(t){return this._getType(t)===Y.null?at(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}wr.create=(e,t)=>new wr({innerType:e,typeName:ce.ZodNullable,...ue(t)});class oa extends be{_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}}oa.create=(e,t)=>new oa({innerType:e,typeName:ce.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...ue(t)});class aa extends be{_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 ai(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}}aa.create=(e,t)=>new aa({innerType:e,typeName:ce.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...ue(t)});class _d extends be{_parse(t){if(this._getType(t)!==Y.nan){const r=this._getOrReturnCtx(t);return W(r,{code:V.invalid_type,expected:Y.nan,received:r.parsedType}),ae}return{status:"valid",value:t.data}}}_d.create=e=>new _d({typeName:ce.ZodNaN,...ue(e)});class bC extends be{_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 pc extends be{_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(),Ir(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 pc({in:t,out:n,typeName:ce.ZodPipeline})}}class ca extends be{_parse(t){const n=this._def.innerType._parse(t),r=s=>(gr(s)&&(s.value=Object.freeze(s.value)),s);return ai(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}}ca.create=(e,t)=>new ca({innerType:e,typeName:ce.ZodReadonly,...ue(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 mo=nn.create,Os=yr.create,vC=sa.create;un.create;Ot.create;const wC=Le.create;li.create;di.create;Un.create;br.create;ui.create;on.create;wr.create;const _C="https://api.opheleo.com",xC="Bearer ",SC="Authorization";wC({id:mo(),userId:mo(),createdAt:Os(),updatedAt:Os(),active:vC(),perDayUsage:Os(),userEmail:mo().email(),maxPerDayUsage:Os()});async function CC(e,t,n){const r=typeof window<"u"?localStorage.getItem("session_token"):null;return(await ke({baseURL:In(n??_C),url:e,method:t,headers:r?{[SC]:`${xC}${r}`}:void 0})).data}async function EC(e){return CC("/iccandle/v1/iccandle-user-usage/me","get",e)}const TC=e=>{const t=e==null?void 0:e.platformApiBase;return G0({queryKey:["iccandle-user-usage",t],queryFn:()=>EC(t),...e})},PC=S.createContext(null);function kC(){const e=S.useContext(PC);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function OC({controlsRef:e,onSymbolTickerChange:t,onScanResultUrlChange:n,onChartWidgetChange:r,onChartContainerChange:s,selectSymbolTickerRef:i,headerSlot:o}){const{resolvedTheme:a}=kC(),c=Nt(),d=cs(),u=S.useRef([]),f=S.useRef(null),m=S.useRef(a),p=S.useRef(null),g=S.useRef(null),h=S.useMemo(()=>oi(d),[d]),y=S.useRef(h),b=S.useRef("60"),{setGapCount:v,setReplayMode:x}=ap();S.useEffect(()=>{v(0),x(!1)},[v,x]),S.useEffect(()=>{Bs()&&T(!0)},[]);const[_,C]=S.useState(null),[k,T]=S.useState(!1),[A,N]=S.useState(null),O=S.useCallback(D=>{if(D===y.current)return;const U=d.find(M=>M.ticker===D);if(!U)return;y.current=D,localStorage.setItem(Ur,D),t(D);const K=f.current;if(K)try{K.onChartReady(()=>{K.activeChart().setSymbol(U.ticker)})}catch{}},[t,d]);S.useEffect(()=>(i.current=O,()=>{i.current=null}),[O,i]);const L=S.useRef([]),R=S.useMemo(()=>new H0(L,"selector",d,c.tickWebSocketUrl),[c.tickWebSocketUrl,d]),{data:$,isLoading:j}=TC({enabled:!0,platformApiBase:c.platformApiBase}),H=!j&&$?$.perDayUsage>=$.maxPerDayUsage:!1;S.useEffect(()=>{s(_)},[_,s]),S.useEffect(()=>{r(A)},[A,r]),S.useEffect(()=>{if(!k||!_)return;if(f.current){N(null),r(null);try{f.current.remove()}catch{}f.current=null}const D=oi(d);y.current=D,b.current="60";const U=op();if(!U)return;const K=new U({container:_,library_path:"/charting_library/",datafeed:R,symbol:D,interval:"60",autosize:!0,theme:m.current,disabled_features:["symbol_info","legend_inplace_edit","header_quick_search","header_compare"],enabled_features:["header_chart_type","show_symbol_logos","show_symbol_logo_in_legend"],custom_indicators_getter:()=>z0(u),drawings_access:{type:"black",tools:[{name:"Date Range"}]},locale:"en",timezone:Mp(),overrides:{priceScaleSelectionStrategyName:"right","scalesProperties.showSeriesLastValue":!0}});let M=!1;return f.current=K,K.onChartReady(()=>{M||f.current!==K||N(K)}),()=>{if(M=!0,N(null),r(null),f.current){try{f.current.remove()}catch{}f.current=null}}},[_,R,r,k]),S.useEffect(()=>{if(!A)return;let D=!1;try{A.onChartReady(()=>{D||(async()=>{try{const U=A.activeChart(),K=await U.createStudy("Generated Candles - By iC Candle",!0,!0);if(D||(K&&U.bringToFront([K]),await A.headerReady(),D)||(await new Promise(Z=>{setTimeout(()=>{if(!D)try{U.clearMarks(2)}catch{}Z(!0)},150)}),D))return;localStorage.setItem("tv:selected-news-events","[]"),U.refreshMarks();const M=Z=>{const fe=U.symbol(),de=ip(fe,d,h);de!==y.current&&(n(null),u.current=[]);try{A.resetCache()}catch{}y.current=de,localStorage.setItem(Ur,de),t(de)},le=Z=>{Z!==b.current&&(n(null),u.current=[]);try{A.resetCache()}catch{}b.current=Z};p.current=M,g.current=le,U.onSymbolChanged().subscribe(null,M),U.onIntervalChanged().subscribe(null,le)}catch{}})()})}catch{}return()=>{D=!0,p.current=null,g.current=null}},[A,e,n,t,h,d]),S.useEffect(()=>{if(!A||!a)return;let D=!1;try{A.onChartReady(()=>{D||A.changeTheme(a).catch(()=>{})})}catch{}return()=>{D=!0}},[A,a]);const F=S.useCallback(()=>{T(!0)},[]),I=H?l.jsx("div",{className:"web-trading-widget-advanced__scan-limit-wrap",children:l.jsxs(D0,{variant:"destructive",className:"web-trading-widget-advanced__scan-limit-badge",children:[l.jsx("span",{className:"web-trading-widget-advanced__scan-limit-badge-title",children:"Daily scan limit reached"}),$&&l.jsxs("span",{className:"web-trading-widget-advanced__scan-limit-badge-count",children:[$.perDayUsage," of ",$.maxPerDayUsage," scans used today"]})]})}):null;return l.jsxs(l.Fragment,{children:[o??I,l.jsx(L0,{onLoad:F}),l.jsx("div",{ref:C,className:"web-trading-widget-advanced__container"})]})}const fp=S.createContext(null);function xd({value:e,children:t}){return l.jsx(fp.Provider,{value:e,children:t})}function AC(){const e=S.useContext(fp);if(!e)throw new Error("useWidgetChartSlot must be used within WidgetChartSlotProvider");return e}function As(e,t){return e.toFixed(t)}function NC({symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:s,minVolumeLots:i,isSubmitting:o,isAccountsLoading:a,selectedLogin:c,isDragging:d,isCollapsed:u,onToggleCollapsed:f,onDragHandlePointerDown:m,onPlaceOrder:p}){const[g,h]=S.useState(!0),y=u??g,b=()=>{f==null||f(),u===void 0&&h(F=>!F)},v=ie(F=>F.setOrderSide),x=ie(F=>F.setVolumeLots),_=ie(F=>F.volumeLots),[C,k]=S.useState(String(_||r));S.useEffect(()=>{y||k(As(_,2))},[y,_]);const T=Number(Bt($t(e))),A=t!==null?Ce(t,T):"—",N=n!==null?Ce(n,T):"—",L=!o&&!a&&c!==""&&(t!==null&&n!==null),R=F=>{const I=Number(C),D=Number.isFinite(I)&&I>0?I:r,U=Math.max(i,D+F*s),K=As(U,2);k(K),x(U)},$=()=>{const F=Number(C);if(!Number.isFinite(F)||F<=0){k(As(r,2)),x(r);return}const I=Math.max(i,F),D=As(I,2);k(D),x(I)},j=F=>{t===null||n===null||v({side:F,entryPrice:F==="buy"?n:t})},H=F=>{if(t===null||n===null||!c)return;const I=Number(C),D=Math.max(i,Number.isFinite(I)&&I>0?I:r);v({side:F,entryPrice:F==="buy"?n:t}),p({login:c,side:F,volumeLots:D,bid:t,ask:n})};return l.jsx("div",{className:"web-trading-widget-mini-order web-trading-widget-mini-order--expanded",children:l.jsxs("div",{className:"web-trading-widget-mini-order__row",children:[l.jsx("button",{type:"button","aria-label":"Move quick order panel",onPointerDown:m,className:`web-trading-widget-mini-order__drag-handle${d?" web-trading-widget-mini-order__drag-handle--grabbing":""}`,children:l.jsx(gf,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2})}),l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button",disabled:!L,className:"web-trading-widget-mini-order__side-btn web-trading-widget-mini-order__side-btn--sell",onMouseDown:()=>j("sell"),onClick:()=>H("sell"),children:[l.jsx("span",{className:"web-trading-widget-mini-order__price",children:A}),l.jsx("span",{className:"web-trading-widget-mini-order__label web-trading-widget-mini-order__label--sell",children:"SELL"})]}),l.jsxs("div",{className:"web-trading-widget-mini-order__volume",children:[l.jsx("button",{type:"button","aria-label":"Decrease volume",disabled:!L,className:"web-trading-widget-mini-order__volume-btn",onClick:()=>R(-1),children:l.jsx(Ys,{className:"web-trading-widget-icon web-trading-widget-icon--xs",strokeWidth:2.5})}),l.jsx("input",{type:"text",inputMode:"decimal",value:C,disabled:!L,onChange:F=>k(F.target.value),onBlur:$,className:"web-trading-widget-mini-order__volume-input"}),l.jsx("button",{type:"button","aria-label":"Increase volume",disabled:!L,className:"web-trading-widget-mini-order__volume-btn",onClick:()=>R(1),children:l.jsx(Po,{className:"web-trading-widget-icon web-trading-widget-icon--xs",strokeWidth:2.5})})]}),l.jsxs("button",{type:"button",disabled:!L,className:"web-trading-widget-mini-order__side-btn web-trading-widget-mini-order__side-btn--buy",onMouseDown:()=>j("buy"),onClick:()=>H("buy"),children:[l.jsx("span",{className:"web-trading-widget-mini-order__label web-trading-widget-mini-order__label--buy",children:"BUY"}),l.jsx("span",{className:"web-trading-widget-mini-order__price",children:N})]})]}),l.jsx("button",{type:"button","aria-label":y?"Expand quick order panel":"Collapse quick order panel","aria-expanded":!y,className:"web-trading-widget-mini-order__toggle",onClick:b,children:y?l.jsx(Ys,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2.5}):l.jsx(Po,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2.5})})]})})}function Lr({title:e,isOpen:t,onToggle:n,children:r}){return l.jsxs("div",{className:"web-trading-widget-market-panel__accordion-item",children:[l.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,l.jsx(Ys,{className:"web-trading-widget-icon web-trading-widget-icon--md web-trading-widget-text-muted"})]}),t?l.jsx("div",{className:"web-trading-widget-market-panel__accordion-content",children:r}):null]})}const RC=new Set(["volume-setting","risk-management"]);function DC({symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:s,minVolumeLots:i,isSubmitting:o,isAccountsLoading:a,selectedLogin:c,isDragging:d,onDragHandlePointerDown:u,onLayoutChange:f,onClose:m,onPlaceOrder:p}){const[g,h]=S.useState(!0),[y,b]=S.useState("market"),v=ie(J=>J.volumeLots),[x,_]=S.useState(String(v||r)),[C,k]=S.useState(""),[T,A]=S.useState(""),N=ie(J=>J.stopLoss),O=ie(J=>J.takeProfit),L=ie(J=>J.setStopLoss),R=ie(J=>J.setTakeProfit),$=ie(J=>J.setVolumeLots),j=ie(J=>J.setOrderSide),[H,F]=S.useState(""),[I,D]=S.useState(ft.GTC),[U,K]=S.useState(""),[M,le]=S.useState(""),[Z,fe]=S.useState(()=>new Set(RC));S.useEffect(()=>{f()},[g,f]);const de=Number(Bt($t(e))),ee=Er(de),q=_f(t,n),B=t!==null?Ce(t,de):"—",me=n!==null?Ce(n,de):"—",oe=Ei(y),se=bf(y),te=Ci(y),je=te.label,Ne=!oe&&te.orderType!==null&&te.orderType%2===1,Oe=S.useMemo(()=>q!==null?q:t??n,[n,t,q]),X=J=>{fe(Xe=>{const Vt=new Set(Xe);return Vt.has(J)?Vt.delete(J):Vt.add(J),Vt})},Te=J=>{_(J);const Xe=Number(J);Number.isFinite(Xe)&&Xe>0&&$(Xe)},Ue=J=>t===null||n===null?null:oe?J==="buy"?n:t:ht(C)??(J==="buy"?n:t),Qe=J=>{const Xe=Ue(J);Xe!==null&&j({side:J,entryPrice:Xe})},ct=J=>{if(t===null||n===null||!c)return;const Xe=Math.max(i,Number(x)||i),Vt=ko(y,J),Or=Ue(J);Or!==null&&j({side:J,entryPrice:Or}),p({login:c,executionMode:y,side:J,orderType:Vt,volumeLots:Xe,stopLoss:N,takeProfit:O,priceOrder:C,priceTrigger:T,comment:H,typeTime:I,expirationDateTime:U,expirationDay:M,bid:t,ask:n})},re=t!==null&&n!==null,$e=oe||ht(C)!==void 0,Fi=!se||ht(T)!==void 0,ls=oe||Pi(I,U,M),bp=!o&&!a&&c!==""&&re&&$e&&Fi&&ls,vp=!oe&&Wa(I),wp=!oe&&Ga(I),gc=()=>te.orderType!==null&&te.orderType%2===1?"sell":"buy";return l.jsxs("div",{className:`web-trading-widget-market-panel web-trading-widget-market-panel--modal${g?" web-trading-widget-market-panel--collapsed":""}`,children:[l.jsx(NC,{symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:s,minVolumeLots:i,isSubmitting:o,isAccountsLoading:a,selectedLogin:c,isDragging:d,isCollapsed:g,onToggleCollapsed:()=>h(J=>!J),onDragHandlePointerDown:u,onPlaceOrder:({login:J,side:Xe,volumeLots:Vt,bid:Or,ask:yc})=>{Or===null||yc===null||p({login:J,executionMode:"market",side:Xe,orderType:ko("market",Xe),volumeLots:Vt,stopLoss:N,takeProfit:O,priceOrder:"",priceTrigger:"",comment:H,typeTime:I,expirationDateTime:"",expirationDay:"",bid:Or,ask:yc})}}),g?null:l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"web-trading-widget-market-panel__header",children:l.jsxs(qs,{value:y,onValueChange:J=>b(J),children:[l.jsx(Br,{className:"web-trading-widget-market-panel__select-trigger","aria-label":"Order execution type",children:l.jsx(Zs,{})}),l.jsx($r,{children:Qs.map(J=>l.jsx(Vr,{value:J.mode,children:J.label},J.mode))})]})}),l.jsxs("div",{className:"web-trading-widget-market-panel__accordion",children:[l.jsx(Lr,{id:"volume-setting",title:"Volume Setting",isOpen:Z.has("volume-setting"),onToggle:()=>X("volume-setting"),children:l.jsx(Re,{label:"Lots",value:x,onChange:Te,step:s,min:i,decimals:2})}),oe?null:l.jsx(Lr,{id:"order-price",title:"Order Price",isOpen:Z.has("order-price"),onToggle:()=>X("order-price"),children:se?l.jsxs(l.Fragment,{children:[l.jsx(Re,{label:"Stop Price",value:T,onChange:A,step:ee,decimals:de,basePrice:Oe,placeholder:q!==null?Ce(q,de):"—"}),l.jsx(Re,{label:"Limit Price",value:C,onChange:k,step:ee,decimals:de,basePrice:Oe,placeholder:q!==null?Ce(q,de):"—"})]}):l.jsx(Re,{label:"Price",value:C,onChange:k,step:ee,decimals:de,basePrice:Oe,placeholder:q!==null?Ce(q,de):"—"})}),l.jsx(Lr,{id:"risk-management",title:"Risk Management",isOpen:Z.has("risk-management"),onToggle:()=>X("risk-management"),children:l.jsxs("div",{className:"web-trading-widget-market-panel__grid-2",children:[l.jsx(Re,{label:"Stop Loss",value:N,onChange:L,step:ee,decimals:de,basePrice:t,placeholder:t!==null?B:"—",clearable:!0}),l.jsx(Re,{label:"Take Profit",value:O,onChange:R,step:ee,decimals:de,basePrice:n,placeholder:n!==null?me:"—",clearable:!0})]})}),oe?null:l.jsxs(Lr,{id:"expiration",title:"Expiration",isOpen:Z.has("expiration"),onToggle:()=>X("expiration"),children:[l.jsx("select",{value:String(I),className:"web-trading-widget-market-panel__select-full","aria-label":"Order expiration type",onChange:J=>D(Number(J.target.value)),children:vf.map(J=>l.jsx("option",{value:String(J.value),children:J.label},J.value))}),vp?l.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[l.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Expiration time"}),l.jsx("input",{type:"datetime-local",value:U,className:"web-trading-widget-market-panel__input",onChange:J=>K(J.target.value)})]}):null,wp?l.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[l.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Expiration day"}),l.jsx("input",{type:"date",value:M,className:"web-trading-widget-market-panel__input",onChange:J=>le(J.target.value)})]}):null]}),l.jsx(Lr,{id:"comment",title:"Comment",isOpen:Z.has("comment"),onToggle:()=>X("comment"),children:l.jsx("input",{type:"text",value:H,className:"web-trading-widget-market-panel__input",placeholder:"",onChange:J=>F(J.target.value)})})]}),l.jsx("div",{className:"web-trading-widget-market-panel__footer",children:l.jsxs("div",{className:"web-trading-widget-market-panel__quotes",children:[l.jsx("span",{children:B}),l.jsx("span",{className:"web-trading-widget-market-panel__quotes-ask",children:me})]})}),!oe&&l.jsxs("button",{type:"button",className:`web-trading-widget-market-panel__place-btn${Ne?" web-trading-widget-market-panel__place-btn--sell":" web-trading-widget-market-panel__place-btn--buy"}`,disabled:!bp,onMouseDown:()=>Qe(gc()),onClick:()=>ct(gc()),children:["Place ",je]})]})]})}function LC({symbolTicker:e,chartWidget:t,orderState:n}){const r=cs(),s=nc(e),{panel:i,confirmation:o,isSubmitting:a,defaultVolumeLots:c,volumeStep:d,minVolumeLots:u,selectedLogin:f,isAccountsLoading:m,hasConfirmedAccount:p,closePanels:g,dismissConfirmation:h,placeMarketOrder:y}=n,b=ye(M=>M.positions),v=ye(M=>M.orders),x=ye(M=>M.selectedPositionTicket),_=ye(M=>M.selectedOrderTicket),C=ye(M=>M.setSelectedPositionTicket),k=ye(M=>M.setSelectedOrderTicket),T=x!==null?b.find(M=>M.ticket===x)??null:null,A=_!==null?v.find(M=>M.ticket===_)??null:null,N=p&&i==="confirmation"&&o!==null,O=p&&i!=="confirmation"&&i!=="closed"&&T===null&&A===null,{panelRef:L,position:R,isDragging:$,onDragStart:j,reclamp:H}=Tf({storageKey:"web-trading-widget-modal-exec-panel-position",defaultAlign:"top-right",isActive:O}),F=ie(M=>M.setDraft),I=ie(M=>M.clearDraft),D=Number(Bt($t(e))),U=Er(D);S.useEffect(()=>{p&&F({source:"new-order",entryPrice:null,side:null,showEntryLine:!1,volumeLots:c,digits:D,priceStep:U})},[c,D,p,U,F]),S.useEffect(()=>{(i==="closed"||i==="confirmation")&&I()},[I,i]);const K=T!==null||A!==null;return!p&&!K?null:l.jsxs("div",{className:"web-trading-widget-new-order-overlay-layer",children:[l.jsx(hh,{chartWidget:t,symbolTicker:e,symbols:r}),K&&T!==null?l.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:l.jsx(sp,{position:T,onClose:()=>C(null)})}):null,K&&A!==null?l.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:l.jsx(rp,{order:A,onClose:()=>k(null)})}):null,N&&o!==null?l.jsx("div",{className:"web-trading-widget-new-order-overlay web-trading-widget-new-order-overlay--news",children:l.jsx(np,{confirmation:o,symbolTicker:e,onDismiss:h})}):null,O?l.jsx("div",{ref:L,style:{left:R.x,top:R.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${$?" web-trading-widget-new-order-overlay--dragging":""}`,children:l.jsx(DC,{symbolTicker:e,bid:(s==null?void 0:s.bid)??null,ask:(s==null?void 0:s.ask)??null,defaultVolumeLots:c,volumeStep:d,minVolumeLots:u,isSubmitting:a,isAccountsLoading:m,selectedLogin:f,isDragging:$,onDragHandlePointerDown:j,onLayoutChange:H,onClose:g,onPlaceOrder:M=>void y({symbolTicker:e,login:M.login,executionMode:M.executionMode,side:M.side,orderType:M.orderType,volumeLots:M.volumeLots,stopLoss:M.stopLoss,takeProfit:M.takeProfit,priceOrder:M.priceOrder,priceTrigger:M.priceTrigger,comment:M.comment,typeTime:M.typeTime,expirationDateTime:M.expirationDateTime,expirationDay:M.expirationDay,bid:M.bid,ask:M.ask})})}):null]})}const jC=`<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>`,lh=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" aria-hidden="true">
85
+ </svg>`,hp=`<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>`,aC=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" aria-hidden="true">
88
+ </svg>`,MC=`<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>`,dh="data-opheleo-account-dropdown";function cC(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 uh(e){const[t]=e.label.split(" · ");return t??e.label}function lC(e){return`My Account — ${e.label} — ${e.balance.toFixed(2)} ${e.currency}`}function dC(e,t){const n=uh(e),r=`${e.balance.toFixed(2)} ${e.currency}`;return`${e.login} · ${n} (${r})${t?" · Active":""}`}function hc(e){return e.accountOptions.length===0?null:e.accountOptions.find(t=>t.login===e.selectedLogin)??e.accountOptions[0]}function fh(e){return e.isAccountsLoading||e.isAccountDataLoading}function ph(e){if(e.isAccountsLoading)return"My Account";if(e.isAccountDataLoading)return"My Account · Switching…";if(e.accountOptions.length===0)return"My Account · None";const t=hc(e);if(!t)return"My Account";const n=uh(t);return`My Account · ${t.login} · ${n}`}function uC(e){return fh(e)?lh:oC}function fC(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:dC(n,r),icon:r?aC:void 0,onSelect:()=>{r||t(n.login)}}})}function pC(e,t){var s,i;const n=e.querySelector(`[${dh}="true"]`);if(n instanceof HTMLElement)return n;const r=e.querySelectorAll('button, [role="button"], div');for(const o of r){if(!(o instanceof HTMLElement))continue;const a=((s=o.textContent)==null?void 0:s.trim())??"";if(!a.includes("My Account")&&a!==t)continue;let c=o;for(;c&&c!==e;){const d=((i=c.textContent)==null?void 0:i.trim())??"";if(c.tagName==="BUTTON"||c.getAttribute("role")==="button"||d.includes("My Account")&&c.querySelector("svg"))return c;c=c.parentElement}}return null}function hC(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 mC(e,t){e.setAttribute(dh,"true"),cC(e);const n=hc(t);if(!fh(t)&&n!==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}hC(e),e.style.border="1px solid transparent",e.style.borderRadius="6px",e.style.padding="0 10px"}function gC(e,t){if(!(e!=null&&e.isConnected))return;const n=ph(t),r=()=>{const s=pC(e,n);s&&mC(s,t)};r(),requestAnimationFrame(r)}async function yC(e,t=()=>!0){try{await e.headerReady()}catch{return null}if(!t())return null;try{return await e.createDropdown({title:"My Account",tooltip:"Select your trading account",align:"left",icon:lh,items:[{title:"Loading accounts…",onSelect:()=>{}}]})}catch{return null}}function wd(e,t,n,r){if(!e||(r==null?void 0:r.isConnected)===!1)return;const s=hc(t);try{e.applyOptions({title:ph(t),tooltip:s?lC(s):"Select your trading account",icon:uC(t),items:fC(t,n)})}catch{return}gC(r??null,t)}function bC(){const e=tC();return l.jsx(eC,{...e})}function vC({children:e,variant:t="chart",scanResultUrl:n,onScanResultUrlChange:r,onScanResultLoad:s,chartWidget:i}){const o=i!==void 0,a=as(),c=t0({symbols:a,defaultPanelAfterConfirm:t==="news"?"market":"mini"}),d=S.useRef(null),u=S.useRef(null),[f,m]=S.useState(null),h=S.useCallback($=>{m($)},[]),[g,p]=S.useState(null),[y,b]=S.useState(null),v=o?i??null:g,[x,_]=S.useState(()=>si(a)),[C,k]=S.useState(n??null);S.useEffect(()=>{k(n??null)},[n]);const{isLoading:T}=kp(c.selectedLogin),R=S.useRef(null),[A,O]=S.useState(c.selectedLogin),D=S.useCallback($=>{$!==c.selectedLogin&&c.setSelectedLogin($)},[c.selectedLogin,c.setSelectedLogin]),L=T&&c.selectedLogin!==A,B=S.useCallback($=>{_($)},[]),U=S.useCallback($=>{k($),r==null||r($)},[r]),{chartContainer:z}=n0({chartWidget:o?v:null,symbols:a,chartSlotElement:o?f:null,onSymbolTickerChange:B,onScanResultUrlChange:U,selectSymbolTickerRef:u}),F=o?z:y,I=S.useCallback($=>{var j;(j=u.current)==null||j.call(u,$)},[]),N=S.useMemo(()=>({controlsRef:d,onSymbolTickerChange:B,onScanResultUrlChange:U,onChartWidgetChange:o?()=>{}:p,onChartContainerChange:o?()=>{}:b,selectSymbolTickerRef:u}),[U,B,o]);S.useEffect(()=>{if(t==="news")return d.current={open:c.openMarketPanel,setSelectedLogin:c.setSelectedLogin},()=>{d.current=null}},[c.openMarketPanel,c.setSelectedLogin,t]),S.useEffect(()=>{!T&&c.selectedLogin!==A&&O(c.selectedLogin)},[T,A,c.selectedLogin]),S.useEffect(()=>{if(!v)return;let $=!1;return(async()=>{try{const se=await yC(v,()=>!$);if($){se==null||se.remove();return}R.current=se,wd(R.current,{accountOptions:c.accountOptions,selectedLogin:c.selectedLogin,isAccountsLoading:c.isAccountsLoading,isAccountDataLoading:L},D,F)}catch{}})(),()=>{var se;$=!0,(se=R.current)==null||se.remove(),R.current=null}},[F,v]),S.useEffect(()=>{wd(R.current,{accountOptions:c.accountOptions,selectedLogin:c.selectedLogin,isAccountsLoading:c.isAccountsLoading,isAccountDataLoading:L},D,F)},[F,D,L,c.accountOptions,c.isAccountsLoading,c.selectedLogin]);const M=e??(o?null:l.jsx(bC,{}));return t==="news"?l.jsx(vd,{value:N,children:l.jsxs("div",{className:"web-trading-widget-trading-layout web-trading-widget-trading-layout--news",children:[l.jsxs("div",{className:"web-trading-widget-trading-layout__chart-slot",children:[l.jsx(rp,{}),l.jsx(uf,{open:!c.hasConfirmedAccount,isAccountsLoading:c.isAccountsLoading,accountOptions:c.accountOptions,onConfirm:c.confirmAccountSelection}),l.jsxs("div",{className:"web-trading-widget-trading-layout__news-body",children:[o?l.jsx("div",{ref:h,className:"web-trading-widget-trading-layout__host-chart-slot",children:M}):M,l.jsx(iC,{symbolTicker:x,chartWidget:v,orderState:c})]})]}),l.jsx(Dp,{onCreateNewOrder:()=>{var $;return($=d.current)==null?void 0:$.open()}})]})}):l.jsx(vd,{value:N,children:l.jsxs("div",{className:"web-trading-widget-trading-layout",children:[l.jsxs("div",{className:"web-trading-widget-trading-layout__body",children:[l.jsxs("div",{className:"web-trading-widget-trading-layout__chart-area",children:[l.jsx(dS,{controlsRef:d,symbolTicker:x,chartWidget:v,scanResultUrl:C,orderState:c}),l.jsx("div",{ref:o?h:void 0,className:"web-trading-widget-trading-layout__chart-slot",children:M})]}),l.jsx(XS,{symbolTicker:x,orderState:c,scanResultUrl:C,initialTab:C?"scan":"trade",onScanResultLoad:s},C??"trade-only")]}),l.jsx(Rp,{symbolTicker:x,onSymbolChange:I,onCreateNewOrder:()=>{var $;return($=d.current)==null?void 0:$.open()}})]})})}function wC({baseUrl:e,token:t,variant:n="chart",scanResultUrl:r,onScanResultLoad:s,onScanResultUrlChange:i,children:o,chartWidget:a}){return l.jsx($x,{token:t,children:l.jsx(Np,{children:l.jsx(np,{baseUrl:e,children:l.jsx(vC,{variant:n,scanResultUrl:r,onScanResultUrlChange:i,chartWidget:a,onScanResultLoad:s,children:o})})})})}exports.ChartNewsOrdersOverlay=AS;exports.WebTradingWidget=wC;
90
+ </svg>`,pp="data-opheleo-account-dropdown";function IC(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 mp(e){const[t]=e.label.split(" · ");return t??e.label}function UC(e){return`My Account — ${e.label} — ${e.balance.toFixed(2)} ${e.currency}`}function FC(e,t){const n=mp(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 gp(e){return e.isAccountsLoading||e.isAccountDataLoading}function yp(e){if(e.isAccountsLoading)return"My Account";if(e.isAccountDataLoading)return"My Account · Switching…";if(e.accountOptions.length===0)return"My Account · None";const t=mc(e);if(!t)return"My Account";const n=mp(t);return`My Account · ${t.login} · ${n}`}function BC(e){return gp(e)?hp:jC}function $C(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:FC(n,r),icon:r?MC:void 0,onSelect:()=>{r||t(n.login)}}})}function VC(e,t){var s,i;const n=e.querySelector(`[${pp}="true"]`);if(n instanceof HTMLElement)return n;const r=e.querySelectorAll('button, [role="button"], div');for(const o of r){if(!(o instanceof HTMLElement))continue;const a=((s=o.textContent)==null?void 0:s.trim())??"";if(!a.includes("My Account")&&a!==t)continue;let c=o;for(;c&&c!==e;){const d=((i=c.textContent)==null?void 0:i.trim())??"";if(c.tagName==="BUTTON"||c.getAttribute("role")==="button"||d.includes("My Account")&&c.querySelector("svg"))return c;c=c.parentElement}}return null}function HC(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 zC(e,t){e.setAttribute(pp,"true"),IC(e);const n=mc(t);if(!gp(t)&&n!==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}HC(e),e.style.border="1px solid transparent",e.style.borderRadius="6px",e.style.padding="0 10px"}function WC(e,t){if(!(e!=null&&e.isConnected))return;const n=yp(t),r=()=>{const s=VC(e,n);s&&zC(s,t)};r(),requestAnimationFrame(r)}async function GC(e,t=()=>!0){try{await e.headerReady()}catch{return null}if(!t())return null;try{return await e.createDropdown({title:"My Account",tooltip:"Select your trading account",align:"left",icon:hp,items:[{title:"Loading accounts…",onSelect:()=>{}}]})}catch{return null}}function Sd(e,t,n,r){if(!e||(r==null?void 0:r.isConnected)===!1)return;const s=mc(t);try{e.applyOptions({title:yp(t),tooltip:s?UC(s):"Select your trading account",icon:BC(t),items:$C(t,n)})}catch{return}WC(r??null,t)}function KC(){const e=AC();return l.jsx(OC,{...e})}function qC({children:e,variant:t="chart",scanResultUrl:n,onScanResultUrlChange:r,onScanResultLoad:s,chartWidget:i,backUrl:o,createAccountUrl:a,dealDetailUrl:c}){const d=i!==void 0,u=cs(),f=A0({symbols:u,defaultPanelAfterConfirm:t==="news"?"market":"mini"}),m=S.useRef(null),p=S.useRef(null),[g,h]=S.useState(null),y=S.useCallback(Z=>{h(Z)},[]),[b,v]=S.useState(null),[x,_]=S.useState(null),C=d?i??null:b,[k,T]=S.useState(()=>oi(u)),[A,N]=S.useState(n??null);S.useEffect(()=>{N(n??null)},[n]);const{isLoading:O}=Rh(f.selectedLogin),L=S.useRef(null),[R,$]=S.useState(f.selectedLogin),j=S.useCallback(Z=>{Z!==f.selectedLogin&&f.setSelectedLogin(Z)},[f.selectedLogin,f.setSelectedLogin]),H=O&&f.selectedLogin!==R,F=S.useCallback(Z=>{T(Z)},[]),I=S.useCallback(Z=>{N(Z),r==null||r(Z)},[r]),{chartContainer:D}=N0({chartWidget:d?C:null,symbols:u,chartSlotElement:d?g:null,onSymbolTickerChange:F,onScanResultUrlChange:I,selectSymbolTickerRef:p}),U=d?D:x,K=S.useCallback(Z=>{var fe;(fe=p.current)==null||fe.call(p,Z)},[]),M=S.useMemo(()=>({controlsRef:m,onSymbolTickerChange:F,onScanResultUrlChange:I,onChartWidgetChange:d?()=>{}:v,onChartContainerChange:d?()=>{}:_,selectSymbolTickerRef:p}),[I,F,d]);S.useEffect(()=>{if(t==="news")return m.current={open:f.openMarketPanel,setSelectedLogin:f.setSelectedLogin},()=>{m.current=null}},[f.openMarketPanel,f.setSelectedLogin,t]),S.useEffect(()=>{!O&&f.selectedLogin!==R&&$(f.selectedLogin)},[O,R,f.selectedLogin]),S.useEffect(()=>{if(!C)return;let Z=!1;return(async()=>{try{const de=await GC(C,()=>!Z);if(Z){de==null||de.remove();return}L.current=de,Sd(L.current,{accountOptions:f.accountOptions,selectedLogin:f.selectedLogin,isAccountsLoading:f.isAccountsLoading,isAccountDataLoading:H},j,U)}catch{}})(),()=>{var de;Z=!0,(de=L.current)==null||de.remove(),L.current=null}},[U,C]),S.useEffect(()=>{Sd(L.current,{accountOptions:f.accountOptions,selectedLogin:f.selectedLogin,isAccountsLoading:f.isAccountsLoading,isAccountDataLoading:H},j,U)},[U,j,H,f.accountOptions,f.isAccountsLoading,f.selectedLogin]);const le=e??(d?null:l.jsx(KC,{}));return t==="news"?l.jsx(xd,{value:M,children:l.jsxs("div",{className:"web-trading-widget-trading-layout web-trading-widget-trading-layout--news",children:[l.jsxs("div",{className:"web-trading-widget-trading-layout__chart-slot",children:[l.jsx(oh,{}),l.jsx(pf,{open:!f.hasConfirmedAccount,isAccountsLoading:f.isAccountsLoading,accountOptions:f.accountOptions,onConfirm:f.confirmAccountSelection,backUrl:o,createAccountUrl:a}),l.jsxs("div",{className:"web-trading-widget-trading-layout__news-body",children:[d?l.jsx("div",{ref:y,className:"web-trading-widget-trading-layout__host-chart-slot",children:le}):le,l.jsx(LC,{symbolTicker:k,chartWidget:C,orderState:f})]})]}),l.jsx(Ih,{onCreateNewOrder:()=>{var Z;return(Z=m.current)==null?void 0:Z.open()}})]})}):l.jsx(xd,{value:M,children:l.jsxs("div",{className:"web-trading-widget-trading-layout",children:[l.jsxs("div",{className:"web-trading-widget-trading-layout__body",children:[l.jsxs("div",{className:"web-trading-widget-trading-layout__chart-area",children:[l.jsx(_S,{controlsRef:m,symbolTicker:k,chartWidget:C,scanResultUrl:A,orderState:f,backUrl:o,createAccountUrl:a}),l.jsx("div",{ref:d?y:void 0,className:"web-trading-widget-trading-layout__chart-slot",children:le})]}),l.jsx(P0,{symbolTicker:k,orderState:f,scanResultUrl:A,initialTab:A?"scan":"trade",onScanResultLoad:s},A??"trade-only")]}),l.jsx(jh,{symbolTicker:k,onSymbolChange:K,onCreateNewOrder:()=>{var Z;return(Z=m.current)==null?void 0:Z.open()},dealDetailUrl:c})]})})}function ZC({baseUrl:e,token:t,variant:n="chart",scanResultUrl:r,onScanResultLoad:s,onScanResultUrlChange:i,children:o,chartWidget:a,backUrl:c,createAccountUrl:d,dealDetailUrl:u}){return l.jsx(Wx,{token:t,children:l.jsx(Mh,{children:l.jsx(ih,{baseUrl:e,children:l.jsx(qC,{variant:n,scanResultUrl:r,onScanResultUrlChange:i,chartWidget:a,onScanResultLoad:s,backUrl:c,createAccountUrl:d,dealDetailUrl:u,children:o})})})})}exports.ChartNewsOrdersOverlay=i0;exports.WebTradingWidget=ZC;